gnucash master: Multiple changes pushed

Geert Janssens gjanssens at code.gnucash.org
Mon Aug 14 12:50:25 EDT 2017


Updated	 via  https://github.com/Gnucash/gnucash/commit/723530a9 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/3e3eead3 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/2a7f2f89 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/53736e08 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/4ce7be04 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/dfe8ea45 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/0c6da2f0 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/afecab33 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/83d14e1c (commit)
	 via  https://github.com/Gnucash/gnucash/commit/ffc640ba (commit)
	 via  https://github.com/Gnucash/gnucash/commit/9de9f536 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/785568b0 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/708a9a47 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/8687dfb1 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/848bb347 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/80be9621 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/342627d5 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/f7131762 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/ea0d4422 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/f34348a4 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/71ef0709 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/dd99d787 (commit)
	from  https://github.com/Gnucash/gnucash/commit/4f2d34f0 (commit)



commit 723530a9bc212a618bf6adf69d88fb9f8789ca17
Merge: 4f2d34f 3e3eead
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Mon Aug 14 18:49:50 2017 +0200

    Merge branch 'reorganize-source-dirs'


commit 3e3eead3c5288212a7161c647587752d98dbdfbe
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Mon Aug 14 18:17:13 2017 +0200

    Eliminate plugins directory
    
    bi-import and customer-import have been put with the other importers
    example is moved to gnc-module as, well, an example

diff --git a/configure.ac b/configure.ac
index c25e6df..c7e298d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1683,13 +1683,12 @@ AC_CONFIG_FILES(
   gnucash/import-export/aqb/Makefile
   gnucash/import-export/aqb/gschemas/Makefile
   gnucash/import-export/aqb/test/Makefile
-  gnucash/plugins/Makefile
-  gnucash/plugins/bi_import/Makefile
-  gnucash/plugins/bi_import/gtkbuilder/Makefile
-  gnucash/plugins/bi_import/ui/Makefile
-  gnucash/plugins/customer_import/Makefile
-  gnucash/plugins/customer_import/gtkbuilder/Makefile
-  gnucash/plugins/customer_import/ui/Makefile
+  gnucash/import-export/bi-import/Makefile
+  gnucash/import-export/bi-import/gtkbuilder/Makefile
+  gnucash/import-export/bi-import/ui/Makefile
+  gnucash/import-export/customer-import/Makefile
+  gnucash/import-export/customer-import/gtkbuilder/Makefile
+  gnucash/import-export/customer-import/ui/Makefile
   gnucash/python/Makefile
   gnucash/python/pycons/Makefile
   gnucash/register/Makefile
diff --git a/gnucash/CMakeLists.txt b/gnucash/CMakeLists.txt
index 4643428..361d34a 100644
--- a/gnucash/CMakeLists.txt
+++ b/gnucash/CMakeLists.txt
@@ -6,7 +6,6 @@ ADD_SUBDIRECTORY (gnome-utils)
 ADD_SUBDIRECTORY (gnome-search)
 ADD_SUBDIRECTORY (html)
 ADD_SUBDIRECTORY (import-export)
-ADD_SUBDIRECTORY (plugins)
 ADD_SUBDIRECTORY (python)
 ADD_SUBDIRECTORY (register)
 ADD_SUBDIRECTORY (report)
@@ -194,5 +193,5 @@ SET_LOCAL_DIST(gnucash_DIST_local CMakeLists.txt environment.in generate-gnc-scr
                Makefile.am ${gnucash_EXTRA_DIST})
 
 SET(gnucash_DIST ${gnucash_DIST_local} ${gnome_DIST} ${gnome_search_DIST}
-             ${gnome_utils_DIST} ${html_DIST} ${import_export_DIST} ${plugins_DIST} ${python_DIST} ${register_DIST} ${report_DIST}
+             ${gnome_utils_DIST} ${html_DIST} ${import_export_DIST} ${python_DIST} ${register_DIST} ${report_DIST}
              ${overrides_DIST} ${test_bin_DIST} PARENT_SCOPE)
diff --git a/gnucash/Makefile.am b/gnucash/Makefile.am
index 1c9d29e..9687a4f 100644
--- a/gnucash/Makefile.am
+++ b/gnucash/Makefile.am
@@ -14,7 +14,6 @@ SUBDIRS = \
   register \
   gnome \
   import-export \
-  plugins \
   . \
   ${OVERRIDES_DIR} \
   test
diff --git a/gnucash/gnucash-bin.c b/gnucash/gnucash-bin.c
index cea1f8b..f382019 100644
--- a/gnucash/gnucash-bin.c
+++ b/gnucash/gnucash-bin.c
@@ -503,13 +503,13 @@ load_gnucash_modules()
         { "gnucash/import-export/csv-export", 0, TRUE },
         { "gnucash/import-export/log-replay", 0, TRUE },
         { "gnucash/import-export/aqbanking", 0, TRUE },
+        { "gnucash/import-export/bi-import", 0, TRUE},
+        { "gnucash/import-export/customer-import", 0, TRUE},
         { "gnucash/report/report-system", 0, FALSE },
         { "gnucash/report/stylesheets", 0, FALSE },
         { "gnucash/report/locale-specific/us", 0, FALSE },
         { "gnucash/report/report-gnome", 0, FALSE },
         { "gnucash/python", 0, TRUE },
-        { "gnucash/plugins/bi_import", 0, TRUE},
-        { "gnucash/plugins/customer_import", 0, TRUE},
     };
 
     /* module initializations go here */
diff --git a/gnucash/import-export/CMakeLists.txt b/gnucash/import-export/CMakeLists.txt
index 4b9ba66..d10dd3c 100644
--- a/gnucash/import-export/CMakeLists.txt
+++ b/gnucash/import-export/CMakeLists.txt
@@ -4,8 +4,10 @@ ADD_SUBDIRECTORY(test)
 
 # ############################################################
 ADD_SUBDIRECTORY(aqb)
+ADD_SUBDIRECTORY(bi-import)
 ADD_SUBDIRECTORY(csv-exp)
 ADD_SUBDIRECTORY(csv-imp)
+ADD_SUBDIRECTORY(customer-import)
 ADD_SUBDIRECTORY(gschemas)
 ADD_SUBDIRECTORY(log-replay)
 ADD_SUBDIRECTORY(ofx)
@@ -79,8 +81,8 @@ SET_LOCAL_DIST(import_export_DIST_local CMakeLists.txt Makefile.am ${generic_imp
         ${generic_import_HEADERS} ${generic_import_GLADE} ${generic_import_noinst_HEADERS}
         ${generic_import_EXTRA_DIST})
 
-SET(import_export_DIST ${import_export_DIST_local} ${aqbanking_DIST}
-        ${csv_export_DIST} ${csv_import_DIST}
+SET(import_export_DIST ${import_export_DIST_local} ${aqbanking_DIST} ${bi_import_DIST}
+        ${csv_export_DIST} ${csv_import_DIST} ${customer_import_DIST}
         ${generic_import_gschema_DIST} ${log_report_DIST} ${ofx_DIST} ${qif_DIST} ${qif_import_DIST}
         ${test_generic_import_DIST}
         PARENT_SCOPE)
diff --git a/gnucash/import-export/Makefile.am b/gnucash/import-export/Makefile.am
index 3fdcf96..d0bb4bf 100644
--- a/gnucash/import-export/Makefile.am
+++ b/gnucash/import-export/Makefile.am
@@ -4,8 +4,18 @@ endif
 if WITH_AQBANKING
     AQBANKING_DIR=aqb
 endif
-SUBDIRS = . gschemas qif qif-imp \
-	${OFX_DIR} ${AQBANKING_DIR} log-replay test csv-imp csv-exp
+SUBDIRS = . \
+  gschemas \
+  ${AQBANKING_DIR} \
+  bi-import \
+  csv-exp \
+  csv-imp \
+  customer-import \
+  log-replay \
+  ${OFX_DIR} \
+  qif \
+  qif-imp \
+  test
 
 pkglib_LTLIBRARIES=libgncmod-generic-import.la
 
diff --git a/gnucash/plugins/bi_import/CMakeLists.txt b/gnucash/import-export/bi-import/CMakeLists.txt
similarity index 81%
rename from gnucash/plugins/bi_import/CMakeLists.txt
rename to gnucash/import-export/bi-import/CMakeLists.txt
index 76d04b5..ec5efeb 100644
--- a/gnucash/plugins/bi_import/CMakeLists.txt
+++ b/gnucash/import-export/bi-import/CMakeLists.txt
@@ -20,9 +20,9 @@ SET(bi_import_noinst_HEADERS
   dialog-bi-import.h
 )
 
-ADD_LIBRARY(gncmod-bi_import ${bi_import_noinst_HEADERS} ${bi_import_SOURCES})
+ADD_LIBRARY(gncmod-bi-import ${bi_import_noinst_HEADERS} ${bi_import_SOURCES})
 
-TARGET_LINK_LIBRARIES(gncmod-bi_import
+TARGET_LINK_LIBRARIES(gncmod-bi-import
   gncmod-gnome-utils
   gncmod-gnome-search
   gncmod-app-utils
@@ -32,14 +32,14 @@ TARGET_LINK_LIBRARIES(gncmod-bi_import
   gnc-gnome
 )
 
-TARGET_INCLUDE_DIRECTORIES(gncmod-bi_import
+TARGET_INCLUDE_DIRECTORIES(gncmod-bi-import
   PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
   PRIVATE ${CMAKE_SOURCE_DIR}/gnucash/gnome
 )
 
-TARGET_COMPILE_DEFINITIONS(gncmod-bi_import PRIVATE -DG_LOG_DOMAIN=\"gnc.plugin.bi-import\")
+TARGET_COMPILE_DEFINITIONS(gncmod-bi-import PRIVATE -DG_LOG_DOMAIN=\"gnc.plugin.bi-import\")
 
-INSTALL(TARGETS gncmod-bi_import
+INSTALL(TARGETS gncmod-bi-import
   LIBRARY DESTINATION lib/gnucash
   ARCHIVE DESTINATION lib/gnucash
   RUNTIME DESTINATION bin)
diff --git a/gnucash/plugins/bi_import/Makefile.am b/gnucash/import-export/bi-import/Makefile.am
similarity index 97%
rename from gnucash/plugins/bi_import/Makefile.am
rename to gnucash/import-export/bi-import/Makefile.am
index e1a87e9..6219392 100644
--- a/gnucash/plugins/bi_import/Makefile.am
+++ b/gnucash/import-export/bi-import/Makefile.am
@@ -1,6 +1,6 @@
 SUBDIRS = ui gtkbuilder .
 
-pkglib_LTLIBRARIES = libgncmod-bi_import.la
+pkglib_LTLIBRARIES = libgncmod-bi-import.la
 
 libgncmod_bi_import_la_SOURCES = \
   gnc-plugin-bi-import.c \
diff --git a/gnucash/plugins/bi_import/README b/gnucash/import-export/bi-import/README
similarity index 100%
rename from gnucash/plugins/bi_import/README
rename to gnucash/import-export/bi-import/README
diff --git a/gnucash/plugins/bi_import/dialog-bi-import-gui.c b/gnucash/import-export/bi-import/dialog-bi-import-gui.c
similarity index 100%
rename from gnucash/plugins/bi_import/dialog-bi-import-gui.c
rename to gnucash/import-export/bi-import/dialog-bi-import-gui.c
diff --git a/gnucash/plugins/bi_import/dialog-bi-import-gui.h b/gnucash/import-export/bi-import/dialog-bi-import-gui.h
similarity index 100%
rename from gnucash/plugins/bi_import/dialog-bi-import-gui.h
rename to gnucash/import-export/bi-import/dialog-bi-import-gui.h
diff --git a/gnucash/plugins/bi_import/dialog-bi-import-helper.c b/gnucash/import-export/bi-import/dialog-bi-import-helper.c
similarity index 100%
rename from gnucash/plugins/bi_import/dialog-bi-import-helper.c
rename to gnucash/import-export/bi-import/dialog-bi-import-helper.c
diff --git a/gnucash/plugins/bi_import/dialog-bi-import-helper.h b/gnucash/import-export/bi-import/dialog-bi-import-helper.h
similarity index 100%
rename from gnucash/plugins/bi_import/dialog-bi-import-helper.h
rename to gnucash/import-export/bi-import/dialog-bi-import-helper.h
diff --git a/gnucash/plugins/bi_import/dialog-bi-import.c b/gnucash/import-export/bi-import/dialog-bi-import.c
similarity index 100%
rename from gnucash/plugins/bi_import/dialog-bi-import.c
rename to gnucash/import-export/bi-import/dialog-bi-import.c
diff --git a/gnucash/plugins/bi_import/dialog-bi-import.h b/gnucash/import-export/bi-import/dialog-bi-import.h
similarity index 100%
rename from gnucash/plugins/bi_import/dialog-bi-import.h
rename to gnucash/import-export/bi-import/dialog-bi-import.h
diff --git a/gnucash/plugins/bi_import/gnc-plugin-bi-import.c b/gnucash/import-export/bi-import/gnc-plugin-bi-import.c
similarity index 100%
rename from gnucash/plugins/bi_import/gnc-plugin-bi-import.c
rename to gnucash/import-export/bi-import/gnc-plugin-bi-import.c
diff --git a/gnucash/plugins/bi_import/gnc-plugin-bi-import.h b/gnucash/import-export/bi-import/gnc-plugin-bi-import.h
similarity index 97%
rename from gnucash/plugins/bi_import/gnc-plugin-bi-import.h
rename to gnucash/import-export/bi-import/gnc-plugin-bi-import.h
index cf1dc32..074be3d 100644
--- a/gnucash/plugins/bi_import/gnc-plugin-bi-import.h
+++ b/gnucash/import-export/bi-import/gnc-plugin-bi-import.h
@@ -44,7 +44,7 @@ G_BEGIN_DECLS
 #define GNC_IS_PLUGIN_BI_IMPORT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),  GNC_TYPE_PLUGIN_BI_IMPORT))
 #define GNC_PLUGIN_BI_IMPORT_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj),  GNC_TYPE_PLUGIN_BI_IMPORT, GncPluginbi_importClass))
 
-#define GNC_PLUGIN_BI_IMPORT_NAME "gnc-plugin-bi_import"
+#define GNC_PLUGIN_BI_IMPORT_NAME "gnc-plugin-bi-import"
 
 /* typedefs & structures */
 typedef struct
diff --git a/gnucash/plugins/bi_import/gncmod-bi-import.c b/gnucash/import-export/bi-import/gncmod-bi-import.c
similarity index 96%
rename from gnucash/plugins/bi_import/gncmod-bi-import.c
rename to gnucash/import-export/bi-import/gncmod-bi-import.c
index 24b45c9..aaa5cbd 100644
--- a/gnucash/plugins/bi_import/gncmod-bi-import.c
+++ b/gnucash/import-export/bi-import/gncmod-bi-import.c
@@ -53,13 +53,13 @@ int libgncmod_bi_import_gnc_module_age      = 0;
 char *
 libgncmod_bi_import_gnc_module_path (void)
 {
-    return g_strdup("gnucash/plugins/bi_import");
+    return g_strdup("gnucash/import-export/bi-import");
 }
 
 char *
 libgncmod_bi_import_gnc_module_description (void)
 {
-    return g_strdup("The GnuCash bi_import plugin");
+    return g_strdup("The GnuCash bi-import plugin");
 }
 
 int
diff --git a/gnucash/plugins/bi_import/gtkbuilder/CMakeLists.txt b/gnucash/import-export/bi-import/gtkbuilder/CMakeLists.txt
similarity index 100%
rename from gnucash/plugins/bi_import/gtkbuilder/CMakeLists.txt
rename to gnucash/import-export/bi-import/gtkbuilder/CMakeLists.txt
diff --git a/gnucash/plugins/bi_import/gtkbuilder/Makefile.am b/gnucash/import-export/bi-import/gtkbuilder/Makefile.am
similarity index 100%
rename from gnucash/plugins/bi_import/gtkbuilder/Makefile.am
rename to gnucash/import-export/bi-import/gtkbuilder/Makefile.am
diff --git a/gnucash/plugins/bi_import/gtkbuilder/dialog-bi-import-gui.glade b/gnucash/import-export/bi-import/gtkbuilder/dialog-bi-import-gui.glade
similarity index 100%
rename from gnucash/plugins/bi_import/gtkbuilder/dialog-bi-import-gui.glade
rename to gnucash/import-export/bi-import/gtkbuilder/dialog-bi-import-gui.glade
diff --git a/gnucash/plugins/bi_import/regex.txt b/gnucash/import-export/bi-import/regex.txt
similarity index 100%
rename from gnucash/plugins/bi_import/regex.txt
rename to gnucash/import-export/bi-import/regex.txt
diff --git a/gnucash/plugins/bi_import/ui/CMakeLists.txt b/gnucash/import-export/bi-import/ui/CMakeLists.txt
similarity index 100%
rename from gnucash/plugins/bi_import/ui/CMakeLists.txt
rename to gnucash/import-export/bi-import/ui/CMakeLists.txt
diff --git a/gnucash/plugins/bi_import/ui/Makefile.am b/gnucash/import-export/bi-import/ui/Makefile.am
similarity index 100%
rename from gnucash/plugins/bi_import/ui/Makefile.am
rename to gnucash/import-export/bi-import/ui/Makefile.am
diff --git a/gnucash/plugins/bi_import/ui/gnc-plugin-bi-import-ui.xml b/gnucash/import-export/bi-import/ui/gnc-plugin-bi-import-ui.xml
similarity index 100%
rename from gnucash/plugins/bi_import/ui/gnc-plugin-bi-import-ui.xml
rename to gnucash/import-export/bi-import/ui/gnc-plugin-bi-import-ui.xml
diff --git a/gnucash/plugins/customer_import/CMakeLists.txt b/gnucash/import-export/customer-import/CMakeLists.txt
similarity index 69%
rename from gnucash/plugins/customer_import/CMakeLists.txt
rename to gnucash/import-export/customer-import/CMakeLists.txt
index c0b9e9b..014c641 100644
--- a/gnucash/plugins/customer_import/CMakeLists.txt
+++ b/gnucash/import-export/customer-import/CMakeLists.txt
@@ -2,8 +2,8 @@ ADD_SUBDIRECTORY(gtkbuilder)
 ADD_SUBDIRECTORY(ui)
 
 SET(customer_import_SOURCES
-  gnc-plugin-customer_import.c
-  libgncmod-customer_import.c
+  gnc-plugin-customer-import.c
+  gncmod-customer-import.c
   dialog-customer-import-gui.c
   dialog-customer-import.c
 )
@@ -13,24 +13,24 @@ SET_SOURCE_FILES_PROPERTIES (${customer_import_SOURCES} PROPERTIES OBJECT_DEPEND
 
 
 SET(customer_import_noinst_HEADERS
-  gnc-plugin-customer_import.h
+  gnc-plugin-customer-import.h
   dialog-customer-import-gui.h
   dialog-customer-import.h
 )
 
-ADD_LIBRARY(gncmod-customer_import ${customer_import_SOURCES} ${customer_input_noinst_HEADERS})
+ADD_LIBRARY(gncmod-customer-import ${customer_import_SOURCES} ${customer_input_noinst_HEADERS})
 
-TARGET_LINK_LIBRARIES(gncmod-customer_import gnc-gnome gncmod-gnome-utils gncmod-app-utils
+TARGET_LINK_LIBRARIES(gncmod-customer-import gnc-gnome gncmod-gnome-utils gncmod-app-utils
      gncmod-engine gnc-core-utils gnc-module ${GLIB2_LDFLAGS})
 
-TARGET_INCLUDE_DIRECTORIES(gncmod-bi_import
+TARGET_INCLUDE_DIRECTORIES(gncmod-customer-import
   PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
   PRIVATE ${CMAKE_SOURCE_DIR}/gnucash/gnome
 )
 
-TARGET_COMPILE_DEFINITIONS(gncmod-customer_import PRIVATE -DG_LOG_DOMAIN=\"gnc.plugin.customer_import\")
+TARGET_COMPILE_DEFINITIONS(gncmod-customer-import PRIVATE -DG_LOG_DOMAIN=\"gnc.plugin.customer-import\")
 
-INSTALL(TARGETS gncmod-customer_import
+INSTALL(TARGETS gncmod-customer-import
   LIBRARY DESTINATION lib/gnucash
   ARCHIVE DESTINATION lib/gnucash
   RUNTIME DESTINATION bin)
diff --git a/gnucash/plugins/customer_import/Makefile.am b/gnucash/import-export/customer-import/Makefile.am
similarity index 86%
rename from gnucash/plugins/customer_import/Makefile.am
rename to gnucash/import-export/customer-import/Makefile.am
index a6577c8..3596dec 100644
--- a/gnucash/plugins/customer_import/Makefile.am
+++ b/gnucash/import-export/customer-import/Makefile.am
@@ -1,15 +1,15 @@
 SUBDIRS = ui gtkbuilder .
 
-pkglib_LTLIBRARIES = libgncmod-customer_import.la
+pkglib_LTLIBRARIES = libgncmod-customer-import.la
 
 libgncmod_customer_import_la_SOURCES = \
-  gnc-plugin-customer_import.c \
-  libgncmod-customer_import.c \
+  gnc-plugin-customer-import.c \
+  gncmod-customer-import.c \
   dialog-customer-import-gui.c \
   dialog-customer-import.c
 
 noinst_HEADERS = \
-  gnc-plugin-customer_import.h \
+  gnc-plugin-customer-import.h \
   dialog-customer-import-gui.h \
   dialog-customer-import.h
 
@@ -43,6 +43,6 @@ AM_CPPFLAGS = \
   ${GTK_CFLAGS} \
   ${GLIB_CFLAGS}
 
-AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.plugin.customer_import\"
+AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.plugin.customer-import\"
 
 EXTRA_DIST = CMakeLists.txt
diff --git a/gnucash/plugins/customer_import/dialog-customer-import-gui.c b/gnucash/import-export/customer-import/dialog-customer-import-gui.c
similarity index 99%
rename from gnucash/plugins/customer_import/dialog-customer-import-gui.c
rename to gnucash/import-export/customer-import/dialog-customer-import-gui.c
index b87ed73..a384b32 100644
--- a/gnucash/plugins/customer_import/dialog-customer-import-gui.c
+++ b/gnucash/import-export/customer-import/dialog-customer-import-gui.c
@@ -84,7 +84,7 @@ gnc_plugin_customer_import_showGUI(void)
     GtkTreeViewColumn *column;
 
     // if window exists already, activate it
-    glist = gnc_find_gui_components ("dialog-customer_import_gui", NULL, NULL);
+    glist = gnc_find_gui_components ("dialog-customer-import-gui", NULL, NULL);
     if (glist)
     {
         // window found
@@ -142,7 +142,7 @@ gnc_plugin_customer_import_showGUI(void)
     CREATE_COLUMN ("shipfax", CI_SHIPFAX);
     CREATE_COLUMN ("shipemail", CI_SHIPEMAIL);
 
-    gui->component_id = gnc_register_gui_component ("dialog-customer_import_gui",
+    gui->component_id = gnc_register_gui_component ("dialog-customer-import-gui",
                         NULL,
                         gnc_customer_import_gui_close_handler,
                         gui);
diff --git a/gnucash/plugins/customer_import/dialog-customer-import-gui.h b/gnucash/import-export/customer-import/dialog-customer-import-gui.h
similarity index 100%
rename from gnucash/plugins/customer_import/dialog-customer-import-gui.h
rename to gnucash/import-export/customer-import/dialog-customer-import-gui.h
diff --git a/gnucash/plugins/customer_import/dialog-customer-import.c b/gnucash/import-export/customer-import/dialog-customer-import.c
similarity index 100%
rename from gnucash/plugins/customer_import/dialog-customer-import.c
rename to gnucash/import-export/customer-import/dialog-customer-import.c
diff --git a/gnucash/plugins/customer_import/dialog-customer-import.h b/gnucash/import-export/customer-import/dialog-customer-import.h
similarity index 98%
rename from gnucash/plugins/customer_import/dialog-customer-import.h
rename to gnucash/import-export/customer-import/dialog-customer-import.h
index d7a29b4..526cb35 100644
--- a/gnucash/plugins/customer_import/dialog-customer-import.h
+++ b/gnucash/import-export/customer-import/dialog-customer-import.h
@@ -1,5 +1,5 @@
 /*
- * dialog-customer_import.h --
+ * dialog-customer-import.h --
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
diff --git a/gnucash/plugins/customer_import/gnc-plugin-customer_import.c b/gnucash/import-export/customer-import/gnc-plugin-customer-import.c
similarity index 93%
rename from gnucash/plugins/customer_import/gnc-plugin-customer_import.c
rename to gnucash/import-export/customer-import/gnc-plugin-customer-import.c
index 4ab4260..986cd6f 100644
--- a/gnucash/plugins/customer_import/gnc-plugin-customer_import.c
+++ b/gnucash/import-export/customer-import/gnc-plugin-customer-import.c
@@ -1,5 +1,5 @@
 /*
- * gnc-plugin-customer_import.c --
+ * gnc-plugin-customer-import.c --
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
@@ -21,7 +21,7 @@
 
 /**
  * @internal
- * @file gnc-plugin-customer_import.c
+ * @file gnc-plugin-customer-import.c
  * @brief Plugin registration of the customer_import plugin
  * @author Copyright (C) 2009 Sebastian Held <sebastian.held at gmx.de>
  */
@@ -34,7 +34,7 @@
 
 #include "dialog-utils.h"
 
-#include "gnc-plugin-customer_import.h"
+#include "gnc-plugin-customer-import.h"
 #include "dialog-customer-import-gui.h"
 
 /* This static indicates the debugging module that this .o belongs to.  */
@@ -47,8 +47,8 @@ static void gnc_plugin_customer_import_finalize           (GObject *object);
 /* Command callbacks */
 static void gnc_plugin_customer_import_cmd_test (GtkAction *action, GncMainWindowActionData *data);
 
-#define PLUGIN_ACTIONS_NAME "gnc-plugin-customer_import-actions"
-#define PLUGIN_UI_FILENAME  "gnc-plugin-customer_import-ui.xml"
+#define PLUGIN_ACTIONS_NAME "gnc-plugin-customer-import-actions"
+#define PLUGIN_UI_FILENAME  "gnc-plugin-customer-import-ui.xml"
 
 static GtkActionEntry gnc_plugin_actions [] =
 {
diff --git a/gnucash/plugins/customer_import/gnc-plugin-customer_import.h b/gnucash/import-export/customer-import/gnc-plugin-customer-import.h
similarity index 94%
rename from gnucash/plugins/customer_import/gnc-plugin-customer_import.h
rename to gnucash/import-export/customer-import/gnc-plugin-customer-import.h
index 1b83f02..43fde78 100644
--- a/gnucash/plugins/customer_import/gnc-plugin-customer_import.h
+++ b/gnucash/import-export/customer-import/gnc-plugin-customer-import.h
@@ -1,5 +1,5 @@
 /*
- * gnc-plugin-customer_import.h --
+ * gnc-plugin-customer-import.h --
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
@@ -22,7 +22,7 @@
 /**
  * @addtogroup Tools
  * @{
- * @file gnc-plugin-customer_import.h
+ * @file gnc-plugin-customer-import.h
  * @brief Plugin registration of the customer_import module
  * @author Copyright (C) 2009 Sebastian Held <sebastian.held at gmx.de>
  */
@@ -44,7 +44,7 @@ G_BEGIN_DECLS
 #define GNC_IS_PLUGIN_customer_import_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),  GNC_TYPE_PLUGIN_customer_import))
 #define GNC_PLUGIN_customer_import_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj),  GNC_TYPE_PLUGIN_customer_import, GncPlugincustomer_importClass))
 
-#define GNC_PLUGIN_customer_import_NAME "gnc-plugin-customer_import"
+#define GNC_PLUGIN_customer_import_NAME "gnc-plugin-customer-import"
 
 /* typedefs & structures */
 typedef struct
diff --git a/gnucash/plugins/customer_import/libgncmod-customer_import.c b/gnucash/import-export/customer-import/gncmod-customer-import.c
similarity index 95%
rename from gnucash/plugins/customer_import/libgncmod-customer_import.c
rename to gnucash/import-export/customer-import/gncmod-customer-import.c
index c76725d..c127c1b 100644
--- a/gnucash/plugins/customer_import/libgncmod-customer_import.c
+++ b/gnucash/import-export/customer-import/gncmod-customer-import.c
@@ -1,5 +1,5 @@
 /*********************************************************************
- * gncmod-customer_import.c
+ * gncmod-customer-import.c
  * module definition/initialization for the customer_import GNOME UI module
  *
  * Copyright (c) 2009 Sebastian Held <sebastian.held at gmx.de>
@@ -37,7 +37,7 @@
 #include "gnc-module-api.h"
 
 #include "gnc-plugin-manager.h"
-#include "gnc-plugin-customer_import.h"
+#include "gnc-plugin-customer-import.h"
 
 GNC_MODULE_API_DECL(libgncmod_customer_import);
 
@@ -53,7 +53,7 @@ int libgncmod_customer_import_gnc_module_age      = 0;
 char *
 libgncmod_customer_import_gnc_module_path (void)
 {
-    return g_strdup("gnucash/plugins/customer_import");
+    return g_strdup("gnucash/import-export/customer-import");
 }
 
 char *
diff --git a/gnucash/plugins/customer_import/gtkbuilder/CMakeLists.txt b/gnucash/import-export/customer-import/gtkbuilder/CMakeLists.txt
similarity index 100%
rename from gnucash/plugins/customer_import/gtkbuilder/CMakeLists.txt
rename to gnucash/import-export/customer-import/gtkbuilder/CMakeLists.txt
diff --git a/gnucash/plugins/customer_import/gtkbuilder/Makefile.am b/gnucash/import-export/customer-import/gtkbuilder/Makefile.am
similarity index 100%
rename from gnucash/plugins/customer_import/gtkbuilder/Makefile.am
rename to gnucash/import-export/customer-import/gtkbuilder/Makefile.am
diff --git a/gnucash/plugins/customer_import/gtkbuilder/dialog-customer-import-gui.glade b/gnucash/import-export/customer-import/gtkbuilder/dialog-customer-import-gui.glade
similarity index 100%
rename from gnucash/plugins/customer_import/gtkbuilder/dialog-customer-import-gui.glade
rename to gnucash/import-export/customer-import/gtkbuilder/dialog-customer-import-gui.glade
diff --git a/gnucash/plugins/customer_import/ui/CMakeLists.txt b/gnucash/import-export/customer-import/ui/CMakeLists.txt
similarity index 90%
rename from gnucash/plugins/customer_import/ui/CMakeLists.txt
rename to gnucash/import-export/customer-import/ui/CMakeLists.txt
index c70156e..d62d64b 100644
--- a/gnucash/plugins/customer_import/ui/CMakeLists.txt
+++ b/gnucash/import-export/customer-import/ui/CMakeLists.txt
@@ -8,4 +8,4 @@ INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
     PATTERN Makefile.* EXCLUDE
     PATTERN CMakeLists.txt EXCLUDE)
 
-SET_DIST_LIST(customer_import_ui_DIST CMakeLists.txt Makefile.am gnc-plugin-customer_import-ui.xml)
\ No newline at end of file
+SET_DIST_LIST(customer_import_ui_DIST CMakeLists.txt Makefile.am gnc-plugin-customer-import-ui.xml)
diff --git a/gnucash/plugins/customer_import/ui/Makefile.am b/gnucash/import-export/customer-import/ui/Makefile.am
similarity index 67%
rename from gnucash/plugins/customer_import/ui/Makefile.am
rename to gnucash/import-export/customer-import/ui/Makefile.am
index 25ebdff..56416b7 100644
--- a/gnucash/plugins/customer_import/ui/Makefile.am
+++ b/gnucash/import-export/customer-import/ui/Makefile.am
@@ -1,5 +1,5 @@
 uidir = $(GNC_UI_DIR)
 ui_DATA = \
-	gnc-plugin-customer_import-ui.xml
+	gnc-plugin-customer-import-ui.xml
 
 EXTRA_DIST = $(ui_DATA) CMakeLists.txt
diff --git a/gnucash/plugins/customer_import/ui/gnc-plugin-customer_import-ui.xml b/gnucash/import-export/customer-import/ui/gnc-plugin-customer-import-ui.xml
similarity index 92%
rename from gnucash/plugins/customer_import/ui/gnc-plugin-customer_import-ui.xml
rename to gnucash/import-export/customer-import/ui/gnc-plugin-customer-import-ui.xml
index 2bbd4ba..3b7e3f2 100644
--- a/gnucash/plugins/customer_import/ui/gnc-plugin-customer_import-ui.xml
+++ b/gnucash/import-export/customer-import/ui/gnc-plugin-customer-import-ui.xml
@@ -4,7 +4,7 @@
       <menu name="FileImport" action="FileImportAction">
           <placeholder name="FileImportPlaceholder">
            <menuitem name="customer_import" action="customer_importAction"/>
-      	</placeholder>
+          </placeholder>
       </menu>
     </menu>
   </menubar>
diff --git a/gnucash/plugins/CMakeLists.txt b/gnucash/plugins/CMakeLists.txt
deleted file mode 100644
index 5c18ad8..0000000
--- a/gnucash/plugins/CMakeLists.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-ADD_SUBDIRECTORY(bi_import)
-ADD_SUBDIRECTORY(customer_import)
-ADD_SUBDIRECTORY(example)
-
-
-SET_LOCAL_DIST(plugins_DIST_local CMakeLists.txt Makefile.am)
-SET(plugins_DIST ${plugins_DIST_local} ${bi_import_DIST} ${customer_import_DIST} ${example_DIST} PARENT_SCOPE)
\ No newline at end of file
diff --git a/gnucash/plugins/Makefile.am b/gnucash/plugins/Makefile.am
deleted file mode 100644
index ad3351e..0000000
--- a/gnucash/plugins/Makefile.am
+++ /dev/null
@@ -1,13 +0,0 @@
-SUBDIRS=customer_import bi_import
-EXTRA_DIST = \
-	example/CMakeLists.txt \
-	example/Makefile.am \
-	example/gnc-plugin.example.c \
-	example/gnc-plugin.example.h \
-	example/gncmod-example.c \
-	example/glade/CMakeLists.txt \
-	example/glade/Makefile.am \
-	example/ui/CMakeLists.txt \
-	example/ui/Makefile.am \
-	example/ui/gnc-plugin-example-ui.xml \
-	CMakeLists.txt
diff --git a/libgnucash/gnc-module/CMakeLists.txt b/libgnucash/gnc-module/CMakeLists.txt
index 519bb1f..4e441c9 100644
--- a/libgnucash/gnc-module/CMakeLists.txt
+++ b/libgnucash/gnc-module/CMakeLists.txt
@@ -1,5 +1,6 @@
 # CMakeLists.txt for libgnucash/gnc-module
 ADD_SUBDIRECTORY(test)
+ADD_SUBDIRECTORY(example)
 
 IF (BUILDING_FROM_VCS)
   # Command to generate the swig-gnc-module.c wrapper file
@@ -66,4 +67,4 @@ GNC_ADD_SCHEME_TARGETS(scm-gnc-module
 
 SET_LOCAL_DIST(gnc_module_DIST_local CMakeLists.txt Makefile.am ${gnc_module_SOURCES} ${gnc_module_HEADERS}
         gnc-module.i gnc-module.scm README)
-SET(gnc_module_DIST ${gnc_module_DIST_local} ${test_gnc_module_DIST} PARENT_SCOPE)
+SET(gnc_module_DIST ${gnc_module_DIST_local} ${test_gnc_module_DIST} ${example_DIST} PARENT_SCOPE)
diff --git a/libgnucash/gnc-module/Makefile.am b/libgnucash/gnc-module/Makefile.am
index d7b3748..eb24ed5 100644
--- a/libgnucash/gnc-module/Makefile.am
+++ b/libgnucash/gnc-module/Makefile.am
@@ -42,10 +42,23 @@ endif
 endif
 endif
 
+EXAMPLE_EXTRA_DIST = \
+  example/CMakeLists.txt \
+  example/Makefile.am \
+  example/gnc-plugin.example.c \
+  example/gnc-plugin.example.h \
+  example/gncmod-example.c \
+  example/glade/CMakeLists.txt \
+  example/glade/Makefile.am \
+  example/ui/CMakeLists.txt \
+  example/ui/Makefile.am \
+  example/ui/gnc-plugin-example-ui.xml
+
 EXTRA_DIST = \
   ${gncscmmod_DATA} \
   gnc-module.i \
-  CMakeLists.txt
+  CMakeLists.txt \
+  ${EXAMPLE_EXTRA_DIST}
 
 if GNUCASH_SEPARATE_BUILDDIR
 #For executing test cases
diff --git a/gnucash/plugins/example/CMakeLists.txt b/libgnucash/gnc-module/example/CMakeLists.txt
similarity index 100%
rename from gnucash/plugins/example/CMakeLists.txt
rename to libgnucash/gnc-module/example/CMakeLists.txt
diff --git a/gnucash/plugins/example/Makefile.am b/libgnucash/gnc-module/example/Makefile.am
similarity index 100%
rename from gnucash/plugins/example/Makefile.am
rename to libgnucash/gnc-module/example/Makefile.am
diff --git a/gnucash/plugins/example/glade/CMakeLists.txt b/libgnucash/gnc-module/example/glade/CMakeLists.txt
similarity index 100%
rename from gnucash/plugins/example/glade/CMakeLists.txt
rename to libgnucash/gnc-module/example/glade/CMakeLists.txt
diff --git a/gnucash/plugins/example/glade/Makefile.am b/libgnucash/gnc-module/example/glade/Makefile.am
similarity index 100%
rename from gnucash/plugins/example/glade/Makefile.am
rename to libgnucash/gnc-module/example/glade/Makefile.am
diff --git a/gnucash/plugins/example/gnc-plugin.example.c b/libgnucash/gnc-module/example/gnc-plugin.example.c
similarity index 100%
rename from gnucash/plugins/example/gnc-plugin.example.c
rename to libgnucash/gnc-module/example/gnc-plugin.example.c
diff --git a/gnucash/plugins/example/gnc-plugin.example.h b/libgnucash/gnc-module/example/gnc-plugin.example.h
similarity index 100%
rename from gnucash/plugins/example/gnc-plugin.example.h
rename to libgnucash/gnc-module/example/gnc-plugin.example.h
diff --git a/gnucash/plugins/example/gncmod-example.c b/libgnucash/gnc-module/example/gncmod-example.c
similarity index 100%
rename from gnucash/plugins/example/gncmod-example.c
rename to libgnucash/gnc-module/example/gncmod-example.c
diff --git a/gnucash/plugins/example/ui/CMakeLists.txt b/libgnucash/gnc-module/example/ui/CMakeLists.txt
similarity index 100%
rename from gnucash/plugins/example/ui/CMakeLists.txt
rename to libgnucash/gnc-module/example/ui/CMakeLists.txt
diff --git a/gnucash/plugins/example/ui/Makefile.am b/libgnucash/gnc-module/example/ui/Makefile.am
similarity index 100%
rename from gnucash/plugins/example/ui/Makefile.am
rename to libgnucash/gnc-module/example/ui/Makefile.am
diff --git a/gnucash/plugins/example/ui/gnc-plugin-example-ui.xml b/libgnucash/gnc-module/example/ui/gnc-plugin-example-ui.xml
similarity index 100%
rename from gnucash/plugins/example/ui/gnc-plugin-example-ui.xml
rename to libgnucash/gnc-module/example/ui/gnc-plugin-example-ui.xml
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 46c0ead..c8d33ed 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -239,6 +239,12 @@ gnucash/import-export/aqb/gnc-gwen-gui.c
 gnucash/import-export/aqb/gncmod-aqbanking.c
 gnucash/import-export/aqb/gnc-plugin-aqbanking.c
 [type: gettext/gsettings]gnucash/import-export/aqb/gschemas/org.gnucash.dialogs.import.hbci.gschema.xml.in.in
+gnucash/import-export/bi-import/dialog-bi-import.c
+gnucash/import-export/bi-import/dialog-bi-import-gui.c
+gnucash/import-export/bi-import/dialog-bi-import-helper.c
+gnucash/import-export/bi-import/gncmod-bi-import.c
+gnucash/import-export/bi-import/gnc-plugin-bi-import.c
+gnucash/import-export/bi-import/gtkbuilder/dialog-bi-import-gui.glade
 gnucash/import-export/csv-exp/assistant-csv-export.c
 gnucash/import-export/csv-exp/assistant-csv-export.glade
 gnucash/import-export/csv-exp/csv-transactions-export.c
@@ -263,6 +269,11 @@ gnucash/import-export/csv-imp/gnc-tokenizer.cpp
 gnucash/import-export/csv-imp/gnc-trans-props.cpp
 gnucash/import-export/csv-imp/gnc-tx-import.cpp
 [type: gettext/gsettings]gnucash/import-export/csv-imp/gschemas/org.gnucash.dialogs.import.csv.gschema.xml.in.in
+gnucash/import-export/customer-import/dialog-customer-import.c
+gnucash/import-export/customer-import/dialog-customer-import-gui.c
+gnucash/import-export/customer-import/gncmod-customer-import.c
+gnucash/import-export/customer-import/gnc-plugin-customer-import.c
+gnucash/import-export/customer-import/gtkbuilder/dialog-customer-import-gui.glade
 gnucash/import-export/dialog-import.glade
 gnucash/import-export/gncmod-generic-import.c
 [type: gettext/gsettings]gnucash/import-export/gschemas/org.gnucash.dialogs.import.generic.gschema.xml.in.in
@@ -303,19 +314,6 @@ gnucash/import-export/qif-imp/qif-objects.scm
 gnucash/import-export/qif-imp/qif-parse.scm
 gnucash/import-export/qif-imp/qif-to-gnc.scm
 gnucash/import-export/qif-imp/qif-utils.scm
-gnucash/plugins/bi_import/dialog-bi-import.c
-gnucash/plugins/bi_import/dialog-bi-import-gui.c
-gnucash/plugins/bi_import/dialog-bi-import-helper.c
-gnucash/plugins/bi_import/gncmod-bi-import.c
-gnucash/plugins/bi_import/gnc-plugin-bi-import.c
-gnucash/plugins/bi_import/gtkbuilder/dialog-bi-import-gui.glade
-gnucash/plugins/customer_import/dialog-customer-import.c
-gnucash/plugins/customer_import/dialog-customer-import-gui.c
-gnucash/plugins/customer_import/gnc-plugin-customer_import.c
-gnucash/plugins/customer_import/gtkbuilder/dialog-customer-import-gui.glade
-gnucash/plugins/customer_import/libgncmod-customer_import.c
-gnucash/plugins/example/gncmod-example.c
-gnucash/plugins/example/gnc-plugin.example.c
 gnucash/python/gncmod-python.c
 gnucash/register/ledger-core/gncEntryLedger.c
 gnucash/register/ledger-core/gncEntryLedgerControl.c
@@ -658,6 +656,8 @@ libgnucash/engine/SX-book.c
 libgnucash/engine/SX-ttinfo.c
 libgnucash/engine/Transaction.c
 libgnucash/engine/TransLog.c
+libgnucash/gnc-module/example/gncmod-example.c
+libgnucash/gnc-module/example/gnc-plugin.example.c
 libgnucash/gnc-module/gnc-module.c
 libgnucash/gnc-module/gnc-module.scm
 libgnucash/scm/fin.scm

commit 2a7f2f891ae1e47658f4fb87a0716336577617af
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Sun Aug 13 12:39:45 2017 +0200

    Eliminate the separate bin directory
    
    Instead its content is moved to gnucash directly, making the gnucash directory
    more meaningful.

diff --git a/.gitignore b/.gitignore
index 2357d17..cf3d045 100644
--- a/.gitignore
+++ b/.gitignore
@@ -179,19 +179,19 @@ libgnucash/scm/build-config.scm
 libgnucash/scm/gnucash
 libgnucash/tax/us/gnucash
 libgnucash/tax/us/test/test-link-module
-gnucash/bin/environment
-gnucash/bin/gnucash
-gnucash/bin/gnucash-bin
-gnucash/bin/gnucash-ddd
-gnucash/bin/gnucash-env
-gnucash/bin/gnucash-gdb
-gnucash/bin/gnucash-launcher
-gnucash/bin/gnucash-make-guids
-gnucash/bin/gnucash-setup-env
-gnucash/bin/gnucash-valgrind
-gnucash/bin/overrides/gnucash-build-env
-gnucash/bin/overrides/gnucash-env
-gnucash/bin/overrides/guile
+gnucash/environment
+gnucash/gnucash
+gnucash/gnucash-bin
+gnucash/gnucash-ddd
+gnucash/gnucash-env
+gnucash/gnucash-gdb
+gnucash/gnucash-launcher
+gnucash/gnucash-make-guids
+gnucash/gnucash-setup-env
+gnucash/gnucash-valgrind
+gnucash/overrides/gnucash-build-env
+gnucash/overrides/gnucash-env
+gnucash/overrides/guile
 gnucash/gnome/gnucash
 gnucash/gnome/gnucash.desktop
 gnucash/gnome/gnucash.desktop.in
diff --git a/common/cmake_modules/MakeDistFiles.cmake b/common/cmake_modules/MakeDistFiles.cmake
index facf319..aeeb4c7 100644
--- a/common/cmake_modules/MakeDistFiles.cmake
+++ b/common/cmake_modules/MakeDistFiles.cmake
@@ -45,9 +45,9 @@ SET(COPY_FROM_BUILD
   libgnucash/app-utils/swig-app-utils-python.c
   libgnucash/app-utils/test/test-load-module
   libgnucash/backend/xml/test/test-real-data.sh
-  gnucash/bin/gnucash.rc
-  gnucash/bin/overrides/gnucash-make-guids
-  gnucash/bin/test/test-version
+  gnucash/gnucash.rc
+  gnucash/overrides/gnucash-make-guids
+  gnucash/test/test-version
   libgnucash/core-utils/gnc-vcs-info.h
   libgnucash/core-utils/swig-core-utils-guile.c
   libgnucash/core-utils/swig-core-utils-python.c
diff --git a/configure.ac b/configure.ac
index 483bcb6..c25e6df 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1587,7 +1587,7 @@ AC_MSG_RESULT($warnFLAGS)
 ### makefiles, so that we don't have an opportunity to adjust them
 ### there.
 
-chmod u+x ${srcdir}/gnucash/bin/generate-gnc-script
+chmod u+x ${srcdir}/gnucash/generate-gnc-script
 
 ### --------------------------------------------------------------------------
 ### Makefile creation
@@ -1650,9 +1650,8 @@ AC_CONFIG_FILES(
   doc/Makefile
   doc/examples/Makefile
   gnucash/Makefile
-  gnucash/bin/Makefile
-  gnucash/bin/overrides/Makefile
-  gnucash/bin/test/Makefile
+  gnucash/overrides/Makefile
+  gnucash/test/Makefile
   gnucash/gnome/Makefile
   gnucash/gnome/gtkbuilder/Makefile
   gnucash/gnome/gschemas/Makefile
@@ -1751,7 +1750,7 @@ AC_CONFIG_FILES(
   libgnucash/tax/us/Makefile
   libgnucash/tax/us/test/Makefile
   dnl # non-makefiles
-  gnucash/bin/gnucash.rc
+  gnucash/gnucash.rc
   libgnucash/app-utils/migratable-prefs.xml
   gnucash/gnome/gnucash.desktop.in
   dnl # GSettings schema files
@@ -1782,8 +1781,8 @@ AC_CONFIG_FILES([libgnucash/app-utils/test/test-load-module],
                 [chmod +x libgnucash/app-utils/test/test-load-module])
 AC_CONFIG_FILES([libgnucash/backend/xml/test/test-real-data.sh],
                 [chmod +x libgnucash/backend/xml/test/test-real-data.sh])
-AC_CONFIG_FILES([gnucash/bin/test/test-version],
-                [chmod +x gnucash/bin/test/test-version])
+AC_CONFIG_FILES([gnucash/test/test-version],
+                [chmod +x gnucash/test/test-version])
 AC_CONFIG_FILES([libgnucash/engine/test/test-create-account],
                 [chmod +x libgnucash/engine/test/test-create-account])
 AC_CONFIG_FILES([libgnucash/engine/test/test-scm-query-import],
@@ -1816,7 +1815,7 @@ AC_CONFIG_FILES([libgnucash/tax/us/test/test-load-module],
                 [chmod +x libgnucash/tax/us/test/test-load-module])
 
 # A few files need extra actions at creation time
-AC_CONFIG_FILES([gnucash/bin/overrides/gnucash-make-guids], [chmod u+x gnucash/bin/overrides/gnucash-make-guids])
+AC_CONFIG_FILES([gnucash/overrides/gnucash-make-guids], [chmod u+x gnucash/overrides/gnucash-make-guids])
 #Link (copy on Windows) test data files:
 AC_CONFIG_LINKS([gnucash/import-export/csv-imp/test/sample1.csv:gnucash/import-export/csv-imp/test/sample1.csv])
 LDFLAGS="${LDFLAGS} ${NOUNDEF}"
diff --git a/gnucash/CMakeLists.txt b/gnucash/CMakeLists.txt
index bd6353e..4643428 100644
--- a/gnucash/CMakeLists.txt
+++ b/gnucash/CMakeLists.txt
@@ -1,7 +1,6 @@
 # CMakeLists.txt for gnucash/
 
 # The subdirectories
-ADD_SUBDIRECTORY (bin)
 ADD_SUBDIRECTORY (gnome)
 ADD_SUBDIRECTORY (gnome-utils)
 ADD_SUBDIRECTORY (gnome-search)
@@ -10,12 +9,190 @@ ADD_SUBDIRECTORY (import-export)
 ADD_SUBDIRECTORY (plugins)
 ADD_SUBDIRECTORY (python)
 ADD_SUBDIRECTORY (register)
-ADD_SUBDIRECTORY(report)
+ADD_SUBDIRECTORY (report)
+ADD_SUBDIRECTORY (overrides)
+ADD_SUBDIRECTORY (test)
 
 ADD_DEFINITIONS (-DHAVE_CONFIG_H)
 
-SET_LOCAL_DIST(gnucash_DIST_local CMakeLists.txt Makefile.am ${gnucash_EXTRA_DIST})
+# Some settings are platform dependent. Let's define them per platform.
+IF (WIN32)
+  # Windows specific settings go here:
+  SET (GNUCASH_RESOURCE_FILE gnucash.rc)
 
-SET(gnucash_DIST ${gnucash_DIST_local} ${bin_DIST} ${gnome_DIST} ${gnome_search_DIST}
-             ${gnome_utils_DIST} ${html_DIST} ${import_export_DIST} ${plugins_DIST} ${python_DIST}
-             ${register_DIST} ${report_DIST} PARENT_SCOPE)
+ELSE (WIN32)
+  # All other platforms use these settings:
+  SET (PLATFORM_FILES gnucash-valgrind)
+
+ENDIF (WIN32)
+
+SET (gnucash_SOURCES
+  gnucash-bin.c
+  ${GNUCASH_RESOURCE_FILE}
+)
+
+ADD_EXECUTABLE (gnucash
+  ${gnucash_SOURCES}
+)
+
+TARGET_COMPILE_DEFINITIONS(gnucash PRIVATE -DG_LOG_DOMAIN=\"gnc.bin\")
+
+TARGET_LINK_LIBRARIES (gnucash
+   gncmod-ledger-core gncmod-report-gnome gnc-gnome gncmod-gnome-utils gncmod-app-utils
+   gncmod-engine gnc-module gnc-core-utils gncmod-report-system
+   ${GUILE_LDFLAGS} ${GLIB2_LDFLAGS} ${GTK3_LDFLAGS} ${GTK_MAC_LDFLAGS}
+)
+
+
+IF (MAC_INTEGRATION)
+  TARGET_COMPILE_OPTIONS(gnucash PRIVATE ${OSX_EXTRA_COMPILE_FLAGS})
+  TARGET_LINK_LIBRARIES(gnucash ${OSX_EXTRA_LIBRARIES})
+ENDIF(MAC_INTEGRATION)
+
+INSTALL(TARGETS gnucash DESTINATION bin)
+# No headers to install.
+
+# Generate the gnucash-env script
+SET(SCRIPT_LIST  "")
+SET(SCRIPT_OUTPUT_DIR ${BINDIR_BUILD})
+
+FOREACH (script gnucash-env gnucash-make-guids)
+  SET (GNUCASH_ENV_SCRIPT ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${script})
+  LIST(APPEND SCRIPT_LIST ${SCRIPT_OUTPUT_DIR}/${script})
+  SET (GNC_OVERRIDES_DIR ${CMAKE_INSTALL_PREFIX}/libexec/gnucash/overrides)
+  FILE(WRITE ${GNUCASH_ENV_SCRIPT} "#!/bin/sh\n")
+  FILE(APPEND ${GNUCASH_ENV_SCRIPT} "PATH=\"${GNC_OVERRIDES_DIR}:\${PATH}\"\n")
+  FILE(APPEND ${GNUCASH_ENV_SCRIPT} "export PATH\n")
+  FILE(APPEND ${GNUCASH_ENV_SCRIPT} "\nGUILE_WARN_DEPRECATED=\"no\"\n")
+  FILE(APPEND ${GNUCASH_ENV_SCRIPT} "export GUILE_WARN_DEPRECATED\n")
+  FILE(APPEND ${GNUCASH_ENV_SCRIPT} "\nexec \"${script}\" \"\$@\"\n")
+  FILE(COPY ${GNUCASH_ENV_SCRIPT}
+       DESTINATION ${SCRIPT_OUTPUT_DIR}
+       FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
+  )
+ENDFOREACH(script)
+
+SET(TOP_SRC_DIR ${CMAKE_SOURCE_DIR})
+SET(GNUCASH_BIN_INSTALL_NAME "gnucash")
+
+SET(VALGRIND_OUTDIR ${BINDIR_BUILD})
+
+CONFIGURE_FILE(gnucash.rc.in gnucash.rc @ONLY NEWLINE_STYLE WIN32)
+GNC_CONFIGURE(gnucash-valgrind.in ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/gnucash-valgrind)
+
+FILE(COPY ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/gnucash-valgrind
+          DESTINATION ${VALGRIND_OUTDIR}
+          FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
+)
+
+## Create the environment file
+
+FILE(STRINGS ${CMAKE_CURRENT_SOURCE_DIR}/environment.in ENV_STRINGS_IN)
+
+SET(ENV_STRINGS_LIST "")
+
+FOREACH(line ${ENV_STRINGS_IN})
+  STRING(REGEX REPLACE "@-|-@" "@" line2 "${line}")
+    STRING(REPLACE ";" "\;" line3 "${line2}")
+  IF(NOT "${line3}" MATCHES "@NOTE")
+    LIST(APPEND ENV_STRINGS_LIST "${line3}\n")
+  ENDIF()
+ENDFOREACH()
+
+STRING(CONCAT ENV_STRINGS ${ENV_STRINGS_LIST})
+STRING(CONFIGURE "${ENV_STRINGS}" ENV_STRINGS_CONF @ONLY)
+
+SET(ENV_FILE_OUT ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/environment)
+SET(BUILD_ENV_FILE_OUT ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/environment.build)
+
+FILE(WRITE ${ENV_FILE_OUT} "${ENV_STRINGS_CONF}")
+FILE(WRITE ${BUILD_ENV_FILE_OUT} "${ENV_STRINGS_CONF}")
+
+SET(XDG_TEXT "
+# GnuCash was not installed in the default location.
+# XDG_DATA_DIRS will be set so that our documentation
+# and gsettings schema are found.\n"
+)
+
+IF (NOT(${GNC_DBD_DIR} STREQUAL "${CMAKE_PREFIX_PATH}/lib/dbd"))
+  FILE(APPEND ${ENV_FILE_OUT} "GNC_DBD_DIR=${GNC_DBD_DIR}")
+ENDIF()
+
+IF (NOT(${DATADIR} STREQUAL "/usr/share") AND NOT(${DATADIR} STREQUAL "/usr/local/share"))
+  FILE(APPEND ${ENV_FILE_OUT} ${XDG_TEXT})
+  FILE(APPEND ${ENV_FILE_OUT} "XDG_DATA_DIRS=${DATADIR};{XDG_DATA_DIRS}" "${GNC_SYSTEM_XDG_DATA_DIRS}\n")
+ENDIF()
+
+FILE(APPEND ${BUILD_ENV_FILE_OUT} "GNC_DBD_DIR=${LIBDBI_DRIVERS_DIR}/dbd")
+
+FILE(APPEND ${BUILD_ENV_FILE_OUT} ${XDG_TEXT})
+FILE(APPEND ${BUILD_ENV_FILE_OUT} "XDG_DATA_DIRS=${DATADIR_BUILD};{XDG_DATA_DIRS};" "${GNC_SYSTEM_XDG_DATA_DIRS}\n")
+
+FILE(COPY ${BUILD_ENV_FILE_OUT}
+  DESTINATION ${SYSCONFDIR_BUILD}/gnucash
+  FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
+)
+FILE(RENAME
+  ${SYSCONFDIR_BUILD}/gnucash/environment.build
+  ${SYSCONFDIR_BUILD}/gnucash/environment
+)
+
+SET(ENVIRONMENT_FILE_DIR ${CMAKE_CURRENT_BINARY_DIR})
+FILE(COPY ${ENV_FILE_OUT}
+  DESTINATION ${ENVIRONMENT_FILE_DIR}
+  FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
+)
+
+INSTALL(FILES ${SCRIPT_LIST} ${VALGRIND_OUTDIR}/gnucash-valgrind DESTINATION bin)
+INSTALL(FILES ${ENVIRONMENT_FILE_DIR}/environment DESTINATION etc/gnucash)
+
+IF (WIN32)
+  # Write out a command script for windows
+  SET(lib_directories boost enchant libsoup mysql pgsql libxslt)
+  SET(bin_directories mingw gnutls goffice libgsf pcre gnome guile webkit regex aqbanking gwenhywfar libofx opensp
+    libdbi sqlite3 mysql pgsql enchant libsoup libxslt)
+
+  SET(CMD_LINES "")
+  SET(BUILD_CMD_LINES "")
+  FOREACH(dir bin lib lib/gnucash)
+    FILE(TO_NATIVE_PATH ${CMAKE_INSTALL_PREFIX}/${dir} INSTALL_PATH_ITEM)
+    FILE(TO_NATIVE_PATH ${CMAKE_BINARY_DIR}/${dir} BUILD_PATH_ITEM)
+    LIST(APPEND CMD_LINES "set PATH=${INSTALL_PATH_ITEM}\;%PATH%\n")
+    LIST(APPEND BUILD_CMD_LINES "set PATH=${BUILD_PATH_ITEM}\;%PATH%\n")
+  ENDFOREACH(dir)
+  IF (NOT ${MINGW64})
+    FOREACH(dir ${lib_directories})
+      FILE(TO_NATIVE_PATH ${CMAKE_PREFIX_PATH}/${dir}/lib PATH_ITEM)
+      LIST(APPEND CMD_LINES "set PATH=${PATH_ITEM}\;%PATH%\n")
+    ENDFOREACH(dir)
+
+    FOREACH(dir ${bin_directories})
+      FILE(TO_NATIVE_PATH ${CMAKE_PREFIX_PATH}/${dir}/bin PATH_ITEM)
+      LIST(APPEND CMD_LINES "set PATH=${PATH_ITEM}\;%PATH%\n")
+    ENDFOREACH(dir)
+  ENDIF (NOT ${MINGW64})
+  SET(CMD_FILE ${CMAKE_CURRENT_BINARY_DIR}/gnucash-launcher.cmd)
+  FILE(WRITE ${CMD_FILE} "@echo off\nsetlocal\n\n")
+  FOREACH(line ${CMD_LINES})
+    FILE(APPEND ${CMD_FILE} "${line}")
+  ENDFOREACH(line)
+  FILE(APPEND ${CMD_FILE} "\nstart gnucash %*\n")
+
+  SET(BUILD_CMD_FILE ${CMAKE_BINARY_DIR}/bin/gnucash-launcher.cmd)
+  FILE(WRITE ${BUILD_CMD_FILE} "@echo off\nsetlocal\n\n")
+  FOREACH(line ${CMD_LINES})
+     FILE(APPEND ${BUILD_CMD_FILE} "${line}")
+  ENDFOREACH(line)
+  FILE(APPEND ${BUILD_CMD_FILE} "\nstart gnucash %*\n")
+
+  INSTALL(PROGRAMS ${CMD_FILE} DESTINATION bin)
+ENDIF(WIN32)
+
+
+SET_LOCAL_DIST(gnucash_DIST_local CMakeLists.txt environment.in generate-gnc-script
+               gnucash-bin.c gnucash.rc.in gnucash-valgrind.in
+               Makefile.am ${gnucash_EXTRA_DIST})
+
+SET(gnucash_DIST ${gnucash_DIST_local} ${gnome_DIST} ${gnome_search_DIST}
+             ${gnome_utils_DIST} ${html_DIST} ${import_export_DIST} ${plugins_DIST} ${python_DIST} ${register_DIST} ${report_DIST}
+             ${overrides_DIST} ${test_bin_DIST} PARENT_SCOPE)
diff --git a/gnucash/bin/CMakeLists.txt b/gnucash/CMakeLists.txt-bin
similarity index 100%
rename from gnucash/bin/CMakeLists.txt
rename to gnucash/CMakeLists.txt-bin
diff --git a/gnucash/Makefile.am b/gnucash/Makefile.am
index fd7b467..1c9d29e 100644
--- a/gnucash/Makefile.am
+++ b/gnucash/Makefile.am
@@ -1,7 +1,10 @@
 if WITH_PYTHON
    PYTHON_DIR = python
 endif
-
+if !PLATFORM_WIN32
+  OVERRIDES_DIR = overrides
+endif
+# Order is important here.
 SUBDIRS = \
   ${PYTHON_DIR} \
   gnome-utils \
@@ -12,4 +15,148 @@ SUBDIRS = \
   gnome \
   import-export \
   plugins \
-  bin
+  . \
+  ${OVERRIDES_DIR} \
+  test
+
+AM_CPPFLAGS = -I${top_builddir} ${GLIB_CFLAGS} ${GNOME_CFLAGS} ${GTK_CFLAGS} \
+  -DPKGSYSCONFDIR=\"${GNC_CONFIGDIR}\" \
+  -DPKGDATADIR=\"${GNC_SHAREDIR}\" \
+  -I${top_srcdir}/common \
+  -I${top_builddir}/common \
+  -I${top_srcdir}/libgnucash/core-utils \
+  -I${top_srcdir}/libgnucash/app-utils \
+  -I${top_srcdir}/gnucash/gnome-utils \
+  -I${top_srcdir}/libgnucash/engine \
+  -I${top_srcdir}/gnucash/gnome \
+  -I${top_builddir}/common \
+  -I${top_builddir}/libgnucash/core-utils \
+  -I${top_srcdir}/libgnucash/gnc-module \
+  -I${top_srcdir}/gnucash/report/report-system \
+  ${GUILE_CFLAGS} \
+  ${GTK_MAC_CFLAGS}
+
+SUFFIXES = .rc
+
+config_DATA = environment
+configdir = ${GNC_CONFIGDIR}
+
+# Some settings are platform dependent. Let's define them per platform.
+if PLATFORM_WIN32
+# Windows specific settings go here:
+GNUCASH_RESOURCE_FILE = gnucash.rc
+dist_noinst_DATA = gnucash.rc
+
+.rc.o:
+	$(AM_V_GEN)$(RC) -I${top_srcdir}/data/pixmaps -i '$<' --input-format=rc -o '$@' -O coff
+
+else !PLATFORM_WIN32
+# All other platforms use these settings:
+PLATFORM_FILES = gnucash-valgrind
+
+endif !PLATFORM_WIN32
+
+BIN_NAME = gnucash
+bin_PROGRAMS = ${BIN_NAME}
+gnucash_SOURCES = gnucash-bin.c ${GNUCASH_RESOURCE_FILE}
+gnucash_LDADD = \
+  ${top_builddir}/gnucash/register/ledger-core/libgncmod-ledger-core.la \
+  ${top_builddir}/gnucash/report/report-gnome/libgncmod-report-gnome.la \
+  ${top_builddir}/gnucash/gnome/libgnc-gnome.la \
+  ${top_builddir}/gnucash/gnome-utils/libgncmod-gnome-utils.la \
+  ${top_builddir}/libgnucash/app-utils/libgncmod-app-utils.la \
+  ${top_builddir}/libgnucash/engine/libgncmod-engine.la \
+  ${top_builddir}/libgnucash/gnc-module/libgnc-module.la \
+  ${top_builddir}/libgnucash/core-utils/libgnc-core-utils.la \
+  ${top_builddir}/gnucash/report/report-system/libgncmod-report-system.la \
+  ${GUILE_LIBS} \
+  ${GLIB_LIBS} \
+  ${GTK_LIBS}
+
+if WITH_GOOGLE_PROFILER
+gnucash_LDADD += -lprofiler
+endif
+
+GNUCASH_BIN_INSTALL_NAME=`echo ${BIN_NAME} | sed -e '$(transform)'`
+
+gnucash-valgrind: gnucash-valgrind.in ${top_builddir}/config.status Makefile
+	rm -f $@.tmp
+	sed < $< > $@.tmp \
+	    -e "s#@-TOP_SRC_DIR-@#${abs_top_srcdir}#g" \
+	    -e "s#@-GNUCASH_BIN_INSTALL_NAME-@#${GNUCASH_BIN_INSTALL_NAME}#g"
+	mv $@.tmp $@
+	chmod u+x $@
+
+environment: environment.in ${top_builddir}/config.status Makefile
+	rm -f $@.tmp
+	sed < $< > $@.tmp \
+	    -e '/@-NOTE.*-@/ D' \
+	    -e "s#@-GUILE_EFFECTIVE_VERSION-@#@GUILE_EFFECTIVE_VERSION@#g"
+if CUSTOM_GNC_DBD_DIR
+	echo 'GNC_DBD_DIR=@GNC_DBD_DIR@' >> $@.tmp
+endif
+    # Set XDG_DATA_DIRS if necessary.  The three components of the search path are the
+    # directory used by GnuCash, whatever was specified in the environment at run time, and
+    # the default value specified via configure.
+	if [ "a$(datadir)" != "a/usr/share" ] && [ "a$(datadir)" != "a/usr/local/share" ]; \
+	then \
+		echo >> $@.tmp; \
+		echo "# GnuCash was not installed in the default location" >> $@.tmp; \
+		echo "# XDG_DATA_DIRS will be set so that our documentation" >> $@.tmp; \
+		echo "# and gsettings schemas are found." >> $@.tmp; \
+		echo "XDG_DATA_DIRS=$(datadir);{XDG_DATA_DIRS};${GNC_SYSTEM_XDG_DATA_DIRS}" >> $@.tmp; \
+	fi
+if WITH_PYTHON
+	if [ "${PYTHON_SITE_PKG}" != "${pyexecdir}" ]; \
+	then \
+		echo  >> $@.tmp; \
+		echo "# Define PYTHONPATH for non default installation path." >> $@.tmp; \
+		echo "PYTHONPATH=${pyexecdir};{PYTHONPATH}" >> $@.tmp; \
+	fi
+endif
+	mv $@.tmp $@
+
+CLEANFILES = $(BUILT_SOURCES) ${config_DATA} ${PLATFORM_FILES}
+
+if !PLATFORM_WIN32
+# The gnucash scripts don't make sense on Windows, so will only be
+# generated and included on the other platforms.
+# We handle gnucash scripts in a somewhat unexpected way, but we do
+# this so that a user who doesn't necessarily have the right
+# directories in their path can still invoke these commands via their
+# full path, say /some/dir/not/in/path/gnucash and still have the
+# right thing happen (i.e. they'll still get the right guile, and the
+# right scripts if they sub-exec anything from their scripts).  If you
+# want to add another gnucash script, please add the name here (which
+# will cause the bindir wrapper to be created, and then put the actual
+# code in a script of the same name in ./overrides.  Oh, and don't
+# forget to add your script to configure.in's "Adjustments" section if
+# you need to.
+#
+# For testing and other reasons, overrides/* scripts should not modify
+# the path to re-insert the overrides dir.  This should only be done
+# by these top-level "common" scripts.
+gnc_common_scripts = gnucash-env gnucash-make-guids
+
+bin_SCRIPTS = \
+    ${gnc_common_scripts} \
+	${PLATFORM_FILES}
+
+# if you change gncoverridedir, make sure you change ./overrides/Makefile.am too.
+gncoverridesdir = ${GNC_LIBEXECDIR}/overrides
+
+## Gnucash scripts -- real code is in overrides, these just get you there.
+${gnc_common_scripts}: generate-gnc-script ${top_builddir}/config.status
+	${srcdir}/generate-gnc-script $@ "${gncoverridesdir}"
+
+CLEANFILES += ${gnc_common_scripts}
+
+endif
+
+EXTRA_DIST = \
+	generate-gnc-script \
+	gnucash-valgrind.in \
+	environment.in \
+	CMakeLists.txt
+
+AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.bin\"
diff --git a/gnucash/bin/Makefile.am b/gnucash/bin/Makefile.am
deleted file mode 100644
index 922e292..0000000
--- a/gnucash/bin/Makefile.am
+++ /dev/null
@@ -1,148 +0,0 @@
-# Order is important here.
-if !PLATFORM_WIN32
-SUBDIRS = . overrides test
-else
-SUBDIRS = . test
-endif
-
-AM_CPPFLAGS = -I${top_builddir} ${GLIB_CFLAGS} ${GNOME_CFLAGS} ${GTK_CFLAGS} \
-  -DPKGSYSCONFDIR=\"${GNC_CONFIGDIR}\" \
-  -DPKGDATADIR=\"${GNC_SHAREDIR}\" \
-  -I${top_srcdir}/common \
-  -I${top_builddir}/common \
-  -I${top_srcdir}/libgnucash/core-utils \
-  -I${top_srcdir}/libgnucash/app-utils \
-  -I${top_srcdir}/gnucash/gnome-utils \
-  -I${top_srcdir}/libgnucash/engine \
-  -I${top_srcdir}/gnucash/gnome \
-  -I${top_builddir}/common \
-  -I${top_builddir}/libgnucash/core-utils \
-  -I${top_srcdir}/libgnucash/gnc-module \
-  -I${top_srcdir}/gnucash/report/report-system \
-  ${GUILE_CFLAGS} \
-  ${GTK_MAC_CFLAGS}
-
-SUFFIXES = .rc
-
-config_DATA = environment
-configdir = ${GNC_CONFIGDIR}
-
-# Some settings are platform dependent. Let's define them per platform.
-if PLATFORM_WIN32
-# Windows specific settings go here:
-GNUCASH_RESOURCE_FILE = gnucash.rc
-dist_noinst_DATA = gnucash.rc
-
-.rc.o:
-	$(AM_V_GEN)$(RC) -I${top_srcdir}/data/pixmaps -i '$<' --input-format=rc -o '$@' -O coff
-
-else !PLATFORM_WIN32
-# All other platforms use these settings:
-PLATFORM_FILES = gnucash-valgrind
-
-endif !PLATFORM_WIN32
-
-BIN_NAME = gnucash
-bin_PROGRAMS = ${BIN_NAME}
-gnucash_SOURCES = gnucash-bin.c ${GNUCASH_RESOURCE_FILE}
-gnucash_LDADD = \
-  ${top_builddir}/gnucash/register/ledger-core/libgncmod-ledger-core.la \
-  ${top_builddir}/gnucash/report/report-gnome/libgncmod-report-gnome.la \
-  ${top_builddir}/gnucash/gnome/libgnc-gnome.la \
-  ${top_builddir}/gnucash/gnome-utils/libgncmod-gnome-utils.la \
-  ${top_builddir}/libgnucash/app-utils/libgncmod-app-utils.la \
-  ${top_builddir}/libgnucash/engine/libgncmod-engine.la \
-  ${top_builddir}/libgnucash/gnc-module/libgnc-module.la \
-  ${top_builddir}/libgnucash/core-utils/libgnc-core-utils.la \
-  ${top_builddir}/gnucash/report/report-system/libgncmod-report-system.la \
-  ${GUILE_LIBS} \
-  ${GLIB_LIBS} \
-  ${GTK_LIBS}
-
-if WITH_GOOGLE_PROFILER
-gnucash_LDADD += -lprofiler
-endif
-
-GNUCASH_BIN_INSTALL_NAME=`echo ${BIN_NAME} | sed -e '$(transform)'`
-
-gnucash-valgrind: gnucash-valgrind.in ${top_builddir}/config.status Makefile
-	rm -f $@.tmp
-	sed < $< > $@.tmp \
-	    -e "s#@-TOP_SRC_DIR-@#${abs_top_srcdir}#g" \
-	    -e "s#@-GNUCASH_BIN_INSTALL_NAME-@#${GNUCASH_BIN_INSTALL_NAME}#g"
-	mv $@.tmp $@
-	chmod u+x $@
-
-environment: environment.in ${top_builddir}/config.status Makefile
-	rm -f $@.tmp
-	sed < $< > $@.tmp \
-	    -e '/@-NOTE.*-@/ D' \
-	    -e "s#@-GUILE_EFFECTIVE_VERSION-@#@GUILE_EFFECTIVE_VERSION@#g"
-if CUSTOM_GNC_DBD_DIR
-	echo 'GNC_DBD_DIR=@GNC_DBD_DIR@' >> $@.tmp
-endif
-    # Set XDG_DATA_DIRS if necessary.  The three components of the search path are the
-    # directory used by GnuCash, whatever was specified in the environment at run time, and
-    # the default value specified via configure.
-	if [ "a$(datadir)" != "a/usr/share" ] && [ "a$(datadir)" != "a/usr/local/share" ]; \
-	then \
-		echo >> $@.tmp; \
-		echo "# GnuCash was not installed in the default location" >> $@.tmp; \
-		echo "# XDG_DATA_DIRS will be set so that our documentation" >> $@.tmp; \
-		echo "# and gsettings schemas are found." >> $@.tmp; \
-		echo "XDG_DATA_DIRS=$(datadir);{XDG_DATA_DIRS};${GNC_SYSTEM_XDG_DATA_DIRS}" >> $@.tmp; \
-	fi
-if WITH_PYTHON
-	if [ "${PYTHON_SITE_PKG}" != "${pyexecdir}" ]; \
-	then \
-		echo  >> $@.tmp; \
-		echo "# Define PYTHONPATH for non default installation path." >> $@.tmp; \
-		echo "PYTHONPATH=${pyexecdir};{PYTHONPATH}" >> $@.tmp; \
-	fi
-endif
-	mv $@.tmp $@
-
-CLEANFILES = $(BUILT_SOURCES) ${config_DATA} ${PLATFORM_FILES}
-
-if !PLATFORM_WIN32
-# The gnucash scripts don't make sense on Windows, so will only be
-# generated and included on the other platforms.
-# We handle gnucash scripts in a somewhat unexpected way, but we do
-# this so that a user who doesn't necessarily have the right
-# directories in their path can still invoke these commands via their
-# full path, say /some/dir/not/in/path/gnucash and still have the
-# right thing happen (i.e. they'll still get the right guile, and the
-# right scripts if they sub-exec anything from their scripts).  If you
-# want to add another gnucash script, please add the name here (which
-# will cause the bindir wrapper to be created, and then put the actual
-# code in a script of the same name in ./overrides.  Oh, and don't
-# forget to add your script to configure.in's "Adjustments" section if
-# you need to.
-#
-# For testing and other reasons, overrides/* scripts should not modify
-# the path to re-insert the overrides dir.  This should only be done
-# by these top-level "common" scripts.
-gnc_common_scripts = gnucash-env gnucash-make-guids
-
-bin_SCRIPTS = \
-    ${gnc_common_scripts} \
-	${PLATFORM_FILES}
-
-# if you change gncoverridedir, make sure you change ./overrides/Makefile.am too.
-gncoverridesdir = ${GNC_LIBEXECDIR}/overrides
-
-## Gnucash scripts -- real code is in overrides, these just get you there.
-${gnc_common_scripts}: generate-gnc-script ${top_builddir}/config.status
-	${srcdir}/generate-gnc-script $@ "${gncoverridesdir}"
-
-CLEANFILES += ${gnc_common_scripts}
-
-endif
-
-EXTRA_DIST = \
-	generate-gnc-script \
-	gnucash-valgrind.in \
-	environment.in \
-	CMakeLists.txt
-
-AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.bin\"
diff --git a/gnucash/bin/environment.in b/gnucash/environment.in
similarity index 100%
rename from gnucash/bin/environment.in
rename to gnucash/environment.in
diff --git a/gnucash/bin/generate-gnc-script b/gnucash/generate-gnc-script
similarity index 100%
rename from gnucash/bin/generate-gnc-script
rename to gnucash/generate-gnc-script
diff --git a/gnucash/bin/gnucash-bin.c b/gnucash/gnucash-bin.c
similarity index 100%
rename from gnucash/bin/gnucash-bin.c
rename to gnucash/gnucash-bin.c
diff --git a/gnucash/bin/gnucash-strip-svn-datafile.sh b/gnucash/gnucash-strip-svn-datafile.sh
similarity index 100%
rename from gnucash/bin/gnucash-strip-svn-datafile.sh
rename to gnucash/gnucash-strip-svn-datafile.sh
diff --git a/gnucash/bin/gnucash-valgrind.in b/gnucash/gnucash-valgrind.in
similarity index 100%
rename from gnucash/bin/gnucash-valgrind.in
rename to gnucash/gnucash-valgrind.in
diff --git a/gnucash/bin/gnucash.rc.in b/gnucash/gnucash.rc.in
similarity index 100%
rename from gnucash/bin/gnucash.rc.in
rename to gnucash/gnucash.rc.in
diff --git a/gnucash/bin/overrides/CMakeLists.txt b/gnucash/overrides/CMakeLists.txt
similarity index 100%
rename from gnucash/bin/overrides/CMakeLists.txt
rename to gnucash/overrides/CMakeLists.txt
diff --git a/gnucash/bin/overrides/Makefile.am b/gnucash/overrides/Makefile.am
similarity index 100%
rename from gnucash/bin/overrides/Makefile.am
rename to gnucash/overrides/Makefile.am
diff --git a/gnucash/bin/overrides/gnucash-build-env.in b/gnucash/overrides/gnucash-build-env.in
similarity index 100%
rename from gnucash/bin/overrides/gnucash-build-env.in
rename to gnucash/overrides/gnucash-build-env.in
diff --git a/gnucash/bin/overrides/gnucash-env.in b/gnucash/overrides/gnucash-env.in
similarity index 100%
rename from gnucash/bin/overrides/gnucash-env.in
rename to gnucash/overrides/gnucash-env.in
diff --git a/gnucash/bin/overrides/gnucash-make-guids.in b/gnucash/overrides/gnucash-make-guids.in
similarity index 100%
rename from gnucash/bin/overrides/gnucash-make-guids.in
rename to gnucash/overrides/gnucash-make-guids.in
diff --git a/gnucash/bin/overrides/guile.in b/gnucash/overrides/guile.in
similarity index 100%
rename from gnucash/bin/overrides/guile.in
rename to gnucash/overrides/guile.in
diff --git a/gnucash/bin/test/CMakeLists.txt b/gnucash/test/CMakeLists.txt
similarity index 100%
rename from gnucash/bin/test/CMakeLists.txt
rename to gnucash/test/CMakeLists.txt
diff --git a/gnucash/bin/test/Makefile.am b/gnucash/test/Makefile.am
similarity index 100%
rename from gnucash/bin/test/Makefile.am
rename to gnucash/test/Makefile.am
diff --git a/gnucash/bin/test/test-version.in b/gnucash/test/test-version.in
similarity index 100%
rename from gnucash/bin/test/test-version.in
rename to gnucash/test/test-version.in
diff --git a/po/POTFILES.in b/po/POTFILES.in
index b504006..46c0ead 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -1,6 +1,5 @@
 # This is a list of files which contain translatable strings.
 # This file was generated by ../make-gnucash-potfiles.
-gnucash/bin/gnucash-bin.c
 gnucash/gnome/assistant-acct-period.c
 gnucash/gnome/assistant-hierarchy.c
 gnucash/gnome/assistant-loan.c
@@ -217,6 +216,7 @@ gnucash/gnome-utils/print-session.c
 gnucash/gnome-utils/search-param.c
 gnucash/gnome-utils/tree-view-utils.c
 gnucash/gnome-utils/window-main-summarybar.c
+gnucash/gnucash-bin.c
 gnucash/html/gnc-html.c
 gnucash/html/gnc-html-factory.c
 gnucash/html/gnc-html-history.c

commit 53736e0842ccff262123b20bdd160b87a80e01dc
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Sun Aug 13 12:07:57 2017 +0200

    Update .gitignore to handle all the renamed directories
    
    At the same time clean up some obsolete entries (business-xyz)
    and fix a gnc-scm-info.h -> gnc-vcs-info.h

diff --git a/.gitignore b/.gitignore
index 3f6af65..2357d17 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,6 @@
 *.bak
 *.gmo
+*.go
 *.gschema.xml
 *.gschema.xml.in
 *.gschema.valid
@@ -70,169 +71,158 @@ po/POTFILES.in
 po/gnucash.pot
 po/stamp-it
 py-compile
-src/app-utils/gnucash
-src/app-utils/sw_app_utils.py
-src/app-utils/test/test-exp-parser
-src/app-utils/test/test-link-module
-src/app-utils/test/test-print-parse-amount
-src/app-utils/test/test-print-queries
-src/app-utils/test/test-scm-query-string
-src/app-utils/test/test-sx
-src/backend/dbi/test/test-dbi
-src/backend/dbi/test/test-dbi-basic
-src/backend/dbi/test/test-dbi-business
-src/backend/dbi/test/test-load-backend
-src/backend/sql/test/test-column-types
-src/backend/sql/test/test-sqlbe
-src/bin/gnucash-launcher
-src/backend/xml/test/test-date-converting
-src/backend/xml/test/test-dom-converters1
-src/backend/xml/test/test-kvp-frames
-src/backend/xml/test/test-load-backend
-src/backend/xml/test/test-load-example-account
-src/backend/xml/test/test-load-xml2
-src/backend/xml/test/test-save-in-lang
-src/backend/xml/test/test-string-converters
-src/backend/xml/test/test-xml-account
-src/backend/xml/test/test-xml-commodity
-src/backend/xml/test/test-xml-pricedb
-src/backend/xml/test/test-xml-transaction
-src/backend/xml/test/test-xml2-is-file
-src/bin/environment
-src/bin/gnucash
-src/bin/gnucash-bin
-src/bin/gnucash-ddd
-src/bin/gnucash-env
-src/bin/gnucash-gdb
-src/bin/gnucash-make-guids
-src/bin/gnucash-setup-env
-src/bin/gnucash-valgrind
-src/bin/overrides/gnucash-build-env
-src/bin/overrides/gnucash-env
-src/bin/overrides/guile
-src/bin/update-gnucash-gconf
-src/business/business-core/gnucash
-src/business/business-core/test/test-address
-src/business/business-core/test/test-business
-src/business/business-core/test/test-customer
-src/business/business-core/test/test-employee
-src/business/business-core/test/test-job
-src/business/business-core/test/test-load-module
-src/business/business-core/test/test-vendor
-src/business/business-gnome/gnucash
-src/business/business-reports/gnucash
-src/business/business-utils/gnucash
-src/business/dialog-tax-table/gnucash
-src/calculation/test/test-link
-src/core-utils/gnc-scm-info.h
-src/core-utils/gnc-version.h
-src/core-utils/gncla-dir.h
-src/core-utils/gnucash
-src/core-utils/sw_core_utils.py
-src/core-utils/test/test-gnc-uri-utils
-src/core-utils/test/test-resolve-file-path
-src/doc/doxygen.cfg
-src/doc/doxygen.log
-src/doc/design/gnucash-design.info
-src/doc/design/mdate-sh
-src/doc/design/stamp-vti
-src/doc/design/texinfo.tex
-src/doc/design/version.texi
-src/doc/html/
-src/engine/gncla-dir.h
-src/engine/gnucash
-src/engine/iso-4217-currencies.c
-src/engine/test/test-account-object
-src/engine/test/test-book-merge
-src/engine/test/test-commodities
-src/engine/test/test-date
-src/engine/test/test-group-vs-book
-src/engine/test/test-guid
-src/engine/test/test-link
-src/engine/test/test-load-engine
-src/engine/test/test-lots
-src/engine/test/test-numeric
-src/engine/test/test-object
-src/engine/test/test-period
-src/engine/test/test-query
-src/engine/test/test-querynew
-src/engine/test/test-recurrence
-src/engine/test/test-recursive
-src/engine/test/test-scm-query
-src/engine/test/test-split-vs-account
-src/engine/test/test-transaction-reversal
-src/engine/test/test-transaction-voiding
-src/engine/test/test-address
-src/engine/test/test-business
-src/engine/test/test-customer
-src/engine/test/test-employee
-src/engine/test/test-engine
-src/engine/test/test-job
-src/engine/test/test-vendor
-src/gnc-module/gnucash
-src/gnc-module/test/test-agedver
-src/gnc-module/test/test-dynload
-src/gnc-module/test/test-incompatdep
-src/gnc-module/test/test-load-c
-src/gnc-module/test/test-modsysver
-src/gnome-utils/gnc-svninfo.h
-src/gnome-utils/gnc-version.h
-src/gnome-utils/gnucash
-src/gnome-utils/test/test-gnc-dialog
-src/gnome-utils/test/test-gnc-recurrence
-src/gnome-utils/test/test-link-module
-src/gnome/gnucash.desktop
-src/gnome/gnucash.desktop.in
-src/import-export/ofx/test/test-link
-src/import-export/qif-import/gnucash
-src/import-export/qif-import/qif-import
-src/import-export/qif-import/test/test-link
-src/import-export/test/test-import-parse
-src/import-export/test/test-link
-src/engine/test/test-qof
-src/optional/python-bindings/.py-links
-src/optional/python-bindings/gnucash/
-src/optional/python-bindings/gnucash_core.c
-src/optional/python-bindings/gnucash_core_c.py
-src/optional/python-bindings/sqlite3test
-src/pixmaps/128x128/
-src/pixmaps/16x16
-src/pixmaps/22x22
-src/pixmaps/24x24
-src/pixmaps/256x256/
-src/pixmaps/32x32
-src/pixmaps/48x48
-src/pixmaps/64x64/
-src/pixmaps/96x96/
-src/pixmaps/gnucash-icon-16x16.png
-src/pixmaps/gnucash-icon-32x32.png
-src/pixmaps/scalable
-src/python/.py-links
-src/python/gnucash/python/init.py
-src/quotes/gnc-fq-check
-src/quotes/gnc-fq-helper
-src/quotes/gnc-fq-update
-src/register/ledger-core/test/test-link-module
-src/register/register-core/test/test-link-module
-src/register/register-gnome/test/test-link-module
-src/report/business-reports/gnucash
-src/report/locale-specific/us/gnucash
-src/report/locale-specific/us/test/test-link-module
-src/report/report-gnome/gnucash
-src/report/report-gnome/test/test-link-module
-src/report/report-system/gnucash
-src/report/report-system/test/test-link-module
-src/report/standard-reports/gnucash
-src/report/stylesheets/gnucash
-src/report/utility-reports/gnucash
-src/scm/build-config.scm
-src/scm/gnucash
-src/swig-runtime.h
-src/tax/us/gnucash
-src/tax/us/test/test-link-module
-src/test-core/gnucash/
-src/test-core/test_stuff.py
-src/test-core/unittest_support.py
+bindings/python/.py-links
+bindings/python/gnucash/
+bindings/python/gnucash_core.c
+bindings/python/gnucash_core_c.py
+bindings/python/sqlite3test
+common/swig-runtime.h
+common/test-core/gnucash/
+common/test-core/test_stuff.py
+common/test-core/unittest_support.py
+data/pixmaps/128x128/
+data/pixmaps/16x16
+data/pixmaps/22x22
+data/pixmaps/24x24
+data/pixmaps/256x256/
+data/pixmaps/32x32
+data/pixmaps/48x48
+data/pixmaps/64x64/
+data/pixmaps/96x96/
+data/pixmaps/gnucash-icon-16x16.png
+data/pixmaps/gnucash-icon-32x32.png
+data/pixmaps/scalable
+libgnucash/app-utils/calculation/test/test-link
+libgnucash/app-utils/gnucash
+libgnucash/app-utils/sw_app_utils.py
+libgnucash/app-utils/test/test-exp-parser
+libgnucash/app-utils/test/test-link-module
+libgnucash/app-utils/test/test-print-parse-amount
+libgnucash/app-utils/test/test-print-queries
+libgnucash/app-utils/test/test-scm-query-string
+libgnucash/app-utils/test/test-sx
+libgnucash/backend/dbi/test/test-dbi
+libgnucash/backend/dbi/test/test-dbi-basic
+libgnucash/backend/dbi/test/test-dbi-business
+libgnucash/backend/dbi/test/test-load-backend
+libgnucash/backend/sql/test/test-column-types
+libgnucash/backend/sql/test/test-sqlbe
+libgnucash/backend/xml/test/test-date-converting
+libgnucash/backend/xml/test/test-dom-converters1
+libgnucash/backend/xml/test/test-kvp-frames
+libgnucash/backend/xml/test/test-load-backend
+libgnucash/backend/xml/test/test-load-example-account
+libgnucash/backend/xml/test/test-load-xml2
+libgnucash/backend/xml/test/test-save-in-lang
+libgnucash/backend/xml/test/test-string-converters
+libgnucash/backend/xml/test/test-xml-account
+libgnucash/backend/xml/test/test-xml-commodity
+libgnucash/backend/xml/test/test-xml-pricedb
+libgnucash/backend/xml/test/test-xml-transaction
+libgnucash/backend/xml/test/test-xml2-is-file
+libgnucash/core-utils/gnc-vcs-info.h
+libgnucash/core-utils/gnc-version.h
+libgnucash/core-utils/gncla-dir.h
+libgnucash/core-utils/gnucash
+libgnucash/core-utils/sw_core_utils.py
+libgnucash/core-utils/test/test-gnc-uri-utils
+libgnucash/core-utils/test/test-resolve-file-path
+libgnucash/doc/doxygen.cfg
+libgnucash/doc/doxygen.log
+libgnucash/doc/design/gnucash-design.info
+libgnucash/doc/design/mdate-sh
+libgnucash/doc/design/stamp-vti
+libgnucash/doc/design/texinfo.tex
+libgnucash/doc/design/version.texi
+libgnucash/doc/html/
+libgnucash/engine/gncla-dir.h
+libgnucash/engine/gnucash
+libgnucash/engine/iso-4217-currencies.c
+libgnucash/engine/test/test-account-object
+libgnucash/engine/test/test-address
+libgnucash/engine/test/test-book-merge
+libgnucash/engine/test/test-business
+libgnucash/engine/test/test-commodities
+libgnucash/engine/test/test-customer
+libgnucash/engine/test/test-date
+libgnucash/engine/test/test-employee
+libgnucash/engine/test/test-engine
+libgnucash/engine/test/test-group-vs-book
+libgnucash/engine/test/test-guid
+libgnucash/engine/test/test-job
+libgnucash/engine/test/test-link
+libgnucash/engine/test/test-load-engine
+libgnucash/engine/test/test-lots
+libgnucash/engine/test/test-numeric
+libgnucash/engine/test/test-object
+libgnucash/engine/test/test-period
+libgnucash/engine/test/test-query
+libgnucash/engine/test/test-querynew
+libgnucash/engine/test/test-qof
+libgnucash/engine/test/test-recurrence
+libgnucash/engine/test/test-recursive
+libgnucash/engine/test/test-scm-query
+libgnucash/engine/test/test-split-vs-account
+libgnucash/engine/test/test-transaction-reversal
+libgnucash/engine/test/test-transaction-voiding
+libgnucash/engine/test/test-vendor
+libgnucash/gnc-module/gnucash
+libgnucash/gnc-module/test/test-agedver
+libgnucash/gnc-module/test/test-dynload
+libgnucash/gnc-module/test/test-incompatdep
+libgnucash/gnc-module/test/test-load-c
+libgnucash/gnc-module/test/test-modsysver
+libgnucash/quotes/gnc-fq-check
+libgnucash/quotes/gnc-fq-helper
+libgnucash/quotes/gnc-fq-update
+libgnucash/scm/build-config.scm
+libgnucash/scm/gnucash
+libgnucash/tax/us/gnucash
+libgnucash/tax/us/test/test-link-module
+gnucash/bin/environment
+gnucash/bin/gnucash
+gnucash/bin/gnucash-bin
+gnucash/bin/gnucash-ddd
+gnucash/bin/gnucash-env
+gnucash/bin/gnucash-gdb
+gnucash/bin/gnucash-launcher
+gnucash/bin/gnucash-make-guids
+gnucash/bin/gnucash-setup-env
+gnucash/bin/gnucash-valgrind
+gnucash/bin/overrides/gnucash-build-env
+gnucash/bin/overrides/gnucash-env
+gnucash/bin/overrides/guile
+gnucash/gnome/gnucash
+gnucash/gnome/gnucash.desktop
+gnucash/gnome/gnucash.desktop.in
+gnucash/gnome-utils/gnucash
+gnucash/gnome-utils/gnc-svninfo.h
+gnucash/gnome-utils/gnc-version.h
+gnucash/gnome-utils/gnucash
+gnucash/gnome-utils/test/test-gnc-dialog
+gnucash/gnome-utils/test/test-gnc-recurrence
+gnucash/gnome-utils/test/test-link-module
+gnucash/import-export/ofx/test/test-link
+gnucash/import-export/qif-import/gnucash
+gnucash/import-export/qif-import/qif-import
+gnucash/import-export/qif-import/test/test-link
+gnucash/import-export/test/test-import-parse
+gnucash/import-export/test/test-link
+gnucash/python/.py-links
+gnucash/python/gnucash/python/init.py
+gnucash/register/ledger-core/test/test-link-module
+gnucash/register/register-core/test/test-link-module
+gnucash/register/register-gnome/test/test-link-module
+gnucash/report/business-reports/gnucash
+gnucash/report/locale-specific/us/gnucash
+gnucash/report/locale-specific/us/test/test-link-module
+gnucash/report/report-gnome/gnucash
+gnucash/report/report-gnome/test/test-link-module
+gnucash/report/report-system/gnucash
+gnucash/report/report-system/test/test-link-module
+gnucash/report/standard-reports/gnucash
+gnucash/report/stylesheets/gnucash
+gnucash/report/utility-reports/gnucash
 stamp-h1
 swig-*.c
 test-driver

commit 4ce7be04977179f07a756c0cddbc5d9fcf7a6cf0
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Fri Aug 11 23:22:37 2017 +0200

    Drop packaging directory
    
    While I myself asked for it to be retained a couple of years back
    I now believe it really makes no sense to keep on carrying
    a completely outdated rpm spec file around. This should not
    be part of the source and properly up to date and maintained
    rpm spec files can be found in each rpm based distro that ships
    gnucash.

diff --git a/.gitignore b/.gitignore
index 3691093..3f6af65 100644
--- a/.gitignore
+++ b/.gitignore
@@ -63,9 +63,6 @@ macros/lt~obsolete.m4
 make-gnucash-potfiles
 missing
 mkinstalldirs
-packaging/gnucash.spec
-packaging/win32/custom.sh
-packaging/win32/gnucash.iss
 po/.intltool-merge-cache
 po/Makefile.in.in
 po/POTFILES
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 239e41b..a5cd985 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -684,7 +684,6 @@ ADD_SUBDIRECTORY (data)
 ADD_SUBDIRECTORY (doc)
 ADD_SUBDIRECTORY (lib)
 ADD_SUBDIRECTORY (macros)
-ADD_SUBDIRECTORY (packaging)
 ADD_SUBDIRECTORY (po)
 ADD_SUBDIRECTORY (common)
 ADD_SUBDIRECTORY (libgnucash)
diff --git a/Makefile.am b/Makefile.am
index 95d76eb..99b6cb1 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -3,7 +3,7 @@ if GNUCASH_ENABLE_GUI
 else
   GNUCASH_SUBDIR =
 endif
-SUBDIRS = . doc lib common libgnucash bindings ${GNUCASH_SUBDIR} packaging po data
+SUBDIRS = . doc lib common libgnucash bindings ${GNUCASH_SUBDIR} po data
 
 GNC_CTAGS_FILE = @GNC_CTAGS_FILE@
 GNC_ETAGS_FILE = @GNC_ETAGS_FILE@
diff --git a/common/cmake_modules/MakeDistFiles.cmake b/common/cmake_modules/MakeDistFiles.cmake
index 1c6dc9b..facf319 100644
--- a/common/cmake_modules/MakeDistFiles.cmake
+++ b/common/cmake_modules/MakeDistFiles.cmake
@@ -100,7 +100,6 @@ SET(COPY_FROM_BUILD
 
 SET(COPY_FROM_BUILD_2
         doc/gnucash.1  # Uses GNC_CONFIGURE
-        packaging/gnucash.spec # Uses GNC_CONFIGURE
         po/gnucash.pot
         libgnucash/doc/design/stamp-vti
         libgnucash/doc/design/version.texi
diff --git a/configure.ac b/configure.ac
index 34417cb..483bcb6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1750,7 +1750,6 @@ AC_CONFIG_FILES(
   libgnucash/tax/Makefile
   libgnucash/tax/us/Makefile
   libgnucash/tax/us/test/Makefile
-  packaging/Makefile
   dnl # non-makefiles
   gnucash/bin/gnucash.rc
   libgnucash/app-utils/migratable-prefs.xml
diff --git a/packaging/CMakeLists.txt b/packaging/CMakeLists.txt
deleted file mode 100644
index 041e062..0000000
--- a/packaging/CMakeLists.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-
-GNC_CONFIGURE(gnucash.spec.in gnucash.spec)
-
-SET_DIST_LIST(packaging_DIST CMakeLists.txt gnucash.spec.in Makefile.am)
\ No newline at end of file
diff --git a/packaging/Makefile.am b/packaging/Makefile.am
deleted file mode 100644
index 17a41ad..0000000
--- a/packaging/Makefile.am
+++ /dev/null
@@ -1,18 +0,0 @@
-EXTRA_DIST = \
-  gnucash.spec.in \
-  gnucash.spec \
-  CMakeLists.txt
-
-all-local: gnucash.spec
-
-## We borrow guile's convention and use @-...-@ as the substitution
-## brackets here, instead of the usual @... at .  This prevents autoconf
-## from substituting the values directly into the left-hand sides of
-## the sed substitutions.  *sigh*
-gnucash.spec: gnucash.spec.in Makefile ${top_builddir}/config.status
-	rm -f $@.tmp
-	sed < $< > $@.tmp \
-            -e 's:@-VERSION-@:${VERSION}:'
-	mv $@.tmp $@
-
-DISTCLEANFILES = gnucash.spec
diff --git a/packaging/README.RPM b/packaging/README.RPM
deleted file mode 100644
index 6fd9eec..0000000
--- a/packaging/README.RPM
+++ /dev/null
@@ -1,88 +0,0 @@
-This directory contains spec files for building an RPM
-
-  REALLY WATCH OUT: The files in this directory are historical
-  examples.  They may be out of date and not maintained.  Please
-  contact your local distro supplier for updates.
-
-  WATCH OUT: These spec file(s) might be heavily out of date and/or
-  absolutely NOT SUITED to your distribution! They are particularly
-  matched for the Fedora Core 4 distribution, but DO NOT USE THEM if
-  you don't have exactly that distribution! Your own distribution
-  probably has its own source RPM of gnucash, and this source RPM
-  includes a spec file that is much better suited to your
-  distribution.
-
-  I repeat: DO NOT USE THIS SPEC file unless you either have Fedora
-  Core 4 or you really know how you can modify it to suit your
-  distribution.
-
-  For German-speaking users, there are German build instructions for
-  RPMs on http://linuxwiki.de/GnuCash/RpmInstallieren . 
-
-------------------------------
-Original file content:
-
-
-Short instructions:
-
-> I've never built an rpm; given a spec file, how do I do this?
-> I understand the theory, just not clear on what to type up.
-
-You'll need to be root in many distributions.  (It is possible to
-avoid this requirement, but I haven't done the work to the RPM.) 
-However, in some distributions (e.g. SuSE) these instructions will
-work even as a normal user.
-
-cd /usr/src/redhat/SOURCES
-tar -zxvf xacc-1.x.tar.gz
-cp xacc-1.x/rpm/xacc.spec ../SPECS
-cp xacc-1.x/rpm/xacc.wmconfig .
-
-cd /usr/src/redhat/SPECS
-rpm -ba xacc.spec
-
-wait a bit, and a new binary rpm will be in
-/usr/src/redhat/RPMS/<arch> and a new src.rpm will be in
-/usr/src/redhat/SRPMS.
-
-
-================================
-
-JPL version:
-
-1) Obtain a GnuCash distribution (source code .tar.gz file), 
-   either by downloading from an ftp site somewhere, or building
-   from CVS using "make dist".  The file should have the nomenclature
-   gnucash-X.Y.Z.tar.gz where X.Y.Z are the release numbers.
-
-2) Copy and uncompress/tar the distribution in your 
-   /usr/src/redhat/SOURCES directory.  You will need to do this as the 
-   root user.  Note, use your distribution-specific path here, only 
-   redhat uses "/usr/src/redhat".
-
-   cd /usr/src/redhat/SOURCES
-   cp /SOMEPATH/gnucash-X.Y.Z.tar.gz
-   tar xvzf gnucash-X.Y.Z.tar.gz
-
-3) Copy the rpm spec file to /usr/src/redhat/SPEC.
-
-   cp gnucash-X.Y.Z/rpm/gnucash.spec /usr/src/redhat/SPECS/.
-   
-4) Edit the spec file, you probably will only need to modify the 
-   following 3 lines, depending on what features you want to include 
-   in the rpm:
-
-   %define _with_postgres 0      (use postgres backend?)
-   %define _with_ofx 0           (use openofx package?)
-   %define _with_hbci 0          (use hbci package?)
-
-5) Build the binary and source RPMs
-   cd /usr/src/redhat/SPECS
-   rpmbuild -ba gnucash.spec
-
-   (note: older versions of rpm use "rpm -ba FILE.spec" to build) 
-   
-6) Wait a bit, and a new binary rpm will be in
-   /usr/src/redhat/RPMS/<arch> and a new src.rpm will be in
-   /usr/src/redhat/SRPMS.
-
diff --git a/packaging/gnucash.spec.in b/packaging/gnucash.spec.in
deleted file mode 100644
index a077f4a..0000000
--- a/packaging/gnucash.spec.in
+++ /dev/null
@@ -1,264 +0,0 @@
-#
-# Spec file for Fedora and other RedHat distros and derivatives
-#
-# Check whether GnuCash should build optional modules.
-# To modify parameters, edit the .spec file, 0 is off, 1 is on
-%define _with_postgres 0
-%define _with_ofx 1
-%define _with_hbci 1
-%define _with_dbi 1
-
-# The --whatprovides redhat-release lets us work on RHEL as well as FC
-# Granted, it will look weird, but at least it wont fail outright.
-%define fc_rel %(rpm -q --queryformat='%{VERSION}' --whatprovides redhat-release)
-
-# Edit dist if not a Fedora release
-%define dist FC%{fc_rel}
-
-%define version @-VERSION-@
-%define __libtoolize /bin/true
-
-%define libgnomeui_version 2.8.0
-%define libgnomeprintui_version 2.8.0
-%define guile_version 1.6.0
-%define gtkhtml3_version 3.1
-%define libofx_version 0.8.0
-%define aqbanking_version 1.3
-%define postgresql_version 7.1.3
-
-Name:      	gnucash
-Summary:   	GnuCash is an application to keep track of your finances.
-Version:   	%{version}
-Release:  	1.%{dist}
-License:	GPL
-Group:     	Applications/Finance
-URL:            http://www.gnucash.org
-Source:    	http://www.gnucash.org/pub/gnucash/sources/stable/gnucash-%{version}.tar.gz
-BuildRoot: 	%{_tmppath}/%{name}-%{version}-root
-
-Prereq:         GConf2
-Prereq:         /usr/bin/gconftool-2
-Prereq: 	/sbin/ldconfig
-PreReq:		/sbin/install-info
-
-Requires:  	libgnomeui >= %{libgnomeui_version}
-Requires:	libgnomeprintui22 >= %{libgnomeprintui22_version}
-Requires:	guile >= %{guile_version}
-Requires:	gtkhtml3 >= %{gtkhtml3_version}
-Requires:	slib >= 3a1
-
-BuildRequires:  gcc, intltool
-BuildRequires: 	libgnomeui-devel >= %{libgnomeui_version}
-BuildRequires: 	libgnomeprintui22-devel >= %{libgnomeprintui22_version}
-BuildRequires: 	gtkhtml3-devel >= %{gtkhtml3_version}
-BuildRequires: 	bzip2-devel, expat-devel, guile-devel
-BuildRequires: 	libglade2-devel, libgsf-devel
-BuildRequires: 	libjpeg-devel, openssl-devel
-BuildRequires:	goffice-devel
-
-%description
-GnuCash is a personal finance manager. A check-book like
-register GUI allows you to enter and track bank accounts,
-stocks, income and even currency trades. The interface is
-designed to be simple and easy to use, but is backed with
-double-entry accounting principles to ensure balanced books.
-
-
-%package devel
-Summary: Header files for GnuCash development.
-Group: Development/Libraries
-Requires: gnucash = %{version}
-
-%description devel
-This package contains header files for GnuCash development.
-Install this package if you want to use GnuCash libraries
-in C programs.
-
-
-%if %{_with_ofx}
-%package ofx
-Summary: Enables OFX importing in GnuCash
-Group: Applications/Finance
-Requires: gnucash = %{version}
-Requires: libofx >= %{libofx_version}
-BuildRequires: libofx-devel
-
-%description ofx
-This package adds OFX file import support to the base
-GnuCash package. Install this package if you want to
-import OFX files.
-%endif
-
-%if %{_with_hbci}
-%package hbci
-Summary: Enables HBCI importing in GnuCash
-Group: Applications/Finance
-Requires: gnucash = %{version}
-Requires: aqbanking >= %{aqbanking_version}
-BuildRequires: aqbanking-devel
-
-%description hbci
-This package adds HBCI file import support to the base
-GnuCash package. Install this package if you want to
-import HBCI files.
-%endif
-
-%if %{_with_postgres}
-%package backend-postgres
-Summary: Backend for storing GnuCash data in a PostgreSQL database.
-Group: Applications/Finance
-Requires: gnucash = %{version}
-Requires: postgresql >= %{postgresql_version}
-BuildRequires: postgresql-devel
-
-%description backend-postgres
-
-This package contains a backend for storing your GnuCash accounts and
-transactions in a PostgreSQL database.  Install this package if you
-want to keep your financial data in a database instead of a flat file
-(recommended for large volumes of data and commercial sites).
-%endif
-
-%if %{_with_dbi}
-%package backend-dbi
-Summary: DBI Backend for storing GnuCash data databases.
-Group: Applications/Finance
-Requires: gnucash = %{version}
-Requires: libdbi
-BuildRequires: libdbi-devel
-
-%description backend-dbi
-This package contains a backend for storing GnuCash accounts in databases
-using the libdbi package.  To enable this functionality, you must install
-one or more of the libdbi-dbd-* driver packages (e.g.  libdbi-dbd-mysql,
-libdbi-dbd-sqlite or libdbi-dbd-pgsql).
-%endif
-
-%prep
-%setup -q
-
-%build
-%configure \
-%if %{_with_ofx}
- --enable-ofx \
-%endif
-%if %{_with_hbci}
- --enable-aqbanking \
-%endif
-%if %{_with_postgres}
- --enable-sql \
-%endif
-%if %{_with_dbi}
- --enable-dbi \
-%endif
- --enable-gui
-
-
-make RPM_OPT_FLAGS="$RPM_OPT_FLAGS"
-
-%if %{_with_postgres}
-cp -p src/backend/postgres/README README.postgres
-%endif
-
-%install
-[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
-
-export GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL=1
-LIBRARY_PATH=$RPM_BUILD_ROOT%{_libdir}:$RPM_BUILD_ROOT%{_libdir}/gnucash make DESTDIR=$RPM_BUILD_ROOT install
-unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL
-
-%find_lang %name
-
-[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT/%{_infodir}/dir
-
-%clean
-[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
-
-%post
-/sbin/ldconfig
-/sbin/install-info %{_infodir}/gnucash-design.info.gz %{_infodir}/dir
-
-export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source`
-SCHEMAS=%{_sysconfdir}/gconf/schemas/apps_gnucash*.schemas
-for S in $SCHEMAS; do
-  gconftool-2 --makefile-install-rule $S > /dev/null
-done
-
-%preun
-if [ "$1" -eq 0 ]; then
-     #deleting the schema on package removal
-     export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source`
-     SCHEMAS=%{_sysconfdir}/gconf/schemas/apps_gnucash*.schemas
-     for S in $SCHEMAS; do
-       gconftool-2 --makefile-uninstall-rule $S > /dev/null
-     done
-fi
-
-%postun
-/sbin/ldconfig
-if [ $1 = 0 ]; then
-   /sbin/install-info --delete %{_infodir}/gnucash-design.info.gz %{_infodir}/dir
-fi
-
-%files -f %{name}.lang
-%defattr(444,root,root,755)
-%attr(555,root,root) %{_bindir}/*
-%attr(555,root,root) %{_libexecdir}/gnucash
-%{_mandir}/man*/*
-%{_infodir}/gnucash*info*
-%{_libdir}/*
-%{_datadir}/gnucash
-%{_datadir}/applications/*
-%{_datadir}/xml/gnucash/xsl/*
-%{_datadir}/icons/*
-%{_sysconfdir}/gconf/schemas/apps_gnucash*
-%if %{_with_ofx}
-%exclude %{_libdir}/gnucash/libgncmod-ofx*
-%endif
-%if %{_with_hbci}
-%exclude %{_libdir}/gnucash/libgncmod-aqbanking*
-%exclude %{_datadir}/gnucash/glade/aqbanking*
-%exclude %{_sysconfdir}/gconf/schemas/apps_gnucash_dialog_hbci.schemas
-%endif
-%if %{_with_postgres}
-%exclude %{_libdir}/libgnc-backend-postgres*
-%endif
-%if %{_with_dbi}
-%exclude %{_libdir}/gnucash/libgncmod-backend-dbi*
-%endif
-%config %{_sysconfdir}/gnucash
-%doc AUTHORS COPYING ChangeLog* DOCUMENTERS HACKING LICENSE NEWS README
-%doc doc/README.german doc/README.francais doc/guile-hackers.txt
-
-%files devel
-%defattr(444,root,root,755)
-%{_includedir}/gnucash
-
-%if %{_with_ofx}
-%files ofx
-%defattr(444,root,root,755)
-%{_libdir}/gnucash/libgncmod-ofx*
-%doc doc/README.OFX
-%endif
-
-%if %{_with_hbci}
-%files hbci
-%defattr(444,root,root,755)
-%{_libdir}/gnucash/libgncmod-aqbanking*
-%{_datadir}/gnucash/glade/aqbanking*
-%{_sysconfdir}/gconf/schemas/apps_gnucash_dialog_hbci.schemas
-%doc doc/README.HBCI
-%endif
-
-%if %{_with_postgres}
-%files backend-postgres
-%defattr(444,root,root,755)
-%{_libdir}/libgnc-backend-postgres*
-%doc README.postgres
-%endif
-
-%if %{_with_dbi}
-%files backend-dbi
-%defattr(444,root,root,755)
-%{_libdir}/gnucash/libgncmod-backend-dbi*
-%endif

commit dfe8ea45367bed94d224b8c8ca45a4e7f2e035bb
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Fri Aug 11 22:51:14 2017 +0200

    Add conditional source files to dist tarball
    
    They should be added even if not used on the system being used to create the dist tarball

diff --git a/gnucash/html/CMakeLists.txt b/gnucash/html/CMakeLists.txt
index eecbc96..c270c14 100644
--- a/gnucash/html/CMakeLists.txt
+++ b/gnucash/html/CMakeLists.txt
@@ -26,12 +26,14 @@ SET (html_SOURCES
 IF (WEBKIT1)
   LIST(APPEND html_HEADERS gnc-html-webkit1.h)
   LIST(APPEND html_SOURCES gnc-html-webkit1.c)
+  SET(html_EXTRA_DIST gnc-html-webkit2.h gnc-html-webkit2.c)
 ELSE ()
   LIST(APPEND html_HEADERS gnc-html-webkit2.h)
   LIST(APPEND html_SOURCES gnc-html-webkit2.c)
+  SET(html_EXTRA_DIST gnc-html-webkit1.h gnc-html-webkit1.c)
 ENDIF ()
 
-SET_DIST_LIST(html_DIST CMakeLists.txt Makefile.am ${html_HEADERS} ${html_SOURCES} gnc-html.i)
+SET_DIST_LIST(html_DIST CMakeLists.txt Makefile.am ${html_HEADERS} ${html_SOURCES} gnc-html.i ${html_EXTRA_DIST})
 
 ADD_LIBRARY (gncmod-html
   ${html_SOURCES}
diff --git a/libgnucash/engine/CMakeLists.txt b/libgnucash/engine/CMakeLists.txt
index 4f25a1e..b4c82ad 100644
--- a/libgnucash/engine/CMakeLists.txt
+++ b/libgnucash/engine/CMakeLists.txt
@@ -324,6 +324,10 @@ SET(engine_EXTRA_DIST
         README.query-api
         SX-book-p.h
         )
+
+IF (NOT WIN32)
+  LIST(APPEND engine_EXTRA_DIST qof-win32.cpp)
+ENDIF (NOT WIN32)
 SET_LOCAL_DIST(engine_DIST_local CMakeLists.txt Makefile.am ${engine_SOURCES} ${engine_HEADERS}
                      ${engine_noinst_HEADERS} ${engine_SCHEME_0} ${engine_SCHEME_1} ${engine_EXTRA_DIST})
 SET(engine_DIST ${engine_DIST_local} ${engine_test_core_DIST} ${test_engine_DIST} PARENT_SCOPE)

commit 0c6da2f001fe5fff711af081c806e2fe055af0af
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Fri Aug 11 22:44:50 2017 +0200

    Cleanup some more obscure references to no longer existing 'src' directory

diff --git a/contrib/art/tango/gnc-invoice-pay.svg b/contrib/art/tango/gnc-invoice-pay.svg
index ac40af7..ec34fba 100644
--- a/contrib/art/tango/gnc-invoice-pay.svg
+++ b/contrib/art/tango/gnc-invoice-pay.svg
@@ -16,7 +16,7 @@
    sodipodi:version="0.32"
    inkscape:version="0.47pre3 r22311"
    sodipodi:docname="gnc-invoice-pay.svg"
-   inkscape:export-filename="/home/janssege/Development/EclipseWS/GnuCash-trunk/src/pixmaps/gnc-invoice-pay.png"
+   inkscape:export-filename="pixmaps/gnc-invoice-pay.png"
    inkscape:export-xdpi="90"
    inkscape:export-ydpi="90"
    version="1.0">
diff --git a/gnucash/bin/gnucash-valgrind.in b/gnucash/bin/gnucash-valgrind.in
index d9be7e9..a10a874 100644
--- a/gnucash/bin/gnucash-valgrind.in
+++ b/gnucash/bin/gnucash-valgrind.in
@@ -12,11 +12,11 @@ TOP_SRC_DIR="@-TOP_SRC_DIR-@"
 export G_SLICE=always-malloc
 export G_DEBUG=gc-friendly
 exec valgrind -v \
-    --suppressions=${TOP_SRC_DIR}/src/debug/valgrind/valgrind-gnucash.supp \
-    --suppressions=${TOP_SRC_DIR}/src/debug/valgrind/valgrind-glib.supp \
-    --suppressions=${TOP_SRC_DIR}/src/debug/valgrind/valgrind-libfontconfig.supp \
-    --suppressions=${TOP_SRC_DIR}/src/debug/valgrind/valgrind-libgda.supp \
-    --suppressions=${TOP_SRC_DIR}/src/debug/valgrind/valgrind-libguile.supp \
+    --suppressions=${TOP_SRC_DIR}/common/debug/valgrind/valgrind-gnucash.supp \
+    --suppressions=${TOP_SRC_DIR}/common/debug/valgrind/valgrind-glib.supp \
+    --suppressions=${TOP_SRC_DIR}/common/debug/valgrind/valgrind-libfontconfig.supp \
+    --suppressions=${TOP_SRC_DIR}/common/debug/valgrind/valgrind-libgda.supp \
+    --suppressions=${TOP_SRC_DIR}/common/debug/valgrind/valgrind-libguile.supp \
     --num-callers=25 \
     --error-limit=no \
     --tool=memcheck \
diff --git a/libgnucash/backend/dbi/.splintrc b/libgnucash/backend/dbi/.splintrc
index 3120058..5026cb7 100644
--- a/libgnucash/backend/dbi/.splintrc
+++ b/libgnucash/backend/dbi/.splintrc
@@ -7,14 +7,12 @@
 -I..
 -I../..
 -I../../..
--I../../gnc-module
--I../../../src/backend
--I../../../src/backend/sql
--I../../../src/engine
--I../../../src/core-utils
+-I../../../libgnucash/gnc-module
+-I../../../libgnucash/backend
+-I../../../libgnucash/backend/sql
+-I../../../libgnucash/engine
+-I../../../libgnucash/core-utils
 -I../../../lib/libc
--I../../../lib/libqof/qof
--I../../../lib/libqof/qof
 -I/usr/include/glib-2.0
 -I/usr/lib/glib-2.0/include
 -I/usr/include/gconf/2
diff --git a/libgnucash/backend/xml/test/test-load-example-account.cpp b/libgnucash/backend/xml/test/test-load-example-account.cpp
index c098e81..7967516 100644
--- a/libgnucash/backend/xml/test/test-load-example-account.cpp
+++ b/libgnucash/backend/xml/test/test-load-example-account.cpp
@@ -74,7 +74,7 @@ guile_main (void* closure, int argc, char** argv)
 
     if (!location)
     {
-        location = "../../../../accounts/C";
+        location = "../../../../data/accounts/C";
     }
 
     gnc_module_system_init ();
diff --git a/libgnucash/core-utils/gnc-path.c b/libgnucash/core-utils/gnc-path.c
index b9aa162..56b9586 100644
--- a/libgnucash/core-utils/gnc-path.c
+++ b/libgnucash/core-utils/gnc-path.c
@@ -168,7 +168,7 @@ gchar *gnc_path_get_reportdir()
     const gchar *builddir = g_getenv ("GNC_BUILDDIR");
     if (g_getenv ("GNC_UNINSTALLED") && builddir)
     {
-        result = g_build_filename (builddir, "src", "report", NULL);
+        result = g_build_filename (builddir, "gnucash", "report", NULL);
     }
     else
     {
diff --git a/libgnucash/doc/doxygen.cfg.in b/libgnucash/doc/doxygen.cfg.in
index b2772a3..cde836c 100644
--- a/libgnucash/doc/doxygen.cfg.in
+++ b/libgnucash/doc/doxygen.cfg.in
@@ -652,8 +652,8 @@ WARN_LOGFILE           = doxygen.log
 # directories like "/usr/src/myproject". Separate the files or directories
 # with spaces.
 
-INPUT                  = @-top_srcdir-@/src \
-                         @-top_srcdir-@/src/engine/
+INPUT                  = @-top_srcdir-@/libgnucash \
+                         @-top_srcdir-@/libgnucash/engine/
 
 # This tag can be used to specify the character encoding of the source files
 # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
@@ -1548,7 +1548,7 @@ SEARCH_INCLUDES        = YES
 # contain include files that are not input files but should be processed by
 # the preprocessor.
 
-INCLUDE_PATH           = @-top_srcdir-@/src/engine/
+INCLUDE_PATH           = @-top_srcdir-@/libgnucash/engine/
 
 # You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
 # patterns (like *.h and *.hpp) to filter out the header-files in the
diff --git a/libgnucash/gnc-module/test/test-gwrapped-c.in b/libgnucash/gnc-module/test/test-gwrapped-c.in
index 9c731cb..b3dacaf 100755
--- a/libgnucash/gnc-module/test/test-gwrapped-c.in
+++ b/libgnucash/gnc-module/test/test-gwrapped-c.in
@@ -3,7 +3,7 @@ ${GUILE} -c "(use-modules (gnucash unittest-support))
           (define log-domain \"gnc.module\")
           (define check (new-TestErrorStruct))
           (define log-level (G-LOG-LEVEL-WARNING))
-          (define msg \"Module '../../../src/gnc-module/test/misc-mods/.libs/libgncmod_futuremodsys.so' requires newer module system\n\")
+          (define msg \"Module '../../../libgnucash/gnc-module/test/misc-mods/.libs/libgncmod_futuremodsys.so' requires newer module system\n\")
           (TestErrorStruct-log-domain-set check log-domain)
           (TestErrorStruct-log-level-set check log-level)
           (TestErrorStruct-msg-set check msg)
diff --git a/libgnucash/gnc-module/test/test-load-deps.in b/libgnucash/gnc-module/test/test-load-deps.in
index 5d71951..9af6410 100755
--- a/libgnucash/gnc-module/test/test-load-deps.in
+++ b/libgnucash/gnc-module/test/test-load-deps.in
@@ -7,7 +7,7 @@ exec ${GUILE} -s $0 "$@"
 (define log-domain "gnc.module")
 (define check (new-TestErrorStruct))
 (define log-level (G-LOG-LEVEL-WARNING))
-(define msg "Module '../../../src/gnc-module/test/misc-mods/.libs/libgncmod_futuremodsys.so' requires newer module system\n")
+(define msg "Module '../../../libgnucash/gnc-module/test/misc-mods/.libs/libgncmod_futuremodsys.so' requires newer module system\n")
 (TestErrorStruct-log-domain-set check log-domain)
 (TestErrorStruct-log-level-set check log-level)
 (TestErrorStruct-msg-set check msg)
diff --git a/libgnucash/gnc-module/test/test-load-scm.in b/libgnucash/gnc-module/test/test-load-scm.in
index a411892..61eddeb 100755
--- a/libgnucash/gnc-module/test/test-load-scm.in
+++ b/libgnucash/gnc-module/test/test-load-scm.in
@@ -6,7 +6,7 @@ exec ${GUILE} -s $0 "$@"
 (define log-domain "gnc.module")
 (define check (new-TestErrorStruct))
 (define log-level (G-LOG-LEVEL-WARNING))
-(define msg "Module '../../../src/gnc-module/test/misc-mods/.libs/libgncmod_futuremodsys.so' requires newer module system\n")
+(define msg "Module '../../../libgnucash/gnc-module/test/misc-mods/.libs/libgncmod_futuremodsys.so' requires newer module system\n")
 (TestErrorStruct-log-domain-set check log-domain)
 (TestErrorStruct-log-level-set check log-level)
 (TestErrorStruct-msg-set check msg)
diff --git a/libgnucash/gnc-module/test/test-scm-init.in b/libgnucash/gnc-module/test/test-scm-init.in
index 86d30dc..9825da7 100755
--- a/libgnucash/gnc-module/test/test-scm-init.in
+++ b/libgnucash/gnc-module/test/test-scm-init.in
@@ -7,7 +7,7 @@ exec ${GUILE} -s $0 "$@"
 (define log-domain "gnc.module")
 (define check (new-TestErrorStruct))
 (define log-level (G-LOG-LEVEL-WARNING))
-(define msg "Module '../../../src/gnc-module/test/misc-mods/.libs/libgncmod_futuremodsys.so' requires newer module system\n")
+(define msg "Module '../../../libgnucash/gnc-module/test/misc-mods/.libs/libgncmod_futuremodsys.so' requires newer module system\n")
 (TestErrorStruct-log-domain-set check log-domain)
 (TestErrorStruct-log-level-set check log-level)
 (TestErrorStruct-msg-set check msg)
diff --git a/libgnucash/gnc-module/test/test-scm-module.in b/libgnucash/gnc-module/test/test-scm-module.in
index 315621b..efac218 100755
--- a/libgnucash/gnc-module/test/test-scm-module.in
+++ b/libgnucash/gnc-module/test/test-scm-module.in
@@ -3,7 +3,7 @@ ${GUILE} -c "(use-modules (gnucash unittest-support))
           (define log-domain \"gnc.module\")
           (define check (new-TestErrorStruct))
           (define log-level (G-LOG-LEVEL-WARNING))
-          (define msg \"Module '../../../src/gnc-module/test/misc-mods/.libs/libgncmod_futuremodsys.so' requires newer module system\n\")
+          (define msg \"Module '../../../libgnucash/gnc-module/test/misc-mods/.libs/libgncmod_futuremodsys.so' requires newer module system\n\")
           (TestErrorStruct-log-domain-set check log-domain)
           (TestErrorStruct-log-level-set check log-level)
           (TestErrorStruct-msg-set check msg)
diff --git a/libgnucash/gnc-module/test/test-scm-multi.in b/libgnucash/gnc-module/test/test-scm-multi.in
index 1649116..c0600a2 100755
--- a/libgnucash/gnc-module/test/test-scm-multi.in
+++ b/libgnucash/gnc-module/test/test-scm-multi.in
@@ -5,7 +5,7 @@ exec ${GUILE} -s $0 "$@"
 (define log-domain "gnc.module")
 (define check (new-TestErrorStruct))
 (define log-level (G-LOG-LEVEL-WARNING))
-(define msg "Module '../../../src/gnc-module/test/misc-mods/.libs/libgncmod_futuremodsys.so' requires newer module system\n")
+(define msg "Module '../../../libgnucash/gnc-module/test/misc-mods/.libs/libgncmod_futuremodsys.so' requires newer module system\n")
 (TestErrorStruct-log-domain-set check log-domain)
 (TestErrorStruct-log-level-set check log-level)
 (TestErrorStruct-msg-set check msg)

commit afecab330a437a107e9859fd6bbe42de32a335a9
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Fri Aug 11 22:14:31 2017 +0200

    Move accounts, checks and pixmaps into a data directory
    
    At the same time move the art directory into contrib to unclutter the top level

diff --git a/CMakeLists.txt b/CMakeLists.txt
index ffad3d1..239e41b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -680,8 +680,7 @@ SET(SCHEME_INSTALLED_SOURCE_DIR ${CMAKE_INSTALL_PREFIX}/share/gnucash/scm)
 SET(SCHEME_INSTALLED_CACHE_DIR ${CMAKE_INSTALL_PREFIX}/lib/gnucash/scm/ccache/${GUILE_EFFECTIVE_VERSION})
 
 # The subdirectories
-ADD_SUBDIRECTORY (accounts)
-ADD_SUBDIRECTORY (checks)
+ADD_SUBDIRECTORY (data)
 ADD_SUBDIRECTORY (doc)
 ADD_SUBDIRECTORY (lib)
 ADD_SUBDIRECTORY (macros)
@@ -725,7 +724,7 @@ SET_LOCAL_DIST(toplvl_DIST ${toplvl_DIST_local})
 # then uses a (SET ${foo_DIST} ${locals....} PARENT_SCOPE) command to report up. See the bottom of
 # libgnucash/app-utils/CMakeLists.txt for an example of this.
 
-SET(ALL_DIST ${accounts_DIST} ${bindings_DIST} ${checks_DIST} ${cmake_DIST} ${common_DIST}
+SET(ALL_DIST ${bindings_DIST} ${cmake_DIST} ${common_DIST} ${data_DIST}
     ${doc_DIST} ${gnucash_DIST} ${lib_DIST} ${libgnucash_DIST} ${macros_DIST} ${packaging_DIST}
     ${po_DIST} ${test_templates_DIST} ${toplvl_DIST} ${util_DIST})
 
diff --git a/Makefile.am b/Makefile.am
index 5fa7dba..95d76eb 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -3,7 +3,7 @@ if GNUCASH_ENABLE_GUI
 else
   GNUCASH_SUBDIR =
 endif
-SUBDIRS = . doc lib common libgnucash bindings ${GNUCASH_SUBDIR} packaging po accounts checks
+SUBDIRS = . doc lib common libgnucash bindings ${GNUCASH_SUBDIR} packaging po data
 
 GNC_CTAGS_FILE = @GNC_CTAGS_FILE@
 GNC_ETAGS_FILE = @GNC_ETAGS_FILE@
diff --git a/configure.ac b/configure.ac
index 500c845..34417cb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1602,45 +1602,47 @@ AC_CONFIG_FILES(
   po/Makefile.in
   dnl # Makefiles
   Makefile
-  accounts/Makefile
-  accounts/C/Makefile
-  accounts/cs/Makefile
-  accounts/da/Makefile
-  accounts/de_AT/Makefile
-  accounts/de_CH/Makefile
-  accounts/de_DE/Makefile
-  accounts/el_GR/Makefile
-  accounts/en_GB/Makefile
-  accounts/es_ES/Makefile
-  accounts/es_MX/Makefile
-  accounts/fi_FI/Makefile
-  accounts/fr_CA/Makefile
-  accounts/fr_CH/Makefile
-  accounts/fr_FR/Makefile
-  accounts/hu_HU/Makefile
-  accounts/it/Makefile
-  accounts/ja/Makefile
-  accounts/ko/Makefile
-  accounts/lt/Makefile
-  accounts/lv/Makefile
-  accounts/nb/Makefile
-  accounts/nl/Makefile
-  accounts/pl/Makefile
-  accounts/pt_BR/Makefile
-  accounts/pt_PT/Makefile
-  accounts/ru/Makefile
-  accounts/sk/Makefile
-  accounts/sv_AX/Makefile
-  accounts/sv_FI/Makefile
-  accounts/sv_SE/Makefile
-  accounts/tr_TR/Makefile
-  accounts/zh_CN/Makefile
-  accounts/zh_HK/Makefile
-  accounts/zh_TW/Makefile
+  data/Makefile
+  data/accounts/Makefile
+  data/accounts/C/Makefile
+  data/accounts/cs/Makefile
+  data/accounts/da/Makefile
+  data/accounts/de_AT/Makefile
+  data/accounts/de_CH/Makefile
+  data/accounts/de_DE/Makefile
+  data/accounts/el_GR/Makefile
+  data/accounts/en_GB/Makefile
+  data/accounts/es_ES/Makefile
+  data/accounts/es_MX/Makefile
+  data/accounts/fi_FI/Makefile
+  data/accounts/fr_CA/Makefile
+  data/accounts/fr_CH/Makefile
+  data/accounts/fr_FR/Makefile
+  data/accounts/hu_HU/Makefile
+  data/accounts/it/Makefile
+  data/accounts/ja/Makefile
+  data/accounts/ko/Makefile
+  data/accounts/lt/Makefile
+  data/accounts/lv/Makefile
+  data/accounts/nb/Makefile
+  data/accounts/nl/Makefile
+  data/accounts/pl/Makefile
+  data/accounts/pt_BR/Makefile
+  data/accounts/pt_PT/Makefile
+  data/accounts/ru/Makefile
+  data/accounts/sk/Makefile
+  data/accounts/sv_AX/Makefile
+  data/accounts/sv_FI/Makefile
+  data/accounts/sv_SE/Makefile
+  data/accounts/tr_TR/Makefile
+  data/accounts/zh_CN/Makefile
+  data/accounts/zh_HK/Makefile
+  data/accounts/zh_TW/Makefile
+  data/checks/Makefile
+  data/pixmaps/Makefile
   bindings/Makefile
   bindings/python/Makefile
   bindings/python/tests/Makefile
-  checks/Makefile
   common/Makefile
   common/debug/Makefile
   common/debug/valgrind/Makefile
@@ -1742,7 +1744,6 @@ AC_CONFIG_FILES(
   libgnucash/gnc-module/test/mod-bar/Makefile
   libgnucash/gnc-module/test/mod-baz/Makefile
   libgnucash/gnc-module/test/misc-mods/Makefile
-  libgnucash/pixmaps/Makefile
   libgnucash/quotes/Makefile
   libgnucash/scm/Makefile
   libgnucash/scm/gnumeric/Makefile
diff --git a/art/banner.svgz b/contrib/art/banner.svgz
similarity index 100%
rename from art/banner.svgz
rename to contrib/art/banner.svgz
diff --git a/art/icon.svgz b/contrib/art/icon.svgz
similarity index 100%
rename from art/icon.svgz
rename to contrib/art/icon.svgz
diff --git a/art/logo.svgz b/contrib/art/logo.svgz
similarity index 100%
rename from art/logo.svgz
rename to contrib/art/logo.svgz
diff --git a/art/splash.svgz b/contrib/art/splash.svgz
similarity index 100%
rename from art/splash.svgz
rename to contrib/art/splash.svgz
diff --git a/art/stock_split_title.png b/contrib/art/stock_split_title.png
similarity index 100%
rename from art/stock_split_title.png
rename to contrib/art/stock_split_title.png
diff --git a/art/stock_split_watermark.png b/contrib/art/stock_split_watermark.png
similarity index 100%
rename from art/stock_split_watermark.png
rename to contrib/art/stock_split_watermark.png
diff --git a/art/tango/README b/contrib/art/tango/README
similarity index 100%
rename from art/tango/README
rename to contrib/art/tango/README
diff --git a/art/tango/gnc-invoice-pay.svg b/contrib/art/tango/gnc-invoice-pay.svg
similarity index 100%
rename from art/tango/gnc-invoice-pay.svg
rename to contrib/art/tango/gnc-invoice-pay.svg
diff --git a/art/tango/gnucash-16x16.svg b/contrib/art/tango/gnucash-16x16.svg
similarity index 100%
rename from art/tango/gnucash-16x16.svg
rename to contrib/art/tango/gnucash-16x16.svg
diff --git a/art/tango/gnucash-22x22.svg b/contrib/art/tango/gnucash-22x22.svg
similarity index 100%
rename from art/tango/gnucash-22x22.svg
rename to contrib/art/tango/gnucash-22x22.svg
diff --git a/art/tango/gnucash-32x32.svg b/contrib/art/tango/gnucash-32x32.svg
similarity index 100%
rename from art/tango/gnucash-32x32.svg
rename to contrib/art/tango/gnucash-32x32.svg
diff --git a/art/tango/gnucash-48x48+.svg b/contrib/art/tango/gnucash-48x48+.svg
similarity index 100%
rename from art/tango/gnucash-48x48+.svg
rename to contrib/art/tango/gnucash-48x48+.svg
diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt
new file mode 100644
index 0000000..9232e88
--- /dev/null
+++ b/data/CMakeLists.txt
@@ -0,0 +1,11 @@
+# CMakeLists.txt for data/
+
+# The subdirectories
+ADD_SUBDIRECTORY (accounts)
+ADD_SUBDIRECTORY (checks)
+ADD_SUBDIRECTORY (pixmaps)
+
+SET_LOCAL_DIST(data_DIST_local CMakeLists.txt Makefile.am ${data_EXTRA_DIST})
+
+SET(data_DIST ${data_DIST_local} ${accounts_DIST} ${checks_DIST}
+             ${pixmaps_DIST} PARENT_SCOPE)
diff --git a/data/Makefile.am b/data/Makefile.am
new file mode 100644
index 0000000..76cdc01
--- /dev/null
+++ b/data/Makefile.am
@@ -0,0 +1,4 @@
+SUBDIRS = \
+  accounts \
+  checks \
+  pixmaps
diff --git a/accounts/C/CMakeLists.txt b/data/accounts/C/CMakeLists.txt
similarity index 100%
rename from accounts/C/CMakeLists.txt
rename to data/accounts/C/CMakeLists.txt
diff --git a/accounts/C/Makefile.am b/data/accounts/C/Makefile.am
similarity index 100%
rename from accounts/C/Makefile.am
rename to data/accounts/C/Makefile.am
diff --git a/accounts/C/acctchrt_brokerage.gnucash-xea b/data/accounts/C/acctchrt_brokerage.gnucash-xea
similarity index 100%
rename from accounts/C/acctchrt_brokerage.gnucash-xea
rename to data/accounts/C/acctchrt_brokerage.gnucash-xea
diff --git a/accounts/C/acctchrt_business.gnucash-xea b/data/accounts/C/acctchrt_business.gnucash-xea
similarity index 100%
rename from accounts/C/acctchrt_business.gnucash-xea
rename to data/accounts/C/acctchrt_business.gnucash-xea
diff --git a/accounts/C/acctchrt_carloan.gnucash-xea b/data/accounts/C/acctchrt_carloan.gnucash-xea
similarity index 100%
rename from accounts/C/acctchrt_carloan.gnucash-xea
rename to data/accounts/C/acctchrt_carloan.gnucash-xea
diff --git a/accounts/C/acctchrt_cdmoneymkt.gnucash-xea b/data/accounts/C/acctchrt_cdmoneymkt.gnucash-xea
similarity index 100%
rename from accounts/C/acctchrt_cdmoneymkt.gnucash-xea
rename to data/accounts/C/acctchrt_cdmoneymkt.gnucash-xea
diff --git a/accounts/C/acctchrt_checkbook.gnucash-xea b/data/accounts/C/acctchrt_checkbook.gnucash-xea
similarity index 100%
rename from accounts/C/acctchrt_checkbook.gnucash-xea
rename to data/accounts/C/acctchrt_checkbook.gnucash-xea
diff --git a/accounts/C/acctchrt_childcare.gnucash-xea b/data/accounts/C/acctchrt_childcare.gnucash-xea
similarity index 100%
rename from accounts/C/acctchrt_childcare.gnucash-xea
rename to data/accounts/C/acctchrt_childcare.gnucash-xea
diff --git a/accounts/C/acctchrt_common.gnucash-xea b/data/accounts/C/acctchrt_common.gnucash-xea
similarity index 100%
rename from accounts/C/acctchrt_common.gnucash-xea
rename to data/accounts/C/acctchrt_common.gnucash-xea
diff --git a/accounts/C/acctchrt_eduloan.gnucash-xea b/data/accounts/C/acctchrt_eduloan.gnucash-xea
similarity index 100%
rename from accounts/C/acctchrt_eduloan.gnucash-xea
rename to data/accounts/C/acctchrt_eduloan.gnucash-xea
diff --git a/accounts/C/acctchrt_fixedassets.gnucash-xea b/data/accounts/C/acctchrt_fixedassets.gnucash-xea
similarity index 100%
rename from accounts/C/acctchrt_fixedassets.gnucash-xea
rename to data/accounts/C/acctchrt_fixedassets.gnucash-xea
diff --git a/accounts/C/acctchrt_full.gnucash-xea b/data/accounts/C/acctchrt_full.gnucash-xea
similarity index 100%
rename from accounts/C/acctchrt_full.gnucash-xea
rename to data/accounts/C/acctchrt_full.gnucash-xea
diff --git a/accounts/C/acctchrt_homeloan.gnucash-xea b/data/accounts/C/acctchrt_homeloan.gnucash-xea
similarity index 100%
rename from accounts/C/acctchrt_homeloan.gnucash-xea
rename to data/accounts/C/acctchrt_homeloan.gnucash-xea
diff --git a/accounts/C/acctchrt_homeown.gnucash-xea b/data/accounts/C/acctchrt_homeown.gnucash-xea
similarity index 100%
rename from accounts/C/acctchrt_homeown.gnucash-xea
rename to data/accounts/C/acctchrt_homeown.gnucash-xea
diff --git a/accounts/C/acctchrt_otherloan.gnucash-xea b/data/accounts/C/acctchrt_otherloan.gnucash-xea
similarity index 100%
rename from accounts/C/acctchrt_otherloan.gnucash-xea
rename to data/accounts/C/acctchrt_otherloan.gnucash-xea
diff --git a/accounts/C/acctchrt_renter.gnucash-xea b/data/accounts/C/acctchrt_renter.gnucash-xea
similarity index 100%
rename from accounts/C/acctchrt_renter.gnucash-xea
rename to data/accounts/C/acctchrt_renter.gnucash-xea
diff --git a/accounts/C/acctchrt_retiremt.gnucash-xea b/data/accounts/C/acctchrt_retiremt.gnucash-xea
similarity index 100%
rename from accounts/C/acctchrt_retiremt.gnucash-xea
rename to data/accounts/C/acctchrt_retiremt.gnucash-xea
diff --git a/accounts/C/acctchrt_spouseinc.gnucash-xea b/data/accounts/C/acctchrt_spouseinc.gnucash-xea
similarity index 100%
rename from accounts/C/acctchrt_spouseinc.gnucash-xea
rename to data/accounts/C/acctchrt_spouseinc.gnucash-xea
diff --git a/accounts/C/acctchrt_spouseretire.gnucash-xea b/data/accounts/C/acctchrt_spouseretire.gnucash-xea
similarity index 100%
rename from accounts/C/acctchrt_spouseretire.gnucash-xea
rename to data/accounts/C/acctchrt_spouseretire.gnucash-xea
diff --git a/accounts/CMakeLists.txt b/data/accounts/CMakeLists.txt
similarity index 100%
rename from accounts/CMakeLists.txt
rename to data/accounts/CMakeLists.txt
diff --git a/accounts/Makefile.am b/data/accounts/Makefile.am
similarity index 100%
rename from accounts/Makefile.am
rename to data/accounts/Makefile.am
diff --git a/accounts/cs/CMakeLists.txt b/data/accounts/cs/CMakeLists.txt
similarity index 100%
rename from accounts/cs/CMakeLists.txt
rename to data/accounts/cs/CMakeLists.txt
diff --git a/accounts/cs/Makefile.am b/data/accounts/cs/Makefile.am
similarity index 100%
rename from accounts/cs/Makefile.am
rename to data/accounts/cs/Makefile.am
diff --git a/accounts/cs/acctchrt_brokerage.gnucash-xea b/data/accounts/cs/acctchrt_brokerage.gnucash-xea
similarity index 100%
rename from accounts/cs/acctchrt_brokerage.gnucash-xea
rename to data/accounts/cs/acctchrt_brokerage.gnucash-xea
diff --git a/accounts/cs/acctchrt_carloan.gnucash-xea b/data/accounts/cs/acctchrt_carloan.gnucash-xea
similarity index 100%
rename from accounts/cs/acctchrt_carloan.gnucash-xea
rename to data/accounts/cs/acctchrt_carloan.gnucash-xea
diff --git a/accounts/cs/acctchrt_cdmoneymkt.gnucash-xea b/data/accounts/cs/acctchrt_cdmoneymkt.gnucash-xea
similarity index 100%
rename from accounts/cs/acctchrt_cdmoneymkt.gnucash-xea
rename to data/accounts/cs/acctchrt_cdmoneymkt.gnucash-xea
diff --git a/accounts/cs/acctchrt_childcare.gnucash-xea b/data/accounts/cs/acctchrt_childcare.gnucash-xea
similarity index 100%
rename from accounts/cs/acctchrt_childcare.gnucash-xea
rename to data/accounts/cs/acctchrt_childcare.gnucash-xea
diff --git a/accounts/cs/acctchrt_common.gnucash-xea b/data/accounts/cs/acctchrt_common.gnucash-xea
similarity index 100%
rename from accounts/cs/acctchrt_common.gnucash-xea
rename to data/accounts/cs/acctchrt_common.gnucash-xea
diff --git a/accounts/cs/acctchrt_currency.gnucash-xea b/data/accounts/cs/acctchrt_currency.gnucash-xea
similarity index 100%
rename from accounts/cs/acctchrt_currency.gnucash-xea
rename to data/accounts/cs/acctchrt_currency.gnucash-xea
diff --git a/accounts/cs/acctchrt_eduloan.gnucash-xea b/data/accounts/cs/acctchrt_eduloan.gnucash-xea
similarity index 100%
rename from accounts/cs/acctchrt_eduloan.gnucash-xea
rename to data/accounts/cs/acctchrt_eduloan.gnucash-xea
diff --git a/accounts/cs/acctchrt_fixedassets.gnucash-xea b/data/accounts/cs/acctchrt_fixedassets.gnucash-xea
similarity index 100%
rename from accounts/cs/acctchrt_fixedassets.gnucash-xea
rename to data/accounts/cs/acctchrt_fixedassets.gnucash-xea
diff --git a/accounts/cs/acctchrt_homeloan.gnucash-xea b/data/accounts/cs/acctchrt_homeloan.gnucash-xea
similarity index 100%
rename from accounts/cs/acctchrt_homeloan.gnucash-xea
rename to data/accounts/cs/acctchrt_homeloan.gnucash-xea
diff --git a/accounts/cs/acctchrt_homeown.gnucash-xea b/data/accounts/cs/acctchrt_homeown.gnucash-xea
similarity index 100%
rename from accounts/cs/acctchrt_homeown.gnucash-xea
rename to data/accounts/cs/acctchrt_homeown.gnucash-xea
diff --git a/accounts/cs/acctchrt_otherloan.gnucash-xea b/data/accounts/cs/acctchrt_otherloan.gnucash-xea
similarity index 100%
rename from accounts/cs/acctchrt_otherloan.gnucash-xea
rename to data/accounts/cs/acctchrt_otherloan.gnucash-xea
diff --git a/accounts/cs/acctchrt_renter.gnucash-xea b/data/accounts/cs/acctchrt_renter.gnucash-xea
similarity index 100%
rename from accounts/cs/acctchrt_renter.gnucash-xea
rename to data/accounts/cs/acctchrt_renter.gnucash-xea
diff --git a/accounts/cs/acctchrt_retiremt.gnucash-xea b/data/accounts/cs/acctchrt_retiremt.gnucash-xea
similarity index 100%
rename from accounts/cs/acctchrt_retiremt.gnucash-xea
rename to data/accounts/cs/acctchrt_retiremt.gnucash-xea
diff --git a/accounts/cs/acctchrt_spouseinc.gnucash-xea b/data/accounts/cs/acctchrt_spouseinc.gnucash-xea
similarity index 100%
rename from accounts/cs/acctchrt_spouseinc.gnucash-xea
rename to data/accounts/cs/acctchrt_spouseinc.gnucash-xea
diff --git a/accounts/cs/acctchrt_spouseretire.gnucash-xea b/data/accounts/cs/acctchrt_spouseretire.gnucash-xea
similarity index 100%
rename from accounts/cs/acctchrt_spouseretire.gnucash-xea
rename to data/accounts/cs/acctchrt_spouseretire.gnucash-xea
diff --git a/accounts/da/CMakeLists.txt b/data/accounts/da/CMakeLists.txt
similarity index 100%
rename from accounts/da/CMakeLists.txt
rename to data/accounts/da/CMakeLists.txt
diff --git a/accounts/da/Makefile.am b/data/accounts/da/Makefile.am
similarity index 100%
rename from accounts/da/Makefile.am
rename to data/accounts/da/Makefile.am
diff --git a/accounts/da/acctchrt_car.gnucash-xea b/data/accounts/da/acctchrt_car.gnucash-xea
similarity index 100%
rename from accounts/da/acctchrt_car.gnucash-xea
rename to data/accounts/da/acctchrt_car.gnucash-xea
diff --git a/accounts/da/acctchrt_common.gnucash-xea b/data/accounts/da/acctchrt_common.gnucash-xea
similarity index 100%
rename from accounts/da/acctchrt_common.gnucash-xea
rename to data/accounts/da/acctchrt_common.gnucash-xea
diff --git a/accounts/da/acctchrt_homeloan.gnucash-xea b/data/accounts/da/acctchrt_homeloan.gnucash-xea
similarity index 100%
rename from accounts/da/acctchrt_homeloan.gnucash-xea
rename to data/accounts/da/acctchrt_homeloan.gnucash-xea
diff --git a/accounts/da/acctchrt_homeown.gnucash-xea b/data/accounts/da/acctchrt_homeown.gnucash-xea
similarity index 100%
rename from accounts/da/acctchrt_homeown.gnucash-xea
rename to data/accounts/da/acctchrt_homeown.gnucash-xea
diff --git a/accounts/de_AT/CMakeLists.txt b/data/accounts/de_AT/CMakeLists.txt
similarity index 100%
rename from accounts/de_AT/CMakeLists.txt
rename to data/accounts/de_AT/CMakeLists.txt
diff --git a/accounts/de_AT/Makefile.am b/data/accounts/de_AT/Makefile.am
similarity index 100%
rename from accounts/de_AT/Makefile.am
rename to data/accounts/de_AT/Makefile.am
diff --git a/accounts/de_AT/acctchrt_auto.gnucash-xea b/data/accounts/de_AT/acctchrt_auto.gnucash-xea
similarity index 100%
rename from accounts/de_AT/acctchrt_auto.gnucash-xea
rename to data/accounts/de_AT/acctchrt_auto.gnucash-xea
diff --git a/accounts/de_AT/acctchrt_autoloan.gnucash-xea b/data/accounts/de_AT/acctchrt_autoloan.gnucash-xea
similarity index 100%
rename from accounts/de_AT/acctchrt_autoloan.gnucash-xea
rename to data/accounts/de_AT/acctchrt_autoloan.gnucash-xea
diff --git a/accounts/de_AT/acctchrt_brokerage.gnucash-xea b/data/accounts/de_AT/acctchrt_brokerage.gnucash-xea
similarity index 100%
rename from accounts/de_AT/acctchrt_brokerage.gnucash-xea
rename to data/accounts/de_AT/acctchrt_brokerage.gnucash-xea
diff --git a/accounts/de_AT/acctchrt_business.gnucash-xea b/data/accounts/de_AT/acctchrt_business.gnucash-xea
similarity index 100%
rename from accounts/de_AT/acctchrt_business.gnucash-xea
rename to data/accounts/de_AT/acctchrt_business.gnucash-xea
diff --git a/accounts/de_AT/acctchrt_common.gnucash-xea b/data/accounts/de_AT/acctchrt_common.gnucash-xea
similarity index 100%
rename from accounts/de_AT/acctchrt_common.gnucash-xea
rename to data/accounts/de_AT/acctchrt_common.gnucash-xea
diff --git a/accounts/de_AT/acctchrt_houseown.gnucash-xea b/data/accounts/de_AT/acctchrt_houseown.gnucash-xea
similarity index 100%
rename from accounts/de_AT/acctchrt_houseown.gnucash-xea
rename to data/accounts/de_AT/acctchrt_houseown.gnucash-xea
diff --git a/accounts/de_AT/acctchrt_investment.gnucash-xea b/data/accounts/de_AT/acctchrt_investment.gnucash-xea
similarity index 100%
rename from accounts/de_AT/acctchrt_investment.gnucash-xea
rename to data/accounts/de_AT/acctchrt_investment.gnucash-xea
diff --git a/accounts/de_AT/acctchrt_kids.gnucash-xea b/data/accounts/de_AT/acctchrt_kids.gnucash-xea
similarity index 100%
rename from accounts/de_AT/acctchrt_kids.gnucash-xea
rename to data/accounts/de_AT/acctchrt_kids.gnucash-xea
diff --git a/accounts/de_CH/CMakeLists.txt b/data/accounts/de_CH/CMakeLists.txt
similarity index 100%
rename from accounts/de_CH/CMakeLists.txt
rename to data/accounts/de_CH/CMakeLists.txt
diff --git a/accounts/de_CH/Makefile.am b/data/accounts/de_CH/Makefile.am
similarity index 100%
rename from accounts/de_CH/Makefile.am
rename to data/accounts/de_CH/Makefile.am
diff --git a/accounts/de_CH/acctchrt_brokerage.gnucash-xea b/data/accounts/de_CH/acctchrt_brokerage.gnucash-xea
similarity index 100%
rename from accounts/de_CH/acctchrt_brokerage.gnucash-xea
rename to data/accounts/de_CH/acctchrt_brokerage.gnucash-xea
diff --git a/accounts/de_CH/acctchrt_chkmu.gnucash-xea b/data/accounts/de_CH/acctchrt_chkmu.gnucash-xea
similarity index 100%
rename from accounts/de_CH/acctchrt_chkmu.gnucash-xea
rename to data/accounts/de_CH/acctchrt_chkmu.gnucash-xea
diff --git a/accounts/de_CH/acctchrt_common.gnucash-xea b/data/accounts/de_CH/acctchrt_common.gnucash-xea
similarity index 100%
rename from accounts/de_CH/acctchrt_common.gnucash-xea
rename to data/accounts/de_CH/acctchrt_common.gnucash-xea
diff --git a/accounts/de_CH/acctchrt_kids.gnucash-xea b/data/accounts/de_CH/acctchrt_kids.gnucash-xea
similarity index 100%
rename from accounts/de_CH/acctchrt_kids.gnucash-xea
rename to data/accounts/de_CH/acctchrt_kids.gnucash-xea
diff --git a/accounts/de_CH/acctchrt_otherasset.gnucash-xea b/data/accounts/de_CH/acctchrt_otherasset.gnucash-xea
similarity index 100%
rename from accounts/de_CH/acctchrt_otherasset.gnucash-xea
rename to data/accounts/de_CH/acctchrt_otherasset.gnucash-xea
diff --git a/accounts/de_CH/acctchrt_otherloan.gnucash-xea b/data/accounts/de_CH/acctchrt_otherloan.gnucash-xea
similarity index 100%
rename from accounts/de_CH/acctchrt_otherloan.gnucash-xea
rename to data/accounts/de_CH/acctchrt_otherloan.gnucash-xea
diff --git a/accounts/de_DE/CMakeLists.txt b/data/accounts/de_DE/CMakeLists.txt
similarity index 100%
rename from accounts/de_DE/CMakeLists.txt
rename to data/accounts/de_DE/CMakeLists.txt
diff --git a/accounts/de_DE/Makefile.am b/data/accounts/de_DE/Makefile.am
similarity index 100%
rename from accounts/de_DE/Makefile.am
rename to data/accounts/de_DE/Makefile.am
diff --git a/accounts/de_DE/acctchrt_auto.gnucash-xea b/data/accounts/de_DE/acctchrt_auto.gnucash-xea
similarity index 100%
rename from accounts/de_DE/acctchrt_auto.gnucash-xea
rename to data/accounts/de_DE/acctchrt_auto.gnucash-xea
diff --git a/accounts/de_DE/acctchrt_autoloan.gnucash-xea b/data/accounts/de_DE/acctchrt_autoloan.gnucash-xea
similarity index 100%
rename from accounts/de_DE/acctchrt_autoloan.gnucash-xea
rename to data/accounts/de_DE/acctchrt_autoloan.gnucash-xea
diff --git a/accounts/de_DE/acctchrt_brokerage.gnucash-xea b/data/accounts/de_DE/acctchrt_brokerage.gnucash-xea
similarity index 100%
rename from accounts/de_DE/acctchrt_brokerage.gnucash-xea
rename to data/accounts/de_DE/acctchrt_brokerage.gnucash-xea
diff --git a/accounts/de_DE/acctchrt_common.gnucash-xea b/data/accounts/de_DE/acctchrt_common.gnucash-xea
similarity index 100%
rename from accounts/de_DE/acctchrt_common.gnucash-xea
rename to data/accounts/de_DE/acctchrt_common.gnucash-xea
diff --git a/accounts/de_DE/acctchrt_full.gnucash-xea b/data/accounts/de_DE/acctchrt_full.gnucash-xea
similarity index 100%
rename from accounts/de_DE/acctchrt_full.gnucash-xea
rename to data/accounts/de_DE/acctchrt_full.gnucash-xea
diff --git a/accounts/de_DE/acctchrt_houseown.gnucash-xea b/data/accounts/de_DE/acctchrt_houseown.gnucash-xea
similarity index 100%
rename from accounts/de_DE/acctchrt_houseown.gnucash-xea
rename to data/accounts/de_DE/acctchrt_houseown.gnucash-xea
diff --git a/accounts/de_DE/acctchrt_investment.gnucash-xea b/data/accounts/de_DE/acctchrt_investment.gnucash-xea
similarity index 100%
rename from accounts/de_DE/acctchrt_investment.gnucash-xea
rename to data/accounts/de_DE/acctchrt_investment.gnucash-xea
diff --git a/accounts/de_DE/acctchrt_kids.gnucash-xea b/data/accounts/de_DE/acctchrt_kids.gnucash-xea
similarity index 100%
rename from accounts/de_DE/acctchrt_kids.gnucash-xea
rename to data/accounts/de_DE/acctchrt_kids.gnucash-xea
diff --git a/accounts/de_DE/acctchrt_otherasset.gnucash-xea b/data/accounts/de_DE/acctchrt_otherasset.gnucash-xea
similarity index 100%
rename from accounts/de_DE/acctchrt_otherasset.gnucash-xea
rename to data/accounts/de_DE/acctchrt_otherasset.gnucash-xea
diff --git a/accounts/de_DE/acctchrt_otherloan.gnucash-xea b/data/accounts/de_DE/acctchrt_otherloan.gnucash-xea
similarity index 100%
rename from accounts/de_DE/acctchrt_otherloan.gnucash-xea
rename to data/accounts/de_DE/acctchrt_otherloan.gnucash-xea
diff --git a/accounts/de_DE/acctchrt_skr03.gnucash-xea b/data/accounts/de_DE/acctchrt_skr03.gnucash-xea
similarity index 100%
rename from accounts/de_DE/acctchrt_skr03.gnucash-xea
rename to data/accounts/de_DE/acctchrt_skr03.gnucash-xea
diff --git a/accounts/de_DE/acctchrt_skr04.gnucash-xea b/data/accounts/de_DE/acctchrt_skr04.gnucash-xea
similarity index 100%
rename from accounts/de_DE/acctchrt_skr04.gnucash-xea
rename to data/accounts/de_DE/acctchrt_skr04.gnucash-xea
diff --git a/accounts/de_DE/acctchrt_skr49.gnucash-xea b/data/accounts/de_DE/acctchrt_skr49.gnucash-xea
similarity index 100%
rename from accounts/de_DE/acctchrt_skr49.gnucash-xea
rename to data/accounts/de_DE/acctchrt_skr49.gnucash-xea
diff --git a/accounts/de_DE/acctchrt_studium.gnucash-xea b/data/accounts/de_DE/acctchrt_studium.gnucash-xea
similarity index 100%
rename from accounts/de_DE/acctchrt_studium.gnucash-xea
rename to data/accounts/de_DE/acctchrt_studium.gnucash-xea
diff --git a/accounts/de_DE/acctchrt_wohnungsw.gnucash-xea b/data/accounts/de_DE/acctchrt_wohnungsw.gnucash-xea
similarity index 100%
rename from accounts/de_DE/acctchrt_wohnungsw.gnucash-xea
rename to data/accounts/de_DE/acctchrt_wohnungsw.gnucash-xea
diff --git a/accounts/el_GR/CMakeLists.txt b/data/accounts/el_GR/CMakeLists.txt
similarity index 100%
rename from accounts/el_GR/CMakeLists.txt
rename to data/accounts/el_GR/CMakeLists.txt
diff --git a/accounts/el_GR/Makefile.am b/data/accounts/el_GR/Makefile.am
similarity index 100%
rename from accounts/el_GR/Makefile.am
rename to data/accounts/el_GR/Makefile.am
diff --git a/accounts/el_GR/acctchrt_brokerage.gnucash-xea b/data/accounts/el_GR/acctchrt_brokerage.gnucash-xea
similarity index 100%
rename from accounts/el_GR/acctchrt_brokerage.gnucash-xea
rename to data/accounts/el_GR/acctchrt_brokerage.gnucash-xea
diff --git a/accounts/el_GR/acctchrt_carloan.gnucash-xea b/data/accounts/el_GR/acctchrt_carloan.gnucash-xea
similarity index 100%
rename from accounts/el_GR/acctchrt_carloan.gnucash-xea
rename to data/accounts/el_GR/acctchrt_carloan.gnucash-xea
diff --git a/accounts/el_GR/acctchrt_common.gnucash-xea b/data/accounts/el_GR/acctchrt_common.gnucash-xea
similarity index 100%
rename from accounts/el_GR/acctchrt_common.gnucash-xea
rename to data/accounts/el_GR/acctchrt_common.gnucash-xea
diff --git a/accounts/en_GB/CMakeLists.txt b/data/accounts/en_GB/CMakeLists.txt
similarity index 100%
rename from accounts/en_GB/CMakeLists.txt
rename to data/accounts/en_GB/CMakeLists.txt
diff --git a/accounts/en_GB/Makefile.am b/data/accounts/en_GB/Makefile.am
similarity index 100%
rename from accounts/en_GB/Makefile.am
rename to data/accounts/en_GB/Makefile.am
diff --git a/accounts/en_GB/acctchrt_brokerage.gnucash-xea b/data/accounts/en_GB/acctchrt_brokerage.gnucash-xea
similarity index 100%
rename from accounts/en_GB/acctchrt_brokerage.gnucash-xea
rename to data/accounts/en_GB/acctchrt_brokerage.gnucash-xea
diff --git a/accounts/en_GB/acctchrt_business.gnucash-xea b/data/accounts/en_GB/acctchrt_business.gnucash-xea
similarity index 100%
rename from accounts/en_GB/acctchrt_business.gnucash-xea
rename to data/accounts/en_GB/acctchrt_business.gnucash-xea
diff --git a/accounts/en_GB/acctchrt_carloan.gnucash-xea b/data/accounts/en_GB/acctchrt_carloan.gnucash-xea
similarity index 100%
rename from accounts/en_GB/acctchrt_carloan.gnucash-xea
rename to data/accounts/en_GB/acctchrt_carloan.gnucash-xea
diff --git a/accounts/en_GB/acctchrt_cdmoneymkt.gnucash-xea b/data/accounts/en_GB/acctchrt_cdmoneymkt.gnucash-xea
similarity index 100%
rename from accounts/en_GB/acctchrt_cdmoneymkt.gnucash-xea
rename to data/accounts/en_GB/acctchrt_cdmoneymkt.gnucash-xea
diff --git a/accounts/en_GB/acctchrt_checkbook.gnucash-xea b/data/accounts/en_GB/acctchrt_checkbook.gnucash-xea
similarity index 100%
rename from accounts/en_GB/acctchrt_checkbook.gnucash-xea
rename to data/accounts/en_GB/acctchrt_checkbook.gnucash-xea
diff --git a/accounts/en_GB/acctchrt_childcare.gnucash-xea b/data/accounts/en_GB/acctchrt_childcare.gnucash-xea
similarity index 100%
rename from accounts/en_GB/acctchrt_childcare.gnucash-xea
rename to data/accounts/en_GB/acctchrt_childcare.gnucash-xea
diff --git a/accounts/en_GB/acctchrt_common.gnucash-xea b/data/accounts/en_GB/acctchrt_common.gnucash-xea
similarity index 100%
rename from accounts/en_GB/acctchrt_common.gnucash-xea
rename to data/accounts/en_GB/acctchrt_common.gnucash-xea
diff --git a/accounts/en_GB/acctchrt_eduloan.gnucash-xea b/data/accounts/en_GB/acctchrt_eduloan.gnucash-xea
similarity index 100%
rename from accounts/en_GB/acctchrt_eduloan.gnucash-xea
rename to data/accounts/en_GB/acctchrt_eduloan.gnucash-xea
diff --git a/accounts/en_GB/acctchrt_fixedassets.gnucash-xea b/data/accounts/en_GB/acctchrt_fixedassets.gnucash-xea
similarity index 100%
rename from accounts/en_GB/acctchrt_fixedassets.gnucash-xea
rename to data/accounts/en_GB/acctchrt_fixedassets.gnucash-xea
diff --git a/accounts/en_GB/acctchrt_full.gnucash-xea b/data/accounts/en_GB/acctchrt_full.gnucash-xea
similarity index 100%
rename from accounts/en_GB/acctchrt_full.gnucash-xea
rename to data/accounts/en_GB/acctchrt_full.gnucash-xea
diff --git a/accounts/en_GB/acctchrt_homeloan.gnucash-xea b/data/accounts/en_GB/acctchrt_homeloan.gnucash-xea
similarity index 100%
rename from accounts/en_GB/acctchrt_homeloan.gnucash-xea
rename to data/accounts/en_GB/acctchrt_homeloan.gnucash-xea
diff --git a/accounts/en_GB/acctchrt_homeown.gnucash-xea b/data/accounts/en_GB/acctchrt_homeown.gnucash-xea
similarity index 100%
rename from accounts/en_GB/acctchrt_homeown.gnucash-xea
rename to data/accounts/en_GB/acctchrt_homeown.gnucash-xea
diff --git a/accounts/en_GB/acctchrt_otherloan.gnucash-xea b/data/accounts/en_GB/acctchrt_otherloan.gnucash-xea
similarity index 100%
rename from accounts/en_GB/acctchrt_otherloan.gnucash-xea
rename to data/accounts/en_GB/acctchrt_otherloan.gnucash-xea
diff --git a/accounts/en_GB/acctchrt_renter.gnucash-xea b/data/accounts/en_GB/acctchrt_renter.gnucash-xea
similarity index 100%
rename from accounts/en_GB/acctchrt_renter.gnucash-xea
rename to data/accounts/en_GB/acctchrt_renter.gnucash-xea
diff --git a/accounts/en_GB/acctchrt_retiremt.gnucash-xea b/data/accounts/en_GB/acctchrt_retiremt.gnucash-xea
similarity index 100%
rename from accounts/en_GB/acctchrt_retiremt.gnucash-xea
rename to data/accounts/en_GB/acctchrt_retiremt.gnucash-xea
diff --git a/accounts/en_GB/acctchrt_spouseinc.gnucash-xea b/data/accounts/en_GB/acctchrt_spouseinc.gnucash-xea
similarity index 100%
rename from accounts/en_GB/acctchrt_spouseinc.gnucash-xea
rename to data/accounts/en_GB/acctchrt_spouseinc.gnucash-xea
diff --git a/accounts/en_GB/acctchrt_spouseretire.gnucash-xea b/data/accounts/en_GB/acctchrt_spouseretire.gnucash-xea
similarity index 100%
rename from accounts/en_GB/acctchrt_spouseretire.gnucash-xea
rename to data/accounts/en_GB/acctchrt_spouseretire.gnucash-xea
diff --git a/accounts/en_GB/uk-vat.gnucash-xea b/data/accounts/en_GB/uk-vat.gnucash-xea
similarity index 100%
rename from accounts/en_GB/uk-vat.gnucash-xea
rename to data/accounts/en_GB/uk-vat.gnucash-xea
diff --git a/accounts/es_ES/CMakeLists.txt b/data/accounts/es_ES/CMakeLists.txt
similarity index 100%
rename from accounts/es_ES/CMakeLists.txt
rename to data/accounts/es_ES/CMakeLists.txt
diff --git a/accounts/es_ES/Makefile.am b/data/accounts/es_ES/Makefile.am
similarity index 100%
rename from accounts/es_ES/Makefile.am
rename to data/accounts/es_ES/Makefile.am
diff --git a/accounts/es_ES/acctchrt_brokerage.gnucash-xea b/data/accounts/es_ES/acctchrt_brokerage.gnucash-xea
similarity index 100%
rename from accounts/es_ES/acctchrt_brokerage.gnucash-xea
rename to data/accounts/es_ES/acctchrt_brokerage.gnucash-xea
diff --git a/accounts/es_ES/acctchrt_carloan.gnucash-xea b/data/accounts/es_ES/acctchrt_carloan.gnucash-xea
similarity index 100%
rename from accounts/es_ES/acctchrt_carloan.gnucash-xea
rename to data/accounts/es_ES/acctchrt_carloan.gnucash-xea
diff --git a/accounts/es_ES/acctchrt_cdmoneymkt.gnucash-xea b/data/accounts/es_ES/acctchrt_cdmoneymkt.gnucash-xea
similarity index 100%
rename from accounts/es_ES/acctchrt_cdmoneymkt.gnucash-xea
rename to data/accounts/es_ES/acctchrt_cdmoneymkt.gnucash-xea
diff --git a/accounts/es_ES/acctchrt_childcare.gnucash-xea b/data/accounts/es_ES/acctchrt_childcare.gnucash-xea
similarity index 100%
rename from accounts/es_ES/acctchrt_childcare.gnucash-xea
rename to data/accounts/es_ES/acctchrt_childcare.gnucash-xea
diff --git a/accounts/es_ES/acctchrt_common.gnucash-xea b/data/accounts/es_ES/acctchrt_common.gnucash-xea
similarity index 100%
rename from accounts/es_ES/acctchrt_common.gnucash-xea
rename to data/accounts/es_ES/acctchrt_common.gnucash-xea
diff --git a/accounts/es_ES/acctchrt_currency.gnucash-xea b/data/accounts/es_ES/acctchrt_currency.gnucash-xea
similarity index 100%
rename from accounts/es_ES/acctchrt_currency.gnucash-xea
rename to data/accounts/es_ES/acctchrt_currency.gnucash-xea
diff --git a/accounts/es_ES/acctchrt_eduloan.gnucash-xea b/data/accounts/es_ES/acctchrt_eduloan.gnucash-xea
similarity index 100%
rename from accounts/es_ES/acctchrt_eduloan.gnucash-xea
rename to data/accounts/es_ES/acctchrt_eduloan.gnucash-xea
diff --git a/accounts/es_ES/acctchrt_fixedassets.gnucash-xea b/data/accounts/es_ES/acctchrt_fixedassets.gnucash-xea
similarity index 100%
rename from accounts/es_ES/acctchrt_fixedassets.gnucash-xea
rename to data/accounts/es_ES/acctchrt_fixedassets.gnucash-xea
diff --git a/accounts/es_ES/acctchrt_homeloan.gnucash-xea b/data/accounts/es_ES/acctchrt_homeloan.gnucash-xea
similarity index 100%
rename from accounts/es_ES/acctchrt_homeloan.gnucash-xea
rename to data/accounts/es_ES/acctchrt_homeloan.gnucash-xea
diff --git a/accounts/es_ES/acctchrt_homeown.gnucash-xea b/data/accounts/es_ES/acctchrt_homeown.gnucash-xea
similarity index 100%
rename from accounts/es_ES/acctchrt_homeown.gnucash-xea
rename to data/accounts/es_ES/acctchrt_homeown.gnucash-xea
diff --git a/accounts/es_ES/acctchrt_otherloan.gnucash-xea b/data/accounts/es_ES/acctchrt_otherloan.gnucash-xea
similarity index 100%
rename from accounts/es_ES/acctchrt_otherloan.gnucash-xea
rename to data/accounts/es_ES/acctchrt_otherloan.gnucash-xea
diff --git a/accounts/es_ES/acctchrt_renter.gnucash-xea b/data/accounts/es_ES/acctchrt_renter.gnucash-xea
similarity index 100%
rename from accounts/es_ES/acctchrt_renter.gnucash-xea
rename to data/accounts/es_ES/acctchrt_renter.gnucash-xea
diff --git a/accounts/es_ES/acctchrt_retiremt.gnucash-xea b/data/accounts/es_ES/acctchrt_retiremt.gnucash-xea
similarity index 100%
rename from accounts/es_ES/acctchrt_retiremt.gnucash-xea
rename to data/accounts/es_ES/acctchrt_retiremt.gnucash-xea
diff --git a/accounts/es_ES/acctchrt_spouseinc.gnucash-xea b/data/accounts/es_ES/acctchrt_spouseinc.gnucash-xea
similarity index 100%
rename from accounts/es_ES/acctchrt_spouseinc.gnucash-xea
rename to data/accounts/es_ES/acctchrt_spouseinc.gnucash-xea
diff --git a/accounts/es_ES/acctchrt_spouseretire.gnucash-xea b/data/accounts/es_ES/acctchrt_spouseretire.gnucash-xea
similarity index 100%
rename from accounts/es_ES/acctchrt_spouseretire.gnucash-xea
rename to data/accounts/es_ES/acctchrt_spouseretire.gnucash-xea
diff --git a/accounts/es_MX/CMakeLists.txt b/data/accounts/es_MX/CMakeLists.txt
similarity index 100%
rename from accounts/es_MX/CMakeLists.txt
rename to data/accounts/es_MX/CMakeLists.txt
diff --git a/accounts/es_MX/Makefile.am b/data/accounts/es_MX/Makefile.am
similarity index 100%
rename from accounts/es_MX/Makefile.am
rename to data/accounts/es_MX/Makefile.am
diff --git a/accounts/es_MX/acctchrt_brokerage.gnucash-xea b/data/accounts/es_MX/acctchrt_brokerage.gnucash-xea
similarity index 100%
rename from accounts/es_MX/acctchrt_brokerage.gnucash-xea
rename to data/accounts/es_MX/acctchrt_brokerage.gnucash-xea
diff --git a/accounts/es_MX/acctchrt_carloan.gnucash-xea b/data/accounts/es_MX/acctchrt_carloan.gnucash-xea
similarity index 100%
rename from accounts/es_MX/acctchrt_carloan.gnucash-xea
rename to data/accounts/es_MX/acctchrt_carloan.gnucash-xea
diff --git a/accounts/es_MX/acctchrt_cdmoneymkt.gnucash-xea b/data/accounts/es_MX/acctchrt_cdmoneymkt.gnucash-xea
similarity index 100%
rename from accounts/es_MX/acctchrt_cdmoneymkt.gnucash-xea
rename to data/accounts/es_MX/acctchrt_cdmoneymkt.gnucash-xea
diff --git a/accounts/es_MX/acctchrt_childcare.gnucash-xea b/data/accounts/es_MX/acctchrt_childcare.gnucash-xea
similarity index 100%
rename from accounts/es_MX/acctchrt_childcare.gnucash-xea
rename to data/accounts/es_MX/acctchrt_childcare.gnucash-xea
diff --git a/accounts/es_MX/acctchrt_common.gnucash-xea b/data/accounts/es_MX/acctchrt_common.gnucash-xea
similarity index 100%
rename from accounts/es_MX/acctchrt_common.gnucash-xea
rename to data/accounts/es_MX/acctchrt_common.gnucash-xea
diff --git a/accounts/es_MX/acctchrt_currency.gnucash-xea b/data/accounts/es_MX/acctchrt_currency.gnucash-xea
similarity index 100%
rename from accounts/es_MX/acctchrt_currency.gnucash-xea
rename to data/accounts/es_MX/acctchrt_currency.gnucash-xea
diff --git a/accounts/es_MX/acctchrt_eduloan.gnucash-xea b/data/accounts/es_MX/acctchrt_eduloan.gnucash-xea
similarity index 100%
rename from accounts/es_MX/acctchrt_eduloan.gnucash-xea
rename to data/accounts/es_MX/acctchrt_eduloan.gnucash-xea
diff --git a/accounts/es_MX/acctchrt_fixedassets.gnucash-xea b/data/accounts/es_MX/acctchrt_fixedassets.gnucash-xea
similarity index 100%
rename from accounts/es_MX/acctchrt_fixedassets.gnucash-xea
rename to data/accounts/es_MX/acctchrt_fixedassets.gnucash-xea
diff --git a/accounts/es_MX/acctchrt_homeloan.gnucash-xea b/data/accounts/es_MX/acctchrt_homeloan.gnucash-xea
similarity index 100%
rename from accounts/es_MX/acctchrt_homeloan.gnucash-xea
rename to data/accounts/es_MX/acctchrt_homeloan.gnucash-xea
diff --git a/accounts/es_MX/acctchrt_homeown.gnucash-xea b/data/accounts/es_MX/acctchrt_homeown.gnucash-xea
similarity index 100%
rename from accounts/es_MX/acctchrt_homeown.gnucash-xea
rename to data/accounts/es_MX/acctchrt_homeown.gnucash-xea
diff --git a/accounts/es_MX/acctchrt_otherloan.gnucash-xea b/data/accounts/es_MX/acctchrt_otherloan.gnucash-xea
similarity index 100%
rename from accounts/es_MX/acctchrt_otherloan.gnucash-xea
rename to data/accounts/es_MX/acctchrt_otherloan.gnucash-xea
diff --git a/accounts/es_MX/acctchrt_renter.gnucash-xea b/data/accounts/es_MX/acctchrt_renter.gnucash-xea
similarity index 100%
rename from accounts/es_MX/acctchrt_renter.gnucash-xea
rename to data/accounts/es_MX/acctchrt_renter.gnucash-xea
diff --git a/accounts/es_MX/acctchrt_retiremt.gnucash-xea b/data/accounts/es_MX/acctchrt_retiremt.gnucash-xea
similarity index 100%
rename from accounts/es_MX/acctchrt_retiremt.gnucash-xea
rename to data/accounts/es_MX/acctchrt_retiremt.gnucash-xea
diff --git a/accounts/es_MX/acctchrt_spouseinc.gnucash-xea b/data/accounts/es_MX/acctchrt_spouseinc.gnucash-xea
similarity index 100%
rename from accounts/es_MX/acctchrt_spouseinc.gnucash-xea
rename to data/accounts/es_MX/acctchrt_spouseinc.gnucash-xea
diff --git a/accounts/es_MX/acctchrt_spouseretire.gnucash-xea b/data/accounts/es_MX/acctchrt_spouseretire.gnucash-xea
similarity index 100%
rename from accounts/es_MX/acctchrt_spouseretire.gnucash-xea
rename to data/accounts/es_MX/acctchrt_spouseretire.gnucash-xea
diff --git a/accounts/fi_FI/CMakeLists.txt b/data/accounts/fi_FI/CMakeLists.txt
similarity index 100%
rename from accounts/fi_FI/CMakeLists.txt
rename to data/accounts/fi_FI/CMakeLists.txt
diff --git a/accounts/fi_FI/Makefile.am b/data/accounts/fi_FI/Makefile.am
similarity index 100%
rename from accounts/fi_FI/Makefile.am
rename to data/accounts/fi_FI/Makefile.am
diff --git a/accounts/fi_FI/acctchrt_common.gnucash-xea b/data/accounts/fi_FI/acctchrt_common.gnucash-xea
similarity index 100%
rename from accounts/fi_FI/acctchrt_common.gnucash-xea
rename to data/accounts/fi_FI/acctchrt_common.gnucash-xea
diff --git a/accounts/fi_FI/acctchrt_ry.gnucash-xea b/data/accounts/fi_FI/acctchrt_ry.gnucash-xea
similarity index 100%
rename from accounts/fi_FI/acctchrt_ry.gnucash-xea
rename to data/accounts/fi_FI/acctchrt_ry.gnucash-xea
diff --git a/accounts/fi_FI/acctchrt_sbr-xbrl.gnucash-xea b/data/accounts/fi_FI/acctchrt_sbr-xbrl.gnucash-xea
similarity index 100%
rename from accounts/fi_FI/acctchrt_sbr-xbrl.gnucash-xea
rename to data/accounts/fi_FI/acctchrt_sbr-xbrl.gnucash-xea
diff --git a/accounts/fr_CA/CMakeLists.txt b/data/accounts/fr_CA/CMakeLists.txt
similarity index 100%
rename from accounts/fr_CA/CMakeLists.txt
rename to data/accounts/fr_CA/CMakeLists.txt
diff --git a/accounts/fr_CA/Makefile.am b/data/accounts/fr_CA/Makefile.am
similarity index 100%
rename from accounts/fr_CA/Makefile.am
rename to data/accounts/fr_CA/Makefile.am
diff --git a/accounts/fr_CA/acctchrt_actifsfixes.gnucash-xea b/data/accounts/fr_CA/acctchrt_actifsfixes.gnucash-xea
similarity index 100%
rename from accounts/fr_CA/acctchrt_actifsfixes.gnucash-xea
rename to data/accounts/fr_CA/acctchrt_actifsfixes.gnucash-xea
diff --git a/accounts/fr_CA/acctchrt_automobile.gnucash-xea b/data/accounts/fr_CA/acctchrt_automobile.gnucash-xea
similarity index 100%
rename from accounts/fr_CA/acctchrt_automobile.gnucash-xea
rename to data/accounts/fr_CA/acctchrt_automobile.gnucash-xea
diff --git a/accounts/fr_CA/acctchrt_basecommune.gnucash-xea b/data/accounts/fr_CA/acctchrt_basecommune.gnucash-xea
similarity index 100%
rename from accounts/fr_CA/acctchrt_basecommune.gnucash-xea
rename to data/accounts/fr_CA/acctchrt_basecommune.gnucash-xea
diff --git a/accounts/fr_CA/acctchrt_cdmarchemon.gnucash-xea b/data/accounts/fr_CA/acctchrt_cdmarchemon.gnucash-xea
similarity index 100%
rename from accounts/fr_CA/acctchrt_cdmarchemon.gnucash-xea
rename to data/accounts/fr_CA/acctchrt_cdmarchemon.gnucash-xea
diff --git a/accounts/fr_CA/acctchrt_chequier.gnucash-xea b/data/accounts/fr_CA/acctchrt_chequier.gnucash-xea
similarity index 100%
rename from accounts/fr_CA/acctchrt_chequier.gnucash-xea
rename to data/accounts/fr_CA/acctchrt_chequier.gnucash-xea
diff --git a/accounts/fr_CA/acctchrt_conjointretraite.gnucash-xea b/data/accounts/fr_CA/acctchrt_conjointretraite.gnucash-xea
similarity index 100%
rename from accounts/fr_CA/acctchrt_conjointretraite.gnucash-xea
rename to data/accounts/fr_CA/acctchrt_conjointretraite.gnucash-xea
diff --git a/accounts/fr_CA/acctchrt_conjointrev.gnucash-xea b/data/accounts/fr_CA/acctchrt_conjointrev.gnucash-xea
similarity index 100%
rename from accounts/fr_CA/acctchrt_conjointrev.gnucash-xea
rename to data/accounts/fr_CA/acctchrt_conjointrev.gnucash-xea
diff --git a/accounts/fr_CA/acctchrt_courtage.gnucash-xea b/data/accounts/fr_CA/acctchrt_courtage.gnucash-xea
similarity index 100%
rename from accounts/fr_CA/acctchrt_courtage.gnucash-xea
rename to data/accounts/fr_CA/acctchrt_courtage.gnucash-xea
diff --git a/accounts/fr_CA/acctchrt_etudeemprunt.gnucash-xea b/data/accounts/fr_CA/acctchrt_etudeemprunt.gnucash-xea
similarity index 100%
rename from accounts/fr_CA/acctchrt_etudeemprunt.gnucash-xea
rename to data/accounts/fr_CA/acctchrt_etudeemprunt.gnucash-xea
diff --git a/accounts/fr_CA/acctchrt_garderie.gnucash-xea b/data/accounts/fr_CA/acctchrt_garderie.gnucash-xea
similarity index 100%
rename from accounts/fr_CA/acctchrt_garderie.gnucash-xea
rename to data/accounts/fr_CA/acctchrt_garderie.gnucash-xea
diff --git a/accounts/fr_CA/acctchrt_locataire.gnucash-xea b/data/accounts/fr_CA/acctchrt_locataire.gnucash-xea
similarity index 100%
rename from accounts/fr_CA/acctchrt_locataire.gnucash-xea
rename to data/accounts/fr_CA/acctchrt_locataire.gnucash-xea
diff --git a/accounts/fr_CA/acctchrt_proprietaire.gnucash-xea b/data/accounts/fr_CA/acctchrt_proprietaire.gnucash-xea
similarity index 100%
rename from accounts/fr_CA/acctchrt_proprietaire.gnucash-xea
rename to data/accounts/fr_CA/acctchrt_proprietaire.gnucash-xea
diff --git a/accounts/fr_CA/acctchrt_retraite.gnucash-xea b/data/accounts/fr_CA/acctchrt_retraite.gnucash-xea
similarity index 100%
rename from accounts/fr_CA/acctchrt_retraite.gnucash-xea
rename to data/accounts/fr_CA/acctchrt_retraite.gnucash-xea
diff --git a/accounts/fr_CA/acctchrt_revenus.gnucash-xea b/data/accounts/fr_CA/acctchrt_revenus.gnucash-xea
similarity index 100%
rename from accounts/fr_CA/acctchrt_revenus.gnucash-xea
rename to data/accounts/fr_CA/acctchrt_revenus.gnucash-xea
diff --git a/accounts/fr_CH/CMakeLists.txt b/data/accounts/fr_CH/CMakeLists.txt
similarity index 100%
rename from accounts/fr_CH/CMakeLists.txt
rename to data/accounts/fr_CH/CMakeLists.txt
diff --git a/accounts/fr_CH/Makefile.am b/data/accounts/fr_CH/Makefile.am
similarity index 100%
rename from accounts/fr_CH/Makefile.am
rename to data/accounts/fr_CH/Makefile.am
diff --git a/accounts/fr_CH/acctchrt_brokerage.gnucash-xea b/data/accounts/fr_CH/acctchrt_brokerage.gnucash-xea
similarity index 100%
rename from accounts/fr_CH/acctchrt_brokerage.gnucash-xea
rename to data/accounts/fr_CH/acctchrt_brokerage.gnucash-xea
diff --git a/accounts/fr_CH/acctchrt_business.gnucash-xea b/data/accounts/fr_CH/acctchrt_business.gnucash-xea
similarity index 100%
rename from accounts/fr_CH/acctchrt_business.gnucash-xea
rename to data/accounts/fr_CH/acctchrt_business.gnucash-xea
diff --git a/accounts/fr_CH/acctchrt_carloan.gnucash-xea b/data/accounts/fr_CH/acctchrt_carloan.gnucash-xea
similarity index 100%
rename from accounts/fr_CH/acctchrt_carloan.gnucash-xea
rename to data/accounts/fr_CH/acctchrt_carloan.gnucash-xea
diff --git a/accounts/fr_CH/acctchrt_cdmoneymkt.gnucash-xea b/data/accounts/fr_CH/acctchrt_cdmoneymkt.gnucash-xea
similarity index 100%
rename from accounts/fr_CH/acctchrt_cdmoneymkt.gnucash-xea
rename to data/accounts/fr_CH/acctchrt_cdmoneymkt.gnucash-xea
diff --git a/accounts/fr_CH/acctchrt_childcare.gnucash-xea b/data/accounts/fr_CH/acctchrt_childcare.gnucash-xea
similarity index 100%
rename from accounts/fr_CH/acctchrt_childcare.gnucash-xea
rename to data/accounts/fr_CH/acctchrt_childcare.gnucash-xea
diff --git a/accounts/fr_CH/acctchrt_common.gnucash-xea b/data/accounts/fr_CH/acctchrt_common.gnucash-xea
similarity index 100%
rename from accounts/fr_CH/acctchrt_common.gnucash-xea
rename to data/accounts/fr_CH/acctchrt_common.gnucash-xea
diff --git a/accounts/fr_CH/acctchrt_currency.gnucash-xea b/data/accounts/fr_CH/acctchrt_currency.gnucash-xea
similarity index 100%
rename from accounts/fr_CH/acctchrt_currency.gnucash-xea
rename to data/accounts/fr_CH/acctchrt_currency.gnucash-xea
diff --git a/accounts/fr_CH/acctchrt_eduloan.gnucash-xea b/data/accounts/fr_CH/acctchrt_eduloan.gnucash-xea
similarity index 100%
rename from accounts/fr_CH/acctchrt_eduloan.gnucash-xea
rename to data/accounts/fr_CH/acctchrt_eduloan.gnucash-xea
diff --git a/accounts/fr_CH/acctchrt_fixedassets.gnucash-xea b/data/accounts/fr_CH/acctchrt_fixedassets.gnucash-xea
similarity index 100%
rename from accounts/fr_CH/acctchrt_fixedassets.gnucash-xea
rename to data/accounts/fr_CH/acctchrt_fixedassets.gnucash-xea
diff --git a/accounts/fr_CH/acctchrt_homeloan.gnucash-xea b/data/accounts/fr_CH/acctchrt_homeloan.gnucash-xea
similarity index 100%
rename from accounts/fr_CH/acctchrt_homeloan.gnucash-xea
rename to data/accounts/fr_CH/acctchrt_homeloan.gnucash-xea
diff --git a/accounts/fr_CH/acctchrt_homeown.gnucash-xea b/data/accounts/fr_CH/acctchrt_homeown.gnucash-xea
similarity index 100%
rename from accounts/fr_CH/acctchrt_homeown.gnucash-xea
rename to data/accounts/fr_CH/acctchrt_homeown.gnucash-xea
diff --git a/accounts/fr_CH/acctchrt_otherloan.gnucash-xea b/data/accounts/fr_CH/acctchrt_otherloan.gnucash-xea
similarity index 100%
rename from accounts/fr_CH/acctchrt_otherloan.gnucash-xea
rename to data/accounts/fr_CH/acctchrt_otherloan.gnucash-xea
diff --git a/accounts/fr_CH/acctchrt_renter.gnucash-xea b/data/accounts/fr_CH/acctchrt_renter.gnucash-xea
similarity index 100%
rename from accounts/fr_CH/acctchrt_renter.gnucash-xea
rename to data/accounts/fr_CH/acctchrt_renter.gnucash-xea
diff --git a/accounts/fr_CH/acctchrt_retiremt.gnucash-xea b/data/accounts/fr_CH/acctchrt_retiremt.gnucash-xea
similarity index 100%
rename from accounts/fr_CH/acctchrt_retiremt.gnucash-xea
rename to data/accounts/fr_CH/acctchrt_retiremt.gnucash-xea
diff --git a/accounts/fr_CH/acctchrt_spouseinc.gnucash-xea b/data/accounts/fr_CH/acctchrt_spouseinc.gnucash-xea
similarity index 100%
rename from accounts/fr_CH/acctchrt_spouseinc.gnucash-xea
rename to data/accounts/fr_CH/acctchrt_spouseinc.gnucash-xea
diff --git a/accounts/fr_CH/acctchrt_spouseretire.gnucash-xea b/data/accounts/fr_CH/acctchrt_spouseretire.gnucash-xea
similarity index 100%
rename from accounts/fr_CH/acctchrt_spouseretire.gnucash-xea
rename to data/accounts/fr_CH/acctchrt_spouseretire.gnucash-xea
diff --git a/accounts/fr_FR/CMakeLists.txt b/data/accounts/fr_FR/CMakeLists.txt
similarity index 100%
rename from accounts/fr_FR/CMakeLists.txt
rename to data/accounts/fr_FR/CMakeLists.txt
diff --git a/accounts/fr_FR/Makefile.am b/data/accounts/fr_FR/Makefile.am
similarity index 100%
rename from accounts/fr_FR/Makefile.am
rename to data/accounts/fr_FR/Makefile.am
diff --git a/accounts/fr_FR/acctchrt_brokerage.gnucash-xea b/data/accounts/fr_FR/acctchrt_brokerage.gnucash-xea
similarity index 100%
rename from accounts/fr_FR/acctchrt_brokerage.gnucash-xea
rename to data/accounts/fr_FR/acctchrt_brokerage.gnucash-xea
diff --git a/accounts/fr_FR/acctchrt_business.gnucash-xea b/data/accounts/fr_FR/acctchrt_business.gnucash-xea
similarity index 100%
rename from accounts/fr_FR/acctchrt_business.gnucash-xea
rename to data/accounts/fr_FR/acctchrt_business.gnucash-xea
diff --git a/accounts/fr_FR/acctchrt_carloan.gnucash-xea b/data/accounts/fr_FR/acctchrt_carloan.gnucash-xea
similarity index 100%
rename from accounts/fr_FR/acctchrt_carloan.gnucash-xea
rename to data/accounts/fr_FR/acctchrt_carloan.gnucash-xea
diff --git a/accounts/fr_FR/acctchrt_cdmoneymkt.gnucash-xea b/data/accounts/fr_FR/acctchrt_cdmoneymkt.gnucash-xea
similarity index 100%
rename from accounts/fr_FR/acctchrt_cdmoneymkt.gnucash-xea
rename to data/accounts/fr_FR/acctchrt_cdmoneymkt.gnucash-xea
diff --git a/accounts/fr_FR/acctchrt_childcare.gnucash-xea b/data/accounts/fr_FR/acctchrt_childcare.gnucash-xea
similarity index 100%
rename from accounts/fr_FR/acctchrt_childcare.gnucash-xea
rename to data/accounts/fr_FR/acctchrt_childcare.gnucash-xea
diff --git a/accounts/fr_FR/acctchrt_common.gnucash-xea b/data/accounts/fr_FR/acctchrt_common.gnucash-xea
similarity index 100%
rename from accounts/fr_FR/acctchrt_common.gnucash-xea
rename to data/accounts/fr_FR/acctchrt_common.gnucash-xea
diff --git a/accounts/fr_FR/acctchrt_currency.gnucash-xea b/data/accounts/fr_FR/acctchrt_currency.gnucash-xea
similarity index 100%
rename from accounts/fr_FR/acctchrt_currency.gnucash-xea
rename to data/accounts/fr_FR/acctchrt_currency.gnucash-xea
diff --git a/accounts/fr_FR/acctchrt_eduloan.gnucash-xea b/data/accounts/fr_FR/acctchrt_eduloan.gnucash-xea
similarity index 100%
rename from accounts/fr_FR/acctchrt_eduloan.gnucash-xea
rename to data/accounts/fr_FR/acctchrt_eduloan.gnucash-xea
diff --git a/accounts/fr_FR/acctchrt_fixedassets.gnucash-xea b/data/accounts/fr_FR/acctchrt_fixedassets.gnucash-xea
similarity index 100%
rename from accounts/fr_FR/acctchrt_fixedassets.gnucash-xea
rename to data/accounts/fr_FR/acctchrt_fixedassets.gnucash-xea
diff --git a/accounts/fr_FR/acctchrt_homeloan.gnucash-xea b/data/accounts/fr_FR/acctchrt_homeloan.gnucash-xea
similarity index 100%
rename from accounts/fr_FR/acctchrt_homeloan.gnucash-xea
rename to data/accounts/fr_FR/acctchrt_homeloan.gnucash-xea
diff --git a/accounts/fr_FR/acctchrt_homeown.gnucash-xea b/data/accounts/fr_FR/acctchrt_homeown.gnucash-xea
similarity index 100%
rename from accounts/fr_FR/acctchrt_homeown.gnucash-xea
rename to data/accounts/fr_FR/acctchrt_homeown.gnucash-xea
diff --git a/accounts/fr_FR/acctchrt_otherloan.gnucash-xea b/data/accounts/fr_FR/acctchrt_otherloan.gnucash-xea
similarity index 100%
rename from accounts/fr_FR/acctchrt_otherloan.gnucash-xea
rename to data/accounts/fr_FR/acctchrt_otherloan.gnucash-xea
diff --git a/accounts/fr_FR/acctchrt_renter.gnucash-xea b/data/accounts/fr_FR/acctchrt_renter.gnucash-xea
similarity index 100%
rename from accounts/fr_FR/acctchrt_renter.gnucash-xea
rename to data/accounts/fr_FR/acctchrt_renter.gnucash-xea
diff --git a/accounts/fr_FR/acctchrt_retiremt.gnucash-xea b/data/accounts/fr_FR/acctchrt_retiremt.gnucash-xea
similarity index 100%
rename from accounts/fr_FR/acctchrt_retiremt.gnucash-xea
rename to data/accounts/fr_FR/acctchrt_retiremt.gnucash-xea
diff --git a/accounts/fr_FR/acctchrt_spouseinc.gnucash-xea b/data/accounts/fr_FR/acctchrt_spouseinc.gnucash-xea
similarity index 100%
rename from accounts/fr_FR/acctchrt_spouseinc.gnucash-xea
rename to data/accounts/fr_FR/acctchrt_spouseinc.gnucash-xea
diff --git a/accounts/fr_FR/acctchrt_spouseretire.gnucash-xea b/data/accounts/fr_FR/acctchrt_spouseretire.gnucash-xea
similarity index 100%
rename from accounts/fr_FR/acctchrt_spouseretire.gnucash-xea
rename to data/accounts/fr_FR/acctchrt_spouseretire.gnucash-xea
diff --git a/accounts/hu_HU/CMakeLists.txt b/data/accounts/hu_HU/CMakeLists.txt
similarity index 100%
rename from accounts/hu_HU/CMakeLists.txt
rename to data/accounts/hu_HU/CMakeLists.txt
diff --git a/accounts/hu_HU/Makefile.am b/data/accounts/hu_HU/Makefile.am
similarity index 100%
rename from accounts/hu_HU/Makefile.am
rename to data/accounts/hu_HU/Makefile.am
diff --git a/accounts/hu_HU/acctchrt_brokerage.gnucash-xea b/data/accounts/hu_HU/acctchrt_brokerage.gnucash-xea
similarity index 100%
rename from accounts/hu_HU/acctchrt_brokerage.gnucash-xea
rename to data/accounts/hu_HU/acctchrt_brokerage.gnucash-xea
diff --git a/accounts/hu_HU/acctchrt_business.gnucash-xea b/data/accounts/hu_HU/acctchrt_business.gnucash-xea
similarity index 100%
rename from accounts/hu_HU/acctchrt_business.gnucash-xea
rename to data/accounts/hu_HU/acctchrt_business.gnucash-xea
diff --git a/accounts/hu_HU/acctchrt_carloan.gnucash-xea b/data/accounts/hu_HU/acctchrt_carloan.gnucash-xea
similarity index 100%
rename from accounts/hu_HU/acctchrt_carloan.gnucash-xea
rename to data/accounts/hu_HU/acctchrt_carloan.gnucash-xea
diff --git a/accounts/hu_HU/acctchrt_cdmoneymkt.gnucash-xea b/data/accounts/hu_HU/acctchrt_cdmoneymkt.gnucash-xea
similarity index 100%
rename from accounts/hu_HU/acctchrt_cdmoneymkt.gnucash-xea
rename to data/accounts/hu_HU/acctchrt_cdmoneymkt.gnucash-xea
diff --git a/accounts/hu_HU/acctchrt_checkbook.gnucash-xea b/data/accounts/hu_HU/acctchrt_checkbook.gnucash-xea
similarity index 100%
rename from accounts/hu_HU/acctchrt_checkbook.gnucash-xea
rename to data/accounts/hu_HU/acctchrt_checkbook.gnucash-xea
diff --git a/accounts/hu_HU/acctchrt_childcare.gnucash-xea b/data/accounts/hu_HU/acctchrt_childcare.gnucash-xea
similarity index 100%
rename from accounts/hu_HU/acctchrt_childcare.gnucash-xea
rename to data/accounts/hu_HU/acctchrt_childcare.gnucash-xea
diff --git a/accounts/hu_HU/acctchrt_common.gnucash-xea b/data/accounts/hu_HU/acctchrt_common.gnucash-xea
similarity index 100%
rename from accounts/hu_HU/acctchrt_common.gnucash-xea
rename to data/accounts/hu_HU/acctchrt_common.gnucash-xea
diff --git a/accounts/hu_HU/acctchrt_eduloan.gnucash-xea b/data/accounts/hu_HU/acctchrt_eduloan.gnucash-xea
similarity index 100%
rename from accounts/hu_HU/acctchrt_eduloan.gnucash-xea
rename to data/accounts/hu_HU/acctchrt_eduloan.gnucash-xea
diff --git a/accounts/hu_HU/acctchrt_fixedassets.gnucash-xea b/data/accounts/hu_HU/acctchrt_fixedassets.gnucash-xea
similarity index 100%
rename from accounts/hu_HU/acctchrt_fixedassets.gnucash-xea
rename to data/accounts/hu_HU/acctchrt_fixedassets.gnucash-xea
diff --git a/accounts/hu_HU/acctchrt_homeloan.gnucash-xea b/data/accounts/hu_HU/acctchrt_homeloan.gnucash-xea
similarity index 100%
rename from accounts/hu_HU/acctchrt_homeloan.gnucash-xea
rename to data/accounts/hu_HU/acctchrt_homeloan.gnucash-xea
diff --git a/accounts/hu_HU/acctchrt_homeown.gnucash-xea b/data/accounts/hu_HU/acctchrt_homeown.gnucash-xea
similarity index 100%
rename from accounts/hu_HU/acctchrt_homeown.gnucash-xea
rename to data/accounts/hu_HU/acctchrt_homeown.gnucash-xea
diff --git a/accounts/hu_HU/acctchrt_otherloan.gnucash-xea b/data/accounts/hu_HU/acctchrt_otherloan.gnucash-xea
similarity index 100%
rename from accounts/hu_HU/acctchrt_otherloan.gnucash-xea
rename to data/accounts/hu_HU/acctchrt_otherloan.gnucash-xea
diff --git a/accounts/hu_HU/acctchrt_renter.gnucash-xea b/data/accounts/hu_HU/acctchrt_renter.gnucash-xea
similarity index 100%
rename from accounts/hu_HU/acctchrt_renter.gnucash-xea
rename to data/accounts/hu_HU/acctchrt_renter.gnucash-xea
diff --git a/accounts/hu_HU/acctchrt_retiremt.gnucash-xea b/data/accounts/hu_HU/acctchrt_retiremt.gnucash-xea
similarity index 100%
rename from accounts/hu_HU/acctchrt_retiremt.gnucash-xea
rename to data/accounts/hu_HU/acctchrt_retiremt.gnucash-xea
diff --git a/accounts/hu_HU/acctchrt_spouseinc.gnucash-xea b/data/accounts/hu_HU/acctchrt_spouseinc.gnucash-xea
similarity index 100%
rename from accounts/hu_HU/acctchrt_spouseinc.gnucash-xea
rename to data/accounts/hu_HU/acctchrt_spouseinc.gnucash-xea
diff --git a/accounts/hu_HU/acctchrt_spouseretire.gnucash-xea b/data/accounts/hu_HU/acctchrt_spouseretire.gnucash-xea
similarity index 100%
rename from accounts/hu_HU/acctchrt_spouseretire.gnucash-xea
rename to data/accounts/hu_HU/acctchrt_spouseretire.gnucash-xea
diff --git a/accounts/it/CMakeLists.txt b/data/accounts/it/CMakeLists.txt
similarity index 100%
rename from accounts/it/CMakeLists.txt
rename to data/accounts/it/CMakeLists.txt
diff --git a/accounts/it/Makefile.am b/data/accounts/it/Makefile.am
similarity index 100%
rename from accounts/it/Makefile.am
rename to data/accounts/it/Makefile.am
diff --git a/accounts/it/acctchrt_brokerage.gnucash-xea b/data/accounts/it/acctchrt_brokerage.gnucash-xea
similarity index 100%
rename from accounts/it/acctchrt_brokerage.gnucash-xea
rename to data/accounts/it/acctchrt_brokerage.gnucash-xea
diff --git a/accounts/it/acctchrt_carloan.gnucash-xea b/data/accounts/it/acctchrt_carloan.gnucash-xea
similarity index 100%
rename from accounts/it/acctchrt_carloan.gnucash-xea
rename to data/accounts/it/acctchrt_carloan.gnucash-xea
diff --git a/accounts/it/acctchrt_checkbook.gnucash-xea b/data/accounts/it/acctchrt_checkbook.gnucash-xea
similarity index 100%
rename from accounts/it/acctchrt_checkbook.gnucash-xea
rename to data/accounts/it/acctchrt_checkbook.gnucash-xea
diff --git a/accounts/it/acctchrt_childcare.gnucash-xea b/data/accounts/it/acctchrt_childcare.gnucash-xea
similarity index 100%
rename from accounts/it/acctchrt_childcare.gnucash-xea
rename to data/accounts/it/acctchrt_childcare.gnucash-xea
diff --git a/accounts/it/acctchrt_common.gnucash-xea b/data/accounts/it/acctchrt_common.gnucash-xea
similarity index 100%
rename from accounts/it/acctchrt_common.gnucash-xea
rename to data/accounts/it/acctchrt_common.gnucash-xea
diff --git a/accounts/it/acctchrt_fixedassets.gnucash-xea b/data/accounts/it/acctchrt_fixedassets.gnucash-xea
similarity index 100%
rename from accounts/it/acctchrt_fixedassets.gnucash-xea
rename to data/accounts/it/acctchrt_fixedassets.gnucash-xea
diff --git a/accounts/it/acctchrt_homeloan.gnucash-xea b/data/accounts/it/acctchrt_homeloan.gnucash-xea
similarity index 100%
rename from accounts/it/acctchrt_homeloan.gnucash-xea
rename to data/accounts/it/acctchrt_homeloan.gnucash-xea
diff --git a/accounts/it/acctchrt_homeown.gnucash-xea b/data/accounts/it/acctchrt_homeown.gnucash-xea
similarity index 100%
rename from accounts/it/acctchrt_homeown.gnucash-xea
rename to data/accounts/it/acctchrt_homeown.gnucash-xea
diff --git a/accounts/it/acctchrt_otherloan.gnucash-xea b/data/accounts/it/acctchrt_otherloan.gnucash-xea
similarity index 100%
rename from accounts/it/acctchrt_otherloan.gnucash-xea
rename to data/accounts/it/acctchrt_otherloan.gnucash-xea
diff --git a/accounts/it/acctchrt_renter.gnucash-xea b/data/accounts/it/acctchrt_renter.gnucash-xea
similarity index 100%
rename from accounts/it/acctchrt_renter.gnucash-xea
rename to data/accounts/it/acctchrt_renter.gnucash-xea
diff --git a/accounts/it/acctchrt_retiremt.gnucash-xea b/data/accounts/it/acctchrt_retiremt.gnucash-xea
similarity index 100%
rename from accounts/it/acctchrt_retiremt.gnucash-xea
rename to data/accounts/it/acctchrt_retiremt.gnucash-xea
diff --git a/accounts/it/acctchrt_spouseinc.gnucash-xea b/data/accounts/it/acctchrt_spouseinc.gnucash-xea
similarity index 100%
rename from accounts/it/acctchrt_spouseinc.gnucash-xea
rename to data/accounts/it/acctchrt_spouseinc.gnucash-xea
diff --git a/accounts/it/acctchrt_spouseretire.gnucash-xea b/data/accounts/it/acctchrt_spouseretire.gnucash-xea
similarity index 100%
rename from accounts/it/acctchrt_spouseretire.gnucash-xea
rename to data/accounts/it/acctchrt_spouseretire.gnucash-xea
diff --git a/accounts/ja/CMakeLists.txt b/data/accounts/ja/CMakeLists.txt
similarity index 100%
rename from accounts/ja/CMakeLists.txt
rename to data/accounts/ja/CMakeLists.txt
diff --git a/accounts/ja/Makefile.am b/data/accounts/ja/Makefile.am
similarity index 100%
rename from accounts/ja/Makefile.am
rename to data/accounts/ja/Makefile.am
diff --git a/accounts/ja/acctchrt_brokerage.gnucash-xea b/data/accounts/ja/acctchrt_brokerage.gnucash-xea
similarity index 100%
rename from accounts/ja/acctchrt_brokerage.gnucash-xea
rename to data/accounts/ja/acctchrt_brokerage.gnucash-xea
diff --git a/accounts/ja/acctchrt_business.gnucash-xea b/data/accounts/ja/acctchrt_business.gnucash-xea
similarity index 100%
rename from accounts/ja/acctchrt_business.gnucash-xea
rename to data/accounts/ja/acctchrt_business.gnucash-xea
diff --git a/accounts/ja/acctchrt_carloan.gnucash-xea b/data/accounts/ja/acctchrt_carloan.gnucash-xea
similarity index 100%
rename from accounts/ja/acctchrt_carloan.gnucash-xea
rename to data/accounts/ja/acctchrt_carloan.gnucash-xea
diff --git a/accounts/ja/acctchrt_cdmoneymkt.gnucash-xea b/data/accounts/ja/acctchrt_cdmoneymkt.gnucash-xea
similarity index 100%
rename from accounts/ja/acctchrt_cdmoneymkt.gnucash-xea
rename to data/accounts/ja/acctchrt_cdmoneymkt.gnucash-xea
diff --git a/accounts/ja/acctchrt_checkbook.gnucash-xea b/data/accounts/ja/acctchrt_checkbook.gnucash-xea
similarity index 100%
rename from accounts/ja/acctchrt_checkbook.gnucash-xea
rename to data/accounts/ja/acctchrt_checkbook.gnucash-xea
diff --git a/accounts/ja/acctchrt_childcare.gnucash-xea b/data/accounts/ja/acctchrt_childcare.gnucash-xea
similarity index 100%
rename from accounts/ja/acctchrt_childcare.gnucash-xea
rename to data/accounts/ja/acctchrt_childcare.gnucash-xea
diff --git a/accounts/ja/acctchrt_common.gnucash-xea b/data/accounts/ja/acctchrt_common.gnucash-xea
similarity index 100%
rename from accounts/ja/acctchrt_common.gnucash-xea
rename to data/accounts/ja/acctchrt_common.gnucash-xea
diff --git a/accounts/ja/acctchrt_eduloan.gnucash-xea b/data/accounts/ja/acctchrt_eduloan.gnucash-xea
similarity index 100%
rename from accounts/ja/acctchrt_eduloan.gnucash-xea
rename to data/accounts/ja/acctchrt_eduloan.gnucash-xea
diff --git a/accounts/ja/acctchrt_fixedassets.gnucash-xea b/data/accounts/ja/acctchrt_fixedassets.gnucash-xea
similarity index 100%
rename from accounts/ja/acctchrt_fixedassets.gnucash-xea
rename to data/accounts/ja/acctchrt_fixedassets.gnucash-xea
diff --git a/accounts/ja/acctchrt_full.gnucash-xea b/data/accounts/ja/acctchrt_full.gnucash-xea
similarity index 100%
rename from accounts/ja/acctchrt_full.gnucash-xea
rename to data/accounts/ja/acctchrt_full.gnucash-xea
diff --git a/accounts/ja/acctchrt_homeloan.gnucash-xea b/data/accounts/ja/acctchrt_homeloan.gnucash-xea
similarity index 100%
rename from accounts/ja/acctchrt_homeloan.gnucash-xea
rename to data/accounts/ja/acctchrt_homeloan.gnucash-xea
diff --git a/accounts/ja/acctchrt_homeown.gnucash-xea b/data/accounts/ja/acctchrt_homeown.gnucash-xea
similarity index 100%
rename from accounts/ja/acctchrt_homeown.gnucash-xea
rename to data/accounts/ja/acctchrt_homeown.gnucash-xea
diff --git a/accounts/ja/acctchrt_otherloan.gnucash-xea b/data/accounts/ja/acctchrt_otherloan.gnucash-xea
similarity index 100%
rename from accounts/ja/acctchrt_otherloan.gnucash-xea
rename to data/accounts/ja/acctchrt_otherloan.gnucash-xea
diff --git a/accounts/ja/acctchrt_renter.gnucash-xea b/data/accounts/ja/acctchrt_renter.gnucash-xea
similarity index 100%
rename from accounts/ja/acctchrt_renter.gnucash-xea
rename to data/accounts/ja/acctchrt_renter.gnucash-xea
diff --git a/accounts/ja/acctchrt_retiremt.gnucash-xea b/data/accounts/ja/acctchrt_retiremt.gnucash-xea
similarity index 100%
rename from accounts/ja/acctchrt_retiremt.gnucash-xea
rename to data/accounts/ja/acctchrt_retiremt.gnucash-xea
diff --git a/accounts/ja/acctchrt_spouseinc.gnucash-xea b/data/accounts/ja/acctchrt_spouseinc.gnucash-xea
similarity index 100%
rename from accounts/ja/acctchrt_spouseinc.gnucash-xea
rename to data/accounts/ja/acctchrt_spouseinc.gnucash-xea
diff --git a/accounts/ja/acctchrt_spouseretire.gnucash-xea b/data/accounts/ja/acctchrt_spouseretire.gnucash-xea
similarity index 100%
rename from accounts/ja/acctchrt_spouseretire.gnucash-xea
rename to data/accounts/ja/acctchrt_spouseretire.gnucash-xea
diff --git a/accounts/ko/CMakeLists.txt b/data/accounts/ko/CMakeLists.txt
similarity index 100%
rename from accounts/ko/CMakeLists.txt
rename to data/accounts/ko/CMakeLists.txt
diff --git a/accounts/ko/Makefile.am b/data/accounts/ko/Makefile.am
similarity index 100%
rename from accounts/ko/Makefile.am
rename to data/accounts/ko/Makefile.am
diff --git a/accounts/ko/acctchrt_brokerage.gnucash-xea b/data/accounts/ko/acctchrt_brokerage.gnucash-xea
similarity index 100%
rename from accounts/ko/acctchrt_brokerage.gnucash-xea
rename to data/accounts/ko/acctchrt_brokerage.gnucash-xea
diff --git a/accounts/ko/acctchrt_business.gnucash-xea b/data/accounts/ko/acctchrt_business.gnucash-xea
similarity index 100%
rename from accounts/ko/acctchrt_business.gnucash-xea
rename to data/accounts/ko/acctchrt_business.gnucash-xea
diff --git a/accounts/ko/acctchrt_carloan.gnucash-xea b/data/accounts/ko/acctchrt_carloan.gnucash-xea
similarity index 100%
rename from accounts/ko/acctchrt_carloan.gnucash-xea
rename to data/accounts/ko/acctchrt_carloan.gnucash-xea
diff --git a/accounts/ko/acctchrt_cdmoneymkt.gnucash-xea b/data/accounts/ko/acctchrt_cdmoneymkt.gnucash-xea
similarity index 100%
rename from accounts/ko/acctchrt_cdmoneymkt.gnucash-xea
rename to data/accounts/ko/acctchrt_cdmoneymkt.gnucash-xea
diff --git a/accounts/ko/acctchrt_checkbook.gnucash-xea b/data/accounts/ko/acctchrt_checkbook.gnucash-xea
similarity index 100%
rename from accounts/ko/acctchrt_checkbook.gnucash-xea
rename to data/accounts/ko/acctchrt_checkbook.gnucash-xea
diff --git a/accounts/ko/acctchrt_childcare.gnucash-xea b/data/accounts/ko/acctchrt_childcare.gnucash-xea
similarity index 100%
rename from accounts/ko/acctchrt_childcare.gnucash-xea
rename to data/accounts/ko/acctchrt_childcare.gnucash-xea
diff --git a/accounts/ko/acctchrt_common.gnucash-xea b/data/accounts/ko/acctchrt_common.gnucash-xea
similarity index 100%
rename from accounts/ko/acctchrt_common.gnucash-xea
rename to data/accounts/ko/acctchrt_common.gnucash-xea
diff --git a/accounts/ko/acctchrt_eduloan.gnucash-xea b/data/accounts/ko/acctchrt_eduloan.gnucash-xea
similarity index 100%
rename from accounts/ko/acctchrt_eduloan.gnucash-xea
rename to data/accounts/ko/acctchrt_eduloan.gnucash-xea
diff --git a/accounts/ko/acctchrt_fixedassets.gnucash-xea b/data/accounts/ko/acctchrt_fixedassets.gnucash-xea
similarity index 100%
rename from accounts/ko/acctchrt_fixedassets.gnucash-xea
rename to data/accounts/ko/acctchrt_fixedassets.gnucash-xea
diff --git a/accounts/ko/acctchrt_homeloan.gnucash-xea b/data/accounts/ko/acctchrt_homeloan.gnucash-xea
similarity index 100%
rename from accounts/ko/acctchrt_homeloan.gnucash-xea
rename to data/accounts/ko/acctchrt_homeloan.gnucash-xea
diff --git a/accounts/ko/acctchrt_homeown.gnucash-xea b/data/accounts/ko/acctchrt_homeown.gnucash-xea
similarity index 100%
rename from accounts/ko/acctchrt_homeown.gnucash-xea
rename to data/accounts/ko/acctchrt_homeown.gnucash-xea
diff --git a/accounts/ko/acctchrt_otherloan.gnucash-xea b/data/accounts/ko/acctchrt_otherloan.gnucash-xea
similarity index 100%
rename from accounts/ko/acctchrt_otherloan.gnucash-xea
rename to data/accounts/ko/acctchrt_otherloan.gnucash-xea
diff --git a/accounts/ko/acctchrt_renter.gnucash-xea b/data/accounts/ko/acctchrt_renter.gnucash-xea
similarity index 100%
rename from accounts/ko/acctchrt_renter.gnucash-xea
rename to data/accounts/ko/acctchrt_renter.gnucash-xea
diff --git a/accounts/ko/acctchrt_retiremt.gnucash-xea b/data/accounts/ko/acctchrt_retiremt.gnucash-xea
similarity index 100%
rename from accounts/ko/acctchrt_retiremt.gnucash-xea
rename to data/accounts/ko/acctchrt_retiremt.gnucash-xea
diff --git a/accounts/ko/acctchrt_spouseinc.gnucash-xea b/data/accounts/ko/acctchrt_spouseinc.gnucash-xea
similarity index 100%
rename from accounts/ko/acctchrt_spouseinc.gnucash-xea
rename to data/accounts/ko/acctchrt_spouseinc.gnucash-xea
diff --git a/accounts/ko/acctchrt_spouseretire.gnucash-xea b/data/accounts/ko/acctchrt_spouseretire.gnucash-xea
similarity index 100%
rename from accounts/ko/acctchrt_spouseretire.gnucash-xea
rename to data/accounts/ko/acctchrt_spouseretire.gnucash-xea
diff --git a/accounts/lt/CMakeLists.txt b/data/accounts/lt/CMakeLists.txt
similarity index 100%
rename from accounts/lt/CMakeLists.txt
rename to data/accounts/lt/CMakeLists.txt
diff --git a/accounts/lt/Makefile.am b/data/accounts/lt/Makefile.am
similarity index 100%
rename from accounts/lt/Makefile.am
rename to data/accounts/lt/Makefile.am
diff --git a/accounts/lt/acctchrt_business.gnucash-xea b/data/accounts/lt/acctchrt_business.gnucash-xea
similarity index 100%
rename from accounts/lt/acctchrt_business.gnucash-xea
rename to data/accounts/lt/acctchrt_business.gnucash-xea
diff --git a/accounts/lv/CMakeLists.txt b/data/accounts/lv/CMakeLists.txt
similarity index 100%
rename from accounts/lv/CMakeLists.txt
rename to data/accounts/lv/CMakeLists.txt
diff --git a/accounts/lv/Makefile.am b/data/accounts/lv/Makefile.am
similarity index 100%
rename from accounts/lv/Makefile.am
rename to data/accounts/lv/Makefile.am
diff --git a/accounts/lv/acctchrt_brokerage.gnucash-xea b/data/accounts/lv/acctchrt_brokerage.gnucash-xea
similarity index 100%
rename from accounts/lv/acctchrt_brokerage.gnucash-xea
rename to data/accounts/lv/acctchrt_brokerage.gnucash-xea
diff --git a/accounts/lv/acctchrt_business.gnucash-xea b/data/accounts/lv/acctchrt_business.gnucash-xea
similarity index 100%
rename from accounts/lv/acctchrt_business.gnucash-xea
rename to data/accounts/lv/acctchrt_business.gnucash-xea
diff --git a/accounts/lv/acctchrt_carloan.gnucash-xea b/data/accounts/lv/acctchrt_carloan.gnucash-xea
similarity index 100%
rename from accounts/lv/acctchrt_carloan.gnucash-xea
rename to data/accounts/lv/acctchrt_carloan.gnucash-xea
diff --git a/accounts/lv/acctchrt_cdmoneymkt.gnucash-xea b/data/accounts/lv/acctchrt_cdmoneymkt.gnucash-xea
similarity index 100%
rename from accounts/lv/acctchrt_cdmoneymkt.gnucash-xea
rename to data/accounts/lv/acctchrt_cdmoneymkt.gnucash-xea
diff --git a/accounts/lv/acctchrt_checkbook.gnucash-xea b/data/accounts/lv/acctchrt_checkbook.gnucash-xea
similarity index 100%
rename from accounts/lv/acctchrt_checkbook.gnucash-xea
rename to data/accounts/lv/acctchrt_checkbook.gnucash-xea
diff --git a/accounts/lv/acctchrt_childcare.gnucash-xea b/data/accounts/lv/acctchrt_childcare.gnucash-xea
similarity index 100%
rename from accounts/lv/acctchrt_childcare.gnucash-xea
rename to data/accounts/lv/acctchrt_childcare.gnucash-xea
diff --git a/accounts/lv/acctchrt_common.gnucash-xea b/data/accounts/lv/acctchrt_common.gnucash-xea
similarity index 100%
rename from accounts/lv/acctchrt_common.gnucash-xea
rename to data/accounts/lv/acctchrt_common.gnucash-xea
diff --git a/accounts/lv/acctchrt_eduloan.gnucash-xea b/data/accounts/lv/acctchrt_eduloan.gnucash-xea
similarity index 100%
rename from accounts/lv/acctchrt_eduloan.gnucash-xea
rename to data/accounts/lv/acctchrt_eduloan.gnucash-xea
diff --git a/accounts/lv/acctchrt_fixedassets.gnucash-xea b/data/accounts/lv/acctchrt_fixedassets.gnucash-xea
similarity index 100%
rename from accounts/lv/acctchrt_fixedassets.gnucash-xea
rename to data/accounts/lv/acctchrt_fixedassets.gnucash-xea
diff --git a/accounts/lv/acctchrt_full.gnucash-xea b/data/accounts/lv/acctchrt_full.gnucash-xea
similarity index 100%
rename from accounts/lv/acctchrt_full.gnucash-xea
rename to data/accounts/lv/acctchrt_full.gnucash-xea
diff --git a/accounts/lv/acctchrt_homeloan.gnucash-xea b/data/accounts/lv/acctchrt_homeloan.gnucash-xea
similarity index 100%
rename from accounts/lv/acctchrt_homeloan.gnucash-xea
rename to data/accounts/lv/acctchrt_homeloan.gnucash-xea
diff --git a/accounts/lv/acctchrt_homeown.gnucash-xea b/data/accounts/lv/acctchrt_homeown.gnucash-xea
similarity index 100%
rename from accounts/lv/acctchrt_homeown.gnucash-xea
rename to data/accounts/lv/acctchrt_homeown.gnucash-xea
diff --git a/accounts/lv/acctchrt_otherloan.gnucash-xea b/data/accounts/lv/acctchrt_otherloan.gnucash-xea
similarity index 100%
rename from accounts/lv/acctchrt_otherloan.gnucash-xea
rename to data/accounts/lv/acctchrt_otherloan.gnucash-xea
diff --git a/accounts/lv/acctchrt_renter.gnucash-xea b/data/accounts/lv/acctchrt_renter.gnucash-xea
similarity index 100%
rename from accounts/lv/acctchrt_renter.gnucash-xea
rename to data/accounts/lv/acctchrt_renter.gnucash-xea
diff --git a/accounts/lv/acctchrt_retiremt.gnucash-xea b/data/accounts/lv/acctchrt_retiremt.gnucash-xea
similarity index 100%
rename from accounts/lv/acctchrt_retiremt.gnucash-xea
rename to data/accounts/lv/acctchrt_retiremt.gnucash-xea
diff --git a/accounts/lv/acctchrt_spouseinc.gnucash-xea b/data/accounts/lv/acctchrt_spouseinc.gnucash-xea
similarity index 100%
rename from accounts/lv/acctchrt_spouseinc.gnucash-xea
rename to data/accounts/lv/acctchrt_spouseinc.gnucash-xea
diff --git a/accounts/lv/acctchrt_spouseretire.gnucash-xea b/data/accounts/lv/acctchrt_spouseretire.gnucash-xea
similarity index 100%
rename from accounts/lv/acctchrt_spouseretire.gnucash-xea
rename to data/accounts/lv/acctchrt_spouseretire.gnucash-xea
diff --git a/accounts/nb/CMakeLists.txt b/data/accounts/nb/CMakeLists.txt
similarity index 100%
rename from accounts/nb/CMakeLists.txt
rename to data/accounts/nb/CMakeLists.txt
diff --git a/accounts/nb/Makefile.am b/data/accounts/nb/Makefile.am
similarity index 100%
rename from accounts/nb/Makefile.am
rename to data/accounts/nb/Makefile.am
diff --git a/accounts/nb/acctchrt_brokerage.gnucash-xea b/data/accounts/nb/acctchrt_brokerage.gnucash-xea
similarity index 100%
rename from accounts/nb/acctchrt_brokerage.gnucash-xea
rename to data/accounts/nb/acctchrt_brokerage.gnucash-xea
diff --git a/accounts/nb/acctchrt_business.gnucash-xea b/data/accounts/nb/acctchrt_business.gnucash-xea
similarity index 100%
rename from accounts/nb/acctchrt_business.gnucash-xea
rename to data/accounts/nb/acctchrt_business.gnucash-xea
diff --git a/accounts/nb/acctchrt_carloan.gnucash-xea b/data/accounts/nb/acctchrt_carloan.gnucash-xea
similarity index 100%
rename from accounts/nb/acctchrt_carloan.gnucash-xea
rename to data/accounts/nb/acctchrt_carloan.gnucash-xea
diff --git a/accounts/nb/acctchrt_cdmoneymkt.gnucash-xea b/data/accounts/nb/acctchrt_cdmoneymkt.gnucash-xea
similarity index 100%
rename from accounts/nb/acctchrt_cdmoneymkt.gnucash-xea
rename to data/accounts/nb/acctchrt_cdmoneymkt.gnucash-xea
diff --git a/accounts/nb/acctchrt_checkbook.gnucash-xea b/data/accounts/nb/acctchrt_checkbook.gnucash-xea
similarity index 100%
rename from accounts/nb/acctchrt_checkbook.gnucash-xea
rename to data/accounts/nb/acctchrt_checkbook.gnucash-xea
diff --git a/accounts/nb/acctchrt_childcare.gnucash-xea b/data/accounts/nb/acctchrt_childcare.gnucash-xea
similarity index 100%
rename from accounts/nb/acctchrt_childcare.gnucash-xea
rename to data/accounts/nb/acctchrt_childcare.gnucash-xea
diff --git a/accounts/nb/acctchrt_common.gnucash-xea b/data/accounts/nb/acctchrt_common.gnucash-xea
similarity index 100%
rename from accounts/nb/acctchrt_common.gnucash-xea
rename to data/accounts/nb/acctchrt_common.gnucash-xea
diff --git a/accounts/nb/acctchrt_eduloan.gnucash-xea b/data/accounts/nb/acctchrt_eduloan.gnucash-xea
similarity index 100%
rename from accounts/nb/acctchrt_eduloan.gnucash-xea
rename to data/accounts/nb/acctchrt_eduloan.gnucash-xea
diff --git a/accounts/nb/acctchrt_fixedassets.gnucash-xea b/data/accounts/nb/acctchrt_fixedassets.gnucash-xea
similarity index 100%
rename from accounts/nb/acctchrt_fixedassets.gnucash-xea
rename to data/accounts/nb/acctchrt_fixedassets.gnucash-xea
diff --git a/accounts/nb/acctchrt_full.gnucash-xea b/data/accounts/nb/acctchrt_full.gnucash-xea
similarity index 100%
rename from accounts/nb/acctchrt_full.gnucash-xea
rename to data/accounts/nb/acctchrt_full.gnucash-xea
diff --git a/accounts/nb/acctchrt_homeloan.gnucash-xea b/data/accounts/nb/acctchrt_homeloan.gnucash-xea
similarity index 100%
rename from accounts/nb/acctchrt_homeloan.gnucash-xea
rename to data/accounts/nb/acctchrt_homeloan.gnucash-xea
diff --git a/accounts/nb/acctchrt_homeown.gnucash-xea b/data/accounts/nb/acctchrt_homeown.gnucash-xea
similarity index 100%
rename from accounts/nb/acctchrt_homeown.gnucash-xea
rename to data/accounts/nb/acctchrt_homeown.gnucash-xea
diff --git a/accounts/nb/acctchrt_otherloan.gnucash-xea b/data/accounts/nb/acctchrt_otherloan.gnucash-xea
similarity index 100%
rename from accounts/nb/acctchrt_otherloan.gnucash-xea
rename to data/accounts/nb/acctchrt_otherloan.gnucash-xea
diff --git a/accounts/nb/acctchrt_renter.gnucash-xea b/data/accounts/nb/acctchrt_renter.gnucash-xea
similarity index 100%
rename from accounts/nb/acctchrt_renter.gnucash-xea
rename to data/accounts/nb/acctchrt_renter.gnucash-xea
diff --git a/accounts/nb/acctchrt_retiremt.gnucash-xea b/data/accounts/nb/acctchrt_retiremt.gnucash-xea
similarity index 100%
rename from accounts/nb/acctchrt_retiremt.gnucash-xea
rename to data/accounts/nb/acctchrt_retiremt.gnucash-xea
diff --git a/accounts/nb/acctchrt_spouseinc.gnucash-xea b/data/accounts/nb/acctchrt_spouseinc.gnucash-xea
similarity index 100%
rename from accounts/nb/acctchrt_spouseinc.gnucash-xea
rename to data/accounts/nb/acctchrt_spouseinc.gnucash-xea
diff --git a/accounts/nb/acctchrt_spouseretire.gnucash-xea b/data/accounts/nb/acctchrt_spouseretire.gnucash-xea
similarity index 100%
rename from accounts/nb/acctchrt_spouseretire.gnucash-xea
rename to data/accounts/nb/acctchrt_spouseretire.gnucash-xea
diff --git a/accounts/nl/CMakeLists.txt b/data/accounts/nl/CMakeLists.txt
similarity index 100%
rename from accounts/nl/CMakeLists.txt
rename to data/accounts/nl/CMakeLists.txt
diff --git a/accounts/nl/Makefile.am b/data/accounts/nl/Makefile.am
similarity index 100%
rename from accounts/nl/Makefile.am
rename to data/accounts/nl/Makefile.am
diff --git a/accounts/nl/acctchrt_checkbook.gnucash-xea b/data/accounts/nl/acctchrt_checkbook.gnucash-xea
similarity index 100%
rename from accounts/nl/acctchrt_checkbook.gnucash-xea
rename to data/accounts/nl/acctchrt_checkbook.gnucash-xea
diff --git a/accounts/nl/acctchrt_full.gnucash-xea b/data/accounts/nl/acctchrt_full.gnucash-xea
similarity index 100%
rename from accounts/nl/acctchrt_full.gnucash-xea
rename to data/accounts/nl/acctchrt_full.gnucash-xea
diff --git a/accounts/nl/acctchrt_rgs_1.1.gnucash-xea b/data/accounts/nl/acctchrt_rgs_1.1.gnucash-xea
similarity index 100%
rename from accounts/nl/acctchrt_rgs_1.1.gnucash-xea
rename to data/accounts/nl/acctchrt_rgs_1.1.gnucash-xea
diff --git a/accounts/pl/CMakeLists.txt b/data/accounts/pl/CMakeLists.txt
similarity index 100%
rename from accounts/pl/CMakeLists.txt
rename to data/accounts/pl/CMakeLists.txt
diff --git a/accounts/pl/Makefile.am b/data/accounts/pl/Makefile.am
similarity index 100%
rename from accounts/pl/Makefile.am
rename to data/accounts/pl/Makefile.am
diff --git a/accounts/pl/acctchrt_brokerage.gnucash-xea b/data/accounts/pl/acctchrt_brokerage.gnucash-xea
similarity index 100%
rename from accounts/pl/acctchrt_brokerage.gnucash-xea
rename to data/accounts/pl/acctchrt_brokerage.gnucash-xea
diff --git a/accounts/pl/acctchrt_business.gnucash-xea b/data/accounts/pl/acctchrt_business.gnucash-xea
similarity index 100%
rename from accounts/pl/acctchrt_business.gnucash-xea
rename to data/accounts/pl/acctchrt_business.gnucash-xea
diff --git a/accounts/pl/acctchrt_carloan.gnucash-xea b/data/accounts/pl/acctchrt_carloan.gnucash-xea
similarity index 100%
rename from accounts/pl/acctchrt_carloan.gnucash-xea
rename to data/accounts/pl/acctchrt_carloan.gnucash-xea
diff --git a/accounts/pl/acctchrt_cdmoneymkt.gnucash-xea b/data/accounts/pl/acctchrt_cdmoneymkt.gnucash-xea
similarity index 100%
rename from accounts/pl/acctchrt_cdmoneymkt.gnucash-xea
rename to data/accounts/pl/acctchrt_cdmoneymkt.gnucash-xea
diff --git a/accounts/pl/acctchrt_checkbook.gnucash-xea b/data/accounts/pl/acctchrt_checkbook.gnucash-xea
similarity index 100%
rename from accounts/pl/acctchrt_checkbook.gnucash-xea
rename to data/accounts/pl/acctchrt_checkbook.gnucash-xea
diff --git a/accounts/pl/acctchrt_childcare.gnucash-xea b/data/accounts/pl/acctchrt_childcare.gnucash-xea
similarity index 100%
rename from accounts/pl/acctchrt_childcare.gnucash-xea
rename to data/accounts/pl/acctchrt_childcare.gnucash-xea
diff --git a/accounts/pl/acctchrt_common.gnucash-xea b/data/accounts/pl/acctchrt_common.gnucash-xea
similarity index 100%
rename from accounts/pl/acctchrt_common.gnucash-xea
rename to data/accounts/pl/acctchrt_common.gnucash-xea
diff --git a/accounts/pl/acctchrt_eduloan.gnucash-xea b/data/accounts/pl/acctchrt_eduloan.gnucash-xea
similarity index 100%
rename from accounts/pl/acctchrt_eduloan.gnucash-xea
rename to data/accounts/pl/acctchrt_eduloan.gnucash-xea
diff --git a/accounts/pl/acctchrt_fixedassets.gnucash-xea b/data/accounts/pl/acctchrt_fixedassets.gnucash-xea
similarity index 100%
rename from accounts/pl/acctchrt_fixedassets.gnucash-xea
rename to data/accounts/pl/acctchrt_fixedassets.gnucash-xea
diff --git a/accounts/pl/acctchrt_full.gnucash-xea b/data/accounts/pl/acctchrt_full.gnucash-xea
similarity index 100%
rename from accounts/pl/acctchrt_full.gnucash-xea
rename to data/accounts/pl/acctchrt_full.gnucash-xea
diff --git a/accounts/pl/acctchrt_homeloan.gnucash-xea b/data/accounts/pl/acctchrt_homeloan.gnucash-xea
similarity index 100%
rename from accounts/pl/acctchrt_homeloan.gnucash-xea
rename to data/accounts/pl/acctchrt_homeloan.gnucash-xea
diff --git a/accounts/pl/acctchrt_homeown.gnucash-xea b/data/accounts/pl/acctchrt_homeown.gnucash-xea
similarity index 100%
rename from accounts/pl/acctchrt_homeown.gnucash-xea
rename to data/accounts/pl/acctchrt_homeown.gnucash-xea
diff --git a/accounts/pl/acctchrt_otherloan.gnucash-xea b/data/accounts/pl/acctchrt_otherloan.gnucash-xea
similarity index 100%
rename from accounts/pl/acctchrt_otherloan.gnucash-xea
rename to data/accounts/pl/acctchrt_otherloan.gnucash-xea
diff --git a/accounts/pl/acctchrt_renter.gnucash-xea b/data/accounts/pl/acctchrt_renter.gnucash-xea
similarity index 100%
rename from accounts/pl/acctchrt_renter.gnucash-xea
rename to data/accounts/pl/acctchrt_renter.gnucash-xea
diff --git a/accounts/pl/acctchrt_retiremt.gnucash-xea b/data/accounts/pl/acctchrt_retiremt.gnucash-xea
similarity index 100%
rename from accounts/pl/acctchrt_retiremt.gnucash-xea
rename to data/accounts/pl/acctchrt_retiremt.gnucash-xea
diff --git a/accounts/pl/acctchrt_spouseinc.gnucash-xea b/data/accounts/pl/acctchrt_spouseinc.gnucash-xea
similarity index 100%
rename from accounts/pl/acctchrt_spouseinc.gnucash-xea
rename to data/accounts/pl/acctchrt_spouseinc.gnucash-xea
diff --git a/accounts/pl/acctchrt_spouseretire.gnucash-xea b/data/accounts/pl/acctchrt_spouseretire.gnucash-xea
similarity index 100%
rename from accounts/pl/acctchrt_spouseretire.gnucash-xea
rename to data/accounts/pl/acctchrt_spouseretire.gnucash-xea
diff --git a/accounts/pt_BR/CMakeLists.txt b/data/accounts/pt_BR/CMakeLists.txt
similarity index 100%
rename from accounts/pt_BR/CMakeLists.txt
rename to data/accounts/pt_BR/CMakeLists.txt
diff --git a/accounts/pt_BR/Makefile.am b/data/accounts/pt_BR/Makefile.am
similarity index 100%
rename from accounts/pt_BR/Makefile.am
rename to data/accounts/pt_BR/Makefile.am
diff --git a/accounts/pt_BR/acctchrt_brokerage.gnucash-xea b/data/accounts/pt_BR/acctchrt_brokerage.gnucash-xea
similarity index 100%
rename from accounts/pt_BR/acctchrt_brokerage.gnucash-xea
rename to data/accounts/pt_BR/acctchrt_brokerage.gnucash-xea
diff --git a/accounts/pt_BR/acctchrt_carloan.gnucash-xea b/data/accounts/pt_BR/acctchrt_carloan.gnucash-xea
similarity index 100%
rename from accounts/pt_BR/acctchrt_carloan.gnucash-xea
rename to data/accounts/pt_BR/acctchrt_carloan.gnucash-xea
diff --git a/accounts/pt_BR/acctchrt_cdmoneymkt.gnucash-xea b/data/accounts/pt_BR/acctchrt_cdmoneymkt.gnucash-xea
similarity index 100%
rename from accounts/pt_BR/acctchrt_cdmoneymkt.gnucash-xea
rename to data/accounts/pt_BR/acctchrt_cdmoneymkt.gnucash-xea
diff --git a/accounts/pt_BR/acctchrt_childcare.gnucash-xea b/data/accounts/pt_BR/acctchrt_childcare.gnucash-xea
similarity index 100%
rename from accounts/pt_BR/acctchrt_childcare.gnucash-xea
rename to data/accounts/pt_BR/acctchrt_childcare.gnucash-xea
diff --git a/accounts/pt_BR/acctchrt_common.gnucash-xea b/data/accounts/pt_BR/acctchrt_common.gnucash-xea
similarity index 100%
rename from accounts/pt_BR/acctchrt_common.gnucash-xea
rename to data/accounts/pt_BR/acctchrt_common.gnucash-xea
diff --git a/accounts/pt_BR/acctchrt_currency.gnucash-xea b/data/accounts/pt_BR/acctchrt_currency.gnucash-xea
similarity index 100%
rename from accounts/pt_BR/acctchrt_currency.gnucash-xea
rename to data/accounts/pt_BR/acctchrt_currency.gnucash-xea
diff --git a/accounts/pt_BR/acctchrt_eduloan.gnucash-xea b/data/accounts/pt_BR/acctchrt_eduloan.gnucash-xea
similarity index 100%
rename from accounts/pt_BR/acctchrt_eduloan.gnucash-xea
rename to data/accounts/pt_BR/acctchrt_eduloan.gnucash-xea
diff --git a/accounts/pt_BR/acctchrt_fixedassets.gnucash-xea b/data/accounts/pt_BR/acctchrt_fixedassets.gnucash-xea
similarity index 100%
rename from accounts/pt_BR/acctchrt_fixedassets.gnucash-xea
rename to data/accounts/pt_BR/acctchrt_fixedassets.gnucash-xea
diff --git a/accounts/pt_BR/acctchrt_homeloan.gnucash-xea b/data/accounts/pt_BR/acctchrt_homeloan.gnucash-xea
similarity index 100%
rename from accounts/pt_BR/acctchrt_homeloan.gnucash-xea
rename to data/accounts/pt_BR/acctchrt_homeloan.gnucash-xea
diff --git a/accounts/pt_BR/acctchrt_homeown.gnucash-xea b/data/accounts/pt_BR/acctchrt_homeown.gnucash-xea
similarity index 100%
rename from accounts/pt_BR/acctchrt_homeown.gnucash-xea
rename to data/accounts/pt_BR/acctchrt_homeown.gnucash-xea
diff --git a/accounts/pt_BR/acctchrt_otherloan.gnucash-xea b/data/accounts/pt_BR/acctchrt_otherloan.gnucash-xea
similarity index 100%
rename from accounts/pt_BR/acctchrt_otherloan.gnucash-xea
rename to data/accounts/pt_BR/acctchrt_otherloan.gnucash-xea
diff --git a/accounts/pt_BR/acctchrt_renter.gnucash-xea b/data/accounts/pt_BR/acctchrt_renter.gnucash-xea
similarity index 100%
rename from accounts/pt_BR/acctchrt_renter.gnucash-xea
rename to data/accounts/pt_BR/acctchrt_renter.gnucash-xea
diff --git a/accounts/pt_BR/acctchrt_retiremt.gnucash-xea b/data/accounts/pt_BR/acctchrt_retiremt.gnucash-xea
similarity index 100%
rename from accounts/pt_BR/acctchrt_retiremt.gnucash-xea
rename to data/accounts/pt_BR/acctchrt_retiremt.gnucash-xea
diff --git a/accounts/pt_BR/acctchrt_spouseinc.gnucash-xea b/data/accounts/pt_BR/acctchrt_spouseinc.gnucash-xea
similarity index 100%
rename from accounts/pt_BR/acctchrt_spouseinc.gnucash-xea
rename to data/accounts/pt_BR/acctchrt_spouseinc.gnucash-xea
diff --git a/accounts/pt_BR/acctchrt_spouseretire.gnucash-xea b/data/accounts/pt_BR/acctchrt_spouseretire.gnucash-xea
similarity index 100%
rename from accounts/pt_BR/acctchrt_spouseretire.gnucash-xea
rename to data/accounts/pt_BR/acctchrt_spouseretire.gnucash-xea
diff --git a/accounts/pt_PT/CMakeLists.txt b/data/accounts/pt_PT/CMakeLists.txt
similarity index 100%
rename from accounts/pt_PT/CMakeLists.txt
rename to data/accounts/pt_PT/CMakeLists.txt
diff --git a/accounts/pt_PT/Makefile.am b/data/accounts/pt_PT/Makefile.am
similarity index 100%
rename from accounts/pt_PT/Makefile.am
rename to data/accounts/pt_PT/Makefile.am
diff --git a/accounts/pt_PT/acctchrt_brokerage.gnucash-xea b/data/accounts/pt_PT/acctchrt_brokerage.gnucash-xea
similarity index 100%
rename from accounts/pt_PT/acctchrt_brokerage.gnucash-xea
rename to data/accounts/pt_PT/acctchrt_brokerage.gnucash-xea
diff --git a/accounts/pt_PT/acctchrt_carloan.gnucash-xea b/data/accounts/pt_PT/acctchrt_carloan.gnucash-xea
similarity index 100%
rename from accounts/pt_PT/acctchrt_carloan.gnucash-xea
rename to data/accounts/pt_PT/acctchrt_carloan.gnucash-xea
diff --git a/accounts/pt_PT/acctchrt_cdmoneymkt.gnucash-xea b/data/accounts/pt_PT/acctchrt_cdmoneymkt.gnucash-xea
similarity index 100%
rename from accounts/pt_PT/acctchrt_cdmoneymkt.gnucash-xea
rename to data/accounts/pt_PT/acctchrt_cdmoneymkt.gnucash-xea
diff --git a/accounts/pt_PT/acctchrt_childcare.gnucash-xea b/data/accounts/pt_PT/acctchrt_childcare.gnucash-xea
similarity index 100%
rename from accounts/pt_PT/acctchrt_childcare.gnucash-xea
rename to data/accounts/pt_PT/acctchrt_childcare.gnucash-xea
diff --git a/accounts/pt_PT/acctchrt_common.gnucash-xea b/data/accounts/pt_PT/acctchrt_common.gnucash-xea
similarity index 100%
rename from accounts/pt_PT/acctchrt_common.gnucash-xea
rename to data/accounts/pt_PT/acctchrt_common.gnucash-xea
diff --git a/accounts/pt_PT/acctchrt_eduloan.gnucash-xea b/data/accounts/pt_PT/acctchrt_eduloan.gnucash-xea
similarity index 100%
rename from accounts/pt_PT/acctchrt_eduloan.gnucash-xea
rename to data/accounts/pt_PT/acctchrt_eduloan.gnucash-xea
diff --git a/accounts/pt_PT/acctchrt_fixedassets.gnucash-xea b/data/accounts/pt_PT/acctchrt_fixedassets.gnucash-xea
similarity index 100%
rename from accounts/pt_PT/acctchrt_fixedassets.gnucash-xea
rename to data/accounts/pt_PT/acctchrt_fixedassets.gnucash-xea
diff --git a/accounts/pt_PT/acctchrt_homeloan.gnucash-xea b/data/accounts/pt_PT/acctchrt_homeloan.gnucash-xea
similarity index 100%
rename from accounts/pt_PT/acctchrt_homeloan.gnucash-xea
rename to data/accounts/pt_PT/acctchrt_homeloan.gnucash-xea
diff --git a/accounts/pt_PT/acctchrt_homeown.gnucash-xea b/data/accounts/pt_PT/acctchrt_homeown.gnucash-xea
similarity index 100%
rename from accounts/pt_PT/acctchrt_homeown.gnucash-xea
rename to data/accounts/pt_PT/acctchrt_homeown.gnucash-xea
diff --git a/accounts/pt_PT/acctchrt_otherloan.gnucash-xea b/data/accounts/pt_PT/acctchrt_otherloan.gnucash-xea
similarity index 100%
rename from accounts/pt_PT/acctchrt_otherloan.gnucash-xea
rename to data/accounts/pt_PT/acctchrt_otherloan.gnucash-xea
diff --git a/accounts/pt_PT/acctchrt_renter.gnucash-xea b/data/accounts/pt_PT/acctchrt_renter.gnucash-xea
similarity index 100%
rename from accounts/pt_PT/acctchrt_renter.gnucash-xea
rename to data/accounts/pt_PT/acctchrt_renter.gnucash-xea
diff --git a/accounts/pt_PT/acctchrt_retiremt.gnucash-xea b/data/accounts/pt_PT/acctchrt_retiremt.gnucash-xea
similarity index 100%
rename from accounts/pt_PT/acctchrt_retiremt.gnucash-xea
rename to data/accounts/pt_PT/acctchrt_retiremt.gnucash-xea
diff --git a/accounts/pt_PT/acctchrt_spouseinc.gnucash-xea b/data/accounts/pt_PT/acctchrt_spouseinc.gnucash-xea
similarity index 100%
rename from accounts/pt_PT/acctchrt_spouseinc.gnucash-xea
rename to data/accounts/pt_PT/acctchrt_spouseinc.gnucash-xea
diff --git a/accounts/pt_PT/acctchrt_spouseretire.gnucash-xea b/data/accounts/pt_PT/acctchrt_spouseretire.gnucash-xea
similarity index 100%
rename from accounts/pt_PT/acctchrt_spouseretire.gnucash-xea
rename to data/accounts/pt_PT/acctchrt_spouseretire.gnucash-xea
diff --git a/accounts/ru/CMakeLists.txt b/data/accounts/ru/CMakeLists.txt
similarity index 100%
rename from accounts/ru/CMakeLists.txt
rename to data/accounts/ru/CMakeLists.txt
diff --git a/accounts/ru/Makefile.am b/data/accounts/ru/Makefile.am
similarity index 100%
rename from accounts/ru/Makefile.am
rename to data/accounts/ru/Makefile.am
diff --git a/accounts/ru/acctchrt_common.gnucash-xea b/data/accounts/ru/acctchrt_common.gnucash-xea
similarity index 100%
rename from accounts/ru/acctchrt_common.gnucash-xea
rename to data/accounts/ru/acctchrt_common.gnucash-xea
diff --git a/accounts/ru/acctchrt_homeloan.gnucash-xea b/data/accounts/ru/acctchrt_homeloan.gnucash-xea
similarity index 100%
rename from accounts/ru/acctchrt_homeloan.gnucash-xea
rename to data/accounts/ru/acctchrt_homeloan.gnucash-xea
diff --git a/accounts/ru/acctchrt_homeown.gnucash-xea b/data/accounts/ru/acctchrt_homeown.gnucash-xea
similarity index 100%
rename from accounts/ru/acctchrt_homeown.gnucash-xea
rename to data/accounts/ru/acctchrt_homeown.gnucash-xea
diff --git a/accounts/ru/acctchrt_renter.gnucash-xea b/data/accounts/ru/acctchrt_renter.gnucash-xea
similarity index 100%
rename from accounts/ru/acctchrt_renter.gnucash-xea
rename to data/accounts/ru/acctchrt_renter.gnucash-xea
diff --git a/accounts/sk/CMakeLists.txt b/data/accounts/sk/CMakeLists.txt
similarity index 100%
rename from accounts/sk/CMakeLists.txt
rename to data/accounts/sk/CMakeLists.txt
diff --git a/accounts/sk/Makefile.am b/data/accounts/sk/Makefile.am
similarity index 100%
rename from accounts/sk/Makefile.am
rename to data/accounts/sk/Makefile.am
diff --git a/accounts/sk/acctchrt_brokerage.gnucash-xea b/data/accounts/sk/acctchrt_brokerage.gnucash-xea
similarity index 100%
rename from accounts/sk/acctchrt_brokerage.gnucash-xea
rename to data/accounts/sk/acctchrt_brokerage.gnucash-xea
diff --git a/accounts/sk/acctchrt_carloan.gnucash-xea b/data/accounts/sk/acctchrt_carloan.gnucash-xea
similarity index 100%
rename from accounts/sk/acctchrt_carloan.gnucash-xea
rename to data/accounts/sk/acctchrt_carloan.gnucash-xea
diff --git a/accounts/sk/acctchrt_cdmoneymkt.gnucash-xea b/data/accounts/sk/acctchrt_cdmoneymkt.gnucash-xea
similarity index 100%
rename from accounts/sk/acctchrt_cdmoneymkt.gnucash-xea
rename to data/accounts/sk/acctchrt_cdmoneymkt.gnucash-xea
diff --git a/accounts/sk/acctchrt_childcare.gnucash-xea b/data/accounts/sk/acctchrt_childcare.gnucash-xea
similarity index 100%
rename from accounts/sk/acctchrt_childcare.gnucash-xea
rename to data/accounts/sk/acctchrt_childcare.gnucash-xea
diff --git a/accounts/sk/acctchrt_common.gnucash-xea b/data/accounts/sk/acctchrt_common.gnucash-xea
similarity index 100%
rename from accounts/sk/acctchrt_common.gnucash-xea
rename to data/accounts/sk/acctchrt_common.gnucash-xea
diff --git a/accounts/sk/acctchrt_currency.gnucash-xea b/data/accounts/sk/acctchrt_currency.gnucash-xea
similarity index 100%
rename from accounts/sk/acctchrt_currency.gnucash-xea
rename to data/accounts/sk/acctchrt_currency.gnucash-xea
diff --git a/accounts/sk/acctchrt_eduloan.gnucash-xea b/data/accounts/sk/acctchrt_eduloan.gnucash-xea
similarity index 100%
rename from accounts/sk/acctchrt_eduloan.gnucash-xea
rename to data/accounts/sk/acctchrt_eduloan.gnucash-xea
diff --git a/accounts/sk/acctchrt_fixedassets.gnucash-xea b/data/accounts/sk/acctchrt_fixedassets.gnucash-xea
similarity index 100%
rename from accounts/sk/acctchrt_fixedassets.gnucash-xea
rename to data/accounts/sk/acctchrt_fixedassets.gnucash-xea
diff --git a/accounts/sk/acctchrt_homeloan.gnucash-xea b/data/accounts/sk/acctchrt_homeloan.gnucash-xea
similarity index 100%
rename from accounts/sk/acctchrt_homeloan.gnucash-xea
rename to data/accounts/sk/acctchrt_homeloan.gnucash-xea
diff --git a/accounts/sk/acctchrt_homeown.gnucash-xea b/data/accounts/sk/acctchrt_homeown.gnucash-xea
similarity index 100%
rename from accounts/sk/acctchrt_homeown.gnucash-xea
rename to data/accounts/sk/acctchrt_homeown.gnucash-xea
diff --git a/accounts/sk/acctchrt_otherloan.gnucash-xea b/data/accounts/sk/acctchrt_otherloan.gnucash-xea
similarity index 100%
rename from accounts/sk/acctchrt_otherloan.gnucash-xea
rename to data/accounts/sk/acctchrt_otherloan.gnucash-xea
diff --git a/accounts/sk/acctchrt_renter.gnucash-xea b/data/accounts/sk/acctchrt_renter.gnucash-xea
similarity index 100%
rename from accounts/sk/acctchrt_renter.gnucash-xea
rename to data/accounts/sk/acctchrt_renter.gnucash-xea
diff --git a/accounts/sk/acctchrt_retiremt.gnucash-xea b/data/accounts/sk/acctchrt_retiremt.gnucash-xea
similarity index 100%
rename from accounts/sk/acctchrt_retiremt.gnucash-xea
rename to data/accounts/sk/acctchrt_retiremt.gnucash-xea
diff --git a/accounts/sk/acctchrt_spouseinc.gnucash-xea b/data/accounts/sk/acctchrt_spouseinc.gnucash-xea
similarity index 100%
rename from accounts/sk/acctchrt_spouseinc.gnucash-xea
rename to data/accounts/sk/acctchrt_spouseinc.gnucash-xea
diff --git a/accounts/sk/acctchrt_spouseretire.gnucash-xea b/data/accounts/sk/acctchrt_spouseretire.gnucash-xea
similarity index 100%
rename from accounts/sk/acctchrt_spouseretire.gnucash-xea
rename to data/accounts/sk/acctchrt_spouseretire.gnucash-xea
diff --git a/accounts/sv_AX/CMakeLists.txt b/data/accounts/sv_AX/CMakeLists.txt
similarity index 100%
rename from accounts/sv_AX/CMakeLists.txt
rename to data/accounts/sv_AX/CMakeLists.txt
diff --git a/accounts/sv_AX/Makefile.am b/data/accounts/sv_AX/Makefile.am
similarity index 100%
rename from accounts/sv_AX/Makefile.am
rename to data/accounts/sv_AX/Makefile.am
diff --git a/accounts/sv_AX/acctchrt_common.gnucash-xea b/data/accounts/sv_AX/acctchrt_common.gnucash-xea
similarity index 100%
rename from accounts/sv_AX/acctchrt_common.gnucash-xea
rename to data/accounts/sv_AX/acctchrt_common.gnucash-xea
diff --git a/accounts/sv_AX/acctchrt_rf.gnucash-xea b/data/accounts/sv_AX/acctchrt_rf.gnucash-xea
similarity index 100%
rename from accounts/sv_AX/acctchrt_rf.gnucash-xea
rename to data/accounts/sv_AX/acctchrt_rf.gnucash-xea
diff --git a/accounts/sv_AX/acctchrt_sbr-xbrl.gnucash-xea b/data/accounts/sv_AX/acctchrt_sbr-xbrl.gnucash-xea
similarity index 100%
rename from accounts/sv_AX/acctchrt_sbr-xbrl.gnucash-xea
rename to data/accounts/sv_AX/acctchrt_sbr-xbrl.gnucash-xea
diff --git a/accounts/sv_FI/CMakeLists.txt b/data/accounts/sv_FI/CMakeLists.txt
similarity index 100%
rename from accounts/sv_FI/CMakeLists.txt
rename to data/accounts/sv_FI/CMakeLists.txt
diff --git a/accounts/sv_FI/Makefile.am b/data/accounts/sv_FI/Makefile.am
similarity index 100%
rename from accounts/sv_FI/Makefile.am
rename to data/accounts/sv_FI/Makefile.am
diff --git a/accounts/sv_FI/acctchrt_common.gnucash-xea b/data/accounts/sv_FI/acctchrt_common.gnucash-xea
similarity index 100%
rename from accounts/sv_FI/acctchrt_common.gnucash-xea
rename to data/accounts/sv_FI/acctchrt_common.gnucash-xea
diff --git a/accounts/sv_FI/acctchrt_rf.gnucash-xea b/data/accounts/sv_FI/acctchrt_rf.gnucash-xea
similarity index 100%
rename from accounts/sv_FI/acctchrt_rf.gnucash-xea
rename to data/accounts/sv_FI/acctchrt_rf.gnucash-xea
diff --git a/accounts/sv_FI/acctchrt_sbr-xbrl.gnucash-xea b/data/accounts/sv_FI/acctchrt_sbr-xbrl.gnucash-xea
similarity index 100%
rename from accounts/sv_FI/acctchrt_sbr-xbrl.gnucash-xea
rename to data/accounts/sv_FI/acctchrt_sbr-xbrl.gnucash-xea
diff --git a/accounts/sv_SE/CMakeLists.txt b/data/accounts/sv_SE/CMakeLists.txt
similarity index 100%
rename from accounts/sv_SE/CMakeLists.txt
rename to data/accounts/sv_SE/CMakeLists.txt
diff --git a/accounts/sv_SE/Makefile.am b/data/accounts/sv_SE/Makefile.am
similarity index 100%
rename from accounts/sv_SE/Makefile.am
rename to data/accounts/sv_SE/Makefile.am
diff --git a/accounts/sv_SE/README.bas_2012 b/data/accounts/sv_SE/README.bas_2012
similarity index 100%
rename from accounts/sv_SE/README.bas_2012
rename to data/accounts/sv_SE/README.bas_2012
diff --git a/accounts/sv_SE/acctchrt_common.gnucash-xea b/data/accounts/sv_SE/acctchrt_common.gnucash-xea
similarity index 100%
rename from accounts/sv_SE/acctchrt_common.gnucash-xea
rename to data/accounts/sv_SE/acctchrt_common.gnucash-xea
diff --git a/accounts/sv_SE/bas_2012.gnucash-xea b/data/accounts/sv_SE/bas_2012.gnucash-xea
similarity index 100%
rename from accounts/sv_SE/bas_2012.gnucash-xea
rename to data/accounts/sv_SE/bas_2012.gnucash-xea
diff --git a/accounts/tr_TR/CMakeLists.txt b/data/accounts/tr_TR/CMakeLists.txt
similarity index 100%
rename from accounts/tr_TR/CMakeLists.txt
rename to data/accounts/tr_TR/CMakeLists.txt
diff --git a/accounts/tr_TR/Makefile.am b/data/accounts/tr_TR/Makefile.am
similarity index 100%
rename from accounts/tr_TR/Makefile.am
rename to data/accounts/tr_TR/Makefile.am
diff --git a/accounts/tr_TR/acctchrt_TEKDUZ.gnucash-xea b/data/accounts/tr_TR/acctchrt_TEKDUZ.gnucash-xea
similarity index 100%
rename from accounts/tr_TR/acctchrt_TEKDUZ.gnucash-xea
rename to data/accounts/tr_TR/acctchrt_TEKDUZ.gnucash-xea
diff --git a/accounts/tr_TR/acctchrt_brokerage.gnucash-xea b/data/accounts/tr_TR/acctchrt_brokerage.gnucash-xea
similarity index 100%
rename from accounts/tr_TR/acctchrt_brokerage.gnucash-xea
rename to data/accounts/tr_TR/acctchrt_brokerage.gnucash-xea
diff --git a/accounts/tr_TR/acctchrt_carloan.gnucash-xea b/data/accounts/tr_TR/acctchrt_carloan.gnucash-xea
similarity index 100%
rename from accounts/tr_TR/acctchrt_carloan.gnucash-xea
rename to data/accounts/tr_TR/acctchrt_carloan.gnucash-xea
diff --git a/accounts/tr_TR/acctchrt_cdmoneymkt.gnucash-xea b/data/accounts/tr_TR/acctchrt_cdmoneymkt.gnucash-xea
similarity index 100%
rename from accounts/tr_TR/acctchrt_cdmoneymkt.gnucash-xea
rename to data/accounts/tr_TR/acctchrt_cdmoneymkt.gnucash-xea
diff --git a/accounts/tr_TR/acctchrt_checkbook.gnucash-xea b/data/accounts/tr_TR/acctchrt_checkbook.gnucash-xea
similarity index 100%
rename from accounts/tr_TR/acctchrt_checkbook.gnucash-xea
rename to data/accounts/tr_TR/acctchrt_checkbook.gnucash-xea
diff --git a/accounts/tr_TR/acctchrt_common.gnucash-xea b/data/accounts/tr_TR/acctchrt_common.gnucash-xea
similarity index 100%
rename from accounts/tr_TR/acctchrt_common.gnucash-xea
rename to data/accounts/tr_TR/acctchrt_common.gnucash-xea
diff --git a/accounts/tr_TR/acctchrt_fixedassets.gnucash-xea b/data/accounts/tr_TR/acctchrt_fixedassets.gnucash-xea
similarity index 100%
rename from accounts/tr_TR/acctchrt_fixedassets.gnucash-xea
rename to data/accounts/tr_TR/acctchrt_fixedassets.gnucash-xea
diff --git a/accounts/tr_TR/acctchrt_homeloan.gnucash-xea b/data/accounts/tr_TR/acctchrt_homeloan.gnucash-xea
similarity index 100%
rename from accounts/tr_TR/acctchrt_homeloan.gnucash-xea
rename to data/accounts/tr_TR/acctchrt_homeloan.gnucash-xea
diff --git a/accounts/zh_CN/CMakeLists.txt b/data/accounts/zh_CN/CMakeLists.txt
similarity index 100%
rename from accounts/zh_CN/CMakeLists.txt
rename to data/accounts/zh_CN/CMakeLists.txt
diff --git a/accounts/zh_CN/Makefile.am b/data/accounts/zh_CN/Makefile.am
similarity index 100%
rename from accounts/zh_CN/Makefile.am
rename to data/accounts/zh_CN/Makefile.am
diff --git a/accounts/zh_CN/acctchrt_brokerage.gnucash-xea b/data/accounts/zh_CN/acctchrt_brokerage.gnucash-xea
similarity index 100%
rename from accounts/zh_CN/acctchrt_brokerage.gnucash-xea
rename to data/accounts/zh_CN/acctchrt_brokerage.gnucash-xea
diff --git a/accounts/zh_CN/acctchrt_business.gnucash-xea b/data/accounts/zh_CN/acctchrt_business.gnucash-xea
similarity index 100%
rename from accounts/zh_CN/acctchrt_business.gnucash-xea
rename to data/accounts/zh_CN/acctchrt_business.gnucash-xea
diff --git a/accounts/zh_CN/acctchrt_carloan.gnucash-xea b/data/accounts/zh_CN/acctchrt_carloan.gnucash-xea
similarity index 100%
rename from accounts/zh_CN/acctchrt_carloan.gnucash-xea
rename to data/accounts/zh_CN/acctchrt_carloan.gnucash-xea
diff --git a/accounts/zh_CN/acctchrt_cdmoneymkt.gnucash-xea b/data/accounts/zh_CN/acctchrt_cdmoneymkt.gnucash-xea
similarity index 100%
rename from accounts/zh_CN/acctchrt_cdmoneymkt.gnucash-xea
rename to data/accounts/zh_CN/acctchrt_cdmoneymkt.gnucash-xea
diff --git a/accounts/zh_CN/acctchrt_checkbook.gnucash-xea b/data/accounts/zh_CN/acctchrt_checkbook.gnucash-xea
similarity index 100%
rename from accounts/zh_CN/acctchrt_checkbook.gnucash-xea
rename to data/accounts/zh_CN/acctchrt_checkbook.gnucash-xea
diff --git a/accounts/zh_CN/acctchrt_childcare.gnucash-xea b/data/accounts/zh_CN/acctchrt_childcare.gnucash-xea
similarity index 100%
rename from accounts/zh_CN/acctchrt_childcare.gnucash-xea
rename to data/accounts/zh_CN/acctchrt_childcare.gnucash-xea
diff --git a/accounts/zh_CN/acctchrt_common.gnucash-xea b/data/accounts/zh_CN/acctchrt_common.gnucash-xea
similarity index 100%
rename from accounts/zh_CN/acctchrt_common.gnucash-xea
rename to data/accounts/zh_CN/acctchrt_common.gnucash-xea
diff --git a/accounts/zh_CN/acctchrt_eduloan.gnucash-xea b/data/accounts/zh_CN/acctchrt_eduloan.gnucash-xea
similarity index 100%
rename from accounts/zh_CN/acctchrt_eduloan.gnucash-xea
rename to data/accounts/zh_CN/acctchrt_eduloan.gnucash-xea
diff --git a/accounts/zh_CN/acctchrt_fixedassets.gnucash-xea b/data/accounts/zh_CN/acctchrt_fixedassets.gnucash-xea
similarity index 100%
rename from accounts/zh_CN/acctchrt_fixedassets.gnucash-xea
rename to data/accounts/zh_CN/acctchrt_fixedassets.gnucash-xea
diff --git a/accounts/zh_CN/acctchrt_full.gnucash-xea b/data/accounts/zh_CN/acctchrt_full.gnucash-xea
similarity index 100%
rename from accounts/zh_CN/acctchrt_full.gnucash-xea
rename to data/accounts/zh_CN/acctchrt_full.gnucash-xea
diff --git a/accounts/zh_CN/acctchrt_homeloan.gnucash-xea b/data/accounts/zh_CN/acctchrt_homeloan.gnucash-xea
similarity index 100%
rename from accounts/zh_CN/acctchrt_homeloan.gnucash-xea
rename to data/accounts/zh_CN/acctchrt_homeloan.gnucash-xea
diff --git a/accounts/zh_CN/acctchrt_homeown.gnucash-xea b/data/accounts/zh_CN/acctchrt_homeown.gnucash-xea
similarity index 100%
rename from accounts/zh_CN/acctchrt_homeown.gnucash-xea
rename to data/accounts/zh_CN/acctchrt_homeown.gnucash-xea
diff --git a/accounts/zh_CN/acctchrt_otherloan.gnucash-xea b/data/accounts/zh_CN/acctchrt_otherloan.gnucash-xea
similarity index 100%
rename from accounts/zh_CN/acctchrt_otherloan.gnucash-xea
rename to data/accounts/zh_CN/acctchrt_otherloan.gnucash-xea
diff --git a/accounts/zh_CN/acctchrt_renter.gnucash-xea b/data/accounts/zh_CN/acctchrt_renter.gnucash-xea
similarity index 100%
rename from accounts/zh_CN/acctchrt_renter.gnucash-xea
rename to data/accounts/zh_CN/acctchrt_renter.gnucash-xea
diff --git a/accounts/zh_CN/acctchrt_retiremt.gnucash-xea b/data/accounts/zh_CN/acctchrt_retiremt.gnucash-xea
similarity index 100%
rename from accounts/zh_CN/acctchrt_retiremt.gnucash-xea
rename to data/accounts/zh_CN/acctchrt_retiremt.gnucash-xea
diff --git a/accounts/zh_CN/acctchrt_spouseinc.gnucash-xea b/data/accounts/zh_CN/acctchrt_spouseinc.gnucash-xea
similarity index 100%
rename from accounts/zh_CN/acctchrt_spouseinc.gnucash-xea
rename to data/accounts/zh_CN/acctchrt_spouseinc.gnucash-xea
diff --git a/accounts/zh_CN/acctchrt_spouseretire.gnucash-xea b/data/accounts/zh_CN/acctchrt_spouseretire.gnucash-xea
similarity index 100%
rename from accounts/zh_CN/acctchrt_spouseretire.gnucash-xea
rename to data/accounts/zh_CN/acctchrt_spouseretire.gnucash-xea
diff --git a/accounts/zh_HK/CMakeLists.txt b/data/accounts/zh_HK/CMakeLists.txt
similarity index 100%
rename from accounts/zh_HK/CMakeLists.txt
rename to data/accounts/zh_HK/CMakeLists.txt
diff --git a/accounts/zh_HK/Makefile.am b/data/accounts/zh_HK/Makefile.am
similarity index 100%
rename from accounts/zh_HK/Makefile.am
rename to data/accounts/zh_HK/Makefile.am
diff --git a/accounts/zh_HK/acctchrt_business.gnucash-xea b/data/accounts/zh_HK/acctchrt_business.gnucash-xea
similarity index 100%
rename from accounts/zh_HK/acctchrt_business.gnucash-xea
rename to data/accounts/zh_HK/acctchrt_business.gnucash-xea
diff --git a/accounts/zh_TW/CMakeLists.txt b/data/accounts/zh_TW/CMakeLists.txt
similarity index 100%
rename from accounts/zh_TW/CMakeLists.txt
rename to data/accounts/zh_TW/CMakeLists.txt
diff --git a/accounts/zh_TW/Makefile.am b/data/accounts/zh_TW/Makefile.am
similarity index 100%
rename from accounts/zh_TW/Makefile.am
rename to data/accounts/zh_TW/Makefile.am
diff --git a/accounts/zh_TW/acctchrt_business.gnucash-xea b/data/accounts/zh_TW/acctchrt_business.gnucash-xea
similarity index 100%
rename from accounts/zh_TW/acctchrt_business.gnucash-xea
rename to data/accounts/zh_TW/acctchrt_business.gnucash-xea
diff --git a/checks/CMakeLists.txt b/data/checks/CMakeLists.txt
similarity index 100%
rename from checks/CMakeLists.txt
rename to data/checks/CMakeLists.txt
diff --git a/checks/Makefile.am b/data/checks/Makefile.am
similarity index 100%
rename from checks/Makefile.am
rename to data/checks/Makefile.am
diff --git a/checks/deluxe.chk b/data/checks/deluxe.chk
similarity index 100%
rename from checks/deluxe.chk
rename to data/checks/deluxe.chk
diff --git a/checks/liberty.chk b/data/checks/liberty.chk
similarity index 100%
rename from checks/liberty.chk
rename to data/checks/liberty.chk
diff --git a/checks/quicken.chk b/data/checks/quicken.chk
similarity index 100%
rename from checks/quicken.chk
rename to data/checks/quicken.chk
diff --git a/checks/quicken_3part.chk b/data/checks/quicken_3part.chk
similarity index 100%
rename from checks/quicken_3part.chk
rename to data/checks/quicken_3part.chk
diff --git a/checks/quicken_check_21.chk b/data/checks/quicken_check_21.chk
similarity index 100%
rename from checks/quicken_check_21.chk
rename to data/checks/quicken_check_21.chk
diff --git a/checks/quicken_wallet.chk b/data/checks/quicken_wallet.chk
similarity index 100%
rename from checks/quicken_wallet.chk
rename to data/checks/quicken_wallet.chk
diff --git a/checks/voucher.chk b/data/checks/voucher.chk
similarity index 100%
rename from checks/voucher.chk
rename to data/checks/voucher.chk
diff --git a/libgnucash/pixmaps/CMakeLists.txt b/data/pixmaps/CMakeLists.txt
similarity index 100%
rename from libgnucash/pixmaps/CMakeLists.txt
rename to data/pixmaps/CMakeLists.txt
diff --git a/libgnucash/pixmaps/Makefile.am b/data/pixmaps/Makefile.am
similarity index 100%
rename from libgnucash/pixmaps/Makefile.am
rename to data/pixmaps/Makefile.am
diff --git a/libgnucash/pixmaps/gnucash-icon-48x48.bmp b/data/pixmaps/gnucash-icon-48x48.bmp
similarity index 100%
rename from libgnucash/pixmaps/gnucash-icon-48x48.bmp
rename to data/pixmaps/gnucash-icon-48x48.bmp
diff --git a/libgnucash/pixmaps/gnucash-icon.ico b/data/pixmaps/gnucash-icon.ico
similarity index 100%
rename from libgnucash/pixmaps/gnucash-icon.ico
rename to data/pixmaps/gnucash-icon.ico
diff --git a/libgnucash/pixmaps/gnucash_splash.png b/data/pixmaps/gnucash_splash.png
similarity index 100%
rename from libgnucash/pixmaps/gnucash_splash.png
rename to data/pixmaps/gnucash_splash.png
diff --git a/libgnucash/pixmaps/hicolor/128x128/apps/gnucash-icon.png b/data/pixmaps/hicolor/128x128/apps/gnucash-icon.png
similarity index 100%
rename from libgnucash/pixmaps/hicolor/128x128/apps/gnucash-icon.png
rename to data/pixmaps/hicolor/128x128/apps/gnucash-icon.png
diff --git a/libgnucash/pixmaps/hicolor/16x16/actions/gnc-account-delete.png b/data/pixmaps/hicolor/16x16/actions/gnc-account-delete.png
similarity index 100%
rename from libgnucash/pixmaps/hicolor/16x16/actions/gnc-account-delete.png
rename to data/pixmaps/hicolor/16x16/actions/gnc-account-delete.png
diff --git a/libgnucash/pixmaps/hicolor/16x16/actions/gnc-account-edit.png b/data/pixmaps/hicolor/16x16/actions/gnc-account-edit.png
similarity index 100%
rename from libgnucash/pixmaps/hicolor/16x16/actions/gnc-account-edit.png
rename to data/pixmaps/hicolor/16x16/actions/gnc-account-edit.png
diff --git a/libgnucash/pixmaps/hicolor/16x16/actions/gnc-account-new.png b/data/pixmaps/hicolor/16x16/actions/gnc-account-new.png
similarity index 100%
rename from libgnucash/pixmaps/hicolor/16x16/actions/gnc-account-new.png
rename to data/pixmaps/hicolor/16x16/actions/gnc-account-new.png
diff --git a/libgnucash/pixmaps/hicolor/16x16/actions/gnc-account-open.png b/data/pixmaps/hicolor/16x16/actions/gnc-account-open.png
similarity index 100%
rename from libgnucash/pixmaps/hicolor/16x16/actions/gnc-account-open.png
rename to data/pixmaps/hicolor/16x16/actions/gnc-account-open.png
diff --git a/libgnucash/pixmaps/hicolor/16x16/actions/gnc-account-report.png b/data/pixmaps/hicolor/16x16/actions/gnc-account-report.png
similarity index 100%
rename from libgnucash/pixmaps/hicolor/16x16/actions/gnc-account-report.png
rename to data/pixmaps/hicolor/16x16/actions/gnc-account-report.png
diff --git a/libgnucash/pixmaps/hicolor/16x16/actions/gnc-account.png b/data/pixmaps/hicolor/16x16/actions/gnc-account.png
similarity index 100%
rename from libgnucash/pixmaps/hicolor/16x16/actions/gnc-account.png
rename to data/pixmaps/hicolor/16x16/actions/gnc-account.png
diff --git a/libgnucash/pixmaps/hicolor/16x16/actions/gnc-gnome-pdf.png b/data/pixmaps/hicolor/16x16/actions/gnc-gnome-pdf.png
similarity index 100%
rename from libgnucash/pixmaps/hicolor/16x16/actions/gnc-gnome-pdf.png
rename to data/pixmaps/hicolor/16x16/actions/gnc-gnome-pdf.png
diff --git a/libgnucash/pixmaps/hicolor/16x16/actions/gnc-invoice-duplicate.png b/data/pixmaps/hicolor/16x16/actions/gnc-invoice-duplicate.png
similarity index 100%
rename from libgnucash/pixmaps/hicolor/16x16/actions/gnc-invoice-duplicate.png
rename to data/pixmaps/hicolor/16x16/actions/gnc-invoice-duplicate.png
diff --git a/libgnucash/pixmaps/hicolor/16x16/actions/gnc-invoice-edit.png b/data/pixmaps/hicolor/16x16/actions/gnc-invoice-edit.png
similarity index 100%
rename from libgnucash/pixmaps/hicolor/16x16/actions/gnc-invoice-edit.png
rename to data/pixmaps/hicolor/16x16/actions/gnc-invoice-edit.png
diff --git a/libgnucash/pixmaps/hicolor/16x16/actions/gnc-invoice-new.png b/data/pixmaps/hicolor/16x16/actions/gnc-invoice-new.png
similarity index 100%
rename from libgnucash/pixmaps/hicolor/16x16/actions/gnc-invoice-new.png
rename to data/pixmaps/hicolor/16x16/actions/gnc-invoice-new.png
diff --git a/libgnucash/pixmaps/hicolor/16x16/actions/gnc-invoice-pay.png b/data/pixmaps/hicolor/16x16/actions/gnc-invoice-pay.png
similarity index 100%
rename from libgnucash/pixmaps/hicolor/16x16/actions/gnc-invoice-pay.png
rename to data/pixmaps/hicolor/16x16/actions/gnc-invoice-pay.png
diff --git a/libgnucash/pixmaps/hicolor/16x16/actions/gnc-invoice-post.png b/data/pixmaps/hicolor/16x16/actions/gnc-invoice-post.png
similarity index 100%
rename from libgnucash/pixmaps/hicolor/16x16/actions/gnc-invoice-post.png
rename to data/pixmaps/hicolor/16x16/actions/gnc-invoice-post.png
diff --git a/libgnucash/pixmaps/hicolor/16x16/actions/gnc-invoice-unpost.png b/data/pixmaps/hicolor/16x16/actions/gnc-invoice-unpost.png
similarity index 100%
rename from libgnucash/pixmaps/hicolor/16x16/actions/gnc-invoice-unpost.png
rename to data/pixmaps/hicolor/16x16/actions/gnc-invoice-unpost.png
diff --git a/libgnucash/pixmaps/hicolor/16x16/actions/gnc-invoice.png b/data/pixmaps/hicolor/16x16/actions/gnc-invoice.png
similarity index 100%
rename from libgnucash/pixmaps/hicolor/16x16/actions/gnc-invoice.png
rename to data/pixmaps/hicolor/16x16/actions/gnc-invoice.png
diff --git a/libgnucash/pixmaps/hicolor/16x16/actions/gnc-jumpto.png b/data/pixmaps/hicolor/16x16/actions/gnc-jumpto.png
similarity index 100%
rename from libgnucash/pixmaps/hicolor/16x16/actions/gnc-jumpto.png
rename to data/pixmaps/hicolor/16x16/actions/gnc-jumpto.png
diff --git a/libgnucash/pixmaps/hicolor/16x16/actions/gnc-split-trans.png b/data/pixmaps/hicolor/16x16/actions/gnc-split-trans.png
similarity index 100%
rename from libgnucash/pixmaps/hicolor/16x16/actions/gnc-split-trans.png
rename to data/pixmaps/hicolor/16x16/actions/gnc-split-trans.png
diff --git a/libgnucash/pixmaps/hicolor/16x16/actions/gnc-sx-new.png b/data/pixmaps/hicolor/16x16/actions/gnc-sx-new.png
similarity index 100%
rename from libgnucash/pixmaps/hicolor/16x16/actions/gnc-sx-new.png
rename to data/pixmaps/hicolor/16x16/actions/gnc-sx-new.png
diff --git a/libgnucash/pixmaps/hicolor/16x16/actions/gnc-transfer.png b/data/pixmaps/hicolor/16x16/actions/gnc-transfer.png
similarity index 100%
rename from libgnucash/pixmaps/hicolor/16x16/actions/gnc-transfer.png
rename to data/pixmaps/hicolor/16x16/actions/gnc-transfer.png
diff --git a/libgnucash/pixmaps/hicolor/16x16/apps/gnucash-icon.png b/data/pixmaps/hicolor/16x16/apps/gnucash-icon.png
similarity index 100%
rename from libgnucash/pixmaps/hicolor/16x16/apps/gnucash-icon.png
rename to data/pixmaps/hicolor/16x16/apps/gnucash-icon.png
diff --git a/libgnucash/pixmaps/hicolor/22x22/apps/gnucash-icon.png b/data/pixmaps/hicolor/22x22/apps/gnucash-icon.png
similarity index 100%
rename from libgnucash/pixmaps/hicolor/22x22/apps/gnucash-icon.png
rename to data/pixmaps/hicolor/22x22/apps/gnucash-icon.png
diff --git a/libgnucash/pixmaps/hicolor/24x24/actions/gnc-account-delete.png b/data/pixmaps/hicolor/24x24/actions/gnc-account-delete.png
similarity index 100%
rename from libgnucash/pixmaps/hicolor/24x24/actions/gnc-account-delete.png
rename to data/pixmaps/hicolor/24x24/actions/gnc-account-delete.png
diff --git a/libgnucash/pixmaps/hicolor/24x24/actions/gnc-account-edit.png b/data/pixmaps/hicolor/24x24/actions/gnc-account-edit.png
similarity index 100%
rename from libgnucash/pixmaps/hicolor/24x24/actions/gnc-account-edit.png
rename to data/pixmaps/hicolor/24x24/actions/gnc-account-edit.png
diff --git a/libgnucash/pixmaps/hicolor/24x24/actions/gnc-account-new.png b/data/pixmaps/hicolor/24x24/actions/gnc-account-new.png
similarity index 100%
rename from libgnucash/pixmaps/hicolor/24x24/actions/gnc-account-new.png
rename to data/pixmaps/hicolor/24x24/actions/gnc-account-new.png
diff --git a/libgnucash/pixmaps/hicolor/24x24/actions/gnc-account-open.png b/data/pixmaps/hicolor/24x24/actions/gnc-account-open.png
similarity index 100%
rename from libgnucash/pixmaps/hicolor/24x24/actions/gnc-account-open.png
rename to data/pixmaps/hicolor/24x24/actions/gnc-account-open.png
diff --git a/libgnucash/pixmaps/hicolor/24x24/actions/gnc-account-report.png b/data/pixmaps/hicolor/24x24/actions/gnc-account-report.png
similarity index 100%
rename from libgnucash/pixmaps/hicolor/24x24/actions/gnc-account-report.png
rename to data/pixmaps/hicolor/24x24/actions/gnc-account-report.png
diff --git a/libgnucash/pixmaps/hicolor/24x24/actions/gnc-account.png b/data/pixmaps/hicolor/24x24/actions/gnc-account.png
similarity index 100%
rename from libgnucash/pixmaps/hicolor/24x24/actions/gnc-account.png
rename to data/pixmaps/hicolor/24x24/actions/gnc-account.png
diff --git a/libgnucash/pixmaps/hicolor/24x24/actions/gnc-gnome-pdf.png b/data/pixmaps/hicolor/24x24/actions/gnc-gnome-pdf.png
similarity index 100%
rename from libgnucash/pixmaps/hicolor/24x24/actions/gnc-gnome-pdf.png
rename to data/pixmaps/hicolor/24x24/actions/gnc-gnome-pdf.png
diff --git a/libgnucash/pixmaps/hicolor/24x24/actions/gnc-invoice-duplicate.png b/data/pixmaps/hicolor/24x24/actions/gnc-invoice-duplicate.png
similarity index 100%
rename from libgnucash/pixmaps/hicolor/24x24/actions/gnc-invoice-duplicate.png
rename to data/pixmaps/hicolor/24x24/actions/gnc-invoice-duplicate.png
diff --git a/libgnucash/pixmaps/hicolor/24x24/actions/gnc-invoice-edit.png b/data/pixmaps/hicolor/24x24/actions/gnc-invoice-edit.png
similarity index 100%
rename from libgnucash/pixmaps/hicolor/24x24/actions/gnc-invoice-edit.png
rename to data/pixmaps/hicolor/24x24/actions/gnc-invoice-edit.png
diff --git a/libgnucash/pixmaps/hicolor/24x24/actions/gnc-invoice-new.png b/data/pixmaps/hicolor/24x24/actions/gnc-invoice-new.png
similarity index 100%
rename from libgnucash/pixmaps/hicolor/24x24/actions/gnc-invoice-new.png
rename to data/pixmaps/hicolor/24x24/actions/gnc-invoice-new.png
diff --git a/libgnucash/pixmaps/hicolor/24x24/actions/gnc-invoice-pay.png b/data/pixmaps/hicolor/24x24/actions/gnc-invoice-pay.png
similarity index 100%
rename from libgnucash/pixmaps/hicolor/24x24/actions/gnc-invoice-pay.png
rename to data/pixmaps/hicolor/24x24/actions/gnc-invoice-pay.png
diff --git a/libgnucash/pixmaps/hicolor/24x24/actions/gnc-invoice-post.png b/data/pixmaps/hicolor/24x24/actions/gnc-invoice-post.png
similarity index 100%
rename from libgnucash/pixmaps/hicolor/24x24/actions/gnc-invoice-post.png
rename to data/pixmaps/hicolor/24x24/actions/gnc-invoice-post.png
diff --git a/libgnucash/pixmaps/hicolor/24x24/actions/gnc-invoice-unpost.png b/data/pixmaps/hicolor/24x24/actions/gnc-invoice-unpost.png
similarity index 100%
rename from libgnucash/pixmaps/hicolor/24x24/actions/gnc-invoice-unpost.png
rename to data/pixmaps/hicolor/24x24/actions/gnc-invoice-unpost.png
diff --git a/libgnucash/pixmaps/hicolor/24x24/actions/gnc-invoice.png b/data/pixmaps/hicolor/24x24/actions/gnc-invoice.png
similarity index 100%
rename from libgnucash/pixmaps/hicolor/24x24/actions/gnc-invoice.png
rename to data/pixmaps/hicolor/24x24/actions/gnc-invoice.png
diff --git a/libgnucash/pixmaps/hicolor/24x24/actions/gnc-jumpto.png b/data/pixmaps/hicolor/24x24/actions/gnc-jumpto.png
similarity index 100%
rename from libgnucash/pixmaps/hicolor/24x24/actions/gnc-jumpto.png
rename to data/pixmaps/hicolor/24x24/actions/gnc-jumpto.png
diff --git a/libgnucash/pixmaps/hicolor/24x24/actions/gnc-split-trans.png b/data/pixmaps/hicolor/24x24/actions/gnc-split-trans.png
similarity index 100%
rename from libgnucash/pixmaps/hicolor/24x24/actions/gnc-split-trans.png
rename to data/pixmaps/hicolor/24x24/actions/gnc-split-trans.png
diff --git a/libgnucash/pixmaps/hicolor/24x24/actions/gnc-sx-new.png b/data/pixmaps/hicolor/24x24/actions/gnc-sx-new.png
similarity index 100%
rename from libgnucash/pixmaps/hicolor/24x24/actions/gnc-sx-new.png
rename to data/pixmaps/hicolor/24x24/actions/gnc-sx-new.png
diff --git a/libgnucash/pixmaps/hicolor/24x24/actions/gnc-transfer.png b/data/pixmaps/hicolor/24x24/actions/gnc-transfer.png
similarity index 100%
rename from libgnucash/pixmaps/hicolor/24x24/actions/gnc-transfer.png
rename to data/pixmaps/hicolor/24x24/actions/gnc-transfer.png
diff --git a/libgnucash/pixmaps/hicolor/24x24/apps/gnucash-icon.png b/data/pixmaps/hicolor/24x24/apps/gnucash-icon.png
similarity index 100%
rename from libgnucash/pixmaps/hicolor/24x24/apps/gnucash-icon.png
rename to data/pixmaps/hicolor/24x24/apps/gnucash-icon.png
diff --git a/libgnucash/pixmaps/hicolor/256x256/apps/gnucash-icon.png b/data/pixmaps/hicolor/256x256/apps/gnucash-icon.png
similarity index 100%
rename from libgnucash/pixmaps/hicolor/256x256/apps/gnucash-icon.png
rename to data/pixmaps/hicolor/256x256/apps/gnucash-icon.png
diff --git a/libgnucash/pixmaps/hicolor/32x32/apps/gnucash-icon.png b/data/pixmaps/hicolor/32x32/apps/gnucash-icon.png
similarity index 100%
rename from libgnucash/pixmaps/hicolor/32x32/apps/gnucash-icon.png
rename to data/pixmaps/hicolor/32x32/apps/gnucash-icon.png
diff --git a/libgnucash/pixmaps/hicolor/48x48/apps/gnucash-icon.png b/data/pixmaps/hicolor/48x48/apps/gnucash-icon.png
similarity index 100%
rename from libgnucash/pixmaps/hicolor/48x48/apps/gnucash-icon.png
rename to data/pixmaps/hicolor/48x48/apps/gnucash-icon.png
diff --git a/libgnucash/pixmaps/hicolor/64x64/apps/gnucash-icon.png b/data/pixmaps/hicolor/64x64/apps/gnucash-icon.png
similarity index 100%
rename from libgnucash/pixmaps/hicolor/64x64/apps/gnucash-icon.png
rename to data/pixmaps/hicolor/64x64/apps/gnucash-icon.png
diff --git a/libgnucash/pixmaps/hicolor/96x96/apps/gnucash-icon.png b/data/pixmaps/hicolor/96x96/apps/gnucash-icon.png
similarity index 100%
rename from libgnucash/pixmaps/hicolor/96x96/apps/gnucash-icon.png
rename to data/pixmaps/hicolor/96x96/apps/gnucash-icon.png
diff --git a/libgnucash/pixmaps/hicolor/scalable/apps/gnucash-icon.svg b/data/pixmaps/hicolor/scalable/apps/gnucash-icon.svg
similarity index 100%
rename from libgnucash/pixmaps/hicolor/scalable/apps/gnucash-icon.svg
rename to data/pixmaps/hicolor/scalable/apps/gnucash-icon.svg
diff --git a/gnucash/bin/Makefile.am b/gnucash/bin/Makefile.am
index 5bbbbed..922e292 100644
--- a/gnucash/bin/Makefile.am
+++ b/gnucash/bin/Makefile.am
@@ -34,7 +34,7 @@ GNUCASH_RESOURCE_FILE = gnucash.rc
 dist_noinst_DATA = gnucash.rc
 
 .rc.o:
-	$(AM_V_GEN)$(RC) -I${top_srcdir}/libgnucash/pixmaps -i '$<' --input-format=rc -o '$@' -O coff
+	$(AM_V_GEN)$(RC) -I${top_srcdir}/data/pixmaps -i '$<' --input-format=rc -o '$@' -O coff
 
 else !PLATFORM_WIN32
 # All other platforms use these settings:
diff --git a/libgnucash/CMakeLists.txt b/libgnucash/CMakeLists.txt
index cd3206e..f034342 100644
--- a/libgnucash/CMakeLists.txt
+++ b/libgnucash/CMakeLists.txt
@@ -7,7 +7,6 @@ ADD_SUBDIRECTORY (core-utils)
 ADD_SUBDIRECTORY (doc)
 ADD_SUBDIRECTORY (engine)
 ADD_SUBDIRECTORY (gnc-module)
-ADD_SUBDIRECTORY (pixmaps)
 ADD_SUBDIRECTORY (quotes)
 ADD_SUBDIRECTORY (scm)
 ADD_SUBDIRECTORY (tax)
@@ -18,4 +17,4 @@ SET_LOCAL_DIST(libgnucash_DIST_local CMakeLists.txt Makefile.am ${libgnucash_EXT
 
 SET(libgnucash_DIST ${libgnucash_DIST_local} ${app_utils_DIST} ${backend_DIST}
              ${core_utils_DIST} ${doc_DIST} ${engine_DIST} ${gnc_module_DIST}
-             ${pixmaps_DIST} ${quotes_DIST} ${scm_DIST} ${tax_DIST} PARENT_SCOPE)
+             ${quotes_DIST} ${scm_DIST} ${tax_DIST} PARENT_SCOPE)
diff --git a/libgnucash/Makefile.am b/libgnucash/Makefile.am
index dc9681c..3b222b6 100644
--- a/libgnucash/Makefile.am
+++ b/libgnucash/Makefile.am
@@ -6,7 +6,6 @@
 # As we intend to move to cmake it's not worth fixing this any more.
 SUBDIRS = \
   doc \
-  pixmaps \
   core-utils \
   gnc-module \
   engine \
diff --git a/libgnucash/backend/xml/test/CMakeLists.txt b/libgnucash/backend/xml/test/CMakeLists.txt
index fc3d94a..342cb21 100644
--- a/libgnucash/backend/xml/test/CMakeLists.txt
+++ b/libgnucash/backend/xml/test/CMakeLists.txt
@@ -85,7 +85,7 @@ ADD_XML_TEST(test-load-xml2 test-load-xml2.cpp
 GNC_ADD_TEST_WITH_GUILE(test-load-example-account
   "${test_backend_xml_module_SOURCES};test-load-example-account.cpp"
   XML_TEST_INCLUDE_DIRS XML_TEST_LIBS
-  GNC_ACCOUNT_PATH=${CMAKE_SOURCE_DIR}/accounts/C
+  GNC_ACCOUNT_PATH=${CMAKE_SOURCE_DIR}/data/accounts/C
 )
 TARGET_COMPILE_OPTIONS(test-load-example-account PRIVATE -DU_SHOW_CPLUSPLUS_API=0)
 ADD_XML_TEST(test-string-converters "${test_backend_xml_base_SOURCES};test-string-converters.cpp")
diff --git a/libgnucash/backend/xml/test/Makefile.am b/libgnucash/backend/xml/test/Makefile.am
index fc3fe18..fd220718 100644
--- a/libgnucash/backend/xml/test/Makefile.am
+++ b/libgnucash/backend/xml/test/Makefile.am
@@ -219,7 +219,7 @@ GNC_TEST_DEPS = \
 
 TESTS_ENVIRONMENT = \
   GUILE_WARN_DEPRECATED=no \
-  GNC_ACCOUNT_PATH=${top_srcdir}/accounts/C \
+  GNC_ACCOUNT_PATH=${top_srcdir}/data/accounts/C \
   GNC_TEST_FILES=test-files/xml2 \
   SRCDIR=${srcdir} \
   GNC_BUILDDIR="${abs_top_builddir}" \

commit 83d14e1c1cb7bc9dd3feec4f295ae151962d7ec7
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Thu Aug 10 13:56:00 2017 +0200

    Restructure the src directory
    
    It is split into
    - /libgnucash (for the non-gui bits)
    - /gnucash (for the gui)
    - /common (misc source files used by both)
    - /bindings (currently only holds python bindings)
    
    This is the first step in restructuring the code. It will need much
    more fine tuning later on.

diff --git a/CMakeLists.txt b/CMakeLists.txt
index db01fcd..ffad3d1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -34,7 +34,7 @@ SET (GNUCASH_RESAVE_VERSION "19920")
 SET(GETTEXT_PACKAGE "gnucash")
 
 # Extra cmake macros
-SET (CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/src/cmake_modules;${CMAKE_MODULE_PATH}")
+SET (CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/common/cmake_modules;${CMAKE_MODULE_PATH}")
 # CMake does a non-recursive build that puts the final build product directories in the build root. Some code needs to know this.
 
 INCLUDE (MacroAppendForeach)
@@ -161,7 +161,7 @@ ENDIF(WIN32)
 FIND_PACKAGE(PkgConfig REQUIRED)
 
 # The default FindPkgConfig.make code has a bug in how the setting of PKG_CONFIG_PATH is handled.
-# The src/cmake_modules/GncFindPkgConfig.cmake file overrides a couple of macros in FindPkgConfig to fix.
+# The common/cmake_modules/GncFindPkgConfig.cmake file overrides a couple of macros in FindPkgConfig to fix.
 
 INCLUDE (GncFindPkgConfig)
 
@@ -556,16 +556,16 @@ INSTALL(FILES ${gnucash_DOCS} DESTINATION share/doc/gnucash)
 SET (GETTEXT_PACKAGE "gnucash")
 
 IF (WIN32)
-  IF (MINGW)
-    SET (HAVE_SCANF_LLD 1)
-  ELSE ()
-    SET (HAVE_SCANF_I64D 1)
-  ENDIF ()
-  SET (HAVE_HTMLHELPW 1)
+IF (MINGW)
+SET (HAVE_SCANF_LLD 1)
+ELSE ()
+SET (HAVE_SCANF_I64D 1)
+ENDIF ()
+SET (HAVE_HTMLHELPW 1)
 ENDIF (WIN32)
 
 IF (NOT WIN32)
-  CHECK_INCLUDE_FILES (X11/Xlib.h HAVE_X11_XLIB_H)
+CHECK_INCLUDE_FILES (X11/Xlib.h HAVE_X11_XLIB_H)
 ENDIF (NOT WIN32)
 
 CHECK_INCLUDE_FILES (dirent.h HAVE_DIRENT_H)
@@ -589,99 +589,92 @@ CHECK_INCLUDE_FILES (utmp.h HAVE_UTMP_H)
 CHECK_INCLUDE_FILES (wctype.h HAVE_WCTYPE_H)
 
 IF (NOT DISABLE_NLS)
-  SET(ENABLE_NLS 1)
+SET(ENABLE_NLS 1)
 ENDIF(NOT DISABLE_NLS)
 
 IF (ENABLE_BINRELOC)
-  IF (UNIX OR MINGW)
-    SET(BR_PTHREAD 1)
-  ENDIF(UNIX OR MINGW)
+IF (UNIX OR MINGW)
+SET(BR_PTHREAD 1)
+ENDIF(UNIX OR MINGW)
 ENDIF(ENABLE_BINRELOC)
 
 IF (UNIX OR MINGW)
-  SET (HAVE_BIND_TEXTDOMAIN_CODESET 1)
-  SET (HAVE_DCGETTEXT 1)
-  SET (HAVE_GETTEXT 1)
-  SET (HAVE_GETTIMEOFDAY 1)
-  SET (HAVE_GUILE 1)
-  SET (HAVE_LIBM 1)
-  SET (HAVE_MEMCPY 1)
-  SET (STDC_HEADERS 1)
-  SET (_ALL_SOURCE 1)
-  SET (_GNU_SOURCE 1)
-  SET (_POSIX_PTHREAD_SEMANTICS 1)
-  SET (_TANDEM_SOURCE 1)
-  SET (__EXTENSIONS__ 1)
+SET (HAVE_BIND_TEXTDOMAIN_CODESET 1)
+SET (HAVE_DCGETTEXT 1)
+SET (HAVE_GETTEXT 1)
+SET (HAVE_GETTIMEOFDAY 1)
+SET (HAVE_GUILE 1)
+SET (HAVE_LIBM 1)
+SET (HAVE_MEMCPY 1)
+SET (STDC_HEADERS 1)
+SET (_ALL_SOURCE 1)
+SET (_GNU_SOURCE 1)
+SET (_POSIX_PTHREAD_SEMANTICS 1)
+SET (_TANDEM_SOURCE 1)
+SET (__EXTENSIONS__ 1)
 ENDIF (UNIX OR MINGW)
 
 IF (UNIX)
-  SET (HAVE_CHOWN 1)
-  SET (HAVE_DLERROR 1)
-  SET (HAVE_DLSYM 1)
-  SET (HAVE_GETHOSTID 1)
-  SET (HAVE_GETHOSTNAME 1)
-  SET (HAVE_GETPPID 1)
-  SET (HAVE_GETUID 1)
-  SET (HAVE_GMTIME_R 1)
-  SET (HAVE_LANGINFO_D_FMT 1)
-  SET (HAVE_LC_MESSAGES 1)
-  SET (HAVE_LIBPTHREAD 1)
-  SET (HAVE_LINK 1)
-  SET (HAVE_LOCALTIME_R 1)
-  SET (HAVE_PTHREAD_MUTEX_INIT 1)
-  SET (HAVE_PTHREAD_PRIO_INHERIT 1)
-  SET (HAVE_SCANF_LLD 1)
-  SET (HAVE_SETENV 1)
-  SET (HAVE_STPCPY 1)
-  SET (HAVE_STRFMON 1)
-  SET (HAVE_STRPTIME 1)
-  SET (HAVE_STRUCT_TM_GMTOFF 1)
-  SET (HAVE_TIMEGM 1)
-  SET (HAVE_TOWUPPER 1)
-  SET (GNC_PLATFORM_POSIX 1)
+SET (HAVE_CHOWN 1)
+SET (HAVE_DLERROR 1)
+SET (HAVE_DLSYM 1)
+SET (HAVE_GETHOSTID 1)
+SET (HAVE_GETHOSTNAME 1)
+SET (HAVE_GETPPID 1)
+SET (HAVE_GETUID 1)
+SET (HAVE_GMTIME_R 1)
+SET (HAVE_LANGINFO_D_FMT 1)
+SET (HAVE_LC_MESSAGES 1)
+SET (HAVE_LIBPTHREAD 1)
+SET (HAVE_LINK 1)
+SET (HAVE_LOCALTIME_R 1)
+SET (HAVE_PTHREAD_MUTEX_INIT 1)
+SET (HAVE_PTHREAD_PRIO_INHERIT 1)
+SET (HAVE_SCANF_LLD 1)
+SET (HAVE_SETENV 1)
+SET (HAVE_STPCPY 1)
+SET (HAVE_STRFMON 1)
+SET (HAVE_STRPTIME 1)
+SET (HAVE_STRUCT_TM_GMTOFF 1)
+SET (HAVE_TIMEGM 1)
+SET (HAVE_TOWUPPER 1)
+SET (GNC_PLATFORM_POSIX 1)
 ENDIF (UNIX)
 
 IF (WIN32)
-  SET (GNC_PLATFORM_WINDOWS 1)
+SET (GNC_PLATFORM_WINDOWS 1)
 ENDIF (WIN32)
 
 IF (APPLE)
 # FIXME: HANDLE gtk-mac-integration-gtk2
-  SET(GNC_PLATFORM_DARWIN 1)
-  SET(GNC_PLATFORM_OSX 1)
-  SET(PLATFORM_OSX 1)
-  SET(HAVE_OSX_KEYCHAIN 1)
+SET(GNC_PLATFORM_DARWIN 1)
+SET(GNC_PLATFORM_OSX 1)
+SET(PLATFORM_OSX 1)
+SET(HAVE_OSX_KEYCHAIN 1)
 ENDIF(APPLE)
 
 IF(GLIB2_VERSION VERSION_GREATER 2.46.0 OR GLIB2_VERSION VERSION_EQUAL 2.46.0)
-  SET(HAVE_GLIB_2_46 1)
+SET(HAVE_GLIB_2_46 1)
 ENDIF()
 
 IF(DISABLE_DEPRECATED_GNOME)
-  SET(GNOME_DISABLE_DEPRECATED 1)
+SET(GNOME_DISABLE_DEPRECATED 1)
 ENDIF(DISABLE_DEPRECATED_GNOME)
 
 IF(DISABLE_DEPRECATED_GTK)
-  SET(GTK_DISABLE_DEPRECATED 1)
-  SET(GDK_DISABLE_DEPRECATED 1)
-  SET(GDK_PIXMAP_DISABLE_DEPRECATED 1)
+SET(GTK_DISABLE_DEPRECATED 1)
+SET(GDK_DISABLE_DEPRECATED 1)
+SET(GDK_PIXMAP_DISABLE_DEPRECATED 1)
 ENDIF(DISABLE_DEPRECATED_GTK)
 
 IF(DISABLE_DEPRECATED_GLIB)
-  SET(G_DISABLE_DEPRECATED 1)
+SET(G_DISABLE_DEPRECATED 1)
 ENDIF(DISABLE_DEPRECATED_GLIB)
 
 ADD_DEFINITIONS (-DHAVE_CONFIG_H)
 
-SET (CONFIG_H ${CMAKE_CURRENT_BINARY_DIR}/src/config.h)
-CONFIGURE_FILE (${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.cmake.in ${CONFIG_H})
-
-IF (BUILDING_FROM_VCS)
-  SET (SWIG_RUNTIME_H ${CMAKE_CURRENT_BINARY_DIR}/src/swig-runtime.h)
-ELSE()
-  SET (SWIG_RUNTIME_H ${CMAKE_CURRENT_SOURCE_DIR}/src/swig-runtime.h)
-ENDIF()
-
+SET (CONFIG_H ${CMAKE_CURRENT_BINARY_DIR}/common/config.h)
+CONFIGURE_FILE (${CMAKE_CURRENT_SOURCE_DIR}/common/config.h.cmake.in ${CONFIG_H})
 
 SET(SCHEME_INSTALLED_SOURCE_DIR ${CMAKE_INSTALL_PREFIX}/share/gnucash/scm)
 SET(SCHEME_INSTALLED_CACHE_DIR ${CMAKE_INSTALL_PREFIX}/lib/gnucash/scm/ccache/${GUILE_EFFECTIVE_VERSION})
@@ -694,7 +687,12 @@ ADD_SUBDIRECTORY (lib)
 ADD_SUBDIRECTORY (macros)
 ADD_SUBDIRECTORY (packaging)
 ADD_SUBDIRECTORY (po)
-ADD_SUBDIRECTORY (src)
+ADD_SUBDIRECTORY (common)
+ADD_SUBDIRECTORY (libgnucash)
+IF (WITH_GNUCASH)
+  ADD_SUBDIRECTORY (gnucash)
+ENDIF (WITH_GNUCASH)
+ADD_SUBDIRECTORY (bindings)
 ADD_SUBDIRECTORY (test-templates)
 ADD_SUBDIRECTORY (util)
 
@@ -709,26 +707,27 @@ ADD_SUBDIRECTORY(cmake)
 SET(PACKAGE_PREFIX "${PACKAGE}-${PACKAGE_VERSION}")
 SET(DIST_FILE "${PACKAGE_PREFIX}.tar")
 
-SET(gnucash_DIST_local ${gnucash_DOCS} ChangeLog.2015 ChangeLog.2016
+SET(toplvl_DIST_local ${gnucash_DOCS} ChangeLog.2015 ChangeLog.2016
   CMakeLists.txt configure.ac Makefile.am make-gnucash-potfiles.in README)
 
 IF(BUILDING_FROM_VCS AND AUTOTOOLS_IN_DIST)
-  SET(gnucash_DIST_local ${gnucash_DIST_local} autogen.sh)
+  SET(toplvl_DIST_local ${toplvl_DIST_local} autogen.sh)
 ENDIF()
 
-SET_LOCAL_DIST(gnucash_DIST ${gnucash_DIST_local})
+SET_LOCAL_DIST(toplvl_DIST ${toplvl_DIST_local})
 
 # Each subdirectory is responsible for reporting its list of distribution files to its parent, up to here.
 #
 # Leaf directories use the SET_DIST_LIST() function to report their distribution files. See
-# the bottom of src/app-utils/test/CMakeLists.txt for an example.
+# the bottom of libgnucash/app-utils/test/CMakeLists.txt for an example.
 #
 # A non leaf directories uses the SET_LOCAL_DIST() function to specify its distribution files local that dir,
 # then uses a (SET ${foo_DIST} ${locals....} PARENT_SCOPE) command to report up. See the bottom of
-# src/app-utils/CMakeLists.txt for an example of this.
+# libgnucash/app-utils/CMakeLists.txt for an example of this.
 
-SET(ALL_DIST ${accounts_DIST} ${checks_DIST} ${cmake_DIST} ${doc_DIST} ${lib_DIST} ${macros_DIST} ${packaging_DIST}
-        ${po_DIST} ${src_DIST} ${gnucash_DIST} ${test_templates_DIST} ${util_DIST})
+SET(ALL_DIST ${accounts_DIST} ${bindings_DIST} ${checks_DIST} ${cmake_DIST} ${common_DIST}
+    ${doc_DIST} ${gnucash_DIST} ${lib_DIST} ${libgnucash_DIST} ${macros_DIST} ${packaging_DIST}
+    ${po_DIST} ${test_templates_DIST} ${toplvl_DIST} ${util_DIST})
 
 
 IF (BUILDING_FROM_VCS)
@@ -738,7 +737,7 @@ ELSE()
   IF(AUTOTOOLS_IN_DIST)
     # Include autotools generated file in the dist
     LIST(APPEND ALL_DIST compile config.guess config.sub configure depcomp install-sh missing
-            src/doc/design/mdate-sh src/doc/design/texinfo.tex)
+            libgnucash/doc/design/mdate-sh libgnucash/doc/design/texinfo.tex)
     IF (EXISTS ${CMAKE_SOURCE_DIR}/test-driver)  # test-driver only created for automake 1.12+.
       LIST(APPEND ALL_DIST test-driver)
     ENDIF()
@@ -757,14 +756,14 @@ ENDFOREACH()
 
 ADD_CUSTOM_COMMAND(OUTPUT ${DIST_FILE}.gz ${DIST_FILE}.bz2
         COMMAND ${CMAKE_COMMAND}
-           -D CMAKE_MODULE_PATH=${CMAKE_SOURCE_DIR}/src/cmake_modules
+           -D CMAKE_MODULE_PATH=${CMAKE_SOURCE_DIR}/common/cmake_modules
            -D PACKAGE_PREFIX=${PACKAGE_PREFIX}
            -D GNUCASH_SOURCE_DIR=${CMAKE_SOURCE_DIR}
            -D BUILD_SOURCE_DIR=${BUILD_SOURCE_DIR}
            -D BUILDING_FROM_VCS=${BUILDING_FROM_VCS}
            -D SHELL=${SHELL}
            -D AUTOTOOLS_IN_DIST=${AUTOTOOLS_IN_DIST}
-           -P ${CMAKE_SOURCE_DIR}/src/cmake_modules/MakeDist.cmake
+           -P ${CMAKE_SOURCE_DIR}/common/cmake_modules/MakeDist.cmake
 
         DEPENDS
           ${ALL_DIST} ${DIST_GENERATED_FILES2} gnc-vcs-info iso-4217-c gnc-warnings-c build-config-scm gnucash-design-info ChangeLog
@@ -774,13 +773,13 @@ ADD_CUSTOM_TARGET(dist DEPENDS ${DIST_FILE}.gz ${DIST_FILE}.bz2)
 
 ADD_CUSTOM_TARGET(distcheck DEPENDS dist
         COMMAND ${CMAKE_COMMAND}
-            -D CMAKE_MODULE_PATH=${CMAKE_SOURCE_DIR}/src/cmake_modules
+            -D CMAKE_MODULE_PATH=${CMAKE_SOURCE_DIR}/common/cmake_modules
             -D CMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}
             -D PACKAGE_PREFIX=${PACKAGE_PREFIX}
             -D CMAKE_C_FLAGS=${CMAKE_C_FLAGS}
             -D CMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
             -D AUTOTOOLS_IN_DIST=${AUTOTOOLS_IN_DIST}
-            -P ${CMAKE_SOURCE_DIR}/src/cmake_modules/MakeDistCheck.cmake
+            -P ${CMAKE_SOURCE_DIR}/common/cmake_modules/MakeDistCheck.cmake
         )
 
 
diff --git a/Makefile.am b/Makefile.am
index cd3e8f5..5fa7dba 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,5 +1,9 @@
-
-SUBDIRS = . doc lib src packaging po accounts checks
+if GNUCASH_ENABLE_GUI
+  GNUCASH_SUBDIR = gnucash
+else
+  GNUCASH_SUBDIR =
+endif
+SUBDIRS = . doc lib common libgnucash bindings ${GNUCASH_SUBDIR} packaging po accounts checks
 
 GNC_CTAGS_FILE = @GNC_CTAGS_FILE@
 GNC_ETAGS_FILE = @GNC_ETAGS_FILE@
@@ -125,9 +129,9 @@ DISTCLEANFILES = \
   make-gnucash-potfiles po/.intltool-merge-cache
 
 cscope.files:
-	find src lib -name '*.[ch]' > cscope.files
+	find bindings common libgnucash gnucash lib -name '*.[ch]' > cscope.files
 if GNUCASH_SEPARATE_BUILDDIR
-	find ${srcdir}/src ${srcdir}/lib -name '*.[ch]' >> cscope.files
+	find ${srcdir}/bindings ${srcdir}/common ${srcdir}/libgnucash ${srcdir}/gnucash ${srcdir}/lib -name '*.[ch]' >> cscope.files
 endif
 
 ${srcdir}/cscope.out: cscope.files
@@ -243,10 +247,10 @@ endif
 ASTYLE = /usr/bin/astyle
 .PHONY: indent
 indent:
-	$(ASTYLE) --indent=spaces=4 --brackets=break --suffix=none `find ${srcdir}/src -name '*.[hc]'`
+	$(ASTYLE) --indent=spaces=4 --brackets=break --suffix=none `find ${srcdir}/{bindings,common,libgnucash,gnucash} -name '*.[hc]'`
 # Use the following line if you've got astyle-1.24, but don't use
 # --pad=oper with astyle 1.22 as it will reformat e.g. "return +1;" in
 # a very ugly way.
-#	$(ASTYLE) --indent=spaces=4 --brackets=break --pad-oper -pad-header --suffix=none `find ${srcdir}/src -name '*.[hc]'`
+#	$(ASTYLE) --indent=spaces=4 --brackets=break --pad-oper -pad-header --suffix=none `find ${srcdir}/{bindings,common,libgnucash,gnucash} -name '*.[hc]'`
 	@echo "### GnuCash development hint: The above command might have re-indented much more files than what you intended. Please commit only those which you really want to have changed, and revert the changes in the others so that other devevelopers do not have unnecessary merge conflicts. Thanks! ###"
 
diff --git a/bindings/CMakeLists.txt b/bindings/CMakeLists.txt
new file mode 100644
index 0000000..f34b2da
--- /dev/null
+++ b/bindings/CMakeLists.txt
@@ -0,0 +1,4 @@
+ADD_SUBDIRECTORY(python)
+
+SET_LOCAL_DIST(bindings_DIST_local CMakeLists.txt Makefile.am)
+SET(bindings_DIST ${bindings_DIST_local} ${python_bindings_DIST} PARENT_SCOPE)
diff --git a/bindings/Makefile.am b/bindings/Makefile.am
new file mode 100644
index 0000000..bfe93cb
--- /dev/null
+++ b/bindings/Makefile.am
@@ -0,0 +1,6 @@
+if WITH_PYTHON
+    PYTHON_DIR = python
+endif
+SUBDIRS = ${PYTHON_DIR}
+
+EXTRA_DIST = CMakeLists.txt
diff --git a/bindings/python/CMakeLists.txt b/bindings/python/CMakeLists.txt
new file mode 100644
index 0000000..294748f
--- /dev/null
+++ b/bindings/python/CMakeLists.txt
@@ -0,0 +1,118 @@
+ADD_SUBDIRECTORY(example_scripts)
+ADD_SUBDIRECTORY(tests)
+
+IF (BUILDING_FROM_VCS)
+  SET(SWIG_FILES ${CMAKE_CURRENT_SOURCE_DIR}/gnucash_core.i ${CMAKE_CURRENT_SOURCE_DIR}/timespec.i)
+  SET(GNUCASH_CORE_C_INCLUDES
+    ${CONFIG_H}
+    ${CMAKE_SOURCE_DIR}/libgnucash/engine/qofsession.h
+    ${CMAKE_SOURCE_DIR}/libgnucash/engine/qofbook.h
+    ${CMAKE_SOURCE_DIR}/libgnucash/engine/qofbackend.h
+    ${CMAKE_SOURCE_DIR}/libgnucash/engine/qoflog.h
+    ${CMAKE_SOURCE_DIR}/libgnucash/engine/qofutil.h
+    ${CMAKE_SOURCE_DIR}/libgnucash/engine/qofid.h
+    ${CMAKE_SOURCE_DIR}/libgnucash/engine/guid.h
+    ${CMAKE_SOURCE_DIR}/libgnucash/gnc-module/gnc-module.h
+    ${CMAKE_SOURCE_DIR}/libgnucash/engine/gnc-engine.h
+    ${CMAKE_SOURCE_DIR}/libgnucash/engine/Transaction.h
+    ${CMAKE_SOURCE_DIR}/libgnucash/engine/Split.h
+    ${CMAKE_SOURCE_DIR}/libgnucash/engine/Account.h
+    ${CMAKE_SOURCE_DIR}/libgnucash/engine/gnc-commodity.h
+    ${CMAKE_SOURCE_DIR}/libgnucash/engine/gnc-lot.h
+    ${CMAKE_SOURCE_DIR}/libgnucash/engine/gnc-numeric.h
+    ${CMAKE_SOURCE_DIR}/libgnucash/engine/gncCustomer.h
+    ${CMAKE_SOURCE_DIR}/libgnucash/engine/gncEmployee.h
+    ${CMAKE_SOURCE_DIR}/libgnucash/engine/gncVendor.h
+    ${CMAKE_SOURCE_DIR}/libgnucash/engine/gncAddress.h
+    ${CMAKE_SOURCE_DIR}/libgnucash/engine/gncBillTerm.h
+    ${CMAKE_SOURCE_DIR}/libgnucash/engine/gncOwner.h
+    ${CMAKE_SOURCE_DIR}/libgnucash/engine/gncInvoice.h
+    ${CMAKE_SOURCE_DIR}/libgnucash/engine/gncJob.h
+    ${CMAKE_SOURCE_DIR}/libgnucash/engine/gncEntry.h
+    ${CMAKE_SOURCE_DIR}/libgnucash/engine/gncTaxTable.h
+    ${CMAKE_SOURCE_DIR}/libgnucash/engine/gncIDSearch.h
+    ${CMAKE_SOURCE_DIR}/libgnucash/engine/gnc-pricedb.h
+    ${CMAKE_SOURCE_DIR}/libgnucash/app-utils/gnc-prefs-utils.h
+  )
+
+  SET (SWIG_GNUCASH_CORE_C ${CMAKE_CURRENT_BINARY_DIR}/gnucash_core.c)
+
+  GNC_ADD_SWIG_PYTHON_COMMAND (swig-gnucash-core ${SWIG_GNUCASH_CORE_C}
+    ${SWIG_FILES}
+    ${CMAKE_SOURCE_DIR}/common/base-typemaps.i
+    ${CMAKE_SOURCE_DIR}/libgnucash/engine/engine-common.i
+    ${GNUCASH_CORE_C_INCLUDES}
+  )
+ELSE()
+  SET (SWIG_GNUCASH_CORE_C gnucash_core.c)
+ENDIF()
+
+IF(WITH_PYTHON)
+
+  SET(gnucash_core_c_INCLUDE_DIRS
+    ${CMAKE_SOURCE_DIR}/libgnucash
+    ${CMAKE_SOURCE_DIR}/libgnucash/engine
+    ${CMAKE_SOURCE_DIR}/gnucash/gnome-utils
+    ${CMAKE_SOURCE_DIR}/libgnucash/app-utils
+    ${CMAKE_SOURCE_DIR}/libgnucash/gnc-module
+    ${CMAKE_SOURCE_DIR}/gnucash/gnome
+    ${CMAKE_SOURCE_DIR}/libgnucash/core-utils
+    ${CMAKE_SOURCE_DIR}/libgnucash/gnc-module
+    ${GLIB_INCLUDE_DIRS}
+    ${PYTHON_INCLUDE_DIRS}
+  )
+
+  ADD_LIBRARY(gnucash_core_c MODULE ${SWIG_GNUCASH_CORE_C})
+  TARGET_INCLUDE_DIRECTORIES(gnucash_core_c PRIVATE ${gnucash_core_c_INCLUDE_DIRS})
+
+  TARGET_LINK_LIBRARIES(gnucash_core_c gncmod-app-utils gncmod-engine gnc-module ${GLIB_LIBS} ${PYTHON_LIBRARIES})
+  SET_TARGET_PROPERTIES(gnucash_core_c PROPERTIES PREFIX "_")
+  TARGET_COMPILE_OPTIONS(gnucash_core_c PRIVATE -Wno-implicit -Wno-missing-prototypes -Wno-declaration-after-statement -Wno-missing-declarations)
+
+  ADD_EXECUTABLE(sqlite3test EXCLUDE_FROM_ALL sqlite3test.c ${SWIG_GNUCASH_CORE_C})
+  TARGET_LINK_LIBRARIES(sqlite3test gncmod-app-utils gncmod-engine gnc-module ${GLIB_LIBS} ${PYTHON_LIBRARIES})
+  TARGET_INCLUDE_DIRECTORIES(sqlite3test PRIVATE ${gnucash_core_c_INCLUDE_DIRS})
+  TARGET_COMPILE_OPTIONS(sqlite3test PRIVATE -Wno-implicit -Wno-missing-prototypes -Wno-declaration-after-statement -Wno-missing-declarations)
+
+  ADD_TEST(NAME sqlite3test COMMAND sqlite3test)
+  ADD_DEPENDENCIES(check sqlite3test)
+
+
+  # Determine where to install the python libraries.
+  EXECUTE_PROCESS(
+    COMMAND ${PYTHON_EXECUTABLE} -c "import sysconfig; print sysconfig.get_path('platlib', vars = { 'platbase' : '${CMAKE_INSTALL_PREFIX}' }  )"
+    RESULT_VARIABLE PYTHON_SYSCONFIG_RESULT
+    OUTPUT_VARIABLE PYTHON_SYSCONFIG_OUTPUT
+    ERROR_VARIABLE PYTHON_SYSCONFIG_ERROR
+    OUTPUT_STRIP_TRAILING_WHITESPACE
+    ERROR_STRIP_TRAILING_WHITESPACE
+  )
+  IF (PYTHON_SYSCONFIG_RESULT)
+    MESSAGE(SEND_ERROR "Could not determine Python site-package directory:\n${PYTHON_SYSCONFIG_ERROR}")
+  ENDIF()
+
+  INSTALL(TARGETS gnucash_core_c
+    LIBRARY DESTINATION ${PYTHON_SYSCONFIG_OUTPUT}/gnucash
+    ARCHIVE DESTINATION ${PYTHON_SYSCONFIG_OUTPUT}/gnucash
+  )
+  INSTALL(FILES __init__.py function_class.py gnucash_business.py gnucash_core.py
+    ${CMAKE_CURRENT_BINARY_DIR}/gnucash_core_c.py
+    DESTINATION ${PYTHON_SYSCONFIG_OUTPUT}/gnucash
+  )
+
+ENDIF()
+
+SET(python_bindings_DATA
+        __init__.py
+        function_class.py
+        gnucash_business.py
+        gnucash_core.i
+        gnucash_core.py
+        sqlite3test.c
+        timespec.i)
+
+SET_LOCAL_DIST(python_bindings_DIST_local CMakeLists.txt Makefile.am ${python_bindings_DATA})
+
+SET(python_bindings_DIST ${python_bindings_DIST_local} ${test_python_bindings_DIST} ${example_scripts_DIST} PARENT_SCOPE)
+
+
diff --git a/bindings/python/Makefile.am b/bindings/python/Makefile.am
new file mode 100644
index 0000000..264c2cf
--- /dev/null
+++ b/bindings/python/Makefile.am
@@ -0,0 +1,137 @@
+SUBDIRS = . tests
+
+SWIG_FILES = gnucash_core.i timespec.i
+
+pkgpyexec_DATA = \
+  __init__.py \
+  function_class.py \
+  gnucash_core.py \
+  gnucash_core_c.py \
+  gnucash_business.py
+
+pkgpyexec_LTLIBRARIES = _gnucash_core_c.la
+
+_gnucash_core_c_la_SOURCES = \
+  gnucash_core.c
+
+_gnucash_core_c_la_CPPFLAGS = \
+  $(PYTHON_CPPFLAGS) \
+  $(GLIB_CFLAGS) \
+  -I$(top_srcdir)/common  \
+  -I$(top_srcdir)/libgnucash/engine \
+  -I${top_srcdir}/gnucash/gnome-utils \
+  -I${top_srcdir}/libgnucash/app-utils \
+  -I${top_srcdir}/libgnucash/gnc-module \
+  -I${top_srcdir}/gnucash/gnome \
+  -I${top_srcdir}/libgnucash/core-utils \
+  -I${top_srcdir}/libgnucash/gnc-module
+
+# Suppress all warnings for now, but we really only need to -Wno-implicit
+AM_CFLAGS = -w
+
+_gnucash_core_c_la_LDFLAGS = -avoid-version -module
+
+_gnucash_core_c_la_LIBADD = \
+  ${GLIB_LIBS} \
+  ${top_builddir}/libgnucash/gnc-module/libgnc-module.la \
+  ${top_builddir}/libgnucash/engine/libgncmod-engine.la \
+  ${top_builddir}/libgnucash/app-utils/libgncmod-app-utils.la
+if BUILDING_FROM_VCS
+_gnucash_core_c_includes= \
+	${top_builddir}/config.h \
+	${top_srcdir}/libgnucash/engine/qofsession.h \
+	${top_srcdir}/libgnucash/engine/qofbook.h \
+	${top_srcdir}/libgnucash/engine/qofbackend.h \
+	${top_srcdir}/libgnucash/engine/qoflog.h \
+	${top_srcdir}/libgnucash/engine/qofutil.h \
+	${top_srcdir}/libgnucash/engine/qofid.h \
+	${top_srcdir}/libgnucash/engine/guid.h \
+	${top_srcdir}/libgnucash/gnc-module/gnc-module.h \
+	${top_srcdir}/libgnucash/engine/gnc-engine.h \
+	${top_srcdir}/libgnucash/engine/Transaction.h \
+	${top_srcdir}/libgnucash/engine/Split.h \
+	${top_srcdir}/libgnucash/engine/Account.h \
+	${top_srcdir}/libgnucash/engine/gnc-commodity.h \
+	${top_srcdir}/libgnucash/engine/gnc-lot.h \
+	${top_srcdir}/libgnucash/engine/gnc-numeric.h \
+	${top_srcdir}/libgnucash/engine/gncCustomer.h \
+	${top_srcdir}/libgnucash/engine/gncEmployee.h \
+	${top_srcdir}/libgnucash/engine/gncVendor.h \
+	${top_srcdir}/libgnucash/engine/gncAddress.h \
+	${top_srcdir}/libgnucash/engine/gncBillTerm.h \
+	${top_srcdir}/libgnucash/engine/gncOwner.h \
+	${top_srcdir}/libgnucash/engine/gncInvoice.h \
+	${top_srcdir}/libgnucash/engine/gncJob.h \
+	${top_srcdir}/libgnucash/engine/gncEntry.h \
+	${top_srcdir}/libgnucash/engine/gncTaxTable.h \
+	${top_srcdir}/libgnucash/engine/gncIDSearch.h \
+	${top_srcdir}/libgnucash/engine/gnc-pricedb.h \
+	${top_srcdir}/libgnucash/app-utils/gnc-prefs-utils.h
+
+
+gnucash_core.c: $(SWIG_FILES) ${top_srcdir}/common/base-typemaps.i ${top_srcdir}/libgnucash/engine/engine-common.i $(_gnucash_core_c_includes)
+	$(SWIG) -python -Wall -Werror \
+	-I$(top_srcdir)/common -I$(top_srcdir)/libgnucash/engine \
+	-I$(top_srcdir)/libgnucash/app-utils -o $@ $<
+
+gnucash_core_c.py: gnucash_core.c $(SWIG_FILES)
+endif
+
+EXTRA_DIST = \
+  $(pkgpyexec_DATA) \
+  $(SWIG_FILES) \
+  example_scripts/Invoice.tex \
+  example_scripts/latex_invoices.py \
+  example_scripts/simple_book.py \
+  example_scripts/simple_session.py \
+  example_scripts/simple_test.py \
+  example_scripts/simple_business_create.py \
+  example_scripts/simple_invoice_insert.py \
+  example_scripts/simple_sqlite_create.py \
+  example_scripts/change_tax_code.py \
+  example_scripts/account_analysis.py \
+  example_scripts/new_book_with_opening_balances.py \
+  example_scripts/test_imbalance_transaction.py \
+  example_scripts/rest-api/gnucash_rest.py \
+  example_scripts/rest-api/gnucash_simple.py \
+  example_scripts/rest-api/README \
+  example_scripts/CMakeLists.txt \
+  CMakeLists.txt
+
+MAINTAINERCLEANFILES = gnucash_core.c
+
+
+check_PROGRAMS = sqlite3test
+sqlite3test_SOURCES = sqlite3test.c
+sqlite3test_LDADD = ${_gnucash_core_c_la_LIBADD}
+sqlite3test_CPPFLAGS = ${_gnucash_core_c_la_CPPFLAGS}
+
+PYTHON_LINK_FILES = \
+  $(pkgpyexec_DATA)
+
+.py-links:$(PYTHON_LINK_FILES)
+	$(RM) -rf gnucash
+	mkdir -p gnucash
+if GNUCASH_SEPARATE_BUILDDIR
+	for X in $(filter-out gnucash_core_c.py,${PYTHON_LINK_FILES}) ; do \
+	  $(LN_S) -f ${srcdir}/$$X . ; \
+	done
+endif
+	( cd gnucash; for file in $(PYTHON_LINK_FILES) ; do \
+	  $(LN_S) -f ../$$file .; \
+	  done )
+
+
+if ! OS_WIN32
+	touch .py-links
+endif
+
+noinst_DATA = .py-links
+
+CLEANFILES = $(BUILT_SOURCES) .py-links gnucash_core.c.py
+
+clean-local:
+	rm -rf gnucash
+
+uninstall-local:
+	rm -rf ${pkgpyexecdir}
diff --git a/src/optional/python-bindings/__init__.py b/bindings/python/__init__.py
similarity index 100%
rename from src/optional/python-bindings/__init__.py
rename to bindings/python/__init__.py
diff --git a/src/optional/python-bindings/example_scripts/CMakeLists.txt b/bindings/python/example_scripts/CMakeLists.txt
similarity index 100%
rename from src/optional/python-bindings/example_scripts/CMakeLists.txt
rename to bindings/python/example_scripts/CMakeLists.txt
diff --git a/src/optional/python-bindings/example_scripts/Invoice.tex b/bindings/python/example_scripts/Invoice.tex
similarity index 100%
rename from src/optional/python-bindings/example_scripts/Invoice.tex
rename to bindings/python/example_scripts/Invoice.tex
diff --git a/src/optional/python-bindings/example_scripts/Invoice.tex.tmpl b/bindings/python/example_scripts/Invoice.tex.tmpl
similarity index 100%
rename from src/optional/python-bindings/example_scripts/Invoice.tex.tmpl
rename to bindings/python/example_scripts/Invoice.tex.tmpl
diff --git a/src/optional/python-bindings/example_scripts/Invoice_2.tex.tmpl b/bindings/python/example_scripts/Invoice_2.tex.tmpl
similarity index 100%
rename from src/optional/python-bindings/example_scripts/Invoice_2.tex.tmpl
rename to bindings/python/example_scripts/Invoice_2.tex.tmpl
diff --git a/src/optional/python-bindings/example_scripts/account_analysis.py b/bindings/python/example_scripts/account_analysis.py
similarity index 100%
rename from src/optional/python-bindings/example_scripts/account_analysis.py
rename to bindings/python/example_scripts/account_analysis.py
diff --git a/src/optional/python-bindings/example_scripts/change_tax_code.py b/bindings/python/example_scripts/change_tax_code.py
similarity index 100%
rename from src/optional/python-bindings/example_scripts/change_tax_code.py
rename to bindings/python/example_scripts/change_tax_code.py
diff --git a/src/optional/python-bindings/example_scripts/get_quotes.pl b/bindings/python/example_scripts/get_quotes.pl
similarity index 100%
rename from src/optional/python-bindings/example_scripts/get_quotes.pl
rename to bindings/python/example_scripts/get_quotes.pl
diff --git a/src/optional/python-bindings/example_scripts/gnc_convenience.py b/bindings/python/example_scripts/gnc_convenience.py
similarity index 100%
rename from src/optional/python-bindings/example_scripts/gnc_convenience.py
rename to bindings/python/example_scripts/gnc_convenience.py
diff --git a/src/optional/python-bindings/example_scripts/gncinvoice_jinja.py b/bindings/python/example_scripts/gncinvoice_jinja.py
similarity index 100%
rename from src/optional/python-bindings/example_scripts/gncinvoice_jinja.py
rename to bindings/python/example_scripts/gncinvoice_jinja.py
diff --git a/src/optional/python-bindings/example_scripts/gncinvoicefkt.py b/bindings/python/example_scripts/gncinvoicefkt.py
similarity index 100%
rename from src/optional/python-bindings/example_scripts/gncinvoicefkt.py
rename to bindings/python/example_scripts/gncinvoicefkt.py
diff --git a/src/optional/python-bindings/example_scripts/invoice_export_doxygen.txt b/bindings/python/example_scripts/invoice_export_doxygen.txt
similarity index 100%
rename from src/optional/python-bindings/example_scripts/invoice_export_doxygen.txt
rename to bindings/python/example_scripts/invoice_export_doxygen.txt
diff --git a/src/optional/python-bindings/example_scripts/latex_invoices.py b/bindings/python/example_scripts/latex_invoices.py
similarity index 100%
rename from src/optional/python-bindings/example_scripts/latex_invoices.py
rename to bindings/python/example_scripts/latex_invoices.py
diff --git a/src/optional/python-bindings/example_scripts/new_book_with_opening_balances.py b/bindings/python/example_scripts/new_book_with_opening_balances.py
similarity index 100%
rename from src/optional/python-bindings/example_scripts/new_book_with_opening_balances.py
rename to bindings/python/example_scripts/new_book_with_opening_balances.py
diff --git a/src/optional/python-bindings/example_scripts/priceDB_test.py b/bindings/python/example_scripts/priceDB_test.py
similarity index 100%
rename from src/optional/python-bindings/example_scripts/priceDB_test.py
rename to bindings/python/example_scripts/priceDB_test.py
diff --git a/src/optional/python-bindings/example_scripts/price_database_example.py b/bindings/python/example_scripts/price_database_example.py
similarity index 100%
rename from src/optional/python-bindings/example_scripts/price_database_example.py
rename to bindings/python/example_scripts/price_database_example.py
diff --git a/src/optional/python-bindings/example_scripts/quotes_historic.py b/bindings/python/example_scripts/quotes_historic.py
similarity index 100%
rename from src/optional/python-bindings/example_scripts/quotes_historic.py
rename to bindings/python/example_scripts/quotes_historic.py
diff --git a/src/optional/python-bindings/example_scripts/rest-api/README b/bindings/python/example_scripts/rest-api/README
similarity index 100%
rename from src/optional/python-bindings/example_scripts/rest-api/README
rename to bindings/python/example_scripts/rest-api/README
diff --git a/src/optional/python-bindings/example_scripts/rest-api/gnucash_rest.py b/bindings/python/example_scripts/rest-api/gnucash_rest.py
similarity index 100%
rename from src/optional/python-bindings/example_scripts/rest-api/gnucash_rest.py
rename to bindings/python/example_scripts/rest-api/gnucash_rest.py
diff --git a/src/optional/python-bindings/example_scripts/rest-api/gnucash_simple.py b/bindings/python/example_scripts/rest-api/gnucash_simple.py
similarity index 100%
rename from src/optional/python-bindings/example_scripts/rest-api/gnucash_simple.py
rename to bindings/python/example_scripts/rest-api/gnucash_simple.py
diff --git a/src/optional/python-bindings/example_scripts/simple_book.py b/bindings/python/example_scripts/simple_book.py
similarity index 100%
rename from src/optional/python-bindings/example_scripts/simple_book.py
rename to bindings/python/example_scripts/simple_book.py
diff --git a/src/optional/python-bindings/example_scripts/simple_business_create.py b/bindings/python/example_scripts/simple_business_create.py
similarity index 100%
rename from src/optional/python-bindings/example_scripts/simple_business_create.py
rename to bindings/python/example_scripts/simple_business_create.py
diff --git a/src/optional/python-bindings/example_scripts/simple_invoice_insert.py b/bindings/python/example_scripts/simple_invoice_insert.py
similarity index 100%
rename from src/optional/python-bindings/example_scripts/simple_invoice_insert.py
rename to bindings/python/example_scripts/simple_invoice_insert.py
diff --git a/src/optional/python-bindings/example_scripts/simple_session.py b/bindings/python/example_scripts/simple_session.py
similarity index 100%
rename from src/optional/python-bindings/example_scripts/simple_session.py
rename to bindings/python/example_scripts/simple_session.py
diff --git a/src/optional/python-bindings/example_scripts/simple_sqlite_create.py b/bindings/python/example_scripts/simple_sqlite_create.py
similarity index 100%
rename from src/optional/python-bindings/example_scripts/simple_sqlite_create.py
rename to bindings/python/example_scripts/simple_sqlite_create.py
diff --git a/src/optional/python-bindings/example_scripts/simple_test.py b/bindings/python/example_scripts/simple_test.py
similarity index 100%
rename from src/optional/python-bindings/example_scripts/simple_test.py
rename to bindings/python/example_scripts/simple_test.py
diff --git a/src/optional/python-bindings/example_scripts/str_methods.py b/bindings/python/example_scripts/str_methods.py
similarity index 100%
rename from src/optional/python-bindings/example_scripts/str_methods.py
rename to bindings/python/example_scripts/str_methods.py
diff --git a/src/optional/python-bindings/example_scripts/test_imbalance_transaction.py b/bindings/python/example_scripts/test_imbalance_transaction.py
similarity index 100%
rename from src/optional/python-bindings/example_scripts/test_imbalance_transaction.py
rename to bindings/python/example_scripts/test_imbalance_transaction.py
diff --git a/src/optional/python-bindings/function_class.py b/bindings/python/function_class.py
similarity index 100%
rename from src/optional/python-bindings/function_class.py
rename to bindings/python/function_class.py
diff --git a/src/optional/python-bindings/gnucash_business.py b/bindings/python/gnucash_business.py
similarity index 100%
rename from src/optional/python-bindings/gnucash_business.py
rename to bindings/python/gnucash_business.py
diff --git a/bindings/python/gnucash_core.i b/bindings/python/gnucash_core.i
new file mode 100644
index 0000000..f0b3800
--- /dev/null
+++ b/bindings/python/gnucash_core.i
@@ -0,0 +1,229 @@
+/*
+ * gnucash_core.i -- SWIG interface file for the core parts of GnuCash
+ *
+ * Copyright (C) 2008 ParIT Worker Co-operative <paritinfo at parit.ca>
+ *
+ * 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 at gnu.org
+ *
+ * @author Mark Jenkins, ParIT Worker Co-operative <mark at parit.ca>
+ * @author Jeff Green, ParIT Worker Co-operative <jeff at parit.ca>
+ */
+
+/** @file
+    @brief SWIG interface file for the core parts of GnuCash
+
+        This file is processed by SWIG and the resulting files are gnucash_core.c and gnucash_core_c.py.
+        Have a look at the includes to see which parts of the GnuCash source SWIG takes as input.
+    @author Mark Jenkins, ParIT Worker Co-operative <mark at parit.ca>
+    @author Jeff Green,   ParIT Worker Co-operative <jeff at parit.ca>
+    @ingroup python_bindings 
+
+    @file gnucash_core.c
+    @brief SWIG output file.
+    @ingroup python_bindings
+    @file gnucash_core_c.py
+    @brief SWIG output file.
+    @ingroup python_bindings
+*/
+
+%feature("autodoc", "1");
+%module(package="gnucash") gnucash_core_c
+
+%{
+#include "config.h"
+#include <datetime.h>
+#include "qofsession.h"
+#include "qofbook.h"
+#include "qofbackend.h"
+#include "qoflog.h"
+#include "qofutil.h"
+#include "qofid.h"
+#include "guid.h"
+#include "qofquery.h"
+#include "qofquerycore.h"
+#include "gnc-module.h"
+#include "gnc-engine.h"
+#include "Transaction.h"
+#include "Split.h"
+#include "Account.h"
+#include "gnc-commodity.h"
+#include "gnc-environment.h"
+#include "gnc-lot.h"
+#include "gnc-numeric.h"
+#include "gncCustomer.h"
+#include "gncCustomerP.h"
+#include "gncEmployee.h"
+#include "gncVendor.h"
+#include "gncVendorP.h"
+#include "gncAddress.h"
+#include "gncBillTerm.h"
+#include "gncOwner.h"
+#include "gncInvoice.h"
+#include "gncInvoiceP.h"
+#include "gncJob.h"
+#include "gncEntry.h"
+#include "gncTaxTable.h"
+#include "gncIDSearch.h"
+#include "gnc-pricedb.h"
+#include "gnc-prefs-utils.h"
+#include "cap-gains.h"
+#include "Scrub3.h"
+%}
+
+%include <timespec.i>
+
+%include <base-typemaps.i>
+
+%include <engine-common.i>
+
+%include <qofbackend.h>
+
+// this function is defined in qofsession.h, but isnt found in the libraries,
+// ignored because SWIG attempts to link against (to create language bindings)
+%ignore qof_session_not_saved;
+%include <qofsession.h>
+
+%include <qofbook.h>
+
+%include <qofid.h>
+
+%include <qofquery.h>
+
+%include <qofquerycore.h>
+
+/* SWIG doesn't like this macro, so redefine it to simply mean const */
+#define G_CONST_RETURN const
+%include <guid.h>
+
+/* %include <Transaction.h>
+%include <Split.h>
+%include <Account.h> */
+
+//Ignored because it is unimplemented
+%ignore gnc_numeric_convert_with_error;
+%include <gnc-numeric.h>
+
+%include <gnc-commodity.h>
+
+%typemap(out) GncOwner * {
+    GncOwnerType owner_type = gncOwnerGetType($1);
+    PyObject * owner_tuple = PyTuple_New(2);
+    PyTuple_SetItem(owner_tuple, 0, PyInt_FromLong( (long) owner_type ) );
+    PyObject * swig_wrapper_object;
+    if (owner_type == GNC_OWNER_CUSTOMER ){
+        swig_wrapper_object = SWIG_NewPointerObj(
+        gncOwnerGetCustomer($1), $descriptor(GncCustomer *), 0);
+    }
+    else if (owner_type == GNC_OWNER_JOB){
+        swig_wrapper_object = SWIG_NewPointerObj(
+        gncOwnerGetJob($1), $descriptor(GncJob *), 0);
+    }
+    else if (owner_type == GNC_OWNER_VENDOR){
+        swig_wrapper_object = SWIG_NewPointerObj(
+        gncOwnerGetVendor($1), $descriptor(GncVendor *), 0);
+    }
+    else if (owner_type == GNC_OWNER_EMPLOYEE){
+        swig_wrapper_object = SWIG_NewPointerObj(
+        gncOwnerGetEmployee($1), $descriptor(GncEmployee *), 0);
+    }
+    else {
+        swig_wrapper_object = Py_None;
+    Py_INCREF(Py_None);
+    }
+    PyTuple_SetItem(owner_tuple, 1, swig_wrapper_object);
+    $result = owner_tuple;
+}
+
+
+%typemap(in) GncOwner * {
+    GncOwner * temp_owner = gncOwnerNew();
+    void * pointer_to_real_thing;
+    if ((SWIG_ConvertPtr($input, &pointer_to_real_thing,
+                         $descriptor(GncCustomer *),
+                         SWIG_POINTER_EXCEPTION)) == 0){
+        gncOwnerInitCustomer(temp_owner, (GncCustomer *)pointer_to_real_thing);
+        $1 = temp_owner;
+    }
+    else if ((SWIG_ConvertPtr($input, &pointer_to_real_thing,
+                         $descriptor(GncJob *),
+                         SWIG_POINTER_EXCEPTION)) == 0){
+        gncOwnerInitJob(temp_owner, (GncJob *)pointer_to_real_thing);
+        $1 = temp_owner;
+    }
+    else if ((SWIG_ConvertPtr($input, &pointer_to_real_thing,
+                         $descriptor(GncVendor *),
+                         SWIG_POINTER_EXCEPTION)) == 0){
+        gncOwnerInitVendor(temp_owner, (GncVendor *)pointer_to_real_thing);
+        $1 = temp_owner;
+    }
+    else if ((SWIG_ConvertPtr($input, &pointer_to_real_thing,
+                         $descriptor(GncEmployee *),
+                         SWIG_POINTER_EXCEPTION)) == 0){
+        gncOwnerInitEmployee(temp_owner, (GncEmployee *)pointer_to_real_thing);
+        $1 = temp_owner;
+    }
+    else {
+    PyErr_SetString(
+        PyExc_ValueError,
+        "Python object passed to function with GncOwner * argument "
+        "couldn't be converted back to pointer of that type");
+        return NULL;
+    }
+}
+
+%typemap(freearg) GncOwner * {
+    gncOwnerFree($1);
+}
+
+static const GncGUID * gncEntryGetGUID(GncEntry *x);
+
+%include <gnc-lot.h>
+
+//core business includes
+%include <gncOwner.h>
+%include <gncCustomer.h>
+%include <gncCustomerP.h>
+%include <gncEmployee.h>
+%include <gncVendor.h>
+%include <gncVendorP.h>
+%include <gncAddress.h>
+%include <gncBillTerm.h>
+%include <gncInvoice.h>
+%include <gncInvoiceP.h>
+%include <gncJob.h>
+%include <gncEntry.h>
+%include <gncTaxTable.h>
+%include <gncIDSearch.h>
+
+// Commodity prices includes and stuff
+%include <gnc-pricedb.h>
+
+%include <cap-gains.h>
+%include <Scrub3.h>
+
+%init %{
+gnc_environment_setup();
+qof_log_init();
+qof_init();
+qof_query_init();
+gnc_module_system_init();
+char * no_args[1] = { NULL };
+gnc_engine_init(0, no_args);
+gnc_prefs_init();
+%}
+
diff --git a/src/optional/python-bindings/gnucash_core.py b/bindings/python/gnucash_core.py
similarity index 100%
rename from src/optional/python-bindings/gnucash_core.py
rename to bindings/python/gnucash_core.py
diff --git a/src/optional/python-bindings/sqlite3test.c b/bindings/python/sqlite3test.c
similarity index 100%
rename from src/optional/python-bindings/sqlite3test.c
rename to bindings/python/sqlite3test.c
diff --git a/src/optional/python-bindings/tests/CMakeLists.txt b/bindings/python/tests/CMakeLists.txt
similarity index 100%
rename from src/optional/python-bindings/tests/CMakeLists.txt
rename to bindings/python/tests/CMakeLists.txt
diff --git a/bindings/python/tests/Makefile.am b/bindings/python/tests/Makefile.am
new file mode 100644
index 0000000..d8ac3eb
--- /dev/null
+++ b/bindings/python/tests/Makefile.am
@@ -0,0 +1,53 @@
+GNC_TEST_DEPS = --gnc-module-dir ${top_builddir}/libgnucash/engine \
+  --gnc-module-dir ${top_builddir}/libgnucash/app-utils \
+  --guile-load-dir ${top_builddir}/libgnucash/core-utils \
+  --guile-load-dir ${top_builddir}/libgnucash/gnc-module \
+  --guile-load-dir ${top_builddir}/libgnucash/engine \
+  --guile-load-dir ${top_builddir}/libgnucash/scm \
+  --guile-load-dir ${top_builddir}/libgnucash/app-utils \
+  --library-dir    ${top_builddir}/libgnucash/core-utils \
+  --library-dir    ${top_builddir}/libgnucash/gnc-module \
+  --library-dir    ${top_builddir}/libgnucash/engine \
+  --library-dir    ${top_builddir}/libgnucash/backend/xml \
+  --library-dir    ${top_builddir}/libgnucash/backend/sql \
+  --library-dir    ${top_builddir}/libgnucash/app-utils \
+  --library-dir    ${top_builddir}/common/test-core
+  
+TESTS_ENVIRONMENT = \
+  GNC_BUILDDIR="${abs_top_builddir}" \
+  PYTHON=${PYTHON} \
+  PYTHONPATH=$$PYTHONPATH:$(top_builddir)/bindings/python \
+  PYTHONPATH=$$PYTHONPATH:$(top_builddir)/bindings/python/.libs \
+  PYTHONPATH=$$PYTHONPATH:$(top_srcdir)/bindings/python/tests \
+  PYTHONPATH=$$PYTHONPATH:$(top_builddir)/common/test-core/ \
+  PYTHONPATH=$$PYTHONPATH:$(top_srcdir)/common/test-core/ \
+  PYTHONPATH=$$PYTHONPATH:$(top_builddir)/common/test-core/.libs \
+  $(shell ${abs_top_srcdir}/common/gnc-test-env.pl --noexports ${GNC_TEST_DEPS})
+  
+## We borrow guile's convention and use @-...-@ as the substitution
+## brackets below, instead of the usual @... at .  This prevents autoconf
+## from substituting the values directly into the left-hand sides of
+## the sed substitutions.  *sigh*
+
+runTests.py: runTests.py.in ${top_builddir}/config.status Makefile
+	rm -f $@.tmp
+	sed < $< > $@.tmp \
+	    -e 's#@-PYTHON-@#${PYTHON}#'
+	mv $@.tmp $@
+	chmod u+x $@
+
+CLEANFILES = runTests.py
+
+TESTS = runTests.py
+
+clean-local:
+	rm -f translog.*
+
+EXTRA_DIST = \
+  runTests.py.in \
+  test_account.py \
+  test_book.py \
+  test_split.py \
+  test_transaction.py \
+  test_business.py \
+  CMakeLists.txt
diff --git a/src/optional/python-bindings/tests/runTests.py.in b/bindings/python/tests/runTests.py.in
similarity index 100%
rename from src/optional/python-bindings/tests/runTests.py.in
rename to bindings/python/tests/runTests.py.in
diff --git a/src/optional/python-bindings/tests/test_account.py b/bindings/python/tests/test_account.py
similarity index 100%
rename from src/optional/python-bindings/tests/test_account.py
rename to bindings/python/tests/test_account.py
diff --git a/src/optional/python-bindings/tests/test_book.py b/bindings/python/tests/test_book.py
similarity index 100%
rename from src/optional/python-bindings/tests/test_book.py
rename to bindings/python/tests/test_book.py
diff --git a/src/optional/python-bindings/tests/test_business.py b/bindings/python/tests/test_business.py
similarity index 100%
rename from src/optional/python-bindings/tests/test_business.py
rename to bindings/python/tests/test_business.py
diff --git a/src/optional/python-bindings/tests/test_commodity.py b/bindings/python/tests/test_commodity.py
similarity index 100%
rename from src/optional/python-bindings/tests/test_commodity.py
rename to bindings/python/tests/test_commodity.py
diff --git a/src/optional/python-bindings/tests/test_split.py b/bindings/python/tests/test_split.py
similarity index 100%
rename from src/optional/python-bindings/tests/test_split.py
rename to bindings/python/tests/test_split.py
diff --git a/src/optional/python-bindings/tests/test_transaction.py b/bindings/python/tests/test_transaction.py
similarity index 100%
rename from src/optional/python-bindings/tests/test_transaction.py
rename to bindings/python/tests/test_transaction.py
diff --git a/src/optional/python-bindings/timespec.i b/bindings/python/timespec.i
similarity index 100%
rename from src/optional/python-bindings/timespec.i
rename to bindings/python/timespec.i
diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt
new file mode 100644
index 0000000..84ca246
--- /dev/null
+++ b/common/CMakeLists.txt
@@ -0,0 +1,25 @@
+# CMakeLists.txt for common/
+
+# The subdirectories
+ADD_SUBDIRECTORY (cmake_modules)
+ADD_SUBDIRECTORY (debug)
+ADD_SUBDIRECTORY (test-core)
+
+SET(common_EXTRA_DIST
+        base-typemaps.i
+        config.h.cmake.in
+        gnc-test-env.pl
+        guile-mappings.h
+        platform.h
+	swig-utf8.patch)
+
+IF (BUILDING_FROM_VCS)
+  SET (SWIG_RUNTIME_H ${CMAKE_CURRENT_BINARY_DIR}/swig-runtime.h PARENT_SCOPE)
+ELSE()
+  SET (SWIG_RUNTIME_H ${CMAKE_CURRENT_SOURCE_DIR}/swig-runtime.h PARENT_SCOPE)
+ENDIF()
+
+
+SET_LOCAL_DIST(common_DIST_local CMakeLists.txt Makefile.am ${common_EXTRA_DIST})
+
+SET(common_DIST ${common_DIST_local} ${cmake_modules_DIST} ${debug_DIST} ${test_core_DIST} PARENT_SCOPE)
diff --git a/common/Makefile.am b/common/Makefile.am
new file mode 100644
index 0000000..07c4e9e
--- /dev/null
+++ b/common/Makefile.am
@@ -0,0 +1,43 @@
+# These directories do not contain any gtk dependencies
+# Note the unusual ordering of some test directories. This is
+# because test-core depends on engine and the test directories
+# in turn depend on test-core.
+SUBDIRS = \
+  . \
+  debug
+# Note normally SUBDIRS should also include test-core. That directory
+# however depends on libgnucash/engine and hence is included in
+# libgnucash/Makefile.am for proper build oldering. This would not
+# be needed if our Makefiles were structured to be included one
+# in the other instead of for a recursive make invocation.
+
+noinst_HEADERS = \
+  swig-runtime.h
+
+if BUILDING_FROM_VCS
+swig-runtime.h:
+	$(SWIG) -guile -external-runtime $@
+endif
+MAINTAINERCLEANFILES = swig-runtime.h
+
+EXTRA_DIST = \
+  base-typemaps.i \
+  cmake_modules/MacroAppendForeach.cmake \
+  cmake_modules/GncAddSwigCommand.cmake \
+  cmake_modules/GncAddTest.cmake \
+  cmake_modules/MakeDist.cmake \
+  cmake_modules/COPYING-CMAKE-SCRIPTS.txt \
+  cmake_modules/MakeDistFiles.cmake \
+  cmake_modules/MacroAddSourceFileCompileFlags.cmake \
+  cmake_modules/MakeDistCheck.cmake \
+  cmake_modules/GncConfigure.cmake \
+  cmake_modules/GncAddSchemeTargets.cmake \
+  cmake_modules/GncAddGSchemaTargets.cmake \
+  cmake_modules/GncFindPkgConfig.cmake \
+  cmake_modules/CMakeLists.txt \
+  config.h.cmake.in \
+  gnc-test-env.pl \
+  guile-mappings.h \
+  platform.h \
+  swig-utf8.patch \
+  CMakeLists.txt
diff --git a/src/base-typemaps.i b/common/base-typemaps.i
similarity index 100%
rename from src/base-typemaps.i
rename to common/base-typemaps.i
diff --git a/src/cmake_modules/CMakeLists.txt b/common/cmake_modules/CMakeLists.txt
similarity index 100%
rename from src/cmake_modules/CMakeLists.txt
rename to common/cmake_modules/CMakeLists.txt
diff --git a/src/cmake_modules/COPYING-CMAKE-SCRIPTS.txt b/common/cmake_modules/COPYING-CMAKE-SCRIPTS.txt
similarity index 100%
rename from src/cmake_modules/COPYING-CMAKE-SCRIPTS.txt
rename to common/cmake_modules/COPYING-CMAKE-SCRIPTS.txt
diff --git a/src/cmake_modules/GncAddGSchemaTargets.cmake b/common/cmake_modules/GncAddGSchemaTargets.cmake
similarity index 100%
rename from src/cmake_modules/GncAddGSchemaTargets.cmake
rename to common/cmake_modules/GncAddGSchemaTargets.cmake
diff --git a/common/cmake_modules/GncAddSchemeTargets.cmake b/common/cmake_modules/GncAddSchemeTargets.cmake
new file mode 100644
index 0000000..2d2478d
--- /dev/null
+++ b/common/cmake_modules/GncAddSchemeTargets.cmake
@@ -0,0 +1,183 @@
+# GncAddSchemeTargets.cmake Define a command to compile Scheme programs with Guile
+# Copyright (c) 2015, Rob Gowin
+# Copyright 2017 John Ralls <jralls at ceridwen.us>
+#
+# 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 at gnu.org
+
+#Guile and ltdl require MSYS paths on MinGW-w64; this function transforms them.
+FUNCTION(MAKE_UNIX_PATH PATH)
+    STRING(REGEX REPLACE "^([A-Za-z]):" "/\\1" newpath ${${PATH}})
+    string(REGEX REPLACE "\\\\" "/" newpath ${newpath})
+    SET(${PATH} ${newpath} PARENT_SCOPE)
+ENDFUNCTION()
+
+#PATH variables in the environment are separated by colons, but CMake lists are separated by semicolons. This function transforms the separators.
+FUNCTION(MAKE_UNIX_PATH_LIST PATH)
+    STRING(REPLACE ";" ":" newpath "${${PATH}}")
+    SET(${PATH} ${newpath} PARENT_SCOPE)
+ENDFUNCTION()
+
+FUNCTION(GNC_ADD_SCHEME_TARGETS _TARGET _SOURCE_FILES _OUTPUT_DIR
+                                _GUILE_MODULES _GUILE_LOAD_DIRS
+				_GUILE_LIBRARY_DIRS _GUILE_DEPENDS
+				MAKE_LINKS)
+  SET(__DEBUG FALSE)
+  IF (__DEBUG)
+    MESSAGE("Parameters to COMPILE_SCHEME for target ${_TARGET}")
+    MESSAGE("   SOURCE_FILES: ${_SOURCE_FILES}")
+    MESSAGE("   GUILE_MODULES: ${_GUILE_MODULES}")
+    MESSAGE("   GUILE_LOAD_DIRS: ${_GUILE_LOAD_DIRS}")
+    MESSAGE("   GUILE_LIBRARY_DIRS: ${_GUILE_LIBRARY_DIRS}")
+    MESSAGE("   GUILE_DEPENDS: ${_GUILE_DEPENDS}")
+    MESSAGE("   DIRECTORIES: ${BINDIR_BUILD}, ${LIBDIR_BUILD}, ${DATADIR_BUILD}")
+  ENDIF(__DEBUG)
+  SET(_CMD "create_symlink")
+  IF(WIN32)
+    SET(_CMD "copy")
+  ENDIF(WIN32)
+  SET(current_srcdir ${CMAKE_CURRENT_SOURCE_DIR})
+  SET(current_bindir ${CMAKE_CURRENT_BINARY_DIR})
+  SET(build_bindir ${BINDIR_BUILD})
+  SET(build_libdir ${LIBDIR_BUILD})
+  SET(build_datadir ${DATADIR_BUILD})
+  IF(MINGW64)
+    MAKE_UNIX_PATH(build_bindir)
+    MAKE_UNIX_PATH(build_libdir)
+    MAKE_UNIX_PATH(build_datadir)
+    MAKE_UNIX_PATH(current_bindir)
+    MAKE_UNIX_PATH(current_srcdir)
+    MAKE_UNIX_PATH(CMAKE_BINARY_DIR)
+    MAKE_UNIX_PATH(CMAKE_SOURCE_DIR)
+  ENDIF(MINGW64)
+
+  # For guile 1, we simple link (or copy, for Windows) each source file to the dest directory
+  IF(HAVE_GUILE1 OR MAKE_LINKS)
+    SET(_LINK_DIR ${DATADIR_BUILD}/gnucash/scm/${_OUTPUT_DIR})
+    FILE(MAKE_DIRECTORY ${_LINK_DIR})
+    SET(_SCHEME_LINKS "")
+    FOREACH(scheme_file ${_SOURCE_FILES})
+      SET(_SOURCE_FILE ${current_srcdir}/${scheme_file})
+      IF(IS_ABSOLUTE ${scheme_file})
+        SET(_SOURCE_FILE ${scheme_file})
+      ENDIF()
+      GET_FILENAME_COMPONENT(name ${scheme_file} NAME)
+      SET(_OUTPUT_FILE ${_LINK_DIR}/${name})
+      IF(NOT EXISTS ${_OUTPUT_FILE})
+        LIST(APPEND _SCHEME_LINKS ${_OUTPUT_FILE})
+        ADD_CUSTOM_COMMAND(
+            OUTPUT ${_OUTPUT_FILE}
+            COMMAND ${CMAKE_COMMAND} -E ${_CMD} ${_SOURCE_FILE} ${_OUTPUT_FILE}
+        )
+      ENDIF()
+    ENDFOREACH(scheme_file)
+    IF(HAVE_GUILE1)
+      ADD_CUSTOM_TARGET(${_TARGET} ALL DEPENDS ${_SCHEME_LINKS})
+    ELSE()
+      ADD_CUSTOM_TARGET(${_TARGET}-links ALL DEPENDS ${_SCHEME_LINKS})
+    ENDIF()
+  ENDIF(HAVE_GUILE1 OR MAKE_LINKS)
+
+  IF(HAVE_GUILE2)
+    # Construct the guile source and compiled load paths
+
+    SET(_GUILE_LOAD_PATH "${current_srcdir}"
+        "${current_bindir}" "${CMAKE_BINARY_DIR}/libgnucash/scm")  # to pick up generated build-config.scm
+    SET(_GUILE_LOAD_COMPILED_PATH "${current_bindir}")
+    FOREACH (load_item ${_GUILE_LOAD_DIRS})
+      LIST(APPEND _GUILE_LOAD_PATH "${CMAKE_SOURCE_DIR}/${load_item}")
+    ENDFOREACH(load_item)
+
+    SET(_GUILE_CACHE_DIR ${LIBDIR_BUILD}/gnucash/scm/ccache/2.0)
+    SET(_GUILE_LOAD_PATH "${current_srcdir}")
+    IF (MAKE_LINKS)
+      LIST(APPEND _GUILE_LOAD_PATH "${build_datadir}/gnucash/scm")
+    ENDIF()
+    SET(_GUILE_LOAD_COMPILED_PATH ${build_libdir}/gnucash/scm/ccache/2.0)
+
+    SET(_TARGET_FILES "")
+
+    FOREACH(source_file ${_SOURCE_FILES})
+      SET(guile_depends ${_GUILE_DEPENDS})
+      GET_FILENAME_COMPONENT(basename ${source_file} NAME_WE)
+
+      SET(output_file ${basename}.go)
+      SET(_TMP_OUTPUT_DIR ${_OUTPUT_DIR})
+      IF (_TMP_OUTPUT_DIR)
+        SET(output_file ${_OUTPUT_DIR}/${basename}.go)
+      ENDIF()
+      SET(output_file ${_GUILE_CACHE_DIR}/${output_file})
+      LIST(APPEND _TARGET_FILES ${output_file})
+
+      SET(source_file_abs_path ${CMAKE_CURRENT_SOURCE_DIR}/${source_file})
+      IF (IS_ABSOLUTE ${source_file})
+        SET(source_file_abs_path ${source_file})
+      ENDIF()
+      IF (__DEBUG)
+        MESSAGE("ADD_CUSTOM_COMMAND: output = ${output_file}")
+      ENDIF()
+      SET(CMAKE_COMMMAND_TMP "")
+      IF (${CMAKE_VERSION} VERSION_GREATER 3.1)
+        SET(CMAKE_COMMAND_TMP ${CMAKE_COMMAND} -E env)
+      ENDIF()
+      IF (MINGW64)
+	set(fpath "")
+	foreach(dir $ENV{PATH})
+	  MAKE_UNIX_PATH(dir)
+	  set(fpath "${fpath}${dir}:")
+	endforeach(dir)
+        SET(LIBRARY_PATH "PATH=\"${build_bindir}:${fpath}\"")
+      ELSE (MINGW64)
+        SET (LIBRARY_PATH "LD_LIBRARY_PATH=${LIBDIR_BUILD}:${LIBDIR_BUILD}/gnucash:${_GUILE_LD_LIBRARY_PATH}")
+      ENDIF (MINGW64)
+      IF (APPLE)
+        SET (LIBRARY_PATH "DYLD_LIBRARY_PATH=${LIBDIR_BUILD}:${LIBDIR_BUILD}/gnucash:${_GUILE_LD_LIBRARY_PATH}")
+      ENDIF (APPLE)
+      SET(_GNC_MODULE_PATH "")
+      IF(MINGW64)
+	SET(_GNC_MODULE_PATH "${build_bindir}")
+      ELSE(MINGW64)
+        SET(_GNC_MODULE_PATH "${LIBDIR_BUILD}" "${LIBDIR_BUILD}/gnucash" "${GNC_MODULE_PATH}")
+      ENDIF(MINGW64)
+      MAKE_UNIX_PATH_LIST(_GUILE_LOAD_PATH)
+      MAKE_UNIX_PATH_LIST(_GUILE_LOAD_COMPILED_PATH)
+      MAKE_UNIX_PATH_LIST(_GUILE_MODULES)
+      MAKE_UNIX_PATH_LIST(_GUILE_LD_LIBRARY_PATH)
+      MAKE_UNIX_PATH_LIST(_GNC_MODULE_PATH)
+      IF (__DEBUG)
+	MESSAGE("  ")
+	MESSAGE("   LIBRARY_PATH: ${LIBRARY_PATH}")
+	MESSAGE("   GUILE_LOAD_PATH: ${_GUILE_LOAD_PATH}")
+	MESSAGE("   GUILE_LOAD_COMPILED_PATH: ${_GUILE_LOAD_COMPILED_PATH}")
+	MESSAGE("   GNC_MODULE_PATH: ${_GNC_MODULE_PATH}")
+      ENDIF(__DEBUG)
+      ADD_CUSTOM_COMMAND(
+        OUTPUT ${output_file}
+        COMMAND ${CMAKE_COMMAND_TMP}
+	   ${LIBRARY_PATH}
+           GNC_UNINSTALLED=YES
+           GNC_BUILDDIR=${CMAKE_BINARY_DIR}
+           GUILE_LOAD_PATH=${_GUILE_LOAD_PATH}
+           GUILE_LOAD_COMPILED_PATH=${_GUILE_LOAD_COMPILED_PATH}
+           GNC_MODULE_PATH=${_GNC_MODULE_PATH}
+           ${GUILE_EXECUTABLE} -e '\(@@ \(guild\) main\)' -s ${GUILD_EXECUTABLE} compile -o ${output_file} ${source_file_abs_path}
+        DEPENDS ${guile_depends}
+        MAIN_DEPENDENCY ${source_file_abs_path}
+      )
+    ENDFOREACH(source_file)
+    IF (__DEBUG)
+      MESSAGE("TARGET_FILES are ${_TARGET_FILES}")
+    ENDIF(__DEBUG)
+    ADD_CUSTOM_TARGET(${_TARGET} ALL DEPENDS ${_TARGET_FILES})
+    INSTALL(FILES ${_TARGET_FILES} DESTINATION ${SCHEME_INSTALLED_CACHE_DIR}/${_OUTPUT_DIR})
+  ENDIF(HAVE_GUILE2)
+  INSTALL(FILES ${_SOURCE_FILES} DESTINATION ${SCHEME_INSTALLED_SOURCE_DIR}/${_OUTPUT_DIR})
+ENDFUNCTION(GNC_ADD_SCHEME_TARGETS)
diff --git a/common/cmake_modules/GncAddSwigCommand.cmake b/common/cmake_modules/GncAddSwigCommand.cmake
new file mode 100644
index 0000000..440b6b9
--- /dev/null
+++ b/common/cmake_modules/GncAddSwigCommand.cmake
@@ -0,0 +1,31 @@
+# Copyright (c) 2010, Christian Stimming
+
+
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+MACRO (GNC_ADD_SWIG_COMMAND _target _output _input)
+
+ADD_CUSTOM_COMMAND (
+  OUTPUT ${_output}
+  DEPENDS ${_input} ${CMAKE_SOURCE_DIR}/common/base-typemaps.i ${ARGN}
+COMMAND ${SWIG_EXECUTABLE} -guile ${SWIG_ARGS} -Linkage module -I${CMAKE_SOURCE_DIR}/libgnucash/engine -I${CMAKE_SOURCE_DIR}/common  -o ${_output} ${_input}
+)
+
+ADD_CUSTOM_TARGET(${_target} DEPENDS ${_output})
+
+ENDMACRO (GNC_ADD_SWIG_COMMAND)
+
+
+MACRO (GNC_ADD_SWIG_PYTHON_COMMAND _target _output _input)
+
+  ADD_CUSTOM_COMMAND(OUTPUT ${_output}
+
+    COMMAND ${SWIG_EXECUTABLE} -python -Wall -Werror ${SWIG_ARGS}
+       -I${CMAKE_SOURCE_DIR}/common
+       -I${CMAKE_SOURCE_DIR}/libgnucash/engine -I${CMAKE_SOURCE_DIR}/libgnucash/app-utils
+       -o ${_output} ${_input}
+    DEPENDS ${_input} ${CMAKE_SOURCE_DIR}/common/base-typemaps.i ${ARGN}
+  )
+  ADD_CUSTOM_TARGET(${_target} ALL DEPENDS ${_output} ${CMAKE_SOURCE_DIR}/common/base-typemaps.i ${_input} ${ARGN})
+ENDMACRO()
diff --git a/common/cmake_modules/GncAddTest.cmake b/common/cmake_modules/GncAddTest.cmake
new file mode 100644
index 0000000..e3df3af
--- /dev/null
+++ b/common/cmake_modules/GncAddTest.cmake
@@ -0,0 +1,163 @@
+
+
+FUNCTION(GET_GUILE_ENV)
+  SET(_GNC_MODULE_PATH ${CMAKE_BINARY_DIR}/lib:${CMAKE_BINARY_DIR}/lib/gnucash)
+  IF (WIN32)
+    SET(_GNC_MODULE_PATH ${CMAKE_BINARY_DIR}/bin)
+  ENDIF()
+  SET(env "")
+  LIST(APPEND env "GNC_UNINSTALLED=yes")
+  LIST(APPEND env "GNC_BUILDDIR=${CMAKE_BINARY_DIR}")
+  LIST(APPEND env "GUILE_WARN_DEPRECATED=no")
+  IF (APPLE)
+    LIST(APPEND env "DYLD_LIBRARY_PATH=${_GNC_MODULE_PATH}")
+  ENDIF()
+  IF (UNIX)
+    LIST(APPEND env LD_LIBRARY_PATH=${_GNC_MODULE_PATH})
+  ENDIF()
+  IF (MINGW64)
+    set(fpath "")
+    set(path $ENV{PATH})
+    list(INSERT path 0 ${CMAKE_BINARY_DIR}/bin)
+    foreach(dir ${path})
+      string(REGEX REPLACE "^([A-Za-z]):" "/\\1" dir ${dir})
+      string(REGEX REPLACE "\\\\" "/" dir ${dir})
+      set(fpath "${fpath}${dir}:")
+    endforeach(dir)
+    LIST(APPEND env "PATH=${fpath}")
+    set(compiled_path "${CMAKE_BINARY_DIR}/lib/gnucash/scm/ccache/2.0")
+    string(REGEX REPLACE "^([A-Za-z]):" "/\\1" compiled_path ${compiled_path})
+    LIST(APPEND env GUILE_LOAD_COMPILED_PATH=${compiled_path})
+  ENDIF(MINGW64)
+  LIST(APPEND env "GNC_MODULE_PATH=${_GNC_MODULE_PATH}")
+  LIST(APPEND env "GUILE=${GUILE_EXECUTABLE}")
+
+  IF (NOT WIN32)
+    LIST(APPEND env "GUILE_LOAD_COMPILED_PATH=${CMAKE_BINARY_DIR}/lib/gnucash/scm/ccache/2.0")
+  ENDIF()
+  SET(guile_load_paths "")
+  LIST(APPEND guile_load_paths ${CMAKE_CURRENT_SOURCE_DIR}/mod-foo)
+  LIST(APPEND guile_load_paths ${CMAKE_CURRENT_SOURCE_DIR}/mod-bar)
+  LIST(APPEND guile_load_paths ${CMAKE_CURRENT_SOURCE_DIR}/mod-baz)
+  IF (WIN32)
+    LIST(APPEND guile_load_paths ${CMAKE_BINARY_DIR}/share/gnucash/scm)
+  ENDIF()
+  SET(guile_load_path "${guile_load_paths}")
+  IF (MINGW64)
+    set(new_path "")
+    FOREACH(load_item ${guile_load_path})
+      string(REGEX REPLACE "^([A-Za-z]):" "/\\1" load_item ${load_item})
+      list(APPEND new_path ${load_item})
+    ENDFOREACH(load_item)
+    set(guile_load_path ${new_path})
+  ENDIF (MINGW64)
+  IF (WIN32 AND NOT MINGW64)
+    STRING(REPLACE ";" "\\\\;" GUILE_LOAD_PATH "${guile_load_path}")
+  ELSE()
+    STRING(REPLACE ";" ":" GUILE_LOAD_PATH "${guile_load_path}")
+  ENDIF()
+  LIST(APPEND env GUILE_LOAD_PATH=${GUILE_LOAD_PATH})
+  SET(GUILE_ENV ${env} PARENT_SCOPE)
+ENDFUNCTION()
+
+
+FUNCTION(GNC_ADD_TEST _TARGET _SOURCE_FILES TEST_INCLUDE_VAR_NAME TEST_LIBS_VAR_NAME)
+  SET(HAVE_ENV_VARS FALSE)
+  IF (${ARGC} GREATER 4)
+    # Extra arguments are treated as environment variables
+    SET(HAVE_ENV_VARS TRUE)
+  ENDIF()
+  SET(TEST_INCLUDE_DIRS ${${TEST_INCLUDE_VAR_NAME}})
+  SET(TEST_LIBS ${${TEST_LIBS_VAR_NAME}})
+  SET_SOURCE_FILES_PROPERTIES (${_SOURCE_FILES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
+  ADD_EXECUTABLE(${_TARGET} EXCLUDE_FROM_ALL ${_SOURCE_FILES})
+  TARGET_LINK_LIBRARIES(${_TARGET} ${TEST_LIBS})
+  TARGET_INCLUDE_DIRECTORIES(${_TARGET} PRIVATE ${TEST_INCLUDE_DIRS})
+  IF (${HAVE_ENV_VARS})
+    SET(CMAKE_COMMAND_TMP "")
+    IF (${CMAKE_VERSION} VERSION_GREATER 3.1)
+      SET(CMAKE_COMMAND_TMP ${CMAKE_COMMAND} -E env "GNC_BUILDDIR=${CMAKE_BINARY_DIR};${ARGN}")
+    ENDIF()
+    ADD_TEST(${_TARGET} ${CMAKE_COMMAND_TMP}
+      ${CMAKE_BINARY_DIR}/bin/${_TARGET}
+    )
+    SET_TESTS_PROPERTIES(${_TARGET} PROPERTIES ENVIRONMENT "GNC_BUILDDIR=${CMAKE_BINARY_DIR};${ARGN}")
+  ELSE()
+    ADD_TEST(NAME ${_TARGET} COMMAND ${_TARGET})
+    SET_TESTS_PROPERTIES(${_TARGET} PROPERTIES ENVIRONMENT "GNC_BUILDDIR=${CMAKE_BINARY_DIR}")
+  ENDIF()
+  ADD_DEPENDENCIES(check ${_TARGET})
+ENDFUNCTION()
+
+FUNCTION(GNC_ADD_TEST_WITH_GUILE _TARGET _SOURCE_FILES TEST_INCLUDE_VAR_NAME TEST_LIBS_VAR_NAME)
+  GET_GUILE_ENV()
+  GNC_ADD_TEST(${_TARGET} "${_SOURCE_FILES}" "${TEST_INCLUDE_VAR_NAME}" "${TEST_LIBS_VAR_NAME}"
+    "${GUILE_ENV};${ARGN}"
+  )
+ENDFUNCTION()
+
+
+FUNCTION(GNC_ADD_SCHEME_TEST _TARGET _SOURCE_FILE)
+  SET(CMAKE_COMMAND_TMP "")
+  IF (${CMAKE_VERSION} VERSION_GREATER 3.1)
+    SET(CMAKE_COMMAND_TMP ${CMAKE_COMMAND} -E env)
+  ENDIF()
+  ADD_TEST(${_TARGET} ${CMAKE_COMMAND_TMP}
+    ${GUILE_EXECUTABLE} --debug -l ${CMAKE_CURRENT_SOURCE_DIR}/${_SOURCE_FILE} -c "(exit (run-test))"
+  )
+  GET_GUILE_ENV()
+  SET_TESTS_PROPERTIES(${_TARGET} PROPERTIES ENVIRONMENT "${GUILE_ENV};${ARGN}")
+ENDFUNCTION()
+
+FUNCTION(GNC_GTEST_CONFIGURE)
+  MESSAGE(STATUS "Checking for GTEST")
+  IF (NOT DEFINED ${GTEST_ROOT})
+    SET(GTEST_ROOT $ENV{GTEST_ROOT})
+  ENDIF()
+  IF (NOT DEFINED ${GMOCK_ROOT})
+    SET(GMOCK_ROOT $ENV{GMOCK_ROOT})
+  ENDIF()
+  FIND_PATH(GTEST_INCLUDE_DIR gtest/gtest.h
+    PATHS ${GTEST_ROOT}/include ${GMOCK_ROOT}/gtest/include /usr/include)
+  FIND_PATH(GTEST_SRC_DIR src/gtest-all.cc
+    PATHS ${GTEST_ROOT} ${GMOCK_ROOT}/gtest /usr/src/gtest)
+  FIND_LIBRARY(GTEST_SHARED_LIB gtest)
+  FIND_LIBRARY(GTEST_MAIN_LIB gtest_main)
+  IF ((GTEST_SHARED_LIB OR GTEST_SRC_DIR) AND GTEST_INCLUDE_DIR)
+    SET(THREADS_PREFER_PTHREAD_FLAG ON)
+    FIND_PACKAGE(Threads REQUIRED)
+    SET(GTEST_FOUND YES CACHE INTERNAL "Found GTest")
+    IF(GTEST_SHARED_LIB)
+      SET(GTEST_LIB "${GTEST_SHARED_LIB};${GTEST_MAIN_LIB}" PARENT_SCOPE)
+      UNSET(GTEST_SRC_DIR CACHE)
+    ELSE()
+      SET(GTEST_SRC "${GTEST_SRC_DIR}/src/gtest_main.cc" PARENT_SCOPE)
+      SET(GTEST_LIB "${CMAKE_BINARY_DIR}/common/test-core/libgtest.a" PARENT_SCOPE)
+    ENDIF()
+  ELSE()
+    MESSAGE(FATAL_ERROR "GTEST not found. Please install it or set GTEST_ROOT or GMOCK_ROOT")
+  ENDIF()
+
+  MESSAGE(STATUS "Checking for GMOCK")
+  FIND_PATH(GMOCK_INCLUDE_DIR gmock/gmock.h
+    PATHS ${GMOCK_ROOT}/include /usr/include)
+  unset(GMOCK_SRC_DIR CACHE)
+  FIND_PATH(GMOCK_SRC_DIR src/gmock-all.cc
+    PATHS ${GMOCK_ROOT} /usr/src/gmock)
+  if (GMOCK_SRC_DIR)
+    SET(GMOCK_MAIN_SRC_DIR "${GMOCK_SRC_DIR}/src")
+  else()
+    FIND_PATH(GMOCK_SRC_DIR gmock-all.cc
+      PATHS ${GMOCK_ROOT} /usr/src/gmock)
+    if (GMOCK_SRC_DIR)
+      SET(GMOCK_MAIN_SRC_DIR "${GMOCK_SRC_DIR}")
+    endif()
+  endif()
+  if (GMOCK_INCLUDE_DIR AND GMOCK_SRC_DIR)
+    SET(GMOCK_FOUND YES PARENT_SCOPE)
+    SET(GMOCK_SRC "${GMOCK_MAIN_SRC_DIR}/gmock-all.cc" PARENT_SCOPE)
+    SET(GMOCK_LIB "${CMAKE_BINARY_DIR}/common/test-core/libgmock.a" PARENT_SCOPE)
+  ELSE()
+    MESSAGE(FATAL_ERROR "GMOCK not found. Please install it or set GMOCK_ROOT")
+  ENDIF()
+ENDFUNCTION()
diff --git a/src/cmake_modules/GncConfigure.cmake b/common/cmake_modules/GncConfigure.cmake
similarity index 100%
rename from src/cmake_modules/GncConfigure.cmake
rename to common/cmake_modules/GncConfigure.cmake
diff --git a/src/cmake_modules/GncFindPkgConfig.cmake b/common/cmake_modules/GncFindPkgConfig.cmake
similarity index 100%
rename from src/cmake_modules/GncFindPkgConfig.cmake
rename to common/cmake_modules/GncFindPkgConfig.cmake
diff --git a/src/cmake_modules/MacroAddSourceFileCompileFlags.cmake b/common/cmake_modules/MacroAddSourceFileCompileFlags.cmake
similarity index 100%
rename from src/cmake_modules/MacroAddSourceFileCompileFlags.cmake
rename to common/cmake_modules/MacroAddSourceFileCompileFlags.cmake
diff --git a/src/cmake_modules/MacroAppendForeach.cmake b/common/cmake_modules/MacroAppendForeach.cmake
similarity index 100%
rename from src/cmake_modules/MacroAppendForeach.cmake
rename to common/cmake_modules/MacroAppendForeach.cmake
diff --git a/common/cmake_modules/MakeDist.cmake b/common/cmake_modules/MakeDist.cmake
new file mode 100644
index 0000000..a83965b
--- /dev/null
+++ b/common/cmake_modules/MakeDist.cmake
@@ -0,0 +1,207 @@
+# This file implements the process of making source distribution tarballs. It expects to find list in
+# 'dist_manifest.txt' of all of the files to be included in the distribution, EXCEPT those
+# files that are generated. The list of generated files is specified in MakeDistFiles.cmake in the
+# COPY_FROM_BUILD and COPY_FROM_BUILD_2 variables.
+#
+# Given all of these files, the procedure is to:
+# 1. Remove any existing dist directory and make a new one.
+# 2. Copy of all the files in dist_manifest.text, COPY_FROM_BUILD and COPY_FROM_BUILD_2
+#    into the dist directory.
+# 3. Run autogen.sh if build a dist from Git.
+# 4. Create the tarball and compress it with gzip and bzip2.
+# 5. Then remove the dist directory.
+
+include(${CMAKE_MODULE_PATH}/MakeDistFiles.cmake)
+
+FUNCTION(FIND_AUTOMAKE AUTOMAKE_VAR ACLOCAL_VAR AUTOMAKE_VERSION_VAR NEED_OVERRIDE_VAR)
+    FIND_PROGRAM(AUTOMAKE automake)
+    EXECUTE_PROCESS(
+            COMMAND ${AUTOMAKE} --version
+            RESULT_VARIABLE AUTOMAKE_RESULT
+            OUTPUT_VARIABLE AUTOMAKE_OUTPUT
+            ERROR_VARIABLE AUTOMAKE_ERROR
+    )
+
+    # GnuCash will not pass distcheck under automake 1.15+
+    # See if automake-1.11 is available. If so use, that
+    SET(AUTOMAKE_OK TRUE)
+    SET(NEED_OVERRIDE FALSE)
+    IF(${AUTOMAKE} STREQUAL AUTOMAKE-NOTFOUND)
+      SET(AUTOMAKE_OK FALSE)
+    ELSE()
+      STRING(REGEX REPLACE ".*automake \\(GNU automake\\) ([0-9]\\.[0-9]+).*" "\\1" AUTOMAKE_VERSION "${AUTOMAKE_OUTPUT}")
+
+      IF (${AUTOMAKE_VERSION} VERSION_GREATER "1.14")
+        SET(AUTOMAKE_OK FALSE)
+      ELSE()
+        FIND_PROGRAM(ACLOCAL aclocal)
+        IF(${ACLOCAL} STREQUAL ACLOCAL-NOTFOUND)
+            MESSAGE(FATAL_ERROR "Found ok version of automake, but can't find aclocal")
+        ENDIF()
+      ENDIF()
+    ENDIF()
+    IF (NOT AUTOMAKE_OK)
+        FIND_PROGRAM(AUTOMAKE11 automake-1.11)
+        IF (${AUTOMAKE11} STREQUAL AUTOMAKE11-NOTFOUND)
+            IF (${AUTOMAKE} STREQUAL AUTOMAKE-NOTFOUND)
+                MESSAGE(FATAL_ERROR "Can't find 'automake' or 'automake-1.11'")
+            ELSE()
+                MESSAGE("Automake is incompatible version 1.15+, but can't find automake-1.11")
+                MESSAGE("  You can set AUTOTOOLS_IN_DIST=OFF to exclude autotools support.")
+                MESSAGE(FATAL_ERROR "automake not compatible")
+            ENDIF()
+        ELSE()
+            SET(AUTOMAKE ${AUTOMAKE11})
+            SET(AUTOMAKE_VERSION 1.11)
+            SET(NEED_OVERRIDE TRUE)
+            FIND_PROGRAM(ACLOCAL aclocal-1.11)
+            IF(${ACLOCAL} STREQUAL ACLOCAL-NOTFOUND)
+                MESSAGE(FATAL_ERROR "Found automake-1.11, but not aclocal-1.11")
+            ENDIF()
+        ENDIF()
+    ENDIF()
+    SET(${AUTOMAKE_VAR} ${AUTOMAKE} PARENT_SCOPE)
+    SET(${ACLOCAL_VAR} ${ACLOCAL} PARENT_SCOPE)
+    SET(${AUTOMAKE_VERSION_VAR} ${AUTOMAKE_VERSION} PARENT_SCOPE)
+    SET(${NEED_OVERRIDE_VAR} ${NEED_OVERRIDE} PARENT_SCOPE)
+ENDFUNCTION()
+
+
+FUNCTION(MAKE_DIST PACKAGE_PREFIX GNUCASH_SOURCE_DIR BUILD_SOURCE_DIR BUILDING_FROM_VCS)
+
+    SET(CMAKE_COMMAND_TMP "")
+    IF (${CMAKE_VERSION} VERSION_GREATER 3.1)
+        SET(CMAKE_COMMAND_TMP ${CMAKE_COMMAND} -E env)
+    ENDIF()
+
+    # -- Remove any existing packaging directory.
+    FILE(REMOVE_RECURSE ${PACKAGE_PREFIX})
+
+    IF (EXISTS ${PACKAGE_PREFIX})
+        MESSAGE(FATAL_ERROR "Unable to remove existing dist directory \"${PACKAGE_PREFIX}\". Cannot continue.")
+    ENDIF()
+
+
+    # -- Copy in distributed files
+    IF(NOT EXISTS dist_manifest.txt)
+        message(FATAL_ERROR "Cannot find dist manifest: dist_manifest.txt")
+    ENDIF()
+
+    file(STRINGS dist_manifest.txt ALL_DIST)
+
+    FOREACH(file ${ALL_DIST})
+        IF(NOT EXISTS ${GNUCASH_SOURCE_DIR}/${file})
+            MESSAGE(FATAL_ERROR "Can't find dist file ${GNUCASH_SOURCE_DIR}/${file}")
+        ENDIF()
+        GET_FILENAME_COMPONENT(dir ${file} DIRECTORY)
+        FILE(MAKE_DIRECTORY ${PACKAGE_PREFIX}/${dir})
+        FILE(COPY ${GNUCASH_SOURCE_DIR}/${file} DESTINATION ${PACKAGE_PREFIX}/${dir})
+    ENDFOREACH()
+
+    # -- Copy in build products that are distributed.
+
+    FOREACH(file ${COPY_FROM_BUILD} ${COPY_FROM_BUILD_2})
+        EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E copy ${BUILD_SOURCE_DIR}/${file} ${PACKAGE_PREFIX}/${file})
+        IF (NOT EXISTS ${PACKAGE_PREFIX}/${file})
+            MESSAGE(FATAL_ERROR "Copy of ${BUILD_SOURCE_DIR}/${file} to dist dir '${PACKAGE_PREFIX}' failed.")
+        ENDIF()
+    ENDFOREACH()
+
+
+    CMAKE_POLICY(SET CMP0012 NEW)
+
+    IF (${BUILDING_FROM_VCS} AND AUTOTOOLS_IN_DIST)
+        FIND_AUTOMAKE(AUTOMAKE ACLOCAL AUTOMAKE_VERSION NEED_OVERRIDE)
+        # -- Run autogen.sh to cause Makefile.in files to be created.
+        SET(CMAKE_COMMAND_AUTOTOOLS ${SHELL} -c)
+        IF (${CMAKE_VERSION} VERSION_GREATER 3.1)
+            SET(CMAKE_COMMAND_AUTOTOOLS ${CMAKE_COMMAND} -E env)
+        ENDIF()
+        IF (${NEED_OVERRIDE})
+          EXECUTE_PROCESS(
+                  COMMAND ${CMAKE_COMMAND_AUTOTOOLS} AUTOMAKE=${AUTOMAKE} ACLOCAL=${ACLOCAL} ./autogen.sh
+                  WORKING_DIRECTORY ${PACKAGE_PREFIX}
+                  RESULT_VARIABLE AUTOGEN_RESULT
+                  OUTPUT_VARIABLE AUTOGEN_OUTPUT
+          )
+        ELSE()
+            EXECUTE_PROCESS(
+                    COMMAND ${CMAKE_COMMAND_AUTOTOOLS} ./autogen.sh
+                    WORKING_DIRECTORY ${PACKAGE_PREFIX}
+                    RESULT_VARIABLE AUTOGEN_RESULT
+                    OUTPUT_VARIABLE AUTOGEN_OUTPUT
+            )
+        ENDIF()
+        IF(NOT ${AUTOGEN_RESULT} STREQUAL "0")
+            MESSAGE(FATAL_ERROR "autogen.sh step failed: ${AUTOGEN_RESULT}")
+        ENDIF()
+        # -- Remove autogen files as they are not distributed.
+
+        FILE(REMOVE ${PACKAGE_PREFIX}/autogen.sh)
+        FILE(REMOVE_RECURSE ${PACKAGE_PREFIX}/autom4te.cache)
+
+        # -- Autogen.sh creates some files a symbolic links that we turn into real files here.
+
+        IF (UNIX) # No symbolic links on Windows
+            SET(LINKS missing config.guess COPYING depcomp INSTALL install-sh config.sub compile)
+            IF(${AUTOMAKE_VERSION} VERSION_GREATER 1.11)
+                LIST(APPEND LINKS test-driver)
+            ENDIF()
+            FOREACH(link ${LINKS})
+                GET_FILENAME_COMPONENT(realpath ${PACKAGE_PREFIX}/${link} REALPATH)
+                FILE(REMOVE ${PACKAGE_PREFIX}/${link})
+                FILE(COPY ${realpath} DESTINATION ${PACKAGE_PREFIX})
+            ENDFOREACH(link)
+
+            FOREACH(link libgnucash/doc/design/mdate-sh libgnucash/doc/design/texinfo.tex)
+                GET_FILENAME_COMPONENT(dir ${link} DIRECTORY)
+                GET_FILENAME_COMPONENT(realpath ${PACKAGE_PREFIX}/${link} REALPATH)
+                FILE(REMOVE ${PACKAGE_PREFIX}/${link})
+                FILE(COPY ${realpath} DESTINATION ${PACKAGE_PREFIX}/${dir})
+            ENDFOREACH(link)
+        ENDIF(UNIX)
+
+    ENDIF()
+
+    # -- Create the tarball.
+
+    EXECUTE_PROCESS_AND_CHECK_RESULT(
+            COMMAND ${CMAKE_COMMAND} -E tar cf ${PACKAGE_PREFIX}.tar ${PACKAGE_PREFIX}
+            WORKING_DIRECTORY .
+            ERROR_MSG "tar command to create ${PACKAGE_PREFIX}.tar failed."
+    )
+
+    # -- Compress the tarball with gzip
+    EXECUTE_PROCESS(
+        COMMAND ${CMAKE_COMMAND} -E copy ${PACKAGE_PREFIX}.tar ${PACKAGE_PREFIX}.tar.save
+    )
+    EXECUTE_PROCESS_AND_CHECK_RESULT(
+            COMMAND ${CMAKE_COMMAND_TMP} gzip -f ${PACKAGE_PREFIX}.tar
+            WORKING_DIRECTORY .
+            ERROR_MSG "gzip command to create ${PACKAGE_PREFIX}.tar.gz failed."
+    )
+
+    # -- Compress the tarball with bzip2
+    EXECUTE_PROCESS(
+        COMMAND ${CMAKE_COMMAND} -E rename ${PACKAGE_PREFIX}.tar.save ${PACKAGE_PREFIX}.tar
+    )
+    EXECUTE_PROCESS_AND_CHECK_RESULT(
+            COMMAND ${CMAKE_COMMAND_TMP} bzip2 -f ${PACKAGE_PREFIX}.tar
+            WORKING_DIRECTORY .
+            ERROR_MSG "bzip2 command to create ${PACKAGE_PREFIX}.tar.bz2 failed."
+    )
+
+    # -- Clean up packaging directory.
+
+    FILE(REMOVE_RECURSE ${PACKAGE_PREFIX})
+
+    IF(EXISTS ${PACKAGE_PREFIX})
+        MESSAGE(WARNING "Could not remove packaging directory '${PACKAGE_PREFIX}'")
+    ENDIF()
+
+    # -- All done.
+
+    MESSAGE("\n\nDistributions ${PACKAGE_PREFIX}.tar.gz and ${PACKAGE_PREFIX}.tar.bz2 created.\n\n")
+ENDFUNCTION()
+
+MAKE_DIST(${PACKAGE_PREFIX} ${GNUCASH_SOURCE_DIR} ${BUILD_SOURCE_DIR} ${BUILDING_FROM_VCS})
diff --git a/src/cmake_modules/MakeDistCheck.cmake b/common/cmake_modules/MakeDistCheck.cmake
similarity index 100%
rename from src/cmake_modules/MakeDistCheck.cmake
rename to common/cmake_modules/MakeDistCheck.cmake
diff --git a/common/cmake_modules/MakeDistFiles.cmake b/common/cmake_modules/MakeDistFiles.cmake
new file mode 100644
index 0000000..1c6dc9b
--- /dev/null
+++ b/common/cmake_modules/MakeDistFiles.cmake
@@ -0,0 +1,110 @@
+
+IF (${CMAKE_VERSION} VERSION_LESS 3.3)
+    INCLUDE(CMakeParseArguments)
+ENDIF()
+
+
+FUNCTION(SET_LOCAL_DIST output)
+    SET(dist_files "")
+    FOREACH(file ${ARGN})
+        FILE(RELATIVE_PATH relative ${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/${file})
+        LIST(APPEND dist_files ${relative})
+    ENDFOREACH()
+    SET (${output} ${dist_files} PARENT_SCOPE)
+ENDFUNCTION()
+
+MACRO(SET_DIST_LIST output)
+    SET_LOCAL_DIST(${output}_TMP ${ARGN})
+    SET(${output} ${${output}_TMP} PARENT_SCOPE)
+ENDMACRO()
+
+FUNCTION(EXECUTE_PROCESS_AND_CHECK_RESULT)
+    cmake_parse_arguments(VARS "" "WORKING_DIRECTORY;ERROR_MSG" "COMMAND" ${ARGN})
+    EXECUTE_PROCESS(
+            COMMAND ${VARS_COMMAND}
+            WORKING_DIRECTORY ${VARS_WORKING_DIRECTORY}
+            RESULT_VARIABLE RESULT
+    )
+    IF (NOT "${RESULT}" STREQUAL "0")
+        MESSAGE(FATAL_ERROR ${VARS_ERROR_MSG})
+    ENDIF()
+ENDFUNCTION()
+
+
+# This is a list of files generated at build time that
+# should be copied into the dist tarball. An item in
+# this list should be a file, not a directory or glob.
+# File in this list become dependenices of the 'dist'
+# target.
+
+
+SET(COPY_FROM_BUILD
+  ChangeLog
+  libgnucash/app-utils/migratable-prefs.xml
+  libgnucash/app-utils/swig-app-utils-guile.c
+  libgnucash/app-utils/swig-app-utils-python.c
+  libgnucash/app-utils/test/test-load-module
+  libgnucash/backend/xml/test/test-real-data.sh
+  gnucash/bin/gnucash.rc
+  gnucash/bin/overrides/gnucash-make-guids
+  gnucash/bin/test/test-version
+  libgnucash/core-utils/gnc-vcs-info.h
+  libgnucash/core-utils/swig-core-utils-guile.c
+  libgnucash/core-utils/swig-core-utils-python.c
+  libgnucash/doc/design/gnucash-design.info
+  libgnucash/engine/iso-4217-currencies.c
+  libgnucash/engine/swig-engine.c
+  libgnucash/engine/test/test-create-account
+  libgnucash/engine/test/test-scm-query-import
+  libgnucash/gnc-module/swig-gnc-module.c
+  libgnucash/gnc-module/test/mod-bar/swig-bar.c
+  libgnucash/gnc-module/test/mod-baz/swig-baz.c
+  libgnucash/gnc-module/test/mod-foo/swig-foo.c
+  libgnucash/gnc-module/test/test-gwrapped-c
+  libgnucash/gnc-module/test/test-load-deps
+  libgnucash/gnc-module/test/test-load-scm
+  libgnucash/gnc-module/test/test-scm-dynload
+  libgnucash/gnc-module/test/test-scm-init
+  libgnucash/gnc-module/test/test-scm-module
+  libgnucash/gnc-module/test/test-scm-multi
+  gnucash/gnome/gnucash.desktop.in
+  gnucash/gnome/swig-gnome.c
+  gnucash/gnome-utils/gnc-warnings.c
+  gnucash/gnome-utils/swig-gnome-utils.c
+  gnucash/gnome-utils/test/test-load-module
+  gnucash/html/swig-gnc-html.c
+  bindings/python/gnucash_core.c
+  gnucash/report/report-gnome/swig-report-gnome.c
+  gnucash/report/report-gnome/test/test-load-module
+  gnucash/report/report-system/swig-report-system.c
+  gnucash/report/report-system/test/test-load-module
+  gnucash/report/stylesheets/test/test-load-module
+  libgnucash/scm/build-config.scm
+  common/swig-runtime.h
+  common/test-core/swig-unittest-support-guile.c
+  common/test-core/swig-unittest-support-python.c
+)
+
+# This list is similiar to the COPY_FROM_BUILD list
+# above, except that we don't create an explicit
+# dependency on this for the 'dist' target. I need
+# to fix the creation of these files so that we
+# can add the as dependencies for 'dist'. These
+# file are not generated using CONFIGURE_FILE(),
+# so CMake does not realize these are generated files.
+
+# Items marked with GNC_CONFIGURE can be
+# properly generated when we drop autotools, because
+# then the source file can use the @XXX@ convention
+# instead of @-XXX-@
+
+SET(COPY_FROM_BUILD_2
+        doc/gnucash.1  # Uses GNC_CONFIGURE
+        packaging/gnucash.spec # Uses GNC_CONFIGURE
+        po/gnucash.pot
+        libgnucash/doc/design/stamp-vti
+        libgnucash/doc/design/version.texi
+        bindings/python/gnucash_core_c.py
+        common/test-core/unittest_support.py
+
+        )
diff --git a/src/config.h.cmake.in b/common/config.h.cmake.in
similarity index 100%
rename from src/config.h.cmake.in
rename to common/config.h.cmake.in
diff --git a/src/debug/CMakeLists.txt b/common/debug/CMakeLists.txt
similarity index 100%
rename from src/debug/CMakeLists.txt
rename to common/debug/CMakeLists.txt
diff --git a/src/debug/Makefile.am b/common/debug/Makefile.am
similarity index 100%
rename from src/debug/Makefile.am
rename to common/debug/Makefile.am
diff --git a/src/debug/splint-defs.h b/common/debug/splint-defs.h
similarity index 100%
rename from src/debug/splint-defs.h
rename to common/debug/splint-defs.h
diff --git a/src/debug/valgrind/CMakeLists.txt b/common/debug/valgrind/CMakeLists.txt
similarity index 100%
rename from src/debug/valgrind/CMakeLists.txt
rename to common/debug/valgrind/CMakeLists.txt
diff --git a/src/debug/valgrind/Makefile.am b/common/debug/valgrind/Makefile.am
similarity index 100%
rename from src/debug/valgrind/Makefile.am
rename to common/debug/valgrind/Makefile.am
diff --git a/src/debug/valgrind/valgrind-gdk.supp b/common/debug/valgrind/valgrind-gdk.supp
similarity index 100%
rename from src/debug/valgrind/valgrind-gdk.supp
rename to common/debug/valgrind/valgrind-gdk.supp
diff --git a/src/debug/valgrind/valgrind-glib.supp b/common/debug/valgrind/valgrind-glib.supp
similarity index 100%
rename from src/debug/valgrind/valgrind-glib.supp
rename to common/debug/valgrind/valgrind-glib.supp
diff --git a/src/debug/valgrind/valgrind-gnucash.supp b/common/debug/valgrind/valgrind-gnucash.supp
similarity index 100%
rename from src/debug/valgrind/valgrind-gnucash.supp
rename to common/debug/valgrind/valgrind-gnucash.supp
diff --git a/src/debug/valgrind/valgrind-libfontconfig.supp b/common/debug/valgrind/valgrind-libfontconfig.supp
similarity index 100%
rename from src/debug/valgrind/valgrind-libfontconfig.supp
rename to common/debug/valgrind/valgrind-libfontconfig.supp
diff --git a/src/debug/valgrind/valgrind-libgda.supp b/common/debug/valgrind/valgrind-libgda.supp
similarity index 100%
rename from src/debug/valgrind/valgrind-libgda.supp
rename to common/debug/valgrind/valgrind-libgda.supp
diff --git a/src/debug/valgrind/valgrind-libguile.supp b/common/debug/valgrind/valgrind-libguile.supp
similarity index 100%
rename from src/debug/valgrind/valgrind-libguile.supp
rename to common/debug/valgrind/valgrind-libguile.supp
diff --git a/src/debug/valgrind/valgrind-x11.supp b/common/debug/valgrind/valgrind-x11.supp
similarity index 100%
rename from src/debug/valgrind/valgrind-x11.supp
rename to common/debug/valgrind/valgrind-x11.supp
diff --git a/src/gnc-test-env.pl b/common/gnc-test-env.pl
similarity index 100%
rename from src/gnc-test-env.pl
rename to common/gnc-test-env.pl
diff --git a/src/guile-mappings.h b/common/guile-mappings.h
similarity index 100%
rename from src/guile-mappings.h
rename to common/guile-mappings.h
diff --git a/src/platform.h b/common/platform.h
similarity index 100%
rename from src/platform.h
rename to common/platform.h
diff --git a/src/swig-utf8.patch b/common/swig-utf8.patch
similarity index 100%
rename from src/swig-utf8.patch
rename to common/swig-utf8.patch
diff --git a/common/test-core/CMakeLists.txt b/common/test-core/CMakeLists.txt
new file mode 100644
index 0000000..70ccece
--- /dev/null
+++ b/common/test-core/CMakeLists.txt
@@ -0,0 +1,81 @@
+SET(test_core_SOURCES
+  test-stuff.c
+  unittest-support.c
+)
+
+SET(test_core_noinst_HEADERS
+  test-stuff.h
+  unittest-support.h
+)
+
+INCLUDE_DIRECTORIES(
+  ${CMAKE_BINARY_DIR}/common
+  ${CMAKE_SOURCE_DIR}/common
+  ${CMAKE_SOURCE_DIR}/libgnucash/engine
+  ${CMAKE_SOURCE_DIR}/common/test-core
+
+  ${GLIB2_INCLUDE_DIRS}
+  ${GUILE_INCLUDE_DIRS}
+)
+
+SET_DIST_LIST(test_core_DIST ${test_core_SOURCES} ${test_core_noinst_HEADERS} CMakeLists.txt
+        Makefile.am unittest-support.i unittest-support.scm)
+
+ADD_LIBRARY(test-core STATIC ${test_core_SOURCES} ${test_core_noinst_HEADERS})
+TARGET_LINK_LIBRARIES(test-core gncmod-engine ${GLIB2_LDFLAGS})
+IF (UNIX)
+  TARGET_COMPILE_OPTIONS(test-core PRIVATE -fPIC)
+ENDIF()
+
+IF (BUILDING_FROM_VCS)
+  SET (SWIG_UNITTEST_SUPPORT_GUILE_C ${CMAKE_CURRENT_BINARY_DIR}/swig-unittest-support-guile.c)
+  GNC_ADD_SWIG_COMMAND (swig-unittest-support-guile-c ${SWIG_UNITTEST_SUPPORT_GUILE_C}
+      ${CMAKE_CURRENT_SOURCE_DIR}/unittest-support.i ${test_core_HEADERS})
+  SET (SWIG_UNITTEST_SUPPORT_PYTHON_C ${CMAKE_CURRENT_BINARY_DIR}/swig-unittest-support-python.c)
+  GNC_ADD_SWIG_PYTHON_COMMAND (swig-unittest-support-python ${SWIG_UNITTEST_SUPPORT_PYTHON_C} ${CMAKE_CURRENT_SOURCE_DIR}/unittest-support.i)
+ELSE()
+  SET (SWIG_UNITTEST_SUPPORT_GUILE_C  swig-unittest-support-guile.c)
+  SET (SWIG_UNITTEST_SUPPORT_PYTHON_C swig-unittest-support-python.c)
+ENDIF()
+
+
+ADD_LIBRARY(test-core-guile ${SWIG_UNITTEST_SUPPORT_GUILE_C})
+TARGET_LINK_LIBRARIES(test-core-guile test-core ${GUILE_LDFLAGS} ${GLIB2_LDFLAGS})
+
+IF (WITH_PYTHON)
+  ADD_LIBRARY(unittest_support MODULE ${SWIG_UNITTEST_SUPPORT_PYTHON_C})
+  TARGET_LINK_LIBRARIES(unittest_support test-core ${PYTHON_LIBRARIES})
+  TARGET_INCLUDE_DIRECTORIES(unittest_support PRIVATE ${PYTHON_INCLUDE_DIRS})
+  SET_TARGET_PROPERTIES(unittest_support PROPERTIES PREFIX "_")
+ENDIF()
+
+SET(test_core_SCHEME unittest-support.scm)
+
+SET(GUILE_OUTPUT_DIR   gnucash)
+SET(GUILE_MODULES      "")
+SET(GUILE_LOAD_DIRS    "")
+SET(GUILE_LIBRARY_DIRS common/test-core libgnucash/engine)
+SET(GUILE_DEPENDS      test-core-guile)
+
+
+GNC_ADD_SCHEME_TARGETS(scm-test-core
+  ${test_core_SCHEME}
+  ${GUILE_OUTPUT_DIR}
+  "${GUILE_MODULES}"
+  "${GUILE_LOAD_DIRS}"
+  "${GUILE_LIBRARY_DIRS}"
+  "${GUILE_DEPENDS}"
+  FALSE
+  )
+
+IF(NOT GTEST_SHARED_LIB)
+  SET (lib_gtest_SOURCES ${GTEST_SRC_DIR}/src/gtest-all.cc)
+  ADD_LIBRARY(gtest STATIC  ${lib_gtest_SOURCES})
+  TARGET_INCLUDE_DIRECTORIES(gtest PUBLIC ${GTEST_INCLUDE_DIR} ${GTEST_SRC_DIR})
+ENDIF()
+SET (lib_gmock_SOURCES ${GMOCK_SRC})
+ADD_LIBRARY(gmock STATIC  ${lib_gmock_SOURCES})
+TARGET_INCLUDE_DIRECTORIES(gmock PUBLIC
+  ${GTEST_INCLUDE_DIR} ${GTEST_SRC_DIR}
+  ${GMOCK_INCLUDE_DIR} ${GMOCK_SRC_DIR})
+INSTALL(FILES unittest-support.h DESTINATION libexec/gnucash/libgnucash/engine/test)
diff --git a/common/test-core/Makefile.am b/common/test-core/Makefile.am
new file mode 100644
index 0000000..8b57f25
--- /dev/null
+++ b/common/test-core/Makefile.am
@@ -0,0 +1,144 @@
+noinst_LTLIBRARIES = libtest-core.la
+
+SWIG_FILES = \
+	unittest-support.i
+
+libtest_core_la_SOURCES = \
+	test-stuff.c \
+	unittest-support.c
+
+libtest_core_la_LIBADD = \
+  ${top_builddir}/libgnucash/engine/libgncmod-engine.la \
+  ${GLIB_LIBS}
+
+noinst_HEADERS = \
+	test-stuff.h \
+	unittest-support.h
+
+libtest_core_la_CPPFLAGS = \
+  -I${top_srcdir}/common \
+  -I${top_srcdir}/libgnucash/engine \
+  ${GLIB_CFLAGS}
+
+libtest_core_la_LDFLAGS = \
+  -rpath ${exec-prefix}/lib
+
+if BUILDING_FROM_VCS
+swig-unittest-support-guile.c: unittest-support.i $(top_srcdir)/common/base-typemaps.i
+	$(SWIG) -guile $(SWIG_ARGS) -Linkage module \
+	-I${top_srcdir}/common \
+	${AM_CPPFLAGS} -o $@ $<
+if ! OS_WIN32
+if ! SWIG_DIST_FAIL
+	if ! `grep "define scm_from_utf8_string" $@ > /dev/null 2>&1`; then \
+	  patch $@ $(top_srcdir)/common/swig-utf8.patch; \
+	fi
+endif
+endif
+
+swig-unittest-support-python.c: unittest-support.i $(top_srcdir)/common/base-typemaps.i
+	$(SWIG) -python  -Wall -Werror $(SWIG_ARGS) \
+	-I${top_srcdir}/common \
+	${AM_CPPFLAGS} -o $@ $<
+
+unittest-support.py: swig-unittest-support-python.c ${SWIG_FILES}
+endif
+noinst_LTLIBRARIES += libtest-core-guile.la
+libtest_core_guile_la_SOURCES = swig-unittest-support-guile.c
+libtest_core_guile_la_LIBADD = \
+  ${GUILE_LIBS} \
+  ${GLIB_LIBS} \
+  libtest-core.la
+
+libtest_core_guile_la_CFLAGS = \
+	${libtest_core_la_CPPFLAGS} \
+	${GUILE_CFLAGS} \
+	${AM_CFLAGS}
+
+libtest_core_guile_la_LDFLAGS = \
+  -rpath ${exec-prefix}/lib
+
+if WITH_PYTHON
+
+noinst_LTLIBRARIES += _unittest_support.la
+
+_unittest_support_la_SOURCES = \
+  swig-unittest-support-python.c
+_unittest_support_la_CFLAGS = \
+  ${libtest_core_la_CPPFLAGS} \
+  ${PYTHON_CPPFLAGS}
+_unittest_support_la_LDFLAGS = \
+  ${PYTHON_LDFLAGS} \
+  -module \
+  -rpath ${exec-prefix}/lib
+
+_unittest_support_la_LIBADD = \
+  ${PYTHON_LIBS} \
+  ${PYTHON_EXTRA_LIBS} \
+  libtest-core.la
+
+endif
+
+if GOOGLE_TEST_LIBS
+noinst_LIBRARIES = libgmock.a
+else
+noinst_LIBRARIES = \
+        libgtest.a \
+        libgmock.a
+nodist_libgtest_a_SOURCES = ${GTEST_SRC}/src/gtest-all.cc
+libgtest_a_CPPFLAGS = ${AM_CPPFLAGS} -I${GTEST_HEADERS} -I${GTEST_SRC}
+endif
+nodist_libgmock_a_SOURCES = ${GMOCK_SRC_PATH}/gmock-all.cc
+libgmock_a_CPPFLAGS = ${libgtest_a_CPPFLAGS} -I${GMOCK_HEADERS} -I${GMOCK_SRC}
+
+gncscmmoddir = ${GNC_SCM_INSTALL_DIR}/gnucash
+gncscmmod_DATA = unittest-support.scm
+
+SCM_FILES = $(gncscmmod_DATA)
+
+.scm-links:
+	$(RM) -rf gnucash
+	mkdir -p  gnucash
+if GNUCASH_SEPARATE_BUILDDIR
+	for X in ${SCM_FILES} ; do \
+	  $(LN_S) -f ${srcdir}/$$X . ; \
+	done
+endif
+	( cd gnucash; for A in $(gncscmmod_DATA) ; do $(LN_S) -f ../$$A . ; done )
+if ! OS_WIN32
+# Windows knows no "ln -s" but uses "cp": must copy every time (see bug #566567).
+	touch .scm-links
+endif
+
+if GNC_HAVE_GUILE_2
+GUILE_COMPILE_ENV = \
+  --library-dir    ${top_builddir}/common/test-core \
+  --library-dir    ${top_builddir}/libgnucash/engine
+
+%.go : %.scm .scm-links $(noinst_LTLIBRARIES)
+	GNC_UNINSTALLED=yes \
+	GNC_BUILDDIR=${top_builddir} \
+	$(shell ${abs_top_srcdir}/common/gnc-test-env.pl --noexports ${GUILE_COMPILE_ENV}) \
+	$(GUILD) compile -o $@ $<
+
+gncscmmodcachedir = ${pkglibdir}/scm/ccache/@GUILE_EFFECTIVE_VERSION@/gnucash
+gncscmmodcache_DATA = $(gncscmmod_DATA:.scm=.go)
+endif
+
+clean-local:
+	$(RM) -rf gnucash
+
+noinst_DATA = .scm-links
+CLEANFILES = .scm-links ${gncscmmodcache_DATA}
+
+EXTRA_DIST = \
+  $(SCM_FILES) \
+  swig-unittest-support-python.c \
+  swig-unittest-support-guile.c \
+  unittest_support.py \
+  unittest-support.i \
+  CMakeLists.txt
+
+MAINTAINERCLEANFILES = \
+	swig-unittest-support-guile.c \
+	swig-unittest-support-python.c
diff --git a/src/test-core/test-stuff.c b/common/test-core/test-stuff.c
similarity index 100%
rename from src/test-core/test-stuff.c
rename to common/test-core/test-stuff.c
diff --git a/src/test-core/test-stuff.h b/common/test-core/test-stuff.h
similarity index 100%
rename from src/test-core/test-stuff.h
rename to common/test-core/test-stuff.h
diff --git a/src/test-core/unittest-support.c b/common/test-core/unittest-support.c
similarity index 100%
rename from src/test-core/unittest-support.c
rename to common/test-core/unittest-support.c
diff --git a/src/test-core/unittest-support.h b/common/test-core/unittest-support.h
similarity index 100%
rename from src/test-core/unittest-support.h
rename to common/test-core/unittest-support.h
diff --git a/src/test-core/unittest-support.i b/common/test-core/unittest-support.i
similarity index 100%
rename from src/test-core/unittest-support.i
rename to common/test-core/unittest-support.i
diff --git a/src/test-core/unittest-support.scm b/common/test-core/unittest-support.scm
similarity index 100%
rename from src/test-core/unittest-support.scm
rename to common/test-core/unittest-support.scm
diff --git a/common/test-core/unittest_support.py b/common/test-core/unittest_support.py
new file mode 100644
index 0000000..cdf7ecf
--- /dev/null
+++ b/common/test-core/unittest_support.py
@@ -0,0 +1,166 @@
+# This file was automatically generated by SWIG (http://www.swig.org).
+# Version 3.0.10
+#
+# Do not make changes to this file unless you know what you are doing--modify
+# the SWIG interface file instead.
+
+
+
+
+
+from sys import version_info as _swig_python_version_info
+if _swig_python_version_info >= (2, 7, 0):
+    def swig_import_helper():
+        import importlib
+        pkg = __name__.rpartition('.')[0]
+        mname = '.'.join((pkg, '_unittest_support')).lstrip('.')
+        try:
+            return importlib.import_module(mname)
+        except ImportError:
+            return importlib.import_module('_unittest_support')
+    _unittest_support = swig_import_helper()
+    del swig_import_helper
+elif _swig_python_version_info >= (2, 6, 0):
+    def swig_import_helper():
+        from os.path import dirname
+        import imp
+        fp = None
+        try:
+            fp, pathname, description = imp.find_module('_unittest_support', [dirname(__file__)])
+        except ImportError:
+            import _unittest_support
+            return _unittest_support
+        if fp is not None:
+            try:
+                _mod = imp.load_module('_unittest_support', fp, pathname, description)
+            finally:
+                fp.close()
+            return _mod
+    _unittest_support = swig_import_helper()
+    del swig_import_helper
+else:
+    import _unittest_support
+del _swig_python_version_info
+try:
+    _swig_property = property
+except NameError:
+    pass  # Python < 2.2 doesn't have 'property'.
+
+try:
+    import builtins as __builtin__
+except ImportError:
+    import __builtin__
+
+def _swig_setattr_nondynamic(self, class_type, name, value, static=1):
+    if (name == "thisown"):
+        return self.this.own(value)
+    if (name == "this"):
+        if type(value).__name__ == 'SwigPyObject':
+            self.__dict__[name] = value
+            return
+    method = class_type.__swig_setmethods__.get(name, None)
+    if method:
+        return method(self, value)
+    if (not static):
+        if _newclass:
+            object.__setattr__(self, name, value)
+        else:
+            self.__dict__[name] = value
+    else:
+        raise AttributeError("You cannot add attributes to %s" % self)
+
+
+def _swig_setattr(self, class_type, name, value):
+    return _swig_setattr_nondynamic(self, class_type, name, value, 0)
+
+
+def _swig_getattr(self, class_type, name):
+    if (name == "thisown"):
+        return self.this.own()
+    method = class_type.__swig_getmethods__.get(name, None)
+    if method:
+        return method(self)
+    raise AttributeError("'%s' object has no attribute '%s'" % (class_type.__name__, name))
+
+
+def _swig_repr(self):
+    try:
+        strthis = "proxy of " + self.this.__repr__()
+    except __builtin__.Exception:
+        strthis = ""
+    return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
+
+try:
+    _object = object
+    _newclass = 1
+except __builtin__.Exception:
+    class _object:
+        pass
+    _newclass = 0
+
+class TestErrorStruct(_object):
+    __swig_setmethods__ = {}
+    __setattr__ = lambda self, name, value: _swig_setattr(self, TestErrorStruct, name, value)
+    __swig_getmethods__ = {}
+    __getattr__ = lambda self, name: _swig_getattr(self, TestErrorStruct, name)
+    __repr__ = _swig_repr
+    __swig_setmethods__["log_level"] = _unittest_support.TestErrorStruct_log_level_set
+    __swig_getmethods__["log_level"] = _unittest_support.TestErrorStruct_log_level_get
+    if _newclass:
+        log_level = _swig_property(_unittest_support.TestErrorStruct_log_level_get, _unittest_support.TestErrorStruct_log_level_set)
+    __swig_setmethods__["log_domain"] = _unittest_support.TestErrorStruct_log_domain_set
+    __swig_getmethods__["log_domain"] = _unittest_support.TestErrorStruct_log_domain_get
+    if _newclass:
+        log_domain = _swig_property(_unittest_support.TestErrorStruct_log_domain_get, _unittest_support.TestErrorStruct_log_domain_set)
+    __swig_setmethods__["msg"] = _unittest_support.TestErrorStruct_msg_set
+    __swig_getmethods__["msg"] = _unittest_support.TestErrorStruct_msg_get
+    if _newclass:
+        msg = _swig_property(_unittest_support.TestErrorStruct_msg_get, _unittest_support.TestErrorStruct_msg_set)
+
+    def __init__(self):
+        this = _unittest_support.new_TestErrorStruct()
+        try:
+            self.this.append(this)
+        except __builtin__.Exception:
+            self.this = this
+    __swig_destroy__ = _unittest_support.delete_TestErrorStruct
+    __del__ = lambda self: None
+TestErrorStruct_swigregister = _unittest_support.TestErrorStruct_swigregister
+TestErrorStruct_swigregister(TestErrorStruct)
+
+G_LOG_FLAG_RECURSION = _unittest_support.G_LOG_FLAG_RECURSION
+G_LOG_FLAG_FATAL = _unittest_support.G_LOG_FLAG_FATAL
+G_LOG_LEVEL_ERROR = _unittest_support.G_LOG_LEVEL_ERROR
+G_LOG_LEVEL_CRITICAL = _unittest_support.G_LOG_LEVEL_CRITICAL
+G_LOG_LEVEL_WARNING = _unittest_support.G_LOG_LEVEL_WARNING
+G_LOG_LEVEL_MESSAGE = _unittest_support.G_LOG_LEVEL_MESSAGE
+G_LOG_LEVEL_INFO = _unittest_support.G_LOG_LEVEL_INFO
+G_LOG_LEVEL_DEBUG = _unittest_support.G_LOG_LEVEL_DEBUG
+G_LOG_LEVEL_MASK = _unittest_support.G_LOG_LEVEL_MASK
+
+def test_add_error(error):
+    return _unittest_support.test_add_error(error)
+test_add_error = _unittest_support.test_add_error
+
+def test_clear_error_list():
+    return _unittest_support.test_clear_error_list()
+test_clear_error_list = _unittest_support.test_clear_error_list
+
+def test_set_checked_handler(domain, level, data):
+    return _unittest_support.test_set_checked_handler(domain, level, data)
+test_set_checked_handler = _unittest_support.test_set_checked_handler
+
+def test_set_list_handler(domain, level, data):
+    return _unittest_support.test_set_list_handler(domain, level, data)
+test_set_list_handler = _unittest_support.test_set_list_handler
+
+def test_set_null_handler(domain, level, data):
+    return _unittest_support.test_set_null_handler(domain, level, data)
+test_set_null_handler = _unittest_support.test_set_null_handler
+
+def g_log_remove_handler(log_domain, handler):
+    return _unittest_support.g_log_remove_handler(log_domain, handler)
+g_log_remove_handler = _unittest_support.g_log_remove_handler
+# This file is compatible with both classic and new-style classes.
+
+
diff --git a/configure.ac b/configure.ac
index 2e4354a..500c845 100644
--- a/configure.ac
+++ b/configure.ac
@@ -22,7 +22,7 @@ dnl Process this file with autoconf to produce a configure script.
 AC_PREREQ(2.60)
 AC_INIT([GnuCash], [2.6.99], [gnucash-devel at gnucash.org])
 AC_CONFIG_HEADERS(config.h)
-AC_CONFIG_SRCDIR(src/engine/Transaction.h)
+AC_CONFIG_SRCDIR(libgnucash/engine/Transaction.h)
 AC_CONFIG_MACRO_DIR([macros])
 
 #Change this in development versions when changing anything that
@@ -31,7 +31,7 @@ GNUCASH_NANO_VERSION=0
 #This should be the earliest version in the form XXMMUUNN (XX=MAJOR,
 #MM=MINOR, UU=MICRO, NN=NANO) or SVN revision if before 2.4.1 which is
 #storage-compatible with the current version. See the comments in
-#src/backend/dbi/gnc-backend-dbi.c:gnc_dbi_load.
+#libgnucash/backend/dbi/gnc-backend-dbi.c:gnc_dbi_load.
 GNUCASH_RESAVE_VERSION=19920
 # Initialize automake -- make sure we have at least version 1.9 Note:
 # Automake 1.14 & 1.15 issue a ton of warnings about subdir-objects, which
@@ -42,7 +42,7 @@ GNUCASH_RESAVE_VERSION=19920
 # http://lists.gnu.org/archive/html/automake/2014-04/msg00002.html and
 # http://debbugs.gnu.org/cgi/bugreport.cgi?bug=13928 for details.
 # In the meantime the best option is to use Automake 1.13 or earlier.
-AM_INIT_AUTOMAKE([1.9 dist-bzip2])
+AM_INIT_AUTOMAKE([1.9 tar-ustar dist-bzip2])
 
 # Parse out the version number
 GNUCASH_VERSION_STRING=AC_PACKAGE_VERSION
@@ -276,7 +276,7 @@ else
   VCS_TYPE=
 
   # Make sure we've got swig-runtime.h and gnc-vcs-info.h
-  AC_CHECK_FILE(${srcdir}/src/swig-runtime.h, [],
+  AC_CHECK_FILE(${srcdir}/common/swig-runtime.h, [],
     [AC_MSG_ERROR([
 
 It looks like you are NOT building from Subversion, svk, git or bzr
@@ -286,7 +286,7 @@ Either that or contact gnucash-devel at gnucash.org because
 the tarball you downloaded is broken.
 
     ])])
-  AC_CHECK_FILE(${srcdir}/src/core-utils/gnc-vcs-info.h, [],
+  AC_CHECK_FILE(${srcdir}/libgnucash/core-utils/gnc-vcs-info.h, [],
     [AC_MSG_ERROR([
 
 It looks like you are NOT building from Subversion, svk, git or bzr
@@ -941,7 +941,7 @@ if test "x$ac_cv_have_gtest_libs" = xyes; then
 else
 dnl Google test requires pthreads and this seems the easiest way to check.
     AX_PTHREAD([
-    ac_cv_gtest_libs="\$(top_builddir)/src/test-core/libgtest.a $PTHREAD_CFLAGS"
+    ac_cv_gtest_libs="\$(top_builddir)/common/test-core/libgtest.a $PTHREAD_CFLAGS"
     ],[
     AC_MSG_ERROR(
       [GTest requires pthreads, but this wasn't found.])
@@ -1000,7 +1000,7 @@ fi
 MIGRATABLE_PREFS_OFX="/dev/null"
 if test x${have_ofx} = xyes ; then
   _COMPONENTS="$_COMPONENTS ofx"
-  MIGRATABLE_PREFS_OFX="$srcdir/src/import-export/ofx/migratable-prefs-ofx.xml"
+  MIGRATABLE_PREFS_OFX="$srcdir/gnucash/import-export/ofx/migratable-prefs-ofx.xml"
 fi
 
 ofx_has_bug_39=no
@@ -1087,7 +1087,7 @@ then
   AC_SUBST(AQBANKING_LIBS)
   AC_SUBST(AQBANKING_CFLAGS)
   _COMPONENTS="$_COMPONENTS aqbanking"
-  MIGRATABLE_PREFS_AQBANKING="$srcdir/src/import-export/aqb/migratable-prefs-aqbanking.xml"
+  MIGRATABLE_PREFS_AQBANKING="$srcdir/gnucash/import-export/aqb/migratable-prefs-aqbanking.xml"
 fi
 AM_CONDITIONAL([WITH_AQBANKING], [test x${want_aqbanking} = xyes])
 AC_SUBST_FILE([MIGRATABLE_PREFS_AQBANKING])
@@ -1587,7 +1587,7 @@ AC_MSG_RESULT($warnFLAGS)
 ### makefiles, so that we don't have an opportunity to adjust them
 ### there.
 
-chmod u+x ${srcdir}/src/bin/generate-gnc-script
+chmod u+x ${srcdir}/gnucash/bin/generate-gnc-script
 
 ### --------------------------------------------------------------------------
 ### Makefile creation
@@ -1637,188 +1637,188 @@ AC_CONFIG_FILES(
   accounts/zh_CN/Makefile
   accounts/zh_HK/Makefile
   accounts/zh_TW/Makefile
+  bindings/Makefile
+  bindings/python/Makefile
+  bindings/python/tests/Makefile
   checks/Makefile
+  common/Makefile
+  common/debug/Makefile
+  common/debug/valgrind/Makefile
+  common/test-core/Makefile
   doc/Makefile
   doc/examples/Makefile
+  gnucash/Makefile
+  gnucash/bin/Makefile
+  gnucash/bin/overrides/Makefile
+  gnucash/bin/test/Makefile
+  gnucash/gnome/Makefile
+  gnucash/gnome/gtkbuilder/Makefile
+  gnucash/gnome/gschemas/Makefile
+  gnucash/gnome/ui/Makefile
+  gnucash/gnome-utils/Makefile
+  gnucash/gnome-utils/gtkbuilder/Makefile
+  gnucash/gnome-utils/gschemas/Makefile
+  gnucash/gnome-utils/test/Makefile
+  gnucash/gnome-utils/ui/Makefile
+  gnucash/gnome-search/Makefile
+  gnucash/html/Makefile
+  gnucash/import-export/Makefile
+  gnucash/import-export/test/Makefile
+  gnucash/import-export/ofx/gschemas/Makefile
+  gnucash/import-export/qif-imp/Makefile
+  gnucash/import-export/qif/Makefile
+  gnucash/import-export/qif/test/Makefile
+  gnucash/import-export/qif-imp/gschemas/Makefile
+  gnucash/import-export/qif-imp/test/Makefile
+  gnucash/import-export/gschemas/Makefile
+  gnucash/import-export/ofx/Makefile
+  gnucash/import-export/ofx/test/Makefile
+  gnucash/import-export/csv-imp/Makefile
+  gnucash/import-export/csv-imp/gschemas/Makefile
+  gnucash/import-export/csv-imp/test/Makefile
+  gnucash/import-export/csv-exp/Makefile
+  gnucash/import-export/csv-exp/gschemas/Makefile
+  gnucash/import-export/log-replay/Makefile
+  gnucash/import-export/aqb/Makefile
+  gnucash/import-export/aqb/gschemas/Makefile
+  gnucash/import-export/aqb/test/Makefile
+  gnucash/plugins/Makefile
+  gnucash/plugins/bi_import/Makefile
+  gnucash/plugins/bi_import/gtkbuilder/Makefile
+  gnucash/plugins/bi_import/ui/Makefile
+  gnucash/plugins/customer_import/Makefile
+  gnucash/plugins/customer_import/gtkbuilder/Makefile
+  gnucash/plugins/customer_import/ui/Makefile
+  gnucash/python/Makefile
+  gnucash/python/pycons/Makefile
+  gnucash/register/Makefile
+  gnucash/register/ledger-core/Makefile
+  gnucash/register/ledger-core/test/Makefile
+  gnucash/register/register-core/Makefile
+  gnucash/register/register-core/test/Makefile
+  gnucash/register/register-gnome/Makefile
+  gnucash/register/register-gnome/test/Makefile
+  gnucash/report/Makefile
+  gnucash/report/report-gnome/Makefile
+  gnucash/report/report-gnome/test/Makefile
+  gnucash/report/report-system/Makefile
+  gnucash/report/report-system/test/Makefile
+  gnucash/report/standard-reports/Makefile
+  gnucash/report/standard-reports/test/Makefile
+  gnucash/report/business-reports/Makefile
+  gnucash/report/locale-specific/Makefile
+  gnucash/report/locale-specific/us/Makefile
+  gnucash/report/locale-specific/us/test/Makefile
+  gnucash/report/stylesheets/Makefile
+  gnucash/report/stylesheets/test/Makefile
+  gnucash/report/utility-reports/Makefile
+  gnucash/report/jqplot/Makefile
   lib/Makefile
   lib/goffice/Makefile
   lib/libc/Makefile
+  libgnucash/Makefile
+  libgnucash/app-utils/Makefile
+  libgnucash/app-utils/test/Makefile
+  libgnucash/backend/Makefile
+  libgnucash/backend/dbi/Makefile
+  libgnucash/backend/dbi/test/Makefile
+  libgnucash/backend/xml/Makefile
+  libgnucash/backend/xml/test/Makefile
+  libgnucash/backend/xml/test/test-files/Makefile
+  libgnucash/backend/xml/test/test-files/xml2/Makefile
+  libgnucash/backend/sql/Makefile
+  libgnucash/backend/sql/test/Makefile
+  libgnucash/core-utils/Makefile
+  libgnucash/core-utils/test/Makefile
+  libgnucash/doc/Makefile
+  libgnucash/doc/design/Makefile
+  libgnucash/doc/xml/Makefile
+  libgnucash/engine/Makefile
+  libgnucash/engine/test/Makefile
+  libgnucash/engine/test-core/Makefile
+  libgnucash/gnc-module/Makefile
+  libgnucash/gnc-module/test/Makefile
+  libgnucash/gnc-module/test/mod-foo/Makefile
+  libgnucash/gnc-module/test/mod-bar/Makefile
+  libgnucash/gnc-module/test/mod-baz/Makefile
+  libgnucash/gnc-module/test/misc-mods/Makefile
+  libgnucash/pixmaps/Makefile
+  libgnucash/quotes/Makefile
+  libgnucash/scm/Makefile
+  libgnucash/scm/gnumeric/Makefile
+  libgnucash/tax/Makefile
+  libgnucash/tax/us/Makefile
+  libgnucash/tax/us/test/Makefile
   packaging/Makefile
-  src/Makefile
-  src/app-utils/Makefile
-  src/app-utils/test/Makefile
-  src/backend/Makefile
-  src/backend/dbi/Makefile
-  src/backend/dbi/test/Makefile
-  src/backend/xml/Makefile
-  src/backend/xml/test/Makefile
-  src/backend/xml/test/test-files/Makefile
-  src/backend/xml/test/test-files/xml2/Makefile
-  src/backend/sql/Makefile
-  src/backend/sql/test/Makefile
-  src/bin/Makefile
-  src/bin/overrides/Makefile
-  src/bin/test/Makefile
-  src/core-utils/Makefile
-  src/core-utils/test/Makefile
-  src/debug/Makefile
-  src/debug/valgrind/Makefile
-  src/doc/Makefile
-  src/doc/design/Makefile
-  src/doc/xml/Makefile
-  src/engine/Makefile
-  src/engine/test/Makefile
-  src/engine/test-core/Makefile
-  src/gnc-module/Makefile
-  src/gnc-module/test/Makefile
-  src/gnc-module/test/mod-foo/Makefile
-  src/gnc-module/test/mod-bar/Makefile
-  src/gnc-module/test/mod-baz/Makefile
-  src/gnc-module/test/misc-mods/Makefile
-  src/gnome/Makefile
-  src/gnome/gtkbuilder/Makefile
-  src/gnome/gschemas/Makefile
-  src/gnome/ui/Makefile
-  src/gnome-utils/Makefile
-  src/gnome-utils/gtkbuilder/Makefile
-  src/gnome-utils/gschemas/Makefile
-  src/gnome-utils/test/Makefile
-  src/gnome-utils/ui/Makefile
-  src/gnome-search/Makefile
-  src/html/Makefile
-  src/import-export/Makefile
-  src/import-export/test/Makefile
-  src/import-export/ofx/gschemas/Makefile
-  src/import-export/qif-imp/Makefile
-  src/import-export/qif/Makefile
-  src/import-export/qif/test/Makefile
-  src/import-export/qif-imp/gschemas/Makefile
-  src/import-export/qif-imp/test/Makefile
-  src/import-export/gschemas/Makefile
-  src/import-export/ofx/Makefile
-  src/import-export/ofx/test/Makefile
-  src/import-export/csv-imp/Makefile
-  src/import-export/csv-imp/gschemas/Makefile
-  src/import-export/csv-imp/test/Makefile
-  src/import-export/csv-exp/Makefile
-  src/import-export/csv-exp/gschemas/Makefile
-  src/import-export/log-replay/Makefile
-  src/import-export/aqb/Makefile
-  src/import-export/aqb/gschemas/Makefile
-  src/import-export/aqb/test/Makefile
-  src/optional/Makefile
-  src/optional/python-bindings/Makefile
-  src/optional/python-bindings/tests/Makefile
-  src/pixmaps/Makefile
-  src/python/Makefile
-  src/python/pycons/Makefile
-  src/quotes/Makefile
-  src/register/Makefile
-  src/register/ledger-core/Makefile
-  src/register/ledger-core/test/Makefile
-  src/register/register-core/Makefile
-  src/register/register-core/test/Makefile
-  src/register/register-gnome/Makefile
-  src/register/register-gnome/test/Makefile
-  src/report/Makefile
-  src/report/report-gnome/Makefile
-  src/report/report-gnome/test/Makefile
-  src/report/report-system/Makefile
-  src/report/report-system/test/Makefile
-  src/report/standard-reports/Makefile
-  src/report/standard-reports/test/Makefile
-  src/report/business-reports/Makefile
-  src/report/locale-specific/Makefile
-  src/report/locale-specific/us/Makefile
-  src/report/locale-specific/us/test/Makefile
-  src/report/stylesheets/Makefile
-  src/report/stylesheets/test/Makefile
-  src/report/utility-reports/Makefile
-  src/report/jqplot/Makefile
-  src/scm/Makefile
-  src/scm/gnumeric/Makefile
-  src/tax/Makefile
-  src/tax/us/Makefile
-  src/tax/us/test/Makefile
-  src/test-core/Makefile
-  dnl # Stuff for bill/invoice import plugin
-  src/plugins/Makefile
-  src/plugins/bi_import/Makefile
-  src/plugins/bi_import/gtkbuilder/Makefile
-  src/plugins/bi_import/ui/Makefile
-  dnl # Stuff for customer import.
-  src/plugins/customer_import/Makefile
-  src/plugins/customer_import/gtkbuilder/Makefile
-  src/plugins/customer_import/ui/Makefile
   dnl # non-makefiles
-  src/bin/gnucash.rc
-  src/app-utils/migratable-prefs.xml
-  src/gnome/gnucash.desktop.in
+  gnucash/bin/gnucash.rc
+  libgnucash/app-utils/migratable-prefs.xml
+  gnucash/gnome/gnucash.desktop.in
   dnl # GSettings schema files
-  src/gnome/gschemas/org.gnucash.dialogs.business.gschema.xml.in
-  src/gnome/gschemas/org.gnucash.dialogs.checkprinting.gschema.xml.in
-  src/gnome/gschemas/org.gnucash.dialogs.commodities.gschema.xml.in
-  src/gnome/gschemas/org.gnucash.dialogs.gschema.xml.in
-  src/gnome/gschemas/org.gnucash.dialogs.reconcile.gschema.xml.in
-  src/gnome/gschemas/org.gnucash.dialogs.sxs.gschema.xml.in
-  src/gnome/gschemas/org.gnucash.dialogs.totd.gschema.xml.in
-  src/gnome/gschemas/org.gnucash.gschema.xml.in
-  src/gnome/gschemas/org.gnucash.window.pages.account.tree.gschema.xml.in
-  src/gnome/gschemas/org.gnucash.window.pages.gschema.xml.in
-  src/gnome-utils/gschemas/org.gnucash.history.gschema.xml.in
-  src/gnome-utils/gschemas/org.gnucash.warnings.gschema.xml.in
-  src/import-export/aqb/gschemas/org.gnucash.dialogs.import.hbci.gschema.xml.in
-  src/import-export/csv-exp/gschemas/org.gnucash.dialogs.export.csv.gschema.xml.in
-  src/import-export/csv-imp/gschemas/org.gnucash.dialogs.import.csv.gschema.xml.in
-  src/import-export/gschemas/org.gnucash.dialogs.import.generic.gschema.xml.in
-  src/import-export/ofx/gschemas/org.gnucash.dialogs.import.ofx.gschema.xml.in
-  src/import-export/qif-imp/gschemas/org.gnucash.dialogs.import.qif.gschema.xml.in
+  gnucash/gnome/gschemas/org.gnucash.dialogs.business.gschema.xml.in
+  gnucash/gnome/gschemas/org.gnucash.dialogs.checkprinting.gschema.xml.in
+  gnucash/gnome/gschemas/org.gnucash.dialogs.commodities.gschema.xml.in
+  gnucash/gnome/gschemas/org.gnucash.dialogs.gschema.xml.in
+  gnucash/gnome/gschemas/org.gnucash.dialogs.reconcile.gschema.xml.in
+  gnucash/gnome/gschemas/org.gnucash.dialogs.sxs.gschema.xml.in
+  gnucash/gnome/gschemas/org.gnucash.dialogs.totd.gschema.xml.in
+  gnucash/gnome/gschemas/org.gnucash.gschema.xml.in
+  gnucash/gnome/gschemas/org.gnucash.window.pages.account.tree.gschema.xml.in
+  gnucash/gnome/gschemas/org.gnucash.window.pages.gschema.xml.in
+  gnucash/gnome-utils/gschemas/org.gnucash.history.gschema.xml.in
+  gnucash/gnome-utils/gschemas/org.gnucash.warnings.gschema.xml.in
+  gnucash/import-export/aqb/gschemas/org.gnucash.dialogs.import.hbci.gschema.xml.in
+  gnucash/import-export/csv-exp/gschemas/org.gnucash.dialogs.export.csv.gschema.xml.in
+  gnucash/import-export/csv-imp/gschemas/org.gnucash.dialogs.import.csv.gschema.xml.in
+  gnucash/import-export/gschemas/org.gnucash.dialogs.import.generic.gschema.xml.in
+  gnucash/import-export/ofx/gschemas/org.gnucash.dialogs.import.ofx.gschema.xml.in
+  gnucash/import-export/qif-imp/gschemas/org.gnucash.dialogs.import.qif.gschema.xml.in
   dnl # Please read doc/build-system before adding *anything* here
   ,
   dnl # init-commands go here
 )
 dnl # Shell scripts, to have their shells set
-AC_CONFIG_FILES([src/app-utils/test/test-load-module],
-                [chmod +x src/app-utils/test/test-load-module])
-AC_CONFIG_FILES([src/backend/xml/test/test-real-data.sh],
-                [chmod +x src/backend/xml/test/test-real-data.sh])
-AC_CONFIG_FILES([src/bin/test/test-version],
-                [chmod +x src/bin/test/test-version])
-AC_CONFIG_FILES([src/engine/test/test-create-account],
-                [chmod +x src/engine/test/test-create-account])
-AC_CONFIG_FILES([src/engine/test/test-scm-query-import],
-                [chmod +x src/engine/test/test-scm-query-import])
-AC_CONFIG_FILES([src/gnc-module/test/test-gwrapped-c],
-                [chmod +x src/gnc-module/test/test-gwrapped-c])
-AC_CONFIG_FILES([src/gnc-module/test/test-load-deps],
-                [chmod +x src/gnc-module/test/test-load-deps])
-AC_CONFIG_FILES([src/gnc-module/test/test-load-scm],
-                [chmod +x src/gnc-module/test/test-load-scm])
-AC_CONFIG_FILES([src/gnc-module/test/test-scm-dynload],
-                [chmod +x src/gnc-module/test/test-scm-dynload])
-AC_CONFIG_FILES([src/gnc-module/test/test-scm-init],
-                [chmod +x src/gnc-module/test/test-scm-init])
-AC_CONFIG_FILES([src/gnc-module/test/test-scm-module],
-                [chmod +x src/gnc-module/test/test-scm-module])
-AC_CONFIG_FILES([src/gnc-module/test/test-scm-multi],
-                [chmod +x src/gnc-module/test/test-scm-multi])
-AC_CONFIG_FILES([src/gnome-utils/test/test-load-module],
-                [chmod +x src/gnome-utils/test/test-load-module])
-AC_CONFIG_FILES([src/report/locale-specific/us/test/test-load-module],
-                [chmod +x src/report/locale-specific/us/test/test-load-module])
-AC_CONFIG_FILES([src/report/report-gnome/test/test-load-module],
-                [chmod +x src/report/report-gnome/test/test-load-module])
-AC_CONFIG_FILES([src/report/report-system/test/test-load-module],
-                [chmod +x src/report/report-system/test/test-load-module])
-AC_CONFIG_FILES([src/report/stylesheets/test/test-load-module],
-                [chmod +x src/report/stylesheets/test/test-load-module])
-AC_CONFIG_FILES([src/tax/us/test/test-load-module],
-                [chmod +x src/tax/us/test/test-load-module])
+AC_CONFIG_FILES([libgnucash/app-utils/test/test-load-module],
+                [chmod +x libgnucash/app-utils/test/test-load-module])
+AC_CONFIG_FILES([libgnucash/backend/xml/test/test-real-data.sh],
+                [chmod +x libgnucash/backend/xml/test/test-real-data.sh])
+AC_CONFIG_FILES([gnucash/bin/test/test-version],
+                [chmod +x gnucash/bin/test/test-version])
+AC_CONFIG_FILES([libgnucash/engine/test/test-create-account],
+                [chmod +x libgnucash/engine/test/test-create-account])
+AC_CONFIG_FILES([libgnucash/engine/test/test-scm-query-import],
+                [chmod +x libgnucash/engine/test/test-scm-query-import])
+AC_CONFIG_FILES([libgnucash/gnc-module/test/test-gwrapped-c],
+                [chmod +x libgnucash/gnc-module/test/test-gwrapped-c])
+AC_CONFIG_FILES([libgnucash/gnc-module/test/test-load-deps],
+                [chmod +x libgnucash/gnc-module/test/test-load-deps])
+AC_CONFIG_FILES([libgnucash/gnc-module/test/test-load-scm],
+                [chmod +x libgnucash/gnc-module/test/test-load-scm])
+AC_CONFIG_FILES([libgnucash/gnc-module/test/test-scm-dynload],
+                [chmod +x libgnucash/gnc-module/test/test-scm-dynload])
+AC_CONFIG_FILES([libgnucash/gnc-module/test/test-scm-init],
+                [chmod +x libgnucash/gnc-module/test/test-scm-init])
+AC_CONFIG_FILES([libgnucash/gnc-module/test/test-scm-module],
+                [chmod +x libgnucash/gnc-module/test/test-scm-module])
+AC_CONFIG_FILES([libgnucash/gnc-module/test/test-scm-multi],
+                [chmod +x libgnucash/gnc-module/test/test-scm-multi])
+AC_CONFIG_FILES([gnucash/gnome-utils/test/test-load-module],
+                [chmod +x gnucash/gnome-utils/test/test-load-module])
+AC_CONFIG_FILES([gnucash/report/locale-specific/us/test/test-load-module],
+                [chmod +x gnucash/report/locale-specific/us/test/test-load-module])
+AC_CONFIG_FILES([gnucash/report/report-gnome/test/test-load-module],
+                [chmod +x gnucash/report/report-gnome/test/test-load-module])
+AC_CONFIG_FILES([gnucash/report/report-system/test/test-load-module],
+                [chmod +x gnucash/report/report-system/test/test-load-module])
+AC_CONFIG_FILES([gnucash/report/stylesheets/test/test-load-module],
+                [chmod +x gnucash/report/stylesheets/test/test-load-module])
+AC_CONFIG_FILES([libgnucash/tax/us/test/test-load-module],
+                [chmod +x libgnucash/tax/us/test/test-load-module])
 
 # A few files need extra actions at creation time
-AC_CONFIG_FILES([src/bin/overrides/gnucash-make-guids], [chmod u+x src/bin/overrides/gnucash-make-guids])
+AC_CONFIG_FILES([gnucash/bin/overrides/gnucash-make-guids], [chmod u+x gnucash/bin/overrides/gnucash-make-guids])
 #Link (copy on Windows) test data files:
-AC_CONFIG_LINKS([src/import-export/csv-imp/test/sample1.csv:src/import-export/csv-imp/test/sample1.csv])
+AC_CONFIG_LINKS([gnucash/import-export/csv-imp/test/sample1.csv:gnucash/import-export/csv-imp/test/sample1.csv])
 LDFLAGS="${LDFLAGS} ${NOUNDEF}"
 AC_OUTPUT
 
diff --git a/gnucash/CMakeLists.txt b/gnucash/CMakeLists.txt
new file mode 100644
index 0000000..bd6353e
--- /dev/null
+++ b/gnucash/CMakeLists.txt
@@ -0,0 +1,21 @@
+# CMakeLists.txt for gnucash/
+
+# The subdirectories
+ADD_SUBDIRECTORY (bin)
+ADD_SUBDIRECTORY (gnome)
+ADD_SUBDIRECTORY (gnome-utils)
+ADD_SUBDIRECTORY (gnome-search)
+ADD_SUBDIRECTORY (html)
+ADD_SUBDIRECTORY (import-export)
+ADD_SUBDIRECTORY (plugins)
+ADD_SUBDIRECTORY (python)
+ADD_SUBDIRECTORY (register)
+ADD_SUBDIRECTORY(report)
+
+ADD_DEFINITIONS (-DHAVE_CONFIG_H)
+
+SET_LOCAL_DIST(gnucash_DIST_local CMakeLists.txt Makefile.am ${gnucash_EXTRA_DIST})
+
+SET(gnucash_DIST ${gnucash_DIST_local} ${bin_DIST} ${gnome_DIST} ${gnome_search_DIST}
+             ${gnome_utils_DIST} ${html_DIST} ${import_export_DIST} ${plugins_DIST} ${python_DIST}
+             ${register_DIST} ${report_DIST} PARENT_SCOPE)
diff --git a/gnucash/Makefile.am b/gnucash/Makefile.am
new file mode 100644
index 0000000..fd7b467
--- /dev/null
+++ b/gnucash/Makefile.am
@@ -0,0 +1,15 @@
+if WITH_PYTHON
+   PYTHON_DIR = python
+endif
+
+SUBDIRS = \
+  ${PYTHON_DIR} \
+  gnome-utils \
+  html \
+  gnome-search \
+  report \
+  register \
+  gnome \
+  import-export \
+  plugins \
+  bin
diff --git a/src/bin/CMakeLists.txt b/gnucash/bin/CMakeLists.txt
similarity index 100%
rename from src/bin/CMakeLists.txt
rename to gnucash/bin/CMakeLists.txt
diff --git a/gnucash/bin/Makefile.am b/gnucash/bin/Makefile.am
new file mode 100644
index 0000000..5bbbbed
--- /dev/null
+++ b/gnucash/bin/Makefile.am
@@ -0,0 +1,148 @@
+# Order is important here.
+if !PLATFORM_WIN32
+SUBDIRS = . overrides test
+else
+SUBDIRS = . test
+endif
+
+AM_CPPFLAGS = -I${top_builddir} ${GLIB_CFLAGS} ${GNOME_CFLAGS} ${GTK_CFLAGS} \
+  -DPKGSYSCONFDIR=\"${GNC_CONFIGDIR}\" \
+  -DPKGDATADIR=\"${GNC_SHAREDIR}\" \
+  -I${top_srcdir}/common \
+  -I${top_builddir}/common \
+  -I${top_srcdir}/libgnucash/core-utils \
+  -I${top_srcdir}/libgnucash/app-utils \
+  -I${top_srcdir}/gnucash/gnome-utils \
+  -I${top_srcdir}/libgnucash/engine \
+  -I${top_srcdir}/gnucash/gnome \
+  -I${top_builddir}/common \
+  -I${top_builddir}/libgnucash/core-utils \
+  -I${top_srcdir}/libgnucash/gnc-module \
+  -I${top_srcdir}/gnucash/report/report-system \
+  ${GUILE_CFLAGS} \
+  ${GTK_MAC_CFLAGS}
+
+SUFFIXES = .rc
+
+config_DATA = environment
+configdir = ${GNC_CONFIGDIR}
+
+# Some settings are platform dependent. Let's define them per platform.
+if PLATFORM_WIN32
+# Windows specific settings go here:
+GNUCASH_RESOURCE_FILE = gnucash.rc
+dist_noinst_DATA = gnucash.rc
+
+.rc.o:
+	$(AM_V_GEN)$(RC) -I${top_srcdir}/libgnucash/pixmaps -i '$<' --input-format=rc -o '$@' -O coff
+
+else !PLATFORM_WIN32
+# All other platforms use these settings:
+PLATFORM_FILES = gnucash-valgrind
+
+endif !PLATFORM_WIN32
+
+BIN_NAME = gnucash
+bin_PROGRAMS = ${BIN_NAME}
+gnucash_SOURCES = gnucash-bin.c ${GNUCASH_RESOURCE_FILE}
+gnucash_LDADD = \
+  ${top_builddir}/gnucash/register/ledger-core/libgncmod-ledger-core.la \
+  ${top_builddir}/gnucash/report/report-gnome/libgncmod-report-gnome.la \
+  ${top_builddir}/gnucash/gnome/libgnc-gnome.la \
+  ${top_builddir}/gnucash/gnome-utils/libgncmod-gnome-utils.la \
+  ${top_builddir}/libgnucash/app-utils/libgncmod-app-utils.la \
+  ${top_builddir}/libgnucash/engine/libgncmod-engine.la \
+  ${top_builddir}/libgnucash/gnc-module/libgnc-module.la \
+  ${top_builddir}/libgnucash/core-utils/libgnc-core-utils.la \
+  ${top_builddir}/gnucash/report/report-system/libgncmod-report-system.la \
+  ${GUILE_LIBS} \
+  ${GLIB_LIBS} \
+  ${GTK_LIBS}
+
+if WITH_GOOGLE_PROFILER
+gnucash_LDADD += -lprofiler
+endif
+
+GNUCASH_BIN_INSTALL_NAME=`echo ${BIN_NAME} | sed -e '$(transform)'`
+
+gnucash-valgrind: gnucash-valgrind.in ${top_builddir}/config.status Makefile
+	rm -f $@.tmp
+	sed < $< > $@.tmp \
+	    -e "s#@-TOP_SRC_DIR-@#${abs_top_srcdir}#g" \
+	    -e "s#@-GNUCASH_BIN_INSTALL_NAME-@#${GNUCASH_BIN_INSTALL_NAME}#g"
+	mv $@.tmp $@
+	chmod u+x $@
+
+environment: environment.in ${top_builddir}/config.status Makefile
+	rm -f $@.tmp
+	sed < $< > $@.tmp \
+	    -e '/@-NOTE.*-@/ D' \
+	    -e "s#@-GUILE_EFFECTIVE_VERSION-@#@GUILE_EFFECTIVE_VERSION@#g"
+if CUSTOM_GNC_DBD_DIR
+	echo 'GNC_DBD_DIR=@GNC_DBD_DIR@' >> $@.tmp
+endif
+    # Set XDG_DATA_DIRS if necessary.  The three components of the search path are the
+    # directory used by GnuCash, whatever was specified in the environment at run time, and
+    # the default value specified via configure.
+	if [ "a$(datadir)" != "a/usr/share" ] && [ "a$(datadir)" != "a/usr/local/share" ]; \
+	then \
+		echo >> $@.tmp; \
+		echo "# GnuCash was not installed in the default location" >> $@.tmp; \
+		echo "# XDG_DATA_DIRS will be set so that our documentation" >> $@.tmp; \
+		echo "# and gsettings schemas are found." >> $@.tmp; \
+		echo "XDG_DATA_DIRS=$(datadir);{XDG_DATA_DIRS};${GNC_SYSTEM_XDG_DATA_DIRS}" >> $@.tmp; \
+	fi
+if WITH_PYTHON
+	if [ "${PYTHON_SITE_PKG}" != "${pyexecdir}" ]; \
+	then \
+		echo  >> $@.tmp; \
+		echo "# Define PYTHONPATH for non default installation path." >> $@.tmp; \
+		echo "PYTHONPATH=${pyexecdir};{PYTHONPATH}" >> $@.tmp; \
+	fi
+endif
+	mv $@.tmp $@
+
+CLEANFILES = $(BUILT_SOURCES) ${config_DATA} ${PLATFORM_FILES}
+
+if !PLATFORM_WIN32
+# The gnucash scripts don't make sense on Windows, so will only be
+# generated and included on the other platforms.
+# We handle gnucash scripts in a somewhat unexpected way, but we do
+# this so that a user who doesn't necessarily have the right
+# directories in their path can still invoke these commands via their
+# full path, say /some/dir/not/in/path/gnucash and still have the
+# right thing happen (i.e. they'll still get the right guile, and the
+# right scripts if they sub-exec anything from their scripts).  If you
+# want to add another gnucash script, please add the name here (which
+# will cause the bindir wrapper to be created, and then put the actual
+# code in a script of the same name in ./overrides.  Oh, and don't
+# forget to add your script to configure.in's "Adjustments" section if
+# you need to.
+#
+# For testing and other reasons, overrides/* scripts should not modify
+# the path to re-insert the overrides dir.  This should only be done
+# by these top-level "common" scripts.
+gnc_common_scripts = gnucash-env gnucash-make-guids
+
+bin_SCRIPTS = \
+    ${gnc_common_scripts} \
+	${PLATFORM_FILES}
+
+# if you change gncoverridedir, make sure you change ./overrides/Makefile.am too.
+gncoverridesdir = ${GNC_LIBEXECDIR}/overrides
+
+## Gnucash scripts -- real code is in overrides, these just get you there.
+${gnc_common_scripts}: generate-gnc-script ${top_builddir}/config.status
+	${srcdir}/generate-gnc-script $@ "${gncoverridesdir}"
+
+CLEANFILES += ${gnc_common_scripts}
+
+endif
+
+EXTRA_DIST = \
+	generate-gnc-script \
+	gnucash-valgrind.in \
+	environment.in \
+	CMakeLists.txt
+
+AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.bin\"
diff --git a/src/bin/environment.in b/gnucash/bin/environment.in
similarity index 100%
rename from src/bin/environment.in
rename to gnucash/bin/environment.in
diff --git a/src/bin/generate-gnc-script b/gnucash/bin/generate-gnc-script
similarity index 100%
rename from src/bin/generate-gnc-script
rename to gnucash/bin/generate-gnc-script
diff --git a/gnucash/bin/gnucash-bin.c b/gnucash/bin/gnucash-bin.c
new file mode 100644
index 0000000..cea1f8b
--- /dev/null
+++ b/gnucash/bin/gnucash-bin.c
@@ -0,0 +1,819 @@
+/*
+ * gnucash-bin.c -- The program entry point for GnuCash
+ *
+ * Copyright (C) 2006 Chris Shoemaker <c.shoemaker at cox.net>
+ *
+ * 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 at gnu.org
+ */
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <libguile.h>
+#include <gtk/gtk.h>
+#include <glib/gi18n.h>
+#include "glib.h"
+#include "gnc-module.h"
+#include "gnc-path.h"
+#include "binreloc.h"
+#include "gnc-locale-utils.h"
+#include "gnc-version.h"
+#include "gnc-engine.h"
+#include "gnc-environment.h"
+#include "gnc-filepath-utils.h"
+#include "gnc-ui-util.h"
+#include "gnc-file.h"
+#include "gnc-hooks.h"
+#include "top-level.h"
+#include "gfec.h"
+#include "gnc-commodity.h"
+#include "gnc-prefs.h"
+#include "gnc-prefs-utils.h"
+#include "gnc-gsettings.h"
+#include "gnc-report.h"
+#include "gnc-main-window.h"
+#include "gnc-splash.h"
+#include "gnc-gnome-utils.h"
+#include "gnc-plugin-file-history.h"
+#include "dialog-new-user.h"
+#include "gnc-session.h"
+#include "engine-helpers-guile.h"
+#include "swig-runtime.h"
+
+/* This static indicates the debugging module that this .o belongs to.  */
+static QofLogModule log_module = GNC_MOD_GUI;
+
+#ifdef HAVE_GETTEXT
+#  include <libintl.h>
+#  include <locale.h>
+#endif
+
+#ifdef MAC_INTEGRATION
+#  include <Foundation/Foundation.h>
+#endif
+
+/* GNUCASH_SCM is defined whenever we're building from an svn/svk/git/bzr tree */
+#ifdef GNUCASH_SCM
+static int is_development_version = TRUE;
+#else
+static int is_development_version = FALSE;
+#define GNUCASH_SCM ""
+#endif
+
+/* Command-line option variables */
+static int          gnucash_show_version = 0;
+static int          debugging        = 0;
+static int          extra            = 0;
+static gchar      **log_flags        = NULL;
+static gchar       *log_to_filename  = NULL;
+static int          nofile           = 0;
+static const gchar *gsettings_prefix = NULL;
+static const char  *add_quotes_file  = NULL;
+static char        *namespace_regexp = NULL;
+static const char  *file_to_load     = NULL;
+static gchar      **args_remaining   = NULL;
+
+static GOptionEntry options[] =
+{
+    {
+        "version", 'v', 0, G_OPTION_ARG_NONE, &gnucash_show_version,
+        N_("Show GnuCash version"), NULL
+    },
+
+    {
+        "debug", '\0', 0, G_OPTION_ARG_NONE, &debugging,
+        N_("Enable debugging mode: provide deep detail in the logs.\nThis is equivalent to: --log \"=info\" --log \"qof=info\" --log \"gnc=info\""), NULL
+    },
+
+    {
+        "extra", '\0', 0, G_OPTION_ARG_NONE, &extra,
+        N_("Enable extra/development/debugging features."), NULL
+    },
+
+    {
+        "log", '\0', 0, G_OPTION_ARG_STRING_ARRAY, &log_flags,
+        N_("Log level overrides, of the form \"modulename={debug,info,warn,crit,error}\"\nExamples: \"--log qof=debug\" or \"--log gnc.backend.file.sx=info\"\nThis can be invoked multiple times."),
+        NULL
+    },
+
+    {
+        "logto", '\0', 0, G_OPTION_ARG_STRING, &log_to_filename,
+        N_("File to log into; defaults to \"/tmp/gnucash.trace\"; can be \"stderr\" or \"stdout\"."),
+        NULL
+    },
+
+    {
+        "nofile", '\0', 0, G_OPTION_ARG_NONE, &nofile,
+        N_("Do not load the last file opened"), NULL
+    },
+    {
+        "gsettings-prefix", '\0', 0, G_OPTION_ARG_STRING, &gsettings_prefix,
+        N_("Set the prefix for gsettings schemas for gsettings queries. This can be useful to have a different settings tree while debugging."),
+        /* Translators: Argument description for autohelp; see
+           http://developer.gnome.org/doc/API/2.0/glib/glib-Commandline-option-parser.html */
+        N_("GSETTINGSPREFIX")
+    },
+    {
+        "add-price-quotes", '\0', 0, G_OPTION_ARG_STRING, &add_quotes_file,
+        N_("Add price quotes to given GnuCash datafile"),
+        /* Translators: Argument description for autohelp; see
+           http://developer.gnome.org/doc/API/2.0/glib/glib-Commandline-option-parser.html */
+        N_("FILE")
+    },
+    {
+        "namespace", '\0', 0, G_OPTION_ARG_STRING, &namespace_regexp,
+        N_("Regular expression determining which namespace commodities will be retrieved"),
+        /* Translators: Argument description for autohelp; see
+           http://developer.gnome.org/doc/API/2.0/glib/glib-Commandline-option-parser.html */
+        N_("REGEXP")
+    },
+    {
+        G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_STRING_ARRAY, &args_remaining, NULL, N_("[datafile]") },
+    { NULL }
+};
+
+static void
+gnc_print_unstable_message(void)
+{
+    if (!is_development_version) return;
+
+    g_print("\n\n%s\n%s\n%s\n%s\n",
+            _("This is a development version. It may or may not work."),
+            _("Report bugs and other problems to gnucash-devel at gnucash.org"),
+            _("You can also lookup and file bug reports at http://bugzilla.gnome.org"),
+            _("To find the last stable version, please refer to http://www.gnucash.org"));
+}
+
+#ifdef MAC_INTEGRATION
+static void
+mac_set_currency_locale(NSLocale *locale, NSString *locale_str)
+{
+    /* If the currency doesn't match the base locale, we need to find a locale that does match, because setlocale won't know what to do with just a currency identifier. */
+    if (![[locale objectForKey: NSLocaleCurrencyCode] isEqualToString:
+	  [[[NSLocale alloc] initWithLocaleIdentifier: locale_str] objectForKey: NSLocaleCurrencyCode]]) {
+	NSArray *all_locales = [NSLocale availableLocaleIdentifiers];
+	NSEnumerator *locale_iter = [all_locales objectEnumerator];
+	NSString *this_locale;
+	NSString *currency = [locale objectForKey: NSLocaleCurrencyCode];
+	NSString *money_locale = nil;
+	while ((this_locale = (NSString*)[locale_iter nextObject]))
+	{
+	    NSLocale *templocale = [[NSLocale alloc]
+				    initWithLocaleIdentifier: this_locale];
+	    if ([[templocale objectForKey: NSLocaleCurrencyCode]
+		 isEqualToString: currency])
+	    {
+		money_locale = this_locale;
+		[templocale release];
+		break;
+	    }
+	    [templocale release];
+	}
+	if (money_locale)
+	    setlocale(LC_MONETARY, [money_locale UTF8String]);
+    }
+}
+/* The locale that we got from AppKit isn't a supported POSIX one, so we need to
+ * find something close. First see if we can find another locale for the
+ * country; failing that, try the language. Ultimately fall back on en_US.
+ */
+static NSString*
+mac_find_close_country(NSString *locale_str, NSString *country_str,
+                       NSString *lang_str)
+{
+    NSArray *all_locales = [NSLocale availableLocaleIdentifiers];
+    NSEnumerator *locale_iter = [all_locales objectEnumerator];
+    NSString *this_locale, *new_locale = nil;
+    PWARN("Apple Locale is set to a value %s not supported"
+          " by the C runtime", [locale_str UTF8String]);
+    while ((this_locale = (NSString*)[locale_iter nextObject]))
+        if ([[[NSLocale componentsFromLocaleIdentifier: this_locale]
+              objectForKey: NSLocaleCountryCode]
+             isEqualToString: country_str] &&
+            setlocale (LC_ALL, [this_locale UTF8String]))
+        {
+            new_locale = this_locale;
+            break;
+        }
+    if (new_locale)
+        locale_str = new_locale;
+    else
+        while ((this_locale = (NSString*)[locale_iter nextObject]))
+            if ([[[NSLocale componentsFromLocaleIdentifier: this_locale]
+                  objectForKey: NSLocaleLanguageCode]
+                 isEqualToString: lang_str] &&
+                setlocale (LC_ALL, [this_locale UTF8String]))
+            {
+                new_locale = this_locale;
+                break;
+            }
+    if (new_locale)
+        locale_str = new_locale;
+    else
+    {
+        locale_str = @"en_US";
+        setlocale(LC_ALL, [locale_str UTF8String]);
+    }
+    PWARN("Using %s instead.", [locale_str UTF8String]);
+    return locale_str;
+}
+
+/* Language subgroups (e.g., US English) are reported in the form "ll-SS"
+ * (e.g. again, "en-US"), not what gettext wants. We convert those to
+ * old-style locales, which is easy for most cases. There are two where it
+ * isn't, though: Simplified Chinese (zh-Hans) and traditional Chinese
+ * (zh-Hant), which are normally assigned the locales zh_CN and zh_TW,
+ * respectively. Those are handled specially.
+ */
+static NSString*
+mac_convert_complex_language(NSString* this_lang)
+{
+    NSArray *elements = [this_lang componentsSeparatedByString: @"-"];
+    if ([elements count] == 1)
+        return this_lang;
+    if ([[elements objectAtIndex: 0] isEqualToString: @"zh"]) {
+        if ([[elements objectAtIndex: 1] isEqualToString: @"Hans"])
+            this_lang = @"zh_CN";
+        else
+            this_lang = @"zh_TW";
+    }
+    else
+        this_lang = [elements componentsJoinedByString: @"_"];
+    return this_lang;
+}
+
+static void
+mac_set_languages(NSArray* languages, NSString *lang_str)
+{
+    /* Process the language list. */
+
+    const gchar *langs = NULL;
+    NSEnumerator *lang_iter = [languages objectEnumerator];
+    NSArray *new_languages = [NSArray array];
+    NSString *this_lang = NULL;
+    NSRange not_found = {NSNotFound, 0};
+    while ((this_lang = [lang_iter nextObject])) {
+        this_lang = [this_lang stringByTrimmingCharactersInSet:
+                     [NSCharacterSet characterSetWithCharactersInString: @"\""]];
+        this_lang = mac_convert_complex_language(this_lang);
+        new_languages = [new_languages arrayByAddingObject: this_lang];
+/* If it's an English language, add the "C" locale after it so that
+ * any messages can default to it */
+        if (!NSEqualRanges([this_lang rangeOfString: @"en"], not_found))
+            new_languages = [new_languages arrayByAddingObject: @"C"];
+        if (![new_languages containsObject: lang_str]) {
+            NSArray *temp_array = [NSArray arrayWithObject: lang_str];
+            new_languages = [temp_array arrayByAddingObjectsFromArray: new_languages];
+        }
+        langs = [[new_languages componentsJoinedByString:@":"] UTF8String];
+    }
+    if (langs && strlen(langs) > 0)
+    {
+        PWARN("Language list: %s", langs);
+        g_setenv("LANGUAGE", langs, TRUE);
+    }
+}
+
+static void
+set_mac_locale()
+{
+    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+    NSUserDefaults *defs = [NSUserDefaults standardUserDefaults];
+    NSLocale *locale = [NSLocale currentLocale];
+    NSString *lang_str, *country_str, *locale_str;
+    NSArray *languages = [[defs arrayForKey: @"AppleLanguages"] retain];
+    @try
+    {
+        lang_str = [locale objectForKey: NSLocaleLanguageCode];
+        country_str = [locale objectForKey: NSLocaleCountryCode];
+	locale_str = [[lang_str stringByAppendingString: @"_"]
+		      stringByAppendingString: country_str];
+    }
+    @catch (NSException *err)
+    {
+	PWARN("Locale detection raised error %s: %s. "
+	      "Check that your locale settings in "
+	      "System Preferences>Languages & Text are set correctly.",
+	      [[err name] UTF8String], [[err reason] UTF8String]);
+	locale_str = @"_";
+    }
+/* If we didn't get a valid current locale, the string will be just "_" */
+    if ([locale_str isEqualToString: @"_"])
+	locale_str = @"en_US";
+
+    lang_str = mac_convert_complex_language(lang_str);
+    if (!setlocale(LC_ALL, [locale_str UTF8String]))
+        locale_str =  mac_find_close_country(locale_str, country_str, lang_str);
+    if (g_getenv("LANG") == NULL)
+	g_setenv("LANG", [locale_str UTF8String], TRUE);
+    mac_set_currency_locale(locale, locale_str);
+/* Now call gnc_localeconv() to force creation of the app locale
+ * before another call to setlocale messes it up. */
+    gnc_localeconv ();
+    /* Process the languages, including the one from the Apple locale. */
+    if ([languages count] > 0)
+        mac_set_languages(languages, lang_str);
+    else
+        g_setenv("LANGUAGE", [lang_str UTF8String], TRUE);
+    [languages release];
+    [pool drain];
+}
+#endif /* MAC_INTEGRATION */
+
+static gboolean
+try_load_config_array(const gchar *fns[])
+{
+    gchar *filename;
+    int i;
+
+    for (i = 0; fns[i]; i++)
+    {
+        filename = gnc_build_dotgnucash_path(fns[i]);
+        if (gfec_try_load(filename))
+        {
+            g_free(filename);
+            return TRUE;
+        }
+        g_free(filename);
+    }
+    return FALSE;
+}
+
+static void
+update_message(const gchar *msg)
+{
+    gnc_update_splash_screen(msg, GNC_SPLASH_PERCENTAGE_UNKNOWN);
+    g_message("%s", msg);
+}
+
+static void
+load_system_config(void)
+{
+    static int is_system_config_loaded = FALSE;
+    gchar *system_config_dir;
+    gchar *system_config;
+
+    if (is_system_config_loaded) return;
+
+    update_message("loading system configuration");
+    system_config_dir = gnc_path_get_pkgsysconfdir();
+    system_config = g_build_filename(system_config_dir, "config", NULL);
+    is_system_config_loaded = gfec_try_load(system_config);
+    g_free(system_config_dir);
+    g_free(system_config);
+}
+
+static void
+load_user_config(void)
+{
+    /* Don't continue adding to this list. When 2.0 rolls around bump
+       the 1.4 (unnumbered) files off the list. */
+    static const gchar *user_config_files[] =
+    {
+        "config-2.0.user", "config-1.8.user", "config-1.6.user",
+        "config.user", NULL
+    };
+    static const gchar *auto_config_files[] =
+    {
+        "config-2.0.auto", "config-1.8.auto", "config-1.6.auto",
+        "config.auto", NULL
+    };
+    static const gchar *saved_report_files[] =
+    {
+        SAVED_REPORTS_FILE, SAVED_REPORTS_FILE_OLD_REV, NULL
+    };
+    static const gchar *stylesheet_files[] = { "stylesheets-2.0", NULL};
+    static int is_user_config_loaded = FALSE;
+
+    if (is_user_config_loaded)
+        return;
+    else is_user_config_loaded = TRUE;
+
+    update_message("loading user configuration");
+    try_load_config_array(user_config_files);
+    update_message("loading auto configuration");
+    try_load_config_array(auto_config_files);
+    update_message("loading saved reports");
+    try_load_config_array(saved_report_files);
+    update_message("loading stylesheets");
+    try_load_config_array(stylesheet_files);
+}
+
+/* Parse command line options, using GOption interface.
+ * We can't let gtk_init_with_args do it because it fails
+ * before parsing any arguments if the GUI can't be initialized.
+ */
+static void
+gnc_parse_command_line(int *argc, char ***argv)
+{
+
+    GError *error = NULL;
+    GOptionContext *context = g_option_context_new (_("- GnuCash personal and small business finance management"));
+
+    g_option_context_add_main_entries (context, options, GETTEXT_PACKAGE);
+    g_option_context_add_group (context, gtk_get_option_group(FALSE));
+    if (!g_option_context_parse (context, argc, argv, &error))
+    {
+        g_printerr (_("%s\nRun '%s --help' to see a full list of available command line options.\n"),
+                    error->message, *argv[0]);
+        g_error_free (error);
+        exit (1);
+    }
+    g_option_context_free (context);
+
+    if (gnucash_show_version)
+    {
+        gchar *fixed_message;
+
+        if (is_development_version)
+        {
+            fixed_message = g_strdup_printf(_("GnuCash %s development version"), VERSION);
+
+            /* Translators: 1st %s is a fixed message, which is translated independently;
+                            2nd %s is the scm type (svn/svk/git/bzr);
+                            3rd %s is the scm revision number;
+                            4th %s is the build date */
+            g_print ( _("%s\nThis copy was built from %s rev %s on %s."),
+                      fixed_message, GNUCASH_SCM, GNUCASH_SCM_REV,
+                      GNUCASH_BUILD_DATE );
+        }
+        else
+        {
+            fixed_message = g_strdup_printf(_("GnuCash %s"), VERSION);
+
+            /* Translators: 1st %s is a fixed message, which is translated independently;
+                            2nd %s is the scm (svn/svk/git/bzr) revision number;
+                            3rd %s is the build date */
+            g_print ( _("%s\nThis copy was built from rev %s on %s."),
+                      fixed_message, GNUCASH_SCM_REV, GNUCASH_BUILD_DATE );
+        }
+        g_print("\n");
+        g_free (fixed_message);
+        exit(0);
+    }
+
+    gnc_prefs_set_debugging(debugging);
+    gnc_prefs_set_extra(extra);
+
+    if (gsettings_prefix)
+        gnc_gsettings_set_prefix(g_strdup(gsettings_prefix));
+
+    if (namespace_regexp)
+        gnc_prefs_set_namespace_regexp(namespace_regexp);
+
+    if (args_remaining)
+        file_to_load = args_remaining[0];
+}
+
+static void
+load_gnucash_modules()
+{
+    int i, len;
+    struct
+    {
+        gchar * name;
+        int version;
+        gboolean optional;
+    } modules[] =
+    {
+        { "gnucash/app-utils", 0, FALSE },
+        { "gnucash/engine", 0, FALSE },
+        { "gnucash/register/ledger-core", 0, FALSE },
+        { "gnucash/register/register-core", 0, FALSE },
+        { "gnucash/register/register-gnome", 0, FALSE },
+        { "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 },
+        { "gnucash/import-export/log-replay", 0, TRUE },
+        { "gnucash/import-export/aqbanking", 0, TRUE },
+        { "gnucash/report/report-system", 0, FALSE },
+        { "gnucash/report/stylesheets", 0, FALSE },
+        { "gnucash/report/locale-specific/us", 0, FALSE },
+        { "gnucash/report/report-gnome", 0, FALSE },
+        { "gnucash/python", 0, TRUE },
+        { "gnucash/plugins/bi_import", 0, TRUE},
+        { "gnucash/plugins/customer_import", 0, TRUE},
+    };
+
+    /* module initializations go here */
+    len = sizeof(modules) / sizeof(*modules);
+    for (i = 0; i < len; i++)
+    {
+        DEBUG("Loading module %s started", modules[i].name);
+        gnc_update_splash_screen(modules[i].name, GNC_SPLASH_PERCENTAGE_UNKNOWN);
+        if (modules[i].optional)
+            gnc_module_load_optional(modules[i].name, modules[i].version);
+        else
+            gnc_module_load(modules[i].name, modules[i].version);
+        DEBUG("Loading module %s finished", modules[i].name);
+    }
+    if (!gnc_engine_is_initialized())
+    {
+        /* On Windows this check used to fail anyway, see
+         * https://lists.gnucash.org/pipermail/gnucash-devel/2006-September/018529.html
+         * but more recently it seems to work as expected
+         * again. 2006-12-20, cstim. */
+        g_warning("GnuCash engine failed to initialize.  Exiting.\n");
+        exit(1);
+    }
+}
+
+static void
+inner_main_add_price_quotes(void *closure, int argc, char **argv)
+{
+    SCM mod, add_quotes, scm_book, scm_result = SCM_BOOL_F;
+    QofSession *session = NULL;
+
+    scm_c_eval_string("(debug-set! stack 200000)");
+
+    mod = scm_c_resolve_module("gnucash price-quotes");
+    scm_set_current_module(mod);
+
+    /* Don't load the modules since the stylesheet module crashes if the
+       GUI is not initialized */
+#ifdef PRICE_QUOTES_NEED_MODULES
+    load_gnucash_modules();
+#endif
+    gnc_prefs_init ();
+    qof_event_suspend();
+    scm_c_eval_string("(gnc:price-quotes-install-sources)");
+
+    if (!gnc_quote_source_fq_installed())
+    {
+        g_print("%s", _("No quotes retrieved. Finance::Quote isn't "
+                        "installed properly.\n"));
+        goto fail;
+    }
+
+    add_quotes = scm_c_eval_string("gnc:book-add-quotes");
+    session = gnc_get_current_session();
+    if (!session) goto fail;
+
+    qof_session_begin(session, add_quotes_file, FALSE, FALSE, FALSE);
+    if (qof_session_get_error(session) != ERR_BACKEND_NO_ERR) goto fail;
+
+    qof_session_load(session, NULL);
+    if (qof_session_get_error(session) != ERR_BACKEND_NO_ERR) goto fail;
+
+    scm_book = gnc_book_to_scm(qof_session_get_book(session));
+    scm_result = scm_call_2(add_quotes, SCM_BOOL_F, scm_book);
+
+    qof_session_save(session, NULL);
+    if (qof_session_get_error(session) != ERR_BACKEND_NO_ERR) goto fail;
+
+    qof_session_destroy(session);
+    if (!scm_is_true(scm_result))
+    {
+        g_warning("Failed to add quotes to %s.", add_quotes_file);
+        goto fail;
+    }
+
+    qof_event_resume();
+    gnc_shutdown(0);
+    return;
+fail:
+    if (session && qof_session_get_error(session) != ERR_BACKEND_NO_ERR)
+        g_warning("Session Error: %s", qof_session_get_error_message(session));
+    qof_event_resume();
+    gnc_shutdown(1);
+}
+
+static char *
+get_file_to_load()
+{
+    if (file_to_load)
+        return g_strdup(file_to_load);
+    else
+        return gnc_history_get_last();
+}
+
+static void
+inner_main (void *closure, int argc, char **argv)
+{
+    SCM main_mod;
+    char* fn;
+
+    scm_c_eval_string("(debug-set! stack 200000)");
+
+    main_mod = scm_c_resolve_module("gnucash main");
+    scm_set_current_module(main_mod);
+
+    /* GnuCash switched to gsettings to store its preferences in version 2.5.6
+     * Migrate the user's preferences from gconf if needed */
+    gnc_gsettings_migrate_from_gconf();
+
+    load_gnucash_modules();
+
+    /* Load the config before starting up the gui. This insures that
+     * custom reports have been read into memory before the Reports
+     * menu is created. */
+    load_system_config();
+    load_user_config();
+
+    /* Setting-up the report menu must come after the module
+       loading but before the gui initialization. */
+    scm_c_use_module("gnucash report report-gnome");
+    scm_c_eval_string("(gnc:report-menu-setup)");
+
+    /* TODO: After some more guile-extraction, this should happen even
+       before booting guile.  */
+    gnc_main_gui_init();
+
+    gnc_hook_add_dangler(HOOK_UI_SHUTDOWN, (GFunc)gnc_file_quit, NULL);
+
+    /* Install Price Quote Sources */
+    gnc_update_splash_screen(_("Checking Finance::Quote..."), GNC_SPLASH_PERCENTAGE_UNKNOWN);
+    scm_c_use_module("gnucash price-quotes");
+    scm_c_eval_string("(gnc:price-quotes-install-sources)");
+
+    gnc_hook_run(HOOK_STARTUP, NULL);
+
+    if (!nofile && (fn = get_file_to_load()))
+    {
+        gnc_update_splash_screen(_("Loading data..."), GNC_SPLASH_PERCENTAGE_UNKNOWN);
+        gnc_file_open_file(fn, /*open_readonly*/ FALSE);
+        g_free(fn);
+    }
+    else if (gnc_prefs_get_bool(GNC_PREFS_GROUP_NEW_USER, GNC_PREF_FIRST_STARTUP))
+    {
+        gnc_destroy_splash_screen();
+        gnc_ui_new_user_dialog();
+    }
+    /* Ensure temporary preferences are temporary */
+    gnc_prefs_reset_group (GNC_PREFS_GROUP_WARNINGS_TEMP);
+
+    gnc_destroy_splash_screen();
+    gnc_main_window_show_all_windows();
+
+    gnc_hook_run(HOOK_UI_POST_STARTUP, NULL);
+    gnc_ui_start_event_loop();
+    gnc_hook_remove_dangler(HOOK_UI_SHUTDOWN, (GFunc)gnc_file_quit);
+
+    gnc_shutdown(0);
+    return;
+}
+
+static void
+gnc_log_init()
+{
+    if (log_to_filename != NULL)
+    {
+        qof_log_init_filename_special(log_to_filename);
+    }
+    else
+    {
+        /* initialize logging to our file. */
+        gchar *tracefilename;
+        tracefilename = g_build_filename(g_get_tmp_dir(), "gnucash.trace",
+                                         (gchar *)NULL);
+        qof_log_init_filename(tracefilename);
+        g_free(tracefilename);
+    }
+
+    // set a reasonable default.
+    qof_log_set_default(QOF_LOG_WARNING);
+
+    gnc_log_default();
+
+    if (gnc_prefs_is_debugging_enabled())
+    {
+        qof_log_set_level("", QOF_LOG_INFO);
+        qof_log_set_level("qof", QOF_LOG_INFO);
+        qof_log_set_level("gnc", QOF_LOG_INFO);
+    }
+
+    {
+        gchar *log_config_filename;
+        log_config_filename = gnc_build_dotgnucash_path("log.conf");
+        if (g_file_test(log_config_filename, G_FILE_TEST_EXISTS))
+            qof_log_parse_log_config(log_config_filename);
+        g_free(log_config_filename);
+    }
+
+    if (log_flags != NULL)
+    {
+        int i = 0;
+        for (; log_flags[i] != NULL; i++)
+        {
+            QofLogLevel level;
+            gchar **parts = NULL;
+
+            gchar *log_opt = log_flags[i];
+            parts = g_strsplit(log_opt, "=", 2);
+            if (parts == NULL || parts[0] == NULL || parts[1] == NULL)
+            {
+                g_warning("string [%s] not parseable", log_opt);
+                continue;
+            }
+
+            level = qof_log_level_from_string(parts[1]);
+            qof_log_set_level(parts[0], level);
+            g_strfreev(parts);
+        }
+    }
+}
+
+int
+main(int argc, char ** argv)
+{
+    gchar *sys_locale = NULL;
+#if !defined(G_THREADS_ENABLED) || defined(G_THREADS_IMPL_NONE)
+#    error "No GLib thread implementation available!"
+#endif
+#ifdef ENABLE_BINRELOC
+    {
+        GError *binreloc_error = NULL;
+        if (!gnc_gbr_init(&binreloc_error))
+        {
+            g_print("main: Error on gnc_gbr_init: %s\n", binreloc_error->message);
+            g_error_free(binreloc_error);
+        }
+    }
+#endif
+
+    /* This should be called before gettext is initialized
+     * The user may have configured a different language via
+     * the environment file.
+     */
+#ifdef MAC_INTEGRATION
+    set_mac_locale();
+#endif
+    gnc_environment_setup();
+#ifndef MAC_INTEGRATION /* setlocale already done */
+    sys_locale = g_strdup (setlocale (LC_ALL, ""));
+    if (!sys_locale)
+      {
+        g_print ("The locale defined in the environment isn't supported. "
+                 "Falling back to the 'C' (US English) locale\n");
+        g_setenv ("LC_ALL", "C", TRUE);
+        setlocale (LC_ALL, "C");
+      }
+#endif
+#ifdef HAVE_GETTEXT
+    {
+        gchar *localedir = gnc_path_get_localedir();
+        bindtextdomain(GETTEXT_PACKAGE, localedir);
+        textdomain(GETTEXT_PACKAGE);
+        bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
+        g_free(localedir);
+    }
+#endif
+    
+    gnc_parse_command_line(&argc, &argv);
+    gnc_print_unstable_message();
+
+    gnc_log_init();
+
+#ifndef MAC_INTEGRATION
+    /* Write some locale details to the log to simplify debugging
+     * To be on the safe side, only do this if not on OS X,
+     * to avoid unintentionally messing up the locale settings */
+    PINFO ("System locale returned %s", sys_locale ? sys_locale : "(null)");
+    PINFO ("Effective locale set to %s.", setlocale (LC_ALL, ""));
+    g_free (sys_locale);
+#endif
+
+    /* If asked via a command line parameter, fetch quotes only */
+    if (add_quotes_file)
+    {
+        /* First initialize the module system, even though gtk hasn't been initialized. */
+        gnc_module_system_init();
+        scm_boot_guile(argc, argv, inner_main_add_price_quotes, 0);
+        exit(0);  /* never reached */
+    }
+
+    /* We need to initialize gtk before looking up all modules */
+    if(!gtk_init_check (&argc, &argv))
+    {
+        g_printerr(_("%s\nRun '%s --help' to see a full list of available command line options.\n"),
+                   _("Error: could not initialize graphical user interface and option add-price-quotes was not set.\n"
+                     "       Perhaps you need to set the $DISPLAY environment variable ?"),
+                   argv[0]);
+        return 1;
+    }
+
+    /* Now the module files are looked up, which might cause some library
+    initialization to be run, hence gtk must be initialized beforehand. */
+    gnc_module_system_init();
+
+    gnc_gui_init();
+    scm_boot_guile(argc, argv, inner_main, 0);
+    exit(0); /* never reached */
+}
diff --git a/src/bin/gnucash-strip-svn-datafile.sh b/gnucash/bin/gnucash-strip-svn-datafile.sh
similarity index 100%
rename from src/bin/gnucash-strip-svn-datafile.sh
rename to gnucash/bin/gnucash-strip-svn-datafile.sh
diff --git a/src/bin/gnucash-valgrind.in b/gnucash/bin/gnucash-valgrind.in
similarity index 100%
rename from src/bin/gnucash-valgrind.in
rename to gnucash/bin/gnucash-valgrind.in
diff --git a/src/bin/gnucash.rc.in b/gnucash/bin/gnucash.rc.in
similarity index 100%
rename from src/bin/gnucash.rc.in
rename to gnucash/bin/gnucash.rc.in
diff --git a/src/bin/overrides/CMakeLists.txt b/gnucash/bin/overrides/CMakeLists.txt
similarity index 100%
rename from src/bin/overrides/CMakeLists.txt
rename to gnucash/bin/overrides/CMakeLists.txt
diff --git a/src/bin/overrides/Makefile.am b/gnucash/bin/overrides/Makefile.am
similarity index 100%
rename from src/bin/overrides/Makefile.am
rename to gnucash/bin/overrides/Makefile.am
diff --git a/gnucash/bin/overrides/gnucash-build-env.in b/gnucash/bin/overrides/gnucash-build-env.in
new file mode 100644
index 0000000..0a3fb65
--- /dev/null
+++ b/gnucash/bin/overrides/gnucash-build-env.in
@@ -0,0 +1,88 @@
+#!/bin/sh
+
+# Usage: gnucash-build-env
+
+# Usage: gnucash-build-env any-cmd [ args ... ]
+# runs any-cmd in gnucash's build environment.
+
+# As with all the other gnucash overrides scripts, expects PATH to be
+# set appropriately.
+
+top_srcdir="@-GNC_SRCDIR-@"
+top_builddir="@-GNC_BUILDDIR-@"
+
+if test "${GNC_CONFIG_PATH}"x = x
+then
+  GNC_CONFIG_PATH="(\"${top_srcdir}/libgnucash/scm\")"
+  export GNC_CONFIG_PATH
+fi
+
+if test "${GNC_SHARE_PATH}"x = x
+then
+  GNC_SHARE_PATH="(\"${top_srcdir}/libgnucash/scm\" \"${top_srcdir}/libgnucash/quotes\")"
+  export GNC_SHARE_PATH
+fi
+
+if test "${GNC_DOC_PATH}"x = x
+then
+  GNC_DOC_PATH="(\"${top_srcdir}/libgnucash/scm\")"
+  export GNC_DOC_PATH
+fi
+
+set +x
+eval `${top_srcdir}/common/gnc-test-env.pl \
+  --gnc-module-dir ${top_builddir}/libgnucash/engine \
+  --gnc-module-dir ${top_builddir}/libgnucash/tax/us \
+  --gnc-module-dir ${top_builddir}/libgnucash/app-utils \
+  --gnc-module-dir ${top_builddir}/gnucash/gnome-utils \
+  --gnc-module-dir ${top_builddir}/gnucash/gnome-search \
+  --gnc-module-dir ${top_builddir}/gnucash/import-export \
+  --gnc-module-dir ${top_builddir}/gnucash/import-export/hbci \
+  --gnc-module-dir ${top_builddir}/gnucash/import-export/log-replay \
+  --gnc-module-dir ${top_builddir}/gnucash/import-export/ofx \
+  --gnc-module-dir ${top_builddir}/gnucash/import-export/qif-import \
+  --gnc-module-dir ${top_builddir}/gnucash/report/locale-specific/us \
+  --gnc-module-dir ${top_builddir}/gnucash/report/report-gnome \
+  --gnc-module-dir ${top_builddir}/gnucash/report/stylesheets \
+  --gnc-module-dir ${top_builddir}/gnucash/register/register-core \
+  --gnc-module-dir ${top_builddir}/gnucash/register/register-gnome \
+  --gnc-module-dir ${top_builddir}/gnucash/register/ledger-core \
+\
+  --guile-load-dir ${top_builddir}/libgnucash/app-utils \
+  --guile-load-dir ${top_builddir}/libgnucash/core-utils \
+  --guile-load-dir ${top_builddir}/libgnucash/gnc-module \
+  --guile-load-dir ${top_builddir}/libgnucash/engine \
+  --guile-load-dir ${top_builddir}/libgnucash/scm \
+  --guile-load-dir ${top_builddir}/libgnucash/tax/us \
+  --guile-load-dir ${top_builddir}/gnucash/gnome-utils \
+  --guile-load-dir ${top_builddir}/gnucash/import-export/qif-import \
+  --guile-load-dir ${top_builddir}/gnucash/report/report-system \
+  --guile-load-dir ${top_builddir}/gnucash/report/standard-reports \
+  --guile-load-dir ${top_builddir}/gnucash/report/business-reports \
+  --guile-load-dir ${top_builddir}/gnucash/report/utility-reports \
+  --guile-load-dir ${top_builddir}/gnucash/report/locale-specific/us \
+  --guile-load-dir ${top_builddir}/gnucash/report/report-gnome \
+  --guile-load-dir ${top_builddir}/gnucash/report/stylesheets \
+\
+  --library-dir    ${top_builddir}/common/test-core \
+  --library-dir    ${top_builddir}/libgnucash/core-utils \
+  --library-dir    ${top_builddir}/libgnucash/app-utils \
+  --library-dir    ${top_builddir}/libgnucash/app-utils/calculation \
+  --library-dir    ${top_builddir}/libgnucash/engine \
+  --library-dir    ${top_builddir}/libgnucash/backend/xml \
+  --library-dir    ${top_builddir}/libgnucash/backend/sql  \
+  --library-dir    ${top_builddir}/libgnucash/gnc-module \
+  --library-dir    ${top_builddir}/gnucash/gnome \
+  --library-dir    ${top_builddir}/gnucash/gnome-search \
+  --library-dir    ${top_builddir}/gnucash/gnome-utils \
+  --library-dir    ${top_builddir}/gnucash/html \
+  --library-dir    ${top_builddir}/gnucash/import-export \
+  --library-dir    ${top_builddir}/gnucash/register/register-gnome \
+  --library-dir    ${top_builddir}/gnucash/register/ledger-core \
+  --library-dir    ${top_builddir}/gnucash/register/register-core \
+  --library-dir    ${top_builddir}/gnucash/report/report-gnome \
+  --library-dir    ${top_builddir}/gnucash/report/report-system
+  `
+LD_LIBRARY_PATH="${DYLD_LIBRARY_PATH}"
+
+exec "$@"
diff --git a/src/bin/overrides/gnucash-env.in b/gnucash/bin/overrides/gnucash-env.in
similarity index 100%
rename from src/bin/overrides/gnucash-env.in
rename to gnucash/bin/overrides/gnucash-env.in
diff --git a/src/bin/overrides/gnucash-make-guids.in b/gnucash/bin/overrides/gnucash-make-guids.in
similarity index 100%
rename from src/bin/overrides/gnucash-make-guids.in
rename to gnucash/bin/overrides/gnucash-make-guids.in
diff --git a/src/bin/overrides/guile.in b/gnucash/bin/overrides/guile.in
similarity index 100%
rename from src/bin/overrides/guile.in
rename to gnucash/bin/overrides/guile.in
diff --git a/src/bin/test/CMakeLists.txt b/gnucash/bin/test/CMakeLists.txt
similarity index 100%
rename from src/bin/test/CMakeLists.txt
rename to gnucash/bin/test/CMakeLists.txt
diff --git a/src/bin/test/Makefile.am b/gnucash/bin/test/Makefile.am
similarity index 100%
rename from src/bin/test/Makefile.am
rename to gnucash/bin/test/Makefile.am
diff --git a/src/bin/test/test-version.in b/gnucash/bin/test/test-version.in
similarity index 100%
rename from src/bin/test/test-version.in
rename to gnucash/bin/test/test-version.in
diff --git a/src/gnome-search/CMakeLists.txt b/gnucash/gnome-search/CMakeLists.txt
similarity index 100%
rename from src/gnome-search/CMakeLists.txt
rename to gnucash/gnome-search/CMakeLists.txt
diff --git a/gnucash/gnome-search/Makefile.am b/gnucash/gnome-search/Makefile.am
new file mode 100644
index 0000000..6dcae68
--- /dev/null
+++ b/gnucash/gnome-search/Makefile.am
@@ -0,0 +1,66 @@
+pkglib_LTLIBRARIES = libgncmod-gnome-search.la
+
+AM_CPPFLAGS = \
+  -I${top_srcdir}/common \
+  -I${top_srcdir}/libgnucash/core-utils \
+  -I${top_srcdir}/libgnucash/engine \
+  -I${top_srcdir}/libgnucash/app-utils \
+  -I${top_srcdir}/gnucash/gnome-utils \
+  -I${top_srcdir}/libgnucash/gnc-module \
+  ${GUILE_CFLAGS} \
+  ${GTK_CFLAGS} \
+  ${GLIB_CFLAGS}
+
+libgncmod_gnome_search_la_SOURCES = \
+  gncmod-gnome-search.c \
+  gnc-general-search.c \
+  dialog-search.c \
+  search-account.c \
+  search-boolean.c \
+  search-core-type.c \
+  search-core-utils.c \
+  search-date.c \
+  search-double.c \
+  search-int64.c \
+  search-numeric.c \
+  search-reconciled.c \
+  search-string.c
+
+gncincludedir = ${GNC_INCLUDE_DIR}
+gncinclude_HEADERS = \
+  dialog-search.h \
+  gnc-general-search.h
+
+noinst_HEADERS = \
+  search-account.h \
+  search-boolean.h \
+  search-core-type.h \
+  search-core-utils.h \
+  search-date.h \
+  search-double.h \
+  search-int64.h \
+  search-numeric.h \
+  search-reconciled.h \
+  search-string.h
+
+libgncmod_gnome_search_la_LDFLAGS = -avoid-version
+
+libgncmod_gnome_search_la_LIBADD = \
+  ${top_builddir}/gnucash/gnome-utils/libgncmod-gnome-utils.la \
+  ${top_builddir}/libgnucash/app-utils/libgncmod-app-utils.la \
+  ${top_builddir}/libgnucash/gnc-module/libgnc-module.la \
+  ${top_builddir}/libgnucash/core-utils/libgnc-core-utils.la \
+  ${top_builddir}/libgnucash/engine/libgncmod-engine.la \
+  ${GUILE_LIBS} \
+  ${GLIB_LIBS} \
+  ${REGEX_LIBS}
+
+gtkbuilderdir = $(GNC_GTKBUILDER_DIR)
+gtkbuilder_DATA = \
+  dialog-search.glade
+
+EXTRA_DIST = \
+  ${gtkbuilder_DATA} \
+  CMakeLists.txt
+
+AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.gui.search\"
diff --git a/src/gnome-search/dialog-search.c b/gnucash/gnome-search/dialog-search.c
similarity index 100%
rename from src/gnome-search/dialog-search.c
rename to gnucash/gnome-search/dialog-search.c
diff --git a/src/gnome-search/dialog-search.glade b/gnucash/gnome-search/dialog-search.glade
similarity index 100%
rename from src/gnome-search/dialog-search.glade
rename to gnucash/gnome-search/dialog-search.glade
diff --git a/src/gnome-search/dialog-search.h b/gnucash/gnome-search/dialog-search.h
similarity index 100%
rename from src/gnome-search/dialog-search.h
rename to gnucash/gnome-search/dialog-search.h
diff --git a/src/gnome-search/gnc-general-search.c b/gnucash/gnome-search/gnc-general-search.c
similarity index 100%
rename from src/gnome-search/gnc-general-search.c
rename to gnucash/gnome-search/gnc-general-search.c
diff --git a/src/gnome-search/gnc-general-search.h b/gnucash/gnome-search/gnc-general-search.h
similarity index 100%
rename from src/gnome-search/gnc-general-search.h
rename to gnucash/gnome-search/gnc-general-search.h
diff --git a/src/gnome-search/gncmod-gnome-search.c b/gnucash/gnome-search/gncmod-gnome-search.c
similarity index 100%
rename from src/gnome-search/gncmod-gnome-search.c
rename to gnucash/gnome-search/gncmod-gnome-search.c
diff --git a/src/gnome-search/search-account.c b/gnucash/gnome-search/search-account.c
similarity index 100%
rename from src/gnome-search/search-account.c
rename to gnucash/gnome-search/search-account.c
diff --git a/src/gnome-search/search-account.h b/gnucash/gnome-search/search-account.h
similarity index 100%
rename from src/gnome-search/search-account.h
rename to gnucash/gnome-search/search-account.h
diff --git a/src/gnome-search/search-boolean.c b/gnucash/gnome-search/search-boolean.c
similarity index 100%
rename from src/gnome-search/search-boolean.c
rename to gnucash/gnome-search/search-boolean.c
diff --git a/src/gnome-search/search-boolean.h b/gnucash/gnome-search/search-boolean.h
similarity index 100%
rename from src/gnome-search/search-boolean.h
rename to gnucash/gnome-search/search-boolean.h
diff --git a/src/gnome-search/search-core-type.c b/gnucash/gnome-search/search-core-type.c
similarity index 100%
rename from src/gnome-search/search-core-type.c
rename to gnucash/gnome-search/search-core-type.c
diff --git a/src/gnome-search/search-core-type.h b/gnucash/gnome-search/search-core-type.h
similarity index 100%
rename from src/gnome-search/search-core-type.h
rename to gnucash/gnome-search/search-core-type.h
diff --git a/src/gnome-search/search-core-utils.c b/gnucash/gnome-search/search-core-utils.c
similarity index 100%
rename from src/gnome-search/search-core-utils.c
rename to gnucash/gnome-search/search-core-utils.c
diff --git a/src/gnome-search/search-core-utils.h b/gnucash/gnome-search/search-core-utils.h
similarity index 100%
rename from src/gnome-search/search-core-utils.h
rename to gnucash/gnome-search/search-core-utils.h
diff --git a/src/gnome-search/search-date.c b/gnucash/gnome-search/search-date.c
similarity index 100%
rename from src/gnome-search/search-date.c
rename to gnucash/gnome-search/search-date.c
diff --git a/src/gnome-search/search-date.h b/gnucash/gnome-search/search-date.h
similarity index 100%
rename from src/gnome-search/search-date.h
rename to gnucash/gnome-search/search-date.h
diff --git a/src/gnome-search/search-double.c b/gnucash/gnome-search/search-double.c
similarity index 100%
rename from src/gnome-search/search-double.c
rename to gnucash/gnome-search/search-double.c
diff --git a/src/gnome-search/search-double.h b/gnucash/gnome-search/search-double.h
similarity index 100%
rename from src/gnome-search/search-double.h
rename to gnucash/gnome-search/search-double.h
diff --git a/src/gnome-search/search-int64.c b/gnucash/gnome-search/search-int64.c
similarity index 100%
rename from src/gnome-search/search-int64.c
rename to gnucash/gnome-search/search-int64.c
diff --git a/src/gnome-search/search-int64.h b/gnucash/gnome-search/search-int64.h
similarity index 100%
rename from src/gnome-search/search-int64.h
rename to gnucash/gnome-search/search-int64.h
diff --git a/src/gnome-search/search-numeric.c b/gnucash/gnome-search/search-numeric.c
similarity index 100%
rename from src/gnome-search/search-numeric.c
rename to gnucash/gnome-search/search-numeric.c
diff --git a/src/gnome-search/search-numeric.h b/gnucash/gnome-search/search-numeric.h
similarity index 100%
rename from src/gnome-search/search-numeric.h
rename to gnucash/gnome-search/search-numeric.h
diff --git a/src/gnome-search/search-reconciled.c b/gnucash/gnome-search/search-reconciled.c
similarity index 100%
rename from src/gnome-search/search-reconciled.c
rename to gnucash/gnome-search/search-reconciled.c
diff --git a/src/gnome-search/search-reconciled.h b/gnucash/gnome-search/search-reconciled.h
similarity index 100%
rename from src/gnome-search/search-reconciled.h
rename to gnucash/gnome-search/search-reconciled.h
diff --git a/src/gnome-search/search-string.c b/gnucash/gnome-search/search-string.c
similarity index 100%
rename from src/gnome-search/search-string.c
rename to gnucash/gnome-search/search-string.c
diff --git a/src/gnome-search/search-string.h b/gnucash/gnome-search/search-string.h
similarity index 100%
rename from src/gnome-search/search-string.h
rename to gnucash/gnome-search/search-string.h
diff --git a/gnucash/gnome-utils/CMakeLists.txt b/gnucash/gnome-utils/CMakeLists.txt
new file mode 100644
index 0000000..fd5043f
--- /dev/null
+++ b/gnucash/gnome-utils/CMakeLists.txt
@@ -0,0 +1,277 @@
+# Note that gnucash/gnome-utils CANNOT depend on gnucash/gnome!
+
+ADD_SUBDIRECTORY(gschemas)
+ADD_SUBDIRECTORY(gtkbuilder)
+ADD_SUBDIRECTORY(ui)
+ADD_SUBDIRECTORY(test)
+
+IF (BUILDING_FROM_VCS)
+  SET (SWIG_GNOME_UTILS_C ${CMAKE_CURRENT_BINARY_DIR}/swig-gnome-utils.c)
+  GNC_ADD_SWIG_COMMAND (swig-gnome-utils-c ${SWIG_GNOME_UTILS_C} ${CMAKE_CURRENT_SOURCE_DIR}/gnome-utils.i)
+ELSE()
+  SET (SWIG_GNOME_UTILS_C swig-gnome-utils.c)
+ENDIF()
+
+CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/gschemas/org.gnucash.warnings.gschema.xml.in.in
+               ${CMAKE_CURRENT_BINARY_DIR}/gschemas/org.gnucash.warnings.gschema.xml.in)
+
+SET (WARNINGS_SCHEMA gschemas/org.gnucash.warnings.gschema.xml.in)
+SET (GNC_WARNINGS_C ${CMAKE_CURRENT_BINARY_DIR}/gnc-warnings.c)
+SET (GNC_WARNINGS_H ${CMAKE_CURRENT_BINARY_DIR}/gnc-warnings.h)
+
+ADD_CUSTOM_COMMAND(
+  OUTPUT ${GNC_WARNINGS_C}
+  DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${WARNINGS_SCHEMA} make-gnc-warnings-c.xsl
+  COMMAND
+    ${LIBXSLT_XSLTPROC_EXECUTABLE} -o ${GNC_WARNINGS_C} ${CMAKE_CURRENT_SOURCE_DIR}/make-gnc-warnings-c.xsl ${CMAKE_CURRENT_BINARY_DIR}/${WARNINGS_SCHEMA}
+)
+ADD_CUSTOM_COMMAND(
+  OUTPUT ${GNC_WARNINGS_H}
+  DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${WARNINGS_SCHEMA} make-gnc-warnings-h.xsl
+  COMMAND
+    ${LIBXSLT_XSLTPROC_EXECUTABLE} -o ${GNC_WARNINGS_H} ${CMAKE_CURRENT_SOURCE_DIR}/make-gnc-warnings-h.xsl ${CMAKE_CURRENT_BINARY_DIR}/${WARNINGS_SCHEMA}
+)
+
+ADD_CUSTOM_TARGET(gnc-warnings-c DEPENDS ${GNC_WARNINGS_C})
+
+SET (gnome_utils_SOURCES
+  account-quickfill.c
+  assistant-xml-encoding.c
+  cursors.c
+  dialog-account.c
+  dialog-book-close.c
+  dialog-commodity.c
+  dialog-dup-trans.c
+  dialog-file-access.c
+  dialog-object-references.c
+  dialog-options.c
+  dialog-preferences.c
+  dialog-query-view.c
+  dialog-reset-warnings.c
+  dialog-tax-table.c
+  dialog-totd.c
+  dialog-transfer.c
+  dialog-userpass.c
+  dialog-utils.c
+  gnc-account-sel.c
+  gnc-amount-edit.c
+  gnc-autosave.c
+  gnc-cell-renderer-date.c
+  gnc-cell-renderer-popup.c
+  gnc-cell-renderer-popup-entry.c
+  gnc-combott.c
+  gnc-commodity-edit.c
+  gnc-currency-edit.c
+  gnc-date-delta.c
+  gnc-date-edit.c
+  gnc-date-format.c 
+  gnc-dense-cal.c
+  gnc-dense-cal-model.c
+  gnc-dense-cal-store.c
+  gnc-embedded-window.c
+  gnc-file.c
+  gnc-frequency.c
+  gnc-recurrence.c
+  gnc-general-select.c
+  gnc-gnome-utils.c
+  gnc-gobject-utils.c
+  gnc-gtk-utils.c
+  gnc-gui-query.c
+  gnc-icons.c
+  gnc-keyring.c
+  gnc-main-window.c
+  gnc-menu-extensions.c
+  gnc-plugin-file-history.c
+  gnc-plugin-manager.c
+  gnc-plugin-menu-additions.c
+  gnc-plugin-page.c
+  gnc-plugin.c
+  gnc-period-select.c
+  gnc-query-view.c
+  gnc-splash.c
+  gnc-sx-instance-dense-cal-adapter.c
+  gnc-sx-list-tree-model-adapter.c
+  gnc-tree-control-split-reg.c
+  gnc-tree-model.c
+  gnc-tree-model-account-types.c
+  gnc-tree-model-account.c
+  gnc-tree-model-budget.c
+  gnc-tree-model-owner.c
+  gnc-tree-model-commodity.c
+  gnc-tree-model-price.c
+  gnc-tree-model-split-reg.c
+  gnc-tree-util-split-reg.c
+  gnc-tree-view-account.c
+  gnc-tree-view-commodity.c
+  gnc-tree-view-owner.c
+  gnc-tree-view-price.c
+  gnc-tree-view-split-reg.c
+  gnc-tree-view-sx-list.c
+  gnc-tree-view.c
+  gnc-window.c
+  gncmod-gnome-utils.c
+  misc-gnome-utils.c
+  tree-view-utils.c
+  search-param.c
+  print-session.c
+  window-main-summarybar.c
+)
+
+SET(gnome_utils_noinst_HEADERS
+  dialog-tax-table.h
+  gnc-autosave.h
+  gnc-gobject-utils.h
+  gnc-gtk-utils.h
+  search-param.h
+)
+
+SET (gnome_utils_HEADERS
+  account-quickfill.h
+  assistant-xml-encoding.h
+  dialog-account.h
+  dialog-book-close.h
+  dialog-commodity.h
+  dialog-dup-trans.h
+  dialog-file-access.h
+  dialog-preferences.h
+  dialog-object-references.h
+  dialog-options.h
+  dialog-query-view.h
+  dialog-reset-warnings.h
+  dialog-totd.h
+  dialog-transfer.h
+  dialog-utils.h
+  gnc-account-sel.h
+  gnc-amount-edit.h
+  gnc-cell-renderer-date.h
+  gnc-cell-renderer-popup.h
+  gnc-cell-renderer-popup-entry.h
+  gnc-combott.h
+  gnc-commodity-edit.h
+  gnc-currency-edit.h
+  gnc-date-delta.h
+  gnc-date-edit.h
+  gnc-date-format.h
+  gnc-dense-cal.h
+  gnc-dense-cal-model.h
+  gnc-dense-cal-store.h
+  gnc-embedded-window.h
+  gnc-file.h
+  gnc-frequency.h
+  gnc-recurrence.h
+  gnc-general-select.h
+  gnc-gnome-utils.h
+  gnc-gui-query.h
+  gnc-icons.h
+  gnc-keyring.h
+  gnc-main-window.h
+  gnc-menu-extensions.h
+  gnc-plugin-file-history.h
+  gnc-plugin-manager.h
+  gnc-plugin-menu-additions.h
+  gnc-plugin-page.h
+  gnc-plugin.h
+  gnc-period-select.h
+  gnc-query-view.h
+  gnc-splash.h
+  gnc-sx-instance-dense-cal-adapter.h
+  gnc-sx-list-tree-model-adapter.h
+  gnc-tree-control-split-reg.h
+  gnc-tree-model.h
+  gnc-tree-model-account-types.h
+  gnc-tree-model-account.h
+  gnc-tree-model-budget.h
+  gnc-tree-model-owner.h
+  gnc-tree-model-commodity.h
+  gnc-tree-model-price.h
+  gnc-tree-model-split-reg.h
+  gnc-tree-util-split-reg.h
+  gnc-tree-view-account.h
+  gnc-tree-view-commodity.h
+  gnc-tree-view-owner.h
+  gnc-tree-view-price.h
+  gnc-tree-view-split-reg.h
+  gnc-tree-view-sx-list.h
+  gnc-tree-view.h
+  gnc-ui.h
+  gnc-window.h
+  misc-gnome-utils.h
+  tree-view-utils.h
+  print-session.h
+  window-main-summarybar.h
+)
+
+
+
+ADD_LIBRARY (gncmod-gnome-utils
+  ${gnome_utils_SOURCES}
+  ${gnome_utils_HEADERS}
+  ${GNC_WARNINGS_C} ${GNC_WARNINGS_H}
+  ${SWIG_GNOME_UTILS_C}
+  ${gnome_utils_noinst_HEADERS}
+)
+
+TARGET_LINK_LIBRARIES(gncmod-gnome-utils gncmod-app-utils gncmod-engine gnc-backend-xml-utils
+     ${GTK3_LDFLAGS} ${GTK_MAC_LDFLAGS})
+
+TARGET_COMPILE_DEFINITIONS(gncmod-gnome-utils PUBLIC ${GTK_MAC_CFLAGS_OTHER}
+    PRIVATE -DG_LOG_DOMAIN=\"gnc.gui\")
+
+IF (MAC_INTEGRATION)
+  TARGET_COMPILE_OPTIONS(gncmod-gnome-utils PRIVATE ${OSX_EXTRA_COMPILE_FLAGS})
+  TARGET_LINK_LIBRARIES(gncmod-gnome-utils ${OSX_EXTRA_LIBRARIES})
+ENDIF(MAC_INTEGRATION)
+
+TARGET_INCLUDE_DIRECTORIES(gncmod-gnome-utils
+    PUBLIC
+      ${GTK3_INCLUDE_DIRS}
+      ${CMAKE_CURRENT_SOURCE_DIR}
+    PRIVATE
+      ${GTK_MAC_INCLUDE_DIRS}
+      ${CMAKE_CURRENT_BINARY_DIR}
+)
+
+
+INSTALL(TARGETS gncmod-gnome-utils
+  LIBRARY DESTINATION lib/gnucash
+  ARCHIVE DESTINATION lib/gnucash
+  RUNTIME DESTINATION bin)
+
+INSTALL(FILES ${gnome_utils_HEADERS} DESTINATION include/gnucash)
+
+
+# Scheme
+
+SET(GUILE_MODULES      "")
+SET(GUILE_LOAD_DIRS    libgnucash/core-utils libgnucash/gnc-module libgnucash/scm)
+SET(GUILE_LIBRARY_DIRS libgnucash/core-utils libgnucash/gnc-module)
+SET(GUILE_DEPENDS      gncmod-gnome-utils scm-core-utils scm-gnc-module scm-scm)
+
+GNC_ADD_SCHEME_TARGETS(scm-gnome-utils-1
+  gnome-utils.scm
+  gnucash
+  "${GUILE_MODULES}"
+  "${GUILE_LOAD_DIRS}"
+  "${GUILE_LIBRARY_DIRS}"
+  "${GUILE_DEPENDS}"
+  FALSE
+)
+
+
+GNC_ADD_SCHEME_TARGETS(scm-gnome-utils-2
+  gnc-menu-extensions.scm
+  ""
+  "${GUILE_MODULES}"
+  "${GUILE_LOAD_DIRS}"
+  "${GUILE_LIBRARY_DIRS}"
+  "${GUILE_DEPENDS}"
+  FALSE
+)
+
+ADD_CUSTOM_TARGET(scm-gnome-utils ALL DEPENDS scm-gnome-utils-2 scm-gnome-utils-1)
+
+SET_LOCAL_DIST(gnome_utils_DIST_local CMakeLists.txt Makefile.am ${gnome_utils_SOURCES} ${gnome_utils_HEADERS}
+        ${gnome_utils_noinst_HEADERS} gnome-utils.scm gnome-utils.i gnc-menu-extensions.scm
+        make-gnc-warnings-c.xsl make-gnc-warnings-h.xsl)
+SET(gnome_utils_DIST ${gnome_utils_DIST_local} ${gnome_utils_gschema_DIST} ${test_gnome_utils_DIST}
+        ${gnome_utils_ui_DIST} ${gnome_utils_gtkbuilder_DIST} PARENT_SCOPE)
diff --git a/gnucash/gnome-utils/Makefile.am b/gnucash/gnome-utils/Makefile.am
new file mode 100644
index 0000000..d92bb93
--- /dev/null
+++ b/gnucash/gnome-utils/Makefile.am
@@ -0,0 +1,328 @@
+SUBDIRS = gtkbuilder gschemas . test ui
+
+pkglib_LTLIBRARIES = libgncmod-gnome-utils.la
+
+# Note that src/gnome-utils CANNOT depend on src/gnome!
+
+AM_CPPFLAGS = \
+  -I${top_srcdir}/libgnucash/core-utils \
+  -I${top_srcdir}/libgnucash/gnc-module \
+  -I${top_srcdir}/libgnucash/engine \
+  -I${top_srcdir}/libgnucash/backend/xml \
+  -I${top_srcdir}/libgnucash/app-utils \
+  -I${top_srcdir}/common \
+  -I${top_builddir}/common \
+  -I${top_builddir}/libgnucash/core-utils \
+  -I${top_srcdir}/lib/libc \
+  ${GLIB_CFLAGS} \
+  ${GTK_CFLAGS} \
+  ${GNOME_KEYRING_CFLAGS} \
+  ${LIBSECRET_CFLAGS} \
+  ${GUILE_CFLAGS} \
+  ${LIBGDA_CFLAGS} \
+  ${LIBXML2_CFLAGS} \
+  ${GTK_MAC_CFLAGS}
+
+libgncmod_gnome_utils_la_SOURCES = \
+  account-quickfill.c \
+  assistant-xml-encoding.c \
+  cursors.c \
+  dialog-account.c \
+  dialog-book-close.c \
+  dialog-commodity.c \
+  dialog-dup-trans.c \
+  dialog-file-access.c \
+  dialog-object-references.c \
+  dialog-options.c \
+  dialog-preferences.c \
+  dialog-query-view.c \
+  dialog-reset-warnings.c \
+  dialog-tax-table.c \
+  dialog-totd.c \
+  dialog-transfer.c \
+  dialog-userpass.c \
+  dialog-utils.c \
+  gnc-account-sel.c \
+  gnc-amount-edit.c \
+  gnc-autosave.c \
+  gnc-cell-renderer-date.c \
+  gnc-cell-renderer-popup.c \
+  gnc-cell-renderer-popup-entry.c \
+  gnc-combott.c \
+  gnc-commodity-edit.c \
+  gnc-currency-edit.c \
+  gnc-date-delta.c \
+  gnc-date-edit.c \
+  gnc-date-format.c \
+  gnc-dense-cal.c \
+  gnc-dense-cal-model.c \
+  gnc-dense-cal-store.c \
+  gnc-embedded-window.c \
+  gnc-file.c \
+  gnc-frequency.c \
+  gnc-recurrence.c \
+  gnc-general-select.c \
+  gnc-gnome-utils.c \
+  gnc-gobject-utils.c \
+  gnc-gtk-utils.c \
+  gnc-gui-query.c \
+  gnc-icons.c \
+  gnc-keyring.c \
+  gnc-main-window.c \
+  gnc-menu-extensions.c \
+  gnc-plugin-file-history.c \
+  gnc-plugin-manager.c \
+  gnc-plugin-menu-additions.c \
+  gnc-plugin-page.c \
+  gnc-plugin.c \
+  gnc-period-select.c \
+  gnc-query-view.c \
+  gnc-splash.c \
+  gnc-sx-instance-dense-cal-adapter.c \
+  gnc-sx-list-tree-model-adapter.c \
+  gnc-tree-control-split-reg.c \
+  gnc-tree-model.c \
+  gnc-tree-model-account-types.c \
+  gnc-tree-model-account.c \
+  gnc-tree-model-budget.c \
+  gnc-tree-model-owner.c \
+  gnc-tree-model-commodity.c \
+  gnc-tree-model-price.c \
+  gnc-tree-model-split-reg.c \
+  gnc-tree-util-split-reg.c \
+  gnc-tree-view-account.c \
+  gnc-tree-view-commodity.c \
+  gnc-tree-view-owner.c \
+  gnc-tree-view-price.c \
+  gnc-tree-view-split-reg.c \
+  gnc-tree-view-sx-list.c \
+  gnc-tree-view.c \
+  gnc-warnings.c \
+  gnc-window.c \
+  gncmod-gnome-utils.c \
+  misc-gnome-utils.c \
+  tree-view-utils.c \
+  search-param.c \
+  print-session.c \
+  swig-gnome-utils.c \
+  window-main-summarybar.c
+
+gncincludedir = ${GNC_INCLUDE_DIR}
+gncinclude_HEADERS = \
+  account-quickfill.h \
+  assistant-xml-encoding.h \
+  dialog-account.h \
+  dialog-book-close.h \
+  dialog-commodity.h \
+  dialog-dup-trans.h \
+  dialog-file-access.h \
+  dialog-preferences.h \
+  dialog-object-references.h \
+  dialog-options.h \
+  dialog-query-view.h \
+  dialog-reset-warnings.h \
+  dialog-totd.h \
+  dialog-transfer.h \
+  dialog-utils.h \
+  gnc-account-sel.h \
+  gnc-amount-edit.h \
+  gnc-cell-renderer-date.h \
+  gnc-cell-renderer-popup.h \
+  gnc-cell-renderer-popup-entry.h \
+  gnc-combott.h \
+  gnc-commodity-edit.h \
+  gnc-currency-edit.h \
+  gnc-date-delta.h \
+  gnc-date-edit.h \
+  gnc-date-format.h \
+  gnc-dense-cal.h \
+  gnc-dense-cal-model.h \
+  gnc-dense-cal-store.h \
+  gnc-embedded-window.h \
+  gnc-file.h \
+  gnc-frequency.h \
+  gnc-recurrence.h \
+  gnc-general-select.h \
+  gnc-gnome-utils.h \
+  gnc-gui-query.h \
+  gnc-icons.h \
+  gnc-keyring.h \
+  gnc-main-window.h \
+  gnc-menu-extensions.h \
+  gnc-plugin-file-history.h \
+  gnc-plugin-manager.h \
+  gnc-plugin-menu-additions.h \
+  gnc-plugin-page.h \
+  gnc-plugin.h \
+  gnc-period-select.h \
+  gnc-query-view.h \
+  gnc-splash.h \
+  gnc-sx-instance-dense-cal-adapter.h \
+  gnc-sx-list-tree-model-adapter.h \
+  gnc-tree-control-split-reg.h \
+  gnc-tree-model.h \
+  gnc-tree-model-account-types.h \
+  gnc-tree-model-account.h \
+  gnc-tree-model-budget.h \
+  gnc-tree-model-owner.h \
+  gnc-tree-model-commodity.h \
+  gnc-tree-model-price.h \
+  gnc-tree-model-split-reg.h \
+  gnc-tree-util-split-reg.h \
+  gnc-tree-view-account.h \
+  gnc-tree-view-commodity.h \
+  gnc-tree-view-owner.h \
+  gnc-tree-view-price.h \
+  gnc-tree-view-split-reg.h \
+  gnc-tree-view-sx-list.h \
+  gnc-tree-view.h \
+  gnc-ui.h \
+  gnc-window.h \
+  misc-gnome-utils.h \
+  tree-view-utils.h \
+  print-session.h \
+  window-main-summarybar.h
+
+noinst_HEADERS = \
+  dialog-tax-table.h \
+  gnc-autosave.h \
+  gnc-gobject-utils.h \
+  gnc-gtk-utils.h \
+  search-param.h
+
+libgncmod_gnome_utils_la_LDFLAGS = -avoid-version
+
+libgncmod_gnome_utils_la_LIBADD = \
+  ${top_builddir}/libgnucash/core-utils/libgnc-core-utils.la \
+  ${top_builddir}/libgnucash/gnc-module/libgnc-module.la \
+  ${top_builddir}/libgnucash/engine/libgncmod-engine.la \
+  ${top_builddir}/libgnucash/backend/xml/libgnc-backend-xml-utils.la \
+  ${top_builddir}/libgnucash/app-utils/libgncmod-app-utils.la \
+  $(top_builddir)/lib/libc/libc-missing.la \
+  ${GTK_LIBS} \
+  ${GNOME_KEYRING_LIBS} \
+  ${LIBSECRET_LIBS} \
+  ${GUILE_LIBS} \
+  ${GLIB_LIBS} \
+  ${DB_LIBS} \
+  ${REGEX_LIBS} \
+  ${LIBXML2_LIBS} \
+  ${GTK_MAC_LIBS}
+
+BUILT_SOURCES = gnc-warnings.c gnc-warnings.h
+
+gnc-warnings.c: gschemas/org.gnucash.warnings.gschema.xml.in make-gnc-warnings-c.xsl
+	$(XSLTPROC) -o $@ $(srcdir)/make-gnc-warnings-c.xsl $<
+
+gnc-warnings.h: gschemas/org.gnucash.warnings.gschema.xml.in make-gnc-warnings-h.xsl
+	$(XSLTPROC) -o $@ $(srcdir)/make-gnc-warnings-h.xsl $<
+
+if HAVE_X11_XLIB_H
+  libgncmod_gnome_utils_la_LIBADD += -lX11
+endif
+
+if BUILDING_FROM_VCS
+swig-gnome-utils.c: gnome-utils.i \
+                    ${top_srcdir}/common/base-typemaps.i
+	$(SWIG) -guile $(SWIG_ARGS) -Linkage module \
+	-I${top_srcdir}/common -o $@ $<
+if ! OS_WIN32
+if ! SWIG_DIST_FAIL
+	if ! `grep "define scm_from_utf8_string" $@ > /dev/null 2>&1`; then \
+	  patch $@ $(top_srcdir)/common/swig-utf8.patch; \
+	fi
+endif
+endif
+endif
+
+gncscmmoddir = ${GNC_SCM_INSTALL_DIR}/gnucash
+gncscmmod_DATA = gnome-utils.scm
+
+gncscmdir = ${GNC_SCM_INSTALL_DIR}
+gncscm_DATA = gnc-menu-extensions.scm
+
+EXTRA_DIST = \
+  gnome-utils.i \
+  make-gnc-warnings-c.xsl \
+  make-gnc-warnings-h.xsl \
+  ${gncscmmod_DATA} \
+  ${gncscm_DATA} \
+  CMakeLists.txt
+
+
+if GNUCASH_SEPARATE_BUILDDIR
+#For executing test cases
+SCM_FILE_LINKS = \
+  ${gncscmmod_DATA} \
+  ${gncscm_DATA}
+endif
+
+.scm-links:
+	$(RM) -rf gnucash
+	mkdir -p  gnucash
+if GNUCASH_SEPARATE_BUILDDIR
+	for X in ${SCM_FILE_LINKS} ; do \
+	  $(LN_S) -f ${srcdir}/$$X . ; \
+	done
+endif
+	( cd gnucash; for A in $(gncscmmod_DATA) ; do $(LN_S) -f ../$$A . ; done )
+if ! OS_WIN32
+# Windows knows no "ln -s" but uses "cp": must copy every time (see bug #566567).
+	touch .scm-links
+endif
+
+if GNC_HAVE_GUILE_2
+GUILE_COMPILE_ENV = \
+  --guile-load-dir ${top_builddir}/libgnucash/core-utils \
+  --guile-load-dir ${top_builddir}/libgnucash/gnc-module \
+  --guile-load-dir ${top_builddir}/libgnucash/scm \
+  --library-dir    ${top_builddir}/libgnucash/engine \
+  --library-dir    ${top_builddir}/libgnucash/core-utils \
+  --library-dir    ${top_builddir}/libgnucash/gnc-module \
+  --library-dir    ${top_builddir}/libgnucash/app-utils \
+  --library-dir    ${top_builddir}/libgnucash/backend/xml \
+  --library-dir    ${top_builddir}/gnucash/gnome-utils
+
+%.go : %.scm .scm-links $(pkglib_LTLIBRARIES)
+	GNC_UNINSTALLED=yes \
+	GNC_BUILDDIR=${top_builddir} \
+	$(shell ${abs_top_srcdir}/common/gnc-test-env.pl --noexports ${GUILE_COMPILE_ENV}) \
+	$(GUILD) compile -o $@ $<
+
+gncscmmodcachedir = ${pkglibdir}/scm/ccache/@GUILE_EFFECTIVE_VERSION@/gnucash
+gncscmmodcache_DATA = $(gncscmmod_DATA:.scm=.go)
+
+gncscmcachedir = ${pkglibdir}/scm/ccache/@GUILE_EFFECTIVE_VERSION@
+gncscmcache_DATA = $(gncscm_DATA:.scm=.go)
+endif
+
+noinst_DATA = .scm-links
+clean-local:
+	rm -rf gnucash
+
+CLEANFILES = \
+	$(BUILT_SOURCES) \
+	.scm-links \
+	${SCM_FILE_LINKS} \
+	${gncscmcache_DATA} \
+	${gncscmmodcache_DATA}
+
+MAINTAINERCLEANFILES = swig-gnome-utils.c
+
+# We want to do this only for the Gnome help tool on Linux and MacPorts.
+if !PLATFORM_WIN32
+if !PLATFORM_OSX_QUARTZ
+#
+# I hate inconsistent standards. Autotools puts help files into
+# ${datadir}/gnome/help/${program} while the gnome2 libraries expect
+# them in ${pkgdatadir}/gnome/help/${program}.
+#
+install-data-hook:
+	$(LN_S) -f ../gnome ${DESTDIR}${pkgdatadir}
+
+uninstall-hook:
+	rm -f ${DESTDIR}${pkgdatadir}/gnome
+endif
+endif
+
+AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.gui\"
diff --git a/src/gnome-utils/account-quickfill.c b/gnucash/gnome-utils/account-quickfill.c
similarity index 100%
rename from src/gnome-utils/account-quickfill.c
rename to gnucash/gnome-utils/account-quickfill.c
diff --git a/src/gnome-utils/account-quickfill.h b/gnucash/gnome-utils/account-quickfill.h
similarity index 100%
rename from src/gnome-utils/account-quickfill.h
rename to gnucash/gnome-utils/account-quickfill.h
diff --git a/src/gnome-utils/assistant-xml-encoding.c b/gnucash/gnome-utils/assistant-xml-encoding.c
similarity index 100%
rename from src/gnome-utils/assistant-xml-encoding.c
rename to gnucash/gnome-utils/assistant-xml-encoding.c
diff --git a/src/gnome-utils/assistant-xml-encoding.h b/gnucash/gnome-utils/assistant-xml-encoding.h
similarity index 100%
rename from src/gnome-utils/assistant-xml-encoding.h
rename to gnucash/gnome-utils/assistant-xml-encoding.h
diff --git a/src/gnome-utils/cursors.c b/gnucash/gnome-utils/cursors.c
similarity index 100%
rename from src/gnome-utils/cursors.c
rename to gnucash/gnome-utils/cursors.c
diff --git a/src/gnome-utils/dialog-account.c b/gnucash/gnome-utils/dialog-account.c
similarity index 100%
rename from src/gnome-utils/dialog-account.c
rename to gnucash/gnome-utils/dialog-account.c
diff --git a/src/gnome-utils/dialog-account.h b/gnucash/gnome-utils/dialog-account.h
similarity index 100%
rename from src/gnome-utils/dialog-account.h
rename to gnucash/gnome-utils/dialog-account.h
diff --git a/gnucash/gnome-utils/dialog-book-close.c b/gnucash/gnome-utils/dialog-book-close.c
new file mode 100644
index 0000000..c130f24
--- /dev/null
+++ b/gnucash/gnome-utils/dialog-book-close.c
@@ -0,0 +1,394 @@
+/********************************************************************\
+ * dialog-book-close.c -- dialog for helping the user close the     *
+ *                        book at the end of the year by adding     *
+ *                        zero-izing splits to all Income and       *
+ *                        Expense accounts                          *
+ *                                                                  *
+ * Copyright (C) 2007-8 Derek Atkins <derek at ihtfp.com>              *
+ *                                                                  *
+ * 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 at gnu.org                   *
+\********************************************************************/
+
+#include "config.h"
+
+#include <gtk/gtk.h>
+#include <glib/gi18n.h>
+
+#include "dialog-utils.h"
+#include "gnc-engine.h"
+#include "Transaction.h"
+#include "Split.h"
+#include "Account.h"
+#include "gnc-ui.h"
+#include "gnc-gui-query.h"
+#include "dialog-book-close.h"
+#include "gnc-account-sel.h"
+#include "gnc-component-manager.h"
+#include "gnc-date-edit.h"
+#include "gnc-session.h"
+#include "gnc-ui-util.h"
+
+#define DIALOG_BOOK_CLOSE_CM_CLASS "dialog-book-close"
+
+void gnc_book_close_response_cb(GtkDialog *, gint, GtkDialog *);
+
+/* This static indicates the debugging module that this .o belongs to.  */
+static QofLogModule log_module = GNC_MOD_GUI;
+
+struct CloseBookWindow
+{
+    /* Passed in by the creator */
+    QofBook* book;
+
+    /* Parts of the dialog */
+    GtkWidget* dialog;
+    GtkWidget* close_date_widget;
+    GtkWidget* income_acct_widget;
+    GtkWidget* expense_acct_widget;
+    GtkWidget* desc_widget;
+
+    /* The final settings */
+    time64 close_date;
+    const char* desc;
+
+    /* Component registration */
+    gint component_manager_id;
+};
+
+struct CloseAccountsCB
+{
+    struct CloseBookWindow* cbw;
+    Account* base_acct;
+    GNCAccountType acct_type;
+    GHashTable* txns;
+    guint hash_size;
+};
+
+struct CACBTransactionList
+{
+    gnc_commodity* cmdty;
+    Transaction* txn;
+    gnc_numeric total;
+};
+
+static struct CACBTransactionList*
+find_or_create_txn(struct CloseAccountsCB* cacb, gnc_commodity* cmdty)
+{
+    struct CACBTransactionList* txn;
+
+    g_return_val_if_fail(cacb, NULL);
+    g_return_val_if_fail(cmdty, NULL);
+
+    txn = g_hash_table_lookup(cacb->txns, cmdty);
+    if (!txn)
+    {
+        txn = g_new0(struct CACBTransactionList, 1);
+        txn->cmdty = cmdty;
+        txn->total = gnc_numeric_zero();
+        txn->txn = xaccMallocTransaction(cacb->cbw->book);
+        xaccTransBeginEdit(txn->txn);
+        xaccTransSetDateEnteredSecs(txn->txn, gnc_time (NULL));
+
+        /* Watch out: The book-closing txn currently assume that their
+        posted-date is the end date plus 12 hours, so that the closing txn can
+        be distinguished from normal txns of the last day. This is the only
+        case within GnuCash where the PostedDate is a different time-of-day
+        that what the GDate normally says as a normalized date. */
+        xaccTransSetDatePostedSecs(txn->txn, cacb->cbw->close_date);
+
+        xaccTransSetDescription(txn->txn, cacb->cbw->desc);
+        xaccTransSetCurrency(txn->txn, cmdty);
+        xaccTransSetIsClosingTxn(txn->txn, TRUE);
+        g_hash_table_insert(cacb->txns, cmdty, txn);
+    }
+
+    return txn;
+}
+
+/* Make sure that the account is of the correct type.
+ * then make sure the account has a balance as of the closing date.
+ * then get the account commodity and find the appropriate
+ * balancing transaction for that commodity and add this balance
+ * to it.
+ */
+static void close_accounts_cb(Account *a, gpointer data)
+{
+    struct CloseAccountsCB* cacb = data;
+    struct CACBTransactionList* txn;
+    gnc_commodity* acct_commodity;
+    Split* split;
+    gnc_numeric bal;
+
+    g_return_if_fail(a);
+    g_return_if_fail(cacb);
+    g_return_if_fail(cacb->cbw);
+    g_return_if_fail(cacb->txns);
+
+    if (cacb->acct_type != xaccAccountGetType(a))
+        return;
+
+    bal = xaccAccountGetBalanceAsOfDate(a, cacb->cbw->close_date + 1);
+    if (gnc_numeric_zero_p(bal))
+        return;
+
+    acct_commodity = gnc_account_or_default_currency(a, NULL);
+    g_assert(acct_commodity);
+
+    txn = find_or_create_txn(cacb, acct_commodity);
+    g_assert(txn);
+
+    split = xaccMallocSplit(cacb->cbw->book);
+    xaccSplitSetParent(split, txn->txn);
+    xaccAccountBeginEdit(a);
+    xaccAccountInsertSplit(a, split);
+    xaccSplitSetBaseValue(split, gnc_numeric_neg(bal), acct_commodity);
+    xaccAccountCommitEdit(a);
+    txn->total = gnc_numeric_add(txn->total, bal, GNC_DENOM_AUTO,
+                                 GNC_HOW_DENOM_FIXED | GNC_HOW_RND_NEVER);
+}
+
+
+static void finish_txn_cb(gnc_commodity* cmdty,
+                          struct CACBTransactionList* txn,
+                          struct CloseAccountsCB* cacb)
+{
+    Account* acc;
+    Split* split;
+
+    g_return_if_fail(cmdty);
+    g_return_if_fail(txn);
+    g_return_if_fail(cacb);
+    g_return_if_fail(cacb->hash_size);
+
+    /* If we only have one currency and the base account uses
+     * that currency, then we can use that account.  Otherwise,
+     * create a subaccount for each currency.
+     */
+    if (cacb->hash_size == 1 &&
+            gnc_commodity_equal(cmdty, xaccAccountGetCommodity(cacb->base_acct)))
+        acc = cacb->base_acct;
+    else
+    {
+        /* See if we already have an account by that name */
+        acc = gnc_account_lookup_by_name(cacb->base_acct,
+                                         gnc_commodity_get_mnemonic(cmdty));
+
+        /* If not, then create one */
+        if (!acc)
+        {
+            acc = xaccMallocAccount(cacb->cbw->book);
+            xaccAccountBeginEdit(acc);
+            xaccAccountSetType(acc, ACCT_TYPE_EQUITY);
+            xaccAccountSetName(acc, gnc_commodity_get_mnemonic(cmdty));
+            xaccAccountSetDescription(acc, gnc_commodity_get_mnemonic(cmdty));
+            xaccAccountSetCommodity(acc, cmdty);
+            gnc_account_append_child(cacb->base_acct, acc);
+            xaccAccountCommitEdit(acc);
+        }
+    }
+    /* Make sure the account exists and is of the correct commodity */
+    g_assert(acc);
+    g_assert(gnc_commodity_equal(cmdty, xaccAccountGetCommodity(acc)));
+
+    /* Create the split for the Equity account to balance out
+     * all the accounts of this.  Use the "total".
+     */
+    split = xaccMallocSplit(cacb->cbw->book);
+    xaccSplitSetParent(split, txn->txn);
+    xaccAccountBeginEdit(acc);
+    xaccAccountInsertSplit(acc, split);
+    xaccSplitSetBaseValue(split, txn->total, cmdty);
+    xaccAccountCommitEdit(acc);
+    xaccTransCommitEdit(txn->txn);
+}
+
+static void close_accounts_of_type(struct CloseBookWindow* cbw,
+                                   Account* acct,
+                                   GNCAccountType acct_type)
+{
+    struct CloseAccountsCB cacb;
+    Account* root_acct;
+
+    g_return_if_fail(cbw);
+    g_return_if_fail(acct);
+
+    cacb.cbw = cbw;
+    cacb.base_acct = acct;
+    cacb.acct_type = acct_type;
+    cacb.txns = g_hash_table_new_full(g_direct_hash,
+                                      (GEqualFunc)gnc_commodity_equal,
+                                      NULL, g_free);
+
+    /* Iterate through all accounts and set up the balancing splits */
+    root_acct = gnc_book_get_root_account(cbw->book);
+    gnc_account_foreach_descendant(root_acct, close_accounts_cb, &cacb);
+
+    /* now iterate through the transactions and handle each currency */
+    cacb.hash_size = g_hash_table_size(cacb.txns);
+    if (cacb.hash_size)
+        g_hash_table_foreach(cacb.txns, (GHFunc)finish_txn_cb, &cacb);
+
+    /* Destroy the table, freeing the used memory */
+    g_hash_table_destroy(cacb.txns);
+}
+
+static void close_handler(gpointer data)
+{
+    GtkWidget *dialog = data;
+
+    gtk_widget_destroy(dialog);
+}
+
+static void destroy_cb(GObject *object, gpointer data)
+{
+    struct CloseBookWindow *cbw;
+
+    cbw = g_object_get_data(G_OBJECT(object), "CloseBookWindow");
+
+    if (cbw->component_manager_id)
+    {
+        gnc_unregister_gui_component(cbw->component_manager_id);
+        cbw->component_manager_id = 0;
+    }
+}
+
+
+void
+gnc_book_close_response_cb(GtkDialog *dialog, gint response, GtkDialog *unused)
+{
+    struct CloseBookWindow* cbw;
+    Account* income_acct;
+    Account* expense_acct;
+
+    ENTER("dialog %p, response %d, unused %p", dialog, response, unused);
+
+    g_return_if_fail(dialog);
+
+    cbw = g_object_get_data(G_OBJECT(dialog), "CloseBookWindow");
+    g_return_if_fail(cbw);
+
+    switch (response)
+    {
+    case GTK_RESPONSE_HELP:
+        gnc_gnome_help(HF_HELP, HL_CLOSE_BOOK);
+        break;
+    case GTK_RESPONSE_OK:
+        cbw->close_date = gnc_date_edit_get_date(GNC_DATE_EDIT(cbw->close_date_widget));
+        cbw->close_date += (3600 * 12);  /* Add 12 hours to the timestamp */
+        cbw->desc = gtk_entry_get_text(GTK_ENTRY(cbw->desc_widget));
+
+        income_acct = gnc_account_sel_get_account(GNC_ACCOUNT_SEL(cbw->income_acct_widget));
+        expense_acct = gnc_account_sel_get_account(GNC_ACCOUNT_SEL(cbw->expense_acct_widget));
+
+        if (!income_acct)
+        {
+            gnc_error_dialog(cbw->dialog, "%s",
+                             _("Please select an Equity account to hold the total Period Income."));
+            break;
+        }
+
+        if (!expense_acct)
+        {
+            gnc_error_dialog(cbw->dialog, "%s",
+                             _("Please select an Equity account to hold the total Period Expense."));
+            break;
+        }
+
+        gnc_suspend_gui_refresh();
+        close_accounts_of_type(cbw, income_acct, ACCT_TYPE_INCOME);
+        close_accounts_of_type(cbw, expense_acct, ACCT_TYPE_EXPENSE);
+        gnc_resume_gui_refresh();
+
+        /* FALL THROUGH */
+    default:
+        gtk_widget_destroy(GTK_WIDGET(dialog));
+        break;
+    }
+    LEAVE("");
+}
+
+void gnc_ui_close_book (QofBook* book)
+{
+    struct CloseBookWindow *cbw;
+    GtkBuilder* builder;
+    GtkWidget* box;
+    GList* equity_list = NULL;
+
+    g_return_if_fail(book);
+
+    cbw = g_new0(struct CloseBookWindow, 1);
+    g_return_if_fail(cbw);
+    cbw->book = book;
+
+    /* Open the dialog */
+    builder = gtk_builder_new();
+    gnc_builder_add_from_file (builder, "dialog-book-close.glade", "close_book_dialog");
+    cbw->dialog = GTK_WIDGET(gtk_builder_get_object (builder,  "close_book_dialog"));
+
+    // Set the style context for this dialog so it can be easily manipulated with css
+    gnc_widget_set_style_context (GTK_WIDGET(cbw->dialog), "GncBookCloseDialog");
+
+    PINFO("Closed Book Window is %p, Dialog is %p", cbw, cbw->dialog);
+
+    /* close date */
+    box = GTK_WIDGET(gtk_builder_get_object (builder,  "date_box"));
+    cbw->close_date_widget = gnc_date_edit_new(gnc_time (NULL), FALSE, FALSE);
+    gtk_box_pack_start(GTK_BOX(box), cbw->close_date_widget, TRUE, TRUE, 0);
+
+    /* income acct */
+    equity_list = g_list_prepend(equity_list, GINT_TO_POINTER(ACCT_TYPE_EQUITY));
+    box = GTK_WIDGET(gtk_builder_get_object (builder, "income_acct_box"));
+    cbw->income_acct_widget = gnc_account_sel_new();
+    gnc_account_sel_set_acct_filters(GNC_ACCOUNT_SEL(cbw->income_acct_widget),
+                                     equity_list, NULL);
+    gnc_account_sel_set_new_account_ability(GNC_ACCOUNT_SEL(cbw->income_acct_widget), TRUE);
+    gtk_box_pack_start(GTK_BOX(box), cbw->income_acct_widget, TRUE, TRUE, 0);
+
+    /* expense acct */
+    box = GTK_WIDGET(gtk_builder_get_object (builder, "expense_acct_box"));
+    cbw->expense_acct_widget = gnc_account_sel_new();
+    gnc_account_sel_set_acct_filters(GNC_ACCOUNT_SEL(cbw->expense_acct_widget),
+                                     equity_list, NULL);
+    gnc_account_sel_set_new_account_ability(GNC_ACCOUNT_SEL(cbw->expense_acct_widget), TRUE);
+    gtk_box_pack_start(GTK_BOX(box), cbw->expense_acct_widget, TRUE, TRUE, 0);
+
+    /* desc */
+    cbw->desc_widget = GTK_WIDGET(gtk_builder_get_object (builder, "desc_entry"));
+
+    /* Autoconnect signals */
+    gtk_builder_connect_signals_full (builder, gnc_builder_connect_full_func, cbw->dialog);
+
+    /* Register dialog with component manager */
+    cbw->component_manager_id =
+        gnc_register_gui_component(DIALOG_BOOK_CLOSE_CM_CLASS, NULL, close_handler,
+                                   cbw->dialog);
+    gnc_gui_component_set_session(cbw->component_manager_id,
+                                  gnc_get_current_session());
+    g_signal_connect(cbw->dialog, "destroy", G_CALLBACK(destroy_cb), NULL);
+
+    /* Clean up the data structure when the dialog is destroyed */
+    g_object_set_data_full(G_OBJECT(cbw->dialog), "CloseBookWindow", cbw, g_free);
+
+    g_object_unref(G_OBJECT(builder));
+
+    /* Run the dialog */
+    gtk_widget_show_all(cbw->dialog);
+
+    g_list_free(equity_list);
+}
+
diff --git a/src/gnome-utils/dialog-book-close.h b/gnucash/gnome-utils/dialog-book-close.h
similarity index 100%
rename from src/gnome-utils/dialog-book-close.h
rename to gnucash/gnome-utils/dialog-book-close.h
diff --git a/src/gnome-utils/dialog-commodity.c b/gnucash/gnome-utils/dialog-commodity.c
similarity index 100%
rename from src/gnome-utils/dialog-commodity.c
rename to gnucash/gnome-utils/dialog-commodity.c
diff --git a/src/gnome-utils/dialog-commodity.h b/gnucash/gnome-utils/dialog-commodity.h
similarity index 100%
rename from src/gnome-utils/dialog-commodity.h
rename to gnucash/gnome-utils/dialog-commodity.h
diff --git a/src/gnome-utils/dialog-dup-trans.c b/gnucash/gnome-utils/dialog-dup-trans.c
similarity index 100%
rename from src/gnome-utils/dialog-dup-trans.c
rename to gnucash/gnome-utils/dialog-dup-trans.c
diff --git a/src/gnome-utils/dialog-dup-trans.h b/gnucash/gnome-utils/dialog-dup-trans.h
similarity index 100%
rename from src/gnome-utils/dialog-dup-trans.h
rename to gnucash/gnome-utils/dialog-dup-trans.h
diff --git a/src/gnome-utils/dialog-file-access.c b/gnucash/gnome-utils/dialog-file-access.c
similarity index 100%
rename from src/gnome-utils/dialog-file-access.c
rename to gnucash/gnome-utils/dialog-file-access.c
diff --git a/src/gnome-utils/dialog-file-access.h b/gnucash/gnome-utils/dialog-file-access.h
similarity index 100%
rename from src/gnome-utils/dialog-file-access.h
rename to gnucash/gnome-utils/dialog-file-access.h
diff --git a/src/gnome-utils/dialog-object-references.c b/gnucash/gnome-utils/dialog-object-references.c
similarity index 100%
rename from src/gnome-utils/dialog-object-references.c
rename to gnucash/gnome-utils/dialog-object-references.c
diff --git a/src/gnome-utils/dialog-object-references.h b/gnucash/gnome-utils/dialog-object-references.h
similarity index 100%
rename from src/gnome-utils/dialog-object-references.h
rename to gnucash/gnome-utils/dialog-object-references.h
diff --git a/src/gnome-utils/dialog-options.c b/gnucash/gnome-utils/dialog-options.c
similarity index 100%
rename from src/gnome-utils/dialog-options.c
rename to gnucash/gnome-utils/dialog-options.c
diff --git a/gnucash/gnome-utils/dialog-options.h b/gnucash/gnome-utils/dialog-options.h
new file mode 100644
index 0000000..cfbe013
--- /dev/null
+++ b/gnucash/gnome-utils/dialog-options.h
@@ -0,0 +1,115 @@
+/********************************************************************\
+ * dialog-options.h -- GNOME option handling                        *
+ * Copyright (C) 1998-2000 Linas Vepstas                            *
+ *                                                                  *
+ * 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 at gnu.org                   *
+\********************************************************************/
+
+#ifndef OPTIONS_DIALOG_H
+#define OPTIONS_DIALOG_H
+
+#include <libguile.h>
+#include "option-util.h"
+#include <gtk/gtk.h>
+
+/** A simple wrapper that casts the gpointer result of
+ * gnc_option_get_widget() already into a GtkWidget*. */
+GtkWidget *gnc_option_get_gtk_widget (GNCOption *option);
+
+typedef struct gnc_option_win GNCOptionWin;
+
+typedef void (* GNCOptionWinCallback)(GNCOptionWin *, gpointer data);
+
+GNCOptionWin * gnc_options_dialog_new_modal(gboolean modal, gchar *title,
+                                                const char *component_class);
+GNCOptionWin * gnc_options_dialog_new(gchar *title);
+GNCOptionWin * gnc_options_dialog_new_w_dialog(gchar *title, GtkWidget *dialog);
+void gnc_options_dialog_destroy(GNCOptionWin * win);
+void gnc_options_register_stocks (void);
+
+GtkWidget * gnc_options_dialog_widget(GNCOptionWin * win);
+GtkWidget * gnc_options_page_list(GNCOptionWin * win);
+GtkWidget * gnc_options_dialog_notebook(GNCOptionWin * win);
+
+void gnc_options_dialog_changed (GNCOptionWin *win);
+
+void gnc_option_changed_widget_cb(GtkWidget *widget, GNCOption *option);
+void gnc_option_changed_option_cb(GtkWidget *dummy, GNCOption *option);
+
+void gnc_options_dialog_set_apply_cb(GNCOptionWin * win,
+                                     GNCOptionWinCallback thunk,
+                                     gpointer cb_data);
+void gnc_options_dialog_set_help_cb(GNCOptionWin * win,
+                                    GNCOptionWinCallback thunk,
+                                    gpointer cb_data);
+void gnc_options_dialog_set_close_cb(GNCOptionWin * win,
+                                     GNCOptionWinCallback thunk,
+                                     gpointer cb_data);
+
+void gnc_options_dialog_set_global_help_cb(GNCOptionWinCallback thunk,
+        gpointer cb_data);
+
+void gnc_options_dialog_build_contents(GNCOptionWin *win,
+                                       GNCOptionDB  *odb);
+
+void gnc_options_dialog_build_contents_full(GNCOptionWin *win,
+                                            GNCOptionDB  *odb,
+                                            gboolean show_dialog);
+
+/* Both apply_cb and close_cb should be scheme functions with 0 arguments.
+ * References to these functions will be held until the close_cb is called
+ */
+void gnc_options_dialog_set_scm_callbacks (GNCOptionWin *win,
+        SCM apply_cb,
+        SCM close_cb);
+
+/*****************************************************************/
+/* Option Registration                                           */
+
+/* Function to set the UI widget based upon the option */
+typedef GtkWidget *
+(*GNCOptionUISetWidget) (GNCOption *option, GtkBox *page_box,
+                         char *name, char *documentation,
+                         /* Return values */
+                         GtkWidget **enclosing, gboolean *packed);
+
+/* Function to set the UI Value for a particular option */
+typedef gboolean
+(*GNCOptionUISetValue)  (GNCOption *option, gboolean use_default,
+                         GtkWidget *widget, SCM value);
+
+/* Function to get the UI Value for a particular option */
+typedef SCM
+(*GNCOptionUIGetValue)  (GNCOption *option, GtkWidget *widget);
+
+
+typedef struct gnc_option_def
+{
+    const char *         option_name;
+    GNCOptionUISetWidget set_widget;
+    GNCOptionUISetValue  set_value;
+    GNCOptionUIGetValue  get_value;
+} GNCOptionDef_t;
+
+
+/* Register a new option type in the UI */
+void gnc_options_ui_initialize (void);
+void gnc_options_ui_register_option (GNCOptionDef_t *option);
+GNCOptionDef_t * gnc_options_ui_get_option (const char *option_name);
+
+#endif /* OPTIONS_DIALOG_H */
diff --git a/src/gnome-utils/dialog-preferences.c b/gnucash/gnome-utils/dialog-preferences.c
similarity index 100%
rename from src/gnome-utils/dialog-preferences.c
rename to gnucash/gnome-utils/dialog-preferences.c
diff --git a/src/gnome-utils/dialog-preferences.h b/gnucash/gnome-utils/dialog-preferences.h
similarity index 100%
rename from src/gnome-utils/dialog-preferences.h
rename to gnucash/gnome-utils/dialog-preferences.h
diff --git a/src/gnome-utils/dialog-query-view.c b/gnucash/gnome-utils/dialog-query-view.c
similarity index 100%
rename from src/gnome-utils/dialog-query-view.c
rename to gnucash/gnome-utils/dialog-query-view.c
diff --git a/src/gnome-utils/dialog-query-view.h b/gnucash/gnome-utils/dialog-query-view.h
similarity index 100%
rename from src/gnome-utils/dialog-query-view.h
rename to gnucash/gnome-utils/dialog-query-view.h
diff --git a/gnucash/gnome-utils/dialog-reset-warnings.c b/gnucash/gnome-utils/dialog-reset-warnings.c
new file mode 100644
index 0000000..794ce20
--- /dev/null
+++ b/gnucash/gnome-utils/dialog-reset-warnings.c
@@ -0,0 +1,426 @@
+/***********************************************************************
+ * dialog-reset-warnings.c -- "Resert Warnings" dialog                 *
+ * Copyright (C) 2005 David Hampton                                    *
+ * Copyright (C) 2011 Robert Fewell                                    *
+ *                                                                     *
+ * 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 at gnu.org                      *
+ *                                                                     *
+ **********************************************************************/
+
+#include "config.h"
+
+#include <glib/gi18n.h>
+#include <gtk/gtk.h>
+
+#include "dialog-utils.h"
+#include "gnc-engine.h"
+#include "gnc-prefs.h"
+#include "gnc-ui.h"
+#include "gnc-warnings.h"
+#include "gnc-component-manager.h"
+#include "dialog-reset-warnings.h"
+
+/* This static indicates the debugging module that this .o belongs to.  */
+static QofLogModule log_module = GNC_MOD_PREFS;
+
+#define GNC_PREFS_GROUP                 "dialogs.reset-warnings"
+#define DIALOG_RESET_WARNINGS_CM_CLASS  "reset-warnings"
+#define TIPS_STRING                     "tips"
+
+typedef struct
+{
+    GtkWidget   *dialog;
+    GtkWidget   *perm_vbox_label;
+    GtkWidget   *perm_vbox;
+    GtkWidget   *temp_vbox_label;
+    GtkWidget   *temp_vbox;
+    GtkWidget   *buttonbox;
+    GtkWidget   *nolabel;
+    GtkWidget   *applybutton;
+} RWDialog;
+
+void gnc_reset_warnings_select_all_cb (GtkButton *button, gpointer user_data);
+void gnc_reset_warnings_unselect_all_cb (GtkButton *button, gpointer user_data);
+void gnc_reset_warnings_response_cb (GtkDialog *dialog, gint response, gpointer user_data);
+static void gnc_reset_warnings_add_section (RWDialog *rw_dialog,
+                                            const gchar *section, GtkWidget *box);
+static void gnc_reset_warnings_update_widgets (RWDialog *rw_dialog);
+
+
+/****************************************************
+ *  Update the Dialog Widgets
+ *  @internal
+ *  @param rw_dialog structure.
+ ****************************************************/
+static void
+gnc_reset_warnings_update_widgets (RWDialog *rw_dialog)
+{
+    GList *list, *tmp;
+    gboolean any = FALSE, checked = FALSE;
+
+    ENTER("rw_dialog %p", rw_dialog);
+
+    list = gtk_container_get_children(GTK_CONTAINER(rw_dialog->perm_vbox));
+    if (list)
+    {
+        gtk_widget_show_all(rw_dialog->perm_vbox_label);
+        for (tmp = list; tmp; tmp = g_list_next(tmp))
+        {
+            if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(tmp->data)))
+            {
+                checked = TRUE;
+                break;
+            }
+        }
+        g_list_free(list);
+        any = TRUE;
+    }
+    else
+    {
+        gtk_widget_hide(rw_dialog->perm_vbox_label);
+    }
+
+    list = gtk_container_get_children(GTK_CONTAINER(rw_dialog->temp_vbox));
+    if (list)
+    {
+        gtk_widget_show_all(rw_dialog->temp_vbox_label);
+        for (tmp = list; tmp; tmp = g_list_next(tmp))
+        {
+            if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(tmp->data)))
+            {
+                checked = TRUE;
+                break;
+            }
+        }
+        g_list_free(list);
+        any = TRUE;
+    }
+    else
+    {
+        gtk_widget_hide(rw_dialog->temp_vbox_label);
+    }
+
+    if (any)
+    {
+        gtk_widget_show(rw_dialog->buttonbox);
+        gtk_widget_hide(rw_dialog->nolabel);
+        gtk_widget_set_sensitive(rw_dialog->applybutton, checked);
+    }
+    else
+    {
+        gtk_widget_hide(rw_dialog->buttonbox);
+        gtk_widget_show(rw_dialog->nolabel);
+        gtk_widget_set_sensitive(rw_dialog->applybutton, FALSE);
+    }
+    LEAVE(" ");
+}
+
+
+/***************************/
+/*  Helper functions       */
+/***************************/
+static void
+gnc_reset_warnings_apply_one (GtkWidget *widget,
+                              GtkDialog *dialog)
+{
+    const gchar *pref = NULL;
+    const gchar *prefs_group = NULL;
+
+    ENTER("widget %p, dialog %p", widget, dialog);
+
+    if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)))
+    {
+        LEAVE("not active");
+        return;
+    }
+
+    pref = gtk_widget_get_name(widget);
+    prefs_group = g_object_get_data (G_OBJECT (widget), "prefs-group");
+    if (prefs_group)
+        gnc_prefs_reset (prefs_group, pref);
+    gtk_widget_destroy(widget);
+    LEAVE(" ");
+}
+
+
+static void
+gnc_reset_warnings_apply_changes (RWDialog *rw_dialog)
+{
+    ENTER("rw_dialog %p", rw_dialog);
+
+    gtk_container_foreach(GTK_CONTAINER(rw_dialog->perm_vbox),
+                          (GtkCallback)gnc_reset_warnings_apply_one,
+                          rw_dialog->dialog);
+
+    gtk_container_foreach(GTK_CONTAINER(rw_dialog->temp_vbox),
+                          (GtkCallback)gnc_reset_warnings_apply_one,
+                          rw_dialog->dialog);
+    gnc_reset_warnings_update_widgets(rw_dialog);
+    LEAVE(" ");
+}
+
+
+/***************************/
+/*    Dialog Callbacks     */
+/***************************/
+void
+gnc_reset_warnings_response_cb (GtkDialog *dialog,
+                                gint response,
+                                gpointer user_data)
+{
+    RWDialog *rw_dialog = user_data;
+
+    ENTER("dialog %p, response %d, user_data %p", dialog, response, user_data);
+
+    switch (response)
+    {
+    case GTK_RESPONSE_APPLY:
+        gnc_reset_warnings_apply_changes(rw_dialog);
+        break;
+
+    case GTK_RESPONSE_OK:
+        gnc_reset_warnings_apply_changes(rw_dialog);
+        gnc_save_window_size(GNC_PREFS_GROUP, GTK_WINDOW(rw_dialog->dialog));
+        gnc_unregister_gui_component_by_data(DIALOG_RESET_WARNINGS_CM_CLASS,
+                                             rw_dialog);
+        gtk_widget_destroy(GTK_WIDGET(rw_dialog->dialog));
+        break;
+
+    default:
+        gnc_unregister_gui_component_by_data(DIALOG_RESET_WARNINGS_CM_CLASS,
+                                             rw_dialog);
+        gtk_widget_destroy(GTK_WIDGET(rw_dialog->dialog));
+        break;
+    }
+    LEAVE("");
+}
+
+
+static void
+gnc_reset_warnings_select_common (RWDialog *rw_dialog,
+                                  gboolean selected)
+{
+    ENTER("rw_dialog %p, selected %d", rw_dialog, selected);
+
+    gtk_container_foreach(GTK_CONTAINER(rw_dialog->perm_vbox),
+                          (GtkCallback)gtk_toggle_button_set_active,
+                          GINT_TO_POINTER(selected));
+
+    gtk_container_foreach(GTK_CONTAINER(rw_dialog->temp_vbox),
+                          (GtkCallback)gtk_toggle_button_set_active,
+                          GINT_TO_POINTER(selected));
+    gnc_reset_warnings_update_widgets(rw_dialog);
+    LEAVE(" ");
+}
+
+
+void
+gnc_reset_warnings_select_all_cb (GtkButton *button,
+                                  gpointer user_data)
+{
+    RWDialog *rw_dialog = user_data;
+    gnc_reset_warnings_select_common(rw_dialog, TRUE);
+}
+
+
+void
+gnc_reset_warnings_unselect_all_cb (GtkButton *button,
+                                    gpointer user_data)
+{
+    RWDialog *rw_dialog = user_data;
+    gnc_reset_warnings_select_common(rw_dialog, FALSE);
+}
+
+
+/***********************************************************************
+ *  This call back function adds a warning to the correct dialog box.
+ *
+ *  @internal
+ *  @param rw_dialog, the data structure
+ *  @param prefs_group the preference group that holds the warning status.
+ *  @param warning a record with details for one warning.
+ *  @param box, the required dialog box to update.
+ ***********************************************************************/
+static void
+gnc_reset_warnings_add_one (RWDialog *rw_dialog, const gchar *prefs_group,
+                            const GncWarningSpec *warning, GtkWidget *box)
+{
+    GtkWidget *checkbox;
+
+    ENTER("rw_dialog %p, warning %p, box %p", rw_dialog, warning, box);
+
+    checkbox = gtk_check_button_new_with_label( _(warning->warn_desc ? warning->warn_desc : warning->warn_name));
+    if (warning->warn_long_desc)
+        gtk_widget_set_tooltip_text(checkbox, _(warning->warn_long_desc));
+
+    gtk_widget_set_name(checkbox, warning->warn_name);
+    g_object_set_data_full (G_OBJECT (checkbox), "prefs-group", g_strdup(prefs_group),
+                            (GDestroyNotify) g_free);
+    g_signal_connect_swapped(G_OBJECT(checkbox), "toggled",
+                             (GCallback)gnc_reset_warnings_update_widgets, rw_dialog);
+    gtk_box_pack_start(GTK_BOX(box), checkbox, TRUE, TRUE, 0);
+    LEAVE(" ");
+}
+
+
+/********************************************************************
+ *  Add all warnings found in the given preference group
+ *  to the dialog box.
+ *
+ *  @internal
+ *  @param The reset warnings data structure
+ *  @param The preference group.
+ *  @param The required dialog box to update.
+ ********************************************************************/
+static void
+gnc_reset_warnings_add_section (RWDialog *rw_dialog, const gchar *prefs_group, GtkWidget *box)
+{
+    const GncWarningSpec *warning = gnc_get_warnings();
+    gint i = 0;
+
+    ENTER("rw_dialog %p, section %s, box %p", rw_dialog, prefs_group, box);
+
+    for (i = 0; warning[i].warn_name; i++)
+    {
+        if (gnc_prefs_get_int(prefs_group, warning[i].warn_name) != 0)
+        {
+            gnc_reset_warnings_add_one(rw_dialog, prefs_group, &warning[i], box);
+        }
+    }
+
+    LEAVE(" ");
+}
+
+
+/***********************************************************************
+ *  Raise the rw dialog to the top of the window stack.  This
+ *  function is called if the user attempts to create a second rw
+ *  dialog.
+ *
+ *  @internal
+ *  @param class_name Unused.
+ *  @param component_id Unused.
+ *  @param user_data A pointer to the rw structure.
+ *  @param iter_data Unused.
+ ***********************************************************************/
+static gboolean
+show_handler (const char *class_name, gint component_id,
+              gpointer user_data, gpointer iter_data)
+{
+    RWDialog *rw_dialog = user_data;
+
+    ENTER(" ");
+    if (!rw_dialog)
+    {
+        LEAVE("no data strucure");
+        return(FALSE);
+    }
+
+    ENTER(" ");
+    gtk_window_present(GTK_WINDOW(rw_dialog->dialog));
+    LEAVE(" ");
+
+    return(TRUE);
+}
+
+
+/****************************************************
+ *  Close the reset warnings dialog.
+ *  @internal
+ *  @param user_data A pointer to the rw structure.
+ ****************************************************/
+static void
+close_handler (gpointer user_data)
+{
+    RWDialog *rw_dialog = user_data;
+
+    ENTER(" ");
+    gnc_unregister_gui_component_by_data(DIALOG_RESET_WARNINGS_CM_CLASS, rw_dialog);
+    gtk_widget_destroy(rw_dialog->dialog);
+    LEAVE(" ");
+}
+
+
+/***********************************************/
+/*     Create the Reset Warnings Dialog        */
+/***********************************************/
+void
+gnc_reset_warnings_dialog (GtkWindow *parent)
+{
+    RWDialog   *rw_dialog;
+    GtkWidget  *dialog;
+    GtkBuilder *builder;
+
+    rw_dialog = g_new0 (RWDialog, 1);
+
+    ENTER("");
+    if (gnc_forall_gui_components(DIALOG_RESET_WARNINGS_CM_CLASS,
+                                  show_handler, NULL))
+    {
+        LEAVE("existing window");
+        return;
+    }
+
+    DEBUG("Opening dialog-reset-warnings.glade:");
+    builder = gtk_builder_new();
+    gnc_builder_add_from_file (builder, "dialog-reset-warnings.glade", "reset_warnings_dialog");
+    dialog = GTK_WIDGET(gtk_builder_get_object (builder, "reset_warnings_dialog"));
+
+    // Set the style context for this dialog so it can be easily manipulated with css
+    gnc_widget_set_style_context (GTK_WIDGET(dialog), "GncResetWarningsDialog");
+
+    gtk_window_set_transient_for(GTK_WINDOW (dialog), parent);
+
+    rw_dialog->dialog = dialog;
+    PINFO("rw_dialog %p, dialog %p", rw_dialog, dialog);
+
+    /* Connect the signals */
+    gtk_builder_connect_signals_full (builder, gnc_builder_connect_full_func, rw_dialog);
+
+    DEBUG("permanent");
+    rw_dialog->perm_vbox_label = GTK_WIDGET(gtk_builder_get_object (builder, "perm_vbox_and_label"));
+    rw_dialog->perm_vbox = GTK_WIDGET(gtk_builder_get_object (builder, "perm_vbox"));
+    gnc_reset_warnings_add_section(rw_dialog, GNC_PREFS_GROUP_WARNINGS_PERM, rw_dialog->perm_vbox);
+
+    DEBUG("temporary");
+    rw_dialog->temp_vbox_label = GTK_WIDGET(gtk_builder_get_object (builder, "temp_vbox_and_label"));
+    rw_dialog->temp_vbox = GTK_WIDGET(gtk_builder_get_object (builder, "temp_vbox"));
+    gnc_reset_warnings_add_section(rw_dialog, GNC_PREFS_GROUP_WARNINGS_TEMP, rw_dialog->temp_vbox);
+
+    rw_dialog->buttonbox = GTK_WIDGET(gtk_builder_get_object (builder, "hbuttonbox"));
+
+    rw_dialog->nolabel = GTK_WIDGET(gtk_builder_get_object (builder, "no_warnings"));
+    rw_dialog->applybutton = GTK_WIDGET(gtk_builder_get_object (builder, "applybutton"));
+
+    /* Enable the proper response buttons */
+    gnc_reset_warnings_update_widgets(rw_dialog);
+
+    /* Record the pointer to the rw data structure and clean up after */
+    g_object_set_data_full(G_OBJECT(rw_dialog->dialog), "dialog-structure", rw_dialog, g_free);
+
+    gnc_restore_window_size(GNC_PREFS_GROUP, GTK_WINDOW(rw_dialog->dialog));
+
+    gnc_register_gui_component (DIALOG_RESET_WARNINGS_CM_CLASS,
+                                NULL, close_handler, rw_dialog);
+
+    gtk_widget_show(GTK_WIDGET(rw_dialog->dialog));
+
+    g_object_unref(G_OBJECT(builder));
+
+    LEAVE(" ");
+}
diff --git a/src/gnome-utils/dialog-reset-warnings.h b/gnucash/gnome-utils/dialog-reset-warnings.h
similarity index 100%
rename from src/gnome-utils/dialog-reset-warnings.h
rename to gnucash/gnome-utils/dialog-reset-warnings.h
diff --git a/src/gnome-utils/dialog-tax-table.c b/gnucash/gnome-utils/dialog-tax-table.c
similarity index 100%
rename from src/gnome-utils/dialog-tax-table.c
rename to gnucash/gnome-utils/dialog-tax-table.c
diff --git a/src/gnome-utils/dialog-tax-table.h b/gnucash/gnome-utils/dialog-tax-table.h
similarity index 100%
rename from src/gnome-utils/dialog-tax-table.h
rename to gnucash/gnome-utils/dialog-tax-table.h
diff --git a/src/gnome-utils/dialog-totd.c b/gnucash/gnome-utils/dialog-totd.c
similarity index 100%
rename from src/gnome-utils/dialog-totd.c
rename to gnucash/gnome-utils/dialog-totd.c
diff --git a/src/gnome-utils/dialog-totd.h b/gnucash/gnome-utils/dialog-totd.h
similarity index 100%
rename from src/gnome-utils/dialog-totd.h
rename to gnucash/gnome-utils/dialog-totd.h
diff --git a/gnucash/gnome-utils/dialog-transfer.c b/gnucash/gnome-utils/dialog-transfer.c
new file mode 100644
index 0000000..2947d9b
--- /dev/null
+++ b/gnucash/gnome-utils/dialog-transfer.c
@@ -0,0 +1,2499 @@
+/********************************************************************\
+ * dialog-transfer.c -- transfer dialog for GnuCash                 *
+ * Copyright (C) 1999 Linas Vepstas                                 *
+ * Copyright (C) 2000 Dave Peticolas                                *
+ * Copyright (C) 2000 Herbert Thoma                                 *
+ *                                                                  *
+ * 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 at gnu.org                   *
+\********************************************************************/
+
+#include "config.h"
+
+#include <gtk/gtk.h>
+#include <gdk/gdkkeysyms.h>
+#include <glib/gi18n.h>
+
+#include "dialog-transfer.h"
+#include "dialog-utils.h"
+#include "gnc-amount-edit.h"
+#include "gnc-component-manager.h"
+#include "gnc-date-edit.h"
+#include "gnc-engine.h"
+#include "gnc-euro.h"
+#include "gnc-exp-parser.h"
+#include "gnc-prefs.h"
+#include "gnc-gui-query.h"
+#include "gnc-pricedb.h"
+#include "gnc-tree-view-account.h"
+#include "gnc-ui.h"
+#include "Transaction.h"
+#include "Account.h"
+#include <libguile.h>
+#include "swig-runtime.h"
+#include "guile-mappings.h"
+#include "engine-helpers.h"
+#include "engine-helpers-guile.h"
+#include "QuickFill.h"
+#include <gnc-commodity.h>
+
+
+#define DIALOG_TRANSFER_CM_CLASS "dialog-transfer"
+#define GNC_PREFS_GROUP "dialogs.transfer"
+
+typedef enum
+{
+    XFER_DIALOG_FROM,
+    XFER_DIALOG_TO
+} XferDirection;
+
+
+/* This static indicates the debugging module that this .o belongs to.  */
+static QofLogModule log_module = GNC_MOD_GUI;
+
+struct _xferDialog
+{
+    GtkWidget *dialog;
+    GtkWidget *amount_edit;
+    GtkWidget *date_entry;
+    GtkWidget *num_entry;
+    GtkWidget *description_entry;
+    GtkWidget *memo_entry;
+    GtkWidget *conv_forward;
+    GtkWidget *conv_reverse;
+
+    GtkWidget *from_window;
+    GtkTreeView * from_tree_view;
+    gnc_commodity *from_commodity;
+    GtkWidget *to_window;
+    GtkTreeView *to_tree_view;
+    gnc_commodity *to_commodity;
+
+    QuickFill *qf;     /* Quickfill on transfer descriptions,
+                          defaults to matching on the "From" account. */
+
+    XferDirection quickfill;    /* direction match on the account instead. */
+
+    /* stored data for the description quickfill selection function */
+    gint desc_start_selection;
+    gint desc_end_selection;
+    guint desc_selection_source_id;
+
+    GtkWidget *transferinfo_label;
+
+    GtkWidget *from_transfer_label;
+    GtkWidget *to_transfer_label;
+
+    GtkWidget *from_currency_label;
+    GtkWidget *to_currency_label;
+
+    GtkWidget *from_show_button;
+    GtkWidget *to_show_button;
+
+    GtkWidget *curr_xfer_table;
+
+    GtkWidget *price_edit;
+    GtkWidget *to_amount_edit;
+
+    GtkWidget *price_radio;
+    GtkWidget *amount_radio;
+
+    GtkWidget *fetch_button;
+
+    QofBook *book;
+    GNCPriceDB *pricedb;
+
+    /* Where to store the "exchange_rate" at exit (in lieu of
+     * creating a transaction)
+     */
+    gnc_numeric *exch_rate;
+    PriceSource price_source;
+    const char *price_type;
+
+    /* Callback function to notify of the newly created Transaction */
+    gnc_xfer_dialog_cb transaction_cb;
+    /* , and its user_data */
+    gpointer transaction_user_data;
+};
+
+/** Structure passed to "filter tree accounts" function to provide it information */
+typedef struct
+{
+    /** Show income/expense accounts in tree */
+    gboolean show_inc_exp;
+
+    /** Show hidden accounts in tree */
+    gboolean show_hidden;
+} AccountTreeFilterInfo;
+
+static AccountTreeFilterInfo *from_info = NULL;
+static AccountTreeFilterInfo *to_info   = NULL;
+
+struct _acct_list_item
+{
+    char *acct_full_name;
+    Account *acct;
+};
+typedef struct _acct_list_item acct_list_item;
+
+
+/** Prototypes ***************************************************/
+static void gnc_xfer_update_to_amount (XferDialog *xferData);
+static void gnc_xfer_dialog_update_conv_info(XferDialog *xferData);
+
+static Account *gnc_transfer_dialog_get_selected_account (XferDialog *dialog,
+                                                          XferDirection direction);
+static void gnc_transfer_dialog_set_selected_account (XferDialog *dialog,
+                                                      Account *account,
+                                                      XferDirection direction);
+
+void gnc_xfer_description_insert_cb(GtkEditable *editable,
+                                    const gchar *insert_text,
+                                    const gint insert_text_len,
+                                    gint *start_pos,
+                                    XferDialog *xferData);
+gboolean gnc_xfer_description_key_press_cb( GtkEntry *entry,
+                                            GdkEventKey *event,
+                                            XferDialog *xferData );
+void gnc_xfer_dialog_fetch (GtkButton *button, XferDialog *xferData);
+gboolean gnc_xfer_dialog_inc_exp_filter_func (Account *account,
+                                              gpointer data);
+void price_amount_radio_toggled_cb(GtkToggleButton *togglebutton, gpointer data);
+
+void gnc_xfer_dialog_response_cb (GtkDialog *dialog, gint response, gpointer data);
+void gnc_xfer_dialog_close_cb(GtkDialog *dialog, gpointer data);
+
+/** Implementations **********************************************/
+
+static gnc_numeric
+gnc_xfer_dialog_compute_price_value (XferDialog *xferData)
+{
+    gnc_numeric from_amt, to_amt;
+    g_return_val_if_fail (xferData != NULL, gnc_numeric_error (GNC_ERROR_ARG));
+
+    from_amt = gnc_amount_edit_get_amount(GNC_AMOUNT_EDIT(xferData->amount_edit));
+    to_amt = gnc_amount_edit_get_amount(GNC_AMOUNT_EDIT(xferData->to_amount_edit));
+
+    return(gnc_numeric_div(to_amt, from_amt, GNC_DENOM_AUTO, GNC_HOW_DENOM_REDUCE));
+}
+
+/* Round a price value according to this policy:
+ * If both commodities are currencies, round to a fixed denominator.
+ * If only one is a currency, round to the currency's scu * a fixed factor.
+ * The fixed values are defined in gnc-pricedb.h
+ */
+static gnc_numeric
+round_price(gnc_commodity *from, gnc_commodity *to, gnc_numeric value)
+{
+    if (gnc_commodity_is_currency(from) && gnc_commodity_is_currency(to))
+        value = gnc_numeric_convert(value, CURRENCY_DENOM,
+                                    GNC_HOW_RND_ROUND_HALF_UP);
+    else if (gnc_commodity_is_currency(to))
+    {
+        int scu = gnc_commodity_get_fraction (to);
+        value = gnc_numeric_convert(value, scu * COMMODITY_DENOM_MULT,
+                                    GNC_HOW_RND_ROUND_HALF_UP);
+    }
+    else if (gnc_commodity_is_currency(from))
+    {
+        int scu = gnc_commodity_get_fraction (from);
+        value = gnc_numeric_convert(value, scu * COMMODITY_DENOM_MULT,
+                                    GNC_HOW_RND_ROUND_HALF_UP);
+    }
+    return value;
+}
+
+typedef enum
+{
+    SAME_DAY,
+    NEAREST,
+    LATEST
+} PriceDate;
+
+typedef struct
+{
+    GNCPrice *price;
+    GNCPriceDB *pricedb;
+    gnc_commodity *from;
+    gnc_commodity *to;
+    Timespec ts;
+    gboolean reverse;
+} PriceReq;
+
+static void
+price_request_from_xferData(PriceReq *pr, XferDialog *xd)
+{
+    g_return_if_fail (pr != NULL);
+    g_return_if_fail (xd != NULL);
+    pr->price = NULL;
+    pr->pricedb = xd->pricedb;
+    pr->from = xd->from_commodity;
+    pr->to = xd->to_commodity;
+    pr->ts = gnc_date_edit_get_date_ts (GNC_DATE_EDIT (xd->date_entry));
+    pr->reverse = FALSE;
+}
+
+static gboolean
+lookup_price(PriceReq *pr, PriceDate pd)
+{
+    GNCPrice *prc = NULL;
+    g_return_val_if_fail (pr != NULL, FALSE);
+    g_return_val_if_fail (pr->pricedb != NULL, FALSE);
+    g_return_val_if_fail (pr->from != NULL, FALSE);
+    g_return_val_if_fail (pr->to != NULL, FALSE);
+
+    pr->reverse = FALSE;
+    switch (pd)
+    {
+        default:
+        case SAME_DAY:
+            prc = gnc_pricedb_lookup_day (pr->pricedb, pr->from,
+                                          pr->to, pr->ts);
+            break;
+        case NEAREST:
+            prc = gnc_pricedb_lookup_nearest_in_time (pr->pricedb, pr->from,
+                                                      pr->to, pr->ts);
+            break;
+        case LATEST:
+            prc = gnc_pricedb_lookup_latest (pr->pricedb, pr->from, pr->to);
+            break;
+    }
+    if (gnc_commodity_equiv(gnc_price_get_currency(prc), pr->from))
+    {
+        pr->reverse = TRUE;
+        PINFO("Found reverse price: 1 %s = %f %s",
+              gnc_commodity_get_mnemonic(pr->to),
+              gnc_numeric_to_double(gnc_price_get_value(prc)),
+              gnc_commodity_get_mnemonic(pr->from));
+
+    }
+    else
+    {
+        PINFO("Found price: 1 %s = %f %s",
+              gnc_commodity_get_mnemonic(pr->from),
+              gnc_numeric_to_double(gnc_price_get_value(prc)),
+              gnc_commodity_get_mnemonic(pr->to));
+    }
+    if (!prc)
+        return FALSE;
+    pr->price = prc;
+    return TRUE;
+}
+
+/* (maybe) update the price from the pricedb. */
+static void
+gnc_xfer_dialog_update_price (XferDialog *xferData)
+{
+    PriceReq pr;
+    gnc_numeric price_value;
+
+    if (!xferData) return;
+    if (!xferData->from_commodity || ! xferData->to_commodity) return;
+    if (gnc_commodity_equal (xferData->from_commodity, xferData->to_commodity))
+        return;
+    if (!xferData->pricedb) return;
+
+    price_request_from_xferData(&pr, xferData);
+    if (!lookup_price(&pr, SAME_DAY))
+        if (!lookup_price(&pr, NEAREST))
+        return;
+
+    /* grab the price from the pricedb */
+    price_value = gnc_price_get_value (pr.price);
+    if (pr.reverse)
+        price_value = gnc_numeric_invert (price_value);
+    gnc_price_unref(pr.price);
+
+    /* and set the price entry */
+    gnc_xfer_dialog_set_price_edit(xferData, price_value);
+
+    /* And then update the to_amount */
+    gnc_xfer_update_to_amount (xferData);
+}
+
+static void
+gnc_xfer_dialog_toggle_cb(GtkToggleButton *button, gpointer data)
+{
+    AccountTreeFilterInfo* info;
+    GncTreeViewAccount* treeview = GNC_TREE_VIEW_ACCOUNT (data);
+
+    info = g_object_get_data (G_OBJECT(treeview), "filter-info");
+    if (info)
+    {
+        info->show_inc_exp = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button));
+        info->show_hidden = FALSE;
+
+        gnc_tree_view_account_refilter (treeview);
+    }
+}
+
+static gboolean
+gnc_xfer_dialog_key_press_cb (GtkWidget   *widget,
+                              GdkEventKey *event,
+                              gpointer     unused)
+{
+    GtkWidget *toplevel;
+
+    if ((event->keyval == GDK_KEY_Return) || (event->keyval == GDK_KEY_KP_Enter))
+    {
+        toplevel = gtk_widget_get_toplevel (widget);
+        if (gtk_widget_is_toplevel(toplevel) && GTK_IS_WINDOW(toplevel))
+        {
+            gtk_window_activate_default(GTK_WINDOW(toplevel));
+            return TRUE;
+        }
+    }
+    return FALSE;
+}
+
+static void
+gnc_xfer_dialog_set_price_auto (XferDialog *xferData,
+                                gboolean currency_active,
+                                const gnc_commodity *from_currency,
+                                const gnc_commodity *to_currency)
+{
+    gnc_numeric from_rate;
+    gnc_numeric to_rate;
+    gnc_numeric price_value;
+
+    if (!currency_active)
+    {
+        GtkEntry *entry;
+        gnc_xfer_dialog_set_price_edit(xferData, gnc_numeric_zero());
+        entry = GTK_ENTRY(gnc_amount_edit_gtk_entry
+                          (GNC_AMOUNT_EDIT(xferData->price_edit)));
+        gtk_entry_set_text(entry, "");
+
+        gnc_xfer_update_to_amount (xferData);
+
+        return;
+    }
+
+    if (!gnc_is_euro_currency (from_currency) ||
+        !gnc_is_euro_currency (to_currency))
+    {
+        gnc_xfer_dialog_update_price (xferData);
+        return;
+    }
+
+    from_rate = gnc_euro_currency_get_rate (from_currency);
+    to_rate = gnc_euro_currency_get_rate (to_currency);
+
+    if (gnc_numeric_zero_p (from_rate) || gnc_numeric_zero_p (to_rate))
+        gnc_xfer_dialog_update_price (xferData);
+
+    price_value = gnc_numeric_div (to_rate, from_rate, GNC_DENOM_AUTO, GNC_HOW_DENOM_REDUCE);
+
+    gnc_amount_edit_set_amount (GNC_AMOUNT_EDIT(xferData->price_edit), price_value);
+
+    gnc_xfer_update_to_amount (xferData);
+}
+
+static void
+gnc_xfer_dialog_curr_acct_activate(XferDialog *xferData)
+{
+    Account *to_account;
+    Account *from_account;
+    gboolean curr_active;
+
+    g_return_if_fail (xferData != NULL);
+    from_account =
+        gnc_transfer_dialog_get_selected_account (xferData, XFER_DIALOG_FROM);
+
+    to_account =
+        gnc_transfer_dialog_get_selected_account (xferData, XFER_DIALOG_TO);
+
+    curr_active = (xferData->exch_rate ||
+                   ((from_account != NULL) && (to_account != NULL)))
+        && !gnc_commodity_equiv(xferData->from_commodity,
+                                xferData->to_commodity);
+
+    gtk_widget_set_sensitive(xferData->curr_xfer_table, curr_active);
+    gtk_widget_set_sensitive(xferData->price_edit,
+                             curr_active && gtk_toggle_button_get_active
+                             (GTK_TOGGLE_BUTTON(xferData->price_radio)));
+    gtk_widget_set_sensitive(xferData->to_amount_edit,
+                             curr_active && gtk_toggle_button_get_active
+                             (GTK_TOGGLE_BUTTON(xferData->amount_radio)));
+    gtk_widget_set_sensitive(xferData->price_radio, curr_active);
+    gtk_widget_set_sensitive(xferData->amount_radio, curr_active);
+
+    gnc_xfer_dialog_set_price_auto (xferData, curr_active,
+                                    xferData->from_commodity, xferData->to_commodity);
+    gnc_xfer_dialog_update_conv_info(xferData);
+
+    if (!curr_active)
+    {
+        GtkEntry *entry;
+
+        gnc_amount_edit_set_amount(GNC_AMOUNT_EDIT(xferData->to_amount_edit),
+                                   gnc_numeric_zero ());
+        entry = GTK_ENTRY(gnc_amount_edit_gtk_entry
+                          (GNC_AMOUNT_EDIT(xferData->to_amount_edit)));
+        gtk_entry_set_text(entry, "");
+    }
+}
+
+
+void
+price_amount_radio_toggled_cb(GtkToggleButton *togglebutton, gpointer data)
+{
+    XferDialog *xferData = data;
+    g_return_if_fail (xferData != NULL);
+
+    gtk_widget_set_sensitive(xferData->price_edit, gtk_toggle_button_get_active
+                             (GTK_TOGGLE_BUTTON(xferData->price_radio)));
+    gtk_widget_set_sensitive(xferData->to_amount_edit,
+                             gtk_toggle_button_get_active
+                             (GTK_TOGGLE_BUTTON(xferData->amount_radio)));
+}
+
+
+/* Reload the xferDialog quickfill with the descriptions
+ * from the currently selected from account.  Note that this
+ * doesn't use the initial account passed into gnc_xfer_dialog,
+ * because that's NULL if no account is selected in the main
+ * account window tree view.
+ */
+static void
+gnc_xfer_dialog_reload_quickfill( XferDialog *xferData )
+{
+    GList *splitlist, *node;
+    Split *split;
+    Transaction *trans;
+    Account *account;
+
+    account = gnc_transfer_dialog_get_selected_account (xferData, xferData->quickfill);
+
+    /* get a new QuickFill to use */
+    gnc_quickfill_destroy( xferData->qf );
+    xferData->qf = gnc_quickfill_new();
+
+    splitlist = xaccAccountGetSplitList( account );
+
+    for ( node = splitlist; node; node = node->next )
+    {
+        split = node->data;
+        trans = xaccSplitGetParent( split );
+        gnc_quickfill_insert( xferData->qf,
+                              xaccTransGetDescription (trans), QUICKFILL_LIFO);
+    }
+}
+
+
+static void
+gnc_xfer_dialog_from_tree_selection_changed_cb (GtkTreeSelection *selection,
+                                                gpointer data)
+{
+    XferDialog *xferData = data;
+    GNCPrintAmountInfo print_info;
+    gnc_commodity *commodity;
+    Account *account;
+
+    account = gnc_transfer_dialog_get_selected_account (xferData, XFER_DIALOG_FROM);
+    if (!account)
+        return;
+
+    commodity = gnc_account_or_default_currency(account, NULL);
+    gtk_label_set_text(GTK_LABEL(xferData->from_currency_label),
+                       gnc_commodity_get_printname(commodity));
+
+    xferData->from_commodity = commodity;
+
+    print_info = gnc_account_print_info (account, FALSE);
+    gnc_amount_edit_set_print_info (GNC_AMOUNT_EDIT (xferData->amount_edit),
+                                    print_info);
+    gnc_amount_edit_set_fraction (GNC_AMOUNT_EDIT (xferData->amount_edit),
+                                  xaccAccountGetCommoditySCU (account));
+
+    gnc_xfer_dialog_curr_acct_activate(xferData);
+
+    /* Reload the xferDialog quickfill if it is based on the from account */
+    if (xferData->quickfill == XFER_DIALOG_FROM)
+        gnc_xfer_dialog_reload_quickfill(xferData);
+}
+
+
+static void
+gnc_xfer_dialog_to_tree_selection_changed_cb (GtkTreeSelection *selection, gpointer data)
+{
+    XferDialog *xferData = data;
+    GNCPrintAmountInfo print_info;
+    gnc_commodity *commodity;
+    Account *account;
+
+    account = gnc_transfer_dialog_get_selected_account (xferData, XFER_DIALOG_TO);
+    if (!account)
+        return;
+
+    commodity = xaccAccountGetCommodity(account);
+    gtk_label_set_text(GTK_LABEL(xferData->to_currency_label),
+                       gnc_commodity_get_printname(commodity));
+
+    xferData->to_commodity = commodity;
+
+    print_info = gnc_account_print_info (account, FALSE);
+    gnc_amount_edit_set_print_info (GNC_AMOUNT_EDIT (xferData->to_amount_edit),
+                                    print_info);
+    gnc_amount_edit_set_fraction (GNC_AMOUNT_EDIT (xferData->to_amount_edit),
+                                  xaccAccountGetCommoditySCU (account));
+
+    gnc_xfer_dialog_curr_acct_activate(xferData);
+
+    /* Reload the xferDialog quickfill if it is based on the to account */
+    if (xferData->quickfill == XFER_DIALOG_TO)
+        gnc_xfer_dialog_reload_quickfill(xferData);
+}
+
+gboolean
+gnc_xfer_dialog_inc_exp_filter_func (Account *account,
+                                     gpointer data)
+{
+    AccountTreeFilterInfo* info;
+    GNCAccountType type;
+
+    info = (AccountTreeFilterInfo*)data;
+
+    if (!info->show_hidden && xaccAccountIsHidden(account))
+    {
+        return FALSE;
+    }
+
+    if (info->show_inc_exp)
+    {
+        return TRUE;
+    }
+
+    type = xaccAccountGetType(account);
+    return ((type != ACCT_TYPE_INCOME) && (type != ACCT_TYPE_EXPENSE));
+}
+
+static void
+gnc_xfer_dialog_fill_tree_view(XferDialog *xferData,
+                               XferDirection direction)
+{
+    GtkTreeView *tree_view;
+    const char *show_inc_exp_message = _("Show the income and expense accounts");
+    GtkWidget *scroll_win;
+    GtkWidget *button;
+    GtkTreeSelection *selection;
+    gboolean  use_accounting_labels;
+    AccountTreeFilterInfo *info;
+    GtkBuilder *builder = g_object_get_data (G_OBJECT (xferData->dialog), "builder");
+
+    g_return_if_fail (xferData != NULL);
+    use_accounting_labels = gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL,
+                                               GNC_PREF_ACCOUNTING_LABELS);
+
+    /* In "normal" mode (non accounting terms) the account where the
+     * money comes from is displayed on the left side and the account
+     * where the money gets transferred to is displayed on the right
+     * side. In accounting terms the "from" account is called the
+     * "credit" account ("Haben" in german) and the "to" account is
+     * called "debit" account ("Soll" in german). Accountants told me
+     * that they always want the credit account on the right side
+     * and the debit on the left side (like the debit and credit
+     * columns in the register window). So reverse from and to account
+     * trees when in "accountant" mode. -- Herbert Thoma, 2004-01-18
+     */
+    if (use_accounting_labels)
+    {
+        button = GTK_WIDGET(gtk_builder_get_object (builder,
+                                                    (direction == XFER_DIALOG_TO) ?
+                                                    "left_show_button" : "right_show_button"));
+        scroll_win = GTK_WIDGET(gtk_builder_get_object (builder,
+                                                        (direction == XFER_DIALOG_TO) ?
+                                                        "left_trans_window" : "right_trans_window"));
+    }
+    else
+    {
+        button = GTK_WIDGET(gtk_builder_get_object (builder,
+                                                    (direction == XFER_DIALOG_TO) ?
+                                                    "right_show_button" : "left_show_button"));
+        scroll_win = GTK_WIDGET(gtk_builder_get_object (builder,
+                                                        (direction == XFER_DIALOG_TO) ?
+                                                        "right_trans_window" : "left_trans_window"));
+    }
+
+
+    if (direction == XFER_DIALOG_TO)
+        info = to_info;
+    else
+        info = from_info;
+
+    tree_view = GTK_TREE_VIEW(gnc_tree_view_account_new(FALSE));
+    gtk_container_add(GTK_CONTAINER(scroll_win), GTK_WIDGET(tree_view));
+    info->show_inc_exp = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button));
+    info->show_hidden = FALSE;
+    gnc_tree_view_account_set_filter (GNC_TREE_VIEW_ACCOUNT (tree_view),
+                                      gnc_xfer_dialog_inc_exp_filter_func,
+                                      info,  /* user data */
+                                      NULL    /* destroy callback */);
+    g_object_set_data (G_OBJECT(tree_view), "filter-info", info);
+
+    gtk_widget_show(GTK_WIDGET(tree_view));
+    g_signal_connect (G_OBJECT (tree_view), "key-press-event",
+                      G_CALLBACK (gnc_xfer_dialog_key_press_cb), NULL);
+
+    selection = gtk_tree_view_get_selection (tree_view);
+    gtk_tree_selection_set_mode (selection, GTK_SELECTION_BROWSE);
+
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), FALSE);
+    gtk_widget_set_tooltip_text (button, show_inc_exp_message);
+
+    if (direction == XFER_DIALOG_TO)
+    {
+        xferData->to_tree_view = tree_view;
+        xferData->to_window = scroll_win;
+        xferData->to_show_button = GTK_WIDGET (button);
+        g_signal_connect (G_OBJECT (selection), "changed",
+                          G_CALLBACK (gnc_xfer_dialog_to_tree_selection_changed_cb), xferData);
+    }
+    else
+    {
+        xferData->from_tree_view = tree_view;
+        xferData->from_window = scroll_win;
+        xferData->from_show_button = GTK_WIDGET (button);
+        g_signal_connect (G_OBJECT (selection), "changed",
+                          G_CALLBACK (gnc_xfer_dialog_from_tree_selection_changed_cb), xferData);
+    }
+    g_signal_connect (G_OBJECT (button), "toggled",
+                      G_CALLBACK (gnc_xfer_dialog_toggle_cb), tree_view);
+}
+
+
+static void
+gnc_parse_error_dialog (XferDialog *xferData, const char *error_string)
+{
+    const char * parse_error_string;
+    g_return_if_fail (xferData != NULL);
+
+    parse_error_string = gnc_exp_parser_error_string ();
+    if (parse_error_string == NULL)
+        parse_error_string = "";
+
+    if (error_string == NULL)
+        error_string = "";
+
+    gnc_error_dialog (xferData->dialog,
+                      "%s\n\n%s: %s.",
+                      error_string, _("Error"),
+                      parse_error_string);
+}
+
+/*** Callbacks for description quickfill. ***/
+
+/* gnc_xfer_dialog_quickfill will update the fields of the dialog
+ * based on the contents of the Description entry.  Returns TRUE
+ * if the fields were updated, or FALSE if the fields were already
+ * updated or if the Description couldn't be matched and no updates
+ * were made.
+ */
+static gboolean
+gnc_xfer_dialog_quickfill( XferDialog *xferData )
+{
+    const char *desc;
+    Account *match_account;  /* the matched text was from this account */
+    Split *split;            /* the split to autocomplete from */
+    Split *other = NULL;     /* the other split of the transaction */
+    Account *other_acct = NULL;   /* the Account of the other split */
+    gboolean changed = FALSE;
+
+    ENTER("xferData=%p", xferData);
+    if ( !xferData )
+    {
+        LEAVE("bad args");
+        return( FALSE );
+    }
+
+    match_account = gnc_transfer_dialog_get_selected_account (xferData, xferData->quickfill);
+
+    desc = gtk_entry_get_text( GTK_ENTRY(xferData->description_entry) );
+
+    if ( !desc || desc[0] == '\0' )  /* no description to match */
+        return( FALSE );
+
+    split = xaccAccountFindSplitByDesc( match_account, desc );
+
+    if ( !split )
+    {
+        LEAVE("split not found");
+        return( FALSE );
+    }
+    DEBUG("split=%p", split);
+
+    /* Now update any blank fields of the transfer dialog with
+     * the memo and amount from the split, and the description
+     * we were passed (assumed to match the split's transaction).
+     */
+
+    if ( gnc_numeric_zero_p(
+             gnc_amount_edit_get_amount(GNC_AMOUNT_EDIT(xferData->amount_edit))))
+    {
+        gnc_numeric amt;
+        DEBUG("updating amount");
+        amt = xaccSplitGetValue( split );
+
+        /* If we've matched a previous transfer, it will appear
+         * to be negative in the from account.
+         * Need to swap the sign in order for this value
+         * to be posted as a withdrawal from the "from" account.
+         */
+        if ( gnc_numeric_negative_p( amt ) )
+            amt = gnc_numeric_neg( amt );
+
+        gnc_amount_edit_set_amount( GNC_AMOUNT_EDIT(xferData->amount_edit), amt );
+        changed = TRUE;
+    }
+
+    if ( !g_strcmp0(gtk_entry_get_text(GTK_ENTRY(xferData->memo_entry)), "" ))
+    {
+        DEBUG("updating memo");
+        gtk_entry_set_text( GTK_ENTRY(xferData->memo_entry),
+                            xaccSplitGetMemo( split ) );
+        changed = TRUE;
+    }
+
+    /* Since we're quickfilling off of one account (either from or to)
+     * that account must be the account of the matched split.
+     * Find the other account from the other split,
+     * and select that account in the appropriate account tree.
+     */
+    if ( ( other = xaccSplitGetOtherSplit( split ) ) &&
+         ( other_acct = xaccSplitGetAccount( other ) ) )
+    {
+        GNCAccountType other_type;
+        GtkWidget *other_button;
+        XferDirection other_direction;
+
+        DEBUG("updating other split");
+        if (xferData->quickfill == XFER_DIALOG_FROM)
+        {
+            other_button = xferData->to_show_button;
+            other_direction = XFER_DIALOG_TO;
+        }
+        else
+        {
+            other_button = xferData->from_show_button;
+            other_direction = XFER_DIALOG_FROM;
+        }
+
+        other_type = xaccAccountGetType(other_acct);
+
+        /* Don't want to deactivate the button just because this
+         * isn't an income or expense account
+         */
+        if ( (other_type == ACCT_TYPE_EXPENSE) || (other_type == ACCT_TYPE_INCOME) )
+            gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(other_button), TRUE);
+
+        gnc_transfer_dialog_set_selected_account (xferData, other_acct, other_direction);
+
+        changed = TRUE;
+    }
+
+    return( changed );
+}
+
+static gboolean
+idle_select_region(gpointer data)
+{
+    XferDialog *xferData = data;
+    g_return_val_if_fail(xferData, FALSE);
+
+    gtk_editable_select_region(GTK_EDITABLE(xferData->description_entry),
+                               xferData->desc_start_selection,
+                               xferData->desc_end_selection);
+
+    xferData->desc_selection_source_id = 0;
+    return FALSE;
+}
+
+/* The insert_cb will do the insert and quickfill if possible and set the
+ * cursor position accordingly.  It will not set the selection but will register
+ * idle_select_region to do that once the program returns to its main loop.
+ */
+void
+gnc_xfer_description_insert_cb(GtkEditable *editable,
+                               const gchar *insert_text,
+                               const gint insert_text_len,
+                               gint *start_pos,
+                               XferDialog *xferData)
+{
+    gchar *prefix, *suffix, *new_text;
+    QuickFill *match;
+    const gchar *match_str;
+    gint prefix_len, new_text_len, match_str_len;
+
+    g_return_if_fail (xferData != NULL);
+
+    if (insert_text_len <= 0)
+        return;
+
+    suffix = gtk_editable_get_chars(editable, *start_pos, -1);
+
+    /* If we are inserting in the middle, do nothing */
+    if (*suffix)
+    {
+        g_free(suffix);
+        return;
+    }
+    g_free(suffix);
+
+    prefix = gtk_editable_get_chars(editable, 0, *start_pos);
+    new_text = g_strconcat(prefix, insert_text, (gchar*) NULL);
+    prefix_len = strlen(prefix);
+    new_text_len = prefix_len + insert_text_len;
+    g_free(prefix);
+
+    if ((match = gnc_quickfill_get_string_match(xferData->qf, new_text))
+        && (match_str = gnc_quickfill_string(match))
+        && ((match_str_len = strlen(match_str)) > new_text_len))
+    {
+        g_signal_handlers_block_matched (G_OBJECT (editable),
+                                         G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, xferData);
+
+        gtk_editable_insert_text(editable,
+                                 match_str + prefix_len,
+                                 match_str_len - prefix_len,
+                                 start_pos);
+
+        g_signal_handlers_unblock_matched (G_OBJECT (editable),
+                                           G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, xferData);
+
+        /* stop the current insert */
+        g_signal_stop_emission_by_name (G_OBJECT (editable), "insert_text");
+
+        /* set the position */
+        *start_pos = g_utf8_strlen(new_text, -1);
+
+        /* select region on idle, because it would be reset once this function
+           finishes */
+        xferData->desc_start_selection = *start_pos;
+        xferData->desc_end_selection = -1;
+        xferData->desc_selection_source_id = g_idle_add(idle_select_region,
+                                                        xferData);
+    }
+    g_free(new_text);
+}
+
+gboolean
+gnc_xfer_description_key_press_cb( GtkEntry *entry,
+                                   GdkEventKey *event,
+                                   XferDialog *xferData )
+{
+    gboolean done_with_input = FALSE;
+
+    /* Most "special" keys are allowed to be handled directly by
+     * the entry's key press handler, but in some cases that doesn't
+     * seem to work right, so handle them here.
+     */
+    ENTER(" ");
+    switch ( event->keyval )
+    {
+        case GDK_KEY_Return:
+        case GDK_KEY_KP_Enter:
+            gnc_xfer_dialog_quickfill( xferData );
+            /* NOT done with input, activate the default button of the dialog. */
+            break;
+
+        case GDK_KEY_Tab:
+        case GDK_KEY_ISO_Left_Tab:
+            if ( !( event->state & GDK_SHIFT_MASK) )    /* Complete on Tab,
+                                                         * but not Shift-Tab */
+            {
+                gnc_xfer_dialog_quickfill( xferData );
+                /* NOT done with input, though, since we need to focus to the next
+                 * field.  Unselect the current field, though.
+                 */
+                gtk_editable_select_region( GTK_EDITABLE(xferData->description_entry),
+                                            0, 0 );
+            }
+            break;
+    }
+
+    LEAVE("done=%d", done_with_input);
+    return( done_with_input );
+}
+
+/*** End of quickfill-specific callbacks ***/
+
+static void
+gnc_xfer_dialog_update_conv_info (XferDialog *xferData)
+{
+    const gchar *to_mnemonic, *from_mnemonic;
+    gchar *string;
+    gnc_numeric rate;
+
+    from_mnemonic = gnc_commodity_get_mnemonic(xferData->from_commodity);
+    to_mnemonic = gnc_commodity_get_mnemonic(xferData->to_commodity);
+
+    /* On the theory that if we don't have a mnemonic then we don't
+     * have a commodity...  On Solaris this crashes without a string.
+     * So, just leave now and wait for the second initialization to
+     * occur.
+     */
+    if (!from_mnemonic || !to_mnemonic)
+        return;
+
+    rate = gnc_amount_edit_get_amount(GNC_AMOUNT_EDIT(xferData->price_edit));
+    if (gnc_numeric_zero_p(rate))
+    {
+        string = g_strdup_printf("1 %s = x %s", from_mnemonic, to_mnemonic);
+        gtk_label_set_text(GTK_LABEL(xferData->conv_forward), string);
+        g_free(string);
+
+        string = g_strdup_printf("1 %s = x %s", to_mnemonic, from_mnemonic);
+        gtk_label_set_text(GTK_LABEL(xferData->conv_reverse), string);
+        g_free(string);
+    }
+    else
+    {
+        string = g_strdup_printf("1 %s = %f %s", from_mnemonic,
+                                 gnc_numeric_to_double(rate), to_mnemonic);
+        gtk_label_set_text(GTK_LABEL(xferData->conv_forward), string);
+        g_free(string);
+
+        rate = gnc_numeric_invert(rate);
+        string = g_strdup_printf("1 %s = %f %s", to_mnemonic,
+                                 gnc_numeric_to_double(rate), from_mnemonic);
+        gtk_label_set_text(GTK_LABEL(xferData->conv_reverse), string);
+        g_free(string);
+    }
+}
+
+static gboolean
+gnc_xfer_amount_update_cb(GtkWidget *widget, GdkEventFocus *event,
+                          gpointer data)
+{
+    XferDialog * xferData = data;
+    g_return_val_if_fail (xferData != NULL, FALSE);
+
+    gnc_amount_edit_evaluate (GNC_AMOUNT_EDIT (xferData->amount_edit));
+
+    gnc_xfer_update_to_amount (xferData);
+
+    return FALSE;
+}
+
+
+static void
+gnc_xfer_update_to_amount (XferDialog *xferData)
+{
+    GNCAmountEdit *amount_edit, *price_edit, *to_amount_edit;
+    gnc_numeric price_value, to_amount;
+    Account *account;
+    int scu = 0;
+
+    g_return_if_fail(xferData);
+
+    xferData->price_source = PRICE_SOURCE_USER_PRICE;
+
+    /* Get the amount editing controls of the dialog. */
+    amount_edit     = GNC_AMOUNT_EDIT(xferData->amount_edit);
+    price_edit      = GNC_AMOUNT_EDIT(xferData->price_edit);
+    to_amount_edit  = GNC_AMOUNT_EDIT(xferData->to_amount_edit);
+
+    /* Determine the SCU (smallest commodity unit) of the "to" amount. */
+    account = gnc_transfer_dialog_get_selected_account(xferData, XFER_DIALOG_TO);
+    if (account == NULL)
+        account = gnc_transfer_dialog_get_selected_account(xferData,
+                                                           XFER_DIALOG_FROM);
+    if (account != NULL)
+        scu = xaccAccountGetCommoditySCU(account);
+    else if (xferData->to_commodity != NULL)
+        scu = gnc_commodity_get_fraction(xferData->to_commodity);
+
+    /* Determine the amount to transfer. */
+    if (!gnc_amount_edit_evaluate(price_edit) ||
+        gnc_numeric_zero_p(price_value = gnc_amount_edit_get_amount(price_edit)))
+        to_amount = gnc_numeric_zero();
+    else
+        to_amount = gnc_numeric_mul(gnc_amount_edit_get_amount(amount_edit),
+                                    price_value, scu, GNC_HOW_RND_ROUND_HALF_UP);
+
+    /* Update the dialog. */
+    gnc_amount_edit_set_amount(to_amount_edit, to_amount);
+    if (gnc_numeric_zero_p(to_amount))
+        gtk_entry_set_text(GTK_ENTRY(gnc_amount_edit_gtk_entry(to_amount_edit)),
+                           "");
+
+    gnc_xfer_dialog_update_conv_info(xferData);
+}
+
+
+static gboolean
+gnc_xfer_price_update_cb(GtkWidget *widget, GdkEventFocus *event,
+                         gpointer data)
+{
+    XferDialog *xferData = data;
+
+    gnc_xfer_update_to_amount (xferData);
+    xferData->price_type = PRICE_TYPE_TRN;
+
+
+    return FALSE;
+}
+
+static gboolean
+gnc_xfer_date_changed_cb(GtkWidget *widget, gpointer data)
+{
+    XferDialog *xferData = data;
+
+    if (xferData)
+        gnc_xfer_dialog_update_price (xferData);
+
+    return FALSE;
+}
+
+static gboolean
+gnc_xfer_to_amount_update_cb(GtkWidget *widget, GdkEventFocus *event,
+                             gpointer data)
+{
+    XferDialog *xferData = data;
+    gnc_numeric price_value;
+
+    gnc_amount_edit_evaluate (GNC_AMOUNT_EDIT (xferData->to_amount_edit));
+    price_value = gnc_xfer_dialog_compute_price_value(xferData);
+    gnc_amount_edit_set_amount(GNC_AMOUNT_EDIT(xferData->price_edit),
+                               price_value);
+    xferData->price_source = PRICE_SOURCE_XFER_DLG_VAL;
+    xferData->price_type = PRICE_TYPE_TRN;
+    gnc_xfer_dialog_update_conv_info(xferData);
+
+    return FALSE;
+}
+
+
+/********************************************************************\
+ * gnc_xfer_dialog_select_from_account                              *
+ *   select the from account in a xfer dialog                       *
+ *                                                                  *
+ * Args:   xferData - xfer dialog structure                         *
+ *         account  - account to select                             *
+ * Return: none                                                     *
+\********************************************************************/
+void
+gnc_xfer_dialog_select_from_account(XferDialog *xferData, Account *account)
+{
+    gnc_transfer_dialog_set_selected_account (xferData, account, XFER_DIALOG_FROM);
+}
+
+
+/********************************************************************\
+ * gnc_xfer_dialog_select_to_account                                *
+ *   select the to account in a xfer dialog                         *
+ *                                                                  *
+ * Args:   xferData - xfer dialog structure                         *
+ *         account  - account to select                             *
+ * Return: none                                                     *
+\********************************************************************/
+void
+gnc_xfer_dialog_select_to_account(XferDialog *xferData, Account *account)
+{
+    gnc_transfer_dialog_set_selected_account (xferData, account, XFER_DIALOG_TO);
+}
+
+void
+gnc_xfer_dialog_select_from_currency(XferDialog *xferData, gnc_commodity *cur)
+{
+    if (!xferData) return;
+    if (!cur) return;
+
+    gtk_label_set_text(GTK_LABEL(xferData->from_currency_label),
+                       gnc_commodity_get_printname(cur));
+
+    gnc_amount_edit_set_print_info(GNC_AMOUNT_EDIT(xferData->amount_edit),
+                                   gnc_commodity_print_info(cur, FALSE));
+    gnc_amount_edit_set_fraction(GNC_AMOUNT_EDIT(xferData->amount_edit),
+                                 gnc_commodity_get_fraction (cur));
+
+    xferData->from_commodity = cur;
+    gnc_xfer_dialog_curr_acct_activate(xferData);
+}
+
+void
+gnc_xfer_dialog_select_to_currency(XferDialog *xferData, gnc_commodity *cur)
+{
+    gtk_label_set_text(GTK_LABEL(xferData->to_currency_label),
+                       gnc_commodity_get_printname(cur));
+
+    gnc_amount_edit_set_print_info(GNC_AMOUNT_EDIT(xferData->to_amount_edit),
+                                   gnc_commodity_print_info(cur, FALSE));
+    gnc_amount_edit_set_fraction(GNC_AMOUNT_EDIT(xferData->to_amount_edit),
+                                 gnc_commodity_get_fraction(cur));
+
+    xferData->to_commodity = cur;
+    gnc_xfer_dialog_curr_acct_activate(xferData);
+}
+
+static void
+gnc_xfer_dialog_lock_account_tree(XferDialog *xferData,
+                                  XferDirection direction,
+                                  gboolean hide)
+{
+    GtkTreeView *tree_view;
+    GtkWidget *show_button;
+    GtkWidget *scroll_win;
+
+    if (xferData == NULL)
+        return;
+
+    switch (direction)
+    {
+        case XFER_DIALOG_FROM:
+            tree_view = xferData->from_tree_view;
+            scroll_win = xferData->from_window;
+            show_button = xferData->from_show_button;
+            break;
+        case XFER_DIALOG_TO:
+            tree_view = xferData->to_tree_view;
+            scroll_win = xferData->to_window;
+            show_button = xferData->to_show_button;
+            break;
+        default:
+            return;
+    }
+
+    gtk_widget_set_sensitive( GTK_WIDGET(tree_view), FALSE );
+    gtk_widget_set_sensitive( GTK_WIDGET(show_button), FALSE );
+
+    if (hide)
+    {
+        gtk_widget_hide( scroll_win );
+        gtk_widget_hide( GTK_WIDGET(show_button) );
+    }
+}
+
+
+/********************************************************************\
+ * gnc_xfer_dialog_lock_from_account_tree                           *
+ *   prevent changes to the from account tree in an xfer dialog     *
+ *                                                                  *
+ * Args:   xferData - xfer dialog structure                         *
+ * Return: none                                                     *
+\********************************************************************/
+void
+gnc_xfer_dialog_lock_from_account_tree(XferDialog *xferData)
+{
+    gnc_xfer_dialog_lock_account_tree(xferData, XFER_DIALOG_FROM, FALSE);
+}
+
+
+/********************************************************************\
+ * gnc_xfer_dialog_lock_to_account_tree                             *
+ *   prevent changes to the to account tree in an xfer dialog       *
+ *                                                                  *
+ * Args:   xferData - xfer dialog structure                         *
+ * Return: none                                                     *
+\********************************************************************/
+void
+gnc_xfer_dialog_lock_to_account_tree(XferDialog *xferData)
+{
+    gnc_xfer_dialog_lock_account_tree(xferData, XFER_DIALOG_TO, FALSE);
+}
+
+
+/********************************************************************\
+ * gnc_xfer_dialog_hide_from_account_tree                           *
+ *   prevent changes to the from account tree in an xfer dialog     *
+ *                                                                  *
+ * Args:   xferData - xfer dialog structure                         *
+ * Return: none                                                     *
+\********************************************************************/
+void
+gnc_xfer_dialog_hide_from_account_tree(XferDialog *xferData)
+{
+    gnc_xfer_dialog_lock_account_tree(xferData, XFER_DIALOG_FROM, TRUE);
+}
+
+
+/********************************************************************\
+ * gnc_xfer_dialog_hide_to_account_tree                             *
+ *   prevent changes to the to account tree in an xfer dialog       *
+ *                                                                  *
+ * Args:   xferData - xfer dialog structure                         *
+ * Return: none                                                     *
+\********************************************************************/
+void
+gnc_xfer_dialog_hide_to_account_tree(XferDialog *xferData)
+{
+    gnc_xfer_dialog_lock_account_tree(xferData, XFER_DIALOG_TO, TRUE);
+}
+
+
+/********************************************************************\
+ * gnc_xfer_dialog_is_exchange_dialog                               *
+ *   set the dialog as an "exchange-dialog", which means that the   *
+ *   Transfer Information table is read-only (and the dialog        *
+ *   will NOT create a transaction when it is closed)               *
+ *                                                                  *
+ * Args:   xferData - xfer dialog structure                         *
+ *         exch_rate - place to store the exchange rate at exit     *
+ * Return: none                                                     *
+\********************************************************************/
+void
+gnc_xfer_dialog_is_exchange_dialog (XferDialog *xferData,
+                                    gnc_numeric *exch_rate)
+{
+    GNCAmountEdit *gae;
+
+    g_return_if_fail(xferData);
+    ENTER("xferData=%p, exch_rate=%p (%s)", xferData, exch_rate,
+          exch_rate == NULL ? "NULL" : xaccPrintAmount(*exch_rate,
+                                                       gnc_default_print_info(FALSE)));
+
+    gtk_widget_set_sensitive (xferData->amount_edit, FALSE);
+    gtk_widget_set_sensitive (xferData->date_entry, FALSE);
+    gtk_widget_set_sensitive (xferData->num_entry, FALSE);
+    gtk_widget_set_sensitive (xferData->description_entry, FALSE);
+    gtk_widget_set_sensitive (xferData->memo_entry, FALSE);
+
+
+    gae = GNC_AMOUNT_EDIT (xferData->price_edit);
+    gtk_widget_grab_focus (gnc_amount_edit_gtk_entry (gae));
+
+    xferData->exch_rate = exch_rate;
+
+    LEAVE(" ");
+}
+
+/********************************************************************\
+ * gnc_xfer_dialog_set_amount                                       *
+ *   set the amount in the given xfer dialog                        *
+ *                                                                  *
+ * Args:   xferData - xfer dialog structure                         *
+ *         amount   - the amount to set                             *
+ * Return: none                                                     *
+\********************************************************************/
+void
+gnc_xfer_dialog_set_amount(XferDialog *xferData, gnc_numeric amount)
+{
+    Account * account;
+
+    if (xferData == NULL)
+        return;
+
+    account = gnc_transfer_dialog_get_selected_account (xferData,
+                                                        XFER_DIALOG_FROM);
+    if (account == NULL)
+        account = gnc_transfer_dialog_get_selected_account (xferData,
+                                                            XFER_DIALOG_TO);
+
+    gnc_amount_edit_set_amount (GNC_AMOUNT_EDIT (xferData->amount_edit), amount);
+}
+void gnc_xfer_dialog_set_amount_sensitive(XferDialog *xferData,
+                                          gboolean is_sensitive)
+{
+    g_assert(xferData);
+    gtk_widget_set_sensitive(gnc_amount_edit_gtk_entry(GNC_AMOUNT_EDIT (xferData->amount_edit)), is_sensitive);
+}
+
+static void
+gnc_xfer_dialog_set_fetch_sensitive (GtkWidget *fetch)
+{
+    if (gnc_quote_source_fq_installed ())
+    {
+        gtk_widget_set_sensitive (fetch, TRUE);
+        gtk_widget_set_tooltip_text (fetch, _("Retrieve the current online quote. This will fail if there is a manually-created price for today."));
+        return;
+    }
+    gtk_widget_set_sensitive (fetch, FALSE);
+    gtk_widget_set_tooltip_text (fetch, _("Finance::Quote must be installed to enable this button."));
+    return;
+}
+
+/********************************************************************\
+ * gnc_xfer_dialog_set_description                                  *
+ *   set the description in the given xfer dialog                   *
+ *                                                                  *
+ * Args:   xferData    - xfer dialog structure                      *
+ *         description - the description to set                     *
+ * Return: none                                                     *
+\********************************************************************/
+void
+gnc_xfer_dialog_set_description(XferDialog *xferData, const char *description)
+{
+    if (xferData == NULL)
+        return;
+
+    gtk_entry_set_text(GTK_ENTRY(xferData->description_entry), description);
+    gnc_quickfill_insert( xferData->qf, description, QUICKFILL_LIFO );
+}
+
+/********************************************************************\
+ * gnc_xfer_dialog_set_memo                                         *
+ *   set the memo in the given xfer dialog                          *
+ *                                                                  *
+ * Args:   xferData    - xfer dialog structure                      *
+ *         memo        - the memo to set                            *
+ * Return: none                                                     *
+\********************************************************************/
+void
+gnc_xfer_dialog_set_memo(XferDialog *xferData, const char *memo)
+{
+    if (xferData == NULL)
+        return;
+
+    gtk_entry_set_text(GTK_ENTRY(xferData->memo_entry), memo);
+    /* gnc_quickfill_insert( xferData->qf, memo, QUICKFILL_LIFO ); */
+}
+
+/********************************************************************\
+ * gnc_xfer_dialog_set_num                                          *
+ *   set the num in the given xfer dialog                           *
+ *                                                                  *
+ * Args:   xferData    - xfer dialog structure                      *
+ *         num        - the num to set                              *
+ * Return: none                                                     *
+\********************************************************************/
+void
+gnc_xfer_dialog_set_num(XferDialog *xferData, const char *num)
+{
+    if (xferData == NULL)
+        return;
+
+    gtk_entry_set_text(GTK_ENTRY(xferData->num_entry), num);
+    /* gnc_quickfill_insert( xferData->qf, num, QUICKFILL_LIFO ); */
+}
+
+/********************************************************************\
+ * gnc_xfer_dialog_set_date                                         *
+ *   set the date in the given xfer dialog                          *
+ *                                                                  *
+ * Args:   xferData    - xfer dialog structure                      *
+ *         set_date    - the date to set                            *
+ * Return: none                                                     *
+\********************************************************************/
+void
+gnc_xfer_dialog_set_date(XferDialog *xferData, time64 set_date)
+{
+    if (xferData == NULL)
+        return;
+
+    gnc_date_edit_set_time( GNC_DATE_EDIT(xferData->date_entry), set_date );
+}
+void gnc_xfer_dialog_set_date_sensitive(XferDialog *xferData,
+                                        gboolean is_sensitive)
+{
+    g_assert(xferData);
+    gtk_widget_set_sensitive (xferData->date_entry, is_sensitive);
+}
+
+void
+gnc_xfer_dialog_set_price_edit(XferDialog *xferData, gnc_numeric price_value)
+{
+    if (xferData == NULL)
+        return;
+
+    if (gnc_numeric_zero_p (price_value))
+        return;
+
+    gnc_amount_edit_set_amount (GNC_AMOUNT_EDIT (xferData->price_edit),
+                                price_value);
+
+    gnc_xfer_update_to_amount (xferData);
+}
+
+static gboolean
+check_accounts  (XferDialog* xferData, Account* from_account,
+                 Account* to_account)
+{
+    if ((from_account == NULL) || (to_account == NULL))
+    {
+        const char *message = _("You must specify an account to transfer from, "
+                                "or to, or both, for this transaction. "
+                                "Otherwise, it will not be recorded.");
+        gnc_error_dialog(xferData->dialog, "%s", message);
+        LEAVE("bad account");
+        return FALSE;
+    }
+
+    if (from_account == to_account)
+    {
+        const char *message = _("You can't transfer from and to the same "
+                                "account!");
+        gnc_error_dialog(xferData->dialog, "%s", message);
+        LEAVE("same account");
+        return FALSE;
+    }
+
+    if (xaccAccountGetPlaceholder(from_account) ||
+        xaccAccountGetPlaceholder(to_account))
+    {
+        const char *placeholder_format =
+            _("The account %s does not allow transactions.");
+        char *name;
+
+        if (xaccAccountGetPlaceholder(from_account))
+            name = gnc_account_get_full_name(from_account);
+        else
+            name = gnc_account_get_full_name(to_account);
+        gnc_error_dialog(xferData->dialog, placeholder_format, name);
+        g_free(name);
+        LEAVE("placeholder");
+        return FALSE;
+    }
+
+    if (!gnc_commodity_is_iso (xferData->from_commodity))
+    {
+        const char *message =
+            _("You can't transfer from a non-currency account. "
+              "Try reversing the \"from\" and \"to\" accounts "
+              "and making the \"amount\" negative.");
+        gnc_error_dialog(xferData->dialog, "%s", message);
+        LEAVE("non-currency");
+        return FALSE;
+    }
+    return TRUE;
+}
+
+static gboolean
+check_edit(XferDialog *xferData)
+{
+    if (!gnc_amount_edit_evaluate (GNC_AMOUNT_EDIT (xferData->price_edit)))
+    {
+        if (gtk_toggle_button_get_active
+            (GTK_TOGGLE_BUTTON(xferData->price_radio)))
+        {
+            gnc_parse_error_dialog (xferData, _("You must enter a valid price."));
+            LEAVE("invalid price");
+            return FALSE;
+        }
+    }
+
+    if (!gnc_amount_edit_evaluate (GNC_AMOUNT_EDIT (xferData->to_amount_edit)))
+    {
+        if (gtk_toggle_button_get_active
+            (GTK_TOGGLE_BUTTON(xferData->amount_radio)))
+        {
+            gnc_parse_error_dialog (xferData,
+                                    _("You must enter a valid `to' amount."));
+            LEAVE("invalid to amount");
+            return FALSE;
+        }
+    }
+    return TRUE;
+}
+
+static void
+create_transaction(XferDialog *xferData, Timespec *ts,
+                   Account *from_account, Account* to_account,
+                   gnc_numeric amount, gnc_numeric to_amount)
+{
+    Transaction *trans;
+    Split *from_split;
+    Split *to_split;
+    const char *string;
+    /* Create the transaction */
+    trans = xaccMallocTransaction(xferData->book);
+
+    xaccTransBeginEdit(trans);
+
+    xaccTransSetCurrency(trans, xferData->from_commodity);
+    xaccTransSetDatePostedTS(trans, ts);
+
+    /* Trans-Num or Split-Action set with gnc_set_num_action below per book
+     * option */
+
+    string = gtk_entry_get_text(GTK_ENTRY(xferData->description_entry));
+    xaccTransSetDescription(trans, string);
+
+    /* create from split */
+    from_split = xaccMallocSplit(xferData->book);
+    xaccTransAppendSplit(trans, from_split);
+
+    /* create to split */
+    to_split = xaccMallocSplit(xferData->book);
+    xaccTransAppendSplit(trans, to_split);
+
+    xaccAccountBeginEdit(from_account);
+    xaccAccountInsertSplit(from_account, from_split);
+
+    xaccAccountBeginEdit(to_account);
+    xaccAccountInsertSplit(to_account, to_split);
+
+    xaccSplitSetBaseValue(from_split, gnc_numeric_neg (amount),
+                          xferData->from_commodity);
+    xaccSplitSetBaseValue(to_split, amount, xferData->from_commodity);
+    xaccSplitSetBaseValue(to_split, to_amount, xferData->to_commodity);
+
+    /* Set the transaction number or split action field based on book option*/
+    string = gtk_entry_get_text(GTK_ENTRY(xferData->num_entry));
+    gnc_set_num_action (trans, from_split, string, NULL);
+
+    /* Set the memo fields */
+    string = gtk_entry_get_text(GTK_ENTRY(xferData->memo_entry));
+    xaccSplitSetMemo(from_split, string);
+    xaccSplitSetMemo(to_split, string);
+
+    /* finish transaction */
+    xaccTransCommitEdit(trans);
+    xaccAccountCommitEdit(from_account);
+    xaccAccountCommitEdit(to_account);
+
+    /* If there is a registered callback handler that should be
+       notified of the newly created Transaction, call it now. */
+    if (xferData->transaction_cb)
+        xferData->transaction_cb(trans, xferData->transaction_user_data);
+}
+
+static gnc_numeric
+swap_commodities(gnc_commodity **from, gnc_commodity **to, gnc_numeric value)
+{
+    gnc_commodity *tmp = *to;
+
+    *to = *from;
+    *from = tmp;
+    value = gnc_numeric_invert(value);
+    return value;
+}
+
+static void
+update_price(XferDialog *xferData, PriceReq *pr)
+{
+    gnc_commodity *from = xferData->from_commodity;
+    gnc_commodity *to = xferData->to_commodity;
+    gnc_numeric value = gnc_amount_edit_get_amount(GNC_AMOUNT_EDIT(xferData->price_edit));
+    gnc_numeric price_value = gnc_price_get_value(pr->price);
+    gnc_numeric rounded_pr_value = round_price(pr->from, pr->to, price_value);
+    gnc_numeric rounded_value;
+
+    if (gnc_price_get_source(pr->price) < xferData->price_source)
+    {
+        PINFO("Existing price is preferred, so won't supersede.");
+        gnc_price_unref (pr->price);
+        return;
+    }
+
+    if (pr->reverse)
+        value = swap_commodities(&from, &to, value);
+    /* Test the rounded values for equality to minimize price-dithering. */
+    rounded_value = round_price(from, to, value);
+    if (gnc_numeric_equal(rounded_value, rounded_pr_value))
+    {
+        PINFO("Same price for %s in %s",
+              gnc_commodity_get_mnemonic(pr->from),
+              gnc_commodity_get_mnemonic(pr->to));
+        gnc_price_unref (pr->price);
+        return;
+    }
+    gnc_price_begin_edit (pr->price);
+    gnc_price_set_time (pr->price, pr->ts);
+    gnc_price_set_typestr(pr->price, xferData->price_type);
+    gnc_price_set_value (pr->price, value);
+    gnc_price_commit_edit (pr->price);
+    PINFO("Updated price: 1 %s = %f %s",
+          gnc_commodity_get_mnemonic(pr->from),
+          gnc_numeric_to_double(gnc_price_get_value(pr->price)),
+          gnc_commodity_get_mnemonic(pr->to));
+    gnc_price_unref (pr->price);
+}
+
+static void
+new_price(XferDialog *xferData, Timespec ts)
+{
+    GNCPrice *price = NULL;
+    gnc_commodity *from = xferData->from_commodity;
+    gnc_commodity *to = xferData->to_commodity;
+    gnc_numeric value = gnc_amount_edit_get_amount(GNC_AMOUNT_EDIT(xferData->price_edit));
+
+/* We want to store currency rates such that the rate > 1 and commodity
+ * prices in terms of a currency regardless of value.
+ */
+    value = gnc_numeric_abs(value);
+    if (gnc_commodity_is_currency(from) && gnc_commodity_is_currency(to))
+    {
+        if (value.num < value.denom)
+            value = swap_commodities(&from, &to, value);
+    }
+    else if (gnc_commodity_is_currency(from))
+            value = swap_commodities(&from, &to, value);
+
+    value = round_price (from, to, value);
+    price = gnc_price_create (xferData->book);
+    gnc_price_begin_edit (price);
+    gnc_price_set_commodity (price, from);
+    gnc_price_set_currency (price, to);
+    gnc_price_set_time (price, ts);
+    gnc_price_set_source (price, xferData->price_source);
+    gnc_price_set_typestr (price, xferData->price_type);
+    gnc_price_set_value (price, value);
+    gnc_pricedb_add_price (xferData->pricedb, price);
+    gnc_price_commit_edit (price);
+    PINFO("Created price: 1 %s = %f %s", gnc_commodity_get_mnemonic(from),
+          gnc_numeric_to_double(value), gnc_commodity_get_mnemonic(to));
+    gnc_price_unref (price);
+}    
+
+static void
+create_price(XferDialog *xferData, Timespec ts)
+{
+    PriceReq pr;
+
+/* Bail in the unlikely event that both currencies have joined the Euro. */
+    if (gnc_is_euro_currency (xferData->from_commodity) &&
+        gnc_is_euro_currency (xferData->to_commodity))
+        return;
+
+    price_request_from_xferData(&pr, xferData);
+    if (lookup_price(&pr, SAME_DAY))
+    {
+        update_price(xferData, &pr);
+        return;
+    }
+    new_price (xferData, ts);
+}
+
+void
+gnc_xfer_dialog_response_cb (GtkDialog *dialog, gint response, gpointer data)
+{
+    XferDialog *xferData = data;
+    Account *to_account;
+    Account *from_account;
+    gnc_numeric amount, to_amount;
+    Timespec ts;
+    GDate date;
+
+    g_return_if_fail (xferData != NULL);
+    ENTER(" ");
+
+    if (response == GTK_RESPONSE_APPLY)
+    {
+        LEAVE("fetching exchange rate");
+        return;
+    }
+
+    if (response != GTK_RESPONSE_OK)
+    {
+        gnc_close_gui_component_by_data (DIALOG_TRANSFER_CM_CLASS, xferData);
+        LEAVE("cancel, etc.");
+        return;
+    }
+
+    from_account = gnc_transfer_dialog_get_selected_account (xferData, XFER_DIALOG_FROM);
+    to_account = gnc_transfer_dialog_get_selected_account (xferData, XFER_DIALOG_TO);
+
+    if (xferData->exch_rate == NULL &&
+        !check_accounts(xferData, from_account, to_account))
+        return;
+
+    if (!gnc_amount_edit_evaluate (GNC_AMOUNT_EDIT (xferData->amount_edit)))
+    {
+        gnc_parse_error_dialog (xferData, _("You must enter a valid amount."));
+        LEAVE("no amount");
+        return;
+    }
+
+    amount = gnc_amount_edit_get_amount(GNC_AMOUNT_EDIT(xferData->amount_edit));
+
+    if (gnc_numeric_zero_p (amount))
+    {
+        const char *message = _("You must enter an amount to transfer.");
+        gnc_error_dialog(xferData->dialog, "%s", message);
+        LEAVE("invalid from amount");
+        return;
+    }
+    g_date_clear (&date, 1);
+    gnc_date_edit_get_gdate (GNC_DATE_EDIT (xferData->date_entry), &date);
+    ts = gdate_to_timespec (date);
+
+    if (!gnc_commodity_equiv(xferData->from_commodity, xferData->to_commodity))
+    {
+        if (!check_edit(xferData))
+            return;
+        to_amount = gnc_amount_edit_get_amount
+            (GNC_AMOUNT_EDIT(xferData->to_amount_edit));
+    }
+    else
+        to_amount = amount;
+
+    gnc_suspend_gui_refresh ();
+
+    if (xferData->exch_rate)
+    {
+        gnc_numeric price_value;
+
+        /* If we've got the price-button set, then make sure we update the
+         * to-amount before we use it.
+         */
+        if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(xferData->price_radio)))
+            gnc_xfer_update_to_amount(xferData);
+
+        price_value = gnc_xfer_dialog_compute_price_value(xferData);
+        gnc_amount_edit_set_amount(GNC_AMOUNT_EDIT(xferData->price_edit),
+                                   price_value);
+        *(xferData->exch_rate) = gnc_numeric_abs(price_value);
+    }
+    else
+        create_transaction (xferData, &ts, from_account, to_account,
+                            amount, to_amount);
+    /* try to save this to the pricedb */
+    if (xferData->pricedb && !gnc_commodity_equal (xferData->from_commodity,
+                                                   xferData->to_commodity))
+        create_price(xferData, ts);
+    /* Refresh everything */
+    gnc_resume_gui_refresh ();
+
+    DEBUG("close component");
+    gnc_close_gui_component_by_data (DIALOG_TRANSFER_CM_CLASS, xferData);
+    LEAVE("ok");
+}
+
+void
+gnc_xfer_dialog_close_cb(GtkDialog *dialog, gpointer data)
+{
+    XferDialog * xferData = data;
+    GtkWidget *entry;
+
+    /* Notify transaction callback to unregister here */
+    if (xferData->transaction_cb)
+        xferData->transaction_cb(NULL, xferData->transaction_user_data);
+
+    entry = gnc_amount_edit_gtk_entry(GNC_AMOUNT_EDIT(xferData->amount_edit));
+    g_signal_handlers_disconnect_matched (G_OBJECT (entry), G_SIGNAL_MATCH_DATA,
+                                          0, 0, NULL, NULL, xferData);
+
+    entry = gnc_amount_edit_gtk_entry(GNC_AMOUNT_EDIT(xferData->price_edit));
+    g_signal_handlers_disconnect_matched (G_OBJECT (entry), G_SIGNAL_MATCH_DATA,
+                                          0, 0, NULL, NULL, xferData);
+
+    entry = gnc_amount_edit_gtk_entry(GNC_AMOUNT_EDIT(xferData->to_amount_edit));
+    g_signal_handlers_disconnect_matched (G_OBJECT (entry), G_SIGNAL_MATCH_DATA,
+                                          0, 0, NULL, NULL, xferData);
+
+    entry = xferData->description_entry;
+    g_signal_handlers_disconnect_matched (G_OBJECT (entry), G_SIGNAL_MATCH_DATA,
+                                          0, 0, NULL, NULL, xferData);
+
+    DEBUG("unregister component");
+    gnc_unregister_gui_component_by_data (DIALOG_TRANSFER_CM_CLASS, xferData);
+
+    gnc_quickfill_destroy (xferData->qf);
+    xferData->qf = NULL;
+
+    if (xferData->desc_selection_source_id)
+        g_source_remove (xferData->desc_selection_source_id);
+
+    g_free(xferData);
+    xferData = NULL;
+
+    DEBUG("xfer dialog destroyed");
+}
+
+
+void
+gnc_xfer_dialog_fetch (GtkButton *button, XferDialog *xferData)
+{
+    PriceReq pr;
+    SCM quotes_func;
+    SCM book_scm;
+    SCM scm_window;
+
+    g_return_if_fail (xferData);
+
+    ENTER(" ");
+
+    quotes_func = scm_c_eval_string ("gnc:book-add-quotes");
+
+    if (!scm_is_procedure (quotes_func))
+    {
+        LEAVE("quote retrieval failed");
+        return;
+    }
+
+    book_scm = gnc_book_to_scm (xferData->book);
+    if (scm_is_true (scm_not (book_scm)))
+    {
+        LEAVE("no book");
+        return;
+    }
+
+    scm_window =  SWIG_NewPointerObj(xferData->dialog,
+                                     SWIG_TypeQuery("_p_GtkWidget"), 0);
+
+    if (scm_is_true (scm_not (book_scm)))
+    {
+        LEAVE("no scm window");
+        return;
+    }
+
+    gnc_set_busy_cursor (NULL, TRUE);
+    scm_call_2 (quotes_func, scm_window, book_scm);
+    gnc_unset_busy_cursor (NULL);
+
+    /*the results should be in the price db now, but don't crash if not. */
+    price_request_from_xferData(&pr, xferData);
+    if (lookup_price(&pr, LATEST))
+    {
+        gnc_numeric price_value = gnc_price_get_value(pr.price);
+        if (pr.reverse)
+            price_value = gnc_numeric_invert(price_value);
+         gnc_xfer_dialog_set_price_edit(xferData, price_value);
+        gnc_price_unref (pr.price);
+    }
+
+    LEAVE("quote retrieved");
+
+}
+
+static void
+gnc_xfer_dialog_create(GtkWidget *parent, XferDialog *xferData)
+{
+    GtkBuilder *builder;
+    gboolean  use_accounting_labels;
+    g_return_if_fail(to_info == NULL && from_info == NULL);
+
+    use_accounting_labels = gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL,
+                                               GNC_PREF_ACCOUNTING_LABELS);
+
+    ENTER(" ");
+    builder = gtk_builder_new();
+    gnc_builder_add_from_file (builder, "dialog-transfer.glade", "transfer_dialog");
+
+    xferData->dialog = GTK_WIDGET(gtk_builder_get_object (builder, "transfer_dialog"));
+    g_object_set_data_full (G_OBJECT (xferData->dialog), "builder", builder, g_object_unref);
+
+    // Set the style context for this dialog so it can be easily manipulated with css
+    gnc_widget_set_style_context (GTK_WIDGET(xferData->dialog), "GncTransferDialog");
+
+    /* parent */
+    if (parent != NULL)
+        gtk_window_set_transient_for (GTK_WINDOW (xferData->dialog), GTK_WINDOW (parent));
+
+    /* default to quickfilling off of the "From" account. */
+    xferData->quickfill = XFER_DIALOG_FROM;
+
+    xferData->transferinfo_label = GTK_WIDGET(gtk_builder_get_object (builder, "transferinfo-label"));
+
+    xferData->fetch_button = GTK_WIDGET(gtk_builder_get_object (builder, "fetch"));
+    gnc_xfer_dialog_set_fetch_sensitive (xferData->fetch_button);
+
+    /* amount & date widgets */
+    {
+        GtkWidget *amount;
+        GtkWidget *entry;
+        GtkWidget *date;
+        GtkWidget *hbox;
+
+        amount = gnc_amount_edit_new();
+        hbox = GTK_WIDGET(gtk_builder_get_object (builder, "amount_hbox"));
+        gtk_box_pack_end(GTK_BOX(hbox), amount, TRUE, TRUE, 0);
+        gnc_amount_edit_set_evaluate_on_enter (GNC_AMOUNT_EDIT (amount), TRUE);
+        xferData->amount_edit = amount;
+
+        entry = gnc_amount_edit_gtk_entry (GNC_AMOUNT_EDIT (amount));
+        gtk_entry_set_activates_default (GTK_ENTRY(entry), TRUE);
+        g_signal_connect (G_OBJECT (entry), "focus-out-event",
+                          G_CALLBACK (gnc_xfer_amount_update_cb), xferData);
+
+        date = gnc_date_edit_new(time (NULL), FALSE, FALSE);
+        gnc_date_activates_default (GNC_DATE_EDIT(date), TRUE);
+        hbox = GTK_WIDGET(gtk_builder_get_object (builder, "date_hbox"));
+
+        gtk_box_pack_end(GTK_BOX(hbox), date, TRUE, TRUE, 0);
+        xferData->date_entry = date;
+        g_signal_connect (G_OBJECT (date), "date_changed",
+                          G_CALLBACK (gnc_xfer_date_changed_cb), xferData);
+    }
+
+    {
+        GtkWidget *entry;
+
+        entry = GTK_WIDGET(gtk_builder_get_object (builder, "num_entry"));
+        xferData->num_entry = entry;
+
+        entry = GTK_WIDGET(gtk_builder_get_object (builder, "description_entry"));
+        xferData->description_entry = entry;
+
+        entry = GTK_WIDGET(gtk_builder_get_object (builder, "memo_entry"));
+        xferData->memo_entry = entry;
+    }
+
+    /* from and to */
+    {
+        GtkWidget *label;
+        gchar *text;
+
+        to_info   = g_new0(AccountTreeFilterInfo, 1);
+        from_info = g_new0(AccountTreeFilterInfo, 1);
+
+        gnc_xfer_dialog_fill_tree_view (xferData, XFER_DIALOG_TO);
+        gnc_xfer_dialog_fill_tree_view (xferData, XFER_DIALOG_FROM);
+
+        /* Reverse from and to account trees when in "accountant" mode,
+           see comment in function gnc_xfer_dialog_fill_tree_table */
+        if (use_accounting_labels)
+        {
+            label = GTK_WIDGET(gtk_builder_get_object (builder, "right_trans_label"));
+            xferData->from_transfer_label = label;
+
+            label = GTK_WIDGET(gtk_builder_get_object (builder, "left_trans_label"));
+            xferData->to_transfer_label = label;
+
+            text = g_strconcat ("<b>", _("Credit Account"), "</b>", NULL);
+            gtk_label_set_markup (GTK_LABEL (xferData->from_transfer_label), text);
+            g_free (text);
+
+            text = g_strconcat ("<b>", _("Debit Account"), "</b>", NULL);
+            gtk_label_set_markup (GTK_LABEL (xferData->to_transfer_label), text);
+            g_free (text);
+
+            label = GTK_WIDGET(gtk_builder_get_object (builder, "right_currency_label"));
+            xferData->from_currency_label = label;
+
+            label = GTK_WIDGET(gtk_builder_get_object (builder, "left_currency_label"));
+            xferData->to_currency_label = label;
+        }
+        else
+        {
+            label = GTK_WIDGET(gtk_builder_get_object (builder, "left_trans_label"));
+            xferData->from_transfer_label = label;
+
+            label = GTK_WIDGET(gtk_builder_get_object (builder, "right_trans_label"));
+            xferData->to_transfer_label = label;
+
+            text = g_strconcat ("<b>", _("Transfer From"), "</b>", NULL);
+            gtk_label_set_markup (GTK_LABEL (xferData->from_transfer_label), text);
+            g_free (text);
+
+            text = g_strconcat ("<b>", _("Transfer To"), "</b>", NULL);
+            gtk_label_set_markup (GTK_LABEL (xferData->to_transfer_label), text);
+
+            label = GTK_WIDGET(gtk_builder_get_object (builder, "left_currency_label"));
+            xferData->from_currency_label = label;
+
+            label = GTK_WIDGET(gtk_builder_get_object (builder, "right_currency_label"));
+            xferData->to_currency_label = label;
+        }
+
+        label = GTK_WIDGET(gtk_builder_get_object (builder, "conv_forward"));
+        xferData->conv_forward = label;
+
+        label = GTK_WIDGET(gtk_builder_get_object (builder, "conv_reverse"));
+        xferData->conv_reverse = label;
+    }
+
+    /* optional intermediate currency account */
+    {
+        GtkWidget *table;
+        GtkWidget *entry;
+        GtkWidget *edit;
+        GtkWidget *hbox;
+        GtkWidget *button;
+
+        table = GTK_WIDGET(gtk_builder_get_object (builder, "curr_transfer_table"));
+        xferData->curr_xfer_table = table;
+
+        edit = gnc_amount_edit_new();
+        gnc_amount_edit_set_print_info(GNC_AMOUNT_EDIT(edit),
+                                       gnc_default_print_info (FALSE));
+        hbox = GTK_WIDGET(gtk_builder_get_object (builder, "price_hbox"));
+        gtk_box_pack_start(GTK_BOX(hbox), edit, TRUE, TRUE, 0);
+        xferData->price_edit = edit;
+        entry = gnc_amount_edit_gtk_entry (GNC_AMOUNT_EDIT (edit));
+        g_signal_connect (G_OBJECT (entry), "focus-out-event",
+                          G_CALLBACK (gnc_xfer_price_update_cb), xferData);
+        gtk_entry_set_activates_default(GTK_ENTRY (entry), TRUE);
+
+        edit = gnc_amount_edit_new();
+        hbox = GTK_WIDGET(gtk_builder_get_object (builder, "right_amount_hbox"));
+        gtk_box_pack_start(GTK_BOX(hbox), edit, TRUE, TRUE, 0);
+        xferData->to_amount_edit = edit;
+        entry = gnc_amount_edit_gtk_entry (GNC_AMOUNT_EDIT (edit));
+        g_signal_connect (G_OBJECT (entry), "focus-out-event",
+                          G_CALLBACK (gnc_xfer_to_amount_update_cb), xferData);
+        gtk_entry_set_activates_default(GTK_ENTRY(entry), TRUE);
+
+        button = GTK_WIDGET(gtk_builder_get_object (builder, "price_radio"));
+        xferData->price_radio = button;
+
+        button = GTK_WIDGET(gtk_builder_get_object (builder, "amount_radio"));
+        xferData->amount_radio = button;
+
+        if (use_accounting_labels)
+        {
+            gtk_label_set_text(GTK_LABEL(gtk_bin_get_child (GTK_BIN(xferData->amount_radio))),
+                               _("Debit Amount:"));
+        }
+        else
+        {
+            gtk_label_set_text(GTK_LABEL(gtk_bin_get_child (GTK_BIN(xferData->amount_radio))),
+                               _("To Amount:"));
+        }
+    }
+
+    gtk_builder_connect_signals(builder, xferData);
+    gnc_restore_window_size (GNC_PREFS_GROUP, GTK_WINDOW (xferData->dialog));
+    LEAVE(" ");
+}
+
+static void
+close_handler (gpointer user_data)
+{
+    XferDialog *xferData = user_data;
+    GtkWidget *dialog;
+
+    ENTER(" ");
+    dialog = GTK_WIDGET (xferData->dialog);
+
+    gnc_save_window_size (GNC_PREFS_GROUP, GTK_WINDOW (dialog));
+    gtk_widget_hide (dialog);
+    gnc_xfer_dialog_close_cb(GTK_DIALOG(dialog), xferData);
+    gtk_widget_destroy (dialog);
+    g_free (to_info);
+    to_info = NULL;
+    g_free (from_info);
+    from_info = NULL;
+    LEAVE(" ");
+}
+
+/********************************************************************\
+ * gnc_xfer_dialog                                                  *
+ *   opens up a window to do an automatic transfer between accounts *
+ *                                                                  *
+ * Args:   parent  - the parent of the window to be created         *
+ *         initial - the initial account in the from/to fields      *
+ * Return: XferDialog structure                                     *
+\********************************************************************/
+XferDialog *
+gnc_xfer_dialog (GtkWidget * parent, Account * initial)
+{
+    XferDialog *xferData;
+    GNCAmountEdit *gae;
+    GtkWidget *amount_entry;
+    QofBook *book = NULL;
+
+    xferData = g_new0 (XferDialog, 1);
+
+    xferData->desc_start_selection = 0;
+    xferData->desc_end_selection = 0;
+    xferData->desc_selection_source_id = 0;
+    xferData->quickfill = XFER_DIALOG_FROM;
+    xferData->transaction_cb = NULL;
+
+    if (initial)
+    {
+        book = gnc_account_get_book (initial);
+    }
+    else
+    {
+        book = gnc_get_current_book ();
+    }
+
+    xferData->book = book;
+    xferData->pricedb = gnc_pricedb_get_db (book);
+
+    gnc_xfer_dialog_create(parent, xferData);
+
+    DEBUG("register component");
+    gnc_register_gui_component (DIALOG_TRANSFER_CM_CLASS,
+                                NULL, close_handler, xferData);
+
+    gae = GNC_AMOUNT_EDIT(xferData->amount_edit);
+    amount_entry = gnc_amount_edit_gtk_entry (gae);
+
+    gtk_widget_grab_focus(amount_entry);
+
+    gnc_xfer_dialog_select_from_account(xferData, initial);
+    gnc_xfer_dialog_select_to_account(xferData, initial);
+
+    gnc_xfer_dialog_curr_acct_activate(xferData);
+
+    gtk_widget_show_all(xferData->dialog);
+
+    gnc_window_adjust_for_screen(GTK_WINDOW(xferData->dialog));
+
+    return xferData;
+}
+
+void
+gnc_xfer_dialog_close( XferDialog *xferData )
+{
+    if ( xferData )
+    {
+        DEBUG("close component");
+        gtk_dialog_response( GTK_DIALOG(xferData->dialog), GTK_RESPONSE_NONE );
+    }
+}
+
+void
+gnc_xfer_dialog_set_title( XferDialog *xferData, const gchar *title )
+{
+    if ( xferData && title )
+    {
+        gtk_window_set_title (GTK_WINDOW (xferData->dialog), title);
+    }
+}
+
+void
+gnc_xfer_dialog_set_information_label( XferDialog *xferData,
+                                       const gchar *text )
+{
+    if (xferData && text)
+    {
+        gchar *markup_text = g_strdup_printf ("<b>%s</b>", text);
+        gtk_label_set_markup (GTK_LABEL (xferData->transferinfo_label), markup_text);
+        g_free (markup_text);
+    }
+}
+
+
+static void
+gnc_xfer_dialog_set_account_label( XferDialog *xferData,
+                                   const gchar *text,
+                                   XferDirection direction )
+{
+    if (xferData && text)
+    {
+        gchar *markup_text = g_strdup_printf ("<b>%s</b>", text);
+        gtk_label_set_markup (GTK_LABEL ((direction == XFER_DIALOG_FROM ?
+                                          xferData->from_transfer_label :
+                                          xferData->to_transfer_label)),
+                              markup_text);
+        g_free (markup_text);
+    }
+}
+
+void
+gnc_xfer_dialog_set_from_account_label( XferDialog *xferData,
+                                        const gchar *label )
+{
+    gnc_xfer_dialog_set_account_label (xferData, label, XFER_DIALOG_FROM);
+}
+
+void
+gnc_xfer_dialog_set_to_account_label( XferDialog *xferData,
+                                      const gchar *label )
+{
+    gnc_xfer_dialog_set_account_label (xferData, label, XFER_DIALOG_TO);
+}
+
+void
+gnc_xfer_dialog_set_from_show_button_active( XferDialog *xferData,
+                                             gboolean set_value )
+{
+    if ( xferData && xferData->from_show_button )
+    {
+        gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(xferData->from_show_button),
+                                      set_value );
+    }
+}
+
+void
+gnc_xfer_dialog_set_to_show_button_active( XferDialog *xferData,
+                                           gboolean set_value )
+{
+    if ( xferData && xferData->to_show_button )
+    {
+        gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(xferData->to_show_button),
+                                      set_value );
+    }
+}
+
+/* Add a button with a user-specified label and "clicked" callback */
+void gnc_xfer_dialog_add_user_specified_button( XferDialog *xferData,
+                                                const gchar *label,
+                                                GCallback callback,
+                                                gpointer user_data )
+{
+    if ( xferData && label && callback )
+    {
+        GtkBuilder *builder = g_object_get_data (G_OBJECT (xferData->dialog), "builder");
+        GtkWidget *button   = gtk_button_new_with_label( label );
+        GtkWidget *box      = GTK_WIDGET(gtk_builder_get_object (builder,
+                                                                 "transfermain-vbox" ));
+        gtk_box_pack_end( GTK_BOX(box), button, FALSE, FALSE, 0 );
+        g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (callback), user_data);
+        gtk_widget_show( button );
+    }
+}
+
+void gnc_xfer_dialog_toggle_currency_table( XferDialog *xferData,
+                                            gboolean show_table )
+{
+    if (xferData && xferData->curr_xfer_table)
+    {
+        if (show_table)
+            gtk_widget_show(xferData->curr_xfer_table);
+        else
+            gtk_widget_hide(xferData->curr_xfer_table);
+    }
+}
+
+
+/* helper function */
+static gboolean
+find_xfer (gpointer find_data, gpointer user_data)
+{
+    return( find_data == user_data );
+}
+
+/* Run the dialog until the user has either successfully completed the
+ * transaction (just clicking OK doesn't always count) or clicked Cancel.
+ * Return TRUE if the transaction was a success, FALSE otherwise.
+ */
+gboolean gnc_xfer_dialog_run_until_done( XferDialog *xferData )
+{
+    GtkDialog *dialog;
+    gint count, response;
+
+    ENTER("xferData=%p", xferData);
+    if ( xferData == NULL )
+    {
+        LEAVE("bad args");
+        return( FALSE );
+    }
+
+    dialog = GTK_DIALOG (xferData->dialog);
+
+    /*
+     * We need to call the response_cb function by hand.  Calling it
+     * automatically on a button click can destroy the window, and
+     * that's bad mojo whole gtk_dialog_run is still in control.
+     */
+    count = g_signal_handlers_disconnect_by_func(dialog,
+                                                 gnc_xfer_dialog_response_cb,
+                                                 xferData);
+    g_assert(count == 1);
+
+    while ( TRUE )
+    {
+        DEBUG("calling gtk_dialog_run");
+        response = gtk_dialog_run (dialog);
+        DEBUG("gtk_dialog_run returned %d", response);
+        gnc_xfer_dialog_response_cb (dialog, response, xferData);
+
+        if ((response != GTK_RESPONSE_OK) && (response != GTK_RESPONSE_APPLY))
+        {
+            LEAVE("not ok");
+            return FALSE;
+        }
+
+        /* See if the dialog is still there.  For various reasons, the
+         * user could have hit OK but remained in the dialog.  We don't
+         * want to return processing back to anyone else until we clear
+         * off this dialog, so if the dialog is still there we'll just
+         * run it again.
+         */
+        if ( !gnc_find_first_gui_component( DIALOG_TRANSFER_CM_CLASS,
+                                            find_xfer, xferData ) )
+        {
+            /* no more dialog, and OK was clicked, so assume it's all good */
+            LEAVE("ok");
+            return TRUE;
+        }
+
+        /* else run the dialog again */
+    }
+
+    g_assert_not_reached();
+    return FALSE; /* to satisfy static code analysis */
+}
+
+
+/* Indicate that the dialog should quickfill based on the "To" account,
+ * rather than the default which is the "From" account.
+ */
+
+void
+gnc_xfer_dialog_quickfill_to_account(XferDialog *xferData,
+                                     gboolean qf_to_account )
+{
+    XferDirection old = xferData->quickfill;
+
+    xferData->quickfill = qf_to_account ? XFER_DIALOG_TO : XFER_DIALOG_FROM;
+
+    /* reload the quickfill if necessary */
+    if ( old != xferData->quickfill )
+        gnc_xfer_dialog_reload_quickfill( xferData );
+}
+
+static Account *
+gnc_transfer_dialog_get_selected_account (XferDialog *dialog,
+                                          XferDirection direction)
+{
+    GtkTreeView *tree_view;
+    Account *account;
+
+    switch (direction)
+    {
+        case XFER_DIALOG_FROM:
+            tree_view = dialog->from_tree_view;
+            break;
+        case XFER_DIALOG_TO:
+            tree_view = dialog->to_tree_view;
+            break;
+        default:
+            g_assert_not_reached ();
+            return NULL;
+    }
+
+    account = gnc_tree_view_account_get_selected_account  (GNC_TREE_VIEW_ACCOUNT (tree_view));
+    return account;
+}
+
+static void
+gnc_transfer_dialog_set_selected_account (XferDialog *dialog,
+                                          Account *account,
+                                          XferDirection direction)
+{
+    GtkTreeView *tree_view;
+    GtkCheckButton *show_button;
+    GNCAccountType type;
+
+    if (account == NULL)
+        return;
+
+    switch (direction)
+    {
+        case XFER_DIALOG_FROM:
+            tree_view = dialog->from_tree_view;
+            show_button = GTK_CHECK_BUTTON (dialog->from_show_button);
+            break;
+        case XFER_DIALOG_TO:
+            tree_view = dialog->to_tree_view;
+            show_button = GTK_CHECK_BUTTON (dialog->to_show_button);
+            break;
+        default:
+            g_assert_not_reached ();
+            return;
+    }
+
+    type = xaccAccountGetType (account);
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (show_button),
+                                  (type == ACCT_TYPE_EXPENSE) ||
+                                  (type == ACCT_TYPE_INCOME));
+
+    gnc_tree_view_account_set_selected_account (GNC_TREE_VIEW_ACCOUNT (tree_view),
+                                                account);
+}
+
+
+void gnc_xfer_dialog_set_txn_cb(XferDialog *xferData,
+                                gnc_xfer_dialog_cb handler,
+                                gpointer user_data)
+{
+    g_assert(xferData);
+    xferData->transaction_cb = handler;
+    xferData->transaction_user_data = user_data;
+}
+
+
+
+gboolean gnc_xfer_dialog_run_exchange_dialog(
+    XferDialog *xfer, gnc_numeric *exch_rate, gnc_numeric amount,
+    Account *reg_acc, Transaction *txn, gnc_commodity *xfer_com,
+    gboolean expanded)
+{
+    gboolean swap_amounts = FALSE;
+    gnc_commodity *txn_cur = xaccTransGetCurrency(txn);
+    gnc_commodity *reg_com = xaccAccountGetCommodity(reg_acc);
+
+    g_return_val_if_fail(txn_cur, TRUE);
+
+    if (xaccTransUseTradingAccounts (txn))
+    {
+        /* If we're using commodity trading accounts then "amount" is
+           really the split's amount and it's in xfer_com commodity.
+           We need an exchange rate that will convert this amount
+           into a value in the transaction currency.  */
+        if (gnc_commodity_equal(xfer_com, txn_cur))
+        {
+            /* Transaction is in the same currency as the split, exchange
+               rate is 1. */
+            *exch_rate = gnc_numeric_create(1, 1);
+            return FALSE;
+        }
+        swap_amounts = expanded;
+    }
+
+    /* We know that "amount" is always in the reg_com currency.
+     * Unfortunately it is possible that neither xfer_com or txn_cur are
+     * the same as reg_com, in which case we need to convert to the txn
+     * currency...  Or, if the register commodity is the xfer_com, then we
+     * need to flip-flop the commodities and the exchange rates.
+     */
+
+    else if (gnc_commodity_equal(reg_com, txn_cur))
+    {
+        /* we're working in the txn currency.  Great.  Nothing to do! */
+        swap_amounts = FALSE;
+
+    }
+    else if (gnc_commodity_equal(reg_com, xfer_com))
+    {
+        /* We're working in the xfer commodity.  Great.  Just swap the
+           amounts. */
+        swap_amounts = TRUE;
+
+        /* XXX: Do we need to check for expanded v. non-expanded
+           accounts here? */
+
+    }
+    else
+    {
+        /* UGGH -- we're not in either.  That means we need to convert
+         * 'amount' from the register commodity to the txn currency.
+         */
+        gnc_numeric rate = xaccTransGetAccountConvRate(txn, reg_acc);
+
+        /* XXX: should we tell the user we've done the conversion? */
+        amount = gnc_numeric_div(amount, rate,
+                                 gnc_commodity_get_fraction(txn_cur),
+                                 GNC_HOW_DENOM_REDUCE);
+    }
+
+    /* enter the accounts */
+    if (swap_amounts)
+    {
+        gnc_xfer_dialog_select_to_currency(xfer, txn_cur);
+        gnc_xfer_dialog_select_from_currency(xfer, xfer_com);
+        if (!gnc_numeric_zero_p(*exch_rate))
+            *exch_rate = gnc_numeric_invert(*exch_rate);
+        amount = gnc_numeric_neg(amount);
+    }
+    else
+    {
+        gnc_xfer_dialog_select_to_currency(xfer, xfer_com);
+        gnc_xfer_dialog_select_from_currency(xfer, txn_cur);
+        if (xaccTransUseTradingAccounts ( txn ))
+            amount = gnc_numeric_neg(amount);
+    }
+    gnc_xfer_dialog_hide_to_account_tree(xfer);
+    gnc_xfer_dialog_hide_from_account_tree(xfer);
+
+    gnc_xfer_dialog_set_amount(xfer, amount);
+    /* Now that from amount is set, set the to amount. */
+    gnc_xfer_update_to_amount(xfer);
+
+    /*
+     * When we flip, we should tell the dialog so it can deal with the
+     * pricedb properly.
+     */
+
+    /* Set the exchange rate */
+    gnc_xfer_dialog_set_price_edit(xfer, *exch_rate);
+
+    /* and run it... */
+    if (gnc_xfer_dialog_run_until_done(xfer) == FALSE)
+        return TRUE;
+    /* If we inverted the rate for the dialog, invert it back. */
+    if (swap_amounts)
+        *exch_rate = gnc_numeric_invert(*exch_rate);
+
+    return FALSE;
+}
diff --git a/src/gnome-utils/dialog-transfer.h b/gnucash/gnome-utils/dialog-transfer.h
similarity index 100%
rename from src/gnome-utils/dialog-transfer.h
rename to gnucash/gnome-utils/dialog-transfer.h
diff --git a/src/gnome-utils/dialog-userpass.c b/gnucash/gnome-utils/dialog-userpass.c
similarity index 100%
rename from src/gnome-utils/dialog-userpass.c
rename to gnucash/gnome-utils/dialog-userpass.c
diff --git a/src/gnome-utils/dialog-utils.c b/gnucash/gnome-utils/dialog-utils.c
similarity index 100%
rename from src/gnome-utils/dialog-utils.c
rename to gnucash/gnome-utils/dialog-utils.c
diff --git a/src/gnome-utils/dialog-utils.h b/gnucash/gnome-utils/dialog-utils.h
similarity index 100%
rename from src/gnome-utils/dialog-utils.h
rename to gnucash/gnome-utils/dialog-utils.h
diff --git a/src/gnome-utils/gnc-account-sel.c b/gnucash/gnome-utils/gnc-account-sel.c
similarity index 100%
rename from src/gnome-utils/gnc-account-sel.c
rename to gnucash/gnome-utils/gnc-account-sel.c
diff --git a/src/gnome-utils/gnc-account-sel.h b/gnucash/gnome-utils/gnc-account-sel.h
similarity index 100%
rename from src/gnome-utils/gnc-account-sel.h
rename to gnucash/gnome-utils/gnc-account-sel.h
diff --git a/src/gnome-utils/gnc-amount-edit.c b/gnucash/gnome-utils/gnc-amount-edit.c
similarity index 100%
rename from src/gnome-utils/gnc-amount-edit.c
rename to gnucash/gnome-utils/gnc-amount-edit.c
diff --git a/src/gnome-utils/gnc-amount-edit.h b/gnucash/gnome-utils/gnc-amount-edit.h
similarity index 100%
rename from src/gnome-utils/gnc-amount-edit.h
rename to gnucash/gnome-utils/gnc-amount-edit.h
diff --git a/src/gnome-utils/gnc-autosave.c b/gnucash/gnome-utils/gnc-autosave.c
similarity index 100%
rename from src/gnome-utils/gnc-autosave.c
rename to gnucash/gnome-utils/gnc-autosave.c
diff --git a/src/gnome-utils/gnc-autosave.h b/gnucash/gnome-utils/gnc-autosave.h
similarity index 100%
rename from src/gnome-utils/gnc-autosave.h
rename to gnucash/gnome-utils/gnc-autosave.h
diff --git a/src/gnome-utils/gnc-cell-renderer-date.c b/gnucash/gnome-utils/gnc-cell-renderer-date.c
similarity index 100%
rename from src/gnome-utils/gnc-cell-renderer-date.c
rename to gnucash/gnome-utils/gnc-cell-renderer-date.c
diff --git a/src/gnome-utils/gnc-cell-renderer-date.h b/gnucash/gnome-utils/gnc-cell-renderer-date.h
similarity index 100%
rename from src/gnome-utils/gnc-cell-renderer-date.h
rename to gnucash/gnome-utils/gnc-cell-renderer-date.h
diff --git a/src/gnome-utils/gnc-cell-renderer-popup-entry.c b/gnucash/gnome-utils/gnc-cell-renderer-popup-entry.c
similarity index 100%
rename from src/gnome-utils/gnc-cell-renderer-popup-entry.c
rename to gnucash/gnome-utils/gnc-cell-renderer-popup-entry.c
diff --git a/src/gnome-utils/gnc-cell-renderer-popup-entry.h b/gnucash/gnome-utils/gnc-cell-renderer-popup-entry.h
similarity index 100%
rename from src/gnome-utils/gnc-cell-renderer-popup-entry.h
rename to gnucash/gnome-utils/gnc-cell-renderer-popup-entry.h
diff --git a/src/gnome-utils/gnc-cell-renderer-popup.c b/gnucash/gnome-utils/gnc-cell-renderer-popup.c
similarity index 100%
rename from src/gnome-utils/gnc-cell-renderer-popup.c
rename to gnucash/gnome-utils/gnc-cell-renderer-popup.c
diff --git a/src/gnome-utils/gnc-cell-renderer-popup.h b/gnucash/gnome-utils/gnc-cell-renderer-popup.h
similarity index 100%
rename from src/gnome-utils/gnc-cell-renderer-popup.h
rename to gnucash/gnome-utils/gnc-cell-renderer-popup.h
diff --git a/src/gnome-utils/gnc-combott.c b/gnucash/gnome-utils/gnc-combott.c
similarity index 100%
rename from src/gnome-utils/gnc-combott.c
rename to gnucash/gnome-utils/gnc-combott.c
diff --git a/src/gnome-utils/gnc-combott.h b/gnucash/gnome-utils/gnc-combott.h
similarity index 100%
rename from src/gnome-utils/gnc-combott.h
rename to gnucash/gnome-utils/gnc-combott.h
diff --git a/src/gnome-utils/gnc-commodity-edit.c b/gnucash/gnome-utils/gnc-commodity-edit.c
similarity index 100%
rename from src/gnome-utils/gnc-commodity-edit.c
rename to gnucash/gnome-utils/gnc-commodity-edit.c
diff --git a/src/gnome-utils/gnc-commodity-edit.h b/gnucash/gnome-utils/gnc-commodity-edit.h
similarity index 100%
rename from src/gnome-utils/gnc-commodity-edit.h
rename to gnucash/gnome-utils/gnc-commodity-edit.h
diff --git a/src/gnome-utils/gnc-currency-edit.c b/gnucash/gnome-utils/gnc-currency-edit.c
similarity index 100%
rename from src/gnome-utils/gnc-currency-edit.c
rename to gnucash/gnome-utils/gnc-currency-edit.c
diff --git a/src/gnome-utils/gnc-currency-edit.h b/gnucash/gnome-utils/gnc-currency-edit.h
similarity index 100%
rename from src/gnome-utils/gnc-currency-edit.h
rename to gnucash/gnome-utils/gnc-currency-edit.h
diff --git a/src/gnome-utils/gnc-date-delta.c b/gnucash/gnome-utils/gnc-date-delta.c
similarity index 100%
rename from src/gnome-utils/gnc-date-delta.c
rename to gnucash/gnome-utils/gnc-date-delta.c
diff --git a/src/gnome-utils/gnc-date-delta.h b/gnucash/gnome-utils/gnc-date-delta.h
similarity index 100%
rename from src/gnome-utils/gnc-date-delta.h
rename to gnucash/gnome-utils/gnc-date-delta.h
diff --git a/src/gnome-utils/gnc-date-edit.c b/gnucash/gnome-utils/gnc-date-edit.c
similarity index 100%
rename from src/gnome-utils/gnc-date-edit.c
rename to gnucash/gnome-utils/gnc-date-edit.c
diff --git a/src/gnome-utils/gnc-date-edit.h b/gnucash/gnome-utils/gnc-date-edit.h
similarity index 100%
rename from src/gnome-utils/gnc-date-edit.h
rename to gnucash/gnome-utils/gnc-date-edit.h
diff --git a/src/gnome-utils/gnc-date-format.c b/gnucash/gnome-utils/gnc-date-format.c
similarity index 100%
rename from src/gnome-utils/gnc-date-format.c
rename to gnucash/gnome-utils/gnc-date-format.c
diff --git a/src/gnome-utils/gnc-date-format.h b/gnucash/gnome-utils/gnc-date-format.h
similarity index 100%
rename from src/gnome-utils/gnc-date-format.h
rename to gnucash/gnome-utils/gnc-date-format.h
diff --git a/src/gnome-utils/gnc-dense-cal-model.c b/gnucash/gnome-utils/gnc-dense-cal-model.c
similarity index 100%
rename from src/gnome-utils/gnc-dense-cal-model.c
rename to gnucash/gnome-utils/gnc-dense-cal-model.c
diff --git a/src/gnome-utils/gnc-dense-cal-model.h b/gnucash/gnome-utils/gnc-dense-cal-model.h
similarity index 100%
rename from src/gnome-utils/gnc-dense-cal-model.h
rename to gnucash/gnome-utils/gnc-dense-cal-model.h
diff --git a/src/gnome-utils/gnc-dense-cal-store.c b/gnucash/gnome-utils/gnc-dense-cal-store.c
similarity index 100%
rename from src/gnome-utils/gnc-dense-cal-store.c
rename to gnucash/gnome-utils/gnc-dense-cal-store.c
diff --git a/src/gnome-utils/gnc-dense-cal-store.h b/gnucash/gnome-utils/gnc-dense-cal-store.h
similarity index 100%
rename from src/gnome-utils/gnc-dense-cal-store.h
rename to gnucash/gnome-utils/gnc-dense-cal-store.h
diff --git a/src/gnome-utils/gnc-dense-cal.c b/gnucash/gnome-utils/gnc-dense-cal.c
similarity index 100%
rename from src/gnome-utils/gnc-dense-cal.c
rename to gnucash/gnome-utils/gnc-dense-cal.c
diff --git a/src/gnome-utils/gnc-dense-cal.h b/gnucash/gnome-utils/gnc-dense-cal.h
similarity index 100%
rename from src/gnome-utils/gnc-dense-cal.h
rename to gnucash/gnome-utils/gnc-dense-cal.h
diff --git a/src/gnome-utils/gnc-embedded-window.c b/gnucash/gnome-utils/gnc-embedded-window.c
similarity index 100%
rename from src/gnome-utils/gnc-embedded-window.c
rename to gnucash/gnome-utils/gnc-embedded-window.c
diff --git a/src/gnome-utils/gnc-embedded-window.h b/gnucash/gnome-utils/gnc-embedded-window.h
similarity index 100%
rename from src/gnome-utils/gnc-embedded-window.h
rename to gnucash/gnome-utils/gnc-embedded-window.h
diff --git a/src/gnome-utils/gnc-file.c b/gnucash/gnome-utils/gnc-file.c
similarity index 100%
rename from src/gnome-utils/gnc-file.c
rename to gnucash/gnome-utils/gnc-file.c
diff --git a/src/gnome-utils/gnc-file.h b/gnucash/gnome-utils/gnc-file.h
similarity index 100%
rename from src/gnome-utils/gnc-file.h
rename to gnucash/gnome-utils/gnc-file.h
diff --git a/src/gnome-utils/gnc-frequency.c b/gnucash/gnome-utils/gnc-frequency.c
similarity index 100%
rename from src/gnome-utils/gnc-frequency.c
rename to gnucash/gnome-utils/gnc-frequency.c
diff --git a/src/gnome-utils/gnc-frequency.h b/gnucash/gnome-utils/gnc-frequency.h
similarity index 100%
rename from src/gnome-utils/gnc-frequency.h
rename to gnucash/gnome-utils/gnc-frequency.h
diff --git a/src/gnome-utils/gnc-general-select.c b/gnucash/gnome-utils/gnc-general-select.c
similarity index 100%
rename from src/gnome-utils/gnc-general-select.c
rename to gnucash/gnome-utils/gnc-general-select.c
diff --git a/src/gnome-utils/gnc-general-select.h b/gnucash/gnome-utils/gnc-general-select.h
similarity index 100%
rename from src/gnome-utils/gnc-general-select.h
rename to gnucash/gnome-utils/gnc-general-select.h
diff --git a/src/gnome-utils/gnc-gnome-utils.c b/gnucash/gnome-utils/gnc-gnome-utils.c
similarity index 100%
rename from src/gnome-utils/gnc-gnome-utils.c
rename to gnucash/gnome-utils/gnc-gnome-utils.c
diff --git a/src/gnome-utils/gnc-gnome-utils.h b/gnucash/gnome-utils/gnc-gnome-utils.h
similarity index 100%
rename from src/gnome-utils/gnc-gnome-utils.h
rename to gnucash/gnome-utils/gnc-gnome-utils.h
diff --git a/src/gnome-utils/gnc-gobject-utils.c b/gnucash/gnome-utils/gnc-gobject-utils.c
similarity index 100%
rename from src/gnome-utils/gnc-gobject-utils.c
rename to gnucash/gnome-utils/gnc-gobject-utils.c
diff --git a/src/gnome-utils/gnc-gobject-utils.h b/gnucash/gnome-utils/gnc-gobject-utils.h
similarity index 100%
rename from src/gnome-utils/gnc-gobject-utils.h
rename to gnucash/gnome-utils/gnc-gobject-utils.h
diff --git a/src/gnome-utils/gnc-gtk-utils.c b/gnucash/gnome-utils/gnc-gtk-utils.c
similarity index 100%
rename from src/gnome-utils/gnc-gtk-utils.c
rename to gnucash/gnome-utils/gnc-gtk-utils.c
diff --git a/src/gnome-utils/gnc-gtk-utils.h b/gnucash/gnome-utils/gnc-gtk-utils.h
similarity index 100%
rename from src/gnome-utils/gnc-gtk-utils.h
rename to gnucash/gnome-utils/gnc-gtk-utils.h
diff --git a/src/gnome-utils/gnc-gui-query.c b/gnucash/gnome-utils/gnc-gui-query.c
similarity index 100%
rename from src/gnome-utils/gnc-gui-query.c
rename to gnucash/gnome-utils/gnc-gui-query.c
diff --git a/src/gnome-utils/gnc-gui-query.h b/gnucash/gnome-utils/gnc-gui-query.h
similarity index 100%
rename from src/gnome-utils/gnc-gui-query.h
rename to gnucash/gnome-utils/gnc-gui-query.h
diff --git a/src/gnome-utils/gnc-icons.c b/gnucash/gnome-utils/gnc-icons.c
similarity index 100%
rename from src/gnome-utils/gnc-icons.c
rename to gnucash/gnome-utils/gnc-icons.c
diff --git a/src/gnome-utils/gnc-icons.h b/gnucash/gnome-utils/gnc-icons.h
similarity index 100%
rename from src/gnome-utils/gnc-icons.h
rename to gnucash/gnome-utils/gnc-icons.h
diff --git a/src/gnome-utils/gnc-keyring.c b/gnucash/gnome-utils/gnc-keyring.c
similarity index 100%
rename from src/gnome-utils/gnc-keyring.c
rename to gnucash/gnome-utils/gnc-keyring.c
diff --git a/src/gnome-utils/gnc-keyring.h b/gnucash/gnome-utils/gnc-keyring.h
similarity index 100%
rename from src/gnome-utils/gnc-keyring.h
rename to gnucash/gnome-utils/gnc-keyring.h
diff --git a/gnucash/gnome-utils/gnc-main-window.c b/gnucash/gnome-utils/gnc-main-window.c
new file mode 100644
index 0000000..b3861bb
--- /dev/null
+++ b/gnucash/gnome-utils/gnc-main-window.c
@@ -0,0 +1,4839 @@
+/*
+ * gnc-main-window.c -- GtkWindow which represents the
+ *	GnuCash main window.
+ *
+ * Copyright (C) 2003 Jan Arne Petersen <jpetersen at uni-bonn.de>
+ * Copyright (C) 2003,2005,2006 David Hampton <hampton at employees.org>
+ *
+ * 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 at gnu.org
+ */
+
+/** @addtogroup Windows
+    @{ */
+/** @addtogroup GncMainWindow Main Window functions.
+    @{ */
+/** @file gnc-main-window.c
+    @brief Functions for adding content to a window.
+    @author Copyright (C) 2003 Jan Arne Petersen <jpetersen at uni-bonn.de>
+    @author Copyright (C) 2003,2005,2006 David Hampton <hampton at employees.org>
+*/
+#include "config.h"
+
+#include <glib/gi18n.h>
+#include <gtk/gtk.h>
+#include <gdk/gdk.h>
+#include <gdk/gdkkeysyms.h>
+
+#include "gnc-plugin.h"
+#include "gnc-plugin-manager.h"
+#include "gnc-main-window.h"
+
+#include "dialog-options.h"
+#include "dialog-preferences.h"
+#include "dialog-reset-warnings.h"
+#include "dialog-transfer.h"
+#include "dialog-utils.h"
+#include "file-utils.h"
+#include "gnc-component-manager.h"
+#include "gnc-engine.h"
+#include "gnc-file.h"
+#include "gnc-filepath-utils.h"
+#include "gnc-gkeyfile-utils.h"
+#include "gnc-gnome-utils.h"
+#include "gnc-gobject-utils.h"
+#include "gnc-gui-query.h"
+#include "gnc-hooks.h"
+#include "gnc-icons.h"
+#include "gnc-session.h"
+#include "gnc-state.h"
+#include "gnc-ui.h"
+#include "gnc-ui-util.h"
+#include "gnc-uri-utils.h"
+#include "gnc-version.h"
+#include "gnc-window.h"
+#include "gnc-prefs.h"
+#include "option-util.h"
+// +JSLED
+//#include "gnc-html.h"
+#include "gnc-autosave.h"
+#include "print-session.h"
+#ifdef MAC_INTEGRATION
+#include <gtkmacintegration/gtkosxapplication.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+# define __need_system_sys_stat_h //To block Guile-2.0's evil substitute
+# include <sys/types.h>
+# include <sys/stat.h> // for stat(2)
+#endif
+
+/** Names of signals generated by the main window. */
+enum
+{
+    PAGE_ADDED,
+    PAGE_CHANGED,
+    LAST_SIGNAL
+};
+
+/** This label is used to provide a mapping from a visible page widget
+ *  back to the corresponding GncPluginPage object. */
+#define PLUGIN_PAGE_LABEL "plugin-page"
+
+#define PLUGIN_PAGE_CLOSE_BUTTON "close-button"
+#define PLUGIN_PAGE_TAB_LABEL    "label"
+
+#define GNC_PREF_SHOW_CLOSE_BUTTON    "tab-close-buttons"
+#define GNC_PREF_TAB_NEXT_RECENT      "tab-next-recent"
+#define GNC_PREF_TAB_POSITION_TOP     "tab-position-top"
+#define GNC_PREF_TAB_POSITION_BOTTOM  "tab-position-bottom"
+#define GNC_PREF_TAB_POSITION_LEFT    "tab-position-left"
+#define GNC_PREF_TAB_POSITION_RIGHT   "tab-position-right"
+#define GNC_PREF_TAB_WIDTH            "tab-width"
+#define GNC_PREF_TAB_COLOR            "show-account-color-tabs"
+#define GNC_PREF_SAVE_CLOSE_EXPIRES   "save-on-close-expires"
+#define GNC_PREF_SAVE_CLOSE_WAIT_TIME "save-on-close-wait-time"
+
+#define GNC_MAIN_WINDOW_NAME "GncMainWindow"
+
+#define DIALOG_BOOK_OPTIONS_CM_CLASS "dialog-book-options"
+
+/* Static Globals *******************************************************/
+
+/** The debugging module that this .o belongs to.  */
+static QofLogModule log_module = GNC_MOD_GUI;
+/** A pointer to the parent class of an embedded window. */
+static GObjectClass *parent_class = NULL;
+/** An identifier that indicates a "main" window. */
+static GQuark window_type = 0;
+/** A list of all extant main windows. This is for convenience as the
+ *  same information can be obtained from the object tracking code. */
+static GList *active_windows = NULL;
+/** Count down timer for the save changes dialog. If the timer reaches zero
+ *  any changes will be saved and the save dialog closed automatically */
+static guint secs_to_save = 0;
+#define MSG_AUTO_SAVE _("Changes will be saved automatically in %u seconds")
+
+/* Declarations *********************************************************/
+static void gnc_main_window_class_init (GncMainWindowClass *klass);
+static void gnc_main_window_init (GncMainWindow *window, GncMainWindowClass *klass);
+static void gnc_main_window_finalize (GObject *object);
+static void gnc_main_window_destroy (GtkWidget *widget);
+
+static void gnc_main_window_setup_window (GncMainWindow *window);
+static void gnc_window_main_window_init (GncWindowIface *iface);
+#ifndef MAC_INTEGRATION
+static void gnc_main_window_update_all_menu_items (void);
+#endif
+
+/* Callbacks */
+static void gnc_main_window_add_widget (GtkUIManager *merge, GtkWidget *widget, GncMainWindow *window);
+static void gnc_main_window_switch_page (GtkNotebook *notebook, gpointer *notebook_page, gint pos, GncMainWindow *window);
+static void gnc_main_window_page_reordered (GtkNotebook *notebook, GtkWidget *child, guint pos, GncMainWindow *window);
+static void gnc_main_window_plugin_added (GncPlugin *manager, GncPlugin *plugin, GncMainWindow *window);
+static void gnc_main_window_plugin_removed (GncPlugin *manager, GncPlugin *plugin, GncMainWindow *window);
+static void gnc_main_window_engine_commit_error_callback( gpointer data, QofBackendError errcode );
+
+/* Command callbacks */
+static void gnc_main_window_cmd_page_setup (GtkAction *action, GncMainWindow *window);
+static void gnc_main_window_cmd_file_properties (GtkAction *action, GncMainWindow *window);
+static void gnc_main_window_cmd_file_close (GtkAction *action, GncMainWindow *window);
+static void gnc_main_window_cmd_file_quit (GtkAction *action, GncMainWindow *window);
+static void gnc_main_window_cmd_edit_cut (GtkAction *action, GncMainWindow *window);
+static void gnc_main_window_cmd_edit_copy (GtkAction *action, GncMainWindow *window);
+static void gnc_main_window_cmd_edit_paste (GtkAction *action, GncMainWindow *window);
+static void gnc_main_window_cmd_edit_preferences (GtkAction *action, GncMainWindow *window);
+static void gnc_main_window_cmd_view_refresh (GtkAction *action, GncMainWindow *window);
+static void gnc_main_window_cmd_view_toolbar (GtkAction *action, GncMainWindow *window);
+static void gnc_main_window_cmd_view_summary (GtkAction *action, GncMainWindow *window);
+static void gnc_main_window_cmd_view_statusbar (GtkAction *action, GncMainWindow *window);
+static void gnc_main_window_cmd_actions_reset_warnings (GtkAction *action, GncMainWindow *window);
+static void gnc_main_window_cmd_actions_rename_page (GtkAction *action, GncMainWindow *window);
+static void gnc_main_window_cmd_window_new (GtkAction *action, GncMainWindow *window);
+static void gnc_main_window_cmd_window_move_page (GtkAction *action, GncMainWindow *window);
+#ifndef MAC_INTEGRATION
+static void gnc_main_window_cmd_window_raise (GtkAction *action, GtkRadioAction *current, GncMainWindow *window);
+#endif
+static void gnc_main_window_cmd_help_tutorial (GtkAction *action, GncMainWindow *window);
+static void gnc_main_window_cmd_help_contents (GtkAction *action, GncMainWindow *window);
+static void gnc_main_window_cmd_help_about (GtkAction *action, GncMainWindow *window);
+
+static void do_popup_menu(GncPluginPage *page, GdkEventButton *event);
+static gboolean gnc_main_window_popup_menu_cb (GtkWidget *widget, GncPluginPage *page);
+static GtkWidget *gnc_main_window_get_statusbar (GncWindow *window_in);
+static void statusbar_notification_lastmodified(void);
+
+#ifdef MAC_INTEGRATION
+static void gnc_quartz_shutdown(GtkosxApplication *theApp, gpointer data);
+static gboolean gnc_quartz_should_quit(GtkosxApplication *theApp, GncMainWindow *window);
+static void gnc_quartz_set_menu(GncMainWindow* window);
+#endif
+
+/** The instance private data structure for an embedded window
+ *  object. */
+typedef struct GncMainWindowPrivate
+{
+    /** The dock (vbox) at the top of the window containing the
+     *  menubar and toolbar.  These items are generated by the UI
+     *  manager and stored here when the UI manager provides them
+     *  to the main window. */
+    GtkWidget *menu_dock;
+    /** The toolbar created by the UI manager.  This pointer
+     * provides easy access for showing/hiding the toolbar. */
+    GtkWidget *toolbar;
+    /** The notebook containing all the pages in this window. */
+    GtkWidget *notebook;
+    /** Show account color as background on tabs */
+    gboolean show_color_tabs;
+    /** A pointer to the status bar at the bottom edge of the
+     *  window.  This pointer provides easy access for
+     *  updating/showing/hiding the status bar. */
+    GtkWidget *statusbar;
+    /** A pointer to the progress bar at the bottom right of the
+     *  window that is contained in the status bar.  This pointer
+     *  provides easy access for updating the progressbar. */
+    GtkWidget *progressbar;
+    /** Pointer to the about dialog.  We need this so that we create
+     *  only one, can attach to its activate-link signal, and can
+     *  destroy it with the main window.
+     */
+    GtkWidget *about_dialog;
+
+    /** The group of all actions provided by the main window
+     *  itself.  This does not include any action provided by menu
+     *  or content plugins. */
+    GtkActionGroup *action_group;
+
+    /** A list of all pages that are installed in this window. */
+    GList *installed_pages;
+    /** A list of pages in order of use (most recent -> least recent) */
+    GList *usage_order;
+    /** The currently selected page. */
+    GncPluginPage *current_page;
+    /** The identifier for this window's engine event handler. */
+    gint event_handler_id;
+
+    /** A hash table of all action groups that have been installed
+     *  into this window. The keys are the name of an action
+     *  group, the values are structures of type
+     *  MergedActionEntry. */
+    GHashTable *merged_actions_table;
+} GncMainWindowPrivate;
+
+#define GNC_MAIN_WINDOW_GET_PRIVATE(o)  \
+   (G_TYPE_INSTANCE_GET_PRIVATE ((o), GNC_TYPE_MAIN_WINDOW, GncMainWindowPrivate))
+
+/** This data structure maintains information about one action groups
+ *  that has been installed in this window. */
+typedef struct
+{
+    /** The merge identifier for this action group.  This number
+     *  is provided by the UI manager. */
+    guint merge_id;
+    /** The action group itself.  This contains all actions added
+     *  by a single menu or content plugin. */
+    GtkActionGroup *action_group;
+} MergedActionEntry;
+
+/** A holding place for all the signals generated by the main window
+ *  code. */
+static guint main_window_signals[LAST_SIGNAL] = { 0 };
+
+
+/** An array of all of the actions provided by the main window code.
+ *  This includes some placeholder actions for the menus that are
+ *  visible in the menu bar but have no action associated with
+ *  them. */
+static GtkActionEntry gnc_menu_actions [] =
+{
+    /* Toplevel */
+
+    { "FileAction", NULL, N_("_File"), NULL, NULL, NULL, },
+    { "EditAction", NULL, N_("_Edit"), NULL, NULL, NULL },
+    { "ViewAction", NULL, N_("_View"), NULL, NULL, NULL },
+    { "ActionsAction", NULL, N_("_Actions"), NULL, NULL, NULL },
+    { "TransactionAction", NULL, N_("Tra_nsaction"), NULL, NULL, NULL },
+    { "ReportsAction", NULL, N_("_Reports"), NULL, NULL, NULL },
+    { "ToolsAction", NULL, N_("_Tools"), NULL, NULL, NULL },
+    { "ExtensionsAction", NULL, N_("E_xtensions"), NULL, NULL, NULL },
+    { "WindowsAction", NULL, N_("_Windows"), NULL, NULL, NULL },
+    { "HelpAction", NULL, N_("_Help"), NULL, NULL, NULL },
+
+    /* File menu */
+
+    { "FileImportAction", NULL, N_("_Import"), NULL, NULL, NULL },
+    { "FileExportAction", NULL, N_("_Export"), NULL, NULL, NULL },
+    {
+        "FilePrintAction", "document-print", N_("_Print..."), "<primary>p",
+        N_("Print the currently active page"), NULL
+    },
+#ifndef GTK_STOCK_PAGE_SETUP
+#    define GTK_STOCK_PAGE_SETUP NULL
+#endif
+    {
+        "FilePageSetupAction", "document-page-setup", N_("Pa_ge Setup..."), "<primary><shift>p",
+        N_("Specify the page size and orientation for printing"),
+        G_CALLBACK (gnc_main_window_cmd_page_setup)
+    },
+    {
+        "FilePropertiesAction", "document-properties", N_("Proper_ties"), "<Alt>Return",
+        N_("Edit the properties of the current file"),
+        G_CALLBACK (gnc_main_window_cmd_file_properties)
+    },
+    {
+        "FileCloseAction", "window-close", N_("_Close"), "<primary>W",
+        N_("Close the currently active page"),
+        G_CALLBACK (gnc_main_window_cmd_file_close)
+    },
+    {
+        "FileQuitAction", "application-exit", N_("_Quit"), "<primary>Q",
+        N_("Quit this application"),
+        G_CALLBACK (gnc_main_window_cmd_file_quit)
+    },
+
+    /* Edit menu */
+
+    {
+        "EditCutAction", "edit-cut", N_("Cu_t"), "<primary>X",
+        N_("Cut the current selection and copy it to clipboard"),
+        G_CALLBACK (gnc_main_window_cmd_edit_cut)
+    },
+    {
+        "EditCopyAction", "edit-copy", N_("_Copy"), "<primary>C",
+        N_("Copy the current selection to clipboard"),
+        G_CALLBACK (gnc_main_window_cmd_edit_copy)
+    },
+    {
+        "EditPasteAction", "edit-paste", N_("_Paste"), "<primary>V",
+        N_("Paste the clipboard content at the cursor position"),
+        G_CALLBACK (gnc_main_window_cmd_edit_paste)
+    },
+    {
+        "EditPreferencesAction", "preferences-system", N_("Pr_eferences"), NULL,
+        N_("Edit the global preferences of GnuCash"),
+        G_CALLBACK (gnc_main_window_cmd_edit_preferences)
+    },
+
+    /* View menu */
+
+    {
+        "ViewSortByAction", NULL, N_("_Sort By..."), NULL,
+        N_("Select sorting criteria for this page view"), NULL
+    },
+    {
+        "ViewFilterByAction", NULL, N_("_Filter By..."), NULL,
+        N_("Select the account types that should be displayed."), NULL
+    },
+    {
+        "ViewRefreshAction", "view-refresh", N_("_Refresh"), "<primary>r",
+        N_("Refresh this window"),
+        G_CALLBACK (gnc_main_window_cmd_view_refresh)
+    },
+
+    /* Actions menu */
+
+    { "ScrubMenuAction", NULL, N_("_Check & Repair"), NULL, NULL, NULL },
+    {
+        "ActionsForgetWarningsAction", NULL, N_("Reset _Warnings..."), NULL,
+        N_("Reset the state of all warning messages so they will be shown again."),
+        G_CALLBACK (gnc_main_window_cmd_actions_reset_warnings)
+    },
+    {
+        "ActionsRenamePageAction", NULL, N_("Re_name Page"), NULL,
+        N_("Rename this page."),
+        G_CALLBACK (gnc_main_window_cmd_actions_rename_page)
+    },
+
+    /* Windows menu */
+
+    {
+        "WindowNewAction", NULL, N_("_New Window"), NULL,
+        N_("Open a new top-level GnuCash window."),
+        G_CALLBACK (gnc_main_window_cmd_window_new)
+    },
+    {
+        "WindowMovePageAction", NULL, N_("New Window with _Page"), NULL,
+        N_("Move the current page to a new top-level GnuCash window."),
+        G_CALLBACK (gnc_main_window_cmd_window_move_page)
+    },
+
+    /* Help menu */
+
+    {
+        "HelpTutorialAction", "help-browser", N_("Tutorial and Concepts _Guide"), "<primary>H",
+        N_("Open the GnuCash Tutorial"),
+        G_CALLBACK (gnc_main_window_cmd_help_tutorial)
+    },
+    {
+        "HelpContentsAction", "help-browser", N_("_Contents"), "F1",
+        N_("Open the GnuCash Help"),
+        G_CALLBACK (gnc_main_window_cmd_help_contents)
+    },
+    {
+        "HelpAboutAction", "help-about", N_("_About"), NULL,
+        N_("About GnuCash"),
+        G_CALLBACK (gnc_main_window_cmd_help_about)
+    },
+};
+/** The number of actions provided by the main window. */
+static guint gnc_menu_n_actions = G_N_ELEMENTS (gnc_menu_actions);
+
+/** An array of all of the toggle action provided by the main window
+ *  code. */
+static GtkToggleActionEntry toggle_actions [] =
+{
+    {
+        "ViewToolbarAction", NULL, N_("_Toolbar"), NULL,
+        N_("Show/hide the toolbar on this window"),
+        G_CALLBACK (gnc_main_window_cmd_view_toolbar), TRUE
+    },
+    {
+        "ViewSummaryAction", NULL, N_("Su_mmary Bar"), NULL,
+        N_("Show/hide the summary bar on this window"),
+        G_CALLBACK (gnc_main_window_cmd_view_summary), TRUE
+    },
+    {
+        "ViewStatusbarAction", NULL, N_("Stat_us Bar"), NULL,
+        N_("Show/hide the status bar on this window"),
+        G_CALLBACK (gnc_main_window_cmd_view_statusbar), TRUE
+    },
+};
+/** The number of toggle actions provided by the main window. */
+static guint n_toggle_actions = G_N_ELEMENTS (toggle_actions);
+
+#ifndef MAC_INTEGRATION
+/** An array of all of the radio action provided by the main window
+ *  code. */
+static GtkRadioActionEntry radio_entries [] =
+{
+    { "Window0Action", NULL, N_("Window _1"), NULL, NULL, 0 },
+    { "Window1Action", NULL, N_("Window _2"), NULL, NULL, 1 },
+    { "Window2Action", NULL, N_("Window _3"), NULL, NULL, 2 },
+    { "Window3Action", NULL, N_("Window _4"), NULL, NULL, 3 },
+    { "Window4Action", NULL, N_("Window _5"), NULL, NULL, 4 },
+    { "Window5Action", NULL, N_("Window _6"), NULL, NULL, 5 },
+    { "Window6Action", NULL, N_("Window _7"), NULL, NULL, 6 },
+    { "Window7Action", NULL, N_("Window _8"), NULL, NULL, 7 },
+    { "Window8Action", NULL, N_("Window _9"), NULL, NULL, 8 },
+    { "Window9Action", NULL, N_("Window _0"), NULL, NULL, 9 },
+};
+
+/** The number of radio actions provided by the main window. */
+static guint n_radio_entries = G_N_ELEMENTS (radio_entries);
+#endif
+
+/** These are the "important" actions provided by the main window.
+ *  Their labels will appear when the toolbar is set to "Icons and
+ *  important text" (e.g. GTK_TOOLBAR_BOTH_HORIZ) mode. */
+static const gchar *gnc_menu_important_actions[] =
+{
+    "FileCloseAction",
+    NULL,
+};
+
+
+/** The following are in the main window so they will always be
+ *  present in the menu structure, but they are never sensitive.
+ *  These actions should be overridden in child windows where they
+ *  have meaning. */
+static const gchar *always_insensitive_actions[] =
+{
+    "FilePrintAction",
+    NULL
+};
+
+
+/** The following items in the main window should be made insensitive
+ *  at startup time.  The sensitivity will be changed by some later
+ *  event. */
+static const gchar *initially_insensitive_actions[] =
+{
+    "FileCloseAction",
+    NULL
+};
+
+
+/** The following are in the main window so they will always be
+ *  present in the menu structure, but they are always hidden.
+ *  These actions should be overridden in child windows where they
+ *  have meaning. */
+static const gchar *always_hidden_actions[] =
+{
+    "ViewSortByAction",
+    "ViewFilterByAction",
+    NULL
+};
+
+
+/** If a page is flagged as immutable, then the following actions
+ *  cannot be performed on that page. */
+static const gchar *immutable_page_actions[] =
+{
+    "FileCloseAction",
+    NULL
+};
+
+
+/** The following actions can only be performed if there are multiple
+ *  pages in a window. */
+static const gchar *multiple_page_actions[] =
+{
+    "WindowMovePageAction",
+    NULL
+};
+
+
+/************************************************************
+ *                                                          *
+ ************************************************************/
+#define WINDOW_COUNT            "WindowCount"
+#define WINDOW_STRING           "Window %d"
+#define WINDOW_GEOMETRY         "WindowGeometry"
+#define WINDOW_POSITION         "WindowPosition"
+#define WINDOW_MAXIMIZED        "WindowMaximized"
+#define TOOLBAR_VISIBLE         "ToolbarVisible"
+#define STATUSBAR_VISIBLE       "StatusbarVisible"
+#define SUMMARYBAR_VISIBLE      "SummarybarVisible"
+#define WINDOW_FIRSTPAGE        "FirstPage"
+#define WINDOW_PAGECOUNT        "PageCount"
+#define WINDOW_PAGEORDER        "PageOrder"
+#define PAGE_TYPE               "PageType"
+#define PAGE_NAME               "PageName"
+#define PAGE_STRING             "Page %d"
+
+typedef struct
+{
+    GKeyFile *key_file;
+    const gchar *group_name;
+    gint window_num;
+    gint page_num;
+    gint page_offset;
+} GncMainWindowSaveData;
+
+
+/*  Iterator function to walk all pages in all windows, calling the
+ *  specified function for each page. */
+void
+gnc_main_window_foreach_page (GncMainWindowPageFunc fn, gpointer user_data)
+{
+    GncMainWindowPrivate *priv;
+    GncMainWindow *window;
+    GncPluginPage *page;
+    GList *w, *p;
+
+    ENTER(" ");
+    for (w = active_windows; w; w = g_list_next(w))
+    {
+        window = w->data;
+        priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
+        for (p = priv->installed_pages; p; p = g_list_next(p))
+        {
+            page = p->data;
+            fn(page, user_data);
+        }
+    }
+    LEAVE(" ");
+}
+
+
+/** Restore a single page to a window.  This function calls a page
+ *  specific function to create the actual page.  It then handles all
+ *  the common tasks such as insuring the page is installed into a
+ *  window, updating the page name, and anything else that might be
+ *  common to all pages.
+ *
+ *  @param window The GncMainWindow where the new page will be
+ *  installed.
+ *
+ *  @param data A data structure containing state about the
+ *  window/page restoration process. */
+static void
+gnc_main_window_restore_page (GncMainWindow *window,
+                              GncMainWindowSaveData *data)
+{
+    GncMainWindowPrivate *priv;
+    GncPluginPage *page;
+    gchar *page_group, *page_type = NULL, *name = NULL;
+    const gchar *class_type;
+    GError *error = NULL;
+
+    ENTER("window %p, data %p (key file %p, window %d, page start %d, page num %d)",
+          window, data, data->key_file, data->window_num, data->page_offset,
+          data->page_num);
+
+    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
+    page_group = g_strdup_printf(PAGE_STRING,
+                                 data->page_offset + data->page_num);
+    page_type = g_key_file_get_string(data->key_file, page_group,
+                                      PAGE_TYPE, &error);
+    if (error)
+    {
+        g_warning("error reading group %s key %s: %s",
+                  page_group, PAGE_TYPE, error->message);
+        goto cleanup;
+    }
+
+    /* See if the page already exists. */
+    page = g_list_nth_data(priv->installed_pages, data->page_num);
+    if (page)
+    {
+        class_type = GNC_PLUGIN_PAGE_GET_CLASS(page)->plugin_name;
+        if (strcmp(page_type, class_type) != 0)
+        {
+            g_warning("error: page types don't match: state %s, existing page %s",
+                      page_type, class_type);
+            goto cleanup;
+        }
+    }
+    else
+    {
+        /* create and install the page */
+        page = gnc_plugin_page_recreate_page(GTK_WIDGET(window), page_type,
+                                             data->key_file, page_group);
+        if (page)
+        {
+            /* Does the page still need to be installed into the window? */
+            if (page->window == NULL)
+            {
+                gnc_plugin_page_set_use_new_window(page, FALSE);
+                gnc_main_window_open_page(window, page);
+            }
+
+            /* Restore the page name */
+            name = g_key_file_get_string(data->key_file, page_group,
+                                         PAGE_NAME, &error);
+            if (error)
+            {
+                g_warning("error reading group %s key %s: %s",
+                          page_group, PAGE_NAME, error->message);
+                /* Fall through and still show the page. */
+            }
+            else
+            {
+                DEBUG("updating page name for %p to %s.", page, name);
+                main_window_update_page_name(page, name);
+                g_free(name);
+            }
+        }
+    }
+
+    LEAVE("ok");
+cleanup:
+    if (error)
+        g_error_free(error);
+    if (page_type)
+        g_free(page_type);
+    g_free(page_group);
+}
+
+
+/** Restore all the pages in a given window.  This function restores
+ *  all the window specific attributes, then calls a helper function
+ *  to restore all the pages that are contained in the window.
+ *
+ *  @param window The GncMainWindow whose pages should be restored.
+ *
+ *  @param data A data structure containing state about the
+ *  window/page restoration process. */
+static void
+gnc_main_window_restore_window (GncMainWindow *window, GncMainWindowSaveData *data)
+{
+    GncMainWindowPrivate *priv;
+    GtkAction *action;
+    gint *pos, *geom, *order;
+    gsize length;
+    gboolean max, visible, desired_visibility;
+    gchar *window_group;
+    gint page_start, page_count, i;
+    GError *error = NULL;
+
+    /* Setup */
+    ENTER("window %p, data %p (key file %p, window %d)",
+          window, data, data->key_file, data->window_num);
+    window_group = g_strdup_printf(WINDOW_STRING, data->window_num + 1);
+
+    /* Deal with the uncommon case that the state file defines a window
+     * but no pages. An example to get in such a situation can be found
+     * here: https://bugzilla.gnome.org/show_bug.cgi?id=436479#c3
+     * If this happens on the first window, we will open an account hierarchy
+     * to avoid confusing the user by presenting a completely empty window.
+     * If it happens on a later window, we'll just skip restoring that window.
+     */
+    if (!g_key_file_has_group (data->key_file, window_group) ||
+        !g_key_file_has_key (data->key_file, window_group, WINDOW_PAGECOUNT, &error))
+    {
+        if (window)
+        {
+            gnc_main_window_restore_default_state (window);
+            PINFO ("saved state had an empty first main window\n"
+                   "an account hierarchy page was added automatically to avoid confusion");
+        }
+        else
+            PINFO ("saved state had an empty main window, skipping restore");
+
+        goto cleanup;
+    }
+
+
+    /* Get this window's notebook info */
+    page_count = g_key_file_get_integer(data->key_file,
+                                        window_group, WINDOW_PAGECOUNT, &error);
+    if (error)
+    {
+        g_warning("error reading group %s key %s: %s",
+                  window_group, WINDOW_PAGECOUNT, error->message);
+        goto cleanup;
+    }
+    if (page_count == 0)
+    {
+        /* Should never happen, but has during alpha testing. Having this
+         * check doesn't hurt anything. */
+        goto cleanup;
+    }
+    page_start = g_key_file_get_integer(data->key_file,
+                                        window_group, WINDOW_FIRSTPAGE, &error);
+    if (error)
+    {
+        g_warning("error reading group %s key %s: %s",
+                  window_group, WINDOW_FIRSTPAGE, error->message);
+        goto cleanup;
+    }
+
+    /* Build a window if we don't already have one */
+    if (window == NULL)
+    {
+        DEBUG("Window %d doesn't exist. Creating new window.", data->window_num);
+        DEBUG("active_windows %p.", active_windows);
+        if (active_windows)
+            DEBUG("first window %p.", active_windows->data);
+        window = gnc_main_window_new();
+        gtk_widget_show(GTK_WIDGET(window));
+    }
+
+    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
+
+    /* Get the window coordinates, etc. */
+    geom = g_key_file_get_integer_list(data->key_file, window_group,
+                                       WINDOW_GEOMETRY, &length, &error);
+    if (error)
+    {
+        g_warning("error reading group %s key %s: %s",
+                  window_group, WINDOW_GEOMETRY, error->message);
+        g_error_free(error);
+        error = NULL;
+    }
+    else if (length != 2)
+    {
+        g_warning("invalid number of values for group %s key %s",
+                  window_group, WINDOW_GEOMETRY);
+    }
+    else
+    {
+        gtk_window_resize(GTK_WINDOW(window), geom[0], geom[1]);
+        DEBUG("window (%p) size %dx%d", window, geom[0], geom[1]);
+    }
+    /* keep the geometry for a test whether the windows position
+       is offscreen */
+
+    pos = g_key_file_get_integer_list(data->key_file, window_group,
+                                      WINDOW_POSITION, &length, &error);
+    if (error)
+    {
+        g_warning("error reading group %s key %s: %s",
+                  window_group, WINDOW_POSITION, error->message);
+        g_error_free(error);
+        error = NULL;
+    }
+    else if (length != 2)
+    {
+        g_warning("invalid number of values for group %s key %s",
+                  window_group, WINDOW_POSITION);
+    }
+// This does not do any thing ?
+//    else if ((pos[0] + (geom ? geom[0] : 0) < 0) ||
+//             (pos[0] > gdk_screen_width()) ||
+//             (pos[1] + (geom ? geom[1] : 0) < 0) ||
+//             (pos[1] > gdk_screen_height()))
+//    {
+//    g_debug("position %dx%d, size%dx%d is offscreen; will not move",
+//	    pos[0], pos[1], geom[0], geom[1]);
+//    }
+    else
+    {
+        gtk_window_move(GTK_WINDOW(window), pos[0], pos[1]);
+        DEBUG("window (%p) position %dx%d", window, pos[0], pos[1]);
+    }
+    if (geom)
+    {
+        g_free(geom);
+    }
+    if (pos)
+    {
+        g_free(pos);
+    }
+
+    max = g_key_file_get_boolean(data->key_file, window_group,
+                                 WINDOW_MAXIMIZED, &error);
+    if (error)
+    {
+        g_warning("error reading group %s key %s: %s",
+                  window_group, WINDOW_MAXIMIZED, error->message);
+        g_error_free(error);
+        error = NULL;
+    }
+    else if (max)
+    {
+        gtk_window_maximize(GTK_WINDOW(window));
+    }
+
+    /* Common view menu items */
+    action = gnc_main_window_find_action(window, "ViewToolbarAction");
+    visible = gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action));
+    desired_visibility = g_key_file_get_boolean(data->key_file, window_group,
+                         TOOLBAR_VISIBLE, &error);
+    if (error)
+    {
+        g_warning("error reading group %s key %s: %s",
+                  window_group, TOOLBAR_VISIBLE, error->message);
+        g_error_free(error);
+        error = NULL;
+    }
+    else if (visible != desired_visibility)
+    {
+        gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), desired_visibility);
+    }
+
+    action = gnc_main_window_find_action(window, "ViewSummaryAction");
+    visible = gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action));
+    desired_visibility = g_key_file_get_boolean(data->key_file, window_group,
+                         SUMMARYBAR_VISIBLE, &error);
+    if (error)
+    {
+        g_warning("error reading group %s key %s: %s",
+                  window_group, TOOLBAR_VISIBLE, error->message);
+        g_error_free(error);
+        error = NULL;
+    }
+    else if (visible != desired_visibility)
+    {
+        gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), desired_visibility);
+    }
+
+    action = gnc_main_window_find_action(window, "ViewStatusbarAction");
+    visible = gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action));
+    desired_visibility = g_key_file_get_boolean(data->key_file, window_group,
+                         STATUSBAR_VISIBLE, &error);
+    if (error)
+    {
+        g_warning("error reading group %s key %s: %s",
+                  window_group, TOOLBAR_VISIBLE, error->message);
+        g_error_free(error);
+        error = NULL;
+    }
+    else if (visible != desired_visibility)
+    {
+        gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), desired_visibility);
+    }
+
+    /* Now populate the window with pages. */
+    for (i = 0; i < page_count; i++)
+    {
+        data->page_offset = page_start;
+        data->page_num = i;
+        gnc_main_window_restore_page(window, data);
+
+        /* give the page a chance to display */
+        while (gtk_events_pending ())
+            gtk_main_iteration ();
+    }
+
+    /* Restore page ordering within the notebook. Use +1 notation so the
+     * numbers in the page order match the page sections, at least for
+     * the one window case. */
+    order = g_key_file_get_integer_list(data->key_file, window_group,
+                                        WINDOW_PAGEORDER, &length, &error);
+    if (error)
+    {
+        g_warning("error reading group %s key %s: %s",
+                  window_group, WINDOW_PAGEORDER, error->message);
+        g_error_free(error);
+        error = NULL;
+    }
+    else if (length != page_count)
+    {
+        g_warning("%s key %s length %" G_GSIZE_FORMAT " differs from window page count %d",
+                  window_group, WINDOW_PAGEORDER, length, page_count);
+    }
+    else
+    {
+        /* Dump any list that might exist */
+        g_list_free(priv->usage_order);
+        priv->usage_order = NULL;
+        /* Now rebuild the list from the key file. */
+        for (i = 0; i < length; i++)
+        {
+            gpointer page = g_list_nth_data(priv->installed_pages, order[i] - 1);
+            if (page)
+            {
+                priv->usage_order = g_list_append(priv->usage_order, page);
+            }
+        }
+        gtk_notebook_set_current_page (GTK_NOTEBOOK(priv->notebook),
+                                       order[0] - 1);
+    }
+    if (order)
+    {
+        g_free(order);
+    }
+
+    LEAVE("window %p", window);
+cleanup:
+    if (error)
+        g_error_free(error);
+    g_free(window_group);
+}
+
+void
+gnc_main_window_restore_all_windows(const GKeyFile *keyfile)
+{
+    gint i, window_count;
+    GError *error = NULL;
+    GncMainWindowSaveData data;
+    GncMainWindow *window;
+
+    /* We use the same struct for reading and for writing, so we cast
+       away the const. */
+    data.key_file = (GKeyFile *) keyfile;
+    window_count = g_key_file_get_integer(data.key_file, STATE_FILE_TOP,
+                                          WINDOW_COUNT, &error);
+    if (error)
+    {
+        g_warning("error reading group %s key %s: %s",
+                  STATE_FILE_TOP, WINDOW_COUNT, error->message);
+        g_error_free(error);
+        LEAVE("can't read count");
+        return;
+    }
+
+    /* Restore all state information on the open windows.  Window
+       numbers in state file are 1-based. GList indices are 0-based. */
+    gnc_set_busy_cursor (NULL, TRUE);
+    for (i = 0; i < window_count; i++)
+    {
+        data.window_num = i;
+        window = g_list_nth_data(active_windows, i);
+        gnc_main_window_restore_window(window, &data);
+    }
+    gnc_unset_busy_cursor (NULL);
+
+    statusbar_notification_lastmodified();
+}
+
+void
+gnc_main_window_restore_default_state(GncMainWindow *window)
+{
+    GtkAction *action;
+
+    /* The default state should be to have an Account Tree page open
+     * in the window. */
+    DEBUG("no saved state file");
+    if (!window)
+        window = g_list_nth_data(active_windows, 0);
+    action = gnc_main_window_find_action(window, "ViewAccountTreeAction");
+    gtk_action_activate(action);
+}
+
+/** Save the state of a single page to a disk.  This function handles
+ *  all the common tasks such as saving the page type and name, and
+ *  anything else that might be common to all pages.  It then calls a
+ *  page specific function to save the actual page.
+ *
+ *  @param page The GncPluginPage whose state should be saved.
+ *
+ *  @param data A data structure containing state about the
+ *  window/page saving process. */
+static void
+gnc_main_window_save_page (GncPluginPage *page, GncMainWindowSaveData *data)
+{
+    gchar *page_group;
+    const gchar *plugin_name, *page_name;
+
+    ENTER("page %p, data %p (key file %p, window %d, page %d)",
+          page, data, data->key_file, data->window_num, data->page_num);
+    plugin_name = gnc_plugin_page_get_plugin_name(page);
+    page_name = gnc_plugin_page_get_page_name(page);
+    if (!plugin_name || !page_name)
+    {
+        LEAVE("not saving invalid page");
+        return;
+    }
+    page_group = g_strdup_printf(PAGE_STRING, data->page_num++);
+    g_key_file_set_string(data->key_file, page_group, PAGE_TYPE, plugin_name);
+    g_key_file_set_string(data->key_file, page_group, PAGE_NAME, page_name);
+
+    gnc_plugin_page_save_page(page, data->key_file, page_group);
+    g_free(page_group);
+    LEAVE(" ");
+}
+
+
+/** Saves all the pages in a single window to a disk.  This function
+ *  saves all the window specific attributes, then calls a helper
+ *  function to save all the pages that are contained in the window.
+ *
+ *  @param window The GncMainWindow whose pages should be saved.
+ *
+ *  @param data A data structure containing state about the
+ *  window/page saving process. */
+static void
+gnc_main_window_save_window (GncMainWindow *window, GncMainWindowSaveData *data)
+{
+    GncMainWindowPrivate *priv;
+    GtkAction *action;
+    gint i, num_pages, coords[4], *order;
+    gboolean maximized, visible;
+    gchar *window_group;
+
+    /* Setup */
+    ENTER("window %p, data %p (key file %p, window %d)",
+          window, data, data->key_file, data->window_num);
+    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
+
+    /* Check for bogus window structures. */
+    num_pages = gtk_notebook_get_n_pages(GTK_NOTEBOOK(priv->notebook));
+    if (0 == num_pages)
+    {
+        LEAVE("empty window %p", window);
+        return;
+    }
+
+    /* Save this window's notebook info */
+    window_group = g_strdup_printf(WINDOW_STRING, data->window_num++);
+    g_key_file_set_integer(data->key_file, window_group,
+                           WINDOW_PAGECOUNT, num_pages);
+    g_key_file_set_integer(data->key_file, window_group,
+                           WINDOW_FIRSTPAGE, data->page_num);
+
+    /* Save page ordering within the notebook. Use +1 notation so the
+     * numbers in the page order match the page sections, at least for
+     * the one window case. */
+    order = g_malloc(sizeof(gint) * num_pages);
+    for (i = 0; i < num_pages; i++)
+    {
+        gpointer page = g_list_nth_data(priv->usage_order, i);
+        order[i] = g_list_index(priv->installed_pages, page) + 1;
+    }
+    g_key_file_set_integer_list(data->key_file, window_group,
+                                WINDOW_PAGEORDER, order, num_pages);
+    g_free(order);
+
+    /* Save the window coordinates, etc. */
+    gtk_window_get_position(GTK_WINDOW(window), &coords[0], &coords[1]);
+    gtk_window_get_size(GTK_WINDOW(window), &coords[2], &coords[3]);
+    maximized = (gdk_window_get_state(gtk_widget_get_window ((GTK_WIDGET(window))))
+                 & GDK_WINDOW_STATE_MAXIMIZED) != 0;
+    g_key_file_set_integer_list(data->key_file, window_group,
+                                WINDOW_POSITION, &coords[0], 2);
+    g_key_file_set_integer_list(data->key_file, window_group,
+                                WINDOW_GEOMETRY, &coords[2], 2);
+    g_key_file_set_boolean(data->key_file, window_group,
+                           WINDOW_MAXIMIZED, maximized);
+    DEBUG("window (%p) position %dx%d, size %dx%d, %s", window,  coords[0], coords[1],
+          coords[2], coords[3],
+          maximized ? "maximized" : "not maximized");
+
+    /* Common view menu items */
+    action = gnc_main_window_find_action(window, "ViewToolbarAction");
+    visible = gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action));
+    g_key_file_set_boolean(data->key_file, window_group,
+                           TOOLBAR_VISIBLE, visible);
+    action = gnc_main_window_find_action(window, "ViewSummaryAction");
+    visible = gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action));
+    g_key_file_set_boolean(data->key_file, window_group,
+                           SUMMARYBAR_VISIBLE, visible);
+    action = gnc_main_window_find_action(window, "ViewStatusbarAction");
+    visible = gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action));
+    g_key_file_set_boolean(data->key_file, window_group,
+                           STATUSBAR_VISIBLE, visible);
+
+    /* Save individual pages in this window */
+    g_list_foreach(priv->installed_pages, (GFunc)gnc_main_window_save_page, data);
+
+    g_free(window_group);
+    LEAVE("window %p", window);
+}
+
+void
+gnc_main_window_save_all_windows(GKeyFile *keyfile)
+{
+    GncMainWindowSaveData data;
+
+    /* Set up the iterator data structures */
+    data.key_file = keyfile;
+    data.window_num = 1;
+    data.page_num = 1;
+
+    g_key_file_set_integer(data.key_file,
+                           STATE_FILE_TOP, WINDOW_COUNT,
+                           g_list_length(active_windows));
+    /* Dump all state information on the open windows */
+    g_list_foreach(active_windows, (GFunc)gnc_main_window_save_window, &data);
+}
+
+
+gboolean
+gnc_main_window_finish_pending (GncMainWindow *window)
+{
+    GncMainWindowPrivate *priv;
+    GList *item;
+
+    g_return_val_if_fail(GNC_IS_MAIN_WINDOW(window), TRUE);
+
+    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
+    for (item = priv->installed_pages; item; item = g_list_next(item))
+    {
+        if (!gnc_plugin_page_finish_pending(item->data))
+        {
+            return FALSE;
+        }
+    }
+    return TRUE;
+}
+
+
+gboolean
+gnc_main_window_all_finish_pending (void)
+{
+    const GList *windows, *item;
+
+    windows = gnc_gobject_tracking_get_list(GNC_MAIN_WINDOW_NAME);
+    for (item = windows; item; item = g_list_next(item))
+    {
+        if (!gnc_main_window_finish_pending(item->data))
+        {
+            return FALSE;
+        }
+    }
+    return TRUE;
+}
+
+
+/** See if the page already exists.  For each open window, look
+ *  through the list of pages installed in that window and see if the
+ *  specified page is there.
+ *
+ *  @internal
+ *
+ *  @param page The page to search for.
+ *
+ *  @return TRUE if the page is present in the window, FALSE otherwise.
+ */
+static gboolean
+gnc_main_window_page_exists (GncPluginPage *page)
+{
+    GncMainWindow *window;
+    GncMainWindowPrivate *priv;
+    GList *walker;
+
+    for (walker = active_windows; walker; walker = g_list_next(walker))
+    {
+        window = walker->data;
+        priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
+        if (g_list_find(priv->installed_pages, page))
+        {
+            return TRUE;
+        }
+    }
+    return FALSE;
+}
+
+static gboolean auto_save_countdown (GtkWidget *dialog)
+{
+    GtkWidget *label;
+    gchar *timeoutstr = NULL;
+
+    /* Stop count down if user closed the dialog since the last time we were called */
+    if (!GTK_IS_DIALOG (dialog))
+        return FALSE; /* remove timer */
+
+    /* Stop count down if count down text can't be updated */
+    label = GTK_WIDGET (g_object_get_data (G_OBJECT (dialog), "count-down-label"));
+    if (!GTK_IS_LABEL (label))
+        return FALSE; /* remove timer */
+
+    secs_to_save--;
+    DEBUG ("Counting down: %d seconds", secs_to_save);
+
+    timeoutstr = g_strdup_printf (MSG_AUTO_SAVE, secs_to_save);
+    gtk_label_set_text (GTK_LABEL (label), timeoutstr);
+    g_free (timeoutstr);
+
+    /* Count down reached 0. Save and close dialog */
+    if (!secs_to_save)
+    {
+        gtk_dialog_response (GTK_DIALOG(dialog), GTK_RESPONSE_APPLY);
+        return FALSE; /* remove timer */
+    }
+
+    /* Run another cycle */
+    return TRUE;
+}
+
+
+/** This function prompts the user to save the file with a dialog that
+ *  follows the HIG guidelines.
+ *
+ *  @internal
+ *
+ *  @returns This function returns TRUE if the user clicked the Cancel
+ *  button.  It returns FALSE if the closing of the window should
+ *  continue.
+ */
+static gboolean
+gnc_main_window_prompt_for_save (GtkWidget *window)
+{
+    QofSession *session;
+    QofBook *book;
+    GtkWidget *dialog, *msg_area, *label;
+    gint response;
+    const gchar *filename, *tmp;
+    const gchar *title = _("Save changes to file %s before closing?");
+    /* This should be the same message as in gnc-file.c */
+    const gchar *message_hours =
+        _("If you don't save, changes from the past %d hours and %d minutes will be discarded.");
+    const gchar *message_days =
+        _("If you don't save, changes from the past %d days and %d hours will be discarded.");
+    time64 oldest_change;
+    gint minutes, hours, days;
+
+    session = gnc_get_current_session();
+    book = qof_session_get_book(session);
+    filename = qof_session_get_url(session);
+    if (!strlen (filename))
+        filename = _("<unknown>");
+    if ((tmp = strrchr(filename, '/')) != NULL)
+        filename = tmp + 1;
+
+    /* Remove any pending auto-save timeouts */
+    gnc_autosave_remove_timer(book);
+
+    dialog = gtk_message_dialog_new(GTK_WINDOW(window),
+                                    GTK_DIALOG_MODAL,
+                                    GTK_MESSAGE_WARNING,
+                                    GTK_BUTTONS_NONE,
+                                    title,
+                                    filename);
+    oldest_change = qof_book_get_session_dirty_time(book);
+    minutes = (gnc_time (NULL) - oldest_change) / 60 + 1;
+    hours = minutes / 60;
+    minutes = minutes % 60;
+    days = hours / 24;
+    hours = hours % 24;
+    if (days > 0)
+    {
+        gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
+                message_days, days, hours);
+    }
+    else if (hours > 0)
+    {
+        gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
+                message_hours, hours, minutes);
+    }
+    else
+    {
+        gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
+                ngettext("If you don't save, changes from the past %d minute will be discarded.",
+                         "If you don't save, changes from the past %d minutes will be discarded.",
+                         minutes), minutes);
+    }
+    gtk_dialog_add_buttons(GTK_DIALOG(dialog),
+                           _("Close _Without Saving"), GTK_RESPONSE_CLOSE,
+                           _("_Cancel"), GTK_RESPONSE_CANCEL,
+                           _("_Save"), GTK_RESPONSE_APPLY,
+                           NULL);
+    gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_APPLY);
+
+    /* If requested by the user, add a timeout to the question to save automatically
+     * if the user doesn't answer after a chosen number of seconds.
+     */
+    if (gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL, GNC_PREF_SAVE_CLOSE_EXPIRES))
+    {
+        gchar *timeoutstr = NULL;
+
+        secs_to_save = gnc_prefs_get_int (GNC_PREFS_GROUP_GENERAL, GNC_PREF_SAVE_CLOSE_WAIT_TIME);
+        timeoutstr = g_strdup_printf (MSG_AUTO_SAVE, secs_to_save);
+        label = GTK_WIDGET(gtk_label_new (timeoutstr));
+        g_free (timeoutstr);
+        gtk_widget_show (label);
+
+        msg_area = gtk_message_dialog_get_message_area (GTK_MESSAGE_DIALOG(dialog));
+        gtk_box_pack_end (GTK_BOX(msg_area), label, TRUE, TRUE, 0);
+        g_object_set (G_OBJECT (label), "xalign", 0.0, NULL);
+
+        g_object_set_data (G_OBJECT (dialog), "count-down-label", label);
+        g_timeout_add_seconds (1, (GSourceFunc)auto_save_countdown, dialog);
+    }
+
+    response = gtk_dialog_run (GTK_DIALOG (dialog));
+    gtk_widget_destroy(dialog);
+
+    switch (response)
+    {
+    case GTK_RESPONSE_APPLY:
+        gnc_file_save();
+        return FALSE;
+
+    case GTK_RESPONSE_CLOSE:
+        qof_book_mark_session_saved(book);
+        return FALSE;
+
+    default:
+        return TRUE;
+    }
+}
+
+
+static void
+gnc_main_window_add_plugin (gpointer plugin,
+                            gpointer window)
+{
+    g_return_if_fail (GNC_IS_MAIN_WINDOW (window));
+    g_return_if_fail (GNC_IS_PLUGIN (plugin));
+
+    ENTER(" ");
+    gnc_plugin_add_to_window (GNC_PLUGIN (plugin),
+                              GNC_MAIN_WINDOW (window),
+                              window_type);
+    LEAVE(" ");
+}
+
+static void
+gnc_main_window_remove_plugin (gpointer plugin,
+                               gpointer window)
+{
+    g_return_if_fail (GNC_IS_MAIN_WINDOW (window));
+    g_return_if_fail (GNC_IS_PLUGIN (plugin));
+
+    ENTER(" ");
+    gnc_plugin_remove_from_window (GNC_PLUGIN (plugin),
+                                   GNC_MAIN_WINDOW (window),
+                                   window_type);
+    LEAVE(" ");
+}
+
+
+static gboolean
+gnc_main_window_timed_quit (gpointer dummy)
+{
+    if (gnc_file_save_in_progress())
+        return TRUE;
+
+    gnc_shutdown (0);
+    return FALSE;
+}
+
+static gboolean
+gnc_main_window_quit(GncMainWindow *window)
+{
+    QofSession *session;
+    gboolean needs_save, do_shutdown;
+
+    session = gnc_get_current_session();
+    needs_save = qof_book_session_not_saved(qof_session_get_book(session)) &&
+                 !gnc_file_save_in_progress();
+    do_shutdown = !needs_save ||
+                  (needs_save && !gnc_main_window_prompt_for_save(GTK_WIDGET(window)));
+
+    if (do_shutdown)
+    {
+        g_timeout_add(250, gnc_main_window_timed_quit, NULL);
+        return TRUE;
+    }
+    return FALSE;
+}
+
+static gboolean
+gnc_main_window_delete_event (GtkWidget *window,
+                              GdkEvent *event,
+                              gpointer user_data)
+{
+    static gboolean already_dead = FALSE;
+
+    if (already_dead)
+        return TRUE;
+
+    if (!gnc_main_window_finish_pending(GNC_MAIN_WINDOW(window)))
+    {
+        /* Don't close the window. */
+        return TRUE;
+    }
+
+    if (g_list_length(active_windows) > 1)
+        return FALSE;
+
+    already_dead = gnc_main_window_quit(GNC_MAIN_WINDOW(window));
+    return TRUE;
+}
+
+
+/** This function handles any event notifications from the engine.
+ *  The only event it currently cares about is the deletion of a book.
+ *  When a book is deleted, it runs through all installed pages
+ *  looking for pages that reference the just (about to be?) deleted
+ *  book.  It closes any page it finds so there are no dangling
+ *  references to the book.
+ *
+ *  @internal
+ *
+ *  @param entity     The guid the item being added, deleted, etc.
+ *
+ *  @param type       The type of the item being added, deleted, etc. This
+ *                    function only cares about a type of GNC_ID_BOOK.
+ *
+ *  @param event_type The type of the event.  This function only cares
+ *                    about an event type of QOF_EVENT_DESTROY.
+ *
+ *  @param user_data  A pointer to the window data structure.
+ */
+static void
+gnc_main_window_event_handler (QofInstance *entity,  QofEventId event_type,
+                               gpointer user_data, gpointer event_data)
+{
+    GncMainWindow *window;
+    GncMainWindowPrivate *priv;
+    GncPluginPage *page;
+    GList *item, *next;
+
+    /* hard failures */
+    g_return_if_fail(GNC_IS_MAIN_WINDOW(user_data));
+
+    /* soft failures */
+    if (!QOF_CHECK_TYPE(entity, QOF_ID_BOOK))
+        return;
+    if (event_type !=  QOF_EVENT_DESTROY)
+        return;
+
+    ENTER("entity %p, event %d, window %p, event data %p",
+          entity, event_type, user_data, event_data);
+    window = GNC_MAIN_WINDOW(user_data);
+    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
+
+    /* This is not a typical list iteration.  We're removing while
+     * we iterate, so we have to cache the 'next' pointer before
+     * executing any code in the loop. */
+    for (item = priv->installed_pages; item; item = next)
+    {
+        next = g_list_next(item);
+        page = GNC_PLUGIN_PAGE(item->data);
+        if (gnc_plugin_page_has_book (page, (QofBook *)entity))
+            gnc_main_window_close_page (page);
+    }
+    LEAVE(" ");
+}
+
+
+/** Generate a title for this window based upon the Gnome Human
+ *  Interface Guidelines, v2.0.  This title will be used as both the
+ *  window title and the title of the "Window" menu item associated
+ *  with the window.
+ *
+ *  As a side-effect, the save action is set sensitive iff the book
+ *  is dirty, and the immutable_page_actions are set sensitive iff the page is
+ *  mutable.
+ *
+ *  @param window The window whose title should be generated.
+ *
+ *  @return The title for the window.  It is the callers
+ *  responsibility to free this string.
+ *
+ *  @internal
+ */
+static gchar *
+gnc_main_window_generate_title (GncMainWindow *window)
+{
+    GncMainWindowPrivate *priv;
+    GncPluginPage *page;
+    QofBook *book;
+    gboolean immutable;
+    gchar *filename = NULL;
+    const gchar *book_id = NULL;
+    const gchar *dirty = "";
+    const gchar *readonly_text = NULL;
+    gchar *readonly;
+    gchar *title;
+
+    if (gnc_current_session_exist())
+    {
+        book_id = qof_session_get_url (gnc_get_current_session ());
+        book = gnc_get_current_book();
+        if (qof_book_session_not_saved (book))
+            dirty = "*";
+        if (qof_book_is_readonly(book))
+        {
+            /* Translators: This string is shown in the window title if this
+            document is, well, read-only. */
+            readonly_text = _("(read-only)");
+        }
+    }
+    readonly = (readonly_text != NULL)
+               ? g_strdup_printf(" %s", readonly_text)
+               : g_strdup("");
+
+    if (!book_id || g_strcmp0 (book_id, "") == 0)
+        filename = g_strdup(_("Unsaved Book"));
+    else
+    {
+        if ( gnc_uri_is_file_uri ( book_id ) )
+        {
+            /* The filename is a true file.
+             * The Gnome HIG 2.0 recommends only the file name (no path) be used. (p15) */
+            gchar *path = gnc_uri_get_path ( book_id );
+            filename = g_path_get_basename ( path );
+            g_free ( path );
+        }
+        else
+        {
+            /* The filename is composed of database connection parameters.
+             * For this we will show access_method://username@database[:port] */
+            filename = gnc_uri_normalize_uri (book_id, FALSE);
+        }
+    }
+
+    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
+    page = priv->current_page;
+    if (page)
+    {
+        /* The Gnome HIG 2.0 recommends the application name not be used. (p16)
+         * but several developers prefer to use it anyway. */
+        title = g_strdup_printf("%s%s%s - %s - GnuCash", dirty, filename, readonly,
+                                gnc_plugin_page_get_page_name(page));
+    }
+    else
+    {
+        title = g_strdup_printf("%s%s%s - GnuCash", dirty, filename, readonly);
+    }
+    /* Update the menus based upon whether this is an "immutable" page. */
+    immutable = page &&
+                g_object_get_data (G_OBJECT (page), PLUGIN_PAGE_IMMUTABLE);
+    gnc_plugin_update_actions(priv->action_group,
+                              immutable_page_actions,
+                              "sensitive", !immutable);
+    /* Trigger sensitivity updtates of other actions such as Save/Revert */
+    g_signal_emit_by_name (window, "page_changed", page);
+    g_free( filename );
+    g_free(readonly);
+
+    return title;
+}
+
+
+/** Update the title bar on the specified window.  This routine uses
+ *  the gnc_main_window_generate_title() function to create the title.
+ *  It is called whenever the user switched pages in a window, as the
+ *  title includes the name of the current page.
+ *
+ *  @param window The window whose title should be updated.
+ *
+ *  @internal
+ */
+static void
+gnc_main_window_update_title (GncMainWindow *window)
+{
+    gchar *title;
+
+    title = gnc_main_window_generate_title(window);
+    gtk_window_set_title(GTK_WINDOW(window), title);
+    g_free(title);
+}
+
+static void
+gnc_main_window_update_all_titles (void)
+{
+    g_list_foreach(active_windows,
+                   (GFunc)gnc_main_window_update_title,
+                   NULL);
+}
+
+static void
+gnc_main_window_book_dirty_cb (QofBook *book,
+                               gboolean dirty,
+                               gpointer user_data)
+{
+    gnc_main_window_update_all_titles();
+
+    /* Auto-save feature */
+    gnc_autosave_dirty_handler(book, dirty);
+}
+
+static void
+gnc_main_window_attach_to_book (QofSession *session)
+{
+    QofBook *book;
+
+    g_return_if_fail(session);
+
+    book = qof_session_get_book(session);
+    qof_book_set_dirty_cb(book, gnc_main_window_book_dirty_cb, NULL);
+    gnc_main_window_update_all_titles();
+#ifndef MAC_INTEGRATION
+    gnc_main_window_update_all_menu_items();
+#endif
+}
+
+static guint gnc_statusbar_notification_messageid = 0;
+//#define STATUSBAR_NOTIFICATION_AUTOREMOVAL
+#ifdef STATUSBAR_NOTIFICATION_AUTOREMOVAL
+/* Removes the statusbar notification again that has been pushed to the
+ * statusbar by generate_statusbar_lastmodified_message. */
+static gboolean statusbar_notification_off(gpointer user_data_unused)
+{
+    GtkWidget *widget = gnc_ui_get_toplevel();
+    //g_warning("statusbar_notification_off\n");
+    if (gnc_statusbar_notification_messageid == 0)
+        return FALSE;
+
+    if (widget && GNC_IS_MAIN_WINDOW(widget))
+    {
+        GncMainWindow *mainwindow = GNC_MAIN_WINDOW(widget);
+        GtkWidget *statusbar = gnc_main_window_get_statusbar(GNC_WINDOW(mainwindow));
+        gtk_statusbar_remove(GTK_STATUSBAR(statusbar), 0, gnc_statusbar_notification_messageid);
+        gnc_statusbar_notification_messageid = 0;
+    }
+    else
+    {
+        g_warning("oops, no GncMainWindow obtained\n");
+    }
+    return FALSE; // should not be called again
+}
+#endif // STATUSBAR_NOTIFICATION_AUTOREMOVAL
+
+/* Creates a statusbar message stating the last modification time of the opened
+ * data file. */
+static gchar *generate_statusbar_lastmodified_message()
+{
+    gchar *message = NULL;
+    const gchar *book_id = NULL;
+
+    if (gnc_current_session_exist())
+    {
+        book_id = qof_session_get_url (gnc_get_current_session ());
+    }
+
+    if (!strlen (book_id))
+        return NULL;
+    else
+    {
+        if ( gnc_uri_is_file_uri ( book_id ) )
+        {
+#ifdef HAVE_SYS_STAT_H
+            /* The filename is a true file. */
+            gchar *filepath = gnc_uri_get_path ( book_id );
+            gchar *filename = g_path_get_basename ( filepath );
+            {
+                // Access the mtime information through stat(2)
+                struct stat statbuf;
+                int r = stat(filepath, &statbuf);
+                if (r == 0)
+                {
+                    /* Translators: This is the date and time that is shown in
+                    the status bar after opening a file: The date and time of
+                    last modification. The string is a format string using
+                    boost::date_time's format flags, see the boost docs for an
+                    explanation of the modifiers. */
+                    char *time_string =
+			gnc_print_time64(statbuf.st_mtime,
+					 _("Last modified on %a, %b %d, %Y at %I:%M %p"));
+                    //g_warning("got time %ld, str=%s\n", mtime, time_string);
+                    /* Translators: This message appears in the status bar after opening the file. */
+                    message = g_strdup_printf(_("File %s opened. %s"),
+                                              filename, time_string);
+                    free(time_string);
+                }
+                else
+                {
+                    g_warning("Unable to read mtime for file %s\n", filepath);
+                    // message is still NULL
+                }
+            }
+            g_free(filename);
+            g_free(filepath);
+#else
+            return NULL;
+#endif
+        }
+        // If the URI is not a file but a database, we can maybe also show
+        // something useful, but I have no idea how to obtain this information.
+    }
+    return message;
+}
+
+static void
+statusbar_notification_lastmodified()
+{
+    // First look up the first GncMainWindow to set the statusbar there
+    GList *iter;
+    GtkWidget *widget = NULL;
+    for (iter = active_windows; iter && !(widget && GNC_IS_MAIN_WINDOW(widget));
+            iter = g_list_next(iter))
+    {
+        widget = iter->data;
+    }
+    if (widget && GNC_IS_MAIN_WINDOW(widget))
+    {
+        // Ok, we found a mainwindow where we can set a statusbar message
+        GncMainWindow *mainwindow = GNC_MAIN_WINDOW(widget);
+        GtkWidget *statusbar = gnc_main_window_get_statusbar(GNC_WINDOW(mainwindow));
+
+        gchar *msg = generate_statusbar_lastmodified_message();
+        if (msg)
+        {
+            gnc_statusbar_notification_messageid = gtk_statusbar_push(GTK_STATUSBAR(statusbar), 0, msg);
+        }
+        g_free(msg);
+
+#ifdef STATUSBAR_NOTIFICATION_AUTOREMOVAL
+        // Also register a timeout callback to remove that statusbar
+        // notification again after 10 seconds
+        g_timeout_add(10 * 1000, statusbar_notification_off, NULL); // maybe not needed anyway?
+#endif
+    }
+    else
+    {
+        g_warning("uh oh, no GNC_IS_MAIN_WINDOW\n");
+    }
+}
+
+
+/** This data structure is used to describe the requested state of a
+ *  GtkRadioAction, and us used to pass data among several
+ *  functions. */
+struct menu_update
+{
+    /** The name of the GtkRadioAction to be updated. */
+    gchar    *action_name;
+
+    /** The new label for this GtkRadioAction. */
+    gchar    *label;
+
+    /** Whether or not the GtkRadioAction should be visible. */
+    gboolean  visible;
+};
+
+#ifndef MAC_INTEGRATION
+/** Update the label on the specified GtkRadioAction in the specified
+ *  window.  This action is displayed as a menu item in the "Windows"
+ *  menu.  This function will end up being called whenever the front
+ *  page is changed in any window, or whenever a window is added or
+ *  deleted.
+ *
+ *  @param window The window whose menu item should be updated.
+ *
+ *  @param data A data structure containing the name of the
+ *  GtkRadioAction, and describing the new state for this action.
+ *
+ *  @internal
+ */
+static void
+gnc_main_window_update_one_menu_action (GncMainWindow *window,
+                                        struct menu_update *data)
+{
+    GncMainWindowPrivate *priv;
+    GtkAction* action;
+
+    ENTER("window %p, action %s, label %s, visible %d", window,
+          data->action_name, data->label, data->visible);
+    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
+    action = gtk_action_group_get_action(priv->action_group, data->action_name);
+    if (action)
+        g_object_set(G_OBJECT(action),
+                     "label", data->label,
+                     "visible", data->visible,
+                     (char *)NULL);
+    LEAVE(" ");
+}
+
+/** Update the window selection GtkRadioAction for a specific window.
+ *  This is fairly simple since the windows are listed in the same
+ *  order that they appear in the active_windows list, so the index
+ *  from the window list is used to generate the name of the action.
+ *  If the code is ever changed to allow more than ten open windows in
+ *  the menu, then the actions in the menu will need to be dynamically
+ *  generated/deleted and it gets harder.
+ *
+ *  @param window The window whose menu item should be updated.
+ *
+ *  @internal
+ */
+static void
+gnc_main_window_update_radio_button (GncMainWindow *window)
+{
+    GncMainWindowPrivate *priv;
+    GtkAction *action, *first_action;
+    GSList *action_list;
+    gchar *action_name;
+    gint index;
+
+    ENTER("window %p", window);
+
+    /* Show the new entry in all windows. */
+    index = g_list_index(active_windows, window);
+    if (index >= n_radio_entries)
+    {
+        LEAVE("window %d, only %d actions", index, n_radio_entries);
+        return;
+    }
+
+    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
+    action_name = g_strdup_printf("Window%dAction", index);
+    action = gtk_action_group_get_action(priv->action_group, action_name);
+
+    /* Block the signal so as not to affect window ordering (top to
+     * bottom) on the screen */
+    action_list = gtk_radio_action_get_group(GTK_RADIO_ACTION(action));
+    if (action_list)
+    {
+        first_action = g_slist_last(action_list)->data;
+        g_signal_handlers_block_by_func(G_OBJECT(first_action),
+                                        G_CALLBACK(gnc_main_window_cmd_window_raise),
+                                        window);
+        DEBUG("blocked signal on %p, set %p active, window %p", first_action,
+              action, window);
+        gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), TRUE);
+        g_signal_handlers_unblock_by_func(G_OBJECT(first_action),
+                                          G_CALLBACK(gnc_main_window_cmd_window_raise),
+                                          window);
+    }
+    g_free(action_name);
+    LEAVE(" ");
+}
+
+/** In every window that the user has open, update the "Window" menu
+ *  item that points to the specified window.  This keeps the "Window"
+ *  menu items consistent across all open windows.  (These items
+ *  cannot be shared because of the way the GtkUIManager code works.)
+ *
+ *  This function is called whenever the user switches pages in a
+ *  window, or whenever a window is added or deleted.
+ *
+ *  @param window The window whose menu item should be updated in all
+ *  open windows.
+ *
+ *  @internal
+ */
+static void
+gnc_main_window_update_menu_item (GncMainWindow *window)
+{
+    struct menu_update data;
+    gchar **strings, *title, *expanded;
+    gint index;
+
+    ENTER("window %p", window);
+    index = g_list_index(active_windows, window);
+    if (index > n_radio_entries)
+    {
+        LEAVE("skip window %d (only %d entries)", index, n_radio_entries);
+        return;
+    }
+
+    /* Figure out the label name. Add the accelerator if possible. */
+    title = gnc_main_window_generate_title(window);
+    strings = g_strsplit(title, "_", 0);
+    g_free(title);
+    expanded = g_strjoinv("__", strings);
+    if (index < 10)
+    {
+        data.label = g_strdup_printf("_%d %s", (index + 1) % 10, expanded);
+        g_free(expanded);
+    }
+    else
+    {
+        data.label = expanded;
+    }
+    g_strfreev(strings);
+
+    data.visible = TRUE;
+    data.action_name = g_strdup_printf("Window%dAction", index);
+    g_list_foreach(active_windows,
+                   (GFunc)gnc_main_window_update_one_menu_action,
+                   &data);
+    g_free(data.action_name);
+    g_free(data.label);
+
+    LEAVE(" ");
+}
+#endif /* !MAC_INTEGRATION */
+
+/** Update all menu entries for all window menu items in all windows.
+ *  This function is called whenever a window is added or deleted.
+ *  The worst case scenario is where the user has deleted the first
+ *  window, so every single visible item needs to be updated.
+ *
+ *  @internal
+ */
+
+#ifndef MAC_INTEGRATION
+static void
+gnc_main_window_update_all_menu_items (void)
+{
+    struct menu_update data;
+    gchar *label;
+    gint i;
+
+    ENTER("");
+    /* First update the entries for all existing windows */
+    g_list_foreach(active_windows,
+                   (GFunc)gnc_main_window_update_menu_item,
+                   NULL);
+    g_list_foreach(active_windows,
+                   (GFunc)gnc_main_window_update_radio_button,
+                   NULL);
+
+    /* Now hide any entries that aren't being used. */
+    data.visible = FALSE;
+    for (i = g_list_length(active_windows); i < n_radio_entries; i++)
+    {
+        data.action_name = g_strdup_printf("Window%dAction", i);
+        label = g_strdup_printf("Window _%d", (i - 1) % 10);
+        data.label = gettext(label);
+
+        g_list_foreach(active_windows,
+                       (GFunc)gnc_main_window_update_one_menu_action,
+                       &data);
+
+        g_free(data.action_name);
+        g_free(label);
+    }
+    LEAVE(" ");
+}
+#endif /* !MAC_INTEGRATION */
+
+/** Show/hide the close box on the tab of a notebook page.  This
+ *  function first checks to see if the specified page has a close
+ *  box, and if so, sets its visibility to the requested state.
+ *
+ *  @internal
+ *
+ *  @param page The GncPluginPage whose notebook tab should be updated.
+ *
+ *  @param new_value A pointer to the boolean that indicates whether
+ *  or not the close button should be visible.
+ */
+static void
+gnc_main_window_update_tab_close_one_page (GncPluginPage *page,
+        gpointer user_data)
+{
+    gboolean *new_value = user_data;
+    GtkWidget * close_button;
+
+    ENTER("page %p, visible %d", page, *new_value);
+    close_button = g_object_get_data(G_OBJECT (page), PLUGIN_PAGE_CLOSE_BUTTON);
+    if (!close_button)
+    {
+        LEAVE("no close button");
+        return;
+    }
+
+    if (*new_value)
+        gtk_widget_show (close_button);
+    else
+        gtk_widget_hide (close_button);
+    LEAVE(" ");
+}
+
+
+/** Show/hide the close box on all pages in all windows.  This function
+ *  calls gnc_main_window_update_tab_close() for each plugin page in the
+ *  application.
+ *
+ *  @internal
+ *
+ *  @param prefs Unused.
+ *
+ *  @param pref Unused.
+ *
+ *  @param user_data Unused.
+ */
+static void
+gnc_main_window_update_tab_close (gpointer prefs, gchar *pref, gpointer user_data)
+{
+    gboolean new_value;
+
+    ENTER(" ");
+    new_value = gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL, GNC_PREF_SHOW_CLOSE_BUTTON);
+    gnc_main_window_foreach_page(
+        gnc_main_window_update_tab_close_one_page,
+        &new_value);
+    LEAVE(" ");
+}
+
+
+/** Show/hide the account color on the tab of a notebook page.
+ *
+ *  @internal
+ *
+ *  @param page The GncPluginPage whose notebook tab should be updated.
+ *
+ *  @param user_data GncMainWindow.
+ */
+static void
+gnc_main_window_update_tab_color_one_page (GncPluginPage *page,
+        gpointer user_data)
+{
+    const gchar          *color_string;
+
+    ENTER("page %p", page);
+    color_string = gnc_plugin_page_get_page_color(page);
+    main_window_update_page_color (page, color_string);
+    LEAVE(" ");
+}
+
+
+/** Show/hide the account color on tabs.
+ *
+ *  @internal
+ *
+ *  @param prefs Unused.
+ *
+ *  @param pref Name of the preference that was changed.
+ *
+ *  @param user_data GncMainWindow.
+ */
+static void
+gnc_main_window_update_tab_color (gpointer gsettings, gchar *pref, gpointer user_data)
+{
+    GncMainWindowPrivate *priv;
+    GncMainWindow        *window;
+
+    ENTER(" ");
+    g_return_if_fail(GNC_IS_MAIN_WINDOW(user_data));
+    window = user_data;
+    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
+    if (g_strcmp0 (GNC_PREF_TAB_COLOR, pref) == 0)
+        priv->show_color_tabs = gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL, GNC_PREF_TAB_COLOR);
+    gnc_main_window_foreach_page (gnc_main_window_update_tab_color_one_page, window);
+    LEAVE(" ");
+}
+
+
+/** Update the width of the label in the tab of a notebook page.  This
+ *  function adjusts both the width and the ellipsize mode so that the tab
+ *  label looks correct.  The special check for a zero value handles the
+ *  case where a user hasn't set a tab width and the preference default isn't
+ *  detected.
+ *
+ *  @internal
+ *
+ *  @param page The GncPluginPage whose notebook tab should be updated.
+ *
+ *  @param new_value The new width of the label in the tab.
+ */
+static void
+gnc_main_window_update_tab_width_one_page (GncPluginPage *page,
+        gpointer user_data)
+{
+    gint *new_value = user_data;
+    GtkWidget *label;
+    const gchar *lab_text;
+
+    ENTER("page %p, visible %d", page, *new_value);
+    label = g_object_get_data(G_OBJECT (page), PLUGIN_PAGE_TAB_LABEL);
+    if (!label)
+    {
+        LEAVE("no label");
+        return;
+    }
+
+    lab_text = gtk_label_get_text (GTK_LABEL(label));
+
+    if (*new_value != 0)
+    {
+        if (g_utf8_strlen (lab_text, -1) < *new_value)
+            gtk_label_set_width_chars (GTK_LABEL(label), strlen (lab_text));
+        else
+            gtk_label_set_width_chars (GTK_LABEL(label), *new_value);
+
+        gtk_label_set_ellipsize(GTK_LABEL(label), PANGO_ELLIPSIZE_MIDDLE);
+    }
+    else
+    {
+        gtk_label_set_width_chars (GTK_LABEL(label), 15);
+        gtk_label_set_ellipsize(GTK_LABEL(label), PANGO_ELLIPSIZE_NONE);
+    }
+    LEAVE(" ");
+}
+
+
+/** Update the tab label width in all pages in all windows.  This function
+ *  calls gnc_main_window_update_tab_width() for each plugin page in the
+ *  application.
+ *
+ *  @internal
+ *
+ *  @param prefs Unused.
+ *
+ *  @param pref Unused.
+ *
+ *  @param user_data Unused.
+ */
+static void
+gnc_main_window_update_tab_width (gpointer prefs, gchar *pref, gpointer user_data)
+{
+    gint new_value;
+
+    ENTER(" ");
+    new_value = gnc_prefs_get_float (GNC_PREFS_GROUP_GENERAL, GNC_PREF_TAB_WIDTH);
+    gnc_main_window_foreach_page(
+        gnc_main_window_update_tab_width_one_page,
+        &new_value);
+    LEAVE(" ");
+}
+
+
+/************************************************************
+ *                 Tab Label Implementation                 *
+ ************************************************************/
+static gboolean
+main_window_find_tab_items (GncMainWindow *window,
+                            GncPluginPage *page,
+                            GtkWidget **label_p,
+                            GtkWidget **entry_p)
+{
+    GncMainWindowPrivate *priv;
+    GtkWidget *tab_hbox, *widget, *tab_widget;
+    GList *children, *tmp;
+
+    ENTER("window %p, page %p, label_p %p, entry_p %p",
+          window, page, label_p, entry_p);
+    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
+    *label_p = *entry_p = NULL;
+
+    if (!page->notebook_page)
+    {
+        LEAVE("invalid notebook_page");
+        return FALSE;
+    }
+
+    tab_widget = gtk_notebook_get_tab_label(GTK_NOTEBOOK(priv->notebook),
+                                           page->notebook_page);
+    if (GTK_IS_EVENT_BOX (tab_widget))
+        tab_hbox = gtk_bin_get_child(GTK_BIN(tab_widget));
+    else if (GTK_IS_BOX (tab_widget))
+        tab_hbox = tab_widget;
+    else
+    {
+        PWARN ("Unknown widget for tab label %p", tab_widget);
+        return FALSE;
+    }
+
+    children = gtk_container_get_children(GTK_CONTAINER(tab_hbox));
+    for (tmp = children; tmp; tmp = g_list_next(tmp))
+    {
+        widget = tmp->data;
+        if (GTK_IS_LABEL(widget))
+        {
+            *label_p = widget;
+        }
+        else if (GTK_IS_ENTRY(widget))
+        {
+            *entry_p = widget;
+        }
+    }
+    g_list_free(children);
+
+    LEAVE("label %p, entry %p", *label_p, *entry_p);
+    return (*label_p && *entry_p);
+}
+
+static gboolean
+main_window_find_tab_widget (GncMainWindow *window,
+                             GncPluginPage *page,
+                             GtkWidget **widget_p)
+{
+    GncMainWindowPrivate *priv;
+
+    ENTER("window %p, page %p, widget %p",
+          window, page, widget_p);
+    *widget_p = NULL;
+
+    if (!page->notebook_page)
+    {
+        LEAVE("invalid notebook_page");
+        return FALSE;
+    }
+
+    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
+    *widget_p = gtk_notebook_get_tab_label(GTK_NOTEBOOK(priv->notebook),
+                                           page->notebook_page);
+
+    LEAVE("widget %p", *widget_p);
+    return TRUE;
+}
+
+void
+main_window_update_page_name (GncPluginPage *page,
+                              const gchar *name_in)
+{
+    GncMainWindow *window;
+    GncMainWindowPrivate *priv;
+    GtkWidget *label, *entry;
+    gchar *name, *old_page_name, *old_page_long_name;
+    gint lab_width;
+
+    ENTER(" ");
+
+    if ((name_in == NULL) || (*name_in == '\0'))
+    {
+        LEAVE("no string");
+        return;
+    }
+    name = g_strstrip(g_strdup(name_in));
+
+    /* Optimization, if the name hasn't changed, don't update X. */
+    if (*name == '\0' || 0 == strcmp(name, gnc_plugin_page_get_page_name(page)))
+    {
+        g_free(name);
+        LEAVE("empty string or name unchanged");
+        return;
+    }
+
+    old_page_name = g_strdup( gnc_plugin_page_get_page_name(page));
+    old_page_long_name = g_strdup( gnc_plugin_page_get_page_long_name(page));
+
+    /* Update the plugin */
+    gnc_plugin_page_set_page_name(page, name);
+
+    /* Update the notebook tab */
+    window = GNC_MAIN_WINDOW(page->window);
+    if (!window)
+    {
+        g_free(old_page_name);
+        g_free(old_page_long_name);
+        g_free(name);
+        LEAVE("no window widget available");
+        return;
+    }
+
+    if (main_window_find_tab_items(window, page, &label, &entry))
+        gtk_label_set_text(GTK_LABEL(label), name);
+
+    /* Adjust the label width for new text */
+    lab_width = gnc_prefs_get_float (GNC_PREFS_GROUP_GENERAL, GNC_PREF_TAB_WIDTH);
+    gnc_main_window_update_tab_width_one_page (page, &lab_width);
+
+    /* Update Tooltip on notebook Tab */
+    if (old_page_long_name && old_page_name
+            && g_strrstr(old_page_long_name, old_page_name) != NULL)
+    {
+        gchar *new_page_long_name;
+        gint string_position;
+        GtkWidget *tab_widget;
+
+        string_position = strlen(old_page_long_name) - strlen(old_page_name);
+        new_page_long_name = g_strconcat(g_strndup(old_page_long_name, string_position), name, NULL);
+
+        gnc_plugin_page_set_page_long_name(page, new_page_long_name);
+
+        if (main_window_find_tab_widget(window, page, &tab_widget))
+            gtk_widget_set_tooltip_text(tab_widget, new_page_long_name);
+
+        g_free(new_page_long_name);
+    }
+
+    /* Update the notebook menu */
+    if (page->notebook_page)
+    {
+        priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
+        label = gtk_notebook_get_menu_label (GTK_NOTEBOOK(priv->notebook),
+                                             page->notebook_page);
+        gtk_label_set_text(GTK_LABEL(label), name);
+    }
+
+    /* Force an update of the window title */
+    gnc_main_window_update_title(window);
+    g_free(old_page_long_name);
+    g_free(old_page_name);
+    g_free(name);
+    LEAVE("done");
+}
+
+
+void
+main_window_update_page_color (GncPluginPage *page,
+                               const gchar *color_in)
+{
+    GncMainWindow *window;
+    GncMainWindowPrivate *priv;
+    GtkWidget *tab_widget;
+    GdkRGBA tab_color;
+    gchar *color_string = NULL;
+    gboolean want_color = FALSE;
+
+    ENTER(" ");
+    if (color_in)
+        color_string = g_strstrip(g_strdup(color_in));
+
+    if (color_string && *color_string != '\0')
+        want_color = TRUE;
+
+    /* Update the plugin */
+    window = GNC_MAIN_WINDOW(page->window);
+    if (want_color)
+        gnc_plugin_page_set_page_color(page, color_string);
+    else
+        gnc_plugin_page_set_page_color(page, NULL);
+
+    /* Update the notebook tab */
+    main_window_find_tab_widget (window, page, &tab_widget);
+    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
+
+    if (want_color && gdk_rgba_parse(&tab_color, color_string) && priv->show_color_tabs)
+    {
+        GtkCssProvider *provider = gtk_css_provider_new();
+        GtkStyleContext *stylectxt;
+        gchar *col_str, *widget_css;
+
+        if (!GTK_IS_EVENT_BOX (tab_widget))
+        {
+            GtkWidget *event_box = gtk_event_box_new ();
+            g_object_ref (tab_widget);
+            gtk_notebook_set_tab_label (GTK_NOTEBOOK(priv->notebook),
+                                        page->notebook_page, event_box);
+            gtk_container_add (GTK_CONTAINER(event_box), tab_widget);
+            g_object_unref (tab_widget);
+            tab_widget = event_box;
+        }
+
+        stylectxt = gtk_widget_get_style_context (GTK_WIDGET (tab_widget));
+        col_str = gdk_rgba_to_string (&tab_color);
+        widget_css = g_strconcat ("*{\n  background-color:", col_str, ";\n}\n", NULL);
+
+        gtk_css_provider_load_from_data (provider, widget_css, -1, NULL);
+        gtk_style_context_add_provider (stylectxt, GTK_STYLE_PROVIDER (provider),
+                                        GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+        g_object_unref (provider);
+        g_free (col_str);
+        g_free (widget_css);
+    }
+    else
+    {
+        if (GTK_IS_EVENT_BOX (tab_widget))
+        {
+            GtkWidget *tab_hbox = gtk_bin_get_child(GTK_BIN(tab_widget));
+            g_object_ref (tab_hbox);
+            gtk_container_remove (GTK_CONTAINER(tab_widget), tab_hbox);
+            gtk_notebook_set_tab_label (GTK_NOTEBOOK(priv->notebook),
+                                        page->notebook_page, tab_hbox);
+            g_object_unref (tab_hbox);
+        }
+    }
+    g_free(color_string);
+    LEAVE("done");
+}
+
+
+static void
+gnc_main_window_tab_entry_activate (GtkWidget *entry,
+                                    GncPluginPage *page)
+{
+    GtkWidget *label, *entry2;
+
+    g_return_if_fail(GTK_IS_ENTRY(entry));
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE(page));
+
+    ENTER("");
+    if (!main_window_find_tab_items(GNC_MAIN_WINDOW(page->window),
+                                    page, &label, &entry2))
+    {
+        LEAVE("can't find required widgets");
+        return;
+    }
+
+    main_window_update_page_name(page, gtk_entry_get_text(GTK_ENTRY(entry)));
+
+    gtk_widget_hide(entry);
+    gtk_widget_show(label);
+    LEAVE("");
+}
+
+
+static gboolean
+gnc_main_window_tab_entry_editing_done (GtkWidget *entry,
+                                        GncPluginPage *page)
+{
+    ENTER("");
+    gnc_main_window_tab_entry_activate(entry, page);
+    LEAVE("");
+    return FALSE;
+}
+
+static gboolean
+gnc_main_window_tab_entry_focus_out_event (GtkWidget *entry,
+        GdkEvent *event,
+        GncPluginPage *page)
+{
+    ENTER("");
+    gtk_cell_editable_editing_done(GTK_CELL_EDITABLE(entry));
+    LEAVE("");
+    return FALSE;
+}
+
+static gboolean
+gnc_main_window_tab_entry_key_press_event (GtkWidget *entry,
+        GdkEventKey *event,
+        GncPluginPage *page)
+{
+    if (event->keyval == GDK_KEY_Escape)
+    {
+        GtkWidget *label, *entry2;
+
+        g_return_val_if_fail(GTK_IS_ENTRY(entry), FALSE);
+        g_return_val_if_fail(GNC_IS_PLUGIN_PAGE(page), FALSE);
+
+        ENTER("");
+        if (!main_window_find_tab_items(GNC_MAIN_WINDOW(page->window),
+                                        page, &label, &entry2))
+        {
+            LEAVE("can't find required widgets");
+            return FALSE;
+        }
+
+        gtk_entry_set_text(GTK_ENTRY(entry), gtk_label_get_text(GTK_LABEL(label)));
+        gtk_widget_hide(entry);
+        gtk_widget_show(label);
+        LEAVE("");
+    }
+    return FALSE;
+}
+
+/************************************************************
+ *                   Widget Implementation                  *
+ ************************************************************/
+
+/*  Get the type of a gnc main window.
+ */
+GType
+gnc_main_window_get_type (void)
+{
+    static GType gnc_main_window_type = 0;
+
+    if (gnc_main_window_type == 0)
+    {
+        static const GTypeInfo our_info =
+        {
+            sizeof (GncMainWindowClass),
+            NULL,
+            NULL,
+            (GClassInitFunc) gnc_main_window_class_init,
+            NULL,
+            NULL,
+            sizeof (GncMainWindow),
+            0,
+            (GInstanceInitFunc) gnc_main_window_init
+        };
+
+        static const GInterfaceInfo plugin_info =
+        {
+            (GInterfaceInitFunc) gnc_window_main_window_init,
+            NULL,
+            NULL
+        };
+
+        gnc_main_window_type = g_type_register_static (GTK_TYPE_WINDOW,
+                               GNC_MAIN_WINDOW_NAME,
+                               &our_info, 0);
+        g_type_add_interface_static (gnc_main_window_type,
+                                     GNC_TYPE_WINDOW,
+                                     &plugin_info);
+    }
+
+    return gnc_main_window_type;
+}
+
+
+/** Initialize the class for a new gnucash main window.  This will set
+ *  up any function pointers that override functions in the parent
+ *  class, and also initialize the signals that this class of widget
+ *  can generate.
+ *
+ *  @param klass The new class structure created by the object system.
+ */
+static void
+gnc_main_window_class_init (GncMainWindowClass *klass)
+{
+    GObjectClass *object_class = G_OBJECT_CLASS (klass);
+    GtkWidgetClass *gtkwidget_class = GTK_WIDGET_CLASS(klass);
+
+    parent_class = g_type_class_peek_parent (klass);
+
+    window_type = g_quark_from_static_string ("gnc-main-window");
+
+    object_class->finalize = gnc_main_window_finalize;
+
+    /* GtkWidget signals */
+    gtkwidget_class->destroy = gnc_main_window_destroy;
+
+    g_type_class_add_private(klass, sizeof(GncMainWindowPrivate));
+
+    /**
+     * GncMainWindow::page_added:
+     * @param window: the #GncMainWindow
+     * @param page: the #GncPluginPage
+     *
+     * The "page_added" signal is emitted when a new page is added
+     * to the notebook of a GncMainWindow.  This can be used to
+     * attach a signal from the page so that menu actions can be
+     * adjusted based upon events that occur within the page
+     * (e.g. an account is selected.)
+     */
+    main_window_signals[PAGE_ADDED] =
+        g_signal_new ("page_added",
+                      G_OBJECT_CLASS_TYPE (object_class),
+                      G_SIGNAL_RUN_FIRST,
+                      G_STRUCT_OFFSET (GncMainWindowClass, page_added),
+                      NULL, NULL,
+                      g_cclosure_marshal_VOID__OBJECT,
+                      G_TYPE_NONE, 1,
+                      G_TYPE_OBJECT);
+
+    /**
+     * GncMainWindow::page_changed:
+     * @param window: the #GncMainWindow
+     * @param page: the #GncPluginPage
+     *
+     * The "page_changed" signal is emitted when a new page is
+     * selected in the notebook of a GncMainWindow.  This can be
+     * used to to adjust menu actions based upon which page is
+     * currently displayed in a window.
+     */
+    main_window_signals[PAGE_CHANGED] =
+        g_signal_new ("page_changed",
+                      G_OBJECT_CLASS_TYPE (object_class),
+                      G_SIGNAL_RUN_FIRST,
+                      G_STRUCT_OFFSET (GncMainWindowClass, page_changed),
+                      NULL, NULL,
+                      g_cclosure_marshal_VOID__OBJECT,
+                      G_TYPE_NONE, 1,
+                      G_TYPE_OBJECT);
+
+    gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL,
+                           GNC_PREF_SHOW_CLOSE_BUTTON,
+                           gnc_main_window_update_tab_close,
+                           NULL);
+    gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL,
+                           GNC_PREF_TAB_WIDTH,
+                           gnc_main_window_update_tab_width,
+                           NULL);
+
+    gnc_hook_add_dangler(HOOK_BOOK_SAVED,
+                         (GFunc)gnc_main_window_update_all_titles, NULL);
+    gnc_hook_add_dangler(HOOK_BOOK_OPENED,
+                         (GFunc)gnc_main_window_attach_to_book, NULL);
+
+}
+
+
+/** Initialize a new instance of a gnucash main window.  This function
+ *  initializes the object private storage space.  It also adds the
+ *  new object to a list (for memory tracking purposes).
+ *
+ *  @param window The new object instance created by the object system.
+ *
+ *  @param klass A pointer to the class data structure for this
+ *  object. */
+static void
+gnc_main_window_init (GncMainWindow *window,
+                      GncMainWindowClass *klass)
+{
+    GncMainWindowPrivate *priv;
+
+    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
+    priv->merged_actions_table =
+        g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
+
+    // Set the style context for this widget so it can be easily manipulated with css
+    gnc_widget_set_style_context (GTK_WIDGET(window), "GncMainWindow");
+
+    priv->event_handler_id =
+        qof_event_register_handler(gnc_main_window_event_handler, window);
+
+    /* Get the show_color_tabs value preference */
+    priv->show_color_tabs = gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL, GNC_PREF_TAB_COLOR);
+    priv->about_dialog = NULL;
+
+    gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL,
+                           GNC_PREF_TAB_COLOR,
+                           gnc_main_window_update_tab_color,
+                           window);
+
+    gnc_main_window_setup_window (window);
+    gnc_gobject_tracking_remember(G_OBJECT(window),
+                                  G_OBJECT_CLASS(klass));
+}
+
+
+/** Finalize the GncMainWindow object.  This function is called from
+ *  the G_Object level to complete the destruction of the object.  It
+ *  should release any memory not previously released by the destroy
+ *  function (i.e. the private data structure), then chain up to the
+ *  parent's destroy function.
+ *
+ *  @param object The object being destroyed.
+ *
+ *  @internal
+ */
+static void
+gnc_main_window_finalize (GObject *object)
+{
+    g_return_if_fail (object != NULL);
+    g_return_if_fail (GNC_IS_MAIN_WINDOW (object));
+
+    if (active_windows == NULL)
+    {
+        /* Oops. User killed last window and we didn't catch it. */
+        g_idle_add((GSourceFunc)gnc_shutdown, 0);
+    }
+
+    gnc_gobject_tracking_forget(object);
+    G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+
+static void
+gnc_main_window_destroy (GtkWidget *widget)
+{
+    GncMainWindow *window;
+    GncMainWindowPrivate *priv;
+    GncPluginManager *manager;
+    GList *plugins;
+
+    g_return_if_fail (widget != NULL);
+    g_return_if_fail (GNC_IS_MAIN_WINDOW (widget));
+
+    window = GNC_MAIN_WINDOW (widget);
+
+    active_windows = g_list_remove (active_windows, window);
+
+    /* Do these things once */
+    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
+    if (priv->merged_actions_table)
+    {
+
+        /* Close any pages in this window */
+        while (priv->current_page)
+            gnc_main_window_close_page(priv->current_page);
+
+        if (gnc_window_get_progressbar_window() == GNC_WINDOW(window))
+            gnc_window_set_progressbar_window(NULL);
+#ifndef MAC_INTEGRATION
+        /* Update the "Windows" menu in all other windows */
+        gnc_main_window_update_all_menu_items();
+#endif
+        gnc_prefs_remove_cb_by_func (GNC_PREFS_GROUP_GENERAL,
+                                     GNC_PREF_TAB_COLOR,
+                                     gnc_main_window_update_tab_color,
+                                     window);
+
+        qof_event_unregister_handler(priv->event_handler_id);
+        priv->event_handler_id = 0;
+
+        g_hash_table_destroy (priv->merged_actions_table);
+        priv->merged_actions_table = NULL;
+
+        /* GncPluginManager stuff */
+        manager = gnc_plugin_manager_get ();
+        plugins = gnc_plugin_manager_get_plugins (manager);
+        g_list_foreach (plugins, gnc_main_window_remove_plugin, window);
+        g_list_free (plugins);
+    }
+    if (priv->about_dialog)
+	g_object_unref (priv->about_dialog);
+    GTK_WIDGET_CLASS (parent_class)->destroy (widget);
+}
+
+
+/*  Create a new gnc main window plugin.
+ */
+GncMainWindow *
+gnc_main_window_new (void)
+{
+    GncMainWindow *window;
+    GtkWidget *old_window;
+
+    window = g_object_new (GNC_TYPE_MAIN_WINDOW, NULL);
+    gtk_window_set_default_size(GTK_WINDOW(window), 800, 600);
+
+    old_window = gnc_ui_get_toplevel();
+    if (old_window)
+    {
+        gint width, height;
+        gtk_window_get_size (GTK_WINDOW (old_window), &width, &height);
+        gtk_window_resize (GTK_WINDOW (window), width, height);
+        if ((gdk_window_get_state((gtk_widget_get_window (GTK_WIDGET(old_window))))
+                & GDK_WINDOW_STATE_MAXIMIZED) != 0)
+        {
+            gtk_window_maximize (GTK_WINDOW (window));
+        }
+    }
+    active_windows = g_list_append (active_windows, window);
+    gnc_main_window_update_title(window);
+#ifdef MAC_INTEGRATION
+    gnc_quartz_set_menu(window);
+#else
+    gnc_main_window_update_all_menu_items();
+#endif
+    gnc_engine_add_commit_error_callback( gnc_main_window_engine_commit_error_callback, window );
+
+    return window;
+}
+
+/************************************************************
+ *                     Utility Functions                    *
+ ************************************************************/
+
+static void
+gnc_main_window_engine_commit_error_callback( gpointer data,
+        QofBackendError errcode )
+{
+    GncMainWindow* window = GNC_MAIN_WINDOW(data);
+    GtkWidget* dialog;
+    const gchar *reason = _("Unable to save to database.");
+    if ( errcode == ERR_BACKEND_READONLY )
+        reason = _("Unable to save to database: Book is marked read-only.");
+    dialog = gtk_message_dialog_new( GTK_WINDOW(window),
+                                     GTK_DIALOG_DESTROY_WITH_PARENT,
+                                     GTK_MESSAGE_ERROR,
+                                     GTK_BUTTONS_CLOSE,
+                                     "%s",
+                                     reason );
+    gtk_dialog_run(GTK_DIALOG (dialog));
+    gtk_widget_destroy(dialog);
+
+}
+
+/** Connect a GncPluginPage to the window.  This function will insert
+ *  the page in to the window's notebook and its list of active pages.
+ *  It will also emit the "inserted" signal on the page, and the
+ *  "add_page" signal on the window.
+ *
+ *  @param window The window where the new page should be added.
+ *
+ *  @param page The GncPluginPage that should be added to the window.
+ *  The visible widget for this plugin must have already been created.
+ *
+ *  @param tab_hbox The widget that should be added into the notebook
+ *  tab for this page.  Generally this is a GtkLabel, but could also
+ *  be a GtkHBox containing an icon and a label.
+ *
+ *  @param menu_label The widget that should be added into the
+ *  notebook popup menu for this page.  This should be a GtkLabel.
+ */
+static void
+gnc_main_window_connect (GncMainWindow *window,
+                         GncPluginPage *page,
+                         GtkWidget *tab_hbox,
+                         GtkWidget *menu_label)
+{
+    GncMainWindowPrivate *priv;
+    GtkNotebook *notebook;
+
+    page->window = GTK_WIDGET(window);
+    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
+    notebook = GTK_NOTEBOOK (priv->notebook);
+    priv->installed_pages = g_list_append (priv->installed_pages, page);
+    priv->usage_order = g_list_prepend (priv->usage_order, page);
+    gtk_notebook_append_page_menu (notebook, page->notebook_page,
+                                   tab_hbox, menu_label);
+    gtk_notebook_set_tab_reorderable (notebook, page->notebook_page, TRUE);
+    gnc_plugin_page_inserted (page);
+    gtk_notebook_set_current_page (notebook, -1);
+    if (GNC_PLUGIN_PAGE_GET_CLASS(page)->window_changed)
+        (GNC_PLUGIN_PAGE_GET_CLASS(page)->window_changed)(page, GTK_WIDGET(window));
+    g_signal_emit (window, main_window_signals[PAGE_ADDED], 0, page);
+
+    g_signal_connect(G_OBJECT(page->notebook_page), "popup-menu",
+                     G_CALLBACK(gnc_main_window_popup_menu_cb), page);
+    g_signal_connect_after(G_OBJECT(page->notebook_page), "button-press-event",
+                           G_CALLBACK(gnc_main_window_button_press_cb), page);
+}
+
+
+/** Disconnect a GncPluginPage page from the window.  If this page is
+ *  currently foremost in the window's notebook, its user interface
+ *  actions will be disconnected and the page's summarybar widget (if
+ *  any) will be removed.  The page is then removed from the window's
+ *  notebook and its list of active pages.
+ *
+ *  @param window The window the page should be removed from.
+ *
+ *  @param page The GncPluginPage that should be removed from the
+ *  window.
+ *
+ *  @internal
+ */
+static void
+gnc_main_window_disconnect (GncMainWindow *window,
+                            GncPluginPage *page)
+{
+    GncMainWindowPrivate *priv;
+    GtkNotebook *notebook;
+    GncPluginPage *new_page;
+    gint page_num;
+
+    /* Disconnect the callbacks */
+    g_signal_handlers_disconnect_by_func(G_OBJECT(page->notebook_page),
+                                         G_CALLBACK(gnc_main_window_popup_menu_cb), page);
+    g_signal_handlers_disconnect_by_func(G_OBJECT(page->notebook_page),
+                                         G_CALLBACK(gnc_main_window_button_press_cb), page);
+
+    /* Disconnect the page and summarybar from the window */
+    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
+    if (priv->current_page == page)
+    {
+        gnc_plugin_page_unmerge_actions (page, window->ui_merge);
+        gnc_plugin_page_unselected (page);
+        priv->current_page = NULL;
+    }
+
+    /* Remove it from the list of pages in the window */
+    priv->installed_pages = g_list_remove (priv->installed_pages, page);
+    priv->usage_order = g_list_remove (priv->usage_order, page);
+
+    /* Switch to the last recently used page */
+    notebook = GTK_NOTEBOOK (priv->notebook);
+    if (gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL, GNC_PREF_TAB_NEXT_RECENT))
+    {
+        new_page = g_list_nth_data (priv->usage_order, 0);
+        if (new_page)
+        {
+            page_num =  gtk_notebook_page_num(notebook, new_page->notebook_page);
+            gtk_notebook_set_current_page(notebook, page_num);
+            /* This may have caused WebKit to schedule  a timer interrupt which it
+               sometimes  forgets to cancel before deleting the object.  See
+               <https://bugs.webkit.org/show_bug.cgi?id=119003>.   Get around this
+               by flushing all events to get rid of the timer interrupt. */
+            while (gtk_events_pending())
+                gtk_main_iteration();
+        }
+    }
+
+    /* Remove the page from the notebook */
+    page_num =  gtk_notebook_page_num(notebook, page->notebook_page);
+    gtk_notebook_remove_page (notebook, page_num);
+
+    if ( gtk_notebook_get_current_page(notebook) == -1)
+    {
+        /* Need to synthesize a page changed signal when the last
+         * page is removed.  The notebook doesn't generate a signal
+         * for this, therefore the switch_page code in this file
+         * never gets called to generate this signal. */
+        gnc_main_window_switch_page(notebook, NULL, -1, window);
+        //g_signal_emit (window, main_window_signals[PAGE_CHANGED], 0, NULL);
+    }
+
+    gnc_plugin_page_removed (page);
+
+    gtk_ui_manager_ensure_update (window->ui_merge);
+    gnc_window_set_status (GNC_WINDOW(window), page, NULL);
+}
+
+
+/************************************************************
+ *                                                          *
+ ************************************************************/
+
+
+void
+gnc_main_window_display_page (GncPluginPage *page)
+{
+    GncMainWindow *window;
+    GncMainWindowPrivate *priv;
+    GtkNotebook *notebook;
+    gint page_num;
+
+    window = GNC_MAIN_WINDOW (page->window);
+    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
+    notebook = GTK_NOTEBOOK (priv->notebook);
+    page_num = gtk_notebook_page_num(notebook, page->notebook_page);
+    gtk_notebook_set_current_page (notebook, page_num);
+    gtk_window_present(GTK_WINDOW(window));
+}
+
+
+/*  Display a data plugin page in a window.  If the page already
+ *  exists in any window, then that window will be brought to the
+ *  front and the notebook switch to display the specified page.  If
+ *  the page is new then it will be added to the specified window.  If
+ *  the window is NULL, the new page will be added to the first
+ *  window.
+ */
+void
+gnc_main_window_open_page (GncMainWindow *window,
+                           GncPluginPage *page)
+{
+    GncMainWindowPrivate *priv;
+    GtkWidget *tab_hbox;
+    GtkWidget *label, *entry;
+    const gchar *icon, *text, *color_string, *lab_text;
+    GtkWidget *image;
+    GList *tmp;
+    gint width;
+
+    ENTER("window %p, page %p", window, page);
+    if (window)
+        g_return_if_fail (GNC_IS_MAIN_WINDOW (window));
+    g_return_if_fail (GNC_IS_PLUGIN_PAGE (page));
+    g_return_if_fail (gnc_plugin_page_has_books(page));
+
+    if (gnc_main_window_page_exists(page))
+    {
+        gnc_main_window_display_page(page);
+        return;
+    }
+
+    /* Does the page want to be in a new window? */
+    if (gnc_plugin_page_get_use_new_window(page))
+    {
+        /* See if there's a blank window. If so, use that. */
+        for (tmp = active_windows; tmp; tmp = g_list_next(tmp))
+        {
+            window = GNC_MAIN_WINDOW(tmp->data);
+            priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
+            if (priv->installed_pages == NULL)
+            {
+                break;
+            }
+        }
+        if (tmp == NULL)
+            window = gnc_main_window_new ();
+        gtk_widget_show(GTK_WIDGET(window));
+    }
+    else if ((window == NULL) && active_windows)
+    {
+        window = active_windows->data;
+    }
+
+    page->window = GTK_WIDGET(window);
+    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
+    page->notebook_page = gnc_plugin_page_create_widget (page);
+    g_object_set_data (G_OBJECT (page->notebook_page),
+                       PLUGIN_PAGE_LABEL, page);
+
+    /*
+     * The page tab.
+     */
+    width = gnc_prefs_get_float(GNC_PREFS_GROUP_GENERAL, GNC_PREF_TAB_WIDTH);
+    icon = GNC_PLUGIN_PAGE_GET_CLASS(page)->tab_icon;
+    lab_text = gnc_plugin_page_get_page_name(page);
+    label = gtk_label_new (lab_text);
+    g_object_set_data (G_OBJECT (page), PLUGIN_PAGE_TAB_LABEL, label);
+
+    if (width != 0)
+    {
+        if (g_utf8_strlen (lab_text, -1) < width)
+            gtk_label_set_width_chars (GTK_LABEL(label), strlen (lab_text));
+        else
+            gtk_label_set_width_chars (GTK_LABEL(label), width);
+
+        gtk_label_set_ellipsize(GTK_LABEL(label), PANGO_ELLIPSIZE_MIDDLE);
+    }
+    gtk_widget_show (label);
+
+    tab_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
+    gtk_box_set_homogeneous (GTK_BOX (tab_hbox), FALSE);
+    gtk_widget_show (tab_hbox);
+
+    if (icon != NULL)
+    {
+        image = gtk_image_new_from_icon_name (icon, GTK_ICON_SIZE_MENU);
+        gtk_widget_show (image);
+        gtk_box_pack_start (GTK_BOX (tab_hbox), image, FALSE, FALSE, 0);
+#if GTK_CHECK_VERSION(3,12,0)
+        gtk_widget_set_margin_start (GTK_WIDGET(image), 5);
+#else
+        gtk_widget_set_margin_left (GTK_WIDGET(image), 5);
+#endif
+        gtk_box_pack_start (GTK_BOX (tab_hbox), label, TRUE, TRUE, 0);
+    }
+    else
+        gtk_box_pack_start (GTK_BOX (tab_hbox), label, TRUE, TRUE, 0);
+
+    text = gnc_plugin_page_get_page_long_name(page);
+    if (text)
+    {
+        gtk_widget_set_tooltip_text(tab_hbox, text);
+    }
+
+    entry = gtk_entry_new();
+    gtk_widget_hide (entry);
+    gtk_box_pack_start (GTK_BOX (tab_hbox), entry, TRUE, TRUE, 0);
+    g_signal_connect(G_OBJECT(entry), "activate",
+                     G_CALLBACK(gnc_main_window_tab_entry_activate), page);
+    g_signal_connect(G_OBJECT(entry), "focus-out-event",
+                     G_CALLBACK(gnc_main_window_tab_entry_focus_out_event),
+                     page);
+    g_signal_connect(G_OBJECT(entry), "key-press-event",
+                     G_CALLBACK(gnc_main_window_tab_entry_key_press_event),
+                     page);
+    g_signal_connect(G_OBJECT(entry), "editing-done",
+                     G_CALLBACK(gnc_main_window_tab_entry_editing_done),
+                     page);
+
+    /* Add close button - Not for immutable pages */
+    if (!g_object_get_data (G_OBJECT (page), PLUGIN_PAGE_IMMUTABLE))
+    {
+        GtkWidget *close_image, *close_button;
+        GtkRequisition requisition;
+
+        close_button = gtk_button_new();
+        gtk_button_set_relief(GTK_BUTTON(close_button), GTK_RELIEF_NONE);
+        close_image = gtk_image_new_from_icon_name ("window-close", GTK_ICON_SIZE_MENU);
+        gtk_widget_show(close_image);
+        gtk_widget_get_preferred_size (close_image, &requisition, NULL);
+        gtk_widget_set_size_request(close_button, requisition.width + 4,
+                                    requisition.height + 2);
+        gtk_container_add(GTK_CONTAINER(close_button), close_image);
+        if (gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL, GNC_PREF_SHOW_CLOSE_BUTTON))
+            gtk_widget_show (close_button);
+        else
+            gtk_widget_hide (close_button);
+
+        g_signal_connect_swapped (G_OBJECT (close_button), "clicked",
+                                  G_CALLBACK(gnc_main_window_close_page), page);
+
+        gtk_box_pack_start (GTK_BOX (tab_hbox), close_button, FALSE, FALSE, 0);
+#if GTK_CHECK_VERSION(3,12,0)
+        gtk_widget_set_margin_end (GTK_WIDGET(close_button), 5);
+#else
+        gtk_widget_set_margin_right (GTK_WIDGET(close_button), 5);
+#endif
+        g_object_set_data (G_OBJECT (page), PLUGIN_PAGE_CLOSE_BUTTON, close_button);
+    }
+
+    /*
+     * The popup menu
+     */
+    label = gtk_label_new (gnc_plugin_page_get_page_name(page));
+
+    /*
+     * Now install it all in the window.
+     */
+    gnc_main_window_connect(window, page, tab_hbox, label);
+
+    color_string = gnc_plugin_page_get_page_color(page);
+    main_window_update_page_color (page, color_string);
+    LEAVE("");
+}
+
+
+/*  Remove a data plugin page from a window and display the previous
+ *  page.  If the page removed was the last page in the window, and
+ *  there is more than one window open, then the entire window will be
+ *  destroyed.
+ */
+void
+gnc_main_window_close_page (GncPluginPage *page)
+{
+    GncMainWindow *window;
+    GncMainWindowPrivate *priv;
+
+    if (!page || !page->notebook_page)
+        return;
+
+    if (!gnc_plugin_page_finish_pending(page))
+        return;
+
+    if (!GNC_IS_MAIN_WINDOW (page->window))
+        return;
+
+    window = GNC_MAIN_WINDOW (page->window);
+    if (!window)
+    {
+        g_warning("Page is not in a window.");
+        return;
+    }
+
+    gnc_main_window_disconnect(window, page);
+    gnc_plugin_page_destroy_widget (page);
+    g_object_unref(page);
+
+    /* If this isn't the last window, go ahead and destroy the window. */
+    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
+    if (priv->installed_pages == NULL)
+    {
+        if (g_list_length(active_windows) > 1)
+        {
+            gtk_widget_destroy(GTK_WIDGET(window));
+        }
+    }
+}
+
+
+/*  Retrieve a pointer to the page that is currently at the front of
+ *  the specified window.  Any plugin that needs to manipulate its
+ *  menus based upon the currently selected menu page should connect
+ *  to the "page_changed" signal on a window.  The callback function
+ *  from that signal can then call this function to obtain a pointer
+ *  to the current page.
+ */
+GncPluginPage *
+gnc_main_window_get_current_page (GncMainWindow *window)
+{
+    GncMainWindowPrivate *priv;
+
+    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
+    return priv->current_page;
+}
+
+
+/*  Manually add a set of actions to the specified window.  Plugins
+ *  whose user interface is not hard coded (e.g. the menu-additions
+ *  plugin) must create their actions at run time, then use this
+ *  function to install them into the window.
+ */
+void
+gnc_main_window_manual_merge_actions (GncMainWindow *window,
+                                      const gchar *group_name,
+                                      GtkActionGroup *group,
+                                      guint merge_id)
+{
+    GncMainWindowPrivate *priv;
+    MergedActionEntry *entry;
+
+    g_return_if_fail (GNC_IS_MAIN_WINDOW (window));
+    g_return_if_fail (group_name != NULL);
+    g_return_if_fail (GTK_IS_ACTION_GROUP(group));
+    g_return_if_fail (merge_id > 0);
+
+    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
+    entry = g_new0 (MergedActionEntry, 1);
+    entry->action_group = group;
+    entry->merge_id = merge_id;
+    gtk_ui_manager_ensure_update (window->ui_merge);
+    g_hash_table_insert (priv->merged_actions_table, g_strdup (group_name), entry);
+}
+
+
+/*  Add a set of actions to the specified window.  This function
+ *  should not need to be called directly by plugin implementors.
+ *  Correctly assigning values to the GncPluginClass fields during
+ *  plugin initialization will cause this routine to be automatically
+ *  called.
+ */
+void
+gnc_main_window_merge_actions (GncMainWindow *window,
+                               const gchar *group_name,
+                               GtkActionEntry *actions,
+                               guint n_actions,
+                               GtkToggleActionEntry *toggle_actions,
+                               guint n_toggle_actions,
+                               const gchar *filename,
+                               gpointer user_data)
+{
+    GncMainWindowPrivate *priv;
+    GncMainWindowActionData *data;
+    MergedActionEntry *entry;
+    GError *error = NULL;
+    gchar *pathname;
+
+    g_return_if_fail (GNC_IS_MAIN_WINDOW (window));
+    g_return_if_fail (group_name != NULL);
+    g_return_if_fail (actions != NULL);
+    g_return_if_fail (n_actions > 0);
+    g_return_if_fail (filename != NULL);
+
+    pathname = gnc_filepath_locate_ui_file (filename);
+    if (pathname == NULL)
+        return;
+
+    data = g_new0 (GncMainWindowActionData, 1);
+    data->window = window;
+    data->data = user_data;
+
+    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
+    entry = g_new0 (MergedActionEntry, 1);
+    entry->action_group = gtk_action_group_new (group_name);
+    gnc_gtk_action_group_set_translation_domain (entry->action_group, GETTEXT_PACKAGE);
+    gtk_action_group_add_actions (entry->action_group, actions, n_actions, data);
+    if (toggle_actions != NULL && n_toggle_actions > 0)
+    {
+        gtk_action_group_add_toggle_actions (entry->action_group,
+                                             toggle_actions, n_toggle_actions,
+                                             data);
+    }
+    gtk_ui_manager_insert_action_group (window->ui_merge, entry->action_group, 0);
+    entry->merge_id = gtk_ui_manager_add_ui_from_file (window->ui_merge, pathname, &error);
+    g_assert(entry->merge_id || error);
+    if (entry->merge_id)
+    {
+        gtk_ui_manager_ensure_update (window->ui_merge);
+        g_hash_table_insert (priv->merged_actions_table, g_strdup (group_name), entry);
+    }
+    else
+    {
+        g_critical("Failed to load ui file.\n  Filename %s\n  Error %s",
+                   filename, error->message);
+        g_error_free(error);
+        g_free(entry);
+    }
+    g_free(pathname);
+}
+
+
+/*  Remove a set of actions from the specified window.  This function
+ *  should not need to be called directly by plugin implementors.  It
+ *  will automatically be called when a plugin is removed from a
+ *  window.
+ */
+void
+gnc_main_window_unmerge_actions (GncMainWindow *window,
+                                 const gchar *group_name)
+{
+    GncMainWindowPrivate *priv;
+    MergedActionEntry *entry;
+
+    g_return_if_fail (GNC_IS_MAIN_WINDOW (window));
+    g_return_if_fail (group_name != NULL);
+
+    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
+    if (priv->merged_actions_table == NULL)
+        return;
+    entry = g_hash_table_lookup (priv->merged_actions_table, group_name);
+
+    if (entry == NULL)
+        return;
+
+    gtk_ui_manager_remove_action_group (window->ui_merge, entry->action_group);
+    gtk_ui_manager_remove_ui (window->ui_merge, entry->merge_id);
+    gtk_ui_manager_ensure_update (window->ui_merge);
+
+    g_hash_table_remove (priv->merged_actions_table, group_name);
+}
+
+
+/*  Force a full update of the user interface for the specified
+ *  window.  This can be an expensive function, but is needed because
+ *  the gtk ui manager doesn't always seem to update properly when
+ *  actions are changed.
+ */
+void
+gnc_main_window_actions_updated (GncMainWindow *window)
+{
+    GtkActionGroup *force;
+
+    g_return_if_fail (GNC_IS_MAIN_WINDOW (window));
+
+    /* Unfortunately gtk_ui_manager_ensure_update doesn't work
+     * here.  Force a full update by adding and removing an empty
+     * action group.
+     */
+    force = gtk_action_group_new("force_update");
+    gtk_ui_manager_insert_action_group (window->ui_merge, force, 0);
+    gtk_ui_manager_ensure_update (window->ui_merge);
+    gtk_ui_manager_remove_action_group (window->ui_merge, force);
+    g_object_unref(force);
+}
+
+
+GtkAction *
+gnc_main_window_find_action (GncMainWindow *window, const gchar *name)
+{
+    GtkAction *action = NULL;
+    const GList *groups, *tmp;
+
+    groups = gtk_ui_manager_get_action_groups(window->ui_merge);
+    for (tmp = groups; tmp; tmp = g_list_next(tmp))
+    {
+        action = gtk_action_group_get_action(GTK_ACTION_GROUP(tmp->data), name);
+        if (action)
+            break;
+    }
+    return action;
+}
+
+
+/*  Retrieve a specific set of user interface actions from a window.
+ *  This function can be used to get an group of action to be
+ *  manipulated when the front page of a window has changed.
+ */
+GtkActionGroup *
+gnc_main_window_get_action_group (GncMainWindow *window,
+                                  const gchar *group_name)
+{
+    GncMainWindowPrivate *priv;
+    MergedActionEntry *entry;
+
+    g_return_val_if_fail (GNC_IS_MAIN_WINDOW (window), NULL);
+    g_return_val_if_fail (group_name != NULL, NULL);
+
+    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
+    if (priv->merged_actions_table == NULL)
+        return NULL;
+    entry = g_hash_table_lookup (priv->merged_actions_table, group_name);
+
+    if (entry == NULL)
+        return NULL;
+
+    return entry->action_group;
+}
+
+static void
+gnc_main_window_update_tab_position (gpointer prefs, gchar *pref, gpointer user_data)
+{
+    GncMainWindow *window;
+    GtkPositionType position = GTK_POS_TOP;
+    GncMainWindowPrivate *priv;
+
+    window = GNC_MAIN_WINDOW(user_data);
+
+    ENTER ("window %p", window);
+    if (gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL, GNC_PREF_TAB_POSITION_BOTTOM))
+        position = GTK_POS_BOTTOM;
+    else if (gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL, GNC_PREF_TAB_POSITION_LEFT))
+        position = GTK_POS_LEFT;
+    else if (gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL, GNC_PREF_TAB_POSITION_RIGHT))
+        position = GTK_POS_RIGHT;
+
+    priv = GNC_MAIN_WINDOW_GET_PRIVATE (window);
+    gtk_notebook_set_tab_pos (GTK_NOTEBOOK (priv->notebook), position);
+
+    LEAVE ("");
+}
+
+/*
+ * Based on code from Epiphany (src/ephy-window.c)
+ */
+static void
+gnc_main_window_update_edit_actions_sensitivity (GncMainWindow *window, gboolean hide)
+{
+    GncMainWindowPrivate *priv;
+    GncPluginPage *page;
+    GtkWidget *widget = gtk_window_get_focus (GTK_WINDOW (window));
+    GtkAction *action;
+    gboolean can_copy = FALSE, can_cut = FALSE, can_paste = FALSE;
+
+    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
+    page = priv->current_page;
+    if (page && GNC_PLUGIN_PAGE_GET_CLASS(page)->update_edit_menu_actions)
+    {
+        (GNC_PLUGIN_PAGE_GET_CLASS(page)->update_edit_menu_actions)(page, hide);
+        return;
+    }
+
+    if (GTK_IS_EDITABLE (widget))
+    {
+        gboolean has_selection;
+
+        has_selection = gtk_editable_get_selection_bounds
+                        (GTK_EDITABLE (widget), NULL, NULL);
+
+        can_copy = has_selection;
+        can_cut = has_selection;
+        can_paste = TRUE;
+    }
+    else if (GTK_IS_TEXT_VIEW (widget))
+    {
+        gboolean has_selection;
+        GtkTextBuffer *text_buffer;
+
+        text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW(widget));
+        has_selection = gtk_text_buffer_get_selection_bounds
+                        (text_buffer, NULL, NULL);
+
+        can_copy = has_selection;
+        can_cut = has_selection;
+        can_paste = TRUE;
+    }
+    else
+    {
+#ifdef ORIGINAL_EPIPHANY_CODE
+        /* For now we assume all actions are possible */
+        can_copy = can_cut = can_paste = TRUE;
+#else
+        /* If its not a GtkEditable, we don't know what to do
+         * with it. */
+        can_copy = can_cut = can_paste = FALSE;
+#endif
+    }
+
+    action = gnc_main_window_find_action (window, "EditCopyAction");
+    gtk_action_set_sensitive (action, can_copy);
+    gtk_action_set_visible (action, !hide || can_copy);
+    action = gnc_main_window_find_action (window, "EditCutAction");
+    gtk_action_set_sensitive (action, can_cut);
+    gtk_action_set_visible (action, !hide || can_cut);
+    action = gnc_main_window_find_action (window, "EditPasteAction");
+    gtk_action_set_sensitive (action, can_paste);
+    gtk_action_set_visible (action,  !hide || can_paste);
+}
+
+static void
+gnc_main_window_enable_edit_actions_sensitivity (GncMainWindow *window)
+{
+    GtkAction *action;
+
+    action = gnc_main_window_find_action (window, "EditCopyAction");
+    gtk_action_set_sensitive (action, TRUE);
+    gtk_action_set_visible (action, TRUE);
+    action = gnc_main_window_find_action (window, "EditCutAction");
+    gtk_action_set_sensitive (action, TRUE);
+    gtk_action_set_visible (action, TRUE);
+    action = gnc_main_window_find_action (window, "EditPasteAction");
+    gtk_action_set_sensitive (action, TRUE);
+    gtk_action_set_visible (action, TRUE);
+}
+
+static void
+gnc_main_window_edit_menu_show_cb (GtkWidget *menu,
+                                   GncMainWindow *window)
+{
+    gnc_main_window_update_edit_actions_sensitivity (window, FALSE);
+}
+
+static void
+gnc_main_window_edit_menu_hide_cb (GtkWidget *menu,
+                                   GncMainWindow *window)
+{
+    gnc_main_window_enable_edit_actions_sensitivity (window);
+}
+
+static void
+gnc_main_window_init_menu_updaters (GncMainWindow *window)
+{
+    GtkWidget *edit_menu_item, *edit_menu;
+
+    edit_menu_item = gtk_ui_manager_get_widget
+                     (window->ui_merge, "/menubar/Edit");
+    edit_menu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (edit_menu_item));
+
+    g_signal_connect (edit_menu, "show",
+                      G_CALLBACK (gnc_main_window_edit_menu_show_cb), window);
+    g_signal_connect (edit_menu, "hide",
+                      G_CALLBACK (gnc_main_window_edit_menu_hide_cb), window);
+}
+
+/* CS: This callback functions will set the statusbar text to the
+ * "tooltip" property of the currently selected GtkAction.
+ *
+ * This code is directly copied from gtk+/test/testmerge.c.
+ * Thanks to (L)GPL! */
+typedef struct _ActionStatus ActionStatus;
+struct _ActionStatus
+{
+    GtkAction *action;
+    GtkWidget *statusbar;
+};
+
+static void
+action_status_destroy (gpointer data)
+{
+    ActionStatus *action_status = data;
+
+    g_object_unref (action_status->action);
+    g_object_unref (action_status->statusbar);
+
+    g_free (action_status);
+}
+
+static void
+set_tip (GtkWidget *widget)
+{
+    ActionStatus *data;
+    gchar *tooltip;
+
+    data = g_object_get_data (G_OBJECT (widget), "action-status");
+
+    if (data)
+    {
+        g_object_get (data->action, "tooltip", &tooltip, NULL);
+
+        gtk_statusbar_push (GTK_STATUSBAR (data->statusbar), 0,
+                            tooltip ? tooltip : "");
+
+        g_free (tooltip);
+    }
+}
+
+static void
+unset_tip (GtkWidget *widget)
+{
+    ActionStatus *data;
+
+    data = g_object_get_data (G_OBJECT (widget), "action-status");
+
+    if (data)
+        gtk_statusbar_pop (GTK_STATUSBAR (data->statusbar), 0);
+}
+
+static void
+connect_proxy (GtkUIManager *merge,
+               GtkAction    *action,
+               GtkWidget    *proxy,
+               GtkWidget    *statusbar)
+{
+    if (GTK_IS_MENU_ITEM (proxy))
+    {
+        ActionStatus *data;
+
+        data = g_object_get_data (G_OBJECT (proxy), "action-status");
+        if (data)
+        {
+            g_object_unref (data->action);
+            g_object_unref (data->statusbar);
+
+            data->action = g_object_ref (action);
+            data->statusbar = g_object_ref (statusbar);
+        }
+        else
+        {
+            data = g_new0 (ActionStatus, 1);
+
+            data->action = g_object_ref (action);
+            data->statusbar = g_object_ref (statusbar);
+
+            g_object_set_data_full (G_OBJECT (proxy), "action-status",
+                                    data, action_status_destroy);
+
+            g_signal_connect (proxy, "select",  G_CALLBACK (set_tip), NULL);
+            g_signal_connect (proxy, "deselect", G_CALLBACK (unset_tip), NULL);
+        }
+    }
+}
+/* CS: end copied code from gtk+/test/testmerge.c */
+
+static void
+gnc_main_window_window_menu (GncMainWindow *window)
+{
+    guint merge_id;
+#ifdef MAC_INTEGRATION
+    gchar *filename = gnc_filepath_locate_ui_file("gnc-windows-menu-ui-quartz.xml");
+#else
+    gchar *filename = gnc_filepath_locate_ui_file("gnc-windows-menu-ui.xml");
+    GncMainWindowPrivate *priv;
+#endif
+    GError *error = NULL;
+    g_assert(filename);
+    merge_id = gtk_ui_manager_add_ui_from_file(window->ui_merge, filename,
+               &error);
+    g_free(filename);
+    g_assert(merge_id);
+#ifndef MAC_INTEGRATION
+    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
+    gtk_action_group_add_radio_actions (priv->action_group,
+                                        radio_entries, n_radio_entries,
+                                        0,
+                                        G_CALLBACK(gnc_main_window_cmd_window_raise),
+                                        window);
+#endif
+};
+
+static void
+gnc_main_window_setup_window (GncMainWindow *window)
+{
+    GncMainWindowPrivate *priv;
+    GtkWidget *main_vbox;
+    guint merge_id;
+    GncPluginManager *manager;
+    GList *plugins;
+    GError *error = NULL;
+    gchar *filename;
+
+    ENTER(" ");
+
+    /* Catch window manager delete signal */
+    g_signal_connect (G_OBJECT (window), "delete-event",
+                      G_CALLBACK (gnc_main_window_delete_event), window);
+
+    /* Create widgets and add them to the window */
+    main_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
+    gtk_box_set_homogeneous (GTK_BOX (main_vbox), FALSE);
+    gtk_widget_show (main_vbox);
+    gtk_container_add (GTK_CONTAINER (window), main_vbox);
+
+    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
+    priv->menu_dock = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
+    gtk_box_set_homogeneous (GTK_BOX (priv->menu_dock), FALSE);
+    gtk_widget_show (priv->menu_dock);
+    gtk_box_pack_start (GTK_BOX (main_vbox), priv->menu_dock,
+                        FALSE, TRUE, 0);
+
+    priv->notebook = gtk_notebook_new ();
+    g_object_set(G_OBJECT(priv->notebook),
+                 "scrollable", TRUE,
+                 "enable-popup", TRUE,
+                 (char *)NULL);
+    gtk_widget_show (priv->notebook);
+    g_signal_connect (G_OBJECT (priv->notebook), "switch-page",
+                      G_CALLBACK (gnc_main_window_switch_page), window);
+    g_signal_connect (G_OBJECT (priv->notebook), "page-reordered",
+                      G_CALLBACK (gnc_main_window_page_reordered), window);
+    gtk_box_pack_start (GTK_BOX (main_vbox), priv->notebook,
+                        TRUE, TRUE, 0);
+
+    priv->statusbar = gtk_statusbar_new ();
+    gtk_widget_show (priv->statusbar);
+    gtk_box_pack_start (GTK_BOX (main_vbox), priv->statusbar,
+                        FALSE, TRUE, 0);
+
+    priv->progressbar = gtk_progress_bar_new ();
+    gtk_progress_bar_set_text(GTK_PROGRESS_BAR(priv->progressbar), " ");
+    gtk_widget_show (priv->progressbar);
+    gtk_box_pack_start (GTK_BOX (priv->statusbar), priv->progressbar,
+                        FALSE, TRUE, 0);
+    gtk_progress_bar_set_pulse_step(GTK_PROGRESS_BAR(priv->progressbar),
+                                    0.01);
+
+    window->ui_merge = gtk_ui_manager_new ();
+
+    /* Create menu and toolbar information */
+    priv->action_group = gtk_action_group_new ("MainWindowActions");
+    gnc_gtk_action_group_set_translation_domain (priv->action_group, GETTEXT_PACKAGE);
+    gtk_action_group_add_actions (priv->action_group, gnc_menu_actions,
+                                  gnc_menu_n_actions, window);
+    gtk_action_group_add_toggle_actions (priv->action_group,
+                                         toggle_actions, n_toggle_actions,
+                                         window);
+    gnc_plugin_update_actions(priv->action_group,
+                              initially_insensitive_actions,
+                              "sensitive", FALSE);
+    gnc_plugin_update_actions(priv->action_group,
+                              always_insensitive_actions,
+                              "sensitive", FALSE);
+    gnc_plugin_update_actions(priv->action_group,
+                              always_hidden_actions,
+                              "visible", FALSE);
+    gnc_plugin_set_important_actions (priv->action_group,
+                                      gnc_menu_important_actions);
+    gtk_ui_manager_insert_action_group (window->ui_merge, priv->action_group, 0);
+
+    g_signal_connect (G_OBJECT (window->ui_merge), "add_widget",
+                      G_CALLBACK (gnc_main_window_add_widget), window);
+    /* Use the "connect-proxy" signal for tooltip display in the
+       status bar */
+    g_signal_connect (G_OBJECT (window->ui_merge), "connect-proxy",
+                      G_CALLBACK (connect_proxy), priv->statusbar);
+
+    filename = gnc_filepath_locate_ui_file("gnc-main-window-ui.xml");
+
+    /* Can't do much without a ui. */
+    g_assert (filename);
+
+    merge_id = gtk_ui_manager_add_ui_from_file (window->ui_merge,
+               filename, &error);
+    g_assert(merge_id || error);
+    if (merge_id)
+    {
+        gtk_window_add_accel_group (GTK_WINDOW (window),
+                                    gtk_ui_manager_get_accel_group(window->ui_merge));
+        gtk_ui_manager_ensure_update (window->ui_merge);
+    }
+    else
+    {
+        g_critical("Failed to load ui file.\n  Filename %s\n  Error %s",
+                   filename, error->message);
+        g_error_free(error);
+        g_assert(merge_id != 0);
+    }
+    g_free(filename);
+    gnc_main_window_window_menu(window);
+    gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL,
+                           GNC_PREF_TAB_POSITION_TOP,
+                           gnc_main_window_update_tab_position,
+                           window);
+    gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL,
+                           GNC_PREF_TAB_POSITION_BOTTOM,
+                           gnc_main_window_update_tab_position,
+                           window);
+    gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL,
+                           GNC_PREF_TAB_POSITION_LEFT,
+                           gnc_main_window_update_tab_position,
+                           window);
+    gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL,
+                           GNC_PREF_TAB_POSITION_RIGHT,
+                           gnc_main_window_update_tab_position,
+                           window);
+    gnc_main_window_update_tab_position(NULL, NULL, window);
+
+    gnc_main_window_init_menu_updaters(window);
+
+    /* Testing */
+    /* Now update the "eXtensions" menu */
+    if (!gnc_prefs_is_extra_enabled())
+    {
+        GtkAction*  action;
+
+        action = gtk_action_group_get_action(priv->action_group,
+                                             "ExtensionsAction");
+        gtk_action_set_visible(action, FALSE);
+    }
+
+    /* GncPluginManager stuff */
+    manager = gnc_plugin_manager_get ();
+    plugins = gnc_plugin_manager_get_plugins (manager);
+    g_list_foreach (plugins, gnc_main_window_add_plugin, window);
+    g_list_free (plugins);
+
+    g_signal_connect (G_OBJECT (manager), "plugin-added",
+                      G_CALLBACK (gnc_main_window_plugin_added), window);
+    g_signal_connect (G_OBJECT (manager), "plugin-removed",
+                      G_CALLBACK (gnc_main_window_plugin_removed), window);
+
+    LEAVE(" ");
+}
+
+#ifdef MAC_INTEGRATION
+/* Event handlers for the shutdown process.  Gnc_quartz_shutdown is
+ * connected to NSApplicationWillTerminate, the last chance to do
+ * anything before quitting. The problem is that it's launched from a
+ * CFRunLoop, not a g_main_loop, and if we call anything that would
+ * affect the main_loop we get an assert that we're in a subidiary
+ * loop.
+ */
+static void
+gnc_quartz_shutdown (GtkosxApplication *theApp, gpointer data)
+{
+    /* Do Nothing. It's too late. */
+}
+/* Should quit responds to NSApplicationBlockTermination; returning
+ * TRUE means "don't terminate", FALSE means "do terminate". If we
+ * decide that it's OK to terminate, then we queue a gnc_shutdown for
+ * the next idle time (because we're not running in the main loop) and
+ * then tell the OS not to terminate. That gives the gnc_shutdown an
+ * opportunity to shut down.
+ */
+static gboolean
+gnc_quartz_should_quit (GtkosxApplication *theApp, GncMainWindow *window)
+{
+    QofSession *session;
+    gboolean needs_save;
+
+    if (!gnc_main_window_all_finish_pending() ||
+            gnc_file_save_in_progress())
+    {
+        return TRUE;
+    }
+    session = gnc_get_current_session();
+    needs_save = qof_book_session_not_saved(qof_session_get_book(session)) &&
+                 !gnc_file_save_in_progress();
+    if (needs_save && gnc_main_window_prompt_for_save(GTK_WIDGET(window)))
+        return TRUE;
+
+    g_timeout_add(250, gnc_main_window_timed_quit, NULL);
+    return TRUE;
+}
+
+static void
+gnc_quartz_set_menu(GncMainWindow* window)
+{
+    GtkosxApplication *theApp = g_object_new(GTKOSX_TYPE_APPLICATION, NULL);
+    GtkWidget       *menu;
+    GtkWidget       *item;
+
+    menu = gtk_ui_manager_get_widget (window->ui_merge, "/menubar");
+    if (GTK_IS_MENU_ITEM (menu))
+        menu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (menu));
+    gtk_widget_hide(menu);
+    gtkosx_application_set_menu_bar (theApp, GTK_MENU_SHELL (menu));
+
+    item = gtk_ui_manager_get_widget (window->ui_merge,
+                                      "/menubar/File/FileQuit");
+    if (GTK_IS_MENU_ITEM (item))
+        gtk_widget_hide (GTK_WIDGET (item));
+
+    item = gtk_ui_manager_get_widget (window->ui_merge,
+                                      "/menubar/Help/HelpAbout");
+    if (GTK_IS_MENU_ITEM (item))
+    {
+        gtkosx_application_insert_app_menu_item (theApp, GTK_WIDGET (item), 0);
+    }
+
+    item = gtk_ui_manager_get_widget (window->ui_merge,
+                                      "/menubar/Edit/EditPreferences");
+    if (GTK_IS_MENU_ITEM (item))
+    {
+        gtkosx_application_insert_app_menu_item (theApp,
+                gtk_separator_menu_item_new (), 1);
+        gtkosx_application_insert_app_menu_item (theApp, GTK_WIDGET (item), 2);
+    }
+
+    item = gtk_ui_manager_get_widget (window->ui_merge,
+                                      "/menubar/Help");
+    gtkosx_application_set_help_menu(theApp, GTK_MENU_ITEM(item));
+    item = gtk_ui_manager_get_widget (window->ui_merge,
+                                      "/menubar/Windows");
+    gtkosx_application_set_window_menu(theApp, GTK_MENU_ITEM(item));
+    g_signal_connect(theApp, "NSApplicationBlockTermination",
+                     G_CALLBACK(gnc_quartz_should_quit), window);
+    gtkosx_application_set_use_quartz_accelerators (theApp, FALSE);
+    g_object_unref (theApp);
+
+}
+#endif //MAC_INTEGRATION
+
+/* Callbacks */
+static void
+gnc_main_window_add_widget (GtkUIManager *merge,
+                            GtkWidget *widget,
+                            GncMainWindow *window)
+{
+    GncMainWindowPrivate *priv;
+
+    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
+    if (GTK_IS_TOOLBAR (widget))
+    {
+        priv->toolbar = widget;
+    }
+
+    gtk_box_pack_start (GTK_BOX (priv->menu_dock), widget, FALSE, FALSE, 0);
+    gtk_widget_show (widget);
+}
+
+/** Should a summary bar be visible in this window?  In order to
+ *  prevent synchronization issues, the "ViewSummaryBar"
+ *  GtkToggleAction is the sole source of information for whether or
+ *  not any summary bar should be visible in a window.
+ *
+ *  @param window A pointer to the window in question.
+ *
+ *  @param action If known, a pointer to the "ViewSummaryBar"
+ *  GtkToggleAction.  If NULL, the function will look up this action.
+ *
+ *  @return TRUE if the summarybar should be visible.
+ */
+static gboolean
+gnc_main_window_show_summarybar (GncMainWindow *window, GtkAction *action)
+{
+    GncMainWindowPrivate *priv;
+
+    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
+    if (action == NULL)
+        action = gtk_action_group_get_action(priv->action_group,
+                                             "ViewSummaryAction");
+    if (action == NULL)
+        return TRUE;
+    return gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action));
+}
+
+/** This function is invoked when the GtkNotebook switches pages.  It
+ *  is responsible for updating the rest of the window contents
+ *  outside of the notebook.  I.E. Updating the user interface, the
+ *  summary bar, etc.  This function also emits the "page_changed"
+ *  signal from the window so that any plugin can also learn about the
+ *  fact that the page has changed.
+ *
+ *  @internal
+ */
+static void
+gnc_main_window_switch_page (GtkNotebook *notebook,
+                             gpointer *notebook_page,
+                             gint pos,
+                             GncMainWindow *window)
+{
+    GncMainWindowPrivate *priv;
+    GtkWidget *child;
+    GncPluginPage *page;
+    gboolean visible;
+
+    ENTER("Notebook %p, page, %p, index %d, window %p",
+          notebook, notebook_page, pos, window);
+    g_return_if_fail (GNC_IS_MAIN_WINDOW (window));
+
+    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
+    if (priv->current_page != NULL)
+    {
+        page = priv->current_page;
+        gnc_plugin_page_unmerge_actions (page, window->ui_merge);
+        gnc_plugin_page_unselected (page);
+    }
+
+    child = gtk_notebook_get_nth_page (notebook, pos);
+    if (child)
+    {
+        page = g_object_get_data (G_OBJECT (child), PLUGIN_PAGE_LABEL);
+    }
+    else
+    {
+        page = NULL;
+    }
+
+    priv->current_page = page;
+
+    if (page != NULL)
+    {
+        /* Update the user interface (e.g. menus and toolbars */
+        gnc_plugin_page_merge_actions (page, window->ui_merge);
+        visible = gnc_main_window_show_summarybar(window, NULL);
+        gnc_plugin_page_show_summarybar (page, visible);
+
+        /* Allow page specific actions */
+        gnc_plugin_page_selected (page);
+        gnc_window_update_status (GNC_WINDOW(window), page);
+
+        /* Update the page reference info */
+        priv->usage_order = g_list_remove (priv->usage_order, page);
+        priv->usage_order = g_list_prepend (priv->usage_order, page);
+    }
+
+    gnc_plugin_update_actions(priv->action_group,
+                              multiple_page_actions,
+                              "sensitive",
+                              g_list_length(priv->installed_pages) > 1);
+
+    gnc_main_window_update_title(window);
+#ifndef MAC_INTEGRATION
+    gnc_main_window_update_menu_item(window);
+#endif
+    g_signal_emit (window, main_window_signals[PAGE_CHANGED], 0, page);
+    LEAVE(" ");
+}
+
+/** This function is invoked when a GtkNotebook tab gets reordered by
+ *  drag and drop. It adjusts the list installed_pages to reflect the new
+ *  ordering so that GnuCash saves and restores the tabs correctly.
+ *
+ *  @internal
+ */
+static void
+gnc_main_window_page_reordered (GtkNotebook *notebook,
+                                GtkWidget *child,
+                                guint pos,
+                                GncMainWindow *window)
+{
+    GncMainWindowPrivate *priv;
+    GncPluginPage *page;
+    GList *old_link;
+
+    ENTER("Notebook %p, child %p, index %d, window %p",
+          notebook, child, pos, window);
+    g_return_if_fail (GNC_IS_MAIN_WINDOW (window));
+
+    if (!child) return;
+
+    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
+
+    page = g_object_get_data (G_OBJECT (child), PLUGIN_PAGE_LABEL);
+    if (!page) return;
+
+    old_link = g_list_find (priv->installed_pages, page);
+    if (!old_link) return;
+
+    priv->installed_pages = g_list_delete_link (priv->installed_pages,
+                            old_link);
+    priv->installed_pages = g_list_insert (priv->installed_pages,
+                                           page, pos);
+
+    LEAVE(" ");
+}
+
+static void
+gnc_main_window_plugin_added (GncPlugin *manager,
+                              GncPlugin *plugin,
+                              GncMainWindow *window)
+{
+    g_return_if_fail (GNC_IS_MAIN_WINDOW (window));
+    g_return_if_fail (GNC_IS_PLUGIN (plugin));
+
+    gnc_plugin_add_to_window (plugin, window, window_type);
+}
+
+static void
+gnc_main_window_plugin_removed (GncPlugin *manager,
+                                GncPlugin *plugin,
+                                GncMainWindow *window)
+{
+    g_return_if_fail (GNC_IS_MAIN_WINDOW (window));
+    g_return_if_fail (GNC_IS_PLUGIN (plugin));
+
+    gnc_plugin_remove_from_window (plugin, window, window_type);
+}
+
+
+/* Command callbacks */
+static void
+gnc_main_window_cmd_page_setup (GtkAction *action,
+                                GncMainWindow *window)
+{
+    GtkWindow *gtk_window;
+
+    g_return_if_fail(GNC_IS_MAIN_WINDOW(window));
+
+    gtk_window = gnc_window_get_gtk_window(GNC_WINDOW(window));
+    gnc_ui_page_setup(gtk_window);
+}
+
+gboolean
+gnc_book_options_dialog_apply_helper(GNCOptionDB * options)
+{
+    QofBook *book = gnc_get_current_book ();
+    gboolean use_split_action_for_num_before =
+        qof_book_use_split_action_for_num_field (book);
+    gboolean use_book_currency_before =
+        gnc_book_use_book_currency (book);
+    gboolean use_split_action_for_num_after;
+    gboolean use_book_currency_after;
+    gboolean return_val = FALSE;
+    GList *results = NULL, *iter;
+
+    if (!options) return return_val;
+
+    results = gnc_option_db_commit (options);
+    for (iter = results; iter; iter = iter->next)
+    {
+        GtkWidget *dialog = gtk_message_dialog_new(NULL,
+                                                   0,
+                                                   GTK_MESSAGE_ERROR,
+                                                   GTK_BUTTONS_OK,
+                                                   "%s",
+                                                   (char*)iter->data);
+        gtk_dialog_run(GTK_DIALOG(dialog));
+        gtk_widget_destroy(dialog);
+        g_free (iter->data);
+    }
+    g_list_free (results);
+    qof_book_begin_edit (book);
+    qof_book_save_options (book, gnc_option_db_save, options, TRUE);
+    use_split_action_for_num_after =
+        qof_book_use_split_action_for_num_field (book);
+    use_book_currency_after = gnc_book_use_book_currency (book);
+    if (use_split_action_for_num_before != use_split_action_for_num_after)
+    {
+        gnc_book_option_num_field_source_change_cb (
+                                                use_split_action_for_num_after);
+        return_val = TRUE;
+    }
+    if (use_book_currency_before != use_book_currency_after)
+    {
+        gnc_book_option_book_currency_selected_cb (use_book_currency_after);
+        return_val = TRUE;
+    }
+    qof_book_commit_edit (book);
+    return return_val;
+}
+
+static void
+gnc_book_options_dialog_apply_cb(GNCOptionWin * optionwin,
+                                 gpointer user_data)
+{
+    GNCOptionDB * options = user_data;
+
+    if (!options) return;
+
+    if (gnc_book_options_dialog_apply_helper (options))
+        gnc_gui_refresh_all ();
+}
+
+static void
+gnc_book_options_dialog_close_cb(GNCOptionWin * optionwin,
+                                 gpointer user_data)
+{
+    GNCOptionDB * options = user_data;
+
+    gnc_options_dialog_destroy(optionwin);
+    gnc_option_db_destroy(options);
+}
+
+static gboolean
+show_handler (const char *class_name, gint component_id,
+              gpointer user_data, gpointer iter_data)
+{
+    GtkWidget *dialog;
+
+    dialog = GTK_WIDGET(user_data);
+    gtk_window_present(GTK_WINDOW(dialog));
+    return(TRUE);
+}
+
+GtkWidget *
+gnc_book_options_dialog_cb (gboolean modal, gchar *title)
+{
+    QofBook *book = gnc_get_current_book ();
+    GNCOptionDB *options;
+    GNCOptionWin *optionwin;
+
+    options = gnc_option_db_new_for_type (QOF_ID_BOOK);
+    qof_book_load_options (book, gnc_option_db_load, options);
+    gnc_option_db_clean (options);
+
+    /* Only allow one Book Options dialog if called from file->properties
+       menu */
+    if (gnc_forall_gui_components(DIALOG_BOOK_OPTIONS_CM_CLASS,
+                                  show_handler, NULL))
+    {
+        return NULL;
+    }
+    optionwin = gnc_options_dialog_new_modal (modal,
+                (title ? title : _( "Book Options")),
+                DIALOG_BOOK_OPTIONS_CM_CLASS);
+    gnc_options_dialog_build_contents (optionwin, options);
+
+    gnc_options_dialog_set_book_options_help_cb (optionwin);
+
+    gnc_options_dialog_set_apply_cb (optionwin,
+                                     gnc_book_options_dialog_apply_cb,
+                                     (gpointer)options);
+    gnc_options_dialog_set_close_cb (optionwin,
+                                     gnc_book_options_dialog_close_cb,
+                                     (gpointer)options);
+    if (modal)
+        gnc_options_dialog_set_new_book_option_values (options);
+    return gnc_options_dialog_widget (optionwin);
+}
+
+static void
+gnc_main_window_cmd_file_properties (GtkAction *action, GncMainWindow *window)
+{
+    gnc_book_options_dialog_cb (FALSE, NULL);
+}
+
+static void
+gnc_main_window_cmd_file_close (GtkAction *action, GncMainWindow *window)
+{
+    GncMainWindowPrivate *priv;
+    GncPluginPage *page;
+
+    g_return_if_fail(GNC_IS_MAIN_WINDOW(window));
+
+    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
+    page = priv->current_page;
+    gnc_main_window_close_page(page);
+}
+
+static void
+gnc_main_window_cmd_file_quit (GtkAction *action, GncMainWindow *window)
+{
+    if (!gnc_main_window_all_finish_pending())
+        return;
+
+    gnc_main_window_quit(window);
+}
+
+static void
+gnc_main_window_cmd_edit_cut (GtkAction *action, GncMainWindow *window)
+{
+    GtkWidget *widget = gtk_window_get_focus (GTK_WINDOW (window));
+    GtkTextBuffer *text_buffer;
+    GtkClipboard *clipboard;
+    gboolean editable;
+
+    if (GTK_IS_EDITABLE (widget))
+    {
+        gtk_editable_cut_clipboard (GTK_EDITABLE (widget));
+    }
+    else if (GTK_IS_TEXT_VIEW (widget))
+    {
+        text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW(widget));
+        clipboard = gtk_widget_get_clipboard (GTK_WIDGET(text_buffer),
+                                              GDK_SELECTION_CLIPBOARD);
+        editable = gtk_text_view_get_editable (GTK_TEXT_VIEW (widget));
+        gtk_text_buffer_cut_clipboard (text_buffer, clipboard, editable);
+    }
+}
+
+static void
+gnc_main_window_cmd_edit_copy (GtkAction *action, GncMainWindow *window)
+{
+    GtkWidget *widget = gtk_window_get_focus (GTK_WINDOW (window));
+    GtkTextBuffer *text_buffer;
+    GtkClipboard *clipboard;
+
+    if (GTK_IS_EDITABLE (widget))
+    {
+        gtk_editable_copy_clipboard (GTK_EDITABLE (widget));
+    }
+    else if (GTK_IS_TEXT_VIEW (widget))
+    {
+        text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW(widget));
+        clipboard = gtk_widget_get_clipboard (GTK_WIDGET(text_buffer),
+                                              GDK_SELECTION_CLIPBOARD);
+        gtk_text_buffer_copy_clipboard (text_buffer, clipboard);
+    }
+}
+
+static void
+gnc_main_window_cmd_edit_paste (GtkAction *action, GncMainWindow *window)
+{
+    GtkWidget *widget = gtk_window_get_focus (GTK_WINDOW (window));
+    GtkTextBuffer *text_buffer;
+    GtkClipboard *clipboard;
+
+    if (GTK_IS_EDITABLE (widget))
+    {
+        gtk_editable_paste_clipboard (GTK_EDITABLE (widget));
+    }
+    else if (GTK_IS_TEXT_VIEW (widget))
+    {
+        text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW(widget));
+        clipboard = gtk_widget_get_clipboard (GTK_WIDGET(text_buffer),
+                                              GDK_SELECTION_CLIPBOARD);
+        gtk_text_buffer_paste_clipboard (text_buffer, clipboard, NULL, FALSE);
+    }
+}
+
+static void
+gnc_main_window_cmd_edit_preferences (GtkAction *action, GncMainWindow *window)
+{
+    gnc_preferences_dialog ();
+}
+
+static void
+gnc_main_window_cmd_view_refresh (GtkAction *action, GncMainWindow *window)
+{
+}
+
+static void
+gnc_main_window_cmd_actions_reset_warnings (GtkAction *action, GncMainWindow *window)
+{
+    gnc_reset_warnings_dialog(GTK_WINDOW(window));
+}
+
+static void
+gnc_main_window_cmd_actions_rename_page (GtkAction *action, GncMainWindow *window)
+{
+    GncMainWindowPrivate *priv;
+    GncPluginPage *page;
+    GtkWidget *label, *entry;
+
+    ENTER(" ");
+    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
+    page = priv->current_page;
+    if (!page)
+    {
+        LEAVE("No current page");
+        return;
+    }
+
+    if (!main_window_find_tab_items(window, page, &label, &entry))
+    {
+        LEAVE("can't find required widgets");
+        return;
+    }
+
+    gtk_entry_set_text(GTK_ENTRY(entry), gtk_label_get_text(GTK_LABEL(label)));
+    gtk_editable_select_region(GTK_EDITABLE(entry), 0, -1);
+    gtk_widget_hide(label);
+    gtk_widget_show(entry);
+    gtk_widget_grab_focus(entry);
+    LEAVE("opened for editing");
+}
+
+static void
+gnc_main_window_cmd_view_toolbar (GtkAction *action, GncMainWindow *window)
+{
+    GncMainWindowPrivate *priv;
+
+    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
+    if (gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action)))
+    {
+        gtk_widget_show (priv->toolbar);
+    }
+    else
+    {
+        gtk_widget_hide (priv->toolbar);
+    }
+}
+
+static void
+gnc_main_window_cmd_view_summary (GtkAction *action, GncMainWindow *window)
+{
+    GncMainWindowPrivate *priv;
+    GList *item;
+    gboolean visible;
+
+    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
+    visible = gnc_main_window_show_summarybar(window, action);
+    for (item = priv->installed_pages; item; item = g_list_next(item))
+    {
+        gnc_plugin_page_show_summarybar(item->data, visible);
+    }
+}
+
+static void
+gnc_main_window_cmd_view_statusbar (GtkAction *action, GncMainWindow *window)
+{
+    GncMainWindowPrivate *priv;
+
+    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
+    if (gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action)))
+    {
+        gtk_widget_show (priv->statusbar);
+    }
+    else
+    {
+        gtk_widget_hide (priv->statusbar);
+    }
+}
+
+static void
+gnc_main_window_cmd_window_new (GtkAction *action, GncMainWindow *window)
+{
+    GncMainWindow *new_window;
+
+    /* Create the new window */
+    ENTER(" ");
+    new_window = gnc_main_window_new ();
+    gtk_widget_show(GTK_WIDGET(new_window));
+    LEAVE(" ");
+}
+
+static void
+gnc_main_window_cmd_window_move_page (GtkAction *action, GncMainWindow *window)
+{
+    GncMainWindowPrivate *priv;
+    GncMainWindow *new_window;
+    GncPluginPage *page;
+    GtkNotebook *notebook;
+    GtkWidget *tab_widget, *menu_widget;
+
+    ENTER("action %p,window %p", action, window);
+
+    /* Setup */
+    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
+    page = priv->current_page;
+    if (!page)
+    {
+        LEAVE("invalid page");
+        return;
+    }
+    if (!page->notebook_page)
+    {
+        LEAVE("invalid notebook_page");
+        return;
+    }
+
+    notebook = GTK_NOTEBOOK (priv->notebook);
+    tab_widget = gtk_notebook_get_tab_label (notebook, page->notebook_page);
+    menu_widget = gtk_notebook_get_menu_label (notebook, page->notebook_page);
+
+    /* Ref the page components, then remove it from its old window */
+    g_object_ref(page);
+    g_object_ref(tab_widget);
+    g_object_ref(menu_widget);
+    g_object_ref(page->notebook_page);
+    gnc_main_window_disconnect(window, page);
+
+    /* Create the new window */
+    new_window = gnc_main_window_new ();
+    gtk_widget_show(GTK_WIDGET(new_window));
+
+    /* Now add the page to the new window */
+    gnc_main_window_connect (new_window, page, tab_widget, menu_widget);
+
+    /* Unref the page components now that we're done */
+    g_object_unref(page->notebook_page);
+    g_object_unref(menu_widget);
+    g_object_unref(tab_widget);
+    g_object_unref(page);
+
+    /* just a little debugging. :-) */
+    DEBUG("Moved page %p from window %p to new window %p",
+          page, window, new_window);
+    DEBUG("Old window current is %p, new window current is %p",
+          priv->current_page, priv->current_page);
+
+    LEAVE("page moved");
+}
+
+#ifndef MAC_INTEGRATION
+static void
+gnc_main_window_cmd_window_raise (GtkAction *action,
+                                  GtkRadioAction *current,
+                                  GncMainWindow *old_window)
+{
+    GncMainWindow *new_window;
+    gint value;
+
+    g_return_if_fail(GTK_IS_ACTION(action));
+    g_return_if_fail(GTK_IS_RADIO_ACTION(current));
+    g_return_if_fail(GNC_IS_MAIN_WINDOW(old_window));
+
+    ENTER("action %p, current %p, window %p", action, current, old_window);
+    value = gtk_radio_action_get_current_value(current);
+    new_window = g_list_nth_data(active_windows, value);
+    gtk_window_present(GTK_WINDOW(new_window));
+    /* revert the change in the radio group
+     * impossible while handling "changed" (G_SIGNAL_NO_RECURSE) */
+    g_idle_add((GSourceFunc)gnc_main_window_update_radio_button, old_window);
+    LEAVE(" ");
+}
+#endif /* !MAC_INTEGRATION */
+
+static void
+gnc_main_window_cmd_help_tutorial (GtkAction *action, GncMainWindow *window)
+{
+    gnc_gnome_help (HF_GUIDE, NULL);
+}
+
+static void
+gnc_main_window_cmd_help_contents (GtkAction *action, GncMainWindow *window)
+{
+    gnc_gnome_help (HF_HELP, NULL);
+}
+
+/** This is a helper function to find a data file and suck it into
+ *  memory.
+ *
+ *  @param partial The name of the file relative to the gnucash
+ *  specific shared data directory.
+ *
+ *  @return The text of the file or NULL. The caller is responsible
+ *  for freeing this string.
+ */
+static gchar *
+get_file (const gchar *partial)
+{
+    gchar *filename, *text = NULL;
+    gsize length;
+
+    filename = gnc_filepath_locate_doc_file(partial);
+    if (filename && g_file_get_contents(filename, &text, &length, NULL))
+    {
+	if (length)
+	{
+	    g_free(filename);
+	    return text;
+	}
+        g_free(text);
+    }
+    g_free (filename);
+    return NULL;
+}
+
+
+/** This is a helper function to find a data file, suck it into
+ *  memory, and split it into an array of strings.
+ *
+ *  @param partial The name of the file relative to the gnucash
+ *  specific shared data directory.
+ *
+ *  @return The text of the file as an array of strings, or NULL. The
+ *  caller is responsible for freeing all the strings and the array.
+ */
+static gchar **
+get_file_strsplit (const gchar *partial)
+{
+    gchar *text, **lines;
+
+    text = get_file(partial);
+    if (!text)
+        return NULL;
+
+    lines = g_strsplit_set(text, "\r\n", -1);
+    g_free(text);
+    return lines;
+}
+/** URL activation callback.
+ *  Use our own function to activate the URL in the users browser
+ *  instead of gtk_show_uri(), which requires gvfs.
+ *  Signature described in gtk docs at GtkAboutDialog activate-link signal.
+ */
+
+static gboolean
+url_signal_cb (GtkAboutDialog *dialog, gchar *uri, gpointer data)
+{
+    gnc_launch_assoc (uri);
+    return TRUE;
+}
+
+/** Create and display the "about" dialog for gnucash.
+ *
+ *  @param action The GtkAction for the "about" menu item.
+ *
+ *  @param window The main window whose menu item was activated.
+ */
+static void
+gnc_main_window_cmd_help_about (GtkAction *action, GncMainWindow *window)
+{
+    GncMainWindowPrivate *priv;
+
+    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
+
+    if (priv->about_dialog == NULL)
+    {
+	const gchar *fixed_message = _("The GnuCash personal finance manager. "
+                                   "The GNU way to manage your money!");
+	const gchar *copyright = _("© 1997-2017 Contributors");
+	gchar **authors = get_file_strsplit("AUTHORS");
+	gchar **documenters = get_file_strsplit("DOCUMENTERS");
+	gchar *license = get_file("LICENSE");
+	gchar *message;
+        GtkIconTheme *icon_theme = gtk_icon_theme_get_default ();
+	GdkPixbuf *logo = gtk_icon_theme_load_icon (icon_theme,
+                                                    GNC_ICON_APP,
+                                                    48,
+                                                    GTK_ICON_LOOKUP_USE_BUILTIN,
+                                                    NULL);
+
+
+#ifdef GNUCASH_SCM
+    /* Development version */
+    /* Translators: 1st %s is a fixed message, which is translated independently;
+                    2nd %s is the scm type (svn/svk/git/bzr);
+                    3rd %s is the scm revision number;
+                    4th %s is the build date */
+	message = g_strdup_printf(_("%s\nThis copy was built from %s rev %s on %s."),
+				  fixed_message, GNUCASH_SCM, GNUCASH_SCM_REV,
+				  GNUCASH_BUILD_DATE);
+#else
+    /* Translators: 1st %s is a fixed message, which is translated independently;
+                    2nd %s is the scm (svn/svk/git/bzr) revision number;
+                    3rd %s is the build date */
+	message = g_strdup_printf(_("%s\nThis copy was built from rev %s on %s."),
+				  fixed_message, GNUCASH_SCM_REV,
+				  GNUCASH_BUILD_DATE);
+#endif
+	priv->about_dialog = gtk_about_dialog_new ();
+	g_object_set (priv->about_dialog,
+		      "authors", authors,
+		      "documenters", documenters,
+		      "comments", message,
+		      "copyright", copyright,
+		      "license", license,
+		      "logo", logo,
+		      "name", "GnuCash",
+     /* Translators: the following string will be shown in Help->About->Credits
+      * Enter your name or that of your team and an email contact for feedback.
+      * The string can have multiple rows, so you can also add a list of
+      * contributors. */
+		      "translator-credits", _("translator_credits"),
+		      "version", VERSION,
+		      "website", "http://www.gnucash.org",
+		      NULL);
+
+	g_free(message);
+	if (license)     g_free(license);
+	if (documenters) g_strfreev(documenters);
+	if (authors)     g_strfreev(authors);
+	g_object_unref (logo);
+	g_signal_connect (priv->about_dialog, "activate-link",
+			  G_CALLBACK (url_signal_cb), NULL);
+	g_signal_connect (priv->about_dialog, "response",
+			  G_CALLBACK (gtk_widget_hide), NULL);
+
+        /* Set dialog to resize. */
+        gtk_window_set_resizable(GTK_WINDOW(priv->about_dialog), TRUE);
+
+	gtk_window_set_transient_for (GTK_WINDOW (priv->about_dialog),
+				      GTK_WINDOW (window));
+    }
+    gtk_dialog_run (GTK_DIALOG (priv->about_dialog));
+}
+
+
+/************************************************************
+ *                                                          *
+ ************************************************************/
+
+void
+gnc_main_window_show_all_windows(void)
+{
+    GList *window_iter;
+#ifdef MAC_INTEGRATION
+    GtkosxApplication *theApp = g_object_new(GTKOSX_TYPE_APPLICATION, NULL);
+#endif
+    for (window_iter = active_windows; window_iter != NULL; window_iter = window_iter->next)
+    {
+        gtk_widget_show(GTK_WIDGET(window_iter->data));
+    }
+#ifdef MAC_INTEGRATION
+    g_signal_connect(theApp, "NSApplicationWillTerminate",
+                     G_CALLBACK(gnc_quartz_shutdown), NULL);
+    gtkosx_application_ready(theApp);
+    g_object_unref (theApp);
+#endif
+}
+
+/** Get a pointer to the first active top level window or NULL
+ *  if there is none.
+ *
+ *  @return A pointer to a GtkWindow object. */
+GtkWidget *
+gnc_ui_get_toplevel (void)
+{
+    GList *window;
+
+    for (window = active_windows; window; window = window->next)
+        if (gtk_window_is_active (GTK_WINDOW (window->data)))
+            return window->data;
+
+    return NULL;
+}
+
+
+/** Retrieve the gtk window associated with a main window object.
+ *  This function is called via a vector off a generic window
+ *  interface.
+ *
+ *  @param window A pointer to a generic window. */
+static GtkWindow *
+gnc_main_window_get_gtk_window (GncWindow *window)
+{
+    g_return_val_if_fail (GNC_IS_MAIN_WINDOW (window), NULL);
+    return GTK_WINDOW(window);
+}
+
+
+/** Retrieve the status bar associated with a main window object.
+ *  This function is called via a vector off a generic window
+ *  interface.
+ *
+ *  @param window_in A pointer to a generic window. */
+static GtkWidget *
+gnc_main_window_get_statusbar (GncWindow *window_in)
+{
+    GncMainWindowPrivate *priv;
+    GncMainWindow *window;
+
+    g_return_val_if_fail (GNC_IS_MAIN_WINDOW (window_in), NULL);
+
+    window = GNC_MAIN_WINDOW(window_in);
+    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
+    return priv->statusbar;
+}
+
+
+/** Retrieve the progress bar associated with a main window object.
+ *  This function is called via a vector off a generic window
+ *  interface.
+ *
+ *  @param window_in A pointer to a generic window. */
+static GtkWidget *
+gnc_main_window_get_progressbar (GncWindow *window_in)
+{
+    GncMainWindowPrivate *priv;
+    GncMainWindow *window;
+
+    g_return_val_if_fail (GNC_IS_MAIN_WINDOW (window_in), NULL);
+
+    window = GNC_MAIN_WINDOW(window_in);
+    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
+    return priv->progressbar;
+}
+
+
+static void
+gnc_main_window_all_ui_set_sensitive (GncWindow *unused, gboolean sensitive)
+{
+    GncMainWindow *window;
+    GncMainWindowPrivate *priv;
+    GList *groupp, *groups, *winp, *tmp;
+    GtkWidget *close_button;
+
+    for (winp = active_windows; winp; winp = g_list_next(winp))
+    {
+        window = winp->data;
+        priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
+
+        groups = gtk_ui_manager_get_action_groups(window->ui_merge);
+        for (groupp = groups; groupp; groupp = g_list_next(groupp))
+        {
+            gtk_action_group_set_sensitive(GTK_ACTION_GROUP(groupp->data), sensitive);
+        }
+
+        for (tmp = priv->installed_pages; tmp; tmp = g_list_next(tmp))
+        {
+            close_button = g_object_get_data(tmp->data, PLUGIN_PAGE_CLOSE_BUTTON);
+            if (!close_button)
+                continue;
+            gtk_widget_set_sensitive (close_button, sensitive);
+        }
+    }
+}
+
+
+/** Initialize the generic window interface for a main window.
+ *
+ *  @param iface A pointer to the interface data structure to
+ *  populate. */
+static void
+gnc_window_main_window_init (GncWindowIface *iface)
+{
+    iface->get_gtk_window  = gnc_main_window_get_gtk_window;
+    iface->get_statusbar   = gnc_main_window_get_statusbar;
+    iface->get_progressbar = gnc_main_window_get_progressbar;
+    iface->ui_set_sensitive = gnc_main_window_all_ui_set_sensitive;
+}
+
+
+/*  Set the window where all progressbar updates should occur.  This
+ *  is a wrapper around the gnc_window_set_progressbar_window()
+ *  function.
+ */
+void
+gnc_main_window_set_progressbar_window (GncMainWindow *window)
+{
+    GncWindow *gncwin;
+    gncwin = GNC_WINDOW(window);
+    gnc_window_set_progressbar_window(gncwin);
+}
+
+
+/** Popup a contextual menu.  This function ends up being called when
+ *  the user right-clicks in the context of a window, or uses the
+ *  keyboard context-menu request key combination (Shift-F10 by
+ *  default).
+ *
+ *  @param page This is the GncPluginPage corresponding to the visible
+ *  page.
+ *
+ *  @param event The event parameter passed to the "button-press"
+ *  callback.  May be null if there was no event (aka keyboard
+ *  request).
+ */
+static void
+do_popup_menu(GncPluginPage *page, GdkEventButton *event)
+{
+    GtkUIManager *ui_merge;
+    GtkWidget *menu;
+    int button, event_time;
+
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE(page));
+
+    ENTER("page %p, event %p", page, event);
+    ui_merge = gnc_plugin_page_get_ui_merge(page);
+    if (ui_merge == NULL)
+    {
+        LEAVE("no ui merge");
+        return;
+    }
+
+    menu = gtk_ui_manager_get_widget(ui_merge, "/MainPopup");
+    if (!menu)
+    {
+        LEAVE("no menu");
+        return;
+    }
+
+    if (event)
+    {
+        button = event->button;
+        event_time = event->time;
+    }
+    else
+    {
+        button = 0;
+        event_time = gtk_get_current_event_time ();
+    }
+#if GTK_CHECK_VERSION(3,22,0)
+    gtk_menu_popup_at_pointer (GTK_MENU(menu), (GdkEvent *) event);
+#else
+    gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, button, event_time);
+#endif
+    LEAVE(" ");
+}
+
+
+/** Callback function invoked when the user requests that Gnucash
+ *  popup the contextual menu via the keyboard context-menu request
+ *  key combination (Shift-F10 by default).
+ *
+ *  @param page This is the GncPluginPage corresponding to the visible
+ *  page.
+ *
+ *  @param widget Whatever widget had focus when the user issued the
+ *  keyboard context-menu request.
+ *
+ *  @return Always returns TRUE to indicate that the menu request was
+ *  handled.
+ */
+static gboolean
+gnc_main_window_popup_menu_cb (GtkWidget *widget,
+                               GncPluginPage *page)
+{
+    ENTER("widget %p, page %p", widget, page);
+    do_popup_menu(page, NULL);
+    LEAVE(" ");
+    return TRUE;
+}
+
+
+/*  Callback function invoked when the user clicks in the content of
+ *  any Gnucash window.  If this was a "right-click" then Gnucash will
+ *  popup the contextual menu.
+ */
+gboolean
+gnc_main_window_button_press_cb (GtkWidget *whatever,
+                                 GdkEventButton *event,
+                                 GncPluginPage *page)
+{
+    g_return_val_if_fail(GNC_IS_PLUGIN_PAGE(page), FALSE);
+
+    ENTER("widget %p, event %p, page %p", whatever, event, page);
+    /* Ignore double-clicks and triple-clicks */
+    if (event->button == 3 && event->type == GDK_BUTTON_PRESS)
+    {
+        do_popup_menu(page, event);
+        LEAVE("menu shown");
+        return TRUE;
+    }
+
+    LEAVE("other click");
+    return FALSE;
+}
+
+
+/* CS: Code copied from gtk/gtkactiongroup.c */
+static gchar *
+dgettext_swapped (const gchar *msgid,
+                  const gchar *domainname)
+{
+    /* CS: Pass this through dgettext if and only if msgid is
+       nonempty. */
+    return (msgid && *msgid) ? dgettext (domainname, msgid) : (gchar*) msgid;
+}
+
+/*
+ * This is copied into GnuCash from Gtk in order to fix problems when
+ * empty msgids were passed through gettext().
+ *
+ * See http://bugzilla.gnome.org/show_bug.cgi?id=326200 . If that bug
+ * is fixed in the gtk that we can rely open, then
+ * gnc_gtk_action_group_set_translation_domain can be replaced by
+ * gtk_action_group_set_translation_domain again.
+ */
+void
+gnc_gtk_action_group_set_translation_domain (GtkActionGroup *action_group,
+        const gchar    *domain)
+{
+    g_return_if_fail (GTK_IS_ACTION_GROUP (action_group));
+
+    gtk_action_group_set_translate_func (action_group,
+                                         (GtkTranslateFunc)dgettext_swapped,
+                                         g_strdup (domain),
+                                         g_free);
+}
+/* CS: End of code copied from gtk/gtkactiongroup.c */
+
+void
+gnc_main_window_all_action_set_sensitive (const gchar *action_name,
+        gboolean sensitive)
+{
+    GList *tmp;
+    GtkAction *action;
+
+    for (tmp = active_windows; tmp; tmp = g_list_next(tmp))
+    {
+        action = gnc_main_window_find_action (tmp->data, action_name);
+        gtk_action_set_sensitive (action, sensitive);
+    }
+}
+
+GtkUIManager *gnc_main_window_get_uimanager (GncMainWindow *window)
+{
+    g_assert(window);
+    return window->ui_merge;
+}
+
+/** @} */
+/** @} */
diff --git a/src/gnome-utils/gnc-main-window.h b/gnucash/gnome-utils/gnc-main-window.h
similarity index 100%
rename from src/gnome-utils/gnc-main-window.h
rename to gnucash/gnome-utils/gnc-main-window.h
diff --git a/src/gnome-utils/gnc-menu-extensions.c b/gnucash/gnome-utils/gnc-menu-extensions.c
similarity index 100%
rename from src/gnome-utils/gnc-menu-extensions.c
rename to gnucash/gnome-utils/gnc-menu-extensions.c
diff --git a/src/gnome-utils/gnc-menu-extensions.h b/gnucash/gnome-utils/gnc-menu-extensions.h
similarity index 100%
rename from src/gnome-utils/gnc-menu-extensions.h
rename to gnucash/gnome-utils/gnc-menu-extensions.h
diff --git a/src/gnome-utils/gnc-menu-extensions.scm b/gnucash/gnome-utils/gnc-menu-extensions.scm
similarity index 100%
rename from src/gnome-utils/gnc-menu-extensions.scm
rename to gnucash/gnome-utils/gnc-menu-extensions.scm
diff --git a/src/gnome-utils/gnc-period-select.c b/gnucash/gnome-utils/gnc-period-select.c
similarity index 100%
rename from src/gnome-utils/gnc-period-select.c
rename to gnucash/gnome-utils/gnc-period-select.c
diff --git a/src/gnome-utils/gnc-period-select.h b/gnucash/gnome-utils/gnc-period-select.h
similarity index 100%
rename from src/gnome-utils/gnc-period-select.h
rename to gnucash/gnome-utils/gnc-period-select.h
diff --git a/src/gnome-utils/gnc-plugin-file-history.c b/gnucash/gnome-utils/gnc-plugin-file-history.c
similarity index 100%
rename from src/gnome-utils/gnc-plugin-file-history.c
rename to gnucash/gnome-utils/gnc-plugin-file-history.c
diff --git a/src/gnome-utils/gnc-plugin-file-history.h b/gnucash/gnome-utils/gnc-plugin-file-history.h
similarity index 100%
rename from src/gnome-utils/gnc-plugin-file-history.h
rename to gnucash/gnome-utils/gnc-plugin-file-history.h
diff --git a/src/gnome-utils/gnc-plugin-manager.c b/gnucash/gnome-utils/gnc-plugin-manager.c
similarity index 100%
rename from src/gnome-utils/gnc-plugin-manager.c
rename to gnucash/gnome-utils/gnc-plugin-manager.c
diff --git a/src/gnome-utils/gnc-plugin-manager.h b/gnucash/gnome-utils/gnc-plugin-manager.h
similarity index 100%
rename from src/gnome-utils/gnc-plugin-manager.h
rename to gnucash/gnome-utils/gnc-plugin-manager.h
diff --git a/src/gnome-utils/gnc-plugin-menu-additions.c b/gnucash/gnome-utils/gnc-plugin-menu-additions.c
similarity index 100%
rename from src/gnome-utils/gnc-plugin-menu-additions.c
rename to gnucash/gnome-utils/gnc-plugin-menu-additions.c
diff --git a/src/gnome-utils/gnc-plugin-menu-additions.h b/gnucash/gnome-utils/gnc-plugin-menu-additions.h
similarity index 100%
rename from src/gnome-utils/gnc-plugin-menu-additions.h
rename to gnucash/gnome-utils/gnc-plugin-menu-additions.h
diff --git a/src/gnome-utils/gnc-plugin-page.c b/gnucash/gnome-utils/gnc-plugin-page.c
similarity index 100%
rename from src/gnome-utils/gnc-plugin-page.c
rename to gnucash/gnome-utils/gnc-plugin-page.c
diff --git a/src/gnome-utils/gnc-plugin-page.h b/gnucash/gnome-utils/gnc-plugin-page.h
similarity index 100%
rename from src/gnome-utils/gnc-plugin-page.h
rename to gnucash/gnome-utils/gnc-plugin-page.h
diff --git a/src/gnome-utils/gnc-plugin.c b/gnucash/gnome-utils/gnc-plugin.c
similarity index 100%
rename from src/gnome-utils/gnc-plugin.c
rename to gnucash/gnome-utils/gnc-plugin.c
diff --git a/src/gnome-utils/gnc-plugin.h b/gnucash/gnome-utils/gnc-plugin.h
similarity index 100%
rename from src/gnome-utils/gnc-plugin.h
rename to gnucash/gnome-utils/gnc-plugin.h
diff --git a/src/gnome-utils/gnc-query-view.c b/gnucash/gnome-utils/gnc-query-view.c
similarity index 100%
rename from src/gnome-utils/gnc-query-view.c
rename to gnucash/gnome-utils/gnc-query-view.c
diff --git a/src/gnome-utils/gnc-query-view.h b/gnucash/gnome-utils/gnc-query-view.h
similarity index 100%
rename from src/gnome-utils/gnc-query-view.h
rename to gnucash/gnome-utils/gnc-query-view.h
diff --git a/src/gnome-utils/gnc-recurrence.c b/gnucash/gnome-utils/gnc-recurrence.c
similarity index 100%
rename from src/gnome-utils/gnc-recurrence.c
rename to gnucash/gnome-utils/gnc-recurrence.c
diff --git a/src/gnome-utils/gnc-recurrence.h b/gnucash/gnome-utils/gnc-recurrence.h
similarity index 100%
rename from src/gnome-utils/gnc-recurrence.h
rename to gnucash/gnome-utils/gnc-recurrence.h
diff --git a/gnucash/gnome-utils/gnc-splash.c b/gnucash/gnome-utils/gnc-splash.c
new file mode 100644
index 0000000..83a9f96
--- /dev/null
+++ b/gnucash/gnome-utils/gnc-splash.c
@@ -0,0 +1,209 @@
+/********************************************************************\
+ * gnc-splash.c -- splash screen for GnuCash                        *
+ * Copyright (C) 2001 Gnumatic, 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 at gnu.org                   *
+\********************************************************************/
+
+#include "config.h"
+
+#include <gtk/gtk.h>
+#include <glib/gi18n.h>
+
+#include "gnc-gnome-utils.h"
+#include "gnc-splash.h"
+#include "gnc-version.h"
+#include "gnc-prefs.h"
+#include "dialog-utils.h"
+
+#define MARKUP_STRING "<span size='small'>%s</span>"
+#define GNC_PREF_SHOW_SPLASH "show-splash-screen"
+
+static GtkWidget * splash = NULL;
+static GtkWidget * progress = NULL;
+static GtkWidget * progress_bar = NULL;
+
+static void
+splash_destroy_cb (GtkWidget *object, gpointer user_data)
+{
+    splash = NULL;
+}
+
+static gboolean
+button_press_cb(GtkWidget *widget, GdkEventButton *event, gpointer unused)
+{
+    gnc_destroy_splash_screen();
+    return TRUE;
+}
+
+void
+gnc_show_splash_screen (void)
+{
+    GtkWidget *pixmap;
+    GtkWidget *frame;
+    GtkWidget *vbox;
+    GtkWidget *hbox;
+    GtkWidget *version;
+    GtkWidget *separator;
+    gchar *ver_string, *markup;
+
+    if (splash) return;
+    if (!gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL, GNC_PREF_SHOW_SPLASH)) return;
+
+    splash = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+    gtk_window_set_decorated(GTK_WINDOW (splash), FALSE);
+    gtk_window_set_skip_taskbar_hint (GTK_WINDOW (splash), TRUE);
+
+    // Set the style context for this dialog so it can be easily manipulated with css
+    gnc_widget_set_style_context (GTK_WIDGET(splash), "GncSplash");
+
+    g_signal_connect (splash, "destroy",
+                      G_CALLBACK (splash_destroy_cb), NULL);
+
+    gtk_window_set_title (GTK_WINDOW (splash), "GnuCash");
+    gtk_window_set_position (GTK_WINDOW (splash), GTK_WIN_POS_CENTER);
+    gtk_window_set_type_hint (GTK_WINDOW (splash), GDK_WINDOW_TYPE_HINT_DIALOG);
+
+    pixmap = gnc_gnome_get_pixmap ("gnucash_splash.png");
+
+    if (!pixmap)
+    {
+        g_warning ("can't find splash pixmap");
+        gtk_widget_destroy (splash);
+        return;
+    }
+
+    frame = gtk_frame_new (NULL);
+    vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
+    gtk_box_set_homogeneous (GTK_BOX (vbox), FALSE);
+    hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 3);
+    gtk_box_set_homogeneous (GTK_BOX (hbox), FALSE);
+#ifdef GNUCASH_SCM
+    /* Development version */
+    /* Translators: 1st %s is the GnuCash version (eg 2.4.11);
+                    2nd %s is the scm type (svn/svk/git/bzr);
+                    3rd %s is the scm revision number;
+                    4th %s is the build date */
+    ver_string = g_strdup_printf(_("Version: GnuCash-%s %s (rev %s built %s)"),
+                                 VERSION, GNUCASH_SCM, GNUCASH_SCM_REV,
+                                 GNUCASH_BUILD_DATE);
+#else
+    /* Dist Tarball */
+    /* Translators: 1st %s is the GnuCash version (eg 2.4.11);
+                    2nd %s is the scm (svn/svk/git/bzr) revision number;
+                    3rd %s is the build date */
+    ver_string = g_strdup_printf(_("Version: GnuCash-%s (rev %s built %s)"),
+                                 VERSION, GNUCASH_SCM_REV, GNUCASH_BUILD_DATE);
+#endif
+
+    version = gtk_label_new(NULL);
+    markup = g_markup_printf_escaped(MARKUP_STRING, ver_string);
+    gtk_label_set_markup(GTK_LABEL(version), markup);
+    g_free(markup);
+    g_free(ver_string);
+    separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
+
+    progress = gtk_label_new(NULL);
+    /* the set_max_width avoids "bumping" of the splash screen
+       if a long string is given in gnc_update_splash_screen();
+       presumably it would be better to inhibit size change of the
+       top level container, but I don't know how to do this */
+    gtk_label_set_max_width_chars(GTK_LABEL(progress), 34);
+    markup = g_markup_printf_escaped(MARKUP_STRING, _("Loading..."));
+    gtk_label_set_markup(GTK_LABEL(progress), markup);
+    g_free(markup);
+
+    progress_bar = gtk_progress_bar_new ();
+
+    gtk_container_add (GTK_CONTAINER (frame), pixmap);
+    gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
+    gtk_box_pack_start (GTK_BOX (vbox), version, FALSE, FALSE, 0);
+    gtk_box_pack_start (GTK_BOX (vbox), separator, FALSE, FALSE, 0);
+    gtk_box_pack_start (GTK_BOX (hbox), progress, TRUE, TRUE, 0);
+    gtk_box_pack_start (GTK_BOX (hbox), progress_bar, FALSE, FALSE, 0);
+    gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
+    gtk_container_add (GTK_CONTAINER (splash), vbox);
+
+    gtk_widget_add_events(splash, GDK_BUTTON_PRESS_MASK);
+    g_signal_connect(splash, "button_press_event",
+                     G_CALLBACK(button_press_cb), NULL);
+
+    gtk_window_set_auto_startup_notification (FALSE);
+    gtk_widget_show_all (splash);
+    gtk_window_set_auto_startup_notification (TRUE);
+
+    /* make sure splash is up */
+    while (gtk_events_pending ())
+        gtk_main_iteration ();
+}
+
+void
+gnc_destroy_splash_screen (void)
+{
+    if (splash)
+    {
+        gtk_widget_destroy (splash);
+        progress = NULL;
+        progress_bar = NULL;
+        splash = NULL;
+    }
+}
+
+void
+gnc_update_splash_screen (const gchar *string, double percentage)
+{
+    gchar *markup;
+
+    if (progress)
+    {
+        if (string && strcmp(string, ""))
+        {
+            markup = g_markup_printf_escaped(MARKUP_STRING, string);
+            gtk_label_set_markup (GTK_LABEL(progress), markup);
+            g_free (markup);
+
+            /* make sure new text is up */
+            while (gtk_events_pending ())
+                gtk_main_iteration ();
+        }
+    }
+
+    if (progress_bar)
+    {
+        if (percentage < 0)
+        {
+            gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progress_bar), 0.0);
+        }
+        else
+        {
+            if (percentage <= 100)
+            {
+                gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progress_bar),
+                                              percentage / 100);
+            }
+            else
+            {
+                gtk_progress_bar_pulse(GTK_PROGRESS_BAR(progress_bar));
+            }
+        }
+
+        /* make sure new status bar is up */
+        while (gtk_events_pending ())
+            gtk_main_iteration ();
+    }
+}
diff --git a/src/gnome-utils/gnc-splash.h b/gnucash/gnome-utils/gnc-splash.h
similarity index 100%
rename from src/gnome-utils/gnc-splash.h
rename to gnucash/gnome-utils/gnc-splash.h
diff --git a/src/gnome-utils/gnc-sx-instance-dense-cal-adapter.c b/gnucash/gnome-utils/gnc-sx-instance-dense-cal-adapter.c
similarity index 100%
rename from src/gnome-utils/gnc-sx-instance-dense-cal-adapter.c
rename to gnucash/gnome-utils/gnc-sx-instance-dense-cal-adapter.c
diff --git a/src/gnome-utils/gnc-sx-instance-dense-cal-adapter.h b/gnucash/gnome-utils/gnc-sx-instance-dense-cal-adapter.h
similarity index 100%
rename from src/gnome-utils/gnc-sx-instance-dense-cal-adapter.h
rename to gnucash/gnome-utils/gnc-sx-instance-dense-cal-adapter.h
diff --git a/src/gnome-utils/gnc-sx-list-tree-model-adapter.c b/gnucash/gnome-utils/gnc-sx-list-tree-model-adapter.c
similarity index 100%
rename from src/gnome-utils/gnc-sx-list-tree-model-adapter.c
rename to gnucash/gnome-utils/gnc-sx-list-tree-model-adapter.c
diff --git a/src/gnome-utils/gnc-sx-list-tree-model-adapter.h b/gnucash/gnome-utils/gnc-sx-list-tree-model-adapter.h
similarity index 100%
rename from src/gnome-utils/gnc-sx-list-tree-model-adapter.h
rename to gnucash/gnome-utils/gnc-sx-list-tree-model-adapter.h
diff --git a/gnucash/gnome-utils/gnc-tree-control-split-reg.c b/gnucash/gnome-utils/gnc-tree-control-split-reg.c
new file mode 100644
index 0000000..25ee798
--- /dev/null
+++ b/gnucash/gnome-utils/gnc-tree-control-split-reg.c
@@ -0,0 +1,2173 @@
+/********************************************************************\
+ * gnc-tree-control-split-reg.c -- GtkTreeView implementation       *
+ *                     to display registers in a GtkTreeView.       *
+ *                                                                  *
+ * Copyright (C) 2006-2007 Chris Shoemaker <c.shoemaker at cox.net>    *
+ * Copyright (C) 2012 Robert Fewell                                 *
+ *                                                                  *
+ * 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 at gnu.org                   *
+ *                                                                  *
+\********************************************************************/
+
+#include "config.h"
+
+#include <gtk/gtk.h>
+#include <glib/gi18n.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "gnc-tree-control-split-reg.h"
+#include "gnc-tree-model-split-reg.h"
+#include "gnc-tree-util-split-reg.h"
+#include "gnc-tree-view-split-reg.h"
+#include "gnc-component-manager.h"
+#include "gnc-ui.h"
+#include "gnc-prefs.h"
+#include "gnc-gdate-utils.h"
+#include "gnc-warnings.h"
+#include "dialog-utils.h"
+#include "dialog-dup-trans.h"
+#include "dialog-account.h"
+
+#include "Transaction.h"
+#include "engine-helpers.h"
+#include "gnc-event.h"
+#include "Scrub.h"
+
+/** Static Globals *******************************************************/
+static QofLogModule log_module = GNC_MOD_LEDGER;
+
+/*****************************************************************************/
+/*****************************************************************************/
+
+/* Read only dialog */
+static gboolean
+gtc_sr_is_trans_readonly_and_warn (GncTreeViewSplitReg *view, Transaction *trans)
+{
+    GncTreeModelSplitReg *model;
+    GtkWidget *window;
+    GtkWidget *dialog;
+    const gchar *reason;
+    const gchar *title = _("Cannot modify or delete this transaction.");
+    const gchar *message_reason =
+        _("This transaction is marked read-only with the comment: '%s'");
+
+    if (!trans) return FALSE;
+
+    window = gnc_tree_view_split_reg_get_parent (view);
+    model = gnc_tree_view_split_reg_get_model_from_view (view);
+
+    if (xaccTransIsReadonlyByPostedDate (trans))
+    {
+        dialog = gtk_message_dialog_new (GTK_WINDOW (window),
+                                        0,
+                                        GTK_MESSAGE_ERROR,
+                                        GTK_BUTTONS_OK,
+                                        "%s", title);
+        gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+                "%s", _("The date of this transaction is older than the \"Read-Only Threshold\" set for this book. "
+                        "This setting can be changed in File -> Properties -> Accounts."));
+        gtk_dialog_run (GTK_DIALOG (dialog));
+        gtk_widget_destroy (dialog);
+        return TRUE;
+    }
+
+    reason = xaccTransGetReadOnly (trans);
+    if (reason)
+    {
+        dialog = gtk_message_dialog_new (GTK_WINDOW (window),
+                                        0,
+                                        GTK_MESSAGE_ERROR,
+                                        GTK_BUTTONS_OK,
+                                        "%s", title);
+        gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+                message_reason, reason);
+        gtk_dialog_run (GTK_DIALOG (dialog));
+        gtk_widget_destroy (dialog);
+        return TRUE;
+    }
+
+    if (gnc_tree_model_split_reg_get_read_only (model, trans))
+    {
+        dialog = gtk_message_dialog_new (GTK_WINDOW (window),
+                                        0,
+                                        GTK_MESSAGE_ERROR,
+                                        GTK_BUTTONS_OK,
+                                        "%s", title);
+        gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+                "%s", _("You can not change this transaction, the Book or Register is set to Read Only."));
+        gtk_dialog_run (GTK_DIALOG (dialog));
+        gtk_widget_destroy (dialog);
+        return TRUE;
+    }
+    return FALSE;
+}
+
+
+/* Transaction is being edited dialog */
+#define gtc_sr_trans_open_and_warn gnc_tree_control_split_reg_trans_open_and_warn
+gboolean
+gnc_tree_control_split_reg_trans_open_and_warn (GncTreeViewSplitReg *view, Transaction *trans)
+{
+    Transaction *dirty_trans;
+    GtkWidget *window;
+    GtkWidget *dialog;
+    gint response;
+    const char *title = _("Save Transaction before proceeding?");
+    const char *message =
+            _("The current transaction has been changed. Would you like to "
+              "record the changes before proceeding, or cancel?");
+
+    window = gnc_tree_view_split_reg_get_parent (view);
+    dirty_trans = gnc_tree_view_split_reg_get_dirty_trans (view);
+
+    if (trans == dirty_trans)
+    {
+        dialog = gtk_message_dialog_new (GTK_WINDOW (window),
+                                        GTK_DIALOG_DESTROY_WITH_PARENT,
+                                        GTK_MESSAGE_QUESTION,
+                                        GTK_BUTTONS_CANCEL,
+                                        "%s", title);
+        gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+                "%s", message);
+        gtk_dialog_add_button (GTK_DIALOG (dialog),
+                              _("_Record"), GTK_RESPONSE_ACCEPT);
+        response = gnc_dialog_run (GTK_DIALOG (dialog), GNC_PREF_WARN_REG_TRANS_MOD);
+        gtk_widget_destroy (dialog);
+
+        if (response != GTK_RESPONSE_ACCEPT)
+            return TRUE;
+
+        xaccTransCommitEdit (trans);
+        gnc_tree_view_split_reg_set_dirty_trans (view, NULL);
+
+        return FALSE;
+    }
+    else
+        return FALSE;
+}
+
+
+#define gtc_sr_trans_test_for_edit gnc_tree_control_split_reg_trans_test_for_edit
+gboolean
+gtc_sr_trans_test_for_edit (GncTreeViewSplitReg *view, Transaction *trans)
+{
+    GtkWidget *window;
+    Transaction *dirty_trans;
+
+    /* Make sure we have stopped editing */
+    gnc_tree_view_split_reg_finish_edit (view);
+
+    window = gnc_tree_view_split_reg_get_parent (view);
+
+    /* Get dirty_trans */
+    dirty_trans = gnc_tree_view_split_reg_get_dirty_trans (view);
+
+    /* We are being edited in a different register */
+    if (xaccTransIsOpen (trans) && (dirty_trans != trans))
+    {
+        gnc_error_dialog (window, "%s",
+                         _("This transaction is being edited in a different register."));
+        return TRUE;
+    }
+    return FALSE;
+}
+
+/*****************************************************************************/
+/*****************************************************************************/
+
+gboolean
+gnc_tree_control_split_reg_balance_trans (GncTreeViewSplitReg *view, Transaction *trans)
+{
+    GncTreeModelSplitReg *model;
+    GtkWidget *window;
+    int choice;
+    int default_value;
+    Account *default_account;
+    Account *other_account;
+    Account *root;
+    GList *radio_list = NULL;
+    const char *title   = _("Rebalance Transaction");
+    const char *message = _("The current transaction is not balanced.");
+    Split *split;
+    Split *other_split;
+    gboolean two_accounts;
+    gboolean multi_currency;
+
+
+    if (xaccTransIsBalanced (trans))
+        return FALSE;
+
+    window = gnc_tree_view_split_reg_get_parent (view);
+    model = gnc_tree_view_split_reg_get_model_from_view (view);
+
+    if (xaccTransUseTradingAccounts (trans))
+    {
+        MonetaryList *imbal_list;
+        gnc_monetary *imbal_mon;
+        imbal_list = xaccTransGetImbalance (trans);
+
+        /* See if the imbalance is only in the transaction's currency */
+        if (!imbal_list)
+            /* Value imbalance, but not commodity imbalance.  This shouldn't
+               be something that scrubbing can cause to happen.  Perhaps someone
+               entered invalid splits.  */
+            multi_currency = TRUE;
+        else
+        {
+            imbal_mon = imbal_list->data;
+            if (!imbal_list->next &&
+                    gnc_commodity_equiv(gnc_monetary_commodity(*imbal_mon),
+                                        xaccTransGetCurrency(trans)))
+                multi_currency = FALSE;
+            else
+                multi_currency = TRUE;
+        }
+
+        /* We're done with the imbalance list, the real work will be done
+           by xaccTransScrubImbalance which will get it again. */
+        gnc_monetary_list_free(imbal_list);
+    }
+    else
+        multi_currency = FALSE;
+
+    split = xaccTransGetSplit (trans, 0);
+    other_split = xaccSplitGetOtherSplit (split);
+
+    if (other_split == NULL)
+    {
+        /* Attempt to handle the inverted many-to-one mapping */
+        split = xaccTransGetSplit (trans, 1);
+        if (split) other_split = xaccSplitGetOtherSplit (split);
+        else split = xaccTransGetSplit (trans, 0);
+    }
+    if (other_split == NULL || multi_currency)
+    {
+        two_accounts = FALSE;
+        other_account = NULL;
+    }
+    else
+    {
+        two_accounts = TRUE;
+        other_account = xaccSplitGetAccount (other_split);
+    }
+
+    default_account = gnc_tree_model_split_reg_get_anchor (model);
+
+    /* If the two pointers are the same, the account from other_split
+     * is actually the default account. We must make other_account
+     * the account from split instead.   */
+
+    if (default_account == other_account)
+        other_account = xaccSplitGetAccount (split);
+
+    /*  If the two pointers are still the same, we have two splits, but
+     *  they both refer to the same account. While non-sensical, we don't
+     *  object.   */
+
+    if (default_account == other_account)
+        two_accounts = FALSE;
+
+    radio_list = g_list_append (radio_list,
+                                _("Balance it _manually"));
+    radio_list = g_list_append (radio_list,
+                                _("Let GnuCash _add an adjusting split"));
+
+    if (model->type < NUM_SINGLE_REGISTER_TYPES2 && !multi_currency)
+    {
+        radio_list = g_list_append (radio_list,
+                                    _("Adjust current account _split total"));
+
+        default_value = 2;
+        if (two_accounts)
+        {
+            radio_list = g_list_append (radio_list,
+                                        _("Adjust _other account split total"));
+            default_value = 3;
+        }
+    }
+    else
+        default_value = 0;
+
+    choice = gnc_choose_radio_option_dialog
+             (window,
+              title,
+              message,
+              _("_Rebalance"),
+              default_value,
+              radio_list);
+
+    g_list_free (radio_list);
+
+    root = gnc_account_get_root(default_account);
+    switch (choice)
+    {
+    default:
+    case 0:
+        return TRUE;
+        break;
+
+    case 1:
+        xaccTransScrubImbalance (trans, root, NULL);
+        break;
+
+    case 2:
+        xaccTransScrubImbalance (trans, root, default_account);
+        break;
+
+    case 3:
+        xaccTransScrubImbalance (trans, root, other_account);
+        break;
+    }
+    return FALSE;
+}
+
+
+/* Cancel the edit and Rollback */
+void
+gnc_tree_control_split_reg_cancel_edit (GncTreeViewSplitReg *view, gboolean reg_closing)
+{
+    /* Make sure we have stopped editing */
+    gnc_tree_view_split_reg_finish_edit (view);
+
+    gnc_tree_view_split_reg_cancel_edit (view, reg_closing);
+}
+
+
+/* Amend the Exchange Rate of the transaction */
+void
+gnc_tree_control_split_reg_exchange_rate (GncTreeViewSplitReg *view)
+{
+    GncTreeModelSplitReg *model;
+    GtkWidget *window;
+    Account *anchor;
+    Transaction *trans;
+    Split *split = NULL;
+    Split *osplit = NULL;
+    gnc_numeric value;
+    gboolean expanded;
+    gint depth;
+    gint num_splits;
+    const char *message;
+    gnc_commodity *txn_com;
+
+    model = gnc_tree_view_split_reg_get_model_from_view (view);
+
+    trans = gnc_tree_view_split_reg_get_current_trans (view);
+    expanded = gnc_tree_view_split_reg_trans_expanded (view, NULL);
+    depth = gnc_tree_view_reg_get_selected_row_depth (view);
+    num_splits = xaccTransCountSplits (trans);
+    anchor = gnc_tree_model_split_reg_get_anchor (model);
+    txn_com = xaccTransGetCurrency (trans);
+
+    if (trans == NULL)
+        return;
+
+    /* See if we were asked to change a blank trans. */
+    if (trans == gnc_tree_control_split_reg_get_blank_trans (view))
+        return;
+
+    /* Test for read only */
+    if (gtc_sr_is_trans_readonly_and_warn (view, trans))
+        return;
+
+    /* See if we are being edited in another register */
+    if (gtc_sr_trans_test_for_edit (view, trans))
+        return;
+
+    /* Make sure we ask to commit any changes before we proceed */
+    if (gtc_sr_trans_open_and_warn (view, trans))
+        return;
+
+    if (num_splits < 2)
+        return;
+
+    window = gnc_tree_view_split_reg_get_parent (view);
+
+    /* Make sure we NEED this for this type of register */
+    if (!gnc_tree_util_split_reg_has_rate (view))
+    {
+        message = _("This register does not support editing exchange rates.");
+        gnc_error_dialog(window, "%s", message);
+        return;
+    }
+
+    /* If the anchor commodity is not a currency, cancel */
+    if (anchor && !gnc_commodity_is_currency (xaccAccountGetCommodity (anchor)))
+    {
+        message = _("This register does not support editing exchange rates.");
+        gnc_error_dialog (window, "%s", message);
+        return;
+    }
+
+    /* If we're not expanded AND number of splits greater than two, nothing to do */
+    if ((gnc_tree_util_split_reg_is_multi (xaccTransGetSplit (trans, 0))) && !expanded)
+    {
+        message = _("You need to expand the transaction in order to modify its "
+                    "exchange rates.");
+        gnc_error_dialog (window, "%s", message);
+        return;
+    }
+
+    if (!gnc_tree_util_split_reg_is_multi (xaccTransGetSplit (trans, 0)) && anchor != NULL && !expanded)
+    {
+        split = gnc_tree_control_split_reg_get_current_trans_split (view);
+
+        if (xaccAccountGetType (xaccSplitGetAccount (split)) == ACCT_TYPE_TRADING) // trading split
+            return;
+
+        osplit = xaccSplitGetOtherSplit (split);
+
+        value = xaccSplitGetValue (split);
+
+        gnc_tree_view_split_reg_set_dirty_trans (view, trans);
+        xaccTransBeginEdit (trans);
+
+        if (txn_com == xaccAccountGetCommodity (xaccSplitGetAccount(split)))
+           gnc_tree_util_split_reg_set_value_for (view, trans, osplit, gnc_numeric_neg (value), TRUE);
+        else
+           gnc_tree_util_split_reg_set_value_for (view, trans, split, value, TRUE);
+
+        xaccTransCommitEdit (trans);
+        gnc_tree_view_split_reg_set_dirty_trans (view, NULL);
+    }
+
+    if (num_splits > 1 && expanded && depth == 3)
+    {
+        split = gnc_tree_view_split_reg_get_current_split (view);
+
+        if (xaccAccountGetType (xaccSplitGetAccount (split)) == ACCT_TYPE_TRADING) // trading split
+            return;
+
+        value = xaccSplitGetValue (split);
+
+        if (txn_com == xaccAccountGetCommodity (xaccSplitGetAccount(split)))
+        {
+            message = _("The two currencies involved equal each other.");
+            gnc_error_dialog (window, "%s", message);
+            return;
+        }
+        else
+        {
+            gnc_tree_view_split_reg_set_dirty_trans (view, trans);
+            xaccTransBeginEdit (trans);
+
+            gnc_tree_util_split_reg_set_value_for (view, trans, split, value, TRUE);
+
+            xaccTransCommitEdit (trans);
+            gnc_tree_view_split_reg_set_dirty_trans (view, NULL);
+        }
+    }
+}
+
+
+/* Void current transaction */
+void
+gnc_tree_control_split_reg_void_current_trans (GncTreeViewSplitReg *view, const char *reason)
+{
+    Transaction *trans;
+    Split *blank_split;
+    Split *split;
+
+    if (!view) return;
+
+    blank_split = gnc_tree_control_split_reg_get_blank_split (view);
+
+    /* get the current split */
+    split = gnc_tree_view_split_reg_get_current_split (view);
+    if (split == NULL)
+        return;
+
+    /* Bail if trying to void the blank split. */
+    if (split == blank_split)
+        return;
+
+    /* already voided. */
+    if (xaccSplitGetReconcile (split) == VREC)
+        return;
+
+    trans = xaccSplitGetParent (split);
+
+    if (trans == NULL)
+        return;
+
+    /* See if we were asked to change a blank trans. */
+    if (trans == gnc_tree_control_split_reg_get_blank_trans (view))
+        return;
+
+    /* Test for read only */
+    if (gtc_sr_is_trans_readonly_and_warn (view, trans))
+        return;
+
+    /* See if we are being edited in another register */
+    if (gtc_sr_trans_test_for_edit (view, trans))
+        return;
+
+    /* Make sure we ask to commit any changes before we proceed */
+    if (gtc_sr_trans_open_and_warn (view, trans))
+        return;
+
+    gnc_tree_view_split_reg_set_dirty_trans (view, trans);
+
+    xaccTransVoid (trans, reason);
+
+    if (xaccTransIsOpen (trans))
+    {
+        PERR("We should not be voiding an open transaction.");
+        xaccTransCommitEdit (trans);
+    }
+    gnc_tree_view_split_reg_set_dirty_trans (view, NULL);
+}
+
+
+/* Unvoid current transaction */
+void
+gnc_tree_control_split_reg_unvoid_current_trans (GncTreeViewSplitReg *view)
+{
+    Transaction *trans;
+    Split *blank_split;
+    Split *split;
+
+    if (!view) return;
+
+    blank_split = gnc_tree_control_split_reg_get_blank_split (view);
+
+    /* get the current split based on cursor position */
+    split = gnc_tree_view_split_reg_get_current_split (view);
+    if (split == NULL)
+        return;
+
+    /* Bail if trying to unvoid the blank split. */
+    if (split == blank_split)
+        return;
+
+    /* not voided. */
+    if (xaccSplitGetReconcile (split) != VREC)
+        return;
+
+    trans = xaccSplitGetParent (split);
+
+    if (trans == NULL)
+        return;
+
+    /* See if we were asked to change a blank trans. */
+    if (trans == gnc_tree_control_split_reg_get_blank_trans (view))
+        return;
+
+    gnc_tree_view_split_reg_set_dirty_trans (view, trans);
+
+    xaccTransUnvoid (trans);
+
+    gnc_tree_view_split_reg_set_dirty_trans (view, NULL);
+}
+
+
+/* Jump to the Blank transaction */
+gboolean
+gnc_tree_control_split_reg_jump_to_blank (GncTreeViewSplitReg *view)
+{
+    GncTreeModelSplitReg *model;
+    GtkTreePath *mpath, *spath;
+    Transaction *btrans;
+
+    model = gnc_tree_view_split_reg_get_model_from_view (view);
+
+    btrans = gnc_tree_model_split_get_blank_trans (model);
+
+    model->current_trans = btrans;
+
+    if (!gnc_tree_model_split_reg_trans_is_in_view (model, btrans))
+        g_signal_emit_by_name (model, "refresh_trans");
+    else
+    {
+        mpath = gnc_tree_model_split_reg_get_path_to_split_and_trans (model, NULL, btrans);
+
+        spath = gnc_tree_view_split_reg_get_sort_path_from_model_path (view, mpath);
+
+        /* Set cursor to new spath */
+        gtk_tree_view_set_cursor (GTK_TREE_VIEW (view), spath, NULL, FALSE);
+
+        gtk_tree_path_free (spath);
+        gtk_tree_path_free (mpath);
+
+        /* scroll when view idle */
+        g_idle_add ((GSourceFunc)gnc_tree_view_split_reg_scroll_to_cell, view );
+    }
+    return FALSE;
+}
+
+
+/* Jump to transaction or split */
+void
+gnc_tree_control_split_reg_jump_to (GncTreeViewSplitReg *view, Transaction *trans, Split *split, gboolean amount)
+{
+    GncTreeModelSplitReg *model;
+    GtkTreePath *mpath, *spath;
+
+    model = gnc_tree_view_split_reg_get_model_from_view (view);
+
+    if (split)
+        trans = NULL;
+
+    mpath = gnc_tree_model_split_reg_get_path_to_split_and_trans (model, split, trans);
+
+    spath = gnc_tree_view_split_reg_get_sort_path_from_model_path (view, mpath);
+
+    if (split)
+        gnc_tree_view_split_reg_expand_trans (view, xaccSplitGetParent (split));
+
+    /* Set cursor to new spath, if amount, cursor is set to correct column ready for editing */
+    if (amount)
+    {
+        GtkCellRenderer *cr0;
+        GList *renderers;
+        GList *columns;
+        GList  *column;
+        gint i;
+
+        columns = gtk_tree_view_get_columns (GTK_TREE_VIEW (view));
+
+        for (column = columns, i = 1; column; column = g_list_next (column), i++)
+        {
+            GtkTreeViewColumn *tvc;
+            ViewCol viewcol;
+
+            tvc = column->data;
+
+            // Get the first renderer, it has the view-column value.
+            renderers = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (tvc));
+            cr0 = g_list_nth_data (renderers, 0);
+            g_list_free (renderers);
+
+            viewcol = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (cr0), "view_column"));
+
+            if (viewcol == COL_DEBIT && gnc_numeric_positive_p (xaccSplitGetAmount (split)))
+                gtk_tree_view_set_cursor (GTK_TREE_VIEW (view), spath, tvc, TRUE);
+
+            if (viewcol == COL_CREDIT && gnc_numeric_negative_p (xaccSplitGetAmount (split)))
+                gtk_tree_view_set_cursor (GTK_TREE_VIEW (view), spath, tvc, TRUE);
+        }
+        g_list_free (columns);
+    }
+    else
+        gtk_tree_view_set_cursor (GTK_TREE_VIEW (view), spath, NULL, FALSE);
+
+    /* Scroll to cell, mid view */
+    gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (view), spath, NULL, TRUE, 0.5, 0.0);
+
+    gtk_tree_path_free (spath);
+    gtk_tree_path_free (mpath);
+}
+
+
+/* Returns the Blank Transaction */
+Transaction *
+gnc_tree_control_split_reg_get_blank_trans (GncTreeViewSplitReg *view)
+{
+    GncTreeModelSplitReg *model;
+
+    model = gnc_tree_view_split_reg_get_model_from_view (view);
+
+    return gnc_tree_model_split_get_blank_trans (model);
+}
+
+
+/* Return the Split for the current Transaction */
+Split *
+gnc_tree_control_split_reg_get_current_trans_split (GncTreeViewSplitReg *view)
+{
+    GncTreeModelSplitReg *model;
+    GtkTreePath *mpath;
+    GtkTreeIter m_iter;
+    Split *split = NULL;
+    Transaction *trans = NULL;
+    Account *anchor;
+    gboolean is_trow1, is_trow2, is_split, is_blank;
+
+    model = gnc_tree_view_split_reg_get_model_from_view (view);
+
+    mpath = gnc_tree_view_split_reg_get_current_path (view);
+
+    gtk_tree_model_get_iter (GTK_TREE_MODEL (model), &m_iter, mpath);
+
+    gnc_tree_model_split_reg_get_split_and_trans (
+            GNC_TREE_MODEL_SPLIT_REG (model), &m_iter, &is_trow1, &is_trow2, &is_split, &is_blank, &split, &trans);
+
+    anchor = gnc_tree_model_split_reg_get_anchor (model);
+
+    split = gnc_tree_model_split_reg_trans_get_split_equal_to_ancestor (trans, anchor);
+
+    gtk_tree_path_free (mpath);
+
+    return split;
+}
+
+
+/* Returns the Blank Split */
+Split *
+gnc_tree_control_split_reg_get_blank_split (GncTreeViewSplitReg *view)
+{
+    GncTreeModelSplitReg *model;
+
+    model = gnc_tree_view_split_reg_get_model_from_view (view);
+
+    return gnc_tree_model_split_get_blank_split (model);
+}
+
+
+/* Move to the relative transaction */
+void
+gnc_tree_control_split_reg_goto_rel_trans_row (GncTreeViewSplitReg *view, gint relative)
+{
+    GncTreeModelSplitReg *model;
+    GtkTreePath *mpath, *spath;
+    GtkTreePath  *new_mpath, *new_spath;
+    gint *indices, sort_direction;
+    gchar *sstring;
+
+    ENTER("Move relative, view is %p, relative is %d", view, relative);
+
+//FIXME Do we need to do some checks on relative maybe  -1,0,1 ??
+
+    model = gnc_tree_view_split_reg_get_model_from_view (view);
+
+    mpath = gnc_tree_view_split_reg_get_current_path (view);
+
+    spath = gnc_tree_view_split_reg_get_sort_path_from_model_path (view, mpath);
+
+    indices = gtk_tree_path_get_indices (spath);
+
+    if (model->sort_direction == GTK_SORT_DESCENDING)
+        sort_direction = -1;
+    else
+        sort_direction = 1;
+
+    new_spath = gtk_tree_path_new_from_indices (indices[0] + (relative * sort_direction), -1);
+
+    // if relative == 0 we block all selection changes
+    gnc_tree_view_split_reg_block_selection (view, TRUE);
+    gtk_tree_selection_unselect_path (gtk_tree_view_get_selection (GTK_TREE_VIEW (view)), spath);
+
+    if (relative != 0)
+        gnc_tree_view_split_reg_block_selection (view, FALSE);
+
+    /* Set cursor to new spath */
+    gtk_tree_view_set_cursor (GTK_TREE_VIEW (view), new_spath, NULL, FALSE);
+
+    if (relative == 0)
+    {
+        gnc_tree_view_split_reg_block_selection (view, FALSE);
+
+        /* Get the new model path we are pointing at */
+        new_mpath = gnc_tree_view_split_reg_get_model_path_from_sort_path (view, new_spath);
+
+        /* As we are not emitting selection change, we need to save the current path ref */
+        gnc_tree_view_split_reg_set_current_path (view, new_mpath);
+        gtk_tree_path_free (new_mpath);
+    }
+
+    sstring = gtk_tree_path_to_string (new_spath);
+    LEAVE("new_spath is %s", sstring);
+    g_free (sstring);
+
+    gtk_tree_path_free (new_spath);
+    gtk_tree_path_free (mpath);
+    gtk_tree_path_free (spath);
+}
+
+
+/* Enter the transaction */
+void
+gnc_tree_control_split_reg_enter (GncTreeViewSplitReg *view)
+{
+    GncTreeModelSplitReg *model;
+    Transaction *btrans, *ctrans;
+    gboolean goto_blank = FALSE;
+    gboolean next_trans = TRUE;
+
+    model = gnc_tree_view_split_reg_get_model_from_view (view);
+
+    goto_blank = gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL_REGISTER,
+                                     GNC_PREF_ENTER_MOVES_TO_END);
+
+    ENTER("view=%p, goto_blank = %s", view, goto_blank ? "TRUE" : "FALSE");
+
+    btrans = gnc_tree_model_split_get_blank_trans (model);
+
+    ctrans = gnc_tree_view_split_reg_get_current_trans (view);
+
+    /* Are we on the blank transaction */
+    if (btrans == ctrans)
+        next_trans = FALSE;
+
+    /* First record the transaction */
+    if (gnc_tree_view_split_reg_enter (view))
+    {
+        /* Now move. */
+        if (goto_blank)
+            gnc_tree_control_split_reg_jump_to_blank (view);
+        else if (next_trans)
+            gnc_tree_control_split_reg_goto_rel_trans_row (view, 1);
+    }
+    LEAVE(" ");
+}
+
+
+/* Reinit the transaction */
+void
+gnc_tree_control_split_reg_reinit (GncTreeViewSplitReg *view, gpointer data)
+{
+    Transaction *trans;
+    GtkWidget *dialog, *window;
+    gint response;
+    const gchar *warning;
+
+    const char *title = _("Remove the splits from this transaction?");
+    const char *recn_warn = _("This transaction contains reconciled splits. "
+                              "Modifying it is not a good idea because that will "
+                              "cause your reconciled balance to be off.");
+
+    trans = gnc_tree_view_split_reg_get_current_trans (view);
+
+    if (trans == NULL)
+        return;
+
+    /* See if we were asked to change a blank trans. */
+    if (trans == gnc_tree_control_split_reg_get_blank_trans (view))
+        return;
+
+    /* Test for read only */
+    if (gtc_sr_is_trans_readonly_and_warn (view, trans))
+        return;
+
+    /* See if we are being edited in another register */
+    if (gtc_sr_trans_test_for_edit (view, trans))
+        return;
+
+    /* Make sure we ask to commit any changes before we proceed */
+    if (gtc_sr_trans_open_and_warn (view, trans))
+        return;
+
+    window = gnc_tree_view_split_reg_get_parent (view);
+
+    dialog = gtk_message_dialog_new (GTK_WINDOW (window),
+                                    GTK_DIALOG_DESTROY_WITH_PARENT,
+                                    GTK_MESSAGE_WARNING,
+                                    GTK_BUTTONS_NONE,
+                                    "%s", title);
+
+    if (xaccTransHasReconciledSplits (trans))
+    {
+        gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+                "%s", recn_warn);
+        warning = GNC_PREF_WARN_REG_SPLIT_DEL_ALL_RECD;
+    }
+    else
+    {
+        warning = GNC_PREF_WARN_REG_SPLIT_DEL_ALL;
+    }
+
+    gtk_dialog_add_button (GTK_DIALOG (dialog),
+                          _("_Cancel"), GTK_RESPONSE_CANCEL);
+    gnc_gtk_dialog_add_button(dialog, _("_Remove Splits"),
+                              "edit-delete", GTK_RESPONSE_ACCEPT);
+    response = gnc_dialog_run (GTK_DIALOG(dialog), warning);
+    gtk_widget_destroy (dialog);
+    if (response != GTK_RESPONSE_ACCEPT)
+        return;
+
+    gnc_tree_view_split_reg_reinit_trans (view);
+}
+
+
+/* Delete the currently selected item */
+void
+gnc_tree_control_split_reg_delete (GncTreeViewSplitReg *view, gpointer data)
+{
+    GncTreeModelSplitReg *model;
+    Account *anchor;
+    RowDepth depth;
+    Transaction *trans;
+    Split *split;
+    GtkWidget *dialog, *window;
+    gint response;
+    const gchar *warning;
+
+    /* get the current split based on cursor position */
+    split = gnc_tree_view_split_reg_get_current_split (view);
+    if (split == NULL)
+    {
+        split = gnc_tree_control_split_reg_get_current_trans_split (view);
+        if (split == NULL)
+        {
+            LEAVE("split is NULL");
+            return;
+        }
+    }
+
+    model = gnc_tree_view_split_reg_get_model_from_view (view);
+
+    anchor = gnc_tree_model_split_reg_get_anchor (model);
+
+    trans = xaccSplitGetParent (split);
+
+    if (trans == NULL)
+        return;
+
+    /* Test for read only */
+    if (gtc_sr_is_trans_readonly_and_warn (view, trans))
+        return;
+
+    /* See if we are being edited in another register */
+    if (gtc_sr_trans_test_for_edit (view, trans))
+        return;
+
+    depth = gnc_tree_view_reg_get_selected_row_depth (view);
+
+    /* Deleting the blank split just cancels */
+    {
+        Split *blank_split = gnc_tree_control_split_reg_get_blank_split (view);
+
+        if (split == blank_split)
+            return;
+    }
+
+    /* Deleting the blank trans just cancels */
+    {
+        Transaction *blank_trans = gnc_tree_control_split_reg_get_blank_trans (view);
+
+        if (trans == blank_trans)
+            return;
+    }
+
+    window = gnc_tree_view_split_reg_get_parent (view);
+
+    /* On a split cursor, just delete the one split. */
+    if (depth == SPLIT3)
+    {
+        const char *format = _("Delete the split '%s' from the transaction '%s'?");
+        const char *recn_warn = _("You would be deleting a reconciled split! "
+                                  "This is not a good idea as it will cause your "
+                                  "reconciled balance to be off.");
+        const char *anchor_error = _("You cannot delete this split.");
+        const char *anchor_split = _("This is the split anchoring this transaction "
+                                     "to the register. You may not delete it from "
+                                     "this register window. You may delete the "
+                                     "entire transaction from this window, or you "
+                                     "may navigate to a register that shows "
+                                     "another side of this same transaction and "
+                                     "delete the split from that register.");
+        char *buf = NULL;
+        const char *memo;
+        const char *desc;
+        char recn;
+        if ((split == gnc_tree_control_split_reg_get_current_trans_split (view)) ||
+            (split == gnc_tree_model_split_reg_trans_get_split_equal_to_ancestor (trans, anchor)))
+        {
+            dialog = gtk_message_dialog_new (GTK_WINDOW (window),
+                                            GTK_DIALOG_MODAL
+                                            | GTK_DIALOG_DESTROY_WITH_PARENT,
+                                            GTK_MESSAGE_ERROR,
+                                            GTK_BUTTONS_OK,
+                                            "%s", anchor_error);
+            gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+                    "%s", anchor_split);
+            gtk_dialog_run (GTK_DIALOG (dialog));
+            gtk_widget_destroy (dialog);
+            return;
+        }
+
+        memo = xaccSplitGetMemo (split);
+        memo = (memo && *memo) ? memo : _("(no memo)");
+
+        desc = xaccTransGetDescription (trans);
+        desc = (desc && *desc) ? desc : _("(no description)");
+
+        /* ask for user confirmation before performing permanent damage */
+        buf = g_strdup_printf (format, memo, desc);
+        dialog = gtk_message_dialog_new (GTK_WINDOW (window),
+                                        GTK_DIALOG_MODAL
+                                        | GTK_DIALOG_DESTROY_WITH_PARENT,
+                                        GTK_MESSAGE_QUESTION,
+                                        GTK_BUTTONS_NONE,
+                                        "%s", buf);
+        g_free(buf);
+        recn = xaccSplitGetReconcile (split);
+        if (recn == YREC || recn == FREC)
+        {
+            gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+                    "%s", recn_warn);
+            warning = GNC_PREF_WARN_REG_SPLIT_DEL_RECD;
+        }
+        else
+        {
+            warning = GNC_PREF_WARN_REG_SPLIT_DEL;
+        }
+
+        gtk_dialog_add_button (GTK_DIALOG (dialog),
+                              _("_Cancel"), GTK_RESPONSE_CANCEL);
+        gnc_gtk_dialog_add_button (dialog, _("_Delete Split"),
+                                  "edit-delete", GTK_RESPONSE_ACCEPT);
+        response = gnc_dialog_run (GTK_DIALOG (dialog), warning);
+        gtk_widget_destroy (dialog);
+        if (response != GTK_RESPONSE_ACCEPT)
+            return;
+
+        gnc_tree_view_split_reg_delete_current_split (view);
+        return;
+    }
+
+    g_return_if_fail (depth == TRANS1 || depth == TRANS2);
+
+    /* On a transaction cursor with 2 or fewer splits in single or double
+     * mode, we just delete the whole transaction, kerblooie */
+    {
+        const char *title = _("Delete the current transaction?");
+        const char *recn_warn = _("You would be deleting a transaction "
+                                  "with reconciled splits! "
+                                  "This is not a good idea as it will cause your "
+                                  "reconciled balance to be off.");
+
+        dialog = gtk_message_dialog_new (GTK_WINDOW (window),
+                                        GTK_DIALOG_MODAL
+                                        | GTK_DIALOG_DESTROY_WITH_PARENT,
+                                        GTK_MESSAGE_WARNING,
+                                        GTK_BUTTONS_NONE,
+                                        "%s", title);
+        if (xaccTransHasReconciledSplits (trans))
+        {
+            gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+                    "%s", recn_warn);
+            warning = GNC_PREF_WARN_REG_TRANS_DEL_RECD;
+        }
+        else
+        {
+            warning = GNC_PREF_WARN_REG_TRANS_DEL;
+        }
+        gtk_dialog_add_button (GTK_DIALOG (dialog),
+                              _("_Cancel"), GTK_RESPONSE_CANCEL);
+        gnc_gtk_dialog_add_button (dialog, _("_Delete Transaction"),
+                                  "edit-delete", GTK_RESPONSE_ACCEPT);
+        response =  gnc_dialog_run (GTK_DIALOG (dialog), warning);
+        gtk_widget_destroy (dialog);
+        if (response != GTK_RESPONSE_ACCEPT)
+            return;
+
+        gnc_tree_view_split_reg_delete_current_trans (view);
+        return;
+    }
+}
+
+
+/* Add Reverse Transaction */
+void
+gnc_tree_control_split_reg_reverse_current (GncTreeViewSplitReg *view)
+{
+    GtkWidget *window;
+    Transaction *trans = NULL, *new_trans = NULL;
+    GList *snode = NULL;
+
+    ENTER(" ");
+
+    trans = gnc_tree_view_split_reg_get_current_trans (view);
+
+    if (trans == NULL)
+    {
+        LEAVE("Trans is Null");
+        return;
+    }
+
+    /* See if we were asked to reverse a blank trans. */
+    if (trans == gnc_tree_control_split_reg_get_blank_trans (view))
+    {
+        LEAVE("Skip blank trans");
+        return;
+    }
+
+    /* Test for read only */
+    if (gtc_sr_is_trans_readonly_and_warn (view, trans))
+    {
+        LEAVE("Read only");
+        return;
+    }
+
+    /* See if we are being edited in another register */
+    if (gtc_sr_trans_test_for_edit (view, trans))
+    {
+        LEAVE("Open in different register");
+        return;
+    }
+
+    window = gnc_tree_view_split_reg_get_parent (view);
+
+    if (xaccTransGetReversedBy (trans))
+    {
+        gnc_error_dialog (window, "%s",
+                         _("A reversing entry has already been created for this transaction."));
+        LEAVE("Already have reversing transaction");
+        return;
+    }
+
+    /* Make sure we ask to commit any changes before we add reverse transaction */
+    if (gtc_sr_trans_open_and_warn (view, trans))
+    {
+        LEAVE("save cancelled");
+        return;
+    }
+
+    /* Create reverse transaction */
+    new_trans = xaccTransReverse (trans);
+
+    xaccTransBeginEdit (new_trans);
+
+    /* Clear transaction level info */
+    xaccTransSetDatePostedSecsNormalized (new_trans, gnc_time (NULL));
+    xaccTransSetDateEnteredSecs (new_trans, gnc_time (NULL));
+
+    xaccTransCommitEdit (new_trans);
+
+    // We need to loop through the splits and send an event to update the register.
+    for (snode = xaccTransGetSplitList (new_trans); snode; snode = snode->next)
+    {
+        if (xaccTransStillHasSplit (new_trans, snode->data))
+        {
+           /* Send an event based on the split account */
+           qof_event_gen (QOF_INSTANCE (xaccSplitGetAccount(snode->data)), GNC_EVENT_ITEM_ADDED, snode->data);
+        }
+    }
+
+    /* give gtk+ a chance to handle pending events */
+    while (gtk_events_pending ())
+        gtk_main_iteration ();
+
+    /* Now jump to new trans */
+    gnc_tree_control_split_reg_jump_to (view, NULL, xaccTransGetSplit (new_trans, 0), FALSE);
+
+    LEAVE("Reverse transaction created");
+}
+
+
+/* Duplicate the current selection */
+gboolean
+gnc_tree_control_split_reg_duplicate_current (GncTreeViewSplitReg *view)
+{
+    GncTreeModelSplitReg *model;
+    GtkWidget *window;
+    RowDepth depth;
+    Transaction *trans;
+    Split *blank_split;
+    Split *split, *trans_split;
+    gboolean use_split_action_for_num_field = FALSE;
+
+    ENTER("");
+
+    model = gnc_tree_view_split_reg_get_model_from_view (view);
+
+    blank_split = gnc_tree_control_split_reg_get_blank_split (view);
+    split = gnc_tree_view_split_reg_get_current_split (view);
+    trans_split = gnc_tree_control_split_reg_get_current_trans_split (view);
+
+
+    depth = gnc_tree_view_reg_get_selected_row_depth (view);
+
+    use_split_action_for_num_field = qof_book_use_split_action_for_num_field (gnc_get_current_book());
+
+    trans = gnc_tree_view_split_reg_get_current_trans (view);
+
+    /* This shouldn't happen, but be paranoid. */
+    if (trans == NULL)
+        return FALSE;
+
+    /* See if we were asked to change a blank trans. */
+    if (trans == gnc_tree_control_split_reg_get_blank_trans (view))
+    {
+        LEAVE("Skip blank trans");
+        return FALSE;
+    }
+
+    /* See if we were asked to change a blank split. */
+    if (split == blank_split)
+    {
+        LEAVE("Skip blank split");
+        return FALSE;
+    }
+
+    /* Test for read only */
+    if (gtc_sr_is_trans_readonly_and_warn (view, trans))
+    {
+        LEAVE("Read only");
+        return FALSE;
+    }
+
+    /* See if we are being edited in another register */
+    if (gtc_sr_trans_test_for_edit (view, trans))
+    {
+        LEAVE("Open in different register");
+        return FALSE;
+    }
+
+    /* Make sure we ask to commit any changes before we proceed */
+    if (gtc_sr_trans_open_and_warn (view, trans))
+    {
+        LEAVE("save cancelled");
+        return FALSE;
+    }
+
+    window = gnc_tree_view_split_reg_get_parent (view);
+
+    /* Ok, we are now ready to make the copy. */
+    if (depth == SPLIT3)
+    {
+        Split *new_split;
+        gboolean new_act_num = FALSE;
+        char *out_num;
+        time64 date;
+
+        /* We are on a split in an expanded transaction.
+         * Just copy the split and add it to the transaction.
+         * However, if the split-action field is being used as the register 
+         * number, and the action field is a number, request a new value or
+         * cancel. Need to get next number and update account last num from
+         * split account not register account, which may be the same or not */
+
+        if (split != trans_split)
+        {
+            if (use_split_action_for_num_field && gnc_strisnum (gnc_get_num_action (NULL, split)))
+            {
+                Account *account = xaccSplitGetAccount (split);
+                const char* title = _("New Split Information");
+                const char *in_num = NULL;
+                date = time (0);
+
+                if (account)
+                    in_num = xaccAccountGetLastNum (account);
+                else
+                    in_num = gnc_get_num_action (NULL, split);
+
+                if (!gnc_dup_trans_dialog (window, title, FALSE,
+                                           &date, in_num, &out_num, NULL, NULL))
+                {
+                    LEAVE("dup cancelled");
+                    return FALSE;
+                }
+                new_act_num = TRUE;
+            }
+
+            new_split = xaccMallocSplit (gnc_get_current_book ());
+
+            // Remove the blank split
+            gnc_tree_model_split_reg_set_blank_split_parent (model, trans, TRUE);
+
+            if (!xaccTransIsOpen (trans))
+                xaccTransBeginEdit (trans);
+            gnc_tree_view_split_reg_set_dirty_trans (view, trans);
+
+            xaccSplitCopyOnto (split, new_split);
+            xaccSplitSetParent (new_split, trans);
+
+            // Add the blank split
+            gnc_tree_model_split_reg_set_blank_split_parent (model, trans, FALSE);
+
+            if (new_act_num) /* if new number supplied by user dialog */
+                gnc_set_num_action (NULL, new_split, out_num, NULL);
+
+            if (new_act_num && gnc_strisnum (out_num))
+            {
+                Account *account = xaccSplitGetAccount (new_split);
+
+                /* If current register is for account, set last num */
+                if (account == gnc_tree_model_split_reg_get_anchor (model))
+                    xaccAccountSetLastNum (account, out_num);
+            }
+            if (new_act_num)
+                g_free (out_num);
+        }
+        else
+        {
+            gnc_error_dialog (window, "%s",
+                         _("This is the split anchoring this transaction to the register."
+                           " You can not duplicate it from this register window."));
+            LEAVE("split anchoring this transaction");
+            return FALSE;
+        }
+    }
+    else
+    {
+        Transaction *new_trans;
+        int trans_split_index;
+        const char *in_num = NULL;
+        const char *in_tnum = NULL;
+        char *out_num;
+        char *out_tnum;
+        time64 date;
+        gboolean use_autoreadonly = qof_book_uses_autoreadonly (gnc_get_current_book());
+
+        /* We are on a transaction row. Copy the whole transaction. */
+
+        date = time (0);
+        if (gnc_strisnum (gnc_get_num_action (trans, trans_split)))
+        {
+            Account *account = gnc_tree_model_split_reg_get_anchor (model);
+
+            if (account)
+                in_num = xaccAccountGetLastNum (account);
+            else
+                in_num = gnc_get_num_action (trans, trans_split);
+        }
+
+        in_tnum = (use_split_action_for_num_field
+                                        ? gnc_get_num_action (trans, NULL)
+                                        : NULL);
+
+        if (!gnc_dup_trans_dialog (window, NULL, TRUE,
+                                   &date, in_num, &out_num, in_tnum, &out_tnum))
+        {
+            LEAVE("dup cancelled");
+            return FALSE;
+        }
+
+        if (use_autoreadonly)
+        {
+            GDate d;
+            GDate *readonly_threshold = qof_book_get_autoreadonly_gdate (gnc_get_current_book());
+            gnc_gdate_set_time64 (&d, date);
+            if (g_date_compare (&d, readonly_threshold) < 0)
+            {
+                GtkWidget *dialog = gtk_message_dialog_new (GTK_WINDOW (window),
+                                    0,
+                                    GTK_MESSAGE_ERROR,
+                                    GTK_BUTTONS_OK,
+                                    "%s", _("Cannot store a transaction at this date"));
+                gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+                        "%s", _("The entered date of the duplicated transaction is older than the \"Read-Only Threshold\" set for this book. "
+                                "This setting can be changed in File -> Properties -> Accounts."));
+                gtk_dialog_run (GTK_DIALOG (dialog));
+                gtk_widget_destroy (dialog);
+
+                g_date_free (readonly_threshold);
+                LEAVE("entered date older than read-only threshold");
+                return FALSE;
+            }
+            g_date_free (readonly_threshold);
+        }
+
+        trans_split_index = xaccTransGetSplitIndex (trans, trans_split);
+
+        new_trans = xaccMallocTransaction (gnc_get_current_book ());
+
+        xaccTransBeginEdit (new_trans);
+
+        xaccTransCopyOnto (trans, new_trans);
+
+        xaccTransSetDatePostedSecsNormalized (new_trans, date);
+
+        /* We also must set a new DateEntered on the new entry
+         * because otherwise the ordering is not deterministic */
+        xaccTransSetDateEnteredSecs(new_trans, gnc_time(NULL));
+
+        /* set per book option */
+        gnc_set_num_action (new_trans, NULL, out_num, out_tnum);
+
+        if (gnc_strisnum (out_num))
+        {
+            Account *account = gnc_tree_model_split_reg_get_anchor (model);
+
+            /* If current register is for account, set last num */
+            if (account)
+                xaccAccountSetLastNum (account, out_num);
+        }
+
+        if (use_split_action_for_num_field)
+        {
+            /* find split in new_trans that equals trans_split and set
+             * split_action to out_num */
+            gnc_set_num_action (NULL,
+                                xaccTransGetSplit (new_trans, trans_split_index),
+                                out_num, NULL);
+            /* note that if the transaction has multiple splits to the register
+             * account, only the anchor split will be set with user input. The
+             * user will have to adjust other splits manually. */
+        }
+
+        xaccTransCommitEdit (new_trans);
+
+        if (out_num != NULL)
+           g_free (out_num);
+
+        if (use_split_action_for_num_field && out_tnum != NULL)
+            g_free (out_tnum);
+    }
+    LEAVE(" ");
+    return TRUE;
+}
+
+
+static gboolean gtcsr_move_current_entry_updown(GncTreeViewSplitReg *view,
+                                                gboolean move_up, gboolean really_do_it)
+{
+    GncTreeModelSplitReg *model;
+    GtkTreePath *mpath = NULL, *spath = NULL, *spath_target = NULL, *mpath_target = NULL;
+    GtkTreeIter m_iter, m_iter_target;
+    gboolean resultvalue = FALSE;
+    g_return_val_if_fail(view, FALSE);
+
+    ENTER("");
+
+    // The allocated memory references will all be cleaned up in the
+    // updown_finish: label.
+
+    model = gnc_tree_view_split_reg_get_model_from_view (view);
+    g_return_val_if_fail(model, FALSE);
+
+    if (model->sort_col != COL_DATE)
+    {
+        LEAVE("Not sorted by date - no up/down move available");
+        return FALSE;
+    }
+
+    mpath = gnc_tree_view_split_reg_get_current_path (view);
+    if (!mpath)
+    {
+        LEAVE("No current path available - probably on the blank split.");
+        goto updown_finish;
+    }
+
+    spath = gnc_tree_view_split_reg_get_sort_path_from_model_path (view, mpath);
+    g_return_val_if_fail(spath, FALSE);
+
+    spath_target = gtk_tree_path_copy(spath);
+    if (move_up)
+    {
+        gboolean move_was_made = gtk_tree_path_prev(spath_target);
+        if (!move_was_made)
+        {
+            LEAVE("huh, no path_prev() possible");
+            goto updown_finish;
+        }
+    }
+    else
+    {
+        gtk_tree_path_next(spath_target);
+        // The path_next() function does not give a return value, see
+        // https://mail.gnome.org/archives/gtk-list/2010-January/msg00171.html
+    }
+
+    if (gtk_tree_path_compare(spath, spath_target) == 0)
+    {
+        LEAVE("oops, paths are equal");
+        goto updown_finish;
+    }
+
+    mpath_target = gnc_tree_view_split_reg_get_model_path_from_sort_path (view, spath_target);
+    if (!mpath_target)
+    {
+        LEAVE("no path to target row");
+        goto updown_finish;
+    }
+
+    if (!gtk_tree_model_get_iter (GTK_TREE_MODEL (model), &m_iter, mpath))
+    {
+        LEAVE("No iter for current row");
+        goto updown_finish;
+    }
+    if (!gtk_tree_model_get_iter (GTK_TREE_MODEL (model), &m_iter_target, mpath_target))
+    {
+        LEAVE("No iter for target row");
+        goto updown_finish;
+    }
+
+    {
+        gboolean is_blank, is_blank_target;
+        Split *current_split, *target_split;
+        Transaction *current_trans, *target_trans;
+        gnc_tree_model_split_reg_get_split_and_trans (GNC_TREE_MODEL_SPLIT_REG (model), &m_iter,
+                                                      NULL, NULL, NULL, &is_blank,
+                                                      &current_split, &current_trans);
+        gnc_tree_model_split_reg_get_split_and_trans (GNC_TREE_MODEL_SPLIT_REG (model), &m_iter_target,
+                                                      NULL, NULL, NULL, &is_blank_target,
+                                                      &target_split, &target_trans);
+        if (is_blank || is_blank_target)
+        {
+            LEAVE("blank split involved, ignored.");
+            goto updown_finish;
+        }
+        if (xaccTransEqual(current_trans, target_trans, TRUE, FALSE, FALSE, FALSE))
+        {
+            LEAVE("two times the same txn, ignored.");
+            goto updown_finish;
+        }
+        if (xaccTransGetIsClosingTxn(current_trans)
+                || xaccTransGetIsClosingTxn(target_trans))
+        {
+            LEAVE("One of the txn is book-closing - no re-ordering allowed.");
+            goto updown_finish;
+        }
+
+        /* Only continue if both have the same date and num, because the
+         * "standard ordering" is tied to the date anyway. */
+        {
+            Timespec t1, t2;
+            GDate d1 = xaccTransGetDatePostedGDate(current_trans),
+                  d2 = xaccTransGetDatePostedGDate(target_trans);
+            if (g_date_compare(&d1, &d2) != 0)
+            {
+                LEAVE("unequal DatePosted, ignoring");
+                goto updown_finish;
+            }
+            if (g_strcmp0(xaccTransGetNum(current_trans),
+                          xaccTransGetNum(target_trans)) != 0)
+            {
+                LEAVE("unequal Num, ignoring");
+                goto updown_finish;
+            }
+
+            /* Special treatment if the equality doesn't hold if we access the
+            dates as timespec. See the comment in gncEntrySetDateGDate() for the
+            reason: Some code used the timespec at noon for the EntryDate, other
+            code used the timespec at the start of day. */
+            t1 = xaccTransRetDatePostedTS(current_trans);
+            t2 = xaccTransRetDatePostedTS(target_trans);
+            if (really_do_it && !timespec_equal(&t1, &t2))
+            {
+                /* Timespecs are not equal, even though the GDates were equal? Then
+                we set the GDates again. This will force the timespecs to be equal
+                as well. */
+                xaccTransSetDatePostedGDate(current_trans, d1);
+                xaccTransSetDatePostedGDate(target_trans, d2);
+            }
+        }
+
+        // Check whether any of the two splits are frozen
+        if (xaccSplitGetReconcile(current_split) == FREC
+                || xaccSplitGetReconcile(target_split) == FREC)
+        {
+            LEAVE("either current or target split is frozen. No modification allowed.");
+            goto updown_finish;
+        }
+
+        // If really_do_it is FALSE, we are only in query mode and shouldn't
+        // modify anything. But if it is TRUE, please go ahead and do the move.
+        if (really_do_it)
+        {
+            // Check whether any of the two splits are reconciled
+            if (xaccSplitGetReconcile(current_split) == YREC
+                    && !gnc_tree_control_split_reg_recn_test(view, spath))
+            {
+                LEAVE("current split is reconciled and user chose not to modify it");
+                goto updown_finish;
+            }
+            if (xaccSplitGetReconcile(target_split) == YREC
+                    && !gnc_tree_control_split_reg_recn_test(view, spath_target))
+            {
+                LEAVE("target split is reconciled and user chose not to modify it");
+                goto updown_finish;
+            }
+
+            PINFO("Ok, about to switch ordering for current desc='%s' target desc='%s'",
+                  xaccTransGetDescription(current_trans),
+                  xaccTransGetDescription(target_trans));
+
+            gnc_suspend_gui_refresh ();
+
+            /* Swap the date-entered of both entries. That's already
+             * sufficient! */
+            {
+                Timespec time_current = xaccTransRetDateEnteredTS(current_trans);
+                Timespec time_target = xaccTransRetDateEnteredTS(target_trans);
+
+                /* Special treatment for identical times (potentially caused
+                 * by the "duplicate entry" command) */
+                if (timespec_equal(&time_current, &time_target))
+                {
+                    g_warning("Surprise - both DateEntered are equal.");
+                    /* We just increment the DateEntered of the previously
+                     * lower of the two by one second. This might still cause
+                     * issues if multiple entries had this problem, but
+                     * whatever. */
+                    if (move_up)
+                        time_current.tv_sec++;
+                    else
+                        time_target.tv_sec++;
+                }
+
+                /* Write the new DateEntered. */
+                xaccTransSetDateEnteredTS(current_trans, &time_target);
+                xaccTransSetDateEnteredTS(target_trans, &time_current);
+
+                /* FIXME: Do we need to notify anyone about the changed ordering? */
+            }
+
+            gnc_resume_gui_refresh ();
+
+            LEAVE("two txn switched, done.");
+        }
+        resultvalue = TRUE;
+        goto updown_finish;
+    }
+updown_finish:
+    // memory cleanup
+    //gtk_tree_path_free (mpath); // Should this be freed??
+    gtk_tree_path_free(spath);
+    gtk_tree_path_free(spath_target);
+    gtk_tree_path_free(mpath_target);
+    return resultvalue;
+}
+
+gboolean gnc_tree_control_split_reg_move_current_entry_updown (GncTreeViewSplitReg *view,
+                                                            gboolean move_up)
+{
+    return gtcsr_move_current_entry_updown(view, move_up, TRUE);
+}
+
+gboolean gnc_tree_control_split_reg_is_current_movable_updown (GncTreeViewSplitReg *view,
+                                                               gboolean move_up)
+{
+    return gtcsr_move_current_entry_updown(view, move_up, FALSE);
+}
+
+
+/* Save any open edited transactions on closing register */
+gboolean
+gnc_tree_control_split_reg_save (GncTreeViewSplitReg *view, gboolean reg_closing)
+{
+    Transaction *dirty_trans;
+    Transaction *blank_trans;
+    Transaction *trans;
+//    Split *split;
+//    Split *current_trans_split;
+
+    ENTER("view=%p, reg_closing=%s", view, reg_closing ? "TRUE" : "FALSE");
+
+    if (!view)
+    {
+        LEAVE("no view");
+        return FALSE;
+    }
+
+    /* Make sure we have stopped editing */
+    gnc_tree_view_split_reg_finish_edit (view);
+
+    if (reg_closing)
+        view->reg_closing = TRUE;
+
+    dirty_trans = gnc_tree_view_split_reg_get_dirty_trans (view);
+    blank_trans = gnc_tree_control_split_reg_get_blank_trans (view);
+
+    /* get the handle to the current split and transaction */
+//    split = gnc_tree_view_split_reg_get_current_split (view);
+    trans = gnc_tree_view_split_reg_get_current_trans (view);
+
+//    current_trans_split = gnc_tree_control_split_reg_get_current_trans_split (view);
+
+    if (trans == NULL)
+    {
+        LEAVE("no transaction");
+        return FALSE;
+    }
+
+    if (!xaccTransIsOpen (trans))
+    {
+        LEAVE("transaction not open");
+        return FALSE;
+    }
+
+    if (trans == dirty_trans )
+    {
+        if (trans != blank_trans)
+        {
+           /* Existing Transaction, we are going to commit. */
+
+            PINFO("committing trans (%p)", trans);
+            xaccTransCommitEdit (trans);
+            gnc_tree_view_split_reg_set_dirty_trans (view, NULL);
+
+            LEAVE("Existing Transaction committed");
+            return TRUE;
+        }
+        else
+        {
+           /* Blank Transaction, we are going to commit. */
+
+            PINFO("start committing blank trans (%p)", trans);
+//FIXME More stuff ?
+
+            if (xaccTransCountSplits (trans) == 0)
+            {
+                GtkWidget *dialog, *window;
+                gint response;
+                /* Translators: This message will be presented when a user *
+                 * attempts to record a transaction without splits        */
+                const char *title = _("Not enough information for Blank Transaction?");
+                const char *message =
+                    _("The blank transaction does not have enough information to save it. Would you like to "
+                      "return to the transaction to update, or cancel the save?");
+                window = gnc_tree_view_split_reg_get_parent (view);
+                dialog = gtk_message_dialog_new (GTK_WINDOW (window),
+                                        GTK_DIALOG_DESTROY_WITH_PARENT,
+                                        GTK_MESSAGE_QUESTION,
+                                        GTK_BUTTONS_CANCEL,
+                                        "%s", title);
+                gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+                        "%s", message);
+                gtk_dialog_add_button (GTK_DIALOG (dialog),
+                              _("_Return"), GTK_RESPONSE_ACCEPT);
+
+                gtk_widget_grab_focus (gtk_dialog_get_widget_for_response (GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT));
+
+                response = gtk_dialog_run (GTK_DIALOG (dialog));
+//                response = gnc_dialog_run (GTK_DIALOG (dialog), "transaction_incomplete");
+                gtk_widget_destroy (dialog);
+
+                if (response != GTK_RESPONSE_ACCEPT)
+                {
+                    LEAVE("save cancelled");
+                    return TRUE;
+                }
+                LEAVE("return to transaction");
+                return FALSE;
+            }
+
+            xaccTransCommitEdit (trans);
+            gnc_tree_view_split_reg_set_dirty_trans (view, NULL);
+
+            LEAVE("Blank Transaction committed");
+            return TRUE;
+        }
+    }
+
+    LEAVE(" ");
+    return TRUE;
+}
+
+
+/* Allow the reconcile flag to be changed */
+gboolean
+gnc_tree_control_split_reg_recn_change (GncTreeViewSplitReg *view, GtkTreePath *spath)
+{
+    GtkWidget *dialog, *window;
+    GncTreeModelSplitReg *model;
+    GtkTreePath *mpath;
+    GtkTreeIter m_iter;
+    Split *split = NULL;
+    Transaction *trans = NULL;
+    gboolean is_trow1, is_trow2, is_split, is_blank;
+    Account *anchor;
+    char rec;
+    const gchar *title = _("Mark split as unreconciled?");
+    const gchar *message =
+        _("You are about to mark a reconciled split as unreconciled. Doing "
+          "so might make future reconciliation difficult! Continue "
+          "with this change?");
+    gint response;
+
+    ENTER(" ");
+
+    model = gnc_tree_view_split_reg_get_model_from_view (view);
+
+    anchor = gnc_tree_model_split_reg_get_anchor (model);
+
+    mpath = gnc_tree_view_split_reg_get_model_path_from_sort_path (view, spath);
+
+    if (!gtk_tree_model_get_iter (GTK_TREE_MODEL (model), &m_iter, mpath))
+    {
+        gtk_tree_path_free (mpath);
+        return FALSE;
+    }
+
+    gnc_tree_model_split_reg_get_split_and_trans (GNC_TREE_MODEL_SPLIT_REG (model), &m_iter,
+                                 &is_trow1, &is_trow2, &is_split, &is_blank, &split, &trans);
+
+    if (is_trow1 || is_trow2)
+        split = xaccTransFindSplitByAccount (trans, anchor);
+
+    rec = xaccSplitGetReconcile (split);
+
+    if (rec != YREC)
+    {
+        gtk_tree_path_free (mpath);
+        LEAVE("Not reconciled");
+        return TRUE;
+    }
+
+    /* Does the user want to be warned? */
+    window = gnc_tree_view_split_reg_get_parent (view);
+    dialog =
+        gtk_message_dialog_new (GTK_WINDOW (window),
+                               GTK_DIALOG_DESTROY_WITH_PARENT,
+                               GTK_MESSAGE_WARNING,
+                               GTK_BUTTONS_CANCEL,
+                               "%s", title);
+    gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+            "%s", message);
+    gtk_dialog_add_button (GTK_DIALOG (dialog), _("_Unreconcile"),
+                          GTK_RESPONSE_YES);
+    response = gnc_dialog_run (GTK_DIALOG (dialog), GNC_PREF_WARN_REG_RECD_SPLIT_UNREC);
+    gtk_widget_destroy (dialog);
+
+    if (response == GTK_RESPONSE_YES)
+    {
+        char rec = 'n';
+        trans = xaccSplitGetParent (split);
+
+        gnc_tree_view_split_reg_set_dirty_trans (view, trans);
+        if (!xaccTransIsOpen (trans))
+            xaccTransBeginEdit (trans);
+
+        xaccSplitSetReconcile (split, rec);
+
+        gtk_tree_path_free (mpath);
+        LEAVE("mark split unreconciled");
+        return TRUE;
+    }
+    gtk_tree_path_free (mpath);
+    LEAVE("Canceled split unreconciled");
+    return FALSE;
+}
+
+
+/* Test for splits being reconciled and decide to allow changes */
+gboolean
+gnc_tree_control_split_reg_recn_test (GncTreeViewSplitReg *view, GtkTreePath *spath)
+{
+    GncTreeModelSplitReg *model;
+    GtkTreePath *mpath;
+    GtkTreeIter m_iter;
+    Split *split = NULL;
+    Transaction *trans = NULL;
+    gboolean is_trow1, is_trow2, is_split, is_blank;
+    Account *anchor;
+    char recn;
+
+    ENTER(" ");
+
+    /* This assumes we reset the flag whenever we change splits. */
+    if (view->change_allowed)
+    {
+        LEAVE("change allowed is set");
+        return TRUE;
+    }
+
+    model = gnc_tree_view_split_reg_get_model_from_view (view);
+
+    anchor = gnc_tree_model_split_reg_get_anchor (model);
+
+    mpath = gnc_tree_view_split_reg_get_model_path_from_sort_path (view, spath);
+
+    if (!gtk_tree_model_get_iter (GTK_TREE_MODEL (model), &m_iter, mpath))
+    {
+        gtk_tree_path_free (mpath);
+        LEAVE("No path");
+        return TRUE;
+    }
+
+    gnc_tree_model_split_reg_get_split_and_trans (GNC_TREE_MODEL_SPLIT_REG (model), &m_iter,
+                                 &is_trow1, &is_trow2, &is_split, &is_blank, &split, &trans);
+
+    if (is_trow1 || is_trow2)
+        split = xaccTransFindSplitByAccount (trans, anchor);
+
+    if (!split)
+    {
+        gtk_tree_path_free (mpath);
+        LEAVE("No split");
+        return TRUE;
+    }
+
+    recn = xaccSplitGetReconcile (split);
+
+    if (recn == YREC || xaccTransHasReconciledSplits (trans))
+    {
+        GtkWidget *dialog, *window;
+        gint response;
+        const gchar *title;
+        const gchar *message;
+
+        if(recn == YREC)
+        {
+            title = _("Change reconciled split?");
+            message =
+             _("You are about to change a reconciled split. Doing so might make "
+               "future reconciliation difficult! Continue with this change?");
+        }
+        else
+        {
+            title = _("Change split linked to a reconciled split?");
+            message =
+            _("You are about to change a split that is linked to a reconciled split. "
+              "Doing so might make future reconciliation difficult! Continue with this change?");
+        }
+
+        /* Does the user want to be warned? */
+        window = gnc_tree_view_split_reg_get_parent (view);
+        dialog =
+            gtk_message_dialog_new (GTK_WINDOW (window),
+                                   GTK_DIALOG_DESTROY_WITH_PARENT,
+                                   GTK_MESSAGE_WARNING,
+                                   GTK_BUTTONS_CANCEL,
+                                   "%s", title);
+        gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+                "%s", message);
+        gtk_dialog_add_button (GTK_DIALOG (dialog), _("Chan_ge Split"),
+                              GTK_RESPONSE_YES);
+        response = gnc_dialog_run (GTK_DIALOG (dialog), GNC_PREF_WARN_REG_RECD_SPLIT_MOD);
+        gtk_widget_destroy (dialog);
+
+        if (response != GTK_RESPONSE_YES)
+        {
+            gtk_tree_path_free (mpath);
+            LEAVE("cancel reconciled split");
+            return FALSE;
+        }
+    }
+    view->change_allowed = TRUE;
+    gtk_tree_path_free (mpath);
+    LEAVE(" ");
+    return TRUE;
+}
+
+
+/* Return the account for name given or create it */ 
+Account *
+gnc_tree_control_split_reg_get_account_by_name (GncTreeViewSplitReg *view, const char *name)
+{
+    GtkWidget *window;
+    const char *placeholder = _("The account %s does not allow transactions.");
+    const char *missing = _("The account %s does not exist. "
+                            "Would you like to create it?");
+    Account *account;
+
+    if (!name || (strlen(name) == 0))
+        return NULL;
+
+    /* Find the account */
+    if (gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL_REGISTER, GNC_PREF_SHOW_LEAF_ACCT_NAMES))
+        account = gnc_account_lookup_by_name (gnc_get_current_root_account(), name);
+    else
+        account = gnc_account_lookup_by_full_name (gnc_get_current_root_account(), name);
+
+    if (!account)
+        account = gnc_account_lookup_by_code (gnc_get_current_root_account(), name);
+
+    window = gnc_tree_view_split_reg_get_parent (view);
+
+    if (!account)
+    {
+        /* Ask if they want to create a new one. */
+        if (!gnc_verify_dialog (window, TRUE, missing, name))
+            return NULL;
+
+        /* User said yes, they want to create a new account. */
+        account = gnc_ui_new_accounts_from_name_window (name);
+        if (!account)
+            return NULL;
+    }
+    /* Now have the account. */
+
+    /* See if the account (either old or new) is a placeholder. */
+    if (xaccAccountGetPlaceholder (account))
+        gnc_error_dialog (window, placeholder, name);
+
+    /* Be seeing you. */
+    return account;
+}
+
+/*****************************************************************************
+ *                         ClipBoard Functions                               *
+ *****************************************************************************/
+static Transaction *clipboard_trans = NULL;
+/* Must never dereference. */
+static const Account *clipboard_acct = NULL;
+
+
+/* Return the split account for which ancestor is it's parent */
+static Account *
+gtc_sr_get_account_for_trans_ancestor (const Transaction *trans, const Account *ancestor)
+{
+    GList *node;
+
+    for (node = xaccTransGetSplitList (trans); node; node = node->next)
+    {
+        Split *split = node->data;
+        Account *split_acc = xaccSplitGetAccount (split);
+
+        if (!xaccTransStillHasSplit (trans, split))
+            continue;
+
+        if (ancestor == split_acc)
+            return split_acc;
+
+        if (ancestor && xaccAccountHasAncestor (split_acc, ancestor))
+            return split_acc;
+    }
+    return NULL;
+}
+
+
+void
+gnc_tree_control_split_reg_cut_trans (GncTreeViewSplitReg *view)
+{
+    GncTreeModelSplitReg *model;
+    Transaction *from_trans;
+    Account *anchor;
+
+    g_return_if_fail (GNC_IS_TREE_VIEW_SPLIT_REG (view));
+
+    model = gnc_tree_view_split_reg_get_model_from_view (view);
+
+    anchor = gnc_tree_model_split_reg_get_anchor (model);
+
+    from_trans = gnc_tree_view_split_reg_get_current_trans (view);
+    if (!from_trans)
+        return;
+
+    /* Test for read only */
+    if (gtc_sr_is_trans_readonly_and_warn (view, from_trans))
+        return;
+
+    if (!xaccTransIsOpen (clipboard_trans))
+        xaccTransBeginEdit (clipboard_trans);
+    if (clipboard_trans)
+        xaccTransDestroy (clipboard_trans);
+
+    clipboard_trans = xaccTransCopyToClipBoard (from_trans);
+    clipboard_acct = gtc_sr_get_account_for_trans_ancestor (from_trans, anchor);
+
+    gnc_tree_view_split_reg_delete_current_trans (view);
+}
+
+
+void
+gnc_tree_control_split_reg_copy_trans (GncTreeViewSplitReg *view)
+{
+    GncTreeModelSplitReg *model;
+    Transaction *from_trans;
+    Account *anchor;
+
+    g_return_if_fail (GNC_IS_TREE_VIEW_SPLIT_REG (view));
+
+    model = gnc_tree_view_split_reg_get_model_from_view (view);
+
+    from_trans = gnc_tree_view_split_reg_get_current_trans (view);
+    if (!from_trans)
+        return;
+
+    anchor = gnc_tree_model_split_reg_get_anchor (model);
+
+    clipboard_acct = gtc_sr_get_account_for_trans_ancestor (from_trans, anchor);
+
+    if (!xaccTransIsOpen (clipboard_trans))
+        xaccTransBeginEdit (clipboard_trans);
+    if (clipboard_trans)
+        xaccTransDestroy (clipboard_trans);
+
+    clipboard_trans = xaccTransCopyToClipBoard (from_trans);
+}
+
+void
+gnc_tree_control_split_reg_paste_trans (GncTreeViewSplitReg *view)
+{
+    GncTreeModelSplitReg *model;
+    Account *anchor_acct;
+    Transaction *to_trans;
+
+    g_return_if_fail (GNC_IS_TREE_VIEW_SPLIT_REG (view));
+
+    model = gnc_tree_view_split_reg_get_model_from_view (view);
+    anchor_acct = gnc_tree_model_split_reg_get_anchor (model);
+
+    to_trans = gnc_tree_view_split_reg_get_current_trans (view);
+    if (!to_trans || !clipboard_trans)
+        return;
+
+    /* See if we are being edited in another register */
+    if (gtc_sr_trans_test_for_edit (view, to_trans))
+        return;
+
+    /* Test for read only */
+    if (gtc_sr_is_trans_readonly_and_warn (view, to_trans))
+        return;
+
+    //FIXME You can not paste from gl to a register, is this too simplistic
+    if (clipboard_acct == NULL && anchor_acct != NULL)
+    {
+        GtkWidget *window;
+
+        window = gnc_tree_view_split_reg_get_parent (view);
+        gnc_error_dialog (window, "%s",
+                         _("You can not paste from the general journal to a register."));
+        return;
+    }
+
+    gnc_tree_view_split_reg_set_dirty_trans (view, to_trans);
+    if (!xaccTransIsOpen (to_trans))
+        xaccTransBeginEdit (to_trans);
+
+    // Remove the blank split
+    gnc_tree_model_split_reg_set_blank_split_parent (model, to_trans, TRUE);
+
+    xaccTransCopyFromClipBoard (clipboard_trans, to_trans, clipboard_acct, anchor_acct, FALSE);
+
+    // Add the blank split back
+    gnc_tree_model_split_reg_set_blank_split_parent (model, to_trans, FALSE);
+
+    // Refresh the view
+    g_signal_emit_by_name (model, "refresh_trans", NULL);
+}
+
+void
+gnc_tree_control_auto_complete (GncTreeViewSplitReg *view, Transaction *trans,  const gchar *new_text)
+{
+    GncTreeModelSplitReg *model;
+    Transaction          *btrans;
+    GtkListStore         *desc_list;
+    GtkTreeIter           iter;
+    gboolean              valid;
+
+    g_return_if_fail (GNC_IS_TREE_VIEW_SPLIT_REG (view));
+    DEBUG("auto_complete - trans %p and description '%s'", trans, new_text);
+
+    model = gnc_tree_view_split_reg_get_model_from_view (view);
+
+    btrans = gnc_tree_model_split_get_blank_trans (model);
+
+    // if we are not looking at the blank trans, return.
+    if (trans != btrans)
+       return;
+
+    desc_list = gnc_tree_model_split_reg_get_description_list (model);
+
+    valid = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (desc_list), &iter);
+    while (valid)
+    {
+        Transaction *trans_from;
+        gchar *text;
+        // Walk through the list, reading each row
+        gtk_tree_model_get (GTK_TREE_MODEL (desc_list), &iter, 0, &text, 1, &trans_from, -1);
+
+        if (g_strcmp0 (text, new_text) == 0)
+        {
+            xaccTransCopyOnto (trans_from, trans);
+            g_free (text);
+            break;
+        }
+        g_free (text);
+
+        valid = gtk_tree_model_iter_next (GTK_TREE_MODEL (desc_list), &iter);
+    }
+}
+
diff --git a/src/gnome-utils/gnc-tree-control-split-reg.h b/gnucash/gnome-utils/gnc-tree-control-split-reg.h
similarity index 100%
rename from src/gnome-utils/gnc-tree-control-split-reg.h
rename to gnucash/gnome-utils/gnc-tree-control-split-reg.h
diff --git a/src/gnome-utils/gnc-tree-model-account-types.c b/gnucash/gnome-utils/gnc-tree-model-account-types.c
similarity index 100%
rename from src/gnome-utils/gnc-tree-model-account-types.c
rename to gnucash/gnome-utils/gnc-tree-model-account-types.c
diff --git a/src/gnome-utils/gnc-tree-model-account-types.h b/gnucash/gnome-utils/gnc-tree-model-account-types.h
similarity index 100%
rename from src/gnome-utils/gnc-tree-model-account-types.h
rename to gnucash/gnome-utils/gnc-tree-model-account-types.h
diff --git a/src/gnome-utils/gnc-tree-model-account.c b/gnucash/gnome-utils/gnc-tree-model-account.c
similarity index 100%
rename from src/gnome-utils/gnc-tree-model-account.c
rename to gnucash/gnome-utils/gnc-tree-model-account.c
diff --git a/src/gnome-utils/gnc-tree-model-account.h b/gnucash/gnome-utils/gnc-tree-model-account.h
similarity index 100%
rename from src/gnome-utils/gnc-tree-model-account.h
rename to gnucash/gnome-utils/gnc-tree-model-account.h
diff --git a/src/gnome-utils/gnc-tree-model-budget.c b/gnucash/gnome-utils/gnc-tree-model-budget.c
similarity index 100%
rename from src/gnome-utils/gnc-tree-model-budget.c
rename to gnucash/gnome-utils/gnc-tree-model-budget.c
diff --git a/src/gnome-utils/gnc-tree-model-budget.h b/gnucash/gnome-utils/gnc-tree-model-budget.h
similarity index 100%
rename from src/gnome-utils/gnc-tree-model-budget.h
rename to gnucash/gnome-utils/gnc-tree-model-budget.h
diff --git a/src/gnome-utils/gnc-tree-model-commodity.c b/gnucash/gnome-utils/gnc-tree-model-commodity.c
similarity index 100%
rename from src/gnome-utils/gnc-tree-model-commodity.c
rename to gnucash/gnome-utils/gnc-tree-model-commodity.c
diff --git a/src/gnome-utils/gnc-tree-model-commodity.h b/gnucash/gnome-utils/gnc-tree-model-commodity.h
similarity index 100%
rename from src/gnome-utils/gnc-tree-model-commodity.h
rename to gnucash/gnome-utils/gnc-tree-model-commodity.h
diff --git a/src/gnome-utils/gnc-tree-model-owner.c b/gnucash/gnome-utils/gnc-tree-model-owner.c
similarity index 100%
rename from src/gnome-utils/gnc-tree-model-owner.c
rename to gnucash/gnome-utils/gnc-tree-model-owner.c
diff --git a/src/gnome-utils/gnc-tree-model-owner.h b/gnucash/gnome-utils/gnc-tree-model-owner.h
similarity index 100%
rename from src/gnome-utils/gnc-tree-model-owner.h
rename to gnucash/gnome-utils/gnc-tree-model-owner.h
diff --git a/src/gnome-utils/gnc-tree-model-price.c b/gnucash/gnome-utils/gnc-tree-model-price.c
similarity index 100%
rename from src/gnome-utils/gnc-tree-model-price.c
rename to gnucash/gnome-utils/gnc-tree-model-price.c
diff --git a/src/gnome-utils/gnc-tree-model-price.h b/gnucash/gnome-utils/gnc-tree-model-price.h
similarity index 100%
rename from src/gnome-utils/gnc-tree-model-price.h
rename to gnucash/gnome-utils/gnc-tree-model-price.h
diff --git a/src/gnome-utils/gnc-tree-model-selection.c b/gnucash/gnome-utils/gnc-tree-model-selection.c
similarity index 100%
rename from src/gnome-utils/gnc-tree-model-selection.c
rename to gnucash/gnome-utils/gnc-tree-model-selection.c
diff --git a/src/gnome-utils/gnc-tree-model-selection.h b/gnucash/gnome-utils/gnc-tree-model-selection.h
similarity index 100%
rename from src/gnome-utils/gnc-tree-model-selection.h
rename to gnucash/gnome-utils/gnc-tree-model-selection.h
diff --git a/src/gnome-utils/gnc-tree-model-split-reg.c b/gnucash/gnome-utils/gnc-tree-model-split-reg.c
similarity index 100%
rename from src/gnome-utils/gnc-tree-model-split-reg.c
rename to gnucash/gnome-utils/gnc-tree-model-split-reg.c
diff --git a/src/gnome-utils/gnc-tree-model-split-reg.h b/gnucash/gnome-utils/gnc-tree-model-split-reg.h
similarity index 100%
rename from src/gnome-utils/gnc-tree-model-split-reg.h
rename to gnucash/gnome-utils/gnc-tree-model-split-reg.h
diff --git a/src/gnome-utils/gnc-tree-model.c b/gnucash/gnome-utils/gnc-tree-model.c
similarity index 100%
rename from src/gnome-utils/gnc-tree-model.c
rename to gnucash/gnome-utils/gnc-tree-model.c
diff --git a/src/gnome-utils/gnc-tree-model.h b/gnucash/gnome-utils/gnc-tree-model.h
similarity index 100%
rename from src/gnome-utils/gnc-tree-model.h
rename to gnucash/gnome-utils/gnc-tree-model.h
diff --git a/src/gnome-utils/gnc-tree-util-split-reg.c b/gnucash/gnome-utils/gnc-tree-util-split-reg.c
similarity index 100%
rename from src/gnome-utils/gnc-tree-util-split-reg.c
rename to gnucash/gnome-utils/gnc-tree-util-split-reg.c
diff --git a/src/gnome-utils/gnc-tree-util-split-reg.h b/gnucash/gnome-utils/gnc-tree-util-split-reg.h
similarity index 100%
rename from src/gnome-utils/gnc-tree-util-split-reg.h
rename to gnucash/gnome-utils/gnc-tree-util-split-reg.h
diff --git a/src/gnome-utils/gnc-tree-view-account.c b/gnucash/gnome-utils/gnc-tree-view-account.c
similarity index 100%
rename from src/gnome-utils/gnc-tree-view-account.c
rename to gnucash/gnome-utils/gnc-tree-view-account.c
diff --git a/src/gnome-utils/gnc-tree-view-account.h b/gnucash/gnome-utils/gnc-tree-view-account.h
similarity index 100%
rename from src/gnome-utils/gnc-tree-view-account.h
rename to gnucash/gnome-utils/gnc-tree-view-account.h
diff --git a/src/gnome-utils/gnc-tree-view-commodity.c b/gnucash/gnome-utils/gnc-tree-view-commodity.c
similarity index 100%
rename from src/gnome-utils/gnc-tree-view-commodity.c
rename to gnucash/gnome-utils/gnc-tree-view-commodity.c
diff --git a/src/gnome-utils/gnc-tree-view-commodity.h b/gnucash/gnome-utils/gnc-tree-view-commodity.h
similarity index 100%
rename from src/gnome-utils/gnc-tree-view-commodity.h
rename to gnucash/gnome-utils/gnc-tree-view-commodity.h
diff --git a/src/gnome-utils/gnc-tree-view-owner.c b/gnucash/gnome-utils/gnc-tree-view-owner.c
similarity index 100%
rename from src/gnome-utils/gnc-tree-view-owner.c
rename to gnucash/gnome-utils/gnc-tree-view-owner.c
diff --git a/src/gnome-utils/gnc-tree-view-owner.h b/gnucash/gnome-utils/gnc-tree-view-owner.h
similarity index 100%
rename from src/gnome-utils/gnc-tree-view-owner.h
rename to gnucash/gnome-utils/gnc-tree-view-owner.h
diff --git a/src/gnome-utils/gnc-tree-view-price.c b/gnucash/gnome-utils/gnc-tree-view-price.c
similarity index 100%
rename from src/gnome-utils/gnc-tree-view-price.c
rename to gnucash/gnome-utils/gnc-tree-view-price.c
diff --git a/src/gnome-utils/gnc-tree-view-price.h b/gnucash/gnome-utils/gnc-tree-view-price.h
similarity index 100%
rename from src/gnome-utils/gnc-tree-view-price.h
rename to gnucash/gnome-utils/gnc-tree-view-price.h
diff --git a/gnucash/gnome-utils/gnc-tree-view-split-reg.c b/gnucash/gnome-utils/gnc-tree-view-split-reg.c
new file mode 100644
index 0000000..ab387a9
--- /dev/null
+++ b/gnucash/gnome-utils/gnc-tree-view-split-reg.c
@@ -0,0 +1,6421 @@
+/********************************************************************\
+ * gnc-tree-view-split-reg.c -- GtkTreeView implementation to       *
+ *                     display registers   in a GtkTreeView.        *
+ *                                                                  *
+ * Copyright (C) 2006-2007 Chris Shoemaker <c.shoemaker at cox.net>    *
+ * Copyright (C) 2012 Robert Fewell                                 *
+ *                                                                  *
+ * 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 at gnu.org                   *
+ *                                                                  *
+\********************************************************************/
+
+#include "config.h"
+
+#include <gtk/gtk.h>
+#include <glib/gi18n.h>
+#include <stdlib.h>
+#include <string.h>
+#include <gdk/gdkkeysyms.h>
+
+#include "gnc-tree-view.h"
+#include "gnc-tree-view-split-reg.h"
+#include "gnc-tree-model-split-reg.h"
+#include "gnc-tree-control-split-reg.h"
+#include "gnc-tree-util-split-reg.h"
+#include "gnc-ui.h"
+#include "gnc-warnings.h"
+#include "dialog-utils.h"
+#include "gnc-prefs.h"
+#include "Transaction.h"
+#include "engine-helpers.h"
+#include "Scrub.h"
+#include "gnc-exp-parser.h"
+#include "SchedXaction.h"
+
+#include "gnc-amount-edit.h"
+
+
+/* Signal codes */
+enum
+{
+    UPDATE_SIGNAL,
+    HELP_SIGNAL,
+    LAST_SIGNAL
+};
+
+typedef enum {
+    RESET,  //0
+    ACCEPT, //1
+    DISCARD,//2
+    CANCEL  //3
+}TransConfirm;
+
+
+/** Static Globals *******************************************************/
+static QofLogModule log_module = GNC_MOD_LEDGER;
+
+static void gnc_tree_view_split_reg_class_init (GncTreeViewSplitRegClass *klass);
+static void gnc_tree_view_split_reg_init (GncTreeViewSplitReg *view);
+static void gnc_tree_view_split_reg_dispose (GObject *object);
+static void gnc_tree_view_split_reg_finalize (GObject *object);
+
+static guint gnc_tree_view_split_reg_signals[LAST_SIGNAL] = {0};
+
+static void gnc_tree_view_split_reg_pref_changed (gpointer prefs, gchar *pref, gpointer user_data);
+
+static void gtv_sr_cdf0 (GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTreeModel *s_model,
+				GtkTreeIter *s_iter, gpointer user_data);
+
+static void gtv_sr_cdf1 (GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTreeModel *s_model,
+				GtkTreeIter *s_iter, gpointer user_data);
+
+static void gtv_sr_control_cdf0 (GtkTreeViewColumn *col, GtkCellRenderer *renderer,
+                                 GtkTreeModel *s_model, GtkTreeIter *s_iter, gpointer user_data);
+
+static void gtv_sr_titles (GncTreeViewSplitReg *view, RowDepth depth);
+
+static void gtv_sr_edited_cb (GtkCellRendererText *cell, const gchar *path_string,
+				const gchar *new_text, gpointer user_data);
+
+static void gtv_sr_edited_normal_cb (GtkCellRendererText *cell, const gchar *path_string,
+                                const gchar *new_text, gpointer user_data);
+
+static void gtv_sr_edited_template_cb (GtkCellRendererText *cell, const gchar *path_string,
+                                const gchar *new_text, gpointer user_data);
+
+//static void start_edit (GtkCellRenderer *cr, GtkCellEditable *editable,
+//				const gchar *path, gpointer user_data); //FIXME This may not be needed
+
+static void gtv_sr_begin_edit (GncTreeViewSplitReg *view, Transaction *trans);
+
+static void gtv_sr_finish_edit (GncTreeViewSplitReg *view);
+
+static void gtv_sr_editable_start_editing_cb (GtkCellRenderer *cr, GtkCellEditable *editable,
+				const gchar *path, gpointer user_data);
+
+static void gtv_sr_editing_canceled_cb (GtkCellRenderer *cr, gpointer user_data);
+
+//static void gtv_sr_match_selected_cb (GtkEntryCompletion *widget, GtkTreeModel *model,
+//                        GtkTreeIter *iter, gpointer user_data); //FIXME This may not be needed
+
+//static void gtv_sr_changed_cb (GtkCellRendererCombo *widget, gchar *path_string,
+//                        GtkTreeIter *iter, gpointer user_data); //FIXME This may not be needed
+
+static void gtv_sr_selection_move_delete_cb (GncTreeModelSplitReg *model, gpointer item, gpointer user_data);
+
+static gboolean gtv_sr_key_press_cb (GtkWidget *widget, GdkEventKey *event, gpointer user_data);
+
+static gboolean gtv_sr_ed_key_press_cb (GtkWidget *widget, GdkEventKey *event, gpointer user_data);
+
+static gboolean gtv_sr_button_cb (GtkWidget *widget, GdkEventButton *event, gpointer user_data);
+
+static gboolean gtv_sr_focus_out_cb (GtkWidget *widget, GdkEventFocus *event, gpointer user_data);
+
+static void gtv_sr_motion_cb (GtkTreeSelection *sel, gpointer user_data);
+
+static void gtv_sr_refresh_view_cb (GncTreeModelSplitReg *model, gpointer user_data);
+
+static gboolean gtv_sr_transaction_changed_confirm (GncTreeViewSplitReg *view, Transaction *new_trans);
+
+
+typedef struct {
+    ViewCol viewcol;
+    gint modelcol;
+    gchar *title;
+    gchar *pref_name;
+    gchar *sizer;
+    int visibility_model_col;
+    int always_visible_col;
+    void (*edited_cb)(GtkCellRendererText *, const gchar *,
+                      const gchar *, gpointer);
+    void (*editing_started_cb)(GtkCellRenderer *, GtkCellEditable *,
+                               const gchar *, gpointer);
+    GtkTreeIterCompareFunc sort_fn;
+} ColDef;
+
+
+static ColDef all_tree_view_split_reg_columns[] = {
+    {COL_DATE, GNC_TREE_MODEL_SPLIT_REG_COL_DATE,
+     "Date", "date", "00/00/0000",
+     GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS, 1,
+     gtv_sr_edited_cb, gtv_sr_editable_start_editing_cb,
+     gnc_tree_model_split_reg_sort_iter_compare_func},
+
+    {COL_DUEDATE, -1,
+     "Due Date", "duedate", "00/00/0000",
+     GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS, 1,
+     gtv_sr_edited_cb, gtv_sr_editable_start_editing_cb, NULL},
+
+    {COL_NUMACT, GNC_TREE_MODEL_SPLIT_REG_COL_NUMACT,
+     "Num / Act / Act", "numact", "0000",
+     GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS, 0,
+     gtv_sr_edited_cb, gtv_sr_editable_start_editing_cb,
+     gnc_tree_model_split_reg_sort_iter_compare_func},
+
+    {COL_DESCNOTES, GNC_TREE_MODEL_SPLIT_REG_COL_DESCNOTES,
+     "Description / Notes / Memo", "descnotes", "xxxxxxxxxxxxxxxxxxx",
+     GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS, 1,
+     gtv_sr_edited_cb, gtv_sr_editable_start_editing_cb,
+     gnc_tree_model_split_reg_sort_iter_compare_func},
+
+    {COL_TRANSFERVOID, -1,
+     "Transfer / Void", "transfervoid", "xxxxxxxxxxxxxxxxxxx",
+     GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS, 1,
+     gtv_sr_edited_cb, gtv_sr_editable_start_editing_cb, NULL},
+
+    {COL_RECN, GNC_TREE_MODEL_SPLIT_REG_COL_RECN,
+     "R", "recn", "xx",
+     GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS, 0,
+     gtv_sr_edited_cb, gtv_sr_editable_start_editing_cb,
+     gnc_tree_model_split_reg_sort_iter_compare_func},
+
+    {COL_TYPE, -1,
+     "Type", "type", "xx",
+     GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS, 0,
+     gtv_sr_edited_cb, gtv_sr_editable_start_editing_cb, NULL},
+
+    {COL_VALUE, -1,
+     "Value", "value", "00000",
+     GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS, 0,
+     gtv_sr_edited_cb, gtv_sr_editable_start_editing_cb, NULL},
+
+    {COL_AMOUNT, -1,
+     "Amount", "amount", "00000",
+     GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS, 0,
+     gtv_sr_edited_cb, gtv_sr_editable_start_editing_cb, NULL},
+
+    {COL_AMTVAL, -1,
+     "Amount / Value", "amtval", "00000",
+     GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS, 1,
+     gtv_sr_edited_cb, gtv_sr_editable_start_editing_cb, NULL},
+
+    {COL_RATE, -1,
+     "Rate", "rate", "00000",
+     GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS, 0,
+     gtv_sr_edited_cb, gtv_sr_editable_start_editing_cb, NULL},
+
+    {COL_PRICE, -1,
+     "Price", "price", "00000",
+     GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS, 1,
+     gtv_sr_edited_cb, gtv_sr_editable_start_editing_cb, NULL},
+
+    {COL_DEBIT, GNC_TREE_MODEL_SPLIT_REG_COL_DEBIT,
+     "Debit", "debit", "00000",
+     GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS, 1,
+     gtv_sr_edited_cb, gtv_sr_editable_start_editing_cb,
+     gnc_tree_model_split_reg_sort_iter_compare_func},
+
+    {COL_CREDIT, GNC_TREE_MODEL_SPLIT_REG_COL_CREDIT,
+     "Credit", "credit", "00000",
+     GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS, 1,
+     gtv_sr_edited_cb, gtv_sr_editable_start_editing_cb,
+     gnc_tree_model_split_reg_sort_iter_compare_func},
+
+    {COL_BALANCE, -1,
+     "Balance", "balance", "00000",
+     GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS, 0,
+     NULL, NULL, NULL},
+
+    {COL_STATUS, -1,
+     " ", "status", "x",
+     GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS, 1,
+     NULL, NULL, NULL},
+
+    {COL_COMM, -1,
+     "Commodity", "commodity", "xxxxxxxx",
+     GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS, 0,
+     NULL, NULL, NULL},
+};
+
+
+struct GncTreeViewSplitRegPrivate
+{
+    gboolean             disposed;
+  
+    Account             *anchor;              // The register default Account
+    gnc_commodity       *reg_comm;            // The register commodity (which may be a non-currency)
+    gnc_commodity       *reg_currency;        // The currency for txns in this register (guaranteed to be a currency)
+
+    Transaction         *current_trans;       // The current highlighted transaction
+    Split               *current_split;       // The current highlighted split
+    RowDepth             current_depth;       // The current depth 1=TROW1, 2=TROW2, 3=SPLIT3
+    GtkTreeRowReference *current_ref;         // The current model path reference
+
+    Transaction         *dirty_trans;         // Set when transaction is changed
+    TransConfirm         trans_confirm;       // This is the return value for gtv_sr_transaction_changed_confirm
+
+    GtkCellRenderer     *temp_cr;             // Pointer to Temp Cell Renderer
+    gulong               fo_handler_id;       // Focus out callback id
+
+    gboolean             acct_short_names;    // Use account short names
+    gboolean             double_line;         // Use double line mode
+    gboolean             expanded;            // Are we expanded to splits
+    gboolean             auto_complete;       // Whether auto complete has run
+    gboolean             negative_in_red;     // Display negative numbers in red
+    gboolean             use_horizontal_lines;// Draw horizontal lines
+    gboolean             use_vertical_lines;  // Draw vertical lines
+
+    gboolean             show_calendar_buttons;        // Show the calendar buttons
+    gboolean             show_extra_dates_on_selection;// Show the above on the selected transaction
+    gboolean             selection_to_blank_on_expand; // Move the selection to the blank split on expand
+
+    gint                 key_length;                   // The number of characters before auto complete starts.
+    gint                 single_button_press;          // Capture single button press.
+
+    gchar               *transfer_string;              // The transfer account string.
+    gboolean             stop_cell_move;               // Stops the cursor moving to a different cell.
+
+};
+
+/* Define some cell colors */
+#define PINKCELL "#F8BEC6"
+#define REDCELL "#F34943"
+#define BLUECELL "#1D80DF"
+#define BLACKCELL "#CBCBD2"
+#define YELLOWCELL "#FFEF98"
+#define ORANGECELL "#F39536"
+
+
+#define GNC_PREF_SHOW_EXTRA_DATES        "show-extra-dates"
+#define GNC_PREF_SHOW_EXTRA_DATES_ON_SEL "show-extra-dates-on-selection"
+#define GNC_PREF_SHOW_CAL_BUTTONS        "show-calendar-buttons"
+#define GNC_PREF_SEL_TO_BLANK_ON_EXPAND  "selection-to-blank-on-expand"
+#define GNC_PREF_KEY_LENGTH              "key-length"
+
+/* This could be a preference setting, show currency / commodity symbols */
+#define SHOW_SYMBOL FALSE
+
+#define GNC_TREE_VIEW_SPLIT_REG_GET_PRIVATE(o)  \
+   (G_TYPE_INSTANCE_GET_PRIVATE ((o), GNC_TYPE_TREE_VIEW_SPLIT_REG, GncTreeViewSplitRegPrivate))
+
+static GObjectClass *parent_class = NULL;
+
+GType
+gnc_tree_view_split_reg_get_type(void)
+{
+    static GType gnc_tree_view_split_reg_type = 0;
+
+    if (gnc_tree_view_split_reg_type == 0)
+    {
+        static const GTypeInfo our_info =
+        {
+            sizeof (GncTreeViewSplitRegClass),
+            NULL,
+            NULL,
+            (GClassInitFunc) gnc_tree_view_split_reg_class_init,
+            NULL,
+            NULL,
+            sizeof (GncTreeViewSplitReg),
+            0,
+            (GInstanceInitFunc) gnc_tree_view_split_reg_init
+        };
+
+        gnc_tree_view_split_reg_type = g_type_register_static (GNC_TYPE_TREE_VIEW,
+                                     "GncTreeViewSplitReg",
+                                     &our_info, 0);
+    }
+    return gnc_tree_view_split_reg_type;
+}
+
+
+static void
+gnc_tree_view_split_reg_class_init (GncTreeViewSplitRegClass *klass)
+{
+    GObjectClass *o_class;
+
+    parent_class = g_type_class_peek_parent (klass);
+
+    o_class = G_OBJECT_CLASS (klass);
+
+    o_class->dispose =  gnc_tree_view_split_reg_dispose;
+    o_class->finalize = gnc_tree_view_split_reg_finalize;
+
+    g_type_class_add_private (klass, sizeof(GncTreeViewSplitRegPrivate));
+
+    gnc_tree_view_split_reg_signals[UPDATE_SIGNAL] =
+        g_signal_new("update_signal",
+                     G_TYPE_FROM_CLASS (o_class),
+                     G_SIGNAL_RUN_LAST,
+                     G_STRUCT_OFFSET (GncTreeViewSplitRegClass, update_signal),
+                     NULL, NULL,
+                     g_cclosure_marshal_VOID__VOID,
+                     G_TYPE_NONE, 0);
+
+    gnc_tree_view_split_reg_signals[HELP_SIGNAL] =
+        g_signal_new("help_signal",
+                     G_TYPE_FROM_CLASS (o_class),
+                     G_SIGNAL_RUN_LAST,
+                     G_STRUCT_OFFSET (GncTreeViewSplitRegClass, help_signal),
+                     NULL, NULL,
+                     g_cclosure_marshal_VOID__VOID,
+                     G_TYPE_NONE, 0);
+
+    klass->update_signal = NULL;
+    klass->help_signal = NULL;
+}
+
+/*****************************************************************************/
+
+/* Return the tree model from the tree view */
+GncTreeModelSplitReg *
+gnc_tree_view_split_reg_get_model_from_view (GncTreeViewSplitReg *view)
+{
+    GtkTreeModelSort *s_model = GTK_TREE_MODEL_SORT (gtk_tree_view_get_model (GTK_TREE_VIEW (view)));
+    return GNC_TREE_MODEL_SPLIT_REG (gtk_tree_model_sort_get_model (GTK_TREE_MODEL_SORT (s_model)));
+}
+
+/* Get the model iter from the view path string */
+static gboolean
+gtv_sr_get_model_iter_from_view_string (GncTreeViewSplitReg *view,
+                                const gchar *path_string, GtkTreeIter *m_iter)
+{
+    GtkTreeModel *s_model;
+    GtkTreeIter s_iter;
+
+    s_model = gtk_tree_view_get_model (GTK_TREE_VIEW (view));
+
+    if (!gtk_tree_model_get_iter_from_string (s_model, &s_iter, path_string))
+    {
+        m_iter = NULL;
+        return FALSE;
+    }
+    gtk_tree_model_sort_convert_iter_to_child_iter (GTK_TREE_MODEL_SORT (s_model), m_iter, &s_iter);
+    return TRUE;
+}
+
+/* Get the model iter from the selection */
+static gboolean
+gtv_sr_get_model_iter_from_selection (GncTreeViewSplitReg *view,
+                              GtkTreeSelection *sel, GtkTreeIter *m_iter)
+{
+    GtkTreeModel *s_model;
+    GtkTreeIter s_iter;
+
+    if (gtk_tree_selection_get_selected (sel, &s_model, &s_iter))
+    {
+        gtk_tree_model_sort_convert_iter_to_child_iter (GTK_TREE_MODEL_SORT (s_model), m_iter, &s_iter);
+        return TRUE;
+    }
+    return FALSE;
+}
+
+/* Get sort model path from the model path
+ *
+ * Return A newly allocated GtkTreePath, or NULL */
+GtkTreePath *
+gnc_tree_view_split_reg_get_sort_path_from_model_path (GncTreeViewSplitReg *view, GtkTreePath *mpath)
+{
+    GtkTreeModel *s_model;
+    GtkTreePath *spath;
+
+    g_return_val_if_fail (mpath, NULL);
+    s_model = gtk_tree_view_get_model (GTK_TREE_VIEW (view));
+    spath = gtk_tree_model_sort_convert_child_path_to_path (GTK_TREE_MODEL_SORT (s_model), mpath);
+    if (!spath)
+    {
+        /* No parent path available */
+        return NULL;
+    }
+    return spath;
+}
+
+/* Get model path from the sort model path
+ *
+ * Return A newly allocated GtkTreePath, or NULL. */
+GtkTreePath *
+gnc_tree_view_split_reg_get_model_path_from_sort_path (GncTreeViewSplitReg *view, GtkTreePath *spath)
+{
+    GtkTreeModel *s_model;
+    GtkTreePath *mpath;
+
+    g_return_val_if_fail (spath, NULL);
+    s_model = gtk_tree_view_get_model (GTK_TREE_VIEW (view));
+    mpath = gtk_tree_model_sort_convert_path_to_child_path (GTK_TREE_MODEL_SORT (s_model), spath);
+    if (!mpath)
+    {
+        /* No child path available */
+        return NULL;
+    }
+    return mpath;
+}
+
+/*****************************************************************************/
+
+static void
+gnc_tree_view_split_reg_init (GncTreeViewSplitReg *view)
+{
+    view->priv = g_new0 (GncTreeViewSplitRegPrivate, 1);
+
+    view->priv->current_trans = NULL;
+    view->priv->current_split = NULL;
+    view->priv->current_depth = 0;
+    view->reg_closing = FALSE;
+    view->priv->fo_handler_id = 0;
+    view->priv->auto_complete = FALSE;
+    view->priv->trans_confirm = RESET;
+    view->priv->single_button_press = 0;
+
+    view->priv->transfer_string = g_strdup ("Dummy");
+    view->priv->stop_cell_move = FALSE;
+
+    view->priv->show_calendar_buttons = gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL_REGISTER, GNC_PREF_SHOW_CAL_BUTTONS);
+    view->show_extra_dates = gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL_REGISTER, GNC_PREF_SHOW_EXTRA_DATES);
+    view->priv->show_extra_dates_on_selection = gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL_REGISTER, GNC_PREF_SHOW_EXTRA_DATES_ON_SEL);
+    view->priv->selection_to_blank_on_expand = gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL_REGISTER, GNC_PREF_SEL_TO_BLANK_ON_EXPAND);
+    view->priv->key_length = gnc_prefs_get_float (GNC_PREFS_GROUP_GENERAL_REGISTER, GNC_PREF_KEY_LENGTH);
+
+    view->priv->acct_short_names = gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL_REGISTER, GNC_PREF_SHOW_LEAF_ACCT_NAMES);
+    view->priv->negative_in_red = gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL, GNC_PREF_NEGATIVE_IN_RED);
+    view->priv->use_horizontal_lines = gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL_REGISTER,
+                                                           GNC_PREF_DRAW_HOR_LINES);
+
+    view->priv->use_vertical_lines = gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL_REGISTER,
+                                                         GNC_PREF_DRAW_VERT_LINES);
+
+    gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL_REGISTER,
+                           GNC_PREF_DRAW_HOR_LINES,
+                           gnc_tree_view_split_reg_pref_changed,
+                           view);
+    gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL_REGISTER,
+                           GNC_PREF_DRAW_VERT_LINES,
+                           gnc_tree_view_split_reg_pref_changed,
+                           view);
+}
+
+
+static void
+gnc_tree_view_split_reg_dispose (GObject *object)
+{
+    GncTreeViewSplitReg *view;
+    GncTreeViewSplitRegPrivate *priv;
+
+    gnc_leave_return_if_fail (object != NULL);
+    gnc_leave_return_if_fail (GNC_IS_TREE_VIEW_SPLIT_REG (object));
+
+    view = GNC_TREE_VIEW_SPLIT_REG (object);
+    priv = GNC_TREE_VIEW_SPLIT_REG_GET_PRIVATE (view);
+
+    if (priv->disposed)
+        return;
+
+    ENTER("split reg view %p", object);
+
+    priv->disposed = TRUE;
+
+    if(view->priv->current_ref != NULL)
+    {
+        gtk_tree_row_reference_free (view->priv->current_ref);
+        view->priv->current_ref = NULL;
+    }
+
+    if (view->help_text)
+        g_free (view->help_text);
+
+    if (view->priv->transfer_string)
+        g_free (view->priv->transfer_string);
+
+    gnc_prefs_remove_cb_by_func (GNC_PREFS_GROUP_GENERAL_REGISTER,
+                                 GNC_PREF_DRAW_HOR_LINES,
+                                 gnc_tree_view_split_reg_pref_changed,
+                                 view);
+    gnc_prefs_remove_cb_by_func (GNC_PREFS_GROUP_GENERAL_REGISTER,
+                                 GNC_PREF_DRAW_VERT_LINES,
+                                 gnc_tree_view_split_reg_pref_changed,
+                                 view);
+
+    if (G_OBJECT_CLASS (parent_class)->dispose)
+        (* G_OBJECT_CLASS (parent_class)->dispose) (object);
+
+    LEAVE(" ");
+}
+
+
+static void
+gnc_tree_view_split_reg_finalize (GObject *object)
+{
+    gnc_leave_return_if_fail(object != NULL);
+    gnc_leave_return_if_fail(GNC_IS_TREE_VIEW_SPLIT_REG (object));
+
+    ENTER("split reg view %p", object);
+
+    if (G_OBJECT_CLASS(parent_class)->finalize)
+        (* G_OBJECT_CLASS(parent_class)->finalize) (object);
+
+    LEAVE(" ");
+}
+
+
+/* Update internal settings based on preferences */
+void
+gnc_tree_view_split_reg_refresh_from_prefs (GncTreeViewSplitReg *view)
+{
+    GncTreeModelSplitReg *model;
+
+    model = gnc_tree_view_split_reg_get_model_from_view (view);
+
+    model->use_theme_colors = gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL_REGISTER,
+                                                 GNC_PREF_USE_THEME_COLORS);
+    model->use_accounting_labels = gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL,
+                                                       GNC_PREF_ACCOUNTING_LABELS);
+
+    model->alt_colors_by_txn = gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL_REGISTER,
+                                                   GNC_PREF_ALT_COLOR_BY_TRANS);
+
+    view->priv->negative_in_red = gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL,
+                                                      GNC_PREF_NEGATIVE_IN_RED);
+}
+
+
+static void
+gnc_tree_view_split_reg_pref_changed (gpointer prefs, gchar *pref, gpointer user_data)
+{
+    GncTreeViewSplitReg *view = user_data;
+
+    g_return_if_fail (pref);
+
+    if (view == NULL)
+        return;
+
+    if (g_str_has_suffix (pref, GNC_PREF_DRAW_HOR_LINES) || g_str_has_suffix (pref, GNC_PREF_DRAW_VERT_LINES))
+    {
+        view->priv->use_horizontal_lines = gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL_REGISTER,
+                                                               GNC_PREF_DRAW_HOR_LINES);
+
+        view->priv->use_vertical_lines = gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL_REGISTER,
+                                                             GNC_PREF_DRAW_VERT_LINES);
+
+        if (view->priv->use_horizontal_lines)
+        {
+            if (view->priv->use_vertical_lines)
+                gtk_tree_view_set_grid_lines (GTK_TREE_VIEW (view), GTK_TREE_VIEW_GRID_LINES_BOTH);
+            else
+                gtk_tree_view_set_grid_lines (GTK_TREE_VIEW (view), GTK_TREE_VIEW_GRID_LINES_HORIZONTAL);
+        }
+        else if (view->priv->use_vertical_lines)
+            gtk_tree_view_set_grid_lines (GTK_TREE_VIEW (view), GTK_TREE_VIEW_GRID_LINES_VERTICAL);
+        else
+            gtk_tree_view_set_grid_lines (GTK_TREE_VIEW (view), GTK_TREE_VIEW_GRID_LINES_NONE);
+    }
+    else
+    {
+        g_warning("gnc_tree_view_split_reg_pref_changed: Unknown preference %s", pref);
+    }
+}
+
+
+/* Define which columns are in which views */
+static ViewCol *
+gnc_tree_view_split_reg_get_colummn_list (GncTreeModelSplitReg *model)
+{
+    DEBUG("Model-type is %d", model->type);
+
+    switch (model->type)
+    {
+    case BANK_REGISTER2:
+    case CASH_REGISTER2:
+    case ASSET_REGISTER2:
+    case CREDIT_REGISTER2:
+    case LIABILITY_REGISTER2:
+    case INCOME_REGISTER2:
+    case EXPENSE_REGISTER2:
+    case EQUITY_REGISTER2:
+    case TRADING_REGISTER2:
+    case INCOME_LEDGER2:
+        {
+        static ViewCol col_list[] = {
+        COL_DATE, COL_NUMACT, COL_DESCNOTES, COL_TRANSFERVOID, COL_RECN,
+        COL_STATUS, COL_DEBIT, COL_CREDIT, COL_BALANCE, -1};
+        return col_list;
+        }
+        break;
+
+    case GENERAL_JOURNAL2:
+        {
+        static ViewCol col_list[] = {
+        COL_DATE, COL_NUMACT, COL_DESCNOTES, COL_TRANSFERVOID, COL_RECN,
+        COL_STATUS, COL_COMM, COL_VALUE, COL_RATE, COL_AMOUNT, COL_DEBIT, COL_CREDIT, -1};
+        return col_list;
+        }
+        break;
+
+    case STOCK_REGISTER2:
+    case CURRENCY_REGISTER2:
+        {
+        static ViewCol col_list[] = {
+        COL_DATE, COL_NUMACT, COL_DESCNOTES, COL_TRANSFERVOID, COL_RECN,
+        COL_STATUS, COL_AMTVAL, COL_PRICE, COL_DEBIT, COL_CREDIT, COL_BALANCE, -1};
+        return col_list;
+        }
+        break;
+
+    case RECEIVABLE_REGISTER2:
+    case PAYABLE_REGISTER2:
+        {
+        static ViewCol col_list[] = {
+        COL_DATE, COL_TYPE, COL_DUEDATE, COL_NUMACT, COL_DESCNOTES, COL_TRANSFERVOID,
+        COL_STATUS, COL_DEBIT, COL_CREDIT, COL_BALANCE, -1};
+        return col_list;
+        }
+
+     case PORTFOLIO_LEDGER2:
+        {
+        static ViewCol col_list[] = {
+        COL_DATE, COL_NUMACT, COL_DESCNOTES, COL_TRANSFERVOID, COL_RECN,
+        COL_STATUS, COL_AMOUNT, COL_PRICE, COL_DEBIT, COL_CREDIT, -1};
+        return col_list;
+        }
+
+    case SEARCH_LEDGER2:
+        {
+        static ViewCol col_list[] = {
+        COL_DATE, COL_NUMACT, COL_DESCNOTES, COL_TRANSFERVOID, COL_RECN,
+        COL_STATUS, COL_DEBIT, COL_CREDIT, -1};
+        return col_list;
+        }
+        break;
+
+    default:
+        {
+        static ViewCol col_list[] = {
+        COL_DATE, COL_NUMACT, COL_DESCNOTES, COL_TRANSFERVOID, COL_RECN,
+	COL_STATUS,
+        COL_VALUE, COL_AMOUNT, COL_RATE, COL_PRICE, COL_DEBIT, COL_CREDIT,
+        COL_BALANCE, -1};
+        return col_list;
+        }
+    }
+}
+
+
+/* Creates a treeview with the list of fields */
+static GncTreeViewSplitReg *
+gnc_tree_view_split_reg_set_cols (GncTreeViewSplitReg *view,
+				  GncTreeModelSplitReg *model,
+				  ViewCol col_list[])
+{
+    int i = 0;
+
+    while (col_list && col_list[i] != -1) {
+        GList *renderers;
+        GtkCellRenderer *cr0;
+        GtkCellRenderer *cr1;
+        GtkTreeViewColumn *col;
+        ColDef def;
+
+        int j, ncol = G_N_ELEMENTS (all_tree_view_split_reg_columns);
+
+        for (j = 0; j < ncol; j++) {
+            if (col_list[i] == all_tree_view_split_reg_columns[j].viewcol) {
+                def = all_tree_view_split_reg_columns[j];
+                break;
+            }
+        }
+        if (j == ncol) {
+            PERR("Failed to find column definition.");
+            i++;
+            continue;
+        }
+        if (col_list[i] == COL_TRANSFERVOID) {
+
+            col = gnc_tree_view_add_combo_column (
+                GNC_TREE_VIEW (view), def.title, def.pref_name, def.sizer,
+                def.modelcol, def.visibility_model_col,
+                GTK_TREE_MODEL (gnc_tree_model_split_reg_get_acct_list (model)), 0, def.sort_fn);
+
+        } else if (col_list[i] == COL_DATE) {
+            col = gnc_tree_view_add_date_column (
+                GNC_TREE_VIEW (view), def.title, def.pref_name, NULL, def.sizer,
+                def.modelcol, def.visibility_model_col, def.sort_fn);
+
+        } else if (col_list[i] == COL_NUMACT) { 
+            col = gnc_tree_view_add_combo_column (
+                GNC_TREE_VIEW (view), def.title, def.pref_name, def.sizer,
+                def.modelcol, def.visibility_model_col,
+                GTK_TREE_MODEL (gnc_tree_model_split_reg_get_action_list (model)), 0, def.sort_fn);
+
+            // Here we are adding a second renderer, we will use the model to switch between the
+            // two by hiding one so we endup with rows of text or combo renderers.
+            cr1 = gtk_cell_renderer_text_new ();
+            gtk_tree_view_column_pack_start (col, cr1, TRUE);
+            gtk_tree_view_column_add_attribute (col, cr1, "visible", GNC_TREE_MODEL_SPLIT_REG_COL_NUM_VIS);
+
+            // Set all the same properties as the first renderer.
+            g_object_set (cr1, "xalign", 1.0, NULL);
+            g_object_set_data (G_OBJECT(cr1), "model_column", GINT_TO_POINTER (def.modelcol));
+            g_object_set_data (G_OBJECT(cr1), "column_name", GINT_TO_POINTER (def.pref_name));
+            g_signal_connect (G_OBJECT(cr1), "editing-started", (GCallback) def.editing_started_cb, view);
+            g_signal_connect (G_OBJECT(cr1), "editing-canceled", G_CALLBACK (gtv_sr_editing_canceled_cb), view);
+            g_object_set (G_OBJECT (cr1), "editable", TRUE, NULL);
+            g_signal_connect (G_OBJECT (cr1), "edited", (GCallback) def.edited_cb, view);
+            g_object_set_data (G_OBJECT (cr1), "view_column", GINT_TO_POINTER (def.viewcol));
+            gtk_tree_view_column_set_cell_data_func (col, cr1, gtv_sr_cdf1, view, NULL);
+
+        } else { 
+            col = gnc_tree_view_add_text_column (
+                GNC_TREE_VIEW (view), def.title, def.pref_name, NULL, def.sizer,
+                def.modelcol, def.visibility_model_col, def.sort_fn);
+        } 
+
+        g_object_set_data (G_OBJECT (col), DEFAULT_VISIBLE, GINT_TO_POINTER (1));
+        g_object_set_data (G_OBJECT (col), ALWAYS_VISIBLE, GINT_TO_POINTER (def.always_visible_col));
+
+        // Set the properties for the first renderer.
+        renderers = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (col));
+        cr0 = g_list_nth_data (renderers, 0);
+        g_list_free (renderers);
+
+        /* Setup cell background color and default alignment */
+        g_object_set (cr0, "xalign", 1.0, NULL);
+
+        if (col_list[i] == COL_NUMACT)
+            gtk_tree_view_column_add_attribute (col, cr0, "visible", GNC_TREE_MODEL_SPLIT_REG_COL_ACT_VIS);
+
+        /* Add the full title for status column to the object for menu creation */
+        if (col_list[i] == COL_STATUS)
+            g_object_set_data_full (G_OBJECT(col), REAL_TITLE, g_strdup (_("Status Bar")), g_free);
+
+        /* This sets the background of the treeview control columns */
+        gnc_tree_view_set_control_column_background (GNC_TREE_VIEW (view), 0, gtv_sr_control_cdf0);
+
+        if (def.editing_started_cb)
+        {
+            //Store the position of the column in the model
+            g_object_set_data (G_OBJECT (cr0), "model_column", GINT_TO_POINTER (def.modelcol));
+            g_object_set_data (G_OBJECT (cr0), "column_name", GINT_TO_POINTER (def.pref_name));
+            g_signal_connect (G_OBJECT (cr0), "editing-started", (GCallback) def.editing_started_cb, view);
+        }
+
+        // Connect editing-canceled signal so that edit-cancelled can be set appropriately
+        g_signal_connect (G_OBJECT (cr0), "editing-canceled", G_CALLBACK (gtv_sr_editing_canceled_cb), view);
+
+        gtk_tree_view_column_set_sizing (col, GTK_TREE_VIEW_COLUMN_FIXED);
+
+//        gtk_tree_view_column_set_min_width (col, -1);
+
+        // Set Columns to be resizable default.
+        g_object_set (G_OBJECT (col), "resizable", TRUE, NULL);
+
+        // Allow the columns to be reorderable.
+        g_object_set (G_OBJECT (col), "reorderable", TRUE, NULL);
+
+        if (def.edited_cb)
+        {
+            g_object_set (G_OBJECT (cr0), "editable", TRUE, NULL);
+            g_signal_connect (G_OBJECT (cr0), "edited", (GCallback) def.edited_cb, view);
+        }
+
+        g_object_set_data (G_OBJECT (cr0), "view_column", GINT_TO_POINTER (def.viewcol));
+        gtk_tree_view_column_set_cell_data_func (col, cr0, gtv_sr_cdf0, view, NULL);
+
+        i++;
+    }
+    gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW (view)), GTK_SELECTION_BROWSE);
+
+    g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (view)), "changed", G_CALLBACK (gtv_sr_motion_cb), view);
+
+    //Add a data-edited property to keep track of transaction edits.
+    g_object_set_data (G_OBJECT (view), "data-edited", GINT_TO_POINTER (FALSE));
+
+    // This is used to move the selected item if the selected transaction is deleted.
+    g_signal_connect (G_OBJECT (model), "selection_move_delete", G_CALLBACK (gtv_sr_selection_move_delete_cb), view);
+
+    // This will refresh the view.
+    g_signal_connect (G_OBJECT (model), "refresh_view", G_CALLBACK (gtv_sr_refresh_view_cb), view);
+
+    // This is for key navigation, tabbing...
+    g_signal_connect (G_OBJECT (view), "key-press-event", G_CALLBACK (gtv_sr_key_press_cb), NULL);
+
+    // This is for mouse buttons...
+    g_signal_connect (G_OBJECT (view), "button_press_event", G_CALLBACK (gtv_sr_button_cb), NULL);
+
+    return view;
+}
+
+
+/* Set up the view */
+gboolean
+gnc_tree_view_split_reg_set_format (GncTreeViewSplitReg *view)
+{
+    GncTreeViewSplitRegPrivate *priv;
+    GncTreeModelSplitReg *model;
+    GtkTreePath *mpath, *spath;
+    gint total_num = 0;
+
+    ENTER(" #### Set View Format #### ");
+
+    model = gnc_tree_view_split_reg_get_model_from_view (view);
+
+    priv = view->priv;
+
+    total_num = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (model), NULL);
+
+    mpath = gtk_tree_row_reference_get_path (view->priv->current_ref);
+
+    spath = gnc_tree_view_split_reg_get_sort_path_from_model_path (view, mpath);
+
+    priv->expanded = FALSE;
+
+    {
+        if (model->style == REG2_STYLE_JOURNAL)
+        {
+            gtk_tree_view_expand_all (GTK_TREE_VIEW (view));
+
+            priv->expanded = TRUE;
+
+            gtk_tree_path_free (mpath);
+            gtk_tree_path_free (spath);
+
+            /* This updates the plugin page gui */
+            gnc_tree_view_split_reg_call_uiupdate_cb (view);
+
+            LEAVE("#### Journal format ####");
+            return (FALSE);
+        }
+
+        if (!model->use_double_line)
+        {
+            gtk_tree_view_collapse_all (GTK_TREE_VIEW (view));
+
+            priv->expanded = FALSE;
+
+            LEAVE("#### Single line foramt ####");
+        }
+
+        if (model->use_double_line)
+        {
+            gint index = 0;
+            GtkTreePath *path;
+
+            path = gtk_tree_path_new_first ();
+            while (index < total_num)
+            {
+                gtk_tree_view_expand_to_path (GTK_TREE_VIEW (view), path);
+                gtk_tree_path_down (path);
+                gtk_tree_view_collapse_row (GTK_TREE_VIEW (view), path);
+                gtk_tree_path_up (path);
+                gtk_tree_path_next (path); //Next Transaction
+                index = index + 1;
+            }
+            gtk_tree_path_free (path);
+            LEAVE("#### Double line format ####");
+        }
+
+        /* This expands to split from top level auto.. */
+        if ((model->style == REG2_STYLE_AUTO_LEDGER) || (model->style == REG2_STYLE_JOURNAL))
+        {
+            gtk_tree_view_expand_row (GTK_TREE_VIEW (view), spath, TRUE);
+
+            priv->expanded = TRUE;
+            LEAVE("#### Auto expand line format ####");
+        }
+    }
+
+    gtk_tree_path_free (mpath);
+    gtk_tree_path_free (spath);
+
+    /* This updates the plugin page gui */
+    gnc_tree_view_split_reg_call_uiupdate_cb (view);
+
+    return (FALSE);
+}
+
+
+/* Set up the view for this transaction, used in transaction discard and cancel */
+static gboolean
+gnc_tree_view_split_reg_format_trans (GncTreeViewSplitReg *view, Transaction *trans)
+{
+    GncTreeViewSplitRegPrivate *priv;
+    GncTreeModelSplitReg *model;
+    GtkTreePath *mpath, *spath;
+
+    ENTER(" ");
+
+    model = gnc_tree_view_split_reg_get_model_from_view (view);
+
+    priv = view->priv;
+
+    mpath = gnc_tree_model_split_reg_get_path_to_split_and_trans (model, NULL, trans);
+
+    spath = gnc_tree_view_split_reg_get_sort_path_from_model_path (view, mpath);
+
+    if ((!model->use_double_line) && (model->style != REG2_STYLE_JOURNAL))
+    {
+        gtk_tree_view_collapse_row (GTK_TREE_VIEW (view), spath);
+        priv->expanded = FALSE;
+        LEAVE("#### Single line transaction foramt ####");
+    }
+
+    if ((model->use_double_line) && (model->style != REG2_STYLE_JOURNAL))
+    {
+        gtk_tree_view_expand_to_path (GTK_TREE_VIEW (view), spath);
+        gtk_tree_path_down (spath);
+        gtk_tree_view_collapse_row (GTK_TREE_VIEW (view), spath);
+        gtk_tree_path_up (spath);
+        priv->expanded = FALSE;
+        LEAVE("#### Double line transaction format ####");
+    }
+
+    /* This expands to split from top level auto.. */
+    if ((model->style == REG2_STYLE_AUTO_LEDGER) || (model->style == REG2_STYLE_JOURNAL))
+    {
+        gtk_tree_view_expand_row (GTK_TREE_VIEW (view), spath, TRUE);
+        priv->expanded = TRUE;
+        LEAVE("#### Auto expand line transaction format ####");
+    }
+
+    gtk_tree_path_free (mpath);
+    gtk_tree_path_free (spath);
+
+    /* This updates the plugin page gui */
+    gnc_tree_view_split_reg_call_uiupdate_cb (view);
+
+    return (FALSE);
+}
+
+
+/* Callback to update the view after transactions are added or deleted */
+static void
+gtv_sr_refresh_view_cb (GncTreeModelSplitReg *model, gpointer user_data)
+{
+    GncTreeViewSplitReg *view = user_data;
+
+    gnc_tree_view_split_reg_set_format (view);
+}
+
+
+/* Create a tree view from a given model */
+GncTreeViewSplitReg*
+gnc_tree_view_split_reg_new_with_model (GncTreeModelSplitReg *model)
+{
+    GtkTreeModel        *s_model;
+    GncTreeViewSplitReg *view;
+    GtkTreeSelection    *selection;
+
+    view = g_object_new (gnc_tree_view_split_reg_get_type(), NULL);
+    g_object_set (view, "name", "split_reg_tree", NULL);
+
+    view->priv->anchor = gnc_tree_model_split_reg_get_anchor (model);
+    view->priv->reg_comm = xaccAccountGetCommodity (view->priv->anchor);
+    view->priv->reg_currency = gnc_account_or_default_currency (view->priv->anchor, NULL);
+    g_assert (view->priv->reg_currency);
+    g_assert (gnc_commodity_is_currency (view->priv->reg_currency));
+    view->help_text = g_strdup ("Help Text");
+
+    /* Set the grid lines to be solid */
+    gnc_widget_set_style_context (GTK_WIDGET(view), "treeview_grid_lines");
+
+    /* TreeView Grid lines */
+    if (view->priv->use_horizontal_lines)
+    {
+        if (view->priv->use_vertical_lines)
+            gtk_tree_view_set_grid_lines (GTK_TREE_VIEW (view), GTK_TREE_VIEW_GRID_LINES_BOTH);
+        else
+            gtk_tree_view_set_grid_lines (GTK_TREE_VIEW (view), GTK_TREE_VIEW_GRID_LINES_HORIZONTAL);
+    }
+    else if (view->priv->use_vertical_lines)
+            gtk_tree_view_set_grid_lines (GTK_TREE_VIEW (view), GTK_TREE_VIEW_GRID_LINES_VERTICAL);
+    else
+        gtk_tree_view_set_grid_lines (GTK_TREE_VIEW (view), GTK_TREE_VIEW_GRID_LINES_NONE);
+
+    // Set the view to fixed height mode...
+//    gtk_tree_view_set_fixed_height_mode (GTK_TREE_VIEW (view), TRUE);
+
+    /* Expanders off */
+    gtk_tree_view_set_show_expanders (GTK_TREE_VIEW (view), FALSE);
+
+    /* Tree Selection */
+    selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (view));
+
+    gtk_tree_selection_unselect_all (selection);
+
+    // Setup the sort model
+    s_model = gtk_tree_model_sort_new_with_model (GTK_TREE_MODEL (model));
+
+    PINFO("#### After Models are Setup ####");
+
+    /* Set the user_data for the sort callback */
+    gnc_tree_view_set_sort_user_data (GNC_TREE_VIEW (view), s_model);
+
+    /* Set up the columns */
+    gnc_tree_view_split_reg_set_cols (view, model, gnc_tree_view_split_reg_get_colummn_list (model));
+
+    PINFO("#### Before View connected to Model ####");
+
+    // Connect model to tree view
+    gtk_tree_view_set_model (GTK_TREE_VIEW (view), s_model);
+    g_object_unref (G_OBJECT (s_model));
+
+    PINFO("#### After View connected to Model ####");
+
+    // Default the sorting to date.
+    gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (s_model),
+                                          GNC_TREE_MODEL_SPLIT_REG_COL_DATE,
+                                          GTK_SORT_ASCENDING);
+
+    PINFO("#### After Set Default Sort Column ####");
+
+    return view;
+}
+
+
+/* This allows the blocking / unblocking of selection */
+void
+gnc_tree_view_split_reg_block_selection (GncTreeViewSplitReg *view, gboolean block)
+{
+    if (block)
+        g_signal_handlers_block_by_func (gtk_tree_view_get_selection (GTK_TREE_VIEW (view)), gtv_sr_motion_cb, view);
+    else
+        g_signal_handlers_unblock_by_func (gtk_tree_view_get_selection (GTK_TREE_VIEW (view)), gtv_sr_motion_cb, view);
+}
+
+
+/* Set the default selection path */
+void
+gnc_tree_view_split_reg_default_selection (GncTreeViewSplitReg *view)
+{
+    GncTreeModelSplitReg *model;
+    GtkTreePath *new_mpath, *mpath, *spath;
+    gint *indices;
+
+    ENTER("#### Default Selection ####");
+
+    model = gnc_tree_view_split_reg_get_model_from_view (view);
+
+    /* Do we have a current transaction set on the model, use it */
+    if (model->current_trans != NULL)
+        view->priv->current_trans = model->current_trans;
+
+    /* Set the default start position to end of list */
+    if (view->priv->current_trans == NULL)
+    {
+        Transaction *btrans;
+
+        btrans = gnc_tree_control_split_reg_get_blank_trans (view);
+        mpath = gnc_tree_model_split_reg_get_path_to_split_and_trans (model, NULL, btrans);
+        view->priv->current_trans = btrans;
+    }
+    else
+        mpath = gnc_tree_model_split_reg_get_path_to_split_and_trans (model, view->priv->current_split, view->priv->current_trans);
+
+    indices = gtk_tree_path_get_indices (mpath);
+
+    if (view->priv->current_depth == 2)
+        new_mpath = gtk_tree_path_new_from_indices (indices[0], indices[1], -1);
+    else
+        new_mpath = gtk_tree_path_new_from_indices (indices[0], -1);
+
+    spath = gnc_tree_view_split_reg_get_sort_path_from_model_path (view, new_mpath);
+
+    {
+        gchar *mstring, *sstring, *tstring;
+        mstring = gtk_tree_path_to_string (mpath);
+        sstring = gtk_tree_path_to_string (spath);
+        tstring = gtk_tree_path_to_string (new_mpath);
+        DEBUG("default_selection mpath is %s, spath is %s, new path is %s", mstring, sstring, tstring);
+        g_free (mstring);
+        g_free (sstring);
+        g_free (tstring);
+    }
+
+    if (view->priv->current_ref != NULL)
+    {
+        gtk_tree_row_reference_free (view->priv->current_ref);
+        view->priv->current_ref = NULL;
+    }
+    view->priv->current_ref = gtk_tree_row_reference_new (GTK_TREE_MODEL (model), new_mpath);
+
+    /* Update the titles */
+    gtv_sr_titles (view, view->priv->current_depth);
+
+    /* Make sure blank split is on current transaction */
+    gnc_tree_model_split_reg_set_blank_split_parent (model, view->priv->current_trans, FALSE);
+
+    PINFO("#### Default Selection - After Titles ####");
+
+    /* Set the view format */
+    gnc_tree_view_split_reg_set_format (view);
+
+    PINFO("#### Default Selection - After View Format ####");
+
+    /* scroll window to show selection */
+    gnc_tree_view_split_reg_scroll_to_cell (view);
+
+    /* Set cursor to new spath */
+    gtk_tree_view_set_cursor (GTK_TREE_VIEW (view), spath, NULL, FALSE);
+
+    gtk_tree_path_free (mpath);
+    gtk_tree_path_free (spath);
+    gtk_tree_path_free (new_mpath);
+
+    LEAVE("#### Leave Default Selection ####");
+}
+
+/*###########################################################################*/
+
+/* Sets read only flag */
+void
+gnc_tree_view_split_reg_set_read_only (GncTreeViewSplitReg *view, gboolean read_only)
+{
+    GncTreeModelSplitReg *model;
+
+    model = gnc_tree_view_split_reg_get_model_from_view (view);
+
+    model->read_only = read_only;
+}
+
+
+/* Return the register commodity */
+gnc_commodity *
+gnc_tree_view_split_reg_get_reg_commodity (GncTreeViewSplitReg *view)
+{
+    return view->priv->reg_comm;
+}
+
+
+/* Returns a Split that matches the current Account */
+static Split *
+gtv_sr_get_this_split (GncTreeViewSplitReg *view, Transaction *trans)
+{
+    GncTreeModelSplitReg *model;
+    int i;
+    Split *split = NULL;
+    Account *anchor;
+
+    model = gnc_tree_view_split_reg_get_model_from_view (view);
+
+    anchor = gnc_tree_model_split_reg_get_anchor (model);
+
+    if (xaccTransCountSplits (trans) == 0) // this may be a blank or a reinit trans.
+    {
+        if (gnc_tree_model_split_reg_is_blank_split_parent (model, trans))
+            return gnc_tree_model_split_get_blank_split (model);
+    }
+
+    for (i = 0; (split = xaccTransGetSplit (trans, i)); i++) {
+        if (anchor == xaccSplitGetAccount (split))
+            return split;
+    }
+    return NULL;
+}
+
+
+/* The returned Splits may be newly created and not yet belong to trans. */
+static gboolean
+gtv_sr_get_split_pair (GncTreeViewSplitReg *view, Transaction *trans, Split **osplit, Split **split)
+{
+    GncTreeModelSplitReg *model;
+    QofBook       *book;
+
+    gint count = xaccTransCountSplits (trans);
+    Account *anchor = view->priv->anchor;
+
+    book = gnc_get_current_book();
+
+    model = gnc_tree_view_split_reg_get_model_from_view (view);
+
+    if (count == 0) // blank trans
+    {
+        *split = gnc_tree_model_split_get_blank_split (model);
+        xaccSplitSetAccount (*split, anchor);
+        xaccSplitSetParent (*split, trans);
+        *osplit = xaccMallocSplit (book);
+        xaccSplitSetParent (*osplit, trans);
+    }
+    else
+    {
+        int i;
+        Split *s, *first_split;
+
+        first_split = xaccTransGetSplit (trans, 0);
+
+        if (gnc_tree_util_split_reg_is_multi (first_split)) // multi trans
+            return FALSE;
+        else // two split trans
+        {
+            for (i = 0; (s = xaccTransGetSplit (trans, i)); i++)
+            {
+                if (anchor == xaccSplitGetAccount (s))
+                {
+                    *split = s;
+                    break;
+                }
+            }
+            g_assert (*split);
+            *osplit = xaccSplitGetOtherSplit(*split);
+            g_assert (*osplit);
+        }
+    }
+    DEBUG("gtv_sr_get_split_pair return - trans is %p, osplit is %p and split %p is set to anchor %p", trans, *osplit, *split, anchor);
+    return TRUE;
+}
+
+
+/* Does this transaction have any Imbalance splits */
+static gboolean
+gtv_sr_get_imbalance (Transaction *trans)
+{
+    int i;
+    Split *split = NULL;
+    const gchar *acc_name;
+    const gchar *prefix = _("Imbalance"); 
+
+    for (i = 0; (split = xaccTransGetSplit (trans, i)); i++)
+    {
+        if (xaccSplitGetAccount (split) != NULL)
+        {
+            acc_name = xaccAccountGetName (xaccSplitGetAccount (split));
+
+            if (g_str_has_prefix (acc_name, prefix))
+                return TRUE;
+        }
+    }
+    return FALSE;
+}
+
+
+/* Only allow changes to values if we have valid split accounts */
+static gboolean
+gtv_sr_have_account (GncTreeViewSplitReg *view, RowDepth depth, gboolean expanded, gboolean is_template, Transaction *trans, Split *split)
+{
+    gboolean gtv_sr_have_account = FALSE;
+
+    DEBUG("gtv_sr_have_account trans %p, split %p, expanded %d, depth %d", trans, split, expanded, depth);
+
+    if ((depth == TRANS1) && !expanded && !gnc_tree_util_split_reg_is_multi (split)) // normal trans
+    {
+        if (xaccSplitGetAccount (xaccSplitGetOtherSplit (split)) != NULL)
+            gtv_sr_have_account = TRUE;
+    }
+
+    if ((depth == SPLIT3) && (xaccTransCountSplits (trans) == 0)) // blank trans, blank split
+        gtv_sr_have_account = TRUE;
+
+    if (depth == SPLIT3)
+    {
+        if (!is_template) // Are we using a template
+        {
+            Account *acc = xaccSplitGetAccount (split);
+            if (acc != NULL)
+            {
+                if (xaccAccountGetType (acc) != ACCT_TYPE_TRADING)
+                    gtv_sr_have_account = TRUE; // normal split
+                else
+                    gtv_sr_have_account = FALSE; // trading split
+            }
+         }
+         else
+         {
+             if (gnc_tree_util_split_reg_template_get_transfer_entry (split) != NULL)
+                 gtv_sr_have_account = TRUE;
+         }
+    }
+    return gtv_sr_have_account;
+}
+
+/*###########################################################################*/
+
+/* This cellDataFunc is to set the cell-background property of the control columns. */
+static void
+gtv_sr_control_cdf0 (GtkTreeViewColumn *col, GtkCellRenderer *cell, GtkTreeModel *s_model,
+    GtkTreeIter *s_iter, gpointer user_data)
+{
+    GncTreeViewSplitReg *view = GNC_TREE_VIEW_SPLIT_REG (user_data);
+    GncTreeModelSplitReg *model;
+    GtkTreeIter m_iter;
+    GtkTreePath *mpath;
+    Transaction *trans;
+    Split *split;
+    gboolean is_split, is_blank, is_trow1, is_trow2;
+    const gchar *row_color;
+
+    gint *indices;
+
+    ENTER("");
+
+    model = gnc_tree_view_split_reg_get_model_from_view (view);
+
+    gtk_tree_model_sort_convert_iter_to_child_iter (GTK_TREE_MODEL_SORT (s_model), &m_iter, s_iter);
+
+    g_return_if_fail (gnc_tree_model_split_reg_get_split_and_trans (
+                         GNC_TREE_MODEL_SPLIT_REG (model), &m_iter,
+                          &is_trow1, &is_trow2, &is_split, &is_blank,
+                          &split, &trans));
+
+    mpath = gtk_tree_model_get_path (GTK_TREE_MODEL (model), &m_iter);
+
+    indices = gtk_tree_path_get_indices (mpath);
+
+    row_color = gnc_tree_model_split_reg_get_row_color (model, is_trow1, is_trow2, is_split, indices[0]);
+
+    gtk_tree_path_free (mpath);
+
+    /* Set the background color / this works for sorting and deleting transactions */
+    g_object_set (cell, "cell-background", row_color, (gchar*)NULL);
+
+    LEAVE("");
+}
+
+
+/* Instead of setting a different cellDataFunc for each column, we just
+   collect everything here for the first cell renderer. */
+static void
+gtv_sr_cdf0 (GtkTreeViewColumn *col, GtkCellRenderer *cell, GtkTreeModel *s_model,
+    GtkTreeIter *s_iter, gpointer user_data)
+{
+    GncTreeViewSplitReg *view = GNC_TREE_VIEW_SPLIT_REG (user_data);
+    GncTreeModelSplitReg *model;
+    GtkTreeIter m_iter;
+    GtkTreePath *spath;
+    ViewCol viewcol;
+    Transaction *trans;
+    Split *split;
+    gboolean is_split, is_blank, is_trow1, is_trow2;
+    gboolean editable = FALSE, expanded = FALSE;
+    gboolean read_only = FALSE;
+    gboolean open_edited = FALSE;
+    gboolean is_template = FALSE;
+    gboolean negative_in_red = FALSE;
+    gboolean show_extra_dates = FALSE;
+    gnc_numeric num = gnc_numeric_zero();
+    const gchar *s = "";
+    const gchar *row_color;
+    RowDepth depth;
+    gint *indices;
+    Account *anchor = view->priv->anchor;
+    char type;
+
+    ENTER("");
+
+    model = gnc_tree_view_split_reg_get_model_from_view (view);
+
+    gtk_tree_model_sort_convert_iter_to_child_iter (GTK_TREE_MODEL_SORT (s_model), &m_iter, s_iter);
+
+    viewcol = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (cell), "view_column"));
+
+    g_return_if_fail (gnc_tree_model_split_reg_get_split_and_trans (
+                         GNC_TREE_MODEL_SPLIT_REG (model), &m_iter,
+                          &is_trow1, &is_trow2, &is_split, &is_blank,
+                          &split, &trans));
+
+    spath = gtk_tree_model_get_path (GTK_TREE_MODEL (s_model), s_iter);
+
+    depth = gtk_tree_path_get_depth (spath);
+
+    indices = gtk_tree_path_get_indices (spath);
+
+    row_color = gnc_tree_model_split_reg_get_row_color (model, is_trow1, is_trow2, is_split, indices[0]);
+
+    /* Lets see if the splits are expanded */
+    if (is_trow1 || is_trow2) // transaction
+    {
+        if (is_trow1)
+            gtk_tree_path_down (spath); /* Move the path down to trow2 */
+        expanded = gtk_tree_view_row_expanded (GTK_TREE_VIEW (view), spath);
+    }
+    else
+        expanded = TRUE; // splits are always expanded
+
+    gtk_tree_path_free (spath);
+
+    /* Set the background color / this works for sorting and deleting of transactions */
+    g_object_set (cell, "cell-background", row_color, (gchar*)NULL);
+
+    /* Get the read only model setting */
+    gtk_tree_model_get (GTK_TREE_MODEL (model), &m_iter, GNC_TREE_MODEL_SPLIT_REG_COL_RO, &read_only, -1);
+
+    /* Are we being edited in other register */
+    if (xaccTransIsOpen (trans) && (view->priv->dirty_trans != trans))
+    {
+        read_only = TRUE;
+        open_edited = TRUE;
+    }
+
+    /* Test for a transaction type of invoice, always read only */
+    type = xaccTransGetTxnType (trans);
+    if (model->type == RECEIVABLE_REGISTER2 || model->type == PAYABLE_REGISTER2)
+    {
+        if (((type == TXN_TYPE_INVOICE) || (type == TXN_TYPE_NONE)) && (view->priv->dirty_trans != trans) && !is_blank)
+            read_only = TRUE;
+    }
+
+    /* Is this a template */
+    is_template = gnc_tree_model_split_reg_get_template (model);
+
+    /* Show negative numbers in red */
+    negative_in_red = view->priv->negative_in_red;
+
+    switch (viewcol) {
+    case COL_DATE:
+        /* Column is DATE */
+        if (is_split)
+            g_object_set (cell, "cell-background", "white", (gchar*)NULL);
+
+        // Show the extra dates for selected transaction
+        if ((view->priv->current_trans == trans) && view->priv->show_extra_dates_on_selection)
+            show_extra_dates = TRUE;
+
+        // Show the extra dates always
+        if (view->show_extra_dates == TRUE)
+            show_extra_dates = TRUE;
+
+        if (is_trow1) {
+            Timespec ts = {0,0};
+            xaccTransGetDatePostedTS (trans, &ts);
+            //If the time returned by xaccTransGetDatePostedTS is 0 then assume it
+            //is a new transaction and set the time to current time to show current
+            //date on new transactions
+            if (ts.tv_sec == 0)
+            {
+                ts.tv_sec = gnc_time (NULL);
+                //xaccTransSetDatePostedSecs (trans, ts.tv_sec);
+            }//if
+            s = gnc_print_date (ts);
+            editable = TRUE;
+        }
+        else if (is_trow2 && show_extra_dates) {
+            Timespec ts = {0,0};
+
+            g_object_set (cell, "cell-background", YELLOWCELL, (gchar*)NULL);
+
+            xaccTransGetDateEnteredTS (trans, &ts);
+            //If the time returned by xaccTransGetDateEnteredTS is 0 then assume it
+            //is a new transaction and set the time to current time to show current
+            //date on new transactions
+            if (ts.tv_sec == 0)
+            {
+                ts.tv_sec = gnc_time (NULL);
+                //xaccTransSetDateEnteredSecs (trans, ts.tv_sec);
+            }//if
+            s = gnc_print_date (ts);
+            editable = FALSE;
+        }
+        else if (is_split && show_extra_dates) {
+            Timespec ts = {0,0};
+
+            if (xaccSplitGetReconcile (split) == YREC)
+            {
+                xaccSplitGetDateReconciledTS (split, &ts);
+                //If the time returned by xaccTransGetDateEnteredTS is 0 then assume it
+                //is a new transaction and set the time to current time to show current
+                //date on new transactions
+                if (ts.tv_sec == 0)
+                {
+                    ts.tv_sec = gnc_time (NULL);
+                    //xaccSplitSetDateReconciledTS (split, ts.tv_sec);
+                }//if
+                s = gnc_print_date (ts);
+            }
+            else
+                s = "";
+            editable = FALSE;
+        }
+        else {
+            s = "";
+            editable = FALSE;
+        }
+
+        /* Is this a template */
+        if (is_template && is_trow1)
+        {
+            s =  _(" Scheduled ");
+            editable = FALSE;
+        }
+        else if (is_template && is_trow2 && show_extra_dates)
+        {
+            s = "";
+            editable = FALSE;
+        }
+        else if (is_template && is_split && show_extra_dates)
+        {
+            s = "";
+            editable = FALSE;
+        }
+
+        editable = (read_only == TRUE) ? FALSE : editable;
+
+        /* This will remove the calander buttons if FALSE */
+        g_object_set (cell, "use_buttons", view->priv->show_calendar_buttons, NULL );
+        g_object_set (cell, "text", s, "editable", editable, NULL);
+        break;
+
+    case COL_DUEDATE:
+        /* Column is DUE DATE */
+        if (is_split)
+            g_object_set (cell, "cell-background", "white", (gchar*)NULL);
+
+        if (is_trow1) {
+            Timespec ts = {0,0};
+
+            /* Only print the due date for invoice transactions */
+            if (type == TXN_TYPE_INVOICE)
+            {
+                xaccTransGetDateDueTS (trans, &ts);
+                s = gnc_print_date (ts);
+                editable = FALSE;
+            }
+            else {
+                s = "";
+                editable = FALSE;
+            }
+        }
+        editable = (read_only == TRUE) ? FALSE : editable;
+
+        g_object_set (cell, "text", s, "editable", editable, NULL);
+        break;
+
+    case COL_NUMACT:
+        /* Column is NUM / ACT but relates to ACT */
+        /* Override default alignment */
+        g_object_set (cell, "xalign", 0.0, NULL );
+
+        editable = TRUE;
+
+        if (is_trow1)
+            /* Get per book option */
+            s = gnc_get_num_action (trans, gtv_sr_get_this_split (view, trans));
+
+        else if (is_trow2 && expanded)
+        {
+            /* Get per book option */
+            if (qof_book_use_split_action_for_num_field (gnc_get_current_book()))
+                s = gnc_get_action_num (trans, gtv_sr_get_this_split (view, trans));
+            else
+                s = "";
+            editable = FALSE;
+        }
+        else if (is_trow2 && !expanded)
+        {
+            /* Get per book option */
+            if (gtv_sr_get_this_split (view, trans) != NULL) // Blank split of blank trans is not child of trans yet.
+               s = gnc_get_action_num (trans, gtv_sr_get_this_split (view, trans));
+            else
+               s = "";
+        }
+        else if (is_split)
+            /* Get split-action with gnc_get_num_action which is the same as
+             * xaccSplitGetAction with these arguments */
+            s = gnc_get_num_action (NULL, split);
+
+        editable = (read_only == TRUE) ? FALSE : editable;
+
+        g_object_set (cell, "text", s, "editable", editable, NULL);
+        break;
+
+    case COL_DESCNOTES:
+        /* Column is DESCRIPTION / NOTES */
+        /* Override default alignment */
+        g_object_set( cell, "xalign", 0.0, NULL );
+        if (is_trow1)
+            s =  xaccTransGetDescription (trans);
+        else if (is_trow2)
+            s =  xaccTransGetNotes (trans);
+        else if (is_split)
+            s = xaccSplitGetMemo (split);
+        editable = TRUE;
+
+        editable = (read_only == TRUE) ? FALSE : editable;
+
+        g_object_set (cell, "text", s, "editable", editable, NULL);
+        break;
+
+    case COL_TRANSFERVOID:
+        /* Column is TRANSFER / VOID */
+        /* Not sure if this will stay here, this sets the combo column
+           0 for short account names, 1 for long */
+        if (view->priv->acct_short_names)
+            g_object_set (G_OBJECT (cell), "text-column", 0, NULL );
+        else
+            g_object_set (G_OBJECT (cell), "text-column", 1, NULL );
+
+        {
+            gchar *string = NULL;
+
+            if (is_trow1)
+            {
+                if (expanded)
+                {
+                    string = g_strdup (" "); /* blank-out if splits are visible */
+                    editable = FALSE;
+                }
+                else
+                {
+                    gboolean is_multi;
+                    string = g_strdup (gnc_tree_util_split_reg_get_transfer_entry (gtv_sr_get_this_split (view, trans), &is_multi));
+
+                    editable = anchor && !expanded && !is_multi;
+                }
+            }
+            if (is_trow2)
+            {
+                string = g_strdup (xaccTransGetVoidReason (trans)); // This is the Void Reason
+                editable = FALSE;
+            }
+            if (is_split)
+            {
+                if (!is_template) // Are we using a template
+                {
+                    Account *acct = xaccSplitGetAccount (split);
+
+                    // This will be all but the General Journal which has anchor == NULL
+                    if ((xaccTransCountSplits (trans) == 0) && (anchor != NULL)) // First split on blank transaction
+                        acct = anchor;
+
+                    if (acct != NULL)
+                    {
+                        if (view->priv->acct_short_names)
+                            string = g_strdup (xaccAccountGetName (acct));
+                        else
+                            string = gnc_account_get_full_name (acct);
+
+                    }
+                    else
+                        string = g_strdup (" ");
+
+                    if (anchor == acct && model->type != GENERAL_JOURNAL2 && model->type != SEARCH_LEDGER2)
+                        editable = FALSE;
+                    else
+                        editable = TRUE;
+                }
+                else
+                {
+                    string = g_strdup (gnc_tree_util_split_reg_template_get_transfer_entry (split));
+                    editable = TRUE;
+                }
+            }
+            editable = (read_only == TRUE) ? FALSE : editable;
+
+            g_object_set (cell, "text", string, "editable", editable, NULL);
+            g_free (string);
+        }
+        break;
+
+    case COL_RECN:
+        /* Column is RECN */
+        /* Override default alignment */
+        g_object_set( cell, "xalign", 0.5, NULL );
+        editable = FALSE;
+        s = "";
+        if (is_trow1 && !expanded)
+        {
+            Split *this_split;
+            char rec;
+
+            this_split = gtv_sr_get_this_split (view, trans);
+
+            if (this_split != NULL) // this could be a blank trans
+            {
+                rec = xaccSplitGetReconcile (this_split);
+                if (rec == VREC || rec == FREC)
+                    editable = FALSE;
+                else
+                    editable = TRUE;
+
+                if (rec != ' ')
+                    s = gnc_get_reconcile_str (rec);
+                else
+                    s = gnc_get_reconcile_str (NREC);
+            }
+        }
+
+        if (is_split)
+        {
+            char rec = xaccSplitGetReconcile (split);
+            if (rec == VREC || rec == FREC)
+                editable = FALSE;
+            else
+                editable = TRUE;
+
+            if (rec != ' ')
+                s = gnc_get_reconcile_str (rec);
+            else
+                s = gnc_get_reconcile_str (NREC);
+        }
+
+        editable = (read_only == TRUE) ? FALSE : editable;
+
+        g_object_set (cell, "text", s, "editable", editable, NULL);
+        break;
+
+    case COL_TYPE:
+        /* Column is TYPE */
+        /* Override default alignment */
+        g_object_set( cell, "xalign", 0.5, NULL );
+        if (is_split)
+            g_object_set (cell, "cell-background", "white", (gchar*)NULL);
+
+        if (is_trow1) {
+            static char ss[2];
+            if (type == TXN_TYPE_NONE)
+                type = '?';
+
+            ss[0] = type;
+            ss[1] = '\0';
+            editable = TRUE;
+            g_object_set (cell, "text", ss, NULL);
+        }
+        else
+        {
+            s = "";
+            editable = FALSE;
+            g_object_set (cell, "text", s, NULL);
+        }
+
+        editable = (read_only == TRUE) ? FALSE : editable;
+
+        g_object_set (cell, "editable", editable, NULL);
+        break;
+
+    case COL_VALUE:
+        /* Column is VALUE */
+        if (is_split)
+        {
+            num = xaccSplitGetValue (split);
+            s = xaccPrintAmount (num, gnc_commodity_print_info (xaccTransGetCurrency (trans), SHOW_SYMBOL));
+            editable = FALSE;
+
+            if (gtv_sr_get_imbalance (trans))
+                g_object_set (cell, "cell-background", PINKCELL, (gchar*)NULL);
+        }
+        else
+        {
+            s = "";
+            editable = FALSE;
+        }
+
+        editable = (read_only == TRUE) ? FALSE : editable;
+
+        // Display negative numbers in red if requested in preferences
+        if (gnc_numeric_negative_p (num) && negative_in_red)
+            g_object_set (cell, "foreground", "red", (gchar*)NULL);
+        else
+            g_object_set (cell, "foreground", NULL, (gchar*)NULL);
+
+        g_object_set (cell, "text", s, "editable", editable, NULL);
+        break;
+
+    case COL_RATE:
+        /* Column is RATE */
+        if ((is_trow1)||(is_trow2))
+        {
+            s = "";
+            editable = FALSE;
+        }
+        else
+        {
+            GNCPrintAmountInfo print_info;
+
+            print_info = gnc_default_price_print_info();
+            print_info.min_decimal_places = 2;
+
+            num = gnc_numeric_convert (gnc_tree_util_get_rate_for (view, trans, split, is_blank), 1000000, GNC_HOW_RND_ROUND_HALF_UP);
+
+            if (gnc_numeric_check (num) == GNC_ERROR_OK)
+                s = xaccPrintAmount (num, print_info);
+            else
+                s = "";
+
+            editable = FALSE;
+
+            if (gtv_sr_get_imbalance (trans))
+                g_object_set (cell, "cell-background", PINKCELL, (gchar*)NULL);
+        }
+
+        editable = (read_only == TRUE) ? FALSE : editable;
+
+        g_object_set (cell, "text", s, "editable", editable, NULL);
+        break;
+
+    case COL_AMOUNT:
+        /* Column is AMOUNT */
+        if (is_split && (anchor == NULL))
+        {
+            num = xaccSplitGetAmount (split);
+            s = xaccPrintAmount (num, gnc_account_print_info (xaccSplitGetAccount (split), SHOW_SYMBOL));
+            editable = FALSE;
+
+            if (gtv_sr_get_imbalance (trans))
+                g_object_set (cell, "cell-background", PINKCELL, (gchar*)NULL);
+        }
+        else if (is_split && (anchor))
+        {
+            gnc_commodity *split_comm;
+            split_comm = xaccAccountGetCommodity (xaccSplitGetAccount (split));
+
+            if (!gnc_commodity_is_currency (split_comm) || (is_blank))
+            {
+                num = xaccSplitGetAmount (split);
+                s = xaccPrintAmount (num, gnc_account_print_info (xaccSplitGetAccount (split), SHOW_SYMBOL));
+                editable = TRUE;
+            }
+
+            if (gtv_sr_get_imbalance (trans))
+                g_object_set (cell, "cell-background", PINKCELL, (gchar*)NULL);
+        }
+        else
+        {
+            s = "";
+            editable = FALSE;
+        }
+
+        editable = (read_only == TRUE) ? FALSE : editable;
+
+        // Display negative numbers in red if requested in preferences
+        if (gnc_numeric_negative_p (num) && negative_in_red)
+            g_object_set (cell, "foreground", "red", (gchar*)NULL);
+        else
+            g_object_set (cell, "foreground", NULL, (gchar*)NULL);
+
+        g_object_set (cell, "text", s, "editable", editable, NULL);
+        break;
+
+    case COL_AMTVAL:
+        /* Column is AMOUNT / VALUE */
+        if (is_trow2)
+        {
+            s = "";
+            editable = FALSE;
+        }
+        else if (is_trow1) // Value
+        {
+            if (anchor)
+            {
+                Split *this_split;
+
+                this_split = gtv_sr_get_this_split (view, trans);
+
+                num = xaccTransGetAccountValue (trans, anchor);
+
+                editable = !expanded && !gnc_tree_util_split_reg_is_multi (this_split);
+
+                if (expanded)
+                    s = "";
+                else
+                    s = xaccPrintAmount (num, gnc_commodity_print_info (xaccTransGetCurrency (trans), SHOW_SYMBOL));
+            }
+            else
+            {
+                s = "";
+                editable = FALSE;
+            }
+        }
+
+        if (is_split) // Amount
+        {
+            if (anchor == NULL)
+            {
+                num = xaccSplitGetAmount (split);
+                s = xaccPrintAmount (num, gnc_account_print_info (xaccSplitGetAccount (split), SHOW_SYMBOL));
+                editable = TRUE;
+            }
+            else if (anchor)
+            {
+                gnc_commodity *split_comm;
+                split_comm = xaccAccountGetCommodity (xaccSplitGetAccount (split));
+
+                if (!gnc_commodity_is_currency (split_comm) || (is_blank))
+                {
+                    num = xaccSplitGetAmount (split);
+                    s = xaccPrintAmount (num, gnc_account_print_info (xaccSplitGetAccount (split), SHOW_SYMBOL));
+                    editable = TRUE;
+                }
+            }
+            else
+            {
+                s = "";
+                editable = FALSE;
+            }
+
+            if (gtv_sr_get_imbalance (trans))
+                g_object_set (cell, "cell-background", PINKCELL, (gchar*)NULL);
+        }
+
+        /* Only allow changes to entries if we have a valid split accounts */
+        editable = gtv_sr_have_account (view, depth, expanded, is_template, trans, split);
+
+        editable = (read_only == TRUE) ? FALSE : editable;
+
+        // Display negative numbers in red if requested in preferences
+        if (gnc_numeric_negative_p (num) && negative_in_red)
+            g_object_set (cell, "foreground", "red", (gchar*)NULL);
+        else
+            g_object_set (cell, "foreground", NULL, (gchar*)NULL);
+
+        g_object_set (cell, "text", s, "editable", editable, NULL);
+        break;
+
+    case COL_PRICE:
+        /* Column is PRICE */
+        if (is_trow2)
+        {
+            s = "";
+            editable = FALSE;
+        }
+        else if (is_trow1)
+        {
+            if (expanded)
+            {
+                s = "";
+                editable = FALSE;
+            }
+            else
+            {
+                if (anchor)
+                {
+                    Split *this_split;
+
+                    this_split = gtv_sr_get_this_split (view, trans);
+                    if (this_split != NULL) // this could be a blank split
+                    {
+                        if (gnc_tree_util_split_reg_is_multi (this_split))
+                            num = gnc_numeric_zero();
+                        else
+                            num = xaccSplitGetSharePrice (this_split);
+
+                        editable = !expanded && !gnc_tree_util_split_reg_is_multi (this_split);
+
+                        if (gnc_numeric_check (num) == GNC_ERROR_OK)
+                        {
+                            s = xaccPrintAmount (num, gnc_split_amount_print_info (split, SHOW_SYMBOL));
+                        }
+                        else
+                        {
+                            s = "";
+                            editable = FALSE;
+                        }
+                    }
+                    else
+                    {
+                        s = "";
+                        editable = FALSE;
+                    }
+                }
+            }
+        }
+
+        if (is_split)
+        {
+            gnc_commodity *split_comm;
+            split_comm = xaccAccountGetCommodity (xaccSplitGetAccount (split));
+
+            if (!gnc_commodity_is_currency (split_comm) || (is_blank))
+            {
+                num = xaccSplitGetSharePrice (split);
+
+                if (gnc_numeric_check (num) == GNC_ERROR_OK)
+                {
+                    s = xaccPrintAmount (num, gnc_split_amount_print_info (split, SHOW_SYMBOL));
+                    editable = TRUE;
+                }
+                else
+                {
+                    s = "";
+                    editable = FALSE;
+                }
+            }
+            else
+            {
+                s = "";
+                editable = FALSE;
+            }
+
+            if (gtv_sr_get_imbalance (trans))
+                g_object_set(cell, "cell-background", PINKCELL, (gchar*)NULL);
+        }
+
+        /* Only allow changes to entries if we have a valid split accounts */
+        editable = gtv_sr_have_account (view, depth, expanded, is_template, trans, split);
+
+        editable = (read_only == TRUE) ? FALSE : editable;
+
+        g_object_set (cell, "text", s, "editable", editable, NULL);
+        break;
+
+    case COL_DEBIT:
+    case COL_CREDIT:
+        /* Column is CREDIT and DEBIT */
+        {
+            if (!is_template) // Is this a template
+            {
+                GNCPrintAmountInfo print_info;
+                print_info = gnc_account_print_info (anchor, SHOW_SYMBOL);
+
+                if (is_split)
+                {
+                    if (!gnc_tree_util_split_reg_get_debcred_entry (view, trans, split, is_blank, &num, &print_info))
+                        num = gnc_numeric_zero();
+
+                    editable = TRUE;
+                    if (gtv_sr_get_imbalance (trans))
+                        g_object_set (cell, "cell-background", PINKCELL, (gchar*)NULL);
+                }
+                else if (is_trow1)
+                {
+                    if (anchor)
+                    {
+                         editable = !expanded && !gnc_tree_util_split_reg_is_multi (gtv_sr_get_this_split (view, trans));
+                         num = xaccTransGetAccountAmount (trans, anchor);
+                    }
+                    else
+                    {
+                        editable = FALSE;
+                        num = gnc_numeric_zero();
+                    }
+                }
+                else if (is_trow2)
+                {
+                    editable = FALSE;
+                    num = gnc_numeric_zero();
+                }
+
+                if ((gnc_numeric_check(num) != GNC_ERROR_OK) ||
+                     gnc_numeric_zero_p(num) ||
+                    (gnc_numeric_negative_p(num) && viewcol == COL_DEBIT) ||
+                    (gnc_numeric_positive_p(num) && viewcol == COL_CREDIT))
+                {
+                    s = "";
+                }
+                else
+                {
+                    if ((is_trow1 || is_trow2) && expanded)
+                        s = "";
+                    else
+                        s = xaccPrintAmount (gnc_numeric_abs (num), print_info);
+                }
+            }
+            else
+            {
+                editable = TRUE;
+
+                if (is_trow1 || is_trow2)
+                {
+                    s = "";
+                    editable = FALSE;
+                }
+                else if (is_split && viewcol == COL_DEBIT)
+                    s = gnc_tree_util_split_reg_template_get_fdebt_entry (split);
+                else
+                    s = gnc_tree_util_split_reg_template_get_fcred_entry (split);
+            }
+
+            /* Only allow changes to entries if we have a valid split accounts */
+            editable = gtv_sr_have_account (view, depth, expanded, is_template, trans, split);
+        }
+
+        editable = (read_only == TRUE) ? FALSE : editable;
+
+        g_object_set (cell, "text", s, "editable", editable, NULL);
+        break;
+
+    case COL_BALANCE:
+        /* Column is BALANCE */
+        if (is_split)
+            g_object_set(cell, "cell-background", "white", (gchar*)NULL);
+
+        if (is_trow1 && anchor) {
+            num = xaccTransGetAccountBalance (trans, anchor);
+            if (gnc_reverse_balance (anchor))
+                num = gnc_numeric_neg (num);
+            s = xaccPrintAmount (num, gnc_account_print_info(anchor, FALSE));
+
+            // Display negative numbers in red if requested in preferences
+            if (gnc_numeric_negative_p (num) && negative_in_red)
+                g_object_set (cell, "foreground", "red", (gchar*)NULL);
+            else
+                g_object_set (cell, "foreground", NULL, (gchar*)NULL);
+        } else {
+            s = "";
+        }
+        g_object_set (cell, "text", s, "editable", FALSE, NULL);
+        break;
+
+    case COL_STATUS:
+        /* Column is STATUS */
+        if (read_only && !open_edited)
+            g_object_set(cell, "cell-background", REDCELL, (gchar*)NULL);
+        else if (read_only && open_edited)
+            g_object_set(cell, "cell-background", ORANGECELL, (gchar*)NULL);
+        else if (xaccTransInFutureByPostedDate (trans))
+            g_object_set(cell, "cell-background", BLUECELL, (gchar*)NULL);
+        else
+            g_object_set(cell, "cell-background", BLACKCELL, (gchar*)NULL);
+        break;
+
+    case COL_COMM:
+        /* Column COMMODITY */
+        {
+            gchar *string = NULL;
+            if (is_split)
+            {
+                gnc_commodity *split_com, *txn_com;
+
+                split_com = xaccAccountGetCommodity (xaccSplitGetAccount(split));
+                txn_com = xaccTransGetCurrency (trans);
+                if (split_com == txn_com)
+                   string = g_strconcat (gnc_commodity_get_printname (split_com), "*", NULL);
+                else
+                   string = g_strdup (gnc_commodity_get_printname (split_com));
+            }
+            else
+                string = g_strdup ("");
+
+            g_object_set (cell, "text", string, "editable", FALSE, NULL);
+            g_free (string);
+        }
+        break;
+
+    default:
+        break;
+    }
+    LEAVE("");
+}
+
+
+/* Instead of setting a different cellDataFunc for each column, we just
+   collect everything here for the second cell renderer. */
+static void
+gtv_sr_cdf1 (GtkTreeViewColumn *col, GtkCellRenderer *cell, GtkTreeModel *s_model,
+    GtkTreeIter *s_iter, gpointer user_data)
+{
+    GncTreeViewSplitReg *view = GNC_TREE_VIEW_SPLIT_REG (user_data);
+    GncTreeModelSplitReg *model;
+    GtkTreeIter m_iter;
+    GtkTreePath *spath;
+    ViewCol viewcol;
+    Transaction *trans;
+    Split *split;
+    gboolean is_split, is_blank, is_trow1, is_trow2;
+    gboolean editable = FALSE, expanded = FALSE;
+    gboolean read_only = FALSE;
+//    gboolean open_edited = FALSE;
+    const gchar *s = "";
+    const gchar *row_color;
+//    RowDepth depth;
+    gint *indices;
+//    Account *anchor = view->priv->anchor;
+    char type;
+
+    ENTER("");
+
+    model = gnc_tree_view_split_reg_get_model_from_view (view);
+
+    gtk_tree_model_sort_convert_iter_to_child_iter (GTK_TREE_MODEL_SORT (s_model), &m_iter, s_iter);
+
+    viewcol = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (cell), "view_column"));
+
+    g_return_if_fail (gnc_tree_model_split_reg_get_split_and_trans (
+                         GNC_TREE_MODEL_SPLIT_REG (model), &m_iter,
+                          &is_trow1, &is_trow2, &is_split, &is_blank,
+                          &split, &trans));
+
+    spath = gtk_tree_model_get_path (GTK_TREE_MODEL (s_model), s_iter);
+
+//    depth = gtk_tree_path_get_depth (spath);
+
+    indices = gtk_tree_path_get_indices (spath);
+
+    row_color = gnc_tree_model_split_reg_get_row_color (model, is_trow1, is_trow2, is_split, indices[0]);
+
+    /* Lets see if the splits are expanded */
+    if (is_trow1 || is_trow2) // transaction
+    {
+        if (is_trow1)
+            gtk_tree_path_down (spath); /* Move the path down to trow2 */
+        expanded = gtk_tree_view_row_expanded (GTK_TREE_VIEW (view), spath);
+    }
+    else
+        expanded = TRUE; // splits are always expanded
+
+    gtk_tree_path_free (spath);
+
+    /* Set the background color / this works for sorting and deleting of transactions */
+    g_object_set (cell, "cell-background", row_color, (gchar*)NULL);
+
+    /* Get the read only model setting */
+    gtk_tree_model_get (GTK_TREE_MODEL (model), &m_iter, GNC_TREE_MODEL_SPLIT_REG_COL_RO, &read_only, -1);
+
+    /* Are we being edited in other register */
+    if (xaccTransIsOpen (trans) && (view->priv->dirty_trans != trans))
+    {
+        read_only = TRUE;
+//        open_edited = TRUE;
+    }
+
+    /* Test for a transaction type of invoice, always read only */
+    type = xaccTransGetTxnType (trans);
+    if (model->type == RECEIVABLE_REGISTER2 || model->type == PAYABLE_REGISTER2)
+    {
+        if (((type == TXN_TYPE_INVOICE) || (type == TXN_TYPE_NONE)) && (view->priv->dirty_trans != trans) && !is_blank)
+            read_only = TRUE;
+    }
+
+    switch (viewcol) {
+    case COL_DATE:
+        /* Column is DATE */
+        break;
+
+    case COL_DUEDATE:
+        /* Column is DUE DATE */
+        break;
+
+    case COL_NUMACT:
+        /* Column is NUM / ACT  but relates to NUM */
+        /* Override default alignment */
+        g_object_set (cell, "xalign", 0.0, NULL );
+
+        editable = TRUE;
+
+        if (is_trow1)
+        {
+            /* Get per book option */
+            s = gnc_get_num_action (trans, gtv_sr_get_this_split (view, trans));
+        }
+        else if (is_trow2 && expanded)
+        {
+            /* Get per book option */
+            if (qof_book_use_split_action_for_num_field (gnc_get_current_book()))
+                s = gnc_get_action_num (trans, gtv_sr_get_this_split (view, trans));
+            else
+                s = "";
+            editable = FALSE;
+        }
+        else if (is_trow2 && !expanded)
+        {
+            /* Get per book option */
+            if (qof_book_use_split_action_for_num_field (gnc_get_current_book()))
+            {
+               if (gtv_sr_get_this_split (view, trans) != NULL) // Blank split of blank trans is not child of trans yet.
+                   s = gnc_get_action_num (trans, gtv_sr_get_this_split (view, trans));
+               else
+                   s = "";
+            }
+            else
+            {
+                s = "XY";
+            }
+        }
+        else if (is_split)
+        {
+            s = "XZ";
+        }
+
+        editable = (read_only == TRUE) ? FALSE : editable;
+
+        g_object_set (cell, "text", s, "editable", editable, NULL);
+        break;
+
+    case COL_DESCNOTES:
+        /* Column is DESCRIPTION / NOTES */
+        break;
+
+    case COL_TRANSFERVOID:
+        /* Column is TRANSFER / VOID */
+        break;
+
+    case COL_RECN:
+        /* Column is RECN */
+        break;
+
+    case COL_TYPE:
+        /* Column is TYPE */
+        break;
+
+    case COL_VALUE:
+        /* Column is VALUE */
+        break;
+
+    case COL_RATE:
+        /* Column is RATE */
+        break;
+
+    case COL_AMOUNT:
+        /* Column is AMOUNT */
+        break;
+
+    case COL_AMTVAL:
+        /* Column is AMOUNT / VALUE */
+        break;
+
+    case COL_PRICE:
+        /* Column is PRICE */
+        break;
+
+    case COL_DEBIT:
+    case COL_CREDIT:
+        /* Column is CREDIT and DEBIT */
+        break;
+
+    case COL_BALANCE:
+        /* Column is BALANCE */
+        break;
+
+    case COL_STATUS:
+        /* Column is STATUS */
+        break;
+
+    case COL_COMM:
+        /* Column COMMODITY */
+        break;
+
+    default:
+        break;
+    }
+    LEAVE("");
+}
+
+
+/*###########################################################################*/
+
+/* Returns TRUE if dialog was canceled or discarded.
+   Does nothing if 'new_trans' is the dirty trans. */
+static gboolean
+gtv_sr_transaction_changed_confirm (GncTreeViewSplitReg *view,
+                            Transaction *new_trans)
+{
+    GtkWidget            *dialog, *window;
+    GncTreeModelSplitReg *model;
+    Split                *split;
+    gint response;
+    const char *title = _("Save the changed transaction?");
+    const char *message = _(
+        "The current transaction has changed. Would you like to "
+        "record the changes, or discard the changes?");
+
+    // Look for dirty_trans not being new_trans.
+    if (!view->priv->dirty_trans || view->priv->dirty_trans == new_trans)
+        return FALSE;
+
+    model = gnc_tree_view_split_reg_get_model_from_view (view);
+
+    // If using trading accounts, lets scrub them to make them work.
+    if (xaccTransUseTradingAccounts (view->priv->dirty_trans))
+    {
+        Account *default_account = gnc_tree_model_split_reg_get_anchor (model);
+        if (default_account != NULL)
+            xaccTransScrubImbalance (view->priv->dirty_trans, gnc_account_get_root(default_account), NULL);
+        else
+        {
+            Account *root = gnc_book_get_root_account (gnc_get_current_book());
+            xaccTransScrubImbalance (view->priv->dirty_trans, root, NULL);
+        }
+    }
+
+    // Test if the transaction is balanced.
+    if (gnc_tree_control_split_reg_balance_trans (view, view->priv->dirty_trans))
+    {
+        view->priv->trans_confirm = CANCEL;
+        return TRUE;
+    }
+
+    window = gnc_tree_view_split_reg_get_parent (view);
+    dialog = gtk_message_dialog_new (GTK_WINDOW (window),
+                                    GTK_DIALOG_DESTROY_WITH_PARENT,
+                                    GTK_MESSAGE_QUESTION,
+                                    GTK_BUTTONS_NONE,
+                                    "%s", title);
+    gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+                                             "%s", message);
+
+    gtk_dialog_add_buttons (GTK_DIALOG(dialog),_("_Discard Changes"), GTK_RESPONSE_REJECT,
+                            _("_Cancel"), GTK_RESPONSE_CANCEL,
+                            _("_Record Changes"), GTK_RESPONSE_ACCEPT, NULL);
+
+    response = gnc_dialog_run (GTK_DIALOG (dialog), GNC_PREF_WARN_REG_TRANS_MOD);
+    gtk_widget_destroy (dialog);
+
+    switch (response)
+    {
+    case GTK_RESPONSE_ACCEPT:
+        g_object_set_data (G_OBJECT (view), "data-edited", GINT_TO_POINTER (FALSE));
+        xaccTransCommitEdit (view->priv->dirty_trans);
+        split = gnc_tree_model_split_get_blank_split (model);
+        xaccSplitReinit (split); // Clear the blank split
+        view->priv->dirty_trans = NULL;
+        view->change_allowed = FALSE;
+        view->priv->auto_complete = FALSE;
+        view->priv->trans_confirm = ACCEPT;
+        return FALSE;
+        break;
+
+    case GTK_RESPONSE_REJECT:
+        if (view->priv->dirty_trans && xaccTransIsOpen (view->priv->dirty_trans))
+        {
+            // Move selection to trans - selection is blocked
+            gnc_tree_control_split_reg_goto_rel_trans_row (view, 0);
+
+            g_object_set_data (G_OBJECT (view), "data-edited", GINT_TO_POINTER (FALSE));
+            xaccTransRollbackEdit (view->priv->dirty_trans);
+            split = gnc_tree_model_split_get_blank_split (model);
+            xaccSplitReinit (split); // Clear the blank split
+            view->change_allowed = FALSE;
+            view->priv->auto_complete = FALSE;
+            view->priv->trans_confirm = DISCARD;
+        }
+        return TRUE;
+        break;
+
+    case GTK_RESPONSE_CANCEL:
+        view->priv->trans_confirm = CANCEL;
+        return TRUE;
+        break;
+
+    default:
+        return FALSE;
+    }
+    return FALSE;
+}
+
+
+/*###########################################################################
+             vvvvv    edit function call backs      vvvvvv
+#############################################################################*/
+#ifdef skip
+static void
+start_edit (GtkCellRenderer *cr, GtkCellEditable *editable,
+           const gchar *path_string, gpointer user_data)
+{
+//    GncTreeViewSplitReg *view = GNC_TREE_VIEW_SPLIT_REG (user_data);
+//    GncTreeModelSplitReg *model;
+    GtkTreePath         *path;
+//g_print("\n\nstart_edit\n");
+/*FIXME Not sure if this is required, leave for now ? */
+
+//    model = gnc_tree_view_split_reg_get_model_from_view (view);
+
+    gtv_sr_editable_start_editing_cb (cr, editable, path_string, user_data);
+/*    g_signal_connect(G_OBJECT(editable), "editing-done", (GCallback) editing_done_cb, view); */
+
+//FIXME this could be the sort path instead of model path / check !!
+    path = gtk_tree_path_new_from_string (path_string);
+
+//FIXME stuff here...
+
+    gtk_tree_path_free (path);
+
+    return;
+}
+#endif
+
+/* Open Transaction for editing */
+static void
+gtv_sr_begin_edit (GncTreeViewSplitReg *view, Transaction *trans)
+{
+    ENTER("gtv_sr_begin_edit trans %p", trans);
+
+    if (trans != view->priv->dirty_trans)
+    {
+        Timespec ts = {0,0};
+        xaccTransGetDatePostedTS (trans, &ts);
+
+        if (!xaccTransIsOpen (trans))
+            xaccTransBeginEdit (trans);
+        view->priv->dirty_trans = trans;
+
+        if (ts.tv_sec == 0)
+        {
+            //If the time returned by xaccTransGetDatePostedTS is 0 then assume it
+            //is a new transaction and set the time to current time to show current
+            //date on new transactions
+
+            ts.tv_sec = gnc_time (NULL);
+            xaccTransSetDatePostedSecs (trans, ts.tv_sec);
+        }
+    }
+    LEAVE(" ");
+}
+
+
+/* Call back to remove date widget */
+static void
+gtv_sr_remove_edit_date (GtkCellEditable *ce, gpointer user_data)
+{
+    GncTreeViewSplitReg *view = GNC_TREE_VIEW_SPLIT_REG (user_data);
+    GncPopupEntry *popup_entry;
+    const gchar *new_string; 
+    const gchar *current_string;
+    GDate date;
+    gchar *date_string;
+
+    ENTER("remove edit date and temp cell rend %p", view->priv->temp_cr);
+
+    if (view->priv->temp_cr != NULL)
+    {
+        // These strings are used to determine if cell data was altered so that keynav works better
+        popup_entry = GNC_POPUP_ENTRY (g_object_get_data (G_OBJECT (view->priv->temp_cr), "cell-editable"));
+
+        new_string = gtk_entry_get_text (GTK_ENTRY (popup_entry->entry));
+
+        current_string = g_object_get_data (G_OBJECT (view->priv->temp_cr), "current-string");
+
+        DEBUG("New string is %s and Current_string is %s", new_string, current_string);
+
+        // If editing wasn't canceled and strings don't match then cell data was edited
+        if (!GPOINTER_TO_INT (g_object_get_data (G_OBJECT (view->priv->temp_cr), "edit-canceled"))
+             && g_ascii_strcasecmp (new_string, current_string))
+        {
+            g_object_set_data (G_OBJECT (view), "data-edited", GINT_TO_POINTER (TRUE));
+        }
+
+        /* Lets update the help text */
+        gnc_tree_util_split_reg_parse_date (&date, new_string);
+        date_string = gnc_tree_util_split_reg_get_date_help (&date);
+
+        if (view->help_text)
+            g_free (view->help_text);
+        view->help_text = g_strdup (date_string);
+
+        g_signal_emit_by_name (view, "help_signal", NULL);
+        g_free (date_string);
+
+        g_object_set_data (G_OBJECT (view->priv->temp_cr), "cell-editable", NULL);
+        view->priv->temp_cr = NULL;
+        view->editing_now = FALSE;
+    }
+    LEAVE(" ");
+}
+
+
+/* Call back to remove combo widget */
+static void
+gtv_sr_remove_edit_combo (GtkCellEditable *ce, gpointer user_data)
+{
+    GncTreeViewSplitReg *view = GNC_TREE_VIEW_SPLIT_REG (user_data);
+    GtkEntry *entry; 
+    const gchar *new_string; 
+    const gchar *current_string;
+
+    ENTER("remove edit combo and temp cell rend %p", view->priv->temp_cr);
+
+    if (view->priv->temp_cr != NULL)
+    {
+        // These strings are used to determine if cell data was altered so that keynav works better
+        entry = GTK_ENTRY (gtk_bin_get_child (GTK_BIN (g_object_get_data (G_OBJECT (view->priv->temp_cr), "cell-editable"))));
+
+        new_string = gtk_entry_get_text (GTK_ENTRY (entry));
+
+        current_string = g_object_get_data (G_OBJECT (view->priv->temp_cr), "current-string");
+
+        DEBUG("New string is %s and Current_string is %s", new_string, current_string);
+
+        // If editing wasn't canceled and strings don't match then cell data was edited
+        if (!GPOINTER_TO_INT (g_object_get_data (G_OBJECT (view->priv->temp_cr), "edit-canceled"))
+             && g_ascii_strcasecmp (new_string, current_string))
+        {
+            g_object_set_data (G_OBJECT (view), "data-edited", GINT_TO_POINTER (TRUE));
+        }
+
+        g_object_set_data (G_OBJECT (view->priv->temp_cr), "cell-editable", NULL);
+        view->priv->temp_cr = NULL;
+        view->editing_now = FALSE;
+    }
+    LEAVE(" ");
+}
+
+
+/* Call back to remove entry widget */
+static void
+gtv_sr_remove_edit_entry (GtkCellEditable *ce, gpointer user_data)
+{
+    GncTreeViewSplitReg *view = GNC_TREE_VIEW_SPLIT_REG (user_data);
+    const gchar *new_string; 
+    const gchar *current_string; 
+
+    ENTER("remove edit entry and temp cell rend %p", view->priv->temp_cr);
+
+    if (view->priv->temp_cr != NULL)
+    {
+        // These strings are used to determine if cell data was altered so that keynav works better
+        new_string = gtk_entry_get_text (GTK_ENTRY (g_object_get_data (G_OBJECT (view->priv->temp_cr), "cell-editable")));
+
+        current_string = g_object_get_data (G_OBJECT (view->priv->temp_cr), "current-string");
+
+        DEBUG("New string is %s and Current_string is %s", new_string, current_string);
+
+        // If editing wasn't canceled and strings don't match then cell data was edited
+        if (!GPOINTER_TO_INT (g_object_get_data (G_OBJECT (view->priv->temp_cr), "edit-canceled"))
+             && g_ascii_strcasecmp (new_string, current_string))
+        {
+            g_object_set_data (G_OBJECT (view), "data-edited", GINT_TO_POINTER (TRUE));
+        }
+        if (g_object_get_data (G_OBJECT (view->priv->temp_cr), "current-flag") != NULL) // flag
+            g_object_set_data (G_OBJECT (view->priv->temp_cr), "current-flag", NULL);
+
+        g_object_set_data (G_OBJECT (view->priv->temp_cr), "cell-editable", NULL);
+        view->priv->temp_cr = NULL;
+        view->editing_now = FALSE;
+    }
+    LEAVE(" ");
+}
+
+
+/* Explain: GtkEntry has a cursor that blinks upon
+   g_timeout_dispatch(). It complains if it blinks after the GtkEntry
+   loses focus. So, we can't pop up any dialogs while the blinking
+   cursor is around. The solution is to force the editing to be
+   finished before raising the dialog. That finalizes the
+   gtkcelleditable. */
+static void
+gtv_sr_finish_edit (GncTreeViewSplitReg *view)
+{
+    GtkCellEditable *ce;
+
+    if (view->priv->temp_cr == NULL)
+        return;
+
+    DEBUG("gtv_sr_finish_edit temp_cr is %p", view->priv->temp_cr);
+
+    if ((ce = GTK_CELL_EDITABLE (g_object_get_data (G_OBJECT (view->priv->temp_cr), "cell-editable"))))
+    {
+        DEBUG("gtv_sr_finish_edit - editing_done");
+        gtk_cell_editable_editing_done (ce);
+        gtk_cell_editable_remove_widget (ce);
+    }
+}
+
+#ifdef skip
+//FIXME Not used yet
+/* This is used in g_idle_add to finish an edit */
+static gboolean
+gtv_sr_idle_finish_edit (GncTreeViewSplitReg *view)
+{
+   gtv_sr_finish_edit (view);
+   return FALSE;
+}
+
+
+/* This is used in g_idle_add to cancel an edit */
+static gboolean
+gtv_sr_idle_cancel_edit (GtkCellRenderer *cr)
+{
+    GtkCellEditable *ce;
+
+    gtk_cell_renderer_stop_editing (cr, TRUE);
+
+    ce = GTK_CELL_EDITABLE (g_object_get_data (G_OBJECT (cr), "cell-editable"));
+    gtk_cell_editable_editing_done (ce);
+    gtk_cell_editable_remove_widget (ce);
+
+   return FALSE;
+}
+#endif
+
+/* This is used in g_idle_add to repopulate the transfer cell */
+static gboolean
+gtv_sr_idle_transfer (GncTreeViewSplitReg *view)
+{
+    GtkTreePath *spath;
+    GList *columns;
+    GList  *column;
+    gint i;
+
+    spath = gnc_tree_view_split_reg_get_current_path (view);
+    columns = gtk_tree_view_get_columns (GTK_TREE_VIEW (view));
+
+    for (column = columns, i = 1; column; column = g_list_next (column), i++)
+    {
+        GList *renderers;
+        GtkCellRenderer *cr0;
+        GtkTreeViewColumn *tvc;
+        ViewCol viewcol;
+
+        tvc = column->data;
+
+        // Get the first renderer, it has the view-column value.
+        renderers = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (tvc));
+        cr0 = g_list_nth_data (renderers, 0);
+        g_list_free (renderers);
+
+        viewcol = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (cr0), "view_column"));
+
+        if (viewcol == COL_TRANSFERVOID)
+            gtk_tree_view_set_cursor (GTK_TREE_VIEW (view), spath, tvc, TRUE);
+    }
+    g_list_free (columns);
+    gtk_tree_path_free (spath);
+    return FALSE;
+}
+
+/*###########################################################################*/
+
+/* Set the column titles based on register type and depth */
+static void
+gtv_sr_titles (GncTreeViewSplitReg *view, RowDepth depth)
+{
+    GncTreeModelSplitReg *model;
+    GtkCellRenderer *cr0;
+    GList *renderers;
+    GList *columns;
+    GList  *column;
+    gint i;
+    gboolean is_template;
+
+    model = gnc_tree_view_split_reg_get_model_from_view (view);
+    ENTER("title depth is %d and sort_depth %d, sort_col is %d", depth, model->sort_depth, model->sort_col);
+
+    columns = gtk_tree_view_get_columns (GTK_TREE_VIEW (view));
+
+    is_template = gnc_tree_model_split_reg_get_template (model);
+
+    for (column = columns, i = 1; column; column = g_list_next (column), i++)
+    {
+        GtkTreeViewColumn *tvc;
+        ViewCol viewcol;
+
+        tvc = column->data;
+
+        // Get the first renderer, it has the view-column value.
+        renderers = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (tvc));
+        cr0 = g_list_nth_data (renderers, 0);
+        g_list_free (renderers);
+
+        viewcol = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (cr0), "view_column"));
+
+        DEBUG("viewcol is %d", viewcol);
+
+        switch (viewcol)
+        {
+        case COL_DATE:
+            switch (model->type)
+            {
+            default: //FIXME These if statements may not be required
+                /* Display arrows if we are sorting on this row */
+                if (model->sort_depth == depth && model->sort_col == viewcol)
+                    gtk_tree_view_column_set_sort_indicator (tvc, TRUE);
+                else
+                    gtk_tree_view_column_set_sort_indicator (tvc, FALSE);
+
+                if (depth == TRANS1)
+                    gtk_tree_view_column_set_title (tvc, _("Date Posted"));
+                else if (depth == TRANS2)
+                    gtk_tree_view_column_set_title (tvc, _("Date Entered"));
+                else if (depth == SPLIT3)
+                    gtk_tree_view_column_set_title (tvc, _("Date Reconciled"));
+                else
+                    gtk_tree_view_column_set_title (tvc, _("Date Posted / Entered / Reconciled"));
+                break;
+            }
+            break;
+
+        case COL_DUEDATE:
+            switch (model->type)
+            {
+            default: //FIXME These if statements may not be required
+                if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
+                    gtk_tree_view_column_set_title (tvc, _("Due Date"));
+                break;
+            }
+            break;
+
+        case COL_NUMACT:
+            switch (model->type)
+            {
+            case RECEIVABLE_REGISTER2:
+            case PAYABLE_REGISTER2:
+                if (depth == TRANS1)
+                    gtk_tree_view_column_set_title (tvc, _("Reference"));
+                else if (depth == TRANS2)
+                    gtk_tree_view_column_set_title (tvc, _("Action"));
+                else if (depth == SPLIT3)
+                    gtk_tree_view_column_set_title (tvc, _("Action"));
+                else
+                    gtk_tree_view_column_set_title (tvc, _("Reference / Action"));
+                break;
+
+
+            default:
+                /* Display arrows if we are sorting on this row */
+                if (model->sort_depth == depth && model->sort_col == viewcol)
+                    gtk_tree_view_column_set_sort_indicator (tvc, TRUE);
+                else
+                    gtk_tree_view_column_set_sort_indicator (tvc, FALSE);
+
+                if (depth == TRANS1)
+                    gtk_tree_view_column_set_title (tvc, _("Number"));
+                else if (depth == TRANS2 && (qof_book_use_split_action_for_num_field (gnc_get_current_book())))
+                    gtk_tree_view_column_set_title (tvc, _("T-Number"));
+                else if (depth == TRANS2 && (!qof_book_use_split_action_for_num_field (gnc_get_current_book())))
+                    gtk_tree_view_column_set_title (tvc, _("Action"));
+                else if (depth == SPLIT3)
+                    gtk_tree_view_column_set_title (tvc, _("Action"));
+                else
+                    gtk_tree_view_column_set_title (tvc, _("Number / Action"));
+                break;
+            }
+            break;
+
+        case COL_DESCNOTES:
+            switch (model->type)
+            {
+            case RECEIVABLE_REGISTER2:
+                if (depth == TRANS1)
+                    gtk_tree_view_column_set_title (tvc, _("Customer"));
+                else if (depth == TRANS2)
+                    gtk_tree_view_column_set_title (tvc, _("Memo"));
+                else if (depth == SPLIT3)
+                    gtk_tree_view_column_set_title (tvc, _("Memo"));
+                else
+                    gtk_tree_view_column_set_title (tvc, _("Customer / Memo"));
+                break;
+
+            case PAYABLE_REGISTER2:
+                if (depth == TRANS1)
+                    gtk_tree_view_column_set_title (tvc, _("Vendor"));
+                else if (depth == TRANS2)
+                    gtk_tree_view_column_set_title (tvc, _("Memo"));
+                else if (depth == SPLIT3)
+                    gtk_tree_view_column_set_title (tvc, _("Memo"));
+                else
+                    gtk_tree_view_column_set_title (tvc, _("Vendor / Memo"));
+                break;
+
+
+            default:
+                /* Display arrows if we are sorting on this row */
+                if (model->sort_depth == depth && model->sort_col == viewcol)
+                    gtk_tree_view_column_set_sort_indicator (tvc, TRUE);
+                else
+                    gtk_tree_view_column_set_sort_indicator (tvc, FALSE);
+
+                if (depth == TRANS1)
+                    gtk_tree_view_column_set_title (tvc, _("Description"));
+                else if (depth == TRANS2)
+                    gtk_tree_view_column_set_title (tvc, _("Notes"));
+                else if (depth == SPLIT3)
+                    gtk_tree_view_column_set_title (tvc, _("Memo"));
+                else
+                    gtk_tree_view_column_set_title (tvc, _("Description / Notes / Memo"));
+                break;
+            }
+            break;
+
+        case COL_TRANSFERVOID:
+            switch (model->type)
+            {
+            case RECEIVABLE_REGISTER2:
+            case PAYABLE_REGISTER2:
+                if (depth == TRANS1)
+                    gtk_tree_view_column_set_title (tvc, _("Accounts"));
+                else if (depth == TRANS2)
+                    gtk_tree_view_column_set_title (tvc, _("Accounts"));
+                else if (depth == SPLIT3)
+                    gtk_tree_view_column_set_title (tvc, _("Accounts"));
+                else
+                    gtk_tree_view_column_set_title (tvc, _("Accounts"));
+                break;
+
+            default:
+                /* Display arrows if we are sorting on this row */
+                if (model->sort_depth == depth && model->sort_col == viewcol)
+                    gtk_tree_view_column_set_sort_indicator (tvc, TRUE);
+                else
+                    gtk_tree_view_column_set_sort_indicator (tvc, FALSE);
+
+                if (depth == TRANS1)
+                    gtk_tree_view_column_set_title (tvc, _("Accounts"));
+                else if (depth == TRANS2)
+                    gtk_tree_view_column_set_title (tvc, _("Void Reason"));
+                else if (depth == SPLIT3)
+                    gtk_tree_view_column_set_title (tvc, _("Accounts"));
+                else
+                    gtk_tree_view_column_set_title (tvc, _("Accounts / Void Reason"));
+                break;
+            }
+            break;
+
+        case COL_RECN:
+            switch (model->type)
+            {
+            default: //FIXME These if statements may not be required
+                if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
+                    gtk_tree_view_column_set_title (tvc, _("R"));
+                break;
+            }
+            break;
+
+        case COL_TYPE:
+            switch (model->type)
+            {
+            default: //FIXME These if statements may not be required
+                if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
+                    gtk_tree_view_column_set_title (tvc, _("Type"));
+                break;
+            }
+            break;
+
+        case COL_VALUE:
+            switch (model->type)
+            {
+            default: //FIXME These if statements may not be required
+                if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
+                    gtk_tree_view_column_set_title (tvc, _("Value"));
+                break;
+            }
+            break;
+
+        case COL_AMOUNT:
+            switch (model->type)
+            {
+            default: //FIXME These if statements may not be required
+                if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
+                    gtk_tree_view_column_set_title (tvc, _("Amount"));
+                break;
+            }
+            break;
+
+        case COL_AMTVAL:
+            switch (model->type)
+            {
+            default:
+                if (depth == TRANS1 || depth == TRANS2)
+                    gtk_tree_view_column_set_title (tvc, _("Value"));
+                else if (depth == SPLIT3)
+                    gtk_tree_view_column_set_title (tvc, _("Amount"));
+                else
+                    gtk_tree_view_column_set_title (tvc, _("Amount / Value"));
+                break;
+            }
+            break;
+
+        case COL_COMM:
+            switch (model->type)
+            {
+            default: //FIXME These if statements may not be required
+                if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
+                    gtk_tree_view_column_set_title (tvc, _("Commodity"));
+                break;
+            }
+            break;
+
+        case COL_RATE:
+            switch (model->type)
+            {
+            default: //FIXME These if statements may not be required
+                if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
+                    gtk_tree_view_column_set_title (tvc, _("Rate"));
+                break;
+            }
+            break;
+
+        case COL_PRICE:
+            switch (model->type)
+            {
+            default: //FIXME These if statements may not be required
+                if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
+                    gtk_tree_view_column_set_title (tvc, _("Price"));
+                break;
+            }
+            break;
+
+        case COL_CREDIT:
+            if(!(model->use_accounting_labels))
+            {
+                switch (model->type)
+                {
+                case BANK_REGISTER2: //FIXME These if statements may not be required
+                if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
+                        gtk_tree_view_column_set_title (tvc, _("Withdrawal"));
+                    break;
+
+                case CASH_REGISTER2:
+                if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
+                        gtk_tree_view_column_set_title (tvc, _("Spend"));
+                    break;
+
+                case ASSET_REGISTER2:
+                if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
+                        gtk_tree_view_column_set_title (tvc, _("Decrease"));
+                    break;
+
+                case LIABILITY_REGISTER2:
+                case EQUITY_REGISTER2:
+                case TRADING_REGISTER2:
+                if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
+                        gtk_tree_view_column_set_title (tvc, _("Increase"));
+                    break;
+
+                case CREDIT_REGISTER2:
+                if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
+                        gtk_tree_view_column_set_title (tvc, _("Charge"));
+                    break;
+
+                case INCOME_REGISTER2:
+                case INCOME_LEDGER2:
+                if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
+                        gtk_tree_view_column_set_title (tvc, _("Income"));
+                    break;
+
+                case EXPENSE_REGISTER2:
+                if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
+                        gtk_tree_view_column_set_title (tvc, _("Rebate"));
+                    break;
+
+                case STOCK_REGISTER2:
+                case CURRENCY_REGISTER2:
+                case PORTFOLIO_LEDGER2:
+                if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
+                        gtk_tree_view_column_set_title (tvc, _("Sell"));
+                    break;
+
+                case RECEIVABLE_REGISTER2:
+                if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
+                        gtk_tree_view_column_set_title (tvc, _("Payment"));
+                    break;
+
+                case PAYABLE_REGISTER2:
+                if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
+                        gtk_tree_view_column_set_title (tvc, _("Bill"));
+                    break;
+
+                case GENERAL_JOURNAL2:
+                if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
+                        gtk_tree_view_column_set_title (tvc, _("Funds Out"));
+                    break;
+
+                case SEARCH_LEDGER2:
+                if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
+                {
+                    if (!is_template)
+                        gtk_tree_view_column_set_title (tvc, _("Funds Out"));
+                    else
+                        gtk_tree_view_column_set_title (tvc, _("Credit Formula"));
+                }
+                    break;
+
+                default:
+                    if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
+                        gtk_tree_view_column_set_title (tvc, _("Credit"));
+                    break;
+                }
+            }
+            else
+                gtk_tree_view_column_set_title (tvc, _("Credit"));
+            break;
+
+        case COL_DEBIT:
+            if(!(model->use_accounting_labels))
+            {
+                switch (model->type)
+                {
+                case BANK_REGISTER2: //FIXME These if statements may not be required
+                if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
+                        gtk_tree_view_column_set_title (tvc, _("Deposit"));
+                    break;
+
+                case CASH_REGISTER2:
+                if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
+                        gtk_tree_view_column_set_title (tvc, _("Receive"));
+                    break;
+
+                case ASSET_REGISTER2:
+                if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
+                        gtk_tree_view_column_set_title (tvc, _("Increase"));
+                    break;
+
+                case LIABILITY_REGISTER2:
+                case EQUITY_REGISTER2:
+                case TRADING_REGISTER2:
+                if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
+                        gtk_tree_view_column_set_title (tvc, _("Decrease"));
+                    break;
+
+                case INCOME_REGISTER2:
+                case INCOME_LEDGER2:
+                if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
+                        gtk_tree_view_column_set_title (tvc, _("Charge"));
+                    break;
+
+                case EXPENSE_REGISTER2:
+                if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
+                        gtk_tree_view_column_set_title (tvc, _("Expense"));
+                    break;
+
+                case STOCK_REGISTER2:
+                case CURRENCY_REGISTER2:
+                case PORTFOLIO_LEDGER2:
+                if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
+                        gtk_tree_view_column_set_title (tvc, _("Buy"));
+                    break;
+
+                case RECEIVABLE_REGISTER2:
+                if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
+                        gtk_tree_view_column_set_title (tvc, _("Invoice"));
+                    break;
+
+                case CREDIT_REGISTER2:
+                case PAYABLE_REGISTER2:
+                if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
+                        gtk_tree_view_column_set_title (tvc, _("Payment"));
+                    break;
+
+                case GENERAL_JOURNAL2:
+                if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
+                        gtk_tree_view_column_set_title (tvc, _("Funds In"));
+                    break;
+
+                case SEARCH_LEDGER2:
+                if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
+                {
+                    if (!is_template)
+                        gtk_tree_view_column_set_title (tvc, _("Funds In"));
+                    else
+                        gtk_tree_view_column_set_title (tvc, _("Debit Formula"));
+                }
+                    break;
+
+                default:
+                if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
+                        gtk_tree_view_column_set_title (tvc, _("Debit"));
+                    break;
+                }
+            }
+            else
+                gtk_tree_view_column_set_title (tvc, _("Debit"));
+            break;
+
+        case COL_BALANCE:
+            switch (model->type)
+            {
+            default: //FIXME These if statements may not be required
+                if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
+                    gtk_tree_view_column_set_title (tvc, _("Balance"));
+                break;
+            }
+            break;
+
+        default:
+            break;
+        }
+    }
+    LEAVE(" ");
+    g_list_free (columns);
+}
+
+
+/* Update the help text */
+static void
+gtv_sr_help (GncTreeViewSplitReg *view, GtkCellRenderer *cr, ViewCol viewcol, RowDepth depth)
+{
+    GncTreeModelSplitReg *model;
+    gchar *help = NULL;
+    const gchar *current_string;
+
+    ENTER("Help Viewcol is %d and depth is %d", viewcol, depth);
+
+    model = gnc_tree_view_split_reg_get_model_from_view (view);
+
+    switch (viewcol)
+    {
+    case COL_DATE:
+        switch (model->type)
+        {
+        default: //FIXME These if statements may not be required
+            if (depth == TRANS1)
+            {
+                GDate date;
+
+                current_string = g_object_get_data (G_OBJECT (cr), "current-string");
+                g_date_set_parse (&date, current_string);
+                help = gnc_tree_util_split_reg_get_date_help (&date);
+            }
+            else
+                help = g_strdup (" ");
+            break;
+        }
+        break;
+
+    case COL_DUEDATE:
+        switch (model->type)
+        {
+        default: //FIXME These if statements may not be required
+            if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
+                help = g_strdup (_("Enter Due Date"));
+            break;
+        }
+        break;
+
+    case COL_NUMACT:
+        switch (model->type)
+        {
+        case RECEIVABLE_REGISTER2:
+        case PAYABLE_REGISTER2:
+            if (depth == TRANS1)
+                help = g_strdup (_("Enter the transaction reference, such as the invoice or check number"));
+            else if (depth == TRANS2 || depth == SPLIT3)
+                help = g_strdup (_("Enter the type of transaction, or choose one from the list"));
+            break;
+
+        default:
+            if (depth == TRANS1)
+                help = g_strdup (_("Enter the transaction number, such as the check number"));
+            else if (depth == TRANS2 || depth == SPLIT3)
+                help = g_strdup (_("Enter the type of transaction, or choose one from the list"));
+            break;
+        }
+        break;
+
+    case COL_DESCNOTES:
+        switch (model->type)
+        {
+        case RECEIVABLE_REGISTER2:
+            if (depth == TRANS1)
+                help = g_strdup (_("Enter the name of the Customer"));
+            else if (depth == TRANS2)
+                help = g_strdup (_("Enter notes for the transaction"));
+            else if (depth == SPLIT3)
+                help = g_strdup (_("Enter a description of the split"));
+            break;
+
+        case PAYABLE_REGISTER2:
+            if (depth == TRANS1)
+                help = g_strdup (_("Enter the name of the Vendor"));
+            else if (depth == TRANS2)
+                help = g_strdup (_("Enter notes for the transaction"));
+            else if (depth == SPLIT3)
+                help = g_strdup (_("Enter a description of the split"));
+            break;
+
+        default:
+            if (depth == TRANS1)
+                help = g_strdup (_("Enter a description of the transaction"));
+            else if (depth == TRANS2)
+                help = g_strdup (_("Enter notes for the transaction"));
+            else if (depth == SPLIT3)
+                help = g_strdup (_("Enter a description of the split"));
+            break;
+        }
+        break;
+
+    case COL_TRANSFERVOID:
+        switch (model->type)
+        {
+        default:
+            if (depth == TRANS1)
+                help = g_strdup (_("Enter the account to transfer from, or choose one from the list"));
+            else if (depth == TRANS2)
+                help = g_strdup (_("Reason the transaction was voided"));
+            else if (depth == SPLIT3)
+                help = g_strdup (_("Enter the account to transfer from, or choose one from the list"));
+            break;
+        }
+        break;
+
+    case COL_RECN:
+        switch (model->type)
+        {
+        default: //FIXME These if statements may not be required
+            if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
+                help = g_strdup (_("Enter the reconcile type"));
+            break;
+        }
+        break;
+
+    case COL_TYPE:
+        switch (model->type)
+        {
+        default: //FIXME These if statements may not be required
+            if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
+                help = g_strdup (_("Enter the type of transaction"));
+            break;
+        }
+        break;
+
+    case COL_VALUE:
+        switch (model->type)
+        {
+        default: //FIXME These if statements may not be required
+            if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
+                help = g_strdup (_("Enter the value of shares bought or sold"));
+            break;
+        }
+        break;
+
+    case COL_AMOUNT:
+        switch (model->type)
+        {
+        default: //FIXME These if statements may not be required
+            if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
+                help = g_strdup (_("Enter the number of shares bought or sold"));
+            break;
+        }
+        break;
+
+    case COL_AMTVAL:
+        switch (model->type)
+        {
+        default:
+            if ((depth == TRANS1) || (depth == TRANS2))
+                help = g_strdup (_("Enter the value of shares bought or sold"));
+            else if (depth == SPLIT3)
+                help = g_strdup (_("Enter the number of shares bought or sold"));
+            break;
+        }
+        break;
+
+    case COL_COMM:
+        switch (model->type)
+        {
+        default: //FIXME These if statements may not be required
+            if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
+                help = g_strdup (_("* Indicates the transaction Commodity."));
+            break;
+        }
+        break;
+
+    case COL_RATE:
+        switch (model->type)
+        {
+        default: //FIXME These if statements may not be required
+            if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
+                help = g_strdup (_("Enter the rate"));
+            break;
+        }
+        break;
+
+    case COL_PRICE:
+        switch (model->type)
+        {
+        default: //FIXME These if statements may not be required
+            if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
+                help = g_strdup (_("Enter the effective share price"));
+            break;
+        }
+        break;
+
+    case COL_CREDIT:
+        switch (model->type)
+        {
+        default: //FIXME These if statements may not be required
+            if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
+                help = g_strdup (_("Enter credit formula for real transaction"));
+            break;
+        }
+        break;
+
+    case COL_DEBIT:
+        switch (model->type)
+        {
+        default: //FIXME These if statements may not be required
+            if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
+                help = g_strdup (_("Enter debit formula for real transaction"));
+            break;
+        }
+        break;
+
+    default:
+            help = g_strdup (" ");
+        break;
+    }
+
+    LEAVE("Help text is - %s", help);
+    if (view->help_text)
+        g_free (view->help_text);
+    view->help_text = g_strdup (help);
+    g_free (help);
+    g_signal_emit_by_name (view, "help_signal", NULL);
+}
+
+/*###########################################################################*/
+
+/* Move the selection to the blank split when expanded */
+static gboolean
+gtv_sr_selection_to_blank (GncTreeViewSplitReg *view)
+{
+    GncTreeModelSplitReg *model;
+    GtkTreePath *bpath, *spath;
+    Split *bsplit;
+
+    /* give gtk+ a chance to handle pending events */
+    while (gtk_events_pending ())
+        gtk_main_iteration ();
+
+    /* Make sure we have expanded splits */
+    if (view->priv->expanded == FALSE)
+        return FALSE;
+
+    model = gnc_tree_view_split_reg_get_model_from_view (view);
+
+    bsplit = gnc_tree_model_split_get_blank_split (model);
+    bpath =  gnc_tree_model_split_reg_get_path_to_split_and_trans (model, bsplit, NULL);
+
+    spath = gnc_tree_view_split_reg_get_sort_path_from_model_path (view, bpath);
+
+    /* Set cursor to new spath */
+    gtk_tree_view_set_cursor (GTK_TREE_VIEW (view), spath, NULL, FALSE);
+
+    gtk_tree_path_free (bpath);
+    gtk_tree_path_free (spath);
+
+    return FALSE;
+}
+
+
+/* Call back for when a change to a Transaction requires the selection to get out of the way */
+static void
+gtv_sr_selection_move_delete_cb (GncTreeModelSplitReg *model, gpointer item, gpointer user_data)
+{
+    GncTreeViewSplitReg *view = user_data;
+    Transaction *trans = item;
+
+    DEBUG("gtv_sr_selection_move_delete_cb view %p model %p trans %p", view, model, trans);
+
+    DEBUG("gtv_sr_selection_move_delete_cb current_trans %p trans %p", view->priv->current_trans, trans);
+
+    /* if same, lets get out of the way, so move */
+    if (trans == view->priv->current_trans)
+        gnc_tree_control_split_reg_goto_rel_trans_row (view, 1);
+
+}
+
+
+/* Call back for focus out event so we can finish edit */
+static gboolean
+gtv_sr_focus_out_cb (GtkWidget *widget, GdkEventFocus *event, gpointer user_data)
+{
+    GncTreeViewSplitReg *view = GNC_TREE_VIEW_SPLIT_REG (user_data);
+
+    gnc_tree_view_split_reg_finish_edit (view);
+
+    return FALSE;
+}
+
+
+/* Reconcile column tests */
+static gboolean
+gtv_sr_recn_tests (GncTreeViewSplitReg *view, GtkTreeViewColumn *column, GtkTreePath *spath)
+{
+    GtkCellRenderer *cr0;
+    GList *renderers;
+    ViewCol viewcol;
+
+    ENTER(" ");
+
+    // Get the first renderer, it has the view-column value.
+    renderers = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (column));
+    cr0 = g_list_nth_data (renderers, 0);
+    g_list_free (renderers);
+
+    viewcol = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (cr0), "view_column"));
+
+    /* Test for change of RECN COLUMN setting from reconciled */
+    if (viewcol == COL_RECN)
+    {
+        /* Are we trying to change the reconcile setting */
+        if (!gnc_tree_control_split_reg_recn_change (view, spath))
+        {
+            LEAVE("Not allowed to change reconciled transaction");
+            return TRUE;
+        }
+    }
+
+    /* Ask, are we allowed to change reconciled values other than 'description / notes / memo'
+       which we can change always */
+    if (viewcol != COL_DESCNOTES && viewcol != COL_RECN)
+    {
+        if (!gnc_tree_control_split_reg_recn_test (view, spath))
+        {
+            LEAVE("Not allowed to edit reconciled transaction");
+            return TRUE;
+        }
+    }
+    LEAVE(" ");
+    return FALSE;
+}
+
+
+/* Test to see if we need to do a move */
+static void
+gtv_split_reg_test_for_move (GncTreeModelSplitReg *model, GtkTreePath *spath)
+{
+    gint num_of_trans, trans_pos;
+    gint *indices;
+
+    indices = gtk_tree_path_get_indices (spath);
+    num_of_trans = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (model), NULL);
+
+    trans_pos = indices[0];
+
+    if (trans_pos < num_of_trans*1/3)
+        gnc_tree_model_split_reg_move (model, VIEW_UP);
+
+    if (trans_pos > num_of_trans*2/3)
+        gnc_tree_model_split_reg_move (model, VIEW_DOWN);
+}
+
+/*###########################################################################*/
+
+/* This is the callback for the mouse click */
+static gboolean
+gtv_sr_button_cb (GtkWidget *widget, GdkEventButton *event, gpointer user_data)
+{
+    GncTreeViewSplitReg  *view = GNC_TREE_VIEW_SPLIT_REG (widget);
+    GncTreeModelSplitReg *model;
+    GtkTreePath *mpath, *spath;
+    GtkTreeViewColumn    *col;
+    GtkTreeIter m_iter;
+    Split *split = NULL;
+    Split *rotate_split = NULL;
+    Transaction *trans = NULL;
+    gboolean is_trow1, is_trow2, is_split, is_blank;
+
+    model = gnc_tree_view_split_reg_get_model_from_view (view);
+
+    /* This is for a single click */
+    if (event->button == 1 && event->type == GDK_BUTTON_PRESS)
+    {
+        GdkWindow *window = gtk_tree_view_get_bin_window (GTK_TREE_VIEW (view));
+
+        if (event->window != window)
+            return FALSE;
+
+        // Make sure we have stopped editing.
+        gnc_tree_view_split_reg_finish_edit (view);
+
+        // This prevents the cell changing.
+        if (view->priv->stop_cell_move == TRUE)
+            return TRUE;
+
+        /* Get tree path for row that was clicked, true if row exists */
+        if (gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (view), (gint) event->x, (gint) event->y,
+                                             &spath, &col, NULL, NULL))
+        {
+            DEBUG("event->x is %d and event->y is %d", (gint)event->x, (gint)event->y);
+
+            mpath = gnc_tree_view_split_reg_get_model_path_from_sort_path (view, spath);
+
+            /* This is to block the single click on a double click */
+            if (view->priv->single_button_press > 0)
+            {
+                view->priv->single_button_press = view->priv->single_button_press -1;
+                return TRUE;
+            }
+
+            if (gtk_tree_model_get_iter (GTK_TREE_MODEL (model), &m_iter, mpath))
+            {
+                gchar *mstring, *sstring;
+                mstring = gtk_tree_path_to_string (mpath);
+                sstring = gtk_tree_path_to_string (spath);
+                DEBUG("Mouse Button Press - mpath is %s, spath is %s", mstring, sstring);
+                g_free (mstring);
+                g_free (sstring);
+
+                // Reset the transaction confirm flag.
+                view->priv->trans_confirm = RESET;
+
+                gnc_tree_model_split_reg_get_split_and_trans (
+                       GNC_TREE_MODEL_SPLIT_REG (model), &m_iter, &is_trow1, &is_trow2, &is_split, &is_blank, &split, &trans);
+
+                // Ask for confirmation if data has been edited, gtv_sr_transaction_changed_confirm return TRUE if canceled
+                if (GPOINTER_TO_INT (g_object_get_data (G_OBJECT (view), "data-edited")) && gtv_sr_transaction_changed_confirm (view, trans))
+                {
+                    DEBUG("MB - Restore position - Cancel / Discard");
+
+                    /* Restore position - Cancel / Discard */
+                    if (view->priv->trans_confirm == CANCEL)
+                    {
+                        DEBUG("MB - Cancel");
+
+                        // Expand trans on split-trans (We only expand on cancel and more than two splits)
+                        if ((xaccTransCountSplits (view->priv->dirty_trans) > 2) && view->priv->dirty_trans != NULL)
+                        {
+                            // Jump to the first split of dirty_trans.
+                            gnc_tree_control_split_reg_jump_to (view, NULL, xaccTransGetSplit (view->priv->dirty_trans, 0), FALSE);
+                        }
+                        else
+                            // Jump to the dirty_trans.
+                            gnc_tree_control_split_reg_jump_to (view, view->priv->dirty_trans, NULL, FALSE);
+
+                        gtk_tree_path_free (spath);
+                        gtk_tree_path_free (mpath);
+                        return TRUE;
+                    }
+
+                    if (view->priv->trans_confirm == DISCARD)
+                    {
+                        DEBUG("MB - Discard");
+                        view->priv->dirty_trans = NULL;
+                    }
+                }
+                /* Skip */
+
+                /* Test for change of transaction */
+                if (view->priv->current_trans != trans)
+                    /* Reset allow changes for reconciled transactions */
+                    view->change_allowed = FALSE;
+
+                // Reconcile tests
+                if (gtv_sr_recn_tests (view, col, spath))
+                {
+                    gtk_tree_path_free (spath);
+                    gtk_tree_path_free (mpath);
+                    return TRUE;
+                }
+
+                // Get the right split for rotate test
+                if (is_split)
+                    rotate_split = split;
+                else
+                    rotate_split = gtv_sr_get_this_split (view, trans);
+
+                /* Set cursor to column */
+                if (!gnc_tree_util_split_reg_rotate (view, col, trans, rotate_split))
+                    gtk_tree_view_set_cursor (GTK_TREE_VIEW (view), spath, col, TRUE);
+                else
+                    gtk_tree_view_set_cursor (GTK_TREE_VIEW (view), spath, col, FALSE);
+
+                /* Test to see if we need to do a move */
+                gtv_split_reg_test_for_move (model, spath);
+
+                gtk_tree_path_free (spath);
+                gtk_tree_path_free (mpath);
+                return TRUE;
+            }
+            gtk_tree_path_free (spath);
+            gtk_tree_path_free (mpath);
+        }
+    }
+
+    /* This is for a double click */
+    if (event->button == 1 && event->type == GDK_2BUTTON_PRESS)
+    {
+        GdkWindow *window = gtk_tree_view_get_bin_window (GTK_TREE_VIEW (view));
+
+        if (event->window != window)
+            return FALSE;
+
+        /* this works on non editable cells like void, balance */
+        if (model->style != REG2_STYLE_JOURNAL)
+        {
+            /* This is to block the single click on a double click */
+            view->priv->single_button_press = 1;
+
+            if (view->priv->expanded)
+                gnc_tree_view_split_reg_collapse_trans (view, NULL);
+            else
+                gnc_tree_view_split_reg_expand_trans (view, NULL);
+
+            /* This updates the plugin page gui */
+            gnc_tree_view_split_reg_call_uiupdate_cb(view);
+        }
+        return TRUE;
+    }
+    return FALSE;
+}
+
+
+static gboolean
+gtv_sr_transaction_changed (GncTreeViewSplitReg *view)
+{
+    GncTreeModelSplitReg *model;
+    GtkTreeViewColumn *col;
+    GtkTreePath *spath;
+
+    model = gnc_tree_view_split_reg_get_model_from_view (view);
+
+    // spath is where we are...
+    gtk_tree_view_get_cursor (GTK_TREE_VIEW (view), &spath, &col);
+
+    if (!spath)
+        return FALSE;
+
+    if (gtv_sr_recn_tests (view, col, spath))
+    {
+        gtk_tree_path_free (spath);
+        return FALSE;
+    }
+    gtk_tree_path_free (spath);
+
+    // Reset the transaction confirm flag.
+    view->priv->trans_confirm = RESET;
+
+    //Ask for confirmation if data has been edited, gtv_sr_transaction_changed_confirm return TRUE if canceled
+    if (GPOINTER_TO_INT (g_object_get_data (G_OBJECT (view), "data-edited")) && gtv_sr_transaction_changed_confirm (view, NULL))
+    {
+        /* Restore position - Cancel / Discard */
+        DEBUG("KB - Restore position - Cancel / Discard");
+
+        if (view->priv->trans_confirm == CANCEL)
+        {
+            DEBUG("KB - Cancel");
+
+            // Expand trans on split-trans (We only expand on cancel)
+            if ((xaccTransCountSplits (view->priv->dirty_trans) > 2) && view->priv->dirty_trans != NULL)
+            {
+                // Jump to the first split of dirty_trans.
+                gnc_tree_control_split_reg_jump_to (view, NULL, xaccTransGetSplit (view->priv->dirty_trans, 0), FALSE);
+            }
+            else
+                // Jump to the dirty_trans.
+                gnc_tree_control_split_reg_jump_to (view, view->priv->dirty_trans, NULL, FALSE);
+
+            return TRUE;
+        }
+
+        if (view->priv->trans_confirm == DISCARD)
+        {
+            DEBUG("KB - Discard");
+
+            gnc_tree_view_split_reg_block_selection (view, TRUE);
+
+            // Check to see if dirty_trans expanded, collapse it.
+            if (gnc_tree_view_split_reg_trans_expanded (view, view->priv->dirty_trans))
+                gnc_tree_view_split_reg_collapse_trans (view, view->priv->dirty_trans);
+
+            gnc_tree_view_split_reg_block_selection (view, FALSE);
+
+            /* Remove the blank split and re-add - done so we keep it last in list */
+            gnc_tree_model_split_reg_set_blank_split_parent (model, view->priv->dirty_trans, TRUE);
+            gnc_tree_model_split_reg_set_blank_split_parent (model, view->priv->dirty_trans, FALSE);
+
+            // Set the transaction to show correct view
+            gnc_tree_view_split_reg_format_trans (view, view->priv->dirty_trans);
+            view->priv->dirty_trans = NULL;
+        }
+    }
+    return FALSE;
+}
+
+
+/* Return whether the cell is in editing mode */
+static gboolean
+gtv_sr_get_editing (GtkTreeViewColumn *col)
+{
+    GtkCellRenderer *cr0 = NULL, *cr1 = NULL;
+    GList *renderers;
+    gboolean cell_editing0 = FALSE;
+    gboolean cell_editing1 = FALSE;
+    gboolean editing = FALSE;
+
+    renderers = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (col));
+    cr0 = g_list_nth_data (renderers, 0); // We always have one renderer
+    if (g_list_length (renderers) == 2)
+        cr1 = g_list_nth_data (renderers, 1); // There is only one column with two renderers
+    g_list_free (renderers);
+
+    if (gtk_cell_renderer_get_visible (cr0))
+        g_object_get (G_OBJECT (cr0), "editing", &cell_editing0, NULL);
+
+    if (cr1 && gtk_cell_renderer_get_visible (cr1))
+        g_object_get (G_OBJECT (cr1), "editing", &cell_editing1, NULL);
+
+    if (cell_editing0 || cell_editing1)
+        editing = TRUE;
+
+    DEBUG("editing is %d for column title %s", editing, gtk_tree_view_column_get_title (col));
+
+    return editing;
+}
+
+
+/* For handling keynav */
+static gboolean
+gtv_sr_key_press_cb (GtkWidget *widget, GdkEventKey *event, gpointer user_data)
+{
+    GncTreeViewSplitReg *view = GNC_TREE_VIEW_SPLIT_REG (widget);
+    GncTreeModelSplitReg *model;
+    GtkTreeViewColumn *col;
+    GtkTreePath *spath, *start_spath;
+    GtkTreePath *start_path, *end_path;
+    gboolean editing = FALSE;
+    gboolean step_off = FALSE;
+    gboolean trans_changed = FALSE;
+    gint *start_indices;
+    gint *next_indices;
+    Transaction *btrans, *ctrans, *hetrans;
+    gboolean goto_blank = FALSE;
+    gboolean next_trans = TRUE;
+
+    // spath is where we are, before key press...
+    gtk_tree_view_get_cursor (GTK_TREE_VIEW (view), &spath, &col);
+
+    if (event->type != GDK_KEY_PRESS)
+    {
+        if (spath)
+            gtk_tree_path_free (spath);
+        return FALSE;
+    }
+
+    switch (event->keyval)
+    {
+    case GDK_KEY_plus:
+    case GDK_KEY_minus:
+    case GDK_KEY_KP_Add:
+    case GDK_KEY_KP_Subtract:
+
+        if (!spath)
+            return TRUE;
+
+        gtk_tree_path_free (spath);
+        return TRUE; //FIXME I may use these to expand / collapse to splits later...
+        break;
+
+    case GDK_KEY_Up:
+    case GDK_KEY_Down:
+
+        model = gnc_tree_view_split_reg_get_model_from_view (view);
+
+        if (event->keyval == GDK_KEY_Up)
+        {
+            gnc_tree_model_split_reg_move (model, VIEW_UP);
+        }
+        else
+            gnc_tree_model_split_reg_move (model, VIEW_DOWN);
+
+        return FALSE;
+        break;
+
+    case GDK_KEY_Page_Up:
+    case GDK_KEY_Page_Down:
+
+        model = gnc_tree_view_split_reg_get_model_from_view (view);
+
+        if (gtk_tree_view_get_visible_range (GTK_TREE_VIEW (view), &start_path, &end_path))
+        {
+            if (event->keyval == GDK_KEY_Page_Up)
+            {
+                GtkTreePath *new_start_path;
+                gint *start_indices, *end_indices;
+                gint new_start;
+                gint num_of_trans;
+
+                start_indices = gtk_tree_path_get_indices (start_path);
+                end_indices = gtk_tree_path_get_indices (end_path);
+                num_of_trans = end_indices[0] - start_indices[0];
+
+                new_start = start_indices[0] - num_of_trans + 2;
+
+                if (new_start < 0)
+                    new_start = 0;
+
+                new_start_path = gtk_tree_path_new_from_indices (new_start, -1);
+
+                /* Scroll to cell, top of view */
+                gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (view), new_start_path, NULL, TRUE, 0.0, 0.0);
+
+                /* Set cursor to new top row */
+                gtk_tree_view_set_cursor (GTK_TREE_VIEW (view), new_start_path, col, FALSE);
+
+                gtk_tree_path_free (new_start_path);
+
+                gnc_tree_model_split_reg_move (model, VIEW_UP);
+            }
+            else
+            {
+                GtkTreePath *new_end_path;
+                gint *start_indices, *end_indices;
+                gint new_end;
+                gint num_of_trans, total_num;
+
+                start_indices = gtk_tree_path_get_indices (start_path);
+                end_indices = gtk_tree_path_get_indices (end_path);
+                num_of_trans = end_indices[0] - start_indices[0];
+
+                total_num = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (model), NULL);
+
+                new_end = end_indices[0] + num_of_trans - 1;
+
+                if (new_end > (total_num - 1))
+                    new_end = total_num -1;
+
+                new_end_path = gtk_tree_path_new_from_indices (new_end, -1);
+
+                /* Scroll to cell, bottom of view */
+                if (model->use_double_line == TRUE)
+                {
+                    gtk_tree_path_down (new_end_path);
+                    gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (view), new_end_path, NULL, TRUE, 1.0, 0.0);
+                    gtk_tree_path_up (new_end_path);
+                }
+                else
+                    gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (view), new_end_path, NULL, TRUE, 1.0, 0.0);
+
+                /* Set cursor to new bottom row */
+                gtk_tree_view_set_cursor (GTK_TREE_VIEW (view), new_end_path, col, FALSE);
+
+                gtk_tree_path_free (new_end_path);
+
+                gnc_tree_model_split_reg_move (model, VIEW_DOWN);
+            }
+            gtk_tree_path_free (start_path);
+            gtk_tree_path_free (end_path);
+        }
+        return TRUE;
+        break;
+
+    case GDK_KEY_Home:
+    case GDK_KEY_End:
+
+        model = gnc_tree_view_split_reg_get_model_from_view (view);
+
+        if (event->keyval == GDK_KEY_Home)
+            hetrans = gnc_tree_model_split_reg_get_first_trans (model);
+        else
+            hetrans = gnc_tree_model_split_get_blank_trans (model);
+
+        model->current_trans = hetrans;
+
+        if (!gnc_tree_model_split_reg_trans_is_in_view (model, hetrans))
+            g_signal_emit_by_name (model, "refresh_trans");
+        else
+            gnc_tree_control_split_reg_jump_to (view, hetrans, NULL, FALSE);
+
+        return TRUE;
+        break;
+
+    case GDK_KEY_Return:
+    case GDK_KEY_space:
+
+        if (!spath)
+            return TRUE;
+
+        // Do the reconcile tests.
+        if (!gtv_sr_recn_tests (view, col, spath))
+        {
+            /* Set cursor to new column, open for editing */
+            gtk_tree_view_set_cursor (GTK_TREE_VIEW (view), spath, col, TRUE);
+        }
+
+        gtk_tree_path_free (spath);
+        return TRUE;
+        break;
+
+    case GDK_KEY_KP_Enter:
+
+        if (!spath)
+            return TRUE;
+
+        goto_blank = gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL_REGISTER,
+                                         GNC_PREF_ENTER_MOVES_TO_END);
+
+        model = gnc_tree_view_split_reg_get_model_from_view (view);
+        btrans = gnc_tree_model_split_get_blank_trans (model);
+        ctrans = gnc_tree_view_split_reg_get_current_trans (view);
+
+        /* Are we on the blank transaction */
+        if (btrans == ctrans)
+            next_trans = FALSE;
+
+        /* First record the transaction */
+        if (gnc_tree_view_split_reg_enter (view))
+        {
+            /* Now move. */
+            if (goto_blank)
+                g_idle_add ((GSourceFunc)gnc_tree_control_split_reg_jump_to_blank, view);
+            else if (next_trans)
+                gnc_tree_control_split_reg_goto_rel_trans_row (view, 1);
+        }
+        return TRUE;
+        break;
+
+    case GDK_KEY_Tab:
+    case GDK_KEY_ISO_Left_Tab:
+    case GDK_KEY_KP_Tab:
+
+        if (!spath)
+            return TRUE;
+
+        // Bypass Auto-complete
+        if (event->state & GDK_CONTROL_MASK)
+            view->priv->auto_complete = TRUE;
+
+        // Make sure we have stopped editing.
+        gnc_tree_view_split_reg_finish_edit (view);
+
+        // This prevents the cell changing.
+        if (view->priv->stop_cell_move == TRUE)
+        {
+            gtk_tree_path_free (spath);
+            return TRUE;
+        }
+
+        while (!editing && !step_off) // lets step over non editable columns
+        {
+            // Create a copy of the path we started with.
+            start_spath = gtk_tree_path_copy (spath);
+            start_indices = gtk_tree_path_get_indices (start_spath);
+
+            {
+                gchar *string = gtk_tree_path_to_string (start_spath);
+                DEBUG("Column title is %s and start path is %s", gtk_tree_view_column_get_title (col), string);
+                g_free (string);
+            }
+
+            model = gnc_tree_view_split_reg_get_model_from_view (view);
+
+            /* Step to the next column, we may wrap */
+            gnc_tree_view_keynav (GNC_TREE_VIEW (view), &col, spath, event); // returns path and column
+
+            {
+                gchar *string = gtk_tree_path_to_string (spath);
+                DEBUG("Column title is %s and spath is %s", gtk_tree_view_column_get_title (col), string);
+                g_free (string);
+            }
+
+            // Have we changed transactions
+            next_indices = gtk_tree_path_get_indices (spath);
+            if (start_indices[0] != next_indices[0])
+            {
+                 if (view->priv->dirty_trans != NULL) // from a dirty trans
+                    trans_changed = TRUE;
+
+                 /* Reset allow changes for reconciled transctions */
+                 view->change_allowed = FALSE;
+            }
+
+            // Do the reconcile tests.
+            if (gnc_tree_view_path_is_valid (GNC_TREE_VIEW (view), spath))
+            {
+                if (gtv_sr_recn_tests (view, col, spath))
+                {
+                    gtk_tree_path_free (start_spath);
+                    gtk_tree_path_free (spath);
+                    return TRUE;
+                }
+            }
+
+            // Have we stepped off the end
+            if (!spath || !gnc_tree_view_path_is_valid (GNC_TREE_VIEW (view), spath) || trans_changed) // We have stepped off the end / or changed trans
+            {
+                // Test for transaction changed.
+                if (gtv_sr_transaction_changed (view))
+                {
+                    gtk_tree_path_free (spath);
+                    return TRUE;
+                }
+                step_off = TRUE;
+            }
+            // This stops the cell activation on discard
+            if (view->priv->trans_confirm != DISCARD)
+            {
+                // Set cursor to new column, open for editing
+                gtk_tree_view_set_cursor (GTK_TREE_VIEW (view), spath, col, TRUE);
+            }
+            // Is this an editable cell ?
+            editing = gtv_sr_get_editing (col);
+        }
+        gtk_tree_path_free (start_spath);
+        gtk_tree_path_free (spath);
+        return TRUE;
+        break;
+
+    default:
+        gtk_tree_path_free (spath);
+	return FALSE;
+    }
+}
+
+
+/*###########################################################################*/
+
+/* Callback for selection move */
+static void
+gtv_sr_motion_cb (GtkTreeSelection *sel, gpointer user_data)
+{
+    GncTreeViewSplitReg *view = GNC_TREE_VIEW_SPLIT_REG (user_data);
+    GncTreeModelSplitReg *model;
+    GtkTreePath *mpath, *spath;
+    Split *split = NULL;
+    Transaction *trans = NULL;
+    Transaction *old_trans;
+    gboolean is_trow1, is_trow2, is_split, is_blank;
+    RowDepth depth = 0;
+    GtkTreeIter m_iter;
+    gint *indices;
+
+    model = gnc_tree_view_split_reg_get_model_from_view (view);
+
+    ENTER("View is %p and Model is %p", view, model);
+
+    DEBUG("Current trans %p, Split %p, Depth %d and Dirty Trans %p", view->priv->current_trans, view->priv->current_split,
+                                                                     view->priv->current_depth, view->priv->dirty_trans);
+
+    /* Reset help text */
+    if (view->help_text)
+        g_free (view->help_text);
+    view->help_text = g_strdup (" ");
+    g_signal_emit_by_name (view, "help_signal", NULL);
+
+    if (gtv_sr_get_model_iter_from_selection (view, sel, &m_iter))
+    {
+        gchar *mstring, *sstring;
+
+        mpath = gtk_tree_model_get_path (GTK_TREE_MODEL (model), &m_iter);
+        spath = gnc_tree_view_split_reg_get_sort_path_from_model_path (view, mpath);
+
+        mstring = gtk_tree_path_to_string (mpath);
+        sstring = gtk_tree_path_to_string (spath);
+        DEBUG("Valid Selection - mpath is %s, spath is %s", mstring, sstring);
+        g_free (mstring);
+        g_free (sstring);
+
+        /* save the current path */
+        gnc_tree_view_split_reg_set_current_path (view, mpath);
+
+        /* Use depth to determine if it is a split or transaction */
+        depth = gtk_tree_path_get_depth (mpath);
+
+        gtk_tree_path_free (mpath);
+
+        gnc_tree_model_split_reg_get_split_and_trans (
+                GNC_TREE_MODEL_SPLIT_REG (model), &m_iter, &is_trow1, &is_trow2, &is_split, &is_blank, &split, &trans);
+
+        DEBUG("Get model trans %p, split %p, is_split %d, is_blank %d\n", trans, split, is_split, is_blank);
+
+        /* Update the titles if depth changes, we change rows */
+        if (depth != view->priv->current_depth)
+            gtv_sr_titles (view, depth);
+
+        /* Move the blank split */ 
+        gnc_tree_model_split_reg_set_blank_split_parent (model, trans, FALSE);
+
+        /* Save trans / split / depth to the current values */
+        old_trans = view->priv->current_trans;
+        view->priv->current_trans = trans;
+        view->priv->current_split = split;
+        view->priv->current_depth = depth;
+
+        DEBUG("Current trans %p, split %p, depth %d and old_trans %p", view->priv->current_trans, view->priv->current_split,
+                                                                     view->priv->current_depth, old_trans);
+
+        /* Save trans and current row to model */
+        model->current_trans = trans;
+        indices = gtk_tree_path_get_indices (spath);
+        model->current_row = indices[0];
+        gnc_tree_model_split_reg_sync_scrollbar (model);
+
+        /* Test for change of transaction and old transaction equals a dirty transaction */
+        if ((trans != old_trans) && (old_trans == view->priv->dirty_trans))
+        {
+            if (gtv_sr_transaction_changed (view))
+            {
+                gtk_tree_path_free (spath);
+                LEAVE("Leave Transaction Changed");
+                return;
+            }
+        }
+        if (view->priv->trans_confirm == CANCEL)
+        {
+            gtk_tree_path_free (spath);
+            LEAVE("Leave Transaction Changed - Cancel");
+            return;
+        }
+
+        /* Auto expand transaction and collapse previous transaction */
+        if (old_trans != trans)
+        {
+            if (model->style != REG2_STYLE_JOURNAL)
+            {
+                gnc_tree_view_split_reg_block_selection (view, TRUE);
+
+                if (gnc_tree_view_split_reg_trans_expanded (view, old_trans))
+                    gnc_tree_view_split_reg_collapse_trans (view, old_trans);
+
+                gnc_tree_view_split_reg_block_selection (view, FALSE);
+            }
+            else
+                gnc_tree_view_split_reg_expand_trans (view, NULL);
+
+            if (model->style == REG2_STYLE_AUTO_LEDGER)
+            {
+                gtk_tree_view_expand_row (GTK_TREE_VIEW (view), spath, TRUE);
+
+                view->priv->expanded = TRUE;
+
+                if (view->priv->selection_to_blank_on_expand)
+                    gtv_sr_selection_to_blank (view);
+            }
+        }
+        gtk_tree_path_free (spath);
+
+        // Check to see if current trans is expanded and remember
+        if (gnc_tree_view_split_reg_trans_expanded (view, trans))
+            view->priv->expanded = TRUE;
+        else
+            view->priv->expanded = FALSE;
+    }
+    else
+    {
+        DEBUG("Not Valid Selection");
+        /* We do not have a valid iter */
+        gtv_sr_titles (view, 0);
+
+        /* Move the blank split to the last transaction */ 
+        gnc_tree_model_split_reg_set_blank_split_parent (model, NULL, FALSE);
+
+        /* Set the default selection start position */
+        gnc_tree_view_split_reg_default_selection (view);
+    }
+
+    /* This updates the plugin page gui */
+    gnc_tree_view_split_reg_call_uiupdate_cb (view);
+
+    LEAVE(" ");
+}
+
+/*###########################################################################*/
+
+/* Connected to "edited" from cellrenderer. For reference, see
+   split-register-model-save.c */
+static void
+gtv_sr_edited_cb (GtkCellRendererText *cell, const gchar *path_string,
+               const gchar *new_text, gpointer user_data)
+{
+    GncTreeViewSplitReg  *view = GNC_TREE_VIEW_SPLIT_REG (user_data);
+    GncTreeModelSplitReg *model;
+    GtkCellEditable      *editable;
+
+    editable = g_object_get_data (G_OBJECT (cell), "cell-editable");
+
+    DEBUG("cell is %p editable pointer is %p and id %lu", cell, editable, view->priv->fo_handler_id);
+
+    /* Remove the focus out cb if one exists */
+    if (view->priv->fo_handler_id != 0)
+    {
+        if (g_signal_handler_is_connected (G_OBJECT (editable), view->priv->fo_handler_id))
+            g_signal_handler_disconnect (G_OBJECT (editable), view->priv->fo_handler_id);
+    }
+    view->priv->fo_handler_id = 0;
+
+    /* Make sure we set focus to the tree view after cell editing */
+    gtk_widget_grab_focus (GTK_WIDGET (view));
+
+    if (g_strcmp0 (g_object_get_data (G_OBJECT (cell), "current-string"), new_text) == 0) // No change, return
+    {
+        if (view->priv->stop_cell_move == FALSE)
+            return;
+    }
+
+    model = gnc_tree_view_split_reg_get_model_from_view (view);
+    g_return_if_fail (model);
+
+    /* Are we using a template or not */
+    if (!gnc_tree_model_split_reg_get_template (model))
+        gtv_sr_edited_normal_cb (cell, path_string, new_text, view);
+    else
+        gtv_sr_edited_template_cb (cell, path_string, new_text, view);
+}
+
+
+/* This is used for the normal registers */
+static void
+gtv_sr_edited_normal_cb (GtkCellRendererText *cell, const gchar *path_string,
+               const gchar *new_text, gpointer user_data)
+{
+    GncTreeViewSplitReg  *view = GNC_TREE_VIEW_SPLIT_REG (user_data);
+    GncTreeModelSplitReg *model;
+    GtkCellEditable      *editable;
+    GtkTreeIter           m_iter;
+    Split                *split;
+    Transaction          *trans;
+    gboolean              is_trow1, is_trow2, is_split, is_blank;
+    ViewCol               viewcol;
+    char                 *error_loc = NULL;
+    Account              *anchor = view->priv->anchor;
+
+    editable = g_object_get_data (G_OBJECT (cell), "cell-editable");
+
+    DEBUG("cell is %p editable pointer is %p", cell, editable);
+
+    g_return_if_fail (gtv_sr_get_model_iter_from_view_string (view, path_string, &m_iter));
+
+    viewcol = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (cell), "view_column"));
+
+    model = gnc_tree_view_split_reg_get_model_from_view (view);
+    g_return_if_fail (model);
+
+    gnc_tree_model_split_reg_get_split_and_trans (
+        model, &m_iter, &is_trow1, &is_trow2, &is_split, &is_blank, &split, &trans);
+
+    switch (viewcol) {
+    case COL_DATE:
+        /* Column is DATE */
+        if (is_trow1)
+        {
+            GDate parsed_date;
+            gnc_tree_util_split_reg_parse_date (&parsed_date, new_text);
+            if (g_date_valid (&parsed_date))
+            {
+                gtv_sr_begin_edit (view, trans);
+                xaccTransSetDate (trans, g_date_get_day (&parsed_date), g_date_get_month (&parsed_date), g_date_get_year (&parsed_date));
+            }
+            else
+            {
+                // We should never get here
+                PERR("invalid date '%s'", new_text);
+            }
+        }
+        break;
+
+    case COL_NUMACT:
+        /* Column is NUM / ACT */
+        gtv_sr_begin_edit (view, trans);
+        if (is_trow1)
+        {
+            /* set per book option */
+            gnc_set_num_action (trans, gtv_sr_get_this_split (view, trans),
+                                                                new_text, NULL);
+
+            if (!qof_book_use_split_action_for_num_field (gnc_get_current_book()))
+            {
+                // Set the last number value for this account.
+                if (gnc_strisnum (new_text) && anchor != NULL)
+                    xaccAccountSetLastNum (anchor, new_text);
+            }
+        }
+        if (is_trow2)
+        {
+            /* set per book option */
+            gnc_set_num_action (trans, gtv_sr_get_this_split (view, trans),
+                                                                NULL, new_text);
+
+            if (qof_book_use_split_action_for_num_field (gnc_get_current_book()))
+            {
+                // Set the last number value for this account.
+                if (gnc_strisnum (new_text) && anchor != NULL)
+                    xaccAccountSetLastNum (anchor, new_text);
+            }
+        }
+        if (is_split)
+        {
+            /* Set split-action with gnc_set_num_action which is the same as
+             * xaccSplitSetAction with these arguments */
+            gnc_set_num_action (NULL, split, NULL, new_text);
+        }
+        break;
+
+    case COL_DESCNOTES:
+        /* Column is DESCRIPTION / NOTES / MEMO */
+        gtv_sr_begin_edit (view, trans);
+        if (is_trow1)
+        {
+            xaccTransSetDescription (trans, new_text);
+            // This will potentially fill in the rest of the transaction.
+            if (view->priv->auto_complete == FALSE)
+            {
+                gnc_tree_control_auto_complete (view, trans, new_text);
+                view->priv->auto_complete = TRUE;
+            }
+        }
+        if (is_trow2)
+            xaccTransSetNotes (trans, new_text);
+
+        if (is_split)
+            xaccSplitSetMemo (split, new_text);
+
+        break;
+
+    case COL_RECN:
+        /* Column is RECONCILE */
+        gtv_sr_begin_edit (view, trans);
+        {
+            char rec = 'n';
+
+            if (new_text != NULL)
+            {
+                const gchar *cflag = gnc_get_reconcile_str (CREC);
+                const gchar *nflag = gnc_get_reconcile_str (NREC);
+                const char recn_flags[] = {NREC, CREC, 0}; // List of reconciled flags
+                const gchar *flags;
+                gchar *this_flag;
+                gint index = 0;
+
+                flags = g_strconcat (nflag, cflag, NULL); // List of translated strings.
+
+                /* Find the current flag in the list of flags */
+                this_flag = strstr (flags, new_text);
+
+                if (this_flag != NULL)
+                {
+                    index = this_flag - flags;
+                    rec = recn_flags[index];
+                }
+            }
+            if (is_trow1) 
+                xaccSplitSetReconcile (gtv_sr_get_this_split (view, trans), rec);
+            if (is_split)
+                xaccSplitSetReconcile (split, rec);
+        }
+        break;
+
+    case COL_TYPE:
+        /* Column is TYPE */
+        gtv_sr_begin_edit (view, trans);
+        {
+            char type = TXN_TYPE_NONE;
+            if (new_text != NULL)
+                type = new_text[0];
+
+            if (is_trow1)
+                xaccTransSetTxnType (trans, type);
+        }
+        break;
+
+    case COL_TRANSFERVOID:
+    case COL_AMTVAL:
+    case COL_AMOUNT:
+    case COL_PRICE:
+    case COL_DEBIT:
+    case COL_CREDIT:
+        {
+            Account       *acct, *old_acct;
+            gnc_numeric    input;
+            Split         *osplit = NULL;
+            gboolean       valid_input = FALSE;
+            gboolean       force = FALSE;
+            gboolean       input_used = FALSE;
+
+            gtv_sr_begin_edit (view, trans);
+
+            /* Get the split pair if anchored to a register */
+            if (!is_split && anchor)
+            {
+                if (!gtv_sr_get_split_pair (view, trans, &osplit, &split))
+                {
+                    DEBUG("couldn't get split pair");
+                    break;
+                }
+            }
+
+            /* Setup the account field */
+            if (viewcol == COL_TRANSFERVOID)
+            {
+                view->priv->stop_cell_move = FALSE;
+                acct = gnc_tree_control_split_reg_get_account_by_name (view, new_text);
+                if (acct == NULL)
+                {
+                    DEBUG("Account is NULL");
+                    xaccSplitReinit(split);
+                    if (osplit)
+                        xaccSplitDestroy (osplit);
+
+                    g_free (view->priv->transfer_string);
+                    view->priv->transfer_string = g_strdup (new_text);
+                    view->priv->stop_cell_move = TRUE;
+
+                    /* this will populate cell with original value */
+                    g_idle_add ((GSourceFunc) gtv_sr_idle_transfer, view);
+                    break;
+                }
+
+                if (acct != NULL && is_split)
+                {
+                    old_acct = xaccSplitGetAccount (split);
+                    xaccSplitSetAccount (split, acct);
+                    if (!gnc_commodity_equiv (xaccAccountGetCommodity (old_acct), xaccAccountGetCommodity (acct)))
+                        force = TRUE;
+                }
+                else
+                {
+                    old_acct = xaccSplitGetAccount (osplit);
+                    xaccSplitSetAccount (osplit, acct);
+                    if (!gnc_commodity_equiv (xaccAccountGetCommodity (old_acct), xaccAccountGetCommodity (acct)))
+                        force = TRUE;
+                }
+            }
+            else
+            {
+                if (!gnc_exp_parser_parse (new_text, &input, &error_loc))
+                    break;
+                else
+                    valid_input = TRUE;
+            }
+
+            /* Get the account for this split */
+            acct = xaccSplitGetAccount (split);
+            if (!acct)
+            {
+                if (anchor)
+                {
+                    xaccSplitSetAccount (split, anchor);
+                    acct = xaccSplitGetAccount (split);
+                }
+                else
+                {
+                    break; //Well, what else is there to do?
+                }
+            }
+
+            /* Set the transaction currency if not set */
+            if (!xaccTransGetCurrency (trans))
+            {
+                // set transaction currency to that of register (which is guaranteed to be a currency)
+                xaccTransSetCurrency (trans, view->priv->reg_currency);
+
+                // We are on General ledger
+                if (!anchor)
+                {
+                    xaccTransSetCurrency (trans, gnc_account_or_default_currency (xaccSplitGetAccount (split), NULL));
+                }
+            }
+
+            // No need to check for a non-currency register because that's what
+            // was already checked when reg_currency was stored.
+
+            /* This computes the value if we just commit the split after entering account */
+            if (!valid_input)
+                input = gnc_tree_util_split_reg_get_value_for (view, trans, split, is_blank);
+
+            // Negate the input if COL_CREDIT
+            if (viewcol == COL_CREDIT)
+                input = gnc_numeric_neg (input);
+
+            // Set the split parent trans
+            xaccSplitSetParent (split, trans);
+
+            // If we are at trasaction level, column is value, split level is amount
+            if (viewcol == COL_AMTVAL)
+            {
+                gnc_tree_util_set_number_for_input (view, trans, split, input, COL_AMTVAL);
+                input_used = TRUE;
+            }
+
+            // The price of stock / shares, editable only when expanded and sub_account
+            if (viewcol == COL_AMOUNT)
+            {
+                gnc_tree_util_set_number_for_input (view, trans, split, input, COL_AMTVAL);
+                input_used = TRUE;
+            }
+
+            // The price of stock / shares
+            if (viewcol == COL_PRICE)
+            {
+                gnc_tree_util_set_number_for_input (view, trans, split, input, COL_PRICE);
+                input_used = TRUE;
+            }
+
+            // Check if this is a stock / share amount
+            if (viewcol == COL_CREDIT || viewcol == COL_DEBIT)
+            {
+                if (!gnc_commodity_is_currency (xaccAccountGetCommodity (acct)))
+                {
+                    gnc_tree_util_set_number_for_input (view, trans, split, input, viewcol);
+                    input_used = TRUE;
+                }
+            }
+
+            // This is used in transaction mode, two splits
+            if (input_used == FALSE)
+            {
+                if (gnc_commodity_is_currency (xaccAccountGetCommodity (acct)))
+                    gnc_tree_util_split_reg_set_value_for (view, trans, split, input, force);
+                else
+                    gnc_tree_util_set_value_for_amount (view, trans, split, input);
+            }
+
+            // If this is the blank split, promote it.
+            if (is_blank)
+            {
+                /*FIXME May be this should be a signal - Promote the blank split to a real split */
+                g_idle_add ((GSourceFunc) gnc_tree_model_split_reg_commit_blank_split, gnc_tree_view_split_reg_get_model_from_view (view));
+
+                /* scroll when view idle */
+                g_idle_add ((GSourceFunc) gnc_tree_view_split_reg_scroll_to_cell, view);
+            }
+
+            // In transaction mode, two splits only, set up the other split.
+            if (osplit)
+            {
+                xaccSplitSetParent (osplit, trans);
+
+                if (gnc_commodity_is_currency (xaccAccountGetCommodity (acct)))
+                    gnc_tree_util_split_reg_set_value_for (view, trans, osplit, gnc_numeric_neg (input), force);
+                else
+                    gnc_tree_util_set_value_for_amount (view, trans, osplit, gnc_numeric_neg (xaccSplitGetValue (split)));
+            }
+        }
+        break;
+
+    default:
+        //g_assert_not_reached();
+        break;
+    }
+}
+
+
+/* This is used for the template registers */
+static void
+gtv_sr_edited_template_cb (GtkCellRendererText *cell, const gchar *path_string,
+               const gchar *new_text, gpointer user_data)
+{
+    GncTreeViewSplitReg  *view = GNC_TREE_VIEW_SPLIT_REG (user_data);
+    GncTreeModelSplitReg *model;
+    GtkCellEditable      *editable;
+    GtkTreeIter           m_iter;
+    Split                *split;
+    Transaction          *trans;
+    gboolean              is_trow1, is_trow2, is_split, is_blank;
+    ViewCol               viewcol;
+    Account              *anchor = view->priv->anchor;
+
+    editable = g_object_get_data (G_OBJECT (cell), "cell-editable");
+
+    DEBUG("cell is %p editable pointer is %p", cell, editable);
+
+    g_return_if_fail (gtv_sr_get_model_iter_from_view_string (view, path_string, &m_iter));
+
+    viewcol = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (cell), "view_column"));
+
+    model = gnc_tree_view_split_reg_get_model_from_view (view);
+    g_return_if_fail (model);
+
+    gnc_tree_model_split_reg_get_split_and_trans (
+        model, &m_iter, &is_trow1, &is_trow2, &is_split, &is_blank, &split, &trans);
+
+    switch (viewcol) {
+    case COL_NUMACT:
+        /* Column is NUM / ACT */
+        gtv_sr_begin_edit (view, trans);
+        if (is_trow1)
+        {
+            /* set per book option */
+            gnc_set_num_action (trans, gtv_sr_get_this_split (view, trans),
+                                                                new_text, NULL);
+
+            if (!qof_book_use_split_action_for_num_field (gnc_get_current_book()))
+            {
+                // Set the last number value for this account.
+                if (gnc_strisnum (new_text) && anchor != NULL)
+                    xaccAccountSetLastNum (anchor, new_text);
+            }
+        }
+        if (is_trow2)
+        {
+            /* set per book option */
+            gnc_set_num_action (trans, gtv_sr_get_this_split (view, trans),
+                                                                NULL, new_text);
+
+            if (qof_book_use_split_action_for_num_field (gnc_get_current_book()))
+            {
+                // Set the last number value for this account.
+                if (gnc_strisnum (new_text) && anchor != NULL)
+                    xaccAccountSetLastNum (anchor, new_text);
+            }
+        }
+        if (is_split)
+        {
+            /* Set split-action with gnc_set_num_action which is the same as
+             * xaccSplitSetAction with these arguments */
+            gnc_set_num_action (NULL, split, NULL, new_text);
+        }
+        break;
+
+    case COL_DESCNOTES:
+        /* Column is DESCRIPTION / NOTES / MEMO */
+        gtv_sr_begin_edit (view, trans);
+        if (is_trow1)
+        {
+            xaccTransSetDescription (trans, new_text);
+            // This will potentially fill in the rest of the transaction.
+            if (view->priv->auto_complete == FALSE)
+            {
+                gnc_tree_control_auto_complete (view, trans, new_text);
+                view->priv->auto_complete = TRUE;
+            }
+        }
+        if (is_trow2)
+            xaccTransSetNotes (trans, new_text);
+
+        if (is_split)
+            xaccSplitSetMemo (split, new_text);
+
+        break;
+
+    case COL_RECN:
+        /* Column is RECONCILE */
+        gtv_sr_begin_edit (view, trans);
+        {
+            char rec = 'n';
+
+            if (new_text != NULL)
+            {
+                const gchar *cflag = gnc_get_reconcile_str (CREC);
+                const gchar *nflag = gnc_get_reconcile_str (NREC);
+                const char recn_flags[] = {NREC, CREC, 0}; // List of reconciled flags
+                const gchar *flags;
+                gchar *this_flag;
+                gint index = 0;
+
+                flags = g_strconcat (nflag, cflag, NULL); // List of translated strings.
+
+                /* Find the current flag in the list of flags */
+                this_flag = strstr (flags, new_text);
+
+                if (this_flag != NULL)
+                {
+                    index = this_flag - flags;
+                    rec = recn_flags[index];
+                }
+            }
+            if (is_trow1)
+                xaccSplitSetReconcile (gtv_sr_get_this_split (view, trans), rec);
+            if (is_split)
+                xaccSplitSetReconcile (split, rec);
+        }
+        break;
+
+    case COL_TRANSFERVOID:
+    case COL_DEBIT:
+    case COL_CREDIT:
+        {
+            gtv_sr_begin_edit (view, trans);
+
+            /* Setup the account field */
+            if (viewcol == COL_TRANSFERVOID)
+            {
+                Account *template_acc;
+		Account *acct;
+                const GncGUID *acctGUID;
+
+                /* save the account GncGUID into the kvp_data. */
+                view->priv->stop_cell_move = FALSE;
+                acct = gnc_tree_control_split_reg_get_account_by_name (view, new_text);
+                if (acct == NULL)
+                {
+                    DEBUG("Template Account is NULL");
+
+                    g_free (view->priv->transfer_string);
+                    view->priv->transfer_string = g_strdup (new_text);
+                    view->priv->stop_cell_move = TRUE;
+
+                    /* this will populate cell with original value */
+                    g_idle_add ((GSourceFunc) gtv_sr_idle_transfer, view);
+                    break;
+                }
+
+                acctGUID = xaccAccountGetGUID (acct);
+		qof_instance_set (QOF_INSTANCE (split),
+				  "sx-account", acctGUID,
+				  NULL);
+
+                template_acc = gnc_tree_model_split_reg_get_template_account (model);
+
+                /* set the actual account to the fake account for these templates */
+                xaccAccountInsertSplit (template_acc, split);
+            }
+
+            /* Set the transaction currency if not set */
+            if (!xaccTransGetCurrency (trans))
+            {
+                xaccTransSetCurrency (trans, gnc_account_or_default_currency (xaccSplitGetAccount (split), NULL));
+            }
+
+            // No need to check for a non-currency register because that's what
+            // was already checked when reg_currency was stored.
+
+            /* Setup the debit and credit fields */
+            if (viewcol == COL_DEBIT)
+            {
+                char *error_loc;
+                gnc_numeric new_value;
+                gboolean parse_result;
+
+                /* Setup the debit formula */
+
+                /* If the value can be parsed into a numeric result, store that
+                 * numeric value additionally. See above comment.*/
+                parse_result = gnc_exp_parser_parse_separate_vars (new_text, &new_value, &error_loc, NULL);
+                if (!parse_result)
+                {
+                    new_value = gnc_numeric_zero();
+                }
+		qof_instance_set (QOF_INSTANCE (split),
+				  "sx-debit-formula", new_text,
+				  "sx-debit-numeric", &new_value,
+				  "sx-credit-formula", NULL,
+				  "sx-credit-numeric", NULL,
+				  NULL);
+            }
+
+            /* Setup the debit and credit fields */
+            if (viewcol == COL_CREDIT)
+            {
+                char *error_loc;
+                gnc_numeric new_value;
+                gboolean parse_result;
+
+               /* If the value can be parsed into a numeric result (without any
+                 * further variable definitions), store that numeric value
+                 * additionally in the kvp. Otherwise store a zero numeric
+                 * there.*/
+                parse_result = gnc_exp_parser_parse_separate_vars (new_text, &new_value, &error_loc, NULL);
+                if (!parse_result)
+                {
+                    new_value = gnc_numeric_zero();
+                }
+		qof_instance_set (QOF_INSTANCE (split),
+				  "sx-credit-formula", new_text,
+				  "sx-credit-numeric", &new_value,
+				  "sx-debit-formula", NULL,
+				  "sx-debit-numeric", NULL,
+				  NULL);
+            }
+            /* set the amount to an innocuous value */
+            xaccSplitSetValue (split, gnc_numeric_create (0, 1));
+
+            // Set the split parent trans
+            xaccSplitSetParent (split, trans);
+
+            // If this is the blank split, promote it.
+            if (is_blank)
+            {
+                /*FIXME May be this should be a signal - Promote the blank split to a real split */
+                g_idle_add ((GSourceFunc) gnc_tree_model_split_reg_commit_blank_split, gnc_tree_view_split_reg_get_model_from_view (view));
+
+                /* scroll when view idle */
+                g_idle_add ((GSourceFunc) gnc_tree_view_split_reg_scroll_to_cell, view);
+            }
+        }
+        break;
+
+    default:
+        //g_assert_not_reached();
+        break;
+    }
+}
+
+/*###########################################################################*/
+
+/* Parses the string value and returns true if it is a
+ * number. In that case, *num is set to the value parsed. */
+static gboolean
+gtv_sr_parse_num (const char *string, long int *num)
+{
+    long int number;
+
+    if (string == NULL)
+        return FALSE;
+
+    if (!gnc_strisnum (string))
+        return FALSE;
+
+    number = strtol (string, NULL, 10);
+
+    if ((number == LONG_MIN) || (number == LONG_MAX))
+        return FALSE;
+
+    if (num != NULL)
+        *num = number;
+
+    return TRUE;
+}
+
+/* Callback for Number Accelerator key */
+static void
+gtv_sr_num_cb (GtkEntry    *entry,
+                          const gchar *text,
+                          gint         length,
+                          gint        *position,
+                          gpointer     user_data)
+{
+    GtkEditable *editable = GTK_EDITABLE (entry);
+    GncTreeViewSplitReg *view = GNC_TREE_VIEW_SPLIT_REG (user_data);
+    GncTreeModelSplitReg *model;
+    RowDepth depth;
+    Account *account;
+    gchar *entered_string;
+    gchar *leave_string = NULL;
+
+    gboolean accel = FALSE;
+    gboolean is_num;
+    long int number = 0;
+    gunichar uc;
+
+    model = gnc_tree_view_split_reg_get_model_from_view (view);
+
+    account = gnc_tree_model_split_reg_get_anchor (model);
+
+    depth = gnc_tree_view_reg_get_selected_row_depth (view);
+
+    // This only works on the number field.
+    if ((depth == TRANS2 || depth == SPLIT3))
+        return;
+
+    // Get entered string
+    entered_string = gtk_editable_get_chars (editable, 0, -1);
+
+    // Test for number and return it.
+    is_num = gtv_sr_parse_num (entered_string, &number);
+
+    if (is_num && (number < 0))
+        is_num = FALSE;
+
+    // Test for accelerator keys.
+    uc = g_utf8_get_char (text);
+    switch (uc)
+    {
+    case '+':
+    case '=':
+        number++;
+        accel = TRUE;
+        break;
+
+    case '_':
+    case '-':
+        number--;
+        accel = TRUE;
+        break;
+
+    case '}':
+    case ']':
+        number += 10;
+        accel = TRUE;
+        break;
+
+    case '{':
+    case '[':
+        number -= 10;
+        accel = TRUE;
+        break;
+    }
+
+    if (number < 0)
+        number = 0;
+
+    /* If there is already a non-number there, don't accelerate. */
+    if (accel && !is_num && (g_strcmp0 (entered_string, "") != 0))
+        accel = FALSE;
+
+    // See if entered string is empty, try and get the last number.
+    if (accel && (g_strcmp0 (entered_string, "") == 0))
+    {
+        if (account != NULL)
+        {
+            if (gtv_sr_parse_num (xaccAccountGetLastNum (account), &number))
+                number = number + 1;
+            else
+                number = 1;
+        }
+        else
+            number = 1;
+
+        is_num = TRUE;
+    }
+
+    if (!accel)
+    {
+        leave_string = g_strconcat (entered_string, text, NULL);
+    }
+
+    if (accel && is_num)
+    {
+        char buff[128];
+
+        strcpy (buff, "");
+        snprintf (buff, sizeof(buff), "%ld", number);
+
+        if (g_strcmp0 (buff, "") == 0)
+            leave_string = "";
+        else
+            leave_string = g_strdup (buff);
+    }
+
+    g_signal_handlers_block_by_func (editable, (gpointer) gtv_sr_num_cb, user_data);
+
+    gtk_editable_delete_text (editable, 0, -1);
+    gtk_editable_set_position (editable, 0);
+
+    if (leave_string != NULL)
+        gtk_editable_insert_text (editable, leave_string, -1, position);
+
+    g_signal_handlers_unblock_by_func (editable, (gpointer) gtv_sr_num_cb, user_data);
+
+    g_signal_stop_emission_by_name (editable, "insert_text");
+
+    if (leave_string)
+        g_free (leave_string);
+
+    g_free (entered_string);
+}
+
+
+/* Callback for Account separator key */
+static void
+gtv_sr_acct_cb (GtkEntry    *entry,
+                          const gchar *text,
+                          gint         length,
+                          gint        *position,
+                          gpointer     user_data)
+{
+    GtkEditable *editable = GTK_EDITABLE (entry);
+    GncTreeViewSplitReg *view = GNC_TREE_VIEW_SPLIT_REG (user_data);
+    GtkEntryCompletion *completion;
+    GtkTreeModel *model;
+    GtkTreeIter  iter;
+
+    const gchar *sep_char;
+    gchar       *entered_string;
+    gchar       *acct_string = NULL;
+
+    gint         num_of_items = 0;
+    gboolean     valid;
+    gboolean     all_the_same = TRUE;
+
+    sep_char = gnc_get_account_separator_string ();
+
+    if (g_strcmp0 (text, sep_char) == 0)
+        entered_string = g_strconcat (gtk_editable_get_chars (editable, 0, -1), NULL);
+    else
+        entered_string = g_strconcat (gtk_editable_get_chars (editable, 0, -1), text, NULL);
+
+    // Get the completion and model
+    completion = gtk_entry_get_completion (entry);
+    model = gtk_entry_completion_get_model (completion);
+
+    // Get the first item in the list
+    valid = gtk_tree_model_get_iter_first (model, &iter);
+    while (valid)
+    {
+        gchar *item, *item_string, *l_item, *l_entered_string, *l_acct_string;
+
+        // Walk through the list, reading each row
+        if (view->priv->acct_short_names)
+            gtk_tree_model_get (model, &iter, 0, &item, -1);
+        else
+            gtk_tree_model_get (model, &iter, 1, &item, -1);
+
+        item_string = g_strconcat (item, sep_char, NULL);
+
+        l_item = g_utf8_strdown (item_string, -1);
+        l_entered_string = g_utf8_strdown (entered_string, -1);
+
+        if (g_str_has_prefix (l_item, l_entered_string))
+        {
+            if (num_of_items == 0)
+                acct_string = g_strdup (item);
+            else
+            {
+                l_acct_string = g_utf8_strdown (acct_string, -1);
+                if (!g_str_has_prefix (g_utf8_strdown (l_item, -1), l_acct_string))
+                    all_the_same = FALSE;
+                g_free (l_acct_string);
+            }
+            num_of_items = num_of_items + 1;
+        }
+        g_free (item);
+        g_free (item_string);
+        g_free (l_item);
+        g_free (l_entered_string);
+        valid = gtk_tree_model_iter_next (model, &iter);
+    }
+
+    g_signal_handlers_block_by_func (editable, (gpointer) gtv_sr_acct_cb, user_data);
+
+    gtk_editable_delete_text (editable, 0, -1);
+    gtk_editable_set_position (editable, 0);
+
+    if (num_of_items == 0)
+        gtk_editable_insert_text (editable, entered_string, -1, position);
+    else
+    {
+        if (num_of_items == 1)
+            gtk_editable_insert_text (editable, acct_string, -1, position);
+        else
+        {
+            if (all_the_same)
+            {
+                if (g_strcmp0 (text, sep_char) == 0)
+                    gtk_editable_insert_text (editable, g_strconcat (acct_string, sep_char, NULL), -1, position);
+                else
+                    gtk_editable_insert_text (editable, entered_string, -1, position);
+            }
+            else
+               gtk_editable_insert_text (editable, entered_string, -1, position);
+        }
+    }
+    g_signal_handlers_unblock_by_func (editable, (gpointer) gtv_sr_acct_cb, user_data);
+
+    g_signal_stop_emission_by_name (editable, "insert_text");
+    g_free (acct_string);
+    g_free (entered_string);
+}
+
+
+/* Callback for changing reconcile setting with space bar */
+static void
+gtv_sr_recn_cb (GtkEntry    *entry,
+                          const gchar *text,
+                          gint         length,
+                          gint        *position,
+                          gpointer     user_data)
+{
+    GtkEditable *editable = GTK_EDITABLE (entry);
+    GncTreeViewSplitReg *view = GNC_TREE_VIEW_SPLIT_REG (user_data);
+
+    const gchar *cflag = gnc_get_reconcile_str (CREC);
+    const gchar *nflag = gnc_get_reconcile_str (NREC);
+
+    const gchar *flags;
+    gchar *this_flag;
+    gchar *result;
+    static char ss[2];
+    gint index = 0;
+
+    result = g_ascii_strdown (text, length);
+
+    if (g_object_get_data (G_OBJECT (view->priv->temp_cr), "current-flag") != NULL)
+        index = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (view->priv->temp_cr), "current-flag"));
+    else
+    {
+        if (g_strcmp0 (g_object_get_data (G_OBJECT (view->priv->temp_cr), "current-string"), nflag) == 0)
+            index = 0;
+    }
+
+    flags = g_strconcat (nflag, cflag, NULL);
+
+    /* So we can test for space */
+    ss[0] = ' ';
+    ss[1] = '\0';
+
+    /* Find the entered text in the list of flags */
+    this_flag = strstr (flags, text);
+
+    if (this_flag == NULL || *this_flag == '\0')
+    {
+        if (g_strcmp0 (text, ss) == 0)  // test for space
+        {
+            /* In the list, choose the next item in the list
+               (wrapping around as necessary). */
+
+            if (flags[index + 1] != '\0')
+                index = index + 1;
+            else
+                index = 0;
+
+            g_free (result);
+            result = g_strdup_printf("%c", flags[index]);
+        }
+        else
+        {
+            /* If it's not there (or the list is empty) use default_flag */
+            g_free (result);
+            result = g_strdup (gnc_get_reconcile_str (NREC));
+        }
+    }
+    else
+    {
+        g_free (result);
+        result = g_strdup (text);
+    }
+
+    /* save the index in the cellrenderer */
+    g_object_set_data (G_OBJECT (view->priv->temp_cr), "current-flag", GINT_TO_POINTER (index));
+
+    g_signal_handlers_block_by_func (editable, (gpointer) gtv_sr_recn_cb, user_data);
+
+    gtk_editable_delete_text (editable, 0, -1);
+    gtk_editable_insert_text (editable, result, length, position);
+
+    g_signal_handlers_unblock_by_func (editable, (gpointer) gtv_sr_recn_cb, user_data);
+
+    g_signal_stop_emission_by_name (editable, "insert_text");
+
+    g_free (result);
+}
+
+
+/* Callback for changing type setting with space bar */
+static void
+gtv_sr_type_cb (GtkEntry    *entry,
+                          const gchar *text,
+                          gint         length,
+                          gint        *position,
+                          gpointer     user_data)
+{
+    GtkEditable *editable = GTK_EDITABLE (entry);
+    GncTreeViewSplitReg *view = GNC_TREE_VIEW_SPLIT_REG (user_data);
+    const gchar *flags;
+    const char type_flags[] = {TXN_TYPE_INVOICE, TXN_TYPE_PAYMENT, 0};
+    gchar *this_flag;
+    gchar *result;
+    static char ss[2];
+    gint index = 0;
+
+    flags = type_flags;
+
+    result = g_ascii_strup (text, length);
+
+    if (g_object_get_data (G_OBJECT (view->priv->temp_cr), "current-flag") != NULL)
+        index = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (view->priv->temp_cr), "current-flag"));
+    else
+    {
+        if (g_strcmp0 (g_object_get_data (G_OBJECT (view->priv->temp_cr), "current-string"), "I") == 0)
+            index = 0;
+    }
+
+    /* So we can test for space */
+    ss[0] = ' ';
+    ss[1] = '\0';
+
+    /* Find the entered text in the list of flags */
+    this_flag = strstr (flags, text);
+
+    if (this_flag == NULL || *this_flag == '\0')
+    {
+        if (g_strcmp0 (text, ss) == 0)  // test for space
+        {
+            /* In the list, choose the next item in the list
+               (wrapping around as necessary). */
+
+            if (flags[index + 1] != '\0')
+                index = index + 1;
+            else
+                index = 0;
+
+            g_free (result);
+            result = g_strdup_printf("%c", flags[index]);
+        }
+        else
+        {
+            /* If it's not there (or the list is empty) use default_flag */
+            g_free (result);
+            result  = NULL;
+        }
+    }
+    else
+    {
+        g_free (result);
+        result = g_strdup (text);
+    }
+
+    /* save the index in the cellrenderer */
+    g_object_set_data (G_OBJECT (view->priv->temp_cr), "current-flag", GINT_TO_POINTER (index));
+
+    g_signal_handlers_block_by_func (editable, (gpointer) gtv_sr_type_cb, user_data);
+
+    gtk_editable_delete_text (editable, 0, -1);
+    gtk_editable_insert_text (editable, result, length, position);
+
+    g_signal_handlers_unblock_by_func (editable, (gpointer) gtv_sr_type_cb, user_data);
+
+    g_signal_stop_emission_by_name (editable, "insert_text");
+
+    g_free (result);
+}
+
+
+/* For handling keynav */
+static gboolean
+gtv_sr_ed_key_press_cb (GtkWidget *widget, GdkEventKey *event, gpointer user_data)
+{
+    GncTreeViewSplitReg *view = GNC_TREE_VIEW_SPLIT_REG (user_data);
+    GncTreeModelSplitReg *model;
+    GtkTreeViewColumn *col;
+    GtkTreePath *spath;
+    gboolean goto_blank = FALSE;
+    gboolean next_trans = TRUE;
+    Transaction *btrans, *ctrans;
+    gint depth;
+    gboolean auto_popped = FALSE;
+
+    // spath is where we are, before key press...
+    gtk_tree_view_get_cursor (GTK_TREE_VIEW (view), &spath, &col);
+
+    if (event->type != GDK_KEY_PRESS)
+    {
+        if (spath)
+            gtk_tree_path_free (spath);
+        return FALSE;
+    }
+
+    switch (event->keyval)
+    {
+
+    case GDK_KEY_Up:
+    case GDK_KEY_Down:
+
+        if (!spath)
+            return TRUE;
+
+        // This is to test for the auto completion popup window
+        {
+            GtkWidget *toplevel;
+            GtkWindowGroup *window_group;
+            GList *win_list;
+
+            toplevel = gtk_widget_get_toplevel (widget);
+            if (GTK_IS_WINDOW (toplevel))
+            {
+                window_group = gtk_window_get_group (GTK_WINDOW (toplevel));
+                win_list = gtk_window_group_list_windows (window_group);
+                if (g_list_length (win_list) == 1 && gtk_widget_get_visible (GTK_WIDGET (win_list->data)))
+                    auto_popped = TRUE;
+
+            g_list_free (win_list);
+            }
+        }
+
+        // Auto complete window popped
+        if (auto_popped == TRUE)
+        {
+            gtk_tree_path_free (spath);
+            return FALSE;
+        }
+
+        model = gnc_tree_view_split_reg_get_model_from_view (view);
+
+        // Make sure we have stopped editing.
+        gnc_tree_view_split_reg_finish_edit (view);
+
+        // This stops the cell changing.
+        if (view->priv->stop_cell_move == TRUE)
+        {
+            gtk_tree_path_free (spath);
+            return TRUE;
+        }
+
+        depth = gtk_tree_path_get_depth (spath);
+        if (event->keyval == GDK_KEY_Up)
+        {
+            if (depth == 1)
+            {
+                if (gtk_tree_path_prev (spath))
+                {
+                    if (gtk_tree_view_row_expanded (GTK_TREE_VIEW (view), spath))
+                    {
+                        gtk_tree_path_down (spath);
+
+                        if (gtk_tree_view_row_expanded (GTK_TREE_VIEW (view), spath) && model->type == GENERAL_JOURNAL2)
+                        {
+                            gtk_tree_path_down (spath);
+
+                            while (gnc_tree_view_path_is_valid (GNC_TREE_VIEW (view), spath))
+                            {
+                                gtk_tree_path_next (spath);
+                            }
+                            gtk_tree_path_prev (spath);
+                        }
+                    }
+                }
+            }
+            else if (!gtk_tree_path_prev (spath) && depth > 1)
+            {
+                gtk_tree_path_up (spath);
+            }
+        }
+        else if (gtk_tree_view_row_expanded (GTK_TREE_VIEW (view), spath))
+        {
+            gtk_tree_path_down (spath);
+        }
+        else
+        {
+            gtk_tree_path_next (spath);
+            if (!gnc_tree_view_path_is_valid (GNC_TREE_VIEW (view), spath) && depth > 2)
+            {
+                gtk_tree_path_prev (spath);
+                gtk_tree_path_up (spath);
+                gtk_tree_path_next (spath);
+            }
+            if (!gnc_tree_view_path_is_valid (GNC_TREE_VIEW (view), spath) && depth > 1)
+            {
+                gtk_tree_path_prev (spath);
+                gtk_tree_path_up (spath);
+                gtk_tree_path_next (spath);
+            }
+        }
+
+        /* Set cursor to new column, open for editing */
+        gtk_tree_view_set_cursor (GTK_TREE_VIEW (view), spath, col, TRUE);
+
+        if (event->keyval == GDK_KEY_Up)
+        {
+            gnc_tree_model_split_reg_move (model, VIEW_UP);
+        }
+        else
+            gnc_tree_model_split_reg_move (model, VIEW_DOWN);
+
+        return TRUE;
+        break;
+
+    case GDK_KEY_Return:
+
+        if (!spath)
+            return TRUE;
+
+        // This stops the cell changing.
+        if (view->priv->stop_cell_move == TRUE)
+        {
+            gtk_tree_path_free (spath);
+            return TRUE;
+        }
+
+        // Do sums if we have ctrl key
+        if (event->state & GDK_CONTROL_MASK)
+        {
+            // Make sure we have stopped editing.
+            gnc_tree_view_split_reg_finish_edit (view);
+
+            /* Set cursor to the column, open for editing */
+            gtk_tree_view_set_cursor (GTK_TREE_VIEW (view), spath, col, TRUE);
+            gtk_tree_path_free (spath);
+            return TRUE;
+        }
+        return FALSE;
+        break;
+
+    case GDK_KEY_KP_Enter:
+
+        if (!spath)
+            return TRUE;
+
+        // This stops the cell changing.
+        if (view->priv->stop_cell_move == TRUE)
+        {
+            gtk_tree_path_free (spath);
+            return TRUE;
+        }
+
+        goto_blank = gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL_REGISTER,
+                                         GNC_PREF_ENTER_MOVES_TO_END);
+
+        model = gnc_tree_view_split_reg_get_model_from_view (view);
+        btrans = gnc_tree_model_split_get_blank_trans (model);
+        ctrans = gnc_tree_view_split_reg_get_current_trans (view);
+
+        /* Are we on the blank transaction */
+        if (btrans == ctrans)
+            next_trans = FALSE;
+
+        /* First record the transaction */
+        if (gnc_tree_view_split_reg_enter (view))
+        {
+            /* Now move. */
+            if (goto_blank)
+                g_idle_add ((GSourceFunc)gnc_tree_control_split_reg_jump_to_blank, view);
+            else if (next_trans)
+                gnc_tree_control_split_reg_goto_rel_trans_row (view, 1);
+        }
+        return TRUE;
+        break;
+
+    default:
+        gtk_tree_path_free (spath);
+	return FALSE;
+    }
+}
+
+/*###########################################################################*/
+
+/* The main Start Editing Call back for the TEXT columns */
+static void
+gtv_sr_editable_start_editing_cb (GtkCellRenderer *cr, GtkCellEditable *editable,
+                              const gchar *path_string, gpointer user_data)
+{
+    GncTreeViewSplitReg  *view = GNC_TREE_VIEW_SPLIT_REG (user_data);
+    GncTreeModelSplitReg *model;
+    GtkTreePath          *spath;
+    GtkEntry             *entry = NULL;
+    ViewCol               viewcol;
+    RowDepth              depth;
+    gint                 *indices;
+
+    GtkListStore *description_list;
+    GtkListStore *memo_list;
+    GtkListStore *notes_list;
+    GtkListStore *account_list;
+
+    GtkEntryCompletion *completion = gtk_entry_completion_new();
+
+    ENTER("gtv_sr_editable_start_editing_cb Path string is '%s'", path_string);
+
+    model = gnc_tree_view_split_reg_get_model_from_view (view);
+
+    /* Description / Notes / Memo / Accounts Completion Lists */
+    description_list = gnc_tree_model_split_reg_get_description_list (model);
+    notes_list = gnc_tree_model_split_reg_get_notes_list (model);
+    memo_list = gnc_tree_model_split_reg_get_memo_list (model);
+    account_list = gnc_tree_model_split_reg_get_acct_list (model);
+
+    // Use depth to determine if it is a split or transaction
+    spath = gtk_tree_path_new_from_string (path_string);
+    depth = gtk_tree_path_get_depth (spath);
+    indices = gtk_tree_path_get_indices (spath);
+
+    viewcol = GPOINTER_TO_INT (g_object_get_data (G_OBJECT(cr), "view_column"));
+
+    DEBUG("editable Depth is %u and ViewCol is %d", depth, viewcol);
+
+    g_object_set_data (G_OBJECT (cr), "cell-editable", editable);
+
+    // This is for key navigation...
+    g_signal_connect (G_OBJECT (editable), "key-press-event", G_CALLBACK (gtv_sr_ed_key_press_cb), view);
+
+    /* DATE COLUMN */
+    if (viewcol == COL_DATE)
+    {
+        entry = GTK_ENTRY (GNC_POPUP_ENTRY (editable)->entry);
+
+        //Copy the string in the GtkEntry for later comparison
+        g_object_set_data_full (G_OBJECT (cr), "current-string", g_strdup (gtk_entry_get_text (entry)), g_free);
+
+        g_signal_connect (G_OBJECT (editable), "remove-widget", (GCallback) gtv_sr_remove_edit_date, view);
+
+        DEBUG("Current String date is '%s'", gtk_entry_get_text (entry));
+    }
+
+    /* TRANSFER / VOID COLUMN */
+    else if (viewcol == COL_TRANSFERVOID)
+    {
+        entry = GTK_ENTRY (gtk_bin_get_child (GTK_BIN (editable)));
+
+        // This is for key navigation...
+        g_signal_connect (G_OBJECT (entry), "key-press-event", G_CALLBACK (gtv_sr_ed_key_press_cb), view);
+
+        {
+            GtkEditable *editable = GTK_EDITABLE (entry);
+
+            if (view->priv->stop_cell_move == TRUE)
+            {
+                gint textPosition = 0;
+                gtk_editable_insert_text (GTK_EDITABLE (editable), view->priv->transfer_string, -1, &textPosition);
+                gtk_editable_set_position (GTK_EDITABLE (editable), -1);
+            }
+        }
+
+        // Update the Account list combo.
+        gnc_tree_model_split_reg_update_account_list (model);
+
+        gtk_entry_set_completion (entry, completion);
+        gtk_entry_completion_set_model (completion, GTK_TREE_MODEL (account_list));
+
+        /* This sets which text column to use, 0 for short names, 1 for long */
+        if (view->priv->acct_short_names)
+            gtk_entry_completion_set_text_column (completion, 0);
+        else
+            gtk_entry_completion_set_text_column (completion, 1);
+
+        gtk_entry_completion_set_popup_completion (completion, TRUE);
+        gtk_entry_completion_set_inline_selection (completion, TRUE);
+        gtk_entry_completion_set_popup_set_width (completion, FALSE);
+        gtk_entry_completion_set_minimum_key_length (completion, 1);
+//??        g_signal_connect(G_OBJECT(completion), "match-selected", (GCallback) gtv_sr_match_selected_cb, view);
+        g_object_unref (completion);
+
+        //Copy the string in the GtkEntry for later comparison
+        g_object_set_data_full (G_OBJECT (cr), "current-string", g_strdup (gtk_entry_get_text (entry)), g_free);
+
+        g_signal_connect (G_OBJECT (entry), "insert_text", (GCallback) gtv_sr_acct_cb, view);
+
+//??        g_signal_connect (G_OBJECT (cr), "changed", (GCallback) gtv_sr_changed_cb, view);
+        g_signal_connect (G_OBJECT (editable), "remove-widget", (GCallback) gtv_sr_remove_edit_combo, view);
+
+        DEBUG("Current String tv is '%s'", gtk_entry_get_text (entry));
+    }
+
+    /* NUMBER / ACTION COLUMN */
+    else if (viewcol == COL_NUMACT)
+    {
+        if ((depth == TRANS1) || ((depth == TRANS2) && (qof_book_use_split_action_for_num_field (gnc_get_current_book()))))
+        {
+            entry = GTK_ENTRY (editable);
+
+            //Copy the string in the GtkEntry for later comparison
+            g_object_set_data_full (G_OBJECT (cr), "current-string", g_strdup (gtk_entry_get_text (entry)), g_free);
+
+            g_signal_connect (G_OBJECT (GTK_ENTRY (entry)), "insert_text", (GCallback) gtv_sr_num_cb, view);
+
+            view->priv->fo_handler_id = g_signal_connect (G_OBJECT (editable), "focus-out-event", (GCallback) gtv_sr_focus_out_cb, view);
+
+            g_signal_connect (G_OBJECT (editable), "remove-widget", (GCallback) gtv_sr_remove_edit_entry, view);
+
+//??        g_signal_connect (G_OBJECT (cr), "changed", (GCallback)gtv_sr_changed_cb, view);
+            DEBUG("Current String num is '%s'", gtk_entry_get_text (entry));
+        }
+
+        if ((depth == SPLIT3) || ((depth == TRANS2) && (!qof_book_use_split_action_for_num_field (gnc_get_current_book()))))
+        {
+            gnc_tree_model_split_reg_update_action_list (model);
+
+            entry = GTK_ENTRY (gtk_bin_get_child (GTK_BIN (editable)));
+
+            //Copy the string in the GtkEntry for later comparison
+            g_object_set_data_full (G_OBJECT (cr), "current-string", g_strdup (gtk_entry_get_text (entry)), g_free);
+
+//??          g_signal_connect (G_OBJECT (cr), "changed", (GCallback) gtv_sr_changed_cb, view);
+            g_signal_connect (G_OBJECT (editable), "remove-widget", (GCallback) gtv_sr_remove_edit_combo, view);
+
+            DEBUG("Current String action is '%s'", gtk_entry_get_text (entry));
+        }
+    }
+
+    /* DESCRIPTION / NOTES / MEMO COLUMN */
+    else if (viewcol == COL_DESCNOTES)
+    {
+        entry = GTK_ENTRY (editable);
+
+        // Update the auto completion lists.
+        gnc_tree_model_split_reg_update_completion (model);
+
+        //Data used for completion is set based on if editing split or not
+        if (depth == TRANS1)
+        {
+            gtk_entry_set_completion (entry, completion);
+            gtk_entry_completion_set_model (completion, GTK_TREE_MODEL (description_list));
+            gtk_entry_completion_set_text_column (completion, 0);
+        }
+        else if (depth == TRANS2)
+        {
+            gtk_entry_set_completion (entry, completion);
+            gtk_entry_completion_set_model (completion, GTK_TREE_MODEL (notes_list));
+            gtk_entry_completion_set_text_column (completion, 0);
+        }
+        else if (depth == SPLIT3)
+        {
+            gtk_entry_set_completion (entry, completion);
+            gtk_entry_completion_set_model (completion, GTK_TREE_MODEL (memo_list));
+            gtk_entry_completion_set_text_column (completion, 0);
+        }
+
+        //To emit "match-selected" signal we need to have a list of matches to
+        //select from instead of using inline autocompletion
+        gtk_entry_completion_set_popup_completion (completion, TRUE);
+        gtk_entry_completion_set_inline_selection (completion, TRUE);
+        gtk_entry_completion_set_minimum_key_length (completion, view->priv->key_length);
+//??        g_signal_connect (G_OBJECT (completion), "match-selected", (GCallback) gtv_sr_match_selected_cb, view);
+
+        g_object_unref (completion);
+
+        //Copy the string in the GtkEntry for later comparison
+        g_object_set_data_full (G_OBJECT (cr), "current-string", g_strdup (gtk_entry_get_text (entry)), g_free);
+
+        view->priv->fo_handler_id = g_signal_connect (G_OBJECT (editable), "focus-out-event", (GCallback) gtv_sr_focus_out_cb, view);
+
+        g_signal_connect (G_OBJECT (editable), "remove-widget", (GCallback) gtv_sr_remove_edit_entry, view);
+
+        DEBUG("Current String dnm is '%s'", gtk_entry_get_text (entry));
+    }
+
+    /* RECN COLUMN */
+    else if (viewcol == COL_RECN)
+    {
+        entry = GTK_ENTRY (editable);
+
+        //Copy the string in the GtkEntry for later comparison
+        g_object_set_data_full (G_OBJECT (cr), "current-string", g_strdup (gtk_entry_get_text (entry)), g_free);
+
+        g_signal_connect (G_OBJECT (GTK_ENTRY (editable)), "insert_text", (GCallback)gtv_sr_recn_cb, view);
+
+        view->priv->fo_handler_id = g_signal_connect (G_OBJECT (editable), "focus-out-event", (GCallback) gtv_sr_focus_out_cb, view);
+
+        g_signal_connect (G_OBJECT (editable), "remove-widget", (GCallback) gtv_sr_remove_edit_entry, view);
+
+//??        g_signal_connect (G_OBJECT (cr), "changed", (GCallback) gtv_sr_changed_cb, view);
+        DEBUG("Current String recn is '%s'", gtk_entry_get_text (entry));
+    }
+
+    /* TYPE COLUMN */
+    else if (viewcol == COL_TYPE)
+    {
+        entry = GTK_ENTRY (editable);
+
+        //Copy the string in the GtkEntry for later comparison
+        g_object_set_data_full (G_OBJECT (cr), "current-string", g_strdup (gtk_entry_get_text (entry)), g_free);
+
+        g_signal_connect (G_OBJECT (GTK_ENTRY (editable)), "insert_text", (GCallback)gtv_sr_type_cb, view);
+
+        view->priv->fo_handler_id = g_signal_connect (G_OBJECT (editable), "focus-out-event", (GCallback) gtv_sr_focus_out_cb, view);
+
+        g_signal_connect (G_OBJECT (editable), "remove-widget", (GCallback) gtv_sr_remove_edit_entry, view);
+
+//??        g_signal_connect (G_OBJECT (cr), "changed", (GCallback) gtv_sr_changed_cb, view);
+        DEBUG("Current String type is '%s'", gtk_entry_get_text (entry));
+    }
+
+    /* THE REST OF THE COLUMNS */
+    else
+    {
+        entry = GTK_ENTRY (editable);
+
+        //Copy the string in the GtkEntry for later comparison
+        g_object_set_data_full (G_OBJECT (cr), "current-string", g_strdup (gtk_entry_get_text (entry)), g_free);
+
+        view->priv->fo_handler_id = g_signal_connect (G_OBJECT (editable), "focus-out-event", (GCallback) gtv_sr_focus_out_cb, view);
+
+        g_signal_connect (G_OBJECT (editable), "remove-widget", (GCallback) gtv_sr_remove_edit_entry, view);
+
+//??        g_signal_connect (G_OBJECT (cr), "changed", (GCallback)gtv_sr_changed_cb, view);
+        DEBUG("Current String rest is '%s'", gtk_entry_get_text (entry));
+    }
+
+    /* Lets change the background of the entry widgets */
+    {
+        GdkRGBA      color;
+        const gchar *row_color;
+        gboolean     is_trow1 = FALSE;
+        gboolean     is_trow2 = FALSE;
+        gboolean     is_split = FALSE;
+
+        if (depth == TRANS1)
+            is_trow1 = TRUE;
+        if (depth == TRANS2)
+            is_trow2 = TRUE;
+        if (depth == SPLIT3)
+            is_split = TRUE;
+
+        row_color = gnc_tree_model_split_reg_get_row_color (model, is_trow1, is_trow2, is_split, indices[0]);
+
+        if (gdk_rgba_parse (&color, row_color))
+        {
+            if (entry != NULL)
+            {
+                GtkStyleContext *stylectxt = gtk_widget_get_style_context (GTK_WIDGET (entry));
+                GtkCssProvider *provider = gtk_css_provider_new();
+                gchar *col_str = gdk_rgba_to_string (&color);
+                gchar *widget_css = g_strconcat ("*{\n  background-color:", col_str, ";\n}\n", NULL);
+
+                gtk_css_provider_load_from_data (provider, widget_css, -1, NULL);
+                gtk_style_context_add_provider (stylectxt, GTK_STYLE_PROVIDER (provider),
+                                                GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+                g_object_unref (provider);
+                g_free (col_str);
+                g_free (widget_css);
+            }
+        }
+    }
+
+    gtv_sr_help (view, cr, viewcol, depth);
+    gtk_tree_path_free (spath);
+
+    view->priv->temp_cr = cr;
+    view->editing_now = TRUE;
+
+    DEBUG("Temp Cell Rend %p", view->priv->temp_cr);
+
+    //Add edit-canceled property to cr so we can distinguish between
+    //cancelled and actual changes
+    g_object_set_data (G_OBJECT (cr), "edit-canceled", GINT_TO_POINTER (FALSE));
+    LEAVE(" ");
+}
+
+#ifdef skip
+// Handle the "match-selected" signal
+static void
+gtv_sr_match_selected_cb (GtkEntryCompletion *widget, GtkTreeModel *model,
+                        GtkTreeIter *iter, gpointer user_data)
+{
+//    GncTreeViewSplitReg *view = GNC_TREE_VIEW_SPLIT_REG (user_data);
+
+//FIXME g_print("gtv_sr_match_selected_cb\n\n");
+
+/* Not sure what I am going to put in here yet if anything */
+}
+#endif
+
+#ifdef skip
+// Handle the "changed" signal
+static void
+gtv_sr_changed_cb (GtkCellRendererCombo *widget, gchar *path_string,
+                        GtkTreeIter *iter, gpointer user_data)
+{
+//    GncTreeViewSplitReg *view = GNC_TREE_VIEW_SPLIT_REG (user_data);
+
+//FIXME g_print("gtv_sr_changed_cb path string is '%s'\n\n", path_string);
+
+/* Not sure what I am going to put in here yet if anything */
+
+}
+#endif
+
+// Handle the "editing-canceled" signal
+static void
+gtv_sr_editing_canceled_cb (GtkCellRenderer *cr, gpointer user_data)
+{
+    GncTreeViewSplitReg *view = GNC_TREE_VIEW_SPLIT_REG (user_data);
+
+    if (GPOINTER_TO_INT (g_object_get_data (G_OBJECT (view), "data-edited")) == FALSE) // Not edited, reset edit path
+    {
+        view->priv->dirty_trans = NULL;
+    }
+
+    /* Reset stop_cell_move */
+    if (view->priv->stop_cell_move == TRUE)
+    {
+        view->priv->stop_cell_move = FALSE;
+
+        /* this will populate cell with original value */
+        g_idle_add ((GSourceFunc) gtv_sr_idle_transfer, view);
+    }
+
+    /* Reset Help text */
+    if (view->help_text)
+        g_free (view->help_text);
+    view->help_text = g_strdup (" ");
+    g_signal_emit_by_name (view, "help_signal", NULL);
+
+    //Set edit-canceled property
+    g_object_set_data (G_OBJECT (cr), "edit-canceled", GINT_TO_POINTER (TRUE));	
+}
+
+/*####################################################################
+          ^^^^   gtv function call backs    ^^^^
+#####################################################################*/
+
+/* Scroll the view to show selected row based on sort direction */
+gboolean
+gnc_tree_view_split_reg_scroll_to_cell (GncTreeViewSplitReg *view)
+{
+    GncTreeModelSplitReg *model;
+    GtkTreePath *mpath, *spath;
+
+    PINFO("#### Start Scroll to Cell ####");
+
+    model = gnc_tree_view_split_reg_get_model_from_view (view);
+
+    mpath = gnc_tree_view_split_reg_get_current_path (view);
+    spath = gnc_tree_view_split_reg_get_sort_path_from_model_path (view, mpath);
+
+    if (model->sort_direction == GTK_SORT_DESCENDING)
+    {
+        gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (view), spath, NULL, TRUE, 0.5, 0.0); //0.0
+    }
+    else
+    {
+        if (model->use_double_line)
+        {
+            gtk_tree_path_down (spath); // move to the second row of transaction
+            gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (view), spath, NULL, TRUE, 1.0, 0.0); //1.0
+        }
+        else
+        {
+            gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (view), spath, NULL, TRUE, 1.0, 0.0); //1.0
+        }
+    }
+
+    gtk_tree_path_free (mpath);
+    gtk_tree_path_free (spath);
+
+    PINFO("#### End Scroll to Cell ####");
+
+    return (FALSE);
+}
+
+
+/* Scroll the view to show the blank split with least movement */
+gboolean
+gnc_tree_view_split_reg_scroll_to_bsplit (GncTreeViewSplitReg *view)
+{
+    GncTreeModelSplitReg *model;
+    GtkTreePath *bsplit_mpath, *bsplit_spath;
+    Split *bsplit;
+
+    model = gnc_tree_view_split_reg_get_model_from_view (view);
+
+    /* Get the blank split spath */
+    bsplit = gnc_tree_model_split_get_blank_split (model);
+    bsplit_mpath = gnc_tree_model_split_reg_get_path_to_split_and_trans (model, bsplit, NULL);
+    bsplit_spath = gnc_tree_view_split_reg_get_sort_path_from_model_path (view, bsplit_mpath);
+
+    gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (view), bsplit_spath, NULL, FALSE, 1.0, 0.0);
+
+    gtk_tree_path_free (bsplit_mpath);
+    gtk_tree_path_free (bsplit_spath);
+    return (FALSE);
+}
+
+
+/* Returns the Transaction at the current selected position */
+Transaction *
+gnc_tree_view_split_reg_get_current_trans (GncTreeViewSplitReg *view)
+{
+    return view->priv->current_trans;
+}
+
+
+/* Returns the Split at the current selected position or NULL */
+Split *
+gnc_tree_view_split_reg_get_current_split (GncTreeViewSplitReg *view)
+{
+    return view->priv->current_split;
+}
+
+
+/* Returns the depth of the selected row */
+RowDepth
+gnc_tree_view_reg_get_selected_row_depth (GncTreeViewSplitReg *view)
+{
+    return view->priv->current_depth;
+}
+
+
+/* Returns the dirty_trans or NULL */
+Transaction *
+gnc_tree_view_split_reg_get_dirty_trans (GncTreeViewSplitReg *view)
+{
+    return view->priv->dirty_trans;
+}
+
+
+/* Sets dirty_trans to trans or NULL to clear */
+void
+gnc_tree_view_split_reg_set_dirty_trans (GncTreeViewSplitReg *view, Transaction *trans)
+{
+    if (trans == NULL)
+    {
+        g_object_set_data (G_OBJECT (view), "data-edited", GINT_TO_POINTER (FALSE));
+        view->priv->dirty_trans = NULL;
+    }
+    else
+    {
+        g_object_set_data (G_OBJECT (view), "data-edited", GINT_TO_POINTER (TRUE));
+        view->priv->dirty_trans = trans;
+    }
+}
+
+
+/* Returns the current path, or NULL if the current path is the blank split. */
+GtkTreePath *
+gnc_tree_view_split_reg_get_current_path (GncTreeViewSplitReg *view)
+{
+    if (!view->priv->current_ref)
+        return NULL;
+    return gtk_tree_row_reference_get_path (view->priv->current_ref);
+}
+
+
+/* Sets the current path reference to path */
+void
+gnc_tree_view_split_reg_set_current_path (GncTreeViewSplitReg *view, GtkTreePath *mpath)
+{
+    GncTreeModelSplitReg *model;
+
+    model = gnc_tree_view_split_reg_get_model_from_view (view);
+
+    if (view->priv->current_ref != NULL)
+    {
+        gtk_tree_row_reference_free (view->priv->current_ref);
+        view->priv->current_ref = NULL;
+    }
+    view->priv->current_ref = gtk_tree_row_reference_new (GTK_TREE_MODEL (model), mpath);
+}
+
+
+/* Reinit transaction / delete the splits */
+void
+gnc_tree_view_split_reg_reinit_trans (GncTreeViewSplitReg *view)
+{
+    Transaction           *trans;
+    RowDepth               depth;
+
+    /* Make sure we have stopped editing */
+    gnc_tree_view_split_reg_finish_edit (view);
+
+    trans = view->priv->current_trans;
+
+    // Lets get out of the way, move selection to trans - selection is blocked
+    gnc_tree_control_split_reg_goto_rel_trans_row (view, 0);
+
+    depth = view->priv->current_depth;
+
+    if (trans && (depth != SPLIT3))
+    {
+        Split *s;
+        int i = 0;
+
+        if (!xaccTransIsOpen (trans))
+            xaccTransBeginEdit (trans);
+
+        gnc_tree_view_split_reg_set_dirty_trans (view, trans);
+
+        while ((s = xaccTransGetSplit (trans, i)) != NULL)
+        {
+            if (xaccTransGetRateForCommodity (trans, view->priv->reg_comm, s, NULL))
+                xaccSplitDestroy (s);
+            else i++;
+        }
+    }
+}
+
+
+/* Delete the current split */
+void
+gnc_tree_view_split_reg_delete_current_split (GncTreeViewSplitReg *view)
+{
+    Transaction           *trans;
+    Split                 *split;
+
+    /* Make sure we have stopped editing */
+    gnc_tree_view_split_reg_finish_edit (view);
+
+    trans = view->priv->current_trans;
+    split = view->priv->current_split;
+
+    if (!xaccTransIsOpen (trans))
+        xaccTransBeginEdit (trans);
+
+    gnc_tree_view_split_reg_set_dirty_trans (view, trans);
+
+    // Lets get out of the way, move selection to trans - selection is blocked
+    gnc_tree_control_split_reg_goto_rel_trans_row (view, 0);
+
+    xaccSplitDestroy (split);
+}
+
+
+/* Delete the current transaction */
+void
+gnc_tree_view_split_reg_delete_current_trans (GncTreeViewSplitReg *view)
+{
+    Transaction           *trans;
+
+    /* We do not use the normal confirmation with this one as we have
+       all ready asked the user to confirm delete */
+
+    /* Make sure we have stopped editing */
+    gnc_tree_view_split_reg_finish_edit (view);
+
+    trans = view->priv->current_trans;
+
+    /* We need to go back one to select the next transaction */
+    gnc_tree_control_split_reg_goto_rel_trans_row (view, 1);
+
+    if (!xaccTransIsOpen (trans))
+        xaccTransBeginEdit (trans);
+    gnc_tree_view_split_reg_set_dirty_trans (view, trans);
+
+    xaccTransDestroy (trans);
+    xaccTransCommitEdit (trans);
+
+    gnc_tree_view_split_reg_set_dirty_trans (view, NULL);
+}
+
+
+/* Record changes */
+gboolean
+gnc_tree_view_split_reg_enter (GncTreeViewSplitReg *view)
+{
+    /* Make sure we have stopped editing */
+    gnc_tree_view_split_reg_finish_edit (view);
+
+    // Test for transaction changed
+    if (gtv_sr_transaction_changed (view))
+        return FALSE;
+
+    // Return FALSE on discard
+    if (view->priv->trans_confirm == DISCARD)
+        return FALSE;
+
+    return TRUE;
+}
+
+
+/* Cancel the edit and rollback changes */
+void
+gnc_tree_view_split_reg_cancel_edit (GncTreeViewSplitReg *view, gboolean reg_closing)
+{
+    GncTreeModelSplitReg *model;
+    Transaction          *trans = view->priv->dirty_trans;
+    Split                *split;
+
+    ENTER("gnc_tree_view_split_reg_cancel_edit view is %p and reg_closing is %d", view, reg_closing);
+
+    model = gnc_tree_view_split_reg_get_model_from_view (view);
+
+    if (trans && xaccTransIsOpen (trans))
+    {
+        // Move selection to trans - selection is blocked
+        gnc_tree_control_split_reg_goto_rel_trans_row (view, 0);
+
+        // Remove the split before rollback.
+        gnc_tree_model_split_reg_set_blank_split_parent (model, trans, TRUE);
+
+        g_object_set_data (G_OBJECT (view), "data-edited", GINT_TO_POINTER (FALSE));
+        xaccTransRollbackEdit (view->priv->dirty_trans);
+
+        // Add the split after rollback so it is last in list.
+        gnc_tree_model_split_reg_set_blank_split_parent (model, trans, FALSE);
+
+        // Set the transaction to show correct view
+        gnc_tree_view_split_reg_format_trans (view, view->priv->dirty_trans);
+
+        gnc_tree_view_split_reg_set_dirty_trans (view, NULL);
+
+        split = gnc_tree_model_split_get_blank_split (model);
+        xaccSplitReinit (split); // Clear the blank split
+    }
+    /* Reset allow changes for reconciled transctions */
+    view->change_allowed = FALSE;
+
+    view->priv->auto_complete = FALSE; // reset auto_complete has run flag
+
+    /* This updates the plugin page gui */
+    gnc_tree_view_split_reg_call_uiupdate_cb(view);
+
+    LEAVE(" ");
+}
+
+
+/* Make sure we have stopped editing */
+void
+gnc_tree_view_split_reg_finish_edit (GncTreeViewSplitReg *view)
+{
+    gtv_sr_finish_edit (view);
+
+    /* give gtk+ a chance to handle pending events */
+    while (gtk_events_pending ())
+       gtk_main_iteration ();
+}
+
+
+/* Returns whether the splits are revealed for the transaction or current position
+   if transaction is NULL */
+gboolean
+gnc_tree_view_split_reg_trans_expanded (GncTreeViewSplitReg *view, Transaction *trans)
+{
+    GncTreeModelSplitReg *model;
+    GtkTreePath *mpath, *spath;
+    gboolean expanded;
+
+    /* if trans is NULL use priv->expanded */
+    if (trans == NULL)
+        expanded = view->priv->expanded;
+    else
+    {
+        model = gnc_tree_view_split_reg_get_model_from_view (view);
+
+        mpath = gnc_tree_model_split_reg_get_path_to_split_and_trans (model, NULL, trans);
+
+        spath = gnc_tree_view_split_reg_get_sort_path_from_model_path (view, mpath);
+
+        gtk_tree_path_down (spath); /* Move the path down to trow2 */
+
+        expanded = gtk_tree_view_row_expanded (GTK_TREE_VIEW (view), spath);
+
+        gtk_tree_path_free (mpath);
+        gtk_tree_path_free (spath);
+    }
+    return expanded;
+}
+
+
+/* Collapse the transaction, if trans is NULL, use current_ref */
+void
+gnc_tree_view_split_reg_collapse_trans (GncTreeViewSplitReg *view, Transaction *trans)
+{
+    GncTreeModelSplitReg *model;
+    GtkTreePath *temp_spath, *mpath, *spath;
+    GtkTreeIter m_iter;
+    gint *indices;
+    RowDepth depth;
+
+    ENTER("gnc_tree_view_split_reg_collapse_trans and trans is %p", trans);
+
+    model = gnc_tree_view_split_reg_get_model_from_view (view);
+
+    /* Make sure we have stopped editing */
+    gnc_tree_view_split_reg_finish_edit (view);
+
+    /* if trans is NULL use current_ref */
+    if (trans == NULL)
+        mpath = gtk_tree_row_reference_get_path (view->priv->current_ref);
+    else
+        mpath = gnc_tree_model_split_reg_get_path_to_split_and_trans (model, NULL, trans);
+
+    spath = gnc_tree_view_split_reg_get_sort_path_from_model_path (view, mpath);
+
+    /* Collapse the view back to the transaction */
+    indices = gtk_tree_path_get_indices (spath);
+    depth = gtk_tree_path_get_depth (spath);
+
+    if (model->use_double_line)
+        temp_spath = gtk_tree_path_new_from_indices (indices[0], 0, -1);
+    else
+        temp_spath = gtk_tree_path_new_from_indices (indices[0], -1);
+
+    /* if trans is NULL, collapse and update current_ref */
+    if (trans == NULL)
+    {
+        GtkTreePath *temp_mpath;
+
+        gnc_tree_view_split_reg_block_selection (view, TRUE);
+
+        /* Change the selection to last available row of transaction - double */
+        if ((model->use_double_line) && (depth == SPLIT3))
+            gtk_tree_selection_select_path (gtk_tree_view_get_selection (GTK_TREE_VIEW (view)), temp_spath);
+
+        /* Change the selection to last available row of transaction - single */
+        if ((!model->use_double_line) && (depth != TRANS1))
+            gtk_tree_selection_select_path (gtk_tree_view_get_selection (GTK_TREE_VIEW (view)), temp_spath);
+
+        gtk_tree_view_collapse_row (GTK_TREE_VIEW (view), temp_spath);
+
+        /* Get the selection */
+        if (gtv_sr_get_model_iter_from_selection (view, gtk_tree_view_get_selection (GTK_TREE_VIEW (view)), &m_iter))
+        {
+            temp_mpath = gtk_tree_model_get_path (GTK_TREE_MODEL (model), &m_iter);
+
+            /* Update the tree view titles */
+            gtv_sr_titles (view, gtk_tree_path_get_depth (temp_mpath));
+
+            /* Save the new model path to path ref */
+            gnc_tree_view_split_reg_set_current_path (view, temp_mpath);
+
+            gtk_tree_path_free (temp_mpath);
+        }
+        gnc_tree_view_split_reg_block_selection (view, FALSE);
+    }
+    else
+        gtk_tree_view_collapse_row (GTK_TREE_VIEW (view), temp_spath);
+
+    gtk_tree_path_free (temp_spath);
+    gtk_tree_path_free (mpath);
+    gtk_tree_path_free (spath);
+
+    view->priv->expanded = FALSE;
+
+    /* This updates the plugin page gui */
+    gnc_tree_view_split_reg_call_uiupdate_cb(view);
+
+    LEAVE(" ");
+}
+
+
+/* Expands the transaction or the current transaction if NULL */
+void
+gnc_tree_view_split_reg_expand_trans (GncTreeViewSplitReg *view, Transaction *trans)
+{
+    GncTreeModelSplitReg *model;
+    GtkTreePath *mpath, *spath;
+    GtkTreePath *start_path, *end_path;
+    gint *indices_spath;
+    gint num_splits;
+
+    ENTER("gnc_tree_view_split_reg_expand_trans and trans is %p", trans);
+
+    model = gnc_tree_view_split_reg_get_model_from_view (view);
+
+    /* Make sure we have stopped editing */
+    gnc_tree_view_split_reg_finish_edit (view);
+
+    if (trans == NULL)
+        mpath = gtk_tree_row_reference_get_path (view->priv->current_ref);
+    else
+        mpath = gnc_tree_model_split_reg_get_path_to_split_and_trans (model, NULL, trans);
+
+    spath = gnc_tree_view_split_reg_get_sort_path_from_model_path (view, mpath);
+
+    gtk_tree_view_expand_row (GTK_TREE_VIEW (view), spath, TRUE);
+
+    view->priv->expanded = TRUE;
+
+    if (view->priv->selection_to_blank_on_expand && (model->style != REG2_STYLE_JOURNAL))
+        gtv_sr_selection_to_blank (view);
+
+    /* Get spath indices and the number of splits */
+    indices_spath = gtk_tree_path_get_indices (spath);
+    num_splits = xaccTransCountSplits (view->priv->current_trans);
+
+    if (gtk_tree_view_get_visible_range (GTK_TREE_VIEW (view), &start_path, &end_path))
+    {
+//        gint *indices_start;
+        gint *indices_end;
+        gint lines = 0;
+
+        /* The first and last visible path */
+//        indices_start = gtk_tree_path_get_indices (start_path);
+        indices_end = gtk_tree_path_get_indices (end_path);
+
+        if (model->use_double_line)
+            lines = (indices_end[0] - indices_spath[0])*2;
+        else
+            lines = indices_end[0] - indices_spath[0];
+
+        if ((num_splits + 1) > lines)
+        {
+            /* scroll window to show selection when view is idle */
+            g_idle_add ((GSourceFunc) gnc_tree_view_split_reg_scroll_to_bsplit, view );
+        }
+        gtk_tree_path_free (start_path);
+        gtk_tree_path_free (end_path);
+    }
+    gtk_tree_path_free (mpath);
+    gtk_tree_path_free (spath);
+
+    /* This updates the plugin page gui */
+    gnc_tree_view_split_reg_call_uiupdate_cb(view);
+
+    LEAVE(" ");
+}
+
+
+/* Return the credit and debit titles of those columns */
+const char *
+gnc_tree_view_split_reg_get_credit_debit_string (GncTreeViewSplitReg *view, gboolean credit)
+{
+    GtkCellRenderer *cr0;
+    GList *renderers;
+    GList *columns;
+    GList  *column;
+    gint i;
+    const char *title = NULL;
+
+    columns = gtk_tree_view_get_columns (GTK_TREE_VIEW (view));
+
+    for ( column = columns, i = 1; column; column = g_list_next (column), i++)
+    {
+        GtkTreeViewColumn *tvc;
+        ViewCol viewcol;
+
+        tvc = column->data;
+
+        // Get the first renderer, it has the view-column value.
+        renderers = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (tvc));
+        cr0 = g_list_nth_data (renderers, 0);
+        g_list_free (renderers);
+
+        viewcol = GPOINTER_TO_INT (g_object_get_data (G_OBJECT(cr0), "view_column"));
+
+        DEBUG("viewcol is %d", viewcol);
+
+        if (viewcol == COL_CREDIT && credit)
+            title = gtk_tree_view_column_get_title (tvc);
+
+        if (viewcol == COL_DEBIT && !credit)
+            title = gtk_tree_view_column_get_title (tvc);
+    }
+    g_list_free (columns);
+    return title;
+}
+
+
+/* Returns the parent Window */
+GtkWidget *
+gnc_tree_view_split_reg_get_parent (GncTreeViewSplitReg *view)
+{
+    GncTreeModelSplitReg *model;
+    model = gnc_tree_view_split_reg_get_model_from_view (view);
+    return gnc_tree_model_split_reg_get_parent (model);
+}
+
+
+/* This sets up the page gui update from the tree view motion callback */
+void
+gnc_tree_view_split_reg_set_uiupdate_cb (GncTreeViewSplitReg *view, GFunc cb, gpointer cb_data)
+{
+    view->uiupdate_cb = cb;
+    view->uiupdate_cb_data = cb_data;
+}
+
+/** Call the moved_cb callback that is used to update the page ui, if it is
+set. If it is not set, this function does nothing.
+
+\return FALSE so that this function can be used in g_idle_add() */
+gboolean gnc_tree_view_split_reg_call_uiupdate_cb(GncTreeViewSplitReg *view)
+{
+    g_assert(view);
+    if (view->uiupdate_cb)
+        (view->uiupdate_cb)(view, view->uiupdate_cb_data);
+    return FALSE;
+}
+
diff --git a/src/gnome-utils/gnc-tree-view-split-reg.h b/gnucash/gnome-utils/gnc-tree-view-split-reg.h
similarity index 100%
rename from src/gnome-utils/gnc-tree-view-split-reg.h
rename to gnucash/gnome-utils/gnc-tree-view-split-reg.h
diff --git a/src/gnome-utils/gnc-tree-view-sx-list.c b/gnucash/gnome-utils/gnc-tree-view-sx-list.c
similarity index 100%
rename from src/gnome-utils/gnc-tree-view-sx-list.c
rename to gnucash/gnome-utils/gnc-tree-view-sx-list.c
diff --git a/src/gnome-utils/gnc-tree-view-sx-list.h b/gnucash/gnome-utils/gnc-tree-view-sx-list.h
similarity index 100%
rename from src/gnome-utils/gnc-tree-view-sx-list.h
rename to gnucash/gnome-utils/gnc-tree-view-sx-list.h
diff --git a/src/gnome-utils/gnc-tree-view.c b/gnucash/gnome-utils/gnc-tree-view.c
similarity index 100%
rename from src/gnome-utils/gnc-tree-view.c
rename to gnucash/gnome-utils/gnc-tree-view.c
diff --git a/src/gnome-utils/gnc-tree-view.h b/gnucash/gnome-utils/gnc-tree-view.h
similarity index 100%
rename from src/gnome-utils/gnc-tree-view.h
rename to gnucash/gnome-utils/gnc-tree-view.h
diff --git a/src/gnome-utils/gnc-ui.h b/gnucash/gnome-utils/gnc-ui.h
similarity index 100%
rename from src/gnome-utils/gnc-ui.h
rename to gnucash/gnome-utils/gnc-ui.h
diff --git a/src/gnome-utils/gnc-window.c b/gnucash/gnome-utils/gnc-window.c
similarity index 100%
rename from src/gnome-utils/gnc-window.c
rename to gnucash/gnome-utils/gnc-window.c
diff --git a/src/gnome-utils/gnc-window.h b/gnucash/gnome-utils/gnc-window.h
similarity index 100%
rename from src/gnome-utils/gnc-window.h
rename to gnucash/gnome-utils/gnc-window.h
diff --git a/src/gnome-utils/gncmod-gnome-utils.c b/gnucash/gnome-utils/gncmod-gnome-utils.c
similarity index 100%
rename from src/gnome-utils/gncmod-gnome-utils.c
rename to gnucash/gnome-utils/gncmod-gnome-utils.c
diff --git a/src/gnome-utils/gnome-utils.i b/gnucash/gnome-utils/gnome-utils.i
similarity index 100%
rename from src/gnome-utils/gnome-utils.i
rename to gnucash/gnome-utils/gnome-utils.i
diff --git a/src/gnome-utils/gnome-utils.scm b/gnucash/gnome-utils/gnome-utils.scm
similarity index 100%
rename from src/gnome-utils/gnome-utils.scm
rename to gnucash/gnome-utils/gnome-utils.scm
diff --git a/src/gnome-utils/gschemas/CMakeLists.txt b/gnucash/gnome-utils/gschemas/CMakeLists.txt
similarity index 100%
rename from src/gnome-utils/gschemas/CMakeLists.txt
rename to gnucash/gnome-utils/gschemas/CMakeLists.txt
diff --git a/src/gnome-utils/gschemas/Makefile.am b/gnucash/gnome-utils/gschemas/Makefile.am
similarity index 100%
rename from src/gnome-utils/gschemas/Makefile.am
rename to gnucash/gnome-utils/gschemas/Makefile.am
diff --git a/src/gnome-utils/gschemas/org.gnucash.history.gschema.xml.in.in b/gnucash/gnome-utils/gschemas/org.gnucash.history.gschema.xml.in.in
similarity index 100%
rename from src/gnome-utils/gschemas/org.gnucash.history.gschema.xml.in.in
rename to gnucash/gnome-utils/gschemas/org.gnucash.history.gschema.xml.in.in
diff --git a/src/gnome-utils/gschemas/org.gnucash.warnings.gschema.xml.in.in b/gnucash/gnome-utils/gschemas/org.gnucash.warnings.gschema.xml.in.in
similarity index 100%
rename from src/gnome-utils/gschemas/org.gnucash.warnings.gschema.xml.in.in
rename to gnucash/gnome-utils/gschemas/org.gnucash.warnings.gschema.xml.in.in
diff --git a/src/gnome-utils/gtkbuilder/CMakeLists.txt b/gnucash/gnome-utils/gtkbuilder/CMakeLists.txt
similarity index 100%
rename from src/gnome-utils/gtkbuilder/CMakeLists.txt
rename to gnucash/gnome-utils/gtkbuilder/CMakeLists.txt
diff --git a/src/gnome-utils/gtkbuilder/Makefile.am b/gnucash/gnome-utils/gtkbuilder/Makefile.am
similarity index 100%
rename from src/gnome-utils/gtkbuilder/Makefile.am
rename to gnucash/gnome-utils/gtkbuilder/Makefile.am
diff --git a/src/gnome-utils/gtkbuilder/assistant-xml-encoding.glade b/gnucash/gnome-utils/gtkbuilder/assistant-xml-encoding.glade
similarity index 100%
rename from src/gnome-utils/gtkbuilder/assistant-xml-encoding.glade
rename to gnucash/gnome-utils/gtkbuilder/assistant-xml-encoding.glade
diff --git a/src/gnome-utils/gtkbuilder/dialog-account.glade b/gnucash/gnome-utils/gtkbuilder/dialog-account.glade
similarity index 100%
rename from src/gnome-utils/gtkbuilder/dialog-account.glade
rename to gnucash/gnome-utils/gtkbuilder/dialog-account.glade
diff --git a/src/gnome-utils/gtkbuilder/dialog-book-close.glade b/gnucash/gnome-utils/gtkbuilder/dialog-book-close.glade
similarity index 100%
rename from src/gnome-utils/gtkbuilder/dialog-book-close.glade
rename to gnucash/gnome-utils/gtkbuilder/dialog-book-close.glade
diff --git a/src/gnome-utils/gtkbuilder/dialog-commodity.glade b/gnucash/gnome-utils/gtkbuilder/dialog-commodity.glade
similarity index 100%
rename from src/gnome-utils/gtkbuilder/dialog-commodity.glade
rename to gnucash/gnome-utils/gtkbuilder/dialog-commodity.glade
diff --git a/src/gnome-utils/gtkbuilder/dialog-file-access.glade b/gnucash/gnome-utils/gtkbuilder/dialog-file-access.glade
similarity index 100%
rename from src/gnome-utils/gtkbuilder/dialog-file-access.glade
rename to gnucash/gnome-utils/gtkbuilder/dialog-file-access.glade
diff --git a/src/gnome-utils/gtkbuilder/dialog-object-references.glade b/gnucash/gnome-utils/gtkbuilder/dialog-object-references.glade
similarity index 100%
rename from src/gnome-utils/gtkbuilder/dialog-object-references.glade
rename to gnucash/gnome-utils/gtkbuilder/dialog-object-references.glade
diff --git a/src/gnome-utils/gtkbuilder/dialog-options.glade b/gnucash/gnome-utils/gtkbuilder/dialog-options.glade
similarity index 100%
rename from src/gnome-utils/gtkbuilder/dialog-options.glade
rename to gnucash/gnome-utils/gtkbuilder/dialog-options.glade
diff --git a/src/gnome-utils/gtkbuilder/dialog-preferences.glade b/gnucash/gnome-utils/gtkbuilder/dialog-preferences.glade
similarity index 100%
rename from src/gnome-utils/gtkbuilder/dialog-preferences.glade
rename to gnucash/gnome-utils/gtkbuilder/dialog-preferences.glade
diff --git a/src/gnome-utils/gtkbuilder/dialog-query-view.glade b/gnucash/gnome-utils/gtkbuilder/dialog-query-view.glade
similarity index 100%
rename from src/gnome-utils/gtkbuilder/dialog-query-view.glade
rename to gnucash/gnome-utils/gtkbuilder/dialog-query-view.glade
diff --git a/src/gnome-utils/gtkbuilder/dialog-reset-warnings.glade b/gnucash/gnome-utils/gtkbuilder/dialog-reset-warnings.glade
similarity index 100%
rename from src/gnome-utils/gtkbuilder/dialog-reset-warnings.glade
rename to gnucash/gnome-utils/gtkbuilder/dialog-reset-warnings.glade
diff --git a/src/gnome-utils/gtkbuilder/dialog-tax-table.glade b/gnucash/gnome-utils/gtkbuilder/dialog-tax-table.glade
similarity index 100%
rename from src/gnome-utils/gtkbuilder/dialog-tax-table.glade
rename to gnucash/gnome-utils/gtkbuilder/dialog-tax-table.glade
diff --git a/src/gnome-utils/gtkbuilder/dialog-totd.glade b/gnucash/gnome-utils/gtkbuilder/dialog-totd.glade
similarity index 100%
rename from src/gnome-utils/gtkbuilder/dialog-totd.glade
rename to gnucash/gnome-utils/gtkbuilder/dialog-totd.glade
diff --git a/src/gnome-utils/gtkbuilder/dialog-transfer.glade b/gnucash/gnome-utils/gtkbuilder/dialog-transfer.glade
similarity index 100%
rename from src/gnome-utils/gtkbuilder/dialog-transfer.glade
rename to gnucash/gnome-utils/gtkbuilder/dialog-transfer.glade
diff --git a/src/gnome-utils/gtkbuilder/dialog-userpass.glade b/gnucash/gnome-utils/gtkbuilder/dialog-userpass.glade
similarity index 100%
rename from src/gnome-utils/gtkbuilder/dialog-userpass.glade
rename to gnucash/gnome-utils/gtkbuilder/dialog-userpass.glade
diff --git a/src/gnome-utils/gtkbuilder/gnc-date-format.glade b/gnucash/gnome-utils/gtkbuilder/gnc-date-format.glade
similarity index 100%
rename from src/gnome-utils/gtkbuilder/gnc-date-format.glade
rename to gnucash/gnome-utils/gtkbuilder/gnc-date-format.glade
diff --git a/src/gnome-utils/gtkbuilder/gnc-frequency.glade b/gnucash/gnome-utils/gtkbuilder/gnc-frequency.glade
similarity index 100%
rename from src/gnome-utils/gtkbuilder/gnc-frequency.glade
rename to gnucash/gnome-utils/gtkbuilder/gnc-frequency.glade
diff --git a/src/gnome-utils/gtkbuilder/gnc-recurrence.glade b/gnucash/gnome-utils/gtkbuilder/gnc-recurrence.glade
similarity index 100%
rename from src/gnome-utils/gtkbuilder/gnc-recurrence.glade
rename to gnucash/gnome-utils/gtkbuilder/gnc-recurrence.glade
diff --git a/src/gnome-utils/gtkbuilder/gnc-tree-view-owner.glade b/gnucash/gnome-utils/gtkbuilder/gnc-tree-view-owner.glade
similarity index 100%
rename from src/gnome-utils/gtkbuilder/gnc-tree-view-owner.glade
rename to gnucash/gnome-utils/gtkbuilder/gnc-tree-view-owner.glade
diff --git a/src/gnome-utils/make-gnc-warnings-c.xsl b/gnucash/gnome-utils/make-gnc-warnings-c.xsl
similarity index 100%
rename from src/gnome-utils/make-gnc-warnings-c.xsl
rename to gnucash/gnome-utils/make-gnc-warnings-c.xsl
diff --git a/src/gnome-utils/make-gnc-warnings-h.xsl b/gnucash/gnome-utils/make-gnc-warnings-h.xsl
similarity index 100%
rename from src/gnome-utils/make-gnc-warnings-h.xsl
rename to gnucash/gnome-utils/make-gnc-warnings-h.xsl
diff --git a/src/gnome-utils/misc-gnome-utils.c b/gnucash/gnome-utils/misc-gnome-utils.c
similarity index 100%
rename from src/gnome-utils/misc-gnome-utils.c
rename to gnucash/gnome-utils/misc-gnome-utils.c
diff --git a/src/gnome-utils/misc-gnome-utils.h b/gnucash/gnome-utils/misc-gnome-utils.h
similarity index 100%
rename from src/gnome-utils/misc-gnome-utils.h
rename to gnucash/gnome-utils/misc-gnome-utils.h
diff --git a/src/gnome-utils/print-session.c b/gnucash/gnome-utils/print-session.c
similarity index 100%
rename from src/gnome-utils/print-session.c
rename to gnucash/gnome-utils/print-session.c
diff --git a/src/gnome-utils/print-session.h b/gnucash/gnome-utils/print-session.h
similarity index 100%
rename from src/gnome-utils/print-session.h
rename to gnucash/gnome-utils/print-session.h
diff --git a/src/gnome-utils/search-param.c b/gnucash/gnome-utils/search-param.c
similarity index 100%
rename from src/gnome-utils/search-param.c
rename to gnucash/gnome-utils/search-param.c
diff --git a/src/gnome-utils/search-param.h b/gnucash/gnome-utils/search-param.h
similarity index 100%
rename from src/gnome-utils/search-param.h
rename to gnucash/gnome-utils/search-param.h
diff --git a/gnucash/gnome-utils/test/CMakeLists.txt b/gnucash/gnome-utils/test/CMakeLists.txt
new file mode 100644
index 0000000..647c61c
--- /dev/null
+++ b/gnucash/gnome-utils/test/CMakeLists.txt
@@ -0,0 +1,35 @@
+
+SET(GNOME_UTILS_TEST_INCLUDE_DIRS
+  ${CMAKE_SOURCE_DIR}/libgnucash/gnc-module
+  ${GLIB2_INCLUDE_DIRS}
+  ${GUILE_INCLUDE_DIRS}
+)
+SET(GNOME_UTILS_TEST_LIBS gnc-module test-core)
+
+GNC_ADD_TEST_WITH_GUILE(test-link-module-gnome-utils test-link-module.c
+  GNOME_UTILS_TEST_INCLUDE_DIRS GNOME_UTILS_TEST_LIBS
+)
+
+
+SET(GNOME_UTILS_GUI_TEST_INCLUDE_DIRS
+  ${GNOME_UTILS_TEST_INCLUDE_DIRS}
+  ${CMAKE_BINARY_DIR}/common
+  ${CMAKE_SOURCE_DIR}/gnucash/gnome-utils
+  ${CMAKE_SOURCE_DIR}/libgnucash/engine
+  ${GTK3_INCLUDE_DIRS}
+)
+SET(GNOME_UTILS_GUI_TEST_LIBS
+  ${GNOME_UTILS_TEST_LIBS}
+  gncmod-gnome-utils
+)
+#This is a GUI test
+#GNC_ADD_TEST(test-gnc-recurrence test-gnc-recurrence.c
+#  GNOME_UTILS_GUI_TEST_INCLUDE_DIRS
+#  GNOME_UTILS_GUI_TEST_LIBS
+#
+
+GNC_ADD_SCHEME_TEST(test-load-module-gnome-utils test-load-module.in)
+
+CONFIGURE_FILE(test-load-module.in test-load-module @ONLY)
+
+SET_DIST_LIST(test_gnome_utils_DIST CMakeLists.txt Makefile.am test-gnc-recurrence.c test-link-module.c test-load-module.in)
diff --git a/gnucash/gnome-utils/test/Makefile.am b/gnucash/gnome-utils/test/Makefile.am
new file mode 100644
index 0000000..f06d47b
--- /dev/null
+++ b/gnucash/gnome-utils/test/Makefile.am
@@ -0,0 +1,75 @@
+TESTS =  \
+  test-link-module test-load-module
+
+# The following tests are nice, but have absolutely no place in an
+# automated testing system.
+#
+TESTS_GUI = test-gnc-recurrence
+
+##lib_LTLIBRARIES = libgncgnome.la
+
+GNC_TEST_DEPS = --gnc-module-dir ${top_builddir}/libgnucash/engine \
+  --gnc-module-dir ${top_builddir}/libgnucash/app-utils \
+  --gnc-module-dir ${top_builddir}/gnucash/gnome-utils \
+  --guile-load-dir ${top_builddir}/libgnucash/gnc-module \
+  --guile-load-dir ${top_builddir}/libgnucash/scm \
+  --guile-load-dir ${top_builddir}/libgnucash/engine \
+  --guile-load-dir ${top_builddir}/libgnucash/core-utils \
+  --guile-load-dir ${top_builddir}/libgnucash/app-utils \
+  --guile-load-dir ${top_builddir}/gnucash/gnome-utils \
+  --library-dir    ${top_builddir}/gnucash/gnome-utils \
+  --library-dir    ${top_builddir}/libgnucash/core-utils \
+  --library-dir    ${top_builddir}/libgnucash/gnc-module \
+  --library-dir    ${top_builddir}/libgnucash/engine \
+  --library-dir    ${top_builddir}/libgnucash/backend/xml \
+  --library-dir    ${top_builddir}/libgnucash/backend/sql \
+  --library-dir    ${top_builddir}/libgnucash/app-utils
+
+
+TESTS_ENVIRONMENT = \
+  GUILE_WARN_DEPRECATED=no \
+  GUILE="${GUILE}" \
+  SRCDIR=${srcdir} \
+  GNC_BUILDDIR="${abs_top_builddir}" \
+  $(shell ${abs_top_srcdir}/common/gnc-test-env.pl --noexports ${GNC_TEST_DEPS})
+
+check_PROGRAMS = \
+  test-link-module test-gnc-recurrence
+
+AM_CPPFLAGS = \
+  -I${top_srcdir}/common \
+  -I${top_srcdir}/libgnucash/engine \
+  -I${top_srcdir}/libgnucash/engine/test-core \
+  -I${top_srcdir}/gnucash/gnome-utils \
+  -I${top_srcdir}/libgnucash/gnc-module \
+  -I${top_srcdir}/libgnucash/app-utils \
+  -I${top_srcdir}/common/test-core \
+  ${GLIB_CFLAGS} \
+  ${GTK_CFLAGS} \
+  ${GUILE_CFLAGS}
+
+LDADD = \
+  ${GNOME_LIBS} \
+  ${top_builddir}/libgnucash/app-utils/libgncmod-app-utils.la \
+  ${top_builddir}/gnucash/gnome-utils/libgncmod-gnome-utils.la \
+  ${top_builddir}/libgnucash/engine/libgncmod-engine.la \
+  ${top_builddir}/libgnucash/engine/test-core/libgncmod-test-engine.la \
+  ${top_builddir}/common/test-core/libtest-core.la
+
+test_gnc_recurrence_SOURCES=test-gnc-recurrence.c
+test_gnc_recurrence_LDADD = \
+  ${GTK_LIBS} \
+  ${LDADD}
+
+test_link_module_SOURCES=test-link-module.c
+test_link_module_LDADD = \
+  ${GUILE_LIBS} \
+  ${GLIB_LIBS} \
+  ${top_builddir}/libgnucash/gnc-module/libgnc-module.la
+
+EXTRA_DIST = \
+  test-load-module \
+  CMakeLists.txt
+
+testit:
+	libtool --mode execute gdb test-link-module
diff --git a/src/gnome-utils/test/test-gnc-recurrence.c b/gnucash/gnome-utils/test/test-gnc-recurrence.c
similarity index 100%
rename from src/gnome-utils/test/test-gnc-recurrence.c
rename to gnucash/gnome-utils/test/test-gnc-recurrence.c
diff --git a/src/gnome-utils/test/test-link-module.c b/gnucash/gnome-utils/test/test-link-module.c
similarity index 100%
rename from src/gnome-utils/test/test-link-module.c
rename to gnucash/gnome-utils/test/test-link-module.c
diff --git a/src/gnome-utils/test/test-load-module.in b/gnucash/gnome-utils/test/test-load-module.in
similarity index 100%
rename from src/gnome-utils/test/test-load-module.in
rename to gnucash/gnome-utils/test/test-load-module.in
diff --git a/src/gnome-utils/tree-view-utils.c b/gnucash/gnome-utils/tree-view-utils.c
similarity index 100%
rename from src/gnome-utils/tree-view-utils.c
rename to gnucash/gnome-utils/tree-view-utils.c
diff --git a/src/gnome-utils/tree-view-utils.h b/gnucash/gnome-utils/tree-view-utils.h
similarity index 100%
rename from src/gnome-utils/tree-view-utils.h
rename to gnucash/gnome-utils/tree-view-utils.h
diff --git a/src/gnome-utils/ui/CMakeLists.txt b/gnucash/gnome-utils/ui/CMakeLists.txt
similarity index 100%
rename from src/gnome-utils/ui/CMakeLists.txt
rename to gnucash/gnome-utils/ui/CMakeLists.txt
diff --git a/src/gnome-utils/ui/Makefile.am b/gnucash/gnome-utils/ui/Makefile.am
similarity index 100%
rename from src/gnome-utils/ui/Makefile.am
rename to gnucash/gnome-utils/ui/Makefile.am
diff --git a/src/gnome-utils/ui/gnc-main-window-ui.xml b/gnucash/gnome-utils/ui/gnc-main-window-ui.xml
similarity index 100%
rename from src/gnome-utils/ui/gnc-main-window-ui.xml
rename to gnucash/gnome-utils/ui/gnc-main-window-ui.xml
diff --git a/src/gnome-utils/ui/gnc-windows-menu-ui-quartz.xml b/gnucash/gnome-utils/ui/gnc-windows-menu-ui-quartz.xml
similarity index 100%
rename from src/gnome-utils/ui/gnc-windows-menu-ui-quartz.xml
rename to gnucash/gnome-utils/ui/gnc-windows-menu-ui-quartz.xml
diff --git a/src/gnome-utils/ui/gnc-windows-menu-ui.xml b/gnucash/gnome-utils/ui/gnc-windows-menu-ui.xml
similarity index 100%
rename from src/gnome-utils/ui/gnc-windows-menu-ui.xml
rename to gnucash/gnome-utils/ui/gnc-windows-menu-ui.xml
diff --git a/src/gnome-utils/ui/gnucash.css b/gnucash/gnome-utils/ui/gnucash.css
similarity index 100%
rename from src/gnome-utils/ui/gnucash.css
rename to gnucash/gnome-utils/ui/gnucash.css
diff --git a/src/gnome-utils/ui/osx_accel_map b/gnucash/gnome-utils/ui/osx_accel_map
similarity index 100%
rename from src/gnome-utils/ui/osx_accel_map
rename to gnucash/gnome-utils/ui/osx_accel_map
diff --git a/src/gnome-utils/window-main-summarybar.c b/gnucash/gnome-utils/window-main-summarybar.c
similarity index 100%
rename from src/gnome-utils/window-main-summarybar.c
rename to gnucash/gnome-utils/window-main-summarybar.c
diff --git a/src/gnome-utils/window-main-summarybar.h b/gnucash/gnome-utils/window-main-summarybar.h
similarity index 100%
rename from src/gnome-utils/window-main-summarybar.h
rename to gnucash/gnome-utils/window-main-summarybar.h
diff --git a/gnucash/gnome/CMakeLists.txt b/gnucash/gnome/CMakeLists.txt
new file mode 100644
index 0000000..bc32f49
--- /dev/null
+++ b/gnucash/gnome/CMakeLists.txt
@@ -0,0 +1,206 @@
+
+ADD_SUBDIRECTORY(gschemas)
+ADD_SUBDIRECTORY(gtkbuilder)
+ADD_SUBDIRECTORY(ui)
+
+SET (gnc_gnome_noinst_HEADERS
+  assistant-acct-period.h
+  assistant-hierarchy.h
+  assistant-loan.h
+  assistant-stock-split.h
+  business-options-gnome.h
+  business-urls.h
+  business-gnome-utils.h
+  dialog-billterms.h
+  dialog-choose-owner.h
+  dialog-customer.h
+  dialog-date-close.h
+  dialog-employee.h
+  dialog-fincalc.h
+  dialog-find-account.h
+  dialog-find-transactions.h
+  dialog-find-transactions2.h
+  dialog-imap-editor.h
+  dialog-invoice.h
+  dialog-job.h
+  dialog-lot-viewer.h
+  dialog-new-user.h
+  dialog-order.h
+  dialog-payment.h
+  dialog-print-check.h
+  dialog-progress.h
+  dialog-sx-editor.h
+  dialog-sx-editor2.h
+  dialog-sx-from-trans.h
+  dialog-sx-since-last-run.h
+  dialog-trans-assoc.h
+  dialog-vendor.h
+  gnc-budget-view.h
+  gnc-plugin-account-tree.h
+  gnc-plugin-basic-commands.h
+  gnc-plugin-budget.h
+  gnc-plugin-business.h
+  gnc-plugin-register.h
+  gnc-plugin-register2.h
+  gnc-plugin-page-account-tree.h
+  gnc-plugin-page-budget.h
+  gnc-plugin-page-invoice.h
+  gnc-plugin-page-owner-tree.h
+  gnc-plugin-page-sx-list.h
+  gnc-plugin-page-register.h
+  gnc-plugin-page-register2.h
+  gnc-split-reg.h
+  gnc-split-reg2.h
+  reconcile-view.h
+  search-owner.h
+  top-level.h
+  window-reconcile.h
+  window-reconcile2.h
+  window-autoclear.h
+)
+
+IF (BUILDING_FROM_VCS)
+  SET (SWIG_GNOME_C ${CMAKE_CURRENT_BINARY_DIR}/swig-gnome.c)
+  GNC_ADD_SWIG_COMMAND (swig-gnome-c ${SWIG_GNOME_C} ${CMAKE_CURRENT_SOURCE_DIR}/gnome.i ${gnc_gnome_HEADERS})
+ELSE()
+  SET (SWIG_GNOME_C swig-gnome.c)
+ENDIF()
+
+SET (gnc_gnome_SOURCES 
+
+  assistant-acct-period.c
+  assistant-hierarchy.c
+  assistant-loan.c
+  assistant-stock-split.c
+  business-options-gnome.c
+  business-urls.c
+  business-gnome-utils.c
+  dialog-billterms.c
+  dialog-choose-owner.c
+  dialog-commodities.c
+  dialog-customer.c
+  dialog-date-close.c
+  dialog-employee.c
+  dialog-fincalc.c
+  dialog-find-account.c
+  dialog-find-transactions.c
+  dialog-find-transactions2.c
+  dialog-imap-editor.c
+  dialog-invoice.c
+  dialog-job.c
+  dialog-lot-viewer.c
+  dialog-new-user.c
+  dialog-order.c
+  dialog-payment.c
+  dialog-price-editor.c
+  dialog-price-edit-db.c
+  dialog-print-check.c
+  dialog-progress.c
+  dialog-sx-editor.c
+  dialog-sx-editor2.c
+  dialog-sx-from-trans.c
+  dialog-sx-since-last-run.c
+  dialog-tax-info.c
+  dialog-trans-assoc.c
+  dialog-vendor.c
+  gnc-budget-view.c
+  gnc-plugin-account-tree.c
+  gnc-plugin-basic-commands.c
+  gnc-plugin-budget.c
+  gnc-plugin-business.c
+  gnc-plugin-register.c
+  gnc-plugin-register2.c
+  gnc-plugin-page-account-tree.c
+  gnc-plugin-page-budget.c
+  gnc-plugin-page-invoice.c
+  gnc-plugin-page-owner-tree.c
+  gnc-plugin-page-sx-list.c
+  gnc-plugin-page-register.c
+  gnc-plugin-page-register2.c
+  gnc-split-reg.c
+  gnc-split-reg2.c
+  reconcile-view.c
+  search-owner.c
+  top-level.c
+  window-reconcile.c
+  window-reconcile2.c
+  window-autoclear.c
+)  
+
+SET_SOURCE_FILES_PROPERTIES (${gnc_gnome_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
+SET_SOURCE_FILES_PROPERTIES (business-options-gnome.c PROPERTIES OBJECT_DEPENDS ${SWIG_RUNTIME_H})
+
+IF (WIN32)
+  SET (gnc_gnome_SOURCES ${gnc_gnome_SOURCES} ${CMAKE_SOURCE_DIR}/lib/libc/strfmon.c)
+ENDIF(WIN32)
+
+ADD_LIBRARY (gnc-gnome ${gnc_gnome_SOURCES} ${gnc_gnome_noinst_HEADERS} ${SWIG_GNOME_C})
+TARGET_LINK_LIBRARIES(gnc-gnome gncmod-gnome-search gncmod-ledger-core gncmod-report-gnome gncmod-report-system
+    gncmod-register-gnome gncmod-register-core gncmod-gnome-utils gncmod-engine ${GTK3_LDFLAGS} ${GTK_MAC_LDFLAGS})
+
+TARGET_COMPILE_DEFINITIONS (gnc-gnome PRIVATE -DG_LOG_DOMAIN=\"gnc.gui\" ${GTK_MAC_CFLAGS_OTHER})
+
+TARGET_INCLUDE_DIRECTORIES(gnc-gnome
+  PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
+  PRIVATE
+    ${CMAKE_SOURCE_DIR}/libgnucash/app-utils/calculation
+    ${CMAKE_BINARY_DIR}/gnucash/gnome-utils # for gnc-warnings.h
+    ${GTK_MAC_INCLUDE_DIRS}
+)
+
+
+IF (MAC_INTEGRATION)
+  TARGET_COMPILE_OPTIONS(gnc-gnome PRIVATE ${OSX_EXTRA_COMPILE_FLAGS})
+  TARGET_LINK_LIBRARIES(gnc-gnome ${OSX_EXTRA_LIBRARIES})
+ENDIF(MAC_INTEGRATION)
+
+
+INSTALL(TARGETS gnc-gnome
+  LIBRARY DESTINATION lib
+  ARCHIVE DESTINATION lib
+  RUNTIME DESTINATION bin)
+
+# No headers to install
+
+# FIXME: where does LC_ALL=C come from?
+
+SET(CMAKE_COMMAND_TMP "")
+IF (${CMAKE_VERSION} VERSION_GREATER 3.1)
+  SET(CMAKE_COMMAND_TMP ${CMAKE_COMMAND} -E env)
+ENDIF()
+
+ADD_CUSTOM_COMMAND(
+    OUTPUT gnucash.appdata.xml
+    COMMAND ${CMAKE_COMMAND_TMP}
+      LC_ALL=C
+      ${PERL_EXECUTABLE} ${INTLTOOL_MERGE} -x -u -c ${CMAKE_SOURCE_DIR}/po/.intltool-merge-cache ${CMAKE_SOURCE_DIR}/po
+        ${CMAKE_CURRENT_SOURCE_DIR}/gnucash.appdata.xml.in gnucash.appdata.xml
+    MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/gnucash.appdata.xml.in
+)
+
+ADD_CUSTOM_TARGET(gnucash-appdata ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/gnucash.appdata.xml)
+
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/gnucash.appdata.xml DESTINATION share/appdata)
+
+#=======
+
+CONFIGURE_FILE(gnucash.desktop.in.in gnucash.desktop.in)
+
+
+ADD_CUSTOM_COMMAND(
+    OUTPUT gnucash.desktop
+    COMMAND ${CMAKE_COMMAND_TMP}
+      LC_ALL=C
+      ${PERL_EXECUTABLE} ${INTLTOOL_MERGE} -d -u -c ${CMAKE_SOURCE_DIR}/po/.intltool-merge-cache ${CMAKE_SOURCE_DIR}/po
+        gnucash.desktop.in gnucash.desktop
+    MAIN_DEPENDENCY gnucash.desktop.in
+)
+
+ADD_CUSTOM_TARGET(gnucash-desktop ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/gnucash.desktop)
+
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/gnucash.desktop DESTINATION share/applications)
+
+SET_LOCAL_DIST(gnome_DIST_local
+        CMakeLists.txt Makefile.am gnome.i gnucash.appdata.xml.in gnucash.desktop.in.in
+        ${gnc_gnome_noinst_HEADERS} ${gnc_gnome_SOURCES})
+SET(gnome_DIST ${gnome_DIST_local} ${gnome_ui_DIST} ${gnome_gschema_DIST} ${gnome_gtkbuilder_DIST} PARENT_SCOPE)
diff --git a/gnucash/gnome/Makefile.am b/gnucash/gnome/Makefile.am
new file mode 100644
index 0000000..de44696
--- /dev/null
+++ b/gnucash/gnome/Makefile.am
@@ -0,0 +1,202 @@
+SUBDIRS = gtkbuilder gschemas ui
+
+lib_LTLIBRARIES = libgnc-gnome.la
+
+libgnc_gnome_la_LIBADD = \
+  ${top_builddir}/gnucash/register/ledger-core/libgncmod-ledger-core.la \
+  ${top_builddir}/gnucash/register/register-gnome/libgncmod-register-gnome.la \
+  ${top_builddir}/gnucash/register/register-core/libgncmod-register-core.la \
+  ${top_builddir}/gnucash/report/report-gnome/libgncmod-report-gnome.la \
+  ${top_builddir}/gnucash/report/report-system/libgncmod-report-system.la \
+  ${top_builddir}/gnucash/gnome-search/libgncmod-gnome-search.la \
+  ${top_builddir}/gnucash/gnome-utils/libgncmod-gnome-utils.la \
+  ${top_builddir}/libgnucash/backend/xml/libgnc-backend-xml-utils.la \
+  ${top_builddir}/libgnucash/app-utils/libgncmod-app-utils.la \
+  ${top_builddir}/gnucash/html/libgncmod-html.la \
+  ${top_builddir}/libgnucash/engine/libgncmod-engine.la \
+  ${top_builddir}/libgnucash/core-utils/libgnc-core-utils.la \
+  ${LIBXML2_LIBS} \
+  ${GUILE_LIBS} \
+  ${GTK_LIBS} \
+  ${GLIB_LIBS}
+
+libgnc_gnome_la_SOURCES = \
+  swig-gnome.c \
+  assistant-acct-period.c \
+  assistant-hierarchy.c \
+  assistant-loan.c \
+  assistant-stock-split.c \
+  business-options-gnome.c \
+  business-urls.c \
+  business-gnome-utils.c \
+  dialog-billterms.c \
+  dialog-choose-owner.c \
+  dialog-commodities.c \
+  dialog-customer.c \
+  dialog-date-close.c \
+  dialog-employee.c \
+  dialog-fincalc.c \
+  dialog-find-account.c \
+  dialog-find-transactions.c \
+  dialog-find-transactions2.c \
+  dialog-imap-editor.c \
+  dialog-invoice.c \
+  dialog-job.c \
+  dialog-lot-viewer.c \
+  dialog-new-user.c \
+  dialog-order.c \
+  dialog-payment.c \
+  dialog-price-editor.c \
+  dialog-price-edit-db.c \
+  dialog-print-check.c \
+  dialog-progress.c \
+  dialog-sx-editor.c \
+  dialog-sx-editor2.c \
+  dialog-sx-from-trans.c \
+  dialog-sx-since-last-run.c \
+  dialog-tax-info.c \
+  dialog-trans-assoc.c \
+  dialog-vendor.c \
+  gnc-budget-view.c \
+  gnc-plugin-account-tree.c \
+  gnc-plugin-basic-commands.c \
+  gnc-plugin-budget.c \
+  gnc-plugin-business.c \
+  gnc-plugin-page-account-tree.c \
+  gnc-plugin-page-budget.c \
+  gnc-plugin-page-invoice.c \
+  gnc-plugin-page-owner-tree.c \
+  gnc-plugin-page-sx-list.c \
+  gnc-plugin-page-register.c \
+  gnc-plugin-page-register2.c \
+  gnc-plugin-register.c \
+  gnc-plugin-register2.c \
+  gnc-split-reg.c \
+  gnc-split-reg2.c \
+  reconcile-view.c \
+  search-owner.c \
+  top-level.c \
+  window-reconcile.c \
+  window-reconcile2.c \
+  window-autoclear.c
+
+gnomeappdir = ${datadir}/applications
+
+gnomeapp_in_files = gnucash.desktop.in
+gnomeapp_DATA = $(gnomeapp_in_files:.desktop.in=.desktop)
+ at INTLTOOL_DESKTOP_RULE@
+
+appicondir = $(datadir)/pixmaps
+
+appdatadir = $(datadir)/appdata
+appdata_in_files = gnucash.appdata.xml.in
+appdata_DATA = $(appdata_in_files:.xml.in=.xml)
+ at INTLTOOL_XML_RULE@
+
+noinst_HEADERS = \
+  assistant-acct-period.h \
+  assistant-hierarchy.h \
+  assistant-loan.h \
+  assistant-stock-split.h \
+  business-options-gnome.h \
+  business-urls.h \
+  business-gnome-utils.h \
+  dialog-billterms.h \
+  dialog-choose-owner.h \
+  dialog-customer.h \
+  dialog-date-close.h \
+  dialog-employee.h \
+  dialog-fincalc.h \
+  dialog-find-account.h \
+  dialog-find-transactions.h \
+  dialog-find-transactions2.h \
+  dialog-imap-editor.h \
+  dialog-invoice.h \
+  dialog-job.h \
+  dialog-lot-viewer.h \
+  dialog-new-user.h \
+  dialog-order.h \
+  dialog-payment.h \
+  dialog-print-check.h \
+  dialog-progress.h \
+  dialog-sx-editor.h \
+  dialog-sx-editor2.h \
+  dialog-sx-from-trans.h \
+  dialog-sx-since-last-run.h \
+  dialog-trans-assoc.h \
+  dialog-vendor.h \
+  gnc-budget-view.h \
+  gnc-plugin-account-tree.h \
+  gnc-plugin-basic-commands.h \
+  gnc-plugin-budget.h \
+  gnc-plugin-business.h \
+  gnc-plugin-page-account-tree.h \
+  gnc-plugin-page-budget.h \
+  gnc-plugin-page-invoice.h \
+  gnc-plugin-page-owner-tree.h \
+  gnc-plugin-page-sx-list.h \
+  gnc-plugin-page-register.h \
+  gnc-plugin-page-register2.h \
+  gnc-plugin-register.h \
+  gnc-plugin-register2.h \
+  gnc-split-reg.h \
+  gnc-split-reg2.h \
+  reconcile-view.h \
+  search-owner.h \
+  top-level.h \
+  window-reconcile.h \
+  window-reconcile2.h \
+  window-autoclear.h
+
+if BUILDING_FROM_VCS
+swig-gnome.c: gnome.i dialog-progress.h ${top_srcdir}/common/base-typemaps.i
+	$(SWIG) -guile $(SWIG_ARGS) -Linkage module \
+	-I${top_srcdir}/common -o $@ $<
+if ! OS_WIN32
+if ! SWIG_DIST_FAIL
+	if ! `grep "define scm_from_utf8_string" $@ > /dev/null 2>&1`; then \
+	  patch $@ $(top_srcdir)/common/swig-utf8.patch; \
+	fi
+endif
+endif
+endif
+
+EXTRA_DIST = \
+  gnome.i \
+  $(gnomeapp_in_files) \
+  $(appdata_in_files) \
+  CMakeLists.txt
+
+AM_CPPFLAGS = \
+  -I${top_srcdir}/common \
+  -I${top_builddir}/common \
+  -I${top_srcdir}/libgnucash/core-utils \
+  -I${top_srcdir}/libgnucash/engine \
+  -I${top_srcdir}/libgnucash/app-utils \
+  -I${top_srcdir}/libgnucash/app-utils/calculation \
+  -I${top_srcdir}/libgnucash/backend/xml \
+  -I${top_srcdir}/gnucash/gnome-utils \
+  -I${top_builddir}/gnucash/gnome-utils \
+  -I${top_srcdir}/gnucash/gnome-search \
+  -I${top_srcdir}/gnucash/html \
+  -I${top_srcdir}/gnucash/register/ledger-core \
+  -I${top_srcdir}/gnucash/register/register-core \
+  -I${top_srcdir}/gnucash/register/register-gnome \
+  -I${top_srcdir}/gnucash/report/report-system \
+  -I${top_srcdir}/gnucash/report/report-gnome \
+  -I${top_srcdir}/lib/libc \
+  ${LIBXML2_CFLAGS} \
+  ${GUILE_CFLAGS} \
+  ${GTK_CFLAGS} \
+  $(GLIB_CFLAGS) \
+  ${GTK_MAC_CFLAGS}
+
+# We build this in an earlier directory.
+
+# The line below breaks automake 1.5.  
+##OMIT_DEPENDENCIES = gnc-dir.h
+
+CLEANFILES = gnucash.desktop gnucash.appdata.xml
+MAINTAINERCLEANFILES = swig-gnome.c
+
+AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.gui\"
diff --git a/src/gnome/assistant-acct-period.c b/gnucash/gnome/assistant-acct-period.c
similarity index 100%
rename from src/gnome/assistant-acct-period.c
rename to gnucash/gnome/assistant-acct-period.c
diff --git a/src/gnome/assistant-acct-period.h b/gnucash/gnome/assistant-acct-period.h
similarity index 100%
rename from src/gnome/assistant-acct-period.h
rename to gnucash/gnome/assistant-acct-period.h
diff --git a/src/gnome/assistant-hierarchy.c b/gnucash/gnome/assistant-hierarchy.c
similarity index 100%
rename from src/gnome/assistant-hierarchy.c
rename to gnucash/gnome/assistant-hierarchy.c
diff --git a/src/gnome/assistant-hierarchy.h b/gnucash/gnome/assistant-hierarchy.h
similarity index 100%
rename from src/gnome/assistant-hierarchy.h
rename to gnucash/gnome/assistant-hierarchy.h
diff --git a/src/gnome/assistant-loan.c b/gnucash/gnome/assistant-loan.c
similarity index 100%
rename from src/gnome/assistant-loan.c
rename to gnucash/gnome/assistant-loan.c
diff --git a/src/gnome/assistant-loan.h b/gnucash/gnome/assistant-loan.h
similarity index 100%
rename from src/gnome/assistant-loan.h
rename to gnucash/gnome/assistant-loan.h
diff --git a/src/gnome/assistant-stock-split.c b/gnucash/gnome/assistant-stock-split.c
similarity index 100%
rename from src/gnome/assistant-stock-split.c
rename to gnucash/gnome/assistant-stock-split.c
diff --git a/src/gnome/assistant-stock-split.h b/gnucash/gnome/assistant-stock-split.h
similarity index 100%
rename from src/gnome/assistant-stock-split.h
rename to gnucash/gnome/assistant-stock-split.h
diff --git a/src/gnome/business-gnome-utils.c b/gnucash/gnome/business-gnome-utils.c
similarity index 100%
rename from src/gnome/business-gnome-utils.c
rename to gnucash/gnome/business-gnome-utils.c
diff --git a/src/gnome/business-gnome-utils.h b/gnucash/gnome/business-gnome-utils.h
similarity index 100%
rename from src/gnome/business-gnome-utils.h
rename to gnucash/gnome/business-gnome-utils.h
diff --git a/src/gnome/business-options-gnome.c b/gnucash/gnome/business-options-gnome.c
similarity index 100%
rename from src/gnome/business-options-gnome.c
rename to gnucash/gnome/business-options-gnome.c
diff --git a/src/gnome/business-options-gnome.h b/gnucash/gnome/business-options-gnome.h
similarity index 100%
rename from src/gnome/business-options-gnome.h
rename to gnucash/gnome/business-options-gnome.h
diff --git a/src/gnome/business-urls.c b/gnucash/gnome/business-urls.c
similarity index 100%
rename from src/gnome/business-urls.c
rename to gnucash/gnome/business-urls.c
diff --git a/src/gnome/business-urls.h b/gnucash/gnome/business-urls.h
similarity index 100%
rename from src/gnome/business-urls.h
rename to gnucash/gnome/business-urls.h
diff --git a/src/gnome/dialog-billterms.c b/gnucash/gnome/dialog-billterms.c
similarity index 100%
rename from src/gnome/dialog-billterms.c
rename to gnucash/gnome/dialog-billterms.c
diff --git a/src/gnome/dialog-billterms.h b/gnucash/gnome/dialog-billterms.h
similarity index 100%
rename from src/gnome/dialog-billterms.h
rename to gnucash/gnome/dialog-billterms.h
diff --git a/src/gnome/dialog-choose-owner.c b/gnucash/gnome/dialog-choose-owner.c
similarity index 100%
rename from src/gnome/dialog-choose-owner.c
rename to gnucash/gnome/dialog-choose-owner.c
diff --git a/src/gnome/dialog-choose-owner.h b/gnucash/gnome/dialog-choose-owner.h
similarity index 100%
rename from src/gnome/dialog-choose-owner.h
rename to gnucash/gnome/dialog-choose-owner.h
diff --git a/gnucash/gnome/dialog-commodities.c b/gnucash/gnome/dialog-commodities.c
new file mode 100644
index 0000000..3b45d97
--- /dev/null
+++ b/gnucash/gnome/dialog-commodities.c
@@ -0,0 +1,431 @@
+/********************************************************************\
+ * dialog-commodities.c -- commodities dialog                       *
+ * Copyright (C) 2001 Gnumatic, Inc.                                *
+ * Author: Dave Peticolas <dave at krondo.com>                         *
+ * Copyright (C) 2003,2005 David Hampton                            *
+ *                                                                  *
+ * 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 at gnu.org                   *
+\********************************************************************/
+
+#include "config.h"
+
+#include <gtk/gtk.h>
+#include <glib/gi18n.h>
+
+#include "dialog-commodity.h"
+#include "dialog-utils.h"
+#include "gnc-commodity.h"
+#include "gnc-component-manager.h"
+#include "qof.h"
+#include "gnc-tree-view-commodity.h"
+#include "gnc-prefs.h"
+#include "gnc-ui.h"
+#include "gnc-ui-util.h"
+#include "gnc-gnome-utils.h"
+#include "gnc-session.h"
+#include "gnc-warnings.h"
+
+
+#define DIALOG_COMMODITIES_CM_CLASS "dialog-commodities"
+#define STATE_SECTION "dialogs/edit_commodities"
+#define GNC_PREFS_GROUP   "dialogs.commodities"
+#define GNC_PREF_INCL_ISO "include-iso"
+
+/* This static indicates the debugging module that this .o belongs to.  */
+/* static short module = MOD_GUI; */
+
+typedef struct
+{
+    GtkWidget * dialog;
+    QofSession *session;
+    QofBook *book;
+
+    GncTreeViewCommodity * commodity_tree;
+    GtkWidget * edit_button;
+    GtkWidget * remove_button;
+    gboolean    show_currencies;
+
+    gboolean is_new;
+} CommoditiesDialog;
+
+
+void gnc_commodities_window_destroy_cb (GtkWidget *object, CommoditiesDialog *cd);
+void gnc_commodities_dialog_response (GtkDialog *dialog, gint response, CommoditiesDialog *cd);
+void gnc_commodities_show_currencies_toggled (GtkToggleButton *toggle, CommoditiesDialog *cd);
+
+
+
+void
+gnc_commodities_window_destroy_cb (GtkWidget *object,   CommoditiesDialog *cd)
+{
+    gnc_unregister_gui_component_by_data (DIALOG_COMMODITIES_CM_CLASS, cd);
+
+    g_free (cd);
+}
+
+static void
+edit_clicked (CommoditiesDialog *cd)
+{
+    gnc_commodity *commodity;
+
+    commodity = gnc_tree_view_commodity_get_selected_commodity (cd->commodity_tree);
+    if (commodity == NULL)
+        return;
+
+    if (gnc_ui_edit_commodity_modal (commodity, cd->dialog))
+        gnc_gui_refresh_all ();
+}
+
+static void
+row_activated_cb (GtkTreeView *view, GtkTreePath *path,
+                  GtkTreeViewColumn *column, CommoditiesDialog *cd)
+{
+    GtkTreeModel *model;
+    GtkTreeIter iter;
+
+    g_return_if_fail(view);
+
+    model = gtk_tree_view_get_model(view);
+    if (gtk_tree_model_get_iter(model, &iter, path))
+    {
+        if (gtk_tree_model_iter_has_child(model, &iter))
+        {
+            /* There are children, so it's not a commodity.
+             * Just expand or collapse the row. */
+            if (gtk_tree_view_row_expanded(view, path))
+                gtk_tree_view_collapse_row(view, path);
+            else
+                gtk_tree_view_expand_row(view, path, FALSE);
+        }
+        else
+            /* It's a commodity, so click the Edit button. */
+            edit_clicked(cd);
+    }
+}
+
+static void
+remove_clicked (CommoditiesDialog *cd)
+{
+    GNCPriceDB *pdb;
+    GList *node;
+    GList *prices;
+    GList *accounts;
+    gboolean can_delete;
+    gnc_commodity *commodity;
+    GtkWidget *dialog;
+    const gchar *message, *warning;
+    gint response;
+
+    commodity = gnc_tree_view_commodity_get_selected_commodity (cd->commodity_tree);
+    if (commodity == NULL)
+        return;
+
+    accounts = gnc_account_get_descendants (gnc_book_get_root_account(cd->book));
+    can_delete = TRUE;
+
+    for (node = accounts; node; node = node->next)
+    {
+        Account *account = node->data;
+
+        if (commodity == xaccAccountGetCommodity (account))
+        {
+            can_delete = FALSE;
+            break;
+        }
+    }
+
+    /* FIXME check for transaction references */
+
+    if (!can_delete)
+    {
+        const char *message = _("That commodity is currently used by "
+                                "at least one of your accounts. You may "
+                                "not delete it.");
+
+        gnc_warning_dialog (cd->dialog, "%s", message);
+        g_list_free (accounts);
+        return;
+    }
+    g_list_free (accounts);
+
+    pdb = gnc_pricedb_get_db (cd->book);
+    prices = gnc_pricedb_get_prices(pdb, commodity, NULL);
+    if (prices)
+    {
+        message = _("This commodity has price quotes. Are "
+                    "you sure you want to delete the selected "
+                    "commodity and its price quotes?");
+        warning = GNC_PREF_WARN_PRICE_COMM_DEL_QUOTES;
+    }
+    else
+    {
+        message = _("Are you sure you want to delete the "
+                    "selected commodity?");
+        warning = GNC_PREF_WARN_PRICE_COMM_DEL;
+    }
+
+    dialog = gtk_message_dialog_new(GTK_WINDOW(cd->dialog),
+                                    GTK_DIALOG_DESTROY_WITH_PARENT,
+                                    GTK_MESSAGE_QUESTION,
+                                    GTK_BUTTONS_NONE,
+                                    "%s", _("Delete commodity?"));
+    gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
+            "%s", message);
+    gtk_dialog_add_buttons(GTK_DIALOG(dialog),
+                           _("_Cancel"), GTK_RESPONSE_CANCEL,
+                           _("_Delete"), GTK_RESPONSE_OK,
+                           (gchar *)NULL);
+    response = gnc_dialog_run(GTK_DIALOG(dialog), warning);
+    gtk_widget_destroy(dialog);
+
+    if (response == GTK_RESPONSE_OK)
+    {
+        gnc_commodity_table *ct;
+
+        ct = gnc_commodity_table_get_table (cd->book);
+        for (node = prices; node; node = node->next)
+            gnc_pricedb_remove_price(pdb, node->data);
+
+        gnc_commodity_table_remove (ct, commodity);
+        gnc_commodity_destroy (commodity);
+        commodity = NULL;
+    }
+
+    gnc_price_list_destroy(prices);
+    gnc_gui_refresh_all ();
+}
+
+static void
+add_clicked (CommoditiesDialog *cd)
+{
+    gnc_commodity *commodity;
+    const char *name_space;
+
+    commodity = gnc_tree_view_commodity_get_selected_commodity (cd->commodity_tree);
+    if (commodity)
+        name_space = gnc_commodity_get_namespace (commodity);
+    else
+        name_space = NULL;
+
+    commodity = gnc_ui_new_commodity_modal (name_space, cd->dialog);
+}
+
+void
+gnc_commodities_dialog_response (GtkDialog *dialog,
+                                 gint response,
+                                 CommoditiesDialog *cd)
+{
+    switch (response)
+    {
+    case GNC_RESPONSE_NEW:
+        add_clicked (cd);
+        return;
+
+    case GNC_RESPONSE_DELETE:
+        remove_clicked (cd);
+        return;
+
+    case GNC_RESPONSE_EDIT:
+        edit_clicked (cd);
+        return;
+
+    case GTK_RESPONSE_CLOSE:
+    default:
+        gnc_close_gui_component_by_data (DIALOG_COMMODITIES_CM_CLASS, cd);
+        return;
+    }
+}
+
+static void
+gnc_commodities_dialog_selection_changed (GtkTreeSelection *selection,
+        CommoditiesDialog *cd)
+{
+    gboolean remove_ok;
+    gnc_commodity *commodity;
+
+    commodity = gnc_tree_view_commodity_get_selected_commodity (cd->commodity_tree);
+    remove_ok = commodity && !gnc_commodity_is_iso(commodity);
+    gtk_widget_set_sensitive (cd->edit_button, commodity != NULL);
+    gtk_widget_set_sensitive (cd->remove_button, remove_ok);
+}
+
+void
+gnc_commodities_show_currencies_toggled (GtkToggleButton *toggle,
+        CommoditiesDialog *cd)
+{
+
+    cd->show_currencies = gtk_toggle_button_get_active (toggle);
+    gnc_tree_view_commodity_refilter (cd->commodity_tree);
+}
+
+static gboolean
+gnc_commodities_dialog_filter_ns_func (gnc_commodity_namespace *name_space,
+                                       gpointer data)
+{
+    CommoditiesDialog *cd = data;
+    const gchar *name;
+    GList *list;
+
+    /* Never show the template list */
+    name = gnc_commodity_namespace_get_name (name_space);
+    if (g_strcmp0 (name, GNC_COMMODITY_NS_TEMPLATE) == 0)
+        return FALSE;
+
+    /* Check whether or not to show commodities */
+    if (!cd->show_currencies && gnc_commodity_namespace_is_iso(name))
+        return FALSE;
+
+    /* Show any other namespace that has commodities */
+    list = gnc_commodity_namespace_get_commodity_list(name_space);
+    return (list != NULL);
+}
+
+static gboolean
+gnc_commodities_dialog_filter_cm_func (gnc_commodity *commodity,
+                                       gpointer data)
+{
+    CommoditiesDialog *cd = data;
+
+    if (cd->show_currencies)
+        return TRUE;
+    return !gnc_commodity_is_iso(commodity);
+}
+
+static void
+gnc_commodities_dialog_create (GtkWidget * parent, CommoditiesDialog *cd)
+{
+    GtkWidget *button;
+    GtkWidget *scrolled_window;
+    GtkBuilder *builder;
+    GtkTreeView *view;
+    GtkTreeSelection *selection;
+
+    builder = gtk_builder_new();
+    gnc_builder_add_from_file (builder, "dialog-commodities.glade", "securities_dialog");
+
+    cd->dialog = GTK_WIDGET(gtk_builder_get_object (builder, "securities_dialog"));
+    cd->session = gnc_get_current_session();
+    cd->book = qof_session_get_book(cd->session);
+    cd->show_currencies = gnc_prefs_get_bool(GNC_PREFS_GROUP, GNC_PREF_INCL_ISO);
+
+    // Set the style context for this dialog so it can be easily manipulated with css
+    gnc_widget_set_style_context (GTK_WIDGET(cd->dialog), "GncCommoditiesDialog");
+
+    gtk_builder_connect_signals(builder, cd);
+
+    /* parent */
+    if (parent != NULL)
+        gtk_window_set_transient_for (GTK_WINDOW (cd->dialog), GTK_WINDOW (parent));
+
+    /* buttons */
+    cd->remove_button = GTK_WIDGET(gtk_builder_get_object (builder, "remove_button"));
+    cd->edit_button = GTK_WIDGET(gtk_builder_get_object (builder, "edit_button"));
+
+    /* commodity tree */
+
+    scrolled_window = GTK_WIDGET(gtk_builder_get_object (builder, "commodity_list_window"));
+    view = gnc_tree_view_commodity_new(cd->book,
+                                       "state-section", STATE_SECTION,
+                                       "show-column-menu", TRUE,
+                                       NULL);
+    cd->commodity_tree = GNC_TREE_VIEW_COMMODITY(view);
+    gtk_container_add (GTK_CONTAINER (scrolled_window), GTK_WIDGET(view));
+    gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(cd->commodity_tree), TRUE);
+    gnc_tree_view_commodity_set_filter (cd->commodity_tree,
+                                        gnc_commodities_dialog_filter_ns_func,
+                                        gnc_commodities_dialog_filter_cm_func,
+                                        cd, NULL);
+    selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (view));
+    g_signal_connect (G_OBJECT (selection), "changed",
+                      G_CALLBACK (gnc_commodities_dialog_selection_changed), cd);
+
+    g_signal_connect (G_OBJECT (cd->commodity_tree), "row-activated",
+                      G_CALLBACK (row_activated_cb), cd);
+
+    /* Show currency button */
+    button = GTK_WIDGET(gtk_builder_get_object (builder, "show_currencies_button"));
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(button), cd->show_currencies);
+
+    g_object_unref(G_OBJECT(builder));
+    gnc_restore_window_size (GNC_PREFS_GROUP, GTK_WINDOW(cd->dialog));
+}
+
+static void
+close_handler (gpointer user_data)
+{
+    CommoditiesDialog *cd = user_data;
+
+    gnc_save_window_size(GNC_PREFS_GROUP, GTK_WINDOW(cd->dialog));
+
+    gnc_prefs_set_bool(GNC_PREFS_GROUP, GNC_PREF_INCL_ISO, cd->show_currencies);
+
+    gtk_widget_destroy(cd->dialog);
+}
+
+static void
+refresh_handler (GHashTable *changes, gpointer user_data)
+{
+    CommoditiesDialog *cd = user_data;
+
+    g_return_if_fail(cd != NULL);
+
+    gnc_tree_view_commodity_refilter (cd->commodity_tree);
+}
+
+static gboolean
+show_handler (const char *klass, gint component_id,
+              gpointer user_data, gpointer iter_data)
+{
+    CommoditiesDialog *cd = user_data;
+
+    if (!cd)
+        return(FALSE);
+    gtk_window_present (GTK_WINDOW(cd->dialog));
+    return(TRUE);
+}
+
+/********************************************************************\
+ * gnc_commodities_dialog                                           *
+ *   opens up a window to edit price information                    *
+ *                                                                  *
+ * Args:   parent  - the parent of the window to be created         *
+ * Return: nothing                                                  *
+\********************************************************************/
+void
+gnc_commodities_dialog (GtkWidget * parent)
+{
+    CommoditiesDialog *cd;
+    gint component_id;
+
+    if (gnc_forall_gui_components (DIALOG_COMMODITIES_CM_CLASS,
+                                   show_handler, NULL))
+        return;
+
+    cd = g_new0 (CommoditiesDialog, 1);
+
+    gnc_commodities_dialog_create (parent, cd);
+
+    component_id = gnc_register_gui_component (DIALOG_COMMODITIES_CM_CLASS,
+                   refresh_handler, close_handler,
+                   cd);
+    gnc_gui_component_set_session (component_id, cd->session);
+
+    gtk_widget_grab_focus (GTK_WIDGET(cd->commodity_tree));
+
+    gtk_widget_show (cd->dialog);
+}
diff --git a/gnucash/gnome/dialog-customer.c b/gnucash/gnome/dialog-customer.c
new file mode 100644
index 0000000..63c2e1c
--- /dev/null
+++ b/gnucash/gnome/dialog-customer.c
@@ -0,0 +1,1347 @@
+/*
+ * dialog-customer.c -- Dialog for Customer entry
+ * Copyright (C) 2001 Derek Atkins
+ * Author: Derek Atkins <warlord at MIT.EDU>
+ *
+ * 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 at gnu.org
+ */
+
+#include "config.h"
+
+#include <gtk/gtk.h>
+#include <glib/gi18n.h>
+#include <gdk/gdkkeysyms.h>
+
+#include "dialog-utils.h"
+#include "gnc-amount-edit.h"
+#include "gnc-currency-edit.h"
+#include "gnc-component-manager.h"
+#include "gnc-ui.h"
+#include "gnc-gui-query.h"
+#include "gnc-ui-util.h"
+#include "qof.h"
+
+#include "dialog-search.h"
+#include "search-param.h"
+#include "QuickFill.h"
+#include "gnc-addr-quickfill.h"
+
+#include "gncAddress.h"
+#include "gncCustomer.h"
+#include "gncCustomerP.h"
+
+#include "business-gnome-utils.h"
+#include "dialog-customer.h"
+#include "dialog-job.h"
+#include "dialog-order.h"
+#include "dialog-invoice.h"
+#include "dialog-payment.h"
+
+#define DIALOG_NEW_CUSTOMER_CM_CLASS "dialog-new-customer"
+#define DIALOG_EDIT_CUSTOMER_CM_CLASS "dialog-edit-customer"
+
+#define GNC_PREFS_GROUP_SEARCH "dialogs.business.customer-search"
+
+void gnc_customer_taxtable_check_cb (GtkToggleButton *togglebutton,
+                                     gpointer user_data);
+
+void gnc_customer_window_ok_cb (GtkWidget *widget, gpointer data);
+void gnc_customer_window_cancel_cb (GtkWidget *widget, gpointer data);
+void gnc_customer_window_help_cb (GtkWidget *widget, gpointer data);
+void gnc_customer_window_destroy_cb (GtkWidget *widget, gpointer data);
+void gnc_customer_name_changed_cb (GtkWidget *widget, gpointer data);
+void gnc_customer_terms_changed_cb (GtkWidget *widget, gpointer data);
+void gnc_customer_taxincluded_changed_cb (GtkWidget *widget, gpointer data);
+void gnc_customer_taxtable_changed_cb (GtkWidget *widget, gpointer data);
+void gnc_customer_addr2_insert_cb(GtkEditable *editable,
+                                  gchar *new_text, gint new_text_length,
+                                  gint *position, gpointer user_data);
+void gnc_customer_addr3_insert_cb(GtkEditable *editable,
+                                  gchar *new_text, gint new_text_length,
+                                  gint *position, gpointer user_data);
+void gnc_customer_addr4_insert_cb(GtkEditable *editable,
+                                  gchar *new_text, gint new_text_length,
+                                  gint *position, gpointer user_data);
+void gnc_customer_shipaddr2_insert_cb(GtkEditable *editable,
+                                      gchar *new_text, gint new_text_length,
+                                      gint *position, gpointer user_data);
+void gnc_customer_shipaddr3_insert_cb(GtkEditable *editable,
+                                      gchar *new_text, gint new_text_length,
+                                      gint *position, gpointer user_data);
+void gnc_customer_shipaddr4_insert_cb(GtkEditable *editable,
+                                      gchar *new_text, gint new_text_length,
+                                      gint *position, gpointer user_data);
+gboolean
+gnc_customer_addr2_key_press_cb( GtkEntry *entry, GdkEventKey *event,
+                                 gpointer user_data );
+gboolean
+gnc_customer_addr3_key_press_cb( GtkEntry *entry, GdkEventKey *event,
+                                 gpointer user_data );
+gboolean
+gnc_customer_addr4_key_press_cb( GtkEntry *entry, GdkEventKey *event,
+                                 gpointer user_data );
+gboolean
+gnc_customer_shipaddr2_key_press_cb( GtkEntry *entry, GdkEventKey *event,
+                                     gpointer user_data );
+gboolean
+gnc_customer_shipaddr3_key_press_cb( GtkEntry *entry, GdkEventKey *event,
+                                     gpointer user_data );
+gboolean
+gnc_customer_shipaddr4_key_press_cb( GtkEntry *entry, GdkEventKey *event,
+                                     gpointer user_data );
+
+#define ADDR_QUICKFILL "GncAddress-Quickfill"
+
+typedef enum
+{
+    NEW_CUSTOMER,
+    EDIT_CUSTOMER
+} CustomerDialogType;
+
+struct _customer_select_window
+{
+    QofBook *	book;
+    QofQuery *	q;
+};
+
+struct _customer_window
+{
+    GtkWidget *	dialog;
+
+    GtkWidget *	id_entry;
+    GtkWidget *	company_entry;
+
+    GtkWidget *	name_entry;
+    GtkWidget *	addr1_entry;
+    GtkWidget *	addr2_entry;
+    GtkWidget *	addr3_entry;
+    GtkWidget *	addr4_entry;
+    GtkWidget *	phone_entry;
+    GtkWidget *	fax_entry;
+    GtkWidget *	email_entry;
+
+    GtkWidget *	shipname_entry;
+    GtkWidget *	shipaddr1_entry;
+    GtkWidget *	shipaddr2_entry;
+    GtkWidget *	shipaddr3_entry;
+    GtkWidget *	shipaddr4_entry;
+    GtkWidget *	shipphone_entry;
+    GtkWidget *	shipfax_entry;
+    GtkWidget *	shipemail_entry;
+
+    GtkWidget *	currency_edit;
+    GtkWidget *	terms_menu;
+    GtkWidget *	discount_amount;
+    GtkWidget *	credit_amount;
+
+    GtkWidget *	active_check;
+    GtkWidget *	taxincluded_menu;
+    GtkWidget *	notes_text;
+
+    GtkWidget *	taxtable_check;
+    GtkWidget *	taxtable_menu;
+
+    GncTaxIncluded taxincluded;
+    GncBillTerm *	terms;
+    CustomerDialogType	dialog_type;
+    GncGUID		customer_guid;
+    gint		component_id;
+    QofBook *	book;
+    GncCustomer *	created_customer;
+
+    GncTaxTable *	taxtable;
+
+    /* stored data for the description quickfill selection function */
+    QuickFill *addr2_quickfill;
+    QuickFill *addr3_quickfill;
+    QuickFill *addr4_quickfill;
+    gint addrX_start_selection;
+    gint addrX_end_selection;
+    guint addrX_selection_source_id;
+};
+
+void
+gnc_customer_taxtable_check_cb (GtkToggleButton *togglebutton,
+                                gpointer user_data)
+{
+    CustomerWindow *cw = user_data;
+
+    if (gtk_toggle_button_get_active (togglebutton))
+        gtk_widget_set_sensitive (cw->taxtable_menu, TRUE);
+    else
+        gtk_widget_set_sensitive (cw->taxtable_menu, FALSE);
+}
+
+static GncCustomer *
+cw_get_customer (CustomerWindow *cw)
+{
+    if (!cw)
+        return NULL;
+
+    return gncCustomerLookup (cw->book, &cw->customer_guid);
+}
+
+static void gnc_ui_to_customer (CustomerWindow *cw, GncCustomer *cust)
+{
+    GtkTextBuffer* text_buffer;
+    GtkTextIter start, end;
+    gchar *text;
+    GncAddress *addr, *shipaddr;
+
+    addr = gncCustomerGetAddr (cust);
+    shipaddr = gncCustomerGetShipAddr (cust);
+
+    gnc_suspend_gui_refresh ();
+
+    gncCustomerBeginEdit (cust);
+
+    if (cw->dialog_type == NEW_CUSTOMER)
+        qof_event_gen(QOF_INSTANCE(cust), QOF_EVENT_ADD, NULL);
+
+    gncCustomerSetID (cust, gtk_editable_get_chars
+                      (GTK_EDITABLE (cw->id_entry), 0, -1));
+    gncCustomerSetName (cust, gtk_editable_get_chars
+                        (GTK_EDITABLE (cw->company_entry), 0, -1));
+
+    gncAddressSetName (addr, gtk_editable_get_chars
+                       (GTK_EDITABLE (cw->name_entry), 0, -1));
+    gncAddressSetAddr1 (addr, gtk_editable_get_chars
+                        (GTK_EDITABLE (cw->addr1_entry), 0, -1));
+    gncAddressSetAddr2 (addr, gtk_editable_get_chars
+                        (GTK_EDITABLE (cw->addr2_entry), 0, -1));
+    gncAddressSetAddr3 (addr, gtk_editable_get_chars
+                        (GTK_EDITABLE (cw->addr3_entry), 0, -1));
+    gncAddressSetAddr4 (addr, gtk_editable_get_chars
+                        (GTK_EDITABLE (cw->addr4_entry), 0, -1));
+    gncAddressSetPhone (addr, gtk_editable_get_chars
+                        (GTK_EDITABLE (cw->phone_entry), 0, -1));
+    gncAddressSetFax (addr, gtk_editable_get_chars
+                      (GTK_EDITABLE (cw->fax_entry), 0, -1));
+    gncAddressSetEmail (addr, gtk_editable_get_chars
+                        (GTK_EDITABLE (cw->email_entry), 0, -1));
+
+    gncAddressSetName (shipaddr, gtk_editable_get_chars
+                       (GTK_EDITABLE (cw->shipname_entry), 0, -1));
+    gncAddressSetAddr1 (shipaddr, gtk_editable_get_chars
+                        (GTK_EDITABLE (cw->shipaddr1_entry), 0, -1));
+    gncAddressSetAddr2 (shipaddr, gtk_editable_get_chars
+                        (GTK_EDITABLE (cw->shipaddr2_entry), 0, -1));
+    gncAddressSetAddr3 (shipaddr, gtk_editable_get_chars
+                        (GTK_EDITABLE (cw->shipaddr3_entry), 0, -1));
+    gncAddressSetAddr4 (shipaddr, gtk_editable_get_chars
+                        (GTK_EDITABLE (cw->shipaddr4_entry), 0, -1));
+    gncAddressSetPhone (shipaddr, gtk_editable_get_chars
+                        (GTK_EDITABLE (cw->shipphone_entry), 0, -1));
+    gncAddressSetFax (shipaddr, gtk_editable_get_chars
+                      (GTK_EDITABLE (cw->shipfax_entry), 0, -1));
+    gncAddressSetEmail (shipaddr, gtk_editable_get_chars
+                        (GTK_EDITABLE (cw->shipemail_entry), 0, -1));
+
+    gncCustomerSetActive (cust, gtk_toggle_button_get_active
+                          (GTK_TOGGLE_BUTTON (cw->active_check)));
+    gncCustomerSetTaxIncluded (cust, cw->taxincluded);
+
+    text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW(cw->notes_text));
+    gtk_text_buffer_get_bounds (text_buffer, &start, &end);
+    text = gtk_text_buffer_get_text (text_buffer, &start, &end, FALSE);
+    gncCustomerSetNotes (cust, text);
+
+    /* Parse and set the currency, terms, discount, and credit amounts */
+    gncCustomerSetCurrency (cust,
+                            gnc_currency_edit_get_currency (GNC_CURRENCY_EDIT
+                                    (cw->currency_edit)));
+    gncCustomerSetTerms (cust, cw->terms);
+    gncCustomerSetDiscount (cust, gnc_amount_edit_get_amount
+                            (GNC_AMOUNT_EDIT (cw->discount_amount)));
+    gncCustomerSetCredit (cust, gnc_amount_edit_get_amount
+                          (GNC_AMOUNT_EDIT (cw->credit_amount)));
+
+    gncCustomerSetTaxTableOverride
+    (cust, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (cw->taxtable_check)));
+    gncCustomerSetTaxTable (cust, cw->taxtable);
+
+    gncCustomerCommitEdit (cust);
+    gnc_resume_gui_refresh ();
+}
+
+static gboolean check_edit_amount (GtkWidget *dialog, GtkWidget *amount,
+                                   gnc_numeric *min, gnc_numeric *max,
+                                   const char * error_message)
+{
+    if (!gnc_amount_edit_evaluate (GNC_AMOUNT_EDIT (amount)))
+    {
+        if (error_message)
+            gnc_error_dialog (dialog, "%s", error_message);
+        return TRUE;
+    }
+    /* We've got a valid-looking number; check mix/max */
+    if (min || max)
+    {
+        gnc_numeric val = gnc_amount_edit_get_amount (GNC_AMOUNT_EDIT (amount));
+        if ((min && gnc_numeric_compare (*min, val) > 0) ||
+                (max && gnc_numeric_compare (val, *max) > 0))
+        {
+            if (error_message)
+                gnc_error_dialog (dialog, "%s", error_message);
+            return TRUE;
+        }
+    }
+    return FALSE;
+}
+
+static gboolean check_entry_nonempty (GtkWidget *dialog, GtkWidget *entry,
+                                      const char * error_message)
+{
+    const char *res = gtk_entry_get_text (GTK_ENTRY (entry));
+    if (g_strcmp0 (res, "") == 0)
+    {
+        if (error_message)
+            gnc_error_dialog (dialog, "%s", error_message);
+        return TRUE;
+    }
+    return FALSE;
+}
+
+void
+gnc_customer_window_ok_cb (GtkWidget *widget, gpointer data)
+{
+    CustomerWindow *cw = data;
+    gnc_numeric min, max;
+    gchar *string;
+
+    /* Check for valid company name */
+    if (check_entry_nonempty (cw->dialog, cw->company_entry,
+                              _("You must enter a company name. "
+                                "If this customer is an individual (and not a company) "
+                                "you should enter the same value for:\nIdentification "
+                                "- Company Name, and\nPayment Address - Name.")))
+        return;
+
+    /* Make sure we have an address */
+    if (check_entry_nonempty (cw->dialog, cw->addr1_entry, NULL) &&
+            check_entry_nonempty (cw->dialog, cw->addr2_entry, NULL) &&
+            check_entry_nonempty (cw->dialog, cw->addr3_entry, NULL) &&
+            check_entry_nonempty (cw->dialog, cw->addr4_entry, NULL))
+    {
+        const char *msg = _("You must enter a billing address.");
+        gnc_error_dialog (cw->dialog, "%s", msg);
+        return;
+    }
+
+    /* Verify terms, discount, and credit are valid (or empty) */
+    min = gnc_numeric_zero ();
+    max = gnc_numeric_create (100, 1);
+
+    if (check_edit_amount (cw->dialog, cw->discount_amount, &min, &max,
+                           _("Discount percentage must be between 0-100 "
+                             "or you must leave it blank.")))
+        return;
+
+    if (check_edit_amount (cw->dialog, cw->credit_amount, &min, NULL,
+                           _("Credit must be a positive amount or "
+                             "you must leave it blank.")))
+        return;
+
+    /* Set the customer id if one has not been chosen */
+    if (g_strcmp0 (gtk_entry_get_text (GTK_ENTRY (cw->id_entry)), "") == 0)
+    {
+        string = gncCustomerNextID (cw->book);
+        gtk_entry_set_text (GTK_ENTRY (cw->id_entry), string);
+        g_free(string);
+    }
+
+    /* Now save it off */
+    {
+        GncCustomer *customer = cw_get_customer (cw);
+        if (customer)
+        {
+            gnc_ui_to_customer (cw, customer);
+        }
+        cw->created_customer = customer;
+        cw->customer_guid = *guid_null ();
+    }
+
+    gnc_close_gui_component (cw->component_id);
+}
+
+void
+gnc_customer_window_cancel_cb (GtkWidget *widget, gpointer data)
+{
+    CustomerWindow *cw = data;
+
+    gnc_close_gui_component (cw->component_id);
+}
+
+void
+gnc_customer_window_help_cb (GtkWidget *widget, gpointer data)
+{
+    gnc_gnome_help(HF_HELP, HL_USAGE_CUSTOMER);
+}
+
+void
+gnc_customer_window_destroy_cb (GtkWidget *widget, gpointer data)
+{
+    CustomerWindow *cw = data;
+    GncCustomer *customer = cw_get_customer (cw);
+
+    gnc_suspend_gui_refresh ();
+
+    if (cw->dialog_type == NEW_CUSTOMER && customer != NULL)
+    {
+        gncCustomerBeginEdit (customer);
+        gncCustomerDestroy (customer);
+        cw->customer_guid = *guid_null ();
+    }
+
+    if (cw->addrX_selection_source_id)
+        g_source_remove (cw->addrX_selection_source_id);
+
+    gnc_unregister_gui_component (cw->component_id);
+    gnc_resume_gui_refresh ();
+
+    g_free (cw);
+}
+
+void
+gnc_customer_name_changed_cb (GtkWidget *widget, gpointer data)
+{
+    CustomerWindow *cw = data;
+    char *fullname, *title;
+    const char *id,  *name;
+
+    if (!cw)
+        return;
+
+    name = gtk_entry_get_text (GTK_ENTRY (cw->company_entry));
+    if (!name || *name == '\0')
+        name = _("<No name>");
+
+    id = gtk_entry_get_text (GTK_ENTRY (cw->id_entry));
+
+    fullname = g_strconcat (name, " (", id, ")", (char *)NULL);
+
+    if (cw->dialog_type == EDIT_CUSTOMER)
+        title = g_strconcat (_("Edit Customer"), " - ", fullname, (char *)NULL);
+    else
+        title = g_strconcat (_("New Customer"), " - ", fullname, (char *)NULL);
+
+    gtk_window_set_title (GTK_WINDOW (cw->dialog), title);
+
+    g_free (fullname);
+    g_free (title);
+}
+
+void
+gnc_customer_terms_changed_cb (GtkWidget *widget, gpointer data)
+{
+    GtkComboBox *cbox = GTK_COMBO_BOX (widget);
+    CustomerWindow *cw = data;
+
+    if (!cw) return;
+    if (!cbox) return;
+
+    cw->terms = gnc_simple_combo_get_value (cbox);
+}
+
+void
+gnc_customer_taxincluded_changed_cb (GtkWidget *widget, gpointer data)
+{
+    GtkComboBox *cbox = GTK_COMBO_BOX (widget);
+    CustomerWindow *cw = data;
+
+    if (!cw) return;
+    if (!cbox) return;
+
+    cw->taxincluded = GPOINTER_TO_INT (gnc_simple_combo_get_value (cbox));
+}
+
+void
+gnc_customer_taxtable_changed_cb (GtkWidget *widget, gpointer data)
+{
+    GtkComboBox *cbox = GTK_COMBO_BOX (widget);
+    CustomerWindow *cw = data;
+
+    if (!cw) return;
+    if (!cbox) return;
+
+    cw->taxtable = gnc_simple_combo_get_value (cbox);
+}
+
+static void
+gnc_customer_window_close_handler (gpointer user_data)
+{
+    CustomerWindow *cw = user_data;
+
+    gtk_widget_destroy (cw->dialog);
+    // cw has already been freed by this point.
+    // cw->dialog = NULL;
+}
+
+static void
+gnc_customer_window_refresh_handler (GHashTable *changes, gpointer user_data)
+{
+    CustomerWindow *cw = user_data;
+    const EventInfo *info;
+    GncCustomer *customer = cw_get_customer (cw);
+
+    /* If there isn't a customer behind us, close down */
+    if (!customer)
+    {
+        gnc_close_gui_component (cw->component_id);
+        return;
+    }
+
+    /* Next, close if this is a destroy event */
+    if (changes)
+    {
+        info = gnc_gui_get_entity_events (changes, &cw->customer_guid);
+        if (info && (info->event_mask & QOF_EVENT_DESTROY))
+        {
+            gnc_close_gui_component (cw->component_id);
+            return;
+        }
+    }
+}
+
+static gboolean
+find_handler (gpointer find_data, gpointer user_data)
+{
+    const GncGUID *customer_guid = find_data;
+    CustomerWindow *cw = user_data;
+
+    return(cw && guid_equal(&cw->customer_guid, customer_guid));
+}
+
+static CustomerWindow *
+gnc_customer_new_window (QofBook *bookp, GncCustomer *cust)
+{
+    CustomerWindow *cw;
+    GtkBuilder *builder;
+    GtkWidget *hbox, *edit;
+    gnc_commodity *currency;
+    GNCPrintAmountInfo print_info;
+
+    /*
+     * Find an existing window for this customer.  If found, bring it to
+     * the front.
+     */
+    if (cust)
+    {
+        GncGUID customer_guid;
+
+        customer_guid = *gncCustomerGetGUID(cust);
+        cw = gnc_find_first_gui_component (DIALOG_EDIT_CUSTOMER_CM_CLASS,
+                                           find_handler, &customer_guid);
+        if (cw)
+        {
+            gtk_window_present (GTK_WINDOW(cw->dialog));
+            return(cw);
+        }
+    }
+
+    /* Find the default currency */
+    if (cust)
+        currency = gncCustomerGetCurrency (cust);
+    else
+        currency = gnc_default_currency ();
+
+    /*
+     * No existing customer window found.  Build a new one.
+     */
+    cw = g_new0 (CustomerWindow, 1);
+
+    cw->book = bookp;
+
+    /* Find the dialog */
+    builder = gtk_builder_new();
+    gnc_builder_add_from_file (builder, "dialog-customer.glade", "terms_store");
+    gnc_builder_add_from_file (builder, "dialog-customer.glade", "tax_included_store");
+    gnc_builder_add_from_file (builder, "dialog-customer.glade", "taxtable_store");
+    gnc_builder_add_from_file (builder, "dialog-customer.glade", "customer_dialog");
+    cw->dialog = GTK_WIDGET (gtk_builder_get_object (builder, "customer_dialog"));
+
+    // Set the style context for this dialog so it can be easily manipulated with css
+    gnc_widget_set_style_context (GTK_WIDGET(cw->dialog), "GncCustomerDialog");
+
+    g_object_set_data (G_OBJECT (cw->dialog), "dialog_info", cw);
+
+    /* Get entry points */
+    cw->id_entry = GTK_WIDGET (gtk_builder_get_object (builder, "id_entry"));
+    cw->company_entry = GTK_WIDGET (gtk_builder_get_object (builder, "company_entry"));
+
+    cw->name_entry = GTK_WIDGET (gtk_builder_get_object (builder, "name_entry"));
+    cw->addr1_entry = GTK_WIDGET (gtk_builder_get_object (builder, "addr1_entry"));
+    cw->addr2_entry = GTK_WIDGET (gtk_builder_get_object (builder, "addr2_entry"));
+    cw->addr3_entry = GTK_WIDGET (gtk_builder_get_object (builder, "addr3_entry"));
+    cw->addr4_entry = GTK_WIDGET (gtk_builder_get_object (builder, "addr4_entry"));
+    cw->phone_entry = GTK_WIDGET (gtk_builder_get_object (builder, "phone_entry"));
+    cw->fax_entry = GTK_WIDGET (gtk_builder_get_object (builder, "fax_entry"));
+    cw->email_entry = GTK_WIDGET (gtk_builder_get_object (builder, "email_entry"));
+
+    cw->shipname_entry = GTK_WIDGET (gtk_builder_get_object (builder, "shipname_entry"));
+    cw->shipaddr1_entry = GTK_WIDGET (gtk_builder_get_object (builder, "shipaddr1_entry"));
+    cw->shipaddr2_entry = GTK_WIDGET (gtk_builder_get_object (builder, "shipaddr2_entry"));
+    cw->shipaddr3_entry = GTK_WIDGET (gtk_builder_get_object (builder, "shipaddr3_entry"));
+    cw->shipaddr4_entry = GTK_WIDGET (gtk_builder_get_object (builder, "shipaddr4_entry"));
+    cw->shipphone_entry = GTK_WIDGET (gtk_builder_get_object (builder, "shipphone_entry"));
+    cw->shipfax_entry = GTK_WIDGET (gtk_builder_get_object (builder, "shipfax_entry"));
+    cw->shipemail_entry = GTK_WIDGET (gtk_builder_get_object (builder, "shipemail_entry"));
+
+    cw->active_check = GTK_WIDGET (gtk_builder_get_object (builder, "active_check"));
+    cw->taxincluded_menu = GTK_WIDGET (gtk_builder_get_object (builder, "tax_included_menu"));
+    cw->notes_text = GTK_WIDGET (gtk_builder_get_object (builder, "notes_text"));
+
+    cw->terms_menu = GTK_WIDGET (gtk_builder_get_object (builder, "terms_menu"));
+
+    cw->taxtable_check = GTK_WIDGET (gtk_builder_get_object (builder, "taxtable_button"));
+    cw->taxtable_menu = GTK_WIDGET (gtk_builder_get_object (builder, "taxtable_menu"));
+
+    /* Currency */
+    edit = gnc_currency_edit_new();
+    gnc_currency_edit_set_currency (GNC_CURRENCY_EDIT(edit), currency);
+    cw->currency_edit = edit;
+
+    hbox = GTK_WIDGET (gtk_builder_get_object (builder, "currency_box"));
+    gtk_box_pack_start (GTK_BOX (hbox), edit, TRUE, TRUE, 0);
+
+    /* DISCOUNT: Percentage Value */
+    edit = gnc_amount_edit_new();
+    gnc_amount_edit_set_evaluate_on_enter (GNC_AMOUNT_EDIT (edit), TRUE);
+    print_info = gnc_integral_print_info ();
+    print_info.max_decimal_places = 5;
+    gnc_amount_edit_set_print_info (GNC_AMOUNT_EDIT (edit), print_info);
+    gnc_amount_edit_set_fraction (GNC_AMOUNT_EDIT (edit), 100000);
+    cw->discount_amount = edit;
+    gtk_widget_show (edit);
+
+    hbox = GTK_WIDGET (gtk_builder_get_object (builder, "discount_box"));
+    gtk_box_pack_start (GTK_BOX (hbox), edit, TRUE, TRUE, 0);
+
+    /* CREDIT: Monetary Value */
+    edit = gnc_amount_edit_new();
+    print_info = gnc_commodity_print_info (currency, FALSE);
+    gnc_amount_edit_set_evaluate_on_enter (GNC_AMOUNT_EDIT (edit), TRUE);
+    gnc_amount_edit_set_print_info (GNC_AMOUNT_EDIT (edit), print_info);
+    gnc_amount_edit_set_fraction (GNC_AMOUNT_EDIT (edit),
+                                  gnc_commodity_get_fraction (currency));
+    cw->credit_amount = edit;
+    gtk_widget_show (edit);
+
+    hbox = GTK_WIDGET (gtk_builder_get_object (builder, "credit_box"));
+    gtk_box_pack_start (GTK_BOX (hbox), edit, TRUE, TRUE, 0);
+
+    /* Setup signals */
+    gtk_builder_connect_signals_full( builder,
+                                      gnc_builder_connect_full_func,
+                                      cw);
+
+    /* Setup initial values */
+    if (cust != NULL)
+    {
+        GtkTextBuffer* text_buffer;
+        GncAddress *addr, *shipaddr;
+        const char *string;
+
+        cw->dialog_type = EDIT_CUSTOMER;
+        cw->customer_guid = *gncCustomerGetGUID (cust);
+
+        addr = gncCustomerGetAddr (cust);
+        shipaddr = gncCustomerGetShipAddr (cust);
+
+        gtk_entry_set_text (GTK_ENTRY (cw->id_entry), gncCustomerGetID (cust));
+        gtk_entry_set_text (GTK_ENTRY (cw->company_entry), gncCustomerGetName (cust));
+
+        /* Setup Address */
+        gtk_entry_set_text (GTK_ENTRY (cw->name_entry), gncAddressGetName (addr));
+        gtk_entry_set_text (GTK_ENTRY (cw->addr1_entry), gncAddressGetAddr1 (addr));
+        gtk_entry_set_text (GTK_ENTRY (cw->addr2_entry), gncAddressGetAddr2 (addr));
+        gtk_entry_set_text (GTK_ENTRY (cw->addr3_entry), gncAddressGetAddr3 (addr));
+        gtk_entry_set_text (GTK_ENTRY (cw->addr4_entry), gncAddressGetAddr4 (addr));
+        gtk_entry_set_text (GTK_ENTRY (cw->phone_entry), gncAddressGetPhone (addr));
+        gtk_entry_set_text (GTK_ENTRY (cw->fax_entry), gncAddressGetFax (addr));
+        gtk_entry_set_text (GTK_ENTRY (cw->email_entry), gncAddressGetEmail (addr));
+
+        /* Setup Ship-to Address */
+        gtk_entry_set_text (GTK_ENTRY (cw->shipname_entry), gncAddressGetName (shipaddr));
+        gtk_entry_set_text (GTK_ENTRY (cw->shipaddr1_entry), gncAddressGetAddr1 (shipaddr));
+        gtk_entry_set_text (GTK_ENTRY (cw->shipaddr2_entry), gncAddressGetAddr2 (shipaddr));
+        gtk_entry_set_text (GTK_ENTRY (cw->shipaddr3_entry), gncAddressGetAddr3 (shipaddr));
+        gtk_entry_set_text (GTK_ENTRY (cw->shipaddr4_entry), gncAddressGetAddr4 (shipaddr));
+        gtk_entry_set_text (GTK_ENTRY (cw->shipphone_entry), gncAddressGetPhone (shipaddr));
+        gtk_entry_set_text (GTK_ENTRY (cw->shipfax_entry), gncAddressGetFax (shipaddr));
+        gtk_entry_set_text (GTK_ENTRY (cw->shipemail_entry), gncAddressGetEmail (shipaddr));
+
+        /* Set toggle buttons */
+        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (cw->active_check),
+                                      gncCustomerGetActive (cust));
+
+        string = gncCustomerGetNotes (cust);
+        text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW(cw->notes_text));
+        gtk_text_buffer_set_text (text_buffer, string, -1);
+
+        cw->component_id =
+            gnc_register_gui_component (DIALOG_EDIT_CUSTOMER_CM_CLASS,
+                                        gnc_customer_window_refresh_handler,
+                                        gnc_customer_window_close_handler,
+                                        cw);
+        cw->terms = gncCustomerGetTerms (cust);
+
+    }
+    else
+    {
+        cust = gncCustomerCreate (bookp);
+        cw->customer_guid = *gncCustomerGetGUID (cust);
+
+        cw->dialog_type = NEW_CUSTOMER;
+        cw->component_id =
+            gnc_register_gui_component (DIALOG_NEW_CUSTOMER_CM_CLASS,
+                                        gnc_customer_window_refresh_handler,
+                                        gnc_customer_window_close_handler,
+                                        cw);
+
+        /* XXX: get the global-default terms */
+        cw->terms = NULL;
+    }
+
+    /* I know that cust exists here -- either passed in or just created */
+
+    cw->taxincluded = gncCustomerGetTaxIncluded (cust);
+    gnc_taxincluded_combo (GTK_COMBO_BOX(cw->taxincluded_menu), cw->taxincluded);
+    gnc_billterms_combo (GTK_COMBO_BOX(cw->terms_menu), bookp, TRUE, cw->terms);
+
+    cw->taxtable = gncCustomerGetTaxTable (cust);
+    gnc_taxtables_combo (GTK_COMBO_BOX(cw->taxtable_menu), bookp, TRUE, cw->taxtable);
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (cw->taxtable_check),
+                                  gncCustomerGetTaxTableOverride (cust));
+    gnc_customer_taxtable_check_cb (GTK_TOGGLE_BUTTON (cw->taxtable_check), cw);
+
+    /* Set up the addr line quickfill */
+    cw->addr2_quickfill = gnc_get_shared_address_addr2_quickfill(cw->book, ADDR_QUICKFILL);
+    cw->addr3_quickfill = gnc_get_shared_address_addr3_quickfill(cw->book, ADDR_QUICKFILL);
+    cw->addr4_quickfill = gnc_get_shared_address_addr4_quickfill(cw->book, ADDR_QUICKFILL);
+
+    /* Set the Discount, and Credit amounts */
+    gnc_amount_edit_set_amount (GNC_AMOUNT_EDIT (cw->discount_amount),
+                                gncCustomerGetDiscount (cust));
+    gnc_amount_edit_set_amount (GNC_AMOUNT_EDIT (cw->credit_amount),
+                                gncCustomerGetCredit (cust));
+
+    gnc_gui_component_watch_entity_type (cw->component_id,
+                                         GNC_CUSTOMER_MODULE_NAME,
+                                         QOF_EVENT_MODIFY | QOF_EVENT_DESTROY);
+
+    gtk_widget_show_all (cw->dialog);
+    g_object_unref(G_OBJECT(builder));
+
+    return cw;
+}
+
+CustomerWindow *
+gnc_ui_customer_edit (GncCustomer *cust)
+{
+    CustomerWindow *cw;
+
+    if (!cust) return NULL;
+
+    cw = gnc_customer_new_window (gncCustomerGetBook(cust), cust);
+
+    return cw;
+}
+
+CustomerWindow *
+gnc_ui_customer_new (QofBook *bookp)
+{
+    CustomerWindow *cw;
+
+    /* Make sure required options exist */
+    if (!bookp) return NULL;
+
+    cw = gnc_customer_new_window (bookp, NULL);
+
+    return cw;
+}
+
+/* Functions for customer selection widgets */
+
+static void
+invoice_customer_cb (gpointer *cust_p, gpointer user_data)
+{
+    struct _customer_select_window *sw = user_data;
+    GncOwner owner;
+    GncCustomer *cust;
+
+    g_return_if_fail (cust_p && user_data);
+
+    cust = *cust_p;
+
+    if (!cust)
+        return;
+
+    gncOwnerInitCustomer (&owner, cust);
+    gnc_invoice_search (NULL, &owner, sw->book);
+    return;
+}
+
+static void
+order_customer_cb (gpointer *cust_p, gpointer user_data)
+{
+    struct _customer_select_window *sw = user_data;
+    GncOwner owner;
+    GncCustomer *cust;
+
+    g_return_if_fail (cust_p && user_data);
+
+    cust = *cust_p;
+
+    if (!cust)
+        return;
+
+    gncOwnerInitCustomer (&owner, cust);
+    gnc_order_search (NULL, &owner, sw->book);
+    return;
+}
+
+static void
+jobs_customer_cb (gpointer *cust_p, gpointer user_data)
+{
+    struct _customer_select_window *sw = user_data;
+    GncOwner owner;
+    GncCustomer *cust;
+
+    g_return_if_fail (cust_p && user_data);
+
+    cust = *cust_p;
+
+    if (!cust)
+        return;
+
+    gncOwnerInitCustomer (&owner, cust);
+    gnc_job_search (NULL, &owner, sw->book);
+    return;
+}
+
+static void
+payment_customer_cb (gpointer *cust_p, gpointer user_data)
+{
+    struct _customer_select_window *sw = user_data;
+    GncOwner owner;
+    GncCustomer *cust;
+
+    g_return_if_fail (cust_p && user_data);
+
+    cust = *cust_p;
+
+    if (!cust)
+        return;
+
+    gncOwnerInitCustomer (&owner, cust);
+    gnc_ui_payment_new (&owner, sw->book);
+    return;
+}
+
+static void
+edit_customer_cb (gpointer *cust_p, gpointer user_data)
+{
+    GncCustomer *cust;
+
+    g_return_if_fail (cust_p);
+    cust = *cust_p;
+
+    if (!cust)
+        return;
+
+    gnc_ui_customer_edit (cust);
+
+    return;
+}
+
+static gpointer
+new_customer_cb (gpointer user_data)
+{
+    struct _customer_select_window *sw = user_data;
+    CustomerWindow *cw;
+
+    g_return_val_if_fail (sw, NULL);
+
+    cw = gnc_ui_customer_new (sw->book);
+    return cw_get_customer (cw);
+}
+
+static void
+free_userdata_cb (gpointer user_data)
+{
+    struct _customer_select_window *sw = user_data;
+
+    g_return_if_fail (sw);
+
+    qof_query_destroy (sw->q);
+    g_free (sw);
+}
+
+GNCSearchWindow *
+gnc_customer_search (GncCustomer *start, QofBook *book)
+{
+    QofQuery *q, *q2 = NULL;
+    QofIdType type = GNC_CUSTOMER_MODULE_NAME;
+    struct _customer_select_window *sw;
+    static GList *params = NULL;
+    static GList *columns = NULL;
+    static GNCSearchCallbackButton buttons[] =
+    {
+        { N_("View/Edit Customer"), edit_customer_cb, NULL, TRUE},
+        { N_("Customer's Jobs"), jobs_customer_cb, NULL, TRUE},
+        //    { N_("Customer's Orders"), order_customer_cb, NULL, TRUE},
+        { N_("Customer's Invoices"), invoice_customer_cb, NULL, TRUE},
+        { N_("Process Payment"), payment_customer_cb, NULL, FALSE},
+        { NULL },
+    };
+    (void)order_customer_cb;
+
+    g_return_val_if_fail (book, NULL);
+
+    /* Build parameter list in reverse order */
+    if (params == NULL)
+    {
+        params = gnc_search_param_prepend (params, _("Shipping Contact"), NULL, type,
+                                           CUSTOMER_SHIPADDR, ADDRESS_NAME, NULL);
+        params = gnc_search_param_prepend (params, _("Billing Contact"), NULL, type,
+                                           CUSTOMER_ADDR, ADDRESS_NAME, NULL);
+        params = gnc_search_param_prepend (params, _("Customer ID"), NULL, type,
+                                           CUSTOMER_ID, NULL);
+        params = gnc_search_param_prepend (params, _("Company Name"), NULL, type,
+                                           CUSTOMER_NAME, NULL);
+    }
+
+    /* Build the column list in reverse order */
+    if (columns == NULL)
+    {
+        columns = gnc_search_param_prepend (columns, _("Contact"), NULL, type,
+                                            CUSTOMER_ADDR, ADDRESS_NAME, NULL);
+        columns = gnc_search_param_prepend (columns, _("Company"), NULL, type,
+                                            CUSTOMER_NAME, NULL);
+        columns = gnc_search_param_prepend (columns, _("ID #"), NULL, type,
+                                            CUSTOMER_ID, NULL);
+    }
+
+    /* Build the queries */
+    q = qof_query_create_for (type);
+    qof_query_set_book (q, book);
+
+#if 0
+    if (start)
+    {
+        q2 = qof_query_copy (q);
+        qof_query_add_guid_match (q2, g_slist_prepend (NULL, QOF_PARAM_GUID),
+                                  gncCustomerGetGUID (start), QOF_QUERY_AND);
+    }
+#endif
+
+    /* launch select dialog and return the result */
+    sw = g_new0 (struct _customer_select_window, 1);
+
+    sw->book = book;
+    sw->q = q;
+
+    return gnc_search_dialog_create (type, _("Find Customer"),
+                                     params, columns, q, q2, buttons, NULL,
+                                     new_customer_cb, sw, free_userdata_cb,
+                                     GNC_PREFS_GROUP_SEARCH, NULL,
+                                     "GncFindCustomerDialog");
+}
+
+GNCSearchWindow *
+gnc_customer_search_select (gpointer start, gpointer book)
+{
+    if (!book) return NULL;
+
+    return gnc_customer_search (start, book);
+}
+
+GNCSearchWindow *
+gnc_customer_search_edit (gpointer start, gpointer book)
+{
+    if (start)
+        gnc_ui_customer_edit (start);
+
+    return NULL;
+}
+
+static gboolean
+idle_select_region_addr2(gpointer user_data)
+{
+    CustomerWindow *wdata = user_data;
+    g_return_val_if_fail(user_data, FALSE);
+
+    /* g_warning("Selection start=%d end=%d",wdata->addrX_start_selection, wdata->addrX_end_selection); */
+
+    gtk_editable_select_region(GTK_EDITABLE(wdata->addr2_entry),
+                               wdata->addrX_start_selection,
+                               wdata->addrX_end_selection);
+
+    wdata->addrX_selection_source_id = 0;
+    return FALSE;
+}
+
+static gboolean
+idle_select_region_addr3(gpointer user_data)
+{
+    CustomerWindow *wdata = user_data;
+    g_return_val_if_fail(user_data, FALSE);
+
+    gtk_editable_select_region(GTK_EDITABLE(wdata->addr3_entry),
+                               wdata->addrX_start_selection,
+                               wdata->addrX_end_selection);
+
+    wdata->addrX_selection_source_id = 0;
+    return FALSE;
+}
+static gboolean
+idle_select_region_addr4(gpointer user_data)
+{
+    CustomerWindow *wdata = user_data;
+    g_return_val_if_fail(user_data, FALSE);
+
+    gtk_editable_select_region(GTK_EDITABLE(wdata->addr4_entry),
+                               wdata->addrX_start_selection,
+                               wdata->addrX_end_selection);
+    wdata->addrX_selection_source_id = 0;
+    return FALSE;
+}
+
+static gboolean
+idle_select_region_shipaddr2(gpointer user_data)
+{
+    CustomerWindow *wdata = user_data;
+    g_return_val_if_fail(user_data, FALSE);
+
+    gtk_editable_select_region(GTK_EDITABLE(wdata->shipaddr2_entry),
+                               wdata->addrX_start_selection,
+                               wdata->addrX_end_selection);
+
+    wdata->addrX_selection_source_id = 0;
+    return FALSE;
+}
+
+static gboolean
+idle_select_region_shipaddr3(gpointer user_data)
+{
+    CustomerWindow *wdata = user_data;
+    g_return_val_if_fail(user_data, FALSE);
+
+    gtk_editable_select_region(GTK_EDITABLE(wdata->shipaddr3_entry),
+                               wdata->addrX_start_selection,
+                               wdata->addrX_end_selection);
+
+    wdata->addrX_selection_source_id = 0;
+    return FALSE;
+}
+static gboolean
+idle_select_region_shipaddr4(gpointer user_data)
+{
+    CustomerWindow *wdata = user_data;
+    g_return_val_if_fail(user_data, FALSE);
+
+    gtk_editable_select_region(GTK_EDITABLE(wdata->shipaddr4_entry),
+                               wdata->addrX_start_selection,
+                               wdata->addrX_end_selection);
+    wdata->addrX_selection_source_id = 0;
+    return FALSE;
+}
+
+/* Implementation of the steps common to all address lines. Returns
+ * TRUE if anything was inserted by quickfill, otherwise FALSE. */
+static gboolean
+gnc_customer_addr_common_insert_cb(GtkEditable *editable,
+                                   gchar *new_text, gint new_text_length,
+                                   gint *position, gpointer user_data, QuickFill *qf)
+{
+    CustomerWindow *wdata = user_data;
+    gchar *concatenated_text;
+    QuickFill *match;
+    gint prefix_len, concatenated_text_len;
+
+    if (new_text_length <= 0)
+        return FALSE;
+
+    /*g_warning("In gnc_customer_addr_common_insert_cb");*/
+
+    {
+        gchar *suffix = gtk_editable_get_chars(editable, *position, -1);
+        /* If we are inserting in the middle, do nothing */
+        if (*suffix)
+        {
+            g_free(suffix);
+            return FALSE;
+        }
+        g_free(suffix);
+    }
+
+    {
+        gchar *prefix = gtk_editable_get_chars(editable, 0, *position);
+        prefix_len = strlen(prefix);
+        concatenated_text = g_strconcat(prefix, new_text, (gchar*) NULL);
+        concatenated_text_len = prefix_len + new_text_length;
+        g_free(prefix);
+    }
+
+    match = gnc_quickfill_get_string_match(qf, concatenated_text);
+    g_free(concatenated_text);
+    if (match)
+    {
+        const char* match_str = gnc_quickfill_string(match);
+        if (match_str)
+        {
+            gint match_str_len = strlen(match_str);
+            if (match_str_len > concatenated_text_len)
+            {
+                /* g_warning("Got match \"%s\" match_str_len=%d new_text=%s position=%d prefix_len=%d", match_str, match_str_len, new_text, *position, prefix_len); */
+
+                g_signal_handlers_block_matched (G_OBJECT (editable),
+                                                 G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, user_data);
+
+                gtk_editable_insert_text(editable,
+                                         match_str + prefix_len,
+                                         match_str_len - prefix_len,
+                                         position);
+
+                g_signal_handlers_unblock_matched (G_OBJECT (editable),
+                                                   G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, user_data);
+
+                /* stop the current insert */
+                g_signal_stop_emission_by_name (G_OBJECT (editable), "insert_text");
+
+                /* set the position */
+                *position = concatenated_text_len;
+
+                /* select region on idle, because it would be reset once this function
+                   finishes */
+                wdata->addrX_start_selection = *position;
+                wdata->addrX_end_selection = -1;
+
+                return TRUE;
+            }
+        }
+    }
+    return FALSE;
+}
+
+void gnc_customer_addr2_insert_cb(GtkEditable *editable,
+                                  gchar *new_text, gint new_text_length,
+                                  gint *position, gpointer user_data)
+{
+    CustomerWindow *wdata = user_data;
+    gboolean r;
+
+    /* The handling common to all address lines is done in this other
+     * function. */
+    r = gnc_customer_addr_common_insert_cb(editable, new_text, new_text_length,
+                                           position, user_data, wdata->addr2_quickfill);
+
+    /* Did we insert something? Then set up the correct idle handler */
+    if (r)
+    {
+        /* select region on idle, because it would be reset once this function
+           finishes */
+        wdata->addrX_selection_source_id = g_idle_add(idle_select_region_addr2,
+                                           user_data);
+    }
+}
+
+void gnc_customer_addr3_insert_cb(GtkEditable *editable,
+                                  gchar *new_text, gint new_text_length,
+                                  gint *position, gpointer user_data)
+{
+    CustomerWindow *wdata = user_data;
+    gboolean r;
+
+    /* The handling common to all address lines is done in this other
+     * function. */
+    r = gnc_customer_addr_common_insert_cb(editable, new_text, new_text_length,
+                                           position, user_data, wdata->addr3_quickfill);
+
+    /* Did we insert something? Then set up the correct idle handler */
+    if (r)
+    {
+        wdata->addrX_selection_source_id = g_idle_add(idle_select_region_addr3,
+                                           user_data);
+    }
+}
+
+void gnc_customer_addr4_insert_cb(GtkEditable *editable,
+                                  gchar *new_text, gint new_text_length,
+                                  gint *position, gpointer user_data)
+{
+    CustomerWindow *wdata = user_data;
+    gboolean r;
+
+    /* The handling common to all address lines is done in this other
+     * function. */
+    r = gnc_customer_addr_common_insert_cb(editable, new_text, new_text_length,
+                                           position, user_data, wdata->addr4_quickfill);
+
+    /* Did we insert something? Then set up the correct idle handler */
+    if (r)
+    {
+        wdata->addrX_selection_source_id = g_idle_add(idle_select_region_addr4,
+                                           user_data);
+    }
+}
+
+void gnc_customer_shipaddr2_insert_cb(GtkEditable *editable,
+                                      gchar *new_text, gint new_text_length,
+                                      gint *position, gpointer user_data)
+{
+    CustomerWindow *wdata = user_data;
+    gboolean r;
+
+    /* The handling common to all address lines is done in this other
+     * function. */
+    r = gnc_customer_addr_common_insert_cb(editable, new_text, new_text_length,
+                                           position, user_data, wdata->addr2_quickfill);
+
+    /* Did we insert something? Then set up the correct idle handler */
+    if (r)
+    {
+        wdata->addrX_selection_source_id = g_idle_add(idle_select_region_shipaddr2,
+                                           user_data);
+    }
+}
+
+void gnc_customer_shipaddr3_insert_cb(GtkEditable *editable,
+                                      gchar *new_text, gint new_text_length,
+                                      gint *position, gpointer user_data)
+{
+    CustomerWindow *wdata = user_data;
+    gboolean r;
+
+    /* The handling common to all address lines is done in this other
+     * function. */
+    r = gnc_customer_addr_common_insert_cb(editable, new_text, new_text_length,
+                                           position, user_data, wdata->addr3_quickfill);
+
+    /* Did we insert something? Then set up the correct idle handler */
+    if (r)
+    {
+        wdata->addrX_selection_source_id = g_idle_add(idle_select_region_shipaddr3,
+                                           user_data);
+    }
+}
+
+void gnc_customer_shipaddr4_insert_cb(GtkEditable *editable,
+                                      gchar *new_text, gint new_text_length,
+                                      gint *position, gpointer user_data)
+{
+    CustomerWindow *wdata = user_data;
+    gboolean r;
+
+    /* The handling common to all address lines is done in this other
+     * function. */
+    r = gnc_customer_addr_common_insert_cb(editable, new_text, new_text_length,
+                                           position, user_data, wdata->addr4_quickfill);
+
+    /* Did we insert something? Then set up the correct idle handler */
+    if (r)
+    {
+        wdata->addrX_selection_source_id = g_idle_add(idle_select_region_shipaddr4,
+                                           user_data);
+    }
+}
+
+static gboolean
+gnc_customer_common_key_press_cb( GtkEntry *entry,
+                                  GdkEventKey *event,
+                                  gpointer user_data, GtkWidget* editable )
+{
+    gboolean done_with_input = FALSE;
+
+    /* Most "special" keys are allowed to be handled directly by
+     * the entry's key press handler, but in some cases that doesn't
+     * seem to work right, so handle them here.
+     */
+    switch ( event->keyval )
+    {
+    case GDK_KEY_Tab:
+    case GDK_KEY_ISO_Left_Tab:
+        if ( !( event->state & GDK_SHIFT_MASK) )    /* Complete on Tab,
+                                                  * but not Shift-Tab */
+        {
+            /* NOT done with input, though, since we need to focus to the next
+             * field.  Unselect the current field, though.
+             */
+            gtk_editable_select_region( GTK_EDITABLE(editable),
+                                        0, 0 );
+        }
+        break;
+    }
+
+    return( done_with_input );
+}
+gboolean
+gnc_customer_addr2_key_press_cb( GtkEntry *entry,
+                                 GdkEventKey *event,
+                                 gpointer user_data )
+{
+    CustomerWindow *wdata = user_data;
+    return gnc_customer_common_key_press_cb(entry, event, user_data,
+                                            wdata->addr2_entry);
+}
+gboolean
+gnc_customer_addr3_key_press_cb( GtkEntry *entry,
+                                 GdkEventKey *event,
+                                 gpointer user_data )
+{
+    CustomerWindow *wdata = user_data;
+    return gnc_customer_common_key_press_cb(entry, event, user_data,
+                                            wdata->addr3_entry);
+}
+gboolean
+gnc_customer_addr4_key_press_cb( GtkEntry *entry,
+                                 GdkEventKey *event,
+                                 gpointer user_data )
+{
+    CustomerWindow *wdata = user_data;
+    return gnc_customer_common_key_press_cb(entry, event, user_data,
+                                            wdata->addr4_entry);
+}
+gboolean
+gnc_customer_shipaddr2_key_press_cb( GtkEntry *entry,
+                                     GdkEventKey *event,
+                                     gpointer user_data )
+{
+    CustomerWindow *wdata = user_data;
+    return gnc_customer_common_key_press_cb(entry, event, user_data,
+                                            wdata->shipaddr2_entry);
+}
+gboolean
+gnc_customer_shipaddr3_key_press_cb( GtkEntry *entry,
+                                     GdkEventKey *event,
+                                     gpointer user_data )
+{
+    CustomerWindow *wdata = user_data;
+    return gnc_customer_common_key_press_cb(entry, event, user_data,
+                                            wdata->shipaddr3_entry);
+}
+gboolean
+gnc_customer_shipaddr4_key_press_cb( GtkEntry *entry,
+                                     GdkEventKey *event,
+                                     gpointer user_data )
+{
+    CustomerWindow *wdata = user_data;
+    return gnc_customer_common_key_press_cb(entry, event, user_data,
+                                            wdata->shipaddr4_entry);
+}
diff --git a/src/gnome/dialog-customer.h b/gnucash/gnome/dialog-customer.h
similarity index 100%
rename from src/gnome/dialog-customer.h
rename to gnucash/gnome/dialog-customer.h
diff --git a/src/gnome/dialog-date-close.c b/gnucash/gnome/dialog-date-close.c
similarity index 100%
rename from src/gnome/dialog-date-close.c
rename to gnucash/gnome/dialog-date-close.c
diff --git a/src/gnome/dialog-date-close.h b/gnucash/gnome/dialog-date-close.h
similarity index 100%
rename from src/gnome/dialog-date-close.h
rename to gnucash/gnome/dialog-date-close.h
diff --git a/src/gnome/dialog-employee.c b/gnucash/gnome/dialog-employee.c
similarity index 100%
rename from src/gnome/dialog-employee.c
rename to gnucash/gnome/dialog-employee.c
diff --git a/src/gnome/dialog-employee.h b/gnucash/gnome/dialog-employee.h
similarity index 100%
rename from src/gnome/dialog-employee.h
rename to gnucash/gnome/dialog-employee.h
diff --git a/src/gnome/dialog-fincalc.c b/gnucash/gnome/dialog-fincalc.c
similarity index 100%
rename from src/gnome/dialog-fincalc.c
rename to gnucash/gnome/dialog-fincalc.c
diff --git a/src/gnome/dialog-fincalc.h b/gnucash/gnome/dialog-fincalc.h
similarity index 100%
rename from src/gnome/dialog-fincalc.h
rename to gnucash/gnome/dialog-fincalc.h
diff --git a/src/gnome/dialog-find-account.c b/gnucash/gnome/dialog-find-account.c
similarity index 100%
rename from src/gnome/dialog-find-account.c
rename to gnucash/gnome/dialog-find-account.c
diff --git a/src/gnome/dialog-find-account.h b/gnucash/gnome/dialog-find-account.h
similarity index 100%
rename from src/gnome/dialog-find-account.h
rename to gnucash/gnome/dialog-find-account.h
diff --git a/src/gnome/dialog-find-transactions.c b/gnucash/gnome/dialog-find-transactions.c
similarity index 100%
rename from src/gnome/dialog-find-transactions.c
rename to gnucash/gnome/dialog-find-transactions.c
diff --git a/src/gnome/dialog-find-transactions.h b/gnucash/gnome/dialog-find-transactions.h
similarity index 100%
rename from src/gnome/dialog-find-transactions.h
rename to gnucash/gnome/dialog-find-transactions.h
diff --git a/src/gnome/dialog-find-transactions2.c b/gnucash/gnome/dialog-find-transactions2.c
similarity index 100%
rename from src/gnome/dialog-find-transactions2.c
rename to gnucash/gnome/dialog-find-transactions2.c
diff --git a/src/gnome/dialog-find-transactions2.h b/gnucash/gnome/dialog-find-transactions2.h
similarity index 100%
rename from src/gnome/dialog-find-transactions2.h
rename to gnucash/gnome/dialog-find-transactions2.h
diff --git a/src/gnome/dialog-imap-editor.c b/gnucash/gnome/dialog-imap-editor.c
similarity index 100%
rename from src/gnome/dialog-imap-editor.c
rename to gnucash/gnome/dialog-imap-editor.c
diff --git a/src/gnome/dialog-imap-editor.h b/gnucash/gnome/dialog-imap-editor.h
similarity index 100%
rename from src/gnome/dialog-imap-editor.h
rename to gnucash/gnome/dialog-imap-editor.h
diff --git a/src/gnome/dialog-invoice.c b/gnucash/gnome/dialog-invoice.c
similarity index 100%
rename from src/gnome/dialog-invoice.c
rename to gnucash/gnome/dialog-invoice.c
diff --git a/src/gnome/dialog-invoice.h b/gnucash/gnome/dialog-invoice.h
similarity index 100%
rename from src/gnome/dialog-invoice.h
rename to gnucash/gnome/dialog-invoice.h
diff --git a/src/gnome/dialog-job.c b/gnucash/gnome/dialog-job.c
similarity index 100%
rename from src/gnome/dialog-job.c
rename to gnucash/gnome/dialog-job.c
diff --git a/src/gnome/dialog-job.h b/gnucash/gnome/dialog-job.h
similarity index 100%
rename from src/gnome/dialog-job.h
rename to gnucash/gnome/dialog-job.h
diff --git a/src/gnome/dialog-lot-viewer.c b/gnucash/gnome/dialog-lot-viewer.c
similarity index 100%
rename from src/gnome/dialog-lot-viewer.c
rename to gnucash/gnome/dialog-lot-viewer.c
diff --git a/src/gnome/dialog-lot-viewer.h b/gnucash/gnome/dialog-lot-viewer.h
similarity index 100%
rename from src/gnome/dialog-lot-viewer.h
rename to gnucash/gnome/dialog-lot-viewer.h
diff --git a/gnucash/gnome/dialog-new-user.c b/gnucash/gnome/dialog-new-user.c
new file mode 100644
index 0000000..2b0ad3d
--- /dev/null
+++ b/gnucash/gnome/dialog-new-user.c
@@ -0,0 +1,163 @@
+/********************************************************************\
+ * dialog-new-user.c -- new user dialog for GnuCash                 *
+ * Copyright (C) 2001 Dave Peticolas <dave at krondo.com>              *
+ *                                                                  *
+ * 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 at gnu.org                   *
+\********************************************************************/
+
+#include "config.h"
+
+#include <gtk/gtk.h>
+#include <glib/gi18n.h>
+
+#include "dialog-new-user.h"
+#include "dialog-utils.h"
+#include "dialog-file-access.h"
+#include "assistant-hierarchy.h"
+#include "gnc-engine.h"
+#include "gnc-hooks.h"
+#include "gnc-ui.h"
+#include "gnc-file.h"
+#include "gnc-prefs.h"
+#include "gnc-main-window.h"
+#include "gnc-plugin-page-account-tree.h"
+#include "gnc-session.h"
+#include "gnc-ui-util.h" // for gnc_get_current_book
+
+/* This static indicates the debugging module that this .o belongs to.  */
+static QofLogModule log_module = GNC_MOD_GUI;
+
+/* function to open a qif import assistant */
+static void (*qifImportAssistantFcn)(void) = NULL;
+
+static void gnc_ui_new_user_cancel_dialog (void);
+
+void
+gnc_new_user_dialog_register_qif_assistant (void (*cb_fcn)(void))
+{
+    g_return_if_fail (qifImportAssistantFcn == NULL);
+    qifImportAssistantFcn = cb_fcn;
+}
+
+void
+gnc_set_first_startup (gboolean first_startup)
+{
+    gnc_prefs_set_bool (GNC_PREFS_GROUP_NEW_USER, GNC_PREF_FIRST_STARTUP, first_startup);
+}
+
+static void
+after_hierarchy_assistant(void)
+{
+    gncp_new_user_finish ();
+    gnc_set_first_startup (FALSE);
+
+    qof_book_mark_session_dirty(gnc_get_current_book());
+    gnc_ui_file_access_for_save_as();
+}
+
+void
+gnc_ui_new_user_dialog (void)
+{
+    GtkWidget *dialog;
+    GtkWidget *new_accounts_button;
+    GtkWidget *import_qif_button;
+    GtkWidget *tutorial_button;
+    GtkBuilder  *builder;
+    gint result;
+
+    ENTER(" ");
+    builder = gtk_builder_new();
+    gnc_builder_add_from_file (builder, "dialog-new-user.glade", "new_user_dialog");
+
+    dialog = GTK_WIDGET(gtk_builder_get_object (builder, "new_user_dialog"));
+
+    // Set the style context for this dialog so it can be easily manipulated with css
+    gnc_widget_set_style_context (GTK_WIDGET(dialog), "GncNewUserDialog");
+
+    new_accounts_button = GTK_WIDGET(gtk_builder_get_object (builder, "new_accounts_button"));
+    import_qif_button = GTK_WIDGET(gtk_builder_get_object (builder, "import_qif_button"));
+    tutorial_button = GTK_WIDGET(gtk_builder_get_object (builder, "tutorial_button"));
+
+    /* Set the sensitivity of the qif-import button based on the availability
+     * of the qif-import assistant.
+     */
+    gtk_widget_set_sensitive (import_qif_button, (qifImportAssistantFcn != NULL));
+
+    result = gtk_dialog_run (GTK_DIALOG (dialog));
+    switch (result)
+    {
+    case GTK_RESPONSE_CANCEL:
+    case GTK_RESPONSE_DELETE_EVENT:
+        gnc_ui_new_user_cancel_dialog ();
+        break;
+    case GTK_RESPONSE_OK:
+        if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (new_accounts_button)))
+        {
+            gnc_ui_hierarchy_assistant_with_callback(TRUE, after_hierarchy_assistant);
+        }
+        else if ((qifImportAssistantFcn != NULL)
+                 && gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (import_qif_button)))
+        {
+            qifImportAssistantFcn();
+            gncp_new_user_finish ();
+        }
+        else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (tutorial_button)))
+        {
+            gnc_gnome_help (HF_GUIDE, NULL);
+            gncp_new_user_finish ();
+        }
+        break;
+    default:
+        g_print ("DEBUG: Response: %d", result);
+        g_assert_not_reached ();
+        break;
+    }
+
+    g_object_unref(G_OBJECT(builder));
+    gtk_widget_destroy (dialog);
+    LEAVE(" ");
+}
+
+static void
+gnc_ui_new_user_cancel_dialog (void)
+{
+    GtkWidget *dialog;
+    GtkBuilder  *builder;
+    gint result;
+    gboolean keepshowing;
+
+    builder = gtk_builder_new();
+    gnc_builder_add_from_file (builder, "dialog-new-user.glade", "new_user_cancel_dialog");
+
+    dialog = GTK_WIDGET(gtk_builder_get_object (builder, "new_user_cancel_dialog"));
+
+    result = gtk_dialog_run (GTK_DIALOG (dialog));
+    keepshowing = (result == GTK_RESPONSE_YES);
+
+    gnc_set_first_startup (keepshowing);
+    gncp_new_user_finish ();
+
+    g_object_unref(G_OBJECT(builder));
+    gtk_widget_destroy(dialog);
+}
+
+void
+gncp_new_user_finish (void)
+{
+    gnc_hook_run(HOOK_BOOK_OPENED, gnc_get_current_session());
+}
diff --git a/src/gnome/dialog-new-user.h b/gnucash/gnome/dialog-new-user.h
similarity index 100%
rename from src/gnome/dialog-new-user.h
rename to gnucash/gnome/dialog-new-user.h
diff --git a/gnucash/gnome/dialog-order.c b/gnucash/gnome/dialog-order.c
new file mode 100644
index 0000000..981ae91
--- /dev/null
+++ b/gnucash/gnome/dialog-order.c
@@ -0,0 +1,986 @@
+/*
+ * dialog-order.c -- Dialog for Order entry
+ * Copyright (C) 2001,2002 Derek Atkins
+ * Author: Derek Atkins <warlord at MIT.EDU>
+ *
+ * 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 at gnu.org
+ */
+
+#include "config.h"
+
+#include <gtk/gtk.h>
+#include <glib/gi18n.h>
+
+#include "dialog-utils.h"
+#include "gnc-component-manager.h"
+#include "gnc-date-edit.h"
+#include "gnc-ui.h"
+#include "gnc-gui-query.h"
+#include "gnc-ui-util.h"
+#include "qof.h"
+#include "gnucash-register.h"
+#include "gnucash-sheet.h"
+#include "dialog-search.h"
+#include "search-param.h"
+
+#include "gncOrder.h"
+#include "gncOrderP.h"
+
+#include "gncEntryLedger.h"
+
+#include "dialog-order.h"
+#include "dialog-invoice.h"
+#include "business-gnome-utils.h"
+#include "dialog-date-close.h"
+#include "gnc-general-search.h"
+
+#define DIALOG_NEW_ORDER_CM_CLASS "dialog-new-order"
+#define DIALOG_EDIT_ORDER_CM_CLASS "dialog-edit-order"
+#define DIALOG_VIEW_ORDER_CM_CLASS "dialog-view-order"
+
+#define GNC_PREFS_GROUP_SEARCH "dialogs.business.order-search"
+
+void gnc_order_window_ok_cb (GtkWidget *widget, gpointer data);
+void gnc_order_window_cancel_cb (GtkWidget *widget, gpointer data);
+void gnc_order_window_help_cb (GtkWidget *widget, gpointer data);
+void gnc_order_window_invoice_cb (GtkWidget *widget, gpointer data);
+void gnc_order_window_close_order_cb (GtkWidget *widget, gpointer data);
+void gnc_order_window_destroy_cb (GtkWidget *widget, gpointer data);
+
+typedef enum
+{
+    NEW_ORDER,
+    EDIT_ORDER,
+    VIEW_ORDER
+} OrderDialogType;
+
+struct _order_select_window
+{
+    QofBook *	book;
+    GncOwner *	owner;
+    QofQuery *	q;
+    GncOwner	owner_def;
+};
+
+struct _order_window
+{
+    GtkWidget *	dialog;
+
+    GtkWidget *	id_entry;
+    GtkWidget *	ref_entry;
+    GtkWidget *	notes_text;
+    GtkWidget *	opened_date;
+    GtkWidget *	closed_date;
+    GtkWidget *	active_check;
+
+    GtkWidget * cd_label;
+    GtkWidget * hide1;
+    GtkWidget * hide2;
+    GtkWidget * close_order_button;
+
+    GtkWidget *	owner_box;
+    GtkWidget *	owner_label;
+    GtkWidget *	owner_choice;
+
+    GnucashRegister *	reg;
+    GncEntryLedger *	ledger;
+
+    OrderDialogType	dialog_type;
+    GncGUID		order_guid;
+    gint		component_id;
+    QofBook *	book;
+    GncOrder *	created_order;
+    GncOwner	owner;
+
+};
+
+static void gnc_order_update_window (OrderWindow *ow);
+
+static GncOrder *
+ow_get_order (OrderWindow *ow)
+{
+    if (!ow)
+        return NULL;
+
+    return gncOrderLookup (ow->book, &ow->order_guid);
+}
+
+static void gnc_ui_to_order (OrderWindow *ow, GncOrder *order)
+{
+    GtkTextBuffer* text_buffer;
+    GtkTextIter start, end;
+    gchar *text;
+    Timespec ts;
+
+    /* Do nothing if this is view only */
+    if (ow->dialog_type == VIEW_ORDER)
+        return;
+
+    gnc_suspend_gui_refresh ();
+    gncOrderBeginEdit (order);
+
+    gncOrderSetID (order, gtk_editable_get_chars
+                   (GTK_EDITABLE (ow->id_entry), 0, -1));
+
+    text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW(ow->notes_text));
+    gtk_text_buffer_get_bounds (text_buffer, &start, &end);
+    text = gtk_text_buffer_get_text (text_buffer, &start, &end, FALSE);
+    gncOrderSetNotes (order, text);
+
+    gncOrderSetReference (order, gtk_editable_get_chars
+                          (GTK_EDITABLE (ow->ref_entry), 0, -1));
+
+    ts = gnc_date_edit_get_date_ts (GNC_DATE_EDIT (ow->opened_date));
+    gncOrderSetDateOpened (order, ts);
+
+    if (ow->active_check)
+        gncOrderSetActive (order, gtk_toggle_button_get_active
+                           (GTK_TOGGLE_BUTTON (ow->active_check)));
+
+    gnc_owner_get_owner (ow->owner_choice, &(ow->owner));
+    gncOrderSetOwner (order, &(ow->owner));
+
+    gncOrderCommitEdit (order);
+    gnc_resume_gui_refresh ();
+}
+
+static gboolean
+gnc_order_window_verify_ok (OrderWindow *ow)
+{
+    const char *res;
+
+    /* Check the ID */
+    res = gtk_entry_get_text (GTK_ENTRY (ow->id_entry));
+    if (g_strcmp0 (res, "") == 0)
+    {
+        gnc_error_dialog (ow->dialog, "%s",
+                          _("The Order must be given an ID."));
+        return FALSE;
+    }
+
+    /* Check the Owner */
+    gnc_owner_get_owner (ow->owner_choice, &(ow->owner));
+    res = gncOwnerGetName (&(ow->owner));
+    if (res == NULL || g_strcmp0 (res, "") == 0)
+    {
+        gnc_error_dialog (ow->dialog, "%s",
+                          _("You need to supply Billing Information."));
+        return FALSE;
+    }
+
+    return TRUE;
+}
+
+static gboolean
+gnc_order_window_ok_save (OrderWindow *ow)
+{
+    if (!gnc_entry_ledger_check_close (ow->dialog, ow->ledger))
+        return FALSE;
+
+    if (!gnc_order_window_verify_ok (ow))
+        return FALSE;
+
+    /* Now save it off */
+    {
+        GncOrder *order = ow_get_order (ow);
+        if (order)
+        {
+            gnc_ui_to_order (ow, order);
+
+        }
+        ow->created_order = order;
+    }
+    return TRUE;
+}
+
+void
+gnc_order_window_ok_cb (GtkWidget *widget, gpointer data)
+{
+    OrderWindow *ow = data;
+
+    if (!gnc_order_window_ok_save (ow))
+        return;
+
+    /* Ok, we don't need this anymore */
+    ow->order_guid = *guid_null ();
+
+    gnc_close_gui_component (ow->component_id);
+}
+
+void
+gnc_order_window_cancel_cb (GtkWidget *widget, gpointer data)
+{
+    OrderWindow *ow = data;
+
+    gnc_close_gui_component (ow->component_id);
+}
+
+void
+gnc_order_window_help_cb (GtkWidget *widget, gpointer data)
+{
+    gnc_gnome_help(HF_HELP, HL_USAGE_BILL);
+}
+
+void
+gnc_order_window_invoice_cb (GtkWidget *widget, gpointer data)
+{
+    OrderWindow *ow = data;
+
+    /* make sure we're ok */
+    if (!gnc_order_window_verify_ok (ow))
+        return;
+
+    /* Ok, go make an invoice */
+    gnc_invoice_search (NULL, &(ow->owner), ow->book);
+
+    /* refresh the window */
+    gnc_order_update_window (ow);
+}
+
+void
+gnc_order_window_close_order_cb (GtkWidget *widget, gpointer data)
+{
+    OrderWindow *ow = data;
+    GncOrder *order;
+    GList *entries;
+    char *message, *label;
+    gboolean non_inv = FALSE;
+    Timespec ts;
+
+    /* Make sure the order is ok */
+    if (!gnc_order_window_verify_ok (ow))
+        return;
+
+    /* Make sure the order exists */
+    order = ow_get_order (ow);
+    if (!order)
+        return;
+
+    /* Check that there is at least one Entry */
+    if (gncOrderGetEntries (order) == NULL)
+    {
+        gnc_error_dialog (ow->dialog, "%s",
+                          _("The Order must have at least one Entry."));
+        return;
+    }
+
+    /* Make sure we can close the order. Are there any uninvoiced entries? */
+    entries = gncOrderGetEntries (order);
+    for ( ; entries ; entries = entries->next)
+    {
+        GncEntry *entry = entries->data;
+        if (gncEntryGetInvoice (entry) == NULL)
+        {
+            non_inv = TRUE;
+            break;
+        }
+    }
+
+    if (non_inv)
+    {
+        /* Damn; yes.  Well, ask the user to make sure they REALLY want to
+         * close this order!
+         */
+
+        message = _("This order contains entries that have not been invoiced. "
+                    "Are you sure you want to close it out before "
+                    "you invoice all the entries?");
+
+        if (gnc_verify_dialog (ow->dialog, FALSE, "%s", message) == FALSE)
+            return;
+    }
+
+    /* Ok, we can close this.  Ask for verification and set the closed date */
+    message = _("Do you really want to close the order?");
+    label = _("Close Date");
+
+    timespecFromTime64 (&ts, gnc_time (NULL));
+    if (!gnc_dialog_date_close_parented (ow->dialog, message, label, TRUE, &ts))
+        return;
+
+    gncOrderSetDateClosed (order, ts);
+
+    /* save it off */
+    gnc_order_window_ok_save (ow);
+
+    /* Reset the type; change to read-only */
+    ow->dialog_type = VIEW_ORDER;
+    gnc_entry_ledger_set_readonly (ow->ledger, TRUE);
+
+    /* And redisplay the window */
+    gnc_order_update_window (ow);
+}
+
+void
+gnc_order_window_destroy_cb (GtkWidget *widget, gpointer data)
+{
+    OrderWindow *ow = data;
+    GncOrder *order = ow_get_order (ow);
+
+    gnc_suspend_gui_refresh ();
+
+    if (ow->dialog_type == NEW_ORDER && order != NULL)
+    {
+        gncOrderBeginEdit (order);
+        gncOrderDestroy (order);
+        ow->order_guid = *guid_null ();
+    }
+
+    if (ow->ledger)
+        gnc_entry_ledger_destroy (ow->ledger);
+    gnc_unregister_gui_component (ow->component_id);
+    gnc_resume_gui_refresh ();
+
+    g_free (ow);
+}
+
+static int
+gnc_order_owner_changed_cb (GtkWidget *widget, gpointer data)
+{
+    OrderWindow *ow = data;
+    GncOrder *order;
+
+    if (!ow)
+        return FALSE;
+
+    if (ow->dialog_type == VIEW_ORDER)
+        return FALSE;
+
+    gnc_owner_get_owner (ow->owner_choice, &(ow->owner));
+
+    /* Set the Order's owner now! */
+    order = ow_get_order (ow);
+    gncOrderSetOwner (order, &(ow->owner));
+
+    if (ow->dialog_type == EDIT_ORDER)
+        return FALSE;
+
+    /* Only set the reference during the New Job dialog */
+    switch (gncOwnerGetType (&(ow->owner)))
+    {
+    case GNC_OWNER_JOB:
+    {
+        char const *msg = gncJobGetReference (gncOwnerGetJob (&(ow->owner)));
+        gtk_entry_set_text (GTK_ENTRY (ow->ref_entry), msg ? msg : "");
+        break;
+    }
+    default:
+        gtk_entry_set_text (GTK_ENTRY (ow->ref_entry), "");
+        break;
+    }
+
+    return FALSE;
+}
+
+static void
+gnc_order_window_close_handler (gpointer user_data)
+{
+    OrderWindow *ow = user_data;
+
+    gtk_widget_destroy (ow->dialog);
+}
+
+static void
+gnc_order_window_refresh_handler (GHashTable *changes, gpointer user_data)
+{
+    OrderWindow *ow = user_data;
+    const EventInfo *info;
+    GncOrder *order = ow_get_order (ow);
+
+    /* If there isn't a order behind us, close down */
+    if (!order)
+    {
+        gnc_close_gui_component (ow->component_id);
+        return;
+    }
+
+    /* Next, close if this is a destroy event */
+    if (changes)
+    {
+        info = gnc_gui_get_entity_events (changes, &ow->order_guid);
+        if (info && (info->event_mask & QOF_EVENT_DESTROY))
+        {
+            gnc_close_gui_component (ow->component_id);
+            return;
+        }
+    }
+}
+
+static void
+gnc_order_update_window (OrderWindow *ow)
+{
+    GncOrder *order;
+    GncOwner *owner;
+    gboolean hide_cd = FALSE;
+
+    order = ow_get_order (ow);
+    owner = gncOrderGetOwner (order);
+
+    if (ow->owner_choice)
+    {
+        gtk_container_remove (GTK_CONTAINER (ow->owner_box), ow->owner_choice);
+        gtk_widget_destroy (ow->owner_choice);
+    }
+
+    switch (ow->dialog_type)
+    {
+    case VIEW_ORDER:
+    case EDIT_ORDER:
+        ow->owner_choice =
+            gnc_owner_edit_create (ow->owner_label, ow->owner_box, ow->book,
+                                   owner);
+        break;
+    case NEW_ORDER:
+        ow->owner_choice =
+            gnc_owner_select_create (ow->owner_label, ow->owner_box, ow->book,
+                                     owner);
+        break;
+    }
+
+    g_signal_connect (ow->owner_choice, "changed",
+                      G_CALLBACK (gnc_order_owner_changed_cb),
+                      ow);
+
+    gtk_widget_show_all (ow->dialog);
+
+    {
+        GtkTextBuffer* text_buffer;
+        const char *string;
+        Timespec ts, ts_zero = {0, 0};
+
+        gtk_entry_set_text (GTK_ENTRY (ow->ref_entry),
+                            gncOrderGetReference (order));
+
+        string = gncOrderGetNotes (order);
+        text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW(ow->notes_text));
+        gtk_text_buffer_set_text (text_buffer, string, -1);
+
+        ts = gncOrderGetDateOpened (order);
+        if (timespec_equal (&ts, &ts_zero))
+        {
+            gnc_date_edit_set_time (GNC_DATE_EDIT (ow->opened_date),
+                                    gnc_time (NULL));
+        }
+        else
+        {
+            gnc_date_edit_set_time_ts (GNC_DATE_EDIT (ow->opened_date), ts);
+        }
+
+        /* If this is a "New Order Window" we can stop here! */
+        if (ow->dialog_type == NEW_ORDER)
+            return;
+
+        ts = gncOrderGetDateClosed (order);
+        if (timespec_equal (&ts, &ts_zero))
+        {
+            gnc_date_edit_set_time (GNC_DATE_EDIT (ow->closed_date),
+                                    gnc_time (NULL));
+            hide_cd = TRUE;
+        }
+        else
+        {
+            gnc_date_edit_set_time_ts (GNC_DATE_EDIT (ow->closed_date), ts);
+        }
+
+        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ow->active_check),
+                                      gncOrderGetActive (order));
+
+    }
+
+    gnc_gui_component_watch_entity_type (ow->component_id,
+                                         GNC_ORDER_MODULE_NAME,
+                                         QOF_EVENT_MODIFY | QOF_EVENT_DESTROY);
+
+    gnc_table_refresh_gui (gnc_entry_ledger_get_table (ow->ledger), TRUE);
+
+    if (hide_cd)
+    {
+        gtk_widget_hide (ow->closed_date);
+        gtk_widget_hide (ow->cd_label);
+        gtk_widget_hide (ow->hide1);
+        gtk_widget_hide (ow->hide2);
+    }
+
+    if (ow->dialog_type == VIEW_ORDER)
+    {
+        /* Setup viewer for read-only access */
+        gtk_widget_set_sensitive (ow->id_entry, FALSE);
+        gtk_widget_set_sensitive (ow->opened_date, FALSE);
+        gtk_widget_set_sensitive (ow->closed_date, FALSE);
+        gtk_widget_set_sensitive (ow->notes_text, FALSE); /* XXX: Should notes remain writable? */
+
+        /* Hide the 'close order' button */
+        gtk_widget_hide (ow->close_order_button);
+    }
+}
+
+static gboolean
+find_handler (gpointer find_data, gpointer user_data)
+{
+    const GncGUID *order_guid = find_data;
+    OrderWindow *ow = user_data;
+
+    return(ow && guid_equal(&ow->order_guid, order_guid));
+}
+
+static OrderWindow *
+gnc_order_new_window (QofBook *bookp, OrderDialogType type,
+                      GncOrder *order, GncOwner *owner)
+{
+    OrderWindow *ow;
+    GtkBuilder *builder;
+    GtkWidget *vbox, *regWidget, *hbox, *date;
+    GncEntryLedger *entry_ledger = NULL;
+    const char * class_name;
+
+    switch (type)
+    {
+    case EDIT_ORDER:
+        class_name = DIALOG_EDIT_ORDER_CM_CLASS;
+        break;
+    case VIEW_ORDER:
+    default:
+        class_name = DIALOG_VIEW_ORDER_CM_CLASS;
+        break;
+    }
+
+    /*
+     * Find an existing window for this order.  If found, bring it to
+     * the front.
+     */
+    if (order)
+    {
+        GncGUID order_guid;
+
+        order_guid = *gncOrderGetGUID(order);
+        ow = gnc_find_first_gui_component (class_name, find_handler,
+                                           &order_guid);
+        if (ow)
+        {
+            gtk_window_present (GTK_WINDOW(ow->dialog));
+            return(ow);
+        }
+    }
+
+    /*
+     * No existing order window found.  Build a new one.
+     */
+    ow = g_new0 (OrderWindow, 1);
+    ow->book = bookp;
+    ow->dialog_type = type;
+
+    /* Save this for later */
+    gncOwnerCopy (owner, &(ow->owner));
+
+    /* Find the dialog */
+    builder = gtk_builder_new();
+    gnc_builder_add_from_file (builder, "dialog-order.glade", "order_entry_dialog");
+    ow->dialog = GTK_WIDGET(gtk_builder_get_object (builder, "order_entry_dialog"));
+
+    // Set the style context for this dialog so it can be easily manipulated with css
+    gnc_widget_set_style_context (GTK_WIDGET(ow->dialog), "GncOrderDialog");
+
+    /* Grab the widgets */
+    ow->id_entry = GTK_WIDGET(gtk_builder_get_object (builder, "id_entry"));
+    ow->ref_entry = GTK_WIDGET(gtk_builder_get_object (builder, "ref_entry"));
+    ow->notes_text = GTK_WIDGET(gtk_builder_get_object (builder, "notes_text"));
+    ow->active_check = GTK_WIDGET(gtk_builder_get_object (builder, "active_check"));
+    ow->owner_box = GTK_WIDGET(gtk_builder_get_object (builder, "owner_hbox"));
+    ow->owner_label = GTK_WIDGET(gtk_builder_get_object (builder, "owner_label"));
+
+    ow->cd_label = GTK_WIDGET(gtk_builder_get_object (builder, "cd_label"));
+    ow->hide1 = GTK_WIDGET(gtk_builder_get_object (builder, "hide1"));
+    ow->hide2 = GTK_WIDGET(gtk_builder_get_object (builder, "hide2"));
+    ow->close_order_button = GTK_WIDGET(gtk_builder_get_object (builder, "close_order_button"));
+
+
+    /* Setup Date Widgets */
+    hbox = GTK_WIDGET(gtk_builder_get_object (builder, "opened_date_hbox"));
+    date = gnc_date_edit_new (time (NULL), FALSE, FALSE);
+    gtk_box_pack_start (GTK_BOX (hbox), date, TRUE, TRUE, 0);
+    gtk_widget_show (date);
+    ow->opened_date = date;
+
+    hbox = GTK_WIDGET(gtk_builder_get_object (builder, "closed_date_hbox"));
+    date = gnc_date_edit_new (time (NULL), FALSE, FALSE);
+    gtk_box_pack_start (GTK_BOX (hbox), date, TRUE, TRUE, 0);
+    gtk_widget_show (date);
+    ow->closed_date = date;
+
+    /* Build the ledger */
+    switch (type)
+    {
+    case EDIT_ORDER:
+        entry_ledger = gnc_entry_ledger_new (ow->book, GNCENTRY_ORDER_ENTRY);
+        break;
+    case VIEW_ORDER:
+    default:
+        entry_ledger = gnc_entry_ledger_new (ow->book, GNCENTRY_ORDER_VIEWER);
+        break;
+    }
+
+    /* Save the entry ledger for later */
+    ow->ledger = entry_ledger;
+
+    /* Set the order for the entry_ledger */
+    gnc_entry_ledger_set_default_order (entry_ledger, order);
+
+    /* Set watches on entries */
+    //  entries = gncOrderGetEntries (order);
+    //  gnc_entry_ledger_load (entry_ledger, entries);
+
+    /* Watch the order of operations, here... */
+    regWidget = gnucash_register_new (gnc_entry_ledger_get_table (entry_ledger),
+                                      NULL);
+    ow->reg = GNUCASH_REGISTER (regWidget);
+    gnucash_sheet_set_window (gnucash_register_get_sheet (ow->reg), ow->dialog);
+    gnc_entry_ledger_set_parent (entry_ledger, ow->dialog);
+
+    vbox = GTK_WIDGET(gtk_builder_get_object (builder, "ledger_vbox"));
+    // gtk_box_pack_start (GTK_BOX(vbox), toolbar, FALSE, FALSE, 2);
+    gtk_box_pack_start (GTK_BOX(vbox), regWidget, TRUE, TRUE, 2);
+
+    /* Setup signals */
+    gtk_builder_connect_signals_full (builder, gnc_builder_connect_full_func, ow);
+
+    /* Setup initial values */
+    ow->order_guid = *gncOrderGetGUID (order);
+
+    gtk_entry_set_text (GTK_ENTRY (ow->id_entry), gncOrderGetID (order));
+
+    ow->component_id =
+        gnc_register_gui_component (class_name,
+                                    gnc_order_window_refresh_handler,
+                                    gnc_order_window_close_handler,
+                                    ow);
+
+    gnc_table_realize_gui (gnc_entry_ledger_get_table (entry_ledger));
+
+    /* Now fill in a lot of the pieces and display properly */
+    gnc_order_update_window (ow);
+
+    /* Maybe set the reference */
+    gnc_order_owner_changed_cb (ow->owner_choice, ow);
+
+    g_object_unref(G_OBJECT(builder));
+
+    return ow;
+}
+
+static OrderWindow *
+gnc_order_window_new_order (QofBook *bookp, GncOwner *owner)
+{
+    OrderWindow *ow;
+    GtkBuilder *builder;
+    GncOrder *order;
+    gchar *string;
+    GtkWidget *hbox, *date;
+
+    ow = g_new0 (OrderWindow, 1);
+    ow->book = bookp;
+    ow->dialog_type = NEW_ORDER;
+
+    order = gncOrderCreate (bookp);
+    gncOrderSetOwner (order, owner);
+
+    /* Save this for later */
+    gncOwnerCopy (owner, &(ow->owner));
+
+    /* Find the dialog */
+    builder = gtk_builder_new();
+    gnc_builder_add_from_file (builder, "dialog-order.glade", "new_order_dialog");
+
+    ow->dialog = GTK_WIDGET(gtk_builder_get_object (builder, "new_order_dialog"));
+
+    // Set the style context for this dialog so it can be easily manipulated with css
+    gnc_widget_set_style_context (GTK_WIDGET(ow->dialog), "GncOrderDialog");
+
+    g_object_set_data (G_OBJECT (ow->dialog), "dialog_info", ow);
+
+    /* Grab the widgets */
+    ow->id_entry = GTK_WIDGET(gtk_builder_get_object (builder, "entry_id"));
+    ow->ref_entry = GTK_WIDGET(gtk_builder_get_object (builder, "entry_ref"));
+    ow->notes_text = GTK_WIDGET(gtk_builder_get_object (builder, "text_notes"));
+    ow->owner_box = GTK_WIDGET(gtk_builder_get_object (builder, "bill_owner_hbox"));
+    ow->owner_label = GTK_WIDGET(gtk_builder_get_object (builder, "bill_owner_label"));
+
+    /* Setup date Widget */
+    hbox = GTK_WIDGET(gtk_builder_get_object (builder, "date_opened_hbox"));
+    date = gnc_date_edit_new (time (NULL), FALSE, FALSE);
+    gtk_box_pack_start (GTK_BOX (hbox), date, TRUE, TRUE, 0);
+    gtk_widget_show (date);
+    ow->opened_date = date;
+
+    /* Setup signals */
+    gtk_builder_connect_signals_full (builder, gnc_builder_connect_full_func, ow);
+
+    /* Setup initial values */
+    ow->order_guid = *gncOrderGetGUID (order);
+    string = gncOrderNextID(bookp);
+    gtk_entry_set_text (GTK_ENTRY (ow->id_entry), string);
+    g_free(string);
+
+    ow->component_id =
+        gnc_register_gui_component (DIALOG_NEW_ORDER_CM_CLASS,
+                                    gnc_order_window_refresh_handler,
+                                    gnc_order_window_close_handler,
+                                    ow);
+
+    /* Now fill in a lot of the pieces and display properly */
+    gnc_order_update_window (ow);
+
+    // The customer choice widget should have keyboard focus
+    if (GNC_IS_GENERAL_SEARCH(ow->owner_choice))
+    {
+        gnc_general_search_grab_focus(GNC_GENERAL_SEARCH(ow->owner_choice));
+    }
+
+    /* Maybe set the reference */
+    gnc_order_owner_changed_cb (ow->owner_choice, ow);
+
+    g_object_unref(G_OBJECT(builder));
+
+    return ow;
+}
+
+OrderWindow *
+gnc_ui_order_edit (GncOrder *order)
+{
+    OrderWindow *ow;
+    OrderDialogType type;
+
+    if (!order) return NULL;
+
+    type = EDIT_ORDER;
+    {
+        Timespec ts = gncOrderGetDateClosed (order);
+        if (ts.tv_sec || ts.tv_nsec)
+            type = VIEW_ORDER;
+    }
+
+    ow = gnc_order_new_window (gncOrderGetBook(order), type, order,
+                               gncOrderGetOwner (order));
+
+    return ow;
+}
+
+OrderWindow *
+gnc_ui_order_new (GncOwner *ownerp, QofBook *bookp)
+{
+    OrderWindow *ow;
+    GncOwner owner;
+
+    if (ownerp)
+    {
+        switch (gncOwnerGetType (ownerp))
+        {
+        case GNC_OWNER_CUSTOMER:
+        case GNC_OWNER_VENDOR:
+        case GNC_OWNER_JOB:
+            gncOwnerCopy (ownerp, &owner);
+            break;
+        default:
+            g_warning ("Cannot deal with unknown Owner types");
+            /* XXX: popup a warning? */
+            return NULL;
+        }
+    }
+    else
+        gncOwnerInitJob (&owner, NULL); /* XXX: pass in the owner type? */
+
+    /* Make sure required options exist */
+    if (!bookp) return NULL;
+
+    ow = gnc_order_window_new_order (bookp, &owner);
+
+    return ow;
+}
+
+/* Functions for order selection widgets */
+
+static void
+edit_order_cb (gpointer *order_p, gpointer user_data)
+{
+    GncOrder *order;
+
+    g_return_if_fail (order_p && user_data);
+
+    order = *order_p;
+
+    if (order)
+        gnc_ui_order_edit (order);
+
+    return;
+}
+
+static gpointer
+new_order_cb (gpointer user_data)
+{
+    struct _order_select_window *sw = user_data;
+    OrderWindow *ow;
+
+    g_return_val_if_fail (user_data, NULL);
+
+    ow = gnc_ui_order_new (sw->owner, sw->book);
+    return ow_get_order (ow);
+}
+
+static void
+free_order_cb (gpointer user_data)
+{
+    struct _order_select_window *sw = user_data;
+
+    g_return_if_fail (sw);
+
+    qof_query_destroy (sw->q);
+    g_free (sw);
+}
+
+GNCSearchWindow *
+gnc_order_search (GncOrder *start, GncOwner *owner, QofBook *book)
+{
+    QofIdType type = GNC_ORDER_MODULE_NAME;
+    struct _order_select_window *sw;
+    QofQuery *q, *q2 = NULL;
+    static GList *params = NULL;
+    static GList *columns = NULL;
+    static GNCSearchCallbackButton buttons[] =
+    {
+        { N_("View/Edit Order"), edit_order_cb, NULL, TRUE},
+        { NULL },
+    };
+
+    g_return_val_if_fail (book, NULL);
+
+    /* Build parameter list in reverse order */
+    if (params == NULL)
+    {
+        params = gnc_search_param_prepend (params, _("Order Notes"), NULL, type,
+                                           ORDER_NOTES, NULL);
+        params = gnc_search_param_prepend (params, _("Date Closed"), NULL, type,
+                                           ORDER_CLOSED, NULL);
+        params = gnc_search_param_prepend (params, _("Is Closed?"), NULL, type,
+                                           ORDER_IS_CLOSED, NULL);
+        params = gnc_search_param_prepend (params, _("Date Opened"), NULL, type,
+                                           ORDER_OPENED, NULL);
+        params = gnc_search_param_prepend (params, _("Owner Name "), NULL, type,
+                                           ORDER_OWNER, OWNER_NAME, NULL);
+        params = gnc_search_param_prepend (params, _("Order ID"), NULL, type,
+                                           ORDER_ID, NULL);
+    }
+
+    /* Build the column list in reverse order */
+    if (columns == NULL)
+    {
+        columns = gnc_search_param_prepend (columns, _("Billing ID"), NULL, type,
+                                            ORDER_REFERENCE, NULL);
+        columns = gnc_search_param_prepend (columns, _("Company"), NULL, type,
+                                            ORDER_OWNER, OWNER_PARENT,
+                                            OWNER_NAME, NULL);
+        columns = gnc_search_param_prepend (columns, _("Closed"), NULL, type,
+                                            ORDER_CLOSED, NULL);
+        columns = gnc_search_param_prepend (columns, _("Opened"), NULL, type,
+                                            ORDER_OPENED, NULL);
+        columns = gnc_search_param_prepend (columns, _("Num"), NULL, type,
+                                            ORDER_ID, NULL);
+    }
+
+    /* Build the queries */
+    q = qof_query_create_for (type);
+    qof_query_set_book (q, book);
+
+    /* If owner is supplied, limit all searches to orders who's owner
+     * (or parent) is the supplied owner!
+     */
+    if (owner && gncOwnerGetGUID (owner))
+    {
+        QofQuery *tmp, *q3;
+
+        q3 = qof_query_create_for (type);
+        qof_query_add_guid_match (q3, g_slist_prepend
+                                  (g_slist_prepend (NULL, QOF_PARAM_GUID),
+                                   ORDER_OWNER),
+                                  gncOwnerGetGUID (owner), QOF_QUERY_OR);
+        qof_query_add_guid_match (q3, g_slist_prepend
+                                  (g_slist_prepend (NULL, OWNER_PARENTG),
+                                   ORDER_OWNER),
+                                  gncOwnerGetGUID (owner), QOF_QUERY_OR);
+
+        tmp = qof_query_merge (q, q3, QOF_QUERY_AND);
+        qof_query_destroy (q);
+        qof_query_destroy (q3);
+        q = tmp;
+        q2 = qof_query_copy (q);
+    }
+
+#if 0
+    if (start)
+    {
+        if (q2 == NULL)
+            q2 = qof_query_copy (q);
+
+        qof_query_add_guid_match (q2, g_slist_prepend (NULL, QOF_PARAM_GUID),
+                                  gncOrderGetGUID (start), QOF_QUERY_AND);
+    }
+#endif
+
+    /* launch select dialog and return the result */
+    sw = g_new0 (struct _order_select_window, 1);
+
+    if (owner)
+    {
+        gncOwnerCopy (owner, &(sw->owner_def));
+        sw->owner = &(sw->owner_def);
+    }
+    sw->book = book;
+    sw->q = q;
+
+    return gnc_search_dialog_create (type, _("Find Order"),
+                                     params, columns, q, q2,
+                                     buttons, NULL, new_order_cb,
+                                     sw, free_order_cb, GNC_PREFS_GROUP_SEARCH,
+                                     NULL, "GncFindOrderDialog");
+}
+
+GNCSearchWindow *
+gnc_order_search_select (gpointer start, gpointer book)
+{
+    GncOrder *o = start;
+    GncOwner owner, *ownerp;
+
+    if (!book) return NULL;
+
+    if (o)
+    {
+        ownerp = gncOrderGetOwner (o);
+        gncOwnerCopy (ownerp, &owner);
+    }
+    else
+        gncOwnerInitCustomer (&owner, NULL); /* XXX */
+
+    return gnc_order_search (start, NULL, book);
+}
+
+GNCSearchWindow *
+gnc_order_search_edit (gpointer start, gpointer book)
+{
+    if (start)
+        gnc_ui_order_edit (start);
+
+    return NULL;
+}
diff --git a/src/gnome/dialog-order.h b/gnucash/gnome/dialog-order.h
similarity index 100%
rename from src/gnome/dialog-order.h
rename to gnucash/gnome/dialog-order.h
diff --git a/gnucash/gnome/dialog-payment.c b/gnucash/gnome/dialog-payment.c
new file mode 100644
index 0000000..e684bc0
--- /dev/null
+++ b/gnucash/gnome/dialog-payment.c
@@ -0,0 +1,1256 @@
+/*
+ * dialog-payment.c -- Dialog for payment entry
+ * Copyright (C) 2002,2006 Derek Atkins
+ * Author: Derek Atkins <warlord at MIT.EDU>
+ * Copyright (c) 2006 David Hampton <hampton at employees.org>
+ *
+ * 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 at gnu.org
+ */
+
+#include "config.h"
+
+#include <gtk/gtk.h>
+#include <glib/gi18n.h>
+
+#include "dialog-utils.h"
+#include "gnc-component-manager.h"
+#include "gnc-ui.h"
+#include "gnc-gui-query.h"
+#include "gnc-ui-util.h"
+#include "qof.h"
+#include "gnc-date.h"
+#include "gnc-date-edit.h"
+#include "gnc-amount-edit.h"
+#include "gnc-gtk-utils.h"
+#include "gnc-prefs.h"
+#include "gnc-tree-view-account.h"
+#include "tree-view-utils.h"
+#include "Transaction.h"
+#include "Account.h"
+#include "gncOwner.h"
+#include "engine-helpers.h"
+
+#include "gncInvoice.h"
+
+#include "dialog-payment.h"
+#include "business-gnome-utils.h"
+
+#include "dialog-transfer.h"
+#include "dialog-print-check.h"
+#include "gnc-general-search.h"
+
+#define DIALOG_PAYMENT_CUSTOMER_CM_CLASS "customer-payment-dialog"
+#define DIALOG_PAYMENT_VENDOR_CM_CLASS "vendor-payment-dialog"
+
+struct _payment_window
+{
+    GtkWidget   * dialog;
+
+    GtkWidget   * payment_warning;
+    GtkWidget   * ok_button;
+    GtkWidget   * num_entry;
+    GtkWidget   * memo_entry;
+    GtkWidget   * post_combo;
+    GtkWidget   * owner_choice;
+    GtkWidget   * amount_debit_edit;
+    GtkWidget   * amount_credit_edit;
+    GtkWidget   * date_edit;
+    GtkWidget   * acct_tree;
+    GtkWidget   * docs_list_tree_view;
+    GtkWidget   * commodity_label;
+    GtkWidget   * print_check;
+
+    gint          component_id;
+    QofBook     * book;
+    GncOwner      owner;
+    GncInvoice  * invoice;
+    Account     * post_acct;
+    Account     * xfer_acct;
+    gnc_numeric   amount_tot;
+    GList       * acct_types;
+    GList       * acct_commodities;
+
+    Transaction * pre_existing_txn;
+    gboolean      print_check_state;
+};
+
+void gnc_ui_payment_window_set_num (PaymentWindow *pw, const char* num)
+{
+    g_assert(pw);
+    gtk_entry_set_text(GTK_ENTRY (pw->num_entry), num);
+}
+void gnc_ui_payment_window_set_memo (PaymentWindow *pw, const char* memo)
+{
+    g_assert(pw);
+    gtk_entry_set_text(GTK_ENTRY (pw->memo_entry), memo);
+}
+void gnc_ui_payment_window_set_date (PaymentWindow *pw, const GDate *date)
+{
+    g_assert(pw);
+    g_assert(date);
+    gnc_date_edit_set_gdate (GNC_DATE_EDIT (pw->date_edit), date);
+}
+void gnc_ui_payment_window_set_amount (PaymentWindow *pw, gnc_numeric amount)
+{
+    g_assert(pw);
+
+    /* Debits are negative, credits are positive */
+    if (gnc_numeric_positive_p (amount))
+    {
+        gnc_amount_edit_set_amount (GNC_AMOUNT_EDIT(pw->amount_credit_edit),
+                                    amount);
+        gnc_amount_edit_set_amount (GNC_AMOUNT_EDIT(pw->amount_debit_edit),
+                                    gnc_numeric_zero ());
+    }
+    else
+    {
+        gnc_amount_edit_set_amount (GNC_AMOUNT_EDIT(pw->amount_debit_edit),
+                                    gnc_numeric_neg (amount));
+        gnc_amount_edit_set_amount (GNC_AMOUNT_EDIT(pw->amount_credit_edit),
+                                    gnc_numeric_zero ());
+    }
+
+}
+
+static void gnc_ui_payment_window_set_commodity (PaymentWindow *pw, const Account* account)
+{
+    gchar *comm_string;
+    gnc_commodity *comm;
+
+    g_assert(pw);
+    g_assert(account);
+
+    comm = xaccAccountGetCommodity (account);
+    comm_string = g_strconcat ("(", gnc_commodity_get_nice_symbol (comm), ")", NULL);
+    gtk_label_set_text (GTK_LABEL(pw->commodity_label), comm_string);
+    g_free (comm_string);
+}
+
+void gnc_ui_payment_window_set_postaccount (PaymentWindow *pw, const Account* account)
+{
+    g_assert(pw);
+    g_assert(account);
+    {
+        gchar *acct_string = gnc_account_get_full_name (account);
+        gnc_cbwe_set_by_string(GTK_COMBO_BOX(pw->post_combo), acct_string);
+        g_free(acct_string);
+    }
+
+    gnc_ui_payment_window_set_commodity (pw, account);
+}
+
+void gnc_ui_payment_window_set_xferaccount (PaymentWindow *pw, const Account* account)
+{
+    g_assert(pw);
+    g_assert(account);
+    gnc_tree_view_account_set_selected_account(GNC_TREE_VIEW_ACCOUNT(pw->acct_tree),
+            (Account*)account);
+}
+
+static gboolean gnc_payment_dialog_has_pre_existing_txn(const PaymentWindow* pw)
+{
+    return pw->pre_existing_txn != NULL;
+}
+int  gnc_payment_dialog_post_to_changed_cb (GtkWidget *widget, gpointer data);
+void gnc_payment_dialog_document_selection_changed_cb (GtkWidget *widget, gpointer data);
+void gnc_payment_dialog_xfer_acct_changed_cb (GtkWidget *widget, gpointer data);
+void gnc_payment_ok_cb (GtkWidget *widget, gpointer data);
+void gnc_payment_cancel_cb (GtkWidget *widget, gpointer data);
+void gnc_payment_window_destroy_cb (GtkWidget *widget, gpointer data);
+void gnc_payment_acct_tree_row_activated_cb (GtkWidget *widget, GtkTreePath *path,
+        GtkTreeViewColumn *column, PaymentWindow *pw);
+void gnc_payment_leave_amount_cb (GtkWidget *widget, GdkEventFocus *event,
+                                  PaymentWindow *pw);
+void gnc_payment_window_fill_docs_list (PaymentWindow *pw);
+
+
+static void
+gnc_payment_window_refresh_handler (GHashTable *changes, gpointer data)
+{
+    PaymentWindow *pw = data;
+
+    gnc_payment_window_fill_docs_list (pw);
+    pw->post_acct = gnc_account_select_combo_fill (pw->post_combo, pw->book, pw->acct_types, pw->acct_commodities);
+}
+
+static gboolean
+gnc_payment_window_check_payment (PaymentWindow *pw)
+{
+    const char *conflict_msg = NULL;
+    gnc_numeric amount_deb, amount_cred;
+    gboolean enable_xfer_acct = TRUE;
+
+    if (!pw)
+        return FALSE;
+
+    /* Verify the "post" account */
+    if (!pw->post_acct)
+    {
+        conflict_msg = _("You must enter a valid account name for posting.");
+        goto update_cleanup;
+    }
+
+    /* Verify the user has selected an owner */
+    gnc_owner_get_owner (pw->owner_choice, &(pw->owner));
+    if (!gncOwnerIsValid(&pw->owner))
+    {
+        conflict_msg = _("You must select a company for payment processing.");
+        goto update_cleanup;
+    }
+
+    /* Test the total amount */
+    amount_deb  = gnc_amount_edit_get_amount (GNC_AMOUNT_EDIT (pw->amount_debit_edit));
+    amount_cred = gnc_amount_edit_get_amount (GNC_AMOUNT_EDIT (pw->amount_credit_edit));
+    pw->amount_tot = gnc_numeric_sub (amount_cred, amount_deb,
+                                      gnc_commodity_get_fraction (xaccAccountGetCommodity (pw->post_acct)),
+                                      GNC_HOW_RND_ROUND_HALF_UP);
+
+    if (gnc_numeric_check (pw->amount_tot) || gnc_numeric_zero_p (pw->amount_tot))
+    {
+        enable_xfer_acct = FALSE;
+    }
+    else
+    {
+        /* Verify the user has selected a transfer account */
+        pw->xfer_acct = gnc_tree_view_account_get_selected_account (GNC_TREE_VIEW_ACCOUNT(pw->acct_tree));
+        if (!pw->xfer_acct)
+        {
+            conflict_msg = _("You must select a transfer account from the account tree.");
+        }
+    }
+
+update_cleanup:
+    gtk_widget_set_sensitive (pw->acct_tree, enable_xfer_acct);
+
+    /* Disable "Print Check" widget if amount is zero but save current
+       state to restore when the widget is re-enabled */
+    if (gtk_widget_is_sensitive (pw->print_check))
+        pw->print_check_state = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(pw->print_check));
+    if (!enable_xfer_acct)
+        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(pw->print_check), FALSE);
+    gtk_widget_set_sensitive (pw->print_check, enable_xfer_acct);
+    if (gtk_widget_is_sensitive (pw->print_check))
+        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(pw->print_check), pw->print_check_state);
+
+    /* Check if there are issues preventing a successful payment */
+    gtk_widget_set_tooltip_text (pw->payment_warning, conflict_msg);
+    if (conflict_msg)
+    {
+        gtk_widget_show (pw->payment_warning);
+        gtk_widget_set_sensitive (pw->ok_button, FALSE);
+        return FALSE;
+    }
+    else
+    {
+        gtk_widget_hide (pw->payment_warning);
+        gtk_widget_set_sensitive (pw->ok_button, TRUE);
+    }
+
+    return TRUE;
+}
+
+static void
+gnc_payment_window_close_handler (gpointer data)
+{
+    PaymentWindow *pw = data;
+
+    if (pw)
+        gtk_widget_destroy (pw->dialog);
+}
+
+static void
+calculate_selected_total_helper (GtkTreeModel *model,
+                                 GtkTreePath *path,
+                                 GtkTreeIter *iter,
+                                 gpointer data)
+{
+    gnc_numeric *subtotal = (gnc_numeric*) data;
+    gnc_numeric cur_val;
+    GValue value = { 0 };
+    GNCLot *lot;
+    Account *acct;
+    gnc_commodity *currency;
+
+    gtk_tree_model_get_value (model, iter, 5, &value);
+    lot = (GNCLot *) g_value_get_pointer (&value);
+    g_value_unset (&value);
+
+    /* Find the amount's currency to determine the required precision */
+    acct = gnc_lot_get_account (lot);
+    currency = xaccAccountGetCommodity (acct);
+
+    cur_val = gnc_lot_get_balance (lot);
+    *subtotal = gnc_numeric_add (*subtotal, cur_val,
+                                 gnc_commodity_get_fraction (currency), GNC_HOW_RND_ROUND_HALF_UP);
+}
+
+static gnc_numeric
+gnc_payment_dialog_calculate_selected_total (PaymentWindow *pw)
+{
+    GtkTreeSelection *selection;
+    gnc_numeric val = gnc_numeric_zero();
+
+    if (!pw->docs_list_tree_view || !GTK_IS_TREE_VIEW(pw->docs_list_tree_view))
+        return gnc_numeric_zero();
+
+    /* Figure out if anything is set in the current list */
+    selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(pw->docs_list_tree_view));
+
+    gtk_tree_selection_selected_foreach (selection,
+                                         calculate_selected_total_helper,
+                                         (gpointer) &val);
+
+    return val;
+}
+
+static void
+gnc_payment_dialog_document_selection_changed (PaymentWindow *pw)
+{
+    gnc_numeric val;
+
+    /* Don't change the amount based on the selected documents
+     * in case this payment is from a pre-existing txn
+     */
+    if (gnc_payment_dialog_has_pre_existing_txn (pw))
+        return;
+
+    /* Set the payment amount in the dialog */
+    val = gnc_payment_dialog_calculate_selected_total (pw);
+    gnc_ui_payment_window_set_amount(pw, val);
+}
+
+static void
+gnc_payment_dialog_highlight_document (PaymentWindow *pw)
+{
+    if (pw->invoice)
+    {
+        GtkTreeIter iter;
+        GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(pw->docs_list_tree_view));
+        GtkTreeSelection *selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(pw->docs_list_tree_view));
+        gtk_tree_selection_unselect_all (selection);
+
+        if (gtk_tree_model_get_iter_first (model, &iter))
+        {
+            do
+            {
+                GValue value = { 0 };
+                GNCLot *lot;
+                GncInvoice *invoice;
+
+                gtk_tree_model_get_value (model, &iter, 5, &value);
+                lot = (GNCLot *) g_value_get_pointer (&value);
+                g_value_unset (&value);
+
+                if (!lot)
+                    continue; /* Lot has been deleted behind our back... */
+
+                invoice = gncInvoiceGetInvoiceFromLot (lot);
+                if (!invoice)
+                    continue;
+
+                if (pw->invoice == invoice)
+                {
+                    gtk_tree_selection_select_iter (selection, &iter);
+                    gnc_payment_dialog_document_selection_changed (pw);
+                }
+            }
+            while (gtk_tree_model_iter_next (model, &iter));
+        }
+    }
+}
+
+void
+gnc_payment_window_fill_docs_list (PaymentWindow *pw)
+{
+    GtkListStore *store;
+    GtkTreeSelection *selection;
+    GList *list = NULL, *node;
+
+    g_return_if_fail (pw->docs_list_tree_view && GTK_IS_TREE_VIEW(pw->docs_list_tree_view));
+
+    /* Get a list of open lots for this owner and post account */
+    if (pw->owner.owner.undefined)
+        list = xaccAccountFindOpenLots (pw->post_acct, gncOwnerLotMatchOwnerFunc,
+                                        &pw->owner, NULL);
+
+    /* Clear the existing list */
+    selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(pw->docs_list_tree_view));
+    gtk_tree_selection_unselect_all (selection);
+    store = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(pw->docs_list_tree_view)));
+    gtk_list_store_clear(store);
+
+    /* Add the documents and overpayments to the tree view */
+    for (node = list; node; node = node->next)
+    {
+        GNCLot *lot = node->data;
+        time64 doc_date_time = 0;
+        const gchar *doc_type_str = NULL;
+        const gchar *doc_id_str   = NULL;
+        const gchar *doc_deb_str  = NULL;
+        const gchar *doc_cred_str = NULL;
+        GtkTreeIter iter;
+        Timespec doc_date;
+        GncInvoice *document;
+        gnc_numeric value = gnc_numeric_zero();
+        gnc_numeric debit = gnc_numeric_zero();
+        gnc_numeric credit = gnc_numeric_zero();
+
+        /* Find the lot's document if it exists,
+         * it could also be a prepayment lot. */
+        document = gncInvoiceGetInvoiceFromLot (lot);
+
+        /* Find the document's date or pre-payment date */
+        if (document)
+            doc_date = gncInvoiceGetDatePosted (document);
+        else
+        {
+            /* Calculate the payment date based on the lot splits */
+            Transaction *trans = xaccSplitGetParent (gnc_lot_get_latest_split (lot));
+            if (trans)
+                doc_date = xaccTransRetDatePostedTS (trans);
+            else
+                continue; /* No valid split in this lot, skip it */
+        }
+        doc_date_time = timespecToTime64 (doc_date);
+
+        /* Find the document type. No type means pre-payment in this case */
+        if (document)
+        {
+            doc_type_str = gncInvoiceGetTypeString (document);
+        }
+        else
+            doc_type_str = _("Pre-Payment");
+
+        /* Find the document id. Empty for pre-payments. */
+        if (document)
+        {
+            doc_id_str = gncInvoiceGetID (document);
+        }
+
+        /* Find the debit/credit amount.
+         * Invoices/vendor credit notes are debit (increasing the balance)
+         * Customer credit notes/bills are credit (decreasing the balance)
+         * Pre-payments are debit or credit depending on their sign
+         */
+        value = gnc_lot_get_balance (lot);
+
+        if (gnc_numeric_positive_p (value))
+            debit = value;
+        else
+            credit = gnc_numeric_neg (value);
+
+        /* Only display non-zero debits/credits */
+        if (!gnc_numeric_zero_p (debit))
+            doc_deb_str = xaccPrintAmount (debit, gnc_default_print_info (FALSE));
+        if (!gnc_numeric_zero_p (credit))
+            doc_cred_str = xaccPrintAmount (credit, gnc_default_print_info (FALSE));
+
+        gtk_list_store_append (store, &iter);
+        gtk_list_store_set (store, &iter,
+                            0, doc_date_time,
+                            1, doc_id_str,
+                            2, doc_type_str,
+                            3, doc_deb_str,
+                            4, doc_cred_str,
+                            5, (gpointer)lot,
+                            -1);
+
+    }
+
+    g_list_free (list);
+
+    /* Highlight the preset invoice if it's in the new list */
+    gnc_payment_dialog_highlight_document (pw);
+}
+
+static void
+gnc_payment_dialog_owner_changed (PaymentWindow *pw)
+{
+    Account *last_acct = NULL;
+    GncGUID *guid = NULL;
+    GncOwner *owner = &pw->owner;
+
+    /* If the owner changed, the initial invoice is no longer valid */
+    pw->invoice = NULL;
+
+    /* Now handle the account tree */
+    if (gncOwnerIsValid(owner))
+        qof_instance_get (qofOwnerGetOwner (owner),
+                          "payment-last-account", &guid,
+                          NULL);
+
+    /* refresh the post and acc available accounts, but cleanup first */
+    if (pw->acct_types)
+    {
+        g_list_free(pw->acct_types);
+        pw->acct_types = NULL;
+    }
+
+    if (pw->acct_commodities)
+    {
+        g_list_free(pw->acct_commodities);
+        pw->acct_commodities = NULL;
+    }
+
+    pw->acct_types = gncOwnerGetAccountTypesList(owner);
+    if (gncOwnerIsValid(owner))
+        pw->acct_commodities = gncOwnerGetCommoditiesList (owner);
+    pw->post_acct = gnc_account_select_combo_fill (pw->post_combo, pw->book, pw->acct_types, pw->acct_commodities);
+
+    if (pw->post_acct)
+        gnc_ui_payment_window_set_commodity (pw, pw->post_acct);
+
+
+    /* Update list of documents and pre-payments */
+    gnc_payment_window_fill_docs_list (pw);
+
+    if (guid)
+    {
+        last_acct = xaccAccountLookup(guid, pw->book);
+    }
+
+    /* Set the last-used transfer account, but only if we didn't
+     * create this dialog from a pre-existing transaction. */
+    if (last_acct && !gnc_payment_dialog_has_pre_existing_txn(pw))
+    {
+        gnc_tree_view_account_set_selected_account(GNC_TREE_VIEW_ACCOUNT(pw->acct_tree),
+                last_acct);
+    }
+}
+
+static void
+gnc_payment_dialog_post_to_changed (PaymentWindow *pw)
+{
+    gnc_payment_window_fill_docs_list (pw);
+}
+
+static void
+gnc_payment_dialog_remember_account (PaymentWindow *pw, Account *acc)
+{
+     QofInstance *owner = qofOwnerGetOwner (&pw->owner);
+    const GncGUID *guid;
+
+    if (!acc) return;
+
+    guid = xaccAccountGetGUID(acc);
+    qof_begin_edit (owner);
+    qof_instance_set (owner,
+		      "payment-last-account", guid,
+		      NULL);
+    qof_commit_edit (owner);
+}
+
+
+static void
+gnc_payment_set_owner (PaymentWindow *pw, GncOwner *owner)
+{
+    gnc_owner_set_owner (pw->owner_choice, owner);
+    gnc_payment_dialog_owner_changed(pw);
+}
+
+static int
+gnc_payment_dialog_owner_changed_cb (GtkWidget *widget, gpointer data)
+{
+    PaymentWindow *pw = data;
+    GncOwner owner;
+
+    if (!pw) return FALSE;
+
+    gncOwnerCopy (&(pw->owner), &owner);
+    gnc_owner_get_owner (pw->owner_choice, &owner);
+
+    /* If this owner really changed, then reset ourselves */
+    if (!gncOwnerEqual (&owner, &(pw->owner)))
+    {
+        gncOwnerCopy (&owner, &(pw->owner));
+        gnc_payment_dialog_owner_changed(pw);
+    }
+
+    /* Reflect if the payment could complete now */
+    gnc_payment_window_check_payment (pw);
+
+    return FALSE;
+}
+
+void
+gnc_payment_dialog_document_selection_changed_cb (GtkWidget *widget, gpointer data)
+{
+    PaymentWindow *pw = data;
+
+    if (!pw) return;
+
+    gnc_payment_dialog_document_selection_changed (pw);
+
+    /* Reflect if the payment could complete now */
+    gnc_payment_window_check_payment (pw);
+}
+
+void
+gnc_payment_dialog_xfer_acct_changed_cb (GtkWidget *widget, gpointer data)
+{
+    PaymentWindow *pw = data;
+
+    if (!pw) return;
+
+    /* Reflect if the payment could complete now */
+    gnc_payment_window_check_payment (pw);
+}
+
+int
+gnc_payment_dialog_post_to_changed_cb (GtkWidget *widget, gpointer data)
+{
+    PaymentWindow *pw = data;
+    Account *post_acct;
+
+    if (!pw) return FALSE;
+
+    post_acct = gnc_account_select_combo_get_active (pw->post_combo);
+
+    /* If this invoice really changed, then reset ourselves */
+    if (post_acct != pw->post_acct)
+    {
+        pw->post_acct = post_acct;
+        gnc_payment_dialog_post_to_changed(pw);
+    }
+    else
+        gnc_payment_dialog_highlight_document (pw);
+
+    /* Reflect if the payment could complete now */
+    gnc_payment_window_check_payment (pw);
+
+    return FALSE;
+}
+
+/*
+ * This helper function is called once for each row in the tree view
+ * that is currently selected.  Its task is to add the corresponding
+ * lot to the end of a glist.
+ */
+static void
+get_selected_lots (GtkTreeModel *model,
+                   GtkTreePath *path,
+                   GtkTreeIter *iter,
+                   gpointer data)
+{
+    GList **return_list = data;
+    GNCLot *lot;
+    GValue value = { 0 };
+
+    gtk_tree_model_get_value (model, iter, 5, &value);
+    lot = (GNCLot *) g_value_get_pointer (&value);
+    g_value_unset (&value);
+
+    if (lot)
+        *return_list = g_list_insert_sorted (*return_list, lot, (GCompareFunc)gncOwnerLotsSortFunc);
+}
+
+void
+gnc_payment_ok_cb (GtkWidget *widget, gpointer data)
+{
+    PaymentWindow *pw = data;
+    const char *text = NULL;
+
+    if (!pw)
+        return;
+
+    /* The gnc_payment_window_check_payment function
+     * ensures we have valid owner, post account, transfer account
+     * and amount so we can proceed with the payment.
+     * Note: make sure it's called before all entry points to this function !
+     */
+
+    /* We're on our way out, stop watching for object changes that could
+     * trigger a gui refresh. Without this the gui suspend/resume
+     * pair could still trigger a gui update on the payment dialog
+     * before we close it. This is undesired because the lots may be in
+     * an inconsistent state until after all events are handled. So
+     * the gui refresh may result in a crash.
+     * See https://bugzilla.gnome.org/show_bug.cgi?id=740471
+     */
+    gnc_gui_component_clear_watches (pw->component_id);
+
+    gnc_suspend_gui_refresh ();
+    {
+        const char *memo, *num;
+        GDate date;
+        Timespec ts;
+        gnc_numeric exch = gnc_numeric_create(1, 1); //default to "one to one" rate
+        GList *selected_lots = NULL;
+        GtkTreeSelection *selection;
+        gboolean auto_pay;
+
+        /* Obtain all our ancillary information */
+        memo = gtk_entry_get_text (GTK_ENTRY (pw->memo_entry));
+        num = gtk_entry_get_text (GTK_ENTRY (pw->num_entry));
+        g_date_clear (&date, 1);
+        gnc_date_edit_get_gdate (GNC_DATE_EDIT (pw->date_edit), &date);
+        ts = gdate_to_timespec (date);
+
+        /* Obtain the list of selected lots (documents/payments) from the dialog */
+        selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(pw->docs_list_tree_view));
+        gtk_tree_selection_selected_foreach (selection, get_selected_lots, &selected_lots);
+
+        /* When the payment amount is 0, the selected documents cancel each other out
+         * so no money is actually transferred.
+         * For non-zero payments money will be transferred between the post account
+         * and the transfer account. In that case if these two accounts don't have
+         * the same currency the user is asked to enter the exchange rate.
+         */
+        if (!gnc_numeric_zero_p (pw->amount_tot) &&
+            !gnc_commodity_equal(xaccAccountGetCommodity(pw->xfer_acct), xaccAccountGetCommodity(pw->post_acct)))
+        {
+            XferDialog* xfer;
+
+            text = _("The transfer and post accounts are associated with different currencies. Please specify the conversion rate.");
+
+            xfer = gnc_xfer_dialog(pw->dialog, pw->post_acct);
+            gnc_info_dialog(pw->dialog, "%s", text);
+
+            gnc_xfer_dialog_select_to_account(xfer, pw->xfer_acct);
+            gnc_xfer_dialog_set_amount(xfer, pw->amount_tot);
+
+            /* All we want is the exchange rate so prevent the user from thinking
+               it makes sense to mess with other stuff */
+            gnc_xfer_dialog_set_from_show_button_active(xfer, FALSE);
+            gnc_xfer_dialog_set_to_show_button_active(xfer, FALSE);
+            gnc_xfer_dialog_hide_from_account_tree(xfer);
+            gnc_xfer_dialog_hide_to_account_tree(xfer);
+            gnc_xfer_dialog_is_exchange_dialog(xfer, &exch);
+            gnc_xfer_dialog_run_until_done(xfer);
+        }
+
+        /* Perform the payment */
+        if (gncOwnerGetType (&(pw->owner)) == GNC_OWNER_CUSTOMER)
+            auto_pay = gnc_prefs_get_bool (GNC_PREFS_GROUP_INVOICE, GNC_PREF_AUTO_PAY);
+        else
+            auto_pay = gnc_prefs_get_bool (GNC_PREFS_GROUP_BILL, GNC_PREF_AUTO_PAY);
+
+        gncOwnerApplyPayment (&pw->owner, &(pw->pre_existing_txn), selected_lots,
+                              pw->post_acct, pw->xfer_acct, pw->amount_tot, exch,
+                              ts, memo, num, auto_pay);
+    }
+    gnc_resume_gui_refresh ();
+
+    /* Save the transfer account, xfer_acct */
+    gnc_payment_dialog_remember_account(pw, pw->xfer_acct);
+
+    if (gtk_widget_is_sensitive (pw->print_check) &&
+        gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(pw->print_check)))
+    {
+        Split *split = xaccTransFindSplitByAccount (pw->pre_existing_txn, pw->xfer_acct);
+        GList *splits = NULL;
+        splits = g_list_append(splits, split);
+        gnc_ui_print_check_dialog_create(NULL, splits);
+    }
+
+    gnc_ui_payment_window_destroy (pw);
+}
+
+void
+gnc_payment_cancel_cb (GtkWidget *widget, gpointer data)
+{
+    PaymentWindow *pw = data;
+    gnc_ui_payment_window_destroy (pw);
+}
+
+void
+gnc_payment_window_destroy_cb (GtkWidget *widget, gpointer data)
+{
+    PaymentWindow *pw = data;
+
+    if (!pw) return;
+
+    gnc_unregister_gui_component (pw->component_id);
+
+    g_list_free (pw->acct_types);
+    g_list_free (pw->acct_commodities);
+    g_free (pw);
+}
+
+void
+gnc_payment_acct_tree_row_activated_cb (GtkWidget *widget, GtkTreePath *path,
+                                        GtkTreeViewColumn *column, PaymentWindow *pw)
+{
+    GtkTreeView *view;
+    GtkTreeModel *model;
+    GtkTreeIter iter;
+
+    g_return_if_fail(widget);
+    view = GTK_TREE_VIEW(widget);
+
+    model = gtk_tree_view_get_model(view);
+    if (gtk_tree_model_get_iter(model, &iter, path))
+    {
+        if (gtk_tree_model_iter_has_child(model, &iter))
+        {
+            /* There are children,
+             * just expand or collapse the row. */
+            if (gtk_tree_view_row_expanded(view, path))
+                gtk_tree_view_collapse_row(view, path);
+            else
+                gtk_tree_view_expand_row(view, path, FALSE);
+        }
+        else if (gnc_payment_window_check_payment (pw))
+            /* It's an account without any children
+             * If all conditions for a valid payment are met click the Ok button. */
+            gnc_payment_ok_cb(widget, pw);
+    }
+}
+
+void
+gnc_payment_leave_amount_cb (GtkWidget *widget, GdkEventFocus *event,
+                             PaymentWindow *pw)
+{
+    gnc_numeric amount_deb, amount_cred, amount_tot;
+
+    if (! pw->amount_credit_edit || ! pw->amount_debit_edit)
+        return;
+
+    /* If both credit and debit amount are entered, simplify it to either one */
+    amount_deb  = gnc_amount_edit_get_amount (GNC_AMOUNT_EDIT (pw->amount_debit_edit));
+    amount_cred = gnc_amount_edit_get_amount (GNC_AMOUNT_EDIT (pw->amount_credit_edit));
+    amount_tot = gnc_numeric_sub (amount_cred, amount_deb,
+                                  gnc_commodity_get_fraction (xaccAccountGetCommodity (pw->post_acct)),
+                                  GNC_HOW_RND_ROUND_HALF_UP);
+
+    gnc_ui_payment_window_set_amount (pw, amount_tot);
+
+    /* Reflect if the payment could complete now */
+    gnc_payment_window_check_payment (pw);
+}
+
+/* Select the list of accoutns to show in the tree */
+static void
+gnc_payment_set_account_types (GncTreeViewAccount *tree)
+{
+    AccountViewInfo avi;
+    int i;
+
+    gnc_tree_view_account_get_view_info (tree, &avi);
+
+    for (i = 0; i < NUM_ACCOUNT_TYPES; i++)
+        avi.include_type[i] = gncBusinessIsPaymentAcctType (i);
+
+    gnc_tree_view_account_set_view_info (tree, &avi);
+}
+
+static gboolean
+find_handler (gpointer find_data, gpointer user_data)
+{
+    PaymentWindow *pw = user_data;
+
+    return (pw != NULL);
+}
+
+static void print_date (GtkTreeViewColumn *tree_column,
+                        GtkCellRenderer *cell,
+                        GtkTreeModel *tree_model,
+                        GtkTreeIter *iter,
+                        gpointer data)
+{
+    GValue value = { 0 };
+    time64 doc_date_time;
+    gchar *doc_date_str;
+
+    g_return_if_fail (cell && iter && tree_model);
+
+
+    gtk_tree_model_get_value (tree_model, iter, 0, &value);
+    doc_date_time = (time64) g_value_get_int64 (&value);
+    g_value_unset (&value);
+    doc_date_str = qof_print_date (doc_date_time);
+    g_object_set (G_OBJECT (cell), "text", doc_date_str, NULL);
+    g_free (doc_date_str);
+}
+
+static PaymentWindow *
+new_payment_window (GncOwner *owner, QofBook *book, GncInvoice *invoice)
+{
+    PaymentWindow *pw;
+    GtkBuilder *builder;
+    GtkWidget *box, *label, *credit_box, *debit_box;
+    GtkTreeSelection *selection;
+    GtkTreeViewColumn *column;
+    GtkCellRenderer *renderer;
+    char * cm_class = (gncOwnerGetType (owner) == GNC_OWNER_CUSTOMER ?
+                       DIALOG_PAYMENT_CUSTOMER_CM_CLASS :
+                       DIALOG_PAYMENT_VENDOR_CM_CLASS);
+
+    /*
+     * Find an existing payment window.  If found, bring it to
+     * the front.  If we have an actual owner, then set it in
+     * the window.
+     */
+
+    pw = gnc_find_first_gui_component (cm_class, find_handler, NULL);
+    if (pw)
+    {
+        if (gncOwnerIsValid(owner))
+            gnc_payment_set_owner (pw, owner);
+
+        // Reset the setting about the pre-existing TXN
+        pw->pre_existing_txn = NULL;
+
+        gtk_window_present (GTK_WINDOW(pw->dialog));
+        return(pw);
+    }
+
+    /* Ok, we need a new window */
+
+    pw = g_new0 (PaymentWindow, 1);
+    pw->book = book;
+    gncOwnerCopy (owner, &(pw->owner));
+
+    /* Compute the post-to account types */
+    pw->acct_types = gncOwnerGetAccountTypesList (owner);
+
+    if (gncOwnerIsValid(owner))
+        pw->acct_commodities = gncOwnerGetCommoditiesList (owner);
+
+    /* Open and read the Glade File */
+    builder = gtk_builder_new();
+    gnc_builder_add_from_file (builder, "dialog-payment.glade", "docs_list_hor_adj");
+    gnc_builder_add_from_file (builder, "dialog-payment.glade", "docs_list_vert_adj");
+    gnc_builder_add_from_file (builder, "dialog-payment.glade", "docs_list_model");
+    gnc_builder_add_from_file (builder, "dialog-payment.glade", "post_combo_model");
+    gnc_builder_add_from_file (builder, "dialog-payment.glade", "payment_dialog");
+    pw->dialog = GTK_WIDGET (gtk_builder_get_object (builder, "payment_dialog"));
+
+    // Set the style context for this dialog so it can be easily manipulated with css
+    gnc_widget_set_style_context (GTK_WIDGET(pw->dialog), "GncPaymentDialog");
+
+    /* Grab the widgets and build the dialog */
+    pw->payment_warning = GTK_WIDGET (gtk_builder_get_object (builder, "payment_warning"));
+    pw->ok_button = GTK_WIDGET (gtk_builder_get_object (builder, "okbutton"));
+    pw->num_entry = GTK_WIDGET (gtk_builder_get_object (builder, "num_entry"));
+    pw->memo_entry = GTK_WIDGET (gtk_builder_get_object (builder, "memo_entry"));
+    pw->commodity_label = GTK_WIDGET (gtk_builder_get_object (builder, "commodity_label"));
+    pw->post_combo = GTK_WIDGET (gtk_builder_get_object (builder, "post_combo"));
+    gtk_combo_box_set_entry_text_column( GTK_COMBO_BOX( pw->post_combo ), 0 );
+    gnc_cbwe_require_list_item(GTK_COMBO_BOX(pw->post_combo));
+
+    label = GTK_WIDGET (gtk_builder_get_object (builder, "owner_label"));
+    box = GTK_WIDGET (gtk_builder_get_object (builder, "owner_box"));
+    pw->owner_choice = gnc_owner_select_create (label, box, book, owner);
+
+    /* Some terminology:
+     * Invoices are paid, credit notes are refunded.
+     * A customer payment is a credit action, paying a vendor is debit
+     *
+     * So depending on the owner the payment amount should be considered
+     * credit (customer) or debit (vendor/employee) and refunds should be
+     * considered debit (customer) or credit (vendor/employee).
+     * For visual consistency, the dialog box will always show a payment and
+     * a refund field. Internally they are treated as credit or debit depending
+     * on the owner type.
+     */
+    if (gncOwnerGetType (owner) == GNC_OWNER_CUSTOMER)
+    {
+        debit_box = GTK_WIDGET (gtk_builder_get_object (builder, "amount_refund_box"));
+        credit_box = GTK_WIDGET (gtk_builder_get_object (builder, "amount_payment_box"));
+    }
+    else
+    {
+        debit_box = GTK_WIDGET (gtk_builder_get_object (builder, "amount_payment_box"));
+        credit_box = GTK_WIDGET (gtk_builder_get_object (builder, "amount_refund_box"));
+    }
+
+    pw->amount_debit_edit = gnc_amount_edit_new ();
+    gtk_box_pack_start (GTK_BOX (debit_box), pw->amount_debit_edit, TRUE, TRUE, 0);
+    gnc_amount_edit_set_evaluate_on_enter (GNC_AMOUNT_EDIT (pw->amount_debit_edit),
+                                           TRUE);
+    gnc_amount_edit_set_amount (GNC_AMOUNT_EDIT (pw->amount_debit_edit), gnc_numeric_zero());
+    g_signal_connect(G_OBJECT(gnc_amount_edit_gtk_entry(GNC_AMOUNT_EDIT(pw->amount_debit_edit))),
+                     "focus-out-event",
+                     G_CALLBACK(gnc_payment_leave_amount_cb), pw);
+
+    pw->amount_credit_edit = gnc_amount_edit_new ();
+    gtk_box_pack_start (GTK_BOX (credit_box), pw->amount_credit_edit, TRUE, TRUE, 0);
+    gnc_amount_edit_set_evaluate_on_enter (GNC_AMOUNT_EDIT (pw->amount_credit_edit),
+                                           TRUE);
+    gnc_amount_edit_set_amount (GNC_AMOUNT_EDIT (pw->amount_credit_edit), gnc_numeric_zero());
+    g_signal_connect(G_OBJECT(gnc_amount_edit_gtk_entry(GNC_AMOUNT_EDIT(pw->amount_credit_edit))),
+                     "focus-out-event",
+                     G_CALLBACK(gnc_payment_leave_amount_cb), pw);
+
+    box = GTK_WIDGET (gtk_builder_get_object (builder, "date_box"));
+    pw->date_edit = gnc_date_edit_new (time(NULL), FALSE, FALSE);
+    gtk_box_pack_start (GTK_BOX (box), pw->date_edit, TRUE, TRUE, 0);
+    pw->print_check = GTK_WIDGET (gtk_builder_get_object (builder, "print_check"));
+
+    pw->docs_list_tree_view = GTK_WIDGET (gtk_builder_get_object (builder, "docs_list_tree_view"));
+    selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(pw->docs_list_tree_view));
+    gtk_tree_selection_set_mode (selection, GTK_SELECTION_MULTIPLE);
+
+    // Set grid lines option to preference
+    gtk_tree_view_set_grid_lines (GTK_TREE_VIEW(pw->docs_list_tree_view), gnc_tree_view_get_grid_lines_pref ());
+
+    /* Configure date column */
+    renderer = gtk_cell_renderer_text_new ();
+    column = gtk_tree_view_get_column (GTK_TREE_VIEW (pw->docs_list_tree_view), 0);
+    gtk_tree_view_column_pack_start (column, renderer, TRUE);
+    tree_view_column_set_default_width (GTK_TREE_VIEW (pw->docs_list_tree_view),
+                                        column, "31-12-2013");
+    gtk_tree_view_column_set_cell_data_func (column, renderer,
+                                             (GtkTreeCellDataFunc) print_date,
+                                             NULL, NULL);
+
+    /* Configure document number column */
+    column = gtk_tree_view_get_column (GTK_TREE_VIEW (pw->docs_list_tree_view), 1);
+    tree_view_column_set_default_width (GTK_TREE_VIEW (pw->docs_list_tree_view),
+                                        column, "INV2013-016");
+
+    /* Configure document type column */
+    column = gtk_tree_view_get_column (GTK_TREE_VIEW (pw->docs_list_tree_view), 2);
+    tree_view_column_set_default_width (GTK_TREE_VIEW (pw->docs_list_tree_view),
+                                        column, _("Credit Note"));
+
+    /* Configure debit column */
+    column = gtk_tree_view_get_column (GTK_TREE_VIEW (pw->docs_list_tree_view), 3);
+    tree_view_column_set_default_width (GTK_TREE_VIEW (pw->docs_list_tree_view),
+                                        column, "11,999.00");
+
+    /* Configure credit column */
+    column = gtk_tree_view_get_column (GTK_TREE_VIEW (pw->docs_list_tree_view), 4);
+    tree_view_column_set_default_width (GTK_TREE_VIEW (pw->docs_list_tree_view),
+                                        column, "11,999.00");
+
+    gtk_tree_sortable_set_sort_column_id (
+        GTK_TREE_SORTABLE (gtk_tree_view_get_model (GTK_TREE_VIEW (pw->docs_list_tree_view))),
+        0, GTK_SORT_ASCENDING);
+
+
+    box = GTK_WIDGET (gtk_builder_get_object (builder, "acct_window"));
+    pw->acct_tree = GTK_WIDGET(gnc_tree_view_account_new (FALSE));
+    gtk_container_add (GTK_CONTAINER (box), pw->acct_tree);
+    gtk_tree_view_set_headers_visible (GTK_TREE_VIEW(pw->acct_tree), FALSE);
+    gnc_payment_set_account_types (GNC_TREE_VIEW_ACCOUNT (pw->acct_tree));
+
+    /* Set the dialog for the 'new' owner.
+     * Note that this also sets the post account tree. */
+    gnc_payment_dialog_owner_changed(pw);
+
+    /* Set the dialog for the 'new' invoice */
+    pw->invoice = invoice;
+    if (invoice)
+    {
+        Account *postacct = gncInvoiceGetPostedAcc (invoice);
+        if (postacct)
+        {
+            gchar *acct_string = gnc_account_get_full_name (postacct);
+            gnc_cbwe_set_by_string(GTK_COMBO_BOX(pw->post_combo), acct_string);
+            gnc_payment_dialog_post_to_changed_cb (pw->post_combo, pw);
+            g_free(acct_string);
+        }
+    }
+
+    /* Setup signals */
+    gtk_builder_connect_signals_full( builder,
+                                      gnc_builder_connect_full_func,
+                                      pw);
+
+    g_signal_connect (G_OBJECT (pw->owner_choice), "changed",
+                      G_CALLBACK (gnc_payment_dialog_owner_changed_cb), pw);
+
+    g_signal_connect (G_OBJECT (pw->acct_tree), "row-activated",
+                      G_CALLBACK (gnc_payment_acct_tree_row_activated_cb), pw);
+
+    selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(pw->acct_tree));
+    g_signal_connect (G_OBJECT (selection), "changed",
+                      G_CALLBACK (gnc_payment_dialog_xfer_acct_changed_cb), pw);
+
+
+    /* Register with the component manager */
+    pw->component_id =
+        gnc_register_gui_component (cm_class,
+                                    gnc_payment_window_refresh_handler,
+                                    gnc_payment_window_close_handler,
+                                    pw);
+
+    /* Watch for any new or changed accounts */
+    gnc_gui_component_watch_entity_type (pw->component_id,
+                                         GNC_ID_ACCOUNT,
+                                         QOF_EVENT_CREATE | QOF_EVENT_MODIFY |
+                                         QOF_EVENT_DESTROY);
+
+    /* Show it all */
+    gtk_widget_show_all (pw->dialog);
+    g_object_unref(G_OBJECT(builder));
+
+    // The customer choice widget should have keyboard focus
+    if (GNC_IS_GENERAL_SEARCH(pw->owner_choice))
+    {
+        gnc_general_search_grab_focus(GNC_GENERAL_SEARCH(pw->owner_choice));
+    }
+
+    /* Reflect if the payment could complete now */
+    gnc_payment_window_check_payment (pw);
+
+    /* Warn the user if they have no valid post-to accounts */
+    {
+        const gchar *text;
+        const char *acct_type;
+
+        text = gtk_entry_get_text(GTK_ENTRY (gtk_bin_get_child(GTK_BIN (GTK_COMBO_BOX(pw->post_combo)))));
+
+        if (!text || g_strcmp0 (text, "") == 0)
+        {
+
+            /* The code below assumes there will only be one account type.
+             * Let's assert this to protect from potential future changes. */
+            g_assert (g_list_length (pw->acct_types) == 1);
+            acct_type = xaccAccountGetTypeStr(GPOINTER_TO_INT(pw->acct_types->data));
+            gnc_warning_dialog(pw->dialog,
+                               _("You have no valid \"Post To\" accounts. "
+                                 "Please create an account of type \"%s\" "
+                                 "before you continue to process this payment. "
+                                 "Perhaps you want to create an Invoice or "
+                                 "Bill first?"),
+                               acct_type);
+        }
+    }
+
+    return pw;
+}
+
+
+void
+gnc_ui_payment_window_destroy (PaymentWindow *pw)
+{
+    if (!pw) return;
+    gnc_close_gui_component (pw->component_id);
+}
+
+PaymentWindow *
+gnc_ui_payment_new_with_invoice (const GncOwner *owner, QofBook *book,
+                                 GncInvoice *invoice)
+{
+    GncOwner owner_def;
+
+    if (!book) return NULL;
+    if (owner)
+    {
+        /* Figure out the company */
+        gncOwnerCopy (gncOwnerGetEndOwner (owner), &owner_def);
+    }
+    else
+    {
+        gncOwnerInitCustomer (&owner_def, NULL);
+    }
+
+    return new_payment_window (&owner_def, book, invoice);
+}
+
+PaymentWindow *
+gnc_ui_payment_new (GncOwner *owner, QofBook *book)
+{
+    return gnc_ui_payment_new_with_invoice (owner, book, NULL);
+}
+
+// ///////////////
+
+gboolean gnc_ui_payment_is_customer_payment(const Transaction *txn)
+{
+    gboolean result = TRUE;
+    Split *assetaccount_split, *aparaccount_split;
+    gnc_numeric amount;
+
+    if (!txn)
+        return result;
+
+    if (!xaccTransGetSplitList(txn))
+        return result;
+
+    /* First test if one split is in an A/R or A/P account.
+     * That will give us the best Customer vs Vendor/Employee distinction */
+    aparaccount_split = xaccTransGetFirstAPARAcctSplit(txn);
+    if (aparaccount_split)
+    {
+        if (xaccAccountGetType (xaccSplitGetAccount (aparaccount_split)) == ACCT_TYPE_RECEIVABLE)
+            return TRUE;  // Type is Customer
+        else if (xaccAccountGetType (xaccSplitGetAccount (aparaccount_split)) == ACCT_TYPE_PAYABLE)
+            return FALSE; // Type is Vendor/Employee, there's not enough information to refine more
+    }
+
+    /* For the lack of an A/R or A/P account we'll assume positive changes to an
+     * Asset/Liability or Equity account are Customer payments the others will be
+     * considered Vendor payments */
+    assetaccount_split = xaccTransGetFirstPaymentAcctSplit(txn);
+    if (!assetaccount_split)
+    {
+        /* Transaction isn't valid for a payment, just return the default
+         * Calling code will have to handle this situation properly */
+        g_message("No asset splits in txn \"%s\"; cannot use this for assigning a payment.",
+                  xaccTransGetDescription(txn));
+        return result;
+    }
+
+    assetaccount_split = xaccTransGetFirstPaymentAcctSplit(txn);
+    amount = xaccSplitGetValue(assetaccount_split);
+    result = gnc_numeric_positive_p(amount); // positive amounts == customer
+    //g_message("Amount=%s", gnc_numeric_to_string(amount));
+    return result;
+}
+
+// ///////////////
+
+PaymentWindow * gnc_ui_payment_new_with_txn (GncOwner *owner, Transaction *txn)
+{
+    Split *assetaccount_split;
+    Split *postaccount_split;
+    gnc_numeric amount;
+    PaymentWindow *pw;
+
+    if (!txn)
+        return NULL;
+
+    // We require the txn to have one split in an Asset account.
+
+    if (!xaccTransGetSplitList(txn))
+        return NULL;
+    assetaccount_split = xaccTransGetFirstPaymentAcctSplit(txn);
+    if (!assetaccount_split)
+    {
+        g_message("No asset splits in txn \"%s\"; cannot use this for assigning a payment.",
+                  xaccTransGetDescription(txn));
+        return NULL;
+    }
+
+    postaccount_split = xaccTransGetFirstAPARAcctSplit(txn); // watch out: Might be NULL
+    amount = xaccSplitGetValue(assetaccount_split);
+
+    pw = gnc_ui_payment_new(owner,
+                            qof_instance_get_book(QOF_INSTANCE(txn)));
+    g_assert(assetaccount_split); // we can rely on this because of the check above
+    g_debug("Amount=%s", gnc_numeric_to_string(amount));
+
+    // Fill in the values from the given txn
+    pw->pre_existing_txn = txn;
+    gnc_ui_payment_window_set_num(pw, gnc_get_num_action(txn, assetaccount_split));
+    gnc_ui_payment_window_set_memo(pw, xaccTransGetDescription(txn));
+    {
+        GDate txn_date = xaccTransGetDatePostedGDate (txn);
+        gnc_ui_payment_window_set_date(pw, &txn_date);
+    }
+    gnc_ui_payment_window_set_amount(pw, amount);
+    gnc_ui_payment_window_set_xferaccount(pw, xaccSplitGetAccount(assetaccount_split));
+    if (postaccount_split)
+        gnc_ui_payment_window_set_postaccount(pw, xaccSplitGetAccount(postaccount_split));
+
+    return pw;
+}
diff --git a/src/gnome/dialog-payment.h b/gnucash/gnome/dialog-payment.h
similarity index 100%
rename from src/gnome/dialog-payment.h
rename to gnucash/gnome/dialog-payment.h
diff --git a/gnucash/gnome/dialog-price-edit-db.c b/gnucash/gnome/dialog-price-edit-db.c
new file mode 100644
index 0000000..9d8cc04
--- /dev/null
+++ b/gnucash/gnome/dialog-price-edit-db.c
@@ -0,0 +1,568 @@
+/********************************************************************\
+ * dialog-price-editor.c -- price selector dialog                   *
+ * Copyright (C) 2001 Gnumatic, Inc.                                *
+ * Author: Dave Peticolas <dave at krondo.com>                         *
+ * Copyright (C) 2003,2005 David Hampton                            *
+ * Copyright (C) 2011 Robert Fewell                                 *
+ *                                                                  *
+ * 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 at gnu.org                   *
+\********************************************************************/
+
+#include "config.h"
+
+#include <gtk/gtk.h>
+#include <glib/gi18n.h>
+#include <libguile.h>
+#include "guile-mappings.h"
+#include <time.h>
+
+#include "dialog-utils.h"
+#include "gnc-amount-edit.h"
+#include "gnc-commodity-edit.h"
+#include "gnc-general-select.h"
+#include "gnc-component-manager.h"
+#include "gnc-currency-edit.h"
+#include "gnc-date-edit.h"
+#include "gnc-engine.h"
+#include "gnc-gui-query.h"
+#include "gnc-pricedb.h"
+#include "gnc-session.h"
+#include "gnc-tree-view-price.h"
+#include "gnc-ui.h"
+#include "gnc-ui-util.h"
+#include "gnc-warnings.h"
+#include "guile-util.h"
+#include "engine-helpers-guile.h"
+#include "swig-runtime.h"
+
+
+#define DIALOG_PRICE_DB_CM_CLASS "dialog-price-edit-db"
+#define STATE_SECTION "dialogs/edit_prices"
+#define GNC_PREFS_GROUP "dialogs.pricedb-editor"
+
+/* This static indicates the debugging module that this .o belongs to.  */
+static QofLogModule log_module = GNC_MOD_GUI;
+
+
+void gnc_prices_dialog_window_destroy_cb (GtkWidget *object, gpointer data);
+void gnc_prices_dialog_close_cb (GtkDialog *dialog, gpointer data);
+void gnc_prices_dialog_response (GtkDialog *dialog, gint response_id, gpointer data);
+void gnc_prices_dialog_edit_clicked (GtkWidget *widget, gpointer data);
+void gnc_prices_dialog_remove_clicked (GtkWidget *widget, gpointer data);
+void gnc_prices_dialog_remove_old_clicked (GtkWidget *widget, gpointer data);
+void gnc_prices_dialog_add_clicked (GtkWidget *widget, gpointer data);
+void gnc_prices_dialog_get_quotes_clicked (GtkWidget *widget, gpointer data);
+
+
+typedef struct
+{
+    GtkWidget * dialog;
+    QofSession *session;
+    QofBook *book;
+    GNCPriceDB *price_db;
+
+    GncTreeViewPrice * price_tree;
+
+    GtkWidget * edit_button;
+    GtkWidget * remove_button;
+} PricesDialog;
+
+
+void
+gnc_prices_dialog_window_destroy_cb (GtkWidget *object, gpointer data)
+{
+    PricesDialog *pdb_dialog = data;
+
+    ENTER(" ");
+    gnc_unregister_gui_component_by_data (DIALOG_PRICE_DB_CM_CLASS, pdb_dialog);
+
+    if (pdb_dialog->dialog)
+    {
+        gtk_widget_destroy(pdb_dialog->dialog);
+        pdb_dialog->dialog = NULL;
+    }
+
+    g_free (pdb_dialog);
+    LEAVE(" ");
+}
+
+
+void
+gnc_prices_dialog_close_cb (GtkDialog *dialog, gpointer data)
+{
+    PricesDialog *pdb_dialog = data;
+
+    ENTER(" ");
+    gnc_close_gui_component_by_data (DIALOG_PRICE_DB_CM_CLASS, pdb_dialog);
+    LEAVE(" ");
+}
+
+
+void
+gnc_prices_dialog_response (GtkDialog *dialog, gint response_id, gpointer data)
+{
+    PricesDialog *pdb_dialog = data;
+
+    ENTER(" ");
+    gnc_close_gui_component_by_data (DIALOG_PRICE_DB_CM_CLASS, pdb_dialog);
+    LEAVE(" ");
+}
+
+
+void
+gnc_prices_dialog_edit_clicked (GtkWidget *widget, gpointer data)
+{
+    PricesDialog *pdb_dialog = data;
+    GList *price_list;
+
+    ENTER(" ");
+    price_list = gnc_tree_view_price_get_selected_prices(pdb_dialog->price_tree);
+    if (!price_list)
+    {
+        LEAVE("no price selected");
+        return;
+    }
+    if (g_list_next(price_list))
+    {
+        g_list_free(price_list);
+        LEAVE("too many prices selected");
+        return;
+    }
+
+    gnc_price_edit_dialog (pdb_dialog->dialog, pdb_dialog->session,
+                           price_list->data, GNC_PRICE_EDIT);
+    g_list_free(price_list);
+    LEAVE(" ");
+}
+
+
+static void
+remove_helper(GNCPrice *price, GNCPriceDB *pdb)
+{
+    gnc_pricedb_remove_price (pdb, price);
+}
+
+
+void
+gnc_prices_dialog_remove_clicked (GtkWidget *widget, gpointer data)
+{
+    PricesDialog *pdb_dialog = data;
+    GList *price_list;
+    gint length, response;
+    GtkWidget *dialog;
+
+    ENTER(" ");
+    price_list = gnc_tree_view_price_get_selected_prices(pdb_dialog->price_tree);
+    if (!price_list)
+    {
+        LEAVE("no price selected");
+        return;
+    }
+
+    length = g_list_length(price_list);
+    if (length > 1)
+    {
+        gchar *message;
+
+        message = g_strdup_printf
+                  (/* Translators: %d is the number of prices. This
+	  is a ngettext(3) message. */
+                      ngettext("Are you sure you want to delete the selected price?",
+                               "Are you sure you want to delete the %d selected prices?",
+                               length),
+                      length);
+        dialog = gtk_message_dialog_new(GTK_WINDOW(pdb_dialog->dialog),
+                                        GTK_DIALOG_DESTROY_WITH_PARENT,
+                                        GTK_MESSAGE_QUESTION,
+                                        GTK_BUTTONS_NONE,
+                                        "%s", _("Delete prices?"));
+        gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
+                "%s", message);
+        g_free(message);
+        gtk_dialog_add_buttons(GTK_DIALOG(dialog),
+                               _("_Cancel"), GTK_RESPONSE_CANCEL,
+                               _("_Delete"), GTK_RESPONSE_YES,
+                               (gchar *)NULL);
+        gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_YES);
+        response = gnc_dialog_run(GTK_DIALOG(dialog), GNC_PREF_WARN_PRICE_QUOTES_DEL);
+        gtk_widget_destroy(dialog);
+    }
+    else
+    {
+        response = GTK_RESPONSE_YES;
+    }
+
+    if (response == GTK_RESPONSE_YES)
+    {
+        g_list_foreach(price_list, (GFunc)remove_helper, pdb_dialog->price_db);
+    }
+    g_list_free(price_list);
+    LEAVE(" ");
+}
+
+
+void
+gnc_prices_dialog_remove_old_clicked (GtkWidget *widget, gpointer data)
+{
+    PricesDialog *pdb_dialog = data;
+    GtkBuilder *builder;
+    GtkWidget *dialog, *button, *date, *label, *box;
+    gint result;
+    gboolean delete_user, delete_last;
+
+    ENTER(" ");
+    builder = gtk_builder_new();
+    gnc_builder_add_from_file (builder, "dialog-price.glade", "deletion_date_dialog");
+
+    dialog = GTK_WIDGET(gtk_builder_get_object (builder, "deletion_date_dialog"));
+
+    box = GTK_WIDGET(gtk_builder_get_object (builder, "date_hbox"));
+    date = gnc_date_edit_new (time (NULL), FALSE, FALSE);
+
+    gtk_box_pack_start (GTK_BOX (box), date, TRUE, TRUE, 0);
+    gtk_widget_show (date);
+    gtk_entry_set_activates_default(GTK_ENTRY(GNC_DATE_EDIT(date)->date_entry), TRUE);
+    label = GTK_WIDGET(gtk_builder_get_object (builder, "date_label"));
+    gnc_date_make_mnemonic_target (GNC_DATE_EDIT(date), label);
+
+    gtk_builder_connect_signals_full (builder, gnc_builder_connect_full_func, pdb_dialog);
+
+    gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (pdb_dialog->dialog));
+
+    result = gtk_dialog_run (GTK_DIALOG (dialog));
+    if (result == GTK_RESPONSE_OK)
+    {
+        Timespec ts;
+
+        DEBUG("deleting prices");
+        ts.tv_sec = gnc_date_edit_get_date (GNC_DATE_EDIT (date));
+        ts.tv_nsec = 0;
+
+        button = GTK_WIDGET(gtk_builder_get_object (builder, "delete_manual"));
+        delete_user = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button));
+        button = GTK_WIDGET(gtk_builder_get_object (builder, "delete_last"));
+        delete_last = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button));
+
+        gnc_pricedb_remove_old_prices(pdb_dialog->price_db, ts,
+                                      delete_user, delete_last);
+    }
+
+    gtk_widget_destroy(dialog);
+    LEAVE(" ");
+}
+
+
+void
+gnc_prices_dialog_add_clicked (GtkWidget *widget, gpointer data)
+{
+    PricesDialog *pdb_dialog = data;
+    GNCPrice *price = NULL;
+    GList *price_list;
+
+    ENTER(" ");
+    price_list = gnc_tree_view_price_get_selected_prices(pdb_dialog->price_tree);
+    if (price_list)
+    {
+        price = price_list->data;
+        g_list_free(price_list);
+    }
+    gnc_price_edit_dialog (pdb_dialog->dialog, pdb_dialog->session,
+                           price, GNC_PRICE_NEW);
+    LEAVE(" ");
+}
+
+
+void
+gnc_prices_dialog_get_quotes_clicked (GtkWidget *widget, gpointer data)
+{
+    PricesDialog *pdb_dialog = data;
+    SCM quotes_func;
+    SCM book_scm;
+    SCM scm_window;
+
+    ENTER(" ");
+    quotes_func = scm_c_eval_string ("gnc:book-add-quotes");
+    if (!scm_is_procedure (quotes_func))
+    {
+        LEAVE(" no procedure");
+        return;
+    }
+
+    book_scm = gnc_book_to_scm (pdb_dialog->book);
+    if (scm_is_true (scm_not (book_scm)))
+    {
+        LEAVE("no book");
+        return;
+    }
+
+    scm_window =  SWIG_NewPointerObj(pdb_dialog->dialog,
+                                     SWIG_TypeQuery("_p_GtkWidget"), 0);
+
+    gnc_set_busy_cursor (NULL, TRUE);
+    scm_call_2 (quotes_func, scm_window, book_scm);
+    gnc_unset_busy_cursor (NULL);
+
+    /* Without this, the summary bar on the accounts tab
+     * won't reflect the new prices (bug #522095). */
+    gnc_gui_refresh_all ();
+
+    LEAVE(" ");
+}
+
+
+static void
+gnc_prices_dialog_selection_changed (GtkTreeSelection *treeselection,
+                                     gpointer data)
+{
+    PricesDialog *pdb_dialog = data;
+    GList *price_list;
+    gint length;
+
+    ENTER(" ");
+    price_list = gnc_tree_view_price_get_selected_prices(pdb_dialog->price_tree);
+    length = g_list_length(price_list);
+
+    gtk_widget_set_sensitive (pdb_dialog->edit_button,
+                              length == 1);
+    gtk_widget_set_sensitive (pdb_dialog->remove_button,
+                              length >= 1);
+    LEAVE("%d prices selected", length);
+}
+
+
+static gboolean
+gnc_price_dialog_filter_ns_func (gnc_commodity_namespace *name_space,
+                                 gpointer data)
+{
+    PricesDialog *pdb_dialog = data;
+    const gchar *name;
+    static GList *cm_list;
+    GList *item;
+
+    /* Never show the template list */
+    name = gnc_commodity_namespace_get_name (name_space);
+    if (g_strcmp0 (name, GNC_COMMODITY_NS_TEMPLATE) == 0)
+        return FALSE;
+
+    /* See if this namespace has commodities */
+    cm_list = gnc_commodity_namespace_get_commodity_list(name_space);
+    for (item = cm_list; item; item = g_list_next(item))
+    {
+
+        /* For each commodity, see if there are prices */
+        if (gnc_pricedb_has_prices(pdb_dialog->price_db, item->data, NULL))
+        {
+            return TRUE;
+        }
+    }
+
+    //  printf("Namespace %s not visible\n", name);
+    return FALSE;
+}
+
+
+static gboolean
+gnc_price_dialog_filter_cm_func (gnc_commodity *commodity,
+                                 gpointer data)
+{
+    PricesDialog *pdb_dialog = data;
+
+    /* Show any commodity that has prices */
+    return gnc_pricedb_has_prices(pdb_dialog->price_db, commodity, NULL);
+}
+
+
+static void
+row_activated_cb (GtkTreeView *view, GtkTreePath *path,
+                  GtkTreeViewColumn *column, gpointer data)
+{
+    GtkTreeModel *model;
+    GtkTreeIter iter;
+
+    g_return_if_fail(view);
+
+    model = gtk_tree_view_get_model(view);
+    if (gtk_tree_model_get_iter(model, &iter, path))
+    {
+        if (gtk_tree_model_iter_has_child(model, &iter))
+        {
+            /* There are children, so it's not a price.
+             * Just expand or collapse the row. */
+            if (gtk_tree_view_row_expanded(view, path))
+                gtk_tree_view_collapse_row(view, path);
+            else
+                gtk_tree_view_expand_row(view, path, FALSE);
+        }
+        else
+            /* It's a price, so click the Edit button. */
+            gnc_prices_dialog_edit_clicked(GTK_WIDGET(view), data);
+    }
+}
+
+
+static void
+gnc_prices_dialog_create (GtkWidget * parent, PricesDialog *pdb_dialog)
+{
+    GtkWidget *dialog, *scrolled_window;
+    GtkBuilder *builder;
+    GtkTreeView *view;
+    GtkTreeSelection *selection;
+
+    ENTER(" ");
+    builder = gtk_builder_new();
+    gnc_builder_add_from_file (builder, "dialog-price.glade", "prices_dialog");
+
+    dialog = GTK_WIDGET(gtk_builder_get_object (builder, "prices_dialog"));
+    pdb_dialog->dialog = dialog;
+
+    // Set the style context for this dialog so it can be easily manipulated with css
+    gnc_widget_set_style_context (GTK_WIDGET(dialog), "GncPriceEditDialog");
+
+    pdb_dialog->session = gnc_get_current_session();
+    pdb_dialog->book = qof_session_get_book(pdb_dialog->session);
+    pdb_dialog->price_db = gnc_pricedb_get_db(pdb_dialog->book);
+
+    /* parent */
+    if (parent != NULL)
+        gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (parent));
+
+    /* default to 'close' button */
+    gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_CLOSE);
+
+    /* price tree */
+    scrolled_window = GTK_WIDGET(gtk_builder_get_object (builder, "price_list_window"));
+    view = gnc_tree_view_price_new(pdb_dialog->book,
+                                   "state-section", STATE_SECTION,
+                                   "show-column-menu", TRUE,
+                                   NULL);
+    pdb_dialog->price_tree = GNC_TREE_VIEW_PRICE(view);
+    gtk_container_add (GTK_CONTAINER (scrolled_window), GTK_WIDGET(view));
+    gnc_tree_view_price_set_filter (pdb_dialog->price_tree,
+                                    gnc_price_dialog_filter_ns_func,
+                                    gnc_price_dialog_filter_cm_func,
+                                    NULL,
+                                    pdb_dialog, NULL);
+
+    selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (view));
+    gtk_tree_selection_set_mode(selection, GTK_SELECTION_MULTIPLE);
+    g_signal_connect (G_OBJECT (selection), "changed",
+                      G_CALLBACK (gnc_prices_dialog_selection_changed), pdb_dialog);
+
+    g_signal_connect (G_OBJECT (view), "row-activated",
+                      G_CALLBACK (row_activated_cb), pdb_dialog);
+
+    /* buttons */
+    {
+        GtkWidget *button;
+
+        button = GTK_WIDGET(gtk_builder_get_object (builder, "edit_button"));
+        pdb_dialog->edit_button = button;
+
+        button = GTK_WIDGET(gtk_builder_get_object (builder, "remove_button"));
+        pdb_dialog->remove_button = button;
+
+        if (!gnc_quote_source_fq_installed())
+        {
+            button = GTK_WIDGET(gtk_builder_get_object (builder, "get_quotes_button"));
+            gtk_widget_set_sensitive(button, FALSE);
+        }
+    }
+
+    gtk_builder_connect_signals_full (builder, gnc_builder_connect_full_func, pdb_dialog);
+
+    g_object_unref(G_OBJECT(builder));
+
+    gnc_restore_window_size(GNC_PREFS_GROUP, GTK_WINDOW(pdb_dialog->dialog));
+    LEAVE(" ");
+}
+
+
+static void
+close_handler (gpointer user_data)
+{
+    PricesDialog *pdb_dialog = user_data;
+
+    ENTER(" ");
+    gnc_save_window_size(GNC_PREFS_GROUP, GTK_WINDOW(pdb_dialog->dialog));
+
+    gtk_widget_destroy (GTK_WIDGET (pdb_dialog->dialog));
+    LEAVE(" ");
+}
+
+
+static void
+refresh_handler (GHashTable *changes, gpointer user_data)
+{
+    ENTER(" ");
+    LEAVE(" ");
+}
+
+
+static gboolean
+show_handler (const char *klass, gint component_id,
+              gpointer user_data, gpointer iter_data)
+{
+    PricesDialog *pdb_dialog = user_data;
+
+    ENTER(" ");
+    if (!pdb_dialog)
+    {
+        LEAVE("no data strucure");
+        return(FALSE);
+    }
+
+    gtk_window_present (GTK_WINDOW(pdb_dialog->dialog));
+    LEAVE(" ");
+    return(TRUE);
+}
+
+
+/********************************************************************\
+ * gnc_prices_dialog                                                *
+ *   opens up a window showing all price information                *
+ *                                                                  *
+ * Args:   parent  - the parent of the window to be created         *
+ * Return: nothing                                                  *
+\********************************************************************/
+void
+gnc_prices_dialog (GtkWidget * parent)
+{
+    PricesDialog *pdb_dialog;
+    gint component_id;
+
+    ENTER(" ");
+    if (gnc_forall_gui_components (DIALOG_PRICE_DB_CM_CLASS, show_handler, NULL))
+    {
+        LEAVE("existing dialog raised");
+        return;
+    }
+
+    pdb_dialog = g_new0 (PricesDialog, 1);
+
+    gnc_prices_dialog_create (parent, pdb_dialog);
+
+    component_id = gnc_register_gui_component (DIALOG_PRICE_DB_CM_CLASS,
+                   refresh_handler, close_handler,
+                   pdb_dialog);
+    gnc_gui_component_set_session (component_id, pdb_dialog->session);
+
+    gtk_widget_grab_focus (GTK_WIDGET(pdb_dialog->price_tree));
+
+    gtk_widget_show (pdb_dialog->dialog);
+    LEAVE(" ");
+}
diff --git a/src/gnome/dialog-price-editor.c b/gnucash/gnome/dialog-price-editor.c
similarity index 100%
rename from src/gnome/dialog-price-editor.c
rename to gnucash/gnome/dialog-price-editor.c
diff --git a/src/gnome/dialog-print-check.c b/gnucash/gnome/dialog-print-check.c
similarity index 100%
rename from src/gnome/dialog-print-check.c
rename to gnucash/gnome/dialog-print-check.c
diff --git a/src/gnome/dialog-print-check.h b/gnucash/gnome/dialog-print-check.h
similarity index 100%
rename from src/gnome/dialog-print-check.h
rename to gnucash/gnome/dialog-print-check.h
diff --git a/src/gnome/dialog-progress.c b/gnucash/gnome/dialog-progress.c
similarity index 100%
rename from src/gnome/dialog-progress.c
rename to gnucash/gnome/dialog-progress.c
diff --git a/src/gnome/dialog-progress.h b/gnucash/gnome/dialog-progress.h
similarity index 100%
rename from src/gnome/dialog-progress.h
rename to gnucash/gnome/dialog-progress.h
diff --git a/src/gnome/dialog-sx-editor.c b/gnucash/gnome/dialog-sx-editor.c
similarity index 100%
rename from src/gnome/dialog-sx-editor.c
rename to gnucash/gnome/dialog-sx-editor.c
diff --git a/src/gnome/dialog-sx-editor.h b/gnucash/gnome/dialog-sx-editor.h
similarity index 100%
rename from src/gnome/dialog-sx-editor.h
rename to gnucash/gnome/dialog-sx-editor.h
diff --git a/src/gnome/dialog-sx-editor2.c b/gnucash/gnome/dialog-sx-editor2.c
similarity index 100%
rename from src/gnome/dialog-sx-editor2.c
rename to gnucash/gnome/dialog-sx-editor2.c
diff --git a/src/gnome/dialog-sx-editor2.h b/gnucash/gnome/dialog-sx-editor2.h
similarity index 100%
rename from src/gnome/dialog-sx-editor2.h
rename to gnucash/gnome/dialog-sx-editor2.h
diff --git a/src/gnome/dialog-sx-from-trans.c b/gnucash/gnome/dialog-sx-from-trans.c
similarity index 100%
rename from src/gnome/dialog-sx-from-trans.c
rename to gnucash/gnome/dialog-sx-from-trans.c
diff --git a/src/gnome/dialog-sx-from-trans.h b/gnucash/gnome/dialog-sx-from-trans.h
similarity index 100%
rename from src/gnome/dialog-sx-from-trans.h
rename to gnucash/gnome/dialog-sx-from-trans.h
diff --git a/src/gnome/dialog-sx-since-last-run.c b/gnucash/gnome/dialog-sx-since-last-run.c
similarity index 100%
rename from src/gnome/dialog-sx-since-last-run.c
rename to gnucash/gnome/dialog-sx-since-last-run.c
diff --git a/src/gnome/dialog-sx-since-last-run.h b/gnucash/gnome/dialog-sx-since-last-run.h
similarity index 100%
rename from src/gnome/dialog-sx-since-last-run.h
rename to gnucash/gnome/dialog-sx-since-last-run.h
diff --git a/src/gnome/dialog-tax-info.c b/gnucash/gnome/dialog-tax-info.c
similarity index 100%
rename from src/gnome/dialog-tax-info.c
rename to gnucash/gnome/dialog-tax-info.c
diff --git a/src/gnome/dialog-trans-assoc.c b/gnucash/gnome/dialog-trans-assoc.c
similarity index 100%
rename from src/gnome/dialog-trans-assoc.c
rename to gnucash/gnome/dialog-trans-assoc.c
diff --git a/src/gnome/dialog-trans-assoc.h b/gnucash/gnome/dialog-trans-assoc.h
similarity index 100%
rename from src/gnome/dialog-trans-assoc.h
rename to gnucash/gnome/dialog-trans-assoc.h
diff --git a/src/gnome/dialog-vendor.c b/gnucash/gnome/dialog-vendor.c
similarity index 100%
rename from src/gnome/dialog-vendor.c
rename to gnucash/gnome/dialog-vendor.c
diff --git a/src/gnome/dialog-vendor.h b/gnucash/gnome/dialog-vendor.h
similarity index 100%
rename from src/gnome/dialog-vendor.h
rename to gnucash/gnome/dialog-vendor.h
diff --git a/src/gnome/gnc-budget-view.c b/gnucash/gnome/gnc-budget-view.c
similarity index 100%
rename from src/gnome/gnc-budget-view.c
rename to gnucash/gnome/gnc-budget-view.c
diff --git a/src/gnome/gnc-budget-view.h b/gnucash/gnome/gnc-budget-view.h
similarity index 100%
rename from src/gnome/gnc-budget-view.h
rename to gnucash/gnome/gnc-budget-view.h
diff --git a/src/gnome/gnc-plugin-account-tree.c b/gnucash/gnome/gnc-plugin-account-tree.c
similarity index 100%
rename from src/gnome/gnc-plugin-account-tree.c
rename to gnucash/gnome/gnc-plugin-account-tree.c
diff --git a/src/gnome/gnc-plugin-account-tree.h b/gnucash/gnome/gnc-plugin-account-tree.h
similarity index 100%
rename from src/gnome/gnc-plugin-account-tree.h
rename to gnucash/gnome/gnc-plugin-account-tree.h
diff --git a/src/gnome/gnc-plugin-basic-commands.c b/gnucash/gnome/gnc-plugin-basic-commands.c
similarity index 100%
rename from src/gnome/gnc-plugin-basic-commands.c
rename to gnucash/gnome/gnc-plugin-basic-commands.c
diff --git a/src/gnome/gnc-plugin-basic-commands.h b/gnucash/gnome/gnc-plugin-basic-commands.h
similarity index 100%
rename from src/gnome/gnc-plugin-basic-commands.h
rename to gnucash/gnome/gnc-plugin-basic-commands.h
diff --git a/src/gnome/gnc-plugin-budget.c b/gnucash/gnome/gnc-plugin-budget.c
similarity index 100%
rename from src/gnome/gnc-plugin-budget.c
rename to gnucash/gnome/gnc-plugin-budget.c
diff --git a/src/gnome/gnc-plugin-budget.h b/gnucash/gnome/gnc-plugin-budget.h
similarity index 100%
rename from src/gnome/gnc-plugin-budget.h
rename to gnucash/gnome/gnc-plugin-budget.h
diff --git a/gnucash/gnome/gnc-plugin-business.c b/gnucash/gnome/gnc-plugin-business.c
new file mode 100644
index 0000000..98d2f31
--- /dev/null
+++ b/gnucash/gnome/gnc-plugin-business.c
@@ -0,0 +1,1108 @@
+/*
+ * gnc-plugin-business.c --
+ *
+ * Author: Jan Arne Petersen <jpetersen at uni-bonn.de>
+ * Copyright (C) 2003 Jan Arne Petersen
+ * Copyright (C) 2005 David Hampton <hampton at employees.org>
+ *
+ * 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 at gnu.org
+ */
+
+#include "config.h"
+
+#include <gtk/gtk.h>
+#include <glib/gi18n.h>
+#include <string.h>
+
+#include "dialog-billterms.h"
+#include "dialog-customer.h"
+#include "dialog-employee.h"
+#include "dialog-invoice.h"
+#include "dialog-job.h"
+#include "dialog-payment.h"
+#include "dialog-tax-table.h"
+#include "dialog-vendor.h"
+#include "business-gnome-utils.h"
+#include "gnc-plugin-business.h"
+#include "gnc-plugin-page-invoice.h"
+#include "gnc-plugin-page-owner-tree.h"
+#include "gncOwner.h"
+#include "gnc-ui-util.h"
+#include "gnc-date.h"
+#include "gnc-file.h"
+#include "guile-mappings.h"
+#include "gnc-session.h"
+#include "gnc-icons.h" /* for GNC_ICON_INVOICE_NEW */
+
+#include "gnc-prefs.h"
+#include "gnc-main-window.h"
+
+#include "gnc-plugin-page-register.h"
+
+/* This static indicates the debugging module that this .o belongs to.  */
+G_GNUC_UNUSED static QofLogModule log_module = G_LOG_DOMAIN;
+
+/* g_object functions */
+static void gnc_plugin_business_class_init (GncPluginBusinessClass *klass);
+static void gnc_plugin_business_init (GncPluginBusiness *plugin);
+static void gnc_plugin_business_finalize (GObject *object);
+static void gnc_plugin_business_add_to_window (GncPlugin *plugin,
+        GncMainWindow *window,
+        GQuark type);
+
+/* Command callbacks */
+static void gnc_plugin_business_cmd_customer_page            (GtkAction *action,
+        GncMainWindowActionData *data);
+static void gnc_plugin_business_cmd_customer_new_customer    (GtkAction *action,
+        GncMainWindowActionData *data);
+static void gnc_plugin_business_cmd_customer_find_customer   (GtkAction *action,
+        GncMainWindowActionData *data);
+static void gnc_plugin_business_cmd_customer_new_invoice     (GtkAction *action,
+        GncMainWindowActionData *data);
+static void gnc_plugin_business_cmd_customer_find_invoice    (GtkAction *action,
+        GncMainWindowActionData *data);
+static void gnc_plugin_business_cmd_customer_new_job         (GtkAction *action,
+        GncMainWindowActionData *data);
+static void gnc_plugin_business_cmd_customer_find_job        (GtkAction *action,
+        GncMainWindowActionData *data);
+static void gnc_plugin_business_cmd_customer_process_payment (GtkAction *action,
+        GncMainWindowActionData *data);
+
+static void gnc_plugin_business_cmd_vendor_page            (GtkAction *action,
+        GncMainWindowActionData *data);
+static void gnc_plugin_business_cmd_vendor_new_vendor      (GtkAction *action,
+        GncMainWindowActionData *data);
+static void gnc_plugin_business_cmd_vendor_find_vendor     (GtkAction *action,
+        GncMainWindowActionData *data);
+static void gnc_plugin_business_cmd_vendor_new_bill        (GtkAction *action,
+        GncMainWindowActionData *data);
+static void gnc_plugin_business_cmd_vendor_find_bill       (GtkAction *action,
+        GncMainWindowActionData *data);
+static void gnc_plugin_business_cmd_vendor_new_job         (GtkAction *action,
+        GncMainWindowActionData *data);
+static void gnc_plugin_business_cmd_vendor_find_job        (GtkAction *action,
+        GncMainWindowActionData *data);
+static void gnc_plugin_business_cmd_vendor_process_payment (GtkAction *action,
+        GncMainWindowActionData *data);
+
+static void gnc_plugin_business_cmd_employee_page                 (GtkAction *action,
+        GncMainWindowActionData *data);
+static void gnc_plugin_business_cmd_employee_new_employee         (GtkAction *action,
+        GncMainWindowActionData *data);
+static void gnc_plugin_business_cmd_employee_find_employee        (GtkAction *action,
+        GncMainWindowActionData *data);
+static void gnc_plugin_business_cmd_employee_new_expense_voucher  (GtkAction *action,
+        GncMainWindowActionData *data);
+static void gnc_plugin_business_cmd_employee_find_expense_voucher (GtkAction *action,
+        GncMainWindowActionData *data);
+static void gnc_plugin_business_cmd_employee_process_payment      (GtkAction *action,
+        GncMainWindowActionData *data);
+
+static void gnc_plugin_business_cmd_tax_tables         (GtkAction *action,
+        GncMainWindowActionData *data);
+static void gnc_plugin_business_cmd_billing_terms      (GtkAction *action,
+        GncMainWindowActionData *data);
+static void gnc_plugin_business_cmd_bills_due_reminder (GtkAction *action,
+        GncMainWindowActionData *data);
+static void gnc_plugin_business_cmd_invoices_due_reminder (GtkAction *action,
+        GncMainWindowActionData *data);
+
+static void gnc_plugin_business_cmd_test_search (GtkAction *action,
+        GncMainWindowActionData *data);
+
+static void gnc_plugin_business_cmd_test_init_data (GtkAction *action,
+        GncMainWindowActionData *data);
+
+static void gnc_plugin_business_cmd_assign_payment (GtkAction *action,
+        GncMainWindowActionData *data);
+static void update_inactive_actions(GncPluginPage *page);
+
+#define PLUGIN_ACTIONS_NAME "gnc-plugin-business-actions"
+#define PLUGIN_UI_FILENAME  "gnc-plugin-business-ui.xml"
+
+#define GNC_PREF_EXTRA_TOOLBUTTONS "enable-toolbuttons"
+#define GNC_PREF_INV_PRINT_RPT     "invoice-printreport"
+
+/** This variable maintains a pointer to the last window where a
+ *  Business command was executed.  It is used to determine where new
+ *  invoices will be placed.  This is a HACK done instead of trudging
+ *  through several layers of dialog (search dialog, new invoice
+ *  dialog) forcing them to track the original parent window.
+ */
+static GncMainWindow *last_window = NULL;
+
+static GtkActionEntry gnc_plugin_actions [] =
+{
+    /* Toplevel */
+    { "BusinessAction", NULL, N_("_Business"), NULL, NULL, NULL },
+
+    /* Customer submenu */
+    { "CustomerMenuAction", NULL, N_("_Customer"), NULL, NULL, NULL },
+    {
+        "CustomerOverviewPageAction", NULL, N_("Customers Overview"), NULL,
+        N_("Open a Customer overview page"),
+        G_CALLBACK (gnc_plugin_business_cmd_customer_page)
+    },
+    {
+        "CustomerNewCustomerOpenAction", NULL, N_("_New Customer..."), NULL,
+        N_("Open the New Customer dialog"),
+        G_CALLBACK (gnc_plugin_business_cmd_customer_new_customer)
+    },
+    {
+        "CustomerFindCustomerOpenAction", NULL, N_("_Find Customer..."), NULL,
+        N_("Open the Find Customer dialog"),
+        G_CALLBACK (gnc_plugin_business_cmd_customer_find_customer)
+    },
+    {
+        "CustomerNewInvoiceOpenAction", NULL, N_("New _Invoice..."), NULL,
+        N_("Open the New Invoice dialog"),
+        G_CALLBACK (gnc_plugin_business_cmd_customer_new_invoice)
+    },
+    {
+        "CustomerFindInvoiceOpenAction", NULL, N_("Find In_voice..."), NULL,
+        N_("Open the Find Invoice dialog"),
+        G_CALLBACK (gnc_plugin_business_cmd_customer_find_invoice)
+    },
+    {
+        "CustomerNewJobOpenAction", NULL, N_("New _Job..."), NULL,
+        N_("Open the New Job dialog"),
+        G_CALLBACK (gnc_plugin_business_cmd_customer_new_job)
+    },
+    {
+        "CustomerFindJobOpenAction", NULL, N_("Find Jo_b..."), NULL,
+        N_("Open the Find Job dialog"),
+        G_CALLBACK (gnc_plugin_business_cmd_customer_find_job)
+    },
+    {
+        "CustomerProcessPaymentAction", NULL, N_("_Process Payment..."), NULL,
+        N_("Open the Process Payment dialog"),
+        G_CALLBACK (gnc_plugin_business_cmd_customer_process_payment)
+    },
+
+    /* Vendor submenu */
+    {
+        "VendorOverviewPageAction", NULL, N_("Vendors Overview"), NULL,
+        N_("Open a Vendor overview page"),
+        G_CALLBACK (gnc_plugin_business_cmd_vendor_page)
+    },
+    { "VendorMenuAction", NULL, N_("_Vendor"), NULL, NULL, NULL },
+    {
+        "VendorNewVendorOpenAction", NULL, N_("_New Vendor..."), NULL,
+        N_("Open the New Vendor dialog"),
+        G_CALLBACK (gnc_plugin_business_cmd_vendor_new_vendor)
+    },
+    {
+        "VendorFindVendorOpenAction", NULL, N_("_Find Vendor..."), NULL,
+        N_("Open the Find Vendor dialog"),
+        G_CALLBACK (gnc_plugin_business_cmd_vendor_find_vendor)
+    },
+    {
+        "VendorNewBillOpenAction", NULL, N_("New _Bill..."), NULL,
+        N_("Open the New Bill dialog"),
+        G_CALLBACK (gnc_plugin_business_cmd_vendor_new_bill)
+    },
+    {
+        "VendorFindBillOpenAction", NULL, N_("Find Bi_ll..."), NULL,
+        N_("Open the Find Bill dialog"),
+        G_CALLBACK (gnc_plugin_business_cmd_vendor_find_bill)
+    },
+    {
+        "VendorNewJobOpenAction", NULL, N_("New _Job..."), NULL,
+        N_("Open the New Job dialog"),
+        G_CALLBACK (gnc_plugin_business_cmd_vendor_new_job)
+    },
+    {
+        "VendorFindJobOpenAction", NULL, N_("Find Jo_b..."), NULL,
+        N_("Open the Find Job dialog"),
+        G_CALLBACK (gnc_plugin_business_cmd_vendor_find_job)
+    },
+    {
+        "VendorProcessPaymentAction", NULL, N_("_Process Payment..."), NULL,
+        N_("Open the Process Payment dialog"),
+        G_CALLBACK (gnc_plugin_business_cmd_vendor_process_payment)
+    },
+
+    /* Employee submenu */
+    {
+        "EmployeeOverviewPageAction", NULL, N_("Employees Overview"), NULL,
+        N_("Open a Employee overview page"),
+        G_CALLBACK (gnc_plugin_business_cmd_employee_page)
+    },
+    { "EmployeeMenuAction", NULL, N_("_Employee"), NULL, NULL, NULL },
+    {
+        "EmployeeNewEmployeeOpenAction", NULL, N_("_New Employee..."), NULL,
+        N_("Open the New Employee dialog"),
+        G_CALLBACK (gnc_plugin_business_cmd_employee_new_employee)
+    },
+    {
+        "EmployeeFindEmployeeOpenAction", NULL, N_("_Find Employee..."), NULL,
+        N_("Open the Find Employee dialog"),
+        G_CALLBACK (gnc_plugin_business_cmd_employee_find_employee)
+    },
+    {
+        "EmployeeNewExpenseVoucherOpenAction", NULL, N_("New _Expense Voucher..."), NULL,
+        N_("Open the New Expense Voucher dialog"),
+        G_CALLBACK (gnc_plugin_business_cmd_employee_new_expense_voucher)
+    },
+    {
+        "EmployeeFindExpenseVoucherOpenAction", NULL, N_("Find Expense _Voucher..."), NULL,
+        N_("Open the Find Expense Voucher dialog"),
+        G_CALLBACK (gnc_plugin_business_cmd_employee_find_expense_voucher)
+    },
+    {
+        "EmployeeProcessPaymentAction", NULL, N_("_Process Payment..."), NULL,
+        N_("Open the Process Payment dialog"),
+        G_CALLBACK (gnc_plugin_business_cmd_employee_process_payment)
+    },
+
+    /* Other menu items */
+    {
+        "TaxTablesOpenAction", NULL, N_("Sales _Tax Table"), NULL,
+        N_("View and edit the list of Sales Tax Tables (GST/VAT)"),
+        G_CALLBACK (gnc_plugin_business_cmd_tax_tables)
+    },
+    {
+        "BillingTermsOpenAction", NULL, N_("_Billing Terms Editor"), NULL,
+        N_("View and edit the list of Billing Terms"),
+        G_CALLBACK (gnc_plugin_business_cmd_billing_terms)
+    },
+    {
+        "BillsDueReminderOpenAction", NULL, N_("Bills _Due Reminder"), NULL,
+        N_("Open the Bills Due Reminder dialog"),
+        G_CALLBACK (gnc_plugin_business_cmd_bills_due_reminder)
+    },
+    {
+        "InvoicesDueReminderOpenAction", NULL, N_("Invoices _Due Reminder"), NULL,
+        N_("Open the Invoices Due Reminder dialog"),
+        G_CALLBACK (gnc_plugin_business_cmd_invoices_due_reminder)
+    },
+    { "ExportMenuAction", NULL, N_("E_xport"), NULL, NULL, NULL },
+
+    /* Extensions Menu */
+    { "BusinessTestAction", NULL, N_("_Business"), NULL, NULL, NULL },
+    {
+        "BusinessTestSearchAction", NULL, N_("Test Search Dialog"), NULL,
+        N_("Test Search Dialog"),
+        G_CALLBACK (gnc_plugin_business_cmd_test_search)
+    },
+    {
+        "BusinessTestInitDataAction", NULL, N_("Initialize Test Data"), NULL,
+        N_("Initialize Test Data"),
+        G_CALLBACK (gnc_plugin_business_cmd_test_init_data)
+    },
+
+    /* Toolbar */
+    {
+        "ToolbarNewInvoiceAction", GNC_ICON_INVOICE_NEW, N_("New _Invoice..."), NULL,
+        N_("Open the New Invoice dialog"),
+        G_CALLBACK (gnc_plugin_business_cmd_customer_new_invoice)
+    },
+
+    /* Register popup menu */
+    {
+        "RegisterAssignPayment", NULL, N_("Assign as payment..."), NULL,
+        N_("Assign the selected transaction as payment"),
+        G_CALLBACK (gnc_plugin_business_cmd_assign_payment)
+    },
+};
+static guint gnc_plugin_n_actions = G_N_ELEMENTS (gnc_plugin_actions);
+
+
+/************************************************************
+ *              Plugin Function Implementation              *
+ ************************************************************/
+
+typedef struct GncPluginBusinessPrivate
+{
+    GncOwner *last_customer;
+    GncOwner *last_vendor;
+    GncOwner *last_employee;
+} GncPluginBusinessPrivate;
+
+#define GNC_PLUGIN_BUSINESS_GET_PRIVATE(o)  \
+   (G_TYPE_INSTANCE_GET_PRIVATE ((o), GNC_TYPE_PLUGIN_BUSINESS, GncPluginBusinessPrivate))
+
+static GObjectClass *parent_class = NULL;
+
+GType
+gnc_plugin_business_get_type (void)
+{
+    static GType gnc_plugin_business_type = 0;
+
+    if (gnc_plugin_business_type == 0)
+    {
+        static const GTypeInfo our_info =
+        {
+            sizeof (GncPluginBusinessClass),
+            NULL,		/* base_init */
+            NULL,		/* base_finalize */
+            (GClassInitFunc) gnc_plugin_business_class_init,
+            NULL,		/* class_finalize */
+            NULL,		/* class_data */
+            sizeof (GncPluginBusiness),
+            0,		/* n_preallocs */
+            (GInstanceInitFunc) gnc_plugin_business_init
+        };
+
+        gnc_plugin_business_type = g_type_register_static (GNC_TYPE_PLUGIN,
+                                   "GncPluginBusiness",
+                                   &our_info, 0);
+    }
+
+    return gnc_plugin_business_type;
+}
+
+GncPlugin *
+gnc_plugin_business_new (void)
+{
+    GncPluginBusiness *plugin;
+
+    /* Reference the invoice page plugin to ensure it exists in
+     * the gtk type system. */
+    GNC_TYPE_PLUGIN_PAGE_INVOICE;
+    GNC_TYPE_PLUGIN_PAGE_OWNER_TREE;
+
+    plugin = g_object_new (GNC_TYPE_PLUGIN_BUSINESS,
+                           (char *)NULL);
+
+    return GNC_PLUGIN (plugin);
+}
+
+static void
+gnc_plugin_business_class_init (GncPluginBusinessClass *klass)
+{
+    GObjectClass *object_class = G_OBJECT_CLASS (klass);
+    GncPluginClass *plugin_class = GNC_PLUGIN_CLASS (klass);
+
+    parent_class = g_type_class_peek_parent (klass);
+
+    object_class->finalize = gnc_plugin_business_finalize;
+
+    /* plugin info */
+    plugin_class->plugin_name  = GNC_PLUGIN_BUSINESS_NAME;
+
+    /* function overrides */
+    plugin_class->add_to_window = gnc_plugin_business_add_to_window;
+
+    /* widget addition/removal */
+    plugin_class->actions_name = PLUGIN_ACTIONS_NAME;
+    plugin_class->actions      = gnc_plugin_actions;
+    plugin_class->n_actions    = gnc_plugin_n_actions;
+    plugin_class->ui_filename  = PLUGIN_UI_FILENAME;
+
+    g_type_class_add_private(klass, sizeof(GncPluginBusinessPrivate));
+}
+
+static void
+gnc_plugin_business_init (GncPluginBusiness *plugin)
+{
+    GncPluginBusinessPrivate *priv;
+
+    priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
+    priv->last_customer = gncOwnerNew ();
+    gncOwnerInitCustomer (priv->last_customer, NULL);
+
+    priv->last_vendor = gncOwnerNew ();
+    gncOwnerInitVendor (priv->last_vendor, NULL);
+
+    priv->last_employee = gncOwnerNew ();
+    gncOwnerInitEmployee (priv->last_employee, NULL);
+}
+
+static void
+gnc_plugin_business_finalize (GObject *object)
+{
+    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (object));
+
+    G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+/************************************************************
+ *                     Helper Functions                     *
+ ************************************************************/
+
+GncMainWindow*
+gnc_plugin_business_get_window()
+{
+    return last_window;
+}
+
+/************************************************************
+ *                    Command Callbacks                     *
+ ************************************************************/
+
+static void
+gnc_plugin_business_cmd_customer_page (GtkAction *action,
+                                       GncMainWindowActionData *mw)
+{
+    GncPluginPage *page;
+
+    g_return_if_fail (mw != NULL);
+    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
+
+    page = gnc_plugin_page_owner_tree_new (GNC_OWNER_CUSTOMER);
+    gnc_main_window_open_page (mw->window, page);
+}
+
+static void
+gnc_plugin_business_cmd_customer_new_customer (GtkAction *action,
+        GncMainWindowActionData *mw)
+{
+    g_return_if_fail (mw != NULL);
+    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
+
+    gnc_ui_customer_new (gnc_get_current_book());
+}
+
+static void
+gnc_plugin_business_cmd_customer_find_customer (GtkAction *action,
+        GncMainWindowActionData *mw)
+{
+    GncPluginBusiness *plugin;
+    GncPluginBusinessPrivate *priv;
+    GncCustomer*customer;
+
+    g_return_if_fail (mw != NULL);
+    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
+
+    plugin = GNC_PLUGIN_BUSINESS (mw->data);
+    priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
+    customer = gncOwnerGetCustomer (priv->last_customer);
+    gnc_customer_search (customer, gnc_get_current_book());
+}
+
+static void
+gnc_plugin_business_cmd_customer_new_invoice (GtkAction *action,
+        GncMainWindowActionData *mw)
+{
+    GncPluginBusiness *plugin;
+    GncPluginBusinessPrivate *priv;
+
+    g_return_if_fail (mw != NULL);
+    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
+
+    plugin = GNC_PLUGIN_BUSINESS (mw->data);
+    priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
+    last_window = mw->window;
+    gnc_ui_invoice_new (priv->last_customer, gnc_get_current_book());
+}
+
+static void
+gnc_plugin_business_cmd_customer_find_invoice (GtkAction *action,
+        GncMainWindowActionData *mw)
+{
+    GncPluginBusiness *plugin;
+    GncPluginBusinessPrivate *priv;
+
+    g_return_if_fail (mw != NULL);
+    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
+
+    plugin = GNC_PLUGIN_BUSINESS (mw->data);
+    priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
+    last_window = mw->window;
+    gnc_invoice_search (NULL, priv->last_customer, gnc_get_current_book());
+}
+
+static void
+gnc_plugin_business_cmd_customer_new_job (GtkAction *action,
+        GncMainWindowActionData *mw)
+{
+    GncPluginBusiness *plugin;
+    GncPluginBusinessPrivate *priv;
+
+    g_return_if_fail (mw != NULL);
+    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
+
+    plugin = GNC_PLUGIN_BUSINESS (mw->data);
+    priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
+    gnc_ui_job_new (priv->last_customer, gnc_get_current_book());
+}
+
+static void
+gnc_plugin_business_cmd_customer_find_job (GtkAction *action,
+        GncMainWindowActionData *mw)
+{
+    GncPluginBusiness *plugin;
+    GncPluginBusinessPrivate *priv;
+
+    g_return_if_fail (mw != NULL);
+    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
+
+    plugin = GNC_PLUGIN_BUSINESS (mw->data);
+    priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
+    gnc_job_search (NULL, priv->last_customer, gnc_get_current_book());
+}
+
+static void
+gnc_plugin_business_cmd_customer_process_payment (GtkAction *action,
+        GncMainWindowActionData *mw)
+{
+    GncPluginBusiness *plugin;
+    GncPluginBusinessPrivate *priv;
+
+    g_return_if_fail (mw != NULL);
+    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
+
+    plugin = GNC_PLUGIN_BUSINESS (mw->data);
+    priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
+    gnc_ui_payment_new (priv->last_customer, gnc_get_current_book());
+}
+
+static void
+gnc_plugin_business_cmd_vendor_page (GtkAction *action,
+                                     GncMainWindowActionData *mw)
+{
+    GncPluginPage *page;
+
+    g_return_if_fail (mw != NULL);
+    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
+
+    page = gnc_plugin_page_owner_tree_new (GNC_OWNER_VENDOR);
+    gnc_main_window_open_page (mw->window, page);
+}
+
+static void
+gnc_plugin_business_cmd_vendor_new_vendor (GtkAction *action,
+        GncMainWindowActionData *mw)
+{
+    g_return_if_fail (mw != NULL);
+    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
+
+    gnc_ui_vendor_new (gnc_get_current_book());
+}
+
+static void
+gnc_plugin_business_cmd_vendor_find_vendor (GtkAction *action,
+        GncMainWindowActionData *mw)
+{
+    GncPluginBusiness *plugin;
+    GncPluginBusinessPrivate *priv;
+    GncVendor *vendor;
+
+    g_return_if_fail (mw != NULL);
+    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
+
+    plugin = GNC_PLUGIN_BUSINESS (mw->data);
+    priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
+    vendor = gncOwnerGetVendor (priv->last_vendor);
+    gnc_vendor_search (vendor, gnc_get_current_book());
+}
+
+static void
+gnc_plugin_business_cmd_vendor_new_bill (GtkAction *action,
+        GncMainWindowActionData *mw)
+{
+    GncPluginBusiness *plugin;
+    GncPluginBusinessPrivate *priv;
+
+    g_return_if_fail (mw != NULL);
+    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
+
+    plugin = GNC_PLUGIN_BUSINESS (mw->data);
+    priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
+    last_window = mw->window;
+    gnc_ui_invoice_new (priv->last_vendor, gnc_get_current_book());
+}
+
+static void
+gnc_plugin_business_cmd_vendor_find_bill (GtkAction *action,
+        GncMainWindowActionData *mw)
+{
+    GncPluginBusiness *plugin;
+    GncPluginBusinessPrivate *priv;
+
+    g_return_if_fail (mw != NULL);
+    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
+
+    plugin = GNC_PLUGIN_BUSINESS (mw->data);
+    priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
+    last_window = mw->window;
+    gnc_invoice_search (NULL, priv->last_vendor, gnc_get_current_book());
+}
+
+static void
+gnc_plugin_business_cmd_vendor_new_job (GtkAction *action,
+                                        GncMainWindowActionData *mw)
+{
+    GncPluginBusiness *plugin;
+    GncPluginBusinessPrivate *priv;
+
+    g_return_if_fail (mw != NULL);
+    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
+
+    plugin = GNC_PLUGIN_BUSINESS (mw->data);
+    priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
+    gnc_ui_job_new (priv->last_vendor, gnc_get_current_book());
+}
+
+static void
+gnc_plugin_business_cmd_vendor_find_job (GtkAction *action,
+        GncMainWindowActionData *mw)
+{
+    GncPluginBusiness *plugin;
+    GncPluginBusinessPrivate *priv;
+
+    g_return_if_fail (mw != NULL);
+    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
+
+    plugin = GNC_PLUGIN_BUSINESS (mw->data);
+    priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
+    gnc_job_search (NULL, priv->last_vendor, gnc_get_current_book());
+}
+
+static void
+gnc_plugin_business_cmd_vendor_process_payment (GtkAction *action,
+        GncMainWindowActionData *mw)
+{
+    GncPluginBusiness *plugin;
+    GncPluginBusinessPrivate *priv;
+
+    g_return_if_fail (mw != NULL);
+    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
+
+    plugin = GNC_PLUGIN_BUSINESS (mw->data);
+    priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
+    gnc_ui_payment_new (priv->last_vendor, gnc_get_current_book());
+}
+
+static void
+gnc_plugin_business_cmd_employee_page (GtkAction *action,
+                                       GncMainWindowActionData *mw)
+{
+    GncPluginPage *page;
+
+    g_return_if_fail (mw != NULL);
+    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
+
+    page = gnc_plugin_page_owner_tree_new (GNC_OWNER_EMPLOYEE);
+    gnc_main_window_open_page (mw->window, page);
+}
+
+static void
+gnc_plugin_business_cmd_employee_new_employee (GtkAction *action,
+        GncMainWindowActionData *mw)
+{
+    g_return_if_fail (mw != NULL);
+    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
+
+    gnc_ui_employee_new (gnc_get_current_book());
+}
+
+static void
+gnc_plugin_business_cmd_employee_find_employee (GtkAction *action,
+        GncMainWindowActionData *mw)
+{
+    GncPluginBusiness *plugin;
+    GncPluginBusinessPrivate *priv;
+    GncEmployee *employee;
+
+    g_return_if_fail (mw != NULL);
+    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
+
+    plugin = GNC_PLUGIN_BUSINESS (mw->data);
+    priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
+    employee = gncOwnerGetEmployee (priv->last_employee);
+    gnc_employee_search (employee, gnc_get_current_book());
+}
+
+static void
+gnc_plugin_business_cmd_employee_new_expense_voucher (GtkAction *action,
+        GncMainWindowActionData *mw)
+{
+    GncPluginBusiness *plugin;
+    GncPluginBusinessPrivate *priv;
+
+    g_return_if_fail (mw != NULL);
+    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
+
+    plugin = GNC_PLUGIN_BUSINESS (mw->data);
+    priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
+    last_window = mw->window;
+    gnc_ui_invoice_new (priv->last_employee, gnc_get_current_book());
+}
+
+static void
+gnc_plugin_business_cmd_employee_find_expense_voucher (GtkAction *action,
+        GncMainWindowActionData *mw)
+{
+    GncPluginBusiness *plugin;
+    GncPluginBusinessPrivate *priv;
+
+    g_return_if_fail (mw != NULL);
+    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
+
+    plugin = GNC_PLUGIN_BUSINESS (mw->data);
+    priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
+    last_window = mw->window;
+    gnc_invoice_search (NULL, priv->last_employee, gnc_get_current_book());
+}
+
+static void
+gnc_plugin_business_cmd_employee_process_payment (GtkAction *action,
+        GncMainWindowActionData *mw)
+{
+    GncPluginBusiness *plugin;
+    GncPluginBusinessPrivate *priv;
+
+    g_return_if_fail (mw != NULL);
+    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
+
+    plugin = GNC_PLUGIN_BUSINESS (mw->data);
+    priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
+    gnc_ui_payment_new (priv->last_employee, gnc_get_current_book());
+}
+
+static void
+gnc_plugin_business_cmd_tax_tables (GtkAction *action,
+                                    GncMainWindowActionData *mw)
+{
+    g_return_if_fail (mw != NULL);
+    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
+
+    gnc_ui_tax_table_window_new (gnc_get_current_book());
+}
+
+static void
+gnc_plugin_business_cmd_billing_terms (GtkAction *action,
+                                       GncMainWindowActionData *mw)
+{
+    g_return_if_fail (mw != NULL);
+    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
+
+    gnc_ui_billterms_window_new (gnc_get_current_book());
+}
+
+
+static void
+gnc_plugin_business_cmd_bills_due_reminder (GtkAction *action,
+        GncMainWindowActionData *mw)
+{
+    g_return_if_fail (mw != NULL);
+    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
+
+    gnc_invoice_remind_bills_due();
+}
+
+
+static void
+gnc_plugin_business_cmd_invoices_due_reminder (GtkAction *action,
+        GncMainWindowActionData *mw)
+{
+    g_return_if_fail (mw != NULL);
+    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
+
+    gnc_invoice_remind_invoices_due();
+}
+
+static void
+gnc_plugin_business_cmd_test_search (GtkAction *action,
+                                     GncMainWindowActionData *data)
+{
+    gnc_search_dialog_test();
+}
+
+static void gnc_business_assign_payment (GtkWidget *parent,
+        Transaction *trans,
+        GncOwner *owner)
+{
+    g_return_if_fail(trans);
+
+    // Do nothing if we don't have more than one split (e.g. in the empty line at the end of the register)
+    if (xaccTransCountSplits(trans) <= 1)
+        return;
+
+    //g_message("Creating payment dialog with trans %p", trans);
+    gnc_ui_payment_new_with_txn(owner, trans);
+}
+
+static void gnc_plugin_business_cmd_assign_payment (GtkAction *action,
+        GncMainWindowActionData *mw)
+{
+    GncPluginBusiness *plugin_business;
+    GncPluginBusinessPrivate *plugin_business_priv;
+    GncPluginPage *plugin_page;
+    GNCSplitReg *gsr;
+    SplitRegister *reg;
+    Split *split;
+    Transaction *trans;
+    gboolean have_owner;
+    GncOwner owner;
+    GncOwner *owner_p;
+
+    g_return_if_fail (mw != NULL);
+    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
+
+    plugin_page = gnc_main_window_get_current_page(mw->window);
+
+    // We continue only if the current page is a plugin page and more
+    // specifically a register plugin page
+    if (!GNC_IS_PLUGIN_PAGE(plugin_page)
+            || !GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page))
+        return;
+
+    gsr = gnc_plugin_page_register_get_gsr(plugin_page);
+    g_return_if_fail(gsr);
+
+    reg = gnc_ledger_display_get_split_register( gsr->ledger );
+    g_return_if_fail(reg);
+
+    split = gnc_split_register_get_current_split(reg);
+    g_return_if_fail(split);
+
+    trans = xaccSplitGetParent(split);
+    g_return_if_fail(trans);
+
+    plugin_business = GNC_PLUGIN_BUSINESS (mw->data);
+    plugin_business_priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin_business);
+
+    have_owner = gncOwnerGetOwnerFromTxn (trans, &owner);
+    if (have_owner)
+        owner_p = &owner;
+    else if (gnc_ui_payment_is_customer_payment(trans))
+        owner_p = plugin_business_priv->last_customer;
+    else
+        owner_p = plugin_business_priv->last_vendor;
+
+    gnc_business_assign_payment (gnc_plugin_page_get_window(plugin_page),
+                                 trans, owner_p);
+}
+
+static const gchar *register_txn_actions[] =
+{
+    "RegisterAssignPayment",
+    NULL
+};
+
+static void
+gnc_plugin_business_update_menus (GncPluginPage *plugin_page)
+{
+    GncMainWindow  *window;
+    GtkActionGroup *action_group;
+    gboolean is_txn_register;
+
+    // We continue only if the current page is a plugin page
+    if (!plugin_page || !GNC_IS_PLUGIN_PAGE(plugin_page))
+        return;
+
+    is_txn_register = GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page);
+    window = GNC_MAIN_WINDOW(plugin_page->window);
+    g_return_if_fail(GNC_IS_MAIN_WINDOW(window));
+    action_group = gnc_main_window_get_action_group(window, PLUGIN_ACTIONS_NAME);
+    g_return_if_fail(GTK_IS_ACTION_GROUP(action_group));
+
+    // Change visibility and also sensitivity according to whether we are in a txn register
+    gnc_plugin_update_actions (action_group, register_txn_actions,
+                               "sensitive", is_txn_register);
+    gnc_plugin_update_actions (action_group, register_txn_actions,
+                               "visible", is_txn_register);
+}
+
+
+static void gnc_plugin_business_main_window_page_changed(GncMainWindow *window,
+        GncPluginPage *page,
+        gpointer user_data)
+{
+    gnc_plugin_business_update_menus(page);
+    update_inactive_actions(page);
+}
+
+static void
+gnc_plugin_business_cmd_test_init_data (GtkAction *action,
+                                        GncMainWindowActionData *data)
+{
+    QofBook *book		= gnc_get_current_book();
+    GncCustomer *customer	= gncCustomerCreate(book);
+    GncAddress *address	= gncCustomerGetAddr(customer);
+    GncInvoice *invoice	= gncInvoiceCreate(book);
+    GncOwner *owner		= gncOwnerNew();
+    GncJob *job		= gncJobCreate(book);
+    Account *root		= gnc_book_get_root_account(book);
+    Account *inc_acct	= xaccMallocAccount(book);
+    Account *bank_acct	= xaccMallocAccount(book);
+    Account *tax_acct	= xaccMallocAccount(book);
+    Account *ar_acct	= xaccMallocAccount(book);
+    Timespec now;
+
+    // Create Customer
+    gncCustomerSetID(customer, "000001");
+    gncCustomerSetName(customer, "Test Customer");
+    gncCustomerSetCurrency(customer, gnc_default_currency());
+    gncAddressSetName(address, "Contact Person");
+    gncAddressSetAddr1(address, "20 Customer Lane");
+    gncAddressSetAddr2(address, "Customer M/S");
+    gncAddressSetAddr3(address, "Addr3, XXX  12345");
+
+    // Create the Owner
+    gncOwnerInitCustomer(owner, customer);
+
+    // Create the Invoice
+    timespecFromTime64(&now, time(NULL));
+    gncInvoiceSetID(invoice, "000012");
+    gncInvoiceSetOwner(invoice, owner);
+    gncInvoiceSetDateOpened(invoice, now);
+    gncInvoiceSetCurrency(invoice, gnc_default_currency());
+
+    // Create the Job
+    gncJobSetID(job, "000025");
+    gncJobSetName(job, "Test Job");
+    gncJobSetReference(job, "Customer's ref#");
+    gncJobSetOwner(job, owner);
+
+    // MODIFY THE OWNER
+    gncOwnerInitJob(owner, job);
+
+    // Create the A/R account
+    xaccAccountSetType(ar_acct, ACCT_TYPE_RECEIVABLE);
+    xaccAccountSetName(ar_acct, "A/R");
+    xaccAccountSetCommodity(ar_acct, gnc_default_currency());
+    gnc_account_append_child(root, ar_acct);
+
+    // Create the Income account
+    xaccAccountSetType(inc_acct, ACCT_TYPE_INCOME);
+    xaccAccountSetName(inc_acct, "Income");
+    xaccAccountSetCommodity(inc_acct, gnc_default_currency());
+    gnc_account_append_child(root, inc_acct);
+
+    // Create the Bank account
+    xaccAccountSetType(bank_acct, ACCT_TYPE_BANK);
+    xaccAccountSetName(bank_acct, "Bank");
+    xaccAccountSetCommodity(bank_acct, gnc_default_currency());
+    gnc_account_append_child(root, bank_acct);
+
+    // Create the Tax account
+    xaccAccountSetType(tax_acct, ACCT_TYPE_LIABILITY);
+    xaccAccountSetName(tax_acct, "Tax-Holding");
+    xaccAccountSetCommodity(tax_acct, gnc_default_currency());
+    gnc_account_append_child(root, tax_acct);
+
+    // Launch the invoice editor
+    gnc_ui_invoice_edit(invoice);
+}
+
+/* This is the list of actions which are switched inactive in a read-only book. */
+static const gchar* readonly_inactive_actions[] =
+{
+    "CustomerNewCustomerOpenAction",
+    "CustomerNewInvoiceOpenAction",
+    "CustomerNewInvoiceOpenAction",
+    "CustomerNewJobOpenAction",
+    "CustomerProcessPaymentAction",
+    "VendorNewVendorOpenAction",
+    "VendorNewBillOpenAction",
+    "VendorNewJobOpenAction",
+    "VendorProcessPaymentAction",
+    "EmployeeNewEmployeeOpenAction",
+    "EmployeeNewExpenseVoucherOpenAction",
+    "EmployeeProcessPaymentAction",
+    "ToolbarNewInvoiceAction",
+    "RegisterAssignPayment",
+    NULL
+};
+
+static void update_inactive_actions(GncPluginPage *plugin_page)
+{
+    GncMainWindow  *window;
+    GtkActionGroup *action_group;
+
+    // We are readonly - so we have to switch particular actions to inactive.
+    gboolean is_readwrite = !qof_book_is_readonly(gnc_get_current_book());
+
+    // We continue only if the current page is a plugin page
+    if (!plugin_page || !GNC_IS_PLUGIN_PAGE(plugin_page))
+        return;
+
+    window = GNC_MAIN_WINDOW(plugin_page->window);
+    g_return_if_fail(GNC_IS_MAIN_WINDOW(window));
+    action_group = gnc_main_window_get_action_group(window, PLUGIN_ACTIONS_NAME);
+    g_return_if_fail(GTK_IS_ACTION_GROUP(action_group));
+
+    /* Set the action's sensitivity */
+    gnc_plugin_update_actions (action_group, readonly_inactive_actions,
+                               "sensitive", is_readwrite);
+}
+
+/* This is the list of actions which are switched invisible or visible
+ * depending on the preference "extra_toolbuttons". */
+static const char* extra_toolbar_actions[] =
+{
+    "ToolbarNewInvoiceAction",
+    NULL
+};
+
+/* Bind the visibility of the extra toolbar buttons to the
+ * enable_toolbuttons preference. */
+static void bind_toolbuttons_visibility (GncMainWindow *mainwindow)
+{
+    GtkActionGroup *action_group;
+    const char **iter;
+
+    g_return_if_fail(mainwindow);
+    g_return_if_fail(GNC_IS_MAIN_WINDOW(mainwindow));
+
+    /* Get the action group */
+    action_group =
+        gnc_main_window_get_action_group(mainwindow, PLUGIN_ACTIONS_NAME);
+    g_assert(action_group);
+
+    for (iter = extra_toolbar_actions; *iter; ++iter)
+    {
+        /* Set the action's visibility */
+        GtkAction *action = gtk_action_group_get_action (action_group, *iter);
+        gnc_prefs_bind (GNC_PREFS_GROUP_INVOICE, GNC_PREF_EXTRA_TOOLBUTTONS, G_OBJECT (action), "visible");
+    }
+}
+
+/**
+ * Called when this plugin is added to a main window.  Connect a few callbacks
+ * here to track page changes.
+ *
+ * Update the toolbar button visibility each time our plugin is added
+ * to a new GncMainWindow. */
+static void gnc_plugin_business_add_to_window (GncPlugin *plugin,
+        GncMainWindow *mainwindow,
+        GQuark type)
+{
+    bind_toolbuttons_visibility (mainwindow);
+
+    g_signal_connect(mainwindow, "page_changed",
+                     G_CALLBACK(gnc_plugin_business_main_window_page_changed),
+                     plugin);
+}
+
+static const char* invoice_printreport_values[] =
+{
+    /* The list below are the guids of reports that can
+     * be used to print an invoice.
+     * Important: this list must be kept in sync with the one at the end
+     * of business-prefs.glade
+     */
+    "5123a759ceb9483abf2182d01c140e8d", // "Printable Invoice"
+    "0769e242be474010b4acf264a5512e6e", // "Tax Invoice"
+    "67112f318bef4fc496bdc27d106bbda4", // "Easy Invoice"
+    "3ce293441e894423a2425d7a22dd1ac6", // "Fancy Invoice"
+    NULL
+};
+
+const char *gnc_plugin_business_get_invoice_printreport(void)
+{
+    int value = gnc_prefs_get_int (GNC_PREFS_GROUP_INVOICE, GNC_PREF_INV_PRINT_RPT);
+    if (value >= 0 && value < 4)
+        return invoice_printreport_values[value];
+    else
+        return NULL;
+}
diff --git a/src/gnome/gnc-plugin-business.h b/gnucash/gnome/gnc-plugin-business.h
similarity index 100%
rename from src/gnome/gnc-plugin-business.h
rename to gnucash/gnome/gnc-plugin-business.h
diff --git a/src/gnome/gnc-plugin-page-account-tree.c b/gnucash/gnome/gnc-plugin-page-account-tree.c
similarity index 100%
rename from src/gnome/gnc-plugin-page-account-tree.c
rename to gnucash/gnome/gnc-plugin-page-account-tree.c
diff --git a/src/gnome/gnc-plugin-page-account-tree.h b/gnucash/gnome/gnc-plugin-page-account-tree.h
similarity index 100%
rename from src/gnome/gnc-plugin-page-account-tree.h
rename to gnucash/gnome/gnc-plugin-page-account-tree.h
diff --git a/src/gnome/gnc-plugin-page-budget.c b/gnucash/gnome/gnc-plugin-page-budget.c
similarity index 100%
rename from src/gnome/gnc-plugin-page-budget.c
rename to gnucash/gnome/gnc-plugin-page-budget.c
diff --git a/src/gnome/gnc-plugin-page-budget.h b/gnucash/gnome/gnc-plugin-page-budget.h
similarity index 100%
rename from src/gnome/gnc-plugin-page-budget.h
rename to gnucash/gnome/gnc-plugin-page-budget.h
diff --git a/src/gnome/gnc-plugin-page-invoice.c b/gnucash/gnome/gnc-plugin-page-invoice.c
similarity index 100%
rename from src/gnome/gnc-plugin-page-invoice.c
rename to gnucash/gnome/gnc-plugin-page-invoice.c
diff --git a/src/gnome/gnc-plugin-page-invoice.h b/gnucash/gnome/gnc-plugin-page-invoice.h
similarity index 100%
rename from src/gnome/gnc-plugin-page-invoice.h
rename to gnucash/gnome/gnc-plugin-page-invoice.h
diff --git a/src/gnome/gnc-plugin-page-owner-tree.c b/gnucash/gnome/gnc-plugin-page-owner-tree.c
similarity index 100%
rename from src/gnome/gnc-plugin-page-owner-tree.c
rename to gnucash/gnome/gnc-plugin-page-owner-tree.c
diff --git a/src/gnome/gnc-plugin-page-owner-tree.h b/gnucash/gnome/gnc-plugin-page-owner-tree.h
similarity index 100%
rename from src/gnome/gnc-plugin-page-owner-tree.h
rename to gnucash/gnome/gnc-plugin-page-owner-tree.h
diff --git a/gnucash/gnome/gnc-plugin-page-register.c b/gnucash/gnome/gnc-plugin-page-register.c
new file mode 100644
index 0000000..3f7fad3
--- /dev/null
+++ b/gnucash/gnome/gnc-plugin-page-register.c
@@ -0,0 +1,4192 @@
+/**********************************************************************
+ * gnc-plugin-page-register.c -- register page functions              *
+ *                                                                    *
+ * Copyright (C) 2003 Jan Arne Petersen <jpetersen at uni-bonn.de>       *
+ * Copyright (C) 2003,2005,2006 David Hampton <hampton at employees.org> *
+ * Copyright (C) 2011, Robert Fewell                                  *
+ *                                                                    *
+ * 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 at gnu.org                     *
+ **********************************************************************/
+
+/** @addtogroup ContentPlugins
+    @{ */
+/** @addtogroup RegisterPlugin Register Page
+    @{ */
+/** @file gnc-plugin-page-register.c
+    @brief  Functions providing a register page for the GnuCash UI
+    @author Copyright (C) 2003 Jan Arne Petersen <jpetersen at uni-bonn.de>
+    @author Copyright (C) 2003,2005 David Hampton <hampton at employees.org>
+*/
+
+#include "config.h"
+
+#include <libguile.h>
+#include "guile-mappings.h"
+#include <gtk/gtk.h>
+#include <glib/gi18n.h>
+#include "swig-runtime.h"
+
+#include "gnc-plugin-page-register.h"
+/*################## Added for Reg2 #################*/
+#include "gnc-plugin-page-register2.h"
+/*################## Added for Reg2 #################*/
+#include "gnc-plugin-register.h"
+#include "gnc-plugin-menu-additions.h"
+#include "gnc-plugin-page-report.h"
+
+#include "dialog-account.h"
+#include "dialog-find-account.h"
+#include "dialog-find-transactions.h"
+#include "dialog-print-check.h"
+#include "dialog-transfer.h"
+#include "dialog-utils.h"
+#include "assistant-stock-split.h"
+#include "gnc-component-manager.h"
+#include "gnc-date.h"
+#include "gnc-date-edit.h"
+#include "gnc-engine.h"
+#include "gnc-event.h"
+#include "gnc-gnome-utils.h"
+#include "gnc-gobject-utils.h"
+#include "gnc-gui-query.h"
+#include "gnc-icons.h"
+#include "gnc-split-reg.h"
+#include "gnc-prefs.h"
+#include "gnc-ui-util.h"
+#include "gnc-window.h"
+#include "gnc-main-window.h"
+#include "gnc-session.h"
+#include "gnc-warnings.h"
+#include "gnucash-sheet.h"
+#include "dialog-lot-viewer.h"
+#include "Scrub.h"
+#include "ScrubBusiness.h"
+#include "qof.h"
+#include "window-reconcile.h"
+#include "window-autoclear.h"
+#include "window-report.h"
+#include "engine-helpers.h"
+#include "qofbookslots.h"
+
+/* This static indicates the debugging module that this .o belongs to.  */
+static QofLogModule log_module = GNC_MOD_GUI;
+
+#define DEFAULT_LINES_AMOUNT         50
+
+static void gnc_plugin_page_register_class_init (GncPluginPageRegisterClass *klass);
+static void gnc_plugin_page_register_init (GncPluginPageRegister *plugin_page);
+static void gnc_plugin_page_register_finalize (GObject *object);
+
+/* static Account *gnc_plugin_page_register_get_current_account (GncPluginPageRegister *page); */
+
+static GtkWidget *gnc_plugin_page_register_create_widget (GncPluginPage *plugin_page);
+static void gnc_plugin_page_register_destroy_widget (GncPluginPage *plugin_page);
+static void gnc_plugin_page_register_window_changed (GncPluginPage *plugin_page, GtkWidget *window);
+static void gnc_plugin_page_register_save_page (GncPluginPage *plugin_page, GKeyFile *file, const gchar *group);
+static GncPluginPage *gnc_plugin_page_register_recreate_page (GtkWidget *window, GKeyFile *file, const gchar *group);
+static void gnc_plugin_page_register_update_edit_menu (GncPluginPage *page, gboolean hide);
+static gboolean gnc_plugin_page_register_finish_pending (GncPluginPage *page);
+
+static gchar *gnc_plugin_page_register_get_tab_name (GncPluginPage *plugin_page);
+static gchar *gnc_plugin_page_register_get_tab_color (GncPluginPage *plugin_page);
+static gchar *gnc_plugin_page_register_get_long_name (GncPluginPage *plugin_page);
+
+static void gnc_plugin_page_register_summarybar_position_changed(gpointer prefs, gchar* pref, gpointer user_data);
+
+/* Callbacks for the "Sort By" dialog */
+void gnc_plugin_page_register_sort_button_cb(GtkToggleButton *button, GncPluginPageRegister *page);
+void gnc_plugin_page_register_sort_response_cb(GtkDialog *dialog, gint response, GncPluginPageRegister *plugin_page);
+void gnc_plugin_page_register_sort_order_save_cb(GtkToggleButton *button, GncPluginPageRegister *page);
+void gnc_plugin_page_register_sort_order_reverse_cb(GtkToggleButton *button, GncPluginPageRegister *page);
+
+static gchar *gnc_plugin_page_register_get_sort_order (GncPluginPage *plugin_page);
+void gnc_plugin_page_register_set_sort_order (GncPluginPage *plugin_page, const gchar *sort_order);
+static gboolean gnc_plugin_page_register_get_sort_reversed (GncPluginPage *plugin_page);
+void gnc_plugin_page_register_set_sort_reversed (GncPluginPage *plugin_page, gboolean reverse_order);
+
+/* Callbacks for the "Filter By" dialog */
+void gnc_plugin_page_register_filter_select_range_cb(GtkRadioButton *button, GncPluginPageRegister *page);
+void gnc_plugin_page_register_filter_start_cb(GtkWidget *radio, GncPluginPageRegister *page);
+void gnc_plugin_page_register_filter_end_cb(GtkWidget *radio, GncPluginPageRegister *page);
+void gnc_plugin_page_register_filter_response_cb(GtkDialog *dialog, gint response, GncPluginPageRegister *plugin_page);
+void gnc_plugin_page_register_filter_status_all_cb(GtkButton *button, GncPluginPageRegister *plugin_page);
+void gnc_plugin_page_register_filter_status_one_cb(GtkToggleButton *button, GncPluginPageRegister *page);
+void gnc_plugin_page_register_filter_save_cb(GtkToggleButton *button, GncPluginPageRegister *page);
+
+static time64 gnc_plugin_page_register_filter_dmy2time (char *date_string);
+static gchar *gnc_plugin_page_register_filter_time2dmy (time64 raw_time);
+static gchar *gnc_plugin_page_register_get_filter (GncPluginPage *plugin_page);
+void gnc_plugin_page_register_set_filter (GncPluginPage *plugin_page, const gchar *filter);
+
+static void gnc_ppr_update_status_query (GncPluginPageRegister *page);
+static void gnc_ppr_update_date_query (GncPluginPageRegister *page);
+
+/* Command callbacks */
+static void gnc_plugin_page_register_cmd_print_check (GtkAction *action, GncPluginPageRegister *plugin_page);
+static void gnc_plugin_page_register_cmd_cut (GtkAction *action, GncPluginPageRegister *plugin_page);
+static void gnc_plugin_page_register_cmd_copy (GtkAction *action, GncPluginPageRegister *plugin_page);
+static void gnc_plugin_page_register_cmd_paste (GtkAction *action, GncPluginPageRegister *plugin_page);
+static void gnc_plugin_page_register_cmd_edit_account (GtkAction *action, GncPluginPageRegister *plugin_page);
+static void gnc_plugin_page_register_cmd_find_account (GtkAction *action, GncPluginPageRegister *plugin_page);
+static void gnc_plugin_page_register_cmd_find_transactions (GtkAction *action, GncPluginPageRegister *plugin_page);
+static void gnc_plugin_page_register_cmd_cut_transaction (GtkAction *action, GncPluginPageRegister *plugin_page);
+static void gnc_plugin_page_register_cmd_copy_transaction (GtkAction *action, GncPluginPageRegister *plugin_page);
+static void gnc_plugin_page_register_cmd_paste_transaction (GtkAction *action, GncPluginPageRegister *plugin_page);
+static void gnc_plugin_page_register_cmd_void_transaction (GtkAction *action, GncPluginPageRegister *plugin_page);
+static void gnc_plugin_page_register_cmd_unvoid_transaction (GtkAction *action, GncPluginPageRegister *plugin_page);
+static void gnc_plugin_page_register_cmd_reverse_transaction (GtkAction *action, GncPluginPageRegister *plugin_page);
+static void gnc_plugin_page_register_cmd_view_sort_by (GtkAction *action, GncPluginPageRegister *plugin_page);
+static void gnc_plugin_page_register_cmd_view_filter_by (GtkAction *action, GncPluginPageRegister *plugin_page);
+static void gnc_plugin_page_register_cmd_style_changed (GtkAction *action, GtkRadioAction *current, GncPluginPageRegister *plugin_page);
+static void gnc_plugin_page_register_cmd_style_double_line (GtkToggleAction *action, GncPluginPageRegister *plugin_page);
+
+static void gnc_plugin_page_register_cmd_reconcile (GtkAction *action, GncPluginPageRegister *plugin_page);
+static void gnc_plugin_page_register_cmd_autoclear (GtkAction *action, GncPluginPageRegister *plugin_page);
+static void gnc_plugin_page_register_cmd_transfer (GtkAction *action, GncPluginPageRegister *plugin_page);
+static void gnc_plugin_page_register_cmd_stock_split (GtkAction *action, GncPluginPageRegister *plugin_page);
+static void gnc_plugin_page_register_cmd_lots (GtkAction *action, GncPluginPageRegister *plugin_page);
+static void gnc_plugin_page_register_cmd_enter_transaction (GtkAction *action, GncPluginPageRegister *plugin_page);
+static void gnc_plugin_page_register_cmd_cancel_transaction (GtkAction *action, GncPluginPageRegister *plugin_page);
+static void gnc_plugin_page_register_cmd_delete_transaction (GtkAction *action, GncPluginPageRegister *plugin_page);
+static void gnc_plugin_page_register_cmd_blank_transaction (GtkAction *action, GncPluginPageRegister *plugin_page);
+static void gnc_plugin_page_register_cmd_duplicate_transaction (GtkAction *action, GncPluginPageRegister *plugin_page);
+static void gnc_plugin_page_register_cmd_reinitialize_transaction (GtkAction *action, GncPluginPageRegister *plugin_page);
+static void gnc_plugin_page_register_cmd_expand_transaction (GtkToggleAction *action, GncPluginPageRegister *plugin_page);
+static void gnc_plugin_page_register_cmd_exchange_rate (GtkAction *action, GncPluginPageRegister *plugin_page);
+static void gnc_plugin_page_register_cmd_jump (GtkAction *action, GncPluginPageRegister *plugin_page);
+static void gnc_plugin_page_register_cmd_schedule (GtkAction *action, GncPluginPageRegister *plugin_page);
+static void gnc_plugin_page_register_cmd_scrub_all (GtkAction *action, GncPluginPageRegister *plugin_page);
+static void gnc_plugin_page_register_cmd_scrub_current (GtkAction *action, GncPluginPageRegister *plugin_page);
+static void gnc_plugin_page_register_cmd_account_report (GtkAction *action, GncPluginPageRegister *plugin_page);
+static void gnc_plugin_page_register_cmd_transaction_report (GtkAction *action, GncPluginPageRegister *plugin_page);
+static void gnc_plugin_page_register_cmd_associate_file_transaction (GtkAction *action, GncPluginPageRegister *plugin_page);
+static void gnc_plugin_page_register_cmd_associate_location_transaction (GtkAction *action, GncPluginPageRegister *plugin_page);
+static void gnc_plugin_page_register_cmd_execassociated_transaction (GtkAction *action, GncPluginPageRegister *plugin_page);
+
+static void gnc_plugin_page_help_changed_cb( GNCSplitReg *gsr, GncPluginPageRegister *register_page );
+static void gnc_plugin_page_register_refresh_cb (GHashTable *changes, gpointer user_data);
+static void gnc_plugin_page_register_close_cb (gpointer user_data);
+
+static void gnc_plugin_page_register_ui_update (gpointer various, GncPluginPageRegister *page);
+static void gppr_account_destroy_cb (Account *account);
+static void gnc_plugin_page_register_event_handler (QofInstance *entity,
+        QofEventId event_type,
+        GncPluginPageRegister *page,
+        GncEventData *ed);
+
+/************************************************************/
+/*                          Actions                         */
+/************************************************************/
+
+#define CUT_TRANSACTION_LABEL            N_("Cu_t Transaction")
+#define COPY_TRANSACTION_LABEL           N_("_Copy Transaction")
+#define PASTE_TRANSACTION_LABEL          N_("_Paste Transaction")
+#define DUPLICATE_TRANSACTION_LABEL      N_("Dup_licate Transaction")
+#define DELETE_TRANSACTION_LABEL         N_("_Delete Transaction")
+#define ASSOCIATE_TRANSACTION_FILE_LABEL      N_("_Associate File with Transaction")
+#define ASSOCIATE_TRANSACTION_LOCATION_LABEL  N_("_Associate Location with Transaction")
+#define EXECASSOCIATED_TRANSACTION_LABEL N_("_Open Associated File/Location")
+#define CUT_SPLIT_LABEL                  N_("Cu_t Split")
+#define COPY_SPLIT_LABEL                 N_("_Copy Split")
+#define PASTE_SPLIT_LABEL                N_("_Paste Split")
+#define DUPLICATE_SPLIT_LABEL            N_("Dup_licate Split")
+#define DELETE_SPLIT_LABEL               N_("_Delete Split")
+#define CUT_TRANSACTION_TIP              N_("Cut the selected transaction into clipboard")
+#define COPY_TRANSACTION_TIP             N_("Copy the selected transaction into clipboard")
+#define PASTE_TRANSACTION_TIP            N_("Paste the transaction from the clipboard")
+#define DUPLICATE_TRANSACTION_TIP        N_("Make a copy of the current transaction")
+#define DELETE_TRANSACTION_TIP           N_("Delete the current transaction")
+#define ASSOCIATE_TRANSACTION_FILE_TIP   N_("Associate a file with the current transaction")
+#define ASSOCIATE_TRANSACTION_LOCATION_TIP    N_("Associate a location with the current transaction")
+#define EXECASSOCIATED_TRANSACTION_TIP   N_("Open the associated file or location with the current transaction")
+#define CUT_SPLIT_TIP                    N_("Cut the selected split into clipboard")
+#define COPY_SPLIT_TIP                   N_("Copy the selected split into clipboard")
+#define PASTE_SPLIT_TIP                  N_("Paste the split from the clipboard")
+#define DUPLICATE_SPLIT_TIP              N_("Make a copy of the current split")
+#define DELETE_SPLIT_TIP                 N_("Delete the current split")
+
+static GtkActionEntry gnc_plugin_page_register_actions [] =
+{
+    /* File menu */
+
+    {
+        "FilePrintAction", "document-print", N_("_Print Checks..."), "<primary>p", NULL,
+        G_CALLBACK (gnc_plugin_page_register_cmd_print_check)
+    },
+
+    /* Edit menu */
+
+    {
+        "EditCutAction", "edit-cut", N_("Cu_t"), "<primary>X",
+        N_("Cut the current selection and copy it to clipboard"),
+        G_CALLBACK (gnc_plugin_page_register_cmd_cut)
+    },
+    {
+        "EditCopyAction", "edit-copy", N_("_Copy"), "<primary>C",
+        N_("Copy the current selection to clipboard"),
+        G_CALLBACK (gnc_plugin_page_register_cmd_copy)
+    },
+    {
+        "EditPasteAction", "edit-paste", N_("_Paste"), "<primary>V",
+        N_("Paste the clipboard content at the cursor position"),
+        G_CALLBACK (gnc_plugin_page_register_cmd_paste)
+    },
+    {
+        "EditEditAccountAction", GNC_ICON_EDIT_ACCOUNT, N_("Edit _Account"), "<primary>e",
+        N_("Edit the selected account"),
+        G_CALLBACK (gnc_plugin_page_register_cmd_edit_account)
+    },
+    {
+        "EditFindAccountAction", "edit-find", N_("F_ind Account"), "<primary>i",
+        N_("Find an account"),
+        G_CALLBACK (gnc_plugin_page_register_cmd_find_account)
+    },
+    {
+        "EditFindTransactionsAction", "edit-find", N_("_Find..."), "<primary>f",
+        N_("Find transactions with a search"),
+        G_CALLBACK (gnc_plugin_page_register_cmd_find_transactions)
+    },
+
+    /* Transaction menu */
+
+    {
+        "CutTransactionAction", "edit-cut", CUT_TRANSACTION_LABEL, "",
+        CUT_TRANSACTION_TIP,
+        G_CALLBACK (gnc_plugin_page_register_cmd_cut_transaction)
+    },
+    {
+        "CopyTransactionAction", "edit-copy", COPY_TRANSACTION_LABEL, "",
+        COPY_TRANSACTION_TIP,
+        G_CALLBACK (gnc_plugin_page_register_cmd_copy_transaction)
+    },
+    {
+        "PasteTransactionAction", "edit-paste", PASTE_TRANSACTION_LABEL, "",
+        PASTE_TRANSACTION_TIP,
+        G_CALLBACK (gnc_plugin_page_register_cmd_paste_transaction)
+    },
+    {
+        "DuplicateTransactionAction", "edit-copy", DUPLICATE_TRANSACTION_LABEL, "",
+        DUPLICATE_TRANSACTION_TIP,
+        G_CALLBACK (gnc_plugin_page_register_cmd_duplicate_transaction)
+    },
+    {
+        "DeleteTransactionAction", "edit-delete", DELETE_TRANSACTION_LABEL, NULL,
+        DELETE_TRANSACTION_TIP,
+        G_CALLBACK (gnc_plugin_page_register_cmd_delete_transaction)
+    },
+    {
+        "RemoveTransactionSplitsAction", "edit-clear", N_("Remo_ve Other Splits"), NULL,
+        N_("Remove all splits in the current transaction"),
+        G_CALLBACK (gnc_plugin_page_register_cmd_reinitialize_transaction)
+    },
+    {
+        "RecordTransactionAction", "list-add", N_("_Enter Transaction"), NULL,
+        N_("Record the current transaction"),
+        G_CALLBACK (gnc_plugin_page_register_cmd_enter_transaction)
+    },
+    {
+        "CancelTransactionAction", "process-stop", N_("Ca_ncel Transaction"), NULL,
+        N_("Cancel the current transaction"),
+        G_CALLBACK (gnc_plugin_page_register_cmd_cancel_transaction)
+    },
+    {
+        "VoidTransactionAction", NULL, N_("_Void Transaction"), NULL, NULL,
+        G_CALLBACK (gnc_plugin_page_register_cmd_void_transaction)
+    },
+    {
+        "UnvoidTransactionAction", NULL, N_("_Unvoid Transaction"), NULL, NULL,
+        G_CALLBACK (gnc_plugin_page_register_cmd_unvoid_transaction)
+    },
+    {
+        "ReverseTransactionAction", NULL, N_("Add _Reversing Transaction"), NULL, NULL,
+        G_CALLBACK (gnc_plugin_page_register_cmd_reverse_transaction)
+    },
+    {
+        "AssociateTransactionFileAction", NULL, ASSOCIATE_TRANSACTION_FILE_LABEL, NULL,
+        ASSOCIATE_TRANSACTION_FILE_TIP,
+        G_CALLBACK (gnc_plugin_page_register_cmd_associate_file_transaction)
+    },
+    {
+        "AssociateTransactionLocationAction", NULL, ASSOCIATE_TRANSACTION_LOCATION_LABEL, NULL,
+        ASSOCIATE_TRANSACTION_LOCATION_TIP,
+        G_CALLBACK (gnc_plugin_page_register_cmd_associate_location_transaction)
+    },
+    {
+        "ExecAssociatedTransactionAction", NULL, EXECASSOCIATED_TRANSACTION_LABEL, NULL,
+        EXECASSOCIATED_TRANSACTION_TIP,
+        G_CALLBACK (gnc_plugin_page_register_cmd_execassociated_transaction)
+    },
+
+    /* View menu */
+
+    {
+        "ViewSortByAction", NULL, N_("_Sort By..."), NULL, NULL,
+        G_CALLBACK (gnc_plugin_page_register_cmd_view_sort_by)
+    },
+    {
+        "ViewFilterByAction", NULL, N_("_Filter By..."), NULL, NULL,
+        G_CALLBACK (gnc_plugin_page_register_cmd_view_filter_by)
+    },
+
+    /* Actions menu */
+
+    {
+        "ActionsTransferAction", GNC_ICON_TRANSFER, N_("_Transfer..."), "<primary>t",
+        N_("Transfer funds from one account to another"),
+        G_CALLBACK (gnc_plugin_page_register_cmd_transfer)
+    },
+    {
+        "ActionsReconcileAction", "edit-select-all", N_("_Reconcile..."), NULL,
+        N_("Reconcile the selected account"),
+        G_CALLBACK (gnc_plugin_page_register_cmd_reconcile)
+    },
+    {
+        "ActionsAutoClearAction", "edit-select-all", N_("_Auto-clear..."), NULL,
+        N_("Automatically clear individual transactions, so as to reach a certain cleared amount"),
+        G_CALLBACK (gnc_plugin_page_register_cmd_autoclear)
+    },
+    {
+        "ActionsStockSplitAction", NULL, N_("Stoc_k Split..."), NULL,
+        N_("Record a stock split or a stock merger"),
+        G_CALLBACK (gnc_plugin_page_register_cmd_stock_split)
+    },
+    {
+        "ActionsLotsAction", NULL, N_("View _Lots..."), NULL,
+        N_("Bring up the lot viewer/editor window"),
+        G_CALLBACK (gnc_plugin_page_register_cmd_lots)
+    },
+    {
+        "BlankTransactionAction", "go-bottom", N_("_Blank Transaction"), "<primary>Page_Down",
+        N_("Move to the blank transaction at the bottom of the register"),
+        G_CALLBACK (gnc_plugin_page_register_cmd_blank_transaction)
+    },
+    {
+        "EditExchangeRateAction", NULL, N_("Edit E_xchange Rate"), NULL,
+        N_("Edit the exchange rate for the current transaction"),
+        G_CALLBACK (gnc_plugin_page_register_cmd_exchange_rate)
+    },
+    {
+        "JumpTransactionAction", GNC_ICON_JUMP_TO, N_("_Jump"), NULL,
+        N_("Jump to the corresponding transaction in the other account"),
+        G_CALLBACK (gnc_plugin_page_register_cmd_jump)
+    },
+    {
+        "ScheduleTransactionAction", GNC_ICON_SCHEDULE, N_("Sche_dule..."), NULL,
+        N_("Create a Scheduled Transaction with the current transaction as a template"),
+        G_CALLBACK (gnc_plugin_page_register_cmd_schedule)
+    },
+    {
+        "ScrubAllAction", NULL, N_("_All transactions"), NULL, NULL,
+        G_CALLBACK (gnc_plugin_page_register_cmd_scrub_all)
+    },
+    {
+        "ScrubCurrentAction", NULL, N_("_This transaction"), NULL, NULL,
+        G_CALLBACK (gnc_plugin_page_register_cmd_scrub_current)
+    },
+
+    /* Reports menu */
+
+    {
+        "ReportsAccountReportAction", NULL, N_("Account Report"), NULL,
+        N_("Open a register report for this Account"),
+        G_CALLBACK (gnc_plugin_page_register_cmd_account_report)
+    },
+    {
+        "ReportsAcctTransReportAction", NULL, N_("Account Report - Single Transaction"), NULL,
+        N_("Open a register report for the selected Transaction"),
+        G_CALLBACK (gnc_plugin_page_register_cmd_transaction_report)
+    },
+};
+
+static guint gnc_plugin_page_register_n_actions = G_N_ELEMENTS (gnc_plugin_page_register_actions);
+
+static GtkToggleActionEntry toggle_entries[] =
+{
+    {
+        "ViewStyleDoubleLineAction", NULL, N_("_Double Line"), NULL,
+        N_("Show two lines of information for each transaction"),
+        G_CALLBACK (gnc_plugin_page_register_cmd_style_double_line), FALSE
+    },
+
+    {
+        "SplitTransactionAction", GNC_ICON_SPLIT_TRANS, N_("S_plit Transaction"), NULL,
+        N_("Show all splits in the current transaction"),
+        G_CALLBACK (gnc_plugin_page_register_cmd_expand_transaction), FALSE
+    },
+};
+
+static guint n_toggle_entries = G_N_ELEMENTS (toggle_entries);
+
+static GtkRadioActionEntry radio_entries_2 [] =
+{
+    /* Translators: This is a menu item in the View menu */
+    {
+        "ViewStyleBasicAction", NULL, N_("_Basic Ledger"), NULL,
+        N_("Show transactions on one or two lines"), REG_STYLE_LEDGER
+    },
+    /* Translators: This is a menu item in the View menu */
+    {
+        "ViewStyleAutoSplitAction", NULL, N_("_Auto-Split Ledger"), NULL,
+        N_("Show transactions on one or two lines and expand the current transaction"), REG_STYLE_AUTO_LEDGER
+    },
+    /* Translators: This is a menu item in the View menu */
+    {
+        "ViewStyleJournalAction", NULL, N_("Transaction _Journal"), NULL,
+        N_("Show expanded transactions with all splits"), REG_STYLE_JOURNAL
+    }
+};
+
+static guint n_radio_entries_2 = G_N_ELEMENTS (radio_entries_2);
+
+/** These are the "important" actions provided by the register page.
+ *  Their labels will appear when the toolbar is set to "Icons and
+ *  important text" (e.g. GTK_TOOLBAR_BOTH_HORIZ) mode. */
+static const gchar *important_actions[] =
+{
+    "SplitTransactionAction",
+    NULL,
+};
+
+/** Actions that require an account to be selected before they are
+ *  enabled. */
+static const gchar *actions_requiring_account[] =
+{
+    "EditEditAccountAction",
+    "ActionsReconcileAction",
+    "ActionsAutoClearAction",
+    "ActionsLotsAction",
+    NULL
+};
+
+/** View Style actions */
+static const gchar *view_style_actions[] =
+{
+    "ViewStyleBasicAction",
+    "ViewStyleAutoSplitAction",
+    "ViewStyleJournalAction",
+    NULL
+};
+
+/** Short labels for use on the toolbar buttons. */
+static action_toolbar_labels toolbar_labels[] =
+{
+    { "ActionsTransferAction", 	            N_("Transfer") },
+    { "RecordTransactionAction", 	        N_("Enter") },
+    { "CancelTransactionAction", 	        N_("Cancel") },
+    { "DeleteTransactionAction", 	        N_("Delete") },
+	{ "DuplicateTransactionAction",         N_("Duplicate") },
+    { "SplitTransactionAction",             N_("Split") },
+    { "ScheduleTransactionAction",          N_("Schedule") },
+    { "BlankTransactionAction",             N_("Blank") },
+    { "ActionsReconcileAction",             N_("Reconcile") },
+    { "ActionsAutoClearAction",             N_("Auto-clear") },
+    { "AssociateTransactionFileAction",     N_("Associate File") },
+    { "AssociateTransactionLocationAction", N_("Associate Location") },
+    { "ExecAssociatedTransactionAction",    N_("Open File/Location") },
+    { NULL, NULL },
+};
+
+struct status_action
+{
+    const char *action_name;
+    int value;
+    GtkWidget *widget;
+};
+
+static struct status_action status_actions[] =
+{
+    { "filter_status_reconciled",   CLEARED_RECONCILED, NULL },
+    { "filter_status_cleared",      CLEARED_CLEARED, NULL },
+    { "filter_status_voided",       CLEARED_VOIDED, NULL },
+    { "filter_status_frozen",       CLEARED_FROZEN, NULL },
+    { "filter_status_unreconciled", CLEARED_NO, NULL },
+    { NULL, 0, NULL },
+};
+
+#define CLEARED_VALUE "cleared_value"
+#define DEFAULT_FILTER "0x001f"
+#define DEFAULT_SORT_ORDER "BY_STANDARD"
+
+/************************************************************/
+/*                      Data Structures                     */
+/************************************************************/
+
+typedef struct GncPluginPageRegisterPrivate
+{
+    GNCLedgerDisplay *ledger;
+    GNCSplitReg *gsr;
+
+    GtkWidget *widget;
+
+    gint event_handler_id;
+    gint component_manager_id;
+    GncGUID key;  /* The guid of the Account we're watching */
+
+    gint lines_default;
+    gboolean read_only;
+
+    struct
+    {
+        GtkWidget *dialog;
+        GtkWidget *num_radio;
+        GtkWidget *act_radio;
+        SortType original_sort_type;
+        gboolean original_save_order;
+        gboolean save_order;
+        gboolean reverse_order;
+        gboolean original_reverse_order;
+    } sd;
+
+    struct
+    {
+        GtkWidget *dialog;
+        GtkWidget *table;
+        GtkWidget *start_date_choose;
+        GtkWidget *start_date_today;
+        GtkWidget *start_date;
+        GtkWidget *end_date_choose;
+        GtkWidget *end_date_today;
+        GtkWidget *end_date;
+        cleared_match_t original_cleared_match;
+        cleared_match_t cleared_match;
+        time64 original_start_time;
+        time64 original_end_time;
+        time64 start_time;
+        time64 end_time;
+        gboolean original_save_filter;
+        gboolean save_filter;
+    } fd;
+} GncPluginPageRegisterPrivate;
+
+#define GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(o)  \
+   (G_TYPE_INSTANCE_GET_PRIVATE ((o), GNC_TYPE_PLUGIN_PAGE_REGISTER, GncPluginPageRegisterPrivate))
+
+static GObjectClass *parent_class = NULL;
+
+/************************************************************/
+/*                      Implementation                      */
+/************************************************************/
+
+GType
+gnc_plugin_page_register_get_type (void)
+{
+    static GType gnc_plugin_page_register_type = 0;
+
+    if (gnc_plugin_page_register_type == 0)
+    {
+        static const GTypeInfo our_info =
+        {
+            sizeof (GncPluginPageRegisterClass),
+            NULL,
+            NULL,
+            (GClassInitFunc) gnc_plugin_page_register_class_init,
+            NULL,
+            NULL,
+            sizeof (GncPluginPageRegister),
+            0,
+            (GInstanceInitFunc) gnc_plugin_page_register_init
+        };
+
+        gnc_plugin_page_register_type = g_type_register_static (GNC_TYPE_PLUGIN_PAGE,
+                                        GNC_PLUGIN_PAGE_REGISTER_NAME,
+                                        &our_info, 0);
+    }
+
+    return gnc_plugin_page_register_type;
+}
+
+static GncPluginPage *
+gnc_plugin_page_register_new_common (GNCLedgerDisplay *ledger)
+{
+    GncPluginPageRegister *register_page;
+    GncPluginPageRegisterPrivate *priv;
+    GncPluginPage *plugin_page;
+    GNCSplitReg *gsr;
+    const GList *item;
+    GList *book_list;
+    gchar *label;
+    gchar *label_color;
+    QofQuery *q;
+
+    /* Is there an existing page? */
+    gsr = gnc_ledger_display_get_user_data (ledger);
+    if (gsr)
+    {
+        item = gnc_gobject_tracking_get_list(GNC_PLUGIN_PAGE_REGISTER_NAME);
+        for ( ; item; item = g_list_next(item))
+        {
+            register_page = (GncPluginPageRegister *)item->data;
+            priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(register_page);
+            if (priv->gsr == gsr)
+                return GNC_PLUGIN_PAGE(register_page);
+        }
+    }
+
+    register_page = g_object_new (GNC_TYPE_PLUGIN_PAGE_REGISTER, NULL);
+    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(register_page);
+    priv->ledger = ledger;
+    priv->key = *guid_null();
+
+    plugin_page = GNC_PLUGIN_PAGE(register_page);
+    label = gnc_plugin_page_register_get_tab_name(plugin_page);
+    gnc_plugin_page_set_page_name(plugin_page, label);
+    g_free(label);
+
+    label_color = gnc_plugin_page_register_get_tab_color(plugin_page);
+    gnc_plugin_page_set_page_color(plugin_page, label_color);
+    g_free(label_color);
+
+    label = gnc_plugin_page_register_get_long_name(plugin_page);
+    gnc_plugin_page_set_page_long_name(plugin_page, label);
+    g_free(label);
+
+    q = gnc_ledger_display_get_query (ledger);
+    book_list = qof_query_get_books (q);
+    for (item = book_list; item; item = g_list_next(item))
+        gnc_plugin_page_add_book (plugin_page, (QofBook *)item->data);
+    // Do not free the list. It is owned by the query.
+
+    priv->component_manager_id = 0;
+    return plugin_page;
+}
+
+GncPluginPage *
+gnc_plugin_page_register_new (Account *account, gboolean subaccounts)
+{
+    GNCLedgerDisplay *ledger;
+    GncPluginPage *page;
+    GncPluginPageRegisterPrivate *priv;
+
+/*################## Added for Reg2 #################*/
+    const GList *item;
+    GncPluginPageRegister2  *new_register_page;
+/*################## Added for Reg2 #################*/
+
+    ENTER("account=%p, subaccounts=%s", account,
+          subaccounts ? "TRUE" : "FALSE");
+
+/*################## Added for Reg2 #################*/
+    // We test for the new register being open here, ie matching account guids
+    item = gnc_gobject_tracking_get_list (GNC_PLUGIN_PAGE_REGISTER2_NAME);
+    for ( ; item; item = g_list_next (item))
+    {
+        Account *new_account;
+        new_register_page = (GncPluginPageRegister2 *)item->data;
+        new_account = gnc_plugin_page_register2_get_account (new_register_page);
+
+        if (guid_equal (xaccAccountGetGUID (account), xaccAccountGetGUID (new_account)))
+        {
+            gnc_error_dialog (NULL, "%s",
+                         _("You have tried to open an account in the old register while it is open in the new register."));
+            return NULL;
+        }
+    }
+/*################## Added for Reg2 #################*/
+
+    if (subaccounts)
+        ledger = gnc_ledger_display_subaccounts (account);
+    else
+        ledger = gnc_ledger_display_simple (account);
+
+    page = gnc_plugin_page_register_new_common(ledger);
+    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
+    priv->key = *xaccAccountGetGUID(account);
+
+    LEAVE("%p", page);
+    return page;
+}
+
+GncPluginPage *
+gnc_plugin_page_register_new_gl (void)
+{
+    GNCLedgerDisplay *ledger;
+
+    ledger = gnc_ledger_display_gl ();
+    return gnc_plugin_page_register_new_common(ledger);
+}
+
+GncPluginPage *
+gnc_plugin_page_register_new_ledger (GNCLedgerDisplay *ledger)
+{
+    return gnc_plugin_page_register_new_common(ledger);
+}
+
+static void
+gnc_plugin_page_register_class_init (GncPluginPageRegisterClass *klass)
+{
+    GObjectClass *object_class = G_OBJECT_CLASS (klass);
+    GncPluginPageClass *gnc_plugin_class = GNC_PLUGIN_PAGE_CLASS(klass);
+
+    parent_class = g_type_class_peek_parent (klass);
+
+    object_class->finalize = gnc_plugin_page_register_finalize;
+
+    gnc_plugin_class->tab_icon        = GNC_ICON_ACCOUNT;
+    gnc_plugin_class->plugin_name     = GNC_PLUGIN_PAGE_REGISTER_NAME;
+    gnc_plugin_class->create_widget   = gnc_plugin_page_register_create_widget;
+    gnc_plugin_class->destroy_widget  = gnc_plugin_page_register_destroy_widget;
+    gnc_plugin_class->window_changed  = gnc_plugin_page_register_window_changed;
+    gnc_plugin_class->save_page       = gnc_plugin_page_register_save_page;
+    gnc_plugin_class->recreate_page   = gnc_plugin_page_register_recreate_page;
+    gnc_plugin_class->update_edit_menu_actions = gnc_plugin_page_register_update_edit_menu;
+    gnc_plugin_class->finish_pending  = gnc_plugin_page_register_finish_pending;
+
+    g_type_class_add_private(klass, sizeof(GncPluginPageRegisterPrivate));
+
+    gnc_ui_register_account_destroy_callback (gppr_account_destroy_cb);
+}
+
+static void
+gnc_plugin_page_register_init (GncPluginPageRegister *plugin_page)
+{
+    GncPluginPageRegisterPrivate *priv;
+    GncPluginPage *parent;
+    GtkActionGroup *action_group;
+    gboolean use_new;
+
+    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
+
+    /* Init parent declared variables */
+    parent = GNC_PLUGIN_PAGE(plugin_page);
+    use_new = gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL_REGISTER, GNC_PREF_USE_NEW);
+    g_object_set(G_OBJECT(plugin_page),
+                 "page-name",      _("General Journal"),
+                 "page-uri",       "default:",
+                 "ui-description", "gnc-plugin-page-register-ui.xml",
+                 "use-new-window", use_new,
+                 NULL);
+
+    /* Create menu and toolbar information */
+    action_group =
+        gnc_plugin_page_create_action_group(parent,
+                                            "GncPluginPageRegisterActions");
+    gtk_action_group_add_actions (action_group, gnc_plugin_page_register_actions,
+                                  gnc_plugin_page_register_n_actions, plugin_page);
+    gtk_action_group_add_toggle_actions (action_group,
+                                         toggle_entries, n_toggle_entries,
+                                         plugin_page);
+    gtk_action_group_add_radio_actions (action_group,
+                                        radio_entries_2, n_radio_entries_2,
+                                        REG_STYLE_LEDGER,
+                                        G_CALLBACK(gnc_plugin_page_register_cmd_style_changed),
+                                        plugin_page);
+
+    gnc_plugin_init_short_names (action_group, toolbar_labels);
+    gnc_plugin_set_important_actions (action_group, important_actions);
+
+    priv->lines_default     = DEFAULT_LINES_AMOUNT;
+    priv->read_only         = FALSE;
+    priv->fd.cleared_match  = CLEARED_ALL;
+}
+
+static void
+gnc_plugin_page_register_finalize (GObject *object)
+{
+    g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (object));
+
+    ENTER("object %p", object);
+
+    G_OBJECT_CLASS (parent_class)->finalize (object);
+    LEAVE(" ");
+}
+
+Account *
+gnc_plugin_page_register_get_account (GncPluginPageRegister *page)
+{
+    GncPluginPageRegisterPrivate *priv;
+    GNCLedgerDisplayType ledger_type;
+    Account *leader;
+
+    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
+    ledger_type = gnc_ledger_display_type (priv->ledger);
+    leader = gnc_ledger_display_leader (priv->ledger);
+
+    if ((ledger_type == LD_SINGLE) || (ledger_type == LD_SUBACCOUNT))
+        return leader;
+    return NULL;
+}
+
+/* This is the list of actions which are switched inactive in a read-only book. */
+static const char* readonly_inactive_actions[] =
+{
+    "EditCutAction",
+    "EditPasteAction",
+    "CutTransactionAction",
+    "PasteTransactionAction",
+    "DuplicateTransactionAction",
+    "DeleteTransactionAction",
+    "RemoveTransactionSplitsAction",
+    "RecordTransactionAction",
+    "CancelTransactionAction",
+    "UnvoidTransactionAction",
+    "VoidTransactionAction",
+    "ReverseTransactionAction",
+    "ActionsTransferAction",
+    "ActionsReconcileAction",
+    "ActionsStockSplitAction",
+    "ScheduleTransactionAction",
+    "ScrubAllAction",
+    "ScrubCurrentAction",
+    "AssociateTransactionFileAction",
+    "AssociateTransactionLocationAction",
+    NULL
+};
+
+/* This is the list of actions whose text needs to be changed based on whether */
+/* the current cursor class is transaction or split. */
+static const char* tran_vs_split_actions[] =
+{
+    "CutTransactionAction",
+    "CopyTransactionAction",
+    "PasteTransactionAction",
+    "DuplicateTransactionAction",
+    "DeleteTransactionAction",
+    NULL
+};
+
+/* This is the list of labels for when the current cursor class is transaction. */
+static const char* tran_action_labels[] =
+{
+    CUT_TRANSACTION_LABEL,
+    COPY_TRANSACTION_LABEL,
+    PASTE_TRANSACTION_LABEL,
+    DUPLICATE_TRANSACTION_LABEL,
+    DELETE_TRANSACTION_LABEL,
+    ASSOCIATE_TRANSACTION_FILE_LABEL,
+    ASSOCIATE_TRANSACTION_LOCATION_LABEL,
+    EXECASSOCIATED_TRANSACTION_LABEL,
+    NULL
+};
+
+/* This is the list of tooltips for when the current cursor class is transaction. */
+static const char* tran_action_tips[] =
+{
+    CUT_TRANSACTION_TIP,
+    COPY_TRANSACTION_TIP,
+    PASTE_TRANSACTION_TIP,
+    DUPLICATE_TRANSACTION_TIP,
+    DELETE_TRANSACTION_TIP,
+    ASSOCIATE_TRANSACTION_FILE_TIP,
+    ASSOCIATE_TRANSACTION_LOCATION_TIP,
+    EXECASSOCIATED_TRANSACTION_TIP,
+    NULL
+};
+
+/* This is the list of labels for when the current cursor class is split. */
+static const char* split_action_labels[] =
+{
+    CUT_SPLIT_LABEL,
+    COPY_SPLIT_LABEL,
+    PASTE_SPLIT_LABEL,
+    DUPLICATE_SPLIT_LABEL,
+    DELETE_SPLIT_LABEL,
+    NULL
+};
+
+/* This is the list of tooltips for when the current cursor class is split. */
+static const char* split_action_tips[] =
+{
+    CUT_SPLIT_TIP,
+    COPY_SPLIT_TIP,
+    PASTE_SPLIT_TIP,
+    DUPLICATE_SPLIT_TIP,
+    DELETE_SPLIT_TIP,
+    NULL
+};
+
+static void
+gnc_plugin_page_register_ui_update (gpointer various, GncPluginPageRegister *page)
+{
+    GncPluginPageRegisterPrivate *priv;
+    SplitRegister *reg;
+    GtkAction *action;
+    gboolean expanded, voided;
+    Transaction *trans;
+    const char *uri;
+
+    /* Set 'Split Transaction' */
+    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
+    reg = gnc_ledger_display_get_split_register(priv->ledger);
+    expanded = gnc_split_register_current_trans_expanded(reg);
+    action = gnc_plugin_page_get_action (GNC_PLUGIN_PAGE(page),
+                                         "SplitTransactionAction");
+    gtk_action_set_sensitive (action, reg->style == REG_STYLE_LEDGER);
+    g_signal_handlers_block_by_func
+    (action, gnc_plugin_page_register_cmd_expand_transaction, page);
+    gtk_toggle_action_set_active (GTK_TOGGLE_ACTION(action), expanded);
+    g_signal_handlers_unblock_by_func
+    (action, gnc_plugin_page_register_cmd_expand_transaction, page);
+
+    /* Set 'Void' and 'Unvoid' */
+    trans = gnc_split_register_get_current_trans(reg);
+    voided = xaccTransHasSplitsInState(trans, VREC);
+    action = gnc_plugin_page_get_action (GNC_PLUGIN_PAGE(page),
+                                         "VoidTransactionAction");
+    gtk_action_set_sensitive (GTK_ACTION(action), !voided);
+
+    action = gnc_plugin_page_get_action (GNC_PLUGIN_PAGE(page),
+                                         "UnvoidTransactionAction");
+    gtk_action_set_sensitive (GTK_ACTION(action), voided);
+
+    /* Set 'ExecAssociated' */
+    uri = xaccTransGetAssociation(trans);
+    action = gnc_plugin_page_get_action (GNC_PLUGIN_PAGE(page),
+                                         "ExecAssociatedTransactionAction");
+    if (g_strcmp0 (uri, "") != 0 && g_strcmp0 (uri, NULL) != 0)
+        gtk_action_set_sensitive (GTK_ACTION(action), TRUE);
+    else
+        gtk_action_set_sensitive (GTK_ACTION(action), FALSE);
+
+    /* If we are in a readonly book, make any modifying action inactive */
+    if (qof_book_is_readonly(gnc_get_current_book()))
+    {
+        const char **iter;
+        for (iter = readonly_inactive_actions; *iter; ++iter)
+        {
+            /* Set the action's sensitivity */
+            GtkAction *action = gnc_plugin_page_get_action (GNC_PLUGIN_PAGE(page), *iter);
+            gtk_action_set_sensitive(action, FALSE);
+        }
+    }
+
+    /* Modifying action descriptions based on cursor class */
+    {
+        const char **iter, **label_iter, **tooltip_iter;
+        gboolean curr_label_trans = FALSE;
+        CursorClass cursor_class = gnc_split_register_get_current_cursor_class (reg);
+        iter = tran_vs_split_actions;
+        action = gnc_plugin_page_get_action (GNC_PLUGIN_PAGE(page), *iter);
+        label_iter = tran_action_labels;
+        if (g_strcmp0 (gtk_action_get_label(action), _(*label_iter)) == 0)
+            curr_label_trans = TRUE;
+        if ((cursor_class == CURSOR_CLASS_SPLIT) && curr_label_trans)
+        {
+            label_iter = split_action_labels;
+            tooltip_iter = split_action_tips;
+            for (iter = tran_vs_split_actions; *iter; ++iter)
+            {
+                /* Adjust the action's label and tooltip */
+                action = gnc_plugin_page_get_action (GNC_PLUGIN_PAGE(page), *iter);
+                gtk_action_set_label(action, _(*label_iter));
+                gtk_action_set_tooltip(action, _(*tooltip_iter));
+                ++label_iter;
+                ++tooltip_iter;
+            }
+        }
+        else if ((cursor_class == CURSOR_CLASS_TRANS) && !curr_label_trans)
+        {
+            label_iter = tran_action_labels;
+            tooltip_iter = tran_action_tips;
+            for (iter = tran_vs_split_actions; *iter; ++iter)
+            {
+                /* Adjust the action's label and tooltip */
+                action = gnc_plugin_page_get_action (GNC_PLUGIN_PAGE(page), *iter);
+                gtk_action_set_label(action, _(*label_iter));
+                gtk_action_set_tooltip(action, _(*tooltip_iter));
+                ++label_iter;
+                ++tooltip_iter;
+            }
+        }
+    }
+}
+
+static void
+gnc_plugin_page_register_ui_initial_state (GncPluginPageRegister *page)
+{
+    GncPluginPageRegisterPrivate *priv ;
+    GtkActionGroup *action_group;
+    GtkAction *action;
+    Account *account;
+    SplitRegister *reg;
+    GNCLedgerDisplayType ledger_type;
+    int i;
+    gboolean is_readwrite = !qof_book_is_readonly(gnc_get_current_book());
+
+    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
+    account = gnc_plugin_page_register_get_account (page);
+    action_group = gnc_plugin_page_get_action_group(GNC_PLUGIN_PAGE(page));
+    gnc_plugin_update_actions(action_group, actions_requiring_account,
+                              "sensitive", is_readwrite && account != NULL);
+
+    /* Set "style" radio button */
+    ledger_type = gnc_ledger_display_type(priv->ledger);
+    gnc_plugin_update_actions(action_group, view_style_actions,
+                              "sensitive", ledger_type == LD_SINGLE);
+
+    reg = gnc_ledger_display_get_split_register(priv->ledger);
+    for (i = n_radio_entries_2 - 1; i > 0; i--)
+    {
+        DEBUG(" index %d: comparing %x to %x", i, radio_entries_2[i].value,
+              reg->style);
+        if (radio_entries_2[i].value == reg->style)
+        {
+            DEBUG("match");
+            break;
+        }
+    }
+
+    /* Either a match was found, or fell out with i = 0 */
+    action = gtk_action_group_get_action(action_group, radio_entries_2[i].name);
+    g_signal_handlers_block_by_func(action, gnc_plugin_page_register_cmd_style_changed, page);
+    gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), TRUE);
+    g_signal_handlers_unblock_by_func(action, gnc_plugin_page_register_cmd_style_changed, page);
+
+    /* Set "double line" toggle button */
+    action = gtk_action_group_get_action (action_group,
+                                          "ViewStyleDoubleLineAction");
+    g_signal_handlers_block_by_func(action, gnc_plugin_page_register_cmd_style_double_line, page);
+    gtk_toggle_action_set_active (GTK_TOGGLE_ACTION(action), reg->use_double_line);
+    g_signal_handlers_unblock_by_func(action, gnc_plugin_page_register_cmd_style_double_line, page);
+}
+
+/* Virtual Functions */
+
+static GtkWidget *
+gnc_plugin_page_register_create_widget (GncPluginPage *plugin_page)
+{
+    GncPluginPageRegister *page;
+    GncPluginPageRegisterPrivate *priv;
+    GNCLedgerDisplayType ledger_type;
+    GncWindow *gnc_window;
+    guint numRows;
+    GtkWidget *gsr;
+    SplitRegister *reg;
+    Account *acct;
+    gchar **filter;
+    gchar *order;
+    int filter_changed = 0;
+
+    ENTER("page %p", plugin_page);
+    page = GNC_PLUGIN_PAGE_REGISTER (plugin_page);
+    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
+
+    if (priv->widget != NULL)
+    {
+        LEAVE("existing widget %p", priv->widget);
+        return priv->widget;
+    }
+
+    priv->widget = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
+    gtk_box_set_homogeneous (GTK_BOX (priv->widget), FALSE);
+    gtk_widget_show (priv->widget);
+
+    // Set the style context for this page so it can be easily manipulated with css
+    gnc_widget_set_style_context (GTK_WIDGET(priv->widget), "GncRegisterPage");
+
+    numRows = priv->lines_default;
+    numRows = MIN(numRows, DEFAULT_LINES_AMOUNT);
+
+    gnc_window = GNC_WINDOW(GNC_PLUGIN_PAGE(page)->window);
+    gsr = gnc_split_reg_new(priv->ledger,
+                            gnc_window_get_gtk_window(gnc_window),
+                            numRows, priv->read_only);
+    priv->gsr = (GNCSplitReg *)gsr;
+    gtk_widget_show (gsr);
+    gtk_box_pack_start (GTK_BOX (priv->widget), gsr, TRUE, TRUE, 0);
+
+    g_signal_connect (G_OBJECT (gsr), "help-changed",
+                      G_CALLBACK ( gnc_plugin_page_help_changed_cb ),
+                      page );
+
+    reg = gnc_ledger_display_get_split_register(priv->ledger);
+    gnc_split_register_config(reg, reg->type, reg->style,
+                              reg->use_double_line);
+    gnc_ledger_display_refresh(priv->ledger);
+
+    gnc_plugin_page_register_ui_initial_state (page);
+    gnc_plugin_page_register_ui_update (NULL, page);
+
+    ledger_type = gnc_ledger_display_type (priv->ledger);
+
+    if (ledger_type == LD_SINGLE || ledger_type == LD_SUBACCOUNT)
+    {
+        /* Set the sort order for the split register and status of save order button */
+        priv->sd.save_order = FALSE;
+        order = gnc_plugin_page_register_get_sort_order(plugin_page);
+
+        PINFO("Loaded Sort order is %s", order);
+
+        gnc_split_reg_set_sort_type(priv->gsr, SortTypefromString(order));
+
+        if (order && (g_strcmp0 (order, DEFAULT_SORT_ORDER) != 0))
+            priv->sd.save_order = TRUE;
+
+        priv->sd.original_save_order = priv->sd.save_order;
+        g_free(order);
+
+        priv->sd.reverse_order = gnc_plugin_page_register_get_sort_reversed(plugin_page);
+        gnc_split_reg_set_sort_reversed(priv->gsr, priv->sd.reverse_order);
+        if (priv->sd.reverse_order)
+            priv->sd.save_order = TRUE;
+
+        priv->sd.original_reverse_order = priv->sd.reverse_order;
+
+        /* Set the filter for the split register and status of save filter button */
+        priv->fd.save_filter = FALSE;
+
+        filter = g_strsplit(gnc_plugin_page_register_get_filter(plugin_page), ",", -1);
+
+        PINFO("Loaded Filter Status is %s", filter[0]);
+
+        priv->fd.cleared_match = (gint)g_ascii_strtoll( filter[0], NULL, 16 );
+
+        if (filter[0] && (g_strcmp0 (filter[0], DEFAULT_FILTER) != 0))
+            filter_changed = filter_changed + 1;
+
+        if (filter[1] && (g_strcmp0 (filter[1], "0") != 0 ))
+        {
+            PINFO("Loaded Filter Start Date is %s", filter[1]);
+
+            priv->fd.start_time = gnc_plugin_page_register_filter_dmy2time (filter[1] );
+            priv->fd.start_time = gnc_time64_get_day_start(priv->fd.start_time);
+            filter_changed = filter_changed + 1;
+
+            if (filter[2] && (g_strcmp0 (filter[2], "0") != 0 ))
+            {
+                PINFO("Loaded Filter End Date is %s", filter[2]);
+
+                priv->fd.end_time = gnc_plugin_page_register_filter_dmy2time (filter[2] );
+                priv->fd.end_time = gnc_time64_get_day_end(priv->fd.end_time);
+                filter_changed = filter_changed + 1;
+            }
+        }
+
+        if (filter_changed != 0)
+            priv->fd.save_filter = TRUE;
+
+        priv->fd.original_save_filter = priv->fd.save_filter;
+        g_strfreev(filter);
+
+        /* Update Query with Filter Status and Dates */
+        gnc_ppr_update_status_query (page);
+        gnc_ppr_update_date_query(page);
+    }
+
+    plugin_page->summarybar = gsr_create_summary_bar(priv->gsr);
+    if (plugin_page->summarybar)
+    {
+        gtk_widget_show_all(plugin_page->summarybar);
+        gtk_box_pack_start(GTK_BOX (priv->widget), plugin_page->summarybar,
+                           FALSE, FALSE, 0);
+
+        gnc_plugin_page_register_summarybar_position_changed (NULL, NULL, page);
+        gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL,
+                               GNC_PREF_SUMMARYBAR_POSITION_TOP,
+                               gnc_plugin_page_register_summarybar_position_changed,
+                               page);
+        gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL,
+                               GNC_PREF_SUMMARYBAR_POSITION_BOTTOM,
+                               gnc_plugin_page_register_summarybar_position_changed,
+                               page);
+    }
+
+    priv->event_handler_id = qof_event_register_handler
+                             ((QofEventHandler)gnc_plugin_page_register_event_handler, page);
+    priv->component_manager_id =
+        gnc_register_gui_component(GNC_PLUGIN_PAGE_REGISTER_NAME,
+                                   gnc_plugin_page_register_refresh_cb,
+                                   gnc_plugin_page_register_close_cb,
+                                   page);
+    gnc_gui_component_set_session (priv->component_manager_id,
+                                   gnc_get_current_session());
+    acct = gnc_plugin_page_register_get_account(page);
+    if (acct)
+        gnc_gui_component_watch_entity (
+            priv->component_manager_id, xaccAccountGetGUID(acct),
+            QOF_EVENT_DESTROY | QOF_EVENT_MODIFY);
+
+    gnc_split_reg_set_moved_cb
+    (priv->gsr, (GFunc)gnc_plugin_page_register_ui_update, page);
+
+    /* DRH - Probably lots of other stuff from regWindowLedger should end up here. */
+    LEAVE(" ");
+    return priv->widget;
+}
+
+static void
+gnc_plugin_page_register_destroy_widget (GncPluginPage *plugin_page)
+{
+    GncPluginPageRegister *page;
+    GncPluginPageRegisterPrivate *priv;
+
+    ENTER("page %p", plugin_page);
+    page = GNC_PLUGIN_PAGE_REGISTER (plugin_page);
+    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
+
+    gnc_prefs_remove_cb_by_func (GNC_PREFS_GROUP_GENERAL,
+                                 GNC_PREF_SUMMARYBAR_POSITION_TOP,
+                                 gnc_plugin_page_register_summarybar_position_changed,
+                                 page);
+    gnc_prefs_remove_cb_by_func (GNC_PREFS_GROUP_GENERAL,
+                                 GNC_PREF_SUMMARYBAR_POSITION_BOTTOM,
+                                 gnc_plugin_page_register_summarybar_position_changed,
+                                 page);
+    if (priv->widget == NULL)
+        return;
+
+    if (priv->component_manager_id)
+    {
+        gnc_unregister_gui_component(priv->component_manager_id);
+        priv->component_manager_id = 0;
+    }
+
+    if (priv->event_handler_id)
+    {
+        qof_event_unregister_handler(priv->event_handler_id);
+        priv->event_handler_id = 0;
+    }
+
+    if (priv->sd.dialog)
+    {
+        gtk_widget_destroy(priv->sd.dialog);
+        memset(&priv->sd, 0, sizeof(priv->sd));
+    }
+
+    if (priv->fd.dialog)
+    {
+        gtk_widget_destroy(priv->fd.dialog);
+        memset(&priv->fd, 0, sizeof(priv->fd));
+    }
+
+    gtk_widget_hide(priv->widget);
+    gnc_ledger_display_close (priv->ledger);
+    priv->ledger = NULL;
+    LEAVE(" ");
+}
+
+static void
+gnc_plugin_page_register_window_changed (GncPluginPage *plugin_page,
+        GtkWidget *window)
+{
+    GncPluginPageRegister *page;
+    GncPluginPageRegisterPrivate *priv;
+
+    g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (plugin_page));
+
+    page = GNC_PLUGIN_PAGE_REGISTER(plugin_page);
+    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
+    priv->gsr->window =
+        GTK_WIDGET(gnc_window_get_gtk_window(GNC_WINDOW(window)));
+}
+
+static const gchar *style_names[] =
+{
+    "Ledger",
+    "Auto Ledger",
+    "Journal",
+    NULL
+};
+
+#define KEY_REGISTER_TYPE       "RegisterType"
+#define KEY_ACCOUNT_NAME        "AccountName"
+#define KEY_REGISTER_STYLE      "RegisterStyle"
+#define KEY_DOUBLE_LINE         "DoubleLineMode"
+
+#define LABEL_ACCOUNT		"Account"
+#define LABEL_SUBACCOUNT	"SubAccount"
+#define LABEL_GL		"GL"
+#define LABEL_SEARCH		"Search"
+
+
+/** Save enough information about this register page that it can be
+ *  recreated next time the user starts gnucash.
+ *
+ *  @param plugin_page The page to save.
+ *
+ *  @param key_file A pointer to the GKeyFile data structure where the
+ *  page information should be written.
+ *
+ *  @param group_name The group name to use when saving data. */
+static void
+gnc_plugin_page_register_save_page (GncPluginPage *plugin_page,
+                                    GKeyFile *key_file,
+                                    const gchar *group_name)
+{
+    GncPluginPageRegister *page;
+    GncPluginPageRegisterPrivate *priv;
+    GNCLedgerDisplayType ledger_type;
+    SplitRegister *reg;
+    Account *leader;
+
+    g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page));
+    g_return_if_fail (key_file != NULL);
+    g_return_if_fail (group_name != NULL);
+
+    ENTER("page %p, key_file %p, group_name %s", plugin_page, key_file,
+          group_name);
+
+    page = GNC_PLUGIN_PAGE_REGISTER(plugin_page);
+    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
+
+    reg = gnc_ledger_display_get_split_register(priv->ledger);
+    ledger_type = gnc_ledger_display_type(priv->ledger);
+    if (ledger_type > LD_GL)
+    {
+        LEAVE("Unsupported ledger type");
+        return;
+    }
+    if ((ledger_type == LD_SINGLE) || (ledger_type == LD_SUBACCOUNT))
+    {
+        const gchar *label;
+        gchar* name;
+        label = (ledger_type == LD_SINGLE) ? LABEL_ACCOUNT : LABEL_SUBACCOUNT;
+        leader = gnc_ledger_display_leader(priv->ledger);
+        g_key_file_set_string(key_file, group_name, KEY_REGISTER_TYPE, label);
+        name = gnc_account_get_full_name(leader);
+        g_key_file_set_string(key_file, group_name, KEY_ACCOUNT_NAME, name);
+        g_free(name);
+    }
+    else if (reg->type == GENERAL_JOURNAL)
+    {
+        g_key_file_set_string(key_file, group_name, KEY_REGISTER_TYPE,
+                              LABEL_GL);
+    }
+    else if (reg->type == SEARCH_LEDGER)
+    {
+        g_key_file_set_string(key_file, group_name, KEY_REGISTER_TYPE,
+                              LABEL_SEARCH);
+    }
+    else
+    {
+        LEAVE("Unsupported register type");
+        return;
+    }
+
+    g_key_file_set_string(key_file, group_name, KEY_REGISTER_STYLE,
+                          style_names[reg->style]);
+    g_key_file_set_boolean(key_file, group_name, KEY_DOUBLE_LINE,
+                           reg->use_double_line);
+
+    LEAVE(" ");
+}
+
+
+/** Read and restore the edit menu settings on the specified register
+ *  page.  This function will restore the register style (ledger, auto
+ *  ledger, journal) and whether or not the register is in double line
+ *  mode.  It should eventually restore the "filter by" and "sort by
+ *  settings.
+ *
+ *  @param page The register being restored.
+ *
+ *  @param key_file A pointer to the GKeyFile data structure where the
+ *  page information should be read.
+ *
+ *  @param group_name The group name to use when restoring data. */
+static void
+gnc_plugin_page_register_restore_edit_menu (GncPluginPage *page,
+        GKeyFile *key_file,
+        const gchar *group_name)
+{
+    GtkAction *action;
+    GError *error = NULL;
+    gchar *style_name;
+    gint i;
+    gboolean use_double_line;
+
+    ENTER(" ");
+
+    /* Convert the style name to an index */
+    style_name = g_key_file_get_string(key_file, group_name,
+                                       KEY_REGISTER_STYLE, &error);
+    for (i = 0 ; style_names[i]; i++)
+    {
+        if (g_ascii_strcasecmp(style_name, style_names[i]) == 0)
+        {
+            DEBUG("Found match for style name: %s", style_name);
+            break;
+        }
+    }
+    g_free(style_name);
+
+    /* Update the style menu action for this page */
+    if (i <= REG_STYLE_JOURNAL)
+    {
+        DEBUG("Setting style: %d", i);
+        action = gnc_plugin_page_get_action(page, radio_entries_2[i].name);
+        gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), TRUE);
+    }
+
+    /* Update the  double line action on this page */
+    use_double_line =
+        g_key_file_get_boolean(key_file, group_name, KEY_DOUBLE_LINE, &error);
+    DEBUG("Setting double_line_mode: %d", use_double_line);
+    action = gnc_plugin_page_get_action(page, "ViewStyleDoubleLineAction");
+    gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), use_double_line);
+
+    LEAVE(" ");
+}
+
+
+/** Create a new register page based on the information saved during a
+ *  previous instantiation of gnucash.
+ *
+ *  @param window The window where this page should be installed.
+ *
+ *  @param key_file A pointer to the GKeyFile data structure where the
+ *  page information should be read.
+ *
+ *  @param group_name The group name to use when restoring data. */
+static GncPluginPage *
+gnc_plugin_page_register_recreate_page (GtkWidget *window,
+                                        GKeyFile *key_file,
+                                        const gchar *group_name)
+{
+    GncPluginPage *page;
+    GError *error = NULL;
+    gchar *reg_type, *acct_name;
+    Account *account;
+    QofBook *book;
+    gboolean include_subs;
+
+    g_return_val_if_fail(key_file, NULL);
+    g_return_val_if_fail(group_name, NULL);
+    ENTER("key_file %p, group_name %s", key_file, group_name);
+
+    /* Create the new page. */
+    reg_type = g_key_file_get_string(key_file, group_name,
+                                     KEY_REGISTER_TYPE, &error);
+    DEBUG("Page type: %s", reg_type);
+    if ((g_ascii_strcasecmp(reg_type, LABEL_ACCOUNT) == 0) ||
+            (g_ascii_strcasecmp(reg_type, LABEL_SUBACCOUNT) == 0))
+    {
+        include_subs = (g_ascii_strcasecmp(reg_type, LABEL_SUBACCOUNT) == 0);
+        DEBUG("Include subs: %d", include_subs);
+        acct_name = g_key_file_get_string(key_file, group_name,
+                                          KEY_ACCOUNT_NAME, &error);
+        book = qof_session_get_book(gnc_get_current_session());
+        account = gnc_account_lookup_by_full_name(gnc_book_get_root_account(book),
+                  acct_name);
+        g_free(acct_name);
+        if (account == NULL)
+        {
+            LEAVE("Bad account name");
+            g_free(reg_type);
+            return NULL;
+        }
+        page = gnc_plugin_page_register_new (account, include_subs);
+    }
+    else if (g_ascii_strcasecmp(reg_type, LABEL_GL) == 0)
+    {
+        page = gnc_plugin_page_register_new_gl();
+    }
+    else
+    {
+        LEAVE("Bad ledger type");
+        g_free(reg_type);
+        return NULL;
+    }
+    g_free(reg_type);
+
+    /* Recreate page in given window */
+    gnc_plugin_page_set_use_new_window(page, FALSE);
+
+    /* Install it now so we can them manipulate the created widget */
+    gnc_main_window_open_page(GNC_MAIN_WINDOW(window), page);
+
+    /* Now update the page to the last state it was in */
+    gnc_plugin_page_register_restore_edit_menu(page, key_file, group_name);
+    LEAVE(" ");
+    return page;
+}
+
+
+/*
+ * Based on code from Epiphany (src/ephy-window.c)
+ */
+static void
+gnc_plugin_page_register_update_edit_menu (GncPluginPage *page, gboolean hide)
+{
+    GncPluginPageRegisterPrivate *priv;
+    GncPluginPageRegister *reg_page;
+    GtkAction *action;
+    gboolean can_copy = FALSE, can_cut = FALSE, can_paste = FALSE;
+    gboolean has_selection;
+    gboolean is_readwrite = !qof_book_is_readonly(gnc_get_current_book());
+
+    reg_page = GNC_PLUGIN_PAGE_REGISTER(page);
+    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(reg_page);
+    has_selection = gnucash_register_has_selection (priv->gsr->reg);
+
+    can_copy = has_selection;
+    can_cut = is_readwrite && has_selection;
+    can_paste = is_readwrite;
+
+    action = gnc_plugin_page_get_action (page, "EditCopyAction");
+    gtk_action_set_sensitive (action, can_copy);
+    gtk_action_set_visible (action, !hide || can_copy);
+    action = gnc_plugin_page_get_action (page, "EditCutAction");
+    gtk_action_set_sensitive (action, can_cut);
+    gtk_action_set_visible (action, !hide || can_cut);
+    action = gnc_plugin_page_get_action (page, "EditPasteAction");
+    gtk_action_set_sensitive (action, can_paste);
+    gtk_action_set_visible (action,  !hide || can_paste);
+}
+
+
+static gboolean
+gnc_plugin_page_register_finish_pending (GncPluginPage *page)
+{
+    GncPluginPageRegisterPrivate *priv;
+    GncPluginPageRegister *reg_page;
+    SplitRegister *reg;
+    GtkWidget *dialog, *window;
+    const gchar *name;
+    gint response;
+
+    reg_page = GNC_PLUGIN_PAGE_REGISTER(page);
+    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(reg_page);
+    reg = gnc_ledger_display_get_split_register(priv->ledger);
+
+    if (!reg || !gnc_split_register_changed(reg))
+        return TRUE;
+
+    name = gnc_plugin_page_register_get_tab_name(page);
+    window = gnc_plugin_page_get_window(page);
+    dialog = gtk_message_dialog_new(GTK_WINDOW(window),
+                                    GTK_DIALOG_DESTROY_WITH_PARENT,
+                                    GTK_MESSAGE_WARNING,
+                                    GTK_BUTTONS_NONE,
+                                    /* Translators: %s is the name
+                                       of the tab page */
+                                    _("Save changes to %s?"), name);
+    gtk_message_dialog_format_secondary_text
+    (GTK_MESSAGE_DIALOG(dialog),
+     "%s",
+     _("This register has pending changes to a transaction. "
+       "Would you like to save the changes to this transaction, "
+       "discard the transaction, or cancel the operation?"));
+    gnc_gtk_dialog_add_button(dialog, _("_Discard Transaction"),
+                              "edit-delete", GTK_RESPONSE_REJECT);
+    gtk_dialog_add_button(GTK_DIALOG(dialog),
+                          _("_Cancel"), GTK_RESPONSE_CANCEL);
+    gnc_gtk_dialog_add_button(dialog, _("_Save Transaction"),
+                              "document-save", GTK_RESPONSE_ACCEPT);
+
+    response = gtk_dialog_run(GTK_DIALOG(dialog));
+    gtk_widget_destroy(dialog);
+
+    switch (response)
+    {
+    case GTK_RESPONSE_ACCEPT:
+        gnc_split_register_save(reg, TRUE);
+        return TRUE;
+
+    case GTK_RESPONSE_REJECT:
+        gnc_split_register_cancel_cursor_trans_changes(reg);
+        gnc_split_register_save (reg, TRUE);
+        return TRUE;
+
+    default:
+        return FALSE;
+    }
+}
+
+
+static gchar *
+gnc_plugin_page_register_get_tab_name (GncPluginPage *plugin_page)
+{
+    GncPluginPageRegisterPrivate *priv;
+    GNCLedgerDisplayType ledger_type;
+    GNCLedgerDisplay *ld;
+    SplitRegister *reg;
+    Account *leader;
+
+    g_return_val_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (plugin_page), _("unknown"));
+
+    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
+    ld = priv->ledger;
+    reg = gnc_ledger_display_get_split_register (ld);
+    ledger_type = gnc_ledger_display_type (ld);
+    leader = gnc_ledger_display_leader (ld);
+
+    switch (ledger_type)
+    {
+    case LD_SINGLE:
+        return g_strdup(xaccAccountGetName (leader));
+
+    case LD_SUBACCOUNT:
+        return g_strdup_printf("%s+", xaccAccountGetName (leader));
+
+    case LD_GL:
+        switch (reg->type)
+        {
+        case GENERAL_JOURNAL:
+        case INCOME_LEDGER:
+            return g_strdup(_("General Journal"));
+        case PORTFOLIO_LEDGER:
+            return g_strdup(_("Portfolio"));
+        case SEARCH_LEDGER:
+            return g_strdup(_("Search Results"));
+        default:
+            break;
+        }
+        break;
+
+    default:
+        break;
+    }
+
+    return g_strdup(_("unknown"));
+}
+
+static gchar *
+gnc_plugin_page_register_get_tab_color (GncPluginPage *plugin_page)
+{
+    GncPluginPageRegisterPrivate *priv;
+    GNCLedgerDisplayType ledger_type;
+    GNCLedgerDisplay *ld;
+    Account *leader;
+    const char* color;
+
+    g_return_val_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (plugin_page), _("unknown"));
+
+    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
+    ld = priv->ledger;
+    ledger_type = gnc_ledger_display_type (ld);
+    leader = gnc_ledger_display_leader (ld);
+    color = NULL;
+
+    if ((ledger_type == LD_SINGLE) || (ledger_type == LD_SUBACCOUNT))
+        color = xaccAccountGetColor (leader);
+
+    return g_strdup(color ? color : "Not Set");
+}
+
+static gchar *
+gnc_plugin_page_register_get_filter (GncPluginPage *plugin_page)
+{
+    GncPluginPageRegisterPrivate *priv;
+    GNCLedgerDisplayType ledger_type;
+    GNCLedgerDisplay *ld;
+    Account *leader;
+    const char* filter;
+
+    g_return_val_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (plugin_page), _("unknown"));
+
+    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
+    ld = priv->ledger;
+    ledger_type = gnc_ledger_display_type (ld);
+    leader = gnc_ledger_display_leader (ld);
+    filter = NULL;
+
+    if ((ledger_type == LD_SINGLE) || (ledger_type == LD_SUBACCOUNT))
+        filter = xaccAccountGetFilter (leader);
+
+    return filter ? g_strdup(filter) : g_strdup_printf("%s,%s,%s", DEFAULT_FILTER, "0", "0");
+}
+
+void
+gnc_plugin_page_register_set_filter (GncPluginPage *plugin_page, const gchar *filter )
+{
+    GncPluginPageRegisterPrivate *priv;
+    GNCLedgerDisplay *ld;
+    Account *leader;
+    gchar *default_filter;
+
+    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
+    ld = priv->ledger;
+    leader = gnc_ledger_display_leader (ld);
+
+    if (leader != NULL)
+    {
+        default_filter = g_strdup_printf("%s,%s,%s", DEFAULT_FILTER, "0", "0");
+
+        if (!filter || (g_strcmp0 (filter, default_filter) == 0))
+            xaccAccountSetFilter (leader, NULL);
+        else
+            xaccAccountSetFilter (leader, filter);
+
+        g_free (default_filter);
+    }
+
+    return;
+}
+
+static gchar *
+gnc_plugin_page_register_get_sort_order (GncPluginPage *plugin_page)
+{
+    GncPluginPageRegisterPrivate *priv;
+    GNCLedgerDisplayType ledger_type;
+    GNCLedgerDisplay *ld;
+    Account *leader;
+    const char* sort_order;
+
+    g_return_val_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (plugin_page), _("unknown"));
+
+    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
+    ld = priv->ledger;
+    ledger_type = gnc_ledger_display_type (ld);
+    leader = gnc_ledger_display_leader (ld);
+    sort_order = NULL;
+
+    if ((ledger_type == LD_SINGLE) || (ledger_type == LD_SUBACCOUNT))
+        sort_order = xaccAccountGetSortOrder (leader);
+
+    return g_strdup(sort_order ? sort_order : DEFAULT_SORT_ORDER);
+}
+
+void
+gnc_plugin_page_register_set_sort_order (GncPluginPage *plugin_page, const gchar *sort_order )
+{
+    GncPluginPageRegisterPrivate *priv;
+    GNCLedgerDisplay *ld;
+    Account *leader;
+
+    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
+    ld = priv->ledger;
+    leader = gnc_ledger_display_leader (ld);
+
+    if (leader != NULL)
+    {
+        if (!sort_order || (g_strcmp0 (sort_order, DEFAULT_SORT_ORDER) == 0))
+            xaccAccountSetSortOrder (leader, NULL);
+        else
+            xaccAccountSetSortOrder (leader, sort_order);
+    }
+
+    return;
+}
+
+static gboolean
+gnc_plugin_page_register_get_sort_reversed (GncPluginPage *plugin_page)
+{
+    GncPluginPageRegisterPrivate *priv;
+    GNCLedgerDisplayType ledger_type;
+    GNCLedgerDisplay *ld;
+    Account *leader;
+    gboolean sort_reversed = FALSE;
+
+    g_return_val_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (plugin_page), FALSE);
+
+    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
+    ld = priv->ledger;
+    ledger_type = gnc_ledger_display_type (ld);
+    leader = gnc_ledger_display_leader (ld);
+
+    if ((ledger_type == LD_SINGLE) || (ledger_type == LD_SUBACCOUNT))
+        sort_reversed = xaccAccountGetSortReversed (leader);
+
+    return sort_reversed;
+}
+
+void
+gnc_plugin_page_register_set_sort_reversed (GncPluginPage *plugin_page, gboolean reverse_order)
+{
+    GncPluginPageRegisterPrivate *priv;
+    GNCLedgerDisplay *ld;
+    Account *leader;
+
+    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
+    ld = priv->ledger;
+    leader = gnc_ledger_display_leader (ld);
+
+    if (leader != NULL)
+        xaccAccountSetSortReversed (leader, reverse_order);
+
+    return;
+}
+
+static gchar *
+gnc_plugin_page_register_get_long_name (GncPluginPage *plugin_page)
+{
+    GncPluginPageRegisterPrivate *priv;
+    GNCLedgerDisplayType ledger_type;
+    GNCLedgerDisplay *ld;
+    Account *leader;
+
+    g_return_val_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (plugin_page), _("unknown"));
+
+    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
+    ld = priv->ledger;
+    ledger_type = gnc_ledger_display_type (ld);
+    leader = gnc_ledger_display_leader (ld);
+
+    switch (ledger_type)
+    {
+    case LD_SINGLE:
+        return gnc_account_get_full_name (leader);
+
+    case LD_SUBACCOUNT:
+    {
+        gchar *account_full_name = gnc_account_get_full_name (leader);
+        gchar *return_string = g_strdup_printf("%s+", account_full_name);
+        g_free ((gpointer *) account_full_name);
+        return return_string;
+    }
+
+    default:
+        break;
+    }
+
+    return NULL;
+}
+
+static void
+gnc_plugin_page_register_summarybar_position_changed (gpointer prefs, gchar* pref, gpointer user_data)
+{
+    GncPluginPage *plugin_page;
+    GncPluginPageRegister *page;
+    GncPluginPageRegisterPrivate *priv;
+    GtkPositionType position = GTK_POS_BOTTOM;
+
+    g_return_if_fail (user_data != NULL);
+
+    if (!GNC_IS_PLUGIN_PAGE (user_data))
+        return;
+
+    plugin_page = GNC_PLUGIN_PAGE (user_data);
+    page = GNC_PLUGIN_PAGE_REGISTER (user_data);
+    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
+
+    if (priv == NULL)
+       return;
+
+    if (gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL, GNC_PREF_SUMMARYBAR_POSITION_TOP))
+        position = GTK_POS_TOP;
+
+    gtk_box_reorder_child (GTK_BOX (priv->widget),
+                          plugin_page->summarybar,
+                          (position == GTK_POS_TOP ? 0 : -1) );
+}
+
+/** This function is called to get the query associated with this
+ *  plugin page.
+ *
+ *  @param page A pointer to the GncPluginPage.
+ */
+Query *
+gnc_plugin_page_register_get_query (GncPluginPage *plugin_page)
+{
+    GncPluginPageRegister *page;
+    GncPluginPageRegisterPrivate *priv;
+
+    g_return_val_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page), NULL);
+
+    page = GNC_PLUGIN_PAGE_REGISTER (plugin_page);
+    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
+    return gnc_ledger_display_get_query (priv->ledger);
+}
+
+/************************************************************/
+/*                     "Sort By" Dialog                     */
+/************************************************************/
+
+/** This function is called whenever the number source book options is changed
+ *  to adjust the displayed labels. Since the book option change may change the
+ *  query sort, the gnc_split_reg_set_sort_type_force function is called to
+ *  ensure the page is refreshed.
+ *
+ *  @param new_val A pointer to the boolean for the new value of the book option.
+ *
+ *  @param page A pointer to the GncPluginPageRegister that is
+ *  associated with this sort order dialog.
+ */
+static void
+gnc_plugin_page_register_sort_book_option_changed (gpointer new_val,
+                                                    gpointer user_data)
+{
+    GncPluginPageRegisterPrivate *priv;
+    GncPluginPageRegister *page = user_data;
+    gboolean *new_data = (gboolean*)new_val;
+
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
+
+    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
+    if (*new_data)
+    {
+        gtk_button_set_label(GTK_BUTTON (priv->sd.num_radio), _("Transaction Number"));
+        gtk_button_set_label(GTK_BUTTON (priv->sd.act_radio), _("Number/Action"));
+    }
+    else
+    {
+        gtk_button_set_label(GTK_BUTTON (priv->sd.num_radio), _("Number"));
+        gtk_button_set_label(GTK_BUTTON (priv->sd.act_radio), _("Action"));
+    }
+    gnc_split_reg_set_sort_type_force (priv->gsr, priv->gsr->sort_type, TRUE);
+}
+
+/** This function is called when the "Sort By..." dialog is closed.
+ *  If the dialog was closed by any method other than clicking the OK
+ *  button, the original sorting order will be restored.
+ *
+ *  @param dialog A pointer to the dialog box.
+ *
+ *  @param response A numerical value indicating why the dialog box was closed.
+ *
+ *  @param page A pointer to the GncPluginPageRegister associated with
+ *  this dialog box.
+ */
+void
+gnc_plugin_page_register_sort_response_cb (GtkDialog *dialog,
+        gint response,
+        GncPluginPageRegister *page)
+{
+    GncPluginPageRegisterPrivate *priv;
+    GncPluginPage *plugin_page;
+    SortType type;
+    const gchar *order;
+
+    g_return_if_fail(GTK_IS_DIALOG(dialog));
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
+
+    ENTER(" ");
+    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
+    plugin_page = GNC_PLUGIN_PAGE(page);
+
+    if (response != GTK_RESPONSE_OK)
+    {
+        /* Restore the original sort order */
+        gnc_split_reg_set_sort_reversed(priv->gsr, priv->sd.original_reverse_order);
+        priv->sd.reverse_order = priv->sd.original_reverse_order;
+        gnc_split_reg_set_sort_type(priv->gsr, priv->sd.original_sort_type);
+        priv->sd.save_order = priv->sd.original_save_order;
+    }
+    else
+    {
+        priv->sd.original_save_order = priv->sd.save_order;
+
+        if (priv->sd.save_order)
+        {
+            type = gnc_split_reg_get_sort_type(priv->gsr);
+            order = SortTypeasString(type);
+            gnc_plugin_page_register_set_sort_order (plugin_page, order);
+            gnc_plugin_page_register_set_sort_reversed (plugin_page, priv->sd.reverse_order);
+        }
+    }
+    gnc_book_option_remove_cb(OPTION_NAME_NUM_FIELD_SOURCE,
+                                gnc_plugin_page_register_sort_book_option_changed,
+                                page);
+    priv->sd.dialog = NULL;
+    priv->sd.num_radio = NULL;
+    priv->sd.act_radio = NULL;
+    gtk_widget_destroy(GTK_WIDGET(dialog));
+    LEAVE(" ");
+}
+
+
+/** This function is called when a radio button in the "Sort By..."
+ *  dialog is clicked.
+ *
+ *  @param button The button that was toggled.
+ *
+ *  @param page A pointer to the GncPluginPageRegister associated with
+ *  this dialog box.
+ */
+void
+gnc_plugin_page_register_sort_button_cb (GtkToggleButton *button,
+        GncPluginPageRegister *page)
+{
+    GncPluginPageRegisterPrivate *priv;
+    const gchar *name;
+    SortType type;
+
+    g_return_if_fail(GTK_IS_TOGGLE_BUTTON(button));
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
+
+    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
+    name = gtk_buildable_get_name(GTK_BUILDABLE(button));
+    ENTER("button %s(%p), page %p", name, button, page);
+    type = SortTypefromString(name);
+    gnc_split_reg_set_sort_type(priv->gsr, type);
+    LEAVE(" ");
+}
+
+
+/** This function is called whenever the save sort order is checked
+ *  or unchecked which allows saving of the sort order.
+ *
+ *  @param button The toggle button that was changed.
+ *
+ *  @param page A pointer to the GncPluginPageRegister that is
+ *  associated with this sort order dialog.
+ */
+void
+gnc_plugin_page_register_sort_order_save_cb (GtkToggleButton *button,
+        GncPluginPageRegister *page)
+{
+    GncPluginPageRegisterPrivate *priv;
+
+    g_return_if_fail(GTK_IS_CHECK_BUTTON(button));
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
+
+    ENTER("Save toggle button (%p), plugin_page %p", button, page);
+
+    /* Compute the new save sort order */
+    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
+
+    if (gtk_toggle_button_get_active(button))
+        priv->sd.save_order = TRUE;
+    else
+        priv->sd.save_order = FALSE;
+    LEAVE(" ");
+}
+
+/** This function is called whenever the reverse sort order is checked
+ *  or unchecked which allows reversing of the sort order.
+ *
+ *  @param button The toggle button that was changed.
+ *
+ *  @param page A pointer to the GncPluginPageRegister that is
+ *  associated with this sort order dialog.
+ */
+void
+gnc_plugin_page_register_sort_order_reverse_cb (GtkToggleButton *button,
+        GncPluginPageRegister *page)
+
+{
+    GncPluginPageRegisterPrivate *priv;
+
+    g_return_if_fail(GTK_IS_CHECK_BUTTON(button));
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
+
+    ENTER("Reverse toggle button (%p), plugin_page %p", button, page);
+
+    /* Compute the new save sort order */
+    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
+
+    priv->sd.reverse_order = gtk_toggle_button_get_active(button);
+    gnc_split_reg_set_sort_reversed(priv->gsr, priv->sd.reverse_order);
+    LEAVE(" ");
+}
+
+/************************************************************/
+/*                    "Filter By" Dialog                    */
+/************************************************************/
+
+/** This function updates the "cleared match" term of the register
+ *  query.  It unconditionally removes any old "cleared match" query
+ *  term, then adds back a new query term if needed.  There seems to
+ *  be a bug in the current g2 register code such that when the number
+ *  of entries in the register doesn't fill up the window, the blank
+ *  space at the end of the window isn't correctly redrawn.  This
+ *  function works around that problem, but a root cause analysis
+ *  should probably be done.
+ *
+ *  @param page A pointer to the GncPluginPageRegister that is
+ *  associated with this filter dialog.
+ */
+static void
+gnc_ppr_update_status_query (GncPluginPageRegister *page)
+{
+    GncPluginPageRegisterPrivate *priv;
+    GSList *param_list;
+    Query *query;
+
+    ENTER(" ");
+    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
+    query = gnc_ledger_display_get_query( priv->ledger );
+    if (!query)
+    {
+        LEAVE("no query found");
+        return;
+    }
+
+    /* Remove the old status match */
+    param_list = qof_query_build_param_list (SPLIT_RECONCILE, NULL);
+    if (param_list)
+    {
+        qof_query_purge_terms (query, param_list);
+        g_slist_free(param_list);
+    }
+
+    /* Install the new status match */
+    if (priv->fd.cleared_match != CLEARED_ALL)
+        xaccQueryAddClearedMatch(query, priv->fd.cleared_match, QOF_QUERY_AND);
+
+    gnc_ledger_display_refresh (priv->ledger);
+    LEAVE(" ");
+}
+
+
+/** This function updates the "date posted" term of the register
+ *  query.  It unconditionally removes any old "date posted" query
+ *  term, then adds back a new query term if needed.  There seems to
+ *  be a bug in the current g2 register code such that when the number
+ *  of entries in the register doesn't fill up the window, the blank
+ *  space at the end of the window isn't correctly redrawn.  This
+ *  function works around that problem, but a root cause analysis
+ *  should probably be done.
+ *
+ *  @param page A pointer to the GncPluginPageRegister that is
+ *  associated with this filter dialog.
+ */
+static void
+gnc_ppr_update_date_query (GncPluginPageRegister *page)
+{
+    GncPluginPageRegisterPrivate *priv;
+    GSList *param_list;
+    Query *query;
+
+    ENTER(" ");
+    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
+    if (!priv->ledger)
+    {
+        LEAVE("no ledger");
+        return;
+    }
+
+    query = gnc_ledger_display_get_query( priv->ledger );
+    if (!query)
+    {
+        LEAVE("no query");
+        return;
+    }
+
+    /* Delete any existing old date spec. */
+    param_list = qof_query_build_param_list(SPLIT_TRANS, TRANS_DATE_POSTED, NULL);
+    if (param_list)
+    {
+        qof_query_purge_terms (query, param_list);
+        g_slist_free(param_list);
+    }
+
+    if (priv->fd.start_time || priv->fd.end_time)
+    {
+        /* Build a new spec */
+        xaccQueryAddDateMatchTT(query,
+                                priv->fd.start_time != 0, priv->fd.start_time,
+                                priv->fd.end_time != 0,   priv->fd.end_time,
+                                QOF_QUERY_AND);
+    }
+
+    gnc_ledger_display_refresh (priv->ledger);
+    LEAVE(" ");
+}
+
+
+/* This function converts a time64 value date to a string */
+static gchar *
+gnc_plugin_page_register_filter_time2dmy ( time64 raw_time)
+{
+    struct tm * timeinfo;
+    gchar date_string[11];
+
+    timeinfo = gnc_localtime (&raw_time);
+    strftime (date_string, 11, "%d-%m-%Y", timeinfo);
+    PINFO("Date string is %s", date_string);
+    gnc_tm_free (timeinfo);
+
+    return g_strdup(date_string);
+}
+
+
+/* This function converts a string date to a time64 value */
+static time64
+gnc_plugin_page_register_filter_dmy2time (char *date_string)
+{
+    struct tm when;
+
+    PINFO("Date string is %s", date_string);
+    memset (&when, 0, sizeof (when));
+
+    sscanf (date_string, "%d-%d-%d", &when.tm_mday,
+	    &when.tm_mon, &when.tm_year);
+
+    when.tm_mon -= 1;
+    when.tm_year -= 1900;
+
+    return gnc_mktime (&when);
+}
+
+
+/** This function is called whenever one of the status entries is
+ *  checked or unchecked.  It updates the status value maintained for
+ *  the filter dialog, and calls another function to do the work of
+ *  applying the change to the register itself.
+ *
+ *  @param button The toggle button that was changed.
+ *
+ *  @param page A pointer to the GncPluginPageRegister that is
+ *  associated with this filter dialog.
+ */
+void
+gnc_plugin_page_register_filter_status_one_cb (GtkToggleButton *button,
+        GncPluginPageRegister *page)
+{
+    GncPluginPageRegisterPrivate *priv;
+    const gchar *name;
+    gint i, value;
+
+    g_return_if_fail(GTK_IS_CHECK_BUTTON(button));
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
+
+    name = gtk_buildable_get_name(GTK_BUILDABLE(button));
+    ENTER("toggle button %s (%p), plugin_page %p", name, button, page);
+
+    /* Determine what status bit to change */
+    value = CLEARED_NONE;
+    for (i = 0; status_actions[i].action_name; i++)
+    {
+        if (g_strcmp0(name, status_actions[i].action_name) == 0)
+        {
+            value = status_actions[i].value;
+            break;
+        }
+    }
+
+    /* Compute the new match status */
+    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
+    if (gtk_toggle_button_get_active(button))
+        priv->fd.cleared_match |= value;
+    else
+        priv->fd.cleared_match &= ~value;
+    gnc_ppr_update_status_query(page);
+    LEAVE(" ");
+}
+
+
+/** This function is called whenever the "select all" status button is
+ *  clicked.  It updates all of the checkbox widgets, then updates the
+ *  query on the register.
+ *
+ *  @param button The button that was clicked.
+ *
+ *  @param page A pointer to the GncPluginPageRegister that is
+ *  associated with this filter dialog.
+ */
+void
+gnc_plugin_page_register_filter_status_all_cb (GtkButton *button,
+        GncPluginPageRegister *page)
+{
+    GncPluginPageRegisterPrivate *priv;
+    GtkWidget *widget;
+    gint i;
+
+    g_return_if_fail(GTK_IS_BUTTON(button));
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
+
+    ENTER("(button %p, page %p)", button, page);
+
+    /* Turn on all the check menu items */
+    for (i = 0; status_actions[i].action_name; i++)
+    {
+        widget = status_actions[i].widget;
+        g_signal_handlers_block_by_func(widget, gnc_plugin_page_register_filter_status_one_cb, page);
+        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(widget), TRUE);
+        g_signal_handlers_unblock_by_func(widget, gnc_plugin_page_register_filter_status_one_cb, page);
+    }
+
+    /* Set the requested status */
+    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
+    priv->fd.cleared_match = CLEARED_ALL;
+    gnc_ppr_update_status_query(page);
+    LEAVE(" ");
+}
+
+
+/** This function computes the starting and ending times for the
+ *  filter by examining the dialog widgets to see which ones are
+ *  selected, and will pull times out of the data entry boxes if
+ *  necessary.  This function must exist to handle the case where the
+ *  "show all" button was Selected, and the user clicks on the "select
+ *  range" button.  Since it exists, it make sense for the rest of the
+ *  callbacks to take advantage of it.
+ *
+ *  @param page A pointer to the GncPluginPageRegister that is
+ *  associated with this filter dialog.
+ */
+static void
+get_filter_times(GncPluginPageRegister *page)
+{
+    GncPluginPageRegisterPrivate *priv;
+    time64 time_val;
+
+    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
+    if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->fd.start_date_choose)))
+    {
+        time_val = gnc_date_edit_get_date(GNC_DATE_EDIT(priv->fd.start_date));
+        time_val = gnc_time64_get_day_start(time_val);
+        priv->fd.start_time = time_val;
+    }
+    else
+    {
+        if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->fd.start_date_today)))
+        {
+            priv->fd.start_time = gnc_time64_get_today_start();
+        }
+        else
+        {
+            priv->fd.start_time = 0;
+        }
+    }
+
+    if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->fd.end_date_choose)))
+    {
+        time_val = gnc_date_edit_get_date(GNC_DATE_EDIT(priv->fd.end_date));
+        time_val = gnc_time64_get_day_end(time_val);
+        priv->fd.end_time = time_val;
+    }
+    else
+    {
+        if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->fd.start_date_today)))
+        {
+            priv->fd.end_time = gnc_time64_get_today_end();
+        }
+        else
+        {
+            priv->fd.end_time = 0;
+        }
+    }
+}
+
+
+/** This function is called when the "select range" radio button
+ *  changes state.  Since there are only two choices in this radio
+ *  group, this one signal can be used to handle all cases.  This
+ *  function is responsible for setting the sensitivity of the table
+ *  of widgets underneath the "select range" choice, and updating the
+ *  time limitation on the register query.  This is handled by a
+ *  helper function when the radio button is selected (as potentially
+ *  all the widgets in the table need to be inspected), and is trivial
+ *  for the other case.
+ *
+ *  @param button A pointer to the "select range" radio button.
+ *
+ *  @param page A pointer to the GncPluginPageRegister that is
+ *  associated with this filter dialog.
+ */
+void
+gnc_plugin_page_register_filter_select_range_cb (GtkRadioButton *button,
+        GncPluginPageRegister *page)
+{
+    GncPluginPageRegisterPrivate *priv;
+    gboolean active;
+
+    g_return_if_fail(GTK_IS_RADIO_BUTTON(button));
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
+
+    ENTER("(button %p, page %p)", button, page);
+    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
+    active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button));
+    gtk_widget_set_sensitive(priv->fd.table, active);
+    if (active)
+    {
+        get_filter_times(page);
+    }
+    else
+    {
+        priv->fd.start_time = 0;
+        priv->fd.end_time = 0;
+    }
+    gnc_ppr_update_date_query(page);
+    LEAVE(" ");
+}
+
+
+/** This function is called when one of the start date entry widgets
+ *  is updated.  It simply calls common routines to determine the
+ *  start/end times and update the register query.
+ *
+ *  @param unused A pointer to a GncDateEntry widgets, but it could be
+ *  any widget.
+ *
+ *  @param page A pointer to the GncPluginPageRegister that is
+ *  associated with this filter dialog.
+ */
+static void
+gnc_plugin_page_register_filter_gde_changed_cb (GtkWidget *unused,
+        GncPluginPageRegister *page)
+{
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
+
+    ENTER("(widget %s(%p), page %p)", gtk_buildable_get_name(GTK_BUILDABLE(unused)), unused, page);
+    get_filter_times(page);
+    gnc_ppr_update_date_query(page);
+    LEAVE(" ");
+}
+
+
+/** This function is called when one of the start date radio buttons
+ *  is selected.  It updates the sensitivity of the date entry widget,
+ *  then calls a common routine to determine the start/end times and
+ *  update the register query.
+ *
+ *  *Note: This function is actually called twice for each new radio
+ *  button selection.  The first time call is to uncheck the old
+ *  button, and the second time to check the new button.  This does
+ *  make a kind of sense, as radio buttons are nothing more than
+ *  linked toggle buttons where only one can be active.
+ *
+ *  @param radio The button whose state is changing.  This will be
+ *  the previously selected button the first of the pair of calls to
+ *  this function, and will be the newly selected button the second
+ *  time.
+ *
+ *  @param page A pointer to the GncPluginPageRegister that is
+ *  associated with this filter dialog.
+ */
+void
+gnc_plugin_page_register_filter_start_cb (GtkWidget *radio,
+        GncPluginPageRegister *page)
+{
+    GncPluginPageRegisterPrivate *priv;
+    const gchar *name;
+    gboolean active;
+
+    g_return_if_fail(GTK_IS_RADIO_BUTTON(radio));
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
+
+    ENTER("(radio %s(%p), page %p)", gtk_buildable_get_name(GTK_BUILDABLE(radio)), radio, page);
+    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
+    if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(radio)))
+    {
+        LEAVE("1st callback of pair. Defer to 2nd callback.");
+        return;
+    }
+
+    name = gtk_buildable_get_name(GTK_BUILDABLE(radio));
+    active = ( g_strcmp0(name, g_strdup("start_date_choose")) == 0 ? 1 : 0 );
+    gtk_widget_set_sensitive(priv->fd.start_date, active);
+    get_filter_times(page);
+    gnc_ppr_update_date_query(page);
+    LEAVE(" ");
+}
+
+
+/** This function is called when one of the end date radio buttons is
+ *  selected.  It updates the sensitivity of the date entry widget,
+ *  then calls a common routine to determine the start/end times and
+ *  update the register query.
+ *
+ *  *Note: This function is actually called twice for each new radio
+ *  button selection.  The first time call is to uncheck the old
+ *  button, and the second time to check the new button.  This does
+ *  make a kind of sense, as radio buttons are nothing more than
+ *  linked toggle buttons where only one can be active.
+ *
+ *  @param radio The button whose state is changing.  This will be
+ *  the previously selected button the first of the pair of calls to
+ *  this function, and will be the newly selected button the second
+ *  time.
+ *
+ *  @param page A pointer to the GncPluginPageRegister that is
+ *  associated with this filter dialog.
+ */
+void
+gnc_plugin_page_register_filter_end_cb (GtkWidget *radio,
+                                        GncPluginPageRegister *page)
+{
+    GncPluginPageRegisterPrivate *priv;
+    const gchar *name;
+    gboolean active;
+
+    g_return_if_fail(GTK_IS_RADIO_BUTTON(radio));
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
+
+    ENTER("(radio %s(%p), page %p)", gtk_buildable_get_name(GTK_BUILDABLE(radio)), radio, page);
+    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
+    if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(radio)))
+    {
+        LEAVE("1st callback of pair. Defer to 2nd callback.");
+        return;
+    }
+
+    name = gtk_buildable_get_name(GTK_BUILDABLE(radio));
+    active = ( g_strcmp0(name, g_strdup("end_date_choose")) == 0 ? 1 : 0 );
+    gtk_widget_set_sensitive(priv->fd.end_date, active);
+    get_filter_times(page);
+    gnc_ppr_update_date_query(page);
+    LEAVE(" ");
+}
+
+
+/** This function is called whenever the save status is checked
+ *  or unchecked. It will allow saving of the filter if required.
+ *
+ *  @param button The toggle button that was changed.
+ *
+ *  @param page A pointer to the GncPluginPageRegister that is
+ *  associated with this filter dialog.
+ */
+void
+gnc_plugin_page_register_filter_save_cb (GtkToggleButton *button,
+        GncPluginPageRegister *page)
+{
+    GncPluginPageRegisterPrivate *priv;
+
+    g_return_if_fail(GTK_IS_CHECK_BUTTON(button));
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
+
+    ENTER("Save toggle button (%p), plugin_page %p", button, page);
+
+    /* Compute the new save filter status */
+    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
+    if (gtk_toggle_button_get_active(button))
+        priv->fd.save_filter = TRUE;
+    else
+        priv->fd.save_filter = FALSE;
+    LEAVE(" ");
+}
+
+
+/** This function is called when the "Filter By..." dialog is closed.
+ *  If the dialog was closed by any method other than clicking the OK
+ *  button, the original sorting order will be restored.
+ *
+ *  @param dialog A pointer to the dialog box.
+ *
+ *  @param response A numerical value indicating why the dialog box was closed.
+ *
+ *  @param page A pointer to the GncPluginPageRegister associated with
+ *  this dialog box.
+ */
+void
+gnc_plugin_page_register_filter_response_cb (GtkDialog *dialog,
+        gint response,
+        GncPluginPageRegister *page)
+{
+    GncPluginPageRegisterPrivate *priv;
+    GncPluginPage *plugin_page;
+
+    g_return_if_fail(GTK_IS_DIALOG(dialog));
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
+
+    ENTER(" ");
+    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
+    plugin_page = GNC_PLUGIN_PAGE(page);
+
+    if (response != GTK_RESPONSE_OK)
+    {
+        /* Remove the old status match */
+        priv->fd.cleared_match = priv->fd.original_cleared_match;
+        gnc_ppr_update_status_query(page);
+        priv->fd.start_time = priv->fd.original_start_time;
+        priv->fd.end_time = priv->fd.original_end_time;
+        priv->fd.save_filter = priv->fd.original_save_filter;
+        gnc_ppr_update_date_query(page);
+    }
+    else
+    {
+        priv->fd.original_save_filter = priv->fd.save_filter;
+
+        if (priv->fd.save_filter)
+        {
+            gchar* filter;
+            filter = g_strdup_printf("0x%04x", priv->fd.cleared_match);
+
+            if ( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->fd.start_date_choose)) && priv->fd.start_time != 0 )
+            {
+                gchar *timeval = gnc_plugin_page_register_filter_time2dmy(priv->fd.start_time);
+                filter = g_strconcat ( filter, ",", timeval, NULL);
+                g_free (timeval);
+            }
+            else
+                filter = g_strconcat ( filter, ",0", NULL);
+
+            if ( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->fd.end_date_choose)) && priv->fd.end_time != 0 )
+            {
+                gchar *timeval = gnc_plugin_page_register_filter_time2dmy(priv->fd.end_time);
+                filter = g_strconcat ( filter, ",", timeval, NULL);
+                g_free (timeval);
+            }
+            else
+                filter = g_strconcat ( filter, ",0", NULL);
+
+            PINFO("The filter to save is %s", filter);
+
+            gnc_plugin_page_register_set_filter (plugin_page, filter);
+            g_free (filter);
+        }
+    }
+    priv->fd.dialog = NULL;
+    gtk_widget_destroy(GTK_WIDGET(dialog));
+    LEAVE(" ");
+}
+
+
+/************************************************************/
+/*                  Report Helper Functions                 */
+/************************************************************/
+
+static char *
+gnc_reg_get_name (GNCLedgerDisplay *ledger, gboolean for_window)
+{
+    Account *leader;
+    SplitRegister *reg;
+    gchar *account_name;
+    gchar *reg_name;
+    gchar *name;
+    GNCLedgerDisplayType ledger_type;
+
+    if (ledger == NULL)
+        return NULL;
+
+    reg = gnc_ledger_display_get_split_register (ledger);
+    ledger_type = gnc_ledger_display_type (ledger);
+
+    switch (reg->type)
+    {
+    case GENERAL_JOURNAL:
+    case INCOME_LEDGER:
+        if (for_window)
+            reg_name = _("General Journal");
+        else
+            reg_name = _("Transaction Report");
+        break;
+    case PORTFOLIO_LEDGER:
+        if (for_window)
+            reg_name = _("Portfolio");
+        else
+            reg_name = _("Portfolio Report");
+        break;
+    case SEARCH_LEDGER:
+        if (for_window)
+            reg_name = _("Search Results");
+        else
+            reg_name = _("Search Results Report");
+        break;
+    default:
+        if (for_window)
+            reg_name = _("Register");
+        else
+            reg_name = _("Transaction Report");
+        break;
+    }
+
+    leader = gnc_ledger_display_leader (ledger);
+
+    if ((leader != NULL) && (ledger_type != LD_GL))
+    {
+        account_name = gnc_account_get_full_name (leader);
+
+        if (ledger_type == LD_SINGLE)
+        {
+            name = g_strconcat (account_name, " - ", reg_name, NULL);
+        }
+        else
+        {
+            name = g_strconcat (account_name, " ", _("and subaccounts"), " - ", reg_name, NULL);
+        }
+        g_free(account_name);
+    }
+    else
+        name = g_strdup (reg_name);
+
+    return name;
+}
+
+static int
+report_helper (GNCLedgerDisplay *ledger, Split *split, Query *query)
+{
+    SplitRegister *reg = gnc_ledger_display_get_split_register (ledger);
+    Account *account;
+    char *str;
+    const char *tmp;
+    swig_type_info * qtype;
+    SCM args;
+    SCM func;
+    SCM arg;
+
+    args = SCM_EOL;
+
+    func = scm_c_eval_string ("gnc:register-report-create");
+    g_return_val_if_fail (scm_is_procedure (func), -1);
+
+    tmp = gnc_split_register_get_credit_string (reg);
+    arg = scm_from_utf8_string (tmp ? tmp : _("Credit"));
+    args = scm_cons (arg, args);
+
+    tmp = gnc_split_register_get_debit_string (reg);
+    arg = scm_from_utf8_string (tmp ? tmp : _("Debit"));
+    args = scm_cons (arg, args);
+
+    str = gnc_reg_get_name (ledger, FALSE);
+    arg = scm_from_utf8_string (str ? str : "");
+    args = scm_cons (arg, args);
+    g_free (str);
+
+    arg = SCM_BOOL (reg->use_double_line);
+    args = scm_cons (arg, args);
+
+    arg = SCM_BOOL (reg->type == GENERAL_JOURNAL || reg->type == INCOME_LEDGER
+                                                || reg->type == SEARCH_LEDGER);
+    args = scm_cons (arg, args);
+
+    arg = SCM_BOOL (reg->style == REG_STYLE_JOURNAL);
+    args = scm_cons (arg, args);
+
+    if (!query)
+    {
+        query = gnc_ledger_display_get_query (ledger);
+        g_return_val_if_fail (query != NULL, -1);
+    }
+
+    qtype = SWIG_TypeQuery ("_p__QofQuery");
+    g_return_val_if_fail (qtype, -1);
+
+    arg = SWIG_NewPointerObj (query, qtype, 0);
+    args = scm_cons (arg, args);
+    g_return_val_if_fail (arg != SCM_UNDEFINED, -1);
+
+
+    if (split)
+    {
+        qtype = SWIG_TypeQuery ("_p_Split");
+        g_return_val_if_fail (qtype, -1);
+        arg = SWIG_NewPointerObj (split, qtype, 0);
+    }
+    else
+    {
+        arg = SCM_BOOL_F;
+    }
+    args = scm_cons (arg, args);
+    g_return_val_if_fail (arg != SCM_UNDEFINED, -1);
+
+
+    qtype = SWIG_TypeQuery ("_p_Account");
+    g_return_val_if_fail (qtype, -1);
+
+    account = gnc_ledger_display_leader (ledger);
+    arg = SWIG_NewPointerObj (account, qtype, 0);
+    args = scm_cons (arg, args);
+    g_return_val_if_fail (arg != SCM_UNDEFINED, -1);
+
+
+    /* Apply the function to the args */
+    arg = scm_apply (func, args, SCM_EOL);
+    g_return_val_if_fail (scm_is_exact (arg), -1);
+
+    return scm_to_int (arg);
+}
+
+/************************************************************/
+/*                     Command callbacks                    */
+/************************************************************/
+
+static void
+gnc_plugin_page_register_cmd_print_check (GtkAction *action,
+        GncPluginPageRegister *plugin_page)
+{
+    GncPluginPageRegisterPrivate *priv;
+    SplitRegister * reg;
+    Split         * split;
+    Transaction   * trans;
+    GList         * splits = NULL, *item;
+    GNCLedgerDisplayType ledger_type;
+    Account       * account;
+    GtkWidget     * window;
+
+    ENTER("(action %p, plugin_page %p)", action, plugin_page);
+
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page));
+
+    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
+    reg = gnc_ledger_display_get_split_register (priv->ledger);
+    ledger_type = gnc_ledger_display_type(priv->ledger);
+    window = gnc_plugin_page_get_window(GNC_PLUGIN_PAGE(plugin_page));
+    if (ledger_type == LD_SINGLE || ledger_type == LD_SUBACCOUNT)
+    {
+        account  = gnc_plugin_page_register_get_account (plugin_page);
+        split    = gnc_split_register_get_current_split(reg);
+        trans    = xaccSplitGetParent(split);
+
+        if (split && trans)
+        {
+            if (xaccSplitGetAccount(split) == account)
+            {
+                splits = g_list_append(splits, split);
+                gnc_ui_print_check_dialog_create(window, splits);
+                g_list_free(splits);
+            }
+            else
+            {
+                /* This split is not for the account shown in this register.  Get the
+                   split that anchors the transaction to the registor */
+                split = gnc_split_register_get_current_trans_split(reg, NULL);
+                if (split)
+                {
+                    splits = g_list_append(splits, split);
+                    gnc_ui_print_check_dialog_create(window, splits);
+                    g_list_free(splits);
+                }
+            }
+        }
+    }
+    else if (ledger_type == LD_GL && reg->type == SEARCH_LEDGER)
+    {
+        Account *common_acct = NULL;
+        splits = qof_query_run(gnc_ledger_display_get_query(priv->ledger));
+        /* Make sure each split is from the same account */
+        for (item = splits; item; item = g_list_next(item))
+        {
+            split = (Split *) item->data;
+            if (common_acct == NULL)
+            {
+                common_acct = xaccSplitGetAccount(split);
+            }
+            else
+            {
+                if (xaccSplitGetAccount(split) != common_acct)
+                {
+                    GtkWidget *dialog;
+                    gint response;
+                    const gchar *title = _("Print checks from multiple accounts?");
+                    const gchar *message =
+                        _("This search result contains splits from more than one account. "
+                          "Do you want to print the checks even though they are not all "
+                          "from the same account?");
+                    dialog = gtk_message_dialog_new(GTK_WINDOW(window),
+                                                    GTK_DIALOG_DESTROY_WITH_PARENT,
+                                                    GTK_MESSAGE_WARNING,
+                                                    GTK_BUTTONS_CANCEL,
+                                                    "%s", title);
+                    gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
+                            "%s", message);
+                    gtk_dialog_add_button(GTK_DIALOG(dialog), _("_Print checks"),
+                                          GTK_RESPONSE_YES);
+                    response = gnc_dialog_run(GTK_DIALOG(dialog),
+                                              GNC_PREF_WARN_CHECKPRINTING_MULTI_ACCT);
+                    gtk_widget_destroy(dialog);
+                    if (response != GTK_RESPONSE_YES)
+                    {
+                        LEAVE("Multiple accounts");
+                        return;
+                    }
+                    break;
+                }
+            }
+        }
+        gnc_ui_print_check_dialog_create(window, splits);
+    }
+    else
+    {
+        gnc_error_dialog(window, "%s",
+                         _("You can only print checks from a bank account register or search results."));
+        LEAVE("Unsupported ledger type");
+        return;
+    }
+    LEAVE(" ");
+}
+
+
+static void
+gnc_plugin_page_register_cmd_cut (GtkAction *action,
+                                  GncPluginPageRegister *page)
+{
+    GncPluginPageRegisterPrivate *priv;
+
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
+
+    ENTER("(action %p, page %p)", action, page);
+    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
+    gnucash_register_cut_clipboard(priv->gsr->reg);
+    LEAVE("");
+}
+
+
+static void
+gnc_plugin_page_register_cmd_copy (GtkAction *action,
+                                   GncPluginPageRegister *page)
+{
+    GncPluginPageRegisterPrivate *priv;
+
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
+
+    ENTER("(action %p, page %p)", action, page);
+    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
+    gnucash_register_copy_clipboard(priv->gsr->reg);
+    LEAVE("");
+}
+
+
+static void
+gnc_plugin_page_register_cmd_paste (GtkAction *action,
+                                    GncPluginPageRegister *page)
+{
+    GncPluginPageRegisterPrivate *priv;
+
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
+
+    ENTER("(action %p, page %p)", action, page);
+    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
+    gnucash_register_paste_clipboard(priv->gsr->reg);
+    LEAVE("");
+}
+
+
+static void
+gnc_plugin_page_register_cmd_edit_account (GtkAction *action,
+        GncPluginPageRegister *page)
+{
+    Account *account;
+
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
+
+    ENTER("(action %p, page %p)", action, page);
+    account = gnc_plugin_page_register_get_account (page);
+    if (account)
+        gnc_ui_edit_account_window (account);
+    LEAVE(" ");
+}
+
+
+static void
+gnc_plugin_page_register_cmd_find_account (GtkAction *action,
+        GncPluginPageRegister *page)
+{
+    GtkWidget *window;
+
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
+
+    window = gnc_plugin_page_get_window (GNC_PLUGIN_PAGE(page));
+
+    gnc_find_account_dialog (window, NULL);
+}
+
+
+
+static void
+gnc_plugin_page_register_cmd_find_transactions (GtkAction *action,
+        GncPluginPageRegister *page)
+{
+    GncPluginPageRegisterPrivate *priv;
+
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
+
+    ENTER("(action %p, page %p)", action, page);
+    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
+    gnc_ui_find_transactions_dialog_create(priv->ledger);
+    LEAVE(" ");
+}
+
+
+static void
+gnc_plugin_page_register_cmd_cut_transaction (GtkAction *action,
+        GncPluginPageRegister *page)
+{
+    GncPluginPageRegisterPrivate *priv;
+    SplitRegister *reg;
+
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
+
+    ENTER("(action %p, page %p)", action, page);
+    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
+    reg = gnc_ledger_display_get_split_register(priv->ledger);
+    gnc_split_register_cut_current(reg);
+    LEAVE(" ");
+}
+
+
+static void
+gnc_plugin_page_register_cmd_copy_transaction (GtkAction *action,
+        GncPluginPageRegister *page)
+{
+    GncPluginPageRegisterPrivate *priv;
+    SplitRegister *reg;
+
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
+
+    ENTER("(action %p, page %p)", action, page);
+    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
+    reg = gnc_ledger_display_get_split_register(priv->ledger);
+    gnc_split_register_copy_current(reg);
+    LEAVE(" ");
+}
+
+
+static void
+gnc_plugin_page_register_cmd_paste_transaction (GtkAction *action,
+        GncPluginPageRegister *page)
+{
+    GncPluginPageRegisterPrivate *priv;
+    SplitRegister *reg;
+
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
+
+    ENTER("(action %p, page %p)", action, page);
+    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
+    reg = gnc_ledger_display_get_split_register(priv->ledger);
+    gnc_split_register_paste_current(reg);
+    LEAVE(" ");
+}
+
+
+static void
+gnc_plugin_page_register_cmd_void_transaction (GtkAction *action,
+        GncPluginPageRegister *page)
+{
+    GncPluginPageRegisterPrivate *priv;
+    GtkWidget *dialog, *entry;
+    SplitRegister *reg;
+    Transaction *trans;
+    GtkBuilder *builder;
+    const char *reason;
+    gint result;
+
+    ENTER("(action %p, page %p)", action, page);
+
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
+
+    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
+    reg = gnc_ledger_display_get_split_register(priv->ledger);
+    trans = gnc_split_register_get_current_trans(reg);
+    if (trans == NULL)
+        return;
+    if (xaccTransHasSplitsInState(trans, VREC))
+        return;
+    if (xaccTransHasReconciledSplits(trans) || xaccTransHasSplitsInState(trans, CREC))
+    {
+        gnc_error_dialog(NULL, "%s", _("You cannot void a transaction with reconciled or cleared splits."));
+        return;
+    }
+    reason = xaccTransGetReadOnly (trans);
+    if (reason)
+    {
+        gnc_error_dialog(NULL, _("This transaction is marked read-only with the comment: '%s'"), reason);
+        return;
+    }
+
+    if (!gnc_plugin_page_register_finish_pending(GNC_PLUGIN_PAGE(page)))
+        return;
+
+    builder = gtk_builder_new();
+    gnc_builder_add_from_file  (builder , "gnc-plugin-page-register.glade", "void_transaction_dialog");
+    dialog = GTK_WIDGET(gtk_builder_get_object (builder, "void_transaction_dialog"));
+    entry = GTK_WIDGET(gtk_builder_get_object (builder, "reason"));
+
+    result = gtk_dialog_run(GTK_DIALOG(dialog));
+    if (result == GTK_RESPONSE_OK)
+    {
+        reason = gtk_entry_get_text(GTK_ENTRY(entry));
+        if (reason == NULL)
+            reason = "";
+        gnc_split_register_void_current_trans(reg, reason);
+    }
+
+    /* All done. Get rid of it. */
+    gtk_widget_destroy(dialog);
+    g_object_unref(G_OBJECT(builder));
+}
+
+
+static void
+gnc_plugin_page_register_cmd_unvoid_transaction (GtkAction *action,
+        GncPluginPageRegister *page)
+{
+    GncPluginPageRegisterPrivate *priv;
+    SplitRegister *reg;
+    Transaction *trans;
+
+    ENTER("(action %p, page %p)", action, page);
+
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
+
+    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
+    reg = gnc_ledger_display_get_split_register(priv->ledger);
+    trans = gnc_split_register_get_current_trans(reg);
+    if (!xaccTransHasSplitsInState(trans, VREC))
+        return;
+    gnc_split_register_unvoid_current_trans(reg);
+    LEAVE(" ");
+}
+
+
+static void
+gnc_plugin_page_register_cmd_reverse_transaction (GtkAction *action,
+        GncPluginPageRegister *page)
+{
+    GncPluginPageRegisterPrivate *priv;
+    SplitRegister *reg;
+    GNCSplitReg *gsr;
+    Transaction *trans, *new_trans;
+
+    ENTER("(action %p, page %p)", action, page);
+
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
+
+    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
+    reg = gnc_ledger_display_get_split_register(priv->ledger);
+    trans = gnc_split_register_get_current_trans(reg);
+    if (trans == NULL)
+        return;
+
+    if (xaccTransGetReversedBy(trans))
+    {
+        gnc_error_dialog(gnc_plugin_page_get_window(GNC_PLUGIN_PAGE(page)), "%s",
+                         _("A reversing entry has already been created for this transaction."));
+        return;
+    }
+
+    qof_event_suspend();
+    new_trans = xaccTransReverse(trans);
+
+    /* Clear transaction level info */
+    xaccTransSetDatePostedSecsNormalized (new_trans, gnc_time (NULL));
+    xaccTransSetDateEnteredSecs (new_trans, gnc_time (NULL));
+
+    qof_event_resume();
+
+    /* Now jump to new trans */
+    gsr = gnc_plugin_page_register_get_gsr(GNC_PLUGIN_PAGE(page));
+    gnc_split_reg_jump_to_split(gsr, xaccTransGetSplit(new_trans, 0));
+    LEAVE(" ");
+}
+
+static void
+gnc_plugin_page_register_cmd_view_sort_by (GtkAction *action,
+        GncPluginPageRegister *page)
+{
+    GncPluginPageRegisterPrivate *priv;
+    SplitRegister *reg;
+    GtkWidget *dialog, *button;
+    GtkBuilder *builder;
+    SortType sort;
+    const gchar *name;
+    gchar *title;
+
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
+    ENTER("(action %p, page %p)", action, page);
+
+    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
+    if (priv->sd.dialog)
+    {
+        gtk_window_present(GTK_WINDOW(priv->sd.dialog));
+        LEAVE("existing dialog");
+        return;
+    }
+
+    /* Create the dialog */
+
+    builder = gtk_builder_new();
+    gnc_builder_add_from_file  (builder, "gnc-plugin-page-register.glade", "sort_by_dialog");
+    dialog = GTK_WIDGET(gtk_builder_get_object (builder, "sort_by_dialog"));
+    priv->sd.dialog = dialog;
+    gtk_window_set_transient_for(GTK_WINDOW(dialog),
+                                 gnc_window_get_gtk_window(GNC_WINDOW(GNC_PLUGIN_PAGE(page)->window)));
+    /* Translations: The %s is the name of the plugin page */
+    title = g_strdup_printf(_("Sort %s by..."),
+                            gnc_plugin_page_get_page_name(GNC_PLUGIN_PAGE(page)));
+    gtk_window_set_title(GTK_WINDOW(dialog), title);
+    g_free(title);
+
+    /* Set the button for the current sort order */
+    sort = gnc_split_reg_get_sort_type(priv->gsr);
+    name = SortTypeasString(sort);
+    button = GTK_WIDGET(gtk_builder_get_object (builder, name));
+    DEBUG("current sort %d, button %s(%p)", sort, name, button);
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE);
+    priv->sd.original_sort_type = sort;
+
+    button = GTK_WIDGET(gtk_builder_get_object (builder, "sort_save"));
+    if (priv->sd.save_order == TRUE)
+        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE);
+
+    /* Set the button for the current reverse_order order */
+    button = GTK_WIDGET(gtk_builder_get_object (builder, "sort_reverse"));
+    if(priv->sd.reverse_order == TRUE)
+       gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE);
+    priv->sd.original_reverse_order = priv->sd.reverse_order;
+
+    priv->sd.num_radio = GTK_WIDGET(gtk_builder_get_object (builder, "BY_NUM"));
+    priv->sd.act_radio = GTK_WIDGET(gtk_builder_get_object (builder, "BY_ACTION"));
+    /* Adjust labels related to Num/Action radio buttons based on book option */
+    reg = gnc_ledger_display_get_split_register(priv->ledger);
+    if (reg && !reg->use_tran_num_for_num_field)
+    {
+        gtk_button_set_label(GTK_BUTTON (priv->sd.num_radio), _("Transaction Number"));
+        gtk_button_set_label(GTK_BUTTON (priv->sd.act_radio), _("Number/Action"));
+    }
+    gnc_book_option_register_cb(OPTION_NAME_NUM_FIELD_SOURCE,
+                                gnc_plugin_page_register_sort_book_option_changed,
+                                page);
+
+     /* Wire it up */
+    gtk_builder_connect_signals_full (builder, gnc_builder_connect_full_func, page);
+
+    /* Show it */
+    gtk_widget_show(dialog);
+    g_object_unref(G_OBJECT(builder));
+    LEAVE(" ");
+}
+
+static void
+gnc_plugin_page_register_cmd_view_filter_by (GtkAction *action,
+        GncPluginPageRegister *page)
+{
+    GncPluginPageRegisterPrivate *priv;
+    GtkWidget *dialog, *toggle, *button, *table, *hbox;
+    time64 start_time, end_time, time_val;
+    GtkBuilder *builder;
+    gboolean sensitive, value;
+    Query *query;
+    gchar *title;
+    int i;
+
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
+    ENTER("(action %p, page %p)", action, page);
+
+    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
+    if (priv->fd.dialog)
+    {
+        gtk_window_present(GTK_WINDOW(priv->fd.dialog));
+        LEAVE("existing dialog");
+        return;
+    }
+
+    /* Create the dialog */
+    builder = gtk_builder_new();
+    gnc_builder_add_from_file (builder, "gnc-plugin-page-register.glade", "filter_by_dialog");
+    dialog = GTK_WIDGET(gtk_builder_get_object (builder, "filter_by_dialog"));
+    priv->fd.dialog = dialog;
+    gtk_window_set_transient_for(GTK_WINDOW(dialog),
+                                 gnc_window_get_gtk_window(GNC_WINDOW(GNC_PLUGIN_PAGE(page)->window)));
+
+    /* Translators: The %s is the name of the plugin page */
+    title = g_strdup_printf(_("Filter %s by..."),
+                            gnc_plugin_page_get_page_name(GNC_PLUGIN_PAGE(page)));
+    gtk_window_set_title(GTK_WINDOW(dialog), title);
+    g_free(title);
+
+    /* Set the check buttons for the current status */
+    for (i = 0; status_actions[i].action_name; i++)
+    {
+        toggle = GTK_WIDGET(gtk_builder_get_object (builder, status_actions[i].action_name));
+        value = priv->fd.cleared_match & status_actions[i].value;
+        status_actions[i].widget = toggle;
+        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), value);
+    }
+    priv->fd.original_cleared_match = priv->fd.cleared_match;
+
+    button = GTK_WIDGET(gtk_builder_get_object (builder, "filter_save"));
+    if (priv->fd.save_filter == TRUE)
+        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE);
+
+
+    /* Set the date info */
+    button = GTK_WIDGET(gtk_builder_get_object (builder, "filter_show_range"));
+    query = gnc_ledger_display_get_query (priv->ledger);
+    xaccQueryGetDateMatchTT(query, &start_time, &end_time);
+    priv->fd.original_start_time = start_time;
+    priv->fd.start_time = start_time;
+    priv->fd.original_end_time = end_time;
+    priv->fd.end_time = end_time;
+
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), start_time || end_time);
+    table = GTK_WIDGET(gtk_builder_get_object (builder, "select_range_table"));
+    priv->fd.table = table;
+    gtk_widget_set_sensitive(GTK_WIDGET(table), start_time || end_time);
+
+    priv->fd.start_date_choose = GTK_WIDGET(gtk_builder_get_object (builder, "start_date_choose"));
+    priv->fd.start_date_today = GTK_WIDGET(gtk_builder_get_object (builder, "start_date_today"));
+    priv->fd.end_date_choose = GTK_WIDGET(gtk_builder_get_object (builder, "end_date_choose"));
+    priv->fd.end_date_today = GTK_WIDGET(gtk_builder_get_object (builder, "end_date_today"));
+
+    {
+        /* Start date info */
+        if (start_time == 0)
+        {
+            button = GTK_WIDGET(gtk_builder_get_object (builder, "start_date_earliest"));
+            time_val = xaccQueryGetEarliestDateFound (query);
+            sensitive = FALSE;
+        }
+        else
+        {
+            time_val = start_time;
+            if ((start_time >= gnc_time64_get_today_start()) &&
+                    (start_time <= gnc_time64_get_today_end()))
+            {
+                button = priv->fd.start_date_today;
+                sensitive = FALSE;
+            }
+            else
+            {
+                button = priv->fd.start_date_choose;
+                sensitive = TRUE;
+            }
+        }
+        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE);
+        priv->fd.start_date = gnc_date_edit_new (gnc_time (NULL), FALSE, FALSE);
+        hbox = GTK_WIDGET(gtk_builder_get_object (builder, "start_date_hbox"));
+        gtk_box_pack_start (GTK_BOX (hbox), priv->fd.start_date, TRUE, TRUE, 0);
+        gtk_widget_show (priv->fd.start_date);
+        gtk_widget_set_sensitive(GTK_WIDGET(priv->fd.start_date), sensitive);
+        gnc_date_edit_set_time (GNC_DATE_EDIT(priv->fd.start_date), time_val);
+        g_signal_connect (G_OBJECT (priv->fd.start_date), "date-changed",
+                          G_CALLBACK (gnc_plugin_page_register_filter_gde_changed_cb),
+                          page);
+    }
+
+    {
+        /* End date info */
+        if (end_time == 0)
+        {
+            button = GTK_WIDGET(gtk_builder_get_object (builder, "end_date_latest"));
+            time_val = xaccQueryGetLatestDateFound (query);
+            sensitive = FALSE;
+        }
+        else
+        {
+            time_val = end_time;
+            if ((end_time >= gnc_time64_get_today_start()) &&
+                    (end_time <= gnc_time64_get_today_end()))
+            {
+                button = priv->fd.end_date_today;
+                sensitive = FALSE;
+            }
+            else
+            {
+                button = priv->fd.end_date_choose;
+                sensitive = TRUE;
+            }
+        }
+        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE);
+        priv->fd.end_date = gnc_date_edit_new (gnc_time (NULL), FALSE, FALSE);
+        hbox = GTK_WIDGET(gtk_builder_get_object (builder, "end_date_hbox"));
+        gtk_box_pack_start (GTK_BOX (hbox), priv->fd.end_date, TRUE, TRUE, 0);
+        gtk_widget_show (priv->fd.end_date);
+        gtk_widget_set_sensitive(GTK_WIDGET(priv->fd.end_date), sensitive);
+        gnc_date_edit_set_time (GNC_DATE_EDIT(priv->fd.end_date), time_val);
+        g_signal_connect (G_OBJECT (priv->fd.end_date), "date-changed",
+                          G_CALLBACK (gnc_plugin_page_register_filter_gde_changed_cb),
+                          page);
+    }
+
+    /* Wire it up */
+    gtk_builder_connect_signals_full (builder, gnc_builder_connect_full_func, page);
+
+    /* Show it */
+    gtk_widget_show_all(dialog);
+    g_object_unref(G_OBJECT(builder));
+    LEAVE(" ");
+}
+
+static void
+gnc_plugin_page_register_cmd_style_changed (GtkAction *action,
+        GtkRadioAction *current,
+        GncPluginPageRegister *plugin_page)
+{
+    GncPluginPageRegisterPrivate *priv;
+    SplitRegisterStyle value;
+
+    ENTER("(action %p, radio action %p, plugin_page %p)",
+          action, current, plugin_page);
+
+    g_return_if_fail(GTK_IS_ACTION(action));
+    g_return_if_fail(GTK_IS_RADIO_ACTION(current));
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page));
+
+    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
+    value = gtk_radio_action_get_current_value(current);
+    gnc_split_reg_change_style(priv->gsr, value);
+
+    gnc_plugin_page_register_ui_update (NULL, plugin_page);
+    LEAVE(" ");
+}
+
+static void
+gnc_plugin_page_register_cmd_style_double_line (GtkToggleAction *action,
+        GncPluginPageRegister *plugin_page)
+{
+    GncPluginPageRegisterPrivate *priv;
+    SplitRegister *reg;
+    gboolean use_double_line;
+
+    ENTER("(action %p, plugin_page %p)", action, plugin_page);
+
+    g_return_if_fail(GTK_IS_ACTION(action));
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page));
+
+    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
+    reg = gnc_ledger_display_get_split_register (priv->ledger);
+
+    use_double_line =  gtk_toggle_action_get_active (action);
+    if (use_double_line != reg->use_double_line)
+    {
+        gnc_split_register_config(reg, reg->type, reg->style, use_double_line);
+        gnc_ledger_display_refresh(priv->ledger);
+    }
+    LEAVE(" ");
+}
+
+static void
+gnc_plugin_page_register_cmd_transfer (GtkAction *action,
+                                       GncPluginPageRegister *page)
+{
+    Account *account;
+    GncWindow *gnc_window;
+    GtkWidget *window;
+
+    ENTER("(action %p, plugin_page %p)", action, page);
+
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
+
+    account = gnc_plugin_page_register_get_account (page);
+    gnc_window = GNC_WINDOW(GNC_PLUGIN_PAGE (page)->window);
+    window = GTK_WIDGET(gnc_window_get_gtk_window(gnc_window));
+    gnc_xfer_dialog (window, account);
+    LEAVE(" ");
+}
+
+static void
+gnc_plugin_page_register_cmd_reconcile (GtkAction *action,
+                                        GncPluginPageRegister *page)
+{
+    Account *account;
+    GtkWindow *window;
+    RecnWindow * recnData;
+
+    ENTER("(action %p, plugin_page %p)", action, page);
+
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
+
+    account = gnc_plugin_page_register_get_account (page);
+
+    window = gnc_window_get_gtk_window(GNC_WINDOW(GNC_PLUGIN_PAGE (page)->window));
+    recnData = recnWindow (GTK_WIDGET(window), account);
+    gnc_ui_reconcile_window_raise (recnData);
+    LEAVE(" ");
+}
+
+static void
+gnc_plugin_page_register_cmd_autoclear (GtkAction *action,
+                                        GncPluginPageRegister *page)
+{
+    Account *account;
+    GtkWindow *window;
+    AutoClearWindow * autoClearData;
+
+    ENTER("(action %p, plugin_page %p)", action, page);
+
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
+
+    account = gnc_plugin_page_register_get_account (page);
+
+    window = gnc_window_get_gtk_window(GNC_WINDOW(GNC_PLUGIN_PAGE (page)->window));
+    autoClearData = autoClearWindow (GTK_WIDGET(window), account);
+    gnc_ui_autoclear_window_raise (autoClearData);
+    LEAVE(" ");
+}
+
+static void
+gnc_plugin_page_register_cmd_stock_split (GtkAction *action,
+        GncPluginPageRegister *page)
+{
+    Account *account;
+
+    ENTER("(action %p, plugin_page %p)", action, page);
+
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
+
+    account = gnc_plugin_page_register_get_account (page);
+    gnc_stock_split_dialog (NULL, account);
+    LEAVE(" ");
+}
+
+static void
+gnc_plugin_page_register_cmd_lots (GtkAction *action,
+                                   GncPluginPageRegister *page)
+{
+    Account *account;
+
+    ENTER("(action %p, plugin_page %p)", action, page);
+
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
+
+    account = gnc_plugin_page_register_get_account (page);
+    gnc_lot_viewer_dialog (account);
+    LEAVE(" ");
+}
+
+static void
+gnc_plugin_page_register_cmd_enter_transaction (GtkAction *action,
+        GncPluginPageRegister *plugin_page)
+{
+    GncPluginPageRegisterPrivate *priv;
+
+    ENTER("(action %p, plugin_page %p)", action, plugin_page);
+
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page));
+
+    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
+    gnc_split_reg_enter(priv->gsr, FALSE);
+    LEAVE(" ");
+}
+
+static void
+gnc_plugin_page_register_cmd_cancel_transaction (GtkAction *action,
+        GncPluginPageRegister *plugin_page)
+{
+    GncPluginPageRegisterPrivate *priv;
+
+    ENTER("(action %p, plugin_page %p)", action, plugin_page);
+
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page));
+
+    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
+    gnc_split_register_cancel_cursor_trans_changes
+    (gnc_ledger_display_get_split_register(priv->ledger));
+    LEAVE(" ");
+}
+
+static void
+gnc_plugin_page_register_cmd_delete_transaction (GtkAction *action,
+        GncPluginPageRegister *plugin_page)
+{
+    GncPluginPageRegisterPrivate *priv;
+
+    ENTER("(action %p, plugin_page %p)", action, plugin_page);
+
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page));
+
+    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
+    gsr_default_delete_handler(priv->gsr, NULL);
+    LEAVE(" ");
+
+}
+
+static void
+gnc_plugin_page_register_cmd_associate_file_transaction (GtkAction *action,
+        GncPluginPageRegister *plugin_page)
+{
+    GncPluginPageRegisterPrivate *priv;
+
+    ENTER("(action %p, plugin_page %p)", action, plugin_page);
+
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page));
+
+    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
+    gsr_default_associate_handler (priv->gsr, TRUE);
+    gnc_plugin_page_register_ui_update (NULL, plugin_page);
+    LEAVE(" ");
+}
+
+static void
+gnc_plugin_page_register_cmd_associate_location_transaction (GtkAction *action,
+        GncPluginPageRegister *plugin_page)
+{
+    GncPluginPageRegisterPrivate *priv;
+
+    ENTER("(action %p, plugin_page %p)", action, plugin_page);
+
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page));
+
+    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
+    gsr_default_associate_handler (priv->gsr, FALSE);
+    gnc_plugin_page_register_ui_update (NULL, plugin_page);
+    LEAVE(" ");
+}
+
+static void
+gnc_plugin_page_register_cmd_execassociated_transaction (GtkAction *action,
+        GncPluginPageRegister *plugin_page)
+{
+    GncPluginPageRegisterPrivate *priv;
+
+    ENTER("(action %p, plugin_page %p)", action, plugin_page);
+
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page));
+
+    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
+    gsr_default_execassociated_handler(priv->gsr, NULL);
+    LEAVE(" ");
+
+}
+
+static void
+gnc_plugin_page_register_cmd_blank_transaction (GtkAction *action,
+        GncPluginPageRegister *plugin_page)
+{
+    GncPluginPageRegisterPrivate *priv;
+    SplitRegister *reg;
+
+    ENTER("(action %p, plugin_page %p)", action, plugin_page);
+
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page));
+
+    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
+    reg = gnc_ledger_display_get_split_register (priv->ledger);
+
+    if (gnc_split_register_save (reg, TRUE))
+        gnc_split_register_redraw (reg);
+
+    gnc_split_reg_jump_to_blank (priv->gsr);
+    LEAVE(" ");
+}
+
+static void
+gnc_plugin_page_register_cmd_duplicate_transaction (GtkAction *action,
+        GncPluginPageRegister *plugin_page)
+{
+    GncPluginPageRegisterPrivate *priv;
+
+    ENTER("(action %p, plugin_page %p)", action, plugin_page);
+
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page));
+
+    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
+    gnc_split_register_duplicate_current
+    (gnc_ledger_display_get_split_register(priv->ledger));
+    LEAVE(" ");
+}
+
+static void
+gnc_plugin_page_register_cmd_reinitialize_transaction (GtkAction *action,
+        GncPluginPageRegister *plugin_page)
+{
+    GncPluginPageRegisterPrivate *priv;
+
+    ENTER("(action %p, plugin_page %p)", action, plugin_page);
+
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page));
+
+    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
+    gsr_default_reinit_handler(priv->gsr, NULL);
+    LEAVE(" ");
+}
+
+static void
+gnc_plugin_page_register_cmd_expand_transaction (GtkToggleAction *action,
+        GncPluginPageRegister *plugin_page)
+{
+    GncPluginPageRegisterPrivate *priv;
+    SplitRegister *reg;
+    gboolean expand;
+
+    ENTER("(action %p, plugin_page %p)", action, plugin_page);
+
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page));
+
+    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
+    reg = gnc_ledger_display_get_split_register (priv->ledger);
+    expand = gtk_toggle_action_get_active (action);
+    gnc_split_register_expand_current_trans (reg, expand);
+    LEAVE(" ");
+}
+
+/** Callback for "Edit Exchange Rate" menu item.
+ */
+static void
+gnc_plugin_page_register_cmd_exchange_rate (GtkAction *action,
+        GncPluginPageRegister *plugin_page)
+{
+    GncPluginPageRegisterPrivate *priv;
+    SplitRegister *reg;
+
+    ENTER("(action %p, plugin_page %p)", action, plugin_page);
+
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page));
+
+    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
+    reg = gnc_ledger_display_get_split_register (priv->ledger);
+
+    /* XXX Ignore the return value -- we don't care if this succeeds */
+    (void)gnc_split_register_handle_exchange (reg, TRUE);
+    LEAVE(" ");
+}
+
+static void
+gnc_plugin_page_register_cmd_jump (GtkAction *action,
+                                   GncPluginPageRegister *plugin_page)
+{
+    GncPluginPageRegisterPrivate *priv;
+    GncPluginPage *new_page;
+    GtkWidget *window;
+    GNCSplitReg *gsr;
+    SplitRegister *reg;
+    Account *account;
+    Account *leader;
+    Split *split;
+
+    ENTER("(action %p, plugin_page %p)", action, plugin_page);
+
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page));
+
+    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
+    window = GNC_PLUGIN_PAGE (plugin_page)->window;
+    if (window == NULL)
+    {
+        LEAVE("no window");
+        return;
+    }
+
+    reg = gnc_ledger_display_get_split_register (priv->ledger);
+    split = gnc_split_register_get_current_split (reg);
+    if (split == NULL)
+    {
+        LEAVE("no split (1)");
+        return;
+    }
+
+    account = xaccSplitGetAccount (split);
+    if (account == NULL)
+    {
+        LEAVE("no account");
+        return;
+    }
+
+    leader = gnc_ledger_display_leader (priv->ledger);
+    if (account == leader)
+    {
+        split = xaccSplitGetOtherSplit (split);
+        if (split == NULL)
+        {
+            LEAVE("no split (2)");
+            return;
+        }
+
+        account = xaccSplitGetAccount (split);
+        if (account == NULL)
+        {
+            LEAVE("no account (2)");
+            return;
+        }
+
+        if (account == leader)
+        {
+            LEAVE("register open for account");
+            return;
+        }
+    }
+
+    new_page = gnc_plugin_page_register_new (account, FALSE);
+    if (new_page == NULL)
+    {
+        LEAVE("couldn't create new page");
+        return;
+    }
+
+    gnc_main_window_open_page (GNC_MAIN_WINDOW(window), new_page);
+    gsr = gnc_plugin_page_register_get_gsr (new_page);
+    gnc_split_reg_jump_to_split(gsr, split);
+    LEAVE(" ");
+}
+
+static void
+gnc_plugin_page_register_cmd_schedule (GtkAction *action,
+                                       GncPluginPageRegister *plugin_page)
+{
+    GncPluginPageRegisterPrivate *priv;
+
+    ENTER("(action %p, plugin_page %p)", action, plugin_page);
+
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page));
+
+    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
+    gsr_default_schedule_handler(priv->gsr, NULL);
+    LEAVE(" ");
+}
+
+static void
+gnc_plugin_page_register_cmd_scrub_current (GtkAction *action,
+        GncPluginPageRegister *plugin_page)
+{
+    GncPluginPageRegisterPrivate *priv;
+    Query *query;
+    Account *root;
+    Transaction *trans;
+    Split *split;
+    GNCLot *lot;
+    SplitRegister *reg;
+
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page));
+
+    ENTER("(action %p, plugin_page %p)", action, plugin_page);
+
+    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
+    query = gnc_ledger_display_get_query( priv->ledger );
+    if (query == NULL)
+    {
+        LEAVE("no query found");
+        return;
+    }
+
+    reg = gnc_ledger_display_get_split_register(priv->ledger);
+    trans = gnc_split_register_get_current_trans(reg);
+    if (trans == NULL)
+    {
+        LEAVE("no trans found");
+        return;
+    }
+
+    gnc_suspend_gui_refresh();
+    root = gnc_get_current_root_account();
+    xaccTransScrubOrphans(trans);
+    xaccTransScrubImbalance(trans, root, NULL);
+
+    split = gnc_split_register_get_current_split (reg);
+    lot = xaccSplitGetLot (split);
+    if (lot && xaccAccountIsAPARType (xaccAccountGetType (xaccSplitGetAccount (split))))
+    {
+        gncScrubBusinessLot (lot);
+        gncScrubBusinessSplit (split);
+    }
+    gnc_resume_gui_refresh();
+    LEAVE(" ");
+}
+
+static void
+gnc_plugin_page_register_cmd_scrub_all (GtkAction *action,
+                                        GncPluginPageRegister *plugin_page)
+{
+    GncPluginPageRegisterPrivate *priv;
+    Query *query;
+    Account *root;
+    GncWindow *window;
+    GList *node, *splits;
+    gint split_count = 0, curr_split_no = 0;
+    const char *message = _( "Checking splits in current register: %u of %u");
+
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page));
+
+    ENTER("(action %p, plugin_page %p)", action, plugin_page);
+
+    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
+    query = gnc_ledger_display_get_query( priv->ledger );
+    if (!query)
+    {
+        LEAVE("no query found");
+        return;
+    }
+
+    gnc_suspend_gui_refresh();
+    window = GNC_WINDOW(GNC_PLUGIN_PAGE (plugin_page)->window);
+    gnc_window_set_progressbar_window (window);
+
+    root = gnc_get_current_root_account();
+
+    splits = qof_query_run(query);
+    split_count = g_list_length (splits);
+    for (node = splits; node; node = node->next)
+    {
+        GNCLot *lot;
+        Split *split = node->data;
+        Transaction *trans = xaccSplitGetParent(split);
+
+        if (!split) continue;
+
+        PINFO("Start processing split %d of %d",
+              curr_split_no + 1, split_count);
+
+        if (curr_split_no % 100 == 0)
+        {
+            char *progress_msg = g_strdup_printf (message, curr_split_no, split_count);
+            gnc_window_show_progress (progress_msg, (100 * curr_split_no) / split_count);
+            g_free (progress_msg);
+        }
+
+        xaccTransScrubOrphans(trans);
+        xaccTransScrubImbalance(trans, root, NULL);
+
+        lot = xaccSplitGetLot (split);
+        if (lot && xaccAccountIsAPARType (xaccAccountGetType (xaccSplitGetAccount (split))))
+        {
+            gncScrubBusinessLot (lot);
+            gncScrubBusinessSplit (split);
+        }
+
+        PINFO("Finished processing split %d of %d",
+              curr_split_no + 1, split_count);
+        curr_split_no++;
+    }
+
+    gnc_window_show_progress (NULL, -1.0);
+    gnc_resume_gui_refresh();
+    LEAVE(" ");
+}
+
+static void
+gnc_plugin_page_register_cmd_account_report (GtkAction *action,
+        GncPluginPageRegister *plugin_page)
+{
+    GncPluginPageRegisterPrivate *priv;
+    GncMainWindow *window;
+    int id;
+
+    ENTER("(action %p, plugin_page %p)", action, plugin_page);
+
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page));
+
+    window = GNC_MAIN_WINDOW(GNC_PLUGIN_PAGE(plugin_page)->window);
+    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
+    id = report_helper (priv->ledger, NULL, NULL);
+    if (id >= 0)
+        gnc_main_window_open_report(id, window);
+    LEAVE(" ");
+}
+
+static void
+gnc_plugin_page_register_cmd_transaction_report (GtkAction *action,
+        GncPluginPageRegister *plugin_page)
+{
+    GncPluginPageRegisterPrivate *priv;
+    GncMainWindow *window;
+    SplitRegister *reg;
+    Split *split;
+    Query *query;
+    int id;
+
+
+    ENTER("(action %p, plugin_page %p)", action, plugin_page);
+
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page));
+
+    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
+    reg = gnc_ledger_display_get_split_register (priv->ledger);
+
+    split = gnc_split_register_get_current_split (reg);
+    if (!split)
+        return;
+
+    query = qof_query_create_for(GNC_ID_SPLIT);
+
+    qof_query_set_book (query, gnc_get_current_book ());
+
+    xaccQueryAddGUIDMatch (query, xaccSplitGetGUID (split),
+                           GNC_ID_SPLIT, QOF_QUERY_AND);
+
+    window = GNC_MAIN_WINDOW(GNC_PLUGIN_PAGE(plugin_page)->window);
+    id = report_helper (priv->ledger, split, query);
+    if (id >= 0)
+        gnc_main_window_open_report(id, window);
+    LEAVE(" ");
+}
+
+/************************************************************/
+/*                    Auxiliary functions                   */
+/************************************************************/
+
+void
+gnc_plugin_page_register_set_options (GncPluginPage *plugin_page,
+                                      gint lines_default,
+                                      gboolean read_only)
+{
+    GncPluginPageRegister *page;
+    GncPluginPageRegisterPrivate *priv;
+
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page));
+
+    page = GNC_PLUGIN_PAGE_REGISTER (plugin_page);
+    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
+    priv->lines_default     = lines_default;
+    priv->read_only         = read_only;
+}
+
+GNCSplitReg *
+gnc_plugin_page_register_get_gsr (GncPluginPage *plugin_page)
+{
+    GncPluginPageRegister *page;
+    GncPluginPageRegisterPrivate *priv;
+
+    g_return_val_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page), NULL);
+
+    page = GNC_PLUGIN_PAGE_REGISTER (plugin_page);
+    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
+
+    return priv->gsr;
+}
+
+static void
+gnc_plugin_page_help_changed_cb (GNCSplitReg *gsr, GncPluginPageRegister *register_page)
+{
+    GncPluginPageRegisterPrivate *priv;
+    SplitRegister *reg;
+    GncWindow *window;
+    char *help;
+
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(register_page));
+
+    window = GNC_WINDOW(GNC_PLUGIN_PAGE(register_page)->window);
+    if (!window)
+    {
+        // This routine can be called before the page is added to a
+        // window.
+        return;
+    }
+
+    /* Get the text from the ledger */
+    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(register_page);
+    reg = gnc_ledger_display_get_split_register(priv->ledger);
+    help = gnc_table_get_help(reg->table);
+    gnc_window_set_status(window, GNC_PLUGIN_PAGE(register_page), help);
+    g_free(help);
+}
+
+static void
+gnc_plugin_page_register_refresh_cb (GHashTable *changes, gpointer user_data)
+{
+    GncPluginPageRegister *page = user_data;
+    GncPluginPageRegisterPrivate *priv;
+
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
+    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
+
+    if (changes)
+    {
+        const EventInfo* ei;
+        ei = gnc_gui_get_entity_events(changes, &priv->key);
+        if (ei)
+        {
+            if (ei->event_mask & QOF_EVENT_DESTROY)
+            {
+                gnc_main_window_close_page(GNC_PLUGIN_PAGE(page));
+                return;
+            }
+            if (ei->event_mask & QOF_EVENT_MODIFY)
+            {
+            }
+        }
+    }
+    else
+    {
+        /* forced updates */
+        gnucash_register_refresh_from_prefs(priv->gsr->reg);
+        gtk_widget_queue_draw(priv->widget);
+    }
+
+    gnc_plugin_page_register_ui_update(NULL, page);
+}
+
+static void
+gnc_plugin_page_register_close_cb (gpointer user_data)
+{
+    GncPluginPage *plugin_page = GNC_PLUGIN_PAGE(user_data);
+    gnc_main_window_close_page (plugin_page);
+}
+
+/** This function is called when an account has been edited and an
+ *  "extreme" change has been made to it.  (E.G. Changing from a
+ *  credit card account to an expense account.  This rouine is
+ *  responsible for finding all open registers containing the account
+ *  and closing them.
+ *
+ *  @param account A pointer to the account that was changed.
+ */
+static void
+gppr_account_destroy_cb (Account *account)
+{
+    GncPluginPageRegister *page;
+    GncPluginPageRegisterPrivate *priv;
+    GNCLedgerDisplayType ledger_type;
+    const GncGUID *acct_guid;
+    const GList *citem;
+    GList *item, *kill = NULL;
+
+    acct_guid = xaccAccountGetGUID(account);
+
+    /* Find all windows that need to be killed.  Don't kill them yet, as
+     * that would affect the list being walked.*/
+    citem = gnc_gobject_tracking_get_list(GNC_PLUGIN_PAGE_REGISTER_NAME);
+    for ( ; citem; citem = g_list_next(citem))
+    {
+        page = (GncPluginPageRegister *)citem->data;
+        priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
+        ledger_type = gnc_ledger_display_type (priv->ledger);
+        if (ledger_type == LD_GL)
+        {
+            kill = g_list_append(kill, page);
+            /* kill it */
+        }
+        else if ((ledger_type == LD_SINGLE) || (ledger_type == LD_SUBACCOUNT))
+        {
+            if (guid_compare(acct_guid, &priv->key) == 0)
+            {
+                kill = g_list_append(kill, page);
+            }
+        }
+    }
+
+    /* Now kill them. */
+    for (item = kill; item; item = g_list_next(item))
+    {
+        page = (GncPluginPageRegister *)item->data;
+        gnc_main_window_close_page(GNC_PLUGIN_PAGE(page));
+    }
+}
+
+/** This function is the handler for all event messages from the
+ *  engine.  Its purpose is to update the register page any time
+ *  an account or transaction is changed.
+ *
+ *  @internal
+ *
+ *  @param entity A pointer to the affected item.
+ *
+ *  @param event_type The type of the affected item.
+ *
+ *  @param page A pointer to the register page.
+ *
+ *  @param ed
+ */
+static void
+gnc_plugin_page_register_event_handler (QofInstance *entity,
+                                        QofEventId event_type,
+                                        GncPluginPageRegister *page,
+                                        GncEventData *ed)
+{
+    Transaction *trans;
+    QofBook *book;
+    GncPluginPage *visible_page;
+    GtkWidget *window;
+    gchar *label, *color;
+
+    g_return_if_fail(page);	/* Required */
+    if (!GNC_IS_TRANS(entity) && !GNC_IS_ACCOUNT(entity))
+        return;
+
+    ENTER("entity %p of type %d, page %p, event data %p",
+          entity, event_type, page, ed);
+
+    window = gnc_plugin_page_get_window(GNC_PLUGIN_PAGE(page));
+
+    if (GNC_IS_ACCOUNT(entity))
+    {
+        if (GNC_IS_MAIN_WINDOW(window))
+        {
+            label = gnc_plugin_page_register_get_tab_name(GNC_PLUGIN_PAGE(page));
+            main_window_update_page_name(GNC_PLUGIN_PAGE(page), label);
+            color = gnc_plugin_page_register_get_tab_color(GNC_PLUGIN_PAGE(page));
+            main_window_update_page_color(GNC_PLUGIN_PAGE(page), color);
+            g_free(color);
+            g_free(label);
+        }
+        LEAVE("tab name updated");
+        return;
+    }
+
+    if (!(event_type & (QOF_EVENT_MODIFY | QOF_EVENT_DESTROY)))
+    {
+        LEAVE("not a modify");
+        return;
+    }
+    trans = GNC_TRANS(entity);
+    book = qof_instance_get_book(QOF_INSTANCE(trans));
+    if (!gnc_plugin_page_has_book(GNC_PLUGIN_PAGE(page), book))
+    {
+        LEAVE("not in this book");
+        return;
+    }
+
+    if (GNC_IS_MAIN_WINDOW(window))
+    {
+        visible_page = gnc_main_window_get_current_page(GNC_MAIN_WINDOW(window));
+        if (visible_page != GNC_PLUGIN_PAGE(page))
+        {
+            LEAVE("page not visible");
+            return;
+        }
+    }
+
+    gnc_plugin_page_register_ui_update(NULL, page);
+    LEAVE(" ");
+    return;
+}
+
+
+/** @} */
+/** @} */
diff --git a/src/gnome/gnc-plugin-page-register.h b/gnucash/gnome/gnc-plugin-page-register.h
similarity index 100%
rename from src/gnome/gnc-plugin-page-register.h
rename to gnucash/gnome/gnc-plugin-page-register.h
diff --git a/gnucash/gnome/gnc-plugin-page-register2.c b/gnucash/gnome/gnc-plugin-page-register2.c
new file mode 100644
index 0000000..4a2ab28
--- /dev/null
+++ b/gnucash/gnome/gnc-plugin-page-register2.c
@@ -0,0 +1,4082 @@
+/**********************************************************************
+ * gnc-plugin-page-register2.c -- register page functions             *
+ *                                                                    *
+ * Copyright (C) 2003 Jan Arne Petersen <jpetersen at uni-bonn.de>       *
+ * Copyright (C) 2003,2005,2006 David Hampton <hampton at employees.org> *
+ * Copyright (C) 2011, Robert Fewell                                  *
+ *                                                                    *
+ * 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 at gnu.org                     *
+ **********************************************************************/
+
+/** @addtogroup ContentPlugins
+    @{ */
+/** @addtogroup RegisterPlugin Register Page
+    @{ */
+/** @file gnc-plugin-page-register.c
+    @brief  Functions providing a register page for the GnuCash UI
+    @author Copyright (C) 2003 Jan Arne Petersen <jpetersen at uni-bonn.de>
+    @author Copyright (C) 2003,2005 David Hampton <hampton at employees.org>
+*/
+
+#include "config.h"
+
+#include <libguile.h>
+#include "guile-mappings.h"
+#include <gtk/gtk.h>
+#include <glib/gi18n.h>
+#include "swig-runtime.h"
+
+#include "gnc-plugin-page-register2.h"
+/*################## Added for Reg2 #################*/
+#include "gnc-plugin-page-register.h"
+/*################## Added for Reg2 #################*/
+#include "gnc-plugin-register2.h"
+#include "gnc-plugin-menu-additions.h"
+#include "gnc-plugin-page-report.h"
+
+#include "gnc-tree-view.h"
+#include "gnc-tree-view-split-reg.h"
+#include "gnc-tree-model-split-reg.h"
+#include "gnc-tree-control-split-reg.h"
+
+#include "dialog-account.h"
+#include "dialog-find-account.h"
+#include "dialog-find-transactions2.h"
+#include "dialog-print-check.h"
+#include "dialog-transfer.h"
+#include "dialog-utils.h"
+#include "SX-book.h"
+#include "dialog-sx-editor.h"
+/*################## Added for Reg2 #################*/
+#include "dialog-sx-editor2.h"
+/*################## Added for Reg2 #################*/
+#include "dialog-sx-from-trans.h"
+#include "assistant-stock-split.h"
+#include "gnc-component-manager.h"
+#include "gnc-date.h"
+#include "gnc-date-edit.h"
+#include "gnc-engine.h"
+#include "gnc-event.h"
+#include "gnc-gnome-utils.h"
+#include "gnc-gobject-utils.h"
+#include "gnc-gui-query.h"
+#include "gnc-icons.h"
+#include "gnc-prefs.h"
+#include "gnc-split-reg2.h"
+#include "gnc-ui-util.h"
+#include "gnc-window.h"
+#include "gnc-main-window.h"
+#include "gnc-session.h"
+#include "gnc-warnings.h"
+#include "dialog-lot-viewer.h"
+#include "Scrub.h"
+#include "qof.h"
+#include "window-reconcile2.h"
+#include "window-autoclear.h"
+#include "window-report.h"
+
+/* This static indicates the debugging module that this .o belongs to.  */
+static QofLogModule log_module = GNC_MOD_GUI;
+
+#define DEFAULT_LINES_AMOUNT         50
+
+static void gnc_plugin_page_register2_class_init (GncPluginPageRegister2Class *klass);
+static void gnc_plugin_page_register2_init (GncPluginPageRegister2 *plugin_page);
+static void gnc_plugin_page_register2_finalize (GObject *object);
+
+static GtkWidget *gnc_plugin_page_register2_create_widget (GncPluginPage *plugin_page);
+static void gnc_plugin_page_register2_destroy_widget (GncPluginPage *plugin_page);
+static void gnc_plugin_page_register2_window_changed (GncPluginPage *plugin_page, GtkWidget *window);
+static void gnc_plugin_page_register2_save_page (GncPluginPage *plugin_page, GKeyFile *file, const gchar *group);
+static GncPluginPage *gnc_plugin_page_register2_recreate_page (GtkWidget *window, GKeyFile *file, const gchar *group);
+static void gnc_plugin_page_register2_update_edit_menu (GncPluginPage *page, gboolean hide);
+static gboolean gnc_plugin_page_register2_finish_pending (GncPluginPage *page);
+
+static gboolean gnc_plugin_page_register2_button_press_cb (GtkWidget *widget, GdkEventButton *event, GncPluginPage *page);
+
+static gchar *gnc_plugin_page_register2_get_tab_name (GncPluginPage *plugin_page);
+static gchar *gnc_plugin_page_register2_get_tab_color (GncPluginPage *plugin_page);
+static gchar *gnc_plugin_page_register2_get_long_name (GncPluginPage *plugin_page);
+
+static void gnc_plugin_page_register2_summarybar_position_changed (gpointer prefs, gchar* pref, gpointer user_data);
+
+/* Callbacks for the "Filter By" dialog */
+void gnc_plugin_page_register2_filter_select_range_cb (GtkRadioButton *button, GncPluginPageRegister2 *page);
+void gnc_plugin_page_register2_filter_start_cb (GtkWidget *radio, GncPluginPageRegister2 *page);
+void gnc_plugin_page_register2_filter_end_cb (GtkWidget *radio, GncPluginPageRegister2 *page);
+void gnc_plugin_page_register2_filter_response_cb (GtkDialog *dialog, gint response, GncPluginPageRegister2 *plugin_page);
+void gnc_plugin_page_register2_filter_status_all_cb (GtkButton *button, GncPluginPageRegister2 *plugin_page);
+void gnc_plugin_page_register2_filter_status_one_cb (GtkToggleButton *button, GncPluginPageRegister2 *page);
+void gnc_plugin_page_register2_filter_save_cb (GtkToggleButton *button, GncPluginPageRegister2 *page);
+
+static time64 gnc_plugin_page_register2_filter_dmy2time (char *date_string);
+static gchar *gnc_plugin_page_register2_filter_time2dmy (time64 raw_time);
+static gchar *gnc_plugin_page_register2_get_filter (GncPluginPage *plugin_page);
+void gnc_plugin_page_register2_set_filter (GncPluginPage *plugin_page, const gchar *filter);
+
+static void gnc_ppr_update_status_query (GncPluginPageRegister2 *page, gboolean refresh_page); 
+static void gnc_ppr_update_date_query (GncPluginPageRegister2 *page, gboolean refresh_page); 
+
+/* Command callbacks */
+static void gnc_plugin_page_register2_cmd_print_check (GtkAction *action, GncPluginPageRegister2 *plugin_page);
+static void gnc_plugin_page_register2_cmd_cut (GtkAction *action, GncPluginPageRegister2 *plugin_page);
+static void gnc_plugin_page_register2_cmd_copy (GtkAction *action, GncPluginPageRegister2 *plugin_page);
+static void gnc_plugin_page_register2_cmd_paste (GtkAction *action, GncPluginPageRegister2 *plugin_page);
+static void gnc_plugin_page_register2_cmd_edit_account (GtkAction *action, GncPluginPageRegister2 *plugin_page);
+static void gnc_plugin_page_register2_cmd_find_account (GtkAction *action, GncPluginPageRegister2 *plugin_page);
+static void gnc_plugin_page_register2_cmd_find_transactions (GtkAction *action, GncPluginPageRegister2 *plugin_page);
+static void gnc_plugin_page_register2_cmd_cut_transaction (GtkAction *action, GncPluginPageRegister2 *plugin_page);
+static void gnc_plugin_page_register2_cmd_copy_transaction (GtkAction *action, GncPluginPageRegister2 *plugin_page);
+static void gnc_plugin_page_register2_cmd_paste_transaction (GtkAction *action, GncPluginPageRegister2 *plugin_page);
+static void gnc_plugin_page_register2_cmd_void_transaction (GtkAction *action, GncPluginPageRegister2 *plugin_page);
+static void gnc_plugin_page_register2_cmd_unvoid_transaction (GtkAction *action, GncPluginPageRegister2 *plugin_page);
+static void gnc_plugin_page_register2_cmd_reverse_transaction (GtkAction *action, GncPluginPageRegister2 *plugin_page);
+static void gnc_plugin_page_register2_cmd_reload (GtkAction *action, GncPluginPageRegister2 *plugin_page);
+static void gnc_plugin_page_register2_cmd_view_filter_by (GtkAction *action, GncPluginPageRegister2 *plugin_page);
+static void gnc_plugin_page_register2_cmd_style_changed (GtkAction *action, GtkRadioAction *current, GncPluginPageRegister2 *plugin_page);
+static void gnc_plugin_page_register2_cmd_style_double_line (GtkToggleAction *action, GncPluginPageRegister2 *plugin_page);
+static void gnc_plugin_page_register2_cmd_style_extra_dates (GtkToggleAction *action, GncPluginPageRegister2 *plugin_page);
+
+static void gnc_plugin_page_register2_cmd_reconcile (GtkAction *action, GncPluginPageRegister2 *plugin_page);
+static void gnc_plugin_page_register2_cmd_autoclear (GtkAction *action, GncPluginPageRegister2 *plugin_page);
+static void gnc_plugin_page_register2_cmd_transfer (GtkAction *action, GncPluginPageRegister2 *plugin_page);
+static void gnc_plugin_page_register2_cmd_stock_split (GtkAction *action, GncPluginPageRegister2 *plugin_page);
+static void gnc_plugin_page_register2_cmd_lots (GtkAction *action, GncPluginPageRegister2 *plugin_page);
+static void gnc_plugin_page_register2_cmd_enter_transaction (GtkAction *action, GncPluginPageRegister2 *plugin_page);
+static void gnc_plugin_page_register2_cmd_cancel_transaction (GtkAction *action, GncPluginPageRegister2 *plugin_page);
+static void gnc_plugin_page_register2_cmd_delete_transaction (GtkAction *action, GncPluginPageRegister2 *plugin_page);
+static void gnc_plugin_page_register2_cmd_blank_transaction (GtkAction *action, GncPluginPageRegister2 *plugin_page);
+static void gnc_plugin_page_register2_cmd_duplicate_transaction (GtkAction *action, GncPluginPageRegister2 *plugin_page);
+static void gnc_plugin_page_register2_cmd_reinitialize_transaction (GtkAction *action, GncPluginPageRegister2 *plugin_page);
+static void gnc_plugin_page_register2_cmd_expand_transaction (GtkToggleAction *action, GncPluginPageRegister2 *plugin_page);
+static void gnc_plugin_page_register2_cmd_exchange_rate (GtkAction *action, GncPluginPageRegister2 *plugin_page);
+static void gnc_plugin_page_register2_cmd_jump (GtkAction *action, GncPluginPageRegister2 *plugin_page);
+static void gnc_plugin_page_register2_cmd_schedule (GtkAction *action, GncPluginPageRegister2 *plugin_page);
+static void gnc_plugin_page_register2_cmd_scrub_all (GtkAction *action, GncPluginPageRegister2 *plugin_page);
+static void gnc_plugin_page_register2_cmd_scrub_current (GtkAction *action, GncPluginPageRegister2 *plugin_page);
+static void gnc_plugin_page_register2_cmd_account_report (GtkAction *action, GncPluginPageRegister2 *plugin_page);
+static void gnc_plugin_page_register2_cmd_transaction_report (GtkAction *action, GncPluginPageRegister2 *plugin_page);
+static void gnc_plugin_page_register2_cmd_entryUp (GtkAction *action, GncPluginPageRegister2 *plugin_page);
+static void gnc_plugin_page_register2_cmd_entryDown (GtkAction *action, GncPluginPageRegister2 *plugin_page);
+
+static void gnc_plugin_page_help_changed_cb (GNCSplitReg2 *gsr, GncPluginPageRegister2 *register_page );
+static void gnc_plugin_page_register2_refresh_cb (GHashTable *changes, gpointer user_data);
+static void gnc_plugin_page_register2_close_cb (gpointer user_data);
+
+static void gnc_plugin_page_register2_ui_update (gpointer various, GncPluginPageRegister2 *page);
+static void gppr_account_destroy_cb (Account *account);
+static void gnc_plugin_page_register2_event_handler (QofInstance *entity,
+        QofEventId event_type,
+        GncPluginPageRegister2 *page,
+        GncEventData *ed);
+
+/************************************************************/
+/*                          Actions                         */
+/************************************************************/
+
+#define CUT_TRANSACTION_LABEL         N_("Cu_t Transaction")
+#define COPY_TRANSACTION_LABEL        N_("_Copy Transaction")
+#define PASTE_TRANSACTION_LABEL       N_("_Paste Transaction")
+#define DUPLICATE_TRANSACTION_LABEL   N_("Dup_licate Transaction")
+#define DELETE_TRANSACTION_LABEL      N_("_Delete Transaction")
+#define CUT_SPLIT_LABEL               N_("Cu_t Split")
+#define COPY_SPLIT_LABEL              N_("_Copy Split")
+#define PASTE_SPLIT_LABEL             N_("_Paste Split")
+#define DUPLICATE_SPLIT_LABEL         N_("Dup_licate Split")
+#define DELETE_SPLIT_LABEL            N_("_Delete Split")
+#define CUT_TRANSACTION_TIP           N_("Cut the selected transaction into clipboard")
+#define COPY_TRANSACTION_TIP          N_("Copy the selected transaction into clipboard")
+#define PASTE_TRANSACTION_TIP         N_("Paste the transaction from the clipboard")
+#define DUPLICATE_TRANSACTION_TIP     N_("Make a copy of the current transaction")
+#define DELETE_TRANSACTION_TIP        N_("Delete the current transaction")
+#define CUT_SPLIT_TIP                 N_("Cut the selected split into clipboard")
+#define COPY_SPLIT_TIP                N_("Copy the selected split into clipboard")
+#define PASTE_SPLIT_TIP               N_("Paste the split from the clipboard")
+#define DUPLICATE_SPLIT_TIP           N_("Make a copy of the current split")
+#define DELETE_SPLIT_TIP              N_("Delete the current split")
+
+#define TRANSACTION_UP_ACTION "TransactionUpAction"
+#define TRANSACTION_DOWN_ACTION "TransactionDownAction"
+
+static GtkActionEntry gnc_plugin_page_register2_actions [] =
+{
+    /* File menu */
+
+    {
+        "FilePrintAction", "document-print", N_("_Print Checks..."), "<primary>p", NULL,
+        G_CALLBACK (gnc_plugin_page_register2_cmd_print_check)
+    },
+
+    /* Edit menu */
+
+    {
+        "EditCutAction", "edit-cut", N_("Cu_t"), "<primary>X",
+        N_("Cut the current selection and copy it to clipboard"),
+        G_CALLBACK (gnc_plugin_page_register2_cmd_cut)
+    },
+    {
+        "EditCopyAction", "edit-copy", N_("_Copy"), "<primary>C",
+        N_("Copy the current selection to clipboard"),
+        G_CALLBACK (gnc_plugin_page_register2_cmd_copy)
+    },
+    {
+        "EditPasteAction", "edit-paste", N_("_Paste"), "<primary>V",
+        N_("Paste the clipboard content at the cursor position"),
+        G_CALLBACK (gnc_plugin_page_register2_cmd_paste)
+    },
+    {
+        "EditEditAccountAction", GNC_ICON_EDIT_ACCOUNT, N_("Edit _Account"), "<primary>e",
+        N_("Edit the selected account"),
+        G_CALLBACK (gnc_plugin_page_register2_cmd_edit_account)
+    },
+    {
+        "EditFindAccountAction", "edit-find", N_("F_ind Account"), "<primary>i",
+        N_("Find an account"),
+        G_CALLBACK (gnc_plugin_page_register2_cmd_find_account)
+    },
+    {
+        "EditFindTransactionsAction", "edit-find", N_("_Find..."), "<primary>f",
+        N_("Find transactions with a search"),
+        G_CALLBACK (gnc_plugin_page_register2_cmd_find_transactions)
+    },
+
+    /* Transaction menu */
+
+    {
+        "CutTransactionAction", "edit-cut", CUT_TRANSACTION_LABEL, "",
+        CUT_TRANSACTION_TIP,
+        G_CALLBACK (gnc_plugin_page_register2_cmd_cut_transaction)
+    },
+    {
+        "CopyTransactionAction", "edit-copy", COPY_TRANSACTION_LABEL, "",
+        COPY_TRANSACTION_TIP,
+        G_CALLBACK (gnc_plugin_page_register2_cmd_copy_transaction)
+    },
+    {
+        "PasteTransactionAction", "edit-paste", PASTE_TRANSACTION_LABEL, "",
+        PASTE_TRANSACTION_TIP,
+        G_CALLBACK (gnc_plugin_page_register2_cmd_paste_transaction)
+    },
+    {
+        "DuplicateTransactionAction", "edit-copy", DUPLICATE_TRANSACTION_LABEL, "",
+        DUPLICATE_TRANSACTION_TIP,
+        G_CALLBACK (gnc_plugin_page_register2_cmd_duplicate_transaction)
+    },
+    {
+        "DeleteTransactionAction", "edit-delete", DELETE_TRANSACTION_LABEL, NULL,
+        DELETE_TRANSACTION_TIP,
+        G_CALLBACK (gnc_plugin_page_register2_cmd_delete_transaction)
+    },
+    {
+        "RemoveTransactionSplitsAction", "edit-clear", N_("Remo_ve All Splits"), NULL,
+        N_("Remove all splits in the current transaction"),
+        G_CALLBACK (gnc_plugin_page_register2_cmd_reinitialize_transaction)
+    },
+    {
+        "RecordTransactionAction", "list-add", N_("_Enter Transaction"), NULL,
+        N_("Record the current transaction"),
+        G_CALLBACK (gnc_plugin_page_register2_cmd_enter_transaction)
+    },
+    {
+        "CancelTransactionAction", "process-stop", N_("Ca_ncel Transaction"), NULL,
+        N_("Cancel the current transaction"),
+        G_CALLBACK (gnc_plugin_page_register2_cmd_cancel_transaction)
+    },
+    {
+        "VoidTransactionAction", NULL, N_("_Void Transaction"), NULL, NULL,
+        G_CALLBACK (gnc_plugin_page_register2_cmd_void_transaction)
+    },
+    {
+        "UnvoidTransactionAction", NULL, N_("_Unvoid Transaction"), NULL, NULL,
+        G_CALLBACK (gnc_plugin_page_register2_cmd_unvoid_transaction)
+    },
+    {
+        "ReverseTransactionAction", NULL, N_("Add _Reversing Transaction"), NULL, NULL,
+        G_CALLBACK (gnc_plugin_page_register2_cmd_reverse_transaction)
+    },
+    {
+        TRANSACTION_UP_ACTION, "go-up", N_("Move Transaction _Up"), NULL,
+        N_("Move the current transaction one row upwards. Only available if the date and number of both rows are identical and the register window is sorted by date."),
+        G_CALLBACK (gnc_plugin_page_register2_cmd_entryUp)
+    },
+    {
+        TRANSACTION_DOWN_ACTION, "go-down", N_("Move Transaction Do_wn"), NULL,
+        N_("Move the current transaction one row downwards. Only available if the date and number of both rows are identical and the register window is sorted by date."),
+        G_CALLBACK (gnc_plugin_page_register2_cmd_entryDown)
+    },
+
+    /* View menu */
+
+    {
+        "ViewFilterByAction", NULL, N_("_Filter By..."), NULL, NULL,
+        G_CALLBACK (gnc_plugin_page_register2_cmd_view_filter_by)
+    },
+    {
+        "ViewRefreshAction", "view-refresh", N_("_Refresh"), "<primary>r",
+        N_("Refresh this window"),
+        G_CALLBACK (gnc_plugin_page_register2_cmd_reload)
+    },
+
+    /* Actions menu */
+
+    {
+        "ActionsTransferAction", GNC_ICON_TRANSFER, N_("_Transfer..."), "<primary>t",
+        N_("Transfer funds from one account to another"),
+        G_CALLBACK (gnc_plugin_page_register2_cmd_transfer)
+    },
+    {
+        "ActionsReconcileAction", "edit-select-all", N_("_Reconcile..."), NULL,
+        N_("Reconcile the selected account"),
+        G_CALLBACK (gnc_plugin_page_register2_cmd_reconcile)
+    },
+    {
+        "ActionsAutoClearAction", "edit-select-all", N_("_Auto-clear..."), NULL,
+        N_("Automatically clear individual transactions, so as to reach a certain cleared amount"),
+        G_CALLBACK (gnc_plugin_page_register2_cmd_autoclear)
+    },
+    {
+        "ActionsStockSplitAction", NULL, N_("Stoc_k Split..."), NULL,
+        N_("Record a stock split or a stock merger"),
+        G_CALLBACK (gnc_plugin_page_register2_cmd_stock_split)
+    },
+    {
+        "ActionsLotsAction", NULL, N_("View _Lots..."), NULL,
+        N_("Bring up the lot viewer/editor window"),
+        G_CALLBACK (gnc_plugin_page_register2_cmd_lots)
+    },
+    {
+        "BlankTransactionAction", "go-bottom", N_("_Blank Transaction"), "<primary>Page_Down",
+        N_("Move to the blank transaction at the bottom of the register"),
+        G_CALLBACK (gnc_plugin_page_register2_cmd_blank_transaction)
+    },
+    {
+        "EditExchangeRateAction", NULL, N_("Edit E_xchange Rate"), NULL,
+        N_("Edit the exchange rate for the current transaction"),
+        G_CALLBACK (gnc_plugin_page_register2_cmd_exchange_rate)
+    },
+    {
+        "JumpTransactionAction", GNC_ICON_JUMP_TO, N_("_Jump"), NULL,
+        N_("Jump to the corresponding transaction in the other account"),
+        G_CALLBACK (gnc_plugin_page_register2_cmd_jump)
+    },
+    {
+        "ScheduleTransactionAction", GNC_ICON_SCHEDULE, N_("Sche_dule..."), NULL,
+        N_("Create a Scheduled Transaction with the current transaction as a template"),
+        G_CALLBACK (gnc_plugin_page_register2_cmd_schedule)
+    },
+    {
+        "ScrubAllAction", NULL, N_("_All transactions"), NULL, NULL,
+        G_CALLBACK (gnc_plugin_page_register2_cmd_scrub_all)
+    },
+    {
+        "ScrubCurrentAction", NULL, N_("_This transaction"), NULL, NULL,
+        G_CALLBACK (gnc_plugin_page_register2_cmd_scrub_current)
+    },
+
+    /* Reports menu */
+
+    {
+        "ReportsAccountReportAction", NULL, N_("Account Report"), NULL,
+        N_("Open a register report for this Account"),
+        G_CALLBACK (gnc_plugin_page_register2_cmd_account_report)
+    },
+    {
+        "ReportsAcctTransReportAction", NULL, N_("Account Report - Single Transaction"), NULL,
+        N_("Open a register report for the selected Transaction"),
+        G_CALLBACK (gnc_plugin_page_register2_cmd_transaction_report)
+    },
+};
+
+static guint gnc_plugin_page_register2_n_actions = G_N_ELEMENTS (gnc_plugin_page_register2_actions);
+
+static GtkToggleActionEntry toggle_entries[] =
+{
+    {
+        "ViewStyleDoubleLineAction", NULL, N_("_Double Line"), NULL,
+        N_("Show two lines of information for each transaction"),
+        G_CALLBACK (gnc_plugin_page_register2_cmd_style_double_line), FALSE
+    },
+
+    {
+        "ViewStyleExtraDatesAction", NULL, N_("Show _Extra Dates"), NULL,
+        N_("Show entered and reconciled dates"),
+        G_CALLBACK (gnc_plugin_page_register2_cmd_style_extra_dates), FALSE
+    },
+
+    {
+        "SplitTransactionAction", GNC_ICON_SPLIT_TRANS, N_("S_plit Transaction"), NULL,
+        N_("Show all splits in the current transaction"),
+        G_CALLBACK (gnc_plugin_page_register2_cmd_expand_transaction), FALSE
+    },
+};
+
+static guint n_toggle_entries = G_N_ELEMENTS (toggle_entries);
+
+static GtkRadioActionEntry radio_entries_2 [] =
+{
+    /* Translators: This is a menu item in the View menu */
+    {
+        "ViewStyleBasicAction", NULL, N_("_Basic Ledger"), NULL,
+        N_("Show transactions on one or two lines"), REG2_STYLE_LEDGER
+    },
+    /* Translators: This is a menu item in the View menu */
+    {
+        "ViewStyleAutoSplitAction", NULL, N_("_Auto-Split Ledger"), NULL,
+        N_("Show transactions on one or two lines and expand the current transaction"), REG2_STYLE_AUTO_LEDGER
+    },
+    /* Translators: This is a menu item in the View menu */
+    {
+        "ViewStyleJournalAction", NULL, N_("Transaction _Journal"), NULL,
+        N_("Show expanded transactions with all splits"), REG2_STYLE_JOURNAL
+    }
+};
+
+static guint n_radio_entries_2 = G_N_ELEMENTS (radio_entries_2);
+
+/** These are the "important" actions provided by the register page.
+ *  Their labels will appear when the toolbar is set to "Icons and
+ *  important text" (e.g. GTK_TOOLBAR_BOTH_HORIZ) mode. */
+static const gchar *important_actions[] =
+{
+    "SplitTransactionAction",
+    NULL,
+};
+
+/** Actions that require an account to be selected before they are
+ *  enabled. */
+static const gchar *actions_requiring_account[] =
+{
+    "EditEditAccountAction",
+    "ActionsReconcileAction",
+    "ActionsAutoClearAction",
+    "ActionsLotsAction",
+    NULL
+};
+
+/** View Style actions */
+static const gchar *view_style_actions[] =
+{
+    "ViewStyleBasicAction",
+    "ViewStyleAutoSplitAction",
+    "ViewStyleJournalAction",
+    NULL
+};
+
+/** Short labels for use on the toolbar buttons. */
+static action_toolbar_labels toolbar_labels[] =
+{
+    { "ActionsTransferAction", 	  N_("Transfer") },
+    { "RecordTransactionAction", 	  N_("Enter") },
+    { "CancelTransactionAction", 	  N_("Cancel") },
+    { "DeleteTransactionAction", 	  N_("Delete") },
+    { "DuplicateTransactionAction", N_("Duplicate") },
+    { "SplitTransactionAction",     N_("Split") },
+    { "ScheduleTransactionAction",  N_("Schedule") },
+    { "BlankTransactionAction",     N_("Blank") },
+    { "ActionsReconcileAction",     N_("Reconcile") },
+    { "ActionsAutoClearAction",     N_("Auto-clear") },
+    { TRANSACTION_UP_ACTION, N_("Up") },
+    { TRANSACTION_DOWN_ACTION, N_("Down") },
+    { NULL, NULL },
+};
+
+struct status_action
+{
+    const char *action_name;
+    int value;
+    GtkWidget *widget;
+};
+
+static struct status_action status_actions[] =
+{
+    { "filter_status_reconciled",   CLEARED_RECONCILED, NULL },
+    { "filter_status_cleared",      CLEARED_CLEARED, NULL },
+    { "filter_status_voided",       CLEARED_VOIDED, NULL },
+    { "filter_status_frozen",       CLEARED_FROZEN, NULL },
+    { "filter_status_unreconciled", CLEARED_NO, NULL },
+    { NULL, 0, NULL },
+};
+
+#define CLEARED_VALUE "cleared_value"
+#define DEFAULT_FILTER "0x001f"
+
+/************************************************************/
+/*                      Data Structures                     */
+/************************************************************/
+
+typedef struct GncPluginPageRegister2Private
+{
+    GtkWidget *widget;
+
+    GNCLedgerDisplay2 *ledger;
+    GNCSplitReg2 *gsr;
+
+    gint event_handler_id;
+    gint component_manager_id;
+    GncGUID key;  /* The guid of the Account we're watching */
+
+    gint lines_default;
+    gboolean read_only;
+
+    struct
+    {
+        GtkWidget *dialog;
+        GtkWidget *table;
+        GtkWidget *start_date_choose;
+        GtkWidget *start_date_today;
+        GtkWidget *start_date;
+        GtkWidget *end_date_choose;
+        GtkWidget *end_date_today;
+        GtkWidget *end_date;
+        cleared_match_t original_cleared_match;
+        cleared_match_t cleared_match;
+        time64 original_start_time;
+        time64 original_end_time;
+        time64 start_time;
+        time64 end_time;
+        gboolean original_save_filter;
+        gboolean save_filter;
+    } fd;
+} GncPluginPageRegister2Private;
+
+#define GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(o)  \
+   (G_TYPE_INSTANCE_GET_PRIVATE ((o), GNC_TYPE_PLUGIN_PAGE_REGISTER2, GncPluginPageRegister2Private))
+
+static GObjectClass *parent_class = NULL;
+
+/************************************************************/
+/*                      Implementation                      */
+/************************************************************/
+
+GType
+gnc_plugin_page_register2_get_type (void)
+{
+    static GType gnc_plugin_page_register2_type = 0;
+
+    if (gnc_plugin_page_register2_type == 0)
+    {
+        static const GTypeInfo our_info =
+        {
+            sizeof (GncPluginPageRegister2Class),
+            NULL,
+            NULL,
+            (GClassInitFunc) gnc_plugin_page_register2_class_init,
+            NULL,
+            NULL,
+            sizeof (GncPluginPageRegister2),
+            0,
+            (GInstanceInitFunc) gnc_plugin_page_register2_init
+        };
+
+        gnc_plugin_page_register2_type = g_type_register_static (GNC_TYPE_PLUGIN_PAGE,
+                                        GNC_PLUGIN_PAGE_REGISTER2_NAME,
+                                        &our_info, 0);
+    }
+
+    return gnc_plugin_page_register2_type;
+}
+
+/*#################################################################################*/
+/*#################################################################################*/
+static GncPluginPage *
+gnc_plugin_page_register2_new_common (GNCLedgerDisplay2 *ledger)
+{
+    GncPluginPageRegister2 *register_page;
+    GncPluginPageRegister2Private *priv;
+    GncPluginPage *plugin_page;
+
+    GNCSplitReg2 *gsr;
+
+    const GList *item;
+    GList *book_list;
+    gchar *label;
+    gchar *label_color;
+    QofQuery *q;
+
+    /* Is there an existing page? */
+    gsr = gnc_ledger_display2_get_user_data (ledger);
+    if (gsr)
+    {
+        item = gnc_gobject_tracking_get_list (GNC_PLUGIN_PAGE_REGISTER2_NAME);
+        for ( ; item; item = g_list_next (item))
+        {
+            register_page = (GncPluginPageRegister2 *)item->data;
+            priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (register_page);
+            if (priv->gsr == gsr)
+                return GNC_PLUGIN_PAGE (register_page);
+        }
+    }
+
+    register_page = g_object_new (GNC_TYPE_PLUGIN_PAGE_REGISTER2, NULL);
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (register_page);
+    priv->ledger = ledger;
+    priv->key = *guid_null();
+
+    plugin_page = GNC_PLUGIN_PAGE (register_page);
+    label = gnc_plugin_page_register2_get_tab_name (plugin_page);
+    gnc_plugin_page_set_page_name (plugin_page, label);
+    g_free (label);
+
+    label_color = gnc_plugin_page_register2_get_tab_color (plugin_page);
+    gnc_plugin_page_set_page_color (plugin_page, label_color);
+    g_free (label_color);
+
+    label = gnc_plugin_page_register2_get_long_name (plugin_page);
+    gnc_plugin_page_set_page_long_name (plugin_page, label);
+    g_free (label);
+
+    q = gnc_ledger_display2_get_query (ledger);
+    book_list = qof_query_get_books (q);
+    for (item = book_list; item; item = g_list_next (item))
+        gnc_plugin_page_add_book (plugin_page, (QofBook *)item->data);
+    // Do not free the list. It is owned by the query.
+
+    priv->component_manager_id = 0;
+    return plugin_page;
+}
+
+/*#################################################################################*/
+
+GncPluginPage *
+gnc_plugin_page_register2_new (Account *account, gboolean subaccounts)
+{
+    GNCLedgerDisplay2 *ledger;
+    GncPluginPage *page;
+    GncPluginPageRegister2Private *priv;
+
+/*################## Added for Reg2 #################*/
+    const GList *item;
+    GncPluginPageRegister  *old_register_page;
+/*################## Added for Reg2 #################*/
+
+    ENTER("account=%p, subaccounts=%s", account,
+          subaccounts ? "TRUE" : "FALSE");
+
+/*################## Added for Reg2 #################*/
+    // We test for the old register being open here, ie matching account guids
+    item = gnc_gobject_tracking_get_list (GNC_PLUGIN_PAGE_REGISTER_NAME);
+    for ( ; item; item = g_list_next (item))
+    {
+        Account *old_account;
+        old_register_page = (GncPluginPageRegister *)item->data;
+        old_account = gnc_plugin_page_register_get_account (old_register_page);
+
+        if (guid_equal (xaccAccountGetGUID (account), xaccAccountGetGUID (old_account)))
+        {
+            gnc_error_dialog (NULL, "%s",
+                         _("You have tried to open an account in the new register while it is open in the old register."));
+            return NULL;
+        }
+    }
+/*################## Added for Reg2 #################*/
+
+    if (subaccounts)
+        ledger = gnc_ledger_display2_subaccounts (account);
+    else
+        ledger = gnc_ledger_display2_simple (account);
+
+    page = gnc_plugin_page_register2_new_common (ledger);
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (page);
+    priv->key = *xaccAccountGetGUID (account);
+
+    LEAVE("%p", page);
+    return page;
+}
+
+GncPluginPage *
+gnc_plugin_page_register2_new_gl (void)
+{
+    GNCLedgerDisplay2 *ledger;
+
+    ledger = gnc_ledger_display2_gl ();
+    return gnc_plugin_page_register2_new_common (ledger);
+}
+
+GncPluginPage *
+gnc_plugin_page_register2_new_ledger (GNCLedgerDisplay2 *ledger)
+{
+    return gnc_plugin_page_register2_new_common (ledger);
+}
+
+static void
+gnc_plugin_page_register2_class_init (GncPluginPageRegister2Class *klass)
+{
+    GObjectClass *object_class = G_OBJECT_CLASS (klass);
+    GncPluginPageClass *gnc_plugin_class = GNC_PLUGIN_PAGE_CLASS(klass);
+
+    parent_class = g_type_class_peek_parent (klass);
+
+    object_class->finalize = gnc_plugin_page_register2_finalize;
+
+    gnc_plugin_class->tab_icon        = GNC_ICON_ACCOUNT;
+    gnc_plugin_class->plugin_name     = GNC_PLUGIN_PAGE_REGISTER2_NAME;
+    gnc_plugin_class->create_widget   = gnc_plugin_page_register2_create_widget;
+    gnc_plugin_class->destroy_widget  = gnc_plugin_page_register2_destroy_widget;
+    gnc_plugin_class->window_changed  = gnc_plugin_page_register2_window_changed;
+    gnc_plugin_class->save_page       = gnc_plugin_page_register2_save_page;
+    gnc_plugin_class->recreate_page   = gnc_plugin_page_register2_recreate_page;
+    gnc_plugin_class->update_edit_menu_actions = gnc_plugin_page_register2_update_edit_menu;
+    gnc_plugin_class->finish_pending  = gnc_plugin_page_register2_finish_pending;
+
+    g_type_class_add_private(klass, sizeof(GncPluginPageRegister2Private));
+
+    gnc_ui_register_account_destroy_callback (gppr_account_destroy_cb);
+}
+
+static void
+gnc_plugin_page_register2_init (GncPluginPageRegister2 *plugin_page)
+{
+    GncPluginPageRegister2Private *priv;
+    GncPluginPage *parent;
+    GtkActionGroup *action_group;
+    gboolean use_new;
+
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(plugin_page);
+
+    /* Init parent declared variables */
+    parent = GNC_PLUGIN_PAGE(plugin_page);
+    use_new = gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL_REGISTER, GNC_PREF_USE_NEW);
+    g_object_set(G_OBJECT(plugin_page),
+                 "page-name",      _("General Journal2"),
+                 "page-uri",       "default:",
+                 "ui-description", "gnc-plugin-page-register2-ui.xml",
+                 "use-new-window", use_new,
+                 NULL);
+
+    /* Create menu and toolbar information */
+    action_group =
+        gnc_plugin_page_create_action_group(parent,
+                                            "GncPluginPageRegister2Actions");
+    gtk_action_group_add_actions (action_group, gnc_plugin_page_register2_actions,
+                                  gnc_plugin_page_register2_n_actions, plugin_page);
+    gtk_action_group_add_toggle_actions (action_group,
+                                         toggle_entries, n_toggle_entries,
+                                         plugin_page);
+    gtk_action_group_add_radio_actions (action_group,
+                                        radio_entries_2, n_radio_entries_2,
+                                        REG2_STYLE_LEDGER,
+                                        G_CALLBACK(gnc_plugin_page_register2_cmd_style_changed),
+                                        plugin_page);
+
+    gnc_plugin_init_short_names (action_group, toolbar_labels);
+    gnc_plugin_set_important_actions (action_group, important_actions);
+
+    priv->lines_default     = DEFAULT_LINES_AMOUNT;
+    priv->read_only         = FALSE;
+    priv->fd.cleared_match  = CLEARED_ALL;
+}
+
+static void
+gnc_plugin_page_register2_finalize (GObject *object)
+{
+    GncPluginPageRegister2 *page;
+
+    ENTER("object %p", object);
+    page = GNC_PLUGIN_PAGE_REGISTER2 (object);
+
+    g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (page));
+
+    G_OBJECT_CLASS (parent_class)->finalize (object);
+    LEAVE(" ");
+}
+
+Account *
+gnc_plugin_page_register2_get_account (GncPluginPageRegister2 *page)
+{
+    GncPluginPageRegister2Private *priv;
+    GNCLedgerDisplay2Type ledger_type;
+    Account *leader;
+
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(page);
+    ledger_type = gnc_ledger_display2_type (priv->ledger);
+    leader = gnc_ledger_display2_leader (priv->ledger);
+
+    if ((ledger_type == LD2_SINGLE) || (ledger_type == LD2_SUBACCOUNT))
+        return leader;
+    return NULL;
+}
+
+/* This is the list of actions which are switched inactive in a read-only book. */
+static const char* readonly_inactive_actions[] =
+{
+    "EditCutAction",
+    "EditPasteAction",
+    "CutTransactionAction",
+    "PasteTransactionAction",
+    TRANSACTION_UP_ACTION,
+    TRANSACTION_DOWN_ACTION,
+    "DuplicateTransactionAction",
+    "DeleteTransactionAction",
+    "RemoveTransactionSplitsAction",
+    "RecordTransactionAction",
+    "CancelTransactionAction",
+    "UnvoidTransactionAction",
+    "VoidTransactionAction",
+    "ReverseTransactionAction",
+    "ActionsTransferAction",
+    "ActionsReconcileAction",
+    "ActionsStockSplitAction",
+    "ScheduleTransactionAction",
+    "ScrubAllAction",
+    "ScrubCurrentAction",
+    NULL
+};
+
+/* This is the list of actions whose text needs to be changed based on whether */
+/* the current cursor class is transaction or split. */
+static const char* tran_vs_split_actions[] =
+{
+    "CutTransactionAction",
+    "CopyTransactionAction",
+    "PasteTransactionAction",
+    "DuplicateTransactionAction",
+    "DeleteTransactionAction",
+    NULL
+};
+
+/* This is the list of labels for when the current cursor class is transaction. */
+static const char* tran_action_labels[] =
+{
+    CUT_TRANSACTION_LABEL,
+    COPY_TRANSACTION_LABEL,
+    PASTE_TRANSACTION_LABEL,
+    DUPLICATE_TRANSACTION_LABEL,
+    DELETE_TRANSACTION_LABEL,
+    NULL
+};
+
+/* This is the list of tooltips for when the current cursor class is transaction. */
+static const char* tran_action_tips[] =
+{
+    CUT_TRANSACTION_TIP,
+    COPY_TRANSACTION_TIP,
+    PASTE_TRANSACTION_TIP,
+    DUPLICATE_TRANSACTION_TIP,
+    DELETE_TRANSACTION_TIP,
+    NULL
+};
+
+/* This is the list of labels for when the current cursor class is split. */
+static const char* split_action_labels[] =
+{
+    CUT_SPLIT_LABEL,
+    COPY_SPLIT_LABEL,
+    PASTE_SPLIT_LABEL,
+    DUPLICATE_SPLIT_LABEL,
+    DELETE_SPLIT_LABEL,
+    NULL
+};
+
+/* This is the list of tooltips for when the current cursor class is split. */
+static const char* split_action_tips[] =
+{
+    CUT_SPLIT_TIP,
+    COPY_SPLIT_TIP,
+    PASTE_SPLIT_TIP,
+    DUPLICATE_SPLIT_TIP,
+    DELETE_SPLIT_TIP,
+    NULL
+};
+
+static void
+gnc_plugin_page_register2_ui_update (gpointer various, GncPluginPageRegister2 *page) // this works
+{
+    GncPluginPageRegister2Private *priv;
+    GncTreeViewSplitReg *view;
+    GncTreeModelSplitReg *model;
+    GtkAction *action;
+    gboolean expanded, voided;
+    Transaction *trans;
+
+    /* Set 'Split Transaction' */
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (page);
+    g_return_if_fail(priv);
+    model = gnc_ledger_display2_get_split_model_register (priv->ledger);
+    view = gnc_ledger_display2_get_split_view_register (priv->ledger);
+    g_return_if_fail(model);
+    g_return_if_fail(view);
+
+    expanded = gnc_tree_view_split_reg_trans_expanded (view, NULL);
+    action = gnc_plugin_page_get_action (GNC_PLUGIN_PAGE (page),
+                                         "SplitTransactionAction");
+    gtk_action_set_sensitive (action, model->style == REG2_STYLE_LEDGER);
+    g_signal_handlers_block_by_func
+    (action, gnc_plugin_page_register2_cmd_expand_transaction, page);
+    gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), expanded);
+    g_signal_handlers_unblock_by_func
+    (action, gnc_plugin_page_register2_cmd_expand_transaction, page);
+
+    /* Set 'Void' and 'Unvoid' */
+    trans = gnc_tree_view_split_reg_get_current_trans (view);
+    voided = xaccTransHasSplitsInState (trans, VREC); 
+
+    action = gnc_plugin_page_get_action (GNC_PLUGIN_PAGE (page),
+                                         "VoidTransactionAction");
+    gtk_action_set_sensitive (GTK_ACTION (action), !voided);
+
+    action = gnc_plugin_page_get_action (GNC_PLUGIN_PAGE (page),
+                                         "UnvoidTransactionAction");
+    gtk_action_set_sensitive (GTK_ACTION (action), voided);
+
+    /* Modify the activeness of the up/down arrows */
+    {
+        GtkAction *action = gnc_plugin_page_get_action (GNC_PLUGIN_PAGE (page), TRANSACTION_UP_ACTION);
+        gtk_action_set_sensitive(action,
+                                 gnc_tree_control_split_reg_is_current_movable_updown(view, TRUE));
+        action = gnc_plugin_page_get_action (GNC_PLUGIN_PAGE (page), TRANSACTION_DOWN_ACTION);
+        gtk_action_set_sensitive(action,
+                                 gnc_tree_control_split_reg_is_current_movable_updown(view, FALSE));
+    }
+
+    /* If we are in a readonly book, make any modifying action inactive */
+    if (qof_book_is_readonly(gnc_get_current_book ()))
+    {
+        const char **iter;
+        for (iter = readonly_inactive_actions; *iter; ++iter)
+        {
+            /* Set the action's sensitivity */
+            GtkAction *action = gnc_plugin_page_get_action (GNC_PLUGIN_PAGE (page), *iter);
+            gtk_action_set_sensitive (action, FALSE);
+        }
+    }
+
+    /* Modifying action descriptions based on row depth */
+    {
+        RowDepth depth;
+        const char **iter, **label_iter, **tooltip_iter;
+        gboolean curr_label_trans = FALSE;
+        depth = gnc_tree_view_reg_get_selected_row_depth (view);
+        iter = tran_vs_split_actions;
+        action = gnc_plugin_page_get_action (GNC_PLUGIN_PAGE (page), *iter);
+        label_iter = tran_action_labels;
+        if (g_strcmp0 (gtk_action_get_label (action), _(*label_iter)) == 0)
+            curr_label_trans = TRUE;
+        if ((depth == SPLIT3) && curr_label_trans)
+        {
+            label_iter = split_action_labels;
+            tooltip_iter = split_action_tips;
+            for (iter = tran_vs_split_actions; *iter; ++iter)
+            {
+                /* Adjust the action's label and tooltip */
+                action = gnc_plugin_page_get_action (GNC_PLUGIN_PAGE (page), *iter);
+                gtk_action_set_label (action, _(*label_iter));
+                gtk_action_set_tooltip (action, _(*tooltip_iter));
+                ++label_iter;
+                ++tooltip_iter;
+            }
+        }
+        else if ((depth == TRANS1 || depth == TRANS2) && !curr_label_trans)
+        {
+            label_iter = tran_action_labels;
+            tooltip_iter = tran_action_tips;
+            for (iter = tran_vs_split_actions; *iter; ++iter)
+            {
+                /* Adjust the action's label and tooltip */
+                action = gnc_plugin_page_get_action (GNC_PLUGIN_PAGE (page), *iter);
+                gtk_action_set_label (action, _(*label_iter));
+                gtk_action_set_tooltip (action, _(*tooltip_iter));
+                ++label_iter;
+                ++tooltip_iter;
+            }
+        }
+    }
+}
+
+static void
+gnc_plugin_page_register2_ui_initial_state (GncPluginPageRegister2 *page) // this works
+{
+    GncPluginPageRegister2Private *priv ;
+    GtkActionGroup *action_group;
+    GtkAction *action;
+    Account *account;
+    GncTreeViewSplitReg *view;
+    GncTreeModelSplitReg *model;
+    GNCLedgerDisplay2Type ledger_type;
+    int i;
+    gboolean is_readwrite = !qof_book_is_readonly (gnc_get_current_book());
+
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (page);
+    account = gnc_plugin_page_register2_get_account (page);
+    action_group = gnc_plugin_page_get_action_group (GNC_PLUGIN_PAGE (page));
+    gnc_plugin_update_actions(action_group, actions_requiring_account,
+                              "sensitive", is_readwrite && account != NULL);
+
+    /* Set "style" radio button */
+    ledger_type = gnc_ledger_display2_type (priv->ledger);
+    gnc_plugin_update_actions (action_group, view_style_actions,
+                              "sensitive", ledger_type == LD2_SINGLE);
+
+    model = gnc_ledger_display2_get_split_model_register (priv->ledger);
+    for (i = n_radio_entries_2 - 1; i > 0; i--)
+    {
+        DEBUG(" index %d: comparing %x to %x", i, radio_entries_2[i].value,
+              model->style);
+        if (radio_entries_2[i].value == model->style)
+        {
+            DEBUG("match");
+            break;
+        }
+    }
+
+    /* Either a match was found, or fell out with i = 0 */
+    action = gtk_action_group_get_action (action_group, radio_entries_2[i].name);
+    g_signal_handlers_block_by_func (action, gnc_plugin_page_register2_cmd_style_changed, page);
+    gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), TRUE);
+    g_signal_handlers_unblock_by_func (action, gnc_plugin_page_register2_cmd_style_changed, page);
+
+    view = gnc_split_reg2_get_register (priv->gsr);
+
+    /* Set "double line" toggle button */
+    action = gtk_action_group_get_action (action_group, "ViewStyleDoubleLineAction");
+    g_signal_handlers_block_by_func (action, gnc_plugin_page_register2_cmd_style_double_line, page);
+    gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), model->use_double_line);
+    g_signal_handlers_unblock_by_func (action, gnc_plugin_page_register2_cmd_style_double_line, page);
+
+    /* Set "extra dates" toggle button */
+    action = gtk_action_group_get_action (action_group, "ViewStyleExtraDatesAction");
+    g_signal_handlers_block_by_func (action, gnc_plugin_page_register2_cmd_style_extra_dates, page);
+    gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), view->show_extra_dates);
+    g_signal_handlers_unblock_by_func (action, gnc_plugin_page_register2_cmd_style_extra_dates, page);
+}
+
+
+/*#################################################################################*/
+/*#################################################################################*/
+/* Virtual Functions */
+
+static GtkWidget *
+gnc_plugin_page_register2_create_widget (GncPluginPage *plugin_page)
+{
+    GncPluginPageRegister2 *page;
+    GncPluginPageRegister2Private *priv;
+    GNCLedgerDisplay2Type ledger_type;
+    GncWindow *gnc_window;
+    guint numRows;
+    GtkWidget *gsr;
+
+    GncTreeViewSplitReg *view;
+    GncTreeModelSplitReg *model;
+    Account *acct;
+    gchar **filter;
+    int filter_changed = 0;
+
+    ENTER("page %p", plugin_page);
+    page = GNC_PLUGIN_PAGE_REGISTER2 (plugin_page);
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (page);
+    if (priv->widget != NULL)
+    {
+        LEAVE("existing widget %p", priv->widget);
+        return priv->widget;
+    }
+
+    priv->widget = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
+    gtk_box_set_homogeneous (GTK_BOX (priv->widget), FALSE);
+    gtk_widget_show (priv->widget);
+
+    // Set the style context for this page so it can be easily manipulated with css
+    gnc_widget_set_style_context (GTK_WIDGET(priv->widget), "GncRegisterPage");
+
+    numRows = priv->lines_default;
+    numRows = MIN (numRows, DEFAULT_LINES_AMOUNT);
+
+    gnc_window = GNC_WINDOW (GNC_PLUGIN_PAGE (page)->window);
+
+    gsr = gnc_split_reg2_new (priv->ledger,
+                            gnc_window_get_gtk_window (gnc_window),
+                            numRows, priv->read_only);
+    priv->gsr = (GNCSplitReg2 *)gsr;
+    gtk_widget_show (gsr);
+
+    gtk_box_pack_start (GTK_BOX (priv->widget), gsr, TRUE, TRUE, 0);
+
+    g_signal_connect (G_OBJECT (gsr), "help-changed",
+                      G_CALLBACK (gnc_plugin_page_help_changed_cb),
+                      page );
+
+    view = gnc_split_reg2_get_register (priv->gsr);
+
+    // Callback for right mouse events
+    g_signal_connect (G_OBJECT (GTK_TREE_VIEW (view)), "button-press-event",
+                      G_CALLBACK (gnc_plugin_page_register2_button_press_cb), page);
+
+    model = gnc_ledger_display2_get_split_model_register (priv->ledger);
+
+    gnc_tree_model_split_reg_config (model, model->type, model->style, model->use_double_line);
+
+    gnc_plugin_page_register2_ui_initial_state (page);
+    gnc_plugin_page_register2_ui_update (NULL, page);
+
+    ledger_type = gnc_ledger_display2_type (priv->ledger);
+
+    if (ledger_type == LD2_SINGLE || ledger_type == LD2_SUBACCOUNT || ledger_type == LD2_GL)
+    {
+        /* Set the filter for the split register and status of save filter button */
+        priv->fd.save_filter = FALSE;
+
+        filter = g_strsplit(gnc_plugin_page_register2_get_filter (plugin_page), ",", -1);
+
+        PINFO("Loaded Filter Status is %s", filter[0]);
+
+        priv->fd.cleared_match = (gint)g_ascii_strtoll (filter[0], NULL, 16 );
+
+        if (filter[0] && (g_strcmp0 (filter[0], DEFAULT_FILTER) != 0))
+            filter_changed = filter_changed + 1;
+
+        if (filter[1] && (g_strcmp0 (filter[1], "0") != 0 ))
+        {
+            PINFO("Loaded Filter Start Date is %s", filter[1]);
+
+            priv->fd.start_time = gnc_plugin_page_register2_filter_dmy2time (filter[1]);
+            priv->fd.start_time = gnc_time64_get_day_start (priv->fd.start_time);
+            filter_changed = filter_changed + 1;
+
+            if (filter[2] && (g_strcmp0 (filter[2], "0") != 0 ))
+            {
+                PINFO("Loaded Filter End Date is %s", filter[2]);
+
+                priv->fd.end_time = gnc_plugin_page_register2_filter_dmy2time (filter[2]);
+                priv->fd.end_time = gnc_time64_get_day_end (priv->fd.end_time);
+                filter_changed = filter_changed + 1;
+            }
+        }
+
+        if (filter_changed != 0)
+            priv->fd.save_filter = TRUE;
+
+        priv->fd.original_save_filter = priv->fd.save_filter;
+        g_strfreev (filter);
+
+        /* Update Query with Filter Status and Dates */
+        gnc_ppr_update_status_query (page, FALSE);
+        gnc_ppr_update_date_query (page, FALSE);
+    }
+
+//FIXME may change, can we load filter at same time of sort so we do one querry on load
+    gnc_ledger_display2_refresh (priv->ledger);
+
+    /* This sets the default selection on load, not required for templates */
+    if (!gnc_tree_model_split_reg_get_template (model))
+       gnc_tree_view_split_reg_default_selection (view);
+
+    plugin_page->summarybar = gnc_split_reg2_create_summary_bar (priv->gsr);
+    if (plugin_page->summarybar)
+    {
+        gtk_widget_show_all (plugin_page->summarybar);
+        gtk_box_pack_start (GTK_BOX (priv->widget), plugin_page->summarybar,
+                           FALSE, FALSE, 0);
+        gnc_plugin_page_register2_summarybar_position_changed (NULL, NULL, page);
+        gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL,
+                               GNC_PREF_SUMMARYBAR_POSITION_TOP,
+                               gnc_plugin_page_register2_summarybar_position_changed,
+                               page);
+        gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL,
+                               GNC_PREF_SUMMARYBAR_POSITION_BOTTOM,
+                               gnc_plugin_page_register2_summarybar_position_changed,
+                               page);
+    }
+
+    priv->event_handler_id = qof_event_register_handler
+                             ((QofEventHandler)gnc_plugin_page_register2_event_handler, page);
+    priv->component_manager_id =
+        gnc_register_gui_component (GNC_PLUGIN_PAGE_REGISTER2_NAME,
+                                   gnc_plugin_page_register2_refresh_cb,
+                                   gnc_plugin_page_register2_close_cb,
+                                   page);
+    gnc_gui_component_set_session (priv->component_manager_id,
+                                   gnc_get_current_session());
+    acct = gnc_plugin_page_register2_get_account (page);
+    if (acct)
+        gnc_gui_component_watch_entity (
+            priv->component_manager_id, xaccAccountGetGUID (acct),
+            QOF_EVENT_DESTROY | QOF_EVENT_MODIFY);
+
+    /* This allows the plugin page to be updated from the view */
+    gnc_split_reg2_set_moved_cb
+    (priv->gsr, (GFunc)gnc_plugin_page_register2_ui_update, page);
+
+    LEAVE(" ");
+    return priv->widget;
+}
+
+/*#################################################################################*/
+
+/** This button press handler calls the common button press handler
+ *  for all pages.  The GtkTreeView eats all button presses and
+ *  doesn't pass them up the widget tree, even when doesn't do
+ *  anything with them.  The only way to get access to the button
+ *  presses in an account tree page is here on the tree view widget.
+ *  Button presses on all other pages are caught by the signal
+ *  registered in gnc-main-window.c. */
+static gboolean
+gnc_plugin_page_register2_button_press_cb (GtkWidget *widget,
+        GdkEventButton *event,
+        GncPluginPage *page)
+{
+
+    g_return_val_if_fail(GNC_IS_PLUGIN_PAGE(page), FALSE);
+
+    ENTER("widget %p, event %p, page %p", widget, event, page);
+    gnc_main_window_button_press_cb (widget, event, page);
+    LEAVE(" ");
+
+    /* Always return FALSE.  This will let the tree view callback run as
+     * well which will select the item under the cursor.  By the time
+     * the user sees the menu both callbacks will have run and the menu
+     * actions will operate on the just-selected account. */
+    return FALSE;
+}
+
+static void
+gnc_plugin_page_register2_destroy_widget (GncPluginPage *plugin_page)
+{
+    GncPluginPageRegister2 *page;
+    GncPluginPageRegister2Private *priv;
+
+    ENTER("page %p", plugin_page);
+    page = GNC_PLUGIN_PAGE_REGISTER2 (plugin_page);
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(plugin_page);
+
+    gnc_prefs_remove_cb_by_func (GNC_PREFS_GROUP_GENERAL,
+                                 GNC_PREF_SUMMARYBAR_POSITION_TOP,
+                                 gnc_plugin_page_register2_summarybar_position_changed,
+                                 page);
+    gnc_prefs_remove_cb_by_func (GNC_PREFS_GROUP_GENERAL,
+                                 GNC_PREF_SUMMARYBAR_POSITION_BOTTOM,
+                                 gnc_plugin_page_register2_summarybar_position_changed,
+                                 page);
+
+    if (priv->widget == NULL)
+    {
+        LEAVE(" ");
+        return;
+    }
+
+    if (priv->component_manager_id)
+    {
+        gnc_unregister_gui_component (priv->component_manager_id);
+        priv->component_manager_id = 0;
+    }
+
+    if (priv->event_handler_id)
+    {
+        qof_event_unregister_handler (priv->event_handler_id);
+        priv->event_handler_id = 0;
+    }
+
+    if (priv->fd.dialog)
+    {
+        gtk_widget_destroy (priv->fd.dialog);
+        memset(&priv->fd, 0, sizeof(priv->fd));
+    }
+
+    gtk_widget_hide (priv->widget);
+
+    if (priv->ledger)
+    {
+        gnc_ledger_display2_close (priv->ledger);
+        priv->ledger = NULL;
+    }
+
+    if (priv->widget)
+    {
+        g_object_unref (G_OBJECT(priv->widget));
+        priv->widget = NULL;
+    }
+    LEAVE(" ");
+}
+
+static void
+gnc_plugin_page_register2_window_changed (GncPluginPage *plugin_page,
+        GtkWidget *window) // this works
+{
+    GncPluginPageRegister2 *page;
+    GncPluginPageRegister2Private *priv;
+
+    g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (plugin_page));
+
+    page = GNC_PLUGIN_PAGE_REGISTER2 (plugin_page);
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (page);
+
+    priv->gsr->window =
+        GTK_WIDGET(gnc_window_get_gtk_window (GNC_WINDOW (window)));
+}
+
+static const gchar *style_names[] =
+{
+    "Ledger",
+    "Auto Ledger",
+    "Journal",
+    NULL
+};
+
+#define KEY_REGISTER_TYPE       "RegisterType"
+#define KEY_ACCOUNT_NAME        "AccountName"
+#define KEY_REGISTER_STYLE      "RegisterStyle"
+#define KEY_DOUBLE_LINE         "DoubleLineMode"
+#define KEY_EXTRA_DATES         "ExtraDatesMode"
+
+#define LABEL_ACCOUNT		"Account"
+#define LABEL_SUBACCOUNT	"SubAccount"
+#define LABEL_GL		"GL"
+#define LABEL_SEARCH		"Search"
+
+#define SPLIT_REGISTER_GUID "SplitRegister GUID"
+
+/** Save enough information about this register page that it can be
+ *  recreated next time the user starts gnucash.
+ *
+ *  @param plugin_page The page to save.
+ *
+ *  @param key_file A pointer to the GKeyFile data structure where the
+ *  page information should be written. gnc_plugin_page_register2_save_page
+ *
+ *  @param group_name The group name to use when saving data. */
+static void
+gnc_plugin_page_register2_save_page (GncPluginPage *plugin_page,
+                                    GKeyFile *key_file,
+                                    const gchar *group_name)
+{
+    GncPluginPageRegister2 *page;
+    GncPluginPageRegister2Private *priv;
+    GNCLedgerDisplay2Type ledger_type;
+    GncTreeViewSplitReg *view;
+    GncTreeModelSplitReg *model;
+    Account *leader;
+
+    g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (plugin_page));
+    g_return_if_fail (key_file != NULL);
+    g_return_if_fail (group_name != NULL);
+
+    ENTER("page %p, key_file %p, group_name %s", plugin_page, key_file,
+          group_name);
+
+    page = GNC_PLUGIN_PAGE_REGISTER2 (plugin_page);
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (page);
+
+    view = gnc_ledger_display2_get_split_view_register (priv->ledger);
+    model = gnc_ledger_display2_get_split_model_register (priv->ledger);
+    ledger_type = gnc_ledger_display2_type (priv->ledger);
+    if (ledger_type > LD2_GL)
+    {
+        LEAVE("Unsupported ledger type");
+        return;
+    }
+    if ((ledger_type == LD2_SINGLE) || (ledger_type == LD2_SUBACCOUNT))
+    {
+        const gchar *label;
+        gchar* name;
+        label = (ledger_type == LD2_SINGLE) ? LABEL_ACCOUNT : LABEL_SUBACCOUNT;
+        leader = gnc_ledger_display2_leader (priv->ledger);
+        g_key_file_set_string (key_file, group_name, KEY_REGISTER_TYPE, label);
+        name = gnc_account_get_full_name (leader);
+        g_key_file_set_string (key_file, group_name, KEY_ACCOUNT_NAME, name);
+        g_free (name);
+    }
+    else if (model->type == GENERAL_JOURNAL2)
+    {
+        g_key_file_set_string (key_file, group_name, KEY_REGISTER_TYPE,
+                              LABEL_GL);
+    }
+    else if (model->type == SEARCH_LEDGER2)
+    {
+        g_key_file_set_string (key_file, group_name, KEY_REGISTER_TYPE,
+                              LABEL_SEARCH);
+    }
+    else
+    {
+        LEAVE("Unsupported register type");
+        return;
+    }
+
+    g_key_file_set_string (key_file, group_name, KEY_REGISTER_STYLE, style_names[model->style]);
+    g_key_file_set_boolean (key_file, group_name, KEY_DOUBLE_LINE, model->use_double_line);
+    g_key_file_set_boolean (key_file, group_name, KEY_EXTRA_DATES, view->show_extra_dates);
+
+    LEAVE(" ");
+}
+
+/** Read and restore the edit menu settings on the specified register
+ *  page. This function will restore the register style (ledger, auto
+ *  ledger, journal) and whether or not the register is in double line
+ *  mode. It should eventually restore the "filter by" and "sort by"
+ *  mode.
+ *
+ *  @param page The register being restored.
+ *
+ *  @param key_file A pointer to the GKeyFile data structure where the
+ *  page information should be read.
+ *
+ *  @param group_name The group name to use when restoring data. */
+static void
+gnc_plugin_page_register2_restore_edit_menu (GncPluginPage *page,
+        GKeyFile *key_file,
+        const gchar *group_name)
+{
+    GtkAction *action;
+    GError *error = NULL;
+    gchar *style_name;
+    gint i;
+    gboolean use_double_line;
+    gboolean show_extra_dates;
+
+    ENTER(" ");
+
+    /* Convert the style name to an index */
+    style_name = g_key_file_get_string (key_file, group_name,
+                                       KEY_REGISTER_STYLE, &error);
+    for (i = 0 ; style_names[i]; i++)
+    {
+        if (g_ascii_strcasecmp (style_name, style_names[i]) == 0)
+        {
+            DEBUG("Found match for style name: %s", style_name);
+            break;
+        }
+    }
+    g_free (style_name);
+
+    /* Update the style menu action for this page */
+    if (i <= REG2_STYLE_JOURNAL)
+    {
+        DEBUG("Setting style: %d", i);
+        action = gnc_plugin_page_get_action (page, radio_entries_2[i].name);
+        gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), TRUE);
+    }
+
+    /* Update the double line action on this page */
+    use_double_line =
+        g_key_file_get_boolean (key_file, group_name, KEY_DOUBLE_LINE, &error);
+    DEBUG("Setting double_line_mode: %d", use_double_line);
+    action = gnc_plugin_page_get_action (page, "ViewStyleDoubleLineAction");
+    gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), use_double_line);
+
+    /* Update the extra dates action on this page */
+    show_extra_dates =
+        g_key_file_get_boolean (key_file, group_name, KEY_EXTRA_DATES, &error);
+    DEBUG("Setting extra_dates_mode: %d", show_extra_dates);
+    action = gnc_plugin_page_get_action (page, "ViewStyleExtraDatesAction");
+    gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), show_extra_dates);
+    LEAVE(" ");
+}
+
+/** Create a new register page based on the information saved during a
+ *  previous instantiation of gnucash.
+ *
+ *  @param window The window where this page should be installed.
+ *
+ *  @param key_file A pointer to the GKeyFile data structure where the
+ *  page information should be read.
+ *
+ *  @param group_name The group name to use when restoring data. */
+static GncPluginPage *
+gnc_plugin_page_register2_recreate_page (GtkWidget *window,
+                                        GKeyFile *key_file,
+                                        const gchar *group_name)
+{
+    GncPluginPage *page;
+    GError *error = NULL;
+    gchar *reg_type, *acct_name;
+    Account *account;
+    QofBook *book;
+    gboolean include_subs;
+
+    g_return_val_if_fail (key_file, NULL);
+    g_return_val_if_fail (group_name, NULL);
+    ENTER("key_file %p, group_name %s", key_file, group_name);
+
+    /* Create the new page. */
+    reg_type = g_key_file_get_string (key_file, group_name,
+                                     KEY_REGISTER_TYPE, &error);
+    DEBUG("Page type: %s", reg_type);
+    if ((g_ascii_strcasecmp (reg_type, LABEL_ACCOUNT) == 0) ||
+            (g_ascii_strcasecmp (reg_type, LABEL_SUBACCOUNT) == 0))
+    {
+        include_subs = (g_ascii_strcasecmp(reg_type, LABEL_SUBACCOUNT) == 0);
+        DEBUG("Include subs: %d", include_subs);
+        acct_name = g_key_file_get_string (key_file, group_name,
+                                          KEY_ACCOUNT_NAME, &error);
+        book = qof_session_get_book (gnc_get_current_session());
+        account = gnc_account_lookup_by_full_name (gnc_book_get_root_account(book),
+                  acct_name);
+        g_free (acct_name);
+        if (account == NULL)
+        {
+            LEAVE("Bad account name");
+            g_free (reg_type);
+            return NULL;
+        }
+        page = gnc_plugin_page_register2_new (account, include_subs);
+    }
+    else if (g_ascii_strcasecmp (reg_type, LABEL_GL) == 0)
+    {
+        page = gnc_plugin_page_register2_new_gl ();
+    }
+    else
+    {
+        LEAVE("Bad ledger type");
+        g_free (reg_type);
+        return NULL;
+    }
+    g_free (reg_type);
+
+    /* Recreate page in given window */
+    gnc_plugin_page_set_use_new_window (page, FALSE);
+
+    /* Install it now so we can them manipulate the created widget */
+    gnc_main_window_open_page (GNC_MAIN_WINDOW (window), page);
+
+    /* Now update the page to the last state it was in */
+    gnc_plugin_page_register2_restore_edit_menu (page, key_file, group_name);
+    LEAVE(" ");
+    return page;
+}
+
+
+/*
+ * Based on code from Epiphany (src/ephy-window.c)
+ */
+static void
+gnc_plugin_page_register2_update_edit_menu (GncPluginPage *page, gboolean hide) //this works
+{
+    GncPluginPageRegister2Private *priv;
+    GncPluginPageRegister2 *reg_page;
+    GncTreeViewSplitReg *view;
+    GtkAction *action;
+    gboolean can_copy = FALSE, can_cut = FALSE, can_paste = FALSE;
+    gboolean has_selection;
+    gboolean is_readwrite = !qof_book_is_readonly (gnc_get_current_book());
+    reg_page = GNC_PLUGIN_PAGE_REGISTER2 (page);
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (reg_page);
+    view = gnc_ledger_display2_get_split_view_register (priv->ledger);
+
+    // This is set while we are editing a cell
+    if (view->editing_now)
+        has_selection = TRUE;
+    else
+        has_selection = FALSE;
+
+    can_copy = has_selection;
+    can_cut = is_readwrite && has_selection;
+    can_paste = is_readwrite;
+
+    action = gnc_plugin_page_get_action (page, "EditCopyAction");
+    gtk_action_set_sensitive (action, can_copy);
+    gtk_action_set_visible (action, !hide || can_copy);
+    action = gnc_plugin_page_get_action (page, "EditCutAction");
+    gtk_action_set_sensitive (action, can_cut);
+    gtk_action_set_visible (action, !hide || can_cut);
+    action = gnc_plugin_page_get_action (page, "EditPasteAction");
+    gtk_action_set_sensitive (action, can_paste);
+    gtk_action_set_visible (action,  !hide || can_paste);
+}
+
+static gboolean
+gnc_plugin_page_register2_finish_pending (GncPluginPage *page) //this works
+{
+    GncPluginPageRegister2Private *priv;
+    GncPluginPageRegister2 *reg_page;
+    GncTreeViewSplitReg *view;
+    GtkWidget *dialog, *window;
+    const gchar *name;
+    gint response;
+
+    reg_page = GNC_PLUGIN_PAGE_REGISTER2 (page);
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (reg_page);
+    view = gnc_ledger_display2_get_split_view_register (priv->ledger);
+
+    /* Make sure we have stopped editing */
+    gnc_tree_view_split_reg_finish_edit (view);
+
+    if (!view || (gnc_tree_view_split_reg_get_dirty_trans (view) == NULL))
+        return TRUE;
+
+    name = gnc_plugin_page_register2_get_tab_name (page);
+    window = gnc_plugin_page_get_window (page);
+    dialog = gtk_message_dialog_new (GTK_WINDOW (window),
+                                    GTK_DIALOG_DESTROY_WITH_PARENT,
+                                    GTK_MESSAGE_WARNING,
+                                    GTK_BUTTONS_NONE,
+                                    /* Translators: %s is the name
+                                       of the tab page */
+                                    _("Save changes to %s?"), name);
+    gtk_message_dialog_format_secondary_text
+    (GTK_MESSAGE_DIALOG (dialog),
+     "%s",
+     _("This register has pending changes to a transaction. "
+       "Would you like to save the changes to this transaction, "
+       "discard the transaction, or cancel the operation?"));
+    gnc_gtk_dialog_add_button (dialog, _("_Discard Transaction"),
+                              "edit-delete", GTK_RESPONSE_REJECT);
+    gtk_dialog_add_button (GTK_DIALOG (dialog),
+                          _("_Cancel"), GTK_RESPONSE_CANCEL);
+    gnc_gtk_dialog_add_button (dialog, _("_Save Transaction"),
+                              "document-save", GTK_RESPONSE_ACCEPT);
+
+    response = gtk_dialog_run (GTK_DIALOG (dialog));
+    gtk_widget_destroy (dialog);
+
+    switch (response)
+    {
+    case GTK_RESPONSE_ACCEPT:
+        return (gnc_tree_control_split_reg_save (view, TRUE));
+
+    case GTK_RESPONSE_REJECT:
+        gnc_tree_control_split_reg_cancel_edit (view, TRUE);
+        return TRUE;
+
+    default:
+        return FALSE;
+    }
+}
+
+static gchar *
+gnc_plugin_page_register2_get_tab_name (GncPluginPage *plugin_page)
+{
+    GncPluginPageRegister2Private *priv;
+    GNCLedgerDisplay2Type ledger_type;
+    GNCLedgerDisplay2 *ld;
+    GncTreeModelSplitReg *model;
+    Account *leader;
+
+    g_return_val_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (plugin_page), _("unknown"));
+
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(plugin_page);
+    ld = priv->ledger;
+    model = gnc_ledger_display2_get_split_model_register(ld);
+    ledger_type = gnc_ledger_display2_type (ld);
+    leader = gnc_ledger_display2_leader (ld);
+
+    switch (ledger_type)
+    {
+    case LD2_SINGLE:
+        return g_strdup(xaccAccountGetName (leader));
+
+    case LD2_SUBACCOUNT:
+        return g_strdup_printf("%s+", xaccAccountGetName (leader));
+
+    case LD2_GL:
+        switch (model->type)
+        {
+        case GENERAL_JOURNAL:
+        case INCOME_LEDGER:
+            return g_strdup(_("General Journal"));
+        case PORTFOLIO_LEDGER:
+            return g_strdup(_("Portfolio"));
+        case SEARCH_LEDGER:
+            return g_strdup(_("Search Results"));
+        default:
+            break;
+        }
+        break;
+
+    default:
+        break;
+    }
+
+    return g_strdup(_("unknown"));
+}
+
+static gchar *
+gnc_plugin_page_register2_get_tab_color (GncPluginPage *plugin_page)
+{
+    GncPluginPageRegister2Private *priv;
+    GNCLedgerDisplay2Type ledger_type;
+    GNCLedgerDisplay2 *ld;
+    Account *leader;
+    const char* color;
+
+    g_return_val_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (plugin_page), _("unknown"));
+
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(plugin_page);
+    ld = priv->ledger;
+    ledger_type = gnc_ledger_display2_type (ld);
+    leader = gnc_ledger_display2_leader (ld);
+    color = NULL;
+
+    if ((ledger_type == LD2_SINGLE) || (ledger_type == LD2_SUBACCOUNT))
+        color = xaccAccountGetColor (leader);
+
+    return g_strdup(color ? color : "Not Set");
+}
+
+static gchar *
+gnc_plugin_page_register2_get_filter (GncPluginPage *plugin_page)
+{
+    GncPluginPageRegister2Private *priv;
+    GNCLedgerDisplay2Type ledger_type;
+    GNCLedgerDisplay2 *ld;
+    Account *leader;
+    const char* filter;
+
+    g_return_val_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (plugin_page), _("unknown"));
+
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(plugin_page);
+    ld = priv->ledger;
+    ledger_type = gnc_ledger_display2_type (ld);
+    leader = gnc_ledger_display2_leader (ld);
+    filter = NULL;
+
+    if ((ledger_type == LD2_SINGLE) || (ledger_type == LD2_SUBACCOUNT))
+        filter = xaccAccountGetFilter (leader);
+
+    return filter ? g_strdup(filter) : g_strdup_printf("%s,%s,%s", DEFAULT_FILTER, "0", "0");
+}
+
+void
+gnc_plugin_page_register2_set_filter (GncPluginPage *plugin_page, const gchar *filter )
+{
+    GncPluginPageRegister2Private *priv;
+    GNCLedgerDisplay2 *ld;
+    Account *leader;
+    gchar *default_filter;
+
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(plugin_page);
+    ld = priv->ledger;
+    leader = gnc_ledger_display2_leader (ld);
+
+    if (leader != NULL)
+    {
+        default_filter = g_strdup_printf("%s,%s,%s", DEFAULT_FILTER, "0", "0");
+
+        if (!filter || (g_strcmp0 (filter, default_filter) == 0))
+            xaccAccountSetFilter (leader, NULL);
+        else
+            xaccAccountSetFilter (leader, filter);
+
+        g_free (default_filter);
+    }
+    return;
+}
+
+static gchar *
+gnc_plugin_page_register2_get_long_name (GncPluginPage *plugin_page)
+{
+    GncPluginPageRegister2Private *priv;
+    GNCLedgerDisplay2Type ledger_type;
+    GNCLedgerDisplay2 *ld;
+    Account *leader;
+
+    g_return_val_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (plugin_page), _("unknown"));
+
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (plugin_page);
+    ld = priv->ledger;
+    ledger_type = gnc_ledger_display2_type (ld);
+    leader = gnc_ledger_display2_leader (ld);
+
+    switch (ledger_type)
+    {
+    case LD2_SINGLE:
+        return gnc_account_get_full_name (leader);
+
+    case LD2_SUBACCOUNT:
+    {
+        gchar *account_full_name = gnc_account_get_full_name (leader);
+        gchar *return_string = g_strdup_printf ("%s+", account_full_name);
+        g_free ((gpointer *) account_full_name);
+        return return_string;
+    }
+
+    default:
+        break;
+    }
+
+    return NULL;
+}
+
+static void
+gnc_plugin_page_register2_summarybar_position_changed (gpointer prefs, gchar* pref, gpointer user_data)
+{
+    GncPluginPage *plugin_page;
+    GncPluginPageRegister2 *page;
+    GncPluginPageRegister2Private *priv;
+    GtkPositionType position = GTK_POS_BOTTOM;
+
+    g_return_if_fail (user_data != NULL);
+
+    if (!GNC_IS_PLUGIN_PAGE (user_data))
+        return;
+
+    plugin_page = GNC_PLUGIN_PAGE (user_data);
+    page = GNC_PLUGIN_PAGE_REGISTER2 (user_data);
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (page);
+
+    if (priv == NULL)
+       return;
+
+    if (gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL, GNC_PREF_SUMMARYBAR_POSITION_TOP))
+        position = GTK_POS_TOP;
+
+    gtk_box_reorder_child (GTK_BOX (priv->widget),
+                          plugin_page->summarybar,
+                          (position == GTK_POS_TOP ? 0 : -1) );
+}
+
+/** This function is called to get the query associated with this
+ *  plugin page.
+ *
+ *  @param page A pointer to the GncPluginPage.
+ */
+Query *
+gnc_plugin_page_register2_get_query (GncPluginPage *plugin_page)
+{
+    GncPluginPageRegister2 *page;
+    GncPluginPageRegister2Private *priv;
+
+    g_return_val_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2(plugin_page), NULL);
+
+    page = GNC_PLUGIN_PAGE_REGISTER2 (plugin_page);
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(page);
+    return gnc_ledger_display2_get_query (priv->ledger);
+}
+
+/*#################################################################################*/
+/*#################################################################################*/
+
+/************************************************************/
+/*                    "Filter By" Dialog                    */
+/************************************************************/
+
+/** This function updates the "cleared match" term of the register
+ *  query.  It unconditionally removes any old "cleared match" query
+ *  term, then adds back a new query term if needed.  There seems to
+ *  be a bug in the current g2 register code such that when the number
+ *  of entries in the register doesn't fill up the window, the blank
+ *  space at the end of the window isn't correctly redrawn.  This
+ *  function works around that problem, but a root cause analysis
+ *  should probably be done.
+ *
+ *  @param page A pointer to the GncPluginPageRegister2 that is
+ *  associated with this filter dialog.
+ */
+static void
+gnc_ppr_update_status_query (GncPluginPageRegister2 *page, gboolean refresh_page)
+{
+    GncPluginPageRegister2Private *priv;
+    GSList *param_list;
+    Query *query;
+
+    ENTER(" ");
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (page);
+    query = gnc_ledger_display2_get_query (priv->ledger );
+    if (!query)
+    {
+        LEAVE("no query found");
+        return;
+    }
+
+    /* Remove the old status match */
+    param_list = qof_query_build_param_list (SPLIT_RECONCILE, NULL);
+    if (param_list)
+    {
+        qof_query_purge_terms (query, param_list);
+        g_slist_free(param_list);
+    }
+
+    /* Install the new status match */
+    if (priv->fd.cleared_match != CLEARED_ALL)
+        xaccQueryAddClearedMatch(query, priv->fd.cleared_match, QOF_QUERY_AND);
+
+    if (refresh_page)
+        gnc_ledger_display2_refresh (priv->ledger);
+    LEAVE(" ");
+}
+
+/** This function updates the "date posted" term of the register
+ *  query.  It unconditionally removes any old "date posted" query
+ *  term, then adds back a new query term if needed.  There seems to
+ *  be a bug in the current g2 register code such that when the number
+ *  of entries in the register doesn't fill up the window, the blank
+ *  space at the end of the window isn't correctly redrawn.  This
+ *  function works around that problem, but a root cause analysis
+ *  should probably be done.
+ *
+ *  @param page A pointer to the GncPluginPageRegister2 that is
+ *  associated with this filter dialog.
+ */
+static void
+gnc_ppr_update_date_query (GncPluginPageRegister2 *page, gboolean refresh_page)
+{
+    GncPluginPageRegister2Private *priv;
+    GSList *param_list;
+    Query *query;
+
+    ENTER(" ");
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (page);
+    if (!priv->ledger)
+    {
+        LEAVE("no ledger");
+        return;
+    }
+
+    query = gnc_ledger_display2_get_query (priv->ledger);
+    if (!query)
+    {
+        LEAVE("no query");
+        return;
+    }
+
+    /* Delete any existing old date spec. */
+    param_list = qof_query_build_param_list (SPLIT_TRANS, TRANS_DATE_POSTED, NULL);
+    if (param_list)
+    {
+        qof_query_purge_terms (query, param_list);
+        g_slist_free(param_list);
+    }
+
+    if (priv->fd.start_time || priv->fd.end_time)
+    {
+        /* Build a new spec */
+        xaccQueryAddDateMatchTT (query,
+                                priv->fd.start_time != 0, priv->fd.start_time,
+                                priv->fd.end_time != 0,   priv->fd.end_time,
+                                QOF_QUERY_AND);
+    }
+
+    if (refresh_page)
+        gnc_ledger_display2_refresh (priv->ledger);
+    LEAVE(" ");
+}
+
+/* This function converts a time64 value date to a string */
+static gchar *
+gnc_plugin_page_register2_filter_time2dmy (time64 raw_time)
+{
+    struct tm * timeinfo;
+    gchar date_string[11];
+
+    timeinfo = gnc_localtime (&raw_time);
+    strftime (date_string, 11, "%d-%m-%Y", timeinfo);
+    PINFO("Date string is %s", date_string);
+
+    gnc_tm_free (timeinfo);
+    return g_strdup (date_string);
+}
+
+/* This function converts a string date to a time64 value */
+static time64
+gnc_plugin_page_register2_filter_dmy2time (char *date_string)
+{
+    struct tm when;
+
+    PINFO("Date string is %s", date_string);
+    memset (&when, 0, sizeof (when));
+    sscanf (date_string, "%d-%d-%d", &when.tm_mday,
+	   &when.tm_mon, &when.tm_year);
+
+    when.tm_year -= 1900;
+    when.tm_mon -=  1;
+
+    return gnc_mktime (&when);
+}
+
+/** This function is called whenever one of the status entries is
+ *  checked or unchecked.  It updates the status value maintained for
+ *  the filter dialog, and calls another function to do the work of
+ *  applying the change to the register itself.
+ *
+ *  @param button The toggle button that was changed.
+ *
+ *  @param page A pointer to the GncPluginPageRegister2 that is
+ *  associated with this filter dialog.
+ */
+void
+gnc_plugin_page_register2_filter_status_one_cb (GtkToggleButton *button,
+        GncPluginPageRegister2 *page)
+{
+    GncPluginPageRegister2Private *priv;
+    const gchar *name;
+    gint i, value;
+
+    g_return_if_fail (GTK_IS_CHECK_BUTTON (button));
+    g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (page));
+
+    name = gtk_buildable_get_name (GTK_BUILDABLE (button));
+    ENTER("toggle button %s (%p), plugin_page %p", name, button, page);
+
+    /* Determine what status bit to change */
+    value = CLEARED_NONE;
+    for (i = 0; status_actions[i].action_name; i++)
+    {
+        if (g_strcmp0 (name, status_actions[i].action_name) == 0)
+        {
+            value = status_actions[i].value;
+            break;
+        }
+    }
+
+    /* Compute the new match status */
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (page);
+    if (gtk_toggle_button_get_active (button))
+        priv->fd.cleared_match |= value;
+    else
+        priv->fd.cleared_match &= ~value;
+    gnc_ppr_update_status_query (page, TRUE);
+    LEAVE(" ");
+}
+
+/** This function is called whenever the "select all" status button is
+ *  clicked. It updates all of the checkbox widgets, then updates the
+ *  query on the register.
+ *
+ *  @param button The button that was clicked.
+ *
+ *  @param page A pointer to the GncPluginPageRegister2 that is
+ *  associated with this filter dialog.
+ */
+void
+gnc_plugin_page_register2_filter_status_all_cb (GtkButton *button,
+        GncPluginPageRegister2 *page)
+{
+    GncPluginPageRegister2Private *priv;
+    GtkWidget *widget;
+    gint i;
+
+    g_return_if_fail (GTK_IS_BUTTON (button));
+    g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (page));
+
+    ENTER("(button %p, page %p)", button, page);
+
+    /* Turn on all the check menu items */
+    for (i = 0; status_actions[i].action_name; i++)
+    {
+        widget = status_actions[i].widget;
+        g_signal_handlers_block_by_func (widget, gnc_plugin_page_register2_filter_status_one_cb, page);
+        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
+        g_signal_handlers_unblock_by_func (widget, gnc_plugin_page_register2_filter_status_one_cb, page);
+    }
+
+    /* Set the requested status */
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (page);
+    priv->fd.cleared_match = CLEARED_ALL;
+    gnc_ppr_update_status_query (page, TRUE);
+    LEAVE(" ");
+}
+
+/** This function computes the starting and ending times for the
+ *  filter by examining the dialog widgets to see which ones are
+ *  selected, and will pull times out of the data entry boxes if
+ *  necessary. This function must exist to handle the case where the
+ *  "show all" button was Selected, and the user clicks on the "select
+ *  range" button. Since it exists, it make sense for the rest of the
+ *  callbacks to take advantage of it.
+ *
+ *  @param page A pointer to the GncPluginPageRegister2 that is
+ *  associated with this filter dialog.
+ */
+static void
+get_filter_times (GncPluginPageRegister2 *page)
+{
+    GncPluginPageRegister2Private *priv;
+    time64 time_val;
+
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (page);
+    if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->fd.start_date_choose)))
+    {
+        time_val = gnc_date_edit_get_date (GNC_DATE_EDIT (priv->fd.start_date));
+        time_val = gnc_time64_get_day_start (time_val);
+        priv->fd.start_time = time_val;
+    }
+    else
+    {
+        if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->fd.start_date_today)))
+        {
+            priv->fd.start_time = gnc_time64_get_today_start();
+        }
+        else
+        {
+            priv->fd.start_time = 0;
+        }
+    }
+
+    if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->fd.end_date_choose)))
+    {
+        time_val = gnc_date_edit_get_date (GNC_DATE_EDIT (priv->fd.end_date));
+        time_val = gnc_time64_get_day_end (time_val);
+        priv->fd.end_time = time_val;
+    }
+    else
+    {
+        if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->fd.start_date_today)))
+        {
+            priv->fd.end_time = gnc_time64_get_today_end();
+        }
+        else
+        {
+            priv->fd.end_time = 0;
+        }
+    }
+}
+
+/** This function is called when the "select range" radio button
+ *  changes state. Since there are only two choices in this radio
+ *  group, this one signal can be used to handle all cases. This
+ *  function is responsible for setting the sensitivity of the table
+ *  of widgets underneath the "select range" choice, and updating the
+ *  time limitation on the register query. This is handled by a
+ *  helper function when the radio button is selected (as potentially
+ *  all the widgets in the table need to be inspected), and is trivial
+ *  for the other case.
+ *
+ *  @param button A pointer to the "select range" radio button.
+ *
+ *  @param page A pointer to the GncPluginPageRegister2 that is
+ *  associated with this filter dialog.
+ */
+void
+gnc_plugin_page_register2_filter_select_range_cb (GtkRadioButton *button,
+        GncPluginPageRegister2 *page)
+{
+    GncPluginPageRegister2Private *priv;
+    gboolean active;
+
+    g_return_if_fail (GTK_IS_RADIO_BUTTON (button));
+    g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (page));
+
+    ENTER("(button %p, page %p)", button, page);
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (page);
+    active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
+    gtk_widget_set_sensitive (priv->fd.table, active);
+    if (active)
+    {
+        get_filter_times (page);
+    }
+    else
+    {
+        priv->fd.start_time = 0;
+        priv->fd.end_time = 0;
+    }
+    gnc_ppr_update_date_query (page, TRUE);
+    LEAVE(" ");
+}
+
+/** This function is called when one of the start date entry widgets
+ *  is updated. It simply calls common routines to determine the
+ *  start/end times and update the register filter.
+ *
+ *  @param unused A pointer to a GncDateEntry widgets, but it could be
+ *  any widget.
+ *
+ *  @param page A pointer to the GncPluginPageRegister2 that is
+ *  associated with this filter dialog.
+ */
+static void
+gnc_plugin_page_register2_filter_gde_changed_cb (GtkWidget *unused,
+        GncPluginPageRegister2 *page)
+{
+    g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (page));
+
+    ENTER("(widget %s(%p), page %p)", gtk_buildable_get_name (GTK_BUILDABLE (unused)), unused, page);
+    get_filter_times (page);
+    gnc_ppr_update_date_query (page, TRUE);
+    LEAVE(" ");
+}
+
+/** This function is called when one of the start date radio buttons
+ *  is selected. It updates the sensitivity of the date entry widget,
+ *  then calls a common routine to determine the start/end times and
+ *  update the register query.
+ *
+ *  *Note: This function is actually called twice for each new radio
+ *  button selection. The first time call is to uncheck the old
+ *  button, and the second time to check the new button. This does
+ *  make a kind of sense, as radio buttons are nothing more than
+ *  linked toggle buttons where only one can be active.
+ *
+ *  @param radio The button whose state is changing. This will be
+ *  the previously selected button the first of the pair of calls to
+ *  this function, and will be the newly selected button the second
+ *  time.
+ *
+ *  @param page A pointer to the GncPluginPageRegister2 that is
+ *  associated with this filter dialog.
+ */
+void
+gnc_plugin_page_register2_filter_start_cb (GtkWidget *radio,
+        GncPluginPageRegister2 *page)
+{
+    GncPluginPageRegister2Private *priv;
+    const gchar *name;
+    gboolean active;
+
+    g_return_if_fail (GTK_IS_RADIO_BUTTON (radio));
+    g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (page));
+
+    ENTER("(radio %s(%p), page %p)", gtk_buildable_get_name (GTK_BUILDABLE (radio)), radio, page);
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (page);
+    if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (radio)))
+    {
+        LEAVE("1st callback of pair. Defer to 2nd callback.");
+        return;
+    }
+
+    name = gtk_buildable_get_name (GTK_BUILDABLE (radio));
+    active = (g_strcmp0 (name, g_strdup ("start_date_choose")) == 0 ? 1 : 0 );
+    gtk_widget_set_sensitive (priv->fd.start_date, active);
+    get_filter_times (page);
+    gnc_ppr_update_date_query (page, TRUE);
+    LEAVE(" ");
+}
+
+/** This function is called when one of the end date radio buttons is
+ *  selected. It updates the sensitivity of the date entry widget,
+ *  then calls a common routine to determine the start/end times and
+ *  update the register query.
+ *
+ *  *Note: This function is actually called twice for each new radio
+ *  button selection. The first time call is to uncheck the old
+ *  button, and the second time to check the new button. This does
+ *  make a kind of sense, as radio buttons are nothing more than
+ *  linked toggle buttons where only one can be active.
+ *
+ *  @param radio The button whose state is changing. This will be
+ *  the previously selected button the first of the pair of calls to
+ *  this function, and will be the newly selected button the second
+ *  time.
+ *
+ *  @param page A pointer to the GncPluginPageRegister2 that is
+ *  associated with this filter dialog.
+ */
+void
+gnc_plugin_page_register2_filter_end_cb (GtkWidget *radio,
+                                        GncPluginPageRegister2 *page)
+{
+    GncPluginPageRegister2Private *priv;
+    const gchar *name;
+    gboolean active;
+
+    g_return_if_fail (GTK_IS_RADIO_BUTTON (radio));
+    g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (page));
+
+    ENTER("(radio %s(%p), page %p)", gtk_buildable_get_name (GTK_BUILDABLE (radio)), radio, page);
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (page);
+    if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (radio)))
+    {
+        LEAVE("1st callback of pair. Defer to 2nd callback.");
+        return;
+    }
+
+    name = gtk_buildable_get_name (GTK_BUILDABLE (radio));
+    active = (g_strcmp0 (name, g_strdup ("end_date_choose")) == 0 ? 1 : 0 );
+    gtk_widget_set_sensitive (priv->fd.end_date, active);
+    get_filter_times (page);
+    gnc_ppr_update_date_query (page, TRUE);
+    LEAVE(" ");
+}
+
+/** This function is called whenever the save status is checked
+ *  or unchecked. It will allow saving of the filter if required.
+ *
+ *  @param button The toggle button that was changed.
+ *
+ *  @param page A pointer to the GncPluginPageRegister2 that is
+ *  associated with this filter dialog.
+ */
+void
+gnc_plugin_page_register2_filter_save_cb (GtkToggleButton *button,
+        GncPluginPageRegister2 *page)
+{
+    GncPluginPageRegister2Private *priv;
+
+    g_return_if_fail (GTK_IS_CHECK_BUTTON (button));
+    g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (page));
+
+    ENTER("Save toggle button (%p), plugin_page %p", button, page);
+
+    /* Compute the new save filter status */
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (page);
+    if (gtk_toggle_button_get_active (button))
+        priv->fd.save_filter = TRUE;
+    else
+        priv->fd.save_filter = FALSE;
+    LEAVE(" ");
+}
+
+/** This function is called when the "Filter By..." dialog is closed.
+ *  If the dialog was closed by any method other than clicking the OK
+ *  button, the original filter will be restored.
+ *
+ *  @param dialog A pointer to the dialog box.
+ *
+ *  @param response A numerical value indicating why the dialog box was closed.
+ *
+ *  @param page A pointer to the GncPluginPageRegister2 associated with
+ *  this dialog box.
+ */
+void
+gnc_plugin_page_register2_filter_response_cb (GtkDialog *dialog,
+        gint response,
+        GncPluginPageRegister2 *page)
+{
+    GncPluginPageRegister2Private *priv;
+    GncPluginPage *plugin_page;
+
+    g_return_if_fail (GTK_IS_DIALOG (dialog));
+    g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (page));
+
+    ENTER(" ");
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (page);
+    plugin_page = GNC_PLUGIN_PAGE (page);
+
+    if (response != GTK_RESPONSE_OK)
+    {
+        /* Remove the old status match */
+        priv->fd.cleared_match = priv->fd.original_cleared_match;
+        gnc_ppr_update_status_query (page, FALSE);
+        priv->fd.start_time = priv->fd.original_start_time;
+        priv->fd.end_time = priv->fd.original_end_time;
+        priv->fd.save_filter = priv->fd.original_save_filter;
+        gnc_ppr_update_date_query (page, FALSE);
+        gnc_ledger_display2_refresh (priv->ledger);
+    }
+    else
+    {
+        priv->fd.original_save_filter = priv->fd.save_filter;
+
+        if (priv->fd.save_filter)
+        {
+            gchar* filter;
+            filter = g_strdup_printf ("0x%04x", priv->fd.cleared_match);
+
+            if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->fd.start_date_choose)) && priv->fd.start_time != 0 )
+            {
+                gchar *timeval = gnc_plugin_page_register2_filter_time2dmy (priv->fd.start_time);
+                filter = g_strconcat (filter, ",", timeval, NULL);
+                g_free (timeval);
+            }
+            else
+                filter = g_strconcat (filter, ",0", NULL);
+
+            if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->fd.end_date_choose)) && priv->fd.end_time != 0 )
+            {
+                gchar *timeval = gnc_plugin_page_register2_filter_time2dmy (priv->fd.end_time);
+                filter = g_strconcat (filter, ",", timeval, NULL);
+                g_free (timeval);
+            }
+            else
+                filter = g_strconcat (filter, ",0", NULL);
+
+            PINFO("The filter to save is %s", filter);
+
+            gnc_plugin_page_register2_set_filter (plugin_page, filter);
+            g_free (filter);
+        }
+    }
+    priv->fd.dialog = NULL;
+    gtk_widget_destroy (GTK_WIDGET (dialog));
+    LEAVE(" ");
+}
+
+/*#################################################################################*/
+/*#################################################################################*/
+
+/************************************************************/
+/*                  Report Helper Functions                 */
+/************************************************************/
+
+static char *
+gnc_reg_get_name (GNCLedgerDisplay2 *ledger, gboolean for_window) // this works
+{
+    Account *leader;
+    GncTreeModelSplitReg *model;
+    gchar *account_name;
+    gchar *reg_name;
+    gchar *name;
+    GNCLedgerDisplay2Type ledger_type;
+
+    if (ledger == NULL)
+        return NULL;
+
+    model = gnc_ledger_display2_get_split_model_register (ledger);
+    ledger_type = gnc_ledger_display2_type (ledger);
+
+    switch (model->type)
+    {
+    case GENERAL_JOURNAL:
+    case INCOME_LEDGER:
+        if (for_window)
+            reg_name = _("General Journal");
+        else
+            reg_name = _("General Journal Report");
+        break;
+    case PORTFOLIO_LEDGER:
+        if (for_window)
+            reg_name = _("Portfolio");
+        else
+            reg_name = _("Portfolio Report");
+        break;
+    case SEARCH_LEDGER:
+        if (for_window)
+            reg_name = _("Search Results");
+        else
+            reg_name = _("Search Results Report");
+        break;
+    default:
+        if (for_window)
+            reg_name = _("Register");
+        else
+            reg_name = _("Register Report");
+        break;
+    }
+
+    leader = gnc_ledger_display2_leader (ledger);
+
+    if ((leader != NULL) && (ledger_type != LD2_GL))
+    {
+        account_name = gnc_account_get_full_name (leader);
+
+        if (ledger_type == LD2_SINGLE)
+        {
+            name = g_strconcat (account_name, " - ", reg_name, NULL);
+        }
+        else
+        {
+            name = g_strconcat (account_name, " ", _("and subaccounts"), " - ", reg_name, NULL);
+        }
+        g_free (account_name);
+    }
+    else
+        name = g_strdup (reg_name);
+
+    return name;
+}
+
+static int
+report_helper (GNCLedgerDisplay2 *ledger, Split *split, Query *query) //this works
+{
+    GncTreeViewSplitReg *view;
+    GncTreeModelSplitReg *model;
+    Account *account;
+    char *str;
+    const char *tmp;
+    swig_type_info * qtype;
+    SCM args;
+    SCM func;
+    SCM arg;
+
+    args = SCM_EOL;
+
+    view = gnc_ledger_display2_get_split_view_register (ledger);
+    model = gnc_ledger_display2_get_split_model_register (ledger);
+
+    func = scm_c_eval_string ("gnc:register-report-create");
+    g_return_val_if_fail (scm_is_procedure (func), -1);
+    tmp = gnc_tree_view_split_reg_get_credit_debit_string (view, TRUE);
+
+    arg = scm_from_utf8_string (tmp ? tmp : _("Credit"));
+    args = scm_cons (arg, args);
+    tmp = gnc_tree_view_split_reg_get_credit_debit_string (view, FALSE);
+    arg = scm_from_utf8_string (tmp ? tmp : _("Debit"));
+    args = scm_cons (arg, args);
+
+    str = gnc_reg_get_name (ledger, FALSE);
+    arg = scm_from_utf8_string (str ? str : "");
+    args = scm_cons (arg, args);
+    g_free (str);
+
+    arg = SCM_BOOL (model->use_double_line);
+    args = scm_cons (arg, args);
+
+    arg = SCM_BOOL (model->type == GENERAL_JOURNAL2 || model->type == INCOME_LEDGER2
+                                                   || model->type == SEARCH_LEDGER2);
+    args = scm_cons (arg, args);
+
+    arg = SCM_BOOL (model->style == REG2_STYLE_JOURNAL);
+    args = scm_cons (arg, args);
+
+    if (!query)
+    {
+        query = gnc_ledger_display2_get_query (ledger);
+        g_return_val_if_fail (query != NULL, -1);
+    }
+
+    qtype = SWIG_TypeQuery ("_p__QofQuery");
+    g_return_val_if_fail (qtype, -1);
+
+    arg = SWIG_NewPointerObj (query, qtype, 0);
+    args = scm_cons (arg, args);
+    g_return_val_if_fail (arg != SCM_UNDEFINED, -1);
+
+
+    if (split)
+    {
+        qtype = SWIG_TypeQuery ("_p_Split");
+        g_return_val_if_fail (qtype, -1);
+        arg = SWIG_NewPointerObj (split, qtype, 0);
+    }
+    else
+    {
+        arg = SCM_BOOL_F;
+    }
+    args = scm_cons (arg, args);
+    g_return_val_if_fail (arg != SCM_UNDEFINED, -1);
+
+
+    qtype = SWIG_TypeQuery ("_p_Account");
+    g_return_val_if_fail (qtype, -1);
+
+    account = gnc_ledger_display2_leader (ledger);
+    arg = SWIG_NewPointerObj (account, qtype, 0);
+    args = scm_cons (arg, args);
+    g_return_val_if_fail (arg != SCM_UNDEFINED, -1);
+
+
+    /* Apply the function to the args */
+    arg = scm_apply (func, args, SCM_EOL);
+    g_return_val_if_fail (scm_is_exact (arg), -1);
+
+    return scm_to_int (arg);
+}
+
+/*#################################################################################*/
+/*#################################################################################*/
+
+/************************************************************/
+/*                     Command callbacks                    */
+/************************************************************/
+
+static void
+gnc_plugin_page_register2_cmd_print_check (GtkAction *action,
+        GncPluginPageRegister2 *plugin_page) // this works
+{
+    GncPluginPageRegister2Private *priv;
+    GncTreeViewSplitReg *view;
+    GncTreeModelSplitReg *model;
+    Split         * split;
+    Transaction   * trans;
+    GList         * splits = NULL, *item;
+    GNCLedgerDisplay2Type ledger_type;
+    Account       * account;
+    GtkWidget     * window;
+
+    ENTER("(action %p, plugin_page %p)", action, plugin_page);
+
+    g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (plugin_page));
+
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (plugin_page);
+    view = gnc_ledger_display2_get_split_view_register (priv->ledger);
+    model = gnc_ledger_display2_get_split_model_register (priv->ledger);
+    ledger_type = gnc_ledger_display2_type (priv->ledger);
+    window = gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (plugin_page));
+
+    if (ledger_type == LD2_SINGLE || ledger_type == LD2_SUBACCOUNT)
+    {
+        account  = gnc_plugin_page_register2_get_account (plugin_page);
+        split = gnc_tree_view_split_reg_get_current_split (view);
+        trans = xaccSplitGetParent (split);
+
+        if (trans == NULL)
+        {
+            LEAVE("trans is NULL");
+            return;
+        }
+
+        /* See if we were asked to print a blank trans. */
+        if (trans == gnc_tree_control_split_reg_get_blank_trans (view))
+        {
+            LEAVE("Asked to print a blank trans");
+            return;
+        }
+
+        /* See if we are being edited in another register */
+        if (gnc_tree_control_split_reg_trans_test_for_edit (view, trans))
+        {
+            LEAVE("trans being edited in another register");
+            return;
+        }
+
+        /* Make sure we ask to commit any changes before we proceed */
+        if (gnc_tree_control_split_reg_trans_open_and_warn (view, trans))
+        {
+            LEAVE("trans being edited");
+            return;
+        }
+
+        if (split && trans)
+        {
+            if (xaccSplitGetAccount(split) == account)
+            {
+                splits = g_list_append(splits, split);
+                gnc_ui_print_check_dialog_create (window, splits);
+                g_list_free(splits);
+            }
+            else
+            {
+                /* This split is not for the account shown in this register.  Get the
+                   split for that account and use it. */
+                split = gnc_tree_model_split_reg_trans_get_split_equal_to_ancestor(trans, account);
+                if (split)
+                {
+                    splits = g_list_append(splits, split);
+                    gnc_ui_print_check_dialog_create (window, splits);
+                    g_list_free(splits);
+                }
+            }           
+        }
+    }
+    else if (ledger_type == LD2_GL && model->type == SEARCH_LEDGER2)
+    {
+        Account *common_acct = NULL;
+        splits = qof_query_run (gnc_ledger_display2_get_query (priv->ledger));
+        /* Make sure each split is from the same account */
+        for (item = splits; item; item = g_list_next (item))
+        {
+            split = (Split *) item->data;
+            if (common_acct == NULL)
+            {
+                common_acct = xaccSplitGetAccount (split);
+            }
+            else
+            {
+                if (xaccSplitGetAccount (split) != common_acct)
+                {
+                    GtkWidget *dialog;
+                    gint response;
+                    const gchar *title = _("Print checks from multiple accounts?");
+                    const gchar *message =
+                        _("This search result contains splits from more than one account. "
+                          "Do you want to print the checks even though they are not all "
+                          "from the same account?");
+                    dialog = gtk_message_dialog_new (GTK_WINDOW (window),
+                                                    GTK_DIALOG_DESTROY_WITH_PARENT,
+                                                    GTK_MESSAGE_WARNING,
+                                                    GTK_BUTTONS_CANCEL,
+                                                    "%s", title);
+                    gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+                            "%s", message);
+                    gtk_dialog_add_button (GTK_DIALOG (dialog), _("_Print checks"),
+                                          GTK_RESPONSE_YES);
+                    response = gnc_dialog_run (GTK_DIALOG (dialog),
+                                               GNC_PREF_WARN_CHECKPRINTING_MULTI_ACCT);
+                    gtk_widget_destroy (dialog);
+                    if (response != GTK_RESPONSE_YES)
+                    {
+                        LEAVE("Multiple accounts");
+                        return;
+                    }
+                    break;
+                }
+            }
+        }
+        gnc_ui_print_check_dialog_create (window, splits);
+    }
+    else
+    {
+        gnc_error_dialog (window, "%s",
+                         _("You can only print checks from a bank account register or search results."));
+        LEAVE("Unsupported ledger type");
+        return;
+    }
+    LEAVE(" ");
+}
+
+static void
+gnc_plugin_page_register2_cmd_cut (GtkAction *action,
+                                  GncPluginPageRegister2 *page) //this works
+{
+    GtkWidget *window, *widget;
+
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2 (page));
+
+    ENTER("(action %p, page %p)", action, page);
+
+    window = gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (page));
+    widget = gtk_window_get_focus (GTK_WINDOW (window));
+
+    DEBUG("(widget name is %s)", gtk_widget_get_name (widget));
+
+    if (GTK_IS_ENTRY(widget))
+        g_signal_emit_by_name(widget, "cut-clipboard", NULL);
+
+    LEAVE("");
+}
+
+static void
+gnc_plugin_page_register2_cmd_copy (GtkAction *action,
+                                   GncPluginPageRegister2 *page) //this works
+{
+    GtkWidget *window, *widget;
+
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2 (page));
+
+    ENTER("(action %p, page %p)", action, page);
+
+    window = gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (page));
+    widget = gtk_window_get_focus (GTK_WINDOW (window));
+
+    DEBUG("(widget name is %s)", gtk_widget_get_name (widget));
+
+    if (GTK_IS_ENTRY(widget))
+        g_signal_emit_by_name (widget, "copy-clipboard", NULL);
+
+    LEAVE("");
+}
+
+static void
+gnc_plugin_page_register2_cmd_paste (GtkAction *action,
+                                    GncPluginPageRegister2 *page) //this works
+{
+    GtkWidget *window, *widget;
+
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2 (page));
+
+    ENTER("(action %p, page %p)", action, page);
+
+    window = gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (page));
+    widget = gtk_window_get_focus (GTK_WINDOW (window));
+
+    DEBUG("(widget name is %s)", gtk_widget_get_name (widget));
+
+    if (GTK_IS_ENTRY(widget))
+        g_signal_emit_by_name (widget, "paste-clipboard", NULL);
+
+    LEAVE("");
+}
+
+static void
+gnc_plugin_page_register2_cmd_edit_account (GtkAction *action,
+        GncPluginPageRegister2 *page) //this works
+{
+    Account *account;
+
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2(page));
+
+    ENTER("(action %p, page %p)", action, page);
+    account = gnc_plugin_page_register2_get_account (page);
+    if (account)
+        gnc_ui_edit_account_window (account);
+    LEAVE(" ");
+}
+
+static void
+gnc_plugin_page_register2_cmd_find_account (GtkAction *action,
+        GncPluginPageRegister2 *page)
+{
+    GtkWidget *window;
+
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2(page));
+
+    window = gnc_plugin_page_get_window (GNC_PLUGIN_PAGE(page));
+
+    gnc_find_account_dialog (window, NULL);
+}
+
+static void
+gnc_plugin_page_register2_cmd_find_transactions (GtkAction *action,
+        GncPluginPageRegister2 *page) // this works
+{
+    GncPluginPageRegister2Private *priv;
+
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2(page));
+
+    ENTER("(action %p, page %p)", action, page);
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(page);
+
+    gnc_ui_find_transactions_dialog_create2 (priv->ledger);
+    LEAVE(" ");
+}
+
+static void
+gnc_plugin_page_register2_cmd_cut_transaction (GtkAction *action,
+        GncPluginPageRegister2 *page) // this works
+{
+    GncPluginPageRegister2Private *priv;
+    GncTreeViewSplitReg *view;
+
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2(page));
+
+    ENTER("(action %p, page %p)", action, page);
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(page);
+    view = gnc_ledger_display2_get_split_view_register (priv->ledger);
+    gnc_tree_control_split_reg_cut_trans (view);
+
+    LEAVE(" ");
+}
+
+static void
+gnc_plugin_page_register2_cmd_copy_transaction (GtkAction *action,
+        GncPluginPageRegister2 *page) // this works
+{
+    GncPluginPageRegister2Private *priv;
+    GncTreeViewSplitReg *view;
+
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2(page));
+
+    ENTER("(action %p, page %p)", action, page);
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(page);
+    view = gnc_ledger_display2_get_split_view_register (priv->ledger);
+    gnc_tree_control_split_reg_copy_trans (view);
+    LEAVE(" ");
+}
+
+static void
+gnc_plugin_page_register2_cmd_paste_transaction (GtkAction *action,
+        GncPluginPageRegister2 *page) //this works
+{
+    GncPluginPageRegister2Private *priv;
+    GncTreeViewSplitReg *view;
+
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2(page));
+
+    ENTER("(action %p, page %p)", action, page);
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(page);
+    view = gnc_ledger_display2_get_split_view_register (priv->ledger);
+    gnc_tree_control_split_reg_paste_trans (view);
+    LEAVE(" ");
+}
+
+static void
+gnc_plugin_page_register2_cmd_void_transaction (GtkAction *action,
+        GncPluginPageRegister2 *page) //this works
+{
+    GncPluginPageRegister2Private *priv;
+    GtkWidget *dialog, *entry;
+    GncTreeViewSplitReg *view;
+    Transaction *trans;
+    GtkBuilder *builder;
+    const char *reason;
+    gint result;
+
+    ENTER("(action %p, page %p)", action, page);
+
+    g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (page));
+
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (page);
+    view = gnc_ledger_display2_get_split_view_register (priv->ledger);
+    trans = gnc_tree_view_split_reg_get_current_trans (view);
+    if (trans == NULL)
+    {
+        LEAVE("trans is NULL");
+        return;
+    }
+    if (xaccTransHasSplitsInState (trans, VREC))
+    {
+        LEAVE("trans has split in VREC state");
+        return;
+    }
+    if (xaccTransHasReconciledSplits (trans) || xaccTransHasSplitsInState (trans, CREC))
+    {
+        gnc_error_dialog (NULL, "%s", _("You cannot void a transaction with reconciled or cleared splits."));
+        LEAVE("trans with reconciled splits");
+        return;
+    }
+
+    if (!gnc_plugin_page_register2_finish_pending (GNC_PLUGIN_PAGE (page)))
+    {
+        LEAVE("finish pending");
+        return;
+    }
+
+    builder = gtk_builder_new();
+    gnc_builder_add_from_file  (builder , "gnc-plugin-page-register2.glade", "void_transaction_dialog");
+    dialog = GTK_WIDGET (gtk_builder_get_object (builder, "void_transaction_dialog"));
+    entry = GTK_WIDGET (gtk_builder_get_object (builder, "reason"));
+
+    result = gtk_dialog_run (GTK_DIALOG (dialog));
+    if (result == GTK_RESPONSE_OK)
+    {
+        reason = gtk_entry_get_text (GTK_ENTRY (entry));
+        if (reason == NULL)
+            reason = "";
+        gnc_tree_control_split_reg_void_current_trans (view, reason);
+    }
+
+    /* All done. Get rid of it. */
+    gtk_widget_destroy (dialog);
+    g_object_unref (G_OBJECT(builder));
+    LEAVE(" ");
+}
+
+static void
+gnc_plugin_page_register2_cmd_unvoid_transaction (GtkAction *action,
+        GncPluginPageRegister2 *page) //this works
+{
+    GncPluginPageRegister2Private *priv;
+    GncTreeViewSplitReg *view;
+    Transaction *trans;
+
+    ENTER("(action %p, page %p)", action, page);
+
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2 (page));
+
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (page);
+    view = gnc_ledger_display2_get_split_view_register (priv->ledger);
+    trans = gnc_tree_view_split_reg_get_current_trans (view);
+    if (!xaccTransHasSplitsInState (trans, VREC))
+    {
+        LEAVE("trans has split in VREC state");
+        return;
+    }
+    gnc_tree_control_split_reg_unvoid_current_trans (view);
+    LEAVE(" ");
+}
+
+static void
+gnc_plugin_page_register2_cmd_reverse_transaction (GtkAction *action,
+        GncPluginPageRegister2 *page) //this works
+{
+    GncPluginPageRegister2Private *priv;
+    GncTreeViewSplitReg *view;
+
+    ENTER("(action %p, page %p)", action, page);
+
+    g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (page));
+
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (page);
+    view = gnc_ledger_display2_get_split_view_register (priv->ledger);
+
+    gnc_tree_control_split_reg_reverse_current (view);
+    LEAVE(" ");
+}
+
+static void
+gnc_plugin_page_register2_cmd_entryUp (GtkAction *action,
+                                       GncPluginPageRegister2 *plugin_page)
+{
+    GncPluginPageRegister2Private *priv;
+    GncTreeViewSplitReg *view;
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2(plugin_page));
+
+    ENTER("(action %p, plugin_page %p)", action, plugin_page);
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(plugin_page);
+    view = gnc_ledger_display2_get_split_view_register (priv->ledger);
+    g_return_if_fail(view);
+    gnc_tree_control_split_reg_move_current_entry_updown(view, TRUE);
+    LEAVE(" ");
+}
+
+static void
+gnc_plugin_page_register2_cmd_entryDown (GtkAction *action,
+                                         GncPluginPageRegister2 *plugin_page)
+{
+    GncPluginPageRegister2Private *priv;
+    GncTreeViewSplitReg *view;
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2(plugin_page));
+
+    ENTER("(action %p, plugin_page %p)", action, plugin_page);
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(plugin_page);
+    view = gnc_ledger_display2_get_split_view_register (priv->ledger);
+    g_return_if_fail(view);
+    gnc_tree_control_split_reg_move_current_entry_updown(view, FALSE);
+    LEAVE(" ");
+}
+
+
+/*#################################################################################*/
+/*#################################################################################*/
+
+static void
+gnc_plugin_page_register2_cmd_view_filter_by (GtkAction *action,
+        GncPluginPageRegister2 *page) //this works
+{
+    GncPluginPageRegister2Private *priv;
+    GNCLedgerDisplay2Type ledger_type;
+    GtkWidget *dialog, *toggle, *button, *table, *hbox;
+    time64 start_time, end_time, time_val;
+    GtkBuilder *builder;
+    gboolean sensitive, value;
+    Query *query;
+    gchar *title;
+    int i;
+
+    g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (page));
+    ENTER("(action %p, page %p)", action, page);
+
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (page);
+    if (priv->fd.dialog)
+    {
+        gtk_window_present (GTK_WINDOW (priv->fd.dialog));
+        LEAVE("existing dialog");
+        return;
+    }
+
+    /* Create the dialog */
+    builder = gtk_builder_new();
+    gnc_builder_add_from_file (builder, "gnc-plugin-page-register2.glade", "filter_by_dialog");
+    dialog = GTK_WIDGET (gtk_builder_get_object (builder, "filter_by_dialog"));
+    priv->fd.dialog = dialog;
+    gtk_window_set_transient_for (GTK_WINDOW (dialog),
+                                 gnc_window_get_gtk_window (GNC_WINDOW (GNC_PLUGIN_PAGE (page)->window)));
+
+    /* Translators: The %s is the name of the plugin page */
+    title = g_strdup_printf (_("Filter %s by..."),
+                            gnc_plugin_page_get_page_name (GNC_PLUGIN_PAGE (page)));
+    gtk_window_set_title (GTK_WINDOW (dialog), title);
+    g_free(title);
+
+    /* Set the check buttons for the current status */
+    for (i = 0; status_actions[i].action_name; i++)
+    {
+        toggle = GTK_WIDGET (gtk_builder_get_object (builder, status_actions[i].action_name));
+        value = priv->fd.cleared_match & status_actions[i].value;
+        status_actions[i].widget = toggle;
+        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), value);
+    }
+    priv->fd.original_cleared_match = priv->fd.cleared_match;
+
+    button = GTK_WIDGET (gtk_builder_get_object (builder, "filter_save"));
+    if (priv->fd.save_filter == TRUE)
+        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
+
+    // General Journals can not save filters so disable button.
+    ledger_type = gnc_ledger_display2_type (priv->ledger);
+    if (ledger_type == LD2_GL)
+       gtk_widget_set_sensitive (GTK_WIDGET (button), FALSE);
+
+    /* Set the date info */
+    button = GTK_WIDGET (gtk_builder_get_object (builder, "filter_show_range"));
+    query = gnc_ledger_display2_get_query (priv->ledger);
+    xaccQueryGetDateMatchTT (query, &start_time, &end_time);
+    priv->fd.original_start_time = start_time;
+    priv->fd.start_time = start_time;
+    priv->fd.original_end_time = end_time;
+    priv->fd.end_time = end_time;
+
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), start_time || end_time);
+    table = GTK_WIDGET (gtk_builder_get_object (builder, "select_range_table"));
+    priv->fd.table = table;
+    gtk_widget_set_sensitive (GTK_WIDGET (table), start_time || end_time);
+
+    priv->fd.start_date_choose = GTK_WIDGET (gtk_builder_get_object (builder, "start_date_choose"));
+    priv->fd.start_date_today = GTK_WIDGET (gtk_builder_get_object (builder, "start_date_today"));
+    priv->fd.end_date_choose = GTK_WIDGET (gtk_builder_get_object (builder, "end_date_choose"));
+    priv->fd.end_date_today = GTK_WIDGET (gtk_builder_get_object (builder, "end_date_today"));
+
+    {
+        /* Start date info */
+        if (start_time == 0)
+        {
+            button = GTK_WIDGET (gtk_builder_get_object (builder, "start_date_earliest"));
+            time_val = xaccQueryGetEarliestDateFound (query);
+            sensitive = FALSE;
+        }
+        else
+        {
+            time_val = start_time;
+            if ((start_time >= gnc_time64_get_today_start()) &&
+                    (start_time <= gnc_time64_get_today_end()))
+            {
+                button = priv->fd.start_date_today;
+                sensitive = FALSE;
+            }
+            else
+            {
+                button = priv->fd.start_date_choose;
+                sensitive = TRUE;
+            }
+        }
+        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
+        priv->fd.start_date = gnc_date_edit_new (gnc_time (NULL), FALSE, FALSE);
+        hbox = GTK_WIDGET (gtk_builder_get_object (builder, "start_date_hbox"));
+        gtk_box_pack_start (GTK_BOX (hbox), priv->fd.start_date, TRUE, TRUE, 0);
+        gtk_widget_show (priv->fd.start_date);
+        gtk_widget_set_sensitive (GTK_WIDGET (priv->fd.start_date), sensitive);
+        gnc_date_edit_set_time (GNC_DATE_EDIT (priv->fd.start_date), time_val);
+        g_signal_connect (G_OBJECT (priv->fd.start_date), "date-changed",
+                          G_CALLBACK (gnc_plugin_page_register2_filter_gde_changed_cb),
+                          page);
+    }
+
+    {
+        /* End date info */
+        if (end_time == 0)
+        {
+            button = GTK_WIDGET (gtk_builder_get_object (builder, "end_date_latest"));
+            time_val = xaccQueryGetLatestDateFound (query);
+            sensitive = FALSE;
+        }
+        else
+        {
+            time_val = end_time;
+            if ((end_time >= gnc_time64_get_today_start()) &&
+                    (end_time <= gnc_time64_get_today_end()))
+            {
+                button = priv->fd.end_date_today;
+                sensitive = FALSE;
+            }
+            else
+            {
+                button = priv->fd.end_date_choose;
+                sensitive = TRUE;
+            }
+        }
+        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
+        priv->fd.end_date = gnc_date_edit_new (gnc_time (NULL), FALSE, FALSE);
+        hbox = GTK_WIDGET (gtk_builder_get_object (builder, "end_date_hbox"));
+        gtk_box_pack_start (GTK_BOX (hbox), priv->fd.end_date, TRUE, TRUE, 0);
+        gtk_widget_show (priv->fd.end_date);
+        gtk_widget_set_sensitive (GTK_WIDGET (priv->fd.end_date), sensitive);
+        gnc_date_edit_set_time (GNC_DATE_EDIT (priv->fd.end_date), time_val);
+        g_signal_connect (G_OBJECT (priv->fd.end_date), "date-changed",
+                          G_CALLBACK (gnc_plugin_page_register2_filter_gde_changed_cb),
+                          page);
+    }
+
+    /* Wire it up */
+    gtk_builder_connect_signals_full (builder, gnc_builder_connect_full_func, page);
+
+    /* Show it */
+    gtk_widget_show_all (dialog);
+    g_object_unref (G_OBJECT (builder));
+    LEAVE(" ");
+}
+
+
+static void
+gnc_plugin_page_register2_cmd_reload (GtkAction *action, GncPluginPageRegister2 *plugin_page) //this works
+{
+    GncPluginPageRegister2Private *priv;
+    GncTreeViewSplitReg *view;
+
+    Transaction *trans;
+
+    ENTER("(action %p, page %p)", action, plugin_page);
+
+    g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (plugin_page));
+
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (plugin_page);
+
+    view = gnc_ledger_display2_get_split_view_register (priv->ledger);
+
+    trans = gnc_tree_view_split_reg_get_current_trans (view);
+
+    /* Make sure we ask to commit any changes before we proceed */
+    if (gnc_tree_control_split_reg_trans_open_and_warn (view, trans))
+    {
+        LEAVE("trans being edited");
+        return;
+    }
+
+    /* give gtk+ a chance to handle pending events */
+    while (gtk_events_pending ())
+        gtk_main_iteration ();
+
+    gnc_ledger_display2_refresh (priv->ledger);
+
+    LEAVE(" ");
+}
+
+/*#################################################################################*/
+/*#################################################################################*/
+
+static void
+gnc_plugin_page_register2_cmd_style_changed (GtkAction *action,
+        GtkRadioAction *current,
+        GncPluginPageRegister2 *plugin_page) //this works
+{
+    GncPluginPageRegister2Private *priv;
+    SplitRegisterStyle2 value;
+
+    ENTER("(action %p, radio action %p, plugin_page %p)",
+          action, current, plugin_page);
+
+    g_return_if_fail (GTK_IS_ACTION (action));
+    g_return_if_fail (GTK_IS_RADIO_ACTION (current));
+    g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (plugin_page));
+
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (plugin_page);
+    value = gtk_radio_action_get_current_value (current);
+    gnc_split_reg2_change_style (priv->gsr, value);
+
+    gnc_plugin_page_register2_ui_update (NULL, plugin_page);
+    LEAVE(" ");
+}
+
+static void
+gnc_plugin_page_register2_cmd_style_double_line (GtkToggleAction *action,
+        GncPluginPageRegister2 *plugin_page) // this works
+{
+    GncPluginPageRegister2Private *priv;
+    GncTreeModelSplitReg *model;
+    GncTreeViewSplitReg *view;
+    gboolean use_double_line;
+
+    ENTER("(action %p, plugin_page %p)", action, plugin_page);
+
+    g_return_if_fail (GTK_IS_ACTION (action));
+    g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (plugin_page));
+
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (plugin_page);
+    model = gnc_ledger_display2_get_split_model_register (priv->ledger);
+
+    view = gnc_ledger_display2_get_split_view_register (priv->ledger);
+
+    use_double_line = gtk_toggle_action_get_active (action);
+    if (use_double_line != model->use_double_line)
+    {
+        gnc_tree_model_split_reg_config (model, model->type, model->style, use_double_line);
+
+        // This will re-display the view.
+        gnc_tree_view_split_reg_set_format (view);
+        gnc_ledger_display2_refresh (priv->ledger);
+    }
+    LEAVE(" ");
+}
+
+static void
+gnc_plugin_page_register2_cmd_style_extra_dates (GtkToggleAction *action,
+        GncPluginPageRegister2 *plugin_page) // this works
+{
+    GncPluginPageRegister2Private *priv;
+    GncTreeViewSplitReg *view;
+    gboolean show_extra_dates;
+
+    ENTER("(action %p, plugin_page %p)", action, plugin_page);
+
+    g_return_if_fail (GTK_IS_ACTION (action));
+    g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (plugin_page));
+
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (plugin_page);
+
+    view = gnc_ledger_display2_get_split_view_register (priv->ledger);
+
+    show_extra_dates = gtk_toggle_action_get_active (action);
+    if (show_extra_dates != view->show_extra_dates)
+    {
+        view->show_extra_dates = show_extra_dates;
+        gnc_ledger_display2_refresh (priv->ledger);
+    }
+    LEAVE(" ");
+}
+
+static void
+gnc_plugin_page_register2_cmd_transfer (GtkAction *action,
+                                       GncPluginPageRegister2 *page) //this works
+{
+    Account *account;
+    GncWindow *gnc_window;
+    GtkWidget *window;
+
+    ENTER("(action %p, plugin_page %p)", action, page);
+
+    g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (page));
+
+    account = gnc_plugin_page_register2_get_account (page);
+    gnc_window = GNC_WINDOW (GNC_PLUGIN_PAGE (page)->window);
+    window = GTK_WIDGET (gnc_window_get_gtk_window (gnc_window));
+    gnc_xfer_dialog (window, account);
+    LEAVE(" ");
+}
+
+static void
+gnc_plugin_page_register2_cmd_reconcile (GtkAction *action,
+                                        GncPluginPageRegister2 *page) // this works
+{
+    GncPluginPageRegister2Private *priv;
+    GncTreeViewSplitReg *view;
+    Account *account;
+    Transaction *trans;
+    GtkWindow *window;
+    RecnWindow2 * recnData;
+
+    ENTER("(action %p, plugin_page %p)", action, page);
+
+    g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (page));
+
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (page);
+    view = gnc_ledger_display2_get_split_view_register (priv->ledger);
+
+    account = gnc_plugin_page_register2_get_account (page);
+
+    trans = gnc_tree_view_split_reg_get_current_trans (view);
+
+    /* Make sure we ask to commit any changes before we proceed */
+    if (gnc_tree_control_split_reg_trans_open_and_warn (view, trans))
+    {
+        LEAVE("trans being edited");
+        return;
+    }
+
+    window = gnc_window_get_gtk_window (GNC_WINDOW (GNC_PLUGIN_PAGE (page)->window));
+    recnData = recnWindow2 (GTK_WIDGET (window), account);
+    gnc_ui_reconcile_window2_raise (recnData);
+    LEAVE(" ");
+}
+
+static void
+gnc_plugin_page_register2_cmd_autoclear (GtkAction *action,
+                                        GncPluginPageRegister2 *page)
+{
+    Account *account;
+    GtkWindow *window;
+    AutoClearWindow * autoClearData;
+
+    ENTER("(action %p, plugin_page %p)", action, page);
+
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2(page));
+
+    account = gnc_plugin_page_register2_get_account (page);
+
+    window = gnc_window_get_gtk_window(GNC_WINDOW(GNC_PLUGIN_PAGE (page)->window));
+    autoClearData = autoClearWindow (GTK_WIDGET(window), account);
+    gnc_ui_autoclear_window_raise (autoClearData);
+    LEAVE(" ");
+}
+
+static void
+gnc_plugin_page_register2_cmd_stock_split (GtkAction *action,
+        GncPluginPageRegister2 *page) // this works
+{
+    Account *account;
+
+    ENTER("(action %p, plugin_page %p)", action, page);
+
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2(page));
+
+    account = gnc_plugin_page_register2_get_account (page);
+    gnc_stock_split_dialog (NULL, account);
+    LEAVE(" ");
+}
+
+static void
+gnc_plugin_page_register2_cmd_lots (GtkAction *action,
+                                   GncPluginPageRegister2 *page) // this works
+{
+    Account *account;
+
+    ENTER("(action %p, plugin_page %p)", action, page);
+
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2(page));
+
+    account = gnc_plugin_page_register2_get_account (page);
+    gnc_lot_viewer_dialog (account);
+    LEAVE(" ");
+}
+
+static void
+gnc_plugin_page_register2_cmd_enter_transaction (GtkAction *action,
+        GncPluginPageRegister2 *plugin_page) //this works
+{
+    GncPluginPageRegister2Private *priv;
+    GncTreeViewSplitReg *view;
+
+    ENTER("(action %p, plugin_page %p)", action, plugin_page);
+
+    g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (plugin_page));
+
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (plugin_page);
+    view = gnc_ledger_display2_get_split_view_register (priv->ledger);
+    gnc_tree_control_split_reg_enter (view);
+    LEAVE(" ");
+}
+
+static void
+gnc_plugin_page_register2_cmd_cancel_transaction (GtkAction *action,
+        GncPluginPageRegister2 *plugin_page) //this works
+{
+    GncPluginPageRegister2Private *priv;
+    GncTreeViewSplitReg *view;
+
+    ENTER("(action %p, plugin_page %p)", action, plugin_page);
+
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2 (plugin_page));
+
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (plugin_page);
+    view = gnc_ledger_display2_get_split_view_register (priv->ledger);
+    gnc_tree_control_split_reg_cancel_edit (view, FALSE);
+    LEAVE(" ");
+}
+
+static void
+gnc_plugin_page_register2_cmd_delete_transaction (GtkAction *action,
+        GncPluginPageRegister2 *plugin_page) //this works
+{
+    GncPluginPageRegister2Private *priv;
+    GncTreeViewSplitReg *view;
+
+    ENTER("(action %p, plugin_page %p)", action, plugin_page);
+
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2 (plugin_page));
+
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (plugin_page);
+    view = gnc_ledger_display2_get_split_view_register (priv->ledger);
+    gnc_tree_control_split_reg_delete (view, NULL);
+    LEAVE(" ");
+
+}
+
+static void
+gnc_plugin_page_register2_cmd_blank_transaction (GtkAction *action,
+        GncPluginPageRegister2 *plugin_page) //this works
+{
+    GncPluginPageRegister2Private *priv;
+    GncTreeViewSplitReg *view;
+
+    ENTER("(action %p, plugin_page %p)", action, plugin_page);
+
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2 (plugin_page));
+
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (plugin_page);
+    view = gnc_ledger_display2_get_split_view_register (priv->ledger);
+    gnc_tree_control_split_reg_jump_to_blank (view);
+    LEAVE(" ");
+}
+
+static void
+gnc_plugin_page_register2_cmd_duplicate_transaction (GtkAction *action,
+        GncPluginPageRegister2 *plugin_page) //this works
+{
+    GncPluginPageRegister2Private *priv;
+    GncTreeViewSplitReg *view;
+
+    ENTER("(action %p, plugin_page %p)", action, plugin_page);
+
+    g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (plugin_page));
+
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (plugin_page);
+    view = gnc_ledger_display2_get_split_view_register (priv->ledger);
+    gnc_tree_control_split_reg_duplicate_current (view);
+    LEAVE(" ");
+}
+
+static void
+gnc_plugin_page_register2_cmd_reinitialize_transaction (GtkAction *action,
+        GncPluginPageRegister2 *plugin_page) //this works
+{
+    GncPluginPageRegister2Private *priv;
+    GncTreeViewSplitReg *view;
+
+    ENTER("(action %p, plugin_page %p)", action, plugin_page);
+
+    g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (plugin_page));
+
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (plugin_page);
+    view = gnc_ledger_display2_get_split_view_register (priv->ledger);
+    gnc_tree_control_split_reg_reinit (view, NULL);
+    LEAVE(" ");
+}
+
+static void
+gnc_plugin_page_register2_cmd_expand_transaction (GtkToggleAction *action,
+        GncPluginPageRegister2 *plugin_page) // this works
+{
+    GncPluginPageRegister2Private *priv;
+    GncTreeViewSplitReg *view;
+    gboolean expand;
+
+    ENTER("(action %p, plugin_page %p)", action, plugin_page);
+
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2 (plugin_page));
+
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (plugin_page);
+    view = gnc_ledger_display2_get_split_view_register (priv->ledger);
+    expand = gtk_toggle_action_get_active (action);
+    if (expand)
+        gnc_tree_view_split_reg_expand_trans (view, NULL);
+    else
+        gnc_tree_view_split_reg_collapse_trans (view, NULL);
+    LEAVE(" ");
+}
+
+static void
+gnc_plugin_page_register2_cmd_exchange_rate (GtkAction *action,
+        GncPluginPageRegister2 *plugin_page) //this works
+{
+    GncPluginPageRegister2Private *priv;
+    GncTreeViewSplitReg *view;
+
+    ENTER("(action %p, plugin_page %p)", action, plugin_page);
+
+    g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (plugin_page));
+
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (plugin_page);
+    view = gnc_ledger_display2_get_split_view_register (priv->ledger);
+    gnc_tree_control_split_reg_exchange_rate (view);
+    LEAVE(" ");
+}
+
+static void
+gnc_plugin_page_register2_cmd_jump (GtkAction *action,
+        GncPluginPageRegister2 *plugin_page) //this works
+{
+    GncPluginPageRegister2Private *priv;
+    GncPluginPage *new_page;
+    GtkWidget *window;
+    GNCLedgerDisplay2 *ld;
+    GncTreeViewSplitReg *view, *new_view;
+    GncTreeModelSplitReg *new_model;
+    Account *account;
+    Account *leader;
+    Split *split;
+    RowDepth depth;
+
+    ENTER("(action %p, plugin_page %p)", action, plugin_page);
+
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2 (plugin_page));
+
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (plugin_page);
+    window = GNC_PLUGIN_PAGE (plugin_page)->window;
+    if (window == NULL)
+    {
+        LEAVE("no window");
+        return;
+    }
+
+    view = gnc_ledger_display2_get_split_view_register (priv->ledger);
+    split = gnc_tree_view_split_reg_get_current_split (view);
+    if (split == NULL)
+    {
+        split = gnc_tree_control_split_reg_get_current_trans_split (view);
+        if (split == NULL)
+        {
+            LEAVE("split is NULL");
+            return;
+        }
+    }
+
+    if (!gnc_tree_view_split_reg_trans_expanded (view, NULL))
+    {
+        Transaction *trans = xaccSplitGetParent (split);
+        if (xaccTransCountSplits (trans) > 2)
+        {
+            LEAVE("more than 2 splits");
+            return;
+        }
+    }
+
+    depth = gnc_tree_view_reg_get_selected_row_depth (view);
+    if (gnc_tree_view_split_reg_trans_expanded (view, NULL) && depth != SPLIT3)
+    {
+        LEAVE("expanded but no split selected");
+        return;
+    }
+
+    account = xaccSplitGetAccount (split);
+    if (account == NULL)
+    {
+        LEAVE("account is NULL");
+        return;
+    }
+
+    leader = gnc_ledger_display2_leader (priv->ledger);
+    if (account == leader)
+    {
+        split = xaccSplitGetOtherSplit (split);
+        if (split == NULL)
+        {
+            LEAVE("no other split");
+            return;
+        }
+
+        account = xaccSplitGetAccount (split);
+        if (account == NULL)
+        {
+            LEAVE("no other account");
+            return;
+        }
+
+        if (account == leader)
+        {
+            LEAVE("register open for account");
+            return;
+        }
+    }
+
+    new_page = gnc_plugin_page_register2_new (account, FALSE);
+    if (new_page == NULL)
+    {
+        LEAVE("couldn't create new page");
+        return;
+    }
+
+    gnc_main_window_open_page (GNC_MAIN_WINDOW (window), new_page);
+
+    ld = gnc_plugin_page_register2_get_ledger (new_page);
+    new_view = gnc_ledger_display2_get_split_view_register (ld);
+    new_model = gnc_ledger_display2_get_split_model_register (ld);
+
+    new_model->current_trans = xaccSplitGetParent (split);
+
+    if (!gnc_tree_model_split_reg_trans_is_in_view (new_model, xaccSplitGetParent (split)))
+        g_signal_emit_by_name (new_model, "refresh_trans");
+
+    gnc_tree_control_split_reg_jump_to (new_view, NULL, split, FALSE);
+    LEAVE(" ");
+}
+
+
+/**
+ * Schedules the current transaction for recurring-entry.
+ * If the selected transaction was created from a scheduled transaction,
+ * opens the editor for that Scheduled Transaction.
+ **/
+static void
+gnc_plugin_page_register2_cmd_schedule (GtkAction *action,
+                                       GncPluginPageRegister2 *plugin_page) // this works
+{
+    GncPluginPageRegister2Private *priv;
+    GncTreeViewSplitReg *view;
+    Transaction *trans;
+
+    ENTER("(action %p, plugin_page %p)", action, plugin_page);
+
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2(plugin_page));
+
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(plugin_page);
+    view = gnc_ledger_display2_get_split_view_register (priv->ledger);
+
+    trans = gnc_tree_view_split_reg_get_current_trans (view);
+
+    if (trans == NULL)
+    {
+        LEAVE("trans is NULL");
+        return;
+    }
+
+    /* See if we were asked to schedule a blank trans. */
+    if (trans == gnc_tree_control_split_reg_get_blank_trans (view))
+    {
+        LEAVE("Asked to schedule a blank trans");
+        return;
+    }
+
+    /* See if we are being edited in another register */
+    if (gnc_tree_control_split_reg_trans_test_for_edit (view, trans))
+    {
+        LEAVE("trans being edited in another register");
+        return;
+    }
+
+    /* Make sure we ask to commit any changes before we proceed */
+    if (gnc_tree_control_split_reg_trans_open_and_warn (view, trans))
+    {
+        LEAVE("trans being edited");
+        return;
+    }
+
+    /* If the transaction has a sched-xact KVP frame, then go to the editor
+     * for the existing SX; otherwise, do the sx-from-trans dialog. */
+    {
+	GncGUID *fromSXId = NULL;
+	SchedXaction *theSX = NULL;
+	GList *sxElts;
+	qof_instance_get (QOF_INSTANCE (trans),
+			  "from-sched-xaction", &fromSXId,
+			  NULL);
+
+	/* Get the correct SX */
+	for ( sxElts = gnc_book_get_schedxactions (gnc_get_current_book())->sx_list;
+	      (!theSX) && sxElts;
+	      sxElts = sxElts->next )
+	{
+	    SchedXaction *sx = (SchedXaction*)sxElts->data;
+	    theSX =
+		((guid_equal (xaccSchedXactionGetGUID (sx), fromSXId))
+		 ? sx : NULL);
+	}
+
+	if (theSX)
+	{
+	    gnc_ui_scheduled_xaction_editor_dialog_create2 (theSX, FALSE);
+	    LEAVE(" ");
+	    return;
+	}
+    }
+    gnc_sx_create_from_trans (trans);
+    LEAVE(" ");
+}
+
+static void
+gnc_plugin_page_register2_cmd_scrub_current (GtkAction *action,
+        GncPluginPageRegister2 *plugin_page) // this works
+{
+    GncPluginPageRegister2Private *priv;
+    GncTreeViewSplitReg *view;
+    Query *query;
+    Account *root;
+    Transaction *trans;
+
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2 (plugin_page));
+
+    ENTER("(action %p, plugin_page %p)", action, plugin_page);
+
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (plugin_page);
+    query = gnc_ledger_display2_get_query (priv->ledger);
+    if (query == NULL)
+    {
+        LEAVE("no query found");
+        return;
+    }
+
+    view = gnc_ledger_display2_get_split_view_register (priv->ledger);
+    trans = gnc_tree_view_split_reg_get_current_trans (view);
+    if (trans == NULL)
+    {
+        LEAVE("no trans found");
+        return;
+    }
+
+    gnc_suspend_gui_refresh();
+    root = gnc_get_current_root_account ();
+    xaccTransScrubOrphans (trans);
+    xaccTransScrubImbalance (trans, root, NULL);
+    gnc_resume_gui_refresh ();
+    LEAVE(" ");
+}
+
+static void
+gnc_plugin_page_register2_cmd_scrub_all (GtkAction *action,
+                                        GncPluginPageRegister2 *plugin_page) // this works
+{
+    GncPluginPageRegister2Private *priv;
+    Query *query;
+    Account *root;
+    Transaction *trans;
+    Split *split;
+    GList *node;
+
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2(plugin_page));
+
+    ENTER("(action %p, plugin_page %p)", action, plugin_page);
+
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(plugin_page);
+    query = gnc_ledger_display2_get_query( priv->ledger );
+    if (!query)
+    {
+        LEAVE("no query found");
+        return;
+    }
+
+    gnc_suspend_gui_refresh();
+    root = gnc_get_current_root_account();
+
+    for (node = qof_query_run(query); node; node = node->next)
+    {
+        split = node->data;
+        trans = xaccSplitGetParent(split);
+
+        xaccTransScrubOrphans(trans);
+        xaccTransScrubImbalance(trans, root, NULL);
+    }
+
+    gnc_resume_gui_refresh();
+    LEAVE(" ");
+}
+
+static void
+gnc_plugin_page_register2_cmd_account_report (GtkAction *action,
+        GncPluginPageRegister2 *plugin_page) // this works
+{
+    GncPluginPageRegister2Private *priv;
+    GncMainWindow *window;
+    int id;
+
+    ENTER("(action %p, plugin_page %p)", action, plugin_page);
+
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2(plugin_page));
+
+    window = GNC_MAIN_WINDOW(GNC_PLUGIN_PAGE(plugin_page)->window);
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(plugin_page);
+    id = report_helper (priv->ledger, NULL, NULL);
+    if (id >= 0)
+        gnc_main_window_open_report(id, window);
+    LEAVE(" ");
+}
+
+static void
+gnc_plugin_page_register2_cmd_transaction_report (GtkAction *action,
+        GncPluginPageRegister2 *plugin_page) // this works
+{
+    GncPluginPageRegister2Private *priv;
+    GncMainWindow *window;
+    GncTreeViewSplitReg *view;
+    Split *split;
+    Query *query;
+    int id;
+
+    ENTER("(action %p, plugin_page %p)", action, plugin_page);
+
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2 (plugin_page));
+
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (plugin_page);
+    view = gnc_ledger_display2_get_split_view_register (priv->ledger);
+
+    split = gnc_tree_view_split_reg_get_current_split (view);
+    if (!split)
+    {
+        LEAVE("split is NULL");
+        return;
+    }
+
+    query = qof_query_create_for(GNC_ID_SPLIT);
+
+    qof_query_set_book (query, gnc_get_current_book ());
+
+    xaccQueryAddGUIDMatch (query, xaccSplitGetGUID (split),
+                           GNC_ID_SPLIT, QOF_QUERY_AND);
+
+    window = GNC_MAIN_WINDOW(GNC_PLUGIN_PAGE(plugin_page)->window);
+    id = report_helper (priv->ledger, split, query);
+    if (id >= 0)
+        gnc_main_window_open_report(id, window);
+    LEAVE(" ");
+}
+
+/*#################################################################################*/
+/*#################################################################################*/
+
+/************************************************************/
+/*                    Auxiliary functions                   */
+/************************************************************/
+
+void
+gnc_plugin_page_register2_set_options (GncPluginPage *plugin_page,
+                                      gint lines_default,
+                                      gboolean read_only)
+{
+    GncPluginPageRegister2 *page;
+    GncPluginPageRegister2Private *priv;
+
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2(plugin_page));
+
+    page = GNC_PLUGIN_PAGE_REGISTER2 (plugin_page);
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(page);
+    priv->lines_default     = lines_default;
+    priv->read_only         = read_only;
+}
+
+GNCSplitReg2 *
+gnc_plugin_page_register2_get_gsr (GncPluginPage *plugin_page)
+{
+    GncPluginPageRegister2 *page;
+    GncPluginPageRegister2Private *priv;
+
+    g_return_val_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2(plugin_page), NULL);
+
+    page = GNC_PLUGIN_PAGE_REGISTER2 (plugin_page);
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(page);
+
+    return priv->gsr;
+}
+
+
+GNCLedgerDisplay2 *
+gnc_plugin_page_register2_get_ledger (GncPluginPage *plugin_page)
+{
+    GncPluginPageRegister2 *page;
+    GncPluginPageRegister2Private *priv;
+
+    g_return_val_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2(plugin_page), NULL);
+
+    page = GNC_PLUGIN_PAGE_REGISTER2 (plugin_page);
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(page);
+
+    return priv->ledger;
+}
+static void
+gnc_plugin_page_help_changed_cb (GNCSplitReg2 *gsr, GncPluginPageRegister2 *register_page) //this works
+{
+    GncPluginPageRegister2Private *priv;
+    GncTreeViewSplitReg *view;
+    GncWindow *window;
+    char *help;
+
+    g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (register_page));
+
+    window = GNC_WINDOW (GNC_PLUGIN_PAGE (register_page)->window);
+    if (!window)
+    {
+        // This routine can be called before the page is added to a
+        // window.
+        return;
+    }
+    /* Get the text from the view */
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (register_page);
+    view = gnc_ledger_display2_get_split_view_register (priv->ledger);
+    help = g_strdup (view->help_text);
+    gnc_window_set_status (window, GNC_PLUGIN_PAGE (register_page), help);
+    g_free (help);
+}
+
+static void
+gnc_plugin_page_register2_refresh_cb (GHashTable *changes, gpointer user_data) //this works
+{
+    GncPluginPageRegister2 *page = user_data;
+    GncPluginPageRegister2Private *priv;
+    GncTreeViewSplitReg *view;
+
+    g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (page));
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (page);
+    view = gnc_ledger_display2_get_split_view_register (priv->ledger);
+
+    if (changes)
+    {
+        const EventInfo* ei;
+
+        ei = gnc_gui_get_entity_events (changes, &priv->key);
+        if (ei)
+        {
+            if (ei->event_mask & QOF_EVENT_DESTROY)
+            {
+                /* Account has been deleted, close plugin page
+                 * but prevent that action from writing state information
+                 * for this deleted account
+                 */
+                g_object_set (G_OBJECT (view), "state-section", NULL, NULL);
+                gnc_main_window_close_page (GNC_PLUGIN_PAGE (page));
+                return;
+            }
+            if (ei->event_mask & QOF_EVENT_MODIFY)
+            {
+            }
+        }
+    }
+    else
+    {
+        /* Force updates */
+        gnc_tree_view_split_reg_refresh_from_prefs (view);
+    }
+    gnc_plugin_page_register2_ui_update (NULL, page);
+}
+
+static void
+gnc_plugin_page_register2_close_cb (gpointer user_data)
+{
+    GncPluginPage *plugin_page = GNC_PLUGIN_PAGE(user_data);
+    gnc_main_window_close_page (plugin_page);
+}
+
+/** This function is called when an account has been edited and an
+ *  "extreme" change has been made to it.  (E.G. Changing from a
+ *  credit card account to an expense account.  This rouine is
+ *  responsible for finding all open registers containing the account
+ *  and closing them.
+ *
+ *  @param account A pointer to the account that was changed.
+ */
+static void
+gppr_account_destroy_cb (Account *account)
+{
+    GncPluginPageRegister2 *page;
+    GncPluginPageRegister2Private *priv;
+    GNCLedgerDisplay2Type ledger_type;
+    const GncGUID *acct_guid;
+    const GList *citem;
+    GList *item, *kill = NULL;
+
+    acct_guid = xaccAccountGetGUID(account);
+
+    /* Find all windows that need to be killed.  Don't kill them yet, as
+     * that would affect the list being walked.*/
+    citem = gnc_gobject_tracking_get_list(GNC_PLUGIN_PAGE_REGISTER2_NAME);
+    for ( ; citem; citem = g_list_next(citem))
+    {
+        page = (GncPluginPageRegister2 *)citem->data;
+        priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(page);
+        ledger_type = gnc_ledger_display2_type (priv->ledger);
+        if (ledger_type == LD2_GL)
+        {
+            kill = g_list_append(kill, page);
+            /* kill it */
+        }
+        else if ((ledger_type == LD2_SINGLE) || (ledger_type == LD2_SUBACCOUNT))
+        {
+            if (guid_compare(acct_guid, &priv->key) == 0)
+            {
+                kill = g_list_append(kill, page);
+            }
+        }
+    }
+
+    /* Now kill them. */
+    for (item = kill; item; item = g_list_next(item))
+    {
+        page = (GncPluginPageRegister2 *)item->data;
+        gnc_main_window_close_page(GNC_PLUGIN_PAGE(page));
+    }
+}
+
+/** This function is the handler for all event messages from the
+ *  engine.  Its purpose is to update the register page any time
+ *  an account or transaction is changed.
+ *
+ *  @internal
+ *
+ *  @param entity A pointer to the affected item.
+ *
+ *  @param event_type The type of the affected item.
+ *
+ *  @param page A pointer to the register page.
+ *
+ *  @param ed
+ */
+static void
+gnc_plugin_page_register2_event_handler (QofInstance *entity,
+                                        QofEventId event_type,
+                                        GncPluginPageRegister2 *page,
+                                        GncEventData *ed)
+{
+    Transaction *trans;
+    QofBook *book;
+    GncPluginPage *visible_page;
+    GtkWidget *window;
+    gchar *label, *color;
+
+    g_return_if_fail(page);	/* Required */
+    if (!GNC_IS_TRANS(entity) && !GNC_IS_ACCOUNT(entity))
+        return;
+
+    ENTER("entity %p of type %d, page %p, event data %p",
+          entity, event_type, page, ed);
+
+    window = gnc_plugin_page_get_window(GNC_PLUGIN_PAGE(page));
+
+    if (GNC_IS_ACCOUNT(entity))
+    {
+        if (GNC_IS_MAIN_WINDOW(window))
+        {
+            label = gnc_plugin_page_register2_get_tab_name(GNC_PLUGIN_PAGE(page));
+            main_window_update_page_name(GNC_PLUGIN_PAGE(page), label);
+            color = gnc_plugin_page_register2_get_tab_color(GNC_PLUGIN_PAGE(page));
+            main_window_update_page_color(GNC_PLUGIN_PAGE(page), color);
+            g_free(color);
+            g_free(label);
+        }
+        LEAVE("tab name updated");
+        return;
+    }
+
+    if (!(event_type & (QOF_EVENT_MODIFY | QOF_EVENT_DESTROY)))
+    {
+        LEAVE("not a modify");
+        return;
+    }
+    trans = GNC_TRANS(entity);
+    book = qof_instance_get_book(QOF_INSTANCE(trans));
+    if (!gnc_plugin_page_has_book(GNC_PLUGIN_PAGE(page), book))
+    {
+        LEAVE("not in this book");
+        return;
+    }
+
+    if (GNC_IS_MAIN_WINDOW(window))
+    {
+        visible_page = gnc_main_window_get_current_page(GNC_MAIN_WINDOW(window));
+        if (visible_page != GNC_PLUGIN_PAGE(page))
+        {
+            LEAVE("page not visible");
+            return;
+        }
+    }
+
+    gnc_plugin_page_register2_ui_update(NULL, page);
+    LEAVE(" ");
+    return;
+}
+
+
+/** @} */
+/** @} */
diff --git a/src/gnome/gnc-plugin-page-register2.h b/gnucash/gnome/gnc-plugin-page-register2.h
similarity index 100%
rename from src/gnome/gnc-plugin-page-register2.h
rename to gnucash/gnome/gnc-plugin-page-register2.h
diff --git a/src/gnome/gnc-plugin-page-sx-list.c b/gnucash/gnome/gnc-plugin-page-sx-list.c
similarity index 100%
rename from src/gnome/gnc-plugin-page-sx-list.c
rename to gnucash/gnome/gnc-plugin-page-sx-list.c
diff --git a/src/gnome/gnc-plugin-page-sx-list.h b/gnucash/gnome/gnc-plugin-page-sx-list.h
similarity index 100%
rename from src/gnome/gnc-plugin-page-sx-list.h
rename to gnucash/gnome/gnc-plugin-page-sx-list.h
diff --git a/src/gnome/gnc-plugin-register.c b/gnucash/gnome/gnc-plugin-register.c
similarity index 100%
rename from src/gnome/gnc-plugin-register.c
rename to gnucash/gnome/gnc-plugin-register.c
diff --git a/src/gnome/gnc-plugin-register.h b/gnucash/gnome/gnc-plugin-register.h
similarity index 100%
rename from src/gnome/gnc-plugin-register.h
rename to gnucash/gnome/gnc-plugin-register.h
diff --git a/src/gnome/gnc-plugin-register2.c b/gnucash/gnome/gnc-plugin-register2.c
similarity index 100%
rename from src/gnome/gnc-plugin-register2.c
rename to gnucash/gnome/gnc-plugin-register2.c
diff --git a/src/gnome/gnc-plugin-register2.h b/gnucash/gnome/gnc-plugin-register2.h
similarity index 100%
rename from src/gnome/gnc-plugin-register2.h
rename to gnucash/gnome/gnc-plugin-register2.h
diff --git a/gnucash/gnome/gnc-split-reg.c b/gnucash/gnome/gnc-split-reg.c
new file mode 100644
index 0000000..610b2b4
--- /dev/null
+++ b/gnucash/gnome/gnc-split-reg.c
@@ -0,0 +1,2258 @@
+/********************************************************************\
+ * gnc-split-reg.c -- A widget for the common register look-n-feel. *
+ * Copyright (C) 1997 Robin D. Clark                                *
+ * Copyright (C) 1997-1998 Linas Vepstas <linas at linas.org>          *
+ * Copyright (C) 1998 Rob Browning <rlb at cs.utexas.edu>              *
+ * Copyright (C) 1999-2000 Dave Peticolas <dave at krondo.com>         *
+ * Copyright (C) 2001 Gnumatic, Inc.                                *
+ * Copyright (C) 2002,2006 Joshua Sled <jsled at asynchronous.org>     *
+ *                                                                  *
+ * 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 at gnu.org                   *
+\********************************************************************/
+
+#include "config.h"
+
+#include <gtk/gtk.h>
+#include <glib/gi18n.h>
+#include <time.h>
+
+#include "gnc-split-reg.h"
+
+#include "Account.h"
+#include "qof.h"
+#include "SX-book.h"
+#include "dialog-account.h"
+#include "dialog-sx-editor.h"
+#include "dialog-sx-from-trans.h"
+#include "gnc-component-manager.h"
+#include "gnc-date-edit.h"
+#include "gnc-engine.h"
+#include "gnc-euro.h"
+#include "gnc-prefs.h"
+#include "gnc-gui-query.h"
+#include "gnc-gnome-utils.h"
+#include "gnc-ledger-display.h"
+#include "gnc-pricedb.h"
+#include "gnc-ui-util.h"
+#include "gnc-ui.h"
+#include "gnc-warnings.h"
+#include "gnucash-sheet.h"
+#include "gnucash-register.h"
+#include "table-allgui.h"
+
+#include "dialog-utils.h"
+
+// static QofLogModule log_module = GNC_MOD_SX;
+static QofLogModule log_module = GNC_MOD_GUI;
+
+#define STATE_SECTION_REG_PREFIX "Register"
+
+/***** PROTOTYPES ***************************************************/
+void gnc_split_reg_raise( GNCSplitReg *gsr );
+
+static GtkWidget* add_summary_label( GtkWidget *summarybar,
+                                     const char *label_str );
+
+static void gnc_split_reg_determine_read_only( GNCSplitReg *gsr );
+
+static GNCPlaceholderType gnc_split_reg_get_placeholder( GNCSplitReg *gsr );
+static GtkWidget *gnc_split_reg_get_parent( GNCLedgerDisplay *ledger );
+
+static void gsr_create_table( GNCSplitReg *gsr );
+static void gsr_setup_table( GNCSplitReg *gsr );
+static void gsr_setup_status_widgets( GNCSplitReg *gsr );
+
+static void gsr_update_summary_label( GtkWidget *label,
+                                      xaccGetBalanceFn getter,
+                                      Account *leader,
+                                      GNCPrintAmountInfo print_info,
+                                      gnc_commodity *cmdty,
+                                      gboolean reverse,
+                                      gboolean euroFlag );
+
+static void gsr_redraw_all_cb (GnucashRegister *g_reg, gpointer data);
+
+static void gnc_split_reg_ld_destroy( GNCLedgerDisplay *ledger );
+
+static Transaction* create_balancing_transaction(QofBook *book, Account *account,
+        time64 statement_date, gnc_numeric balancing_amount);
+
+void gsr_default_enter_handler    ( GNCSplitReg *w, gpointer ud );
+void gsr_default_cancel_handler   ( GNCSplitReg *w, gpointer ud );
+void gsr_default_delete_handler   ( GNCSplitReg *w, gpointer ud );
+void gsr_default_reinit_handler   ( GNCSplitReg *w, gpointer ud );
+void gsr_default_dup_handler      ( GNCSplitReg *w, gpointer ud );
+void gsr_default_schedule_handler ( GNCSplitReg *w, gpointer ud );
+void gsr_default_expand_handler   ( GNCSplitReg *w, gpointer ud );
+void gsr_default_blank_handler    ( GNCSplitReg *w, gpointer ud );
+void gsr_default_jump_handler     ( GNCSplitReg *w, gpointer ud );
+void gsr_default_cut_handler      ( GNCSplitReg *w, gpointer ud );
+void gsr_default_cut_txn_handler  ( GNCSplitReg *w, gpointer ud );
+void gsr_default_copy_handler     ( GNCSplitReg *w, gpointer ud );
+void gsr_default_copy_txn_handler ( GNCSplitReg *w, gpointer ud );
+void gsr_default_paste_handler    ( GNCSplitReg *w, gpointer ud );
+void gsr_default_paste_txn_handler( GNCSplitReg *w, gpointer ud );
+void gsr_default_void_txn_handler ( GNCSplitReg *w, gpointer ud );
+void gsr_default_unvoid_txn_handler ( GNCSplitReg *w, gpointer ud );
+void gsr_default_reverse_txn_handler ( GNCSplitReg *w, gpointer ud );
+void gsr_default_associate_handler ( GNCSplitReg *w, gboolean uri_is_file );
+void gsr_default_execassociated_handler ( GNCSplitReg *w, gpointer ud );
+
+static void gsr_emit_simple_signal( GNCSplitReg *gsr, const char *sigName );
+static void gsr_emit_help_changed( GnucashRegister *reg, gpointer user_data );
+static void gsr_emit_include_date_signal( GNCSplitReg *gsr, time64 date );
+
+void gnc_split_reg_cut_cb(GtkWidget *w, gpointer data);
+void gnc_split_reg_copy_cb(GtkWidget *w, gpointer data);
+void gnc_split_reg_paste_cb(GtkWidget *w, gpointer data);
+
+void gnc_split_reg_cut_trans_cb(GtkWidget *w, gpointer data);
+void gnc_split_reg_copy_trans_cb(GtkWidget *w, gpointer data);
+void gnc_split_reg_paste_trans_cb(GtkWidget *w, gpointer data);
+void gnc_split_reg_void_trans_cb(GtkWidget *w, gpointer data);
+void gnc_split_reg_unvoid_trans_cb(GtkWidget *w, gpointer data);
+void gnc_split_reg_reverse_trans_cb(GtkWidget *w, gpointer data);
+
+void gnc_split_reg_record_cb (GnucashRegister *reg, gpointer data);
+void gnc_split_reg_reinitialize_trans_cb(GtkWidget *w, gpointer data);
+void gnc_split_reg_delete_trans_cb(GtkWidget *w, gpointer data);
+void gnc_split_reg_duplicate_trans_cb(GtkWidget *w, gpointer data);
+void gnc_split_reg_recur_cb(GtkWidget *w, gpointer data);
+void gnc_split_reg_record_trans_cb(GtkWidget *w, gpointer data);
+void gnc_split_reg_cancel_trans_cb(GtkWidget *w, gpointer data);
+
+void gnc_split_reg_expand_trans_menu_cb(GtkWidget *widget, gpointer data);
+void gnc_split_reg_expand_trans_toolbar_cb(GtkWidget *widget, gpointer data);
+void gnc_split_reg_new_trans_cb(GtkWidget *widget, gpointer data);
+void gnc_split_reg_jump_cb(GtkWidget *widget, gpointer data);
+
+void gnc_split_reg_style_ledger_cb (GtkWidget *w, gpointer data);
+void gnc_split_reg_style_auto_ledger_cb (GtkWidget *w, gpointer data);
+void gnc_split_reg_style_journal_cb (GtkWidget *w, gpointer data);
+void gnc_split_reg_double_line_cb (GtkWidget *w, gpointer data);
+
+void gnc_split_reg_sort_standard_cb (GtkWidget *w, gpointer data);
+void gnc_split_reg_sort_date_cb (GtkWidget *w, gpointer data);
+void gnc_split_reg_sort_date_entered_cb (GtkWidget *w, gpointer data);
+void gnc_split_reg_sort_date_reconciled_cb (GtkWidget *w, gpointer data);
+void gnc_split_reg_sort_num_cb (GtkWidget *w, gpointer data);
+void gnc_split_reg_sort_amount_cb (GtkWidget *w, gpointer data);
+void gnc_split_reg_sort_memo_cb (GtkWidget *w, gpointer data);
+void gnc_split_reg_sort_desc_cb (GtkWidget *w, gpointer data);
+void gnc_split_reg_sort_action_cb (GtkWidget *w, gpointer data);
+void gnc_split_reg_sort_notes_cb (GtkWidget *w, gpointer data);
+
+
+void gnc_split_reg_destroy_cb(GtkWidget *widget, gpointer data);
+void gnc_split_reg_size_allocate( GtkWidget *widget,
+                                  GtkAllocation *allocation,
+                                  gpointer user_data );
+
+
+static void gnc_split_reg_class_init( GNCSplitRegClass *klass );
+static void gnc_split_reg_init( GNCSplitReg *gsr );
+static void gnc_split_reg_init2( GNCSplitReg *gsr );
+
+FROM_STRING_FUNC(SortType, ENUM_LIST_SORTTYPE)
+AS_STRING_FUNC(SortType, ENUM_LIST_SORTTYPE)
+
+GType
+gnc_split_reg_get_type( void )
+{
+    static GType gnc_split_reg_type = 0;
+
+    if (!gnc_split_reg_type)
+    {
+        GTypeInfo type_info =
+        {
+            sizeof(GNCSplitRegClass),      /* class_size */
+            NULL,   			/* base_init */
+            NULL,				/* base_finalize */
+            (GClassInitFunc)gnc_split_reg_class_init,
+            NULL,				/* class_finalize */
+            NULL,				/* class_data */
+            sizeof(GNCSplitReg),		/* */
+            0,				/* n_preallocs */
+            (GInstanceInitFunc)gnc_split_reg_init,
+        };
+
+        gnc_split_reg_type = g_type_register_static( GTK_TYPE_BOX,
+                             "GNCSplitReg",
+                             &type_info, 0 );
+    }
+
+    return gnc_split_reg_type;
+}
+
+/* SIGNALS */
+enum gnc_split_reg_signal_enum
+{
+    ENTER_ENT_SIGNAL,
+    CANCEL_ENT_SIGNAL,
+    DELETE_ENT_SIGNAL,
+    REINIT_ENT_SIGNAL,
+    DUP_ENT_SIGNAL,
+    SCHEDULE_ENT_SIGNAL,
+    EXPAND_ENT_SIGNAL,
+    BLANK_SIGNAL,
+    JUMP_SIGNAL,
+    CUT_SIGNAL,
+    CUT_TXN_SIGNAL,
+    COPY_SIGNAL,
+    COPY_TXN_SIGNAL,
+    PASTE_SIGNAL,
+    PASTE_TXN_SIGNAL,
+    VOID_TXN_SIGNAL,
+    UNVOID_TXN_SIGNAL,
+    REVERSE_TXN_SIGNAL,
+    HELP_CHANGED_SIGNAL,
+    INCLUDE_DATE_SIGNAL,
+    LAST_SIGNAL
+};
+
+static guint gnc_split_reg_signals[LAST_SIGNAL] = { 0 };
+
+static void
+gnc_split_reg_class_init( GNCSplitRegClass *klass )
+{
+    int i;
+    GObjectClass *object_class;
+    static struct similar_signal_info
+    {
+        enum gnc_split_reg_signal_enum s;
+        const char *signal_name;
+        guint defaultOffset;
+    } signals[] =
+    {
+        { ENTER_ENT_SIGNAL,    "enter_ent",    G_STRUCT_OFFSET( GNCSplitRegClass, enter_ent_cb ) },
+        { CANCEL_ENT_SIGNAL,   "cancel_ent",   G_STRUCT_OFFSET( GNCSplitRegClass, cancel_ent_cb ) },
+        { DELETE_ENT_SIGNAL,   "delete_ent",   G_STRUCT_OFFSET( GNCSplitRegClass, delete_ent_cb ) },
+        { REINIT_ENT_SIGNAL,   "reinit_ent",   G_STRUCT_OFFSET( GNCSplitRegClass, reinit_ent_cb ) },
+        { DUP_ENT_SIGNAL,      "dup_ent",      G_STRUCT_OFFSET( GNCSplitRegClass, dup_ent_cb ) },
+        { SCHEDULE_ENT_SIGNAL, "schedule_ent", G_STRUCT_OFFSET( GNCSplitRegClass, schedule_ent_cb ) },
+        { EXPAND_ENT_SIGNAL,   "expand_ent",   G_STRUCT_OFFSET( GNCSplitRegClass, expand_ent_cb ) },
+        { BLANK_SIGNAL,        "blank",        G_STRUCT_OFFSET( GNCSplitRegClass, blank_cb ) },
+        { JUMP_SIGNAL,         "jump",         G_STRUCT_OFFSET( GNCSplitRegClass, jump_cb ) },
+        { CUT_SIGNAL,          "cut",          G_STRUCT_OFFSET( GNCSplitRegClass, cut_cb ) },
+        { CUT_TXN_SIGNAL,      "cut_txn",      G_STRUCT_OFFSET( GNCSplitRegClass, cut_txn_cb ) },
+        { COPY_SIGNAL,         "copy",         G_STRUCT_OFFSET( GNCSplitRegClass, copy_cb ) },
+        { COPY_TXN_SIGNAL,     "copy_txn",     G_STRUCT_OFFSET( GNCSplitRegClass, copy_txn_cb ) },
+        { PASTE_SIGNAL,        "paste",        G_STRUCT_OFFSET( GNCSplitRegClass, paste_cb ) },
+        { PASTE_TXN_SIGNAL,    "paste_txn",    G_STRUCT_OFFSET( GNCSplitRegClass, paste_txn_cb ) },
+        { VOID_TXN_SIGNAL,     "void_txn",     G_STRUCT_OFFSET( GNCSplitRegClass, void_txn_cb ) },
+        { UNVOID_TXN_SIGNAL,   "unvoid_txn",   G_STRUCT_OFFSET( GNCSplitRegClass, unvoid_txn_cb ) },
+        { REVERSE_TXN_SIGNAL,  "reverse_txn",  G_STRUCT_OFFSET( GNCSplitRegClass, reverse_txn_cb ) },
+        { HELP_CHANGED_SIGNAL, "help-changed", G_STRUCT_OFFSET( GNCSplitRegClass, help_changed_cb ) },
+        { INCLUDE_DATE_SIGNAL, "include-date", G_STRUCT_OFFSET( GNCSplitRegClass, include_date_cb ) },
+        { LAST_SIGNAL, NULL, 0 }
+    };
+
+    object_class = (GObjectClass*) klass;
+
+    for ( i = 0; signals[i].s != INCLUDE_DATE_SIGNAL; i++ )
+    {
+        gnc_split_reg_signals[ signals[i].s ] =
+            g_signal_new( signals[i].signal_name,
+                          G_TYPE_FROM_CLASS(object_class),
+                          G_SIGNAL_RUN_LAST,
+                          signals[i].defaultOffset,
+                          NULL, NULL,
+                          g_cclosure_marshal_VOID__VOID,
+                          G_TYPE_NONE, 0 );
+    }
+    /* Setup the non-default-marshalled signals; 'i' is still valid, here. */
+    /* "include-date" */
+    gnc_split_reg_signals[ INCLUDE_DATE_SIGNAL ] =
+        g_signal_new( "include-date",
+                      G_TYPE_FROM_CLASS(object_class),
+                      G_SIGNAL_RUN_LAST,
+                      signals[i++].defaultOffset,
+                      NULL, NULL,
+                      g_cclosure_marshal_VOID__INT, /* time64 == int */
+                      G_TYPE_NONE, 1, G_TYPE_INT );
+
+    g_assert( i == LAST_SIGNAL );
+
+    /* Setup the default handlers. */
+    klass->enter_ent_cb    = gsr_default_enter_handler;
+    klass->cancel_ent_cb   = gsr_default_cancel_handler;
+    klass->delete_ent_cb   = gsr_default_delete_handler;
+    klass->reinit_ent_cb   = gsr_default_reinit_handler;
+    klass->dup_ent_cb      = gsr_default_dup_handler;
+    klass->schedule_ent_cb = gsr_default_schedule_handler;
+    klass->expand_ent_cb   = gsr_default_expand_handler;
+    klass->blank_cb        = gsr_default_blank_handler;
+    klass->jump_cb         = gsr_default_jump_handler;
+    klass->cut_cb          = gsr_default_cut_handler;
+    klass->cut_txn_cb      = gsr_default_cut_txn_handler;
+    klass->copy_cb         = gsr_default_copy_handler;
+    klass->copy_txn_cb     = gsr_default_copy_txn_handler;
+    klass->paste_cb        = gsr_default_paste_handler;
+    klass->paste_txn_cb    = gsr_default_paste_txn_handler;
+    klass->void_txn_cb     = gsr_default_void_txn_handler;
+    klass->unvoid_txn_cb   = gsr_default_unvoid_txn_handler;
+    klass->reverse_txn_cb  = gsr_default_reverse_txn_handler;
+
+    klass->help_changed_cb = NULL;
+    klass->include_date_cb = NULL;
+}
+
+GtkWidget*
+gnc_split_reg_new( GNCLedgerDisplay *ld,
+                   GtkWindow *parent,
+                   gint numberOfLines,
+                   gboolean read_only )
+{
+    GNCSplitReg *gsrToRet;
+
+    ENTER("ld=%p, parent=%p, numberOfLines=%d, read_only=%s",
+          ld, parent, numberOfLines, read_only ? "TRUE" : "FALSE");
+
+    gsrToRet = g_object_new( gnc_split_reg_get_type(), NULL );
+
+    gsrToRet->numRows        = numberOfLines;
+    gsrToRet->read_only      = read_only;
+
+    gsrToRet->ledger = ld;
+    gsrToRet->window = GTK_WIDGET(parent);
+
+    gnc_split_reg_init2( gsrToRet );
+
+    LEAVE("%p", gsrToRet);
+    return GTK_WIDGET( gsrToRet );
+}
+
+static void
+gnc_split_reg_init( GNCSplitReg *gsr )
+{
+    gtk_orientable_set_orientation (GTK_ORIENTABLE(gsr), GTK_ORIENTATION_VERTICAL);
+
+    gsr->sort_type = BY_STANDARD;
+    gsr->width = -1;
+    gsr->height = -1;
+    gsr->numRows = 10;
+    gsr->read_only = FALSE;
+
+    g_signal_connect( gsr, "destroy",
+                      G_CALLBACK (gnc_split_reg_destroy_cb), gsr );
+}
+
+static void
+gnc_split_reg_init2( GNCSplitReg *gsr )
+{
+    if ( !gsr ) return;
+
+    gnc_split_reg_determine_read_only( gsr );
+
+    gsr_setup_status_widgets( gsr );
+    /* ordering is important here... setup_status before create_table */
+    gsr_create_table( gsr );
+    gsr_setup_table( gsr );
+}
+
+static
+void
+gsr_setup_table( GNCSplitReg *gsr )
+{
+    SplitRegister *sr;
+
+    ENTER("gsr=%p", gsr);
+
+    sr = gnc_ledger_display_get_split_register( gsr->ledger );
+    gnc_split_register_show_present_divider( sr, TRUE );
+    /* events should be sufficient to redraw this */
+    /* gnc_ledger_display_refresh( gsr->ledger ); */
+
+    LEAVE(" ");
+}
+
+static
+void
+gsr_create_table( GNCSplitReg *gsr )
+{
+    GtkWidget *register_widget = NULL;
+    SplitRegister *sr = NULL;
+
+    Account * account = gnc_ledger_display_leader(gsr->ledger);
+    const GncGUID * guid = xaccAccountGetGUID(account);
+    gchar guidstr[GUID_ENCODING_LENGTH+1];
+    gchar *state_section = NULL;
+    guid_to_string_buff(guid, guidstr);
+    state_section = g_strconcat (STATE_SECTION_REG_PREFIX, " ", guidstr, NULL);
+
+    ENTER("gsr=%p", gsr);
+
+    gnc_ledger_display_set_user_data( gsr->ledger, (gpointer)gsr );
+    gnc_ledger_display_set_handlers( gsr->ledger,
+                                     gnc_split_reg_ld_destroy,
+                                     gnc_split_reg_get_parent );
+
+    /* FIXME: We'd really rather pass this down... */
+    sr = gnc_ledger_display_get_split_register( gsr->ledger );
+    register_widget = gnucash_register_new( sr->table, state_section );
+    gsr->reg = GNUCASH_REGISTER( register_widget );
+    g_free (state_section);
+    gtk_box_pack_start (GTK_BOX (gsr), GTK_WIDGET(gsr->reg), TRUE, TRUE, 0);
+    gnucash_sheet_set_window (gnucash_register_get_sheet (gsr->reg), gsr->window);
+    gtk_widget_show ( GTK_WIDGET(gsr->reg) );
+    g_signal_connect (gsr->reg, "activate_cursor",
+                      G_CALLBACK(gnc_split_reg_record_cb), gsr);
+    g_signal_connect (gsr->reg, "redraw_all",
+                      G_CALLBACK(gsr_redraw_all_cb), gsr);
+    g_signal_connect (gsr->reg, "redraw_help",
+                      G_CALLBACK(gsr_emit_help_changed), gsr);
+
+    LEAVE(" ");
+}
+
+static
+void
+gsr_setup_status_widgets( GNCSplitReg *gsr )
+{
+    SplitRegister *sr;
+    gboolean use_double_line;
+
+    sr = gnc_ledger_display_get_split_register( gsr->ledger );
+    use_double_line = gnc_ledger_display_default_double_line( gsr->ledger );
+
+    /* be sure to initialize the gui elements associated with the cursor */
+    gnc_split_register_config( sr, sr->type, sr->style, use_double_line );
+}
+
+void
+gnc_split_reg_destroy_cb(GtkWidget *widget, gpointer data)
+{
+}
+
+/**
+ * Raise an existing register window to the front.
+ **/
+void
+gnc_split_reg_raise( GNCSplitReg *gsr )
+{
+    if (gsr == NULL)
+        return;
+
+    if (gsr->window == NULL)
+        return;
+
+    gtk_window_present( GTK_WINDOW(gsr->window) );
+}
+
+
+/**
+ * Duplicate-code reduction function; retreives, formats and updates the
+ * GtkLabel with the given amount.
+ **/
+static
+void
+gsr_update_summary_label( GtkWidget *label,
+                          xaccGetBalanceFn getter,
+                          Account *leader,
+                          GNCPrintAmountInfo print_info,
+                          gnc_commodity *cmdty,
+                          gboolean reverse,
+                          gboolean euroFlag )
+{
+    gnc_numeric amount;
+    char string[256];
+
+    if ( label == NULL )
+        return;
+
+    amount = (*getter)( leader );
+
+    if ( reverse )
+    {
+        amount = gnc_numeric_neg( amount );
+    }
+
+    xaccSPrintAmount( string, amount, print_info );
+
+    if ( euroFlag )
+    {
+        strcat( string, " / " );
+        xaccSPrintAmount( string + strlen( string ),
+                          gnc_convert_to_euro( cmdty, amount ),
+                          gnc_commodity_print_info( gnc_get_euro(), TRUE ) );
+    }
+
+    gnc_set_label_color( label, amount );
+    gtk_label_set_text( GTK_LABEL(label), string );
+}
+
+static
+void
+gsr_redraw_all_cb (GnucashRegister *g_reg, gpointer data)
+{
+    GNCSplitReg *gsr = data;
+    gnc_commodity * commodity;
+    GNCPrintAmountInfo print_info;
+    gnc_numeric amount;
+    Account *leader;
+    gboolean reverse;
+    gboolean euro;
+
+    if ( gsr->summarybar == NULL )
+        return;
+
+    leader = gnc_ledger_display_leader( gsr->ledger );
+
+    commodity = xaccAccountGetCommodity( leader );
+
+    /* no EURO converson, if account is already EURO or no EURO currency */
+    if (commodity != NULL)
+        euro = (gnc_is_euro_currency( commodity ) &&
+                (strncasecmp(gnc_commodity_get_mnemonic(commodity), "EUR", 3)));
+    else
+        euro = FALSE;
+
+    print_info = gnc_account_print_info( leader, TRUE );
+    reverse = gnc_reverse_balance( leader );
+
+    gsr_update_summary_label( gsr->balance_label,
+                              xaccAccountGetPresentBalance,
+                              leader, print_info, commodity, reverse, euro );
+    gsr_update_summary_label( gsr->cleared_label,
+                              xaccAccountGetClearedBalance,
+                              leader, print_info, commodity, reverse, euro );
+    gsr_update_summary_label( gsr->reconciled_label,
+                              xaccAccountGetReconciledBalance,
+                              leader, print_info, commodity, reverse, euro );
+    gsr_update_summary_label( gsr->future_label,
+                              xaccAccountGetBalance,
+                              leader, print_info, commodity, reverse, euro );
+    gsr_update_summary_label( gsr->projectedminimum_label,
+                              xaccAccountGetProjectedMinimumBalance,
+                              leader, print_info, commodity, reverse, euro );
+    if (gsr->shares_label == NULL && gsr->value_label == NULL)
+        return;
+    amount = xaccAccountGetBalance( leader );
+    if (reverse)
+        amount = gnc_numeric_neg( amount );
+
+   /* Print the summary share amount */
+    if (gsr->shares_label != NULL)
+    {
+        char string[256];
+        print_info = gnc_account_print_info( leader, TRUE );
+        xaccSPrintAmount( string, amount, print_info );
+        gnc_set_label_color( gsr->shares_label, amount );
+        gtk_label_set_text( GTK_LABEL(gsr->shares_label), string );
+    }
+
+    /* Print the summary share value */
+    if (gsr->value_label != NULL)
+    {
+        char string[256];
+        QofBook *book = gnc_account_get_book (leader);
+        GNCPriceDB *pricedb = gnc_pricedb_get_db (book);
+        gnc_commodity *currency = gnc_default_currency ();
+        print_info = gnc_commodity_print_info (currency, TRUE);
+        xaccSPrintAmount (string, amount, print_info);
+        gnc_set_label_color (gsr->value_label, amount);
+        gtk_label_set_text (GTK_LABEL (gsr->value_label), string);
+
+    }
+}
+
+static void
+gnc_split_reg_ld_destroy( GNCLedgerDisplay *ledger )
+{
+    GNCSplitReg *gsr = gnc_ledger_display_get_user_data( ledger );
+
+    Account * account = gnc_ledger_display_leader(ledger);
+    const GncGUID * guid = xaccAccountGetGUID(account);
+    gchar guidstr[GUID_ENCODING_LENGTH+1];
+    gchar *state_section;
+
+    guid_to_string_buff(guid, guidstr);
+
+    state_section = g_strconcat (STATE_SECTION_REG_PREFIX, " ", guidstr, NULL);
+
+    if (gsr)
+    {
+        SplitRegister *reg;
+
+        reg = gnc_ledger_display_get_split_register (ledger);
+
+        if (reg && reg->table)
+            gnc_table_save_state (reg->table, state_section);
+
+        /*
+         * Don't destroy the window here any more.  The register no longer
+         * owns it.
+         */
+    }
+    g_free (state_section);
+    gnc_ledger_display_set_user_data (ledger, NULL);
+}
+
+void
+gsr_default_cut_handler( GNCSplitReg *gsr, gpointer data )
+{
+    gnucash_register_cut_clipboard( gsr->reg );
+}
+
+/**
+ * Cut the selection to the clipboard.  This refers to the Split.
+ **/
+void
+gnc_split_reg_cut_cb (GtkWidget *w, gpointer data)
+{
+    GNCSplitReg *gsr = data;
+    gsr_emit_simple_signal( gsr, "cut" );
+}
+
+void
+gsr_default_copy_handler( GNCSplitReg *gsr, gpointer data )
+{
+    gnucash_register_copy_clipboard( gsr->reg );
+}
+
+/**
+ * Copy the selection to the clipboard.  This refers to the Split.
+ **/
+void
+gnc_split_reg_copy_cb (GtkWidget *w, gpointer data)
+{
+    GNCSplitReg *gsr = data;
+    gsr_emit_simple_signal( gsr, "copy" );
+}
+
+void
+gsr_default_paste_handler( GNCSplitReg *gsr, gpointer data )
+{
+    gnucash_register_paste_clipboard( gsr->reg );
+}
+
+/**
+ * Paste the clipboard to the selection.  This refers to the Split.
+ **/
+void
+gnc_split_reg_paste_cb (GtkWidget *w, gpointer data)
+{
+    GNCSplitReg *gsr = data;
+    gsr_emit_simple_signal( gsr, "paste" );
+}
+
+void
+gsr_default_cut_txn_handler( GNCSplitReg *gsr, gpointer data )
+{
+    gnc_split_register_cut_current
+    (gnc_ledger_display_get_split_register( gsr->ledger ));
+}
+
+/**
+ * Cut the current transaction  to the clipboard.
+ **/
+void
+gnc_split_reg_cut_trans_cb (GtkWidget *w, gpointer data)
+{
+    GNCSplitReg *gsr = data;
+    gsr_emit_simple_signal( gsr, "cut_txn" );
+}
+
+void
+gsr_default_copy_txn_handler( GNCSplitReg *gsr, gpointer data )
+{
+    gnc_split_register_copy_current
+    (gnc_ledger_display_get_split_register( gsr->ledger ));
+}
+
+/**
+ * Copy the current transaction to the clipboard.
+ **/
+void
+gnc_split_reg_copy_trans_cb(GtkWidget *w, gpointer data)
+{
+    GNCSplitReg *gsr = data;
+    gsr_emit_simple_signal( gsr, "copy_txn" );
+}
+
+void
+gsr_default_paste_txn_handler( GNCSplitReg *gsr, gpointer data )
+{
+    gnc_split_register_paste_current
+    (gnc_ledger_display_get_split_register( gsr->ledger ));
+}
+
+/**
+ * Paste the transaction clipboard to the selection.
+ **/
+void
+gnc_split_reg_paste_trans_cb (GtkWidget *w, gpointer data)
+{
+    GNCSplitReg *gsr = data;
+    gsr_emit_simple_signal( gsr, "paste_txn" );
+}
+
+/********************************************************************\
+ * gnc_split_reg_void_trans_cb                                      *
+ *                                                                  *
+ * Args:   widget - the widget that called us                       *
+ *         data   - the data struct for this register               *
+ * Return: none                                                     *
+\********************************************************************/
+void
+gsr_default_void_txn_handler (GNCSplitReg *gsr, gpointer data)
+{
+    // Override this function.
+}
+
+void
+gnc_split_reg_void_trans_cb (GtkWidget *w, gpointer data)
+{
+    GNCSplitReg *gsr = data;
+    gsr_emit_simple_signal( gsr, "void_txn" );
+}
+
+/********************************************************************\
+ * gnc_split_reg_unvoid_trans_cb                                      *
+ *                                                                  *
+ * Args:   widget - the widget that called us                       *
+ *         data   - the data struct for this register               *
+ * Return: none                                                     *
+\********************************************************************/
+void
+gsr_default_unvoid_txn_handler (GNCSplitReg *gsr, gpointer data)
+{
+    // Override this function.
+}
+
+void
+gnc_split_reg_unvoid_trans_cb (GtkWidget *w, gpointer data)
+{
+    GNCSplitReg *gsr = data;
+    gsr_emit_simple_signal( gsr, "unvoid_txn" );
+}
+
+/********************************************************************\
+ * gnc_split_reg_reverse_trans_cb                                   *
+ *                                                                  *
+ * Args:   widget - the widget that called us                       *
+ *         data   - the data struct for this register               *
+ * Return: none                                                     *
+\********************************************************************/
+void
+gsr_default_reverse_txn_handler (GNCSplitReg *gsr, gpointer data)
+{
+    SplitRegister *reg;
+    Transaction *trans, *new_trans;
+
+    reg = gnc_ledger_display_get_split_register( gsr->ledger );
+    trans = gnc_split_register_get_current_trans (reg);
+    if (trans == NULL)
+        return;
+
+    if (xaccTransGetReversedBy(trans))
+    {
+        gnc_error_dialog(gsr->window, "%s",
+                         _("A reversing entry has already been created for this transaction."));
+        return;
+    }
+
+    new_trans = xaccTransReverse(trans);
+
+    /* Clear transaction level info */
+    xaccTransSetDatePostedSecsNormalized(new_trans, gnc_time (NULL));
+    xaccTransSetDateEnteredSecs(new_trans, gnc_time (NULL));
+
+    /* Now jump to new trans */
+    gnc_split_reg_jump_to_split(gsr, xaccTransGetSplit(new_trans, 0));
+}
+
+void
+gnc_split_reg_reverse_trans_cb (GtkWidget *w, gpointer data)
+{
+    GNCSplitReg *gsr = data;
+    gsr_emit_simple_signal( gsr, "reverse_txn" );
+}
+
+
+static gboolean
+is_trans_readonly_and_warn (const Transaction *trans)
+{
+    GtkWidget *dialog;
+    const gchar *reason;
+    const gchar *title = _("Cannot modify or delete this transaction.");
+    const gchar *message =
+        _("This transaction is marked read-only with the comment: '%s'");
+
+    if (!trans) return FALSE;
+
+    if (xaccTransIsReadonlyByPostedDate (trans))
+    {
+        dialog = gtk_message_dialog_new(NULL,
+                                        0,
+                                        GTK_MESSAGE_ERROR,
+                                        GTK_BUTTONS_OK,
+                                        "%s", title);
+        gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
+                "%s", _("The date of this transaction is older than the \"Read-Only Threshold\" set for this book. "
+                        "This setting can be changed in File -> Properties -> Accounts."));
+        gtk_dialog_run(GTK_DIALOG(dialog));
+        gtk_widget_destroy(dialog);
+        return TRUE;
+    }
+
+    reason = xaccTransGetReadOnly (trans);
+    if (reason)
+    {
+        dialog = gtk_message_dialog_new(NULL,
+                                        0,
+                                        GTK_MESSAGE_ERROR,
+                                        GTK_BUTTONS_OK,
+                                        "%s", title);
+        gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
+                message, reason);
+        gtk_dialog_run(GTK_DIALOG(dialog));
+        gtk_widget_destroy(dialog);
+        return TRUE;
+    }
+    return FALSE;
+}
+
+
+void
+gsr_default_reinit_handler( GNCSplitReg *gsr, gpointer data )
+{
+    VirtualCellLocation vcell_loc;
+    SplitRegister *reg;
+    Transaction *trans;
+    Split *split;
+    GtkWidget *dialog;
+    gint response;
+    const gchar *warning;
+
+    const char *title = _("Remove the splits from this transaction?");
+    const char *recn_warn = _("This transaction contains reconciled splits. "
+                              "Modifying it is not a good idea because that will "
+                              "cause your reconciled balance to be off.");
+
+    reg = gnc_ledger_display_get_split_register( gsr->ledger );
+
+    trans = gnc_split_register_get_current_trans (reg);
+    if (is_trans_readonly_and_warn(trans))
+        return;
+    dialog = gtk_message_dialog_new(GTK_WINDOW(gsr->window),
+                                    GTK_DIALOG_DESTROY_WITH_PARENT,
+                                    GTK_MESSAGE_WARNING,
+                                    GTK_BUTTONS_NONE,
+                                    "%s", title);
+    if (xaccTransHasReconciledSplits (trans))
+    {
+        gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
+                "%s", recn_warn);
+        warning = GNC_PREF_WARN_REG_SPLIT_DEL_ALL_RECD;
+    }
+    else
+    {
+        warning = GNC_PREF_WARN_REG_SPLIT_DEL_ALL;
+    }
+
+    gtk_dialog_add_button(GTK_DIALOG(dialog),
+                          _("_Cancel"), GTK_RESPONSE_CANCEL);
+    gnc_gtk_dialog_add_button(dialog, _("_Remove Splits"),
+                              "edit-delete", GTK_RESPONSE_ACCEPT);
+    response = gnc_dialog_run(GTK_DIALOG(dialog), warning);
+    gtk_widget_destroy (dialog);
+    if (response != GTK_RESPONSE_ACCEPT)
+        return;
+
+    /*
+     * Find the "transaction" split for the current transaction. This is
+     * the split that appears at the top of the transaction in the
+     * register.
+     */
+    split = gnc_split_register_get_current_split (reg);
+    if (!gnc_split_register_get_split_virt_loc(reg, split, &vcell_loc))
+        return;
+    split = gnc_split_register_get_current_trans_split (reg, &vcell_loc);
+    gnc_split_register_empty_current_trans_except_split (reg, split);
+}
+
+/**
+ * "Reinitializes" the current transaction.
+ **/
+void
+gnc_split_reg_reinitialize_trans_cb(GtkWidget *widget, gpointer data)
+{
+    GNCSplitReg *gsr = data;
+    gsr_emit_simple_signal( gsr, "reinit_ent" );
+}
+
+static void
+gsr_default_associate_handler_file (GNCSplitReg *gsr, Transaction *trans, gboolean have_uri)
+{
+    GtkWidget *dialog;
+    gint       response;
+    gboolean   valid_path_head = FALSE;
+    gchar     *path_head = gnc_prefs_get_string (GNC_PREFS_GROUP_GENERAL, "assoc-head");
+
+    dialog = gtk_file_chooser_dialog_new (_("Associate File with Transaction"),
+                                     GTK_WINDOW(gsr->window),
+                                     GTK_FILE_CHOOSER_ACTION_OPEN,
+                                     _("_Remove"), GTK_RESPONSE_REJECT,
+                                     _("_Cancel"), GTK_RESPONSE_CANCEL,
+                                     _("_OK"), GTK_RESPONSE_ACCEPT,
+                                     NULL);
+
+    gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER(dialog), FALSE);
+
+    if ((path_head != NULL) && (g_strcmp0 (path_head, "") != 0)) // not default entry
+        valid_path_head = TRUE;
+
+    if (have_uri)
+    {
+        gchar *new_uri;
+        gchar *uri_label;
+        gchar *filename;
+
+        const gchar *uri = xaccTransGetAssociation (trans);
+
+        if (valid_path_head && g_str_has_prefix (uri,"file:/") && !g_str_has_prefix (uri,"file://")) 
+        {
+            const gchar *part = uri + strlen ("file:");
+            new_uri = g_strconcat (path_head, part, NULL);
+        }
+        else
+            new_uri = g_strdup (uri);
+
+        filename = g_uri_unescape_string (new_uri, NULL);
+        uri_label = g_strconcat (_("Existing Association is "), filename, NULL);
+        gtk_file_chooser_set_extra_widget (GTK_FILE_CHOOSER(dialog), gtk_label_new (uri_label));
+        gtk_file_chooser_set_uri (GTK_FILE_CHOOSER(dialog), new_uri);
+
+        g_free (uri_label);
+        g_free (new_uri);
+        g_free (filename);
+    }
+    response = gtk_dialog_run (GTK_DIALOG (dialog));
+
+    if (response == GTK_RESPONSE_REJECT)
+        xaccTransSetAssociation (trans, "");
+
+    if (response == GTK_RESPONSE_ACCEPT)
+    {
+	gchar *dialog_uri = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (dialog));
+
+        PINFO("Dialog File URI: %s\n", dialog_uri);
+
+        if (valid_path_head && g_str_has_prefix (dialog_uri, path_head))
+        {
+            gchar *part = dialog_uri + strlen (path_head);
+            gchar *new_uri = g_strconcat ("file:", part, NULL);
+            xaccTransSetAssociation (trans, new_uri);
+            g_free (new_uri);
+        }
+        else
+            xaccTransSetAssociation (trans, dialog_uri);
+
+        g_free (dialog_uri);
+    }
+    g_free (path_head);
+    gtk_widget_destroy (dialog);
+}
+
+static void
+gsr_default_associate_handler_location (GNCSplitReg *gsr, Transaction *trans, gboolean have_uri)
+{
+    GtkWidget *dialog, *entry, *label, *content_area;
+    gint response;
+
+    dialog = gtk_dialog_new_with_buttons (_("Associate Location with Transaction"),
+                                     GTK_WINDOW(gsr->window),
+                                     GTK_DIALOG_MODAL,
+                                     _("_Remove"), GTK_RESPONSE_REJECT,
+                                     _("_Cancel"), GTK_RESPONSE_CANCEL,
+                                     _("_OK"), GTK_RESPONSE_ACCEPT,
+                                     NULL);
+
+    content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
+
+    // add the entry text
+    entry = gtk_entry_new ();
+    gtk_entry_set_width_chars (GTK_ENTRY (entry), 80);
+    gtk_entry_set_activates_default (GTK_ENTRY (entry), TRUE);
+
+    // add a label and set entry text if required
+    if (have_uri)
+    {
+        label = gtk_label_new (_("Amend URL:"));
+        gtk_entry_set_text (GTK_ENTRY (entry), xaccTransGetAssociation (trans));
+    }
+    else
+        label = gtk_label_new (_("Enter URL:"));
+
+    // pack label and entry to content area
+    gnc_label_set_alignment (label, 0.0, 0.5);
+    gtk_container_add (GTK_CONTAINER (content_area), label);
+    gtk_container_add (GTK_CONTAINER (content_area), entry);
+
+    // set spacings
+    gtk_container_set_border_width (GTK_CONTAINER (dialog), 12);
+
+    // set the default response
+    gtk_dialog_set_default_response (GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT);
+
+    gtk_widget_show_all (dialog);
+
+    // run the dialog
+    response = gtk_dialog_run (GTK_DIALOG (dialog));
+
+    if (response == GTK_RESPONSE_REJECT)
+        xaccTransSetAssociation (trans, "");
+
+    if (response == GTK_RESPONSE_ACCEPT)
+    {
+        const gchar *dialog_uri = gtk_entry_get_text (GTK_ENTRY (entry));
+        DEBUG("Location URI: %s\n", dialog_uri);
+        xaccTransSetAssociation (trans, dialog_uri);
+    }
+    gtk_widget_destroy (dialog);
+}
+
+/**
+ * Associates a URI with the current transaction.
+ **/
+void
+gsr_default_associate_handler (GNCSplitReg *gsr, gboolean uri_is_file)
+{
+    SplitRegister *reg = gnc_ledger_display_get_split_register (gsr->ledger);
+    Split *split = gnc_split_register_get_current_split (reg);
+    Transaction *trans;
+    CursorClass cursor_class;
+    const gchar *uri;
+    gboolean have_uri = FALSE;
+
+    /* get the current split based on cursor position */
+    if (split == NULL)
+    {
+        gnc_split_register_cancel_cursor_split_changes (reg);
+        return;
+    }
+
+    trans = xaccSplitGetParent (split);
+    cursor_class = gnc_split_register_get_current_cursor_class (reg);
+
+    if (cursor_class == CURSOR_CLASS_NONE)
+        return;
+
+    if (is_trans_readonly_and_warn (trans))
+        return;
+
+    // get the existing uri
+    uri = xaccTransGetAssociation (trans);
+
+    // Check for uri is empty or NULL
+    if (g_strcmp0 (uri, "") != 0 && g_strcmp0 (uri, NULL) != 0)
+    {
+        have_uri = TRUE;
+
+        if (g_str_has_prefix (uri, "file:")) // use the correct dialog
+            uri_is_file = TRUE;
+        else
+            uri_is_file = FALSE;
+    }
+
+    if (uri_is_file == TRUE)
+        gsr_default_associate_handler_file (gsr, trans, have_uri);
+    else
+        gsr_default_associate_handler_location (gsr, trans, have_uri);
+}
+
+/**
+ * Executes the associated link with the current transaction.
+ **/
+void
+gsr_default_execassociated_handler (GNCSplitReg *gsr, gpointer data)
+{
+    CursorClass cursor_class;
+    SplitRegister *reg = gnc_ledger_display_get_split_register (gsr->ledger);
+    Transaction *trans;
+    Split *split = gnc_split_register_get_current_split (reg);
+    const char *uri;
+    const char *run_uri;
+    gchar *uri_scheme;
+
+    /* get the current split based on cursor position */
+    if (split == NULL)
+    {
+        gnc_split_register_cancel_cursor_split_changes (reg);
+        return;
+    }
+
+    trans = xaccSplitGetParent (split);
+    cursor_class = gnc_split_register_get_current_cursor_class (reg);
+
+    if (cursor_class == CURSOR_CLASS_NONE)
+        return;
+
+#ifdef DUMP_FUNCTIONS
+    if (qof_log_check (log_module, QOF_LOG_DEBUG))
+        xaccTransDump (trans, "ExecAssociated");
+#endif
+
+    uri = xaccTransGetAssociation (trans);
+
+    if (g_strcmp0 (uri, "") == 0 && g_strcmp0 (uri, NULL) == 0)
+        gnc_error_dialog (NULL, "%s", _("This transaction is not associated with a URI."));
+    else
+    {
+        if (g_str_has_prefix (uri,"file:/") && !g_str_has_prefix (uri,"file://")) // Check for relative path
+        {
+            gchar *path_head = gnc_prefs_get_string (GNC_PREFS_GROUP_GENERAL, "assoc-head");
+
+            if ((path_head != NULL) && (g_strcmp0 (path_head, "") != 0)) // not default entry
+            {
+                const gchar *part = uri + strlen ("file:");
+                run_uri = g_strconcat (path_head, part, NULL);
+            }
+            else
+                run_uri = g_strdup (uri);
+        }
+        else
+            run_uri = g_strdup (uri);
+
+        uri_scheme = g_uri_parse_scheme (run_uri);
+
+        if (uri_scheme != NULL) // make sure we have a scheme entry
+        {
+            gnc_launch_assoc (run_uri);
+            g_free (uri_scheme);
+        }
+        else
+            gnc_error_dialog (NULL, "%s", _("This transaction is not associated with a valid URI."));
+    }
+    return;
+}
+
+void
+gsr_default_delete_handler( GNCSplitReg *gsr, gpointer data )
+{
+    CursorClass cursor_class;
+    SplitRegister *reg;
+    Transaction *trans;
+    Split *split;
+    GtkWidget *dialog;
+    gint response;
+    const gchar *warning;
+
+    reg = gnc_ledger_display_get_split_register( gsr->ledger );
+
+    /* get the current split based on cursor position */
+    split = gnc_split_register_get_current_split(reg);
+    if (split == NULL)
+    {
+        gnc_split_register_cancel_cursor_split_changes (reg);
+        return;
+    }
+
+    trans = xaccSplitGetParent(split);
+    cursor_class = gnc_split_register_get_current_cursor_class (reg);
+
+    /* Deleting the blank split just cancels */
+    {
+        Split *blank_split = gnc_split_register_get_blank_split (reg);
+
+        if (split == blank_split)
+        {
+            gnc_split_register_cancel_cursor_trans_changes (reg);
+            return;
+        }
+    }
+
+    if (cursor_class == CURSOR_CLASS_NONE)
+        return;
+
+    if (is_trans_readonly_and_warn(trans))
+        return;
+
+    /* On a split cursor, just delete the one split. */
+    if (cursor_class == CURSOR_CLASS_SPLIT)
+    {
+        const char *format = _("Delete the split '%s' from the transaction '%s'?");
+        const char *recn_warn = _("You would be deleting a reconciled split! "
+                                  "This is not a good idea as it will cause your "
+                                  "reconciled balance to be off.");
+        const char *anchor_error = _("You cannot delete this split.");
+        const char *anchor_split = _("This is the split anchoring this transaction "
+                                     "to the register. You may not delete it from "
+                                     "this register window. You may delete the "
+                                     "entire transaction from this window, or you "
+                                     "may navigate to a register that shows "
+                                     "another side of this same transaction and "
+                                     "delete the split from that register.");
+        char *buf = NULL;
+        const char *memo;
+        const char *desc;
+        char recn;
+
+        if (split == gnc_split_register_get_current_trans_split (reg, NULL))
+        {
+            dialog = gtk_message_dialog_new(GTK_WINDOW(gsr->window),
+                                            GTK_DIALOG_MODAL
+                                            | GTK_DIALOG_DESTROY_WITH_PARENT,
+                                            GTK_MESSAGE_ERROR,
+                                            GTK_BUTTONS_OK,
+                                            "%s", anchor_error);
+            gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
+                    "%s", anchor_split);
+            gtk_dialog_run(GTK_DIALOG(dialog));
+            gtk_widget_destroy (dialog);
+            return;
+        }
+
+        memo = xaccSplitGetMemo (split);
+        memo = (memo && *memo) ? memo : _("(no memo)");
+
+        desc = xaccTransGetDescription (trans);
+        desc = (desc && *desc) ? desc : _("(no description)");
+
+        /* ask for user confirmation before performing permanent damage */
+        buf = g_strdup_printf (format, memo, desc);
+        dialog = gtk_message_dialog_new(GTK_WINDOW(gsr->window),
+                                        GTK_DIALOG_MODAL
+                                        | GTK_DIALOG_DESTROY_WITH_PARENT,
+                                        GTK_MESSAGE_QUESTION,
+                                        GTK_BUTTONS_NONE,
+                                        "%s", buf);
+        g_free(buf);
+        recn = xaccSplitGetReconcile (split);
+        if (recn == YREC || recn == FREC)
+        {
+            gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
+                    "%s", recn_warn);
+            warning = GNC_PREF_WARN_REG_SPLIT_DEL_RECD;
+        }
+        else
+        {
+            warning = GNC_PREF_WARN_REG_SPLIT_DEL;
+        }
+
+        gtk_dialog_add_button(GTK_DIALOG(dialog),
+                              _("_Cancel"), GTK_RESPONSE_CANCEL);
+        gnc_gtk_dialog_add_button(dialog, _("_Delete Split"),
+                                  "edit-delete", GTK_RESPONSE_ACCEPT);
+        response = gnc_dialog_run(GTK_DIALOG(dialog), warning);
+        gtk_widget_destroy (dialog);
+        if (response != GTK_RESPONSE_ACCEPT)
+            return;
+
+        gnc_split_register_delete_current_split (reg);
+        return;
+    }
+
+    g_return_if_fail(cursor_class == CURSOR_CLASS_TRANS);
+
+    /* On a transaction cursor with 2 or fewer splits in single or double
+     * mode, we just delete the whole transaction, kerblooie */
+    {
+        const char *title = _("Delete the current transaction?");
+        const char *recn_warn = _("You would be deleting a transaction "
+                                  "with reconciled splits! "
+                                  "This is not a good idea as it will cause your "
+                                  "reconciled balance to be off.");
+
+        dialog = gtk_message_dialog_new(GTK_WINDOW(gsr->window),
+                                        GTK_DIALOG_MODAL
+                                        | GTK_DIALOG_DESTROY_WITH_PARENT,
+                                        GTK_MESSAGE_WARNING,
+                                        GTK_BUTTONS_NONE,
+                                        "%s", title);
+        if (xaccTransHasReconciledSplits (trans))
+        {
+            gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
+                    "%s", recn_warn);
+            warning = GNC_PREF_WARN_REG_TRANS_DEL_RECD;
+        }
+        else
+        {
+            warning = GNC_PREF_WARN_REG_TRANS_DEL;
+        }
+        gtk_dialog_add_button(GTK_DIALOG(dialog),
+                              _("_Cancel"), GTK_RESPONSE_CANCEL);
+        gnc_gtk_dialog_add_button(dialog, _("_Delete Transaction"),
+                                  "edit-delete", GTK_RESPONSE_ACCEPT);
+        response =  gnc_dialog_run(GTK_DIALOG(dialog), warning);
+        gtk_widget_destroy (dialog);
+        if (response != GTK_RESPONSE_ACCEPT)
+            return;
+
+        gnc_split_register_delete_current_trans (reg);
+        return;
+    }
+}
+
+/**
+ * Deletes the current transaction.
+ **/
+void
+gnc_split_reg_delete_trans_cb(GtkWidget *widget, gpointer data)
+{
+    GNCSplitReg *gsr = data;
+    gsr_emit_simple_signal( gsr, "delete_ent" );
+}
+
+void
+gsr_default_dup_handler( GNCSplitReg *gsr, gpointer data )
+{
+    gnc_split_register_duplicate_current
+    (gnc_ledger_display_get_split_register( gsr->ledger ));
+}
+
+/**
+ * Duplicates the current transaction in the register.
+ **/
+void
+gnc_split_reg_duplicate_trans_cb(GtkWidget *w, gpointer data)
+{
+    GNCSplitReg *gsr = data;
+    gsr_emit_simple_signal( gsr, "dup_ent" );
+}
+
+/**
+ * Schedules the current transaction for recurring-entry.
+ * If the selected transaction was created from a scheduled transaction,
+ * opens the editor for that Scheduled Transaction.
+ **/
+void
+gsr_default_schedule_handler( GNCSplitReg *gsr, gpointer data )
+{
+    SplitRegister *reg = gnc_ledger_display_get_split_register( gsr->ledger );
+    Transaction *pending_trans = gnc_split_register_get_current_trans (reg);
+
+    /* If the transaction has a sched-xact KVP frame, then go to the editor
+     * for the existing SX; otherwise, do the sx-from-trans dialog. */
+    {
+	GncGUID *fromSXId = NULL;
+	SchedXaction *theSX = NULL;
+	GList *sxElts;
+	qof_instance_get (QOF_INSTANCE (pending_trans),
+			  "from-sched-xaction", &fromSXId,
+			  NULL);
+
+	/* Get the correct SX */
+	for ( sxElts = gnc_book_get_schedxactions (gnc_get_current_book())->sx_list;
+	      (!theSX) && sxElts;
+	      sxElts = sxElts->next )
+	{
+	    SchedXaction *sx = (SchedXaction*)sxElts->data;
+	    theSX =
+		((guid_equal (xaccSchedXactionGetGUID (sx), fromSXId))
+		 ? sx : NULL);
+	}
+
+	if ( theSX )
+	{
+	    gnc_ui_scheduled_xaction_editor_dialog_create(theSX, FALSE);
+	    return;
+	}
+    }
+
+    gnc_sx_create_from_trans(pending_trans);
+}
+
+void
+gnc_split_reg_recur_cb(GtkWidget *w, gpointer data)
+{
+    GNCSplitReg *gsr = data;
+    gsr_emit_simple_signal( gsr, "schedule_ent" );
+}
+
+/**
+ * Records into the books the currently-selected transaction.
+ **/
+void
+gnc_split_reg_record_trans_cb (GtkWidget *w, gpointer data)
+{
+    GNCSplitReg *gsr = data;
+    gsr_emit_simple_signal( gsr, "enter_ent" );
+}
+
+void
+gsr_default_cancel_handler( GNCSplitReg *gsr, gpointer data )
+{
+    gnc_split_register_cancel_cursor_trans_changes
+    (gnc_ledger_display_get_split_register( gsr->ledger ));
+}
+
+/**
+ * Cancels the edits of the currently-selected transaction.
+ **/
+void
+gnc_split_reg_cancel_trans_cb(GtkWidget *w, gpointer data)
+{
+    GNCSplitReg *gsr = data;
+    gsr_emit_simple_signal( gsr, "cancel_ent" );
+}
+
+void
+gsr_default_expand_handler( GNCSplitReg *gsr, gpointer data )
+{
+    gint activeCount;
+    gboolean expand;
+    SplitRegister *reg;
+
+    if (!gsr)
+        return;
+
+    reg = gnc_ledger_display_get_split_register (gsr->ledger);
+
+    /* These should all be in agreement. */
+    activeCount =
+        ( ( gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM(gsr->split_menu_check)) ? 1 : -1 )
+          + ( gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM(gsr->split_popup_check)) ? 1 : -1 )
+          + ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(gsr->split_button) )
+              ? 1 : -1 ) );
+
+    /* If activeCount > 0, then there's more active than inactive; otherwise,
+     * more inactive than active.  Both determine which state the user is
+     * attempting to get to. */
+    expand = ( activeCount < 0 );
+
+    /* The ledger's invocation of 'redraw_all' will force the agreement in the
+     * other split state widgets, so we neglect doing it here.  */
+    gnc_split_register_expand_current_trans (reg, expand);
+}
+
+void
+gnc_split_reg_expand_trans_menu_cb (GtkWidget *widget, gpointer data)
+{
+    GNCSplitReg *gsr = data;
+    gsr_emit_simple_signal( gsr, "expand_ent" );
+}
+
+void
+gnc_split_reg_expand_trans_toolbar_cb (GtkWidget *widget, gpointer data)
+{
+    GNCSplitReg *gsr = data;
+    gsr_emit_simple_signal( gsr, "expand_ent" );
+}
+
+/**
+ * move the cursor to the split, if present in register
+**/
+void
+gnc_split_reg_jump_to_split(GNCSplitReg *gsr, Split *split)
+{
+    Transaction *trans;
+    VirtualCellLocation vcell_loc;
+    SplitRegister *reg;
+
+    if (!gsr) return;
+
+    trans = xaccSplitGetParent(split);
+
+    gsr_emit_include_date_signal( gsr, xaccTransGetDate(trans) );
+
+    reg = gnc_ledger_display_get_split_register( gsr->ledger );
+
+    if (gnc_split_register_get_split_virt_loc(reg, split, &vcell_loc))
+        gnucash_register_goto_virt_cell( gsr->reg, vcell_loc );
+
+    gnc_ledger_display_refresh( gsr->ledger );
+}
+
+
+/**
+ * Move the cursor to the split in the non-blank amount column.
+ **/
+void
+gnc_split_reg_jump_to_split_amount(GNCSplitReg *gsr, Split *split)
+{
+    VirtualLocation virt_loc;
+    SplitRegister *reg;
+    Transaction *trans;
+
+    if (!gsr) return;
+
+    trans = xaccSplitGetParent(split);
+    gsr_emit_include_date_signal( gsr, xaccTransGetDate(trans) );
+
+    reg = gnc_ledger_display_get_split_register (gsr->ledger);
+
+    if (gnc_split_register_get_split_amount_virt_loc (reg, split, &virt_loc))
+        gnucash_register_goto_virt_loc (gsr->reg, virt_loc);
+
+    gnc_ledger_display_refresh (gsr->ledger);
+}
+
+void
+gnc_split_reg_jump_to_blank (GNCSplitReg *gsr)
+{
+    SplitRegister *reg = gnc_ledger_display_get_split_register (gsr->ledger);
+    VirtualCellLocation vcell_loc;
+    Split *blank;
+
+    ENTER("gsr=%p", gsr);
+
+    blank = gnc_split_register_get_blank_split (reg);
+    if (blank == NULL)
+    {
+        LEAVE("no blank split");
+        return;
+    }
+
+    if (gnc_split_register_get_split_virt_loc (reg, blank, &vcell_loc))
+        gnucash_register_goto_virt_cell (gsr->reg, vcell_loc);
+
+    gnc_ledger_display_refresh (gsr->ledger);
+    LEAVE(" ");
+}
+
+void
+gnc_split_reg_balancing_entry(GNCSplitReg *gsr, Account *account,
+                              time64 statement_date, gnc_numeric balancing_amount)
+{
+
+    Transaction *transaction;
+    Split *split;
+
+    // create transaction
+    transaction = create_balancing_transaction(gnc_get_current_book(),
+                  account, statement_date, balancing_amount);
+
+    // jump to transaction
+    split = xaccTransFindSplitByAccount(transaction, account);
+    if (split == NULL)
+    {
+        // default behaviour: jump to blank split
+        g_warning("create_balancing_transaction failed");
+        gnc_split_reg_jump_to_blank(gsr);
+    }
+    else
+    {
+        // goto balancing transaction
+        gnc_split_reg_jump_to_split(gsr, split );
+    }
+}
+
+static Transaction*
+create_balancing_transaction(QofBook *book, Account *account,
+                             time64 statement_date, gnc_numeric balancing_amount)
+{
+
+    Transaction *trans;
+    Split *split;
+
+    if (!account)
+        return NULL;
+    if (gnc_numeric_zero_p(balancing_amount))
+        return NULL;
+
+    xaccAccountBeginEdit(account);
+
+    trans = xaccMallocTransaction(book);
+
+    xaccTransBeginEdit(trans);
+
+    // fill Transaction
+    xaccTransSetCurrency(trans, gnc_account_or_default_currency(account, NULL));
+    xaccTransSetDatePostedSecsNormalized(trans, statement_date);
+    xaccTransSetDescription(trans, _("Balancing entry from reconciliation"));
+    /* We also must set a new DateEntered on the new entry
+     * because otherwise the ordering is not deterministic */
+    xaccTransSetDateEnteredSecs(trans, gnc_time(NULL));
+
+    // 1. Split
+    split = xaccMallocSplit(book);
+    xaccTransAppendSplit(trans, split);
+    xaccAccountInsertSplit(account, split);
+    xaccSplitSetAmount(split, balancing_amount);
+    xaccSplitSetValue(split, balancing_amount);
+
+    // 2. Split (no account is defined: split goes to orphan account)
+    split = xaccMallocSplit(book);
+    xaccTransAppendSplit(trans, split);
+
+    balancing_amount = gnc_numeric_neg(balancing_amount);
+    xaccSplitSetAmount(split, balancing_amount);
+    xaccSplitSetValue(split, balancing_amount);
+
+    xaccTransCommitEdit(trans);
+    xaccAccountCommitEdit(account);
+    return trans;
+}
+
+void
+gsr_default_blank_handler( GNCSplitReg *gsr, gpointer data )
+{
+    SplitRegister *reg;
+
+    ENTER("gsr=%p, gpointer=%p", gsr, data);
+
+    reg = gnc_ledger_display_get_split_register (gsr->ledger);
+
+    if (gnc_split_register_save (reg, TRUE))
+        gnc_split_register_redraw (reg);
+
+    gnc_split_reg_jump_to_blank (gsr);
+    LEAVE(" ");
+}
+
+void
+gnc_split_reg_new_trans_cb (GtkWidget *widget, gpointer data)
+{
+    GNCSplitReg *gsr = data;
+    gsr_emit_simple_signal( gsr, "blank" );
+}
+
+void
+gsr_default_jump_handler( GNCSplitReg *gsr, gpointer data )
+{
+    g_assert_not_reached();
+}
+
+void
+gnc_split_reg_jump_cb( GtkWidget *widget, gpointer data )
+{
+    GNCSplitReg *gsr = data;
+    gsr_emit_simple_signal( gsr, "jump" );
+}
+
+void
+gnc_split_reg_change_style (GNCSplitReg *gsr, SplitRegisterStyle style)
+{
+    SplitRegister *reg = gnc_ledger_display_get_split_register (gsr->ledger);
+
+    if (style == reg->style)
+        return;
+
+    gnc_split_register_config (reg, reg->type, style, reg->use_double_line);
+    gnc_ledger_display_refresh (gsr->ledger);
+}
+
+void
+gnc_split_reg_style_ledger_cb (GtkWidget *w, gpointer data)
+{
+    GNCSplitReg *gsr = data;
+
+    if (!gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM(w)))
+        return;
+
+    gnc_split_reg_change_style (gsr, REG_STYLE_LEDGER);
+}
+
+void
+gnc_split_reg_style_auto_ledger_cb (GtkWidget *w, gpointer data)
+{
+    GNCSplitReg *gsr = data;
+
+    if (!gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM(w)))
+        return;
+
+    gnc_split_reg_change_style (gsr, REG_STYLE_AUTO_LEDGER);
+}
+
+void
+gnc_split_reg_style_journal_cb (GtkWidget *w, gpointer data)
+{
+    GNCSplitReg *gsr = data;
+
+    if (!gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM(w)))
+        return;
+
+    gnc_split_reg_change_style (gsr, REG_STYLE_JOURNAL);
+}
+
+void
+gnc_split_reg_double_line_cb (GtkWidget *w, gpointer data)
+{
+    GNCSplitReg *gsr = data;
+    SplitRegister *reg = gnc_ledger_display_get_split_register (gsr->ledger);
+    gboolean use_double_line;
+
+    use_double_line = gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM(w));
+    if ( use_double_line == reg->use_double_line )
+        return;
+
+    gnc_split_register_config( reg, reg->type, reg->style, use_double_line );
+    gnc_ledger_display_refresh( gsr->ledger );
+}
+
+static void
+gnc_split_reg_sort_force( GNCSplitReg *gsr, SortType sort_code, gboolean force )
+{
+    Query *query = gnc_ledger_display_get_query( gsr->ledger );
+    gboolean show_present_divider = FALSE;
+    GSList *p1 = NULL, *p2 = NULL, *p3 = NULL, *standard;
+    SplitRegister *reg;
+
+    if ((gsr->sort_type == sort_code) && !force)
+        return;
+
+    standard = g_slist_prepend( NULL, QUERY_DEFAULT_SORT );
+
+    switch (sort_code)
+    {
+    case BY_STANDARD:
+        p1 = standard;
+        show_present_divider = TRUE;
+        break;
+    case BY_DATE:
+        p1 = g_slist_prepend (p1, TRANS_DATE_POSTED);
+        p1 = g_slist_prepend (p1, SPLIT_TRANS);
+        p2 = standard;
+        show_present_divider = TRUE;
+        break;
+    case BY_DATE_ENTERED:
+        p1 = g_slist_prepend (p1, TRANS_DATE_ENTERED);
+        p1 = g_slist_prepend (p1, SPLIT_TRANS);
+        p2 = standard;
+        break;
+    case BY_DATE_RECONCILED:
+        p1 = g_slist_prepend (p1, SPLIT_RECONCILE);
+        p2 = g_slist_prepend (p2, SPLIT_DATE_RECONCILED);
+        p3 = standard;
+        break;
+    case BY_NUM:
+        p1 = g_slist_prepend (p1, TRANS_NUM);
+        p1 = g_slist_prepend (p1, SPLIT_TRANS);
+        p2 = standard;
+        break;
+    case BY_AMOUNT:
+        p1 = g_slist_prepend (p1, SPLIT_VALUE);
+        p2 = standard;
+        break;
+    case BY_MEMO:
+        p1 = g_slist_prepend (p1, SPLIT_MEMO);
+        p2 = standard;
+        break;
+    case BY_DESC:
+        p1 = g_slist_prepend (p1, TRANS_DESCRIPTION);
+        p1 = g_slist_prepend (p1, SPLIT_TRANS);
+        p2 = standard;
+        break;
+    case BY_ACTION:
+        p1 = g_slist_prepend (p1, SPLIT_ACTION);
+        p2 = standard;
+        break;
+    case BY_NOTES:
+        p1 = g_slist_prepend (p1, TRANS_NOTES);
+        p1 = g_slist_prepend (p1, SPLIT_TRANS);
+        p2 = standard;
+        break;
+    default:
+        g_slist_free (standard);
+        g_return_if_fail (FALSE);
+        break;
+    }
+
+    qof_query_set_sort_order( query, p1, p2, p3 );
+    reg = gnc_ledger_display_get_split_register( gsr->ledger );
+    gnc_split_register_show_present_divider( reg, show_present_divider );
+    gsr->sort_type = sort_code;
+    gnc_ledger_display_refresh( gsr->ledger );
+}
+
+static void
+gnc_split_reg_sort( GNCSplitReg *gsr, SortType sort_code )
+{
+    gnc_split_reg_sort_force( gsr, sort_code, FALSE );
+}
+
+void
+gnc_split_reg_sort_standard_cb(GtkWidget *w, gpointer data)
+{
+    GNCSplitReg *gsr = data;
+    gnc_split_reg_sort(gsr, BY_STANDARD);
+}
+
+void
+gnc_split_reg_sort_date_cb(GtkWidget *w, gpointer data)
+{
+    GNCSplitReg *gsr = data;
+    gnc_split_reg_sort(gsr, BY_DATE);
+}
+
+void
+gnc_split_reg_sort_date_entered_cb(GtkWidget *w, gpointer data)
+{
+    GNCSplitReg *gsr = data;
+    gnc_split_reg_sort(gsr, BY_DATE_ENTERED);
+}
+
+void
+gnc_split_reg_sort_date_reconciled_cb(GtkWidget *w, gpointer data)
+{
+    GNCSplitReg *gsr = data;
+    gnc_split_reg_sort(gsr, BY_DATE_RECONCILED);
+}
+
+void
+gnc_split_reg_sort_num_cb(GtkWidget *w, gpointer data)
+{
+    GNCSplitReg *gsr = data;
+    gnc_split_reg_sort(gsr, BY_NUM);
+}
+
+void
+gnc_split_reg_sort_amount_cb(GtkWidget *w, gpointer data)
+{
+    GNCSplitReg *gsr = data;
+    gnc_split_reg_sort(gsr, BY_AMOUNT);
+}
+
+void
+gnc_split_reg_sort_memo_cb(GtkWidget *w, gpointer data)
+{
+    GNCSplitReg *gsr = data;
+    gnc_split_reg_sort(gsr, BY_MEMO);
+}
+
+void
+gnc_split_reg_sort_desc_cb(GtkWidget *w, gpointer data)
+{
+    GNCSplitReg *gsr = data;
+    gnc_split_reg_sort(gsr, BY_DESC);
+}
+
+void
+gnc_split_reg_sort_action_cb(GtkWidget *w, gpointer data)
+{
+    GNCSplitReg *gsr = data;
+    gnc_split_reg_sort(gsr, BY_ACTION);
+}
+
+void
+gnc_split_reg_sort_notes_cb(GtkWidget *w, gpointer data)
+{
+    GNCSplitReg *gsr = data;
+    gnc_split_reg_sort(gsr, BY_NOTES);
+}
+
+
+void
+gnc_split_reg_set_sort_reversed(GNCSplitReg *gsr, gboolean rev)
+{
+  /* Note: sort_reversed is the boolean opposite of sort_increasing
+   *       so when rev == true, we're sorting decreasing
+   *       In other words, qof_query_set_sort_increasing should
+   *       always use the inverse of rev.
+   */
+  Query *query = gnc_ledger_display_get_query( gsr->ledger );
+  qof_query_set_sort_increasing (query, !rev, !rev, !rev);
+  gnc_ledger_display_refresh( gsr->ledger );
+}
+
+static void
+gnc_split_reg_record (GNCSplitReg *gsr)
+{
+    SplitRegister *reg;
+    Transaction *trans;
+
+    ENTER("gsr=%p", gsr);
+
+    reg = gnc_ledger_display_get_split_register (gsr->ledger);
+    trans = gnc_split_register_get_current_trans (reg);
+
+    if (!gnc_split_register_save (reg, TRUE))
+    {
+        LEAVE("no save");
+        return;
+    }
+
+    gsr_emit_include_date_signal( gsr, xaccTransGetDate(trans) );
+
+    /* Explicit redraw shouldn't be needed,
+     * since gui_refresh events should handle this. */
+    /* gnc_split_register_redraw (reg); */
+    LEAVE(" ");
+}
+
+static gboolean
+gnc_split_reg_match_trans_row( VirtualLocation virt_loc,
+                               gpointer user_data )
+{
+    GNCSplitReg *gsr = user_data;
+    CursorClass cursor_class;
+    SplitRegister *sr;
+
+    sr = gnc_ledger_display_get_split_register (gsr->ledger);
+    cursor_class = gnc_split_register_get_cursor_class (sr, virt_loc.vcell_loc);
+
+    return (cursor_class == CURSOR_CLASS_TRANS);
+}
+
+static void
+gnc_split_reg_goto_next_trans_row (GNCSplitReg *gsr)
+{
+    ENTER("gsr=%p", gsr);
+    gnucash_register_goto_next_matching_row( gsr->reg,
+            gnc_split_reg_match_trans_row,
+            gsr );
+    LEAVE(" ");
+}
+
+void
+gnc_split_reg_enter( GNCSplitReg *gsr, gboolean next_transaction )
+{
+    SplitRegister *sr = gnc_ledger_display_get_split_register( gsr->ledger );
+    gboolean goto_blank;
+
+    ENTER("gsr=%p, next_transaction=%s", gsr, next_transaction ? "TRUE" : "FALSE");
+
+    goto_blank = gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL_REGISTER,
+                                    GNC_PREF_ENTER_MOVES_TO_END);
+
+    /* If we are in single or double line mode and we hit enter
+     * on the blank split, go to the blank split instead of the
+     * next row. This prevents the cursor from jumping around
+     * when you are entering transactions. */
+    if ( !goto_blank && !next_transaction )
+    {
+        SplitRegisterStyle style = sr->style;
+
+        if (style == REG_STYLE_LEDGER)
+        {
+            Split *blank_split;
+
+            blank_split = gnc_split_register_get_blank_split(sr);
+            if (blank_split != NULL)
+            {
+                Split *current_split;
+
+                current_split = gnc_split_register_get_current_split(sr);
+
+                if (blank_split == current_split)
+                    goto_blank = TRUE;
+            }
+        }
+    }
+
+    /* First record the transaction. This will perform a refresh. */
+    gnc_split_reg_record( gsr );
+
+    if (!goto_blank && next_transaction)
+        gnc_split_register_expand_current_trans (sr, FALSE);
+
+    /* Now move. */
+    if (goto_blank)
+        gnc_split_reg_jump_to_blank( gsr );
+    else if (next_transaction)
+        gnc_split_reg_goto_next_trans_row( gsr );
+    else
+        gnucash_register_goto_next_virt_row( gsr->reg );
+    LEAVE(" ");
+}
+
+void
+gsr_default_enter_handler( GNCSplitReg *gsr, gpointer data )
+{
+    gnc_split_reg_enter( gsr, FALSE );
+}
+
+void
+gnc_split_reg_record_cb (GnucashRegister *reg, gpointer data)
+{
+    gsr_emit_simple_signal( (GNCSplitReg*)data, "enter_ent" );
+}
+
+void
+gnc_split_reg_size_allocate (GtkWidget *widget,
+                             GtkAllocation *allocation,
+                             gpointer user_data)
+{
+    GNCSplitReg *gsr = user_data;
+    gsr->width = allocation->width;
+    gtk_window_set_default_size( GTK_WINDOW(gsr->window), gsr->width, 0 );
+}
+
+static
+GtkWidget*
+add_summary_label (GtkWidget *summarybar, const char *label_str)
+{
+    GtkWidget *hbox;
+    GtkWidget *label;
+
+    hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
+    gtk_box_set_homogeneous (GTK_BOX (hbox), FALSE);
+    gtk_box_pack_start( GTK_BOX(summarybar), hbox, FALSE, FALSE, 5 );
+
+    label = gtk_label_new( label_str );
+    gnc_label_set_alignment(label, 1.0, 0.5 );
+    gtk_box_pack_start( GTK_BOX(hbox), label, FALSE, FALSE, 0 );
+
+    label = gtk_label_new( "" );
+    gnc_label_set_alignment(label, 1.0, 0.5 );
+    gtk_box_pack_start( GTK_BOX(hbox), label, FALSE, FALSE, 0 );
+
+    return label;
+}
+
+GtkWidget *
+gsr_create_summary_bar( GNCSplitReg *gsr )
+{
+    GtkWidget *summarybar;
+
+    gsr->cleared_label    = NULL;
+    gsr->balance_label    = NULL;
+    gsr->reconciled_label = NULL;
+    gsr->future_label     = NULL;
+    gsr->projectedminimum_label  = NULL;
+    gsr->shares_label     = NULL;
+    gsr->value_label      = NULL;
+
+    if ( gnc_ledger_display_type(gsr->ledger) >= LD_SUBACCOUNT )
+    {
+        gsr->summarybar = NULL;
+        return NULL;
+    }
+
+    summarybar = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
+    gtk_box_set_homogeneous (GTK_BOX (summarybar), FALSE);
+
+    if (!xaccAccountIsPriced(gnc_ledger_display_leader(gsr->ledger)))
+    {
+        gsr->balance_label    = add_summary_label (summarybar, _("Present:"));
+        gsr->future_label     = add_summary_label (summarybar, _("Future:"));
+        gsr->cleared_label    = add_summary_label (summarybar, _("Cleared:"));
+        gsr->reconciled_label = add_summary_label (summarybar, _("Reconciled:"));
+        gsr->projectedminimum_label  = add_summary_label (summarybar, _("Projected Minimum:"));
+    }
+    else
+    {
+        gsr->shares_label     = add_summary_label (summarybar, _("Shares:"));
+        gsr->value_label      = add_summary_label (summarybar, _("Current Value:"));
+    }
+
+    gsr->summarybar = summarybar;
+
+    /* Force the first update */
+    gsr_redraw_all_cb(NULL, gsr);
+    return gsr->summarybar;
+}
+
+/**
+ * Opens up a register window for a group of Accounts.
+ * @param gsr the register window instance
+ * @return A GNCPlaceholderType indicating presence and type of placeholder
+ * accounts
+ **/
+static
+GNCPlaceholderType
+gnc_split_reg_get_placeholder( GNCSplitReg *gsr )
+{
+    Account *leader;
+    SplitRegister *reg;
+    gboolean single_account;
+
+    if (gsr == NULL)
+        return PLACEHOLDER_NONE;
+
+    reg = gnc_ledger_display_get_split_register( gsr->ledger );
+
+    switch (reg->type)
+    {
+    case GENERAL_JOURNAL:
+    case INCOME_LEDGER:
+    case PORTFOLIO_LEDGER:
+    case SEARCH_LEDGER:
+        single_account = FALSE;
+        break;
+    default:
+        single_account = TRUE;
+        break;
+    }
+
+    leader = gnc_ledger_display_leader( gsr->ledger );
+
+    if (leader == NULL)
+        return PLACEHOLDER_NONE;
+    if (single_account)
+    {
+        if (xaccAccountGetPlaceholder( leader ))
+            return PLACEHOLDER_THIS;
+        return PLACEHOLDER_NONE;
+    }
+    return xaccAccountGetDescendantPlaceholder( leader );
+}
+
+/**
+ * @see gtk_callback_bug_workaround
+ **/
+typedef struct dialog_args
+{
+    GNCSplitReg *gsr;
+    gchar *string;
+} dialog_args;
+
+/**
+ * Gtk has occasional problems with performing function as part of a
+ * callback.  This routine gets called via a timer callback to get it out of
+ * the data path with the problem.
+ **/
+static
+gboolean
+gtk_callback_bug_workaround (gpointer argp)
+{
+    dialog_args *args = argp;
+    const gchar *read_only = _("This account register is read-only.");
+    GtkWidget *dialog;
+
+    dialog = gtk_message_dialog_new(GTK_WINDOW(args->gsr->window),
+                                    GTK_DIALOG_DESTROY_WITH_PARENT,
+                                    GTK_MESSAGE_WARNING,
+                                    GTK_BUTTONS_CLOSE,
+                                    "%s", read_only);
+    gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
+            "%s", args->string);
+    gnc_dialog_run(GTK_DIALOG(dialog), GNC_PREF_WARN_REG_IS_READ_ONLY);
+    gtk_widget_destroy(dialog);
+    g_free(args);
+    return FALSE;
+}
+
+/**
+ * Determines whether this register window should be read-only.
+ **/
+static
+void
+gnc_split_reg_determine_read_only( GNCSplitReg *gsr )
+{
+    dialog_args *args = g_malloc(sizeof(dialog_args));
+    SplitRegister *reg;
+
+    if (qof_book_is_readonly(gnc_get_current_book()))
+    {
+        /* Is the book read-only? Then for sure also make this register
+        read-only. */
+        gsr->read_only = TRUE;
+    }
+
+    if ( !gsr->read_only )
+    {
+
+        switch (gnc_split_reg_get_placeholder(gsr))
+        {
+        case PLACEHOLDER_NONE:
+            /* stay as false. */
+            return;
+
+        case PLACEHOLDER_THIS:
+            args->string = _("This account may not be edited. If you want "
+                             "to edit transactions in this register, please "
+                             "open the account options and turn off the "
+                             "placeholder checkbox.");
+            break;
+
+        default:
+            args->string = _("One of the sub-accounts selected may not be "
+                             "edited. If you want to edit transactions in "
+                             "this register, please open the sub-account "
+                             "options and turn off the placeholder checkbox. "
+                             "You may also open an individual account instead "
+                             "of a set of accounts.");
+            break;
+        }
+        gsr->read_only = TRUE;
+        /* Put up a warning dialog */
+        args->gsr = gsr;
+        g_timeout_add (250, gtk_callback_bug_workaround, args); /* 0.25 seconds */
+    }
+
+    /* Make the contents immutable */
+    reg = gnc_ledger_display_get_split_register( gsr->ledger );
+    gnc_split_register_set_read_only( reg, TRUE );
+
+}
+
+static
+GtkWidget *
+gnc_split_reg_get_parent( GNCLedgerDisplay *ledger )
+{
+    GNCSplitReg *gsr =
+        GNC_SPLIT_REG(gnc_ledger_display_get_user_data( ledger ));
+
+    if (gsr == NULL)
+        return NULL;
+
+    return gsr->window;
+}
+
+static
+void
+gsr_emit_help_changed( GnucashRegister *reg, gpointer user_data )
+{
+    gsr_emit_simple_signal( (GNCSplitReg*)user_data, "help-changed" );
+}
+
+static
+void
+gsr_emit_include_date_signal( GNCSplitReg *gsr, time64 date )
+{
+    g_signal_emit_by_name( gsr, "include-date", date, NULL );
+}
+
+static
+void
+gsr_emit_simple_signal( GNCSplitReg *gsr, const char *sigName )
+{
+    g_signal_emit_by_name( gsr, sigName, NULL );
+}
+
+GnucashRegister*
+gnc_split_reg_get_register( GNCSplitReg *gsr )
+{
+    if ( !gsr )
+        return NULL;
+
+    return gsr->reg;
+}
+
+SortType
+gnc_split_reg_get_sort_type( GNCSplitReg *gsr )
+{
+    g_assert( gsr );
+    return gsr->sort_type;
+}
+
+void
+gnc_split_reg_set_sort_type( GNCSplitReg *gsr, SortType t )
+{
+    gnc_split_reg_sort( gsr, t );
+}
+
+void
+gnc_split_reg_set_sort_type_force( GNCSplitReg *gsr, SortType t, gboolean force )
+{
+    gnc_split_reg_sort_force( gsr, t, force );
+}
+
+
+GtkWidget*
+gnc_split_reg_get_summarybar( GNCSplitReg *gsr )
+{
+    if ( !gsr ) return NULL;
+    return gsr->summarybar;
+}
+
+gboolean
+gnc_split_reg_get_read_only( GNCSplitReg *gsr )
+{
+    g_assert( gsr );
+    return gsr->read_only;
+}
+
+void
+gnc_split_reg_set_moved_cb( GNCSplitReg *gsr, GFunc cb, gpointer cb_data )
+{
+    gnucash_register_set_moved_cb (gsr->reg, cb, cb_data);
+}
diff --git a/src/gnome/gnc-split-reg.h b/gnucash/gnome/gnc-split-reg.h
similarity index 100%
rename from src/gnome/gnc-split-reg.h
rename to gnucash/gnome/gnc-split-reg.h
diff --git a/gnucash/gnome/gnc-split-reg2.c b/gnucash/gnome/gnc-split-reg2.c
new file mode 100644
index 0000000..9255225
--- /dev/null
+++ b/gnucash/gnome/gnc-split-reg2.c
@@ -0,0 +1,1112 @@
+/********************************************************************\
+ * gnc-split-reg2.c -- A widget for the common register look-n-feel *
+ * Copyright (C) 1997 Robin D. Clark                                *
+ * Copyright (C) 1997-1998 Linas Vepstas <linas at linas.org>          *
+ * Copyright (C) 1998 Rob Browning <rlb at cs.utexas.edu>              *
+ * Copyright (C) 1999-2000 Dave Peticolas <dave at krondo.com>         *
+ * Copyright (C) 2001 Gnumatic, Inc.                                *
+ * Copyright (C) 2002,2006 Joshua Sled <jsled at asynchronous.org>     *
+ * Copyright (C) 2012 Robert Fewell                                 *
+ *                                                                  *
+ * 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 at gnu.org                   *
+\********************************************************************/
+
+#include "config.h"
+
+#include <gtk/gtk.h>
+#include <glib.h>
+#include <glib/gi18n.h>
+
+#include "gnc-split-reg2.h"
+#include "gnc-tree-view-split-reg.h"
+#include "gnc-tree-control-split-reg.h"
+#include "gnc-ledger-display2.h"
+
+#include "gnc-euro.h"
+#include "gnc-state.h"
+#include "gnc-warnings.h"
+#include "dialog-utils.h"
+
+#define STATE_SECTION_REG_PREFIX "Register"
+#define STATE_SECTION_GEN_JOURNAL "General Journal"
+
+static QofLogModule log_module = GNC_MOD_GUI;
+
+/***** PROTOTYPES ***************************************************/
+void gnc_split_reg2_raise (GNCSplitReg2 *gsr);
+
+static GtkWidget* add_summary_label (GtkWidget *summarybar,
+                                     const char *label_str);
+
+static void gnc_split_reg2_determine_read_only (GNCSplitReg2 *gsr);
+
+static void gnc_split_reg2_determine_account_pr (GNCSplitReg2 *gsr);
+
+static GNCPlaceholderType gnc_split_reg2_get_placeholder (GNCSplitReg2 *gsr);
+static GtkWidget *gnc_split_reg2_get_parent (GNCLedgerDisplay2 *ledger);
+
+static void gsr2_create_table (GNCSplitReg2 *gsr);
+static void gsr2_setup_table (GNCSplitReg2 *gsr);
+
+static void gsr2_setup_status_widgets (GNCSplitReg2 *gsr);
+
+static void gsr2_update_summary_label (GtkWidget *label,
+                                      xaccGetBalanceFn getter,
+                                      Account *leader,
+                                      GNCPrintAmountInfo print_info,
+                                      gnc_commodity *cmdty,
+                                      gboolean reverse,
+                                      gboolean euroFlag );
+
+static void gsr2_redraw_all_cb (GncTreeViewSplitReg *view, gpointer data);
+
+static void gnc_split_reg2_ld_destroy (GNCLedgerDisplay2 *ledger);
+
+static Transaction* gsr2_create_balancing_transaction (QofBook *book, Account *account,
+        time64 statement_date, gnc_numeric balancing_amount);
+
+static void gsr2_emit_simple_signal (GNCSplitReg2 *gsr, const char *sigName);
+static void gsr2_emit_help_changed (GncTreeViewSplitReg *view, gpointer user_data);
+static void gsr2_scroll_value_changed_cb (GtkAdjustment *adj, gpointer user_data);
+static gboolean gsr2_scroll_button_event_cb (GtkWidget *widget, GdkEventButton *event, gpointer user_data);
+static void gsr2_scroll_sync_cb (GncTreeModelSplitReg *model, gpointer user_data);
+
+void gnc_split_reg2_style_ledger_cb (GtkWidget *w, gpointer data);
+void gnc_split_reg2_style_auto_ledger_cb (GtkWidget *w, gpointer data);
+void gnc_split_reg2_style_journal_cb (GtkWidget *w, gpointer data);
+void gnc_split_reg2_double_line_cb (GtkWidget *w, gpointer data);
+
+void gnc_split_reg2_destroy_cb (GtkWidget *widget, gpointer data);
+
+static void gnc_split_reg2_class_init (GNCSplitReg2Class *klass);
+static void gnc_split_reg2_init (GNCSplitReg2 *gsr);
+static void gnc_split_reg2_init2 (GNCSplitReg2 *gsr);
+
+static void gnc_split_reg2_sort_changed_cb (GtkTreeSortable *sortable, gpointer user_data);
+
+
+GType
+gnc_split_reg2_get_type (void)
+{
+    static GType gnc_split_reg2_type = 0;
+
+    if (!gnc_split_reg2_type)
+    {
+        GTypeInfo type_info =
+        {
+            sizeof(GNCSplitReg2Class),          /* class_size */
+            NULL,   			        /* base_init */
+            NULL,				/* base_finalize */
+            (GClassInitFunc)gnc_split_reg2_class_init,
+            NULL,				/* class_finalize */
+            NULL,				/* class_data */
+            sizeof(GNCSplitReg2),		/* */
+            0,				        /* n_preallocs */
+            (GInstanceInitFunc)gnc_split_reg2_init,
+        };
+
+        gnc_split_reg2_type = g_type_register_static (GTK_TYPE_BOX,
+                             "GNCSplitReg2",
+                             &type_info, 0 );
+    }
+
+    return gnc_split_reg2_type;
+}
+
+/* SIGNALS */
+enum
+{
+    HELP_CHANGED,
+    LAST_SIGNAL
+};
+
+static guint gnc_split_reg2_signals[LAST_SIGNAL] = { 0 };
+
+static void
+gnc_split_reg2_class_init (GNCSplitReg2Class *klass)
+{
+    GObjectClass *object_class;
+
+    object_class = (GObjectClass*) klass;
+
+    gnc_split_reg2_signals[HELP_CHANGED] =
+        g_signal_new("help-changed",
+                     G_TYPE_FROM_CLASS (object_class),
+                     G_SIGNAL_RUN_LAST,
+                     G_STRUCT_OFFSET (GNCSplitReg2Class, help_changed),
+                     NULL, NULL,
+                     g_cclosure_marshal_VOID__VOID,
+                     G_TYPE_NONE, 0);
+
+    /* Setup the default handlers. */
+    klass->help_changed = NULL;
+
+}
+
+GtkWidget*
+gnc_split_reg2_new (GNCLedgerDisplay2 *ld,
+                   GtkWindow *parent,
+                   gint numberOfLines,
+                   gboolean read_only )
+{
+    GNCSplitReg2 *gsrToRet;
+
+    ENTER("ld=%p, parent=%p, numberOfLines=%d, read_only=%s",
+          ld, parent, numberOfLines, read_only ? "TRUE" : "FALSE");
+
+    gsrToRet = g_object_new (gnc_split_reg2_get_type(), NULL);
+
+    gsrToRet->numRows = numberOfLines;
+    gsrToRet->read_only = read_only;
+
+    gsrToRet->ledger = ld;
+    gsrToRet->window = GTK_WIDGET (parent);
+
+    gnc_split_reg2_init2 (gsrToRet);
+
+    LEAVE("%p", gsrToRet);
+    return GTK_WIDGET (gsrToRet);
+}
+
+static void
+gnc_split_reg2_init (GNCSplitReg2 *gsr)
+{
+    gtk_orientable_set_orientation (GTK_ORIENTABLE(gsr), GTK_ORIENTATION_VERTICAL);
+
+    gsr->numRows = 10;
+    gsr->read_only = FALSE;
+
+    g_signal_connect (gsr, "destroy",
+                      G_CALLBACK (gnc_split_reg2_destroy_cb), gsr );
+}
+
+static void
+gnc_split_reg2_init2 (GNCSplitReg2 *gsr)
+{
+    if (!gsr) return;
+
+    gnc_split_reg2_determine_read_only (gsr);
+
+    gnc_split_reg2_determine_account_pr (gsr);
+
+    gsr2_setup_status_widgets (gsr);
+    /* ordering is important here... setup_status before create_table */
+
+    gsr2_create_table (gsr);
+    gsr2_setup_table (gsr);
+
+}
+
+static
+void
+gsr2_setup_table (GNCSplitReg2 *gsr)
+{
+//    GncTreeModelSplitReg *model;
+
+    ENTER("gsr=%p", gsr);
+
+// This dose not do any thing
+//    model = gnc_ledger_display2_get_split_model_register (gsr->ledger);
+
+    LEAVE(" ");
+}
+
+static
+void
+gsr2_create_table (GNCSplitReg2 *gsr)
+{
+    GncTreeViewSplitReg *view;
+    GncTreeModelSplitReg *model;
+    GtkTreeModel *s_model;
+    GtkWidget *scrolled_window;
+    GtkTreeViewColumn *col;
+    GNCLedgerDisplay2Type ledger_type;
+    GtkWidget *hbox;
+    gdouble num_of_trans;
+
+    gchar *state_section;
+    GKeyFile *state_file = gnc_state_get_current();
+    const GncGUID * guid;
+    Account * account;
+
+    account = gnc_ledger_display2_leader (gsr->ledger);
+    guid = xaccAccountGetGUID (account);
+
+    ENTER("create table gsr=%p", gsr);
+
+    gnc_ledger_display2_set_user_data (gsr->ledger, (gpointer)gsr);
+    gnc_ledger_display2_set_handlers (gsr->ledger,
+                                     gnc_split_reg2_ld_destroy,
+                                     gnc_split_reg2_get_parent);
+
+    model = gnc_ledger_display2_get_split_model_register (gsr->ledger);
+    view = gnc_tree_view_split_reg_new_with_model (model);
+    g_object_unref (G_OBJECT (model));
+
+    /* State_section is used to store per register state: column widths, sort order,... */
+    ledger_type = gnc_ledger_display2_type (gsr->ledger);
+    if (ledger_type == LD2_GL && model->type == GENERAL_JOURNAL2)
+        state_section = g_strdup (STATE_SECTION_GEN_JOURNAL);
+    else if (ledger_type == LD2_SUBACCOUNT)
+    {
+        gchar guidstr[GUID_ENCODING_LENGTH+1];
+        guid_to_string_buff (guid, guidstr);
+        state_section = g_strconcat (STATE_SECTION_REG_PREFIX, " ", guidstr, " w/subaccounts", NULL);
+    }
+    else
+    {
+        gchar guidstr[GUID_ENCODING_LENGTH+1];
+        guid_to_string_buff (guid, guidstr);
+        state_section = g_strconcat (STATE_SECTION_REG_PREFIX, " ", guidstr, NULL);
+    }
+    g_object_set (G_OBJECT (view), "state-section", state_section,
+                 "show-column-menu", FALSE, NULL);
+
+    // Create a hbox for treeview and scrollbar.
+    hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
+    gtk_box_set_homogeneous (GTK_BOX (hbox), FALSE);
+    gtk_widget_show (hbox);
+
+    scrolled_window = gtk_scrolled_window_new (NULL, NULL);
+    gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
+                                   GTK_POLICY_AUTOMATIC,
+                                   GTK_POLICY_AUTOMATIC);
+
+    gtk_widget_show (scrolled_window);
+
+    gtk_box_pack_start (GTK_BOX (gsr), hbox, TRUE, TRUE, 0);
+
+    num_of_trans = model->number_of_trans_in_full_tlist - 1;
+
+    gsr->scroll_adj = GTK_ADJUSTMENT (gtk_adjustment_new (model->position_of_trans_in_full_tlist, 0.0, num_of_trans + 10, 1.0, 10.0, 10.0));
+
+    gsr->scroll_bar = gtk_scrollbar_new (GTK_ORIENTATION_VERTICAL, GTK_ADJUSTMENT (gsr->scroll_adj));
+    gtk_widget_show (gsr->scroll_bar);
+
+    gtk_box_pack_start (GTK_BOX (hbox), gsr->scroll_bar, FALSE, FALSE, 2);
+    gtk_box_pack_start (GTK_BOX (hbox), scrolled_window, TRUE, TRUE, 0);
+
+    gnc_ledger_display2_set_split_view_register (gsr->ledger, view);
+
+    /* Synchronize model state with view state
+     * (needed to properly set up the internal query) */
+
+    /* Restore the sort depth from saved state */
+    model->sort_depth = g_key_file_get_integer (state_file, state_section, "sort_depth", NULL);
+    g_free(state_section);
+
+    s_model = gtk_tree_view_get_model(GTK_TREE_VIEW(view));
+    if (s_model)
+    {
+        gint sort_col;
+        GtkSortType   type;
+
+        if (gtk_tree_sortable_get_sort_column_id (GTK_TREE_SORTABLE (s_model), &sort_col, &type))
+        {
+            model->sort_col = sort_col;
+            model->sort_direction = type;
+        }
+    }
+
+    gnc_tree_view_configure_columns (GNC_TREE_VIEW (view));
+
+    if (ledger_type == LD2_GL && model->type == GENERAL_JOURNAL2)
+        gnc_tree_view_set_show_column_menu (GNC_TREE_VIEW (view), TRUE);
+    else
+        gnc_tree_view_set_show_column_menu (GNC_TREE_VIEW (view), FALSE);
+
+    /* This column gets all the free space */
+    gnc_tree_view_expand_columns (GNC_TREE_VIEW (view), "descnotes", NULL);
+
+    /* This sets the status color column, 4 is the minimum */
+    col = gnc_tree_view_find_column_by_name (GNC_TREE_VIEW (view), "status");
+    if (col != NULL)
+        g_object_set (G_OBJECT(col),
+                     "resizable", FALSE,
+                     "sizing", GTK_TREE_VIEW_COLUMN_FIXED,
+                     "fixed-width", 4,
+                      NULL);
+
+    gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (view), TRUE);
+    gtk_widget_show (GTK_WIDGET (view));
+
+    gtk_container_add (GTK_CONTAINER (scrolled_window), GTK_WIDGET (view));
+    gtk_widget_show (GTK_WIDGET (gsr));
+
+    /* Should this be read only */
+    gnc_tree_view_split_reg_set_read_only (view, gsr->read_only);
+
+    /* This tells the ledger that we have a valid tree view */
+    gnc_ledger_display2_set_split_view_refresh (gsr->ledger, TRUE);
+
+    /* This triggers the update of the summary bar */
+    g_signal_connect_after (model, "refresh_status_bar",
+                      G_CALLBACK (gsr2_redraw_all_cb), gsr); //this works
+
+    // This will keep scrollbar in sync.
+    g_signal_connect (model, "scroll_sync",
+                      G_CALLBACK (gsr2_scroll_sync_cb), gsr);
+
+    /* This triggers the update of the help text */
+    g_signal_connect (view, "help_signal",
+                      G_CALLBACK (gsr2_emit_help_changed), gsr); // this works
+
+    gsr2_scroll_value_changed_cb (GTK_ADJUSTMENT (gsr->scroll_adj), gsr);
+
+    /* This triggers the tooltip to change when scrolling */
+    g_signal_connect (gsr->scroll_adj, "value-changed",
+                      G_CALLBACK (gsr2_scroll_value_changed_cb), gsr); // this works
+
+    /* This triggers the model update when mouse button released */
+    g_signal_connect (gsr->scroll_bar, "button-release-event",
+                      G_CALLBACK (gsr2_scroll_button_event_cb), gsr);
+
+    // Connect a call back to update the sort settings.
+    g_signal_connect (GTK_TREE_SORTABLE (s_model), "sort-column-changed",
+          G_CALLBACK (gnc_split_reg2_sort_changed_cb), gsr);
+
+    LEAVE(" ");
+}
+
+static
+void
+gsr2_setup_status_widgets (GNCSplitReg2 *gsr)
+{
+    GncTreeModelSplitReg *model;
+    gboolean use_double_line;
+
+    model = gnc_ledger_display2_get_split_model_register (gsr->ledger);
+    use_double_line = gnc_ledger_display2_default_double_line (gsr->ledger);
+
+    /* be sure to initialize the gui elements */
+    gnc_tree_model_split_reg_config (model, model->type, model->style, use_double_line);
+}
+
+void
+gnc_split_reg2_destroy_cb (GtkWidget *widget, gpointer data)
+{
+}
+
+/**
+ * Jump to split.
+ **/
+void
+gnc_split_reg2_jump_to_split (GNCSplitReg2 *gsr, Split *split)
+{
+    GncTreeViewSplitReg *view;
+
+    if (gsr == NULL)
+        return;
+
+    if (split == NULL)
+        return;
+
+    view = gnc_ledger_display2_get_split_view_register (gsr->ledger);
+
+    gnc_tree_control_split_reg_jump_to (view, NULL, split, FALSE);
+}
+
+
+/**
+ * Move the cursor to the split in the non-blank amount column.
+ **/
+void
+gnc_split_reg2_jump_to_split_amount (GNCSplitReg2 *gsr, Split *split)
+{
+    GncTreeViewSplitReg *view;
+
+    if (gsr == NULL)
+        return;
+
+    if (split == NULL)
+        return;
+
+    view = gnc_ledger_display2_get_split_view_register (gsr->ledger);
+
+    gnc_tree_control_split_reg_jump_to (view, NULL, split, TRUE);
+}
+
+/**
+ * Raise an existing register window to the front.
+ **/
+void
+gnc_split_reg2_raise (GNCSplitReg2 *gsr)
+{
+    if (gsr == NULL)
+        return;
+
+    if (gsr->window == NULL)
+        return;
+
+    gtk_window_present (GTK_WINDOW (gsr->window));
+}
+
+
+/**
+ * Duplicate-code reduction function; retreives, formats and updates the
+ * GtkLabel with the given amount.
+ **/
+static
+void
+gsr2_update_summary_label (GtkWidget *label,
+                          xaccGetBalanceFn getter,
+                          Account *leader,
+                          GNCPrintAmountInfo print_info,
+                          gnc_commodity *cmdty,
+                          gboolean reverse,
+                          gboolean euroFlag)
+{
+    gnc_numeric amount;
+    char string[256];
+
+    if ( label == NULL )
+        return;
+
+    amount = (*getter)( leader );
+
+    if ( reverse )
+    {
+        amount = gnc_numeric_neg( amount );
+    }
+
+    xaccSPrintAmount( string, amount, print_info );
+
+    if ( euroFlag )
+    {
+        strcat( string, " / " );
+        xaccSPrintAmount( string + strlen( string ),
+                          gnc_convert_to_euro( cmdty, amount ),
+                          gnc_commodity_print_info( gnc_get_euro(), TRUE ) );
+    }
+
+    gnc_set_label_color( label, amount );
+    gtk_label_set_text( GTK_LABEL(label), string );
+}
+
+static
+void
+gsr2_redraw_all_cb (GncTreeViewSplitReg *view, gpointer user_data)
+{
+    GNCSplitReg2 *gsr = user_data;
+    gnc_commodity * commodity;
+    GNCPrintAmountInfo print_info;
+    gnc_numeric amount;
+    Account *leader;
+    gboolean reverse;
+    gboolean euro;
+
+    if ( gsr->summarybar == NULL )
+        return;
+
+    leader = gnc_ledger_display2_leader( gsr->ledger );
+
+    commodity = xaccAccountGetCommodity( leader );
+
+    /* no EURO converson, if account is already EURO or no EURO currency */
+    if (commodity != NULL)
+        euro = (gnc_is_euro_currency( commodity ) &&
+                (strncasecmp(gnc_commodity_get_mnemonic(commodity), "EUR", 3)));
+    else
+        euro = FALSE;
+
+    print_info = gnc_account_print_info( leader, TRUE );
+    reverse = gnc_reverse_balance( leader );
+
+    gsr2_update_summary_label( gsr->balance_label,
+                              xaccAccountGetPresentBalance,
+                              leader, print_info, commodity, reverse, euro );
+    gsr2_update_summary_label( gsr->cleared_label,
+                              xaccAccountGetClearedBalance,
+                              leader, print_info, commodity, reverse, euro );
+    gsr2_update_summary_label( gsr->reconciled_label,
+                              xaccAccountGetReconciledBalance,
+                              leader, print_info, commodity, reverse, euro );
+    gsr2_update_summary_label( gsr->future_label,
+                              xaccAccountGetBalance,
+                              leader, print_info, commodity, reverse, euro );
+    gsr2_update_summary_label( gsr->projectedminimum_label,
+                              xaccAccountGetProjectedMinimumBalance,
+                              leader, print_info, commodity, reverse, euro );
+
+   /* Print the summary share amount */
+    if (gsr->shares_label != NULL)
+    {
+        char string[256];
+        print_info = gnc_account_print_info( leader, TRUE );
+        amount = xaccAccountGetBalance( leader );
+        if ( reverse )
+            amount = gnc_numeric_neg( amount );
+        xaccSPrintAmount( string, amount, print_info );
+        gnc_set_label_color( gsr->shares_label, amount );
+        gtk_label_set_text( GTK_LABEL(gsr->shares_label), string );
+    }
+
+    /* Print the summary share value */
+    if (gsr->value_label != NULL)
+    {
+        char string[256];
+        QofBook *book = gnc_account_get_book (leader);
+        GNCPriceDB *pricedb = gnc_pricedb_get_db (book);
+        gnc_commodity *commodity = xaccAccountGetCommodity (leader);
+        gnc_commodity *currency = gnc_default_currency ();
+        print_info = gnc_commodity_print_info (currency, TRUE);
+        xaccSPrintAmount (string, amount, print_info);
+        gnc_set_label_color (gsr->value_label, amount);
+        gtk_label_set_text (GTK_LABEL (gsr->value_label), string);
+
+    }
+}
+
+
+static void
+gnc_split_reg2_ld_destroy (GNCLedgerDisplay2 *ledger)
+{
+    gnc_ledger_display2_set_user_data (ledger, NULL);
+}
+
+
+/* ########################### Handlers ############################### */
+
+void
+gnc_split_reg2_balancing_entry (GNCSplitReg2 *gsr, Account *account,
+                              time64 statement_date, gnc_numeric balancing_amount) // this works
+{
+    GncTreeViewSplitReg *view;
+    Transaction *transaction;
+    Split *split;
+
+    view = gnc_ledger_display2_get_split_view_register (gsr->ledger);
+
+    // create transaction
+    transaction = gsr2_create_balancing_transaction (gnc_get_current_book(),
+                  account, statement_date, balancing_amount);
+
+    // jump to transaction
+    split = xaccTransFindSplitByAccount (transaction, account);
+    if (split == NULL)
+    {
+        // default behaviour: jump to blank split
+        g_warning("gsr2_create_balancing_transaction failed");
+        gnc_tree_control_split_reg_jump_to_blank (view);
+    }
+    else
+    {
+        // goto balancing transaction
+        gnc_tree_control_split_reg_jump_to (view, NULL, split, FALSE);
+    }
+}
+
+static Transaction*
+gsr2_create_balancing_transaction (QofBook *book, Account *account,
+                             time64 statement_date, gnc_numeric balancing_amount)
+{
+    Transaction *trans;
+    Split *split;
+
+    if (!account)
+        return NULL;
+    if (gnc_numeric_zero_p (balancing_amount))
+        return NULL;
+
+    xaccAccountBeginEdit (account);
+
+    trans = xaccMallocTransaction (book);
+
+    xaccTransBeginEdit (trans);
+
+    // fill Transaction
+    xaccTransSetCurrency (trans, gnc_account_or_default_currency (account, NULL));
+    xaccTransSetDatePostedSecsNormalized (trans, statement_date);
+    xaccTransSetDescription (trans, _("Balancing entry from reconciliation"));
+
+    // 1. Split
+    split = xaccMallocSplit (book);
+    xaccTransAppendSplit (trans, split);
+    xaccAccountInsertSplit  (account, split);
+    xaccSplitSetAmount (split, balancing_amount);
+    xaccSplitSetValue (split, balancing_amount);
+
+    // 2. Split (no account is defined: split goes to orphan account)
+    split = xaccMallocSplit (book);
+    xaccTransAppendSplit (trans, split);
+
+    balancing_amount = gnc_numeric_neg (balancing_amount);
+    xaccSplitSetAmount (split, balancing_amount);
+    xaccSplitSetValue (split, balancing_amount);
+
+    xaccTransCommitEdit (trans);
+    xaccAccountCommitEdit (account);
+    return trans;
+}
+
+
+/* Sort changed callback */
+static void
+gnc_split_reg2_sort_changed_cb (GtkTreeSortable *sortable, gpointer user_data)
+{
+    GNCSplitReg2 *gsr = user_data;
+    GncTreeViewSplitReg *view;
+    GncTreeModelSplitReg *model;
+    GtkSortType   type;
+    gint          sortcol;
+    gint          sort_depth;
+    const gchar  *state_section;
+    GKeyFile *state_file = gnc_state_get_current();
+
+    gtk_tree_sortable_get_sort_column_id (sortable, &sortcol, &type);
+    ENTER("sortcol is %d", sortcol);
+
+    view = gnc_ledger_display2_get_split_view_register (gsr->ledger);
+    model = gnc_ledger_display2_get_split_model_register (gsr->ledger);
+
+    sort_depth = gnc_tree_view_reg_get_selected_row_depth (view);
+    if (sort_depth != 0)
+        model->sort_depth = sort_depth;
+
+    model->sort_col = sortcol;
+    model->sort_direction = type;
+
+    /* Save the sort depth state */
+    state_section = gnc_tree_view_get_state_section (GNC_TREE_VIEW (view));
+    g_key_file_set_integer (state_file, state_section, "sort_depth", model->sort_depth);
+
+    LEAVE("m_sort_col %d, m_sort_direction is %d  m_sort_depth is %d", model->sort_col, model->sort_direction, model->sort_depth);
+
+    if (sortcol != -1)
+        gnc_ledger_display2_refresh (gsr->ledger);
+}
+/* ############################## End Handlers ############################ */
+
+void
+gnc_split_reg2_change_style (GNCSplitReg2 *gsr, SplitRegisterStyle2 style)
+{
+    GncTreeModelSplitReg *model = gnc_ledger_display2_get_split_model_register (gsr->ledger);
+
+    if (style == model->style)
+        return;
+
+    gnc_tree_model_split_reg_config (model, model->type, style, model->use_double_line);
+
+    // This will re-display the view.
+    gnc_tree_view_split_reg_set_format (gnc_ledger_display2_get_split_view_register (gsr->ledger));
+}
+
+void
+gnc_split_reg2_style_ledger_cb (GtkWidget *w, gpointer data)
+{
+    GNCSplitReg2 *gsr = data;
+
+    if (!gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (w)))
+        return;
+
+    gnc_split_reg2_change_style (gsr, REG2_STYLE_LEDGER);
+}
+
+void
+gnc_split_reg2_style_auto_ledger_cb (GtkWidget *w, gpointer data)
+{
+    GNCSplitReg2 *gsr = data;
+
+    if (!gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (w)))
+        return;
+
+    gnc_split_reg2_change_style (gsr, REG2_STYLE_AUTO_LEDGER);
+}
+
+void
+gnc_split_reg2_style_journal_cb (GtkWidget *w, gpointer data)
+{
+    GNCSplitReg2 *gsr = data;
+
+    if (!gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (w)))
+        return;
+
+    gnc_split_reg2_change_style (gsr, REG2_STYLE_JOURNAL);
+}
+
+void
+gnc_split_reg2_double_line_cb (GtkWidget *w, gpointer data)
+{
+    GNCSplitReg2 *gsr = data;
+    GncTreeModelSplitReg *model = gnc_ledger_display2_get_split_model_register (gsr->ledger);
+    gboolean use_double_line;
+
+    use_double_line = gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (w));
+    if (use_double_line == model->use_double_line)
+        return;
+
+    gnc_tree_model_split_reg_config (model, model->type, model->style, use_double_line);
+
+    // This will re-display the view.
+    gnc_tree_view_split_reg_set_format (gnc_ledger_display2_get_split_view_register (gsr->ledger));
+}
+
+static
+GtkWidget*
+add_summary_label (GtkWidget *summarybar, const char *label_str)
+{
+    GtkWidget *hbox;
+    GtkWidget *label;
+
+    hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
+    gtk_box_set_homogeneous (GTK_BOX (hbox), FALSE);
+    gtk_box_pack_start (GTK_BOX (summarybar), hbox, FALSE, FALSE, 5);
+
+    label = gtk_label_new (label_str);
+    gnc_label_set_alignment (label, 1.0, 0.5);
+    gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
+
+    label = gtk_label_new ("");
+    gnc_label_set_alignment (label, 1.0, 0.5);
+    gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
+
+    return label;
+}
+
+GtkWidget *
+gnc_split_reg2_create_summary_bar (GNCSplitReg2 *gsr)
+{
+    GtkWidget *summarybar;
+
+    gsr->cleared_label    = NULL;
+    gsr->balance_label    = NULL;
+    gsr->reconciled_label = NULL;
+    gsr->future_label     = NULL;
+    gsr->projectedminimum_label = NULL;
+    gsr->shares_label     = NULL;
+    gsr->value_label      = NULL;
+
+    if (gnc_ledger_display2_type (gsr->ledger) >= LD2_SUBACCOUNT)
+    {
+        gsr->summarybar = NULL;
+        return NULL;
+    }
+
+    summarybar = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
+    gtk_box_set_homogeneous (GTK_BOX (summarybar), FALSE);
+
+    if (!xaccAccountIsPriced(gnc_ledger_display2_leader(gsr->ledger)))
+    {
+        gsr->balance_label    = add_summary_label (summarybar, _("Present:"));
+        gsr->future_label     = add_summary_label (summarybar, _("Future:"));
+        gsr->cleared_label    = add_summary_label (summarybar, _("Cleared:"));
+        gsr->reconciled_label = add_summary_label (summarybar, _("Reconciled:"));
+        gsr->projectedminimum_label  = add_summary_label (summarybar, _("Projected Minimum:"));
+    }
+    else
+    {
+        gsr->shares_label     = add_summary_label (summarybar, _("Shares:"));
+        gsr->value_label      = add_summary_label (summarybar, _("Current Value:"));
+    }
+
+    gsr->summarybar = summarybar;
+
+    /* Force the first update */
+    gsr2_redraw_all_cb (NULL, gsr);
+    return gsr->summarybar;
+}
+
+/**
+ * Opens up a register window for a group of Accounts.
+ * @param gsr the register window instance
+ * @return A GNCPlaceholderType indicating presence and type of placeholder
+ * accounts
+ **/
+static
+GNCPlaceholderType
+gnc_split_reg2_get_placeholder (GNCSplitReg2 *gsr)
+{
+    Account *leader;
+    GncTreeModelSplitReg *model;
+    gboolean single_account;
+
+    if (gsr == NULL)
+        return PLACEHOLDER_NONE;
+
+    model = gnc_ledger_display2_get_split_model_register (gsr->ledger);
+
+    switch (model->type)
+    {
+    case GENERAL_JOURNAL2:
+    case INCOME_LEDGER2:
+    case PORTFOLIO_LEDGER2:
+    case SEARCH_LEDGER2:
+        single_account = FALSE;
+        break;
+    default:
+        single_account = TRUE;
+        break;
+    }
+
+    leader = gnc_ledger_display2_leader (gsr->ledger);
+
+    if (leader == NULL)
+        return PLACEHOLDER_NONE;
+    if (single_account)
+    {
+        if (xaccAccountGetPlaceholder (leader))
+            return PLACEHOLDER_THIS;
+        return PLACEHOLDER_NONE;
+    }
+    return xaccAccountGetDescendantPlaceholder (leader);
+}
+
+
+
+/**
+ * @see gtk_callback_bug_workaround
+ **/
+typedef struct dialog_args
+{
+    GNCSplitReg2 *gsr;
+    gchar *string;
+} dialog_args;
+
+
+/* This Register is an Account Payable / Receivable one */
+static
+gboolean
+gsr2_determine_account_pr_dialog (gpointer argp)
+{
+    dialog_args *args = argp;
+    GtkWidget *dialog;
+
+    const char *title = _("Account Payable / Receivable Register");
+    const char *message =
+            _("The register displayed is for Account Payable or Account Receivable. "
+              "Changing the entries may cause harm, please use the business "
+              "options to change the entries.");
+
+    dialog = gtk_message_dialog_new (GTK_WINDOW (args->gsr->window),
+                                     GTK_DIALOG_DESTROY_WITH_PARENT,
+                                     GTK_MESSAGE_WARNING,
+                                     GTK_BUTTONS_CLOSE,
+                                     "%s", title);
+    gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+                                              "%s", message);
+
+    gnc_dialog_run (GTK_DIALOG (dialog), GNC_PREF_WARN_REG_IS_ACCT_PAY_REC);
+    gtk_widget_destroy (dialog);
+    g_free (args);
+    return FALSE;
+}
+
+
+/* This Register is an Account Payable / Receivable one */
+static void
+gnc_split_reg2_determine_account_pr (GNCSplitReg2 *gsr)
+{
+    dialog_args *args = g_malloc (sizeof (dialog_args));
+    GncTreeModelSplitReg *model;
+
+    model = gnc_ledger_display2_get_split_model_register (gsr->ledger);
+
+    if (model->type != PAYABLE_REGISTER2 && model->type != RECEIVABLE_REGISTER2)
+        return;
+
+    /* Put up a warning dialog */
+    args->gsr = gsr;
+    g_timeout_add (250, gsr2_determine_account_pr_dialog, args); /* 0.25 seconds */
+}
+
+
+/**
+ * Gtk has occasional problems with performing function as part of a
+ * callback.  This routine gets called via a timer callback to get it out of
+ * the data path with the problem.
+ **/
+static
+gboolean
+gtk_callback_bug_workaround (gpointer argp)
+{
+    dialog_args *args = argp;
+    const gchar *read_only = _("This account register is read-only.");
+    GtkWidget *dialog;
+
+    dialog = gtk_message_dialog_new (GTK_WINDOW(args->gsr->window),
+                                    GTK_DIALOG_DESTROY_WITH_PARENT,
+                                    GTK_MESSAGE_WARNING,
+                                    GTK_BUTTONS_CLOSE,
+                                    "%s", read_only);
+    gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+            "%s", args->string);
+    gnc_dialog_run (GTK_DIALOG (dialog), GNC_PREF_WARN_REG_IS_READ_ONLY);
+    gtk_widget_destroy (dialog);
+    g_free (args);
+    return FALSE;
+}
+
+/**
+ * Determines whether this register window should be read-only.
+ **/
+static
+void
+gnc_split_reg2_determine_read_only (GNCSplitReg2 *gsr) //this works
+{
+    dialog_args *args = g_malloc (sizeof (dialog_args));
+
+    if (qof_book_is_readonly (gnc_get_current_book()))
+    {
+        /* Is the book read-only? Then for sure also make this register
+        read-only. */
+        gsr->read_only = TRUE;
+    }
+
+    if (!gsr->read_only)
+    {
+
+        switch (gnc_split_reg2_get_placeholder (gsr))
+        {
+        case PLACEHOLDER_NONE:
+            /* stay as false. */
+            return;
+
+        case PLACEHOLDER_THIS:
+            args->string = _("This account may not be edited. If you want "
+                             "to edit transactions in this register, please "
+                             "open the account options and turn off the "
+                             "placeholder checkbox.");
+            break;
+
+        default:
+            args->string = _("One of the sub-accounts selected may not be "
+                             "edited. If you want to edit transactions in "
+                             "this register, please open the sub-account "
+                             "options and turn off the placeholder checkbox. "
+                             "You may also open an individual account instead "
+                             "of a set of accounts.");
+            break;
+        }
+        gsr->read_only = TRUE;
+        /* Put up a warning dialog */
+        args->gsr = gsr;
+        g_timeout_add (250, gtk_callback_bug_workaround, args); /* 0.25 seconds */
+    }
+}
+
+static
+GtkWidget *
+gnc_split_reg2_get_parent (GNCLedgerDisplay2 *ledger)
+{
+    GNCSplitReg2 *gsr =
+        GNC_SPLIT_REG2 (gnc_ledger_display2_get_user_data (ledger));
+
+    if (gsr == NULL)
+        return NULL;
+
+    return gsr->window;
+}
+
+static void
+gsr2_emit_help_changed (GncTreeViewSplitReg *view, gpointer user_data)
+{
+    gsr2_emit_simple_signal ((GNCSplitReg2*)user_data, "help-changed" );
+}
+
+/* Callback to keep vertical scroll bar in sync */
+static void
+gsr2_scroll_sync_cb (GncTreeModelSplitReg *model, gpointer user_data)
+{
+    GNCSplitReg2 *gsr = user_data;
+    gint trans_position;
+
+    trans_position = model->position_of_trans_in_full_tlist;
+
+    gtk_adjustment_set_value (gsr->scroll_adj, trans_position);
+
+    gtk_adjustment_set_upper (gsr->scroll_adj, model->number_of_trans_in_full_tlist + 9);
+}
+
+static void
+gsr2_scroll_value_changed_cb (GtkAdjustment *adj, gpointer user_data)
+{
+    GNCSplitReg2 *gsr = user_data;
+    GncTreeModelSplitReg *model;
+    gchar *text;
+    gint  trans_position;
+
+    model = gnc_ledger_display2_get_split_model_register (gsr->ledger);
+
+    trans_position = gtk_adjustment_get_value (adj);
+
+    text = gnc_tree_model_split_reg_get_tooltip (model, trans_position);
+
+    g_object_set (gtk_widget_get_settings (gsr->scroll_bar), "gtk-tooltip-timeout", 2, NULL);
+
+    gtk_widget_set_tooltip_text (gsr->scroll_bar, text);
+
+    g_free (text);
+}
+
+static
+gboolean
+gsr2_scroll_button_event_cb (GtkWidget *widget, GdkEventButton *event, gpointer user_data)
+{
+    GNCSplitReg2 *gsr = user_data;
+    GncTreeModelSplitReg *model;
+    gint trans_position;
+
+    model = gnc_ledger_display2_get_split_model_register (gsr->ledger);
+
+    trans_position = gtk_adjustment_get_value (gsr->scroll_adj);
+
+    gnc_tree_model_split_reg_set_current_trans_by_position (model, trans_position);
+
+//FIXME should we store what it was...
+    g_object_set (gtk_widget_get_settings (gsr->scroll_bar), "gtk-tooltip-timeout", 500, NULL);
+
+    g_signal_emit_by_name (model, "refresh_trans");
+
+    return FALSE;
+}
+
+static
+void
+gsr2_emit_simple_signal (GNCSplitReg2 *gsr, const char *sigName)
+{
+    g_signal_emit_by_name( gsr, sigName, NULL );
+}
+
+GncTreeViewSplitReg *
+gnc_split_reg2_get_register (GNCSplitReg2 *gsr )
+{
+    if ( !gsr )
+        return NULL;
+
+    return gnc_ledger_display2_get_split_view_register (gsr->ledger);
+}
+
+GtkWidget*
+gnc_split_reg2_get_summarybar (GNCSplitReg2 *gsr)
+{
+    if (!gsr) return NULL;
+    return gsr->summarybar;
+}
+
+gboolean
+gnc_split_reg2_get_read_only (GNCSplitReg2 *gsr)
+{
+    g_assert (gsr);
+    return gsr->read_only;
+}
+
+void
+gnc_split_reg2_set_moved_cb (GNCSplitReg2 *gsr, GFunc cb, gpointer cb_data ) //this works
+{
+    gnc_tree_view_split_reg_set_uiupdate_cb (gnc_ledger_display2_get_split_view_register (gsr->ledger), cb, cb_data);
+}
diff --git a/src/gnome/gnc-split-reg2.h b/gnucash/gnome/gnc-split-reg2.h
similarity index 100%
rename from src/gnome/gnc-split-reg2.h
rename to gnucash/gnome/gnc-split-reg2.h
diff --git a/src/gnome/gnome.i b/gnucash/gnome/gnome.i
similarity index 100%
rename from src/gnome/gnome.i
rename to gnucash/gnome/gnome.i
diff --git a/src/gnome/gnucash.appdata.xml.in b/gnucash/gnome/gnucash.appdata.xml.in
similarity index 100%
rename from src/gnome/gnucash.appdata.xml.in
rename to gnucash/gnome/gnucash.appdata.xml.in
diff --git a/src/gnome/gnucash.desktop.in.in b/gnucash/gnome/gnucash.desktop.in.in
similarity index 100%
rename from src/gnome/gnucash.desktop.in.in
rename to gnucash/gnome/gnucash.desktop.in.in
diff --git a/src/gnome/gschemas/CMakeLists.txt b/gnucash/gnome/gschemas/CMakeLists.txt
similarity index 100%
rename from src/gnome/gschemas/CMakeLists.txt
rename to gnucash/gnome/gschemas/CMakeLists.txt
diff --git a/src/gnome/gschemas/Makefile.am b/gnucash/gnome/gschemas/Makefile.am
similarity index 100%
rename from src/gnome/gschemas/Makefile.am
rename to gnucash/gnome/gschemas/Makefile.am
diff --git a/src/gnome/gschemas/org.gnucash.dialogs.business.gschema.xml.in.in b/gnucash/gnome/gschemas/org.gnucash.dialogs.business.gschema.xml.in.in
similarity index 100%
rename from src/gnome/gschemas/org.gnucash.dialogs.business.gschema.xml.in.in
rename to gnucash/gnome/gschemas/org.gnucash.dialogs.business.gschema.xml.in.in
diff --git a/src/gnome/gschemas/org.gnucash.dialogs.checkprinting.gschema.xml.in.in b/gnucash/gnome/gschemas/org.gnucash.dialogs.checkprinting.gschema.xml.in.in
similarity index 100%
rename from src/gnome/gschemas/org.gnucash.dialogs.checkprinting.gschema.xml.in.in
rename to gnucash/gnome/gschemas/org.gnucash.dialogs.checkprinting.gschema.xml.in.in
diff --git a/src/gnome/gschemas/org.gnucash.dialogs.commodities.gschema.xml.in.in b/gnucash/gnome/gschemas/org.gnucash.dialogs.commodities.gschema.xml.in.in
similarity index 100%
rename from src/gnome/gschemas/org.gnucash.dialogs.commodities.gschema.xml.in.in
rename to gnucash/gnome/gschemas/org.gnucash.dialogs.commodities.gschema.xml.in.in
diff --git a/src/gnome/gschemas/org.gnucash.dialogs.gschema.xml.in.in b/gnucash/gnome/gschemas/org.gnucash.dialogs.gschema.xml.in.in
similarity index 100%
rename from src/gnome/gschemas/org.gnucash.dialogs.gschema.xml.in.in
rename to gnucash/gnome/gschemas/org.gnucash.dialogs.gschema.xml.in.in
diff --git a/src/gnome/gschemas/org.gnucash.dialogs.reconcile.gschema.xml.in.in b/gnucash/gnome/gschemas/org.gnucash.dialogs.reconcile.gschema.xml.in.in
similarity index 100%
rename from src/gnome/gschemas/org.gnucash.dialogs.reconcile.gschema.xml.in.in
rename to gnucash/gnome/gschemas/org.gnucash.dialogs.reconcile.gschema.xml.in.in
diff --git a/src/gnome/gschemas/org.gnucash.dialogs.sxs.gschema.xml.in.in b/gnucash/gnome/gschemas/org.gnucash.dialogs.sxs.gschema.xml.in.in
similarity index 100%
rename from src/gnome/gschemas/org.gnucash.dialogs.sxs.gschema.xml.in.in
rename to gnucash/gnome/gschemas/org.gnucash.dialogs.sxs.gschema.xml.in.in
diff --git a/src/gnome/gschemas/org.gnucash.dialogs.totd.gschema.xml.in.in b/gnucash/gnome/gschemas/org.gnucash.dialogs.totd.gschema.xml.in.in
similarity index 100%
rename from src/gnome/gschemas/org.gnucash.dialogs.totd.gschema.xml.in.in
rename to gnucash/gnome/gschemas/org.gnucash.dialogs.totd.gschema.xml.in.in
diff --git a/src/gnome/gschemas/org.gnucash.gschema.xml.in.in b/gnucash/gnome/gschemas/org.gnucash.gschema.xml.in.in
similarity index 100%
rename from src/gnome/gschemas/org.gnucash.gschema.xml.in.in
rename to gnucash/gnome/gschemas/org.gnucash.gschema.xml.in.in
diff --git a/src/gnome/gschemas/org.gnucash.window.pages.account.tree.gschema.xml.in.in b/gnucash/gnome/gschemas/org.gnucash.window.pages.account.tree.gschema.xml.in.in
similarity index 100%
rename from src/gnome/gschemas/org.gnucash.window.pages.account.tree.gschema.xml.in.in
rename to gnucash/gnome/gschemas/org.gnucash.window.pages.account.tree.gschema.xml.in.in
diff --git a/src/gnome/gschemas/org.gnucash.window.pages.gschema.xml.in.in b/gnucash/gnome/gschemas/org.gnucash.window.pages.gschema.xml.in.in
similarity index 100%
rename from src/gnome/gschemas/org.gnucash.window.pages.gschema.xml.in.in
rename to gnucash/gnome/gschemas/org.gnucash.window.pages.gschema.xml.in.in
diff --git a/src/gnome/gtkbuilder/CMakeLists.txt b/gnucash/gnome/gtkbuilder/CMakeLists.txt
similarity index 100%
rename from src/gnome/gtkbuilder/CMakeLists.txt
rename to gnucash/gnome/gtkbuilder/CMakeLists.txt
diff --git a/src/gnome/gtkbuilder/Makefile.am b/gnucash/gnome/gtkbuilder/Makefile.am
similarity index 100%
rename from src/gnome/gtkbuilder/Makefile.am
rename to gnucash/gnome/gtkbuilder/Makefile.am
diff --git a/src/gnome/gtkbuilder/assistant-acct-period.glade b/gnucash/gnome/gtkbuilder/assistant-acct-period.glade
similarity index 100%
rename from src/gnome/gtkbuilder/assistant-acct-period.glade
rename to gnucash/gnome/gtkbuilder/assistant-acct-period.glade
diff --git a/src/gnome/gtkbuilder/assistant-hierarchy.glade b/gnucash/gnome/gtkbuilder/assistant-hierarchy.glade
similarity index 100%
rename from src/gnome/gtkbuilder/assistant-hierarchy.glade
rename to gnucash/gnome/gtkbuilder/assistant-hierarchy.glade
diff --git a/src/gnome/gtkbuilder/assistant-loan.glade b/gnucash/gnome/gtkbuilder/assistant-loan.glade
similarity index 100%
rename from src/gnome/gtkbuilder/assistant-loan.glade
rename to gnucash/gnome/gtkbuilder/assistant-loan.glade
diff --git a/src/gnome/gtkbuilder/assistant-stock-split.glade b/gnucash/gnome/gtkbuilder/assistant-stock-split.glade
similarity index 100%
rename from src/gnome/gtkbuilder/assistant-stock-split.glade
rename to gnucash/gnome/gtkbuilder/assistant-stock-split.glade
diff --git a/src/gnome/gtkbuilder/business-options-gnome.glade b/gnucash/gnome/gtkbuilder/business-options-gnome.glade
similarity index 100%
rename from src/gnome/gtkbuilder/business-options-gnome.glade
rename to gnucash/gnome/gtkbuilder/business-options-gnome.glade
diff --git a/src/gnome/gtkbuilder/business-prefs.glade b/gnucash/gnome/gtkbuilder/business-prefs.glade
similarity index 100%
rename from src/gnome/gtkbuilder/business-prefs.glade
rename to gnucash/gnome/gtkbuilder/business-prefs.glade
diff --git a/src/gnome/gtkbuilder/dialog-billterms.glade b/gnucash/gnome/gtkbuilder/dialog-billterms.glade
similarity index 100%
rename from src/gnome/gtkbuilder/dialog-billterms.glade
rename to gnucash/gnome/gtkbuilder/dialog-billterms.glade
diff --git a/src/gnome/gtkbuilder/dialog-choose-owner.glade b/gnucash/gnome/gtkbuilder/dialog-choose-owner.glade
similarity index 100%
rename from src/gnome/gtkbuilder/dialog-choose-owner.glade
rename to gnucash/gnome/gtkbuilder/dialog-choose-owner.glade
diff --git a/src/gnome/gtkbuilder/dialog-commodities.glade b/gnucash/gnome/gtkbuilder/dialog-commodities.glade
similarity index 100%
rename from src/gnome/gtkbuilder/dialog-commodities.glade
rename to gnucash/gnome/gtkbuilder/dialog-commodities.glade
diff --git a/src/gnome/gtkbuilder/dialog-customer.glade b/gnucash/gnome/gtkbuilder/dialog-customer.glade
similarity index 100%
rename from src/gnome/gtkbuilder/dialog-customer.glade
rename to gnucash/gnome/gtkbuilder/dialog-customer.glade
diff --git a/src/gnome/gtkbuilder/dialog-date-close.glade b/gnucash/gnome/gtkbuilder/dialog-date-close.glade
similarity index 100%
rename from src/gnome/gtkbuilder/dialog-date-close.glade
rename to gnucash/gnome/gtkbuilder/dialog-date-close.glade
diff --git a/src/gnome/gtkbuilder/dialog-employee.glade b/gnucash/gnome/gtkbuilder/dialog-employee.glade
similarity index 100%
rename from src/gnome/gtkbuilder/dialog-employee.glade
rename to gnucash/gnome/gtkbuilder/dialog-employee.glade
diff --git a/src/gnome/gtkbuilder/dialog-fincalc.glade b/gnucash/gnome/gtkbuilder/dialog-fincalc.glade
similarity index 100%
rename from src/gnome/gtkbuilder/dialog-fincalc.glade
rename to gnucash/gnome/gtkbuilder/dialog-fincalc.glade
diff --git a/src/gnome/gtkbuilder/dialog-find-account.glade b/gnucash/gnome/gtkbuilder/dialog-find-account.glade
similarity index 100%
rename from src/gnome/gtkbuilder/dialog-find-account.glade
rename to gnucash/gnome/gtkbuilder/dialog-find-account.glade
diff --git a/src/gnome/gtkbuilder/dialog-imap-editor.glade b/gnucash/gnome/gtkbuilder/dialog-imap-editor.glade
similarity index 100%
rename from src/gnome/gtkbuilder/dialog-imap-editor.glade
rename to gnucash/gnome/gtkbuilder/dialog-imap-editor.glade
diff --git a/src/gnome/gtkbuilder/dialog-invoice.glade b/gnucash/gnome/gtkbuilder/dialog-invoice.glade
similarity index 100%
rename from src/gnome/gtkbuilder/dialog-invoice.glade
rename to gnucash/gnome/gtkbuilder/dialog-invoice.glade
diff --git a/src/gnome/gtkbuilder/dialog-job.glade b/gnucash/gnome/gtkbuilder/dialog-job.glade
similarity index 100%
rename from src/gnome/gtkbuilder/dialog-job.glade
rename to gnucash/gnome/gtkbuilder/dialog-job.glade
diff --git a/src/gnome/gtkbuilder/dialog-lot-viewer.glade b/gnucash/gnome/gtkbuilder/dialog-lot-viewer.glade
similarity index 100%
rename from src/gnome/gtkbuilder/dialog-lot-viewer.glade
rename to gnucash/gnome/gtkbuilder/dialog-lot-viewer.glade
diff --git a/src/gnome/gtkbuilder/dialog-new-user.glade b/gnucash/gnome/gtkbuilder/dialog-new-user.glade
similarity index 100%
rename from src/gnome/gtkbuilder/dialog-new-user.glade
rename to gnucash/gnome/gtkbuilder/dialog-new-user.glade
diff --git a/src/gnome/gtkbuilder/dialog-order.glade b/gnucash/gnome/gtkbuilder/dialog-order.glade
similarity index 100%
rename from src/gnome/gtkbuilder/dialog-order.glade
rename to gnucash/gnome/gtkbuilder/dialog-order.glade
diff --git a/src/gnome/gtkbuilder/dialog-payment.glade b/gnucash/gnome/gtkbuilder/dialog-payment.glade
similarity index 100%
rename from src/gnome/gtkbuilder/dialog-payment.glade
rename to gnucash/gnome/gtkbuilder/dialog-payment.glade
diff --git a/src/gnome/gtkbuilder/dialog-price.glade b/gnucash/gnome/gtkbuilder/dialog-price.glade
similarity index 100%
rename from src/gnome/gtkbuilder/dialog-price.glade
rename to gnucash/gnome/gtkbuilder/dialog-price.glade
diff --git a/src/gnome/gtkbuilder/dialog-print-check.glade b/gnucash/gnome/gtkbuilder/dialog-print-check.glade
similarity index 100%
rename from src/gnome/gtkbuilder/dialog-print-check.glade
rename to gnucash/gnome/gtkbuilder/dialog-print-check.glade
diff --git a/src/gnome/gtkbuilder/dialog-progress.glade b/gnucash/gnome/gtkbuilder/dialog-progress.glade
similarity index 100%
rename from src/gnome/gtkbuilder/dialog-progress.glade
rename to gnucash/gnome/gtkbuilder/dialog-progress.glade
diff --git a/src/gnome/gtkbuilder/dialog-sx.glade b/gnucash/gnome/gtkbuilder/dialog-sx.glade
similarity index 100%
rename from src/gnome/gtkbuilder/dialog-sx.glade
rename to gnucash/gnome/gtkbuilder/dialog-sx.glade
diff --git a/src/gnome/gtkbuilder/dialog-tax-info.glade b/gnucash/gnome/gtkbuilder/dialog-tax-info.glade
similarity index 100%
rename from src/gnome/gtkbuilder/dialog-tax-info.glade
rename to gnucash/gnome/gtkbuilder/dialog-tax-info.glade
diff --git a/src/gnome/gtkbuilder/dialog-trans-assoc.glade b/gnucash/gnome/gtkbuilder/dialog-trans-assoc.glade
similarity index 100%
rename from src/gnome/gtkbuilder/dialog-trans-assoc.glade
rename to gnucash/gnome/gtkbuilder/dialog-trans-assoc.glade
diff --git a/src/gnome/gtkbuilder/dialog-vendor.glade b/gnucash/gnome/gtkbuilder/dialog-vendor.glade
similarity index 100%
rename from src/gnome/gtkbuilder/dialog-vendor.glade
rename to gnucash/gnome/gtkbuilder/dialog-vendor.glade
diff --git a/src/gnome/gtkbuilder/gnc-plugin-page-budget.glade b/gnucash/gnome/gtkbuilder/gnc-plugin-page-budget.glade
similarity index 100%
rename from src/gnome/gtkbuilder/gnc-plugin-page-budget.glade
rename to gnucash/gnome/gtkbuilder/gnc-plugin-page-budget.glade
diff --git a/src/gnome/gtkbuilder/gnc-plugin-page-register.glade b/gnucash/gnome/gtkbuilder/gnc-plugin-page-register.glade
similarity index 100%
rename from src/gnome/gtkbuilder/gnc-plugin-page-register.glade
rename to gnucash/gnome/gtkbuilder/gnc-plugin-page-register.glade
diff --git a/src/gnome/gtkbuilder/gnc-plugin-page-register2.glade b/gnucash/gnome/gtkbuilder/gnc-plugin-page-register2.glade
similarity index 100%
rename from src/gnome/gtkbuilder/gnc-plugin-page-register2.glade
rename to gnucash/gnome/gtkbuilder/gnc-plugin-page-register2.glade
diff --git a/src/gnome/gtkbuilder/window-autoclear.glade b/gnucash/gnome/gtkbuilder/window-autoclear.glade
similarity index 100%
rename from src/gnome/gtkbuilder/window-autoclear.glade
rename to gnucash/gnome/gtkbuilder/window-autoclear.glade
diff --git a/src/gnome/gtkbuilder/window-reconcile.glade b/gnucash/gnome/gtkbuilder/window-reconcile.glade
similarity index 100%
rename from src/gnome/gtkbuilder/window-reconcile.glade
rename to gnucash/gnome/gtkbuilder/window-reconcile.glade
diff --git a/src/gnome/reconcile-view.c b/gnucash/gnome/reconcile-view.c
similarity index 100%
rename from src/gnome/reconcile-view.c
rename to gnucash/gnome/reconcile-view.c
diff --git a/src/gnome/reconcile-view.h b/gnucash/gnome/reconcile-view.h
similarity index 100%
rename from src/gnome/reconcile-view.h
rename to gnucash/gnome/reconcile-view.h
diff --git a/src/gnome/search-owner.c b/gnucash/gnome/search-owner.c
similarity index 100%
rename from src/gnome/search-owner.c
rename to gnucash/gnome/search-owner.c
diff --git a/src/gnome/search-owner.h b/gnucash/gnome/search-owner.h
similarity index 100%
rename from src/gnome/search-owner.h
rename to gnucash/gnome/search-owner.h
diff --git a/src/gnome/top-level.c b/gnucash/gnome/top-level.c
similarity index 100%
rename from src/gnome/top-level.c
rename to gnucash/gnome/top-level.c
diff --git a/src/gnome/top-level.h b/gnucash/gnome/top-level.h
similarity index 100%
rename from src/gnome/top-level.h
rename to gnucash/gnome/top-level.h
diff --git a/src/gnome/ui/CMakeLists.txt b/gnucash/gnome/ui/CMakeLists.txt
similarity index 100%
rename from src/gnome/ui/CMakeLists.txt
rename to gnucash/gnome/ui/CMakeLists.txt
diff --git a/src/gnome/ui/Makefile.am b/gnucash/gnome/ui/Makefile.am
similarity index 100%
rename from src/gnome/ui/Makefile.am
rename to gnucash/gnome/ui/Makefile.am
diff --git a/src/gnome/ui/gnc-plugin-account-tree-ui.xml b/gnucash/gnome/ui/gnc-plugin-account-tree-ui.xml
similarity index 100%
rename from src/gnome/ui/gnc-plugin-account-tree-ui.xml
rename to gnucash/gnome/ui/gnc-plugin-account-tree-ui.xml
diff --git a/src/gnome/ui/gnc-plugin-basic-commands-ui.xml b/gnucash/gnome/ui/gnc-plugin-basic-commands-ui.xml
similarity index 100%
rename from src/gnome/ui/gnc-plugin-basic-commands-ui.xml
rename to gnucash/gnome/ui/gnc-plugin-basic-commands-ui.xml
diff --git a/src/gnome/ui/gnc-plugin-budget-ui.xml b/gnucash/gnome/ui/gnc-plugin-budget-ui.xml
similarity index 100%
rename from src/gnome/ui/gnc-plugin-budget-ui.xml
rename to gnucash/gnome/ui/gnc-plugin-budget-ui.xml
diff --git a/src/gnome/ui/gnc-plugin-business-ui.xml b/gnucash/gnome/ui/gnc-plugin-business-ui.xml
similarity index 100%
rename from src/gnome/ui/gnc-plugin-business-ui.xml
rename to gnucash/gnome/ui/gnc-plugin-business-ui.xml
diff --git a/src/gnome/ui/gnc-plugin-file-history-ui.xml b/gnucash/gnome/ui/gnc-plugin-file-history-ui.xml
similarity index 100%
rename from src/gnome/ui/gnc-plugin-file-history-ui.xml
rename to gnucash/gnome/ui/gnc-plugin-file-history-ui.xml
diff --git a/src/gnome/ui/gnc-plugin-page-account-tree-ui.xml b/gnucash/gnome/ui/gnc-plugin-page-account-tree-ui.xml
similarity index 100%
rename from src/gnome/ui/gnc-plugin-page-account-tree-ui.xml
rename to gnucash/gnome/ui/gnc-plugin-page-account-tree-ui.xml
diff --git a/src/gnome/ui/gnc-plugin-page-account-tree2-ui.xml b/gnucash/gnome/ui/gnc-plugin-page-account-tree2-ui.xml
similarity index 100%
rename from src/gnome/ui/gnc-plugin-page-account-tree2-ui.xml
rename to gnucash/gnome/ui/gnc-plugin-page-account-tree2-ui.xml
diff --git a/src/gnome/ui/gnc-plugin-page-budget-ui.xml b/gnucash/gnome/ui/gnc-plugin-page-budget-ui.xml
similarity index 100%
rename from src/gnome/ui/gnc-plugin-page-budget-ui.xml
rename to gnucash/gnome/ui/gnc-plugin-page-budget-ui.xml
diff --git a/src/gnome/ui/gnc-plugin-page-invoice-ui.xml b/gnucash/gnome/ui/gnc-plugin-page-invoice-ui.xml
similarity index 100%
rename from src/gnome/ui/gnc-plugin-page-invoice-ui.xml
rename to gnucash/gnome/ui/gnc-plugin-page-invoice-ui.xml
diff --git a/src/gnome/ui/gnc-plugin-page-owner-tree-ui.xml b/gnucash/gnome/ui/gnc-plugin-page-owner-tree-ui.xml
similarity index 100%
rename from src/gnome/ui/gnc-plugin-page-owner-tree-ui.xml
rename to gnucash/gnome/ui/gnc-plugin-page-owner-tree-ui.xml
diff --git a/src/gnome/ui/gnc-plugin-page-register-ui.xml b/gnucash/gnome/ui/gnc-plugin-page-register-ui.xml
similarity index 100%
rename from src/gnome/ui/gnc-plugin-page-register-ui.xml
rename to gnucash/gnome/ui/gnc-plugin-page-register-ui.xml
diff --git a/src/gnome/ui/gnc-plugin-page-register2-ui.xml b/gnucash/gnome/ui/gnc-plugin-page-register2-ui.xml
similarity index 100%
rename from src/gnome/ui/gnc-plugin-page-register2-ui.xml
rename to gnucash/gnome/ui/gnc-plugin-page-register2-ui.xml
diff --git a/src/gnome/ui/gnc-plugin-page-sx-list-ui.xml b/gnucash/gnome/ui/gnc-plugin-page-sx-list-ui.xml
similarity index 100%
rename from src/gnome/ui/gnc-plugin-page-sx-list-ui.xml
rename to gnucash/gnome/ui/gnc-plugin-page-sx-list-ui.xml
diff --git a/src/gnome/ui/gnc-plugin-page-sx-list2-ui.xml b/gnucash/gnome/ui/gnc-plugin-page-sx-list2-ui.xml
similarity index 100%
rename from src/gnome/ui/gnc-plugin-page-sx-list2-ui.xml
rename to gnucash/gnome/ui/gnc-plugin-page-sx-list2-ui.xml
diff --git a/src/gnome/ui/gnc-plugin-page-sxregister-ui.xml b/gnucash/gnome/ui/gnc-plugin-page-sxregister-ui.xml
similarity index 100%
rename from src/gnome/ui/gnc-plugin-page-sxregister-ui.xml
rename to gnucash/gnome/ui/gnc-plugin-page-sxregister-ui.xml
diff --git a/src/gnome/ui/gnc-plugin-register-ui.xml b/gnucash/gnome/ui/gnc-plugin-register-ui.xml
similarity index 100%
rename from src/gnome/ui/gnc-plugin-register-ui.xml
rename to gnucash/gnome/ui/gnc-plugin-register-ui.xml
diff --git a/src/gnome/ui/gnc-plugin-register2-ui.xml b/gnucash/gnome/ui/gnc-plugin-register2-ui.xml
similarity index 100%
rename from src/gnome/ui/gnc-plugin-register2-ui.xml
rename to gnucash/gnome/ui/gnc-plugin-register2-ui.xml
diff --git a/src/gnome/ui/gnc-plugin-register22-ui.xml b/gnucash/gnome/ui/gnc-plugin-register22-ui.xml
similarity index 100%
rename from src/gnome/ui/gnc-plugin-register22-ui.xml
rename to gnucash/gnome/ui/gnc-plugin-register22-ui.xml
diff --git a/src/gnome/ui/gnc-reconcile-window-ui.xml b/gnucash/gnome/ui/gnc-reconcile-window-ui.xml
similarity index 100%
rename from src/gnome/ui/gnc-reconcile-window-ui.xml
rename to gnucash/gnome/ui/gnc-reconcile-window-ui.xml
diff --git a/src/gnome/ui/gnc-sxed-to-create-window-ui.xml b/gnucash/gnome/ui/gnc-sxed-to-create-window-ui.xml
similarity index 100%
rename from src/gnome/ui/gnc-sxed-to-create-window-ui.xml
rename to gnucash/gnome/ui/gnc-sxed-to-create-window-ui.xml
diff --git a/src/gnome/ui/gnc-sxed-window-ui-full.xml b/gnucash/gnome/ui/gnc-sxed-window-ui-full.xml
similarity index 100%
rename from src/gnome/ui/gnc-sxed-window-ui-full.xml
rename to gnucash/gnome/ui/gnc-sxed-window-ui-full.xml
diff --git a/src/gnome/ui/gnc-sxed-window-ui.xml b/gnucash/gnome/ui/gnc-sxed-window-ui.xml
similarity index 100%
rename from src/gnome/ui/gnc-sxed-window-ui.xml
rename to gnucash/gnome/ui/gnc-sxed-window-ui.xml
diff --git a/src/gnome/window-autoclear.c b/gnucash/gnome/window-autoclear.c
similarity index 100%
rename from src/gnome/window-autoclear.c
rename to gnucash/gnome/window-autoclear.c
diff --git a/src/gnome/window-autoclear.h b/gnucash/gnome/window-autoclear.h
similarity index 100%
rename from src/gnome/window-autoclear.h
rename to gnucash/gnome/window-autoclear.h
diff --git a/src/gnome/window-reconcile.c b/gnucash/gnome/window-reconcile.c
similarity index 100%
rename from src/gnome/window-reconcile.c
rename to gnucash/gnome/window-reconcile.c
diff --git a/src/gnome/window-reconcile.h b/gnucash/gnome/window-reconcile.h
similarity index 100%
rename from src/gnome/window-reconcile.h
rename to gnucash/gnome/window-reconcile.h
diff --git a/src/gnome/window-reconcile2.c b/gnucash/gnome/window-reconcile2.c
similarity index 100%
rename from src/gnome/window-reconcile2.c
rename to gnucash/gnome/window-reconcile2.c
diff --git a/src/gnome/window-reconcile2.h b/gnucash/gnome/window-reconcile2.h
similarity index 100%
rename from src/gnome/window-reconcile2.h
rename to gnucash/gnome/window-reconcile2.h
diff --git a/src/html/CMakeLists.txt b/gnucash/html/CMakeLists.txt
similarity index 100%
rename from src/html/CMakeLists.txt
rename to gnucash/html/CMakeLists.txt
diff --git a/gnucash/html/Makefile.am b/gnucash/html/Makefile.am
new file mode 100644
index 0000000..94f0137
--- /dev/null
+++ b/gnucash/html/Makefile.am
@@ -0,0 +1,95 @@
+#SUBDIRS = . test
+SUBDIRS = .
+
+pkglib_LTLIBRARIES = libgncmod-html.la
+
+AM_CPPFLAGS = \
+  -I${top_srcdir}/libgnucash/core-utils \
+  -I${top_srcdir}/libgnucash/gnc-module \
+  -I${top_srcdir}/libgnucash/engine \
+  -I${top_srcdir}/gnucash/gnome-utils \
+  -I${top_srcdir}/libgnucash/app-utils \
+  -I${top_srcdir}/common \
+  -I${top_builddir}/common \
+  -I${top_srcdir}/lib/libc \
+  ${GLIB_CFLAGS} \
+  ${GUILE_CFLAGS} \
+  ${GTK_CFLAGS} \
+  ${GNOME_CFLAGS} \
+  ${WEBKIT_CFLAGS}
+
+libgncmod_html_la_SOURCES = \
+  gncmod-html.c \
+  gnc-html.c \
+  gnc-html-history.c \
+  gnc-html-factory.c \
+  gnc-html-webkit2.c \
+  swig-gnc-html.c
+
+gncincludedir = ${GNC_INCLUDE_DIR}
+gncinclude_HEADERS = \
+  gnc-html-history.h \
+  gnc-html.h \
+  gnc-html-p.h \
+  gnc-html-factory.h \
+  gnc-html-webkit2.h \
+  gnc-html-extras.h \
+  gnc-html-webkit-p.h
+
+libgncmod_html_la_LDFLAGS = -avoid-version
+
+libgncmod_html_la_LIBADD = \
+  ${top_builddir}/libgnucash/core-utils/libgnc-core-utils.la \
+  ${top_builddir}/libgnucash/gnc-module/libgnc-module.la \
+  ${top_builddir}/libgnucash/engine/libgncmod-engine.la \
+  ${top_builddir}/gnucash/gnome-utils/libgncmod-gnome-utils.la \
+  ${top_builddir}/libgnucash/app-utils/libgncmod-app-utils.la \
+  $(top_builddir)/lib/libc/libc-missing.la \
+  ${WEBKIT_LIBS} \
+  ${GTK_LIBS} \
+  ${GLIB_LIBS} \
+  ${DB_LIBS} \
+  ${GUILE_LIBS} \
+  ${REGEX_LIBS}
+
+if BUILDING_FROM_VCS
+swig-gnc-html.c: gnc-html.i gnc-html.h \
+                    ${top_srcdir}/common/base-typemaps.i
+	$(SWIG) -guile $(SWIG_ARGS) -Linkage module \
+	-I${top_srcdir}/common -o $@ $<
+if ! OS_WIN32
+if ! SWIG_DIST_FAIL
+	if ! `grep "define scm_from_utf8_string" $@ > /dev/null 2>&1`; then \
+	  patch $@ $(top_srcdir)/common/swig-utf8.patch; \
+	fi
+endif
+endif
+endif
+
+EXTRA_DIST = \
+  gnc-html.i \
+  CMakeLists.txt \
+  gnc-html-webkit.h \
+  gnc-html-webkit1.h \
+  gnc-html-webkit1.c
+
+CLEANFILES = $(BUILT_SOURCES) gnucash
+MAINTAINERCLEANFILES = swig-gnc-html.c
+
+# We do this only for the gnome help tool on Linux and MacPorts.
+if !PLATFORM_WIN32
+if !PLATFORM_OSX_QUARTZ
+#
+# I hate inconsistent standards. Autotools puts help files into
+# ${datadir}/gnome/help/${program} while the gnome2 libraries expect
+# them in ${pkgdatadir}/gnome/help/${program}.
+#
+install-data-hook:
+	$(LN_S) -f ../gnome ${DESTDIR}${pkgdatadir}
+
+uninstall-hook:
+	rm -f ${DESTDIR}${pkgdatadir}/gnome
+endif
+endif
+
+AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.html\"
diff --git a/src/html/gnc-html-extras.h b/gnucash/html/gnc-html-extras.h
similarity index 100%
rename from src/html/gnc-html-extras.h
rename to gnucash/html/gnc-html-extras.h
diff --git a/src/html/gnc-html-factory.c b/gnucash/html/gnc-html-factory.c
similarity index 100%
rename from src/html/gnc-html-factory.c
rename to gnucash/html/gnc-html-factory.c
diff --git a/src/html/gnc-html-factory.h b/gnucash/html/gnc-html-factory.h
similarity index 100%
rename from src/html/gnc-html-factory.h
rename to gnucash/html/gnc-html-factory.h
diff --git a/src/html/gnc-html-history.c b/gnucash/html/gnc-html-history.c
similarity index 100%
rename from src/html/gnc-html-history.c
rename to gnucash/html/gnc-html-history.c
diff --git a/src/html/gnc-html-history.h b/gnucash/html/gnc-html-history.h
similarity index 100%
rename from src/html/gnc-html-history.h
rename to gnucash/html/gnc-html-history.h
diff --git a/src/html/gnc-html-p.h b/gnucash/html/gnc-html-p.h
similarity index 100%
rename from src/html/gnc-html-p.h
rename to gnucash/html/gnc-html-p.h
diff --git a/src/html/gnc-html-webkit-p.h b/gnucash/html/gnc-html-webkit-p.h
similarity index 100%
rename from src/html/gnc-html-webkit-p.h
rename to gnucash/html/gnc-html-webkit-p.h
diff --git a/src/html/gnc-html-webkit.h b/gnucash/html/gnc-html-webkit.h
similarity index 100%
rename from src/html/gnc-html-webkit.h
rename to gnucash/html/gnc-html-webkit.h
diff --git a/src/html/gnc-html-webkit1.c b/gnucash/html/gnc-html-webkit1.c
similarity index 100%
rename from src/html/gnc-html-webkit1.c
rename to gnucash/html/gnc-html-webkit1.c
diff --git a/src/html/gnc-html-webkit1.h b/gnucash/html/gnc-html-webkit1.h
similarity index 100%
rename from src/html/gnc-html-webkit1.h
rename to gnucash/html/gnc-html-webkit1.h
diff --git a/src/html/gnc-html-webkit2.c b/gnucash/html/gnc-html-webkit2.c
similarity index 100%
rename from src/html/gnc-html-webkit2.c
rename to gnucash/html/gnc-html-webkit2.c
diff --git a/src/html/gnc-html-webkit2.h b/gnucash/html/gnc-html-webkit2.h
similarity index 100%
rename from src/html/gnc-html-webkit2.h
rename to gnucash/html/gnc-html-webkit2.h
diff --git a/src/html/gnc-html.c b/gnucash/html/gnc-html.c
similarity index 100%
rename from src/html/gnc-html.c
rename to gnucash/html/gnc-html.c
diff --git a/src/html/gnc-html.h b/gnucash/html/gnc-html.h
similarity index 100%
rename from src/html/gnc-html.h
rename to gnucash/html/gnc-html.h
diff --git a/src/html/gnc-html.i b/gnucash/html/gnc-html.i
similarity index 100%
rename from src/html/gnc-html.i
rename to gnucash/html/gnc-html.i
diff --git a/src/html/gncmod-html.c b/gnucash/html/gncmod-html.c
similarity index 100%
rename from src/html/gncmod-html.c
rename to gnucash/html/gncmod-html.c
diff --git a/gnucash/import-export/CMakeLists.txt b/gnucash/import-export/CMakeLists.txt
new file mode 100644
index 0000000..4b9ba66
--- /dev/null
+++ b/gnucash/import-export/CMakeLists.txt
@@ -0,0 +1,86 @@
+# CMakeLists.txt for gnucash/import-export
+
+ADD_SUBDIRECTORY(test)
+
+# ############################################################
+ADD_SUBDIRECTORY(aqb)
+ADD_SUBDIRECTORY(csv-exp)
+ADD_SUBDIRECTORY(csv-imp)
+ADD_SUBDIRECTORY(gschemas)
+ADD_SUBDIRECTORY(log-replay)
+ADD_SUBDIRECTORY(ofx)
+ADD_SUBDIRECTORY(qif)
+ADD_SUBDIRECTORY(qif-imp)
+
+
+SET (generic_import_SOURCES
+  import-account-matcher.c
+  import-commodity-matcher.c
+  import-backend.c
+  import-format-dialog.c
+  import-match-picker.c
+  import-parse.c
+  import-utilities.c
+  import-settings.c
+  import-main-matcher.c
+  import-pending-matches.c
+  gncmod-generic-import.c
+)
+
+# Add dependency on config.h
+SET_SOURCE_FILES_PROPERTIES (${generic_import_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
+
+SET (generic_import_HEADERS
+  import-parse.h
+)
+
+SET (generic_import_noinst_HEADERS
+  import-account-matcher.h
+  import-backend.h
+  import-commodity-matcher.h
+  import-main-matcher.h
+  import-match-picker.h
+  import-pending-matches.h
+  import-settings.h
+  import-utilities.h
+)
+
+ADD_LIBRARY (gncmod-generic-import
+  ${generic_import_SOURCES}
+  ${generic_import_HEADERS}
+  ${generic_import_noinst_HEADERS}
+)
+
+TARGET_LINK_LIBRARIES(gncmod-generic-import gncmod-gnome-utils gncmod-engine ${GTK3_LDFLAGS} ${GLIB2_LDFLAGS})
+
+TARGET_COMPILE_DEFINITIONS (gncmod-generic-import PRIVATE -DG_LOG_DOMAIN=\"gnc.import\")
+
+TARGET_INCLUDE_DIRECTORIES(gncmod-generic-import PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
+
+
+INSTALL(TARGETS gncmod-generic-import
+  LIBRARY DESTINATION lib/gnucash
+  ARCHIVE DESTINATION lib/gnucash
+  RUNTIME DESTINATION bin
+)
+
+INSTALL(FILES ${generic_import_HEADERS} DESTINATION include/gnucash)
+
+SET(generic_import_GLADE dialog-import.glade)
+
+INSTALL(FILES ${generic_import_GLADE} DESTINATION share/gnucash/gtkbuilder)
+
+
+FILE(COPY ${generic_import_GLADE} DESTINATION ${DATADIR_BUILD}/gnucash/gtkbuilder)
+
+SET(generic_import_EXTRA_DIST generic-import-design.txt)
+
+SET_LOCAL_DIST(import_export_DIST_local CMakeLists.txt Makefile.am ${generic_import_SOURCES}
+        ${generic_import_HEADERS} ${generic_import_GLADE} ${generic_import_noinst_HEADERS}
+        ${generic_import_EXTRA_DIST})
+
+SET(import_export_DIST ${import_export_DIST_local} ${aqbanking_DIST}
+        ${csv_export_DIST} ${csv_import_DIST}
+        ${generic_import_gschema_DIST} ${log_report_DIST} ${ofx_DIST} ${qif_DIST} ${qif_import_DIST}
+        ${test_generic_import_DIST}
+        PARENT_SCOPE)
diff --git a/gnucash/import-export/Makefile.am b/gnucash/import-export/Makefile.am
new file mode 100644
index 0000000..3fdcf96
--- /dev/null
+++ b/gnucash/import-export/Makefile.am
@@ -0,0 +1,69 @@
+if WITH_OFX
+    OFX_DIR=ofx
+endif
+if WITH_AQBANKING
+    AQBANKING_DIR=aqb
+endif
+SUBDIRS = . gschemas qif qif-imp \
+	${OFX_DIR} ${AQBANKING_DIR} log-replay test csv-imp csv-exp
+
+pkglib_LTLIBRARIES=libgncmod-generic-import.la
+
+libgncmod_generic_import_la_SOURCES = \
+	import-account-matcher.c \
+	import-commodity-matcher.c \
+	import-backend.c \
+	import-format-dialog.c \
+	import-match-picker.c \
+	import-parse.c \
+	import-utilities.c \
+	import-settings.c \
+	import-main-matcher.c \
+	import-pending-matches.c \
+	gncmod-generic-import.c
+
+gncincludedir = ${GNC_INCLUDE_DIR}
+gncinclude_HEADERS = \
+  import-parse.h
+
+noinst_HEADERS = \
+  import-account-matcher.h \
+  import-backend.h \
+  import-commodity-matcher.h \
+  import-main-matcher.h \
+  import-match-picker.h \
+  import-settings.h \
+  import-pending-matches.h \
+  import-utilities.h
+
+libgncmod_generic_import_la_LDFLAGS = -avoid-version
+
+libgncmod_generic_import_la_LIBADD = \
+  ${top_builddir}/gnucash/gnome-utils/libgncmod-gnome-utils.la \
+  ${top_builddir}/libgnucash/app-utils/libgncmod-app-utils.la \
+  ${top_builddir}/libgnucash/engine/libgncmod-engine.la \
+  ${top_builddir}/libgnucash/core-utils/libgnc-core-utils.la \
+  ${top_builddir}/libgnucash/gnc-module/libgnc-module.la \
+  ${REGEX_LIBS} \
+  ${GLIB_LIBS}
+
+gtkbuilderdir = ${GNC_GTKBUILDER_DIR}
+gtkbuilder_DATA = dialog-import.glade
+
+AM_CPPFLAGS = \
+  -I${top_srcdir}/common \
+  -I${top_srcdir}/libgnucash/core-utils \
+  -I${top_srcdir}/libgnucash/engine \
+  -I${top_srcdir}/libgnucash/gnc-module \
+  -I${top_srcdir}/libgnucash/app-utils \
+  -I${top_srcdir}/gnucash/gnome \
+  -I${top_srcdir}/gnucash/gnome-utils \
+  ${GTK_CFLAGS} \
+  ${GLIB_CFLAGS}
+
+EXTRA_DIST = \
+  $(gtkbuilder_DATA) \
+  generic-import-design.txt \
+  CMakeLists.txt
+
+AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.i-e\"
diff --git a/gnucash/import-export/aqb/CMakeLists.txt b/gnucash/import-export/aqb/CMakeLists.txt
new file mode 100644
index 0000000..8a64933
--- /dev/null
+++ b/gnucash/import-export/aqb/CMakeLists.txt
@@ -0,0 +1,91 @@
+# CMakeLists.txt for gnucash/import-export/aqbanking
+
+ADD_SUBDIRECTORY(gschemas)
+ADD_SUBDIRECTORY(test)
+
+SET (aqbanking_SOURCES
+  dialog-ab-trans.c
+  dialog-ab-daterange.c
+  assistant-ab-initial.c
+  gnc-ab-getbalance.c
+  gnc-ab-gettrans.c
+  gnc-ab-kvp.c
+  gnc-ab-transfer.c
+  gnc-ab-utils.c
+  gnc-file-aqb-import.c
+  gnc-gwen-gui.c
+  gnc-plugin-aqbanking.c
+  gncmod-aqbanking.c
+)
+
+# Add dependency on config.h
+SET_SOURCE_FILES_PROPERTIES (${aqbanking_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
+
+SET (aqbanking_noinst_HEADERS
+  dialog-ab-trans.h
+  dialog-ab-daterange.h
+  assistant-ab-initial.h
+  gnc-ab-getbalance.h
+  gnc-ab-gettrans.h
+  gnc-ab-kvp.h
+  gnc-ab-transfer.h
+  gnc-ab-utils.h
+  gnc-file-aqb-import.h
+  gnc-gwen-gui.h
+  gnc-plugin-aqbanking.h
+)
+
+SET(aqbanking_GLADE assistant-ab-initial.glade dialog-ab.glade dialog-ab-pref.glade)
+
+SET(aqbanking_UI gnc-plugin-aqbanking-ui.xml)
+
+IF(WITH_AQBANKING)
+  ADD_LIBRARY (gncmod-aqbanking
+    ${aqbanking_SOURCES}
+    ${aqbanking_noinst_HEADERS}
+  )
+
+  SET(AQB_EXPORT_SYMBOLS "")
+  IF (WIN32)
+    SET(AQB_EXPORT_SYMBOLS "-Wl,--export-all-symbols")
+  ENDIF()
+  SET(AQB_LIBSTDCXX "")
+  IF (MINGW)
+    SET(AQB_LIBSTDCXX "-lstdc++")
+  ENDIF()
+
+  TARGET_LINK_LIBRARIES(gncmod-aqbanking gnc-gnome gncmod-gnome-utils
+         gncmod-generic-import gncmod-register-core
+         gncmod-register-gnome gncmod-ledger-core gncmod-engine
+         ${AQB_EXPORT_SYMBOLS} ${AQBANKING_LDFLAGS}
+         ${GWENHYWFAR_LDFLAGS} ${GWENGUI_GTK2_LDFLAGS}
+         ${GNOME_LDFLAGS} ${KTOBLZCHECK_LDFLAGS} ${AQB_LIBSTDCXX})
+
+  TARGET_COMPILE_DEFINITIONS(gncmod-aqbanking PRIVATE -DG_LOG_DOMAIN=\"gnc.import.aqbanking\")
+
+  TARGET_INCLUDE_DIRECTORIES(gncmod-aqbanking PRIVATE ${AQBANKING_INCLUDE_DIRS}
+         ${GWENHYWFAR_INCLUDE_DIRS} ${KTOBLZCHECK_INCLUDE_DIRS})
+
+  INSTALL(TARGETS gncmod-aqbanking
+    LIBRARY DESTINATION lib/gnucash
+    ARCHIVE DESTINATION lib/gnucash
+    RUNTIME DESTINATION bin)
+
+# No headers to install
+
+
+  INSTALL(FILES ${aqbanking_GLADE} DESTINATION share/gnucash/gtkbuilder)
+
+  INSTALL(FILES ${aqbanking_UI} DESTINATION share/gnucash/ui)
+
+  FILE(COPY ${aqbanking_UI}
+    DESTINATION ${DATADIR_BUILD}/gnucash/ui)
+  FILE(COPY ${aqbanking_GLADE}
+    DESTINATION ${DATADIR_BUILD}/gnucash/gtkbuilder)
+ENDIF(WITH_AQBANKING)
+
+SET_LOCAL_DIST(aqbanking_DIST_local CMakeLists.txt Makefile.am migratable-prefs-aqbanking.xml
+        ${aqbanking_SOURCES} ${aqbanking_noinst_HEADERS} ${aqbanking_EXTRA_DIST}
+        ${aqbanking_GLADE} ${aqbanking_UI})
+
+SET(aqbanking_DIST ${aqbanking_DIST_local} ${aqbanking_gschema_DIST} ${test_aqb_DIST} PARENT_SCOPE)
diff --git a/gnucash/import-export/aqb/Makefile.am b/gnucash/import-export/aqb/Makefile.am
new file mode 100644
index 0000000..d699d80
--- /dev/null
+++ b/gnucash/import-export/aqb/Makefile.am
@@ -0,0 +1,81 @@
+SUBDIRS = . gschemas test
+
+pkglib_LTLIBRARIES = libgncmod-aqbanking.la
+
+libgncmod_aqbanking_la_SOURCES = \
+  dialog-ab-trans.c \
+  dialog-ab-daterange.c \
+  assistant-ab-initial.c \
+  gnc-ab-getbalance.c \
+  gnc-ab-gettrans.c \
+  gnc-ab-kvp.c \
+  gnc-ab-transfer.c \
+  gnc-ab-utils.c \
+  gnc-file-aqb-import.c \
+  gnc-gwen-gui.c \
+  gnc-plugin-aqbanking.c \
+  gncmod-aqbanking.c
+
+noinst_HEADERS = \
+  dialog-ab-trans.h \
+  dialog-ab-daterange.h \
+  assistant-ab-initial.h \
+  gnc-ab-getbalance.h \
+  gnc-ab-gettrans.h \
+  gnc-ab-kvp.h \
+  gnc-ab-transfer.h \
+  gnc-ab-utils.h \
+  gnc-file-aqb-import.h \
+  gnc-gwen-gui.h \
+  gnc-plugin-aqbanking.h
+
+libgncmod_aqbanking_la_LDFLAGS = -avoid-version
+if OS_WIN32
+libgncmod_aqbanking_la_LDFLAGS += -export-symbols-regex .*
+endif
+libgncmod_aqbanking_la_LIBADD = \
+  ${top_builddir}/gnucash/import-export/libgncmod-generic-import.la \
+  ${top_builddir}/gnucash/gnome/libgnc-gnome.la \
+  ${top_builddir}/gnucash/gnome-utils/libgncmod-gnome-utils.la \
+  ${top_builddir}/libgnucash/app-utils/libgncmod-app-utils.la \
+  ${top_builddir}/libgnucash/engine/libgncmod-engine.la \
+  ${top_builddir}/libgnucash/core-utils/libgnc-core-utils.la \
+  ${top_builddir}/libgnucash/gnc-module/libgnc-module.la \
+  ${GTK_LIBS} \
+  ${GLIB_LIBS} \
+  ${GWENGUI_GTK2_LIBS} \
+  ${AQBANKING_LIBS}
+
+AM_CPPFLAGS = \
+  -I${top_srcdir}/common \
+  -I${top_srcdir}/gnucash/import-export \
+  -I${top_srcdir}/gnucash/gnome \
+  -I${top_srcdir}/gnucash/register/ledger-core \
+  -I${top_srcdir}/gnucash/register/register-gnome \
+  -I${top_srcdir}/gnucash/register/register-core \
+  -I${top_srcdir}/gnucash/gnome-utils \
+  -I${top_srcdir}/libgnucash/app-utils \
+  -I${top_srcdir}/libgnucash/engine \
+  -I${top_srcdir}/libgnucash/core-utils \
+  -I${top_srcdir}/libgnucash/gnc-module \
+  ${GTK_CFLAGS} \
+  ${GLIB_CFLAGS} \
+  ${AQBANKING_CFLAGS}
+
+uidir = $(GNC_UI_DIR)
+ui_DATA = \
+  gnc-plugin-aqbanking-ui.xml
+
+gtkbuilderdir = $(GNC_GTKBUILDER_DIR)
+gtkbuilder_DATA = \
+  assistant-ab-initial.glade \
+  dialog-ab.glade \
+  dialog-ab-pref.glade
+
+EXTRA_DIST = \
+    ${ui_DATA} \
+    ${gtkbuilder_DATA} \
+    migratable-prefs-aqbanking.xml \
+    CMakeLists.txt
+
+AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.import.aqbanking\"
diff --git a/src/import-export/aqb/assistant-ab-initial.c b/gnucash/import-export/aqb/assistant-ab-initial.c
similarity index 100%
rename from src/import-export/aqb/assistant-ab-initial.c
rename to gnucash/import-export/aqb/assistant-ab-initial.c
diff --git a/src/import-export/aqb/assistant-ab-initial.glade b/gnucash/import-export/aqb/assistant-ab-initial.glade
similarity index 100%
rename from src/import-export/aqb/assistant-ab-initial.glade
rename to gnucash/import-export/aqb/assistant-ab-initial.glade
diff --git a/src/import-export/aqb/assistant-ab-initial.h b/gnucash/import-export/aqb/assistant-ab-initial.h
similarity index 100%
rename from src/import-export/aqb/assistant-ab-initial.h
rename to gnucash/import-export/aqb/assistant-ab-initial.h
diff --git a/src/import-export/aqb/dialog-ab-daterange.c b/gnucash/import-export/aqb/dialog-ab-daterange.c
similarity index 100%
rename from src/import-export/aqb/dialog-ab-daterange.c
rename to gnucash/import-export/aqb/dialog-ab-daterange.c
diff --git a/src/import-export/aqb/dialog-ab-daterange.h b/gnucash/import-export/aqb/dialog-ab-daterange.h
similarity index 100%
rename from src/import-export/aqb/dialog-ab-daterange.h
rename to gnucash/import-export/aqb/dialog-ab-daterange.h
diff --git a/src/import-export/aqb/dialog-ab-pref.glade b/gnucash/import-export/aqb/dialog-ab-pref.glade
similarity index 100%
rename from src/import-export/aqb/dialog-ab-pref.glade
rename to gnucash/import-export/aqb/dialog-ab-pref.glade
diff --git a/src/import-export/aqb/dialog-ab-trans.c b/gnucash/import-export/aqb/dialog-ab-trans.c
similarity index 100%
rename from src/import-export/aqb/dialog-ab-trans.c
rename to gnucash/import-export/aqb/dialog-ab-trans.c
diff --git a/src/import-export/aqb/dialog-ab-trans.h b/gnucash/import-export/aqb/dialog-ab-trans.h
similarity index 100%
rename from src/import-export/aqb/dialog-ab-trans.h
rename to gnucash/import-export/aqb/dialog-ab-trans.h
diff --git a/src/import-export/aqb/dialog-ab.glade b/gnucash/import-export/aqb/dialog-ab.glade
similarity index 100%
rename from src/import-export/aqb/dialog-ab.glade
rename to gnucash/import-export/aqb/dialog-ab.glade
diff --git a/src/import-export/aqb/gnc-ab-getbalance.c b/gnucash/import-export/aqb/gnc-ab-getbalance.c
similarity index 100%
rename from src/import-export/aqb/gnc-ab-getbalance.c
rename to gnucash/import-export/aqb/gnc-ab-getbalance.c
diff --git a/src/import-export/aqb/gnc-ab-getbalance.h b/gnucash/import-export/aqb/gnc-ab-getbalance.h
similarity index 100%
rename from src/import-export/aqb/gnc-ab-getbalance.h
rename to gnucash/import-export/aqb/gnc-ab-getbalance.h
diff --git a/src/import-export/aqb/gnc-ab-gettrans.c b/gnucash/import-export/aqb/gnc-ab-gettrans.c
similarity index 100%
rename from src/import-export/aqb/gnc-ab-gettrans.c
rename to gnucash/import-export/aqb/gnc-ab-gettrans.c
diff --git a/src/import-export/aqb/gnc-ab-gettrans.h b/gnucash/import-export/aqb/gnc-ab-gettrans.h
similarity index 100%
rename from src/import-export/aqb/gnc-ab-gettrans.h
rename to gnucash/import-export/aqb/gnc-ab-gettrans.h
diff --git a/src/import-export/aqb/gnc-ab-kvp.c b/gnucash/import-export/aqb/gnc-ab-kvp.c
similarity index 100%
rename from src/import-export/aqb/gnc-ab-kvp.c
rename to gnucash/import-export/aqb/gnc-ab-kvp.c
diff --git a/src/import-export/aqb/gnc-ab-kvp.h b/gnucash/import-export/aqb/gnc-ab-kvp.h
similarity index 100%
rename from src/import-export/aqb/gnc-ab-kvp.h
rename to gnucash/import-export/aqb/gnc-ab-kvp.h
diff --git a/src/import-export/aqb/gnc-ab-transfer.c b/gnucash/import-export/aqb/gnc-ab-transfer.c
similarity index 100%
rename from src/import-export/aqb/gnc-ab-transfer.c
rename to gnucash/import-export/aqb/gnc-ab-transfer.c
diff --git a/src/import-export/aqb/gnc-ab-transfer.h b/gnucash/import-export/aqb/gnc-ab-transfer.h
similarity index 100%
rename from src/import-export/aqb/gnc-ab-transfer.h
rename to gnucash/import-export/aqb/gnc-ab-transfer.h
diff --git a/src/import-export/aqb/gnc-ab-utils.c b/gnucash/import-export/aqb/gnc-ab-utils.c
similarity index 100%
rename from src/import-export/aqb/gnc-ab-utils.c
rename to gnucash/import-export/aqb/gnc-ab-utils.c
diff --git a/src/import-export/aqb/gnc-ab-utils.h b/gnucash/import-export/aqb/gnc-ab-utils.h
similarity index 100%
rename from src/import-export/aqb/gnc-ab-utils.h
rename to gnucash/import-export/aqb/gnc-ab-utils.h
diff --git a/src/import-export/aqb/gnc-file-aqb-import.c b/gnucash/import-export/aqb/gnc-file-aqb-import.c
similarity index 100%
rename from src/import-export/aqb/gnc-file-aqb-import.c
rename to gnucash/import-export/aqb/gnc-file-aqb-import.c
diff --git a/src/import-export/aqb/gnc-file-aqb-import.h b/gnucash/import-export/aqb/gnc-file-aqb-import.h
similarity index 100%
rename from src/import-export/aqb/gnc-file-aqb-import.h
rename to gnucash/import-export/aqb/gnc-file-aqb-import.h
diff --git a/src/import-export/aqb/gnc-gwen-gui.c b/gnucash/import-export/aqb/gnc-gwen-gui.c
similarity index 100%
rename from src/import-export/aqb/gnc-gwen-gui.c
rename to gnucash/import-export/aqb/gnc-gwen-gui.c
diff --git a/src/import-export/aqb/gnc-gwen-gui.h b/gnucash/import-export/aqb/gnc-gwen-gui.h
similarity index 100%
rename from src/import-export/aqb/gnc-gwen-gui.h
rename to gnucash/import-export/aqb/gnc-gwen-gui.h
diff --git a/src/import-export/aqb/gnc-plugin-aqbanking-ui.xml b/gnucash/import-export/aqb/gnc-plugin-aqbanking-ui.xml
similarity index 100%
rename from src/import-export/aqb/gnc-plugin-aqbanking-ui.xml
rename to gnucash/import-export/aqb/gnc-plugin-aqbanking-ui.xml
diff --git a/src/import-export/aqb/gnc-plugin-aqbanking.c b/gnucash/import-export/aqb/gnc-plugin-aqbanking.c
similarity index 100%
rename from src/import-export/aqb/gnc-plugin-aqbanking.c
rename to gnucash/import-export/aqb/gnc-plugin-aqbanking.c
diff --git a/src/import-export/aqb/gnc-plugin-aqbanking.h b/gnucash/import-export/aqb/gnc-plugin-aqbanking.h
similarity index 100%
rename from src/import-export/aqb/gnc-plugin-aqbanking.h
rename to gnucash/import-export/aqb/gnc-plugin-aqbanking.h
diff --git a/src/import-export/aqb/gncmod-aqbanking.c b/gnucash/import-export/aqb/gncmod-aqbanking.c
similarity index 100%
rename from src/import-export/aqb/gncmod-aqbanking.c
rename to gnucash/import-export/aqb/gncmod-aqbanking.c
diff --git a/src/import-export/aqb/gschemas/CMakeLists.txt b/gnucash/import-export/aqb/gschemas/CMakeLists.txt
similarity index 100%
rename from src/import-export/aqb/gschemas/CMakeLists.txt
rename to gnucash/import-export/aqb/gschemas/CMakeLists.txt
diff --git a/src/import-export/aqb/gschemas/Makefile.am b/gnucash/import-export/aqb/gschemas/Makefile.am
similarity index 100%
rename from src/import-export/aqb/gschemas/Makefile.am
rename to gnucash/import-export/aqb/gschemas/Makefile.am
diff --git a/src/import-export/aqb/gschemas/org.gnucash.dialogs.import.hbci.gschema.xml.in.in b/gnucash/import-export/aqb/gschemas/org.gnucash.dialogs.import.hbci.gschema.xml.in.in
similarity index 100%
rename from src/import-export/aqb/gschemas/org.gnucash.dialogs.import.hbci.gschema.xml.in.in
rename to gnucash/import-export/aqb/gschemas/org.gnucash.dialogs.import.hbci.gschema.xml.in.in
diff --git a/src/import-export/aqb/migratable-prefs-aqbanking.xml b/gnucash/import-export/aqb/migratable-prefs-aqbanking.xml
similarity index 100%
rename from src/import-export/aqb/migratable-prefs-aqbanking.xml
rename to gnucash/import-export/aqb/migratable-prefs-aqbanking.xml
diff --git a/gnucash/import-export/aqb/test/CMakeLists.txt b/gnucash/import-export/aqb/test/CMakeLists.txt
new file mode 100644
index 0000000..f665052
--- /dev/null
+++ b/gnucash/import-export/aqb/test/CMakeLists.txt
@@ -0,0 +1,36 @@
+set(test_aqb_SOURCES test-aqb.c test-kvp.c)
+
+set(test_aqb_INCLUDE_DIRS
+  ${CMAKE_BINARY_DIR}/common
+  ${CMAKE_SOURCE_DIR}/gnucash/import-export/aqb
+  ${CMAKE_SOURCE_DIR}/common
+  ${CMAKE_SOURCE_DIR}/gnucash/import-export
+  ${CMAKE_SOURCE_DIR}/gnucash/gnome
+  ${CMAKE_SOURCE_DIR}/gnucash/register/ledger-core
+  ${CMAKE_SOURCE_DIR}/gnucash/register/regiser-gnome
+  ${CMAKE_SOURCE_DIR}/gnucash/register/regitser-core
+  ${CMAKE_SOURCE_DIR}/gnucash/gnome-utils
+  ${CMAKE_SOURCE_DIR}/libgnucash/app-utils
+  ${CMAKE_SOURCE_DIR}/libgnucash/engine
+  ${CMAKE_SOURCE_DIR}/libgnucash/core-utils
+  ${CMAKE_SOURCE_DIR}/libgnucash/gnc-module
+  ${GLIB2_INCLUDE_DIRS}
+  ${GTK_INCLUDE_DIRS}
+  ${AQBANKING_INCLUDE_DIRS}
+)
+
+set(test_aqb_LIBS
+  gncmod-aqbanking gncmod-generic-import gnc-gnome gncmod-gnome-utils
+  gncmod-ledger-core gncmod-report-gnome gncmod-app-utils
+  gncmod-backend-xml-utils gncmod-engine gnc-core-utils gnc-module
+  ${GLIB2_LDFLAGS}
+)
+
+SET_DIST_LIST(test_aqb_DIST ${test_aqb_SOURCES} file-book.gnucash
+  file-book-hbcislot.gnucash CMakeLists.txt Makefile.am)
+IF(WITH_AQBANKING)
+  GNC_ADD_TEST(test-aqb
+    "${test_aqb_SOURCES}"
+    test_aqb_INCLUDE_DIRS
+    test_aqb_LIBS SRCDIR=${CMAKE_CURRENT_SOURCE_DIR})
+ ENDIF()
diff --git a/gnucash/import-export/aqb/test/Makefile.am b/gnucash/import-export/aqb/test/Makefile.am
new file mode 100644
index 0000000..830d794
--- /dev/null
+++ b/gnucash/import-export/aqb/test/Makefile.am
@@ -0,0 +1,73 @@
+# A template Makefile.am for GLib g_test-based test directories.
+# Copyright 2011 John Ralls <jralls at ceridwen.us>
+
+include $(top_srcdir)/test-templates/Makefile.decl
+
+
+#You will only need one of these: It points to the module directory
+#after $(top_srcdir) or ${top_builddir}:
+MODULEPATH = gnucash/import-export/aqb
+
+#The test program. You'll need to add to this if you have more than one module above.
+
+check_PROGRAMS = test-aqb
+
+TESTS = ${check_PROGRAMS}
+
+test_aqbdir = ${top_srcdir}/${MODULEPATH}/test
+
+#Program files for tests go here. It's probably best to have one for
+#each file in the parent directory. Include
+#test_foo_support.c if you have one and aren't building the
+#support library.
+test_aqb_SOURCES = \
+  test-aqb.c \
+  test-kvp.c
+
+test_aqb_HEADERSS =
+
+#The tests might require more libraries, but try to keep them
+#as independent as possible.
+test_aqb_LDADD = \
+  ${top_builddir}/${MODULEPATH}/libgncmod-aqbanking.la \
+  ${top_builddir}/gnucash/import-export/libgncmod-generic-import.la \
+  ${top_builddir}/gnucash/gnome/libgnc-gnome.la \
+  ${top_builddir}/gnucash/gnome-utils/libgncmod-gnome-utils.la \
+  ${top_builddir}/gnucash/register/ledger-core/libgncmod-ledger-core.la \
+  ${top_builddir}/gnucash/report/report-gnome/libgncmod-report-gnome.la \
+  ${top_builddir}/libgnucash/app-utils/libgncmod-app-utils.la \
+  ${top_builddir}/libgnucash/backend/xml/libgnc-backend-xml-utils.la \
+  ${top_builddir}/libgnucash/engine/libgncmod-engine.la \
+  ${top_builddir}/libgnucash/core-utils/libgnc-core-utils.la \
+  ${top_builddir}/libgnucash/gnc-module/libgnc-module.la \
+  ${GLIB_LIBS}
+
+test_aqb_CFLAGS = \
+	-DTESTPROG=test_aqb \
+	${DEFAULT_INCLUDES} \
+	-I$(top_srcdir)/${MODULEPATH}/ \
+  -I${top_srcdir}/common \
+  -I${top_srcdir}/gnucash/import-export \
+  -I${top_srcdir}/gnucash/gnome \
+  -I${top_srcdir}/gnucash/register/ledger-core \
+  -I${top_srcdir}/gnucash/register/register-gnome \
+  -I${top_srcdir}/gnucash/register/register-core \
+  -I${top_srcdir}/gnucash/gnome-utils \
+  -I${top_srcdir}/libgnucash/app-utils \
+  -I${top_srcdir}/libgnucash/engine \
+  -I${top_srcdir}/libgnucash/backend/xml \
+  -I${top_srcdir}/libgnucash/core-utils \
+  -I${top_srcdir}/libgnucash/gnc-module \
+  ${GTK_CFLAGS} \
+  ${GLIB_CFLAGS} \
+  ${AQBANKING_CFLAGS}
+
+  TESTS_ENVIRONMENT = \
+  GNC_BUILDDIR=${abs_top_builddir} \
+  SRCDIR=${srcdir} \
+  G_DEBUG=
+
+EXTRA_DIST += \
+  file-book-hbcislot.gnucash \
+  file-book.gnucash \
+  CMakeLists.txt
diff --git a/src/import-export/aqb/test/file-book-hbcislot.gnucash b/gnucash/import-export/aqb/test/file-book-hbcislot.gnucash
similarity index 100%
rename from src/import-export/aqb/test/file-book-hbcislot.gnucash
rename to gnucash/import-export/aqb/test/file-book-hbcislot.gnucash
diff --git a/src/import-export/aqb/test/file-book.gnucash b/gnucash/import-export/aqb/test/file-book.gnucash
similarity index 100%
rename from src/import-export/aqb/test/file-book.gnucash
rename to gnucash/import-export/aqb/test/file-book.gnucash
diff --git a/gnucash/import-export/aqb/test/test-aqb.c b/gnucash/import-export/aqb/test/test-aqb.c
new file mode 100644
index 0000000..2fd7b12
--- /dev/null
+++ b/gnucash/import-export/aqb/test/test-aqb.c
@@ -0,0 +1,61 @@
+/********************************************************************
+ * testmain.c: GLib g_test test execution file.			    *
+ * Copyright 2011 John Ralls <jralls at ceridwen.us>		    *
+ *                                                                  *
+ * 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 at gnu.org                   *
+\********************************************************************/
+
+
+/* This is a template test program. Copy it to the test sudirectory and rename it test_modulename.c. (Use the same modulename that you gave Makefile.am in the same directory.
+Write and link other test files */
+#include <glib.h>
+#include "config.h"
+#include <qof.h>
+#include "gnc-backend-xml.h"
+#include "gnc-module.h"
+#include "gnc-engine.h"
+#include <TransLog.h>
+
+extern void test_qofsession_aqb_kvp( void );
+
+int
+main (int   argc,
+      char *argv[])
+{
+    g_setenv ("GNC_UNINSTALLED", "1", TRUE);
+    qof_init(); 			/* Initialize the GObject system */
+    qof_log_init_filename_special("stderr"); /* Init the log system */
+    g_test_init ( &argc, &argv, NULL ); 	/* initialize test program */
+    qof_log_set_level("gnc", (QofLogLevel)G_LOG_LEVEL_DEBUG);
+    g_test_bug_base("https://bugzilla.gnome.org/show_bug.cgi?id="); /* init the bugzilla URL */
+    /* Disable the transaction log */
+    xaccLogDisable();
+
+    gnc_module_system_init();
+    gnc_engine_init(argc, argv);
+
+    /* Add test functions and suites. See
+     * http://library.gnome.org/devel/glib/stable/glib-Testing.html for
+     * details. Unfortunately, GLib-Testing doesn't provide the automatic
+     * registration features of more sophisticated frameworks. */
+    g_test_add_func ("/import-export/aqb/kvp", test_qofsession_aqb_kvp);
+
+    return g_test_run();
+}
+
+
diff --git a/gnucash/import-export/aqb/test/test-kvp.c b/gnucash/import-export/aqb/test/test-kvp.c
new file mode 100644
index 0000000..415eed6
--- /dev/null
+++ b/gnucash/import-export/aqb/test/test-kvp.c
@@ -0,0 +1,209 @@
+/********************************************************************
+ * test_submodule.c: Example GLib g_test test suite.		    *
+ * Copyright 2011 John Ralls <jralls at ceridwen.us>		    *
+ *                                                                  *
+ * 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 at gnu.org                   *
+\********************************************************************/
+
+#include <config.h>
+#include <glib.h>
+
+// for the gnc_ab_get_book_template_list() et al. functions
+#include "gnc-ab-kvp.h"
+#include <gnc-aqbanking-templates.h>
+#include <qofinstance-p.h>
+#include "gnc-hooks.h"
+
+void test_qofsession_aqb_kvp (void);
+
+static char* get_filepath(const char* filename)
+{
+    char *result;
+
+    const char *srcdir = g_getenv("SRCDIR");
+    if (!srcdir)
+    {
+        g_test_message("No env variable SRCDIR exists, assuming \".\"\n");
+        srcdir = ".";
+    }
+
+    result = g_strdup_printf("%s/%s", srcdir, filename);
+
+    g_test_message("Using file path %s\n", result);
+
+    // Test whether the file really exists
+    g_assert(g_file_test(result, G_FILE_TEST_EXISTS));
+
+    return result;
+}
+
+void
+test_qofsession_aqb_kvp( void )
+{
+    /* load the accounts from the users datafile */
+    /* but first, check to make sure we've got a session going. */
+    QofBackendError io_err;
+    char *file1 = get_filepath("file-book.gnucash");
+    char *file2 = get_filepath("file-book-hbcislot.gnucash");
+
+    if (1)
+    {
+        // A file with no content at all, but a valid XML file
+        QofSession *new_session = qof_session_new ();
+        char *newfile = g_strdup_printf("file://%s", file1);
+
+        qof_session_begin (new_session, newfile, TRUE, FALSE, FALSE);
+        io_err = qof_session_get_error (new_session);
+        //printf("io_err1 = %d\n", io_err);
+        g_assert(io_err != ERR_BACKEND_NO_HANDLER); // Do not have no handler
+
+        g_assert(io_err != ERR_BACKEND_NO_SUCH_DB); // DB must exist
+        g_assert(io_err != ERR_BACKEND_LOCKED);
+        g_assert(io_err == 0);
+
+        qof_session_load (new_session, NULL);
+        io_err = qof_session_get_error (new_session);
+        //printf("io_err2 = %d\n", io_err);
+        g_assert(io_err == 0);
+
+        g_free(newfile);
+        g_free(file1);
+
+        gnc_hook_run(HOOK_BOOK_CLOSED, new_session);
+        //qof_session_destroy(new_session); // tries to delete the LCK file but it wasn't created in the first place
+    }
+
+    if (1)
+    {
+        // A file with no content except for the book_template_list kvp
+        // slot
+        QofSession *new_session = qof_session_new ();
+        char *newfile = g_strdup_printf("file://%s", file2);
+
+        qof_session_begin (new_session, newfile, TRUE, FALSE, FALSE);
+        io_err = qof_session_get_error (new_session);
+        //printf("io_err1 = %d\n", io_err);
+        g_assert(io_err != ERR_BACKEND_NO_HANDLER); // Do not have no handler
+
+        g_assert(io_err != ERR_BACKEND_NO_SUCH_DB); // DB must exist
+        g_assert(io_err != ERR_BACKEND_LOCKED);
+        g_assert(io_err == 0);
+
+        qof_session_load (new_session, NULL);
+        io_err = qof_session_get_error (new_session);
+        //printf("io_err2 = %d\n", io_err);
+        g_assert(io_err == 0);
+
+        {
+            GList *templ_list;
+            GncABTransTempl *templ;
+            QofBook *book = qof_session_get_book(new_session);
+            const char* ORIGINAL_NAME = "Some Name";
+            const char* CHANGED_NAME = "Some Changed Name";
+
+            templ_list = gnc_ab_trans_templ_list_new_from_book (book);
+            g_assert_cmpint(g_list_length(templ_list), ==, 1);
+
+            templ = templ_list->data;
+	    //Raise the edit level so that we can check that it's marked dirty.
+	    qof_instance_increase_editlevel(QOF_INSTANCE(book));
+	    g_assert_cmpstr(gnc_ab_trans_templ_get_name(templ), ==, ORIGINAL_NAME); // ok, name from file is here
+
+            // Now we change the name into something else and verify it can be saved
+            gnc_ab_trans_templ_set_name(templ, CHANGED_NAME);
+            {
+                g_assert(!qof_instance_get_dirty(QOF_INSTANCE(book))); // not yet dirty
+
+                // Here we save the changed kvp
+                gnc_ab_set_book_template_list(book, templ_list);
+                g_assert(qof_instance_get_dirty(QOF_INSTANCE(book))); // yup, now dirty
+                gnc_ab_trans_templ_list_free(templ_list);
+            }
+
+            {
+                templ_list = gnc_ab_trans_templ_list_new_from_book (book);
+                g_assert_cmpint(g_list_length(templ_list), ==, 1);
+
+                templ = templ_list->data;
+                g_assert_cmpstr(gnc_ab_trans_templ_get_name(templ), ==, CHANGED_NAME); // ok, the change has been saved!
+                gnc_ab_trans_templ_list_free(templ_list);
+            }
+        }
+
+        {
+            // Check the kvp slots of a aqbanking-enabled account
+            QofBook *book = qof_session_get_book(new_session);
+            Account* account = gnc_book_get_root_account(book);
+            GDate retrieved_date, original_date;
+            gchar buff[MAX_DATE_LENGTH];
+
+            g_assert(account);
+
+            // The interesting test case here: Can we read the correct date
+            // from the xml file?
+            if (1)
+            {
+                Timespec retrieved_ts = gnc_ab_get_account_trans_retrieval(account);
+                g_test_message("retrieved_ts=%s\n", gnc_print_date(retrieved_ts));
+                //printf("Time=%s\n", gnc_print_date(retrieved_ts));
+
+                retrieved_date = timespec_to_gdate(retrieved_ts);
+                g_date_set_dmy(&original_date, 29, 8, 2014);
+
+                g_assert_cmpint(g_date_compare(&retrieved_date, &original_date), ==, 0);
+            }
+
+            // A lower-level test here: Can we write and read again the
+            // trans_retrieval date? This wouldn't need this particular
+            // Account, just a general Account object.
+            if (0)
+            {
+                Timespec original_ts = timespec_now(), retrieved_ts;
+
+                // Check whether the "ab-trans-retrieval" property of Account
+                // is written and read again correctly.
+                gnc_ab_set_account_trans_retrieval(account, original_ts);
+                retrieved_ts = gnc_ab_get_account_trans_retrieval(account);
+
+//                printf("original_ts=%s = %d  retrieved_ts=%s = %d\n",
+//                       gnc_print_date(original_ts), original_ts.tv_sec,
+//                       gnc_print_date(retrieved_ts), retrieved_ts.tv_sec);
+
+                original_date = timespec_to_gdate(original_ts);
+                retrieved_date = timespec_to_gdate(retrieved_ts);
+
+                qof_print_gdate (buff, sizeof (buff), &original_date);
+                //printf("original_date=%s\n", buff);
+                qof_print_gdate (buff, sizeof (buff), &retrieved_date);
+                //printf("retrieved_date=%s\n", buff);
+
+                // Is the retrieved date identical to the one written
+                g_assert_cmpint(g_date_compare(&retrieved_date, &original_date), ==, 0);
+            }
+
+        }
+
+        g_free(newfile);
+        g_free(file2);
+
+        gnc_hook_run(HOOK_BOOK_CLOSED, new_session);
+        //qof_session_destroy(new_session); // tries to delete the LCK file but it wasn't created in the first place
+    }
+
+
+}
diff --git a/src/import-export/csv-exp/CMakeLists.txt b/gnucash/import-export/csv-exp/CMakeLists.txt
similarity index 100%
rename from src/import-export/csv-exp/CMakeLists.txt
rename to gnucash/import-export/csv-exp/CMakeLists.txt
diff --git a/gnucash/import-export/csv-exp/Makefile.am b/gnucash/import-export/csv-exp/Makefile.am
new file mode 100644
index 0000000..4635918
--- /dev/null
+++ b/gnucash/import-export/csv-exp/Makefile.am
@@ -0,0 +1,60 @@
+SUBDIRS = . gschemas
+
+pkglib_LTLIBRARIES=libgncmod-csv-export.la
+
+libgncmod_csv_export_la_SOURCES = \
+  gncmod-csv-export.c \
+  gnc-plugin-csv-export.c \
+  assistant-csv-export.c \
+  csv-tree-export.c \
+  csv-transactions-export.c
+
+noinst_HEADERS = \
+  gnc-plugin-csv-export.h \
+  assistant-csv-export.h \
+  csv-tree-export.h \
+  csv-transactions-export.h
+
+libgncmod_csv_export_la_LDFLAGS = -avoid-version
+
+libgncmod_csv_export_la_LIBADD = \
+  ${top_builddir}/gnucash/import-export/libgncmod-generic-import.la \
+  ${top_builddir}/gnucash/gnome-utils/libgncmod-gnome-utils.la \
+  ${top_builddir}/libgnucash/app-utils/libgncmod-app-utils.la \
+  ${top_builddir}/gnucash/gnome/libgnc-gnome.la \
+  ${top_builddir}/libgnucash/engine/libgncmod-engine.la \
+  ${top_builddir}/libgnucash/core-utils/libgnc-core-utils.la \
+  ${top_builddir}/libgnucash/gnc-module/libgnc-module.la \
+  ${top_builddir}/lib/libc/libc-missing.la \
+  ${GTK_LIBS} \
+  ${GLIB_LIBS}
+
+AM_CPPFLAGS = \
+  -I${top_srcdir}/common \
+  -I${top_srcdir}/libgnucash/core-utils \
+  -I${top_srcdir}/libgnucash/engine \
+  -I${top_srcdir}/libgnucash/gnc-module \
+  -I${top_srcdir}/libgnucash/app-utils \
+  -I${top_srcdir}/gnucash/gnome \
+  -I${top_srcdir}/gnucash/gnome-utils \
+  -I${top_srcdir}/gnucash/register/ledger-core \
+  -I${top_srcdir}/gnucash/register/register-core \
+  -I${top_srcdir}/gnucash/register/register-gnome \
+  -I${top_srcdir}/gnucash/import-export \
+  -I${top_srcdir}/lib/libc \
+  -I${top_srcdir}/lib \
+  ${GUILE_CFLAGS} \
+  ${GLIB_CFLAGS} \
+  $(GTK_CFLAGS)
+
+uidir = $(GNC_UI_DIR)
+ui_DATA = \
+	gnc-plugin-csv-export-ui.xml
+
+gtkbuilderdir = ${GNC_GTKBUILDER_DIR}
+gtkbuilder_DATA = \
+	assistant-csv-export.glade
+
+EXTRA_DIST = $(ui_DATA) $(gtkbuilder_DATA) CMakeLists.txt
+
+AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.export.csv\"
diff --git a/src/import-export/csv-exp/assistant-csv-export.c b/gnucash/import-export/csv-exp/assistant-csv-export.c
similarity index 100%
rename from src/import-export/csv-exp/assistant-csv-export.c
rename to gnucash/import-export/csv-exp/assistant-csv-export.c
diff --git a/src/import-export/csv-exp/assistant-csv-export.glade b/gnucash/import-export/csv-exp/assistant-csv-export.glade
similarity index 100%
rename from src/import-export/csv-exp/assistant-csv-export.glade
rename to gnucash/import-export/csv-exp/assistant-csv-export.glade
diff --git a/src/import-export/csv-exp/assistant-csv-export.h b/gnucash/import-export/csv-exp/assistant-csv-export.h
similarity index 100%
rename from src/import-export/csv-exp/assistant-csv-export.h
rename to gnucash/import-export/csv-exp/assistant-csv-export.h
diff --git a/src/import-export/csv-exp/csv-transactions-export.c b/gnucash/import-export/csv-exp/csv-transactions-export.c
similarity index 100%
rename from src/import-export/csv-exp/csv-transactions-export.c
rename to gnucash/import-export/csv-exp/csv-transactions-export.c
diff --git a/src/import-export/csv-exp/csv-transactions-export.h b/gnucash/import-export/csv-exp/csv-transactions-export.h
similarity index 100%
rename from src/import-export/csv-exp/csv-transactions-export.h
rename to gnucash/import-export/csv-exp/csv-transactions-export.h
diff --git a/src/import-export/csv-exp/csv-tree-export.c b/gnucash/import-export/csv-exp/csv-tree-export.c
similarity index 100%
rename from src/import-export/csv-exp/csv-tree-export.c
rename to gnucash/import-export/csv-exp/csv-tree-export.c
diff --git a/src/import-export/csv-exp/csv-tree-export.h b/gnucash/import-export/csv-exp/csv-tree-export.h
similarity index 100%
rename from src/import-export/csv-exp/csv-tree-export.h
rename to gnucash/import-export/csv-exp/csv-tree-export.h
diff --git a/src/import-export/csv-exp/gnc-plugin-csv-export-ui.xml b/gnucash/import-export/csv-exp/gnc-plugin-csv-export-ui.xml
similarity index 100%
rename from src/import-export/csv-exp/gnc-plugin-csv-export-ui.xml
rename to gnucash/import-export/csv-exp/gnc-plugin-csv-export-ui.xml
diff --git a/src/import-export/csv-exp/gnc-plugin-csv-export.c b/gnucash/import-export/csv-exp/gnc-plugin-csv-export.c
similarity index 100%
rename from src/import-export/csv-exp/gnc-plugin-csv-export.c
rename to gnucash/import-export/csv-exp/gnc-plugin-csv-export.c
diff --git a/src/import-export/csv-exp/gnc-plugin-csv-export.h b/gnucash/import-export/csv-exp/gnc-plugin-csv-export.h
similarity index 100%
rename from src/import-export/csv-exp/gnc-plugin-csv-export.h
rename to gnucash/import-export/csv-exp/gnc-plugin-csv-export.h
diff --git a/src/import-export/csv-exp/gncmod-csv-export.c b/gnucash/import-export/csv-exp/gncmod-csv-export.c
similarity index 100%
rename from src/import-export/csv-exp/gncmod-csv-export.c
rename to gnucash/import-export/csv-exp/gncmod-csv-export.c
diff --git a/src/import-export/csv-exp/gschemas/CMakeLists.txt b/gnucash/import-export/csv-exp/gschemas/CMakeLists.txt
similarity index 100%
rename from src/import-export/csv-exp/gschemas/CMakeLists.txt
rename to gnucash/import-export/csv-exp/gschemas/CMakeLists.txt
diff --git a/src/import-export/csv-exp/gschemas/Makefile.am b/gnucash/import-export/csv-exp/gschemas/Makefile.am
similarity index 100%
rename from src/import-export/csv-exp/gschemas/Makefile.am
rename to gnucash/import-export/csv-exp/gschemas/Makefile.am
diff --git a/src/import-export/csv-exp/gschemas/org.gnucash.dialogs.export.csv.gschema.xml.in.in b/gnucash/import-export/csv-exp/gschemas/org.gnucash.dialogs.export.csv.gschema.xml.in.in
similarity index 100%
rename from src/import-export/csv-exp/gschemas/org.gnucash.dialogs.export.csv.gschema.xml.in.in
rename to gnucash/import-export/csv-exp/gschemas/org.gnucash.dialogs.export.csv.gschema.xml.in.in
diff --git a/src/import-export/csv-imp/CMakeLists.txt b/gnucash/import-export/csv-imp/CMakeLists.txt
similarity index 100%
rename from src/import-export/csv-imp/CMakeLists.txt
rename to gnucash/import-export/csv-imp/CMakeLists.txt
diff --git a/gnucash/import-export/csv-imp/Makefile.am b/gnucash/import-export/csv-imp/Makefile.am
new file mode 100644
index 0000000..c718b03
--- /dev/null
+++ b/gnucash/import-export/csv-imp/Makefile.am
@@ -0,0 +1,83 @@
+SUBDIRS = . gschemas test
+
+pkglib_LTLIBRARIES=libgncmod-csv-import.la
+
+libgncmod_csv_import_la_SOURCES = \
+  gncmod-csv-import.c \
+  assistant-csv-account-import.c \
+  assistant-csv-trans-import.cpp \
+  gnc-plugin-csv-import.c \
+  csv-account-import.c \
+  gnc-csv-account-map.c \
+  gnc-csv-tokenizer.cpp \
+  gnc-csv-gnumeric-popup.c \
+  gnc-dummy-tokenizer.cpp \
+  gnc-fw-tokenizer.cpp \
+  gnc-tokenizer.cpp \
+  gnc-tx-import.cpp \
+  gnc-trans-props.cpp \
+  gnc-csv-trans-settings.cpp
+
+noinst_HEADERS = \
+  assistant-csv-account-import.h \
+  assistant-csv-trans-import.h \
+  gnc-plugin-csv-import.h \
+  csv-account-import.h \
+  gnc-csv-account-map.h \
+  gnc-csv-tokenizer.hpp \
+  gnc-csv-gnumeric-popup.h \
+  gnc-dummy-tokenizer.hpp \
+  gnc-fw-tokenizer.hpp \
+  gnc-tokenizer.hpp \
+  gnc-tx-import.hpp \
+  gnc-trans-props.hpp \
+  gnc-csv-trans-settings.hpp
+
+libgncmod_csv_import_la_LDFLAGS = -avoid-version
+
+libgncmod_csv_import_la_LIBADD = \
+  ${top_builddir}/gnucash/import-export/libgncmod-generic-import.la \
+  ${top_builddir}/gnucash/gnome-utils/libgncmod-gnome-utils.la \
+  ${top_builddir}/libgnucash/app-utils/libgncmod-app-utils.la \
+  ${top_builddir}/libgnucash/engine/libgncmod-engine.la \
+  ${top_builddir}/libgnucash/core-utils/libgnc-core-utils.la \
+  ${top_builddir}/libgnucash/gnc-module/libgnc-module.la \
+  ${top_builddir}/lib/goffice/libgnc-goffice.la \
+  ${top_builddir}/lib/libc/libc-missing.la \
+  ${GLIB_LIBS} \
+  ${GTK_LIBS} \
+  ${ICU4C_I18N_LIBS} \
+  ${BOOST_LDFLAGS} \
+  -lboost_regex \
+  -lboost_locale
+
+AM_CPPFLAGS = \
+  -I${top_srcdir}/common \
+  -I${top_srcdir}/libgnucash/core-utils \
+  -I${top_srcdir}/libgnucash/engine \
+  -I${top_srcdir}/libgnucash/gnc-module \
+  -I${top_srcdir}/libgnucash/app-utils \
+  -I${top_srcdir}/gnucash/gnome \
+  -I${top_srcdir}/gnucash/gnome-utils \
+  -I${top_srcdir}/gnucash/import-export \
+  -I${top_srcdir}/lib/libc \
+  -I${top_srcdir}/lib/goffice \
+  -I${top_srcdir}/lib \
+  ${GUILE_CFLAGS} \
+  ${GLIB_CFLAGS} \
+  ${GTK_CFLAGS} \
+  ${ICU4C_I18N_CFLAGS} \
+  ${BOOST_CPPFLAGS}
+
+uidir = $(GNC_UI_DIR)
+ui_DATA = \
+	gnc-plugin-csv-import-ui.xml
+
+gtkbuilderdir = ${GNC_GTKBUILDER_DIR}
+gtkbuilder_DATA = \
+	assistant-csv-account-import.glade \
+	assistant-csv-trans-import.glade
+
+EXTRA_DIST = $(ui_DATA) $(gtkbuilder_DATA) CMakeLists.txt
+
+AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.import.csv\"
diff --git a/src/import-export/csv-imp/assistant-csv-account-import.c b/gnucash/import-export/csv-imp/assistant-csv-account-import.c
similarity index 100%
rename from src/import-export/csv-imp/assistant-csv-account-import.c
rename to gnucash/import-export/csv-imp/assistant-csv-account-import.c
diff --git a/src/import-export/csv-imp/assistant-csv-account-import.glade b/gnucash/import-export/csv-imp/assistant-csv-account-import.glade
similarity index 100%
rename from src/import-export/csv-imp/assistant-csv-account-import.glade
rename to gnucash/import-export/csv-imp/assistant-csv-account-import.glade
diff --git a/src/import-export/csv-imp/assistant-csv-account-import.h b/gnucash/import-export/csv-imp/assistant-csv-account-import.h
similarity index 100%
rename from src/import-export/csv-imp/assistant-csv-account-import.h
rename to gnucash/import-export/csv-imp/assistant-csv-account-import.h
diff --git a/src/import-export/csv-imp/assistant-csv-trans-import.cpp b/gnucash/import-export/csv-imp/assistant-csv-trans-import.cpp
similarity index 100%
rename from src/import-export/csv-imp/assistant-csv-trans-import.cpp
rename to gnucash/import-export/csv-imp/assistant-csv-trans-import.cpp
diff --git a/src/import-export/csv-imp/assistant-csv-trans-import.glade b/gnucash/import-export/csv-imp/assistant-csv-trans-import.glade
similarity index 100%
rename from src/import-export/csv-imp/assistant-csv-trans-import.glade
rename to gnucash/import-export/csv-imp/assistant-csv-trans-import.glade
diff --git a/src/import-export/csv-imp/assistant-csv-trans-import.h b/gnucash/import-export/csv-imp/assistant-csv-trans-import.h
similarity index 100%
rename from src/import-export/csv-imp/assistant-csv-trans-import.h
rename to gnucash/import-export/csv-imp/assistant-csv-trans-import.h
diff --git a/src/import-export/csv-imp/csv-account-import.c b/gnucash/import-export/csv-imp/csv-account-import.c
similarity index 100%
rename from src/import-export/csv-imp/csv-account-import.c
rename to gnucash/import-export/csv-imp/csv-account-import.c
diff --git a/src/import-export/csv-imp/csv-account-import.h b/gnucash/import-export/csv-imp/csv-account-import.h
similarity index 100%
rename from src/import-export/csv-imp/csv-account-import.h
rename to gnucash/import-export/csv-imp/csv-account-import.h
diff --git a/src/import-export/csv-imp/gnc-csv-account-map.c b/gnucash/import-export/csv-imp/gnc-csv-account-map.c
similarity index 100%
rename from src/import-export/csv-imp/gnc-csv-account-map.c
rename to gnucash/import-export/csv-imp/gnc-csv-account-map.c
diff --git a/src/import-export/csv-imp/gnc-csv-account-map.h b/gnucash/import-export/csv-imp/gnc-csv-account-map.h
similarity index 100%
rename from src/import-export/csv-imp/gnc-csv-account-map.h
rename to gnucash/import-export/csv-imp/gnc-csv-account-map.h
diff --git a/src/import-export/csv-imp/gnc-csv-gnumeric-popup.c b/gnucash/import-export/csv-imp/gnc-csv-gnumeric-popup.c
similarity index 100%
rename from src/import-export/csv-imp/gnc-csv-gnumeric-popup.c
rename to gnucash/import-export/csv-imp/gnc-csv-gnumeric-popup.c
diff --git a/src/import-export/csv-imp/gnc-csv-gnumeric-popup.h b/gnucash/import-export/csv-imp/gnc-csv-gnumeric-popup.h
similarity index 100%
rename from src/import-export/csv-imp/gnc-csv-gnumeric-popup.h
rename to gnucash/import-export/csv-imp/gnc-csv-gnumeric-popup.h
diff --git a/src/import-export/csv-imp/gnc-csv-tokenizer.cpp b/gnucash/import-export/csv-imp/gnc-csv-tokenizer.cpp
similarity index 100%
rename from src/import-export/csv-imp/gnc-csv-tokenizer.cpp
rename to gnucash/import-export/csv-imp/gnc-csv-tokenizer.cpp
diff --git a/src/import-export/csv-imp/gnc-csv-tokenizer.hpp b/gnucash/import-export/csv-imp/gnc-csv-tokenizer.hpp
similarity index 100%
rename from src/import-export/csv-imp/gnc-csv-tokenizer.hpp
rename to gnucash/import-export/csv-imp/gnc-csv-tokenizer.hpp
diff --git a/src/import-export/csv-imp/gnc-csv-trans-settings.cpp b/gnucash/import-export/csv-imp/gnc-csv-trans-settings.cpp
similarity index 100%
rename from src/import-export/csv-imp/gnc-csv-trans-settings.cpp
rename to gnucash/import-export/csv-imp/gnc-csv-trans-settings.cpp
diff --git a/src/import-export/csv-imp/gnc-csv-trans-settings.hpp b/gnucash/import-export/csv-imp/gnc-csv-trans-settings.hpp
similarity index 100%
rename from src/import-export/csv-imp/gnc-csv-trans-settings.hpp
rename to gnucash/import-export/csv-imp/gnc-csv-trans-settings.hpp
diff --git a/src/import-export/csv-imp/gnc-dummy-tokenizer.cpp b/gnucash/import-export/csv-imp/gnc-dummy-tokenizer.cpp
similarity index 100%
rename from src/import-export/csv-imp/gnc-dummy-tokenizer.cpp
rename to gnucash/import-export/csv-imp/gnc-dummy-tokenizer.cpp
diff --git a/src/import-export/csv-imp/gnc-dummy-tokenizer.hpp b/gnucash/import-export/csv-imp/gnc-dummy-tokenizer.hpp
similarity index 100%
rename from src/import-export/csv-imp/gnc-dummy-tokenizer.hpp
rename to gnucash/import-export/csv-imp/gnc-dummy-tokenizer.hpp
diff --git a/src/import-export/csv-imp/gnc-fw-tokenizer.cpp b/gnucash/import-export/csv-imp/gnc-fw-tokenizer.cpp
similarity index 100%
rename from src/import-export/csv-imp/gnc-fw-tokenizer.cpp
rename to gnucash/import-export/csv-imp/gnc-fw-tokenizer.cpp
diff --git a/src/import-export/csv-imp/gnc-fw-tokenizer.hpp b/gnucash/import-export/csv-imp/gnc-fw-tokenizer.hpp
similarity index 100%
rename from src/import-export/csv-imp/gnc-fw-tokenizer.hpp
rename to gnucash/import-export/csv-imp/gnc-fw-tokenizer.hpp
diff --git a/src/import-export/csv-imp/gnc-plugin-csv-import-ui.xml b/gnucash/import-export/csv-imp/gnc-plugin-csv-import-ui.xml
similarity index 100%
rename from src/import-export/csv-imp/gnc-plugin-csv-import-ui.xml
rename to gnucash/import-export/csv-imp/gnc-plugin-csv-import-ui.xml
diff --git a/src/import-export/csv-imp/gnc-plugin-csv-import.c b/gnucash/import-export/csv-imp/gnc-plugin-csv-import.c
similarity index 100%
rename from src/import-export/csv-imp/gnc-plugin-csv-import.c
rename to gnucash/import-export/csv-imp/gnc-plugin-csv-import.c
diff --git a/src/import-export/csv-imp/gnc-plugin-csv-import.h b/gnucash/import-export/csv-imp/gnc-plugin-csv-import.h
similarity index 100%
rename from src/import-export/csv-imp/gnc-plugin-csv-import.h
rename to gnucash/import-export/csv-imp/gnc-plugin-csv-import.h
diff --git a/src/import-export/csv-imp/gnc-tokenizer.cpp b/gnucash/import-export/csv-imp/gnc-tokenizer.cpp
similarity index 100%
rename from src/import-export/csv-imp/gnc-tokenizer.cpp
rename to gnucash/import-export/csv-imp/gnc-tokenizer.cpp
diff --git a/src/import-export/csv-imp/gnc-tokenizer.hpp b/gnucash/import-export/csv-imp/gnc-tokenizer.hpp
similarity index 100%
rename from src/import-export/csv-imp/gnc-tokenizer.hpp
rename to gnucash/import-export/csv-imp/gnc-tokenizer.hpp
diff --git a/src/import-export/csv-imp/gnc-trans-props.cpp b/gnucash/import-export/csv-imp/gnc-trans-props.cpp
similarity index 100%
rename from src/import-export/csv-imp/gnc-trans-props.cpp
rename to gnucash/import-export/csv-imp/gnc-trans-props.cpp
diff --git a/src/import-export/csv-imp/gnc-trans-props.hpp b/gnucash/import-export/csv-imp/gnc-trans-props.hpp
similarity index 100%
rename from src/import-export/csv-imp/gnc-trans-props.hpp
rename to gnucash/import-export/csv-imp/gnc-trans-props.hpp
diff --git a/src/import-export/csv-imp/gnc-tx-import.cpp b/gnucash/import-export/csv-imp/gnc-tx-import.cpp
similarity index 100%
rename from src/import-export/csv-imp/gnc-tx-import.cpp
rename to gnucash/import-export/csv-imp/gnc-tx-import.cpp
diff --git a/src/import-export/csv-imp/gnc-tx-import.hpp b/gnucash/import-export/csv-imp/gnc-tx-import.hpp
similarity index 100%
rename from src/import-export/csv-imp/gnc-tx-import.hpp
rename to gnucash/import-export/csv-imp/gnc-tx-import.hpp
diff --git a/src/import-export/csv-imp/gncmod-csv-import.c b/gnucash/import-export/csv-imp/gncmod-csv-import.c
similarity index 100%
rename from src/import-export/csv-imp/gncmod-csv-import.c
rename to gnucash/import-export/csv-imp/gncmod-csv-import.c
diff --git a/src/import-export/csv-imp/gschemas/CMakeLists.txt b/gnucash/import-export/csv-imp/gschemas/CMakeLists.txt
similarity index 100%
rename from src/import-export/csv-imp/gschemas/CMakeLists.txt
rename to gnucash/import-export/csv-imp/gschemas/CMakeLists.txt
diff --git a/src/import-export/csv-imp/gschemas/Makefile.am b/gnucash/import-export/csv-imp/gschemas/Makefile.am
similarity index 100%
rename from src/import-export/csv-imp/gschemas/Makefile.am
rename to gnucash/import-export/csv-imp/gschemas/Makefile.am
diff --git a/src/import-export/csv-imp/gschemas/org.gnucash.dialogs.import.csv.gschema.xml.in.in b/gnucash/import-export/csv-imp/gschemas/org.gnucash.dialogs.import.csv.gschema.xml.in.in
similarity index 100%
rename from src/import-export/csv-imp/gschemas/org.gnucash.dialogs.import.csv.gschema.xml.in.in
rename to gnucash/import-export/csv-imp/gschemas/org.gnucash.dialogs.import.csv.gschema.xml.in.in
diff --git a/gnucash/import-export/csv-imp/test/CMakeLists.txt b/gnucash/import-export/csv-imp/test/CMakeLists.txt
new file mode 100644
index 0000000..6fc282d
--- /dev/null
+++ b/gnucash/import-export/csv-imp/test/CMakeLists.txt
@@ -0,0 +1,37 @@
+
+SET(CSV_IMP_TEST_INCLUDE_DIRS
+  ${CMAKE_BINARY_DIR}/common # for config.h
+  ${CMAKE_SOURCE_DIR}/common
+  ${CMAKE_SOURCE_DIR}/libgnucash/engine
+  ${CMAKE_SOURCE_DIR}/common/test-core
+  ${CMAKE_SOURCE_DIR}/lib
+  ${GLIB2_INCLUDE_DIRS}
+)
+SET(CSV_IMP_TEST_LIBS gncmod-csv-import gncmod-engine test-core)
+
+# This test does not run in Win32
+IF (NOT WIN32)
+  SET(MODULEPATH ${CMAKE_SOURCE_DIR}/gnucash/import-export/csv-imp)
+  SET(gtest_csv_imp_LIBS gncmod-csv-import ${GLIB2_LDFLAGS} ${GTEST_LIB})
+  SET(gtest_csv_imp_INCLUDES
+    ${MODULEPATH}
+    ${CSV_IMP_TEST_INCLUDE_DIRS}
+    ${GTEST_INCLUDE_DIR})
+
+  SET(test_tokenizer_SOURCES
+    test-tokenizer.cpp
+    ${GTEST_SRC})
+  GNC_ADD_TEST(test-tokenizer "${test_tokenizer_SOURCES}"
+    gtest_csv_imp_INCLUDES gtest_csv_imp_LIBS
+    SRCDIR=${CMAKE_SOURCE_DIR}/gnucash/import-export/csv-imp/test)
+
+  SET(test_tx_import_SOURCES
+    test-tx-import.cpp
+    ${GTEST_SRC})
+  GNC_ADD_TEST(test-tx_import "${test_tx_import_SOURCES}"
+    gtest_csv_imp_INCLUDES gtest_csv_imp_LIBS)
+ENDIF()
+
+SET_DIST_LIST(test_csv_import_DIST CMakeLists.txt Makefile.am
+    test-tx-import.cpp test-tokenizer.cpp
+    sample1.csv ${test_csv_imp_SOURCES})
diff --git a/gnucash/import-export/csv-imp/test/Makefile.am b/gnucash/import-export/csv-imp/test/Makefile.am
new file mode 100644
index 0000000..7fd0e80
--- /dev/null
+++ b/gnucash/import-export/csv-imp/test/Makefile.am
@@ -0,0 +1,118 @@
+# A template Makefile.am for GLib g_test-based test directories.
+# Copyright 2011 John Ralls <jralls at ceridwen.us>
+
+include $(top_srcdir)/test-templates/Makefile.decl
+
+
+#You will only need one of these: It points to the module directory
+#after $(top_srcdir) or ${top_builddir}:
+MODULEPATH = gnucash/import-export/csv-imp
+
+#The test program. You'll need to add to this if you have more than one module above.
+
+check_PROGRAMS = test-tokenizer \
+                 test-tx-import
+
+TESTS = ${check_PROGRAMS}
+
+#Program files for tests go here. It's probably best to have one for
+#each file in the parent directory. Include
+#test_foo_support.c if you have one and aren't building the
+#support library.
+test_tokenizer_SOURCES = \
+    test-tokenizer.cpp
+
+test_tx_import_SOURCES = \
+    test-tx-import.cpp
+
+if !GOOGLE_TEST_LIBS
+nodist_test_tokenizer_SOURCES = \
+        ${GTEST_SRC}/src/gtest_main.cc
+
+nodist_test_tx_import_SOURCES = \
+        ${GTEST_SRC}/src/gtest_main.cc
+endif
+
+IMP_TEST_CPPFLAGS =  \
+	${DEFAULT_INCLUDES} \
+	-I$(top_srcdir)/${MODULEPATH}/ \
+  -I${top_srcdir}/common/test-core \
+  -I${top_srcdir}/common \
+  -I${top_srcdir}/gnucash/import-export \
+  -I${top_srcdir}/gnucash/gnome \
+  -I${top_srcdir}/gnucash/register/ledger-core \
+  -I${top_srcdir}/gnucash/register/register-gnome \
+  -I${top_srcdir}/gnucash/register/register-core \
+  -I${top_srcdir}/gnucash/gnome-utils \
+  -I${top_srcdir}/libgnucash/app-utils \
+  -I${top_srcdir}/libgnucash/engine \
+  -I${top_srcdir}/libgnucash/core-utils \
+  -I${top_srcdir}/libgnucash/gnc-module \
+  -I${top_srcdir}/lib/libc \
+  -I${top_srcdir}/lib \
+  ${GTK_CFLAGS} \
+  ${GLIB_CFLAGS} \
+  $(BOOST_CPPFLAGS)
+
+test_tokenizer_CPPFLAGS = \
+  -I$(GTEST_HEADERS) \
+  $(IMP_TEST_CPPFLAGS)
+
+test_tx_import_CPPFLAGS = \
+  -I$(GTEST_HEADERS) \
+  $(IMP_TEST_CPPFLAGS)
+
+#The tests might require more libraries, but try to keep them
+#as independent as possible.
+IMP_TEST_LDFLAGS = \
+  ${top_builddir}/${MODULEPATH}/libgncmod-csv-import.la \
+  ${top_builddir}/gnucash/import-export/libgncmod-generic-import.la \
+  ${top_builddir}/gnucash/gnome/libgnc-gnome.la \
+  ${top_builddir}/gnucash/gnome-utils/libgncmod-gnome-utils.la \
+  ${top_builddir}/gnucash/register/ledger-core/libgncmod-ledger-core.la \
+  ${top_builddir}/gnucash/report/report-gnome/libgncmod-report-gnome.la \
+  ${top_builddir}/libgnucash/app-utils/libgncmod-app-utils.la \
+  ${top_builddir}/libgnucash/backend/xml/libgnc-backend-xml-utils.la \
+  ${top_builddir}/libgnucash/engine/libgncmod-engine.la \
+  ${top_builddir}/libgnucash/core-utils/libgnc-core-utils.la \
+  ${top_builddir}/libgnucash/gnc-module/libgnc-module.la \
+  ${GLIB_LIBS} \
+  $(BOOST_LDFLAGS)
+
+test_tokenizer_LDADD = \
+  ${IMP_TEST_LDFLAGS} \
+  $(GTEST_LIBS)
+
+test_tx_import_LDADD = \
+  ${IMP_TEST_LDFLAGS} \
+  $(GTEST_LIBS)
+
+GNC_TEST_DEPS = \
+--library-dir    ${top_builddir}/${MODULEPATH} \
+--library-dir    ${top_builddir}/gnucash/import-export \
+--library-dir    ${top_builddir}/gnucash/gnome \
+--library-dir    ${top_builddir}/gnucash/gnome-utils \
+--library-dir    ${top_builddir}/gnucash/gnome-search \
+--library-dir    ${top_builddir}/gnucash/register/ledger-core \
+--library-dir    ${top_builddir}/gnucash/register/register-core \
+--library-dir    ${top_builddir}/gnucash/register/register-gnome \
+--library-dir    ${top_builddir}/gnucash/report/report-system \
+--library-dir    ${top_builddir}/gnucash/report/report-gnome \
+--library-dir    ${top_builddir}/gnucash/html \
+--library-dir    ${top_builddir}/libgnucash/app-utils \
+--library-dir    ${top_builddir}/libgnucash/backend/xml \
+--library-dir    ${top_builddir}/libgnucash/engine \
+--library-dir    ${top_builddir}/libgnucash/core-utils \
+--library-dir    ${top_builddir}/libgnucash/gnc-module
+
+TESTS_ENVIRONMENT = \
+  SRCDIR=${srcdir} \
+  G_DEBUG= \
+  $(shell ${abs_top_srcdir}/common/gnc-test-env.pl --noexports ${GNC_TEST_DEPS})
+
+EXTRA_DIST += \
+  sample1.csv \
+  CMakeLists.txt
+
+
+AM_CPPFLAGS = -DG_LOG_DOMAIN=\"gnc.import.csv\"
diff --git a/src/import-export/csv-imp/test/sample1.csv b/gnucash/import-export/csv-imp/test/sample1.csv
similarity index 100%
rename from src/import-export/csv-imp/test/sample1.csv
rename to gnucash/import-export/csv-imp/test/sample1.csv
diff --git a/src/import-export/csv-imp/test/test-tokenizer.cpp b/gnucash/import-export/csv-imp/test/test-tokenizer.cpp
similarity index 100%
rename from src/import-export/csv-imp/test/test-tokenizer.cpp
rename to gnucash/import-export/csv-imp/test/test-tokenizer.cpp
diff --git a/src/import-export/csv-imp/test/test-tx-import.cpp b/gnucash/import-export/csv-imp/test/test-tx-import.cpp
similarity index 100%
rename from src/import-export/csv-imp/test/test-tx-import.cpp
rename to gnucash/import-export/csv-imp/test/test-tx-import.cpp
diff --git a/src/import-export/dialog-import.glade b/gnucash/import-export/dialog-import.glade
similarity index 100%
rename from src/import-export/dialog-import.glade
rename to gnucash/import-export/dialog-import.glade
diff --git a/src/import-export/generic-import-design.txt b/gnucash/import-export/generic-import-design.txt
similarity index 100%
rename from src/import-export/generic-import-design.txt
rename to gnucash/import-export/generic-import-design.txt
diff --git a/src/import-export/gncmod-generic-import.c b/gnucash/import-export/gncmod-generic-import.c
similarity index 100%
rename from src/import-export/gncmod-generic-import.c
rename to gnucash/import-export/gncmod-generic-import.c
diff --git a/src/import-export/gschemas/CMakeLists.txt b/gnucash/import-export/gschemas/CMakeLists.txt
similarity index 100%
rename from src/import-export/gschemas/CMakeLists.txt
rename to gnucash/import-export/gschemas/CMakeLists.txt
diff --git a/src/import-export/gschemas/Makefile.am b/gnucash/import-export/gschemas/Makefile.am
similarity index 100%
rename from src/import-export/gschemas/Makefile.am
rename to gnucash/import-export/gschemas/Makefile.am
diff --git a/src/import-export/gschemas/org.gnucash.dialogs.import.generic.gschema.xml.in.in b/gnucash/import-export/gschemas/org.gnucash.dialogs.import.generic.gschema.xml.in.in
similarity index 100%
rename from src/import-export/gschemas/org.gnucash.dialogs.import.generic.gschema.xml.in.in
rename to gnucash/import-export/gschemas/org.gnucash.dialogs.import.generic.gschema.xml.in.in
diff --git a/src/import-export/import-account-matcher.c b/gnucash/import-export/import-account-matcher.c
similarity index 100%
rename from src/import-export/import-account-matcher.c
rename to gnucash/import-export/import-account-matcher.c
diff --git a/src/import-export/import-account-matcher.h b/gnucash/import-export/import-account-matcher.h
similarity index 100%
rename from src/import-export/import-account-matcher.h
rename to gnucash/import-export/import-account-matcher.h
diff --git a/src/import-export/import-backend.c b/gnucash/import-export/import-backend.c
similarity index 100%
rename from src/import-export/import-backend.c
rename to gnucash/import-export/import-backend.c
diff --git a/src/import-export/import-backend.h b/gnucash/import-export/import-backend.h
similarity index 100%
rename from src/import-export/import-backend.h
rename to gnucash/import-export/import-backend.h
diff --git a/src/import-export/import-commodity-matcher.c b/gnucash/import-export/import-commodity-matcher.c
similarity index 100%
rename from src/import-export/import-commodity-matcher.c
rename to gnucash/import-export/import-commodity-matcher.c
diff --git a/src/import-export/import-commodity-matcher.h b/gnucash/import-export/import-commodity-matcher.h
similarity index 100%
rename from src/import-export/import-commodity-matcher.h
rename to gnucash/import-export/import-commodity-matcher.h
diff --git a/src/import-export/import-format-dialog.c b/gnucash/import-export/import-format-dialog.c
similarity index 100%
rename from src/import-export/import-format-dialog.c
rename to gnucash/import-export/import-format-dialog.c
diff --git a/gnucash/import-export/import-main-matcher.c b/gnucash/import-export/import-main-matcher.c
new file mode 100644
index 0000000..cfbaa5a
--- /dev/null
+++ b/gnucash/import-export/import-main-matcher.c
@@ -0,0 +1,916 @@
+/********************************************************************\
+ * import-main-matcher.c - Transaction matcher main window          *
+ *                                                                  *
+ * Copyright (C) 2002 Benoit Grégoire <bock at step.polymtl.ca>        *
+ * Copyright (C) 2002 Christian Stimming                            *
+ * Copyright (c) 2006 David Hampton <hampton at employees.org>         *
+ * Copyright (C) 2012 Robert Fewell                                 *
+ *                                                                  *
+ * 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 at gnu.org                   *
+\********************************************************************/
+/** @addtogroup Import_Export
+    @{ */
+/** @internal
+    @file import-main-matcher.c
+    @brief Transaction matcher main window
+    @author Copyright (C) 2002 Benoit Grégoire
+    @author Christian Stimming
+    @author Copyright (c) 2006 David Hampton <hampton at employees.org>
+*/
+#include "config.h"
+
+#include <gtk/gtk.h>
+#include <glib/gi18n.h>
+
+#include "import-main-matcher.h"
+
+#include "dialog-utils.h"
+#include "gnc-ui.h"
+#include "gnc-ui-util.h"
+#include "gnc-engine.h"
+#include "import-settings.h"
+#include "import-match-picker.h"
+#include "import-backend.h"
+#include "import-account-matcher.h"
+#include "import-pending-matches.h"
+#include "gnc-component-manager.h"
+#include "guid.h"
+
+#define GNC_PREFS_GROUP "dialogs.import.generic.transaction-list"
+
+struct _main_matcher_info
+{
+    GtkWidget *dialog;
+    GtkWidget *assistant;
+    GtkTreeView *view;
+    GNCImportSettings *user_settings;
+    int selected_row;
+    GNCTransactionProcessedCB transaction_processed_cb;
+    gpointer user_data;
+    GNCImportPendingMatches *pending_matches;
+};
+
+enum downloaded_cols
+{
+    DOWNLOADED_COL_DATE = 0,
+    DOWNLOADED_COL_ACCOUNT,
+    DOWNLOADED_COL_AMOUNT,
+    DOWNLOADED_COL_DESCRIPTION,
+    DOWNLOADED_COL_MEMO,
+    DOWNLOADED_COL_ACTION_ADD,
+    DOWNLOADED_COL_ACTION_CLEAR,
+    DOWNLOADED_COL_ACTION_UPDATE,
+    DOWNLOADED_COL_ACTION_INFO,
+    DOWNLOADED_COL_ACTION_PIXBUF,
+    DOWNLOADED_COL_DATA,
+    DOWNLOADED_COL_COLOR,
+    NUM_DOWNLOADED_COLS
+};
+
+#define COLOR_RED    "brown1"
+#define COLOR_YELLOW "gold"
+#define COLOR_GREEN  "DarkSeaGreen1"
+
+static QofLogModule log_module = GNC_MOD_IMPORT;
+
+void on_matcher_ok_clicked (GtkButton *button, GNCImportMainMatcher *info);
+void on_matcher_cancel_clicked (GtkButton *button, gpointer user_data);
+void on_matcher_help_clicked (GtkButton *button, gpointer user_data);
+void on_matcher_help_close_clicked (GtkButton *button, gpointer user_data);
+
+/* Local prototypes */
+static void
+refresh_model_row(GNCImportMainMatcher *gui, GtkTreeModel *model,
+                  GtkTreeIter *iter, GNCImportTransInfo *info);
+
+void gnc_gen_trans_list_delete (GNCImportMainMatcher *info)
+{
+    GtkTreeModel *model;
+    GtkTreeIter iter;
+    GNCImportTransInfo *trans_info;
+
+    if (info == NULL)
+        return;
+
+    model = gtk_tree_view_get_model(info->view);
+    if (gtk_tree_model_get_iter_first(model, &iter))
+    {
+        do
+        {
+            gtk_tree_model_get(model, &iter,
+                               DOWNLOADED_COL_DATA, &trans_info,
+                               -1);
+
+            if (info->transaction_processed_cb)
+            {
+                info->transaction_processed_cb(trans_info,
+                                               FALSE,
+                                               info->user_data);
+            }
+
+            gnc_import_TransInfo_delete(trans_info);
+        }
+        while (gtk_tree_model_iter_next (model, &iter));
+    }
+
+
+    if (!(info->dialog == NULL))
+    {
+        gnc_save_window_size(GNC_PREFS_GROUP, GTK_WINDOW(info->dialog));
+        gnc_import_Settings_delete (info->user_settings);
+        gtk_widget_destroy (GTK_WIDGET (info->dialog));
+    }
+    else
+        gnc_import_Settings_delete (info->user_settings);
+    g_free (info);
+}
+
+void
+on_matcher_ok_clicked (GtkButton *button,
+                       GNCImportMainMatcher *info)
+{
+    GtkTreeModel *model;
+    GtkTreeIter iter;
+    GNCImportTransInfo *trans_info;
+
+    g_assert (info);
+
+    /*   DEBUG ("Begin") */
+
+    model = gtk_tree_view_get_model(info->view);
+    if (!gtk_tree_model_get_iter_first(model, &iter))
+        return;
+
+    /* Don't run any queries and/or split sorts while processing the matcher
+    results. */
+    gnc_suspend_gui_refresh();
+
+    do
+    {
+        gtk_tree_model_get(model, &iter,
+                           DOWNLOADED_COL_DATA, &trans_info,
+                           -1);
+
+        if (gnc_import_process_trans_item(NULL, trans_info))
+        {
+            if (info->transaction_processed_cb)
+            {
+                info->transaction_processed_cb(trans_info,
+                                               TRUE,
+                                               info->user_data);
+            }
+        }
+    }
+    while (gtk_tree_model_iter_next (model, &iter));
+
+    /* Allow GUI refresh again. */
+    gnc_resume_gui_refresh();
+
+    gnc_gen_trans_list_delete (info);
+    /* DEBUG ("End") */
+}
+
+void
+on_matcher_cancel_clicked (GtkButton *button, gpointer user_data)
+{
+    GNCImportMainMatcher *info = user_data;
+    gnc_gen_trans_list_delete (info);
+}
+
+void
+on_matcher_help_close_clicked (GtkButton *button, gpointer user_data)
+{
+    GtkWidget *help_dialog = user_data;
+
+    gtk_widget_destroy(help_dialog);
+}
+
+void
+on_matcher_help_clicked (GtkButton *button, gpointer user_data)
+{
+    GNCImportMainMatcher *info = user_data;
+    GtkBuilder *builder;
+    GtkWidget *help_dialog, *box;
+
+    builder = gtk_builder_new();
+    gnc_builder_add_from_file (builder, "dialog-import.glade", "textbuffer2");
+    gnc_builder_add_from_file (builder, "dialog-import.glade", "textbuffer3");
+    gnc_builder_add_from_file (builder, "dialog-import.glade", "textbuffer4");
+    gnc_builder_add_from_file (builder, "dialog-import.glade", "textbuffer5");
+    gnc_builder_add_from_file (builder, "dialog-import.glade", "matcher_help_dialog");
+
+    box = GTK_WIDGET(gtk_builder_get_object (builder, "red"));
+    gnc_widget_set_style_context (GTK_WIDGET(box), "color_back_red");
+
+    box = GTK_WIDGET(gtk_builder_get_object (builder, "yellow"));
+    gnc_widget_set_style_context (GTK_WIDGET(box), "color_back_yellow");
+
+    box = GTK_WIDGET(gtk_builder_get_object (builder, "green"));
+    gnc_widget_set_style_context (GTK_WIDGET(box), "color_back_green");
+
+    help_dialog = GTK_WIDGET(gtk_builder_get_object (builder, "matcher_help_dialog"));
+    gtk_window_set_transient_for(GTK_WINDOW(help_dialog),
+                                 GTK_WINDOW(info->dialog));
+
+    /* Connect the signals */
+    gtk_builder_connect_signals_full (builder, gnc_builder_connect_full_func, help_dialog);
+
+    g_object_unref(G_OBJECT(builder));
+
+    gtk_widget_show(help_dialog);
+}
+
+static void
+run_account_picker_dialog (GNCImportMainMatcher *info,
+                           GtkTreeModel *model,
+                           GtkTreeIter *iter,
+                           GNCImportTransInfo *trans_info)
+{
+    Account *old_acc, *new_acc;
+    gboolean ok_pressed;
+    g_assert (trans_info);
+    old_acc = gnc_import_TransInfo_get_destacc (trans_info);
+    new_acc = gnc_import_select_account(info->dialog,
+                                        NULL,
+                                        TRUE,
+                                        _("Destination account for the auto-balance split."),
+                                        xaccTransGetCurrency(gnc_import_TransInfo_get_trans(trans_info)),
+                                        ACCT_TYPE_NONE,
+                                        old_acc,
+                                        &ok_pressed);
+    if (ok_pressed)
+        gnc_import_TransInfo_set_destacc (trans_info, new_acc, TRUE);
+}
+
+static void
+run_match_dialog (GNCImportMainMatcher *info,
+                  GNCImportTransInfo *trans_info)
+{
+    gnc_import_match_picker_run_and_close (trans_info, info->pending_matches);
+}
+
+static void
+gnc_gen_trans_add_toggled_cb (GtkCellRendererToggle *cell_renderer,
+                              gchar                 *path,
+                              GNCImportMainMatcher  *gui)
+{
+    GtkTreeModel *model;
+    GtkTreeIter iter;
+    GNCImportTransInfo *trans_info;
+
+    model = gtk_tree_view_get_model(gui->view);
+    if (!gtk_tree_model_get_iter_from_string(model, &iter, path))
+        return;
+    gtk_tree_model_get(model, &iter, DOWNLOADED_COL_DATA, &trans_info, -1);
+
+    if ( gnc_import_TransInfo_get_action(trans_info) == GNCImport_ADD
+            && gnc_import_Settings_get_action_skip_enabled (gui->user_settings) == TRUE)
+    {
+        gnc_import_TransInfo_set_action(trans_info, GNCImport_SKIP);
+    }
+    else
+    {
+        gnc_import_TransInfo_set_action(trans_info, GNCImport_ADD);
+    }
+    refresh_model_row(gui, model, &iter, trans_info);
+}
+
+static void
+gnc_gen_trans_clear_toggled_cb (GtkCellRendererToggle *cell_renderer,
+                                gchar                 *path,
+                                GNCImportMainMatcher  *gui)
+{
+    GtkTreeModel *model;
+    GtkTreeIter iter;
+    GNCImportTransInfo *trans_info;
+
+    model = gtk_tree_view_get_model(gui->view);
+    if (!gtk_tree_model_get_iter_from_string(model, &iter, path))
+        return;
+    gtk_tree_model_get(model, &iter, DOWNLOADED_COL_DATA, &trans_info, -1);
+
+    if ( gnc_import_TransInfo_get_action(trans_info) == GNCImport_CLEAR
+            && gnc_import_Settings_get_action_skip_enabled (gui->user_settings) == TRUE)
+    {
+        gnc_import_TransInfo_set_action(trans_info, GNCImport_SKIP);
+    }
+    else
+    {
+        gnc_import_TransInfo_set_action(trans_info, GNCImport_CLEAR);
+    }
+    refresh_model_row(gui, model, &iter, trans_info);
+}
+
+static void
+gnc_gen_trans_update_toggled_cb (GtkCellRendererToggle *cell_renderer,
+                                 gchar                 *path,
+                                 GNCImportMainMatcher  *gui)
+{
+    GtkTreeModel *model;
+    GtkTreeIter iter;
+    GNCImportTransInfo *trans_info;
+
+    model = gtk_tree_view_get_model(gui->view);
+    if (!gtk_tree_model_get_iter_from_string(model, &iter, path))
+        return;
+    gtk_tree_model_get(model, &iter, DOWNLOADED_COL_DATA, &trans_info, -1);
+
+    if ( gnc_import_TransInfo_get_action(trans_info) == GNCImport_UPDATE
+            && gnc_import_Settings_get_action_skip_enabled (gui->user_settings) == TRUE)
+    {
+        gnc_import_TransInfo_set_action(trans_info, GNCImport_SKIP);
+    }
+    else
+    {
+        gnc_import_TransInfo_set_action(trans_info, GNCImport_UPDATE);
+    }
+    refresh_model_row(gui, model, &iter, trans_info);
+}
+
+static void
+gnc_gen_trans_row_activated_cb (GtkTreeView           *view,
+                                GtkTreePath           *path,
+                                GtkTreeViewColumn     *column,
+                                GNCImportMainMatcher  *gui)
+{
+    GtkTreeModel *model;
+    GtkTreeIter iter;
+    GNCImportTransInfo *trans_info;
+
+    model = gtk_tree_view_get_model(gui->view);
+    if (!gtk_tree_model_get_iter(model, &iter, path))
+        return;
+    gtk_tree_model_get(model, &iter, DOWNLOADED_COL_DATA, &trans_info, -1);
+
+    switch (gnc_import_TransInfo_get_action (trans_info))
+    {
+    case GNCImport_ADD:
+        if (gnc_import_TransInfo_is_balanced(trans_info) == FALSE)
+        {
+            run_account_picker_dialog (gui, model, &iter, trans_info);
+        }
+        break;
+    case GNCImport_CLEAR:
+    case GNCImport_UPDATE:
+        run_match_dialog (gui, trans_info);
+        break;
+    case GNCImport_SKIP:
+        /*The information displayed is only informative, until you select an action*/
+        break;
+    default:
+        PERR("I don't know what to do! (Yet...)");
+        break;
+    }
+    refresh_model_row(gui, model, &iter, trans_info);
+}
+
+static void
+gnc_gen_trans_row_changed_cb (GtkTreeSelection *selection,
+                              GNCImportMainMatcher *gui)
+{
+    GtkTreeModel *model;
+    GtkTreeIter iter;
+
+    if (!gtk_tree_selection_get_selected(selection, &model, &iter))
+        return;
+    gtk_tree_selection_unselect_iter(selection, &iter);
+}
+
+static GtkTreeViewColumn *
+add_text_column(GtkTreeView *view, const gchar *title, int col_num)
+{
+    GtkCellRenderer *renderer;
+    GtkTreeViewColumn *column;
+
+    renderer = gtk_cell_renderer_text_new();
+    g_object_set(G_OBJECT(renderer),
+                 "foreground", "black",
+                 "foreground-set", TRUE,
+                 NULL);
+    column = gtk_tree_view_column_new_with_attributes
+             (title, renderer,
+              "text", col_num,
+              "background", DOWNLOADED_COL_COLOR,
+              NULL);
+    gtk_tree_view_column_set_sort_column_id(column, col_num);
+    g_object_set(G_OBJECT(column),
+                 "reorderable", TRUE,
+                 "resizable", TRUE,
+                 NULL);
+    gtk_tree_view_append_column(view, column);
+    return column;
+}
+
+static GtkTreeViewColumn *
+add_toggle_column(GtkTreeView *view, const gchar *title, int col_num,
+                  GCallback cb_fn, gpointer cb_arg)
+{
+    GtkCellRenderer *renderer;
+    GtkTreeViewColumn *column;
+
+    renderer = gtk_cell_renderer_toggle_new();
+    column = gtk_tree_view_column_new_with_attributes
+             (title, renderer,
+              "active", col_num,
+              "cell-background", DOWNLOADED_COL_COLOR,
+              NULL);
+    gtk_tree_view_column_set_sort_column_id(column, col_num);
+    g_object_set(G_OBJECT(column),
+                 "reorderable", TRUE,
+                 NULL);
+    g_signal_connect(renderer, "toggled", cb_fn, cb_arg);
+    gtk_tree_view_append_column(view, column);
+    return column;
+}
+
+static void
+gnc_gen_trans_init_view (GNCImportMainMatcher *info,
+                         gboolean show_account,
+                         gboolean show_update)
+{
+    GtkTreeView *view;
+    GtkListStore *store;
+    GtkCellRenderer *renderer;
+    GtkTreeViewColumn *column;
+    GtkTreeSelection *selection;
+
+    view = info->view;
+    store = gtk_list_store_new(NUM_DOWNLOADED_COLS,
+                               G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
+                               G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN,
+                               G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_STRING,
+                               GDK_TYPE_PIXBUF, G_TYPE_POINTER, G_TYPE_STRING);
+    gtk_tree_view_set_model(view, GTK_TREE_MODEL(store));
+    g_object_unref(store);
+
+    /* Add the columns */
+    add_text_column(view, _("Date"), DOWNLOADED_COL_DATE);
+    column = add_text_column(view, _("Account"), DOWNLOADED_COL_ACCOUNT);
+    gtk_tree_view_column_set_visible(column, show_account);
+    add_text_column(view, _("Amount"), DOWNLOADED_COL_AMOUNT);
+    add_text_column(view, _("Description"), DOWNLOADED_COL_DESCRIPTION);
+    add_text_column(view, _("Memo"), DOWNLOADED_COL_MEMO);
+    add_toggle_column(view, _("A"), DOWNLOADED_COL_ACTION_ADD,
+                      G_CALLBACK(gnc_gen_trans_add_toggled_cb), info);
+    column = add_toggle_column(view, _("U+R"), DOWNLOADED_COL_ACTION_UPDATE,
+                               G_CALLBACK(gnc_gen_trans_update_toggled_cb), info);
+    gtk_tree_view_column_set_visible(column, show_update);
+    add_toggle_column(view, _("R"), DOWNLOADED_COL_ACTION_CLEAR,
+                      G_CALLBACK(gnc_gen_trans_clear_toggled_cb), info);
+
+    /* The last column has multiple renderers */
+    renderer = gtk_cell_renderer_pixbuf_new();
+    g_object_set(renderer, "xalign", 0.0, NULL);
+    column = gtk_tree_view_column_new_with_attributes(_("Info"), renderer,
+             "pixbuf", DOWNLOADED_COL_ACTION_PIXBUF,
+             "cell-background", DOWNLOADED_COL_COLOR,
+             NULL);
+    renderer = gtk_cell_renderer_text_new();
+    g_object_set(G_OBJECT(renderer),
+                 "foreground", "black",
+                 "foreground-set", TRUE,
+                 NULL);
+    gtk_tree_view_column_pack_start(column, renderer, TRUE);
+    gtk_tree_view_column_set_attributes(column, renderer,
+                                        "text", DOWNLOADED_COL_ACTION_INFO,
+                                        "background", DOWNLOADED_COL_COLOR,
+                                        NULL);
+    gtk_tree_view_column_set_sort_column_id(column, DOWNLOADED_COL_ACTION_INFO);
+    g_object_set(G_OBJECT(column),
+                 "reorderable", TRUE,
+                 "resizable", TRUE,
+                 NULL);
+    gtk_tree_view_append_column(info->view, column);
+
+
+    selection = gtk_tree_view_get_selection(info->view);
+    g_signal_connect(info->view, "row-activated",
+                     G_CALLBACK(gnc_gen_trans_row_activated_cb), info);
+    g_signal_connect(selection, "changed",
+                     G_CALLBACK(gnc_gen_trans_row_changed_cb), info);
+}
+
+GNCImportMainMatcher *gnc_gen_trans_list_new (GtkWidget *parent,
+        const gchar* heading,
+        gboolean all_from_same_account,
+        gint match_date_hardlimit)
+{
+    GNCImportMainMatcher *info;
+    GtkBuilder *builder;
+    GtkWidget *heading_label;
+    GtkWidget *box, *pbox;
+    gboolean show_update;
+
+    info = g_new0 (GNCImportMainMatcher, 1);
+    info->pending_matches = gnc_import_PendingMatches_new();
+
+    /* Initialize user Settings. */
+    info->user_settings = gnc_import_Settings_new ();
+    gnc_import_Settings_set_match_date_hardlimit (info->user_settings, match_date_hardlimit);
+
+    /* Initialize the GtkDialog. */
+    builder = gtk_builder_new();
+    gnc_builder_add_from_file (builder, "dialog-import.glade", "transaction_matcher_dialog");
+    gnc_builder_add_from_file (builder, "dialog-import.glade", "transaction_matcher_content");
+    info->dialog = GTK_WIDGET(gtk_builder_get_object (builder, "transaction_matcher_dialog"));
+    g_assert (info->dialog != NULL);
+
+    /* Pack the content into the dialog vbox */
+    pbox = GTK_WIDGET(gtk_builder_get_object (builder, "transaction_matcher_vbox"));
+    box = GTK_WIDGET(gtk_builder_get_object (builder, "transaction_matcher_content"));
+    gtk_box_pack_start( GTK_BOX(pbox), box, TRUE, TRUE, 0);
+
+    /* Get the view */
+    info->view = GTK_TREE_VIEW(gtk_builder_get_object (builder, "downloaded_view"));
+    g_assert (info->view != NULL);
+
+    show_update = gnc_import_Settings_get_action_update_enabled(info->user_settings);
+    gnc_gen_trans_init_view(info, all_from_same_account, show_update);
+    heading_label = GTK_WIDGET(gtk_builder_get_object (builder, "heading_label"));
+    g_assert (heading_label != NULL);
+
+    /* if (parent)
+      gtk_window_set_transient_for (GTK_WINDOW (info->dialog),
+    			  GTK_WINDOW (parent));*/
+
+    if (heading)
+        gtk_label_set_text (GTK_LABEL (heading_label), heading);
+
+    gnc_restore_window_size(GNC_PREFS_GROUP, GTK_WINDOW(info->dialog));
+    gtk_widget_show_all (GTK_WIDGET (info->dialog));
+
+    info->transaction_processed_cb = NULL;
+
+    /* Connect the signals */
+    gtk_builder_connect_signals_full (builder, gnc_builder_connect_full_func, info);
+
+    g_object_unref(G_OBJECT(builder));
+
+    return info;
+}
+
+/*****************************************************************
+ *                 Assistant routines Start                      *
+ *****************************************************************/
+
+GNCImportMainMatcher * gnc_gen_trans_assist_new (GtkWidget *parent,
+        const gchar* heading,
+        gboolean all_from_same_account,
+        gint match_date_hardlimit)
+{
+    GNCImportMainMatcher *info;
+    GtkBuilder *builder;
+    GtkWidget *heading_label;
+    GtkWidget *box;
+    gboolean show_update;
+
+    info = g_new0 (GNCImportMainMatcher, 1);
+    info->pending_matches = gnc_import_PendingMatches_new();
+
+    /* Initialize user Settings. */
+    info->user_settings = gnc_import_Settings_new ();
+    gnc_import_Settings_set_match_date_hardlimit (info->user_settings, match_date_hardlimit);
+
+    /* load the interface */
+    builder = gtk_builder_new();
+    gnc_builder_add_from_file (builder, "dialog-import.glade", "transaction_matcher_content");
+    if (builder == NULL)
+    {
+        PERR("Error opening the glade builder interface");
+    }
+    /* Pack content into Assistant page widget */
+    box = GTK_WIDGET(gtk_builder_get_object (builder, "transaction_matcher_content"));
+    gtk_box_pack_start( GTK_BOX(parent), box, TRUE, TRUE, 6);
+
+    /* Get the view */
+    info->view = GTK_TREE_VIEW(gtk_builder_get_object (builder, "downloaded_view"));
+    g_assert (info->view != NULL);
+
+    show_update = gnc_import_Settings_get_action_update_enabled(info->user_settings);
+    gnc_gen_trans_init_view(info, all_from_same_account, show_update);
+    heading_label = GTK_WIDGET(gtk_builder_get_object (builder, "heading_label"));
+    g_assert (heading_label != NULL);
+
+    if (heading)
+        gtk_label_set_text (GTK_LABEL (heading_label), heading);
+
+    info->transaction_processed_cb = NULL;
+
+    /* Connect the signals */
+    gtk_builder_connect_signals_full (builder, gnc_builder_connect_full_func, info);
+
+    g_object_unref(G_OBJECT(builder));
+
+    return info;
+}
+
+void gnc_gen_trans_assist_start (GNCImportMainMatcher *info)
+{
+    on_matcher_ok_clicked (NULL, info);
+}
+
+/*****************************************************************
+ *                   Assistant routines End                      *
+ *****************************************************************/
+
+void gnc_gen_trans_list_add_tp_cb(GNCImportMainMatcher *info,
+                                  GNCTransactionProcessedCB trans_processed_cb,
+                                  gpointer user_data)
+{
+    info->user_data = user_data;
+    info->transaction_processed_cb = trans_processed_cb;
+}
+
+gboolean gnc_gen_trans_list_run (GNCImportMainMatcher *info)
+{
+    gboolean result;
+
+    /* DEBUG("Begin"); */
+    result = gtk_dialog_run (GTK_DIALOG (info->dialog));
+    /* DEBUG("Result was %d", result); */
+
+    /* No destroying here since the dialog was already destroyed through
+       the ok_clicked handlers. */
+
+    return result;
+}
+
+static void
+refresh_model_row (GNCImportMainMatcher *gui,
+                   GtkTreeModel *model,
+                   GtkTreeIter *iter,
+                   GNCImportTransInfo *info)
+{
+    GtkListStore *store;
+    GtkTreeSelection *selection;
+    gchar *tmp, *imbalance, *text, *color;
+    const gchar *ro_text;
+    Split *split;
+    g_assert (gui);
+    g_assert (model);
+    g_assert (info);
+    /*DEBUG("Begin");*/
+
+    store = GTK_LIST_STORE(model);
+    gtk_list_store_set(store, iter, DOWNLOADED_COL_DATA, info, -1);
+
+    /*Account:*/
+    split = gnc_import_TransInfo_get_fsplit (info);
+    g_assert(split); // Must not be NULL
+    ro_text = xaccAccountGetName(xaccSplitGetAccount(split));
+    gtk_list_store_set(store, iter, DOWNLOADED_COL_ACCOUNT, ro_text, -1);
+
+    /*Date*/
+    text = qof_print_date ( xaccTransGetDate( gnc_import_TransInfo_get_trans(info) ) );
+    gtk_list_store_set(store, iter, DOWNLOADED_COL_DATE, text, -1);
+    g_free(text);
+
+    /*Amount*/
+    ro_text = xaccPrintAmount
+              (xaccSplitGetAmount (split),
+               gnc_split_amount_print_info(split, TRUE)
+              );
+    gtk_list_store_set(store, iter, DOWNLOADED_COL_AMOUNT, ro_text, -1);
+
+    /*Description*/
+    ro_text = xaccTransGetDescription(gnc_import_TransInfo_get_trans(info) );
+    gtk_list_store_set(store, iter, DOWNLOADED_COL_DESCRIPTION, ro_text, -1);
+
+    /*Memo*/
+    ro_text = xaccSplitGetMemo(split);
+    gtk_list_store_set(store, iter, DOWNLOADED_COL_MEMO, ro_text, -1);
+
+    /*Actions*/
+
+    /* Action information */
+    ro_text = text = color = NULL;
+    switch (gnc_import_TransInfo_get_action(info))
+    {
+    case GNCImport_ADD:
+        if (gnc_import_TransInfo_is_balanced(info) == TRUE)
+        {
+            ro_text = _("New, already balanced");
+            color = COLOR_GREEN;
+        }
+        else
+        {
+            /* Assume that importers won't create transactions in two or more
+               currencies so we can use xaccTransGetImbalanceValue */
+            imbalance =
+                g_strdup
+                (xaccPrintAmount
+                 (gnc_numeric_neg(xaccTransGetImbalanceValue
+                                  (gnc_import_TransInfo_get_trans(info) )),
+                  gnc_commodity_print_info
+                  (xaccTransGetCurrency(gnc_import_TransInfo_get_trans (info)),
+                   TRUE) ));
+            if (gnc_import_TransInfo_get_destacc (info) != NULL)
+            {
+                color = COLOR_GREEN;
+                tmp = gnc_account_get_full_name
+                      (gnc_import_TransInfo_get_destacc (info));
+                if (gnc_import_TransInfo_get_destacc_selected_manually(info)
+                        == TRUE)
+                {
+                    text =
+                        /* Translators: %1$s is the amount to be
+                           transferred. %2$s is the destination account. */
+                        g_strdup_printf(_("New, transfer %s to (manual) \"%s\""),
+                                        imbalance, tmp);
+                }
+                else
+                {
+                    text =
+                        /* Translators: %1$s is the amount to be
+                           transferred. %2$s is the destination account. */
+                        g_strdup_printf(_("New, transfer %s to (auto) \"%s\""),
+                                        imbalance, tmp);
+                }
+                g_free (tmp);
+
+            }
+            else
+            {
+                color = COLOR_YELLOW;
+                text =
+                    /* Translators: %s is the amount to be transferred. */
+                    g_strdup_printf(_("New, UNBALANCED (need acct to transfer %s)!"),
+                                    imbalance);
+            }
+            g_free (imbalance);
+        }
+        break;
+    case GNCImport_CLEAR:
+        if (gnc_import_TransInfo_get_selected_match(info))
+        {
+            color = COLOR_GREEN;
+            if (gnc_import_TransInfo_get_match_selected_manually(info) == TRUE)
+            {
+                ro_text = _("Reconcile (manual) match");
+            }
+            else
+            {
+                ro_text = _("Reconcile (auto) match");
+            }
+        }
+        else
+        {
+            color = COLOR_RED;
+            ro_text = _("Match missing!");
+        }
+        break;
+    case GNCImport_UPDATE:
+        if (gnc_import_TransInfo_get_selected_match(info))
+        {
+            color = COLOR_GREEN;
+            if (gnc_import_TransInfo_get_match_selected_manually(info) == TRUE)
+            {
+                ro_text = _("Update and reconcile (manual) match");
+            }
+            else
+            {
+                ro_text = _("Update and reconcile (auto) match");
+            }
+        }
+        else
+        {
+            color = COLOR_RED;
+            ro_text = _("Match missing!");
+        }
+        break;
+    case GNCImport_SKIP:
+        color = COLOR_RED;
+        ro_text = _("Do not import (no action selected)");
+        break;
+    default:
+        color = "white";
+        ro_text = "WRITEME, this is an unknown action";
+        break;
+    }
+
+    gtk_list_store_set(store, iter,
+                       DOWNLOADED_COL_COLOR, color,
+                       DOWNLOADED_COL_ACTION_INFO, ro_text ? ro_text : text,
+                       -1);
+    if (text)
+        g_free(text);
+
+    /* Set the pixmaps */
+    gtk_list_store_set(store, iter,
+                       DOWNLOADED_COL_ACTION_ADD,
+                       gnc_import_TransInfo_get_action(info) == GNCImport_ADD,
+                       -1);
+    if (gnc_import_TransInfo_get_action(info) == GNCImport_SKIP)
+    {
+        /*Show the best match's confidence pixmap in the info column*/
+        gtk_list_store_set(store, iter,
+                           DOWNLOADED_COL_ACTION_PIXBUF,
+                           gen_probability_pixbuf( gnc_import_MatchInfo_get_probability
+                                   ( gnc_import_TransInfo_get_selected_match (info)),
+                                   gui->user_settings,
+                                   GTK_WIDGET(gui->view)),
+                           -1);
+    }
+
+    gtk_list_store_set(store, iter,
+                       DOWNLOADED_COL_ACTION_CLEAR,
+                       gnc_import_TransInfo_get_action(info) == GNCImport_CLEAR,
+                       -1);
+    if (gnc_import_TransInfo_get_action(info) == GNCImport_CLEAR)
+    {
+        /*Show the best match's confidence pixmap in the info column*/
+        gtk_list_store_set(store, iter,
+                           DOWNLOADED_COL_ACTION_PIXBUF,
+                           gen_probability_pixbuf( gnc_import_MatchInfo_get_probability
+                                   ( gnc_import_TransInfo_get_selected_match (info)),
+                                   gui->user_settings,
+                                   GTK_WIDGET(gui->view)),
+                           -1);
+    }
+
+    gtk_list_store_set(store, iter,
+                       DOWNLOADED_COL_ACTION_UPDATE,
+                       gnc_import_TransInfo_get_action(info) == GNCImport_UPDATE,
+                       -1);
+    if (gnc_import_TransInfo_get_action(info) == GNCImport_UPDATE)
+    {
+        /*Show the best match's confidence pixmap in the info column*/
+        gtk_list_store_set(store, iter,
+                           DOWNLOADED_COL_ACTION_PIXBUF,
+                           gen_probability_pixbuf( gnc_import_MatchInfo_get_probability
+                                   ( gnc_import_TransInfo_get_selected_match (info)),
+                                   gui->user_settings,
+                                   GTK_WIDGET(gui->view)),
+                           -1);
+    }
+
+    selection = gtk_tree_view_get_selection(gui->view);
+    gtk_tree_selection_unselect_all(selection);
+}
+
+void gnc_gen_trans_list_add_trans(GNCImportMainMatcher *gui, Transaction *trans)
+{
+    gnc_gen_trans_list_add_trans_with_ref_id(gui, trans, 0);
+    return;
+}/* end gnc_import_add_trans() */
+
+void gnc_gen_trans_list_add_trans_with_ref_id(GNCImportMainMatcher *gui, Transaction *trans, guint32 ref_id)
+{
+    GNCImportTransInfo * transaction_info = NULL;
+    GtkTreeModel *model;
+    GtkTreeIter iter;
+    GNCImportMatchInfo *selected_match;
+    gboolean match_selected_manually;
+    g_assert (gui);
+    g_assert (trans);
+
+
+    if (gnc_import_exists_online_id (trans))
+        return;
+    else
+    {
+        transaction_info = gnc_import_TransInfo_new(trans, NULL);
+        gnc_import_TransInfo_set_ref_id(transaction_info, ref_id);
+
+        gnc_import_TransInfo_init_matches(transaction_info,
+                                          gui->user_settings);
+
+        selected_match =
+            gnc_import_TransInfo_get_selected_match(transaction_info);
+        match_selected_manually =
+            gnc_import_TransInfo_get_match_selected_manually(transaction_info);
+
+        if (selected_match)
+            gnc_import_PendingMatches_add_match(gui->pending_matches,
+                                                selected_match,
+                                                match_selected_manually);
+
+        model = gtk_tree_view_get_model(gui->view);
+        gtk_list_store_append(GTK_LIST_STORE(model), &iter);
+        refresh_model_row (gui, model, &iter, transaction_info);
+    }
+    return;
+}/* end gnc_import_add_trans_with_ref_id() */
+
+GtkWidget *gnc_gen_trans_list_widget (GNCImportMainMatcher *info)
+{
+    g_assert(info);
+    return info->dialog;
+}
+
+/** @} */
diff --git a/src/import-export/import-main-matcher.h b/gnucash/import-export/import-main-matcher.h
similarity index 100%
rename from src/import-export/import-main-matcher.h
rename to gnucash/import-export/import-main-matcher.h
diff --git a/src/import-export/import-match-picker.c b/gnucash/import-export/import-match-picker.c
similarity index 100%
rename from src/import-export/import-match-picker.c
rename to gnucash/import-export/import-match-picker.c
diff --git a/src/import-export/import-match-picker.h b/gnucash/import-export/import-match-picker.h
similarity index 100%
rename from src/import-export/import-match-picker.h
rename to gnucash/import-export/import-match-picker.h
diff --git a/src/import-export/import-parse.c b/gnucash/import-export/import-parse.c
similarity index 100%
rename from src/import-export/import-parse.c
rename to gnucash/import-export/import-parse.c
diff --git a/src/import-export/import-parse.h b/gnucash/import-export/import-parse.h
similarity index 100%
rename from src/import-export/import-parse.h
rename to gnucash/import-export/import-parse.h
diff --git a/src/import-export/import-pending-matches.c b/gnucash/import-export/import-pending-matches.c
similarity index 100%
rename from src/import-export/import-pending-matches.c
rename to gnucash/import-export/import-pending-matches.c
diff --git a/src/import-export/import-pending-matches.h b/gnucash/import-export/import-pending-matches.h
similarity index 100%
rename from src/import-export/import-pending-matches.h
rename to gnucash/import-export/import-pending-matches.h
diff --git a/src/import-export/import-settings.c b/gnucash/import-export/import-settings.c
similarity index 100%
rename from src/import-export/import-settings.c
rename to gnucash/import-export/import-settings.c
diff --git a/src/import-export/import-settings.h b/gnucash/import-export/import-settings.h
similarity index 100%
rename from src/import-export/import-settings.h
rename to gnucash/import-export/import-settings.h
diff --git a/src/import-export/import-utilities.c b/gnucash/import-export/import-utilities.c
similarity index 100%
rename from src/import-export/import-utilities.c
rename to gnucash/import-export/import-utilities.c
diff --git a/src/import-export/import-utilities.h b/gnucash/import-export/import-utilities.h
similarity index 100%
rename from src/import-export/import-utilities.h
rename to gnucash/import-export/import-utilities.h
diff --git a/src/import-export/log-replay/CMakeLists.txt b/gnucash/import-export/log-replay/CMakeLists.txt
similarity index 100%
rename from src/import-export/log-replay/CMakeLists.txt
rename to gnucash/import-export/log-replay/CMakeLists.txt
diff --git a/gnucash/import-export/log-replay/Makefile.am b/gnucash/import-export/log-replay/Makefile.am
new file mode 100644
index 0000000..3529e06
--- /dev/null
+++ b/gnucash/import-export/log-replay/Makefile.am
@@ -0,0 +1,43 @@
+SUBDIRS = .
+
+pkglib_LTLIBRARIES=libgncmod-log-replay.la
+
+libgncmod_log_replay_la_SOURCES = \
+  gnc-log-replay.c \
+  gnc-plugin-log-replay.c \
+  gncmod-log-replay.c
+
+noinst_HEADERS = \
+  gnc-log-replay.h \
+  gnc-plugin-log-replay.h
+
+libgncmod_log_replay_la_LDFLAGS = -avoid-version
+
+libgncmod_log_replay_la_LIBADD = \
+  ${top_builddir}/gnucash/gnome-utils/libgncmod-gnome-utils.la \
+  ${top_builddir}/libgnucash/app-utils/libgncmod-app-utils.la \
+  ${top_builddir}/libgnucash/engine/libgncmod-engine.la \
+  ${top_builddir}/libgnucash/core-utils/libgnc-core-utils.la \
+  ${top_builddir}/libgnucash/gnc-module/libgnc-module.la \
+  ${GTK_LIBS} \
+  ${GLIB_LIBS}
+
+AM_CPPFLAGS = \
+  -I${top_srcdir}/common \
+  -I${top_srcdir}/libgnucash/core-utils \
+  -I${top_srcdir}/libgnucash/engine \
+  -I${top_srcdir}/libgnucash/gnc-module \
+  -I${top_srcdir}/libgnucash/app-utils \
+  -I${top_srcdir}/gnucash/gnome \
+  -I${top_srcdir}/gnucash/gnome-utils \
+  -I${top_srcdir}/gnucash/import-export \
+  ${GTK_CFLAGS} \
+  ${GLIB_CFLAGS}
+
+uidir = $(GNC_UI_DIR)
+dist_ui_DATA = \
+	gnc-plugin-log-replay-ui.xml
+
+AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.import.log-replay\"
+
+EXTRA_DIST = CMakeLists.txt
diff --git a/src/import-export/log-replay/gnc-log-replay.c b/gnucash/import-export/log-replay/gnc-log-replay.c
similarity index 100%
rename from src/import-export/log-replay/gnc-log-replay.c
rename to gnucash/import-export/log-replay/gnc-log-replay.c
diff --git a/src/import-export/log-replay/gnc-log-replay.h b/gnucash/import-export/log-replay/gnc-log-replay.h
similarity index 100%
rename from src/import-export/log-replay/gnc-log-replay.h
rename to gnucash/import-export/log-replay/gnc-log-replay.h
diff --git a/src/import-export/log-replay/gnc-plugin-log-replay-ui.xml b/gnucash/import-export/log-replay/gnc-plugin-log-replay-ui.xml
similarity index 100%
rename from src/import-export/log-replay/gnc-plugin-log-replay-ui.xml
rename to gnucash/import-export/log-replay/gnc-plugin-log-replay-ui.xml
diff --git a/src/import-export/log-replay/gnc-plugin-log-replay.c b/gnucash/import-export/log-replay/gnc-plugin-log-replay.c
similarity index 100%
rename from src/import-export/log-replay/gnc-plugin-log-replay.c
rename to gnucash/import-export/log-replay/gnc-plugin-log-replay.c
diff --git a/src/import-export/log-replay/gnc-plugin-log-replay.h b/gnucash/import-export/log-replay/gnc-plugin-log-replay.h
similarity index 100%
rename from src/import-export/log-replay/gnc-plugin-log-replay.h
rename to gnucash/import-export/log-replay/gnc-plugin-log-replay.h
diff --git a/src/import-export/log-replay/gncmod-log-replay.c b/gnucash/import-export/log-replay/gncmod-log-replay.c
similarity index 100%
rename from src/import-export/log-replay/gncmod-log-replay.c
rename to gnucash/import-export/log-replay/gncmod-log-replay.c
diff --git a/src/import-export/ofx/CMakeLists.txt b/gnucash/import-export/ofx/CMakeLists.txt
similarity index 100%
rename from src/import-export/ofx/CMakeLists.txt
rename to gnucash/import-export/ofx/CMakeLists.txt
diff --git a/gnucash/import-export/ofx/Makefile.am b/gnucash/import-export/ofx/Makefile.am
new file mode 100644
index 0000000..629d6d0
--- /dev/null
+++ b/gnucash/import-export/ofx/Makefile.am
@@ -0,0 +1,47 @@
+SUBDIRS = . gschemas test
+
+pkglib_LTLIBRARIES=libgncmod-ofx.la
+
+libgncmod_ofx_la_SOURCES = \
+  gnc-ofx-import.c \
+  gnc-ofx-kvp.c \
+  gncmod-ofx-import.c \
+  gnc-plugin-ofx.c
+
+noinst_HEADERS = \
+  gnc-ofx-import.h \
+  gnc-ofx-kvp.h \
+  gnc-plugin-ofx.h
+
+libgncmod_ofx_la_LDFLAGS = -avoid-version
+
+libgncmod_ofx_la_LIBADD = \
+  ${top_builddir}/gnucash/import-export/libgncmod-generic-import.la \
+  ${top_builddir}/gnucash/gnome-utils/libgncmod-gnome-utils.la \
+  ${top_builddir}/libgnucash/app-utils/libgncmod-app-utils.la \
+  ${top_builddir}/libgnucash/engine/libgncmod-engine.la \
+  ${top_builddir}/libgnucash/core-utils/libgnc-core-utils.la \
+  ${top_builddir}/libgnucash/gnc-module/libgnc-module.la \
+  ${GLIB_LIBS} \
+  ${LIBOFX_LIBS}
+
+AM_CPPFLAGS = \
+  -I${top_srcdir}/common \
+  -I${top_srcdir}/libgnucash/core-utils \
+  -I${top_srcdir}/libgnucash/engine \
+  -I${top_srcdir}/libgnucash/gnc-module \
+  -I${top_srcdir}/libgnucash/app-utils \
+  -I${top_srcdir}/gnucash/gnome \
+  -I${top_srcdir}/gnucash/gnome-utils \
+  -I${top_srcdir}/gnucash/import-export \
+  ${GTK_CFLAGS} \
+  ${GLIB_CFLAGS} \
+  ${LIBOFX_CFLAGS} 
+
+uidir = $(GNC_UI_DIR)
+ui_DATA = \
+	gnc-plugin-ofx-ui.xml
+
+EXTRA_DIST = $(ui_DATA) migratable-prefs-ofx.xml CMakeLists.txt
+
+AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.import.ofx\"
diff --git a/gnucash/import-export/ofx/gnc-ofx-import.c b/gnucash/import-export/ofx/gnc-ofx-import.c
new file mode 100644
index 0000000..de95859
--- /dev/null
+++ b/gnucash/import-export/ofx/gnc-ofx-import.c
@@ -0,0 +1,1051 @@
+/*******************************************************************\
+ * 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 at gnu.org                   *
+\********************************************************************/
+/** @addtogroup Import_Export
+    @{ */
+/** @internal
+     @file gnc-ofx-import.c
+     @brief Ofx import module code
+     @author Copyright (c) 2002 Benoit Grégoire <bock at step.polymtl.ca>
+ */
+#include "config.h"
+
+#include <gtk/gtk.h>
+#include <glib/gi18n.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/time.h>
+#include <math.h>
+
+#include <libofx/libofx.h>
+#include "import-account-matcher.h"
+#include "import-commodity-matcher.h"
+#include "import-utilities.h"
+#include "import-main-matcher.h"
+
+#include "Account.h"
+#include "Transaction.h"
+#include "engine-helpers.h"
+#include "gnc-ofx-import.h"
+#include "gnc-file.h"
+#include "gnc-engine.h"
+#include "gnc-ui-util.h"
+#include "gnc-glib-utils.h"
+#include "gnc-prefs.h"
+#include "gnc-ui.h"
+#include "dialog-account.h"
+#include "dialog-utils.h"
+
+#include "gnc-ofx-kvp.h"
+
+#define GNC_PREFS_GROUP "dialogs.import.ofx"
+#define GNC_PREF_AUTO_COMMODITY "auto-create-commodity"
+
+static QofLogModule log_module = GNC_MOD_IMPORT;
+
+/********************************************************************\
+ * gnc_file_ofx_import
+ * Entry point
+\********************************************************************/
+
+/* CS: Store the reference to the created importer gui so that the
+   ofx_proc_transaction_cb can use it. */
+GNCImportMainMatcher *gnc_ofx_importer_gui = NULL;
+static gboolean auto_create_commodity = FALSE;
+static Account *ofx_parent_account = NULL;
+
+GList *ofx_created_commodites = NULL;
+
+/*
+int ofx_proc_status_cb(struct OfxStatusData data)
+{
+  return 0;
+}
+*/
+
+int ofx_proc_security_cb(const struct OfxSecurityData data, void * security_user_data);
+int ofx_proc_transaction_cb(struct OfxTransactionData data, void * transaction_user_data);
+int ofx_proc_account_cb(struct OfxAccountData data, void * account_user_data);
+static double ofx_get_investment_amount(const struct OfxTransactionData* data);
+
+static const gchar *gnc_ofx_ttype_to_string(TransactionType t)
+{
+    switch (t)
+    {
+    case OFX_CREDIT:
+        return "Generic credit";
+    case OFX_DEBIT:
+        return "Generic debit";
+    case OFX_INT:
+        return "Interest earned or paid (Note: Depends on signage of amount)";
+    case OFX_DIV:
+        return "Dividend";
+    case OFX_FEE:
+        return "FI fee";
+    case OFX_SRVCHG:
+        return "Service charge";
+    case OFX_DEP:
+        return "Deposit";
+    case OFX_ATM:
+        return "ATM debit or credit (Note: Depends on signage of amount)";
+    case OFX_POS:
+        return "Point of sale debit or credit (Note: Depends on signage of amount)";
+    case OFX_XFER:
+        return "Transfer";
+    case OFX_CHECK:
+        return "Check";
+    case OFX_PAYMENT:
+        return "Electronic payment";
+    case OFX_CASH:
+        return "Cash withdrawal";
+    case OFX_DIRECTDEP:
+        return "Direct deposit";
+    case OFX_DIRECTDEBIT:
+        return "Merchant initiated debit";
+    case OFX_REPEATPMT:
+        return "Repeating payment/standing order";
+    case OFX_OTHER:
+        return "Other";
+    default:
+        return "Unknown transaction type";
+    }
+}
+
+static const gchar *gnc_ofx_invttype_to_str(InvTransactionType t)
+{
+    switch (t)
+    {
+    case OFX_BUYDEBT:
+        return "BUYDEBT (Buy debt security)";
+    case OFX_BUYMF:
+        return "BUYMF (Buy mutual fund)";
+    case OFX_BUYOPT:
+        return "BUYOPT (Buy option)";
+    case OFX_BUYOTHER:
+        return "BUYOTHER (Buy other security type)";
+    case OFX_BUYSTOCK:
+        return "BUYSTOCK (Buy stock))";
+    case OFX_CLOSUREOPT:
+        return "CLOSUREOPT (Close a position for an option)";
+    case OFX_INCOME:
+        return "INCOME (Investment income is realized as cash into the investment account)";
+    case OFX_INVEXPENSE:
+        return "INVEXPENSE (Misc investment expense that is associated with a specific security)";
+    case OFX_JRNLFUND:
+        return "JRNLFUND (Journaling cash holdings between subaccounts within the same investment account)";
+    case OFX_MARGININTEREST:
+        return "MARGININTEREST (Margin interest expense)";
+    case OFX_REINVEST:
+        return "REINVEST (Reinvestment of income)";
+    case OFX_RETOFCAP:
+        return "RETOFCAP (Return of capital)";
+    case OFX_SELLDEBT:
+        return "SELLDEBT (Sell debt security.  Used when debt is sold, called, or reached maturity)";
+    case OFX_SELLMF:
+        return "SELLMF (Sell mutual fund)";
+    case OFX_SELLOPT:
+        return "SELLOPT (Sell option)";
+    case OFX_SELLOTHER:
+        return "SELLOTHER (Sell other type of security)";
+    case OFX_SELLSTOCK:
+        return "SELLSTOCK (Sell stock)";
+    case OFX_SPLIT:
+        return "SPLIT (Stock or mutial fund split)";
+    case OFX_TRANSFER:
+        return "TRANSFER (Transfer holdings in and out of the investment account)";
+    default:
+        return "ERROR, this investment transaction type is unknown.  This is a bug in ofxdump";
+    }
+
+}
+
+static gchar*
+sanitize_string (gchar* str)
+{
+    gchar *inval;
+    const int length = -1; /*Assumes str is null-terminated */
+    while (!g_utf8_validate (str, length, (const gchar **)(&inval)))
+	*inval = '@';
+    return str;
+}
+
+int ofx_proc_security_cb(const struct OfxSecurityData data, void * security_user_data)
+{
+    char* cusip = NULL;
+    char* default_fullname = NULL;
+    char* default_mnemonic = NULL;
+
+    if (data.unique_id_valid)
+    {
+        cusip = gnc_utf8_strip_invalid_strdup (data.unique_id);
+    }
+    if (data.secname_valid)
+    {
+        default_fullname = gnc_utf8_strip_invalid_strdup (data.secname);
+    }
+    if (data.ticker_valid)
+    {
+        default_mnemonic = gnc_utf8_strip_invalid_strdup (data.ticker);
+    }
+
+    if (auto_create_commodity)
+    {
+        gnc_commodity *commodity =
+            gnc_import_select_commodity(cusip,
+                                        FALSE,
+                                        default_fullname,
+                                        default_mnemonic);
+
+        if (!commodity)
+        {
+            QofBook *book = gnc_get_current_book();
+            gnc_quote_source *source;
+            gint source_selection = 0; // FIXME: This is just a wild guess
+            char *commodity_namespace = NULL;
+            int fraction = 1;
+
+            if (data.unique_id_type_valid)
+            {
+                commodity_namespace = gnc_utf8_strip_invalid_strdup (data.unique_id_type);
+            }
+
+            g_warning("Creating a new commodity, cusip=%s", cusip);
+            /* Create the new commodity */
+            commodity = gnc_commodity_new(book,
+                                          default_fullname,
+                                          commodity_namespace,
+                                          default_mnemonic,
+                                          cusip,
+                                          fraction);
+
+            /* Also set a single quote source */
+            gnc_commodity_begin_edit(commodity);
+            gnc_commodity_user_set_quote_flag (commodity, TRUE);
+            source = gnc_quote_source_lookup_by_ti (SOURCE_SINGLE, source_selection);
+            gnc_commodity_set_quote_source(commodity, source);
+            gnc_commodity_commit_edit(commodity);
+
+            /* Remember the commodity */
+            gnc_commodity_table_insert(gnc_get_current_commodities(), commodity);
+
+            /* Remember this new commodity for us as well */
+            ofx_created_commodites = g_list_prepend(ofx_created_commodites, commodity);
+	    g_free (commodity_namespace);
+
+        }
+    }
+    else
+    {
+        gnc_import_select_commodity(cusip,
+                                    TRUE,
+                                    default_fullname,
+                                    default_mnemonic);
+    }
+
+    g_free (cusip);
+    g_free (default_mnemonic);
+    g_free (default_fullname);
+    return 0;
+}
+
+static void gnc_ofx_set_split_memo(const struct OfxTransactionData* data, Split *split)
+{
+    g_assert(data);
+    g_assert(split);
+    /* Also put the ofx transaction name in
+     * the splits memo field, or ofx memo if
+     * name is unavailable */
+    if (data->name_valid)
+    {
+        xaccSplitSetMemo(split, data->name);
+    }
+    else if (data->memo_valid)
+    {
+        xaccSplitSetMemo(split, data->memo);
+    }
+}
+static gnc_numeric gnc_ofx_numeric_from_double(double value, const gnc_commodity *commodity)
+{
+    return double_to_gnc_numeric (value,
+                                  gnc_commodity_get_fraction(commodity),
+                                  GNC_HOW_RND_ROUND_HALF_UP);
+}
+static gnc_numeric gnc_ofx_numeric_from_double_txn(double value, const Transaction* txn)
+{
+    return gnc_ofx_numeric_from_double(value, xaccTransGetCurrency(txn));
+}
+
+/* Opens the dialog to create a new account with given name, commodity, parent, type.
+ * Returns the new account, or NULL if it couldn't be created.. */
+static Account *gnc_ofx_new_account(const char* name,
+                                    const gnc_commodity * account_commodity,
+                                    Account *parent_account,
+                                    GNCAccountType new_account_default_type)
+{
+    Account *result;
+    GList * valid_types = NULL;
+
+    g_assert(name);
+    g_assert(account_commodity);
+    g_assert(parent_account);
+
+    if (new_account_default_type != ACCT_TYPE_NONE)
+    {
+        // Passing the types as gpointer
+        valid_types =
+            g_list_prepend(valid_types,
+                           GINT_TO_POINTER(new_account_default_type));
+        if (!xaccAccountTypesCompatible(xaccAccountGetType(parent_account), new_account_default_type))
+        {
+            // Need to add the parent's account type
+            valid_types =
+                g_list_prepend(valid_types,
+                               GINT_TO_POINTER(xaccAccountGetType(parent_account)));
+        }
+    }
+    result = gnc_ui_new_accounts_from_name_with_defaults (name,
+             valid_types,
+             account_commodity,
+             parent_account);
+    g_list_free(valid_types);
+    return result;
+}
+/* LibOFX has a daylight time handling bug,
+ * https://sourceforge.net/p/libofx/bugs/39/, which causes it to adjust the
+ * timestamp for daylight time even when daylight time is not in
+ * effect. HAVE_OFX_BUG_39 reflects the result of checking for this bug during
+ * configuration, and fix_ofx_bug_39() corrects for it.
+ */
+static time64
+fix_ofx_bug_39 (time64 t)
+{
+#if HAVE_OFX_BUG_39
+    struct tm stm;
+    gnc_localtime_r(&t, &stm);
+    if (daylight && !stm.tm_isdst)
+        t += 3600;
+#endif
+    return t;
+}
+
+int ofx_proc_transaction_cb(struct OfxTransactionData data, void * transaction_user_data)
+{
+    char dest_string[255];
+    time64 current_time = gnc_time (NULL);
+    Account *account;
+    Account *investment_account = NULL;
+    Account *income_account = NULL;
+    gchar *investment_account_text, *investment_account_onlineid;
+    gnc_commodity *currency = NULL;
+    gnc_commodity *investment_commodity = NULL;
+    gnc_numeric gnc_amount, gnc_units;
+    QofBook *book;
+    Transaction *transaction;
+    Split *split;
+    gchar *notes, *tmp;
+
+    g_assert(gnc_ofx_importer_gui);
+
+    if (!data.account_id_valid)
+    {
+        PERR("account ID for this transaction is unavailable!");
+        return 0;
+    }
+    else
+	gnc_utf8_strip_invalid (data.account_id);
+
+    account = gnc_import_select_account(gnc_gen_trans_list_widget(gnc_ofx_importer_gui),
+                                        data.account_id,
+					0, NULL, NULL, ACCT_TYPE_NONE,
+					NULL, NULL);
+    if (account == NULL)
+    {
+        PERR("Unable to find account for id %s", data.account_id);
+        return 0;
+    }
+    /***** Validate the input strings to ensure utf8 *****/
+    if (data.name_valid)
+        gnc_utf8_strip_invalid(data.name);
+    if (data.memo_valid)
+        gnc_utf8_strip_invalid(data.memo);
+    if (data.check_number_valid)
+        gnc_utf8_strip_invalid(data.check_number);
+    if (data.reference_number_valid)
+        gnc_utf8_strip_invalid(data.reference_number);
+
+    /***** Create the transaction and setup transaction data *******/
+    book = gnc_account_get_book(account);
+    transaction = xaccMallocTransaction(book);
+    xaccTransBeginEdit(transaction);
+
+    /* Note: Unfortunately libofx <= 0.9.5 will not report a missing
+     * date field as an invalid one. Instead, it will report it as
+     * valid and return a completely bogus date. Starting with
+     * libofx-0.9.6 (not yet released as of 2012-09-09), it will still
+     * be reported as valid but at least the date integer itself is
+     * just plain zero. */
+    if (data.date_posted_valid && (data.date_posted != 0))
+    {
+        /* The hopeful case: We have a posted_date */
+        data.date_posted = fix_ofx_bug_39 (data.date_posted);
+        xaccTransSetDatePostedSecsNormalized(transaction, data.date_posted);
+    }
+    else if (data.date_initiated_valid && (data.date_initiated != 0))
+    {
+        /* No posted date? Maybe we have an initiated_date */
+        data.date_initiated = fix_ofx_bug_39 (data.date_initiated);
+        xaccTransSetDatePostedSecsNormalized(transaction, data.date_initiated);
+    }
+    else
+    {
+        /* Uh no, no valid date. As a workaround use today's date */
+        xaccTransSetDatePostedSecsNormalized(transaction, current_time);
+    }
+
+    xaccTransSetDateEnteredSecs(transaction, current_time);
+
+    /* Put transaction name in Description, or memo if name unavailable */
+    if (data.name_valid)
+    {
+        xaccTransSetDescription(transaction, data.name);
+    }
+    else if (data.memo_valid)
+    {
+        xaccTransSetDescription(transaction, data.memo);
+    }
+
+    /* Put everything else in the Notes field */
+    notes = g_strdup_printf("OFX ext. info: ");
+
+    if (data.transactiontype_valid)
+    {
+        tmp = notes;
+        notes = g_strdup_printf("%s%s%s", tmp, "|Trans type:",
+                                gnc_ofx_ttype_to_string(data.transactiontype));
+        g_free(tmp);
+    }
+
+    if (data.invtransactiontype_valid)
+    {
+        tmp = notes;
+        notes = g_strdup_printf("%s%s%s", tmp, "|Investment Trans type:",
+                                gnc_ofx_invttype_to_str(data.invtransactiontype));
+        g_free(tmp);
+    }
+    if (data.memo_valid && data.name_valid) /* Copy only if memo wasn't put in Description */
+    {
+        tmp = notes;
+        notes = g_strdup_printf("%s%s%s", tmp, "|Memo:", data.memo);
+        g_free(tmp);
+    }
+    if (data.date_funds_available_valid)
+    {
+        Timespec ts;
+        timespecFromTime64(&ts, data.date_funds_available);
+        gnc_timespec_to_iso8601_buff (ts, dest_string);
+        tmp = notes;
+        notes = g_strdup_printf("%s%s%s", tmp,
+				"|Date funds available:", dest_string);
+        g_free(tmp);
+    }
+    if (data.server_transaction_id_valid)
+    {
+        tmp = notes;
+        notes = g_strdup_printf("%s%s%s", tmp,
+				"|Server trans ID (conf. number):",
+				sanitize_string (data.server_transaction_id));
+        g_free(tmp);
+    }
+    if (data.standard_industrial_code_valid)
+    {
+        tmp = notes;
+        notes = g_strdup_printf("%s%s%ld", tmp,
+				"|Standard Industrial Code:",
+                                data.standard_industrial_code);
+        g_free(tmp);
+
+    }
+    if (data.payee_id_valid)
+    {
+        tmp = notes;
+        notes = g_strdup_printf("%s%s%s", tmp, "|Payee ID:",
+				sanitize_string (data.payee_id));
+        g_free(tmp);
+    }
+
+    //PERR("WRITEME: GnuCash ofx_proc_transaction():Add PAYEE and ADRESS here once supported by libofx! Notes=%s\n", notes);
+
+    /* Ideally, gnucash should process the corrected transactions */
+    if (data.fi_id_corrected_valid)
+    {
+        PERR("WRITEME: GnuCash ofx_proc_transaction(): WARNING: This transaction corrected a previous transaction, but we created a new one instead!\n");
+        tmp = notes;
+        notes = g_strdup_printf("%s%s%s%s", tmp,
+				"|This corrects transaction #",
+				sanitize_string (data.fi_id_corrected),
+				"but GnuCash didn't process the correction!");
+        g_free(tmp);
+    }
+    xaccTransSetNotes(transaction, notes);
+    g_free(notes);
+
+    if (data.account_ptr && data.account_ptr->currency_valid)
+    {
+        DEBUG("Currency from libofx: %s", data.account_ptr->currency);
+        currency = gnc_commodity_table_lookup( gnc_get_current_commodities (),
+                                               GNC_COMMODITY_NS_CURRENCY,
+                                               data.account_ptr->currency);
+    }
+    else
+    {
+        DEBUG("Currency from libofx unavailable, defaulting to account's default");
+        currency = xaccAccountGetCommodity(account);
+    }
+
+    xaccTransSetCurrency(transaction, currency);
+    if (data.amount_valid)
+    {
+        if (!data.invtransactiontype_valid)
+        {
+            /***** Process a normal transaction ******/
+            DEBUG("Adding split; Ordinary banking transaction, money flows from or into the source account");
+            split = xaccMallocSplit(book);
+            xaccTransAppendSplit(transaction, split);
+            xaccAccountInsertSplit(account, split);
+
+            gnc_amount = gnc_ofx_numeric_from_double_txn(data.amount, transaction);
+            xaccSplitSetBaseValue(split, gnc_amount, xaccTransGetCurrency(transaction));
+
+            /* set tran-num and/or split-action per book option */
+            if (data.check_number_valid)
+            {
+                gnc_set_num_action(transaction, split, data.check_number, NULL);
+            }
+            else if (data.reference_number_valid)
+            {
+                gnc_set_num_action(transaction, split, data.reference_number, NULL);
+            }
+            /* Also put the ofx transaction's memo in the
+             * split's memo field */
+            if (data.memo_valid)
+            {
+                xaccSplitSetMemo(split, data.memo);
+            }
+            if (data.fi_id_valid)
+            {
+                gnc_import_set_split_online_id(split,
+					       sanitize_string (data.fi_id));
+            }
+        }
+
+        else if (data.unique_id_valid
+                 && data.security_data_valid
+                 && data.security_data_ptr != NULL
+                 && data.security_data_ptr->secname_valid)
+        {
+            gboolean choosing_account = TRUE;
+	    gnc_utf8_strip_invalid (data.unique_id);
+            /********* Process an investment transaction **********/
+            /* Note that the ACCT_TYPE_STOCK account type
+               should be replaced with something derived from
+               data.invtranstype*/
+
+            // We have an investment transaction. First select the correct commodity.
+            investment_commodity = gnc_import_select_commodity(data.unique_id,
+                                   FALSE,
+                                   NULL,
+                                   NULL);
+            if (investment_commodity != NULL)
+            {
+                // As we now have the commodity, select the account with that commodity.
+
+                investment_account_text = g_strdup_printf( /* This string is a default account
+                                                              name. It MUST NOT contain the
+                                                              character ':' anywhere in it or
+                                                              in any translations.  */
+                                         _("Stock account for security \"%s\""),
+                             sanitize_string (data.security_data_ptr->secname));
+
+                investment_account_onlineid = g_strdup_printf( "%s%s",
+							       data.account_id,
+							       data.unique_id);
+                investment_account = gnc_import_select_account(NULL,
+                                     investment_account_onlineid,
+                                     1,
+                                     investment_account_text,
+                                     investment_commodity,
+                                     ACCT_TYPE_STOCK,
+                                     NULL,
+                                     NULL);
+
+                // but use it only if that's really the right commodity
+                if (investment_account
+                        && xaccAccountGetCommodity(investment_account) != investment_commodity)
+                    investment_account = NULL;
+
+                // Loop until we either have an account, or the user pressed Cancel
+                while (!investment_account && choosing_account)
+                {
+                    // No account with correct commodity automatically found.
+
+                    // But are we in auto-create mode and already know a parent?
+                    if (auto_create_commodity && ofx_parent_account)
+                    {
+                        // Yes, so use that as parent when auto-creating the new account below.
+                        investment_account = ofx_parent_account;
+                    }
+                    else
+                    {
+                        // Let the user choose an account
+                        investment_account = gnc_import_select_account(
+                                                 gnc_gen_trans_list_widget(gnc_ofx_importer_gui),
+                                                 data.unique_id,
+                                                 TRUE,
+                                                 investment_account_text,
+                                                 investment_commodity,
+                                                 ACCT_TYPE_STOCK,
+                                                 NULL,
+                                                 &choosing_account);
+                    }
+                    // Does the chosen account have the right commodity?
+                    if (investment_account && xaccAccountGetCommodity(investment_account) != investment_commodity)
+                    {
+                        if (auto_create_commodity
+                                && xaccAccountTypesCompatible(xaccAccountGetType(investment_account),
+                                                              ACCT_TYPE_STOCK))
+                        {
+                            // The user chose an account, but it does
+                            // not have the right commodity. Also,
+                            // auto-creation is on. Hence, we create a
+                            // new child account of the selected one,
+                            // and this one will have the right
+                            // commodity.
+                            Account *parent_account = investment_account;
+                            investment_account =
+                                gnc_ofx_new_account(investment_account_text,
+                                                    investment_commodity,
+                                                    parent_account,
+                                                    ACCT_TYPE_STOCK);
+                            if (investment_account)
+                            {
+                                gnc_import_set_acc_online_id(investment_account, data.unique_id);
+                                choosing_account = FALSE;
+                                ofx_parent_account = parent_account;
+                            }
+                            else
+                            {
+                                ofx_parent_account = NULL;
+                            }
+                        }
+                        else
+                        {
+                            // No account with matching commodity. Ask the user
+                            // whether to continue or abort.
+                            choosing_account =
+                                gnc_verify_dialog(
+                                    gnc_gen_trans_list_widget(gnc_ofx_importer_gui), TRUE,
+                                    "The chosen account \"%s\" does not have the correct "
+                                    "currency/security \"%s\" (it has \"%s\" instead). "
+                                    "This account cannot be used. "
+                                    "Do you want to choose again?",
+                                    xaccAccountGetName(investment_account),
+                                    gnc_commodity_get_fullname(investment_commodity),
+                                    gnc_commodity_get_fullname(xaccAccountGetCommodity(investment_account)));
+                            // We must also delete the online_id that was set in gnc_import_select_account()
+                            gnc_import_set_acc_online_id(investment_account, "");
+                            investment_account = NULL;
+                        }
+                    }
+                }
+                if (!investment_account)
+                {
+                    PERR("No investment account found for text: %s\n", investment_account_text);
+                }
+                g_free (investment_account_text);
+                g_free (investment_account_onlineid);
+                investment_account_text = NULL;
+
+                if (investment_account != NULL &&
+                        data.unitprice_valid &&
+                        data.units_valid &&
+                        ( data.invtransactiontype != OFX_INCOME ) )
+                {
+                    DEBUG("Adding investment split; Money flows from or into the stock account");
+                    split = xaccMallocSplit(book);
+                    xaccTransAppendSplit(transaction, split);
+                    xaccAccountInsertSplit(investment_account, split);
+
+                    gnc_amount = gnc_ofx_numeric_from_double_txn (ofx_get_investment_amount(&data),
+                                 transaction);
+                    gnc_units = gnc_ofx_numeric_from_double (data.units, investment_commodity);
+                    xaccSplitSetAmount(split, gnc_units);
+                    xaccSplitSetValue(split, gnc_amount);
+
+                    /* set tran-num and/or split-action per book option */
+                    if (data.check_number_valid)
+                    {
+                        gnc_set_num_action(transaction, split, data.check_number, NULL);
+                    }
+                    else if (data.reference_number_valid)
+                    {
+                        gnc_set_num_action(transaction, split,
+                                           data.reference_number, NULL);
+                    }
+                    if (data.security_data_ptr->memo_valid)
+                    {
+                        xaccSplitSetMemo(split,
+                                sanitize_string (data.security_data_ptr->memo));
+                    }
+                    if (data.fi_id_valid)
+                    {
+                        gnc_import_set_split_online_id(split,
+                                                 sanitize_string (data.fi_id));
+                    }
+                }
+                else
+                {
+                    if (investment_account)
+                        PERR("The investment account, units or unitprice was not found for the investment transaction");
+                }
+            }
+            else
+            {
+                PERR("Commodity not found for the investment transaction");
+            }
+
+            if (data.invtransactiontype_valid && investment_account)
+            {
+                if (data.invtransactiontype == OFX_REINVEST
+                        || data.invtransactiontype == OFX_INCOME)
+                {
+                    DEBUG("Now let's find an account for the destination split");
+
+                    income_account = gnc_ofx_kvp_get_assoc_account(investment_account);
+
+                    if (income_account == NULL)
+                    {
+                        DEBUG("Couldn't find an associated income account");
+                        investment_account_text = g_strdup_printf( /* This string is a default account
+                                                                      name. It MUST NOT contain the
+                                                                      character ':' anywhere in it or
+                                                                      in any translations.  */
+                                                      _("Income account for security \"%s\""),
+                                                      sanitize_string (data.security_data_ptr->secname));
+                        income_account = gnc_import_select_account(
+                                             gnc_gen_trans_list_widget(gnc_ofx_importer_gui),
+                                             NULL,
+                                             1,
+                                             investment_account_text,
+                                             currency,
+                                             ACCT_TYPE_INCOME,
+                                             NULL,
+                                             NULL);
+                        if (income_account != NULL)
+                        {
+                            gnc_ofx_kvp_set_assoc_account(investment_account,
+                                                          income_account);
+                            DEBUG("KVP written");
+                        }
+
+                    }
+                    else
+                    {
+                        DEBUG("Found at least one associated income account");
+                    }
+                }
+                if (income_account != NULL &&
+                        data.invtransactiontype == OFX_REINVEST)
+                {
+                    DEBUG("Adding investment split; Money flows from the income account");
+                    split = xaccMallocSplit(book);
+                    xaccTransAppendSplit(transaction, split);
+                    xaccAccountInsertSplit(income_account, split);
+
+                    gnc_amount = gnc_ofx_numeric_from_double_txn (data.amount, transaction);
+                    xaccSplitSetBaseValue(split, gnc_amount, xaccTransGetCurrency(transaction));
+
+                    // Set split memo from ofx transaction name or memo
+                    gnc_ofx_set_split_memo(&data, split);
+                }
+                if (income_account != NULL &&
+                        data.invtransactiontype == OFX_INCOME)
+                {
+                    DEBUG("Adding investment split; Money flows from the income account");
+                    split = xaccMallocSplit(book);
+                    xaccTransAppendSplit(transaction, split);
+                    xaccAccountInsertSplit(income_account, split);
+
+                    gnc_amount = gnc_ofx_numeric_from_double_txn (-data.amount,/*OFX_INCOME amounts come in as positive numbers*/
+                                 transaction);
+                    xaccSplitSetBaseValue(split, gnc_amount, xaccTransGetCurrency(transaction));
+
+                    // Set split memo from ofx transaction name or memo
+                    gnc_ofx_set_split_memo(&data, split);
+                }
+            }
+
+            if (data.invtransactiontype_valid
+                    && data.invtransactiontype != OFX_REINVEST)
+            {
+                DEBUG("Adding investment split; Money flows from or to the cash account");
+                split = xaccMallocSplit(book);
+                xaccTransAppendSplit(transaction, split);
+                xaccAccountInsertSplit(account, split);
+
+                gnc_amount = gnc_ofx_numeric_from_double_txn(
+                                 -ofx_get_investment_amount(&data), transaction);
+                xaccSplitSetBaseValue(split, gnc_amount,
+                                      xaccTransGetCurrency(transaction));
+
+                // Set split memo from ofx transaction name or memo
+                gnc_ofx_set_split_memo(&data, split);
+            }
+        }
+
+        /* Send transaction to importer GUI. */
+        if (xaccTransCountSplits(transaction) > 0)
+        {
+            DEBUG("%d splits sent to the importer gui", xaccTransCountSplits(transaction));
+            gnc_gen_trans_list_add_trans (gnc_ofx_importer_gui, transaction);
+        }
+        else
+        {
+            PERR("No splits in transaction (missing account?), ignoring.");
+            xaccTransDestroy(transaction);
+            xaccTransCommitEdit(transaction);
+        }
+    }
+    else
+    {
+        PERR("The transaction doesn't have a valid amount");
+        xaccTransDestroy(transaction);
+        xaccTransCommitEdit(transaction);
+    }
+
+    return 0;
+}//end ofx_proc_transaction()
+
+/*
+int ofx_proc_statement_cb(struct OfxStatementData data, void * statement_user_data)
+{
+  return 0;
+}//end ofx_proc_statement()
+*/
+
+int ofx_proc_account_cb(struct OfxAccountData data, void * account_user_data)
+{
+    gnc_commodity_table * commodity_table;
+    gnc_commodity * default_commodity;
+    GNCAccountType default_type = ACCT_TYPE_NONE;
+    gchar * account_description;
+    /* In order to trigger a book options display on the creation of a new book,
+     * we need to detect when we are dealing with a new book. */
+    gboolean new_book = gnc_is_new_book();
+
+    const gchar * account_type_name = _("Unknown OFX account");
+
+    if (data.account_id_valid)
+    {
+        commodity_table = gnc_get_current_commodities ();
+        if (data.currency_valid)
+        {
+            DEBUG("Currency from libofx: %s", data.currency);
+            default_commodity = gnc_commodity_table_lookup(commodity_table,
+                                GNC_COMMODITY_NS_CURRENCY,
+                                data.currency);
+        }
+        else
+        {
+            default_commodity = NULL;
+        }
+
+        if (data.account_type_valid)
+        {
+            switch (data.account_type)
+            {
+            case OFX_CHECKING :
+                default_type = ACCT_TYPE_BANK;
+                account_type_name = _("Unknown OFX checking account");
+                break;
+            case OFX_SAVINGS :
+                default_type = ACCT_TYPE_BANK;
+                account_type_name = _("Unknown OFX savings account");
+                break;
+            case OFX_MONEYMRKT :
+                default_type = ACCT_TYPE_MONEYMRKT;
+                account_type_name = _("Unknown OFX money market account");
+                break;
+            case OFX_CREDITLINE :
+                default_type = ACCT_TYPE_CREDITLINE;
+                account_type_name = _("Unknown OFX credit line account");
+                break;
+            case OFX_CMA :
+                default_type = ACCT_TYPE_NONE;
+                account_type_name = _("Unknown OFX CMA account");
+                break;
+            case OFX_CREDITCARD :
+                default_type = ACCT_TYPE_CREDIT;
+                account_type_name = _("Unknown OFX credit card account");
+                break;
+            case OFX_INVESTMENT :
+                default_type = ACCT_TYPE_BANK;
+                account_type_name = _("Unknown OFX investment account");
+                break;
+            default:
+                PERR("WRITEME: ofx_proc_account() This is an unknown account type!");
+                break;
+            }
+        }
+
+        /* If the OFX importer was started in Gnucash in a 'new_book' situation,
+         * as described above, the first time the 'ofx_proc_account_cb' function
+         * is called a book is created. (This happens after the 'new_book' flag
+         * is set in 'gnc_get_current_commodities', called above.) So, before
+         * calling 'gnc_import_select_account', allow the user to set book
+         * options. */
+        if (new_book)
+            new_book = gnc_new_book_option_display(gnc_ui_get_toplevel());
+
+        gnc_utf8_strip_invalid(data.account_name);
+        gnc_utf8_strip_invalid(data.account_id);
+        account_description = g_strdup_printf( /* This string is a default account
+                                                  name. It MUST NOT contain the
+                                                  character ':' anywhere in it or
+                                                  in any translation.  */
+                                  "%s \"%s\"",
+                                  account_type_name,
+                                  data.account_name);
+        gnc_import_select_account(NULL, data.account_id, 1,
+                                  account_description, default_commodity,
+                                  default_type, NULL, NULL);
+        g_free(account_description);
+    }
+    else
+    {
+        PERR("account online ID not available");
+    }
+
+    return 0;
+}
+
+double ofx_get_investment_amount(const struct OfxTransactionData* data)
+{
+    g_assert(data);
+    switch (data->invtransactiontype)
+    {
+    case OFX_BUYDEBT:
+    case OFX_BUYMF:
+    case OFX_BUYOPT:
+    case OFX_BUYOTHER:
+    case OFX_BUYSTOCK:
+        return fabs(data->amount);
+    case OFX_SELLDEBT:
+    case OFX_SELLMF:
+    case OFX_SELLOPT:
+    case OFX_SELLOTHER:
+    case OFX_SELLSTOCK:
+        return -1 * fabs(data->amount);
+    default:
+        return -1 * data->amount;
+    }
+}
+
+void gnc_file_ofx_import (void)
+{
+    extern int ofx_PARSER_msg;
+    extern int ofx_DEBUG_msg;
+    extern int ofx_WARNING_msg;
+    extern int ofx_ERROR_msg;
+    extern int ofx_INFO_msg;
+    extern int ofx_STATUS_msg;
+    char *selected_filename;
+    char *default_dir;
+    LibofxContextPtr libofx_context = libofx_get_new_context();
+
+    ofx_PARSER_msg = false;
+    ofx_DEBUG_msg = false;
+    ofx_WARNING_msg = true;
+    ofx_ERROR_msg = true;
+    ofx_INFO_msg = true;
+    ofx_STATUS_msg = false;
+
+    DEBUG("gnc_file_ofx_import(): Begin...\n");
+
+    default_dir = gnc_get_default_directory(GNC_PREFS_GROUP);
+    selected_filename = gnc_file_dialog(_("Select an OFX/QFX file to process"),
+                                        NULL,
+                                        default_dir,
+                                        GNC_FILE_DIALOG_IMPORT);
+    g_free(default_dir);
+
+    if (selected_filename != NULL)
+    {
+#ifdef G_OS_WIN32
+        gchar *conv_name;
+#endif
+
+        /* Remember the directory as the default. */
+        default_dir = g_path_get_dirname(selected_filename);
+        gnc_set_default_directory(GNC_PREFS_GROUP, default_dir);
+        g_free(default_dir);
+
+        /*strncpy(file,selected_filename, 255);*/
+        DEBUG("Filename found: %s", selected_filename);
+
+        /* Create the Generic transaction importer GUI. */
+        gnc_ofx_importer_gui = gnc_gen_trans_list_new(NULL, NULL, FALSE, 42);
+
+        /* Look up the needed preferences */
+        auto_create_commodity =
+            gnc_prefs_get_bool (GNC_PREFS_GROUP_IMPORT, GNC_PREF_AUTO_COMMODITY);
+
+        /* Initialize libofx */
+
+        /*ofx_set_statement_cb(libofx_context, ofx_proc_statement_cb, 0);*/
+        ofx_set_account_cb(libofx_context, ofx_proc_account_cb, 0);
+        ofx_set_transaction_cb(libofx_context, ofx_proc_transaction_cb, 0);
+        ofx_set_security_cb(libofx_context, ofx_proc_security_cb, 0);
+        /*ofx_set_status_cb(libofx_context, ofx_proc_status_cb, 0);*/
+
+#ifdef G_OS_WIN32
+        conv_name = g_win32_locale_filename_from_utf8(selected_filename);
+        g_free(selected_filename);
+        selected_filename = conv_name;
+#endif
+
+        DEBUG("Opening selected file");
+        libofx_proc_file(libofx_context, selected_filename, AUTODETECT);
+        g_free(selected_filename);
+    }
+
+    if (ofx_created_commodites)
+    {
+        /* FIXME: Present some result window about the newly created
+         * commodities */
+        g_warning("Created %d new commodities during import", g_list_length(ofx_created_commodites));
+        g_list_free(ofx_created_commodites);
+        ofx_created_commodites = NULL;
+    }
+    else
+    {
+        //g_warning("No new commodities created");
+    }
+}
+
+
+/** @} */
diff --git a/src/import-export/ofx/gnc-ofx-import.h b/gnucash/import-export/ofx/gnc-ofx-import.h
similarity index 100%
rename from src/import-export/ofx/gnc-ofx-import.h
rename to gnucash/import-export/ofx/gnc-ofx-import.h
diff --git a/src/import-export/ofx/gnc-ofx-kvp.c b/gnucash/import-export/ofx/gnc-ofx-kvp.c
similarity index 100%
rename from src/import-export/ofx/gnc-ofx-kvp.c
rename to gnucash/import-export/ofx/gnc-ofx-kvp.c
diff --git a/gnucash/import-export/ofx/gnc-ofx-kvp.h b/gnucash/import-export/ofx/gnc-ofx-kvp.h
new file mode 100644
index 0000000..58cd36a
--- /dev/null
+++ b/gnucash/import-export/ofx/gnc-ofx-kvp.h
@@ -0,0 +1,38 @@
+/*******************************************************************\
+ * 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 at gnu.org                   *
+\********************************************************************/
+/*
+ * gnc-ofx-kvp.h
+ *
+ *  Created on: 13.03.2011
+ *      Author: cs
+ */
+
+#ifndef GNC_OFX_KVP_H_
+#define GNC_OFX_KVP_H_
+
+#include <glib.h>
+#include <Account.h>
+
+Account *gnc_ofx_kvp_get_assoc_account(const Account* investment_account);
+
+void gnc_ofx_kvp_set_assoc_account(Account* investment_account,
+                                   const Account *associated_income_accout);
+
+
+#endif /* GNC_OFX_CONVERSIONS_H_ */
diff --git a/src/import-export/ofx/gnc-plugin-ofx-ui.xml b/gnucash/import-export/ofx/gnc-plugin-ofx-ui.xml
similarity index 100%
rename from src/import-export/ofx/gnc-plugin-ofx-ui.xml
rename to gnucash/import-export/ofx/gnc-plugin-ofx-ui.xml
diff --git a/src/import-export/ofx/gnc-plugin-ofx.c b/gnucash/import-export/ofx/gnc-plugin-ofx.c
similarity index 100%
rename from src/import-export/ofx/gnc-plugin-ofx.c
rename to gnucash/import-export/ofx/gnc-plugin-ofx.c
diff --git a/src/import-export/ofx/gnc-plugin-ofx.h b/gnucash/import-export/ofx/gnc-plugin-ofx.h
similarity index 100%
rename from src/import-export/ofx/gnc-plugin-ofx.h
rename to gnucash/import-export/ofx/gnc-plugin-ofx.h
diff --git a/src/import-export/ofx/gncmod-ofx-import.c b/gnucash/import-export/ofx/gncmod-ofx-import.c
similarity index 100%
rename from src/import-export/ofx/gncmod-ofx-import.c
rename to gnucash/import-export/ofx/gncmod-ofx-import.c
diff --git a/src/import-export/ofx/gschemas/CMakeLists.txt b/gnucash/import-export/ofx/gschemas/CMakeLists.txt
similarity index 100%
rename from src/import-export/ofx/gschemas/CMakeLists.txt
rename to gnucash/import-export/ofx/gschemas/CMakeLists.txt
diff --git a/src/import-export/ofx/gschemas/Makefile.am b/gnucash/import-export/ofx/gschemas/Makefile.am
similarity index 100%
rename from src/import-export/ofx/gschemas/Makefile.am
rename to gnucash/import-export/ofx/gschemas/Makefile.am
diff --git a/src/import-export/ofx/gschemas/org.gnucash.dialogs.import.ofx.gschema.xml.in.in b/gnucash/import-export/ofx/gschemas/org.gnucash.dialogs.import.ofx.gschema.xml.in.in
similarity index 100%
rename from src/import-export/ofx/gschemas/org.gnucash.dialogs.import.ofx.gschema.xml.in.in
rename to gnucash/import-export/ofx/gschemas/org.gnucash.dialogs.import.ofx.gschema.xml.in.in
diff --git a/src/import-export/ofx/migratable-prefs-ofx.xml b/gnucash/import-export/ofx/migratable-prefs-ofx.xml
similarity index 100%
rename from src/import-export/ofx/migratable-prefs-ofx.xml
rename to gnucash/import-export/ofx/migratable-prefs-ofx.xml
diff --git a/src/import-export/ofx/test/CMakeLists.txt b/gnucash/import-export/ofx/test/CMakeLists.txt
similarity index 100%
rename from src/import-export/ofx/test/CMakeLists.txt
rename to gnucash/import-export/ofx/test/CMakeLists.txt
diff --git a/gnucash/import-export/ofx/test/Makefile.am b/gnucash/import-export/ofx/test/Makefile.am
new file mode 100644
index 0000000..2e784d4
--- /dev/null
+++ b/gnucash/import-export/ofx/test/Makefile.am
@@ -0,0 +1,13 @@
+TESTS=test-link
+
+AM_CPPFLAGS=${LIBOFX_CFLAGS}
+check_PROGRAMS=test-link
+
+test_link_SOURCES=test-link.c
+test_link_LDADD=\
+	$(top_builddir)/libgnucash/engine/libgncmod-engine.la \
+	$(top_builddir)/libgnucash/app-utils/libgncmod-app-utils.la \
+	${top_builddir}/gnucash/gnome-utils/libgncmod-gnome-utils.la \
+	../libgncmod-ofx.la
+
+EXTRA_DIST = CMakeLists.txt
diff --git a/src/import-export/ofx/test/test-link.c b/gnucash/import-export/ofx/test/test-link.c
similarity index 100%
rename from src/import-export/ofx/test/test-link.c
rename to gnucash/import-export/ofx/test/test-link.c
diff --git a/gnucash/import-export/qif-imp/CMakeLists.txt b/gnucash/import-export/qif-imp/CMakeLists.txt
new file mode 100644
index 0000000..a26fb08
--- /dev/null
+++ b/gnucash/import-export/qif-imp/CMakeLists.txt
@@ -0,0 +1,93 @@
+# CMakeLists.txt for gnucash/import_export/qif-imp
+
+ADD_SUBDIRECTORY(gschemas)
+ADD_SUBDIRECTORY(test)
+
+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
+SET_SOURCE_FILES_PROPERTIES (${qif_import_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
+
+SET (qif_import_noinst_HEADERS
+    dialog-account-picker.h
+    assistant-qif-import.h
+    gnc-plugin-qif-import.h
+)
+
+ADD_LIBRARY	(gncmod-qif-import ${qif_import_SOURCES} ${qif_import_noinst_HEADERS})
+
+TARGET_LINK_LIBRARIES(gncmod-qif-import gncmod-app-utils gncmod-gnome-utils gnc-gnome)
+
+TARGET_COMPILE_DEFINITIONS(gncmod-qif-import PRIVATE -DG_LOG_DOMAIN=\"gnc.import.qif.import\")
+
+INSTALL(TARGETS gncmod-qif-import
+  LIBRARY DESTINATION lib/gnucash
+  ARCHIVE DESTINATION lib/gnucash
+  RUNTIME DESTINATION bin)
+# No headers to install.
+
+
+# Scheme
+
+SET (qif_import_SCHEME
+  qif-dialog-utils.scm
+  qif-file.scm
+  qif-guess-map.scm
+  qif-merge-groups.scm
+  qif-objects.scm
+  qif-parse.scm
+  qif-to-gnc.scm
+  qif-utils.scm
+  qif-import.scm # yes, included in both SETs
+)
+
+SET(qif_import_SCHEME_2
+  qif-import.scm
+)
+
+SET(GUILE_MODULES      "")
+SET(GUILE_LOAD_DIRS    libgnucash/core-utils libgnucash/gnc-module libgnucash/scm)
+SET(GUILE_LIBRARY_DIRS libgnucash/core-utils libgnucash/gnc-module gnucash/gnome)
+SET(GUILE_DEPENDS      gncmod-qif-import scm-core-utils scm-gnc-module scm-scm)
+
+GNC_ADD_SCHEME_TARGETS(scm-qif-import-2
+  "${qif_import_SCHEME_2}"
+  "gnucash/import-export"
+  "${GUILE_MODULES}"
+  "${GUILE_LOAD_DIRS}"
+  "${GUILE_LIBRARY_DIRS}"
+  "${GUILE_DEPENDS}"
+  FALSE
+)
+
+GNC_ADD_SCHEME_TARGETS(scm-qif-import
+  "${qif_import_SCHEME}"
+  "qif-import"
+  "${GUILE_MODULES}"
+  "${GUILE_LOAD_DIRS}"
+  "${GUILE_LIBRARY_DIRS}"
+  "${GUILE_DEPENDS}"
+  FALSE
+)
+
+SET(qif_import_GLADE assistant-qif-import.glade dialog-account-picker.glade)
+
+INSTALL(FILES ${qif_import_GLADE} DESTINATION share/gnucash/gtkbuilder)
+
+SET(qif_import_UI gnc-plugin-qif-import-ui.xml)
+
+INSTALL(FILES ${qif_import_UI} DESTINATION share/gnucash/ui)
+
+FILE(COPY ${qif_import_UI}
+  DESTINATION ${DATADIR_BUILD}/gnucash/ui)
+FILE(COPY ${qif_import_GLADE}
+  DESTINATION ${DATADIR_BUILD}/gnucash/gtkbuilder)
+
+SET_LOCAL_DIST(qif_import_DIST_local CMakeLists.txt Makefile.am file-format.txt ${qif_import_SOURCES} ${qif_import_noinst_HEADERS}
+        ${qif_import_SCHEME} ${qif_import_SCHEME_2} ${qif_import_GLADE} ${qif_import_UI})
+SET(qif_import_DIST ${qif_import_DIST_local} ${test_qif_import_DIST} ${qif_import_gschema_DIST} PARENT_SCOPE)
diff --git a/gnucash/import-export/qif-imp/Makefile.am b/gnucash/import-export/qif-imp/Makefile.am
new file mode 100644
index 0000000..e23cd32
--- /dev/null
+++ b/gnucash/import-export/qif-imp/Makefile.am
@@ -0,0 +1,142 @@
+SUBDIRS = . test gschemas
+
+pkglib_LTLIBRARIES=libgncmod-qif-import.la
+
+libgncmod_qif_import_la_SOURCES = \
+  dialog-account-picker.c \
+  assistant-qif-import.c \
+  gnc-plugin-qif-import.c \
+  gncmod-qif-import.c
+
+noinst_HEADERS = \
+  dialog-account-picker.h \
+  assistant-qif-import.h \
+  gnc-plugin-qif-import.h
+
+libgncmod_qif_import_la_LDFLAGS = -avoid-version
+
+libgncmod_qif_import_la_LIBADD = \
+  ${top_builddir}/gnucash/import-export/libgncmod-generic-import.la \
+  ${top_builddir}/gnucash/gnome/libgnc-gnome.la \
+  ${top_builddir}/gnucash/gnome-utils/libgncmod-gnome-utils.la \
+  ${top_builddir}/libgnucash/app-utils/libgncmod-app-utils.la \
+  ${top_builddir}/libgnucash/core-utils/libgnc-core-utils.la \
+  ${top_builddir}/libgnucash/engine/libgncmod-engine.la \
+  ${top_builddir}/libgnucash/gnc-module/libgnc-module.la \
+  ${GUILE_LIBS} \
+  ${GLIB_LIBS}
+
+
+gncscmmoddir = ${GNC_SCM_INSTALL_DIR}/gnucash/import-export
+gncscmmod_DATA = qif-import.scm 
+
+gncscmdir = ${GNC_SCM_INSTALL_DIR}/qif-import
+
+gncscm_DATA = \
+  qif-dialog-utils.scm \
+  qif-file.scm \
+  qif-guess-map.scm \
+  qif-import.scm \
+  qif-merge-groups.scm \
+  qif-objects.scm \
+  qif-parse.scm \
+  qif-to-gnc.scm \
+  qif-utils.scm
+
+gtkbuilderdir = ${GNC_GTKBUILDER_DIR}
+gtkbuilder_DATA = \
+   dialog-account-picker.glade \
+   assistant-qif-import.glade
+
+AM_CPPFLAGS = \
+  -I${top_srcdir}/common \
+  -I${top_builddir}/common \
+  -I${top_srcdir}/libgnucash/core-utils \
+  -I${top_srcdir}/libgnucash/engine \
+  -I${top_srcdir}/libgnucash/gnc-module \
+  -I${top_srcdir}/libgnucash/app-utils \
+  -I${top_srcdir}/gnucash/gnome \
+  -I${top_srcdir}/gnucash/gnome-utils \
+  -I${top_srcdir}/gnucash/import-export \
+  ${GUILE_CFLAGS} \
+  ${GLIB_CFLAGS} \
+  ${GTK_CFLAGS}
+
+uidir = $(GNC_UI_DIR)
+ui_DATA = \
+	gnc-plugin-qif-import-ui.xml
+
+EXTRA_DIST = \
+  ${gncscm_DATA} \
+  ${gtkbuilder_DATA} \
+  file-format.txt \
+  $(ui_DATA) \
+  CMakeLists.txt
+
+CLEANFILES =
+
+if GNUCASH_SEPARATE_BUILDDIR
+SCM_FILE_LINKS = \
+  ${gncscm_DATA}
+endif
+
+noinst_DATA = .scm-links
+
+.scm-links: 
+	$(RM) -rf gnucash
+	mkdir -p  gnucash qif-import
+	mkdir -p  gnucash/import-export
+if GNUCASH_SEPARATE_BUILDDIR
+	for X in ${SCM_FILE_LINKS} ; do \
+	  $(LN_S) -f ${srcdir}/$$X . ; \
+	done
+endif
+	( cd gnucash/import-export; for A in $(gncscmmod_DATA) ; do $(LN_S) -f ../../$$A . ; done )
+	( cd qif-import; for A in $(gncscm_DATA) ; do $(LN_S) -f ../$$A . ; done )
+if ! OS_WIN32
+# Windows knows no "ln -s" but uses "cp": must copy every time (see bug #566567).
+	touch .scm-links
+endif
+
+if GNC_HAVE_GUILE_2
+GUILE_COMPILE_ENV = \
+  --guile-load-dir ${top_builddir}/libgnucash/core-utils \
+  --guile-load-dir ${top_builddir}/libgnucash/gnc-module \
+  --guile-load-dir ${top_builddir}/libgnucash/scm \
+  --library-dir    ${top_builddir}/libgnucash/engine \
+  --library-dir    ${top_builddir}/libgnucash/core-utils \
+  --library-dir    ${top_builddir}/libgnucash/app-utils \
+  --library-dir    ${top_builddir}/gnucash/gnome \
+  --library-dir    ${top_builddir}/libgnucash/gnc-module \
+  --library-dir    ${top_builddir}/gnucash/gnome-utils \
+  --library-dir    ${top_builddir}/libgnucash/backend/xml \
+  --library-dir    ${top_builddir}/libgnucash/backend/sql \
+  --library-dir    ${top_builddir}/gnucash/html \
+  --library-dir    ${top_builddir}/gnucash/report/report-system \
+  --library-dir    ${top_builddir}/gnucash/report/report-gnome \
+  --library-dir    ${top_builddir}/gnucash/register/register-gnome \
+  --library-dir    ${top_builddir}/gnucash/register/register-core \
+  --library-dir    ${top_builddir}/gnucash/register/ledger-core \
+  --library-dir    ${top_builddir}/gnucash/gnome-search
+
+
+%.go : %.scm .scm-links $(pkglib_LTLIBRARIES)
+	GNC_UNINSTALLED=yes \
+	GNC_BUILDDIR=${top_builddir} \
+	$(shell ${abs_top_srcdir}/common/gnc-test-env.pl --noexports ${GUILE_COMPILE_ENV}) \
+	$(GUILD) compile -o $@ $<
+
+gncscmmodcachedir = ${pkglibdir}/scm/ccache/@GUILE_EFFECTIVE_VERSION@/gnucash/import-export
+gncscmmodcache_DATA = $(gncscmmod_DATA:.scm=.go)
+
+gncscmcachedir = ${pkglibdir}/scm/ccache/@GUILE_EFFECTIVE_VERSION@/qif-import
+gncscmcache_DATA = $(gncscm_DATA:.scm=.go)
+endif
+
+clean-local:
+	$(RM) -rf gnucash qif-import
+
+CLEANFILES += .scm-links ${gncscmmodcache_DATA} ${gncscmcache_DATA}
+DISTCLEANFILES = ${SCM_FILE_LINKS}
+
+AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.import.qif.import\"
diff --git a/src/import-export/qif-imp/assistant-qif-import.c b/gnucash/import-export/qif-imp/assistant-qif-import.c
similarity index 100%
rename from src/import-export/qif-imp/assistant-qif-import.c
rename to gnucash/import-export/qif-imp/assistant-qif-import.c
diff --git a/src/import-export/qif-imp/assistant-qif-import.glade b/gnucash/import-export/qif-imp/assistant-qif-import.glade
similarity index 100%
rename from src/import-export/qif-imp/assistant-qif-import.glade
rename to gnucash/import-export/qif-imp/assistant-qif-import.glade
diff --git a/src/import-export/qif-imp/assistant-qif-import.h b/gnucash/import-export/qif-imp/assistant-qif-import.h
similarity index 100%
rename from src/import-export/qif-imp/assistant-qif-import.h
rename to gnucash/import-export/qif-imp/assistant-qif-import.h
diff --git a/src/import-export/qif-imp/dialog-account-picker.c b/gnucash/import-export/qif-imp/dialog-account-picker.c
similarity index 100%
rename from src/import-export/qif-imp/dialog-account-picker.c
rename to gnucash/import-export/qif-imp/dialog-account-picker.c
diff --git a/src/import-export/qif-imp/dialog-account-picker.glade b/gnucash/import-export/qif-imp/dialog-account-picker.glade
similarity index 100%
rename from src/import-export/qif-imp/dialog-account-picker.glade
rename to gnucash/import-export/qif-imp/dialog-account-picker.glade
diff --git a/src/import-export/qif-imp/dialog-account-picker.h b/gnucash/import-export/qif-imp/dialog-account-picker.h
similarity index 100%
rename from src/import-export/qif-imp/dialog-account-picker.h
rename to gnucash/import-export/qif-imp/dialog-account-picker.h
diff --git a/src/import-export/qif-imp/file-format.txt b/gnucash/import-export/qif-imp/file-format.txt
similarity index 100%
rename from src/import-export/qif-imp/file-format.txt
rename to gnucash/import-export/qif-imp/file-format.txt
diff --git a/src/import-export/qif-imp/gnc-plugin-qif-import-ui.xml b/gnucash/import-export/qif-imp/gnc-plugin-qif-import-ui.xml
similarity index 100%
rename from src/import-export/qif-imp/gnc-plugin-qif-import-ui.xml
rename to gnucash/import-export/qif-imp/gnc-plugin-qif-import-ui.xml
diff --git a/src/import-export/qif-imp/gnc-plugin-qif-import.c b/gnucash/import-export/qif-imp/gnc-plugin-qif-import.c
similarity index 100%
rename from src/import-export/qif-imp/gnc-plugin-qif-import.c
rename to gnucash/import-export/qif-imp/gnc-plugin-qif-import.c
diff --git a/src/import-export/qif-imp/gnc-plugin-qif-import.h b/gnucash/import-export/qif-imp/gnc-plugin-qif-import.h
similarity index 100%
rename from src/import-export/qif-imp/gnc-plugin-qif-import.h
rename to gnucash/import-export/qif-imp/gnc-plugin-qif-import.h
diff --git a/src/import-export/qif-imp/gncmod-qif-import.c b/gnucash/import-export/qif-imp/gncmod-qif-import.c
similarity index 100%
rename from src/import-export/qif-imp/gncmod-qif-import.c
rename to gnucash/import-export/qif-imp/gncmod-qif-import.c
diff --git a/src/import-export/qif-imp/gschemas/CMakeLists.txt b/gnucash/import-export/qif-imp/gschemas/CMakeLists.txt
similarity index 100%
rename from src/import-export/qif-imp/gschemas/CMakeLists.txt
rename to gnucash/import-export/qif-imp/gschemas/CMakeLists.txt
diff --git a/src/import-export/qif-imp/gschemas/Makefile.am b/gnucash/import-export/qif-imp/gschemas/Makefile.am
similarity index 100%
rename from src/import-export/qif-imp/gschemas/Makefile.am
rename to gnucash/import-export/qif-imp/gschemas/Makefile.am
diff --git a/src/import-export/qif-imp/gschemas/org.gnucash.dialogs.import.qif.gschema.xml.in.in b/gnucash/import-export/qif-imp/gschemas/org.gnucash.dialogs.import.qif.gschema.xml.in.in
similarity index 100%
rename from src/import-export/qif-imp/gschemas/org.gnucash.dialogs.import.qif.gschema.xml.in.in
rename to gnucash/import-export/qif-imp/gschemas/org.gnucash.dialogs.import.qif.gschema.xml.in.in
diff --git a/src/import-export/qif-imp/qif-dialog-utils.scm b/gnucash/import-export/qif-imp/qif-dialog-utils.scm
similarity index 100%
rename from src/import-export/qif-imp/qif-dialog-utils.scm
rename to gnucash/import-export/qif-imp/qif-dialog-utils.scm
diff --git a/src/import-export/qif-imp/qif-file.scm b/gnucash/import-export/qif-imp/qif-file.scm
similarity index 100%
rename from src/import-export/qif-imp/qif-file.scm
rename to gnucash/import-export/qif-imp/qif-file.scm
diff --git a/src/import-export/qif-imp/qif-guess-map.scm b/gnucash/import-export/qif-imp/qif-guess-map.scm
similarity index 100%
rename from src/import-export/qif-imp/qif-guess-map.scm
rename to gnucash/import-export/qif-imp/qif-guess-map.scm
diff --git a/src/import-export/qif-imp/qif-import.scm b/gnucash/import-export/qif-imp/qif-import.scm
similarity index 100%
rename from src/import-export/qif-imp/qif-import.scm
rename to gnucash/import-export/qif-imp/qif-import.scm
diff --git a/src/import-export/qif-imp/qif-merge-groups.scm b/gnucash/import-export/qif-imp/qif-merge-groups.scm
similarity index 100%
rename from src/import-export/qif-imp/qif-merge-groups.scm
rename to gnucash/import-export/qif-imp/qif-merge-groups.scm
diff --git a/src/import-export/qif-imp/qif-objects.scm b/gnucash/import-export/qif-imp/qif-objects.scm
similarity index 100%
rename from src/import-export/qif-imp/qif-objects.scm
rename to gnucash/import-export/qif-imp/qif-objects.scm
diff --git a/src/import-export/qif-imp/qif-parse.scm b/gnucash/import-export/qif-imp/qif-parse.scm
similarity index 100%
rename from src/import-export/qif-imp/qif-parse.scm
rename to gnucash/import-export/qif-imp/qif-parse.scm
diff --git a/src/import-export/qif-imp/qif-to-gnc.scm b/gnucash/import-export/qif-imp/qif-to-gnc.scm
similarity index 100%
rename from src/import-export/qif-imp/qif-to-gnc.scm
rename to gnucash/import-export/qif-imp/qif-to-gnc.scm
diff --git a/src/import-export/qif-imp/qif-utils.scm b/gnucash/import-export/qif-imp/qif-utils.scm
similarity index 100%
rename from src/import-export/qif-imp/qif-utils.scm
rename to gnucash/import-export/qif-imp/qif-utils.scm
diff --git a/src/import-export/qif-imp/test/CMakeLists.txt b/gnucash/import-export/qif-imp/test/CMakeLists.txt
similarity index 100%
rename from src/import-export/qif-imp/test/CMakeLists.txt
rename to gnucash/import-export/qif-imp/test/CMakeLists.txt
diff --git a/gnucash/import-export/qif-imp/test/Makefile.am b/gnucash/import-export/qif-imp/test/Makefile.am
new file mode 100644
index 0000000..7123793
--- /dev/null
+++ b/gnucash/import-export/qif-imp/test/Makefile.am
@@ -0,0 +1,17 @@
+TESTS=test-link
+
+check_PROGRAMS=test-link
+
+test_link_SOURCES = \
+  test-link.c
+
+test_link_LDADD=../libgncmod-qif-import.la \
+  ${top_builddir}/gnucash/register/ledger-core/libgncmod-ledger-core.la \
+  ${top_builddir}/libgnucash/core-utils/libgnc-core-utils.la \
+  ${top_builddir}/gnucash/gnome/libgnc-gnome.la \
+  ${top_builddir}/libgnucash/engine/libgncmod-engine.la \
+  ${top_builddir}/gnucash/gnome-utils/libgncmod-gnome-utils.la \
+  ${top_builddir}/libgnucash/app-utils/libgncmod-app-utils.la \
+  ${LIBXML2_LIBS}
+
+EXTRA_DIST = CMakeLists.txt
diff --git a/src/import-export/qif-imp/test/test-link.c b/gnucash/import-export/qif-imp/test/test-link.c
similarity index 100%
rename from src/import-export/qif-imp/test/test-link.c
rename to gnucash/import-export/qif-imp/test/test-link.c
diff --git a/src/import-export/qif/CMakeLists.txt b/gnucash/import-export/qif/CMakeLists.txt
similarity index 100%
rename from src/import-export/qif/CMakeLists.txt
rename to gnucash/import-export/qif/CMakeLists.txt
diff --git a/gnucash/import-export/qif/Makefile.am b/gnucash/import-export/qif/Makefile.am
new file mode 100644
index 0000000..a9c19c2
--- /dev/null
+++ b/gnucash/import-export/qif/Makefile.am
@@ -0,0 +1,39 @@
+#SUBDIRS = . test
+DIST_SUBDIRS = test
+
+pkglib_LTLIBRARIES=libgncmod-qif.la
+
+libgncmod_qif_la_SOURCES = \
+  qif-context.c \
+  qif-defaults.c \
+  qif-file.c \
+  qif-objects.c \
+  qif-parse.c
+
+noinst_HEADERS = \
+  qif-file.h \
+  qif-defaults.h \
+  qif-import-p.h \
+  qif-import.h \
+  qif-objects.h \
+  qif-objects-p.h \
+  qif-parse.h
+
+libgncmod_qif_la_LIBADD = \
+  ${top_builddir}/gnucash/import-export/libgncmod-generic-import.la \
+  ${top_builddir}/libgnucash/engine/libgncmod-engine.la \
+  ${REGEX_LIBS} \
+  ${GLIB_LIBS}
+
+AM_CPPFLAGS = \
+  -I${top_srcdir}/common \
+  -I${top_srcdir}/libgnucash/engine \
+  -I${top_srcdir}/libgnucash/gnc-module \
+  -I${top_srcdir}/libgnucash/app-utils \
+  -I${top_srcdir}/gnucash/import-export \
+  ${GLIB_CFLAGS} \
+  ${GUILE_CFLAGS}
+
+AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.import.qif\"
+
+EXTRA_DIST = CMakeLists.txt
diff --git a/src/import-export/qif/qif-context.c b/gnucash/import-export/qif/qif-context.c
similarity index 100%
rename from src/import-export/qif/qif-context.c
rename to gnucash/import-export/qif/qif-context.c
diff --git a/src/import-export/qif/qif-defaults.c b/gnucash/import-export/qif/qif-defaults.c
similarity index 100%
rename from src/import-export/qif/qif-defaults.c
rename to gnucash/import-export/qif/qif-defaults.c
diff --git a/src/import-export/qif/qif-defaults.h b/gnucash/import-export/qif/qif-defaults.h
similarity index 100%
rename from src/import-export/qif/qif-defaults.h
rename to gnucash/import-export/qif/qif-defaults.h
diff --git a/src/import-export/qif/qif-file.c b/gnucash/import-export/qif/qif-file.c
similarity index 100%
rename from src/import-export/qif/qif-file.c
rename to gnucash/import-export/qif/qif-file.c
diff --git a/src/import-export/qif/qif-file.h b/gnucash/import-export/qif/qif-file.h
similarity index 100%
rename from src/import-export/qif/qif-file.h
rename to gnucash/import-export/qif/qif-file.h
diff --git a/src/import-export/qif/qif-import-p.h b/gnucash/import-export/qif/qif-import-p.h
similarity index 100%
rename from src/import-export/qif/qif-import-p.h
rename to gnucash/import-export/qif/qif-import-p.h
diff --git a/src/import-export/qif/qif-import.h b/gnucash/import-export/qif/qif-import.h
similarity index 100%
rename from src/import-export/qif/qif-import.h
rename to gnucash/import-export/qif/qif-import.h
diff --git a/src/import-export/qif/qif-objects-p.h b/gnucash/import-export/qif/qif-objects-p.h
similarity index 100%
rename from src/import-export/qif/qif-objects-p.h
rename to gnucash/import-export/qif/qif-objects-p.h
diff --git a/src/import-export/qif/qif-objects.c b/gnucash/import-export/qif/qif-objects.c
similarity index 100%
rename from src/import-export/qif/qif-objects.c
rename to gnucash/import-export/qif/qif-objects.c
diff --git a/src/import-export/qif/qif-objects.h b/gnucash/import-export/qif/qif-objects.h
similarity index 100%
rename from src/import-export/qif/qif-objects.h
rename to gnucash/import-export/qif/qif-objects.h
diff --git a/src/import-export/qif/qif-parse.c b/gnucash/import-export/qif/qif-parse.c
similarity index 100%
rename from src/import-export/qif/qif-parse.c
rename to gnucash/import-export/qif/qif-parse.c
diff --git a/src/import-export/qif/qif-parse.h b/gnucash/import-export/qif/qif-parse.h
similarity index 100%
rename from src/import-export/qif/qif-parse.h
rename to gnucash/import-export/qif/qif-parse.h
diff --git a/gnucash/import-export/qif/test/CMakeLists.txt b/gnucash/import-export/qif/test/CMakeLists.txt
new file mode 100644
index 0000000..072fdee
--- /dev/null
+++ b/gnucash/import-export/qif/test/CMakeLists.txt
@@ -0,0 +1,18 @@
+
+SET(QIF_TEST_INCLUDE_DIRS
+  ${CMAKE_BINARY_DIR}/common
+  ${CMAKE_SOURCE_DIR}/gnucash/import-export/qif
+  ${CMAKE_SOURCE_DIR}/libgnucash/engine
+  ${CMAKE_SOURCE_DIR}/common/test-core
+  ${GLIB2_INCLUDE_DIRS}
+)
+SET(QIF_TEST_LIBS gncmod-qif test-core)
+
+IF (FALSE)
+  # Tests for this directory are not run.
+  GNC_ADD_TEST(test-link-qif test-link.c QIF_TEST_INCLUDE_DIRS QIF_TEST_LIBS)
+  GNC_ADD_TEST(test-qif test-qif.c QIF_TEST_INCLUDE_DIRS QIF_TEST_LIBS
+    GNC_TEST_FILES=${CMAKE_CURRENT_SOURCE_DIR}/test-files)
+ENDIF()
+
+SET_DIST_LIST(test_qif_DIST CMakeLists.txt Makefile.am test-link.c test-qif.c test-files/test-1-bank-txn.qif)
diff --git a/gnucash/import-export/qif/test/Makefile.am b/gnucash/import-export/qif/test/Makefile.am
new file mode 100644
index 0000000..bbd6305
--- /dev/null
+++ b/gnucash/import-export/qif/test/Makefile.am
@@ -0,0 +1,49 @@
+AM_CPPFLAGS = \
+  -I${top_srcdir}/common \
+  -I${top_srcdir}/libgnucash/gnc-module \
+  -I${top_srcdir}/common/test-core \
+  -I${top_srcdir}/libgnucash/engine \
+  -I${top_srcdir}/libgnucash/app-utils \
+  -I${top_srcdir}/gnucash/import-export \
+  -I${top_srcdir}/gnucash/import-export/qif \
+  ${GUILE_CFLAGS} \
+  ${GLIB_CFLAGS}
+
+LDADD = \
+  ${top_builddir}/libgnucash/gnc-module/libgnc-module.la \
+  ${top_builddir}/common/test-core/libtest-core.la \
+  ../../libgncmod-generic-import.la \
+  ../libgncmod-qif.la \
+  ${GLIB_LIBS}
+
+TESTS = \
+  test-link \
+  test-qif
+
+GNC_TEST_DEPS = --gnc-module-dir ${top_builddir}/libgnucash/core-utils \
+  --gnc-module-dir ${top_builddir}/libgnucash/gnc-module \
+  --gnc-module-dir ${top_builddir}/libgnucash/engine \
+  --gnc-module-dir ${top_builddir}/libgnucash/app-utils \
+  --gnc-module-dir ${top_builddir}/gnucash/import-export \
+  --gnc-module-dir ${top_builddir}/gnucash/import-export/qif \
+  --gnc-module-dir ${top_builddir}/gnucash/gnome-utils \
+  --gnc-module-dir ${top_srcdir}/libgnucash/gnc-module \
+  --gnc-module-dir ${top_srcdir}/libgnucash/engine \
+  --gnc-module-dir ${top_srcdir}/libgnucash/app-utils \
+  --gnc-module-dir ${top_srcdir}/gnucash/gnome-utils \
+  --gnc-module-dir ${top_builddir}/gnucash/gnome-utils \
+  --gnc-module-dir ${top_builddir}/gnucash/gnome \
+  --guile-load-dir ${top_srcdir}/libgnucash/scm \
+  --guile-load-dir ${top_srcdir}/gnucash/import-export \
+  --guile-load-dir ${top_srcdir}/gnucash/import-export/qif
+
+TESTS_ENVIRONMENT = \
+  GNC_TEST_FILES=${srcdir}/test-files \
+  $(shell ${abs_top_srcdir}/common/gnc-test-env.pl --noexports ${GNC_TEST_DEPS})
+
+check_PROGRAMS = \
+  test-link \
+  test-qif
+
+EXTRA_DIST = \
+  test-files/test-1-bank-txn.qif CMakeLists.txt
diff --git a/src/import-export/qif/test/test-files/test-1-bank-txn.qif b/gnucash/import-export/qif/test/test-files/test-1-bank-txn.qif
similarity index 100%
rename from src/import-export/qif/test/test-files/test-1-bank-txn.qif
rename to gnucash/import-export/qif/test/test-files/test-1-bank-txn.qif
diff --git a/src/import-export/qif/test/test-link.c b/gnucash/import-export/qif/test/test-link.c
similarity index 100%
rename from src/import-export/qif/test/test-link.c
rename to gnucash/import-export/qif/test/test-link.c
diff --git a/src/import-export/qif/test/test-qif.c b/gnucash/import-export/qif/test/test-qif.c
similarity index 100%
rename from src/import-export/qif/test/test-qif.c
rename to gnucash/import-export/qif/test/test-qif.c
diff --git a/gnucash/import-export/test/CMakeLists.txt b/gnucash/import-export/test/CMakeLists.txt
new file mode 100644
index 0000000..07e872b
--- /dev/null
+++ b/gnucash/import-export/test/CMakeLists.txt
@@ -0,0 +1,26 @@
+
+
+SET(GENERIC_IMPORT_TEST_INCLUDE_DIRS
+  ${CMAKE_BINARY_DIR}/common # for config.h
+  ${CMAKE_SOURCE_DIR}/libgnucash/gnc-module
+  ${CMAKE_SOURCE_DIR}/gnucash/import-export
+  ${CMAKE_SOURCE_DIR}/common/test-core
+  ${CMAKE_SOURCE_DIR}/libgnucash/engine
+  ${CMAKE_SOURCE_DIR}/libgnucash/engine/test-core
+  ${GLIB2_INCLUDE_DIRS}
+  ${GUILE_INCLUDE_DIRS}
+)
+
+SET(GENERIC_IMPORT_TEST_LIBS gncmod-generic-import gncmod-test-engine test-core)
+
+GNC_ADD_TEST_WITH_GUILE(test-import-parse test-import-parse.c
+  GENERIC_IMPORT_TEST_INCLUDE_DIRS GENERIC_IMPORT_TEST_LIBS
+)
+GNC_ADD_TEST(test-link-generic-import test-link.c
+  GENERIC_IMPORT_TEST_INCLUDE_DIRS GENERIC_IMPORT_TEST_LIBS
+)
+GNC_ADD_TEST(test-import-pending-matches test-import-pending-matches.c
+  GENERIC_IMPORT_TEST_INCLUDE_DIRS GENERIC_IMPORT_TEST_LIBS
+)
+SET_DIST_LIST(test_generic_import_DIST CMakeLists.txt Makefile.am
+        test-link.c test-import-parse.c test-import-pending-matches.c)
diff --git a/gnucash/import-export/test/Makefile.am b/gnucash/import-export/test/Makefile.am
new file mode 100644
index 0000000..3cca84a
--- /dev/null
+++ b/gnucash/import-export/test/Makefile.am
@@ -0,0 +1,78 @@
+include $(top_srcdir)/test-templates/Makefile.decl
+
+AM_CPPFLAGS = \
+  -I${top_srcdir}/common \
+  -I${top_srcdir}/libgnucash/gnc-module \
+  -I${top_srcdir}/common/test-core \
+  -I${top_srcdir}/libgnucash/engine \
+  -I${top_srcdir}/libgnucash/app-utils \
+  -I${top_srcdir}/gnucash/import-export \
+  -I${top_srcdir}/libgnucash/engine/test-core \
+  ${GTK_CFLAGS} \
+  ${GUILE_CFLAGS} \
+  ${GLIB_CFLAGS}
+
+LDADD = \
+  ${top_builddir}/libgnucash/core-utils/libgnc-core-utils.la \
+  ${top_builddir}/libgnucash/gnc-module/libgnc-module.la \
+  ${top_builddir}/common/test-core/libtest-core.la \
+  ../libgncmod-generic-import.la \
+  $(top_builddir)/libgnucash/app-utils/libgncmod-app-utils.la \
+  ${top_builddir}/gnucash/gnome-utils/libgncmod-gnome-utils.la \
+  ${top_builddir}/libgnucash/engine/libgncmod-engine.la \
+  ${GLIB_LIBS} \
+  ${GUILE_LIBS}
+
+TESTS = \
+  test-link \
+  test-import-parse
+
+GNC_TEST_DEPS = --gnc-module-dir ${top_builddir}/libgnucash/engine \
+  --gnc-module-dir ${top_builddir}/libgnucash/app-utils \
+  --gnc-module-dir ${top_builddir}/gnucash/gnome-utils \
+  --gnc-module-dir ${top_builddir}/gnucash/import-export \
+  --guile-load-dir ${top_builddir}/libgnucash/gnc-module \
+  --guile-load-dir ${top_builddir}/libgnucash/scm \
+  --guile-load-dir ${top_builddir}/libgnucash/engine \
+  --guile-load-dir ${top_builddir}/libgnucash/core-utils \
+  --guile-load-dir ${top_builddir}/libgnucash/app-utils \
+  --guile-load-dir ${top_builddir}/gnucash/gnome-utils \
+\
+  --library-dir    ${top_builddir}/libgnucash/core-utils \
+  --library-dir    ${top_builddir}/libgnucash/app-utils \
+  --library-dir    ${top_builddir}/gnucash/gnome-utils \
+  --library-dir    ${top_builddir}/libgnucash/engine \
+  --library-dir    ${top_builddir}/libgnucash/backend/xml \
+  --library-dir    ${top_builddir}/libgnucash/backend/sql  \
+  --library-dir    ${top_builddir}/libgnucash/gnc-module
+
+TESTS_ENVIRONMENT = \
+  GUILE_WARN_DEPRECATED=no \
+  GNC_BUILDDIR="${abs_top_builddir}" \
+  $(shell ${abs_top_srcdir}/common/gnc-test-env.pl --noexports ${GNC_TEST_DEPS})
+
+check_PROGRAMS = \
+  test-link \
+  test-import-parse
+
+TEST_PROGS += test-import-pending-matches
+
+noinst_PROGRAMS = $(TEST_PROGS) $(check_PROGRAMS)
+
+test_import_pending_matches_SOURCES = test-import-pending-matches.c
+
+test_import_pending_matches_LDADD = \
+  ${top_builddir}/libgnucash/engine/libgncmod-engine.la \
+  ../libgncmod-generic-import.la \
+  ${top_builddir}/libgnucash/engine/test-core/libgncmod-test-engine.la \
+  ${top_builddir}/common/test-core/libtest-core.la \
+  ${GLIB_LIBS}
+
+test_import_pending_matches_CFLAGS = $(AM_CPPFLAGS)
+
+clean-local:
+	rm -f translog.*
+
+distclean-local: clean-local
+
+EXTRA_DIST += CMakeLists.txt
diff --git a/src/import-export/test/test-import-parse.c b/gnucash/import-export/test/test-import-parse.c
similarity index 100%
rename from src/import-export/test/test-import-parse.c
rename to gnucash/import-export/test/test-import-parse.c
diff --git a/src/import-export/test/test-import-pending-matches.c b/gnucash/import-export/test/test-import-pending-matches.c
similarity index 100%
rename from src/import-export/test/test-import-pending-matches.c
rename to gnucash/import-export/test/test-import-pending-matches.c
diff --git a/src/import-export/test/test-link.c b/gnucash/import-export/test/test-link.c
similarity index 100%
rename from src/import-export/test/test-link.c
rename to gnucash/import-export/test/test-link.c
diff --git a/src/plugins/CMakeLists.txt b/gnucash/plugins/CMakeLists.txt
similarity index 100%
rename from src/plugins/CMakeLists.txt
rename to gnucash/plugins/CMakeLists.txt
diff --git a/src/plugins/Makefile.am b/gnucash/plugins/Makefile.am
similarity index 100%
rename from src/plugins/Makefile.am
rename to gnucash/plugins/Makefile.am
diff --git a/gnucash/plugins/bi_import/CMakeLists.txt b/gnucash/plugins/bi_import/CMakeLists.txt
new file mode 100644
index 0000000..76d04b5
--- /dev/null
+++ b/gnucash/plugins/bi_import/CMakeLists.txt
@@ -0,0 +1,49 @@
+
+ADD_SUBDIRECTORY(gtkbuilder)
+ADD_SUBDIRECTORY(ui)
+
+SET(bi_import_SOURCES
+  gnc-plugin-bi-import.c
+  gncmod-bi-import.c
+  dialog-bi-import-gui.c
+  dialog-bi-import-helper.c
+  dialog-bi-import.c
+)
+
+# Add dependency on config.h
+SET_SOURCE_FILES_PROPERTIES (${bi_import_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
+
+SET(bi_import_noinst_HEADERS
+  gnc-plugin-bi-import.h 
+  dialog-bi-import-gui.h 
+  dialog-bi-import-helper.h 
+  dialog-bi-import.h
+)
+
+ADD_LIBRARY(gncmod-bi_import ${bi_import_noinst_HEADERS} ${bi_import_SOURCES})
+
+TARGET_LINK_LIBRARIES(gncmod-bi_import
+  gncmod-gnome-utils
+  gncmod-gnome-search
+  gncmod-app-utils
+  gncmod-engine
+  gnc-core-utils
+  gnc-module
+  gnc-gnome
+)
+
+TARGET_INCLUDE_DIRECTORIES(gncmod-bi_import
+  PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
+  PRIVATE ${CMAKE_SOURCE_DIR}/gnucash/gnome
+)
+
+TARGET_COMPILE_DEFINITIONS(gncmod-bi_import PRIVATE -DG_LOG_DOMAIN=\"gnc.plugin.bi-import\")
+
+INSTALL(TARGETS gncmod-bi_import
+  LIBRARY DESTINATION lib/gnucash
+  ARCHIVE DESTINATION lib/gnucash
+  RUNTIME DESTINATION bin)
+# No headers to install.
+
+SET_LOCAL_DIST(bi_import_DIST_local CMakeLists.txt Makefile.am README ${bi_import_SOURCES} ${bi_import_noinst_HEADERS})
+SET(bi_import_DIST ${bi_import_DIST_local} ${bi_import_ui_DIST} ${bi_import_glade_DIST} PARENT_SCOPE)
diff --git a/gnucash/plugins/bi_import/Makefile.am b/gnucash/plugins/bi_import/Makefile.am
new file mode 100644
index 0000000..e1a87e9
--- /dev/null
+++ b/gnucash/plugins/bi_import/Makefile.am
@@ -0,0 +1,51 @@
+SUBDIRS = ui gtkbuilder .
+
+pkglib_LTLIBRARIES = libgncmod-bi_import.la
+
+libgncmod_bi_import_la_SOURCES = \
+  gnc-plugin-bi-import.c \
+  gncmod-bi-import.c \
+  dialog-bi-import-gui.c \
+  dialog-bi-import-helper.c \
+  dialog-bi-import.c
+
+noinst_HEADERS = \
+  gnc-plugin-bi-import.h \
+  dialog-bi-import-gui.h \
+  dialog-bi-import-helper.h \
+  dialog-bi-import.h
+
+libgncmod_bi_import_la_LDFLAGS = -avoid-version
+
+libgncmod_bi_import_la_LIBADD = \
+  ${top_builddir}/gnucash/gnome/libgnc-gnome.la \
+  ${top_builddir}/gnucash/gnome-utils/libgncmod-gnome-utils.la \
+  ${top_builddir}/libgnucash/app-utils/libgncmod-app-utils.la \
+  ${top_builddir}/libgnucash/engine/libgncmod-engine.la \
+  ${top_builddir}/libgnucash/core-utils/libgnc-core-utils.la \
+  ${top_builddir}/libgnucash/gnc-module/libgnc-module.la \
+  ${top_builddir}/lib/libc/libc-missing.la \
+  ${GLIB_LIBS}
+
+AM_CPPFLAGS = \
+  -I${top_srcdir}/common \
+  -I${top_builddir}/common \
+  -I${top_srcdir}/gnucash/gnome \
+  -I${top_srcdir}/gnucash/report/report-gnome \
+  -I${top_srcdir}/gnucash/gnome-search/ \
+  -I${top_srcdir}/gnucash/register/ledger-core \
+  -I${top_srcdir}/gnucash/register/ledger-business \
+  -I${top_srcdir}/gnucash/register/register-gnome \
+  -I${top_srcdir}/gnucash/register/register-core \
+  -I${top_srcdir}/gnucash/gnome-utils \
+  -I${top_srcdir}/libgnucash/app-utils \
+  -I${top_srcdir}/libgnucash/engine \
+  -I${top_srcdir}/libgnucash/core-utils \
+  -I${top_srcdir}/libgnucash/gnc-module \
+  -I${top_srcdir}/lib/libc \
+  ${GTK_CFLAGS} \
+  ${GLIB_CFLAGS}
+
+AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.plugin.bi-import\"
+
+EXTRA_DIST = CMakeLists.txt
diff --git a/src/plugins/bi_import/README b/gnucash/plugins/bi_import/README
similarity index 100%
rename from src/plugins/bi_import/README
rename to gnucash/plugins/bi_import/README
diff --git a/src/plugins/bi_import/dialog-bi-import-gui.c b/gnucash/plugins/bi_import/dialog-bi-import-gui.c
similarity index 100%
rename from src/plugins/bi_import/dialog-bi-import-gui.c
rename to gnucash/plugins/bi_import/dialog-bi-import-gui.c
diff --git a/src/plugins/bi_import/dialog-bi-import-gui.h b/gnucash/plugins/bi_import/dialog-bi-import-gui.h
similarity index 100%
rename from src/plugins/bi_import/dialog-bi-import-gui.h
rename to gnucash/plugins/bi_import/dialog-bi-import-gui.h
diff --git a/src/plugins/bi_import/dialog-bi-import-helper.c b/gnucash/plugins/bi_import/dialog-bi-import-helper.c
similarity index 100%
rename from src/plugins/bi_import/dialog-bi-import-helper.c
rename to gnucash/plugins/bi_import/dialog-bi-import-helper.c
diff --git a/src/plugins/bi_import/dialog-bi-import-helper.h b/gnucash/plugins/bi_import/dialog-bi-import-helper.h
similarity index 100%
rename from src/plugins/bi_import/dialog-bi-import-helper.h
rename to gnucash/plugins/bi_import/dialog-bi-import-helper.h
diff --git a/src/plugins/bi_import/dialog-bi-import.c b/gnucash/plugins/bi_import/dialog-bi-import.c
similarity index 100%
rename from src/plugins/bi_import/dialog-bi-import.c
rename to gnucash/plugins/bi_import/dialog-bi-import.c
diff --git a/src/plugins/bi_import/dialog-bi-import.h b/gnucash/plugins/bi_import/dialog-bi-import.h
similarity index 100%
rename from src/plugins/bi_import/dialog-bi-import.h
rename to gnucash/plugins/bi_import/dialog-bi-import.h
diff --git a/src/plugins/bi_import/gnc-plugin-bi-import.c b/gnucash/plugins/bi_import/gnc-plugin-bi-import.c
similarity index 100%
rename from src/plugins/bi_import/gnc-plugin-bi-import.c
rename to gnucash/plugins/bi_import/gnc-plugin-bi-import.c
diff --git a/src/plugins/bi_import/gnc-plugin-bi-import.h b/gnucash/plugins/bi_import/gnc-plugin-bi-import.h
similarity index 100%
rename from src/plugins/bi_import/gnc-plugin-bi-import.h
rename to gnucash/plugins/bi_import/gnc-plugin-bi-import.h
diff --git a/src/plugins/bi_import/gncmod-bi-import.c b/gnucash/plugins/bi_import/gncmod-bi-import.c
similarity index 100%
rename from src/plugins/bi_import/gncmod-bi-import.c
rename to gnucash/plugins/bi_import/gncmod-bi-import.c
diff --git a/src/plugins/bi_import/gtkbuilder/CMakeLists.txt b/gnucash/plugins/bi_import/gtkbuilder/CMakeLists.txt
similarity index 100%
rename from src/plugins/bi_import/gtkbuilder/CMakeLists.txt
rename to gnucash/plugins/bi_import/gtkbuilder/CMakeLists.txt
diff --git a/src/plugins/bi_import/gtkbuilder/Makefile.am b/gnucash/plugins/bi_import/gtkbuilder/Makefile.am
similarity index 100%
rename from src/plugins/bi_import/gtkbuilder/Makefile.am
rename to gnucash/plugins/bi_import/gtkbuilder/Makefile.am
diff --git a/src/plugins/bi_import/gtkbuilder/dialog-bi-import-gui.glade b/gnucash/plugins/bi_import/gtkbuilder/dialog-bi-import-gui.glade
similarity index 100%
rename from src/plugins/bi_import/gtkbuilder/dialog-bi-import-gui.glade
rename to gnucash/plugins/bi_import/gtkbuilder/dialog-bi-import-gui.glade
diff --git a/src/plugins/bi_import/regex.txt b/gnucash/plugins/bi_import/regex.txt
similarity index 100%
rename from src/plugins/bi_import/regex.txt
rename to gnucash/plugins/bi_import/regex.txt
diff --git a/src/plugins/bi_import/ui/CMakeLists.txt b/gnucash/plugins/bi_import/ui/CMakeLists.txt
similarity index 100%
rename from src/plugins/bi_import/ui/CMakeLists.txt
rename to gnucash/plugins/bi_import/ui/CMakeLists.txt
diff --git a/src/plugins/bi_import/ui/Makefile.am b/gnucash/plugins/bi_import/ui/Makefile.am
similarity index 100%
rename from src/plugins/bi_import/ui/Makefile.am
rename to gnucash/plugins/bi_import/ui/Makefile.am
diff --git a/src/plugins/bi_import/ui/gnc-plugin-bi-import-ui.xml b/gnucash/plugins/bi_import/ui/gnc-plugin-bi-import-ui.xml
similarity index 100%
rename from src/plugins/bi_import/ui/gnc-plugin-bi-import-ui.xml
rename to gnucash/plugins/bi_import/ui/gnc-plugin-bi-import-ui.xml
diff --git a/gnucash/plugins/customer_import/CMakeLists.txt b/gnucash/plugins/customer_import/CMakeLists.txt
new file mode 100644
index 0000000..c0b9e9b
--- /dev/null
+++ b/gnucash/plugins/customer_import/CMakeLists.txt
@@ -0,0 +1,40 @@
+ADD_SUBDIRECTORY(gtkbuilder)
+ADD_SUBDIRECTORY(ui)
+
+SET(customer_import_SOURCES
+  gnc-plugin-customer_import.c
+  libgncmod-customer_import.c
+  dialog-customer-import-gui.c
+  dialog-customer-import.c
+)
+
+# Add dependency on config.h
+SET_SOURCE_FILES_PROPERTIES (${customer_import_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
+
+
+SET(customer_import_noinst_HEADERS
+  gnc-plugin-customer_import.h
+  dialog-customer-import-gui.h
+  dialog-customer-import.h
+)
+
+ADD_LIBRARY(gncmod-customer_import ${customer_import_SOURCES} ${customer_input_noinst_HEADERS})
+
+TARGET_LINK_LIBRARIES(gncmod-customer_import gnc-gnome gncmod-gnome-utils gncmod-app-utils
+     gncmod-engine gnc-core-utils gnc-module ${GLIB2_LDFLAGS})
+
+TARGET_INCLUDE_DIRECTORIES(gncmod-bi_import
+  PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
+  PRIVATE ${CMAKE_SOURCE_DIR}/gnucash/gnome
+)
+
+TARGET_COMPILE_DEFINITIONS(gncmod-customer_import PRIVATE -DG_LOG_DOMAIN=\"gnc.plugin.customer_import\")
+
+INSTALL(TARGETS gncmod-customer_import
+  LIBRARY DESTINATION lib/gnucash
+  ARCHIVE DESTINATION lib/gnucash
+  RUNTIME DESTINATION bin)
+# No headers to install.
+
+SET_LOCAL_DIST(customer_import_DIST_local CMakeLists.txt Makefile.am ${customer_import_SOURCES} ${customer_import_noinst_HEADERS})
+SET(customer_import_DIST ${customer_import_DIST_local} ${customer_import_glade_DIST} ${customer_import_ui_DIST} PARENT_SCOPE)
diff --git a/gnucash/plugins/customer_import/Makefile.am b/gnucash/plugins/customer_import/Makefile.am
new file mode 100644
index 0000000..a6577c8
--- /dev/null
+++ b/gnucash/plugins/customer_import/Makefile.am
@@ -0,0 +1,48 @@
+SUBDIRS = ui gtkbuilder .
+
+pkglib_LTLIBRARIES = libgncmod-customer_import.la
+
+libgncmod_customer_import_la_SOURCES = \
+  gnc-plugin-customer_import.c \
+  libgncmod-customer_import.c \
+  dialog-customer-import-gui.c \
+  dialog-customer-import.c
+
+noinst_HEADERS = \
+  gnc-plugin-customer_import.h \
+  dialog-customer-import-gui.h \
+  dialog-customer-import.h
+
+libgncmod_customer_import_la_LDFLAGS = -avoid-version
+
+libgncmod_customer_import_la_LIBADD = \
+  ${top_builddir}/gnucash/gnome/libgnc-gnome.la \
+  ${top_builddir}/gnucash/gnome-utils/libgncmod-gnome-utils.la \
+  ${top_builddir}/libgnucash/app-utils/libgncmod-app-utils.la \
+  ${top_builddir}/libgnucash/engine/libgncmod-engine.la \
+  ${top_builddir}/libgnucash/core-utils/libgnc-core-utils.la \
+  ${top_builddir}/libgnucash/gnc-module/libgnc-module.la \
+  ${top_builddir}/lib/libc/libc-missing.la \
+  ${GLIB_LIBS}
+
+AM_CPPFLAGS = \
+  -I${top_srcdir}/common \
+  -I${top_builddir}/common \
+  -I${top_srcdir}/gnucash/gnome \
+  -I${top_srcdir}/gnucash/report/report-gnome \
+  -I${top_srcdir}/gnucash/gnome-search/ \
+  -I${top_srcdir}/gnucash/register/ledger-core \
+  -I${top_srcdir}/gnucash/register/register-gnome \
+  -I${top_srcdir}/gnucash/register/register-core \
+  -I${top_srcdir}/gnucash/gnome-utils \
+  -I${top_srcdir}/libgnucash/app-utils \
+  -I${top_srcdir}/libgnucash/engine \
+  -I${top_srcdir}/libgnucash/core-utils \
+  -I${top_srcdir}/libgnucash/gnc-module \
+  -I${top_srcdir}/lib/libc \
+  ${GTK_CFLAGS} \
+  ${GLIB_CFLAGS}
+
+AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.plugin.customer_import\"
+
+EXTRA_DIST = CMakeLists.txt
diff --git a/src/plugins/customer_import/dialog-customer-import-gui.c b/gnucash/plugins/customer_import/dialog-customer-import-gui.c
similarity index 100%
rename from src/plugins/customer_import/dialog-customer-import-gui.c
rename to gnucash/plugins/customer_import/dialog-customer-import-gui.c
diff --git a/src/plugins/customer_import/dialog-customer-import-gui.h b/gnucash/plugins/customer_import/dialog-customer-import-gui.h
similarity index 100%
rename from src/plugins/customer_import/dialog-customer-import-gui.h
rename to gnucash/plugins/customer_import/dialog-customer-import-gui.h
diff --git a/src/plugins/customer_import/dialog-customer-import.c b/gnucash/plugins/customer_import/dialog-customer-import.c
similarity index 100%
rename from src/plugins/customer_import/dialog-customer-import.c
rename to gnucash/plugins/customer_import/dialog-customer-import.c
diff --git a/src/plugins/customer_import/dialog-customer-import.h b/gnucash/plugins/customer_import/dialog-customer-import.h
similarity index 100%
rename from src/plugins/customer_import/dialog-customer-import.h
rename to gnucash/plugins/customer_import/dialog-customer-import.h
diff --git a/src/plugins/customer_import/gnc-plugin-customer_import.c b/gnucash/plugins/customer_import/gnc-plugin-customer_import.c
similarity index 100%
rename from src/plugins/customer_import/gnc-plugin-customer_import.c
rename to gnucash/plugins/customer_import/gnc-plugin-customer_import.c
diff --git a/src/plugins/customer_import/gnc-plugin-customer_import.h b/gnucash/plugins/customer_import/gnc-plugin-customer_import.h
similarity index 100%
rename from src/plugins/customer_import/gnc-plugin-customer_import.h
rename to gnucash/plugins/customer_import/gnc-plugin-customer_import.h
diff --git a/src/plugins/customer_import/gtkbuilder/CMakeLists.txt b/gnucash/plugins/customer_import/gtkbuilder/CMakeLists.txt
similarity index 100%
rename from src/plugins/customer_import/gtkbuilder/CMakeLists.txt
rename to gnucash/plugins/customer_import/gtkbuilder/CMakeLists.txt
diff --git a/src/plugins/customer_import/gtkbuilder/Makefile.am b/gnucash/plugins/customer_import/gtkbuilder/Makefile.am
similarity index 100%
rename from src/plugins/customer_import/gtkbuilder/Makefile.am
rename to gnucash/plugins/customer_import/gtkbuilder/Makefile.am
diff --git a/src/plugins/customer_import/gtkbuilder/dialog-customer-import-gui.glade b/gnucash/plugins/customer_import/gtkbuilder/dialog-customer-import-gui.glade
similarity index 100%
rename from src/plugins/customer_import/gtkbuilder/dialog-customer-import-gui.glade
rename to gnucash/plugins/customer_import/gtkbuilder/dialog-customer-import-gui.glade
diff --git a/src/plugins/customer_import/libgncmod-customer_import.c b/gnucash/plugins/customer_import/libgncmod-customer_import.c
similarity index 100%
rename from src/plugins/customer_import/libgncmod-customer_import.c
rename to gnucash/plugins/customer_import/libgncmod-customer_import.c
diff --git a/src/plugins/customer_import/ui/CMakeLists.txt b/gnucash/plugins/customer_import/ui/CMakeLists.txt
similarity index 100%
rename from src/plugins/customer_import/ui/CMakeLists.txt
rename to gnucash/plugins/customer_import/ui/CMakeLists.txt
diff --git a/src/plugins/customer_import/ui/Makefile.am b/gnucash/plugins/customer_import/ui/Makefile.am
similarity index 100%
rename from src/plugins/customer_import/ui/Makefile.am
rename to gnucash/plugins/customer_import/ui/Makefile.am
diff --git a/src/plugins/customer_import/ui/gnc-plugin-customer_import-ui.xml b/gnucash/plugins/customer_import/ui/gnc-plugin-customer_import-ui.xml
similarity index 100%
rename from src/plugins/customer_import/ui/gnc-plugin-customer_import-ui.xml
rename to gnucash/plugins/customer_import/ui/gnc-plugin-customer_import-ui.xml
diff --git a/src/plugins/example/CMakeLists.txt b/gnucash/plugins/example/CMakeLists.txt
similarity index 100%
rename from src/plugins/example/CMakeLists.txt
rename to gnucash/plugins/example/CMakeLists.txt
diff --git a/gnucash/plugins/example/Makefile.am b/gnucash/plugins/example/Makefile.am
new file mode 100644
index 0000000..d575ab6
--- /dev/null
+++ b/gnucash/plugins/example/Makefile.am
@@ -0,0 +1,37 @@
+SUBDIRS = ui glade .
+
+pkglib_LTLIBRARIES = libgncmod-example.la
+
+libgncmod_example_la_SOURCES = \
+  gnc-plugin-example.c \
+  gncmod-example.c
+
+noinst_HEADERS = \
+  gnc-plugin-example.h
+
+libgncmod_example_la_LDFLAGS = -avoid-version
+
+libgncmod_example_la_LIBADD = \
+  ${top_builddir}/libgnucash/gnc-module/libgnc-module.la \
+  ${GNOME_LIBS} \
+  ${GLADE_LIBS} \
+  ${GLIB_LIBS} \
+  ${AQBANKING_LIBS}
+
+AM_CFLAGS = \
+  -I${top_srcdir}/common \
+  -I${top_srcdir}/gnucash/gnome \
+  -I${top_srcdir}/gnucash/register/ledger-core \
+  -I${top_srcdir}/gnucash/register/register-gnome \
+  -I${top_srcdir}/gnucash/register/register-core \
+  -I${top_srcdir}/gnucash/gnome-utils \
+  -I${top_srcdir}/libgnucash/app-utils \
+  -I${top_srcdir}/libgnucash/engine \
+  -I${top_srcdir}/libgnucash/core-utils \
+  -I${top_srcdir}/libgnucash/gnc-module \
+  ${GNOME_CFLAGS} \
+  ${GLADE_CFLAGS} \
+  ${GLIB_CFLAGS} \
+  ${AQBANKING_CFLAGS}
+
+INCLUDES = -DG_LOG_DOMAIN=\"gnc.plugin.example\"
diff --git a/src/plugins/example/glade/CMakeLists.txt b/gnucash/plugins/example/glade/CMakeLists.txt
similarity index 100%
rename from src/plugins/example/glade/CMakeLists.txt
rename to gnucash/plugins/example/glade/CMakeLists.txt
diff --git a/src/plugins/example/glade/Makefile.am b/gnucash/plugins/example/glade/Makefile.am
similarity index 100%
rename from src/plugins/example/glade/Makefile.am
rename to gnucash/plugins/example/glade/Makefile.am
diff --git a/src/plugins/example/gnc-plugin.example.c b/gnucash/plugins/example/gnc-plugin.example.c
similarity index 100%
rename from src/plugins/example/gnc-plugin.example.c
rename to gnucash/plugins/example/gnc-plugin.example.c
diff --git a/src/plugins/example/gnc-plugin.example.h b/gnucash/plugins/example/gnc-plugin.example.h
similarity index 100%
rename from src/plugins/example/gnc-plugin.example.h
rename to gnucash/plugins/example/gnc-plugin.example.h
diff --git a/src/plugins/example/gncmod-example.c b/gnucash/plugins/example/gncmod-example.c
similarity index 100%
rename from src/plugins/example/gncmod-example.c
rename to gnucash/plugins/example/gncmod-example.c
diff --git a/src/plugins/example/ui/CMakeLists.txt b/gnucash/plugins/example/ui/CMakeLists.txt
similarity index 100%
rename from src/plugins/example/ui/CMakeLists.txt
rename to gnucash/plugins/example/ui/CMakeLists.txt
diff --git a/src/plugins/example/ui/Makefile.am b/gnucash/plugins/example/ui/Makefile.am
similarity index 100%
rename from src/plugins/example/ui/Makefile.am
rename to gnucash/plugins/example/ui/Makefile.am
diff --git a/src/plugins/example/ui/gnc-plugin-example-ui.xml b/gnucash/plugins/example/ui/gnc-plugin-example-ui.xml
similarity index 100%
rename from src/plugins/example/ui/gnc-plugin-example-ui.xml
rename to gnucash/plugins/example/ui/gnc-plugin-example-ui.xml
diff --git a/src/python/CMakeLists.txt b/gnucash/python/CMakeLists.txt
similarity index 100%
rename from src/python/CMakeLists.txt
rename to gnucash/python/CMakeLists.txt
diff --git a/gnucash/python/Makefile.am b/gnucash/python/Makefile.am
new file mode 100644
index 0000000..b3f7971
--- /dev/null
+++ b/gnucash/python/Makefile.am
@@ -0,0 +1,62 @@
+SUBDIRS = pycons 
+#test
+
+pkglib_LTLIBRARIES = libgncmod-python.la
+
+libgncmod_python_la_SOURCES = \
+  gncmod-python.c
+
+libgncmod_python_la_LDFLAGS = -avoid-version \
+  ${PYTHON_LDFLAGS}
+
+libgncmod_python_la_LIBADD = \
+  ${top_builddir}/libgnucash/gnc-module/libgnc-module.la \
+  ${top_builddir}/libgnucash/core-utils/libgnc-core-utils-python.la \
+  ${top_builddir}/libgnucash/app-utils/libgncmod-app-utils-python.la \
+  ${PYTHON_LIBS} \
+  ${PYTHON_EXTRA_LIBS} \
+  ${GLIB_LIBS}
+
+AM_CPPFLAGS = \
+  -I${top_srcdir}/common \
+  -I${top_srcdir}/libgnucash/core-utils \
+  -I${top_srcdir}/libgnucash/gnc-module \
+  ${PYTHON_CPPFLAGS} \
+  ${GLIB_CFLAGS}
+
+
+gncpymoddir = ${GNC_SHAREDIR}/python/
+gncpymod_DATA = \
+   init.py
+
+if GNUCASH_SEPARATE_BUILDDIR
+#For executing test cases
+PY_FILE_LINKS = ${gncpymod_DATA}
+endif
+
+.py-links:
+	$(RM) -rf gnucash
+	mkdir -p  gnucash
+	mkdir -p  gnucash/python
+if GNUCASH_SEPARATE_BUILDDIR
+	for X in ${PY_FILE_LINKS} ; do \
+	  $(LN_S) -f ${srcdir}/$$X . ; \
+	done
+endif
+	( cd gnucash/python; for A in $(gncpymod_DATA) ; do $(LN_S) -f ../../$$A . ; done )
+if ! OS_WIN32
+# Windows knows no "ln -s" but uses "cp": must copy every time (see bug #566567).
+	touch .py-links
+endif
+
+clean-local:
+	$(RM) -rf gnucash
+
+noinst_DATA = .py-links
+
+EXTRA_DIST = ${gncpymod_DATA} CMakeLists.txt
+
+CLEANFILES = .py-links
+DISTCLEANFILES = ${PY_FILE_LINKS}
+
+AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.python\"
diff --git a/src/python/gncmod-python.c b/gnucash/python/gncmod-python.c
similarity index 100%
rename from src/python/gncmod-python.c
rename to gnucash/python/gncmod-python.c
diff --git a/src/python/init.py b/gnucash/python/init.py
similarity index 100%
rename from src/python/init.py
rename to gnucash/python/init.py
diff --git a/src/python/pycons/CMakeLists.txt b/gnucash/python/pycons/CMakeLists.txt
similarity index 100%
rename from src/python/pycons/CMakeLists.txt
rename to gnucash/python/pycons/CMakeLists.txt
diff --git a/src/python/pycons/Makefile.am b/gnucash/python/pycons/Makefile.am
similarity index 100%
rename from src/python/pycons/Makefile.am
rename to gnucash/python/pycons/Makefile.am
diff --git a/src/python/pycons/__init__.py b/gnucash/python/pycons/__init__.py
similarity index 100%
rename from src/python/pycons/__init__.py
rename to gnucash/python/pycons/__init__.py
diff --git a/src/python/pycons/console.py b/gnucash/python/pycons/console.py
similarity index 100%
rename from src/python/pycons/console.py
rename to gnucash/python/pycons/console.py
diff --git a/src/python/pycons/ishell.py b/gnucash/python/pycons/ishell.py
similarity index 100%
rename from src/python/pycons/ishell.py
rename to gnucash/python/pycons/ishell.py
diff --git a/src/python/pycons/pycons b/gnucash/python/pycons/pycons
similarity index 100%
rename from src/python/pycons/pycons
rename to gnucash/python/pycons/pycons
diff --git a/src/python/pycons/setup.py b/gnucash/python/pycons/setup.py
similarity index 100%
rename from src/python/pycons/setup.py
rename to gnucash/python/pycons/setup.py
diff --git a/src/python/pycons/shell.py b/gnucash/python/pycons/shell.py
similarity index 100%
rename from src/python/pycons/shell.py
rename to gnucash/python/pycons/shell.py
diff --git a/src/python/pycons/simple_plot.py b/gnucash/python/pycons/simple_plot.py
similarity index 100%
rename from src/python/pycons/simple_plot.py
rename to gnucash/python/pycons/simple_plot.py
diff --git a/src/register/CMakeLists.txt b/gnucash/register/CMakeLists.txt
similarity index 100%
rename from src/register/CMakeLists.txt
rename to gnucash/register/CMakeLists.txt
diff --git a/src/register/Makefile.am b/gnucash/register/Makefile.am
similarity index 100%
rename from src/register/Makefile.am
rename to gnucash/register/Makefile.am
diff --git a/gnucash/register/ledger-core/CMakeLists.txt b/gnucash/register/ledger-core/CMakeLists.txt
new file mode 100644
index 0000000..df8a676
--- /dev/null
+++ b/gnucash/register/ledger-core/CMakeLists.txt
@@ -0,0 +1,65 @@
+
+ADD_SUBDIRECTORY(test)
+
+SET (ledger_core_SOURCES
+  gnc-ledger-display.c
+  gnc-ledger-display2.c
+  gncmod-ledger-core.c
+  split-register.c
+  split-register-control.c
+  split-register-layout.c
+  split-register-load.c
+  split-register-model.c
+  split-register-model-save.c
+  split-register-util.c
+  gncEntryLedger.c
+  gncEntryLedgerControl.c
+  gncEntryLedgerDisplay.c
+  gncEntryLedgerLayout.c
+  gncEntryLedgerLoad.c
+  gncEntryLedgerModel.c
+)
+
+
+SET (ledger_core_HEADERS
+  gnc-ledger-display.h
+  gnc-ledger-display2.h
+  split-register.h
+  split-register-control.h
+  split-register-layout.h
+  split-register-model.h
+  split-register-model-save.h
+  split-register-p.h
+  gncEntryLedger.h
+  gncEntryLedgerP.h
+  gncEntryLedgerControl.h
+  gncEntryLedgerLayout.h
+  gncEntryLedgerModel.h
+)
+
+# Add dependency on config.h
+SET_SOURCE_FILES_PROPERTIES (${ledger_core_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
+
+ADD_LIBRARY (gncmod-ledger-core ${ledger_core_SOURCES} ${ledger_core_HEADERS})
+
+TARGET_LINK_LIBRARIES(gncmod-ledger-core gncmod-register-gnome gncmod-register-core gncmod-gnome-utils
+        gncmod-engine gnc-core-utils ${GTK3_LDFLAGS})
+
+TARGET_COMPILE_DEFINITIONS (gncmod-ledger-core PRIVATE -DG_LOG_DOMAIN=\"gnc.register.ledger\")
+
+TARGET_INCLUDE_DIRECTORIES(gncmod-ledger-core
+    PUBLIC
+        ${CMAKE_CURRENT_SOURCE_DIR}
+        ${CMAKE_BINARY_DIR}/gnucash/gnome-utils # for gnc-warnings.h
+)
+
+INSTALL(TARGETS gncmod-ledger-core
+  LIBRARY DESTINATION lib/gnucash
+  ARCHIVE DESTINATION lib/gnucash
+  RUNTIME DESTINATION bin)
+# No headers to install
+
+
+SET_LOCAL_DIST(ledger_core_DIST_local CMakeLists.txt Makefile.am ${ledger_core_SOURCES} ${ledger_core_HEADERS})
+SET(ledger_core_DIST ${ledger_core_DIST_local} ${test_ledger_core_DIST} PARENT_SCOPE)
+
diff --git a/gnucash/register/ledger-core/Makefile.am b/gnucash/register/ledger-core/Makefile.am
new file mode 100644
index 0000000..c0bf2ac
--- /dev/null
+++ b/gnucash/register/ledger-core/Makefile.am
@@ -0,0 +1,71 @@
+SUBDIRS = . test
+
+pkglib_LTLIBRARIES = libgncmod-ledger-core.la
+
+libgncmod_ledger_core_la_SOURCES = \
+  gnc-ledger-display.c \
+  gnc-ledger-display2.c \
+  gncmod-ledger-core.c \
+  split-register.c \
+  split-register-control.c \
+  split-register-layout.c \
+  split-register-load.c \
+  split-register-model.c \
+  split-register-model-save.c \
+  split-register-util.c \
+  gncEntryLedger.c \
+  gncEntryLedgerControl.c \
+  gncEntryLedgerDisplay.c \
+  gncEntryLedgerLayout.c \
+  gncEntryLedgerLoad.c \
+  gncEntryLedgerModel.c
+
+noinst_HEADERS = \
+  gnc-ledger-display.h \
+  gnc-ledger-display2.h \
+  split-register.h \
+  split-register-control.h \
+  split-register-layout.h \
+  split-register-model.h \
+  split-register-model-save.h \
+  split-register-p.h \
+  gncEntryLedger.h \
+  gncEntryLedgerP.h \
+  gncEntryLedgerControl.h \
+  gncEntryLedgerLayout.h \
+  gncEntryLedgerModel.h
+
+libgncmod_ledger_core_la_LDFLAGS = -avoid-version
+
+libgncmod_ledger_core_la_LIBADD = \
+  ${top_builddir}/gnucash/register/register-gnome/libgncmod-register-gnome.la \
+  ${top_builddir}/gnucash/register/register-core/libgncmod-register-core.la \
+  ${top_builddir}/gnucash/gnome-utils/libgncmod-gnome-utils.la \
+  ${top_builddir}/libgnucash/app-utils/libgncmod-app-utils.la \
+  ${top_builddir}/libgnucash/engine/libgncmod-engine.la \
+  ${top_builddir}/libgnucash/core-utils/libgnc-core-utils.la \
+  ${top_builddir}/libgnucash/gnc-module/libgnc-module.la \
+  ${GUILE_LIBS} \
+  ${GTK_LIBS} \
+  ${GLIB_LIBS}
+
+AM_CPPFLAGS = \
+  -I${top_srcdir}/common \
+  -I${top_builddir}/common \
+  -I${top_srcdir}/libgnucash/engine \
+  -I${top_srcdir}/libgnucash/gnc-module \
+  -I${top_srcdir}/libgnucash/core-utils \
+  -I${top_srcdir}/libgnucash/app-utils \
+  -I${top_srcdir}/gnucash/gnome-utils \
+  -I${top_builddir}/gnucash/gnome-utils \
+  -I${top_srcdir}/gnucash/register/register-core \
+  -I${top_srcdir}/gnucash/register/register-gnome \
+  ${GUILE_CFLAGS} \
+  ${GTK_CFLAGS} \
+  ${GLIB_CFLAGS} \
+  ${GNOME_CFLAGS}
+
+
+AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.register.ledger\"
+
+EXTRA_DIST = CMakeLists.txt
diff --git a/src/register/ledger-core/gnc-ledger-display.c b/gnucash/register/ledger-core/gnc-ledger-display.c
similarity index 100%
rename from src/register/ledger-core/gnc-ledger-display.c
rename to gnucash/register/ledger-core/gnc-ledger-display.c
diff --git a/src/register/ledger-core/gnc-ledger-display.h b/gnucash/register/ledger-core/gnc-ledger-display.h
similarity index 100%
rename from src/register/ledger-core/gnc-ledger-display.h
rename to gnucash/register/ledger-core/gnc-ledger-display.h
diff --git a/src/register/ledger-core/gnc-ledger-display2.c b/gnucash/register/ledger-core/gnc-ledger-display2.c
similarity index 100%
rename from src/register/ledger-core/gnc-ledger-display2.c
rename to gnucash/register/ledger-core/gnc-ledger-display2.c
diff --git a/src/register/ledger-core/gnc-ledger-display2.h b/gnucash/register/ledger-core/gnc-ledger-display2.h
similarity index 100%
rename from src/register/ledger-core/gnc-ledger-display2.h
rename to gnucash/register/ledger-core/gnc-ledger-display2.h
diff --git a/gnucash/register/ledger-core/gncEntryLedger.c b/gnucash/register/ledger-core/gncEntryLedger.c
new file mode 100644
index 0000000..a4315a7
--- /dev/null
+++ b/gnucash/register/ledger-core/gncEntryLedger.c
@@ -0,0 +1,1080 @@
+/*
+ * gncEntryLedger.c -- a Ledger widget for entering GncEntry objects
+ * Copyright (C) 2001, 2002, 2003 Derek Atkins
+ * Author: Derek Atkins <warlord at MIT.EDU>
+ *
+ * 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 at gnu.org
+ */
+
+#include "config.h"
+
+#include <gtk/gtk.h>
+#include <glib/gi18n.h>
+
+#include "Account.h"
+#include "dialog-account.h"
+#include "dialog-utils.h"
+#include "gnc-ui-util.h"
+#include "combocell.h"
+#include "pricecell.h"
+#include "recncell.h"
+#include "checkboxcell.h"
+
+#include "gnc-component-manager.h"
+#include "gnc-ui.h"
+#include "gnc-warnings.h"
+
+#include "gncEntry.h"
+#include "gncEntryLedger.h"
+#include "gncEntryLedgerP.h"
+#include "gncEntryLedgerLayout.h"
+#include "gncEntryLedgerModel.h"
+#include "gncEntryLedgerControl.h"
+
+static QofLogModule log_module = "Business Entry Ledger";
+
+/** Static Functions ***************************************************/
+
+static void
+gnc_entry_ledger_clear_blank_entry (GncEntryLedger *ledger)
+{
+    GncEntry *entry;
+
+    if (!ledger) return;
+
+    entry = gnc_entry_ledger_get_blank_entry (ledger);
+    if (entry)
+    {
+        if (!gncEntryIsOpen (entry))
+            gncEntryBeginEdit (entry);
+        gncEntryDestroy (entry);
+    }
+
+    ledger->blank_entry_guid = *guid_null ();
+    ledger->blank_entry_edited = FALSE;
+}
+
+/** Exported Functions ***************************************************/
+
+GncEntry *
+gnc_entry_ledger_get_blank_entry (GncEntryLedger *ledger)
+{
+    if (!ledger) return NULL;
+    return gncEntryLookup (ledger->book, &(ledger->blank_entry_guid));
+}
+
+Account *
+gnc_entry_ledger_get_account_by_name (GncEntryLedger *ledger, BasicCell * bcell,
+                                      const char *name, gboolean *isnew)
+{
+    const char *placeholder = _("The account %s does not allow transactions.");
+    const char *missing = _("The account %s does not exist. "
+                            "Would you like to create it?");
+    char *account_name;
+    ComboCell *cell = (ComboCell *) bcell;
+    Account *account;
+    GList *account_types = NULL;
+
+    /* Find the account */
+    account = gnc_account_lookup_for_register (gnc_get_current_root_account (), name);
+
+    if (!account)
+    {
+        /* Ask if they want to create a new one. */
+        if (!gnc_verify_dialog (ledger->parent, TRUE, missing, name))
+            return NULL;
+
+        /* No changes, as yet. */
+        *isnew = FALSE;
+
+        /* User said yes, they want to create a new account. */
+        account_types = g_list_prepend (account_types, (gpointer)ACCT_TYPE_CREDIT);
+        account_types = g_list_prepend (account_types, (gpointer)ACCT_TYPE_ASSET);
+        account_types = g_list_prepend (account_types, (gpointer)ACCT_TYPE_LIABILITY);
+        if ( ledger->is_cust_doc )
+            account_types = g_list_prepend (account_types, (gpointer)ACCT_TYPE_INCOME);
+        else
+            account_types = g_list_prepend (account_types, (gpointer)ACCT_TYPE_EXPENSE);
+
+        account = gnc_ui_new_accounts_from_name_window_with_types (name, account_types);
+        g_list_free ( account_types );
+        if (!account)
+            return NULL;
+        *isnew = TRUE;
+
+        /* Now have a new account. Update the cell with the name as created. */
+        account_name = gnc_get_account_name_for_register (account);
+        gnc_combo_cell_set_value (cell, account_name);
+        gnc_basic_cell_set_changed (&cell->cell, TRUE);
+        g_free (account_name);
+    }
+
+    /* See if the account (either old or new) is a placeholder. */
+    if (xaccAccountGetPlaceholder (account))
+    {
+        gnc_error_dialog (ledger->parent, placeholder, name);
+    }
+
+    /* Be seeing you. */
+    return account;
+}
+
+Account * gnc_entry_ledger_get_account (GncEntryLedger *ledger,
+                                        const char * cell_name)
+{
+    BasicCell *cell;
+    const char * name;
+    gboolean dummy;
+
+    cell = gnc_table_layout_get_cell (ledger->table->layout, cell_name);
+    if (!cell)
+        return NULL;
+    name = gnc_basic_cell_get_value (cell);
+    return gnc_entry_ledger_get_account_by_name (ledger, cell, name, &dummy);
+}
+
+GncTaxTable * gnc_entry_ledger_get_taxtable (GncEntryLedger *ledger,
+        const char *cell_name)
+{
+    GncEntry *entry;
+    const char * name;
+
+    /* If the cursor has changed, then pull in the current table */
+    if (gnc_table_layout_get_cell_changed (ledger->table->layout,
+                                           cell_name, TRUE))
+    {
+        name = gnc_table_layout_get_cell_value (ledger->table->layout, cell_name);
+        return gncTaxTableLookupByName (ledger->book, name);
+    }
+
+    /* If it has not changed, pull in the table from the entry */
+    entry = gnc_entry_ledger_get_current_entry (ledger);
+    if (ledger->is_cust_doc)
+        return gncEntryGetInvTaxTable (entry);
+    else
+        return gncEntryGetBillTaxTable (entry);
+}
+
+gboolean gnc_entry_ledger_get_checkmark (GncEntryLedger *ledger,
+        const char * cell_name)
+{
+    CheckboxCell *cell =
+        (CheckboxCell *) gnc_table_layout_get_cell (ledger->table->layout, cell_name);
+
+    if (!cell)
+        return FALSE;
+
+    return cell->flag;
+}
+
+gint gnc_entry_ledger_get_type (GncEntryLedger *ledger, const char * cell_name)
+{
+    RecnCell *cell =
+        (RecnCell *) gnc_table_layout_get_cell (ledger->table->layout, cell_name);
+
+    if (!cell)
+        return -1;
+
+    return (gnc_recn_cell_get_flag (cell) - '0');
+}
+
+/* Return TRUE if value is valid, return FALSE if invalid */
+gboolean gnc_entry_ledger_get_numeric (GncEntryLedger *ledger,
+                                       const char *cell_name,
+                                       gnc_numeric *value)
+{
+    PriceCell *cell =
+        (PriceCell *) gnc_table_layout_get_cell (ledger->table->layout, cell_name);
+
+    if (!value || !cell)
+        return FALSE;
+
+    *value = gnc_price_cell_get_value (cell);
+    return TRUE;
+}
+
+
+GncEntry * gnc_entry_ledger_get_entry (GncEntryLedger *ledger,
+                                       VirtualCellLocation vcell_loc)
+{
+    GncGUID *guid;
+
+    if (!ledger) return NULL;
+
+    guid = gnc_table_get_vcell_data (ledger->table, vcell_loc);
+    if (!guid) return NULL;
+
+    return gncEntryLookup (ledger->book, guid);
+}
+
+/* Returns the Entry where the cursor is currently located. */
+GncEntry * gnc_entry_ledger_get_current_entry (GncEntryLedger *ledger)
+{
+    if (!ledger) return NULL;
+
+    return
+        gnc_entry_ledger_get_entry (ledger,
+                                    ledger->table->current_cursor_loc.vcell_loc);
+}
+
+static void gnc_entry_ledger_config_action (GncEntryLedger *ledger)
+{
+    ComboCell *cell;
+
+    cell = (ComboCell *) gnc_table_layout_get_cell (ledger->table->layout,
+            ENTRY_ACTN_CELL);
+    if (!cell) return;
+
+    /* XXX: change this based on the ledger type */
+
+    gnc_combo_cell_add_menu_item (cell, _("Hours"));
+    gnc_combo_cell_add_menu_item (cell, _("Project"));
+    gnc_combo_cell_add_menu_item (cell, _("Material"));
+}
+
+static void
+gnc_entry_ledger_config_cells (GncEntryLedger *ledger)
+{
+    /* the action cell */
+    gnc_combo_cell_set_autosize
+    ((ComboCell *)
+     gnc_table_layout_get_cell (ledger->table->layout, ENTRY_ACTN_CELL), TRUE);
+
+    /* The action cell should also accept strings not in the list */
+    gnc_combo_cell_set_strict
+    ((ComboCell *)
+     gnc_table_layout_get_cell (ledger->table->layout, ENTRY_ACTN_CELL), FALSE);
+
+    /* Use 6 decimal places for all prices and quantities */
+    gnc_price_cell_set_fraction
+    ((PriceCell *)
+     gnc_table_layout_get_cell (ledger->table->layout, ENTRY_PRIC_CELL),
+     1000000);
+
+    gnc_price_cell_set_fraction
+    ((PriceCell *)
+     gnc_table_layout_get_cell (ledger->table->layout, ENTRY_DISC_CELL),
+     1000000);
+
+    gnc_price_cell_set_fraction
+    ((PriceCell *) gnc_table_layout_get_cell (ledger->table->layout,
+            ENTRY_QTY_CELL),
+     1000000);
+
+    /* add menu items for the action and payment cells */
+    gnc_entry_ledger_config_action (ledger);
+}
+
+/* Create and return a new GncEntry Ledger */
+GncEntryLedger * gnc_entry_ledger_new (QofBook *book, GncEntryLedgerType type)
+{
+    GncEntryLedger *ledger;
+
+    if (!book) return NULL;
+    if (type < 0 || type >= GNCENTRY_NUM_REGISTER_TYPES) return NULL;
+
+    ledger = g_new0 (GncEntryLedger, 1);
+    ledger->type = type;
+    ledger->book = book;
+    ledger->traverse_to_new = TRUE;
+    ledger->prefs_group = NULL;
+
+    /* Orders and Invoices are "invoices" for lookups */
+    switch (type)
+    {
+    case GNCENTRY_ORDER_ENTRY:
+    case GNCENTRY_ORDER_VIEWER:
+    case GNCENTRY_INVOICE_ENTRY:
+    case GNCENTRY_INVOICE_VIEWER:
+        ledger->is_cust_doc = TRUE;
+        ledger->is_credit_note = FALSE;
+        break;
+    case GNCENTRY_BILL_ENTRY:
+    case GNCENTRY_BILL_VIEWER:
+    case GNCENTRY_EXPVOUCHER_ENTRY:
+    case GNCENTRY_EXPVOUCHER_VIEWER:
+    case GNCENTRY_NUM_REGISTER_TYPES:
+        ledger->is_cust_doc = FALSE;
+        ledger->is_credit_note = FALSE;
+        break;
+    case GNCENTRY_CUST_CREDIT_NOTE_ENTRY:
+    case GNCENTRY_CUST_CREDIT_NOTE_VIEWER:
+        ledger->is_cust_doc = TRUE;
+        ledger->is_credit_note = TRUE;
+        break;
+    case GNCENTRY_VEND_CREDIT_NOTE_ENTRY:
+    case GNCENTRY_VEND_CREDIT_NOTE_VIEWER:
+    case GNCENTRY_EMPL_CREDIT_NOTE_ENTRY:
+    case GNCENTRY_EMPL_CREDIT_NOTE_VIEWER:
+        ledger->is_cust_doc = FALSE;
+        ledger->is_credit_note = TRUE;
+        break;
+    default:
+	PWARN ("Bad GncEntryLedgerType");
+	g_free (ledger);
+	return NULL;
+	break;
+    }
+
+    ledger->blank_entry_guid = *guid_null();
+    ledger->blank_entry_edited = FALSE;
+
+    {
+        GDate *today = gnc_g_date_new_today();
+        ledger->last_date_entered = *today;
+        g_date_free(today);
+    }
+
+    {
+        TableLayout *layout = gnc_entry_ledger_layout_new (ledger);
+        TableModel *model = gnc_entry_ledger_model_new (type);
+        TableControl *control = gnc_entry_ledger_control_new ();
+        model->handler_user_data = ledger;
+        control->user_data = ledger;
+
+        ledger->table = gnc_table_new (layout, model, control);
+    }
+
+    gnc_entry_ledger_config_cells (ledger);
+
+    /* set up header */
+    {
+        VirtualCellLocation vcell_loc = { 0, 0 };
+        CellBlock *header;
+
+        header = gnc_table_layout_get_cursor (ledger->table->layout, CURSOR_HEADER);
+
+        gnc_table_set_vcell (ledger->table, header, NULL, TRUE, TRUE, vcell_loc);
+    }
+
+    /* set up first initial row */
+    {
+        VirtualLocation vloc;
+        CellBlock *cursor;
+
+        vloc.vcell_loc.virt_row = 1;
+        vloc.vcell_loc.virt_col = 0;
+        vloc.phys_row_offset = 0;
+        vloc.phys_col_offset = 0;
+
+        cursor = gnc_table_layout_get_cursor (ledger->table->layout, "cursor");
+
+        gnc_table_set_vcell (ledger->table, cursor, NULL, TRUE, TRUE, vloc.vcell_loc);
+
+        if (gnc_table_find_close_valid_cell (ledger->table, &vloc, FALSE))
+            gnc_table_move_cursor (ledger->table, vloc);
+        else
+        {
+            g_warning ("Can't find valid initial location");
+        }
+    }
+
+    /* Initialize Display */
+    gnc_entry_ledger_display_init (ledger);
+    if (qof_book_is_readonly(ledger->book))
+    {
+        gnc_entry_ledger_set_readonly(ledger, TRUE);
+    }
+    return ledger;
+}
+
+/* Destroy the GncEntry Ledger */
+void gnc_entry_ledger_destroy (GncEntryLedger *ledger)
+{
+    if (!ledger) return;
+
+    /* Destroy blank entry, etc. */
+    gnc_entry_ledger_clear_blank_entry (ledger);
+    gnc_entry_ledger_display_fini (ledger);
+    gnc_table_destroy (ledger->table);
+    qof_query_destroy (ledger->query);
+    g_free (ledger);
+}
+
+Table * gnc_entry_ledger_get_table (GncEntryLedger *ledger)
+{
+    if (!ledger) return NULL;
+    return ledger->table;
+}
+
+void gnc_entry_ledger_set_default_order (GncEntryLedger *ledger,
+        GncOrder *order)
+{
+    if (!ledger) return;
+    ledger->order = order;
+
+    if (!ledger->query && order)
+    {
+        ledger->query = qof_query_create_for (GNC_ENTRY_MODULE_NAME);
+        qof_query_set_book (ledger->query, gncOrderGetBook (order));
+        qof_query_add_guid_match (ledger->query,
+                                  g_slist_prepend (g_slist_prepend (NULL,
+                                          QOF_PARAM_GUID),
+                                          ENTRY_ORDER),
+                                  gncOrderGetGUID (order), QOF_QUERY_AND);
+    }
+    gnc_entry_ledger_display_refresh (ledger);
+}
+
+static void create_invoice_query (GncEntryLedger *ledger)
+{
+    QofQuery *q, *q1;
+    char * type = NULL;
+
+    if (!ledger->invoice)
+        return;
+
+    if (ledger->query)
+        qof_query_destroy (ledger->query);
+
+    /* Match:   (where I-TYPE == Invoice or Bill)
+     *
+     * 1. book AND
+     * 2.   ( Entry->I-TYPE == ledger->invoice
+     * #if I-TYPE == Invoice/Cust Credit Note (entry only)
+     *        OR
+     * 3.     ( Entry->Invoice == NULL AND
+     *          ( Entry->Billable == TRUE AND
+     *            Entry->Bill->Is-Posted? == TRUE AND
+     *            ( Entry->BillTo == Invoice->parent OR
+     *              ( Entry->BillTo == NULL AND Entry->Bill->BillTo == Invoice->parent ) ) )
+     *           OR
+     *           ( Entry->Order->real-parent == Invoice->parent ) )
+     * #endif
+     *      )
+     *
+     * Note that term 3 is only for Editable invoices.
+     */
+
+    /* Term 1 */
+    ledger->query = qof_query_create_for (GNC_ENTRY_MODULE_NAME);
+    qof_query_set_book (ledger->query, gncInvoiceGetBook (ledger->invoice));
+
+    /* Term 2 */
+    switch (ledger->type)
+    {
+    case GNCENTRY_INVOICE_ENTRY:
+    case GNCENTRY_INVOICE_VIEWER:
+    case GNCENTRY_CUST_CREDIT_NOTE_ENTRY:
+    case GNCENTRY_CUST_CREDIT_NOTE_VIEWER:
+        type = ENTRY_INVOICE;
+        break;
+    case GNCENTRY_BILL_ENTRY:
+    case GNCENTRY_BILL_VIEWER:
+    case GNCENTRY_EXPVOUCHER_ENTRY:
+    case GNCENTRY_EXPVOUCHER_VIEWER:
+    case GNCENTRY_VEND_CREDIT_NOTE_ENTRY:
+    case GNCENTRY_VEND_CREDIT_NOTE_VIEWER:
+    case GNCENTRY_EMPL_CREDIT_NOTE_ENTRY:
+    case GNCENTRY_EMPL_CREDIT_NOTE_VIEWER:
+        type = ENTRY_BILL;
+        break;
+    default:
+        g_warning ("Invalid Ledger type");
+        type = ENTRY_INVOICE;
+        break;
+    }
+
+    q = qof_query_create_for (GNC_ENTRY_MODULE_NAME);
+    qof_query_add_guid_match (q, qof_query_build_param_list (type, QOF_PARAM_GUID, NULL),
+                              gncInvoiceGetGUID (ledger->invoice), QOF_QUERY_OR);
+
+    /* Term 3 */
+    if ((ledger->type == GNCENTRY_INVOICE_ENTRY ||
+            ledger->type == GNCENTRY_CUST_CREDIT_NOTE_ENTRY) &&
+            gncOwnerGetEndGUID (gncInvoiceGetOwner (ledger->invoice)) != NULL)
+    {
+
+        const GncGUID *invoice_parent =
+            gncOwnerGetGUID (gncInvoiceGetOwner (ledger->invoice));
+        QofQuery *q2 = qof_query_create_for (GNC_ENTRY_MODULE_NAME);
+
+        /*
+         * Entry->BillTo == Invoice->parent OR
+         * ( Entry->BillTo == NULL AND Entry->Bill->BillTo == Invoice->parent )
+         */
+
+        qof_query_add_guid_match (q2, qof_query_build_param_list (ENTRY_BILLTO,
+                                  QOF_PARAM_GUID, NULL),
+                                  NULL, QOF_QUERY_AND);
+        qof_query_add_guid_match (q2, qof_query_build_param_list (ENTRY_BILL, INVOICE_BILLTO,
+                                  QOF_PARAM_GUID, NULL),
+                                  invoice_parent, QOF_QUERY_AND);
+        qof_query_add_guid_match (q2, qof_query_build_param_list (ENTRY_BILLTO,
+                                  QOF_PARAM_GUID, NULL),
+                                  invoice_parent, QOF_QUERY_OR);
+
+        /* Entry->Billable == TRUE AND Entry->Bill->Is-Posted? == TRUE */
+        qof_query_add_boolean_match (q2, qof_query_build_param_list (ENTRY_BILLABLE, NULL),
+                                     TRUE, QOF_QUERY_AND);
+        qof_query_add_boolean_match (q2, qof_query_build_param_list (ENTRY_BILL,
+                                     INVOICE_IS_POSTED, NULL),
+                                     TRUE, QOF_QUERY_AND);
+
+        /* Entry->Order->real-parent == Invoice->parent */
+        qof_query_add_guid_match (q2, qof_query_build_param_list (ENTRY_ORDER, ORDER_OWNER,
+                                  OWNER_PARENTG, NULL),
+                                  invoice_parent, QOF_QUERY_OR);
+
+        /* Entry->Invoice == NULL */
+        qof_query_add_guid_match (q2, qof_query_build_param_list (ENTRY_INVOICE,
+                                  QOF_PARAM_GUID, NULL),
+                                  NULL, QOF_QUERY_AND);
+
+
+        /* Combine terms 2 and 3 */
+        q1 = qof_query_merge (q, q2, QOF_QUERY_OR);
+        qof_query_destroy (q);
+        qof_query_destroy (q2);
+        q = q1;
+    }
+
+    /* Combine terms 1 and 2 */
+    q1 = qof_query_merge (ledger->query, q, QOF_QUERY_AND);
+    qof_query_destroy (q);
+    qof_query_destroy (ledger->query);
+    ledger->query = q1;
+}
+
+void gnc_entry_ledger_set_default_invoice (GncEntryLedger *ledger,
+        GncInvoice *invoice)
+{
+    if (!ledger) return;
+    ledger->invoice = invoice;
+
+    /* For bills only, set the default date for new entries
+     * to the bill's opened date. This saves a lot of typing when
+     * adding bills on a day different from the bill's own date.
+     * Note this is for bills only, because for (customer's) invoices
+     * it makes more sense to use the current date.
+     * Consult https://bugzilla.gnome.org/show_bug.cgi?id=646541
+     * to understand why.
+     */
+    if (gncInvoiceGetOwnerType (invoice) == GNC_OWNER_VENDOR)
+        ledger->last_date_entered = timespec_to_gdate(gncInvoiceGetDateOpened (invoice));
+
+    if (!ledger->query && invoice)
+        create_invoice_query (ledger);
+
+    gnc_entry_ledger_display_refresh (ledger);
+}
+
+void gnc_entry_ledger_reset_query (GncEntryLedger *ledger)
+{
+    if (!ledger) return;
+    if (!ledger->invoice) return;
+
+    create_invoice_query (ledger);
+    gnc_entry_ledger_display_refresh (ledger);
+}
+
+void gnc_entry_ledger_set_parent (GncEntryLedger *ledger, GtkWidget *parent)
+{
+    if (!ledger) return;
+    ledger->parent = parent;
+}
+
+gboolean gnc_entry_ledger_find_entry (GncEntryLedger *ledger, GncEntry *entry,
+                                      VirtualCellLocation *vcell_loc)
+{
+    Table *table = ledger->table;
+    int v_row;
+    GncEntry *e;
+
+    for (v_row = 1; v_row < table->num_virt_rows; v_row++)
+    {
+        VirtualCellLocation vc_loc = { v_row, 0 };
+
+        e = gnc_entry_ledger_get_entry (ledger, vc_loc);
+
+        if (e == entry)
+        {
+            if (vcell_loc != NULL)
+                *vcell_loc = vc_loc;
+            return TRUE;
+        }
+    }
+    return FALSE;
+}
+
+void gnc_entry_ledger_set_readonly (GncEntryLedger *ledger, gboolean readonly)
+{
+    if (!ledger) return;
+    if (!readonly && qof_book_is_readonly(ledger->book)) return;
+
+    /* reset the ledger type appropriately */
+    if (readonly)
+    {
+        switch (ledger->type)
+        {
+        case GNCENTRY_ORDER_ENTRY:
+            ledger->type = GNCENTRY_ORDER_VIEWER;
+            break;
+        case GNCENTRY_INVOICE_ENTRY:
+            ledger->type = GNCENTRY_INVOICE_VIEWER;
+            create_invoice_query (ledger);
+            break;
+        case GNCENTRY_BILL_ENTRY:
+            ledger->type = GNCENTRY_BILL_VIEWER;
+            create_invoice_query (ledger);
+            break;
+        case GNCENTRY_EXPVOUCHER_ENTRY:
+            ledger->type = GNCENTRY_EXPVOUCHER_VIEWER;
+            create_invoice_query (ledger);
+            break;
+        case GNCENTRY_CUST_CREDIT_NOTE_ENTRY:
+            ledger->type = GNCENTRY_CUST_CREDIT_NOTE_VIEWER;
+            create_invoice_query (ledger);
+            break;
+        case GNCENTRY_VEND_CREDIT_NOTE_ENTRY:
+            ledger->type = GNCENTRY_VEND_CREDIT_NOTE_VIEWER;
+            create_invoice_query (ledger);
+            break;
+        case GNCENTRY_EMPL_CREDIT_NOTE_ENTRY:
+            ledger->type = GNCENTRY_EMPL_CREDIT_NOTE_VIEWER;
+            create_invoice_query (ledger);
+            break;
+        default:
+            return;        /* Nothing to do */
+        }
+    }
+    else
+    {
+        switch (ledger->type)
+        {
+        case GNCENTRY_ORDER_VIEWER:
+            ledger->type = GNCENTRY_ORDER_ENTRY;
+            break;
+        case GNCENTRY_INVOICE_VIEWER:
+            ledger->type = GNCENTRY_INVOICE_ENTRY;
+            create_invoice_query (ledger);
+            break;
+        case GNCENTRY_BILL_VIEWER:
+            ledger->type = GNCENTRY_BILL_ENTRY;
+            create_invoice_query (ledger);
+            break;
+        case GNCENTRY_EXPVOUCHER_VIEWER:
+            ledger->type = GNCENTRY_EXPVOUCHER_ENTRY;
+            create_invoice_query (ledger);
+            break;
+        case GNCENTRY_CUST_CREDIT_NOTE_VIEWER:
+            ledger->type = GNCENTRY_CUST_CREDIT_NOTE_ENTRY;
+            create_invoice_query (ledger);
+            break;
+        case GNCENTRY_VEND_CREDIT_NOTE_VIEWER:
+            ledger->type = GNCENTRY_VEND_CREDIT_NOTE_ENTRY;
+            create_invoice_query (ledger);
+            break;
+        case GNCENTRY_EMPL_CREDIT_NOTE_VIEWER:
+            ledger->type = GNCENTRY_EMPL_CREDIT_NOTE_ENTRY;
+            create_invoice_query (ledger);
+            break;
+        default:
+            return;        /* Nothing to do */
+        }
+    }
+
+    /* reset the model */
+    gnc_table_model_set_read_only (ledger->table->model, readonly);
+
+    /* if readonly is TRUE, get rid of the blank entry. */
+    if (readonly)
+        gnc_entry_ledger_clear_blank_entry (ledger);
+
+    /* and refresh the display */
+    gnc_entry_ledger_display_refresh (ledger);
+}
+
+gboolean
+gnc_entry_ledger_changed (GncEntryLedger *ledger)
+{
+    if (!ledger)
+        return FALSE;
+
+    if (gnc_table_current_cursor_changed (ledger->table, FALSE))
+        return TRUE;
+
+    return FALSE;
+}
+
+void
+gnc_entry_ledger_compute_value (GncEntryLedger *ledger,
+                                gnc_numeric *value, gnc_numeric *tax_value)
+{
+    gnc_numeric qty, price, discount;
+    gint disc_type, disc_how;
+    gboolean taxable, taxincluded;
+    GncTaxTable *table;
+    GList *taxes = NULL;
+    int denom = 100;
+
+    gnc_entry_ledger_get_numeric (ledger, ENTRY_QTY_CELL, &qty);
+    gnc_entry_ledger_get_numeric (ledger, ENTRY_PRIC_CELL, &price);
+    gnc_entry_ledger_get_numeric (ledger, ENTRY_DISC_CELL, &discount);
+
+    disc_type = gnc_entry_ledger_get_type (ledger, ENTRY_DISTYPE_CELL);
+    disc_how = gnc_entry_ledger_get_type (ledger, ENTRY_DISHOW_CELL);
+
+    /* Bills and exp-vouchers dont have discounts */
+    if (ledger->type == GNCENTRY_BILL_ENTRY ||
+            ledger->type == GNCENTRY_BILL_VIEWER ||
+            ledger->type == GNCENTRY_EXPVOUCHER_ENTRY ||
+            ledger->type == GNCENTRY_EXPVOUCHER_VIEWER)
+    {
+        g_assert (gnc_numeric_zero_p (discount));
+        disc_type = GNC_AMT_TYPE_VALUE;
+        disc_how = GNC_DISC_PRETAX;
+    }
+
+
+    /* If we're so early in the process that we don't have info, stop now */
+    if (disc_type < 0 || disc_how < 0)
+    {
+        if (value)
+            *value = gnc_numeric_zero ();
+        if (tax_value)
+            *tax_value = gnc_numeric_zero ();
+        return;
+    }
+
+    taxable = gnc_entry_ledger_get_checkmark (ledger, ENTRY_TAXABLE_CELL);
+    taxincluded = gnc_entry_ledger_get_checkmark (ledger, ENTRY_TAXINCLUDED_CELL);
+    table = gnc_entry_ledger_get_taxtable (ledger, ENTRY_TAXTABLE_CELL);
+
+    /* Expense vouchers don't have taxable, taxincluded, or taxtable cells, either */
+    if (ledger->type == GNCENTRY_EXPVOUCHER_ENTRY ||
+            ledger->type == GNCENTRY_EXPVOUCHER_VIEWER)
+    {
+        taxable = FALSE;
+        taxincluded = FALSE;
+        table = NULL;
+    }
+
+    if (ledger->invoice)
+    {
+        gnc_commodity *currency = gncInvoiceGetCurrency(ledger->invoice);
+        if (currency)
+            denom = gnc_commodity_get_fraction(currency);
+    }
+
+    gncEntryComputeValue (qty, price, (taxable ? table : NULL), taxincluded,
+                          discount, disc_type, disc_how, denom,
+                          value, NULL, &taxes);
+
+    /* return the tax value */
+    if (tax_value)
+        *tax_value = gncAccountValueTotal (taxes);
+}
+
+gboolean
+gnc_entry_ledger_get_entry_virt_loc (GncEntryLedger *ledger, const GncEntry *entry,
+                                     VirtualCellLocation *vcell_loc)
+{
+    Table *table;
+    int v_row;
+    int v_col;
+
+    if ((ledger == NULL) || (entry == NULL))
+        return FALSE;
+    g_assert(vcell_loc);
+
+    table = ledger->table;
+
+    /* go backwards because typically you search for entries at the end */
+
+    for (v_row = table->num_virt_rows - 1; v_row > 0; v_row--)
+        for (v_col = 0; v_col < table->num_virt_cols; v_col++)
+        {
+            VirtualCellLocation vc_loc = { v_row, v_col };
+            VirtualCell *vcell;
+            GncEntry *e;
+
+            vcell = gnc_table_get_virtual_cell (table, vc_loc);
+            if (vcell == NULL)
+                continue;
+
+            if (!vcell->visible)
+                continue;
+
+            e = gncEntryLookup (ledger->book, vcell->vcell_data);
+
+            if (e == entry)
+            {
+                if (vcell_loc)
+                    *vcell_loc = vc_loc;
+
+                return TRUE;
+            }
+        }
+
+    return FALSE;
+}
+
+void
+gnc_entry_ledger_delete_current_entry (GncEntryLedger *ledger)
+{
+    GncEntry *entry;
+
+    if (!ledger)
+        return;
+
+    /* If there is no entry, just return */
+    entry = gnc_entry_ledger_get_current_entry (ledger);
+    if (!entry)
+        return;
+
+    /* If this is the blank entry, just cancel the changes */
+    if (entry == gnc_entry_ledger_get_blank_entry (ledger))
+    {
+        gnc_entry_ledger_cancel_cursor_changes (ledger);
+        return;
+    }
+
+    /* Ok, let's delete this entry */
+    gnc_suspend_gui_refresh ();
+    if (!gncEntryIsOpen (entry))
+        gncEntryBeginEdit (entry);
+
+    {
+        GncOrder *order;
+        GncInvoice *invoice;
+
+        order = gncEntryGetOrder (entry);
+        if (order)
+            gncOrderRemoveEntry (order, entry);
+
+        invoice = gncEntryGetInvoice (entry);
+        if (invoice)
+            gncInvoiceRemoveEntry (invoice, entry);
+
+        invoice = gncEntryGetBill (entry);
+        if (invoice)
+            gncBillRemoveEntry (invoice, entry);
+
+        gncEntryDestroy (entry);
+    }
+    gnc_resume_gui_refresh ();
+}
+
+void
+gnc_entry_ledger_duplicate_current_entry (GncEntryLedger *ledger)
+{
+    GncEntry *entry;
+    gboolean changed;
+
+    if (!ledger)
+        return;
+
+    /* Be paranoid */
+    entry = gnc_entry_ledger_get_current_entry (ledger);
+    if (!entry)
+        return;
+
+    changed = gnc_table_current_cursor_changed (ledger->table, FALSE);
+
+    /* See if we're asked to duplicate an unchanged blank entry --
+     * there is no point in doing that.
+     */
+    if (!changed && entry == gnc_entry_ledger_get_blank_entry (ledger))
+        return;
+
+    gnc_suspend_gui_refresh ();
+
+    /* If the cursor has been edited, we are going to have to commit
+     * it before we can duplicate. Make sure the user wants to do that. */
+    if (changed)
+    {
+        const char *title = _("Save the current entry?");
+        const char *message =
+            _("The current transaction has been changed. Would you like to "
+              "record the changes before duplicating this entry, or "
+              "cancel the duplication?");
+        GtkWidget *dialog;
+        gint response;
+
+        dialog = gtk_message_dialog_new(GTK_WINDOW(ledger->parent),
+                                        GTK_DIALOG_DESTROY_WITH_PARENT,
+                                        GTK_MESSAGE_QUESTION,
+                                        GTK_BUTTONS_NONE,
+                                        "%s", title);
+        gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
+                "%s", message);
+        gtk_dialog_add_buttons(GTK_DIALOG(dialog),
+                               _("_Cancel"), GTK_RESPONSE_CANCEL,
+                               _("_Record"), GTK_RESPONSE_ACCEPT,
+                               NULL);
+        response = gnc_dialog_run(GTK_DIALOG(dialog), GNC_PREF_WARN_INV_ENTRY_DUP);
+        gtk_widget_destroy(dialog);
+
+        if (response != GTK_RESPONSE_ACCEPT)
+        {
+            gnc_resume_gui_refresh ();
+            return;
+        }
+
+        if (!gnc_entry_ledger_commit_entry (ledger))
+        {
+            gnc_resume_gui_refresh ();
+            return;
+        }
+    }
+
+    /* Ok, we're ready to make the copy */
+    {
+        GncEntry * new_entry;
+
+        new_entry = gncEntryCreate (ledger->book);
+        gncEntryCopy (entry, new_entry, TRUE);
+        gncEntrySetDateGDate (new_entry, &ledger->last_date_entered);
+
+        /* We also must set a new DateEntered on the new entry
+         * because otherwise the ordering is not deterministic */
+        gncEntrySetDateEntered (new_entry, timespec_now());
+
+        /* Set the hint for where to display on the refresh */
+        ledger->hint_entry = new_entry;
+    }
+
+    gnc_resume_gui_refresh ();
+    return;
+}
+
+QofQuery *
+gnc_entry_ledger_get_query (GncEntryLedger *ledger)
+{
+    if (!ledger)
+        return NULL;
+
+    return ledger->query;
+}
+
+void
+gnc_entry_ledger_set_prefs_group (GncEntryLedger *ledger, const gchar *string)
+{
+    if (!ledger)
+        return;
+
+    ledger->prefs_group = string;
+}
+
+void gnc_entry_ledger_move_current_entry_updown (GncEntryLedger *ledger,
+        gboolean move_up)
+{
+    GncEntry *blank, *current, *target;
+    VirtualCellLocation vcell_loc;
+
+    g_assert(ledger);
+
+    blank = gnc_entry_ledger_get_blank_entry(ledger);
+    if (!blank)
+        return;
+
+    /* Ensure we have a valid current GncEntry and it isn't the blank
+     * entry */
+    current = gnc_entry_ledger_get_current_entry(ledger);
+    if (!current || current == blank)
+        return;
+
+    /* Obtain the GncEntry at the up or down virtual table location */
+    vcell_loc = ledger->table->current_cursor_loc.vcell_loc;
+    if (move_up)
+    {
+        if (vcell_loc.virt_row == 0)
+            return;
+        vcell_loc.virt_row--;
+    }
+    else
+    {
+        vcell_loc.virt_row++;
+    }
+
+    /* Ensure we have a valid other GncEntry and it isn't the blank
+     * entry */
+    target = gnc_entry_ledger_get_entry(ledger, vcell_loc);
+    if (!target || target == blank)
+        return;
+
+    /* Also, only continue if both have the same date, because the
+     * "standard ordering" is tied to the date anyway. Note: This
+     * unfortunately prevents the user from changing the ordering if
+     * he has chosen a different sort order and the sort key happens
+     * to be equal among the two entries. But I don't know how to look
+     * up the current sort ordering from here, so I cowardly refuse to
+     * tweak the EntryDate in this case. */
+    {
+        Timespec t1, t2;
+        GDate d1 = gncEntryGetDateGDate(current),
+              d2 = gncEntryGetDateGDate(target);
+        if (g_date_compare(&d1, &d2) != 0)
+            return;
+
+        /* Special treatment if the equality doesn't hold if we access the
+        dates as timespec. See the comment in gncEntrySetDateGDate() for the
+        reason: Some code used the timespec at noon for the EntryDate, other
+        code used the timespec at the start of day. */
+        t1 = gncEntryGetDate(current);
+        t2 = gncEntryGetDate(target);
+        if (!timespec_equal(&t1, &t2))
+        {
+            /* Timespecs are not equal, even though the GDates were equal? Then
+            we set the GDates again. This will force the timespecs to be equal
+            as well. */
+            gncEntrySetDateGDate(current, &d1);
+            gncEntrySetDateGDate(target, &d2);
+        }
+    }
+
+    /*g_warning("Ok, current desc='%s' target desc='%s'",
+              gncEntryGetDescription(current),
+              gncEntryGetDescription(target));*/
+
+    gnc_suspend_gui_refresh ();
+
+    /* Swap the date-entered of both entries. That's already
+     * sufficient! */
+    {
+        Timespec time_current = gncEntryGetDateEntered(current);
+        Timespec time_target = gncEntryGetDateEntered(target);
+
+        /* Special treatment for identical times (potentially caused
+         * by the "duplicate entry" command) */
+        if (timespec_equal(&time_current, &time_target))
+        {
+            /*g_warning("Surprise - both DateEntered are equal.");*/
+            /* We just increment the DateEntered of the previously
+             * lower of the two by one second. This might still cause
+             * issues if multiple entries had this problem, but
+             * whatever. */
+            if (move_up)
+                time_current.tv_sec++;
+            else
+                time_target.tv_sec++;
+        }
+
+        /* Write the new DateEntered. */
+        gncEntrySetDateEntered(current, time_target);
+        gncEntrySetDateEntered(target, time_current);
+
+        /* And finally let the GncInvoice sort its entries
+         * accordingly, so that the invoice reports will give the same
+         * ordering as the register window. */
+        gncInvoiceSortEntries(ledger->invoice);
+    }
+
+    gnc_resume_gui_refresh ();
+}
diff --git a/src/register/ledger-core/gncEntryLedger.h b/gnucash/register/ledger-core/gncEntryLedger.h
similarity index 100%
rename from src/register/ledger-core/gncEntryLedger.h
rename to gnucash/register/ledger-core/gncEntryLedger.h
diff --git a/gnucash/register/ledger-core/gncEntryLedgerControl.c b/gnucash/register/ledger-core/gncEntryLedgerControl.c
new file mode 100644
index 0000000..fa23b99
--- /dev/null
+++ b/gnucash/register/ledger-core/gncEntryLedgerControl.c
@@ -0,0 +1,1049 @@
+/** \file gncEntryLedgerControl.c
+ * \brief Control for GncEntry ledger
+ *
+ * Copyright (C) 2001, 2002, 2003 Derek Atkins
+ * Author: Derek Atkins <warlord at MIT.EDU>
+ * Copyright (C) 2010 Christian Stimming <christian at cstimming.de> */
+/*
+ * 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 at gnu.org
+ */
+
+#include "config.h"
+
+#include <glib.h>
+#include <glib/gi18n.h>
+
+#include "Account.h"
+#include "combocell.h"
+#include "dialog-account.h"
+#include "dialog-utils.h"
+#include "gnc-component-manager.h"
+#include "gnc-prefs.h"
+#include "gnc-ui.h"
+#include "gnc-ui-util.h"
+#include "gnc-gui-query.h"
+#include "gnc-warnings.h"
+#include "table-allgui.h"
+#include "pricecell.h"
+#include "dialog-tax-table.h"
+#include "checkboxcell.h"
+
+#include "gncEntryLedgerP.h"
+#include "gncEntryLedgerControl.h"
+
+
+static gboolean
+gnc_entry_ledger_save (GncEntryLedger *ledger, gboolean do_commit)
+{
+    GncEntry *blank_entry;
+    GncEntry *entry;
+
+    if (!ledger) return FALSE;
+
+    blank_entry = gnc_entry_ledger_get_blank_entry (ledger);
+
+    entry = gnc_entry_ledger_get_current_entry (ledger);
+    if (entry == NULL) return FALSE;
+
+    /* Try to avoid heavy-weight updates if nothing has changed */
+    if (!gnc_table_current_cursor_changed (ledger->table, FALSE))
+    {
+        if (!do_commit) return FALSE;
+
+        if (entry == blank_entry)
+        {
+            if (ledger->blank_entry_edited)
+            {
+                ledger->last_date_entered = gncEntryGetDateGDate (entry);
+                ledger->blank_entry_guid = *guid_null ();
+                ledger->blank_entry_edited = FALSE;
+                blank_entry = NULL;
+            }
+            else
+                return FALSE;
+        }
+
+        return TRUE;
+    }
+
+    gnc_suspend_gui_refresh ();
+
+    if (!gncEntryIsOpen (entry))
+        gncEntryBeginEdit (entry);
+
+    gnc_table_save_cells (ledger->table, entry);
+
+    if (entry == blank_entry)
+    {
+        Timespec ts;
+        ts.tv_sec = gnc_time (NULL);
+        ts.tv_nsec = 0;
+        gncEntrySetDateEntered (blank_entry, ts);
+
+        switch (ledger->type)
+        {
+        case GNCENTRY_ORDER_ENTRY:
+            gncOrderAddEntry (ledger->order, blank_entry);
+            break;
+        case GNCENTRY_INVOICE_ENTRY:
+        case GNCENTRY_CUST_CREDIT_NOTE_ENTRY:
+            /* Anything entered on an invoice entry must be part of the invoice! */
+            gncInvoiceAddEntry (ledger->invoice, blank_entry);
+            break;
+        case GNCENTRY_BILL_ENTRY:
+        case GNCENTRY_EXPVOUCHER_ENTRY:
+        case GNCENTRY_VEND_CREDIT_NOTE_ENTRY:
+        case GNCENTRY_EMPL_CREDIT_NOTE_ENTRY:
+            /* Anything entered on an invoice entry must be part of the invoice! */
+            gncBillAddEntry (ledger->invoice, blank_entry);
+            break;
+        default:
+            /* Nothing to do for viewers */
+            g_warning ("blank entry traversed in a viewer");
+            break;
+        }
+    }
+
+    if (entry == blank_entry)
+    {
+        if (do_commit)
+        {
+            ledger->blank_entry_guid = *guid_null ();
+            blank_entry = NULL;
+            ledger->last_date_entered = gncEntryGetDateGDate (entry);
+        }
+        else
+            ledger->blank_entry_edited = TRUE;
+    }
+
+    if (do_commit)
+        gncEntryCommitEdit (entry);
+
+    gnc_table_clear_current_cursor_changes (ledger->table);
+
+    gnc_resume_gui_refresh ();
+
+    return TRUE;
+}
+
+static gboolean
+gnc_entry_ledger_verify_acc_cell_ok (GncEntryLedger *ledger,
+                                     const char *cell_name,
+                                     const char *cell_msg)
+{
+    ComboCell *cell;
+    const char *name;
+
+    cell = (ComboCell *) gnc_table_layout_get_cell (ledger->table->layout,
+            cell_name);
+    g_return_val_if_fail (cell, TRUE);
+    name = cell->cell.value;
+    if (!name || *name == '\0')
+    {
+        const char *format = ("%s %s");
+        const char *gen_msg = _("Invalid Entry: You need to supply an account in the right currency for this position.");
+
+        gnc_error_dialog (ledger->parent, format, gen_msg, cell_msg);
+        return FALSE;
+    }
+    return TRUE;
+}
+
+/** Verify whether we can save the entry, or warn the user when we can't
+ * return TRUE if we can save, FALSE if there is a problem
+ */
+static gboolean
+gnc_entry_ledger_verify_can_save (GncEntryLedger *ledger)
+{
+    gnc_numeric value;
+
+    /* Compute the value and tax value of the current cursor */
+    gnc_entry_ledger_compute_value (ledger, &value, NULL);
+
+    /* If there is a value, make sure there is an account */
+    if (! gnc_numeric_zero_p (value))
+    {
+        switch (ledger->type)
+        {
+        case GNCENTRY_INVOICE_ENTRY:
+        case GNCENTRY_CUST_CREDIT_NOTE_ENTRY:
+            if (!gnc_entry_ledger_verify_acc_cell_ok (ledger, ENTRY_IACCT_CELL,
+                    _("This account should usually be of type income.")))
+                return FALSE;
+            break;
+        case GNCENTRY_BILL_ENTRY:
+        case GNCENTRY_EXPVOUCHER_ENTRY:
+        case GNCENTRY_VEND_CREDIT_NOTE_ENTRY:
+        case GNCENTRY_EMPL_CREDIT_NOTE_ENTRY:
+            if (!gnc_entry_ledger_verify_acc_cell_ok (ledger, ENTRY_BACCT_CELL,
+                    _("This account should usually be of type expense or asset.")))
+                return FALSE;
+            break;
+        default:
+            g_warning ("Unhandled ledger type");
+            break;
+        }
+    }
+
+    return TRUE;
+}
+
+static void gnc_entry_ledger_move_cursor (VirtualLocation *p_new_virt_loc,
+        gpointer user_data)
+{
+    GncEntryLedger *ledger = user_data;
+    VirtualLocation new_virt_loc = *p_new_virt_loc;
+    GncEntry *new_entry;
+    GncEntry *old_entry;
+    gboolean saved;
+
+    if (!ledger) return;
+
+    old_entry = gnc_entry_ledger_get_current_entry (ledger);
+    new_entry = gnc_entry_ledger_get_entry (ledger, new_virt_loc.vcell_loc);
+
+    gnc_suspend_gui_refresh ();
+    saved = gnc_entry_ledger_save (ledger, old_entry != new_entry);
+    gnc_resume_gui_refresh ();
+
+    /* redrawing can muck everything up */
+    if (saved)
+    {
+        VirtualCellLocation vcell_loc;
+
+        /* redraw */
+        gnc_entry_ledger_display_refresh (ledger);
+
+        if (ledger->traverse_to_new)
+            new_entry = gnc_entry_ledger_get_blank_entry (ledger);
+
+        /* if the entry we were going to is still in the register,
+         * then it may have moved. Find out where it is now. */
+        if (gnc_entry_ledger_find_entry (ledger, new_entry, &vcell_loc))
+        {
+            gnc_table_get_virtual_cell (ledger->table, vcell_loc);
+            new_virt_loc.vcell_loc = vcell_loc;
+        }
+        else
+            new_virt_loc.vcell_loc = ledger->table->current_cursor_loc.vcell_loc;
+    }
+
+    gnc_table_find_close_valid_cell (ledger->table, &new_virt_loc, FALSE);
+
+    *p_new_virt_loc = new_virt_loc;
+}
+
+/** Creates a new query that searches for an GncEntry item with
+ * description string equal to the given "desc" argument. The query
+ * will find the single GncEntry with the latest (=newest)
+ * DATE_ENTERED. */
+static QofQuery *new_query_for_entry_desc(GncEntryLedger *reg, const char* desc, gboolean use_invoice)
+{
+    QofQuery *query = NULL;
+    QofQueryPredData *predData = NULL;
+    GSList *param_list = NULL;
+    GSList *primary_sort_params = NULL;
+    const char* should_be_null = (use_invoice ? ENTRY_BILL : ENTRY_INVOICE);
+
+    g_assert(reg);
+    g_assert(desc);
+
+    /* The query itself and its book */
+    query = qof_query_create_for (GNC_ID_ENTRY);
+    qof_query_set_book (query, reg->book);
+
+    /* Predicate data: We want to compare one string, namely the given
+     * argument */
+    predData =
+        qof_query_string_predicate (QOF_COMPARE_EQUAL, desc,
+                                    QOF_STRING_MATCH_CASEINSENSITIVE, FALSE);
+
+    /* Search Parameter: We want to query on the ENTRY_DESC column */
+    param_list = qof_query_build_param_list (ENTRY_DESC, NULL);
+
+    /* Register this in the query */
+    qof_query_add_term (query, param_list, predData, QOF_QUERY_FIRST_TERM);
+
+    /* For invoice entries, Entry->Bill must be NULL, and vice versa */
+    qof_query_add_guid_match (query,
+                              qof_query_build_param_list (should_be_null,
+                                      QOF_PARAM_GUID, NULL),
+                              NULL, QOF_QUERY_AND);
+
+    /* Set the sort order: By DATE_ENTERED, increasing, and returning
+     * only one single resulting item. */
+    primary_sort_params = qof_query_build_param_list(ENTRY_DATE_ENTERED, NULL);
+    qof_query_set_sort_order (query, primary_sort_params, NULL, NULL);
+    qof_query_set_sort_increasing (query, TRUE, TRUE, TRUE);
+
+    qof_query_set_max_results(query, 1);
+
+    return query;
+}
+
+/** Finds the GncEntry with the matching description string as given
+ * in "desc", but searches this in the whole book. */
+static GncEntry*
+find_entry_in_book_by_desc(GncEntryLedger *reg, const char* desc)
+{
+    GncEntry *result = NULL;
+    gboolean use_invoice;
+    QofQuery *query;
+    GList *entries = NULL;
+
+    switch (reg->type)
+    {
+    case GNCENTRY_INVOICE_ENTRY:
+    case GNCENTRY_INVOICE_VIEWER:
+    case GNCENTRY_CUST_CREDIT_NOTE_ENTRY:
+    case GNCENTRY_CUST_CREDIT_NOTE_VIEWER:
+        use_invoice = TRUE;
+        break;
+    default:
+        use_invoice = FALSE;
+        break;
+    };
+
+    query = new_query_for_entry_desc(reg, desc, use_invoice);
+    entries = qof_query_run(query);
+
+    /* Do we have a non-empty result? */
+    if (entries)
+    {
+        /* That's the result. */
+        result = (GncEntry*) entries->data;
+        /*g_warning("Found %d GncEntry items", g_list_length (entries));*/
+    }
+
+    qof_query_destroy(query);
+    return result;
+}
+
+#if 0
+/** Finds the GncEntry with the matching description string as given
+ * in "desc", but searches this only in the given entry ledger
+ * (i.e. the currently opened ledger window). */
+static GncEntry*
+gnc_find_entry_in_reg_by_desc(GncEntryLedger *reg, const char* desc)
+{
+    int virt_row, virt_col;
+    int num_rows, num_cols;
+    GncEntry *last_entry;
+
+    g_assert(reg);
+    g_assert(reg->table);
+    if (!reg || !reg->table)
+        return NULL;
+
+    num_rows = reg->table->num_virt_rows;
+    num_cols = reg->table->num_virt_cols;
+
+    last_entry = NULL;
+
+    for (virt_row = num_rows - 1; virt_row >= 0; virt_row--)
+        for (virt_col = num_cols - 1; virt_col >= 0; virt_col--)
+        {
+            GncEntry *entry;
+            VirtualCellLocation vcell_loc = { virt_row, virt_col };
+
+            entry = gnc_entry_ledger_get_entry(reg, vcell_loc);
+
+            if (entry == last_entry)
+                continue;
+
+            if (g_strcmp0 (desc, gncEntryGetDescription (entry)) == 0)
+                return entry;
+
+            last_entry = entry;
+        }
+
+    return NULL;
+}
+#endif
+
+static void set_value_combo_cell(BasicCell *cell, const char *new_value)
+{
+    if (!cell || !new_value)
+        return;
+    if (g_strcmp0 (new_value, gnc_basic_cell_get_value (cell)) == 0)
+        return;
+
+    gnc_combo_cell_set_value ((ComboCell *) cell, new_value);
+    gnc_basic_cell_set_changed (cell, TRUE);
+}
+
+static void set_value_price_cell(BasicCell *cell, gnc_numeric new_value)
+{
+    PriceCell *pcell = (PriceCell*) cell;
+    if (!cell)
+        return;
+    if (gnc_numeric_equal (new_value, gnc_price_cell_get_value(pcell)))
+        return;
+
+    gnc_price_cell_set_value (pcell, new_value);
+    gnc_basic_cell_set_changed (cell, TRUE);
+}
+
+static gboolean
+gnc_entry_ledger_auto_completion (GncEntryLedger *ledger,
+                                  gncTableTraversalDir dir,
+                                  VirtualLocation *p_new_virt_loc)
+{
+    GncEntry *entry;
+    GncEntry *blank_entry;
+    GncEntry *auto_entry;
+    const char* cell_name;
+    const char *desc;
+    BasicCell *cell = NULL;
+    char *account_name = NULL;
+
+    g_assert(ledger);
+    g_assert(ledger->table);
+    blank_entry = gnc_entry_ledger_get_blank_entry (ledger);
+
+    /* auto-completion is only triggered by a tab out */
+    if (dir != GNC_TABLE_TRAVERSE_RIGHT)
+        return FALSE;
+
+    entry = gnc_entry_ledger_get_current_entry (ledger);
+    if (entry == NULL)
+        return FALSE;
+
+    cell_name = gnc_table_get_current_cell_name (ledger->table);
+
+    /* Auto-completion is done only in an entry ledger */
+    switch (ledger->type)
+    {
+    case GNCENTRY_ORDER_ENTRY:
+    case GNCENTRY_INVOICE_ENTRY:
+    case GNCENTRY_BILL_ENTRY:
+    case GNCENTRY_EXPVOUCHER_ENTRY:
+    case GNCENTRY_CUST_CREDIT_NOTE_ENTRY:
+    case GNCENTRY_VEND_CREDIT_NOTE_ENTRY:
+    case GNCENTRY_EMPL_CREDIT_NOTE_ENTRY:
+        break;
+    default:
+        return FALSE;
+    }
+
+    /* Further conditions before we actually do auto-completion: */
+    /* There must be a blank entry */
+    if (blank_entry == NULL)
+        return FALSE;
+
+    /* we must be on the blank entry */
+    if (entry != blank_entry)
+        return FALSE;
+
+    /* and leaving the description cell */
+    if (!gnc_cell_name_equal (cell_name, ENTRY_DESC_CELL))
+        return FALSE;
+
+    /* nothing but the date and description should be changed */
+    /* FIXME, this should be refactored. */
+    if (gnc_table_layout_get_cell_changed (ledger->table->layout,
+                                           ENTRY_ACTN_CELL, TRUE)
+            || gnc_table_layout_get_cell_changed (ledger->table->layout,
+                    ENTRY_QTY_CELL, TRUE)
+            || gnc_table_layout_get_cell_changed (ledger->table->layout,
+                    ENTRY_PRIC_CELL, TRUE)
+            || gnc_table_layout_get_cell_changed (ledger->table->layout,
+                    ENTRY_DISC_CELL, TRUE)
+            || gnc_table_layout_get_cell_changed (ledger->table->layout,
+                    ENTRY_DISTYPE_CELL, TRUE)
+            || gnc_table_layout_get_cell_changed (ledger->table->layout,
+                    ENTRY_DISHOW_CELL, TRUE)
+            || gnc_table_layout_get_cell_changed (ledger->table->layout,
+                    ENTRY_IACCT_CELL, TRUE)
+            || gnc_table_layout_get_cell_changed (ledger->table->layout,
+                    ENTRY_BACCT_CELL, TRUE)
+            || gnc_table_layout_get_cell_changed (ledger->table->layout,
+                    ENTRY_TAXABLE_CELL, TRUE)
+            || gnc_table_layout_get_cell_changed (ledger->table->layout,
+                    ENTRY_TAXINCLUDED_CELL, TRUE)
+            || gnc_table_layout_get_cell_changed (ledger->table->layout,
+                    ENTRY_TAXTABLE_CELL, TRUE)
+            || gnc_table_layout_get_cell_changed (ledger->table->layout,
+                    ENTRY_VALUE_CELL, TRUE)
+            || gnc_table_layout_get_cell_changed (ledger->table->layout,
+                    ENTRY_TAXVAL_CELL, TRUE)
+            || gnc_table_layout_get_cell_changed (ledger->table->layout,
+                    ENTRY_BILLABLE_CELL, TRUE)
+            || gnc_table_layout_get_cell_changed (ledger->table->layout,
+                    ENTRY_PAYMENT_CELL, TRUE))
+        return FALSE;
+
+    /* and the description should indeed be changed */
+    if (!gnc_table_layout_get_cell_changed (ledger->table->layout,
+                                            ENTRY_DESC_CELL, TRUE))
+        return FALSE;
+
+    /* to a non-empty value */
+    desc = gnc_table_layout_get_cell_value (ledger->table->layout, ENTRY_DESC_CELL);
+    if ((desc == NULL) || (*desc == '\0'))
+        return FALSE;
+
+    /* Ok, we are sure we want to trigger auto-completion. Now find an
+     * entry to copy the values from. */
+    auto_entry =
+        /* Use this for book-wide auto-completion of the invoice entries */
+        find_entry_in_book_by_desc(ledger, desc);
+
+    if (auto_entry == NULL)
+        return FALSE;
+
+    /* now perform the completion */
+    gnc_suspend_gui_refresh ();
+
+    /* Auto-complete the action field */
+    cell = gnc_table_layout_get_cell (ledger->table->layout, ENTRY_ACTN_CELL);
+    set_value_combo_cell (cell, gncEntryGetAction (auto_entry));
+
+    /* Auto-complete the account field */
+    switch (ledger->type)
+    {
+    case GNCENTRY_INVOICE_ENTRY:
+    case GNCENTRY_CUST_CREDIT_NOTE_ENTRY:
+        cell = gnc_table_layout_get_cell (ledger->table->layout, ENTRY_IACCT_CELL);
+        account_name = gnc_get_account_name_for_register (gncEntryGetInvAccount(auto_entry));
+        break;
+    case GNCENTRY_EXPVOUCHER_ENTRY:
+    case GNCENTRY_BILL_ENTRY:
+    case GNCENTRY_VEND_CREDIT_NOTE_ENTRY:
+    case GNCENTRY_EMPL_CREDIT_NOTE_ENTRY:
+        cell = gnc_table_layout_get_cell (ledger->table->layout, ENTRY_BACCT_CELL);
+        account_name = gnc_get_account_name_for_register (gncEntryGetBillAccount(auto_entry));
+        break;
+    case GNCENTRY_ORDER_ENTRY:
+    default:
+        cell = NULL;
+        account_name = NULL;
+        break;
+    }
+    set_value_combo_cell (cell, account_name);
+    g_free (account_name);
+
+    /* Auto-complete quantity cell. Note that this requires some care because
+     * credit notes store quantities with a reversed sign. So we need to figure
+     * out if the original document from which we extract the autofill entry
+     * was a credit note or not. */
+    {
+        gboolean orig_is_cn;
+        switch (ledger->type)
+        {
+        case GNCENTRY_INVOICE_ENTRY:
+        case GNCENTRY_CUST_CREDIT_NOTE_ENTRY:
+            orig_is_cn = gncInvoiceGetIsCreditNote (gncEntryGetInvoice (auto_entry));
+            break;
+        default:
+            orig_is_cn = gncInvoiceGetIsCreditNote (gncEntryGetBill (auto_entry));
+            break;
+        }
+        cell = gnc_table_layout_get_cell (ledger->table->layout, ENTRY_QTY_CELL);
+        set_value_price_cell (cell, gncEntryGetDocQuantity (auto_entry, orig_is_cn));
+    }
+
+    /* Auto-complete price cell */
+    {
+        gnc_numeric price;
+        switch (ledger->type)
+        {
+        case GNCENTRY_INVOICE_ENTRY:
+        case GNCENTRY_CUST_CREDIT_NOTE_ENTRY:
+            price = gncEntryGetInvPrice (auto_entry);
+            break;
+        default:
+            price = gncEntryGetBillPrice (auto_entry);
+            break;
+        }
+
+        /* Auto-complete price cell */
+        cell = gnc_table_layout_get_cell (ledger->table->layout, ENTRY_PRIC_CELL);
+        set_value_price_cell (cell, price);
+    }
+
+    /* We intentionally skip the discount column */
+
+    /* Taxable?, Tax-include?, Tax table */
+    {
+        gboolean taxable = FALSE, taxincluded = FALSE;
+        GncTaxTable *taxtable = NULL;
+        switch (ledger->type)
+        {
+        case GNCENTRY_INVOICE_ENTRY:
+        case GNCENTRY_CUST_CREDIT_NOTE_ENTRY:
+            taxable = gncEntryGetInvTaxable (auto_entry);
+            taxincluded = gncEntryGetInvTaxIncluded (auto_entry);
+            taxtable = gncEntryGetInvTaxTable (auto_entry);
+            break;
+        case GNCENTRY_BILL_ENTRY:
+        case GNCENTRY_VEND_CREDIT_NOTE_ENTRY:
+            taxable = gncEntryGetBillTaxable (auto_entry);
+            taxincluded = gncEntryGetBillTaxIncluded (auto_entry);
+            taxtable = gncEntryGetBillTaxTable (auto_entry);
+            break;
+        default:
+            break;
+        }
+
+        switch (ledger->type)
+        {
+        case GNCENTRY_INVOICE_ENTRY:
+        case GNCENTRY_CUST_CREDIT_NOTE_ENTRY:
+        case GNCENTRY_BILL_ENTRY:
+        case GNCENTRY_VEND_CREDIT_NOTE_ENTRY:
+            /* Taxable? cell */
+            cell = gnc_table_layout_get_cell (ledger->table->layout, ENTRY_TAXABLE_CELL);
+            gnc_checkbox_cell_set_flag ((CheckboxCell *) cell, taxable);
+            gnc_basic_cell_set_changed (cell, TRUE);
+
+            /* taxincluded? cell */
+            cell = gnc_table_layout_get_cell (ledger->table->layout, ENTRY_TAXINCLUDED_CELL);
+            gnc_checkbox_cell_set_flag ((CheckboxCell *) cell, taxincluded);
+            gnc_basic_cell_set_changed (cell, TRUE);
+
+            /* Taxable? cell */
+            cell = gnc_table_layout_get_cell (ledger->table->layout, ENTRY_TAXTABLE_CELL);
+            set_value_combo_cell(cell, gncTaxTableGetName (taxtable));
+            break;
+        default:
+            break;
+        }
+    }
+
+
+    gnc_resume_gui_refresh ();
+
+    /* now move to the non-empty amount column unless config setting says not */
+    if ( !gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL_REGISTER,
+                             GNC_PREF_TAB_TRANS_MEMORISED) )
+    {
+        VirtualLocation new_virt_loc;
+        const char *cell_name = ENTRY_QTY_CELL;
+
+        if (gnc_table_get_current_cell_location (ledger->table, cell_name,
+                &new_virt_loc))
+            *p_new_virt_loc = new_virt_loc;
+    }
+
+    return TRUE;
+}
+
+static gboolean gnc_entry_ledger_traverse (VirtualLocation *p_new_virt_loc,
+        gncTableTraversalDir dir,
+        gpointer user_data)
+{
+    GncEntryLedger *ledger = user_data;
+    GncEntry *entry, *new_entry;
+    gint response;
+    VirtualLocation virt_loc;
+    int changed;
+    char const *cell_name;
+    gboolean exact_traversal;
+
+    if (!ledger) return FALSE;
+
+    exact_traversal = (dir == GNC_TABLE_TRAVERSE_POINTER);
+
+    entry = gnc_entry_ledger_get_current_entry (ledger);
+    if (!entry)
+        return FALSE;
+
+    /* no changes, make sure we aren't going off the end */
+    changed = gnc_table_current_cursor_changed (ledger->table, FALSE);
+    if (!changed)
+        return FALSE;
+
+    virt_loc = *p_new_virt_loc;
+
+    cell_name = gnc_table_get_current_cell_name (ledger->table);
+
+    /* See if we are leaving the account field */
+    do
+    {
+        ComboCell *cell;
+        char *name;
+        char *cell_name = NULL;
+
+        switch (ledger->type)
+        {
+        case GNCENTRY_INVOICE_ENTRY:
+        case GNCENTRY_INVOICE_VIEWER:
+        case GNCENTRY_CUST_CREDIT_NOTE_ENTRY:
+        case GNCENTRY_CUST_CREDIT_NOTE_VIEWER:
+            cell_name = ENTRY_IACCT_CELL;
+            break;
+        case GNCENTRY_BILL_ENTRY:
+        case GNCENTRY_BILL_VIEWER:
+        case GNCENTRY_EXPVOUCHER_ENTRY:
+        case GNCENTRY_EXPVOUCHER_VIEWER:
+        case GNCENTRY_VEND_CREDIT_NOTE_ENTRY:
+        case GNCENTRY_VEND_CREDIT_NOTE_VIEWER:
+        case GNCENTRY_EMPL_CREDIT_NOTE_ENTRY:
+        case GNCENTRY_EMPL_CREDIT_NOTE_VIEWER:
+            cell_name = ENTRY_BACCT_CELL;
+            break;
+        default:
+            g_warning ("Unhandled ledger type");
+            break;
+        }
+
+        if (!cell_name)
+            break;
+
+        if (!gnc_cell_name_equal (cell_name, cell_name))
+            break;
+
+        if (!gnc_table_layout_get_cell_changed (ledger->table->layout,
+                                                cell_name, FALSE))
+            break;
+
+        cell = (ComboCell *) gnc_table_layout_get_cell (ledger->table->layout,
+                cell_name);
+        if (!cell)
+            break;
+
+        name = cell->cell.value;
+        if (!name || *name == '\0')
+            break;
+
+        /* Create the account if necessary. Also checks for a placeholder */
+        if (!gnc_entry_ledger_get_account_by_name (ledger, (BasicCell *) cell,
+                cell->cell.value,
+                &ledger->full_refresh))
+            return TRUE;
+
+    }
+    while (FALSE);
+
+
+    /* See if we are leaving the TaxTable field */
+    do
+    {
+        ComboCell *cell;
+        GncTaxTable *table;
+        char *name;
+
+        if (!gnc_cell_name_equal (cell_name, ENTRY_TAXTABLE_CELL))
+            break;
+
+        if (!gnc_table_layout_get_cell_changed (ledger->table->layout,
+                                                ENTRY_TAXTABLE_CELL, FALSE))
+            break;
+
+        cell = (ComboCell *) gnc_table_layout_get_cell (ledger->table->layout,
+                ENTRY_TAXTABLE_CELL);
+        if (!cell)
+            break;
+
+        name = cell->cell.value;
+        if (!name || *name == '\0')
+            break;
+
+        table = gncTaxTableLookupByName (ledger->book, cell->cell.value);
+        if (table)
+            break;
+
+        {
+            const char *format = _("The tax table %s does not exist. "
+                                   "Would you like to create it?");
+            if (!gnc_verify_dialog (ledger->parent, TRUE, format, name))
+                break;
+        }
+
+        ledger->full_refresh = FALSE;
+
+        table = gnc_ui_tax_table_new_from_name (ledger->book, name);
+        if (!table)
+            break;
+
+        ledger->full_refresh = TRUE;
+
+        name = (char *)gncTaxTableGetName (table);
+        gnc_combo_cell_set_value (cell, name);
+        gnc_basic_cell_set_changed (&cell->cell, TRUE);
+
+    }
+    while (FALSE);
+
+
+    /* See if we are tabbing off the end of the very last line
+     * (i.e. the blank entry)
+     */
+    do
+    {
+        VirtualLocation virt_loc;
+
+        if (!changed && !ledger->blank_entry_edited)
+            break;
+
+        if (dir != GNC_TABLE_TRAVERSE_RIGHT)
+            break;
+
+        virt_loc = ledger->table->current_cursor_loc;
+        if (gnc_table_move_vertical_position (ledger->table, &virt_loc, 1))
+            break;
+
+        virt_loc = ledger->table->current_cursor_loc;
+        if (gnc_table_move_tab (ledger->table, &virt_loc, TRUE))
+            break;
+
+        *p_new_virt_loc = ledger->table->current_cursor_loc;
+
+        /* Yep, we're trying to leave the blank entry -- make sure
+         * we are allowed to do so by verifying the current cursor.
+         * If the current cursor is ok, then move on!
+         */
+
+        /* Verify that the cursor is ok.  If we can't save the cell, don't move! */
+        if (!gnc_entry_ledger_verify_can_save (ledger))
+        {
+            return TRUE;
+        }
+
+        (p_new_virt_loc->vcell_loc.virt_row)++;
+        p_new_virt_loc->phys_row_offset = 0;
+        p_new_virt_loc->phys_col_offset = 0;
+
+        ledger->traverse_to_new = TRUE;
+
+        /* If we're here, we're tabbing off the end of the 'blank entry' */
+        return FALSE;
+
+    }
+    while (FALSE);
+
+    /* Now see if we are changing cursors. If not, we may be able to
+     * auto-complete. */
+    if (!gnc_table_virtual_cell_out_of_bounds (ledger->table,
+            virt_loc.vcell_loc))
+    {
+        if (gnc_entry_ledger_auto_completion (ledger, dir, p_new_virt_loc))
+            return FALSE;
+    }
+
+    /* Check for going off the end */
+    gnc_table_find_close_valid_cell (ledger->table, &virt_loc, exact_traversal);
+
+    /* Same entry, no problem -- we're just moving backwards in the cursor */
+    new_entry = gnc_entry_ledger_get_entry (ledger, virt_loc.vcell_loc);
+    if (entry == new_entry)
+    {
+        *p_new_virt_loc = virt_loc;
+
+        return FALSE;
+    }
+
+    /* If we are here, then we are trying to leave the cursor.  Make sure
+     * the cursor we are leaving is valid.  If so, ask the user if the
+     * changes should be recorded.  If not, don't go anywhere.
+     */
+
+    /* Verify this cursor -- if it's not valid, don't let them move on */
+    if (!gnc_entry_ledger_verify_can_save (ledger))
+    {
+        *p_new_virt_loc = ledger->table->current_cursor_loc;
+        return TRUE;
+    }
+
+    /*
+     * XXX  GNCENTRY_INVOICE_EDIT processing to be added:
+     * 1) check if the qty field changed.
+     * 2) if so, check if this entry is part of an order.
+     * 3) if so, ask if they want to change the entry or
+     *    split the entry into two parts.
+     */
+
+    /* Ok, we are changing lines and the current entry has
+     * changed. We only ask them what they want to do in
+     * limited cases -- usually just let the change go through.
+     */
+    {
+        GtkWidget *dialog;
+        const char *title = _("Save the current entry?");
+        const char *message =
+            _("The current entry has been changed. However, this entry is "
+              "part of an existing order. Would you like to record the change "
+              "and effectively change your order?");
+
+        switch (ledger->type)
+        {
+        case GNCENTRY_INVOICE_ENTRY:
+        case GNCENTRY_CUST_CREDIT_NOTE_ENTRY:
+            if (gncEntryGetOrder (entry) != NULL)
+            {
+                dialog = gtk_message_dialog_new(GTK_WINDOW(ledger->parent),
+                                                GTK_DIALOG_DESTROY_WITH_PARENT,
+                                                GTK_MESSAGE_QUESTION,
+                                                GTK_BUTTONS_NONE,
+                                                "%s", title);
+                gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
+                        "%s", message);
+                gtk_dialog_add_buttons(GTK_DIALOG(dialog),
+                                       _("_Don't Record"), GTK_RESPONSE_REJECT,
+                                       _("_Cancel"), GTK_RESPONSE_CANCEL,
+                                       _("_Record"), GTK_RESPONSE_ACCEPT,
+                                       NULL);
+                response = gnc_dialog_run(GTK_DIALOG(dialog), GNC_PREF_WARN_INV_ENTRY_MOD);
+                gtk_widget_destroy(dialog);
+                break;
+            }
+
+            /* FALL THROUGH */
+        default:
+            response = GTK_RESPONSE_ACCEPT;
+            break;
+        }
+    }
+
+    switch (response)
+    {
+    case GTK_RESPONSE_ACCEPT:
+        break;
+
+    case GTK_RESPONSE_REJECT:
+    {
+        VirtualCellLocation vcell_loc;
+        GncEntry *new_entry;
+
+        new_entry = gnc_entry_ledger_get_entry (ledger, virt_loc.vcell_loc);
+
+        gnc_entry_ledger_cancel_cursor_changes (ledger);
+
+        if (gnc_entry_ledger_find_entry (ledger, new_entry, &vcell_loc))
+            virt_loc.vcell_loc = vcell_loc;
+
+        gnc_table_find_close_valid_cell (ledger->table, &virt_loc,
+                                         exact_traversal);
+
+        *p_new_virt_loc = virt_loc;
+    }
+
+    break;
+
+    case GTK_RESPONSE_CANCEL:
+    default:
+        return TRUE;
+    }
+
+    return FALSE;
+}
+
+TableControl * gnc_entry_ledger_control_new (void)
+{
+    TableControl * control;
+
+    control = gnc_table_control_new ();
+    control->move_cursor = gnc_entry_ledger_move_cursor;
+    control->traverse = gnc_entry_ledger_traverse;
+
+    return control;
+}
+
+
+void gnc_entry_ledger_cancel_cursor_changes (GncEntryLedger *ledger)
+{
+    VirtualLocation virt_loc;
+
+    if (ledger == NULL)
+        return;
+
+    virt_loc = ledger->table->current_cursor_loc;
+
+    if (!gnc_table_current_cursor_changed (ledger->table, FALSE))
+        return;
+
+    /* When cancelling edits, reload the cursor from the entry. */
+    gnc_table_clear_current_cursor_changes (ledger->table);
+
+    if (gnc_table_find_close_valid_cell (ledger->table, &virt_loc, FALSE))
+        gnc_table_move_cursor_gui (ledger->table, virt_loc);
+
+    gnc_table_refresh_gui (ledger->table, TRUE);
+}
+
+static gboolean
+gnc_entry_ledger_check_close_internal (GtkWidget *parent,
+                                       GncEntryLedger *ledger,
+                                       gboolean dontask)
+{
+    const char *message = _("The current entry has been changed. "
+                            "Would you like to save it?");
+    VirtualLocation virt_loc;
+
+    virt_loc = ledger->table->current_cursor_loc;
+
+    if (gnc_entry_ledger_traverse (&virt_loc, GNC_TABLE_TRAVERSE_POINTER,
+                                   ledger))
+        return FALSE;
+
+    if (!gnc_entry_ledger_verify_can_save (ledger))
+        return FALSE;
+
+    if (dontask || gnc_verify_dialog (parent, TRUE, "%s", message))
+        gnc_entry_ledger_save (ledger, TRUE);
+    else
+        gnc_entry_ledger_cancel_cursor_changes (ledger);
+
+    return TRUE;
+}
+
+gboolean
+gnc_entry_ledger_commit_entry (GncEntryLedger *ledger)
+{
+    if (!ledger) return TRUE;
+
+    return gnc_entry_ledger_check_close_internal (NULL, ledger, TRUE);
+}
+
+gboolean
+gnc_entry_ledger_check_close (GtkWidget *parent, GncEntryLedger *ledger)
+{
+    if (!ledger) return TRUE;
+
+    if (gnc_entry_ledger_changed (ledger))
+    {
+        gboolean dontask = FALSE;
+
+        if (ledger->type ==  GNCENTRY_INVOICE_ENTRY ||
+                ledger->type ==  GNCENTRY_CUST_CREDIT_NOTE_ENTRY)
+        {
+            gboolean inv_value;
+            gboolean only_inv_changed = FALSE;
+
+            if (gnc_table_current_cursor_changed (ledger->table, FALSE) == 1 &&
+                    gnc_table_layout_get_cell_changed (ledger->table->layout,
+                            ENTRY_INV_CELL, TRUE))
+                only_inv_changed = TRUE;
+
+            inv_value = gnc_entry_ledger_get_checkmark (ledger, ENTRY_INV_CELL);
+
+            if (inv_value && only_inv_changed)
+            {
+                /* If the only change is that the 'inv' entry was clicked
+                 * "on", then just accept the change it without question.
+                 */
+                dontask = TRUE;
+            }
+        }
+
+        return gnc_entry_ledger_check_close_internal (parent, ledger, dontask);
+
+    }
+    return TRUE;
+}
diff --git a/src/register/ledger-core/gncEntryLedgerControl.h b/gnucash/register/ledger-core/gncEntryLedgerControl.h
similarity index 100%
rename from src/register/ledger-core/gncEntryLedgerControl.h
rename to gnucash/register/ledger-core/gncEntryLedgerControl.h
diff --git a/src/register/ledger-core/gncEntryLedgerDisplay.c b/gnucash/register/ledger-core/gncEntryLedgerDisplay.c
similarity index 100%
rename from src/register/ledger-core/gncEntryLedgerDisplay.c
rename to gnucash/register/ledger-core/gncEntryLedgerDisplay.c
diff --git a/src/register/ledger-core/gncEntryLedgerLayout.c b/gnucash/register/ledger-core/gncEntryLedgerLayout.c
similarity index 100%
rename from src/register/ledger-core/gncEntryLedgerLayout.c
rename to gnucash/register/ledger-core/gncEntryLedgerLayout.c
diff --git a/src/register/ledger-core/gncEntryLedgerLayout.h b/gnucash/register/ledger-core/gncEntryLedgerLayout.h
similarity index 100%
rename from src/register/ledger-core/gncEntryLedgerLayout.h
rename to gnucash/register/ledger-core/gncEntryLedgerLayout.h
diff --git a/gnucash/register/ledger-core/gncEntryLedgerLoad.c b/gnucash/register/ledger-core/gncEntryLedgerLoad.c
new file mode 100644
index 0000000..9da269f
--- /dev/null
+++ b/gnucash/register/ledger-core/gncEntryLedgerLoad.c
@@ -0,0 +1,617 @@
+/*
+ * gncEntryLedgerLoad.c -- a Ledger widget for entering GncEntry objects
+ * Copyright (C) 2001, 2002, 2003 Derek Atkins
+ * Author: Derek Atkins <warlord at MIT.EDU>
+ *
+ * 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 at gnu.org
+ */
+
+#include "config.h"
+
+#include <glib.h>
+#include <glib/gi18n.h>
+
+#include "Account.h"
+#include "account-quickfill.h"
+#include "combocell.h"
+#include "gnc-component-manager.h"
+#include "gnc-prefs.h"
+#include "gnc-ui-util.h"
+#include "recncell.h"
+
+#include "business-helpers.h"
+
+#include "gncEntry.h"
+#include "gncEntryLedger.h"
+#include "gncEntryLedgerP.h"
+#include "quickfillcell.h"
+#include "gnc-entry-quickfill.h"
+
+#define GNC_PREF_TAX_INCL "tax-included"
+
+static const QofLogModule log_module = "Business Entry Ledger";
+
+/* XXX: This should go elsewhere */
+const char * gnc_entry_ledger_type_string_getter (char flag)
+{
+    switch (flag)
+    {
+    case '1':
+        return _("$");
+    case '2':
+        return _("%");
+    default:
+        break;
+    };
+    return "?";
+}
+
+const char * gnc_entry_ledger_how_string_getter (char flag)
+{
+    switch (flag)
+    {
+    case '1':
+        return _("<");
+    case '2':
+        return _("=");
+    case '3':
+        return _(">");
+    default:
+        break;
+    };
+        return "?";
+}
+
+static void load_discount_type_cells (GncEntryLedger *ledger)
+{
+    RecnCell *cell;
+
+    if (!ledger) return;
+
+    cell = (RecnCell *)
+           gnc_table_layout_get_cell (ledger->table->layout, ENTRY_DISTYPE_CELL);
+
+    if (!cell) return;
+
+    gnc_recn_cell_set_valid_flags (cell, "12", '2');
+    gnc_recn_cell_set_flag_order (cell, "21");
+    gnc_recn_cell_set_string_getter (cell, gnc_entry_ledger_type_string_getter);
+}
+
+static void load_discount_how_cells (GncEntryLedger *ledger)
+{
+    RecnCell *cell;
+
+    if (!ledger) return;
+
+    cell = (RecnCell *)
+           gnc_table_layout_get_cell (ledger->table->layout, ENTRY_DISHOW_CELL);
+
+    if (!cell) return;
+
+    gnc_recn_cell_set_valid_flags (cell, "123", '1');
+    gnc_recn_cell_set_flag_order (cell, "123");
+    gnc_recn_cell_set_string_getter (cell, gnc_entry_ledger_how_string_getter);
+}
+
+static void load_payment_type_cells (GncEntryLedger *ledger)
+{
+    ComboCell *cell;
+    const GncOwner *owner;
+    GncEmployee *employee;
+
+    cell = (ComboCell *) gnc_table_layout_get_cell (ledger->table->layout,
+            ENTRY_PAYMENT_CELL);
+    if (!cell) return;
+
+    if (!ledger->invoice) return;
+
+    owner = gncOwnerGetEndOwner (gncInvoiceGetOwner (ledger->invoice));
+    if (gncOwnerGetType (owner) != GNC_OWNER_EMPLOYEE)
+        return;
+
+    employee = gncOwnerGetEmployee (owner);
+    g_return_if_fail (employee);
+
+    gnc_combo_cell_clear_menu (cell);
+    gnc_combo_cell_add_menu_item (cell, _("Cash"));
+
+    if (gncEmployeeGetCCard (employee))
+        gnc_combo_cell_add_menu_item (cell, _("Charge"));
+}
+
+/* ==================================================================== */
+/* Return TRUE if we don't want to add this account to the xfer menu */
+
+static gboolean
+skip_expense_acct_cb (Account *account, gpointer user_data)
+{
+    GNCAccountType type;
+
+    /* Don't add A/R, A/P, Bank, Cash, or Equity accounts */
+    type = xaccAccountGetType (account);
+    if (type == ACCT_TYPE_PAYABLE || type == ACCT_TYPE_RECEIVABLE ||
+            type == ACCT_TYPE_CASH || type == ACCT_TYPE_BANK ||
+            type == ACCT_TYPE_EQUITY || type == ACCT_TYPE_TRADING)
+    {
+        return TRUE;
+    }
+
+    /* If this is an ORDER or INVOICE, then leave out the expenses.  */
+    if (type == ACCT_TYPE_EXPENSE) return TRUE;
+
+    /* Don't add placeholder accounts */
+    if (xaccAccountGetPlaceholder (account)) return TRUE;
+
+    return FALSE;
+}
+
+static gboolean
+skip_income_acct_cb (Account *account, gpointer user_data)
+{
+    GNCAccountType type;
+
+    /* Don't add A/R, A/P, Bank, Cash, or Equity accounts */
+    type = xaccAccountGetType (account);
+    if (type == ACCT_TYPE_PAYABLE || type == ACCT_TYPE_RECEIVABLE ||
+            type == ACCT_TYPE_CASH || type == ACCT_TYPE_BANK ||
+            type == ACCT_TYPE_EQUITY || type == ACCT_TYPE_TRADING)
+    {
+        return TRUE;
+    }
+
+    /* If this is a BILL, then leave out the incomes */
+    if (type == ACCT_TYPE_INCOME) return TRUE;
+
+    /* Don't add placeholder accounts */
+    if (xaccAccountGetPlaceholder (account)) return TRUE;
+
+    return FALSE;
+}
+
+/* ===================================================================== */
+/* Splat the account name into the transfer cell combobox menu */
+
+#define EKEY "Expense Business entry quickfill"
+#define IKEY "Income Business entry quickfill"
+
+static void
+load_xfer_type_cells (GncEntryLedger *ledger)
+{
+    Account *root;
+    ComboCell *cell;
+    QuickFill *qf = NULL;
+    GtkListStore *store = NULL;
+
+    root = gnc_book_get_root_account (ledger->book);
+    if (root == NULL) return;
+
+    /* Use a common, shared quickfill.  For the ORDER or INVOICE,
+     * ledgers, we don't want expense-type accounts in the menu.
+     * For BILL, etc. then leave out the income types.
+     */
+    switch (ledger->type)
+    {
+    case GNCENTRY_ORDER_ENTRY:
+    case GNCENTRY_ORDER_VIEWER:
+    case GNCENTRY_INVOICE_ENTRY:
+    case GNCENTRY_INVOICE_VIEWER:
+    case GNCENTRY_CUST_CREDIT_NOTE_ENTRY:
+    case GNCENTRY_CUST_CREDIT_NOTE_VIEWER:
+        qf = gnc_get_shared_account_name_quickfill (root, IKEY,
+                skip_expense_acct_cb, NULL);
+        store = gnc_get_shared_account_name_list_store (root, IKEY,
+                skip_expense_acct_cb, NULL);
+        break;
+
+    case GNCENTRY_BILL_ENTRY:
+    case GNCENTRY_BILL_VIEWER:
+    case GNCENTRY_EXPVOUCHER_ENTRY:
+    case GNCENTRY_EXPVOUCHER_VIEWER:
+    case GNCENTRY_VEND_CREDIT_NOTE_ENTRY:
+    case GNCENTRY_VEND_CREDIT_NOTE_VIEWER:
+    case GNCENTRY_EMPL_CREDIT_NOTE_ENTRY:
+    case GNCENTRY_EMPL_CREDIT_NOTE_VIEWER:
+    case GNCENTRY_NUM_REGISTER_TYPES:
+        qf = gnc_get_shared_account_name_quickfill (root, EKEY,
+                skip_income_acct_cb, NULL);
+        store = gnc_get_shared_account_name_list_store (root, EKEY,
+                skip_income_acct_cb, NULL);
+        break;
+    default:
+	PWARN ("Bad GncEntryLedgerType");
+	break;
+    }
+
+    cell = (ComboCell *)
+           gnc_table_layout_get_cell (ledger->table->layout, ENTRY_IACCT_CELL);
+    gnc_combo_cell_use_quickfill_cache (cell, qf);
+    gnc_combo_cell_use_list_store_cache (cell, store);
+
+    cell = (ComboCell *)
+           gnc_table_layout_get_cell (ledger->table->layout, ENTRY_BACCT_CELL);
+    gnc_combo_cell_use_quickfill_cache (cell, qf);
+    gnc_combo_cell_use_list_store_cache (cell, store);
+}
+
+/* ===================================================================== */
+
+static void load_taxtable_type_cells (GncEntryLedger *ledger)
+{
+    GList *list;
+    ComboCell *cell;
+
+    cell = (ComboCell *)
+           gnc_table_layout_get_cell (ledger->table->layout, ENTRY_TAXTABLE_CELL);
+    gnc_combo_cell_clear_menu (cell);
+
+    list = gncTaxTableGetTables (ledger->book);
+    for ( ; list ; list = list->next )
+    {
+        GncTaxTable *table = list->data;
+        const char *name = gncTaxTableGetName (table);
+        if (name != NULL)
+            gnc_combo_cell_add_menu_item (cell, (char*)name);
+    }
+}
+
+static void
+gnc_entry_ledger_show_entry (GncEntryLedger *ledger,
+                             VirtualCellLocation start_loc)
+{
+    VirtualCellLocation end_loc;
+    int v_row;
+
+    end_loc = start_loc;
+    v_row = end_loc.virt_row + 1;
+    end_loc.virt_row = MIN (v_row, ledger->table->num_virt_rows - 1);
+
+    gnc_table_show_range (ledger->table, start_loc, end_loc);
+}
+
+#define DESC_QF_KEY_INVOICES "ENTRY_DESC_CELL_QF_INVOICES"
+#define DESC_QF_KEY_BILLS "ENTRY_DESC_CELL_QF_BILLS"
+
+static void
+load_description_cell (GncEntryLedger *ledger)
+{
+    QuickFill *shared_quickfill;
+    QuickFillCell *cell;
+
+    switch (ledger->type)
+    {
+    case GNCENTRY_INVOICE_ENTRY:
+    case GNCENTRY_INVOICE_VIEWER:
+    case GNCENTRY_CUST_CREDIT_NOTE_ENTRY:
+    case GNCENTRY_CUST_CREDIT_NOTE_VIEWER:
+        shared_quickfill = gnc_get_shared_entry_desc_quickfill(ledger->book, DESC_QF_KEY_INVOICES, TRUE);
+        break;
+    default:
+        shared_quickfill = gnc_get_shared_entry_desc_quickfill(ledger->book, DESC_QF_KEY_BILLS, FALSE);
+        break;
+    };
+
+    cell = (QuickFillCell *)
+           gnc_table_layout_get_cell (ledger->table->layout, ENTRY_DESC_CELL);
+    gnc_quickfill_cell_use_quickfill_cache (cell, shared_quickfill);
+}
+
+void gnc_entry_ledger_load_xfer_cells (GncEntryLedger *ledger)
+{
+    load_xfer_type_cells (ledger);
+    load_taxtable_type_cells (ledger);
+    load_payment_type_cells (ledger);
+    load_description_cell (ledger);
+}
+
+/* XXX (FIXME): This should be in a config file! */
+/* Copy GncEntry information from the list to the rows of the Ledger. */
+/* XXX This code is a cut-n-paste job from the SplitRegister code;
+ * the split-register should be generalized to the point where a cut-n-paste
+ * like this isn't required, and this should be trashed.
+ */
+void gnc_entry_ledger_load (GncEntryLedger *ledger, GList *entry_list)
+{
+    GncEntry *blank_entry, *find_entry;
+    CursorBuffer *cursor_buffer;
+    Table *table;
+
+    GList *node;
+    CellBlock *cursor_header, *cursor;
+    VirtualCellLocation vcell_loc;
+    VirtualLocation save_loc;
+    gboolean start_primary_color = TRUE;
+
+    int new_entry_row = -1;
+
+    if (!ledger) return;
+
+    /* Load up cells */
+    load_discount_type_cells (ledger);
+    load_discount_how_cells (ledger);
+    gnc_entry_ledger_load_xfer_cells (ledger);
+
+    blank_entry = gnc_entry_ledger_get_blank_entry (ledger);
+
+    if (blank_entry == NULL && ledger->invoice == NULL && entry_list == NULL)
+        return;
+
+    if (blank_entry == NULL && ledger->invoice)
+    {
+        switch (ledger->type)
+        {
+        case GNCENTRY_ORDER_ENTRY:
+        case GNCENTRY_INVOICE_ENTRY:
+        case GNCENTRY_BILL_ENTRY:
+        case GNCENTRY_EXPVOUCHER_ENTRY:
+        case GNCENTRY_CUST_CREDIT_NOTE_ENTRY:
+        case GNCENTRY_VEND_CREDIT_NOTE_ENTRY:
+        case GNCENTRY_EMPL_CREDIT_NOTE_ENTRY:
+
+            gnc_suspend_gui_refresh ();
+
+            blank_entry = gncEntryCreate (ledger->book);
+            gncEntrySetDateGDate (blank_entry, &ledger->last_date_entered);
+            ledger->blank_entry_guid = *gncEntryGetGUID (blank_entry);
+
+            gnc_resume_gui_refresh ();
+
+            /* The rest of this does not apply to expense vouchers */
+            if (ledger->type != GNCENTRY_EXPVOUCHER_ENTRY)
+            {
+                const GncOwner *owner = gncOwnerGetEndOwner (gncInvoiceGetOwner (ledger->invoice));
+                GncTaxTable *table = NULL;
+                GncTaxIncluded taxincluded_p = GNC_TAXINCLUDED_USEGLOBAL;
+                gboolean taxincluded = FALSE;
+                gnc_numeric discount = gnc_numeric_zero ();
+                gnc_numeric price = gnc_numeric_zero ();
+
+                /* Determine the Price from Customer's or Vendor's Job */
+                switch (gncOwnerGetType (gncInvoiceGetOwner (ledger->invoice)))
+                {
+                case GNC_OWNER_JOB:
+                    price = gncJobGetRate( gncOwnerGetJob (gncInvoiceGetOwner (ledger->invoice)));
+                    break;
+                default:
+                    break;
+                }
+
+                /* Determine the TaxIncluded and Discount values */
+                switch (gncOwnerGetType (owner))
+                {
+                case GNC_OWNER_CUSTOMER:
+                    taxincluded_p = gncCustomerGetTaxIncluded (owner->owner.customer);
+                    discount = gncCustomerGetDiscount (owner->owner.customer);
+                    break;
+                case GNC_OWNER_VENDOR:
+                    taxincluded_p = gncVendorGetTaxIncluded (owner->owner.vendor);
+                    break;
+                default:
+                    break;
+                }
+
+                /* Compute the default taxincluded */
+                switch (taxincluded_p)
+                {
+                case GNC_TAXINCLUDED_YES:
+                    taxincluded = TRUE;
+                    break;
+                case GNC_TAXINCLUDED_NO:
+                    taxincluded = FALSE;
+                    break;
+                case GNC_TAXINCLUDED_USEGLOBAL:
+                    if (ledger->prefs_group)
+                    {
+                        taxincluded = gnc_prefs_get_bool (ledger->prefs_group, GNC_PREF_TAX_INCL);
+                    }
+                    else
+                    {
+                        taxincluded = FALSE;
+                    }
+                    break;
+                }
+
+                /* Compute the proper taxtable */
+                switch (gncOwnerGetType (owner))
+                {
+                case GNC_OWNER_CUSTOMER:
+                    table = gnc_business_get_default_tax_table (ledger->book,
+                            GNC_OWNER_CUSTOMER);
+
+                    if (gncCustomerGetTaxTableOverride (owner->owner.customer))
+                        table = gncCustomerGetTaxTable (owner->owner.customer);
+                    break;
+
+                case GNC_OWNER_VENDOR:
+                    table = gnc_business_get_default_tax_table (ledger->book,
+                            GNC_OWNER_VENDOR);
+
+                    if (gncVendorGetTaxTableOverride (owner->owner.vendor))
+                        table = gncVendorGetTaxTable (owner->owner.vendor);
+                    break;
+
+                default:
+                    break;
+                }
+
+                if (ledger->is_cust_doc)
+                {
+                    gncEntrySetInvTaxable (blank_entry, table != NULL);
+                    gncEntrySetInvTaxTable (blank_entry, table);
+                    gncEntrySetInvTaxIncluded (blank_entry, taxincluded);
+                    gncEntrySetInvDiscount (blank_entry, discount);
+                    gncEntrySetInvPrice (blank_entry, price);
+                }
+                else
+                {
+                    gncEntrySetBillTaxable (blank_entry, table != NULL);
+                    gncEntrySetBillTaxTable (blank_entry, table);
+                    gncEntrySetBillTaxIncluded (blank_entry, taxincluded);
+                    gncEntrySetBillPrice (blank_entry, price);
+                }
+            }
+
+            break;
+        default:
+            ledger->blank_entry_guid = *guid_null ();
+            break;
+        }
+        ledger->blank_entry_edited = FALSE;
+    }
+
+    table = ledger->table;
+
+    gnc_table_leave_update (table, table->current_cursor_loc);
+    save_loc = table->current_cursor_loc;
+
+    /* Figure out where we are going to */
+    if (ledger->traverse_to_new)
+    {
+        find_entry = blank_entry;
+    }
+    else if (ledger->hint_entry)
+    {
+        find_entry = ledger->hint_entry;
+    }
+    else
+    {
+        find_entry = gnc_entry_ledger_get_current_entry(ledger);
+        /* XXX: get current entry (cursor_hint_xxx) */
+    }
+
+    /* If the current cursor has changed we save the values for later
+     * possible restoration. */
+    if (gnc_table_current_cursor_changed (table, TRUE) &&
+            (find_entry == gnc_entry_ledger_get_current_entry (ledger)))
+    {
+        cursor_buffer = gnc_cursor_buffer_new ();
+        gnc_table_save_current_cursor (table, cursor_buffer);
+    }
+    else
+        cursor_buffer = NULL;
+
+    /* disable move callback -- we don't want the cascade of
+     * callbacks while we are fiddling with loading the register */
+    gnc_table_control_allow_move (table->control, FALSE);
+
+    /* invalidate the cursor */
+    {
+        VirtualLocation virt_loc;
+
+        virt_loc.vcell_loc.virt_row = -1;
+        virt_loc.vcell_loc.virt_col = -1;
+        virt_loc.phys_row_offset = -1;
+        virt_loc.phys_col_offset = -1;
+
+        gnc_table_move_cursor_gui (table, virt_loc);
+    }
+
+    /* make sure that the header is loaded */
+    vcell_loc.virt_row = 0;
+    vcell_loc.virt_col = 0;
+    cursor_header = gnc_table_layout_get_cursor (table->layout, CURSOR_HEADER);
+    gnc_table_set_vcell (table, cursor_header, NULL, TRUE, TRUE, vcell_loc);
+    vcell_loc.virt_row++;
+
+    /* get the current time and reset the dividing row */
+    table->model->dividing_row_upper = -1;
+    table->model->dividing_row = -1;
+    table->model->dividing_row_lower = -1;
+    cursor = gnc_table_layout_get_cursor (table->layout, "cursor");
+
+    /* Populate the table */
+    for (node = entry_list; node; node = node->next)
+    {
+        GncEntry *entry = node->data;
+
+        /* Don't load the blank entry */
+        if (entry == blank_entry)
+            continue;
+
+        /* If this is the first load of the ledger, fill the quickfill cells */
+        {
+            /* XXX */
+        }
+
+        if (entry == find_entry)
+            new_entry_row = vcell_loc.virt_row;
+
+        gnc_table_set_vcell (table, cursor, gncEntryGetGUID (entry),
+                             TRUE, start_primary_color, vcell_loc);
+        vcell_loc.virt_row++;
+
+        /* Flip color for the next guy */
+        start_primary_color = !start_primary_color;
+    }
+
+    /* Add the blank entry at the end. */
+    if (blank_entry)
+    {
+        gnc_table_set_vcell (table, cursor, gncEntryGetGUID (blank_entry),
+                             TRUE, start_primary_color, vcell_loc);
+
+        if (find_entry == blank_entry)
+            new_entry_row = vcell_loc.virt_row;
+
+        vcell_loc.virt_row++;
+    }
+
+    /* Resize the table */
+    gnc_table_set_size (table, vcell_loc.virt_row, 1);
+
+    /* Restore the cursor to its rightful position */
+    if (new_entry_row > 0)
+        save_loc.vcell_loc.virt_row = new_entry_row;
+
+    if (gnc_table_find_close_valid_cell (table, &save_loc, FALSE))
+    {
+        gnc_table_move_cursor_gui (table, save_loc);
+
+        if (find_entry == gnc_entry_ledger_get_current_entry (ledger))
+            gnc_table_restore_current_cursor (table, cursor_buffer);
+    }
+
+    gnc_cursor_buffer_destroy (cursor_buffer);
+    cursor_buffer = NULL;
+
+    /* Reset the ledger */
+    ledger->traverse_to_new = FALSE;
+    ledger->hint_entry = NULL;
+
+    /* Set the cell fractions */
+
+
+    gnc_table_refresh_gui (table, TRUE);
+    gnc_entry_ledger_show_entry (ledger, table->current_cursor_loc.vcell_loc);
+
+    /* Set completion character */
+    gnc_combo_cell_set_complete_char
+    ((ComboCell *)
+     gnc_table_layout_get_cell (table->layout, ENTRY_IACCT_CELL),
+     gnc_get_account_separator ());
+
+    gnc_combo_cell_set_complete_char
+    ((ComboCell *)
+     gnc_table_layout_get_cell (table->layout, ENTRY_BACCT_CELL),
+     gnc_get_account_separator ());
+
+    /* enable callback for cursor user-driven moves */
+    gnc_table_control_allow_move (table->control, TRUE);
+}
+
+/* =========================== END OF FILE ========================== */
diff --git a/src/register/ledger-core/gncEntryLedgerModel.c b/gnucash/register/ledger-core/gncEntryLedgerModel.c
similarity index 100%
rename from src/register/ledger-core/gncEntryLedgerModel.c
rename to gnucash/register/ledger-core/gncEntryLedgerModel.c
diff --git a/src/register/ledger-core/gncEntryLedgerModel.h b/gnucash/register/ledger-core/gncEntryLedgerModel.h
similarity index 100%
rename from src/register/ledger-core/gncEntryLedgerModel.h
rename to gnucash/register/ledger-core/gncEntryLedgerModel.h
diff --git a/src/register/ledger-core/gncEntryLedgerP.h b/gnucash/register/ledger-core/gncEntryLedgerP.h
similarity index 100%
rename from src/register/ledger-core/gncEntryLedgerP.h
rename to gnucash/register/ledger-core/gncEntryLedgerP.h
diff --git a/src/register/ledger-core/gncmod-ledger-core.c b/gnucash/register/ledger-core/gncmod-ledger-core.c
similarity index 100%
rename from src/register/ledger-core/gncmod-ledger-core.c
rename to gnucash/register/ledger-core/gncmod-ledger-core.c
diff --git a/gnucash/register/ledger-core/split-register-control.c b/gnucash/register/ledger-core/split-register-control.c
new file mode 100644
index 0000000..6f3b611
--- /dev/null
+++ b/gnucash/register/ledger-core/split-register-control.c
@@ -0,0 +1,1859 @@
+/********************************************************************\
+ * split-register-control.c -- split register control object        *
+ *                                                                  *
+ * 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 at gnu.org                   *
+ *                                                                  *
+\********************************************************************/
+
+#include "config.h"
+
+#include <glib.h>
+#include <glib/gi18n.h>
+
+#include "Scrub.h"
+#include "combocell.h"
+#include "gnc-component-manager.h"
+#include "gnc-prefs.h"
+#include "gnc-ui.h"
+#include "gnc-warnings.h"
+#include "pricecell.h"
+#include "datecell.h"
+#include "dialog-transfer.h"
+#include "dialog-utils.h"
+#include "split-register-control.h"
+#include "split-register-model-save.h"
+#include "split-register-p.h"
+#include "table-allgui.h"
+#include "engine-helpers.h"
+
+
+/* This static indicates the debugging module that this .o belongs to. */
+static QofLogModule log_module = GNC_MOD_LEDGER;
+
+
+static gboolean
+gnc_split_register_balance_trans (SplitRegister *reg, Transaction *trans)
+{
+    int choice;
+    int default_value;
+    Account *default_account;
+    Account *other_account;
+    Account *root;
+    GList *radio_list = NULL;
+    const char *title   = _("Rebalance Transaction");
+    const char *message = _("The current transaction is not balanced.");
+    Split *split;
+    Split *other_split;
+    gboolean two_accounts;
+    gboolean multi_currency;
+
+
+    if (xaccTransIsBalanced (trans))
+        return FALSE;
+
+    if (xaccTransUseTradingAccounts (trans))
+    {
+        MonetaryList *imbal_list;
+        gnc_monetary *imbal_mon;
+        imbal_list = xaccTransGetImbalance (trans);
+
+        /* See if the imbalance is only in the transaction's currency */
+        if (!imbal_list)
+            /* Value imbalance, but not commodity imbalance.  This shouldn't
+               be something that scrubbing can cause to happen.  Perhaps someone
+               entered invalid splits.  */
+            multi_currency = TRUE;
+        else
+        {
+            imbal_mon = imbal_list->data;
+            if (!imbal_list->next &&
+                    gnc_commodity_equiv(gnc_monetary_commodity(*imbal_mon),
+                                        xaccTransGetCurrency(trans)))
+                multi_currency = FALSE;
+            else
+                multi_currency = TRUE;
+        }
+
+        /* We're done with the imbalance list, the real work will be done
+           by xaccTransScrubImbalance which will get it again. */
+        gnc_monetary_list_free(imbal_list);
+    }
+    else
+        multi_currency = FALSE;
+
+    split = xaccTransGetSplit (trans, 0);
+    other_split = xaccSplitGetOtherSplit (split);
+
+    if (other_split == NULL)
+    {
+        /* Attempt to handle the inverted many-to-one mapping */
+        split = xaccTransGetSplit (trans, 1);
+        if (split) other_split = xaccSplitGetOtherSplit (split);
+        else split = xaccTransGetSplit (trans, 0);
+    }
+    if (other_split == NULL || multi_currency)
+    {
+        two_accounts = FALSE;
+        other_account = NULL;
+    }
+    else
+    {
+        two_accounts = TRUE;
+        other_account = xaccSplitGetAccount (other_split);
+    }
+
+    default_account = gnc_split_register_get_default_account (reg);
+
+    /* If the two pointers are the same, the account from other_split
+     * is actually the default account. We must make other_account
+     * the account from split instead.   */
+
+    if (default_account == other_account)
+        other_account = xaccSplitGetAccount (split);
+
+    /*  If the two pointers are still the same, we have two splits, but
+     *  they both refer to the same account. While non-sensical, we don't
+     *  object.   */
+
+    if (default_account == other_account)
+        two_accounts = FALSE;
+
+    radio_list = g_list_append (radio_list,
+                                _("Balance it _manually"));
+    radio_list = g_list_append (radio_list,
+                                _("Let GnuCash _add an adjusting split"));
+
+    if (reg->type < NUM_SINGLE_REGISTER_TYPES && !multi_currency)
+    {
+        radio_list = g_list_append (radio_list,
+                                    _("Adjust current account _split total"));
+
+        default_value = 2;
+        if (two_accounts)
+        {
+            radio_list = g_list_append (radio_list,
+                                        _("Adjust _other account split total"));
+            default_value = 3;
+        }
+    }
+    else
+        default_value = 0;
+
+    choice = gnc_choose_radio_option_dialog
+             (gnc_split_register_get_parent (reg),
+              title,
+              message,
+              _("_Rebalance"),
+              default_value,
+              radio_list);
+
+    g_list_free (radio_list);
+
+    root = default_account ? gnc_account_get_root(default_account) : NULL;
+    switch (choice)
+    {
+    default:
+    case 0:
+        break;
+
+    case 1:
+        xaccTransScrubImbalance (trans, root, NULL);
+        break;
+
+    case 2:
+        xaccTransScrubImbalance (trans, root, default_account);
+        break;
+
+    case 3:
+        xaccTransScrubImbalance (trans, root, other_account);
+        break;
+    }
+
+    return TRUE;
+}
+
+static gboolean
+gnc_split_register_old_split_empty_p (SplitRegister *reg, Split *split)
+{
+    BasicCell *cell;
+    gnc_numeric amount;
+    const char *string;
+
+    string = gnc_table_layout_get_cell_value (reg->table->layout, MEMO_CELL);
+    if ((string != NULL) && (*string != '\0'))
+        return FALSE;
+
+    string = gnc_table_layout_get_cell_value (reg->table->layout, XFRM_CELL);
+    if ((string != NULL) && (*string != '\0'))
+        return FALSE;
+
+    cell = gnc_table_layout_get_cell (reg->table->layout, CRED_CELL);
+    if (cell)
+    {
+        amount = gnc_price_cell_get_value ((PriceCell *) cell);
+        if (!gnc_numeric_zero_p (amount))
+            return FALSE;
+    }
+
+    cell = gnc_table_layout_get_cell (reg->table->layout, DEBT_CELL);
+    if (cell)
+    {
+        amount = gnc_price_cell_get_value ((PriceCell *) cell);
+        if (!gnc_numeric_zero_p (amount))
+            return FALSE;
+    }
+
+    return TRUE;
+}
+
+/* Checks a cell for a debit or credit change to see if a new exchange
+ * rate is needed. */
+
+static gboolean
+gnc_split_register_check_debcred (SplitRegister *reg,
+                                  const char *cell_name)
+{
+    if ((gnc_cell_name_equal (cell_name, DEBT_CELL) &&
+            gnc_table_layout_get_cell_changed (reg->table->layout,
+                                               DEBT_CELL, FALSE)) ||
+         (gnc_cell_name_equal (cell_name, CRED_CELL) &&
+            gnc_table_layout_get_cell_changed (reg->table->layout,
+                                               CRED_CELL, FALSE)))
+    {
+        SRInfo *info = gnc_split_register_get_info (reg);
+        PriceCell *rate_cell = (PriceCell *) gnc_table_layout_get_cell (reg->table->layout,
+                                RATE_CELL);
+        if (gnc_split_reg_has_rate_cell(reg->type) && info->rate_reset != RATE_RESET_DONE)
+        {
+            /* Debit or credit amount changed, get a new exchange rate */
+            info->rate_reset = RATE_RESET_REQD;
+            if (info->auto_complete)
+            {
+                /* It's auto-filled, start with rate from price DB for the date
+                   of the transaction. */
+                gnc_price_cell_set_value (rate_cell, gnc_numeric_zero());
+            }
+        }
+    }
+
+    return TRUE;
+}
+
+/* Checks a cell for an account change and takes any necessary action if
+ * one has occurred. Returns TRUE if the check passes, FALSE if it fails. */
+static gboolean
+gnc_split_register_check_account (SplitRegister *reg,
+                                  const char *cell_name)
+{
+    SRInfo *info;
+    ComboCell *cell = NULL;
+    Account* new_acct;
+    Split *split;
+    char *name;
+
+    g_return_val_if_fail(reg, TRUE);
+
+    /* See if we are leaving an account field */
+    if (gnc_cell_name_equal (cell_name, XFRM_CELL))
+    {
+        if (gnc_table_layout_get_cell_changed (reg->table->layout,
+                                               XFRM_CELL, FALSE))
+            cell = (ComboCell *) gnc_table_layout_get_cell (reg->table->layout,
+                    XFRM_CELL);
+    }
+    else if (gnc_cell_name_equal (cell_name, MXFRM_CELL))
+    {
+        if (gnc_table_layout_get_cell_changed (reg->table->layout,
+                                               MXFRM_CELL, FALSE))
+            cell = (ComboCell *) gnc_table_layout_get_cell (reg->table->layout,
+                    MXFRM_CELL);
+    }
+
+    if (!cell)
+        return TRUE;
+
+    /* The account has been changed. */
+    name = cell->cell.value;
+    DEBUG("Changed to %s", name ? name : "NULL");
+    if (!name || *name == '\0' ||
+            g_strcmp0 (name, SPLIT_TRANS_STR) == 0 ||
+            g_strcmp0 (name, STOCK_SPLIT_STR) == 0)
+        return TRUE;
+
+    /* Create the account if necessary. Also checks for a placeholder. */
+    info = gnc_split_register_get_info (reg);
+    new_acct = gnc_split_register_get_account_by_name (reg,
+               (BasicCell *) cell,
+               cell->cell.value);
+    if (!new_acct)
+        return FALSE;
+
+    split = gnc_split_register_get_current_split(reg);
+    gnc_split_register_set_cell_fractions (reg, split);
+
+    /* See if we need to reset the exchange rate. */
+    if (gnc_split_reg_has_rate_cell(reg->type))
+    {
+        PriceCell     *rate_cell = (PriceCell *) gnc_table_layout_get_cell (reg->table->layout,
+                                                                            RATE_CELL);
+        Account       *orig_acct = xaccSplitGetAccount(split);
+        gnc_commodity *orig_com  = xaccAccountGetCommodity(orig_acct);
+        gnc_commodity *last_com  = xaccAccountGetCommodity(info->rate_account);
+        gnc_commodity *new_com   = xaccAccountGetCommodity(new_acct);
+
+        if (gnc_commodity_equal(last_com ? last_com : orig_com, new_com))
+        {
+            DEBUG("Commodity is still %s. Leaving rate unchanged.",
+                  new_com  ? gnc_commodity_get_mnemonic(new_com) : "NULL");
+        }
+        else if (!gnc_commodity_equal(orig_com, new_com))
+        {
+            /* The commodity has changed but is not the original. Reset the rate. */
+            DEBUG("Commodity now %s (originally %s). Clearing rate.",
+                  new_com  ? gnc_commodity_get_mnemonic(new_com) : "NULL",
+                  orig_com ? gnc_commodity_get_mnemonic(orig_com) : "NULL");
+
+            gnc_price_cell_set_value (rate_cell, gnc_numeric_zero());
+            info->rate_account = new_acct;
+            info->rate_reset = RATE_RESET_REQD;
+        }
+        else
+        {
+            /* Get the original rate from the split. */
+            gnc_numeric amt       = xaccSplitGetAmount(split);
+            gnc_numeric val       = xaccSplitGetValue(split);
+            gnc_numeric orig_rate = gnc_numeric_div(amt, val, GNC_DENOM_AUTO,
+                                                    GNC_HOW_DENOM_REDUCE);
+
+            if (!gnc_numeric_check(orig_rate))
+            {
+                DEBUG("Using original rate of %s.",
+                      gnc_num_dbg_to_string(orig_rate));
+                gnc_price_cell_set_value (rate_cell, orig_rate);
+                info->rate_account = new_acct;
+                info->rate_reset = RATE_RESET_NOT_REQD;
+            }
+            else
+            {
+                DEBUG("Can't get rate. Using zero.");
+                gnc_price_cell_set_value (rate_cell, gnc_numeric_zero());
+                info->rate_account = new_acct;
+                info->rate_reset = RATE_RESET_REQD;
+            }
+        }
+    }
+
+    return TRUE;
+}
+
+static void
+gnc_split_register_move_cursor (VirtualLocation *p_new_virt_loc,
+                                gpointer user_data)
+{
+    VirtualLocation new_virt_loc = *p_new_virt_loc;
+    VirtualCellLocation old_trans_split_loc;
+    SplitRegister *reg = user_data;
+    Transaction *pending_trans;
+    Transaction *new_trans;
+    Transaction *old_trans;
+    Split *old_trans_split;
+    Split *new_trans_split;
+    Split *new_split;
+    Split *old_split;
+    CursorClass new_class;
+    CursorClass old_class;
+    gboolean exact_traversal;
+    gboolean do_refresh;
+    gboolean saved;
+    SRInfo *info;
+
+    ENTER("reg=%p, p_new_virt_loc=%p (%d, %d)",
+          reg, p_new_virt_loc,
+          new_virt_loc.vcell_loc.virt_row,
+          new_virt_loc.vcell_loc.virt_col);
+
+    if (!reg)
+    {
+        LEAVE("no register");
+        return;
+    }
+
+    info = gnc_split_register_get_info (reg);
+
+    /* The transaction we are coming from */
+    old_split = gnc_split_register_get_current_split (reg);
+    old_trans = gnc_split_register_get_current_trans (reg);
+    old_trans_split =
+        gnc_split_register_get_current_trans_split (reg, &old_trans_split_loc);
+    old_class = gnc_split_register_get_current_cursor_class (reg);
+
+    exact_traversal = info->exact_traversal;
+
+    if (info->traverse_to_new)
+    {
+        if (old_class == CURSOR_CLASS_SPLIT)
+            new_trans = old_trans;
+        else
+            new_trans = NULL;
+
+        new_split = NULL;
+        new_trans_split = NULL;
+        new_class = CURSOR_CLASS_NONE;
+    }
+    else if (!info->hint_set_by_traverse)
+    {
+        /* The transaction where we are moving to */
+        new_trans = gnc_split_register_get_trans (reg, new_virt_loc.vcell_loc);
+
+        /* The split we are moving to */
+        new_split = gnc_split_register_get_split (reg, new_virt_loc.vcell_loc);
+
+        /* The split at the transaction line we are moving to */
+        new_trans_split = gnc_split_register_get_trans_split
+                          (reg, new_virt_loc.vcell_loc, NULL);
+
+        new_class = gnc_split_register_get_cursor_class (reg,
+                    new_virt_loc.vcell_loc);
+    }
+    else
+    {
+        new_trans = info->cursor_hint_trans;
+        new_split = info->cursor_hint_split;
+        new_trans_split = info->cursor_hint_trans_split;
+        new_class = info->cursor_hint_cursor_class;
+    }
+
+    info->hint_set_by_traverse = FALSE;
+    info->reg_loaded = FALSE;
+
+    gnc_suspend_gui_refresh ();
+
+    /* commit the contents of the cursor into the database */
+    saved = gnc_split_register_save (reg, old_trans != new_trans);
+    pending_trans = xaccTransLookup (&info->pending_trans_guid,
+                                     gnc_get_current_book ());
+    if ((old_class == CURSOR_CLASS_SPLIT) &&
+            old_split &&
+            (old_split != new_split) &&
+            gnc_split_register_old_split_empty_p(reg, old_split))
+    {
+        int current_row;
+
+        xaccSplitDestroy(old_split);
+        old_split = NULL;
+
+        /*
+         * If the user is moving down a row, we've just thrown off the
+         * numbers by deleting a split. Correct for that.
+         */
+        current_row = reg->table->current_cursor_loc.vcell_loc.virt_row;
+        if (new_virt_loc.vcell_loc.virt_row > current_row)
+            new_virt_loc.vcell_loc.virt_row--;
+    }
+    else if ((pending_trans != NULL)      &&
+             (pending_trans == old_trans) &&
+             (old_trans != new_trans))
+    {
+        if (gnc_split_register_balance_trans (reg, pending_trans))
+        {
+            /* Trans was unbalanced. */
+            new_trans = old_trans;
+            new_split = old_split;
+            new_trans_split = old_trans_split;
+            new_class = old_class;
+            new_virt_loc = reg->table->current_cursor_loc;
+        }
+        else
+        {
+            /* Trans was balanced. Let it go. */
+            info->pending_trans_guid = *guid_null ();
+            if (xaccTransIsOpen (pending_trans))
+                xaccTransCommitEdit (pending_trans);
+            else g_assert_not_reached();
+
+            pending_trans = NULL;
+            saved = TRUE;
+        }
+    }
+    else if (old_trans &&
+             (old_trans != new_trans) &&
+             !xaccTransHasReconciledSplits(old_trans) &&
+             !info->first_pass &&
+             gnc_split_register_balance_trans (reg, old_trans))
+    {
+        /* no matter what, stay there so the user can see what happened */
+        new_trans = old_trans;
+        new_split = old_split;
+        new_trans_split = old_trans_split;
+        new_class = old_class;
+        new_virt_loc = reg->table->current_cursor_loc;
+    }
+
+    if (saved)
+    {
+        info->cursor_hint_trans = new_trans;
+        info->cursor_hint_split = new_split;
+        info->cursor_hint_trans_split = new_trans_split;
+        info->cursor_hint_cursor_class = new_class;
+    }
+
+    if (old_split != new_split)
+    {
+        info->change_confirmed = FALSE;
+        info->rate_account = NULL;
+        info->rate_reset = RATE_RESET_NOT_REQD;
+    }
+
+    gnc_resume_gui_refresh ();
+
+    /* redrawing the register can muck everything up */
+    if (saved)
+    {
+        VirtualCellLocation vcell_loc;
+
+        if (!info->reg_loaded)
+            gnc_split_register_redraw (reg);
+
+        /* if the split we were going to is still in the register,
+         * then it may have moved. Find out where it is now. */
+        if (gnc_split_register_find_split (reg, new_trans, new_trans_split,
+                                           new_split, new_class, &vcell_loc))
+        {
+
+            gnc_table_get_virtual_cell (reg->table, vcell_loc);
+            new_virt_loc.vcell_loc = vcell_loc;
+        }
+        else
+            new_virt_loc.vcell_loc = reg->table->current_cursor_loc.vcell_loc;
+
+        new_trans = gnc_split_register_get_trans (reg, new_virt_loc.vcell_loc);
+        new_split = gnc_split_register_get_split (reg, new_virt_loc.vcell_loc);
+        new_trans_split = gnc_split_register_get_trans_split(
+                              reg, new_virt_loc.vcell_loc, NULL);
+        new_class = gnc_split_register_get_cursor_class (reg,
+                    new_virt_loc.vcell_loc);
+    }
+    else if (info->traverse_to_new)
+    {
+        new_trans = info->cursor_hint_trans;
+        new_split = info->cursor_hint_split;
+        new_trans_split = info->cursor_hint_trans_split;
+        new_class = info->cursor_hint_cursor_class;
+    }
+
+    gnc_table_find_close_valid_cell (reg->table, &new_virt_loc, exact_traversal);
+
+    *p_new_virt_loc = new_virt_loc;
+
+    PINFO ("after move %d %d \n",
+           new_virt_loc.vcell_loc.virt_row,
+           new_virt_loc.vcell_loc.virt_col);
+
+    /* if the register was reloaded, then everything should be fine :)
+     * otherwise, we may need to change some visibility settings. */
+    if (saved)
+    {
+        gnc_split_register_set_cell_fractions (reg, new_split);
+
+        LEAVE("saved");
+        return;
+    }
+
+    /* in the mult-line and dynamic modes, we need to hide the old
+     * and show the new. */
+    if (gnc_split_register_current_trans_expanded (reg) &&
+            (old_trans_split != new_trans_split))
+    {
+        VirtualCellLocation vc_loc;
+
+        vc_loc = old_trans_split_loc;
+        gnc_table_set_virt_cell_cursor(
+            reg->table, vc_loc, gnc_split_register_get_passive_cursor (reg));
+        gnc_split_register_set_trans_visible (reg, vc_loc, FALSE,
+                                              reg->style == REG_STYLE_JOURNAL);
+
+        if ((REG_STYLE_AUTO_LEDGER == reg->style) ||
+                (REG_STYLE_JOURNAL     == reg->style))
+        {
+            gnc_split_register_get_trans_split (reg, new_virt_loc.vcell_loc,
+                                                &vc_loc);
+            gnc_table_set_virt_cell_cursor
+            (reg->table, vc_loc, gnc_split_register_get_active_cursor (reg));
+            gnc_split_register_set_trans_visible (reg, vc_loc, TRUE,
+                                                  reg->style == REG_STYLE_JOURNAL);
+        }
+
+        info->trans_expanded = FALSE;
+
+        do_refresh = TRUE;
+    }
+    else
+        do_refresh = FALSE;
+
+    info->cursor_hint_trans = new_trans;
+    info->cursor_hint_split = new_split;
+    info->cursor_hint_trans_split = new_trans_split;
+    info->cursor_hint_cursor_class = new_class;
+
+    gnc_split_register_set_cell_fractions (reg, new_split);
+
+    gnc_table_find_close_valid_cell (reg->table, p_new_virt_loc,
+                                     exact_traversal);
+
+    if (do_refresh)
+    {
+        VirtualCellLocation vc_loc;
+
+        gnc_table_refresh_gui (reg->table, FALSE);
+        gnc_table_leave_update (reg->table, reg->table->current_cursor_loc);
+
+        gnc_split_register_get_trans_split (reg, p_new_virt_loc->vcell_loc,
+                                            &vc_loc);
+        gnc_split_register_show_trans (reg, vc_loc);
+    }
+
+    LEAVE(" ");
+}
+
+static Split *
+gnc_find_split_in_trans_by_memo (Transaction *trans, const char *memo,
+                                 gboolean unit_price)
+{
+    int i = 0;
+    Split *split;
+
+    while ((split = xaccTransGetSplit(trans, i)) != NULL)
+    {
+        i++;
+        if (unit_price)
+        {
+            gnc_numeric price = xaccSplitGetSharePrice (split);
+            if (!gnc_numeric_equal (price, gnc_numeric_create (1, 1)))
+                continue;
+        }
+
+        if (g_strcmp0 (memo, xaccSplitGetMemo (split)) == 0)
+            return split;
+    }
+
+    return NULL;
+}
+
+static Split *
+gnc_find_split_in_account_by_memo (Account *account, const char *memo,
+                                   gboolean unit_price)
+{
+    GList *slp;
+
+    if (account == NULL) return NULL;
+
+    for (slp = g_list_last (xaccAccountGetSplitList (account));
+            slp;
+            slp = slp->prev)
+    {
+        Split *split = slp->data;
+        Transaction *trans = xaccSplitGetParent (split);
+
+        split = gnc_find_split_in_trans_by_memo (trans, memo, unit_price);
+
+        if (split) return split;
+    }
+
+    return NULL;
+}
+
+static Split *
+gnc_find_split_in_reg_by_memo (SplitRegister *reg, const char *memo,
+                               gboolean unit_price)
+{
+    int virt_row, virt_col;
+    int num_rows, num_cols;
+    Transaction *last_trans;
+
+    if (!reg || !reg->table)
+        return NULL;
+
+    num_rows = reg->table->num_virt_rows;
+    num_cols = reg->table->num_virt_cols;
+
+    last_trans = NULL;
+
+    for (virt_row = num_rows - 1; virt_row >= 0; virt_row--)
+        for (virt_col = num_cols - 1; virt_col >= 0; virt_col--)
+        {
+            Split *split;
+            Transaction *trans;
+            VirtualCellLocation vcell_loc = { virt_row, virt_col };
+
+            split = gnc_split_register_get_split (reg, vcell_loc);
+            trans = xaccSplitGetParent (split);
+
+            if (trans == last_trans)
+                continue;
+
+            split = gnc_find_split_in_trans_by_memo (trans, memo, unit_price);
+            if (split != NULL)
+                return split;
+
+            last_trans = trans;
+        }
+
+    return NULL;
+}
+
+static Transaction *
+gnc_find_trans_in_reg_by_desc (SplitRegister *reg, const char *description)
+{
+    int virt_row, virt_col;
+    int num_rows, num_cols;
+    Transaction *last_trans;
+
+    if (!reg || !reg->table)
+        return NULL;
+
+    num_rows = reg->table->num_virt_rows;
+    num_cols = reg->table->num_virt_cols;
+
+    last_trans = NULL;
+
+    for (virt_row = num_rows - 1; virt_row >= 0; virt_row--)
+        for (virt_col = num_cols - 1; virt_col >= 0; virt_col--)
+        {
+            Split *split;
+            Transaction *trans;
+            VirtualCellLocation vcell_loc = { virt_row, virt_col };
+
+            split = gnc_split_register_get_split (reg, vcell_loc);
+            trans = xaccSplitGetParent(split);
+
+            if (trans == last_trans)
+                continue;
+
+            if (g_strcmp0 (description, xaccTransGetDescription (trans)) == 0)
+                return trans;
+
+            last_trans = trans;
+        }
+
+    return NULL;
+}
+
+/* This function determines if auto-completion is appropriate and,
+ * if so, performs it. This should only be called by LedgerTraverse. */
+static gboolean
+gnc_split_register_auto_completion (SplitRegister *reg,
+                                    gncTableTraversalDir dir,
+                                    VirtualLocation *p_new_virt_loc)
+{
+    SRInfo *info = gnc_split_register_get_info (reg);
+    VirtualLocation new_virt_loc;
+    CursorClass cursor_class;
+    Transaction *pending_trans;
+    Transaction *blank_trans;
+    const char *cell_name;
+    Transaction *trans;
+    Split *blank_split;
+    gnc_numeric amount;
+    BasicCell *cell;
+    Split *split;
+
+    if (!reg->do_auto_complete)
+        return FALSE;
+
+    blank_split = xaccSplitLookup (&info->blank_split_guid,
+                                   gnc_get_current_book ());
+    blank_trans = xaccSplitGetParent (blank_split);
+
+    pending_trans = xaccTransLookup (&info->pending_trans_guid,
+                                     gnc_get_current_book ());
+
+    /* auto-completion is only triggered by a tab out */
+    if (dir != GNC_TABLE_TRAVERSE_RIGHT)
+        return FALSE;
+
+    split = gnc_split_register_get_current_split (reg);
+    trans = gnc_split_register_get_current_trans (reg);
+    if (trans == NULL)
+        return FALSE;
+
+    cursor_class = gnc_split_register_get_current_cursor_class (reg);
+    cell_name = gnc_table_get_current_cell_name (reg->table);
+
+    switch (cursor_class)
+    {
+    case CURSOR_CLASS_TRANS:
+    {
+        Transaction *auto_trans;
+        const char *desc;
+
+        /* there must be a blank transaction * */
+        if (blank_trans == NULL)
+            return FALSE;
+
+        /* we must be on the blank split */
+        if (trans != blank_trans)
+            return FALSE;
+
+        /* and leaving the description cell */
+        if (!gnc_cell_name_equal (cell_name, DESC_CELL))
+            return FALSE;
+
+        /* nothing but the date, num, and description should be changed */
+        /* FIXME, this should be refactored. */
+        if (gnc_table_layout_get_cell_changed (reg->table->layout,
+                                               XFRM_CELL, TRUE)  ||
+                gnc_table_layout_get_cell_changed (reg->table->layout,
+                        MXFRM_CELL, TRUE) ||
+                gnc_table_layout_get_cell_changed (reg->table->layout,
+                        PRIC_CELL, TRUE)  ||
+                gnc_table_layout_get_cell_changed (reg->table->layout,
+                        SHRS_CELL, TRUE)  ||
+                gnc_table_layout_get_cell_changed (reg->table->layout,
+                        DEBT_CELL, TRUE)  ||
+                gnc_table_layout_get_cell_changed (reg->table->layout,
+                        CRED_CELL, TRUE)  ||
+                gnc_table_layout_get_cell_changed (reg->table->layout,
+                        NOTES_CELL, TRUE) ||
+                gnc_table_layout_get_cell_changed (reg->table->layout,
+                        RECN_CELL, TRUE))
+            return FALSE;
+
+        /* and the description should be changed */
+        if (!gnc_table_layout_get_cell_changed (reg->table->layout,
+                                                DESC_CELL, TRUE))
+            return FALSE;
+
+        /* to a non-empty value */
+        desc = gnc_table_layout_get_cell_value (reg->table->layout, DESC_CELL);
+        if ((desc == NULL) || (*desc == '\0'))
+            return FALSE;
+
+        /* find a transaction to auto-complete on */
+        if (gnc_split_register_get_default_account (reg) != NULL)
+        {
+            Account *account = gnc_split_register_get_default_account (reg);
+
+            auto_trans = xaccAccountFindTransByDesc(account, desc);
+        }
+        else
+            auto_trans = gnc_find_trans_in_reg_by_desc(reg, desc);
+
+        if (auto_trans == NULL)
+            return FALSE;
+
+        gnc_suspend_gui_refresh ();
+
+        /* We are guaranteed to be on the blank trans, so we can
+           discount the possibility that the current transaction is
+           being edited in another register. */
+        /* now perform the completion */
+        if (pending_trans != trans)
+        {
+            if (!xaccTransIsOpen(trans))
+                xaccTransBeginEdit(trans);
+            /* This is now the pending transaction */
+            info->pending_trans_guid = *xaccTransGetGUID(trans);
+            if (pending_trans != NULL)
+            {
+                if (xaccTransIsOpen (pending_trans))
+                    xaccTransCommitEdit (pending_trans);
+                else g_assert_not_reached();
+            }
+        }
+        g_assert(xaccTransIsOpen(trans));
+        pending_trans = xaccTransLookup(&info->pending_trans_guid,
+                                        gnc_get_current_book ());
+        g_assert(pending_trans == trans);
+
+        gnc_copy_trans_onto_trans (auto_trans, trans, FALSE, FALSE);
+        blank_split = NULL;
+
+        if (gnc_split_register_get_default_account (reg) != NULL)
+        {
+            Account *default_account =
+                gnc_split_register_get_default_account (reg);
+            gnc_commodity *trans_cmdty = xaccTransGetCurrency(trans);
+            gnc_commodity *acct_cmdty = xaccAccountGetCommodity(default_account);
+            Split *s;
+            int i = 0;
+            if (gnc_commodity_is_currency(acct_cmdty) &&
+                !gnc_commodity_equal(trans_cmdty, acct_cmdty))
+                xaccTransSetCurrency(trans, acct_cmdty);
+
+            while ((s = xaccTransGetSplit(trans, i)) != NULL)
+            {
+                if (default_account == xaccSplitGetAccount(s))
+                {
+                    blank_split = s;
+                    info->blank_split_guid = *xaccSplitGetGUID(blank_split);
+                    break;
+                }
+                i++;
+            }
+        }
+
+        if (blank_split == NULL)
+        {
+            blank_split = xaccTransGetSplit(trans, 0);
+            info->blank_split_guid = *xaccSplitGetGUID(blank_split);
+        }
+        DEBUG("blank_split=%p", blank_split);
+
+        info->blank_split_edited = TRUE;
+
+        {
+            SRSaveData *sd;
+
+            sd = gnc_split_register_save_data_new(
+                     trans, blank_split, gnc_split_register_current_trans_expanded (reg));
+            gnc_table_save_cells (reg->table, sd);
+            gnc_split_register_save_data_destroy (sd);
+        }
+
+        gnc_resume_gui_refresh ();
+
+        /* now move to the non-empty amount column unless config setting says not */
+        if ( !gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL_REGISTER,
+                                 GNC_PREF_TAB_TRANS_MEMORISED) )
+        {
+            amount = xaccSplitGetAmount (blank_split);
+            cell_name = (gnc_numeric_negative_p (amount)) ? CRED_CELL : DEBT_CELL;
+
+            if (gnc_table_get_current_cell_location (reg->table, cell_name,
+                    &new_virt_loc))
+                *p_new_virt_loc = new_virt_loc;
+        }
+    }
+
+    break;
+
+    case CURSOR_CLASS_SPLIT:
+    {
+        char *account_name;
+        const char *memo;
+        gboolean unit_price;
+        Split *auto_split;
+
+        /* we must be on a blank split of a transaction */
+        if (split != NULL)
+            return FALSE;
+
+        /* and leaving the memo cell */
+        if (!gnc_cell_name_equal (cell_name, MEMO_CELL))
+            return FALSE;
+
+        /* nothing but the action, memo, and amounts should be changed */
+        /* FIXME. This should be refactored. */
+        if (gnc_table_layout_get_cell_changed (reg->table->layout,
+                                               XFRM_CELL, TRUE)  ||
+                gnc_table_layout_get_cell_changed (reg->table->layout,
+                        MXFRM_CELL, TRUE) ||
+                gnc_table_layout_get_cell_changed (reg->table->layout,
+                        PRIC_CELL, TRUE)  ||
+                gnc_table_layout_get_cell_changed (reg->table->layout,
+                        SHRS_CELL, TRUE)  ||
+                gnc_table_layout_get_cell_changed (reg->table->layout,
+                        RECN_CELL, TRUE))
+            return FALSE;
+
+        /* and the memo should be changed */
+        if (!gnc_table_layout_get_cell_changed (reg->table->layout,
+                                                MEMO_CELL, TRUE))
+            return FALSE;
+
+        /* to a non-empty value */
+        memo = gnc_table_layout_get_cell_value (reg->table->layout, MEMO_CELL);
+        if ((memo == NULL) || (*memo == '\0'))
+            return FALSE;
+
+        /* if there is no price field, only auto-complete from splits with
+         * a unit share price. */
+        unit_price = !gnc_table_get_current_cell_location (reg->table,
+                     PRIC_CELL, NULL);
+
+        /* find a split to auto-complete on */
+        if (gnc_split_register_get_default_account (reg) != NULL)
+        {
+            Account *account = gnc_split_register_get_default_account (reg);
+
+            auto_split = gnc_find_split_in_account_by_memo (account, memo,
+                         unit_price);
+        }
+        else
+            auto_split = gnc_find_split_in_reg_by_memo (reg, memo, unit_price);
+
+        if (auto_split == NULL)
+            return FALSE;
+
+        /* the auto-complete code below is taken from xaccSRGetEntryHandler */
+
+        /* auto-complete the action field if it wasn't changed */
+        if (!gnc_table_layout_get_cell_changed (reg->table->layout,
+                                                ACTN_CELL, TRUE))
+        {
+            cell = gnc_table_layout_get_cell (reg->table->layout, ACTN_CELL);
+            gnc_combo_cell_set_value ((ComboCell *) cell,
+                                      gnc_get_num_action (NULL, auto_split));
+        }
+
+        /* auto-complete the account name */
+        cell = gnc_table_layout_get_cell (reg->table->layout, XFRM_CELL);
+
+        account_name = gnc_get_account_name_for_register (xaccSplitGetAccount (auto_split));
+        gnc_combo_cell_set_value ((ComboCell *) cell, account_name);
+        g_free(account_name);
+
+        gnc_basic_cell_set_changed (cell, TRUE);
+
+        if (!gnc_table_layout_get_cell_changed (reg->table->layout,
+                                                DEBT_CELL, TRUE) &&
+                !gnc_table_layout_get_cell_changed (reg->table->layout,
+                        CRED_CELL, TRUE))
+        {
+            BasicCell *debit_cell;
+            BasicCell *credit_cell;
+
+            amount = xaccSplitGetValue (auto_split);
+
+            debit_cell = gnc_table_layout_get_cell (reg->table->layout,
+                                                    DEBT_CELL);
+            credit_cell = gnc_table_layout_get_cell (reg->table->layout,
+                          CRED_CELL);
+
+            gnc_price_cell_set_debt_credit_value ((PriceCell *) debit_cell,
+                                                  (PriceCell *) credit_cell,
+                                                  amount);
+
+            gnc_basic_cell_set_changed (debit_cell, TRUE);
+            gnc_basic_cell_set_changed (credit_cell, TRUE);
+        }
+
+        /* and refresh the gui */
+        gnc_table_refresh_gui (reg->table, TRUE);
+
+        /* now move to the non-empty amount column */
+        amount = xaccSplitGetAmount (auto_split);
+        cell_name = (gnc_numeric_negative_p (amount)) ? CRED_CELL : DEBT_CELL;
+
+        if (gnc_table_get_current_cell_location (reg->table, cell_name,
+                &new_virt_loc))
+            *p_new_virt_loc = new_virt_loc;
+    }
+
+    break;
+
+    default:
+        break;
+    }
+
+    return TRUE;
+}
+
+static void
+gnc_split_register_check_stock_action (SplitRegister *reg,
+                                       const char *cell_name)
+{
+    BasicCell *cell;
+    gnc_numeric shares;
+    gboolean buy, sell;
+    const char *name;
+
+    if (!gnc_cell_name_equal (cell_name, ACTN_CELL) ||
+            !gnc_table_layout_get_cell_changed (reg->table->layout,
+                    ACTN_CELL, FALSE))
+        return;
+
+    cell = gnc_table_layout_get_cell (reg->table->layout, ACTN_CELL);
+    if (!cell)
+        return;
+    name = ((ComboCell *)cell)->cell.value;
+    if ((name == NULL) || (*name == '\0'))
+        return;
+
+    buy  = g_strcmp0 (name, ACTION_BUY_STR)  == 0;
+    sell = g_strcmp0 (name, ACTION_SELL_STR) == 0;
+    if (!buy && !sell)
+        return;
+
+    cell = gnc_table_layout_get_cell (reg->table->layout, SHRS_CELL);
+    if (!cell)
+        return;
+    shares = gnc_price_cell_get_value ((PriceCell *) cell);
+
+    if ((buy  && !gnc_numeric_positive_p (shares)) ||
+            (sell &&  gnc_numeric_positive_p (shares)))
+    {
+        gnc_price_cell_set_value ((PriceCell *)cell, gnc_numeric_neg (shares));
+        gnc_basic_cell_set_changed (cell, TRUE);
+    }
+}
+
+static void
+gnc_split_register_check_stock_shares (SplitRegister *reg,
+                                       const char *cell_name)
+{
+    BasicCell *cell;
+    gnc_numeric shares;
+    gboolean buy;
+    const char *name;
+
+    if (!gnc_cell_name_equal (cell_name, SHRS_CELL) ||
+            !gnc_table_layout_get_cell_changed (reg->table->layout,
+                    SHRS_CELL, FALSE))
+        return;
+
+    cell = gnc_table_layout_get_cell (reg->table->layout, SHRS_CELL);
+    if (!cell)
+        return;
+    shares = gnc_price_cell_get_value ((PriceCell *) cell);
+    if (gnc_numeric_zero_p (shares))
+        return;
+    buy  = gnc_numeric_positive_p (shares);
+
+    cell = gnc_table_layout_get_cell (reg->table->layout, ACTN_CELL);
+    if (!cell)
+        return;
+    name = ((ComboCell *)cell)->cell.value;
+
+    if (!g_strcmp0(name, "") ||
+            !g_strcmp0(name, buy ? ACTION_SELL_STR : ACTION_BUY_STR))
+    {
+        gnc_combo_cell_set_value((ComboCell *)cell,
+                                 buy ? ACTION_BUY_STR : ACTION_SELL_STR);
+        gnc_basic_cell_set_changed (cell, TRUE);
+    }
+}
+
+/* This function checks a cell for changes and takes appropriate action if a
+ * change has occurred. It is recommended to call this function just before
+ * leaving a cell. Returns FALSE if control should remain in this cell. For
+ * example, the user may have made a mistake and needs another chance to
+ * edit the information before moving on. */
+gboolean
+gnc_split_register_check_cell (SplitRegister *reg, const char *cell_name)
+{
+    ENTER("reg=%p, cell_name=%s", reg, cell_name ? cell_name : "NULL");
+
+    /* See if we are leaving an account field. */
+    if (!gnc_split_register_check_account (reg, cell_name))
+    {
+        LEAVE("account check failed");
+        return FALSE;
+    }
+
+    /* See if we are leaving a debit or credit cell */
+    if (!gnc_split_register_check_debcred (reg, cell_name))
+    {
+        LEAVE("debit/credit check failed");
+        return FALSE;
+    }
+
+    /* See if we are leaving an action field */
+    if ((reg->type == STOCK_REGISTER) ||
+            (reg->type == PORTFOLIO_LEDGER) ||
+            (reg->type == CURRENCY_REGISTER))
+    {
+        gnc_split_register_check_stock_action (reg, cell_name);
+        gnc_split_register_check_stock_shares (reg, cell_name);
+    }
+
+    LEAVE(" ");
+    return TRUE;
+}
+
+static Account *
+gnc_split_register_get_account_always (SplitRegister *reg,
+                                       const char * cell_name)
+{
+    BasicCell *cell;
+    const char *name;
+
+    cell = gnc_table_layout_get_cell (reg->table->layout, cell_name);
+    if (!cell)
+        return NULL;
+    name = gnc_basic_cell_get_value (cell);
+
+    /* If 'name' is "-- Split Transaction --" then return NULL or the
+       register acct */
+    if (!g_strcmp0 (name, SPLIT_TRANS_STR))
+    {
+        return NULL;
+    }
+
+    return gnc_split_register_get_account_by_name (reg, cell, name);
+}
+
+#if 0 /* Not Used */
+static const char *
+gnc_split_register_get_cell_string (SplitRegister *reg, const char *cell_name)
+{
+    BasicCell *cell;
+
+    cell = gnc_table_layout_get_cell (reg->table->layout, cell_name);
+    if (!cell)
+        return "";
+
+    return gnc_basic_cell_get_value (cell);
+}
+
+static Timespec
+gnc_split_register_get_cell_date (SplitRegister *reg, const char *cell_name)
+{
+    DateCell *cell;
+    Timespec ts;
+
+    cell = (DateCell*) gnc_table_layout_get_cell (reg->table->layout, cell_name);
+
+    if (cell)
+        gnc_date_cell_get_date (cell, &ts);
+    else
+        timespecFromTime64 (&ts, gnc_time (NULL));
+
+    return ts;
+}
+#endif /* Not Used */
+
+/* Creates a transfer dialog and fills its values from register cells (if
+ * available) or from the provided transaction and split.
+ */
+static XferDialog *
+gnc_split_register_xfer_dialog(SplitRegister *reg, Transaction *txn,
+                               Split *split)
+{
+    XferDialog *xfer;
+    CellBlock *cur;
+    BasicCell *cell;
+
+    g_return_val_if_fail(reg, NULL);
+    g_return_val_if_fail(reg->table, NULL);
+    cur = reg->table->current_cursor;
+
+    /* Create the exchange rate dialog. */
+    xfer = gnc_xfer_dialog(NULL, NULL);
+    g_return_val_if_fail(xfer, NULL);
+
+    /* Set the description. */
+    cell = gnc_cellblock_get_cell_by_name(cur, DESC_CELL, NULL, NULL);
+    if (cell)
+        gnc_xfer_dialog_set_description(xfer, gnc_basic_cell_get_value(cell));
+    else
+    {
+        const char *str = xaccTransGetDescription(txn);
+        gnc_xfer_dialog_set_description(xfer, str ? str : "");
+    }
+
+    /* Set the memo. */
+    cell = gnc_cellblock_get_cell_by_name(cur, MEMO_CELL, NULL, NULL);
+    if (cell)
+        gnc_xfer_dialog_set_memo(xfer, gnc_basic_cell_get_value(cell));
+    else
+    {
+        const char *str = xaccSplitGetMemo(split);
+        gnc_xfer_dialog_set_memo(xfer, str ? str : "");
+    }
+
+    /* Set the num. */
+    cell = gnc_cellblock_get_cell_by_name(cur, NUM_CELL, NULL, NULL);
+    if (cell)
+        gnc_xfer_dialog_set_num(xfer, gnc_basic_cell_get_value(cell));
+    else
+    {
+        const char *str = gnc_get_num_action (txn, split);
+        gnc_xfer_dialog_set_num(xfer, str ? str : "");
+    }
+
+    /* Set the date. */
+    cell = gnc_cellblock_get_cell_by_name(cur, DATE_CELL, NULL, NULL);
+    if (cell)
+    {
+        Timespec ts;
+        gnc_date_cell_get_date((DateCell*) cell, &ts);
+        gnc_xfer_dialog_set_date(xfer, timespecToTime64(ts));
+    }
+    else
+        gnc_xfer_dialog_set_date(xfer, xaccTransGetDate(txn));
+
+    return xfer;
+}
+
+/** If needed display the transfer dialog to get a price/exchange rate and
+ * adjust the price cell accordingly.
+ * If the dialog does not complete successfully, then return TRUE.
+ * Return FALSE in all other cases (meaning "move on")
+ * @param reg the register to operate on
+ * @param force_dialog pop a dialog even if we don't think we need it.
+ * @return whether more handling is required.
+ */
+gboolean
+gnc_split_register_handle_exchange (SplitRegister *reg, gboolean force_dialog)
+{
+    SRInfo *info;
+    Transaction *txn;
+    Split *split, *osplit;
+    Account *xfer_acc, *reg_acc;
+    gnc_commodity *txn_cur, *xfer_com, *reg_com;
+    gnc_numeric amount, exch_rate;
+    XferDialog *xfer;
+    gboolean expanded = FALSE;
+    PriceCell *rate_cell;
+    const char *message;
+    CursorClass cursor_class;
+
+    ENTER("reg=%p, force_dialog=%s", reg, force_dialog ? "TRUE" : "FALSE" );
+
+    /* Make sure we NEED this for this type of register */
+    if (!gnc_split_reg_has_rate_cell (reg->type))
+    {
+        if (force_dialog)
+        {
+            message = _("This register does not support editing exchange rates.");
+            gnc_error_dialog(gnc_split_register_get_parent(reg), "%s", message);
+        }
+        LEAVE("no rate cell");
+        return FALSE;
+    }
+
+    rate_cell = (PriceCell*) gnc_table_layout_get_cell(
+                    reg->table->layout, RATE_CELL);
+    if (!rate_cell)
+    {
+        if (force_dialog)
+        {
+            message = _("This register does not support editing exchange rates.");
+            gnc_error_dialog(gnc_split_register_get_parent(reg), "%s", message);
+        }
+        LEAVE("null rate cell");
+        return FALSE;
+    }
+
+    /* See if we already have an exchange rate... */
+    info = gnc_split_register_get_info (reg);
+    exch_rate = gnc_price_cell_get_value (rate_cell);
+    if (!gnc_numeric_zero_p(exch_rate) && !force_dialog &&
+        info->rate_reset != RATE_RESET_REQD)
+    {
+        LEAVE("rate already non-zero");
+        return FALSE;
+    }
+
+    /* Are we expanded? */
+    expanded = gnc_split_register_current_trans_expanded (reg);
+    cursor_class = gnc_split_register_get_current_cursor_class (reg);
+
+    /* If we're expanded AND a transaction cursor, there is nothing to do */
+    if (expanded && cursor_class == CURSOR_CLASS_TRANS)
+    {
+        if (force_dialog)
+        {
+            message = _("You need to select a split in order to modify its exchange "
+                        "rate.");
+            gnc_error_dialog(gnc_split_register_get_parent(reg), "%s", message);
+        }
+        LEAVE("expanded with transaction cursor; nothing to do");
+        return FALSE;
+    }
+
+    /* Grab the xfer account */
+    xfer_acc = gnc_split_register_get_account_always(
+                   reg, expanded ? XFRM_CELL : MXFRM_CELL);
+
+    /* If this is an un-expanded, multi-split transaction, then warn the user */
+    if (force_dialog && !expanded && !xfer_acc)
+    {
+        message = _("You need to expand the transaction in order to modify its "
+                    "exchange rates.");
+        gnc_error_dialog (gnc_split_register_get_parent (reg), "%s", message);
+        LEAVE("%s", message);
+        return TRUE;
+    }
+
+    /* No account -- don't run the dialog */
+    if (!xfer_acc)
+    {
+        if (force_dialog)
+        {
+            message = _("The entered account could not be found.");
+            gnc_error_dialog(gnc_split_register_get_parent(reg), "%s", message);
+        }
+        LEAVE("no xfer account");
+        return FALSE;
+    }
+
+    /* Grab the txn currency and xfer commodity */
+    txn = gnc_split_register_get_current_trans (reg);
+    txn_cur = xaccTransGetCurrency (txn);
+    xfer_com = xaccAccountGetCommodity (xfer_acc);
+
+    /* Grab the register account and commodity (may be used later) */
+    reg_acc = gnc_split_register_get_default_account (reg);
+    reg_com = xaccAccountGetCommodity (reg_acc);
+
+    /* Grab the split and perhaps the "other" split (if it is a two-split txn) */
+    split = gnc_split_register_get_current_split (reg);
+    osplit = xaccSplitGetOtherSplit (split);
+
+    /* Check if the txn- and xfer- commodities are the same */
+    if (gnc_commodity_equal (txn_cur, xfer_com))
+    {
+        /* If we're not forcing the dialog, then there is no reason to
+         * go on.  We're using the correct accounts.
+         */
+        if (!force_dialog)
+        {
+            LEAVE("txn and account currencies match, and not forcing");
+            return FALSE;
+        }
+
+        /* Only proceed with two-split, basic, non-expanded registers */
+        if (expanded || osplit == NULL)
+        {
+            message = _("The two currencies involved equal each other.");
+            gnc_error_dialog(gnc_split_register_get_parent(reg), "%s", message);
+            LEAVE("register is expanded or osplit == NULL; not forcing dialog");
+            return FALSE;
+        }
+
+        /* If we're forcing, then compare the current account
+         * commodity to the transaction currency.
+         */
+        xfer_acc = reg_acc;
+        xfer_com = reg_com;
+        if (gnc_commodity_equal (txn_cur, xfer_com))
+        {
+            message = _("The two currencies involved equal each other.");
+            gnc_error_dialog(gnc_split_register_get_parent(reg), "%s", message);
+            LEAVE("reg commodity == txn commodity; not forcing");
+            return FALSE;
+        }
+    }
+
+    /* If this is a non-expanded, two-split txn where BOTH splits need
+     * conversion rates, then require the user to actually expand the
+     * transaction in order to edit it.
+     */
+    if (!expanded && osplit &&
+            gnc_split_register_split_needs_amount (reg, split) &&
+            gnc_split_register_split_needs_amount (reg, osplit))
+    {
+        message = _("You need to expand the transaction in order to modify its "
+                    "exchange rates.");
+        if (force_dialog)
+        {
+            gnc_error_dialog (gnc_split_register_get_parent (reg), "%s", message);
+        }
+        LEAVE("%s", message);
+        return TRUE;
+    }
+
+    /* Strangely, if we're in a two-split, non-expanded txn, we need
+     * to do something really special with the exchange rate!  In
+     * particular, we have to pick it up from the _other_ split --
+     * right?
+     * XXX: perhaps I should pop up an error here?  Or maybe require the
+     * user to go into expanded-mode?
+     */
+    if (!expanded && osplit && !gnc_commodity_equal(reg_com, txn_cur) &&
+            !gnc_commodity_equal(reg_com, xfer_com))
+    {
+        gnc_numeric amt = xaccSplitGetAmount (osplit);
+        gnc_numeric val = xaccSplitGetValue (osplit);
+        exch_rate = gnc_numeric_div (amt, val, GNC_DENOM_AUTO, GNC_HOW_DENOM_REDUCE);
+    }
+
+    /* Ok, we need to grab the exchange rate */
+    amount = gnc_split_register_debcred_cell_value (reg);
+
+    /*
+     * If "amount" is zero then we don't need an exchange-rate.. Return
+     * FALSE to let the user continue on.
+     */
+    if (gnc_numeric_zero_p (amount))
+    {
+        if (force_dialog)
+        {
+            message = _("The split's amount is zero, so no exchange rate is needed.");
+            gnc_error_dialog(gnc_split_register_get_parent(reg), "%s", message);
+        }
+        LEAVE("amount is zero; no exchange rate needed");
+        return FALSE;
+    }
+
+    /* If the exch_rate is zero, we're not forcing the dialog, and this is
+     * _not_ the blank split, then return FALSE -- this is a "special"
+     * gain/loss stock transaction.
+     */
+    if (gnc_numeric_zero_p(exch_rate) && !force_dialog && split &&
+            info->rate_reset != RATE_RESET_REQD &&
+            split != gnc_split_register_get_blank_split (reg))
+    {
+        LEAVE("gain/loss split; no exchange rate needed");
+        return FALSE;
+    }
+
+    /* Show the exchange-rate dialog */
+    xfer = gnc_split_register_xfer_dialog(reg, txn, split);
+    gnc_xfer_dialog_is_exchange_dialog(xfer, &exch_rate);
+    if (gnc_xfer_dialog_run_exchange_dialog(
+                xfer, &exch_rate, amount, reg_acc, txn, xfer_com, expanded))
+    {
+        /* FIXME: How should the dialog be destroyed? */
+        LEAVE("leaving rate unchanged");
+        return TRUE;
+    }
+    /* FIXME: How should the dialog be destroyed? */
+
+    /* Set the RATE_CELL on this cursor and mark it changed */
+    gnc_price_cell_set_value (rate_cell, exch_rate);
+    gnc_basic_cell_set_changed (&rate_cell->cell, TRUE);
+    info->rate_account = xfer_acc;
+    info->rate_reset = RATE_RESET_DONE;
+    LEAVE("set rate=%s", gnc_num_dbg_to_string(exch_rate));
+    return FALSE;
+}
+
+/* Returns FALSE if dialog was canceled. */
+static gboolean
+transaction_changed_confirm(VirtualLocation *p_new_virt_loc,
+                            VirtualLocation *virt_loc,
+                            SplitRegister *reg, Transaction *new_trans,
+                            gboolean exact_traversal)
+{
+    GtkWidget *dialog, *window;
+    gint response;
+    const char *title = _("Save the changed transaction?");
+    const char *message =
+        _("The current transaction has been changed. Would you like to "
+          "record the changes before moving to a new transaction, discard the "
+          "changes, or return to the changed transaction?");
+
+    window = gnc_split_register_get_parent(reg);
+    dialog = gtk_message_dialog_new(GTK_WINDOW(window),
+                                    GTK_DIALOG_DESTROY_WITH_PARENT,
+                                    GTK_MESSAGE_QUESTION,
+                                    GTK_BUTTONS_NONE,
+                                    "%s", title);
+    gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
+            "%s", message);
+    gtk_dialog_add_buttons(GTK_DIALOG(dialog),
+                           _("_Discard Changes"), GTK_RESPONSE_REJECT,
+                           _("_Cancel"), GTK_RESPONSE_CANCEL,
+                           _("_Record Changes"), GTK_RESPONSE_ACCEPT,
+                           NULL);
+    response = gnc_dialog_run(GTK_DIALOG(dialog), GNC_PREF_WARN_REG_TRANS_MOD);
+    gtk_widget_destroy(dialog);
+
+    switch (response)
+    {
+    case GTK_RESPONSE_ACCEPT:
+        break;
+
+    case GTK_RESPONSE_REJECT:
+    {
+        VirtualCellLocation vcell_loc;
+        Split *new_split;
+        Split *trans_split;
+        CursorClass new_class;
+
+        new_split = gnc_split_register_get_split (reg, virt_loc->vcell_loc);
+        trans_split = gnc_split_register_get_trans_split (reg,
+                      virt_loc->vcell_loc,
+                      NULL);
+        new_class = gnc_split_register_get_cursor_class (reg,
+                    virt_loc->vcell_loc);
+
+        gnc_split_register_cancel_cursor_trans_changes (reg);
+
+        if (gnc_split_register_find_split (reg, new_trans, trans_split,
+                                           new_split, new_class, &vcell_loc))
+            virt_loc->vcell_loc = vcell_loc;
+
+        gnc_table_find_close_valid_cell (reg->table, virt_loc,
+                                         exact_traversal);
+
+        *p_new_virt_loc = *virt_loc;
+    }
+    break;
+
+    case GTK_RESPONSE_CANCEL:
+    default:
+        return TRUE;
+    }
+
+    return FALSE;
+}
+
+/** Examine a request to traverse to a new location in the register and
+ *  decide whether it should be allowed to proceed, and where the new
+ *  location will be.
+ *
+ *  @param p_new_virt_loc a pointer to storage for the new location
+ *
+ *  @param dir the direction of the traversal
+ *
+ *  @param user_data pointer to a ::SplitRegister to traverse
+ *
+ *  @return @c TRUE if the traversal cannot be completed. Otherwise,
+ *  @c FALSE is returned and the new location is stored at @a p_new_virt_loc. */
+static gboolean
+gnc_split_register_traverse (VirtualLocation *p_new_virt_loc,
+                             gncTableTraversalDir dir,
+                             gpointer user_data)
+{
+    SplitRegister *reg = user_data;
+    Transaction *pending_trans;
+    VirtualLocation virt_loc;
+    Transaction *trans, *new_trans;
+    gboolean changed;
+    SRInfo *info;
+    Split *split;
+    const char *cell_name;
+
+    g_return_val_if_fail(p_new_virt_loc, TRUE);
+
+    ENTER("reg=%p, p_new_virt_loc=%p (%d,%d), dir=%d",
+          reg, p_new_virt_loc, (*p_new_virt_loc).vcell_loc.virt_row,
+          (*p_new_virt_loc).vcell_loc.virt_col, dir);
+
+    if (!reg)
+    {
+        LEAVE("no register");
+        return FALSE;
+    }
+
+    info = gnc_split_register_get_info (reg);
+
+    if (info->first_pass)
+    {
+        LEAVE("first pass");
+        return FALSE;
+    }
+
+    pending_trans = xaccTransLookup (&info->pending_trans_guid,
+                                     gnc_get_current_book ());
+    virt_loc = *p_new_virt_loc;
+
+    info->exact_traversal = (dir == GNC_TABLE_TRAVERSE_POINTER);
+
+    split = gnc_split_register_get_current_split (reg);
+    trans = gnc_split_register_get_current_trans (reg);
+    if (trans == NULL)
+    {
+        LEAVE("no transaction");
+        return FALSE;
+    }
+
+    /* no changes, make sure we aren't going off the end */
+    changed = gnc_table_current_cursor_changed (reg->table, FALSE);
+    if (!changed && (pending_trans != trans))
+    {
+        gnc_table_find_close_valid_cell (reg->table, &virt_loc,
+                                         info->exact_traversal);
+
+        *p_new_virt_loc = virt_loc;
+
+        LEAVE("no changes");
+        return FALSE;
+    }
+
+    /* Get the current cell-name and check it for changes. */
+    cell_name = gnc_table_get_current_cell_name (reg->table);
+    if (!gnc_split_register_check_cell (reg, cell_name))
+    {
+        LEAVE("check cell");
+        return TRUE;
+    }
+
+    /* See if we are tabbing off the end of the very last line */
+    do
+    {
+        VirtualLocation virt_loc;
+
+        if (!changed && !info->blank_split_edited)
+            break;
+
+        if (dir != GNC_TABLE_TRAVERSE_RIGHT)
+            break;
+
+        virt_loc = reg->table->current_cursor_loc;
+        if (gnc_table_move_vertical_position (reg->table, &virt_loc, 1))
+            break;
+
+        virt_loc = reg->table->current_cursor_loc;
+        if (gnc_table_move_tab (reg->table, &virt_loc, TRUE))
+            break;
+
+        /* Deal with the exchange-rate */
+        if (gnc_split_register_handle_exchange (reg, FALSE))
+        {
+            LEAVE("no exchange rate");
+            return TRUE;
+        }
+
+        *p_new_virt_loc = reg->table->current_cursor_loc;
+        (p_new_virt_loc->vcell_loc.virt_row)++;
+        p_new_virt_loc->phys_row_offset = 0;
+        p_new_virt_loc->phys_col_offset = 0;
+
+        info->traverse_to_new = TRUE;
+
+        LEAVE("off end of last line");
+        return FALSE;
+
+    }
+    while (FALSE);
+
+    /* Now see if we are changing cursors. If not, we may be able to
+     * auto-complete. */
+    if (!gnc_table_virtual_cell_out_of_bounds (reg->table, virt_loc.vcell_loc))
+    {
+        if (gnc_split_register_auto_completion (reg, dir, p_new_virt_loc))
+        {
+            info->auto_complete = TRUE;
+            LEAVE("auto-complete");
+            return FALSE;
+        }
+    }
+
+    /* See if we are tabbing off the end of a blank split */
+    do
+    {
+        VirtualLocation virt_loc;
+        int old_virt_row;
+
+        if (!changed)
+            break;
+
+        if (split)
+            break;
+
+        if (dir != GNC_TABLE_TRAVERSE_RIGHT)
+            break;
+
+        virt_loc = reg->table->current_cursor_loc;
+        old_virt_row = virt_loc.vcell_loc.virt_row;
+
+        if (gnc_table_move_tab (reg->table, &virt_loc, TRUE) &&
+                old_virt_row == virt_loc.vcell_loc.virt_row)
+            break;
+
+        /* If we are here, then: (a) the current cursor has been
+         * edited, and (b) we are on the blank split of a multi-line
+         * transaction, and (c) we are tabbing out of the last cell
+         * on the line. Thus, we want to go ahead and add the new
+         * split and end up on the new blank split of the current
+         * transaction. */
+
+        /* Deal with the exchange-rate */
+        if (gnc_split_register_handle_exchange (reg, FALSE))
+        {
+            LEAVE("no exchange rate");
+            return TRUE;
+        }
+
+        info->cursor_hint_trans = trans;
+        info->cursor_hint_split = split;
+        info->cursor_hint_trans_split =
+            gnc_split_register_get_current_trans_split (reg, NULL);
+        info->cursor_hint_cursor_class = CURSOR_CLASS_SPLIT;
+        info->hint_set_by_traverse = TRUE;
+
+        LEAVE("off end of blank split");
+        return FALSE;
+
+    }
+    while (FALSE);
+
+    {
+        int old_virt_row = reg->table->current_cursor_loc.vcell_loc.virt_row;
+
+        /* Check for going off the end */
+        gnc_table_find_close_valid_cell (reg->table, &virt_loc,
+                                         info->exact_traversal);
+
+
+        /* Did we change vertical position? */
+        if (virt_loc.vcell_loc.virt_row != old_virt_row)
+            /* Deal with the exchange-rate */
+            if (gnc_split_register_handle_exchange (reg, FALSE))
+            {
+                LEAVE("no exchange rate");
+                return TRUE;
+            }
+    }
+
+
+    /* Same transaction, no problem */
+    new_trans = gnc_split_register_get_trans (reg, virt_loc.vcell_loc);
+    if (trans == new_trans)
+    {
+        *p_new_virt_loc = virt_loc;
+        {
+            LEAVE("staying within txn");
+            return FALSE;
+        }
+    }
+
+    /* Ok, we are changing transactions and the current transaction has
+     * changed. See what the user wants to do. */
+    LEAVE("txn change");
+    return transaction_changed_confirm(p_new_virt_loc, &virt_loc, reg,
+                                       new_trans, info->exact_traversal);
+}
+
+TableControl *
+gnc_split_register_control_new (void)
+{
+    TableControl *control = gnc_table_control_new();
+
+    control->move_cursor = gnc_split_register_move_cursor;
+    control->traverse = gnc_split_register_traverse;
+
+    return control;
+}
+
+gboolean
+gnc_split_register_recn_cell_confirm (char old_flag, gpointer data)
+{
+    SplitRegister *reg = data;
+    GtkWidget *dialog, *window;
+    gint response;
+    const gchar *title = _("Mark split as unreconciled?");
+    const gchar *message =
+        _("You are about to mark a reconciled split as unreconciled. Doing "
+          "so might make future reconciliation difficult! Continue "
+          "with this change?");
+
+    if (old_flag != YREC)
+        return TRUE;
+
+    /* Does the user want to be warned? */
+    window = gnc_split_register_get_parent(reg);
+    dialog =
+        gtk_message_dialog_new(GTK_WINDOW(window),
+                               GTK_DIALOG_DESTROY_WITH_PARENT,
+                               GTK_MESSAGE_WARNING,
+                               GTK_BUTTONS_CANCEL,
+                               "%s", title);
+    gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
+            "%s", message);
+    gtk_dialog_add_button(GTK_DIALOG(dialog), _("_Unreconcile"),
+                          GTK_RESPONSE_YES);
+    response = gnc_dialog_run(GTK_DIALOG(dialog), GNC_PREF_WARN_REG_RECD_SPLIT_UNREC);
+    gtk_widget_destroy(dialog);
+    return (response == GTK_RESPONSE_YES);
+}
diff --git a/src/register/ledger-core/split-register-control.h b/gnucash/register/ledger-core/split-register-control.h
similarity index 100%
rename from src/register/ledger-core/split-register-control.h
rename to gnucash/register/ledger-core/split-register-control.h
diff --git a/src/register/ledger-core/split-register-layout.c b/gnucash/register/ledger-core/split-register-layout.c
similarity index 100%
rename from src/register/ledger-core/split-register-layout.c
rename to gnucash/register/ledger-core/split-register-layout.c
diff --git a/src/register/ledger-core/split-register-layout.h b/gnucash/register/ledger-core/split-register-layout.h
similarity index 100%
rename from src/register/ledger-core/split-register-layout.h
rename to gnucash/register/ledger-core/split-register-layout.h
diff --git a/src/register/ledger-core/split-register-load.c b/gnucash/register/ledger-core/split-register-load.c
similarity index 100%
rename from src/register/ledger-core/split-register-load.c
rename to gnucash/register/ledger-core/split-register-load.c
diff --git a/gnucash/register/ledger-core/split-register-model-save.c b/gnucash/register/ledger-core/split-register-model-save.c
new file mode 100644
index 0000000..34bbdbd
--- /dev/null
+++ b/gnucash/register/ledger-core/split-register-model-save.c
@@ -0,0 +1,903 @@
+/********************************************************************\
+ * split-register-model-save.c -- split register model object       *
+ *                                                                  *
+ * 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 at gnu.org                   *
+ *                                                                  *
+\********************************************************************/
+
+#include "config.h"
+
+#include <glib.h>
+
+#include "Scrub.h"
+#include "SchedXaction.h"
+#include "datecell.h"
+#include "gnc-engine.h"
+#include "engine-helpers.h"
+#include "numcell.h"
+#include "pricecell.h"
+#include "recncell.h"
+#include "split-register-model-save.h"
+#include "split-register-p.h"
+#include "gnc-exp-parser.h"
+
+
+struct sr_save_data
+{
+    Transaction *trans;
+    Split *split;
+
+    gboolean handled_dc; /* We have already handled the debit/credit cells. */
+    gboolean do_scrub;   /* Scrub other split at the end. */
+    gboolean reg_expanded; /* Register is in expanded (split) mode */
+};
+
+/* This static indicates the debugging module that this .o belongs to. */
+static QofLogModule log_module = GNC_MOD_LEDGER;
+
+
+static void
+gnc_split_register_save_date_cell (BasicCell * cell,
+                                   gpointer save_data,
+                                   gpointer user_data)
+{
+    SRSaveData *sd = save_data;
+    const char *value;
+    GDate gdate;
+
+    g_return_if_fail (gnc_basic_cell_has_name (cell, DATE_CELL));
+
+    value = gnc_basic_cell_get_value (cell);
+
+    /* commit any pending changes */
+    gnc_date_cell_commit ((DateCell *) cell);
+
+    DEBUG ("DATE: %s", value ? value : "(null)");
+
+    gnc_date_cell_get_date_gdate ((DateCell *) cell, &gdate);
+
+    xaccTransSetDatePostedGDate (sd->trans, gdate);
+}
+
+static void
+gnc_split_register_save_type_cell (BasicCell * cell,
+                                   gpointer save_data,
+                                   gpointer user_data)
+{
+    SRSaveData *sd = save_data;
+    char value;
+
+    g_return_if_fail (gnc_basic_cell_has_name (cell, TYPE_CELL));
+
+    value = gnc_recn_cell_get_flag ((RecnCell *)cell);
+
+    xaccTransSetTxnType (sd->trans, value);
+}
+
+static void
+gnc_split_register_save_due_date_cell (BasicCell * cell,
+                                       gpointer save_data,
+                                       gpointer user_data)
+{
+    SRSaveData *sd = save_data;
+    const char *value;
+    Timespec ts;
+
+    g_return_if_fail (gnc_basic_cell_has_name (cell, DDUE_CELL));
+
+    value = gnc_basic_cell_get_value (cell);
+
+    /* commit any pending changes */
+    gnc_date_cell_commit ((DateCell *) cell);
+
+    DEBUG ("DATE: %s", value ? value : "(null)");
+
+    gnc_date_cell_get_date ((DateCell *) cell, &ts);
+
+    xaccTransSetDateDueTS (sd->trans, &ts);
+}
+
+static void
+gnc_split_register_save_num_cell (BasicCell * cell,
+                                  gpointer save_data,
+                                  gpointer user_data)
+{
+    SRSaveData *sd = save_data;
+    SplitRegister *reg = user_data;
+    const char *value;
+
+    g_return_if_fail (gnc_basic_cell_has_name (cell, NUM_CELL));
+
+    value = gnc_basic_cell_get_value (cell);
+
+    DEBUG ("NUM: %s\n", value ? value : "(null)");
+
+    /* set per book option */
+    gnc_set_num_action (sd->trans, sd->split, value, NULL);
+
+    if (gnc_num_cell_set_last_num ((NumCell *) cell, value))
+    {
+        SRInfo *info = gnc_split_register_get_info (reg);
+        Split *blank_split = xaccSplitLookup (&info->blank_split_guid,
+                                                  gnc_get_current_book ());
+        Transaction *blank_trans = xaccSplitGetParent (blank_split);
+
+        if (sd->trans == blank_trans)
+           gnc_split_register_set_last_num (reg, gnc_basic_cell_get_value (cell));
+    }
+}
+
+static void
+gnc_split_register_save_tnum_cell (BasicCell * cell,
+                                  gpointer save_data,
+                                  gpointer user_data)
+{
+    SRSaveData *sd = save_data;
+    const char *value;
+
+    g_return_if_fail (gnc_basic_cell_has_name (cell, TNUM_CELL));
+
+    value = gnc_basic_cell_get_value (cell);
+
+    DEBUG ("TNUM: %s\n", value ? value : "(null)");
+
+    /* set tran-num using utility function */
+    gnc_set_num_action (sd->trans, NULL, value, NULL);
+}
+
+static void
+gnc_split_register_save_desc_cell (BasicCell * cell,
+                                   gpointer save_data,
+                                   gpointer user_data)
+{
+    SRSaveData *sd = save_data;
+    const char *value;
+
+    g_return_if_fail (gnc_basic_cell_has_name (cell, DESC_CELL));
+
+    value = gnc_basic_cell_get_value (cell);
+
+    DEBUG ("DESC: %s", value ? value : "(null)");
+
+    xaccTransSetDescription (sd->trans, value);
+}
+
+static void
+gnc_split_register_save_notes_cell (BasicCell * cell,
+                                    gpointer save_data,
+                                    gpointer user_data)
+{
+    SRSaveData *sd = save_data;
+    const char *value;
+
+    g_return_if_fail (gnc_basic_cell_has_name (cell, NOTES_CELL));
+
+    value = gnc_basic_cell_get_value (cell);
+
+    DEBUG ("NOTES: %s", value ? value : "(null)");
+
+    xaccTransSetNotes (sd->trans, value);
+}
+
+static void
+gnc_split_register_save_recn_cell (BasicCell * bcell,
+                                   gpointer save_data,
+                                   gpointer user_data)
+{
+    SRSaveData *sd = save_data;
+    RecnCell *cell = (RecnCell *) bcell;
+
+    g_return_if_fail (gnc_basic_cell_has_name (bcell, RECN_CELL));
+
+    DEBUG ("RECN: %c", gnc_recn_cell_get_flag (cell));
+
+    xaccSplitSetReconcile (sd->split, gnc_recn_cell_get_flag (cell));
+}
+
+static void
+gnc_split_register_save_actn_cell (BasicCell * cell,
+                                   gpointer save_data,
+                                   gpointer user_data)
+{
+    SRSaveData *sd = save_data;
+    const char *value;
+
+    g_return_if_fail (gnc_basic_cell_has_name (cell, ACTN_CELL));
+
+    value = gnc_basic_cell_get_value (cell);
+
+    DEBUG ("ACTN: %s", value ? value : "(null)");
+
+    /* Set split-action with gnc_set_num_action which is the same as
+     * xaccSplitSetAction with these arguments */
+    gnc_set_num_action (NULL, sd->split, NULL, value);
+}
+
+static void
+gnc_split_register_save_memo_cell (BasicCell * cell,
+                                   gpointer save_data,
+                                   gpointer user_data)
+{
+    SRSaveData *sd = save_data;
+    const char *value;
+
+    g_return_if_fail (gnc_basic_cell_has_name (cell, MEMO_CELL));
+
+    value = gnc_basic_cell_get_value (cell);
+
+    DEBUG ("MEMO: %s", value ? value : "(null)");
+
+    xaccSplitSetMemo (sd->split, value);
+}
+
+/* OK, the handling of transfers gets complicated because it depends
+ * on what was displayed to the user. For a multi-line display, we
+ * just reparent the indicated split. For a two-line display, we want
+ * to reparent the "other" split, but only if there is one. XFRM is
+ * the straight split, MXFRM is the mirrored split. */
+static void
+gnc_split_register_save_xfrm_cell (BasicCell * cell,
+                                   gpointer save_data,
+                                   gpointer user_data)
+{
+    SRSaveData *sd = save_data;
+    SplitRegister *reg = user_data;
+    Account *old_acc;
+    Account *new_acc;
+
+    g_return_if_fail (gnc_basic_cell_has_name (cell, XFRM_CELL));
+
+    old_acc = xaccSplitGetAccount (sd->split);
+
+    new_acc = gnc_split_register_get_account (reg, XFRM_CELL);
+
+    if ((new_acc != NULL) && (old_acc != new_acc))
+        xaccAccountInsertSplit (new_acc, sd->split);
+}
+
+static void
+gnc_split_register_save_mxfrm_cell (BasicCell * cell,
+                                    gpointer save_data,
+                                    gpointer user_data)
+{
+    SRSaveData *sd = save_data;
+    SplitRegister *reg = user_data;
+    Split * other_split;
+
+    g_return_if_fail (gnc_basic_cell_has_name (cell, MXFRM_CELL));
+
+    other_split = xaccSplitGetOtherSplit (sd->split);
+
+    /* other_split may be null for two very different reasons:
+     * (1) the parent transaction has three or more splits in it,
+     *     and so the "other" split is ambiguous, and thus null.
+     * (2) the parent transaction has only this one split as a child.
+     *     and "other" is null because there is no other.
+     *
+     * In the case (2), we want to create the other split, so that
+     * the user's request to transfer actually works out. */
+
+    if (!other_split)
+    {
+        other_split = xaccTransGetSplit (sd->trans, 1);
+
+        if (!other_split)
+        {
+            other_split = xaccMallocSplit (gnc_get_current_book ());
+            xaccTransAppendSplit (sd->trans, other_split);
+        }
+    }
+
+    if (other_split)
+    {
+        Account *old_acc;
+        Account *new_acc;
+
+        /* Do some reparenting. Insertion into new account
+         * will automatically delete from the old account. */
+        old_acc = xaccSplitGetAccount (other_split);
+        new_acc = gnc_split_register_get_account (reg, MXFRM_CELL);
+
+        if ((new_acc != NULL) && (old_acc != new_acc))
+            xaccAccountInsertSplit (new_acc, other_split);
+    }
+}
+
+static void
+gnc_split_register_save_shares_cell (BasicCell * bcell,
+                                     gpointer save_data,
+                                     gpointer user_data)
+{
+    SRSaveData *sd = save_data;
+    PriceCell *cell = (PriceCell *) bcell;
+    gnc_numeric amount;
+
+    g_return_if_fail (gnc_basic_cell_has_name (bcell, SHRS_CELL));
+
+    amount = gnc_price_cell_get_value (cell);
+
+    DEBUG ("SHRS");
+
+    xaccSplitSetAmount (sd->split, amount);
+
+    sd->do_scrub = TRUE;
+}
+
+static void
+gnc_split_register_save_price_cell (BasicCell * bcell,
+                                    gpointer save_data,
+                                    gpointer user_data)
+{
+    SRSaveData *sd = save_data;
+    PriceCell *cell = (PriceCell *) bcell;
+    gnc_numeric price;
+
+    g_return_if_fail (gnc_basic_cell_has_name (bcell, PRIC_CELL));
+
+    price = gnc_price_cell_get_value (cell);
+
+    DEBUG ("PRIC");
+
+    /* If we handled the Debcred cell then don't set the share price! */
+    if (!sd->handled_dc)
+        xaccSplitSetSharePrice (sd->split, price);
+
+    sd->do_scrub = TRUE;
+}
+
+gnc_numeric
+gnc_split_register_debcred_cell_value (SplitRegister *reg)
+{
+    PriceCell *cell;
+    gnc_numeric new_amount;
+    gnc_numeric credit;
+    gnc_numeric debit;
+
+    cell = (PriceCell *) gnc_table_layout_get_cell (reg->table->layout,
+            CRED_CELL);
+    credit = gnc_price_cell_get_value (cell);
+
+    cell = (PriceCell *) gnc_table_layout_get_cell (reg->table->layout,
+            DEBT_CELL);
+    debit  = gnc_price_cell_get_value (cell);
+
+    new_amount = gnc_numeric_sub_fixed (debit, credit);
+
+    return new_amount;
+}
+
+static gnc_numeric
+gnc_split_register_get_rate_cell (SplitRegister *reg, const char *cell_name)
+{
+    PriceCell *rate_cell;
+
+    rate_cell = (PriceCell*) gnc_table_layout_get_cell (reg->table->layout,
+                cell_name);
+    if (rate_cell)
+        return gnc_price_cell_get_value (rate_cell);
+
+    /* Uhh, just return '1' */
+    return gnc_numeric_create (100, 100);
+}
+
+gboolean
+gnc_split_register_split_needs_amount (SplitRegister *reg, Split *split)
+{
+    Transaction *txn = xaccSplitGetParent (split);
+    Account *acc = xaccSplitGetAccount (split);
+
+    return gnc_split_register_needs_conv_rate (reg, txn, acc);
+}
+
+static void
+gnc_split_register_save_amount_values (SRSaveData *sd, SplitRegister *reg)
+{
+    Account *acc;
+    gnc_numeric new_amount, convrate, amtconv, value;
+    gnc_commodity *curr, *reg_com, *xfer_com;
+    Account *xfer_acc;
+
+    new_amount = gnc_split_register_debcred_cell_value (reg);
+    acc = gnc_split_register_get_default_account (reg);
+
+    xfer_acc = xaccSplitGetAccount (sd->split);
+    xfer_com = xaccAccountGetCommodity (xfer_acc);
+    reg_com = xaccAccountGetCommodity (acc);
+    curr = xaccTransGetCurrency (sd->trans);
+
+    /* First, compute the conversion rate to convert the value to the
+      * amount.
+      */
+    amtconv = convrate = gnc_split_register_get_rate_cell (reg, RATE_CELL);
+    if (acc && gnc_split_register_needs_conv_rate (reg, sd->trans, acc))
+    {
+
+        /* If we are in an expanded register and the xfer_acc->comm !=
+        * reg_acc->comm then we need to compute the convrate here.
+        * Otherwise, we _can_ use the rate_cell!
+        */
+        if (sd->reg_expanded && ! gnc_commodity_equal (reg_com, xfer_com))
+            amtconv = xaccTransGetAccountConvRate(sd->trans, acc);
+    }
+
+    if (xaccTransUseTradingAccounts (sd->trans))
+    {
+        /* Using currency accounts, the amount is probably really the
+           amount and not the value. */
+        gboolean is_amount;
+        if (reg->type == STOCK_REGISTER ||
+                reg->type == CURRENCY_REGISTER ||
+                reg->type == PORTFOLIO_LEDGER)
+        {
+            if (xaccAccountIsPriced(xfer_acc) ||
+                    !gnc_commodity_is_iso(xaccAccountGetCommodity(xfer_acc)))
+                is_amount = FALSE;
+            else
+                is_amount = TRUE;
+        }
+        else
+        {
+            is_amount = TRUE;
+        }
+
+        if (is_amount)
+        {
+            xaccSplitSetAmount(sd->split, new_amount);
+            if (gnc_split_register_split_needs_amount (reg, sd->split))
+            {
+                value = gnc_numeric_div(new_amount, amtconv,
+                                        gnc_commodity_get_fraction(curr),
+                                        GNC_HOW_RND_ROUND_HALF_UP);
+                xaccSplitSetValue(sd->split, value);
+            }
+            else
+                xaccSplitSetValue(sd->split, new_amount);
+        }
+        else
+        {
+            xaccSplitSetValue(sd->split, new_amount);
+        }
+
+        return;
+    }
+
+    /* How to interpret new_amount depends on our view of this
+     * transaction.  If we're sitting in an account with the same
+     * commodity as the transaction, then we can set the Value and then
+     * compute the amount.  Otherwise we are setting the "converted
+     * value".  This means we need to convert new_amount to the actual
+     * 'value' by dividing by the convrate in order to set the value.
+     */
+
+    /* Now compute/set the split value.  Amount is in the register
+     * currency but we need to convert to the txn currency.
+     */
+    if (acc && gnc_split_register_needs_conv_rate (reg, sd->trans, acc))
+    {
+
+        /* convert the amount to the Value ... */
+        value = gnc_numeric_div (new_amount, amtconv,
+                                 gnc_commodity_get_fraction (curr),
+                                 GNC_HOW_RND_ROUND_HALF_UP);
+        xaccSplitSetValue (sd->split, value);
+    }
+    else
+        xaccSplitSetValue (sd->split, new_amount);
+
+    /* Now re-compute the Amount from the Value.  We may need to convert
+     * from the Value back to the amount here using the convrate from
+     * earlier.
+     */
+    value = xaccSplitGetValue (sd->split);
+
+    if (gnc_split_register_split_needs_amount (reg, sd->split))
+    {
+        acc = xaccSplitGetAccount (sd->split);
+        new_amount = gnc_numeric_mul (value, convrate,
+                                      xaccAccountGetCommoditySCU (acc),
+                                      GNC_HOW_RND_ROUND_HALF_UP);
+        xaccSplitSetAmount (sd->split, new_amount);
+    }
+}
+
+static void
+gnc_split_register_save_debcred_cell (BasicCell * bcell,
+                                      gpointer save_data,
+                                      gpointer user_data)
+{
+    SRSaveData *sd = save_data;
+    SplitRegister *reg = user_data;
+
+    g_return_if_fail (gnc_basic_cell_has_name (bcell, DEBT_CELL) ||
+                      gnc_basic_cell_has_name (bcell, CRED_CELL));
+
+    if (sd->handled_dc)
+        return;
+
+    gnc_split_register_save_amount_values (sd, reg);
+
+    sd->handled_dc = TRUE;
+    sd->do_scrub = TRUE;
+}
+
+static void
+gnc_split_register_save_rate_cell (BasicCell * bcell,
+                                   gpointer save_data,
+                                   gpointer user_data)
+{
+    SRSaveData *sd = save_data;
+
+    /* if the exchrate cell changed, then make sure to force a scrub */
+    sd->do_scrub = TRUE;
+}
+
+static void
+gnc_split_register_save_cells (gpointer save_data,
+                               gpointer user_data)
+{
+    SRSaveData *sd = save_data;
+    SplitRegister *reg = user_data;
+    Split *other_split;
+    gnc_commodity *txn_cur;
+    gnc_numeric rate = gnc_numeric_zero();
+
+    g_return_if_fail (sd != NULL);
+
+    if (!sd->do_scrub)
+        return;
+
+    other_split = xaccSplitGetOtherSplit (sd->split);
+    txn_cur = xaccTransGetCurrency (sd->trans);
+
+    xaccSplitScrub (sd->split);
+
+    rate = gnc_split_register_get_rate_cell (reg, RATE_CELL);
+
+    if (other_split && !sd->reg_expanded)
+    {
+        gnc_numeric amount, value = xaccSplitGetValue (sd->split);
+        Account *acc;
+        gboolean split_needs_amount;
+
+        split_needs_amount = gnc_split_register_split_needs_amount(reg, sd->split);
+
+        /* We are changing the rate on the current split, but it was not
+         * handled in the debcred handler, so we need to do it here.
+         */
+        if (!sd->handled_dc && split_needs_amount && !gnc_numeric_zero_p (rate))
+        {
+            gnc_numeric amount = xaccSplitGetAmount (sd->split);
+            value = gnc_numeric_div(
+                        amount, rate, gnc_commodity_get_fraction(txn_cur), GNC_HOW_RND_ROUND_HALF_UP);
+            xaccSplitSetValue (sd->split, value);
+
+            /* XXX: do we need to set the amount on the other split? */
+        }
+
+        /* Now reverse the value for the other split */
+        value = gnc_numeric_neg (value);
+
+        if (gnc_split_register_split_needs_amount (reg, other_split))
+        {
+            acc = xaccSplitGetAccount (other_split);
+
+            /* If we don't have an exchange rate then figure it out.  Or, if
+             * BOTH splits require an amount, then most likely we're in the
+             * strange case of having a transaction currency different than
+             * _both_ accounts -- so grab the other exchange rate.
+             */
+            if (gnc_numeric_zero_p (rate) || split_needs_amount)
+                rate = xaccTransGetAccountConvRate(xaccSplitGetParent (other_split),
+                                                   acc);
+
+            amount = gnc_numeric_mul (value, rate, xaccAccountGetCommoditySCU (acc),
+                                      GNC_HOW_RND_ROUND_HALF_UP);
+            xaccSplitSetAmount (other_split, amount);
+
+        }
+
+        xaccSplitSetValue (other_split, value);
+
+        xaccSplitScrub (other_split);
+    }
+    else if (gnc_split_register_split_needs_amount (reg, sd->split) &&
+             ! gnc_numeric_zero_p (rate))
+    {
+        /* this is either a multi-split or expanded transaction, so only
+         * deal with this split...  In particular we need to reset the
+         * Value if the conv-rate changed.
+         *
+         * If we handled the debcred then no need to do anything there --
+         * the debcred handler did all the computation.  If NOT, then the
+         * convrate changed -- reset the value from the amount.
+         */
+        if (!sd->handled_dc)
+        {
+            gnc_split_register_save_amount_values (sd, reg);
+#if 0
+            gnc_numeric value, amount;
+
+            amount = xaccSplitGetAmount (sd->split);
+            value = gnc_numeric_div (amount, rate, gnc_commodity_get_fraction (txn_cur),
+                                     GNC_HOW_RND_ROUND_HALF_UP);
+            xaccSplitSetValue (sd->split, value);
+#endif
+        }
+    }
+}
+
+static void
+gnc_template_register_save_unexpected_cell (BasicCell * cell,
+        gpointer save_data,
+        gpointer user_data)
+{
+    PERR ("unexpected changed fields in a template register");
+}
+
+static void
+gnc_template_register_save_xfrm_cell (BasicCell * cell,
+                                      gpointer save_data,
+                                      gpointer user_data)
+{
+    SRSaveData *sd = save_data;
+    SplitRegister *reg = user_data;
+    SRInfo *info = gnc_split_register_get_info (reg);
+    Account *template_acc;
+    const GncGUID *acctGUID;
+    Account *acct;
+
+    g_return_if_fail (gnc_basic_cell_has_name (cell, XFRM_CELL));
+
+    /* save the account GncGUID into the kvp_data. */
+    acct = gnc_split_register_get_account (reg, XFRM_CELL);
+    if (!acct)
+    {
+        PERR ("unknown account");
+        return;
+    }
+
+    acctGUID = xaccAccountGetGUID (acct);
+    qof_instance_set (QOF_INSTANCE (sd->split),
+		      "sx-account", acctGUID,
+		      NULL);
+    template_acc = xaccAccountLookup (&info->template_account,
+                                      gnc_get_current_book ());
+
+    /* set the actual account to the fake account for these templates */
+    xaccAccountInsertSplit (template_acc, sd->split);
+}
+
+static void
+gnc_template_register_save_mxfrm_cell (BasicCell * cell,
+                                       gpointer save_data,
+                                       gpointer user_data)
+{
+}
+
+static void
+save_cell (SplitRegister *reg, Split* split, const char *cell_name)
+{
+    const gboolean is_credit = g_strcmp0 (cell_name, FCRED_CELL) == 0;
+    const char *formula = is_credit ?
+        "sx-credit-formula" : "sx-debit-formula";
+    const char *numeric = is_credit ?
+        "sx-credit-numeric" : "sx-debit-numeric";
+    const char *value = gnc_table_layout_get_cell_value (reg->table->layout,
+                                                         cell_name);
+    gnc_numeric new_amount = gnc_numeric_zero ();
+    GHashTable *parser_vars = g_hash_table_new (g_str_hash, g_str_equal);
+    char *error_loc;
+
+    /* If the value can be parsed into a numeric result (without any
+     * further variable definitions), store that numeric value
+     * additionally in the kvp. Otherwise store a zero numeric
+     * there.*/
+    const gboolean parse_result =
+        gnc_exp_parser_parse_separate_vars (value, &new_amount,
+                                            &error_loc, parser_vars);
+    if (!parse_result || g_hash_table_size (parser_vars) != 0)
+        new_amount = gnc_numeric_zero ();
+    g_hash_table_unref (parser_vars);
+    qof_instance_set (QOF_INSTANCE (split),
+		  numeric, &new_amount,
+		  formula, value,
+		  NULL);
+}
+
+static void
+gnc_template_register_save_debcred_cell (BasicCell * cell,
+        gpointer save_data,
+        gpointer user_data)
+{
+    SRSaveData *sd = save_data;
+    SplitRegister *reg = user_data;
+
+    g_return_if_fail (gnc_basic_cell_has_name (cell, FDEBT_CELL) ||
+                      gnc_basic_cell_has_name (cell, FCRED_CELL));
+
+    if (sd->handled_dc)
+        return;
+
+    save_cell (reg, sd->split, FCRED_CELL);
+    save_cell (reg, sd->split, FDEBT_CELL);
+
+    /* set the amount to an innocuous value */
+    /* Note that this marks the split dirty */
+    xaccSplitSetValue (sd->split, gnc_numeric_create (0, 1));
+
+    sd->handled_dc = TRUE;
+}
+
+static void
+gnc_template_register_save_shares_cell (BasicCell * cell,
+                                        gpointer save_data,
+                                        gpointer user_data)
+{
+    SRSaveData *sd = save_data;
+    char *sharesStr = "(x + y)/42";
+
+    g_return_if_fail (gnc_basic_cell_has_name (cell, SHRS_CELL));
+    /* FIXME: shares cells are numeric by definition. */
+    qof_instance_set (QOF_INSTANCE (sd->split),
+		      "sx-shares", sharesStr,
+		      NULL);
+
+    /* set the shares to an innocuous value */
+    /* Note that this marks the split dirty */
+    xaccSplitSetSharePriceAndAmount (sd->split,
+                                     gnc_numeric_create (0, 1),
+                                     gnc_numeric_create (0, 1));
+}
+
+void
+gnc_split_register_model_add_save_handlers (TableModel *model)
+{
+    g_return_if_fail (model != NULL);
+
+    gnc_table_model_set_save_handler (model,
+                                      gnc_split_register_save_date_cell,
+                                      DATE_CELL);
+
+    gnc_table_model_set_save_handler (model,
+                                      gnc_split_register_save_due_date_cell,
+                                      DDUE_CELL);
+
+    gnc_table_model_set_save_handler (model,
+                                      gnc_split_register_save_type_cell,
+                                      TYPE_CELL);
+
+    gnc_table_model_set_save_handler (model,
+                                      gnc_split_register_save_num_cell,
+                                      NUM_CELL);
+
+    gnc_table_model_set_save_handler (model,
+                                      gnc_split_register_save_tnum_cell,
+                                      TNUM_CELL);
+
+    gnc_table_model_set_save_handler (model,
+                                      gnc_split_register_save_desc_cell,
+                                      DESC_CELL);
+
+    gnc_table_model_set_save_handler (model,
+                                      gnc_split_register_save_notes_cell,
+                                      NOTES_CELL);
+
+    gnc_table_model_set_save_handler (model,
+                                      gnc_split_register_save_recn_cell,
+                                      RECN_CELL);
+
+    gnc_table_model_set_save_handler (model,
+                                      gnc_split_register_save_actn_cell,
+                                      ACTN_CELL);
+
+    gnc_table_model_set_save_handler (model,
+                                      gnc_split_register_save_memo_cell,
+                                      MEMO_CELL);
+
+    gnc_table_model_set_save_handler (model,
+                                      gnc_split_register_save_xfrm_cell,
+                                      XFRM_CELL);
+
+    gnc_table_model_set_save_handler (model,
+                                      gnc_split_register_save_mxfrm_cell,
+                                      MXFRM_CELL);
+
+    gnc_table_model_set_save_handler (model,
+                                      gnc_split_register_save_shares_cell,
+                                      SHRS_CELL);
+
+    gnc_table_model_set_save_handler (model,
+                                      gnc_split_register_save_price_cell,
+                                      PRIC_CELL);
+
+    gnc_table_model_set_save_handler (model,
+                                      gnc_split_register_save_debcred_cell,
+                                      DEBT_CELL);
+
+    gnc_table_model_set_save_handler (model,
+                                      gnc_split_register_save_debcred_cell,
+                                      CRED_CELL);
+
+    gnc_table_model_set_save_handler (model,
+                                      gnc_split_register_save_rate_cell,
+                                      RATE_CELL);
+
+    gnc_table_model_set_post_save_handler (model, gnc_split_register_save_cells);
+}
+
+void
+gnc_template_register_model_add_save_handlers (TableModel *model)
+{
+    g_return_if_fail (model != NULL);
+
+    gnc_split_register_model_add_save_handlers (model);
+
+    gnc_table_model_set_save_handler (model,
+                                      gnc_template_register_save_unexpected_cell,
+                                      DATE_CELL);
+
+    gnc_table_model_set_save_handler (model,
+                                      gnc_template_register_save_unexpected_cell,
+                                      DDUE_CELL);
+
+    gnc_table_model_set_save_handler (model,
+                                      gnc_template_register_save_xfrm_cell,
+                                      XFRM_CELL);
+
+    gnc_table_model_set_save_handler (model,
+                                      gnc_template_register_save_mxfrm_cell,
+                                      MXFRM_CELL);
+
+    gnc_table_model_set_save_handler (model,
+                                      gnc_template_register_save_debcred_cell,
+                                      FDEBT_CELL);
+
+    gnc_table_model_set_save_handler (model,
+                                      gnc_template_register_save_debcred_cell,
+                                      FCRED_CELL);
+
+    gnc_table_model_set_save_handler (model,
+                                      gnc_template_register_save_shares_cell,
+                                      SHRS_CELL);
+}
+
+SRSaveData *
+gnc_split_register_save_data_new (Transaction *trans, Split *split,
+                                  gboolean expanded)
+{
+    SRSaveData *sd;
+
+    g_return_val_if_fail (trans != NULL, NULL);
+    g_return_val_if_fail (split != NULL, NULL);
+
+    sd = g_new0 (SRSaveData, 1);
+
+    sd->trans = trans;
+    sd->split = split;
+    sd->handled_dc = FALSE;
+    sd->do_scrub = FALSE;
+    sd->reg_expanded = expanded;
+
+    return sd;
+}
+
+void
+gnc_split_register_save_data_destroy (SRSaveData *sd)
+{
+    g_free (sd);
+}
diff --git a/src/register/ledger-core/split-register-model-save.h b/gnucash/register/ledger-core/split-register-model-save.h
similarity index 100%
rename from src/register/ledger-core/split-register-model-save.h
rename to gnucash/register/ledger-core/split-register-model-save.h
diff --git a/gnucash/register/ledger-core/split-register-model.c b/gnucash/register/ledger-core/split-register-model.c
new file mode 100644
index 0000000..86e406d
--- /dev/null
+++ b/gnucash/register/ledger-core/split-register-model.c
@@ -0,0 +1,2736 @@
+/********************************************************************\
+ * split-register-model.c -- split register model object            *
+ *                                                                  *
+ * 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 at gnu.org                   *
+ *                                                                  *
+\********************************************************************/
+
+#include "config.h"
+
+#include <glib.h>
+#include <glib/gi18n.h>
+
+#include "datecell.h"
+#include "dialog-utils.h"
+#include "gnc-engine.h"
+#include "gnc-prefs.h"
+#include "gnc-ui.h"
+#include "gnc-warnings.h"
+#include "pricecell.h"
+#include "recncell.h"
+#include "split-register.h"
+#include "split-register-model.h"
+#include "split-register-model-save.h"
+#include "split-register-p.h"
+#include "engine-helpers.h"
+
+/* This static indicates the debugging module that this .o belongs to. */
+static QofLogModule log_module = GNC_MOD_LEDGER;
+
+/* Flag for determining colorization of negative amounts. */
+static gboolean use_red_for_negative = TRUE;
+
+/* This returns the balance at runtime of a register at the split defined by virt_loc regardless of
+ * sort order. It always assumes that the first txn in the register is starting from a 0 balance.
+ * If gboolean subaccounts is TRUE, then it will return the total balance of the parent account
+ * and all its subaccounts. FALSE will return the balance of just the parent account of the register. */
+static gnc_numeric
+gnc_split_register_get_rbaln (VirtualLocation virt_loc, gpointer user_data, gboolean subaccounts)
+{
+    SplitRegister *reg = user_data;
+    Split *split;
+    SRInfo *info = gnc_split_register_get_info (reg);
+    gnc_numeric balance = gnc_numeric_zero();
+    Account *account = NULL;
+    Transaction *trans;
+    GList *node, *child;
+    GList *children = NULL;
+    int i, row;
+
+    balance = gnc_numeric_zero();
+
+    /* Return NULL if this is a blank transaction. */
+    split = gnc_split_register_get_split (reg, virt_loc.vcell_loc);
+    if (split == xaccSplitLookup (&info->blank_split_guid,
+                                  gnc_get_current_book ()))
+        return gnc_numeric_zero();
+
+    trans = xaccSplitGetParent (split);
+    if (!trans)
+        return gnc_numeric_zero();
+
+    /* Get a list of accounts for matching */
+    account = gnc_split_register_get_default_account(reg);
+    if (!account)
+        /* Register has no account (perhaps general journal) so it has no
+           well defined balance, return zero. */
+        return balance;
+
+    if (subaccounts)
+    {
+        children = gnc_account_get_descendants(account);
+        children = g_list_append(children, account);
+    }
+
+    /* Get the row number we're on, then start with the first row. */
+    row = virt_loc.vcell_loc.virt_row;
+    virt_loc.vcell_loc.virt_row = 0;
+
+    while (virt_loc.vcell_loc.virt_row <= row )
+    {
+        /* Get new temporary split and its parent transaction */
+        split = gnc_split_register_get_split (reg, virt_loc.vcell_loc);
+        trans = xaccSplitGetParent (split);
+
+        i = 1;
+        for (node = xaccTransGetSplitList (trans); node; node = node->next)
+        {
+            Split *secondary = node->data;
+            i++;
+
+            if (subaccounts)
+            {
+                /* Add up the splits that belong to the transaction if they are
+                 * from the lead account or one of the subaccounts. */
+                account = xaccSplitGetAccount (secondary);
+
+                for (child = children; child; child = child->next)
+                {
+                    if (account == child->data)
+                    {
+                        balance = gnc_numeric_add_fixed(balance, xaccSplitGetAmount(secondary));
+                        break;
+                    }
+                }
+            }
+            else
+            {
+                if ( account == xaccSplitGetAccount(secondary) )
+                    balance = gnc_numeric_add_fixed( balance, xaccSplitGetAmount(secondary) );
+            }
+        }
+        virt_loc.vcell_loc.virt_row += i;
+    }
+
+    if (subaccounts)
+        g_list_free(children);
+
+    return balance;
+}
+
+static gnc_commodity *
+gnc_split_register_get_split_commodity (SplitRegister *reg,
+                                        VirtualLocation virt_loc)
+{
+    CursorClass cursor_class;
+    Account *account;
+    Split *split;
+
+    split = gnc_split_register_get_split (reg, virt_loc.vcell_loc);
+    if (!split)
+        return NULL;
+
+    cursor_class = gnc_split_register_get_cursor_class (reg,
+                   virt_loc.vcell_loc);
+    if (cursor_class != CURSOR_CLASS_SPLIT)
+        return NULL;
+
+    account = NULL;
+
+    if (virt_cell_loc_equal (virt_loc.vcell_loc,
+                             reg->table->current_cursor_loc.vcell_loc) &&
+            gnc_table_layout_get_cell_changed (reg->table->layout, XFRM_CELL, FALSE))
+    {
+        const char *name;
+
+        name = gnc_table_layout_get_cell_value (reg->table->layout, XFRM_CELL);
+        account = gnc_account_lookup_for_register (gnc_get_current_root_account (), name);
+    }
+
+    if (!account)
+        account = xaccSplitGetAccount (split);
+
+    if (!account)
+        return NULL;
+        
+    return xaccAccountGetCommodity(account);
+}
+
+static gboolean
+gnc_split_register_use_security_cells (SplitRegister *reg,
+                                       VirtualLocation virt_loc)
+{
+    CursorClass cursor_class;
+    Account *account;
+    Split *split;
+
+    split = gnc_split_register_get_split (reg, virt_loc.vcell_loc);
+    if (!split)
+        return TRUE;
+
+    cursor_class = gnc_split_register_get_cursor_class (reg,
+                   virt_loc.vcell_loc);
+    if (cursor_class != CURSOR_CLASS_SPLIT)
+        return TRUE;
+
+    account = NULL;
+
+    if (virt_cell_loc_equal (virt_loc.vcell_loc,
+                             reg->table->current_cursor_loc.vcell_loc) &&
+            gnc_table_layout_get_cell_changed (reg->table->layout, XFRM_CELL, FALSE))
+    {
+        const char *name;
+
+        name = gnc_table_layout_get_cell_value (reg->table->layout, XFRM_CELL);
+        account = gnc_account_lookup_for_register (gnc_get_current_root_account (), name);
+    }
+
+    if (!account)
+        account = xaccSplitGetAccount (split);
+
+    if (!account)
+        return TRUE;
+
+    if (xaccTransUseTradingAccounts (xaccSplitGetParent (split)))
+    {
+        gnc_commodity *commod = xaccAccountGetCommodity(account);
+        if (!gnc_commodity_is_iso(commod) ||
+            !gnc_commodity_equal(commod, xaccTransGetCurrency(xaccSplitGetParent(split))))
+            return TRUE;
+    }
+
+    return xaccAccountIsPriced(account);
+}
+
+static const char *
+gnc_split_register_get_date_label (VirtualLocation virt_loc,
+                                   gpointer user_data)
+{
+    return _("Date");
+}
+
+static const char *
+gnc_split_register_get_due_date_label (VirtualLocation virt_loc,
+                                       gpointer user_data)
+{
+    return _("Due Date");
+}
+
+static const char *
+gnc_split_register_get_num_label (VirtualLocation virt_loc,
+                                  gpointer user_data)
+{
+    SplitRegister *reg = user_data;
+
+    switch (reg->type)
+    {
+    case RECEIVABLE_REGISTER:
+    case PAYABLE_REGISTER:
+        return _("Ref");
+    default:
+        return _("Num");
+    }
+}
+
+static const char *
+gnc_split_register_get_tran_num_label (VirtualLocation virt_loc,
+                                  gpointer user_data)
+{
+    SplitRegister *reg = user_data;
+
+    switch (reg->type)
+    {
+    case RECEIVABLE_REGISTER:
+    case PAYABLE_REGISTER:
+        return _("T-Ref");
+    case GENERAL_JOURNAL:
+    case INCOME_LEDGER:
+    case SEARCH_LEDGER:
+    {
+        if (reg->use_tran_num_for_num_field)
+            return _("Num");
+    }
+    default:
+        return _("T-Num");
+    }
+}
+
+static const char *
+gnc_split_register_get_desc_label (VirtualLocation virt_loc,
+                                   gpointer user_data)
+{
+    SplitRegister *reg = user_data;
+
+    switch (reg->type)
+    {
+    case RECEIVABLE_REGISTER:
+        return _("Customer");
+    case PAYABLE_REGISTER:
+        return _("Vendor");
+    default:
+        return _("Description");
+    }
+}
+
+static const char *
+gnc_split_register_get_recn_label (VirtualLocation virt_loc,
+                                   gpointer user_data)
+{
+    SplitRegister *reg = user_data;
+
+    switch (reg->type)
+    {
+    case RECEIVABLE_REGISTER:
+    case PAYABLE_REGISTER:
+        return _("Paid");
+
+    default:
+        return _("Reconciled:R") + 11;
+    }
+}
+
+static const char *
+gnc_split_register_get_baln_label (VirtualLocation virt_loc,
+                                   gpointer user_data)
+{
+    return _("Balance");
+}
+
+static const char *
+gnc_split_register_get_action_label (VirtualLocation virt_loc,
+                                     gpointer user_data)
+{
+    return _("Action");
+}
+
+static const char *
+gnc_split_register_get_associate_label (VirtualLocation virt_loc,
+                                   gpointer user_data)
+{
+    return _("Associate:A") + 10;
+}
+
+static const char *
+gnc_split_register_get_xfrm_label (VirtualLocation virt_loc,
+                                   gpointer user_data)
+{
+    return _("Account");
+}
+
+static const char *
+gnc_split_register_get_mxfrm_label (VirtualLocation virt_loc,
+                                    gpointer user_data)
+{
+    return _("Transfer");
+}
+
+static const char *
+gnc_split_register_get_memo_label (VirtualLocation virt_loc,
+                                   gpointer user_data)
+{
+    return _("Memo");
+}
+
+static const char *
+gnc_split_register_get_type_label (VirtualLocation virt_loc,
+                                   gpointer user_data)
+{
+    return _("Type");
+}
+
+static const char *
+gnc_split_register_get_debit_label (VirtualLocation virt_loc,
+                                    gpointer user_data)
+{
+    SplitRegister *reg = user_data;
+
+    return gnc_split_register_get_debit_string (reg);
+}
+
+static const char *
+gnc_split_register_get_credit_label (VirtualLocation virt_loc,
+                                     gpointer user_data)
+{
+    SplitRegister *reg = user_data;
+
+    return gnc_split_register_get_credit_string (reg);
+}
+
+static const char *
+gnc_split_register_get_price_label (VirtualLocation virt_loc,
+                                    gpointer user_data)
+{
+    SplitRegister *reg = user_data;
+    gnc_commodity *commod;
+
+    if (!gnc_split_register_use_security_cells (reg, virt_loc))
+        return NULL;
+
+    commod = gnc_split_register_get_split_commodity (reg, virt_loc);
+    if (!commod || !gnc_commodity_is_iso(commod))
+        return _("Price");
+    else
+        return _("Exch. Rate");
+}
+
+static const char *
+gnc_split_register_get_shares_label (VirtualLocation virt_loc,
+                                     gpointer user_data)
+{
+    SplitRegister *reg = user_data;
+    gnc_commodity *commod;
+
+    if (!gnc_split_register_use_security_cells (reg, virt_loc))
+        return NULL;
+
+    commod = gnc_split_register_get_split_commodity (reg, virt_loc);
+    if (!commod || !gnc_commodity_is_iso(commod))
+        return _("Shares");
+    else
+        return _("Oth. Curr.");
+}
+
+static const char *
+gnc_split_register_get_tcredit_label (VirtualLocation virt_loc,
+                                      gpointer user_data)
+{
+    SplitRegister *reg = user_data;
+    SRInfo *info = gnc_split_register_get_info (reg);
+
+    if (info->tcredit_str)
+        return info->tcredit_str;
+
+    {
+        const char *string = gnc_split_register_get_credit_string (reg);
+
+        if (string)
+            info->tcredit_str = g_strdup_printf (_("Tot %s"), string);
+    }
+
+    if (info->tcredit_str)
+        return info->tcredit_str;
+
+    info->tcredit_str = g_strdup (_("Tot Credit"));
+
+    return info->tcredit_str;
+}
+
+static const char *
+gnc_split_register_get_tdebit_label (VirtualLocation virt_loc,
+                                     gpointer user_data)
+{
+    SplitRegister *reg = user_data;
+    SRInfo *info = gnc_split_register_get_info (reg);
+
+    if (info->tdebit_str)
+        return info->tdebit_str;
+
+    {
+        const char *string = gnc_split_register_get_debit_string (reg);
+        if (string)
+            info->tdebit_str = g_strdup_printf (_("Tot %s"), string);
+    }
+
+    if (info->tdebit_str)
+        return info->tdebit_str;
+
+    info->tdebit_str = g_strdup (_("Tot Debit"));
+
+    return info->tdebit_str;
+}
+
+static const char *
+gnc_split_register_get_tshares_label (VirtualLocation virt_loc,
+                                      gpointer user_data)
+{
+    return _("Tot Shares");
+}
+
+static const char *
+gnc_split_register_get_tbalance_label (VirtualLocation virt_loc,
+                                       gpointer user_data)
+{
+    return _("Balance");
+}
+
+static const char *
+gnc_split_register_get_notes_label (VirtualLocation virt_loc,
+                                    gpointer user_data)
+{
+    return _("Notes");
+}
+
+static const char *
+gnc_split_register_get_fdebit_label (VirtualLocation virt_loc,
+                                     gpointer user_data)
+{
+    return _("Debit Formula");
+}
+
+static const char *
+gnc_split_register_get_fcredit_label (VirtualLocation virt_loc,
+                                      gpointer user_data)
+{
+    return _("Credit Formula");
+}
+
+static gnc_numeric
+get_trans_total_amount (SplitRegister *reg, Transaction *trans)
+{
+    Account *account = gnc_split_register_get_default_account (reg);
+    return xaccTransGetAccountAmount(trans, account);
+}
+
+static gnc_numeric
+get_trans_total_balance (SplitRegister *reg, Transaction *trans)
+{
+    Account *account;
+
+    account = gnc_split_register_get_default_account (reg);
+    if (!trans || !account) return gnc_numeric_zero();
+
+    return xaccTransGetAccountBalance(trans, account);
+}
+
+static guint32
+gnc_split_register_get_color_internal (VirtualLocation virt_loc,
+                                       SplitRegister *reg,
+                                       const guint32 *color_table,
+                                       gboolean foreground)
+{
+    const char *cursor_name;
+    VirtualCell *vcell;
+    gboolean is_current;
+    gboolean double_alternate_virt;
+    guint32 colorbase = 0; /* By default return background colors */
+
+    if (foreground)
+        colorbase = COLOR_UNKNOWN_FG; /* a bit of enum arithmetic */
+
+    if (!reg)
+        return color_table[colorbase + COLOR_UNKNOWN_BG];
+
+    if (gnc_table_virtual_location_in_header (reg->table, virt_loc))
+        return color_table[colorbase + COLOR_HEADER_BG];
+
+    vcell = gnc_table_get_virtual_cell (reg->table, virt_loc.vcell_loc);
+    if (!vcell || !vcell->cellblock)
+        return color_table[colorbase + COLOR_UNKNOWN_BG];
+
+    if ((virt_loc.phys_col_offset < vcell->cellblock->start_col) ||
+            (virt_loc.phys_col_offset > vcell->cellblock->stop_col))
+        return color_table[colorbase + COLOR_UNKNOWN_BG];
+
+    is_current = virt_cell_loc_equal (reg->table->current_cursor_loc.vcell_loc,
+                                      virt_loc.vcell_loc);
+
+    cursor_name = vcell->cellblock->cursor_name;
+
+    if (g_strcmp0 (cursor_name, CURSOR_SINGLE_JOURNAL) == 0 ||
+            g_strcmp0 (cursor_name, CURSOR_SINGLE_LEDGER) == 0)
+    {
+        if (is_current)
+            return vcell->start_primary_color ?
+                    color_table[colorbase + COLOR_PRIMARY_BG_ACTIVE] :
+                    color_table[colorbase + COLOR_SECONDARY_BG_ACTIVE];
+
+        return vcell->start_primary_color ?
+                color_table[colorbase + COLOR_PRIMARY_BG] : color_table[colorbase + COLOR_SECONDARY_BG];
+    }
+
+    if (g_strcmp0 (cursor_name, CURSOR_DOUBLE_JOURNAL) == 0 ||
+            g_strcmp0 (cursor_name, CURSOR_DOUBLE_JOURNAL_NUM_ACTN) == 0 ||
+            g_strcmp0 (cursor_name, CURSOR_DOUBLE_LEDGER) == 0 ||
+            g_strcmp0 (cursor_name, CURSOR_DOUBLE_LEDGER_NUM_ACTN) == 0)
+    {
+        double_alternate_virt = gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL_REGISTER,
+                                                    GNC_PREF_ALT_COLOR_BY_TRANS);
+        if (is_current)
+        {
+            if (double_alternate_virt)
+                return vcell->start_primary_color ?
+                        color_table[colorbase + COLOR_PRIMARY_BG_ACTIVE] :
+                        color_table[colorbase + COLOR_SECONDARY_BG_ACTIVE];
+
+            return (virt_loc.phys_row_offset % 2 == 0) ?
+                    color_table[colorbase + COLOR_PRIMARY_BG_ACTIVE] :
+                    color_table[colorbase + COLOR_SECONDARY_BG_ACTIVE];
+        }
+
+        if (double_alternate_virt)
+            return vcell->start_primary_color ?
+                    color_table[colorbase + COLOR_PRIMARY_BG] :
+                    color_table[colorbase + COLOR_SECONDARY_BG];
+
+        return (virt_loc.phys_row_offset % 2 == 0) ?
+                color_table[colorbase + COLOR_PRIMARY_BG] :
+                color_table[colorbase + COLOR_SECONDARY_BG];
+    }
+
+    if (g_strcmp0 (cursor_name, CURSOR_SPLIT) == 0)
+    {
+        if (is_current)
+            return color_table[colorbase + COLOR_SPLIT_BG_ACTIVE];
+
+        return color_table[colorbase + COLOR_SPLIT_BG];
+    }
+
+    PWARN ("Unexpected cursor: %s\n", cursor_name);
+
+    return color_table[colorbase + COLOR_UNKNOWN_BG];
+}
+
+static guint32
+gnc_split_register_get_fg_color_internal (VirtualLocation virt_loc,
+                                          SplitRegister *reg,
+                                          const guint32 *color_table)
+{
+    const guint32 red_color = color_table[COLOR_NEGATIVE];
+    guint32 fg_color;
+    const char * cell_name;
+    gnc_numeric value;
+    Split *split;
+
+    fg_color = gnc_split_register_get_color_internal (virt_loc, reg, color_table, TRUE);
+
+    if (!use_red_for_negative)
+        return fg_color;
+
+    split = gnc_split_register_get_split (reg, virt_loc.vcell_loc);
+    if (!split)
+        return fg_color;
+
+    cell_name = gnc_table_get_cell_name (reg->table, virt_loc);
+
+    if (gnc_cell_name_equal (cell_name, TSHRS_CELL))
+        value = get_trans_total_amount (reg, xaccSplitGetParent (split));
+    else if (gnc_cell_name_equal (cell_name, SHRS_CELL))
+    {
+        if (virt_cell_loc_equal (reg->table->current_cursor_loc.vcell_loc,
+                                      virt_loc.vcell_loc))
+            value = gnc_price_cell_get_value
+                     ((PriceCell *) gnc_table_layout_get_cell (reg->table->layout,
+                             SHRS_CELL));
+        else
+            value = xaccSplitGetAmount (split);
+    }
+    else if (gnc_cell_name_equal (cell_name, BALN_CELL))
+        value = xaccSplitGetBalance (split);
+    else if (gnc_cell_name_equal (cell_name, RBALN_CELL))
+        value = gnc_split_register_get_rbaln (virt_loc, reg, TRUE);
+    else if (gnc_cell_name_equal (cell_name, TBALN_CELL))
+        value = get_trans_total_balance (reg, xaccSplitGetParent (split));
+
+    if ((gnc_cell_name_equal (cell_name, BALN_CELL)) ||
+            (gnc_cell_name_equal (cell_name, RBALN_CELL)) ||
+            (gnc_cell_name_equal (cell_name, TBALN_CELL)))
+        {
+            Account *account = xaccSplitGetAccount (split);
+            if (gnc_reverse_balance (account))
+                value = gnc_numeric_neg (value);
+        }
+
+    if (gnc_numeric_negative_p (value))
+        return red_color;
+
+    return fg_color;
+}
+
+static guint32
+gnc_split_register_get_fg_color (VirtualLocation virt_loc,
+                                 gpointer user_data)
+{
+    SplitRegister *reg = user_data;
+    return gnc_split_register_get_fg_color_internal (virt_loc, reg, reg_colors_default);
+}
+
+static guint32
+gnc_split_register_get_gtkrc_fg_color (VirtualLocation virt_loc,
+                                       gpointer user_data)
+{
+    SplitRegister *reg = user_data;
+    return gnc_split_register_get_fg_color_internal (virt_loc, reg, reg_colors_gtkrc);
+}
+
+static guint32
+gnc_split_register_get_bg_color (VirtualLocation virt_loc,
+        gboolean *hatching,
+        gpointer user_data)
+{
+    SplitRegister *reg = user_data;
+
+    if (hatching)
+        *hatching = FALSE;
+
+    return gnc_split_register_get_color_internal (virt_loc, reg, reg_colors_default, FALSE);
+}
+
+
+static RegisterColor
+gnc_split_register_get_gtkrc_bg_color (VirtualLocation virt_loc,
+                                       gboolean *hatching,
+                                       gpointer user_data)
+{
+    SplitRegister *reg = user_data;
+
+    if (hatching)
+        *hatching = FALSE;
+
+    return gnc_split_register_get_color_internal (virt_loc, reg, reg_colors_gtkrc, FALSE);
+}
+
+static guint32
+gnc_split_register_get_debcred_bg_color (VirtualLocation virt_loc,
+        gboolean *hatching,
+        gpointer user_data)
+{
+    SplitRegister *reg = user_data;
+
+    if (hatching)
+    {
+        Transaction *trans;
+
+        trans = gnc_split_register_get_trans (reg, virt_loc.vcell_loc);
+
+        if (trans)
+            *hatching = !xaccTransIsBalanced (trans);
+        else
+            *hatching = FALSE;
+    }
+
+    return gnc_split_register_get_bg_color (virt_loc, NULL, user_data);
+}
+
+static void
+gnc_split_register_get_border (VirtualLocation virt_loc,
+                               PhysicalCellBorders *borders,
+                               gpointer user_data)
+{
+    SplitRegister *reg = user_data;
+    CursorClass cursor_class;
+    VirtualCell *vcell;
+
+    vcell = gnc_table_get_virtual_cell (reg->table, virt_loc.vcell_loc);
+    if (!vcell || !vcell->cellblock)
+        return;
+
+    if (virt_loc.phys_col_offset < vcell->cellblock->start_col ||
+            virt_loc.phys_col_offset > vcell->cellblock->stop_col)
+    {
+        borders->top    = CELL_BORDER_LINE_NONE;
+        borders->bottom = CELL_BORDER_LINE_NONE;
+        borders->left   = CELL_BORDER_LINE_NONE;
+        borders->right  = CELL_BORDER_LINE_NONE;
+        return;
+    }
+
+    cursor_class =
+        gnc_split_register_cursor_name_to_class (vcell->cellblock->cursor_name);
+
+    if (cursor_class == CURSOR_CLASS_SPLIT)
+    {
+        borders->top    = CELL_BORDER_LINE_LIGHT;
+        borders->bottom = CELL_BORDER_LINE_LIGHT;
+        borders->left   = MIN (borders->left,   CELL_BORDER_LINE_LIGHT);
+        borders->right  = MIN (borders->right,  CELL_BORDER_LINE_LIGHT);
+
+        if (virt_loc.phys_col_offset == vcell->cellblock->start_col)
+            borders->left = CELL_BORDER_LINE_NORMAL;
+        if (virt_loc.phys_col_offset == vcell->cellblock->stop_col)
+            borders->right = CELL_BORDER_LINE_NORMAL;
+    }
+}
+
+static const char *
+gnc_split_register_get_associate_entry (VirtualLocation virt_loc,
+                                   gboolean translate,
+                                   gboolean *conditionally_changed,
+                                   gpointer user_data)
+{
+    SplitRegister *reg = user_data;
+    Transaction *trans;
+    char associate;
+    static char s[2];
+    const char *uri;
+
+    trans = gnc_split_register_get_trans (reg, virt_loc.vcell_loc);
+    if (!trans)
+        return NULL;
+
+    // get the existing uri
+    uri = xaccTransGetAssociation (trans);
+
+    // Check for uri is empty or NULL
+    if (g_strcmp0 (uri, "") != 0 && g_strcmp0 (uri, NULL) != 0)
+    {
+        if (g_str_has_prefix (uri, "file:"))
+            associate = 'f';
+        else
+            associate = 'w';
+    }
+    else
+        associate = ' ';
+
+    s[0] = associate;
+    s[1] = '\0';
+
+    return s;
+}
+
+#if 0
+// this code is not used yet
+static char
+gnc_split_register_get_associate_value (SplitRegister *reg,
+                                   VirtualLocation virt_loc)
+{
+    RecnCell *cell;
+
+    cell = (RecnCell *)gnc_table_layout_get_cell (reg->table->layout, ASSOC_CELL);
+    if (!cell)
+        return '\0';
+
+    return gnc_recn_cell_get_flag (cell);
+}
+#endif
+
+static const char *
+gnc_split_register_get_type_entry (VirtualLocation virt_loc,
+                                   gboolean translate,
+                                   gboolean *conditionally_changed,
+                                   gpointer user_data)
+{
+    SplitRegister *reg = user_data;
+    Transaction *trans;
+    char type;
+    static char s[2];
+
+    trans = gnc_split_register_get_trans (reg, virt_loc.vcell_loc);
+    if (!trans)
+        return NULL;
+
+    type = xaccTransGetTxnType (trans);
+
+    if (type == TXN_TYPE_NONE)
+        type = '?';
+
+    s[0] = type;
+    s[1] = '\0';
+
+    return s;
+}
+
+static char
+gnc_split_register_get_type_value (SplitRegister *reg,
+                                   VirtualLocation virt_loc)
+{
+    RecnCell *cell;
+
+    cell = (RecnCell *)gnc_table_layout_get_cell (reg->table->layout, TYPE_CELL);
+    if (!cell)
+        return '\0';
+
+    return gnc_recn_cell_get_flag (cell);
+}
+
+static const char *
+gnc_split_register_get_due_date_entry (VirtualLocation virt_loc,
+                                       gboolean translate,
+                                       gboolean *conditionally_changed,
+                                       gpointer user_data)
+{
+    SplitRegister *reg = user_data;
+    Transaction *trans;
+    Split *split;
+    Timespec ts;
+    gboolean is_current;
+    char type;
+
+    is_current = virt_cell_loc_equal (reg->table->current_cursor_loc.vcell_loc,
+                                      virt_loc.vcell_loc);
+
+    if (is_current)
+    {
+        type = gnc_split_register_get_type_value (reg, virt_loc);
+    }
+    else
+    {
+        const char *typestr =
+            gnc_split_register_get_type_entry (virt_loc, translate,
+                                               conditionally_changed, user_data);
+        if (typestr != NULL)
+            type = *typestr;
+        else
+            type = '\0';
+    }
+
+    /* Only print the due date for invoice transactions */
+    if (type != TXN_TYPE_INVOICE)
+    {
+        //PWARN ("returning NULL due_date entry");
+        return NULL;
+    }
+
+    split = gnc_split_register_get_split (reg, virt_loc.vcell_loc);
+    trans = xaccSplitGetParent (split);
+    if (!trans)
+    {
+        //PWARN ("No transaction in due_date entry");
+        return NULL;
+    }
+
+    xaccTransGetDateDueTS (trans, &ts);
+    //PWARN ("returning valid due_date entry");
+
+    return gnc_print_date (ts);
+}
+
+static const char *
+gnc_split_register_get_date_entry (VirtualLocation virt_loc,
+                                   gboolean translate,
+                                   gboolean *conditionally_changed,
+                                   gpointer user_data)
+{
+    SplitRegister *reg = user_data;
+    Transaction *trans;
+    Split *split;
+    Timespec ts;
+
+    split = gnc_split_register_get_split (reg, virt_loc.vcell_loc);
+    trans = xaccSplitGetParent (split);
+    if (!trans)
+        return NULL;
+
+    xaccTransGetDatePostedTS (trans, &ts);
+
+    return gnc_print_date (ts);
+}
+
+static char *
+gnc_split_register_get_date_help (VirtualLocation virt_loc,
+                                  gpointer user_data)
+{
+    SplitRegister *reg = user_data;
+    BasicCell *cell;
+    char string[1024];
+    GDate date;
+
+    cell = gnc_table_get_cell (reg->table, virt_loc);
+    if (!cell || !cell->value || *cell->value == '\0')
+        return NULL;
+
+    g_date_clear (&date, 1);
+    gnc_date_cell_get_date_gdate ((DateCell *) cell, &date);
+
+    g_date_strftime (string, sizeof (string), _("%A %d %B %Y"), &date);
+
+    return g_strdup (string);
+}
+
+static const char *
+gnc_split_register_get_inactive_date_entry (VirtualLocation virt_loc,
+        gboolean translate,
+        gboolean *conditionally_changed,
+        gpointer user_data)
+{
+    /* This seems to be the one that initially gets used, the InactiveDateCell
+       is set to, and subsequently displayed. */
+    return _("Scheduled");
+}
+
+static const char *
+gnc_split_register_get_num_entry (VirtualLocation virt_loc,
+                                  gboolean translate,
+                                  gboolean *conditionally_changed,
+                                  gpointer user_data)
+{
+    SplitRegister *reg = user_data;
+    Transaction *trans;
+    Split *split;
+
+    split = gnc_split_register_get_split (reg, virt_loc.vcell_loc);
+    trans = xaccSplitGetParent (split);
+
+    return gnc_get_num_action (trans, split); 
+}
+
+static const char *
+gnc_split_register_get_tran_num_entry (VirtualLocation virt_loc,
+                                  gboolean translate,
+                                  gboolean *conditionally_changed,
+                                  gpointer user_data)
+{
+    SplitRegister *reg = user_data;
+    Transaction *trans;
+    Split *split;
+
+    split = gnc_split_register_get_split (reg, virt_loc.vcell_loc);
+    trans = xaccSplitGetParent (split);
+
+    return gnc_get_num_action (trans, NULL);
+}
+
+static char *
+gnc_split_register_get_num_help (VirtualLocation virt_loc,
+                                 gpointer user_data)
+{
+    SplitRegister *reg = user_data;
+    const char *help;
+
+    help = gnc_table_get_entry (reg->table, virt_loc);
+    if (!help || *help == '\0')
+        switch (reg->type)
+        {
+        case RECEIVABLE_REGISTER:
+        case PAYABLE_REGISTER:
+            help = reg->use_tran_num_for_num_field ?
+                    _("Enter a reference, such as an invoice or check number, "
+                        "common to all entry lines (splits)") :
+                    _("Enter a reference, such as an invoice or check number, "
+                        "unique to each entry line (split)");
+            break;
+        default:
+            help = reg->use_tran_num_for_num_field ?
+                    _("Enter a reference, such as a check number, "
+                        "common to all entry lines (splits)") :
+                    _("Enter a reference, such as a check number, "
+                        "unique to each entry line (split)");
+            break;
+        }
+
+    return g_strdup (help);
+}
+
+static char *
+gnc_split_register_get_tran_num_help (VirtualLocation virt_loc,
+                                 gpointer user_data)
+{
+    SplitRegister *reg = user_data;
+    const char *help;
+
+    help = gnc_table_get_entry (reg->table, virt_loc);
+    if (!help || *help == '\0')
+        switch (reg->type)
+        {
+        case RECEIVABLE_REGISTER:
+        case PAYABLE_REGISTER:
+            help = _("Enter a transaction reference, such as an invoice "
+                    "or check number, common to all entry lines (splits)");
+            break;
+        default:
+            help = _("Enter a transaction reference "
+                    "that will be common to all entry lines (splits)");
+            break;
+        }
+
+    return g_strdup (help);
+}
+
+static const char *
+gnc_split_register_get_desc_entry (VirtualLocation virt_loc,
+                                   gboolean translate,
+                                   gboolean *conditionally_changed,
+                                   gpointer user_data)
+{
+    SplitRegister *reg = user_data;
+    Transaction *trans;
+    Split *split;
+
+    split = gnc_split_register_get_split (reg, virt_loc.vcell_loc);
+    trans = xaccSplitGetParent (split);
+
+    return xaccTransGetDescription (trans);
+}
+
+static char *
+gnc_split_register_get_desc_help (VirtualLocation virt_loc,
+                                  gpointer user_data)
+{
+    SplitRegister *reg = user_data;
+    const char *help;
+
+    help = gnc_table_get_entry (reg->table, virt_loc);
+    if (!help || *help == '\0')
+        switch (reg->type)
+        {
+        case RECEIVABLE_REGISTER:
+            help = _("Enter the name of the Customer");
+            break;
+        case PAYABLE_REGISTER:
+            help = _("Enter the name of the Vendor");
+            break;
+        default:
+            help = _("Enter a description of the transaction");
+            break;
+        }
+    return g_strdup (help);
+}
+
+static const char *
+gnc_split_register_get_notes_entry (VirtualLocation virt_loc,
+                                    gboolean translate,
+                                    gboolean *conditionally_changed,
+                                    gpointer user_data)
+{
+    SplitRegister *reg = user_data;
+    Transaction *trans;
+    Split *split;
+
+    split = gnc_split_register_get_split (reg, virt_loc.vcell_loc);
+    trans = xaccSplitGetParent (split);
+
+    return xaccTransGetNotes (trans);
+}
+
+static char *
+gnc_split_register_get_notes_help (VirtualLocation virt_loc,
+                                   gpointer user_data)
+{
+    SplitRegister *reg = user_data;
+    const char *help;
+
+    help = gnc_table_get_entry (reg->table, virt_loc);
+    if (!help || *help == '\0')
+        help = _("Enter notes for the transaction");
+
+    return g_strdup (help);
+}
+
+static const char *
+gnc_split_register_get_vnotes_entry (VirtualLocation virt_loc,
+                                     gboolean translate,
+                                     gboolean *conditionally_changed,
+                                     gpointer user_data)
+{
+    SplitRegister *reg = user_data;
+    Transaction *trans;
+    Split *split;
+
+    split = gnc_split_register_get_split (reg, virt_loc.vcell_loc);
+    trans = xaccSplitGetParent (split);
+
+    if(trans == NULL)
+        return NULL;
+    else
+        return xaccTransGetVoidReason(trans);
+}
+
+static char *
+gnc_split_register_get_vnotes_help (VirtualLocation virt_loc,
+                                    gpointer user_data)
+{
+    SplitRegister *reg = user_data;
+    const char *help;
+
+    help = gnc_table_get_entry (reg->table, virt_loc);
+    if (!help || *help == '\0')
+        help = _("Reason the transaction was voided");
+
+    return g_strdup (help);
+}
+
+static const char *
+gnc_split_register_get_rate_entry (VirtualLocation virt_loc,
+                                   gboolean translate,
+                                   gboolean *conditionally_changed,
+                                   gpointer user_data)
+{
+    SplitRegister *reg = user_data;
+    Split *split, *osplit;
+    Transaction *txn;
+    gnc_numeric amount, value, convrate;
+    SRInfo *info = gnc_split_register_get_info (reg);
+
+    if (info->rate_reset == RATE_RESET_REQD && info->auto_complete)
+        return "0";
+        
+    split = gnc_split_register_get_split (reg, virt_loc.vcell_loc);
+    if (!split)
+        return NULL;
+
+    /* If this is a basic, non-expanded ledger with exactly two splits,
+     * and split->txn->curr == split->acc->comm, then use the OTHER
+     * split for the rate.
+     */
+    osplit = xaccSplitGetOtherSplit (split);
+    txn = gnc_split_register_get_trans (reg, virt_loc.vcell_loc);
+
+    if (!gnc_split_register_current_trans_expanded (reg) && osplit &&
+            !gnc_split_register_needs_conv_rate(reg, txn,
+                    xaccSplitGetAccount(split)))
+    {
+        split = osplit;
+    }
+
+    amount = xaccSplitGetAmount (split);
+    value = xaccSplitGetValue (split);
+
+    if (gnc_numeric_zero_p (value))
+        return "0";
+
+    convrate = gnc_numeric_div (amount, value, GNC_DENOM_AUTO, GNC_HOW_DENOM_REDUCE);
+
+    return xaccPrintAmount (convrate, gnc_default_price_print_info ());
+}
+
+static const char *
+gnc_split_register_get_recn_entry (VirtualLocation virt_loc,
+                                   gboolean translate,
+                                   gboolean *conditionally_changed,
+                                   gpointer user_data)
+{
+    SplitRegister *reg = user_data;
+    Split *split;
+
+    split = gnc_split_register_get_split (reg, virt_loc.vcell_loc);
+    if (!split)
+        return NULL;
+
+    if (translate)
+        return gnc_get_reconcile_str (xaccSplitGetReconcile (split));
+    else
+    {
+        static char s[2];
+
+        s[0] = xaccSplitGetReconcile (split);
+        s[1] = '\0';
+
+        return s;
+    }
+}
+
+static const char *
+gnc_split_register_get_action_entry (VirtualLocation virt_loc,
+                                     gboolean translate,
+                                     gboolean *conditionally_changed,
+                                     gpointer user_data)
+{
+    SplitRegister *reg = user_data;
+    Split *split = gnc_split_register_get_split(reg, virt_loc.vcell_loc);
+
+    return gnc_get_num_action (NULL, split);
+}
+
+static char *
+gnc_split_register_get_action_help (VirtualLocation virt_loc,
+                                    gpointer user_data)
+{
+    SplitRegister *reg = user_data;
+    const char *help;
+
+    help = gnc_table_get_entry (reg->table, virt_loc);
+    if (!help || *help == '\0')
+        help = reg->use_tran_num_for_num_field ?
+        _("Enter an action type, or choose one from the list") :
+        _("Enter a reference number, such as the next check number, or choose an action type from the list");
+
+    return g_strdup (help);
+}
+
+static const char *
+gnc_split_register_get_memo_entry (VirtualLocation virt_loc,
+                                   gboolean translate,
+                                   gboolean *conditionally_changed,
+                                   gpointer user_data)
+{
+    SplitRegister *reg = user_data;
+    Split *split;
+
+    split = gnc_split_register_get_split (reg, virt_loc.vcell_loc);
+
+    return xaccSplitGetMemo (split);
+}
+
+static char *
+gnc_split_register_get_memo_help (VirtualLocation virt_loc,
+                                  gpointer user_data)
+{
+    SplitRegister *reg = user_data;
+    const char *help;
+
+    help = gnc_table_get_entry (reg->table, virt_loc);
+    if (!help || *help == '\0')
+        help = _("Enter a description of the split");
+    return g_strdup (help);
+}
+
+static const char *
+gnc_split_register_get_balance_entry (VirtualLocation virt_loc,
+                                      gboolean translate,
+                                      gboolean *conditionally_changed,
+                                      gpointer user_data)
+{
+    SplitRegister *reg = user_data;
+    SRInfo *info = gnc_split_register_get_info (reg);
+    gnc_numeric balance;
+    gboolean is_trans;
+    Split *split;
+    Account *account;
+
+    split = gnc_split_register_get_split (reg, virt_loc.vcell_loc);
+
+    if (split == xaccSplitLookup (&info->blank_split_guid,
+                                  gnc_get_current_book ()))
+        return NULL;
+
+    is_trans = gnc_cell_name_equal
+               (gnc_table_get_cell_name (reg->table, virt_loc), TBALN_CELL);
+
+    if (is_trans)
+        balance = get_trans_total_balance (reg, xaccSplitGetParent (split));
+    else
+        balance = xaccSplitGetBalance (split);
+
+    account = xaccSplitGetAccount (split);
+    if (!account)
+        account = gnc_split_register_get_default_account (reg);
+
+    if (gnc_reverse_balance (account))
+        balance = gnc_numeric_neg (balance);
+
+    return xaccPrintAmount (balance, gnc_account_print_info (account, FALSE));
+}
+
+static const char *
+gnc_split_register_get_price_entry (VirtualLocation virt_loc,
+                                    gboolean translate,
+                                    gboolean *conditionally_changed,
+                                    gpointer user_data)
+{
+    SplitRegister *reg = user_data;
+    gnc_numeric price;
+    Split *split;
+
+    if (!gnc_split_register_use_security_cells (reg, virt_loc))
+        return NULL;
+
+    split = gnc_split_register_get_split (reg, virt_loc.vcell_loc);
+
+    price = xaccSplitGetSharePrice (split);
+    if (gnc_numeric_zero_p (price))
+        return NULL;
+
+    return xaccPrintAmount (price, gnc_default_price_print_info ());
+}
+
+static char *
+gnc_split_register_get_price_help (VirtualLocation virt_loc,
+                                   gpointer user_data)
+{
+    SplitRegister *reg = user_data;
+    const char *help;
+
+    help = gnc_table_get_entry (reg->table, virt_loc);
+    if (!help || *help == '\0')
+        help = _("Enter the effective share price");
+
+    return g_strdup (help);
+}
+
+static const char *
+gnc_split_register_get_shares_entry (VirtualLocation virt_loc,
+                                     gboolean translate,
+                                     gboolean *conditionally_changed,
+                                     gpointer user_data)
+{
+    SplitRegister *reg = user_data;
+    gnc_numeric shares;
+    Split *split;
+
+    if (!gnc_split_register_use_security_cells (reg, virt_loc))
+        return NULL;
+
+    split = gnc_split_register_get_split (reg, virt_loc.vcell_loc);
+
+    shares = xaccSplitGetAmount (split);
+    if (gnc_numeric_zero_p (shares))
+        return NULL;
+
+    return xaccPrintAmount (shares, gnc_split_amount_print_info (split, FALSE));
+}
+
+static char *
+gnc_split_register_get_shares_help (VirtualLocation virt_loc,
+                                    gpointer user_data)
+{
+    SplitRegister *reg = user_data;
+    const char *help;
+
+    help = gnc_table_get_entry (reg->table, virt_loc);
+    if (!help || *help == '\0')
+        help = _("Enter the number of shares bought or sold");
+
+    return g_strdup (help);
+}
+
+static const char *
+gnc_split_register_get_tshares_entry (VirtualLocation virt_loc,
+                                      gboolean translate,
+                                      gboolean *conditionally_changed,
+                                      gpointer user_data)
+{
+    SplitRegister *reg = user_data;
+    gnc_numeric total;
+    Split *split;
+
+    split = gnc_split_register_get_split (reg, virt_loc.vcell_loc);
+
+    total = get_trans_total_amount (reg, xaccSplitGetParent (split));
+
+    return xaccPrintAmount (total, gnc_split_amount_print_info (split, FALSE));
+}
+
+static const char *
+gnc_split_register_get_xfrm_entry (VirtualLocation virt_loc,
+                                   gboolean translate,
+                                   gboolean *conditionally_changed,
+                                   gpointer user_data)
+{
+    static char *name = NULL;
+
+    SplitRegister *reg = user_data;
+    Split *split;
+
+    split = gnc_split_register_get_split (reg, virt_loc.vcell_loc);
+
+    g_free (name);
+
+    name = gnc_get_account_name_for_register (xaccSplitGetAccount (split));
+
+    return name;
+}
+
+static char *
+gnc_split_register_get_xfrm_help (VirtualLocation virt_loc,
+                                  gpointer user_data)
+{
+    SplitRegister *reg = user_data;
+    const char *help;
+
+    help = gnc_table_get_entry (reg->table, virt_loc);
+    if (!help || *help == '\0')
+        help = _("Enter the account to transfer from, "
+                 "or choose one from the list");
+
+    return g_strdup (help);
+}
+
+static const char *
+gnc_split_register_get_mxfrm_entry (VirtualLocation virt_loc,
+                                    gboolean translate,
+                                    gboolean *conditionally_changed,
+                                    gpointer user_data)
+{
+    static char *name = NULL;
+
+    SplitRegister *reg = user_data;
+    Split *split;
+    Split *s;
+
+    split = gnc_split_register_get_split (reg, virt_loc.vcell_loc);
+    if (!split)
+        return NULL;
+
+    s = xaccSplitGetOtherSplit (split);
+
+    g_free (name);
+
+    if (s)
+        name = gnc_get_account_name_for_register (xaccSplitGetAccount (s));
+    else
+    {
+        /* For multi-split transactions and stock splits,
+         * use a special value. */
+        s = xaccTransGetSplit (xaccSplitGetParent(split), 1);
+
+        if (s)
+            name = g_strdup (SPLIT_TRANS_STR);
+        else if (g_strcmp0 ("stock-split", xaccSplitGetType (split)) == 0)
+            name = g_strdup (STOCK_SPLIT_STR);
+        else
+            name = g_strdup ("");
+    }
+
+    return name;
+}
+
+static char *
+gnc_split_register_get_mxfrm_help (VirtualLocation virt_loc,
+                                   gpointer user_data)
+{
+    const char *help;
+
+    SplitRegister *reg = user_data;
+    Split *split;
+    Split *s;
+
+    split = gnc_split_register_get_split (reg, virt_loc.vcell_loc);
+    if (!split)
+        return NULL;
+
+    s = xaccSplitGetOtherSplit (split);
+
+    if (s)
+    {
+        help = gnc_split_register_get_mxfrm_entry (virt_loc, FALSE,
+                NULL, user_data);
+        if (!help || *help == '\0')
+            help = _("Enter the account to transfer from, "
+                     "or choose one from the list");
+    }
+    else
+    {
+        /* For multi-split transactions and stock splits,
+         * use a special value. */
+        s = xaccTransGetSplit (xaccSplitGetParent(split), 1);
+
+        if (s)
+            help = _("This transaction has multiple splits; "
+                     "press the Split button to see them all");
+        else if (g_strcmp0 ("stock-split", xaccSplitGetType (split)) == 0)
+            help = _("This transaction is a stock split; "
+                     "press the Split button to see details");
+        else
+            help = "";
+    }
+
+    return g_strdup (help);
+}
+
+/* Return the total amount of the transaction for splits of default account
+ * and all subaccounts of the register. */
+static gnc_numeric
+get_trans_total_amount_subaccounts (SplitRegister *reg, Transaction *trans)
+{
+    GList *children, *child;
+    Account *parent;
+    gnc_numeric total = gnc_numeric_zero();
+
+    /* Get a list of all subaccounts for matching */
+    parent = gnc_split_register_get_default_account(reg);
+    if (!parent)
+        /* Register has no account, perhaps it's the general journal.  If it
+           has no account then we have no way of picking out the desired splits,
+           return zero. */
+        return total;
+    children = gnc_account_get_descendants(parent);
+    children = g_list_append(children, parent);
+
+    for (child = children; child; child = child->next)
+    {
+        total = gnc_numeric_add_fixed(total, xaccTransGetAccountAmount(trans, child->data));
+    }
+
+    g_list_free(children);
+
+    return total;
+}
+
+static const char *
+gnc_split_register_get_tdebcred_entry (VirtualLocation virt_loc,
+                                       gboolean translate,
+                                       gboolean *conditionally_changed,
+                                       gpointer user_data)
+{
+    SplitRegister *reg = user_data;
+    const char * cell_name;
+    gnc_numeric total;
+    Split *split;
+
+    split = gnc_split_register_get_split (reg, virt_loc.vcell_loc);
+    if (!split)
+        return NULL;
+
+    cell_name = gnc_table_get_cell_name (reg->table, virt_loc);
+
+    switch (reg->type)
+    {
+    case GENERAL_JOURNAL:
+    case INCOME_LEDGER:
+        total = get_trans_total_amount_subaccounts (reg, xaccSplitGetParent (split));
+        break;
+    default:
+        total = get_trans_total_amount (reg, xaccSplitGetParent (split));
+        break;
+    }
+
+    if (gnc_numeric_zero_p (total))
+        return NULL;
+
+    if (gnc_numeric_negative_p (total) &&
+            gnc_cell_name_equal (cell_name, TDEBT_CELL))
+        return NULL;
+
+    if (gnc_numeric_positive_p (total) &&
+            gnc_cell_name_equal (cell_name, TCRED_CELL))
+        return NULL;
+
+    total = gnc_numeric_abs (total);
+
+    return xaccPrintAmount (total, gnc_split_amount_print_info (split, FALSE));
+}
+
+/* return TRUE if we have a RATE_CELL; return FALSE if we do not.
+ * (note: should match split-register-layout.c)
+ */
+gboolean
+gnc_split_reg_has_rate_cell (SplitRegisterType type)
+{
+    switch (type)
+    {
+    case BANK_REGISTER:
+    case CASH_REGISTER:
+    case ASSET_REGISTER:
+    case CREDIT_REGISTER:
+    case LIABILITY_REGISTER:
+    case INCOME_REGISTER:
+    case EXPENSE_REGISTER:
+    case EQUITY_REGISTER:
+    case TRADING_REGISTER:
+    case GENERAL_JOURNAL:
+    case INCOME_LEDGER:
+    case SEARCH_LEDGER:
+        return TRUE;
+
+    case STOCK_REGISTER:
+    case CURRENCY_REGISTER:
+    case PORTFOLIO_LEDGER:
+    case RECEIVABLE_REGISTER:
+    case PAYABLE_REGISTER:
+    default:
+        return FALSE;
+    }
+}
+
+/* returns TRUE if you need to convert the split's value to the local
+ * (account) display currency.  Returns FALSE if you can just use the
+ * split->value directly.
+ */
+gboolean
+gnc_split_register_needs_conv_rate (SplitRegister *reg,
+                                    Transaction *txn, Account *acc)
+{
+    gnc_commodity *txn_cur, *acc_com;
+
+    /* If there is not a RATE_CELL, then don't do anything */
+    if (!gnc_split_reg_has_rate_cell (reg->type))
+        return FALSE;
+
+    /* if txn->currency == acc->commodity, then return FALSE */
+    acc_com = xaccAccountGetCommodity (acc);
+    txn_cur = xaccTransGetCurrency (txn);
+    if (txn_cur && acc_com && gnc_commodity_equal (txn_cur, acc_com))
+        return FALSE;
+
+    return TRUE;
+}
+
+static const char *
+gnc_split_register_get_debcred_entry (VirtualLocation virt_loc,
+                                      gboolean translate,
+                                      gboolean *conditionally_changed,
+                                      gpointer user_data)
+{
+    SplitRegister *reg = user_data;
+    gboolean is_debit;
+    Split *split;
+    Transaction *trans;
+    gnc_commodity *currency;
+
+    is_debit = gnc_cell_name_equal
+               (gnc_table_get_cell_name (reg->table, virt_loc), DEBT_CELL);
+
+    split = gnc_split_register_get_split (reg, virt_loc.vcell_loc);
+    trans = gnc_split_register_get_trans (reg, virt_loc.vcell_loc);
+
+    currency = xaccTransGetCurrency (trans);
+    if (!currency)
+        currency = gnc_default_currency ();
+
+    if (!split)
+    {
+        gnc_numeric imbalance;
+        Account *acc;
+
+        imbalance = xaccTransGetImbalanceValue (trans);
+
+        if (gnc_numeric_zero_p (imbalance))
+            return NULL;
+
+        if (xaccTransUseTradingAccounts (trans))
+        {
+            MonetaryList *imbal_list;
+            gnc_monetary *imbal_mon;
+            imbal_list = xaccTransGetImbalance (trans);
+
+            if (!imbal_list)
+            {
+                /* No commodity imbalance, there shouldn't be a value imablance. */
+                return NULL;
+            }
+
+            if (imbal_list->next)
+            {
+                /* Multiple currency imbalance. */
+                gnc_monetary_list_free(imbal_list);
+                return NULL;
+            }
+
+            imbal_mon = imbal_list->data;
+            if (!gnc_commodity_equal(gnc_monetary_commodity(*imbal_mon), currency))
+            {
+                /* Imbalance is in wrong currency */
+                gnc_monetary_list_free(imbal_list);
+                return NULL;
+            }
+
+            if (!gnc_numeric_equal (gnc_monetary_value(*imbal_mon), imbalance))
+            {
+                /* Value and commodity imbalances differ */
+                gnc_monetary_list_free(imbal_list);
+                return NULL;
+            }
+
+            /* Done with the imbalance list */
+            gnc_monetary_list_free(imbal_list);
+        }
+
+        imbalance = gnc_numeric_neg (imbalance);
+
+        if (gnc_numeric_negative_p (imbalance) && is_debit)
+            return NULL;
+
+        if (gnc_numeric_positive_p (imbalance) && !is_debit)
+            return NULL;
+
+        if (conditionally_changed)
+            *conditionally_changed = TRUE;
+
+        imbalance = gnc_numeric_abs (imbalance);
+
+        acc = gnc_split_register_get_default_account (reg);
+        if (gnc_split_register_needs_conv_rate (reg, trans, acc))
+        {
+            imbalance = gnc_numeric_mul (imbalance,
+                                         xaccTransGetAccountConvRate(trans, acc),
+                                         gnc_commodity_get_fraction (currency),
+                                         GNC_HOW_RND_ROUND_HALF_UP);
+        }
+        else
+        {
+            imbalance = gnc_numeric_convert (imbalance,
+                                             gnc_commodity_get_fraction (currency),
+                                             GNC_HOW_RND_ROUND_HALF_UP);
+        }
+
+        return xaccPrintAmount (imbalance, gnc_account_print_info (acc, FALSE));
+    }
+
+    {
+        gnc_numeric amount;
+        gnc_commodity *split_commodity;
+        GNCPrintAmountInfo print_info;
+        Account *account;
+        gnc_commodity * commodity;
+
+        account = gnc_split_register_get_default_account (reg);
+        commodity = xaccAccountGetCommodity (account);
+        split_commodity = xaccAccountGetCommodity(xaccSplitGetAccount(split));
+
+        if (xaccTransUseTradingAccounts (trans))
+        {
+            gboolean use_symbol, is_current;
+            is_current = virt_cell_loc_equal (reg->table->current_cursor_loc.vcell_loc,
+                                              virt_loc.vcell_loc);
+
+            if (reg->type == STOCK_REGISTER ||
+                    reg->type == CURRENCY_REGISTER ||
+                    reg->type == PORTFOLIO_LEDGER)
+            {
+                gnc_commodity *amount_commodity;
+                /* security register.  If this split has price and shares columns,
+                   use the value, otherwise use the amount.  */
+                if (gnc_split_register_use_security_cells(reg, virt_loc))
+                {
+                    amount = xaccSplitGetValue(split);
+                    amount_commodity = currency;
+                }
+                else
+                {
+                    amount = xaccSplitGetAmount(split);
+                    amount_commodity = split_commodity;
+                }
+                /* Show the currency if it is not the default currency */
+                if (is_current ||
+                        gnc_commodity_equiv(amount_commodity, gnc_default_currency()))
+                    use_symbol = FALSE;
+                else
+                    use_symbol = TRUE;
+                print_info = gnc_commodity_print_info(amount_commodity, use_symbol);
+            }
+            else
+            {
+                /* non-security register, always use the split amount. */
+                amount = xaccSplitGetAmount(split);
+                if (is_current ||
+                        gnc_commodity_equiv(split_commodity, commodity))
+                    use_symbol = FALSE;
+                else
+                    use_symbol = TRUE;
+                print_info = gnc_commodity_print_info(split_commodity, use_symbol);
+            }
+        }
+        else
+        {
+            /* If this account is not a stock/mutual/currency account, and
+            * currency != the account commodity, then use the SplitAmount
+            * instead of the SplitValue.
+            */
+            switch (reg->type)
+            {
+            case STOCK_REGISTER:
+            case CURRENCY_REGISTER:
+            case PORTFOLIO_LEDGER:
+                amount = xaccSplitGetValue (split);
+                print_info = gnc_commodity_print_info (currency, FALSE);
+                break;
+
+            default:
+                if (commodity && !gnc_commodity_equal (commodity, currency))
+                    /* Convert this to the "local" value */
+                    amount = xaccSplitConvertAmount(split, account);
+                else
+                    amount = xaccSplitGetValue (split);
+                print_info = gnc_account_print_info (account, FALSE);
+                break;
+            }
+        }
+
+        if (gnc_numeric_zero_p (amount))
+            return NULL;
+
+        if (gnc_numeric_negative_p (amount) && is_debit)
+            return NULL;
+
+        if (gnc_numeric_positive_p (amount) && !is_debit)
+            return NULL;
+
+        amount = gnc_numeric_abs (amount);
+
+        return xaccPrintAmount (amount, print_info);
+    }
+}
+
+/* Calculates the register balance for each split at runtime.
+ * This works regardless of the sort order. */
+static const char *
+gnc_split_register_get_rbaln_entry (VirtualLocation virt_loc,
+                                    gboolean translate,
+                                    gboolean *conditionally_changed,
+                                    gpointer user_data)
+{
+    SplitRegister *reg = user_data;
+    SRInfo *info = gnc_split_register_get_info (reg);
+    Split *split;
+    Transaction *trans;
+    gnc_numeric balance;
+    Account *account;
+
+    /* Return NULL if this is a blank transaction. */
+    split = gnc_split_register_get_split (reg, virt_loc.vcell_loc);
+    if (split == xaccSplitLookup (&info->blank_split_guid,
+                                  gnc_get_current_book ()))
+        return NULL;
+
+    trans = xaccSplitGetParent (split);
+    if (!trans)
+        return NULL;
+
+    balance = gnc_split_register_get_rbaln (virt_loc, user_data, TRUE);
+
+    account = xaccSplitGetAccount (split);
+    if (!account)
+        account = gnc_split_register_get_default_account (reg);
+
+    if (gnc_reverse_balance (account))
+        balance = gnc_numeric_neg (balance);
+
+    return xaccPrintAmount (balance, gnc_account_print_info (account, FALSE));
+}
+
+static gboolean
+gnc_split_register_cursor_is_readonly (VirtualLocation virt_loc,
+                                       gpointer user_data)
+{
+    SplitRegister *reg = user_data;
+    Split *split;
+    Transaction *txn;
+    char type;
+
+    split = gnc_split_register_get_split (reg, virt_loc.vcell_loc);
+    if (!split) return FALSE;
+
+    txn = xaccSplitGetParent (split);
+    if (!txn) return FALSE;
+
+    if (xaccTransGetReadOnly(txn)
+            || xaccTransIsReadonlyByPostedDate(txn))
+        return(TRUE);
+
+    type = xaccTransGetTxnType (txn);
+    return (type == TXN_TYPE_INVOICE);
+}
+
+static CellIOFlags
+gnc_split_register_get_inactive_io_flags (VirtualLocation virt_loc,
+        gpointer user_data)
+{
+    if (gnc_split_register_cursor_is_readonly (virt_loc, user_data))
+        return XACC_CELL_ALLOW_READ_ONLY;
+
+    return XACC_CELL_ALLOW_NONE;
+}
+
+static CellIOFlags
+gnc_split_register_get_standard_io_flags (VirtualLocation virt_loc,
+        gpointer user_data)
+{
+    if (gnc_split_register_cursor_is_readonly (virt_loc, user_data))
+        return XACC_CELL_ALLOW_READ_ONLY;
+
+    return XACC_CELL_ALLOW_ALL;
+}
+
+static CellIOFlags
+gnc_split_register_get_recn_io_flags (VirtualLocation virt_loc,
+                                      gpointer user_data)
+{
+    if (gnc_split_register_cursor_is_readonly (virt_loc, user_data))
+        return XACC_CELL_ALLOW_READ_ONLY;
+
+    return XACC_CELL_ALLOW_ALL | XACC_CELL_ALLOW_EXACT_ONLY;
+}
+
+static CellIOFlags
+gnc_split_register_get_ddue_io_flags (VirtualLocation virt_loc,
+                                      gpointer user_data)
+{
+    SplitRegister *reg = user_data;
+    char type;
+
+    type = gnc_split_register_get_type_value (reg, virt_loc);
+
+    /* Only print the due date for invoice transactions */
+    if (type != TXN_TYPE_INVOICE)
+    {
+        return XACC_CELL_ALLOW_NONE;
+    }
+
+    return XACC_CELL_ALLOW_READ_ONLY;
+}
+
+static CellIOFlags
+gnc_split_register_get_rate_io_flags (VirtualLocation virt_loc,
+                                      gpointer user_data)
+{
+    return XACC_CELL_ALLOW_SHADOW;
+}
+
+static CellIOFlags
+gnc_split_register_get_debcred_io_flags (VirtualLocation virt_loc,
+        gpointer user_data)
+{
+    SplitRegister *reg = user_data;
+    Split *split;
+
+    if (gnc_split_register_cursor_is_readonly (virt_loc, user_data))
+        return XACC_CELL_ALLOW_READ_ONLY;
+
+    split = gnc_split_register_get_split (reg, virt_loc.vcell_loc);
+
+    if (g_strcmp0 ("stock-split", xaccSplitGetType (split)) == 0)
+        return XACC_CELL_ALLOW_NONE;
+
+    return XACC_CELL_ALLOW_ALL;
+}
+
+static CellIOFlags
+gnc_split_register_get_security_io_flags (VirtualLocation virt_loc,
+        gpointer user_data)
+{
+    SplitRegister *reg = user_data;
+
+    if (gnc_split_register_cursor_is_readonly (virt_loc, user_data))
+        return XACC_CELL_ALLOW_READ_ONLY;
+
+    if (gnc_split_register_use_security_cells (reg, virt_loc))
+        return XACC_CELL_ALLOW_ALL;
+
+    return XACC_CELL_ALLOW_SHADOW;
+}
+
+static gboolean
+xaccTransWarnReadOnly (const Transaction *trans)
+{
+    GtkWidget *dialog;
+    const gchar *reason;
+    const gchar *format =
+        _("Cannot modify or delete this transaction. This transaction is "
+          "marked read-only because:\n\n'%s'");
+
+    if (!trans) return FALSE;
+
+    reason = xaccTransGetReadOnly (trans);
+    if (reason)
+    {
+        dialog = gtk_message_dialog_new(NULL,
+                                        0,
+                                        GTK_MESSAGE_ERROR,
+                                        GTK_BUTTONS_OK,
+                                        format,
+                                        reason);
+        gtk_dialog_run(GTK_DIALOG(dialog));
+        gtk_widget_destroy(dialog);
+        return TRUE;
+    }
+    return FALSE;
+}
+
+
+static gboolean
+gnc_split_register_confirm (VirtualLocation virt_loc, gpointer user_data)
+{
+    SplitRegister *reg = user_data;
+    SRInfo *info = gnc_split_register_get_info (reg);
+    Transaction *trans;
+    Split *split;
+    char recn;
+    const char *cell_name;
+    gboolean change_ok;
+
+    /* This assumes we reset the flag whenever we change splits.
+     * This happens in gnc_split_register_move_cursor(). */
+    if (info->change_confirmed)
+        return TRUE;
+
+    split = gnc_split_register_get_split (reg, virt_loc.vcell_loc);
+    if (!split)
+        return TRUE;
+
+    trans = xaccSplitGetParent (split);
+    if (xaccTransWarnReadOnly(trans))
+        return FALSE;
+    if (gnc_table_layout_get_cell_changed (reg->table->layout, RECN_CELL, FALSE))
+        recn = gnc_recn_cell_get_flag
+               ((RecnCell *) gnc_table_layout_get_cell (reg->table->layout, RECN_CELL));
+    else
+        recn = xaccSplitGetReconcile (split);
+
+    /* What Cell are we in */
+    cell_name = gnc_table_get_cell_name (reg->table, virt_loc);
+
+    /* These cells can be changed */
+    change_ok = (g_strcmp0(cell_name, "notes") == 0) || (g_strcmp0(cell_name, "memo") == 0) || (g_strcmp0(cell_name, "action") == 0);
+
+    if ((recn == YREC || xaccTransHasReconciledSplits (trans)) && !change_ok)
+    {
+        GtkWidget *dialog, *window;
+        gint response;
+        const gchar *title;
+        const gchar *message;
+
+        if(recn == YREC)
+        {
+            title = _("Change reconciled split?");
+            message =
+             _("You are about to change a reconciled split. Doing so might make "
+               "future reconciliation difficult! Continue with this change?");
+        }
+        else
+        {
+            title = _("Change split linked to a reconciled split?");
+            message =
+            _("You are about to change a split that is linked to a reconciled split. "
+              "Doing so might make future reconciliation difficult! Continue with this change?");
+        }
+
+        /* Does the user want to be warned? */
+        window = gnc_split_register_get_parent(reg);
+        dialog =
+            gtk_message_dialog_new(GTK_WINDOW(window),
+                                   GTK_DIALOG_DESTROY_WITH_PARENT,
+                                   GTK_MESSAGE_WARNING,
+                                   GTK_BUTTONS_CANCEL,
+                                   "%s", title);
+        gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
+                "%s", message);
+        gtk_dialog_add_button(GTK_DIALOG(dialog), _("Chan_ge Split"),
+                              GTK_RESPONSE_YES);
+        response = gnc_dialog_run(GTK_DIALOG(dialog), GNC_PREF_WARN_REG_RECD_SPLIT_MOD);
+        gtk_widget_destroy(dialog);
+        if (response != GTK_RESPONSE_YES)
+            return FALSE;
+
+        info->change_confirmed = TRUE;
+    }
+
+    return TRUE;
+}
+
+static gpointer
+gnc_split_register_guid_malloc (void)
+{
+    GncGUID *guid;
+
+    guid = guid_malloc ();
+
+    *guid = *guid_null ();
+
+    return guid;
+}
+
+static const char *
+gnc_template_register_get_xfrm_entry (VirtualLocation virt_loc,
+                                      gboolean translate,
+                                      gboolean *conditionally_changed,
+                                      gpointer user_data)
+{
+    static char *name = NULL;
+
+    SplitRegister *reg = user_data;
+    Split *split;
+    Account *account;
+    GncGUID *guid = NULL;
+
+    split = gnc_split_register_get_split (reg, virt_loc.vcell_loc);
+    if (!split)
+        return NULL;
+    /* Caller either uses the return as a temporary in a boolean
+     * expression or g_strdups it, so we keep it static and free the
+     * old one on every call to avoid leaks. Ugly, but it works.
+     */
+    g_free (name);
+    qof_instance_get (QOF_INSTANCE (split),
+		      "sx-account", &guid,
+		      NULL);
+    account = xaccAccountLookup (guid, gnc_get_current_book ());
+    name = account ? gnc_get_account_name_for_register (account) : NULL;
+
+    return name;
+}
+
+static const char *
+gnc_template_register_get_fdebt_entry (VirtualLocation virt_loc,
+                                       gboolean translate,
+                                       gboolean *conditionally_changed,
+                                       gpointer user_data)
+{
+    SplitRegister *reg = user_data;
+    Split *split = gnc_split_register_get_split(reg, virt_loc.vcell_loc);
+    char *formula = NULL;
+
+    if (split)
+    {
+        qof_instance_get (QOF_INSTANCE (split),
+                  "sx-debit-formula", &formula,
+                  NULL);
+    }
+
+    return formula;
+}
+
+static char *
+gnc_split_register_get_fdebt_help (VirtualLocation virt_loc,
+                                   gpointer user_data)
+{
+    SplitRegister *reg = user_data;
+    const char *help;
+
+    help = gnc_table_get_entry (reg->table, virt_loc);
+    if (!help || *help == '\0')
+        help = _("Enter debit formula for real transaction");
+
+    return g_strdup (help);
+}
+
+static const char *
+gnc_template_register_get_fcred_entry (VirtualLocation virt_loc,
+                                       gboolean translate,
+                                       gboolean *conditionally_changed,
+                                       gpointer user_data)
+{
+    SplitRegister *reg = user_data;
+    Split *split = gnc_split_register_get_split(reg, virt_loc.vcell_loc);
+    char *formula = NULL;
+
+    if (split)
+    {
+        qof_instance_get (QOF_INSTANCE (split),
+                  "sx-credit-formula", &formula,
+                  NULL);
+    }
+
+    return formula;
+
+}
+
+static char *
+gnc_split_register_get_fcred_help (VirtualLocation virt_loc,
+                                   gpointer user_data)
+{
+    SplitRegister *reg = user_data;
+    const char *help = gnc_table_get_entry (reg->table, virt_loc);
+
+    if (!help || *help == '\0')
+        help = _("Enter credit formula for real transaction");
+
+    return g_strdup (help);
+}
+
+static char *
+gnc_split_register_get_default_help (VirtualLocation virt_loc,
+                                     gpointer user_data)
+{
+    SplitRegister *reg = user_data;
+    const char *help = gnc_table_get_entry(reg->table, virt_loc);
+
+    return g_strdup (help);
+}
+
+/* This function has been #if-zeroed for a year; in all released versions since
+ * 2001 it has issued dire warnings about being wrong, and returned nothing
+ * because it was querying a non-existent slot.
+ *
+ * Now it retrieves the sx-debit-numeric or sx-credit-numeric properties from
+ * the split. I'm not sure that it's what was originally intended, but at least
+ * it can do something now.	<jralls, 8 June 2015>
+ */
+static const char *
+gnc_template_register_get_debcred_entry (VirtualLocation virt_loc,
+        gboolean translate,
+        gboolean *conditionally_changed,
+        gpointer user_data)
+{
+    SplitRegister *reg = user_data;
+    Split *split;
+    gnc_numeric *amount;
+    const char * cell_name;
+
+    split = gnc_split_register_get_split (reg, virt_loc.vcell_loc);
+    if (!split)
+        return gnc_split_register_get_debcred_entry (virt_loc,
+                translate,
+                conditionally_changed,
+                user_data);
+
+    cell_name = gnc_table_get_cell_name (reg->table, virt_loc);
+    if (gnc_cell_name_equal (cell_name, DEBT_CELL))
+        qof_instance_get (QOF_INSTANCE (split),
+                          "sx-debit-numeric", &amount,
+                          NULL);
+    else
+        qof_instance_get (QOF_INSTANCE (split),
+                          "sx-credit-numeric", &amount,
+                          NULL);
+    if (gnc_numeric_zero_p (*amount))
+        return "";
+
+    *amount = gnc_numeric_abs (*amount);
+    return xaccPrintAmount (*amount, gnc_default_print_info (FALSE));
+}
+
+static void
+gnc_split_register_guid_free (gpointer guid)
+{
+    guid_free (guid);
+}
+
+static void
+gnc_split_register_guid_copy (gpointer p_to, gconstpointer p_from)
+{
+    GncGUID *to = p_to;
+    const GncGUID *from = p_from;
+
+    g_return_if_fail (to != NULL);
+    *to = from ? *from : *guid_null();
+}
+
+
+static void
+gnc_split_register_colorize_negative (gpointer gsettings, gchar *key, gpointer unused)
+{
+    use_red_for_negative = gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL,
+                                              GNC_PREF_NEGATIVE_IN_RED);
+}
+
+
+static gpointer
+gnc_split_register_model_add_hooks (gpointer unused)
+{
+    gnc_prefs_register_cb(GNC_PREFS_GROUP_GENERAL, GNC_PREF_NEGATIVE_IN_RED,
+                          gnc_split_register_colorize_negative,
+                          NULL);
+    /* Get the initial value */
+    use_red_for_negative = gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL,
+                                              GNC_PREF_NEGATIVE_IN_RED);
+    return NULL;
+}
+
+
+TableModel *
+gnc_split_register_model_new (void)
+{
+    TableModel *model;
+    static GOnce once = G_ONCE_INIT;
+
+    g_once(&once, gnc_split_register_model_add_hooks, NULL);
+
+    model = gnc_table_model_new ();
+
+    gnc_table_model_set_entry_handler (model,
+                                       gnc_split_register_get_date_entry,
+                                       DATE_CELL);
+
+    gnc_table_model_set_entry_handler (model,
+                                       gnc_split_register_get_due_date_entry,
+                                       DDUE_CELL);
+
+    gnc_table_model_set_entry_handler (model,
+                                       gnc_split_register_get_num_entry,
+                                       NUM_CELL);
+
+    gnc_table_model_set_entry_handler (model,
+                                       gnc_split_register_get_tran_num_entry,
+                                       TNUM_CELL);
+
+    gnc_table_model_set_entry_handler (model,
+                                       gnc_split_register_get_desc_entry,
+                                       DESC_CELL);
+
+    gnc_table_model_set_entry_handler (model,
+                                       gnc_split_register_get_notes_entry,
+                                       NOTES_CELL);
+
+    gnc_table_model_set_entry_handler (model,
+                                       gnc_split_register_get_vnotes_entry,
+                                       VNOTES_CELL);
+
+    gnc_table_model_set_entry_handler (model,
+                                       gnc_split_register_get_rate_entry,
+                                       RATE_CELL);
+
+    gnc_table_model_set_entry_handler (model,
+                                       gnc_split_register_get_recn_entry,
+                                       RECN_CELL);
+
+    gnc_table_model_set_entry_handler (model,
+                                       gnc_split_register_get_action_entry,
+                                       ACTN_CELL);
+
+    gnc_table_model_set_entry_handler (model,
+                                       gnc_split_register_get_memo_entry,
+                                       MEMO_CELL);
+
+    gnc_table_model_set_entry_handler (model,
+                                       gnc_split_register_get_balance_entry,
+                                       BALN_CELL);
+
+    gnc_table_model_set_entry_handler (model,
+                                       gnc_split_register_get_balance_entry,
+                                       TBALN_CELL);
+
+    gnc_table_model_set_entry_handler (model,
+                                       gnc_split_register_get_price_entry,
+                                       PRIC_CELL);
+
+    gnc_table_model_set_entry_handler (model,
+                                       gnc_split_register_get_shares_entry,
+                                       SHRS_CELL);
+
+    gnc_table_model_set_entry_handler (model,
+                                       gnc_split_register_get_tshares_entry,
+                                       TSHRS_CELL);
+
+    gnc_table_model_set_entry_handler (model,
+                                       gnc_split_register_get_xfrm_entry,
+                                       XFRM_CELL);
+
+    gnc_table_model_set_entry_handler (model,
+                                       gnc_split_register_get_mxfrm_entry,
+                                       MXFRM_CELL);
+
+    gnc_table_model_set_entry_handler (model,
+                                       gnc_split_register_get_tdebcred_entry,
+                                       TDEBT_CELL);
+
+    gnc_table_model_set_entry_handler (model,
+                                       gnc_split_register_get_tdebcred_entry,
+                                       TCRED_CELL);
+
+    gnc_table_model_set_entry_handler (model,
+                                       gnc_split_register_get_associate_entry,
+                                       ASSOC_CELL);
+
+    gnc_table_model_set_entry_handler (model,
+                                       gnc_split_register_get_type_entry,
+                                       TYPE_CELL);
+
+    gnc_table_model_set_entry_handler (model,
+                                       gnc_split_register_get_debcred_entry,
+                                       DEBT_CELL);
+
+    gnc_table_model_set_entry_handler (model,
+                                       gnc_split_register_get_debcred_entry,
+                                       CRED_CELL);
+
+    gnc_table_model_set_entry_handler (model,
+                                       gnc_split_register_get_rbaln_entry,
+                                       RBALN_CELL);
+
+
+    gnc_table_model_set_label_handler (model,
+                                       gnc_split_register_get_date_label,
+                                       DATE_CELL);
+
+    gnc_table_model_set_label_handler (model,
+                                       gnc_split_register_get_due_date_label,
+                                       DDUE_CELL);
+
+    gnc_table_model_set_label_handler (model,
+                                       gnc_split_register_get_num_label,
+                                       NUM_CELL);
+
+    gnc_table_model_set_label_handler (model,
+                                       gnc_split_register_get_tran_num_label,
+                                       TNUM_CELL);
+
+    gnc_table_model_set_label_handler (model,
+                                       gnc_split_register_get_desc_label,
+                                       DESC_CELL);
+
+    gnc_table_model_set_label_handler (model,
+                                       gnc_split_register_get_recn_label,
+                                       RECN_CELL);
+
+    gnc_table_model_set_label_handler (model,
+                                       gnc_split_register_get_baln_label,
+                                       BALN_CELL);
+
+    gnc_table_model_set_label_handler (model,
+                                       gnc_split_register_get_action_label,
+                                       ACTN_CELL);
+
+    gnc_table_model_set_label_handler (model,
+                                       gnc_split_register_get_xfrm_label,
+                                       XFRM_CELL);
+
+    gnc_table_model_set_label_handler (model,
+                                       gnc_split_register_get_memo_label,
+                                       MEMO_CELL);
+
+    gnc_table_model_set_label_handler (model,
+                                       gnc_split_register_get_debit_label,
+                                       DEBT_CELL);
+
+    gnc_table_model_set_label_handler (model,
+                                       gnc_split_register_get_credit_label,
+                                       CRED_CELL);
+
+    gnc_table_model_set_label_handler (model,
+                                       gnc_split_register_get_price_label,
+                                       PRIC_CELL);
+
+    gnc_table_model_set_label_handler (model,
+                                       gnc_split_register_get_shares_label,
+                                       SHRS_CELL);
+
+    gnc_table_model_set_label_handler (model,
+                                       gnc_split_register_get_mxfrm_label,
+                                       MXFRM_CELL);
+
+    gnc_table_model_set_label_handler (model,
+                                       gnc_split_register_get_tcredit_label,
+                                       TCRED_CELL);
+
+    gnc_table_model_set_label_handler (model,
+                                       gnc_split_register_get_tdebit_label,
+                                       TDEBT_CELL);
+
+    gnc_table_model_set_label_handler (model,
+                                       gnc_split_register_get_tshares_label,
+                                       TSHRS_CELL);
+
+    gnc_table_model_set_label_handler (model,
+                                       gnc_split_register_get_tbalance_label,
+                                       TBALN_CELL);
+
+    gnc_table_model_set_label_handler (model,
+                                       gnc_split_register_get_associate_label,
+                                       ASSOC_CELL);
+
+    gnc_table_model_set_label_handler (model,
+                                       gnc_split_register_get_type_label,
+                                       TYPE_CELL);
+
+    gnc_table_model_set_label_handler (model,
+                                       gnc_split_register_get_notes_label,
+                                       NOTES_CELL);
+
+    gnc_table_model_set_label_handler (model,
+                                       gnc_split_register_get_fdebit_label,
+                                       FDEBT_CELL);
+
+    gnc_table_model_set_label_handler (model,
+                                       gnc_split_register_get_fcredit_label,
+                                       FCRED_CELL);
+
+    gnc_table_model_set_label_handler (model,
+                                       gnc_split_register_get_tbalance_label,
+                                       RBALN_CELL);
+
+
+    gnc_table_model_set_default_help_handler(
+        model, gnc_split_register_get_default_help);
+
+    gnc_table_model_set_help_handler (model,
+                                      gnc_split_register_get_date_help,
+                                      DATE_CELL);
+
+    gnc_table_model_set_help_handler (model,
+                                      gnc_split_register_get_date_help,
+                                      DDUE_CELL);
+
+    gnc_table_model_set_help_handler (model,
+                                      gnc_split_register_get_num_help,
+                                      NUM_CELL);
+
+    gnc_table_model_set_help_handler (model,
+                                      gnc_split_register_get_tran_num_help,
+                                      TNUM_CELL);
+
+    gnc_table_model_set_help_handler (model,
+                                      gnc_split_register_get_desc_help,
+                                      DESC_CELL);
+
+    gnc_table_model_set_help_handler (model,
+                                      gnc_split_register_get_price_help,
+                                      PRIC_CELL);
+
+    gnc_table_model_set_help_handler (model,
+                                      gnc_split_register_get_shares_help,
+                                      SHRS_CELL);
+
+    gnc_table_model_set_help_handler (model,
+                                      gnc_split_register_get_action_help,
+                                      ACTN_CELL);
+
+    gnc_table_model_set_help_handler (model,
+                                      gnc_split_register_get_memo_help,
+                                      MEMO_CELL);
+
+    gnc_table_model_set_help_handler (model,
+                                      gnc_split_register_get_notes_help,
+                                      NOTES_CELL);
+
+    gnc_table_model_set_help_handler (model,
+                                      gnc_split_register_get_vnotes_help,
+                                      VNOTES_CELL);
+
+    gnc_table_model_set_help_handler (model,
+                                      gnc_split_register_get_xfrm_help,
+                                      XFRM_CELL);
+
+    gnc_table_model_set_help_handler (model,
+                                      gnc_split_register_get_mxfrm_help,
+                                      MXFRM_CELL);
+
+    gnc_table_model_set_help_handler (model,
+                                      gnc_split_register_get_fcred_help,
+                                      FCRED_CELL);
+
+    gnc_table_model_set_help_handler (model,
+                                      gnc_split_register_get_fdebt_help,
+                                      FDEBT_CELL);
+
+
+    gnc_table_model_set_io_flags_handler(
+        model, gnc_split_register_get_standard_io_flags, DATE_CELL);
+
+    /* FIXME: We really only need a due date for 'invoices', not for
+     * 'payments' or 'receipts'.  This implies we really only need the
+     * due-date for transactions that credit the ACCT_TYPE_RECEIVABLE or
+     * debit the ACCT_TYPE_PAYABLE account type.
+     */
+    gnc_table_model_set_io_flags_handler(
+        model, gnc_split_register_get_rate_io_flags, RATE_CELL);
+
+    gnc_table_model_set_io_flags_handler(
+        model, gnc_split_register_get_ddue_io_flags, DDUE_CELL);
+
+    gnc_table_model_set_io_flags_handler(
+        model, gnc_split_register_get_standard_io_flags, NUM_CELL);
+
+    gnc_table_model_set_io_flags_handler(
+        model, gnc_split_register_get_standard_io_flags, TNUM_CELL);
+
+    gnc_table_model_set_io_flags_handler(
+        model, gnc_split_register_get_standard_io_flags, DESC_CELL);
+
+    gnc_table_model_set_io_flags_handler(
+        model, gnc_split_register_get_standard_io_flags, ACTN_CELL);
+
+    gnc_table_model_set_io_flags_handler(
+        model, gnc_split_register_get_standard_io_flags, XFRM_CELL);
+
+    gnc_table_model_set_io_flags_handler(
+        model, gnc_split_register_get_standard_io_flags, MEMO_CELL);
+
+    gnc_table_model_set_io_flags_handler(
+        model, gnc_split_register_get_standard_io_flags, MXFRM_CELL);
+
+    gnc_table_model_set_io_flags_handler(
+        model, gnc_split_register_get_standard_io_flags, NOTES_CELL);
+
+    gnc_table_model_set_io_flags_handler(
+        model, gnc_split_register_get_inactive_io_flags, VNOTES_CELL);
+
+    gnc_table_model_set_io_flags_handler(
+        model, gnc_split_register_get_debcred_io_flags, CRED_CELL);
+
+    gnc_table_model_set_io_flags_handler(
+        model, gnc_split_register_get_debcred_io_flags, DEBT_CELL);
+
+    gnc_table_model_set_io_flags_handler(
+        model, gnc_split_register_get_recn_io_flags, RECN_CELL);
+
+    gnc_table_model_set_io_flags_handler(
+        model, gnc_split_register_get_recn_io_flags, ASSOC_CELL);
+
+    gnc_table_model_set_io_flags_handler(
+        model, gnc_split_register_get_recn_io_flags, TYPE_CELL);
+
+    gnc_table_model_set_io_flags_handler(
+        model, gnc_split_register_get_security_io_flags, PRIC_CELL);
+
+    gnc_table_model_set_io_flags_handler(
+        model, gnc_split_register_get_security_io_flags, SHRS_CELL);
+
+
+    gnc_table_model_set_fg_color_handler(
+        model, gnc_split_register_get_fg_color, SHRS_CELL);
+
+    gnc_table_model_set_fg_color_handler(
+        model, gnc_split_register_get_fg_color, TSHRS_CELL);
+
+    gnc_table_model_set_fg_color_handler(
+        model, gnc_split_register_get_fg_color, BALN_CELL);
+
+    gnc_table_model_set_fg_color_handler(
+        model, gnc_split_register_get_fg_color, TBALN_CELL);
+
+    gnc_table_model_set_fg_color_handler(
+        model, gnc_split_register_get_fg_color, RBALN_CELL);
+
+    gnc_table_model_set_fg_color_handler(
+        model, gnc_split_register_get_gtkrc_fg_color, "gtkrc");
+
+
+    gnc_table_model_set_default_bg_color_handler(
+        model, gnc_split_register_get_bg_color);
+
+    gnc_table_model_set_bg_color_handler(
+        model, gnc_split_register_get_gtkrc_bg_color, "gtkrc");
+
+    gnc_table_model_set_bg_color_handler(
+        model, gnc_split_register_get_debcred_bg_color, DEBT_CELL);
+
+    gnc_table_model_set_bg_color_handler(
+        model, gnc_split_register_get_debcred_bg_color, CRED_CELL);
+
+    gnc_table_model_set_bg_color_handler(
+        model, gnc_split_register_get_debcred_bg_color, TDEBT_CELL);
+
+    gnc_table_model_set_bg_color_handler(
+        model, gnc_split_register_get_debcred_bg_color, TCRED_CELL);
+
+    gnc_table_model_set_bg_color_handler(
+        model, gnc_split_register_get_debcred_bg_color, FCRED_CELL);
+
+    gnc_table_model_set_bg_color_handler(
+        model, gnc_split_register_get_debcred_bg_color, FDEBT_CELL);
+
+
+    gnc_table_model_set_default_cell_border_handler(
+        model, gnc_split_register_get_border);
+
+
+    gnc_table_model_set_default_confirm_handler(
+        model, gnc_split_register_confirm);
+
+    model->cell_data_allocator   = gnc_split_register_guid_malloc;
+    model->cell_data_deallocator = gnc_split_register_guid_free;
+    model->cell_data_copy        = gnc_split_register_guid_copy;
+
+    gnc_split_register_model_add_save_handlers (model);
+
+    return model;
+}
+
+TableModel *
+gnc_template_register_model_new (void)
+{
+    TableModel *model;
+
+    model = gnc_split_register_model_new ();
+
+    gnc_table_model_set_entry_handler(
+        model, gnc_split_register_get_inactive_date_entry, DATE_CELL );
+
+    gnc_table_model_set_entry_handler(
+        model, gnc_split_register_get_inactive_date_entry, DDUE_CELL );
+
+    gnc_table_model_set_io_flags_handler(
+        model, gnc_split_register_get_inactive_io_flags, DATE_CELL );
+
+    gnc_table_model_set_io_flags_handler(
+        model, gnc_split_register_get_inactive_io_flags, DDUE_CELL );
+
+    gnc_table_model_set_entry_handler(
+        model, gnc_template_register_get_xfrm_entry, XFRM_CELL);
+
+    gnc_table_model_set_entry_handler(
+        model, gnc_template_register_get_fdebt_entry, FDEBT_CELL);
+
+    gnc_table_model_set_entry_handler(
+        model, gnc_template_register_get_fcred_entry, FCRED_CELL);
+
+    gnc_table_model_set_entry_handler(
+        model, gnc_template_register_get_debcred_entry, DEBT_CELL);
+
+    gnc_table_model_set_entry_handler(
+        model, gnc_template_register_get_debcred_entry, CRED_CELL);
+
+    gnc_table_model_set_io_flags_handler(
+        model, gnc_split_register_get_standard_io_flags, FCRED_CELL);
+
+    gnc_table_model_set_io_flags_handler(
+        model, gnc_split_register_get_standard_io_flags, FDEBT_CELL);
+
+    gnc_template_register_model_add_save_handlers (model);
+
+    return model;
+}
diff --git a/src/register/ledger-core/split-register-model.h b/gnucash/register/ledger-core/split-register-model.h
similarity index 100%
rename from src/register/ledger-core/split-register-model.h
rename to gnucash/register/ledger-core/split-register-model.h
diff --git a/src/register/ledger-core/split-register-p.h b/gnucash/register/ledger-core/split-register-p.h
similarity index 100%
rename from src/register/ledger-core/split-register-p.h
rename to gnucash/register/ledger-core/split-register-p.h
diff --git a/src/register/ledger-core/split-register-util.c b/gnucash/register/ledger-core/split-register-util.c
similarity index 100%
rename from src/register/ledger-core/split-register-util.c
rename to gnucash/register/ledger-core/split-register-util.c
diff --git a/gnucash/register/ledger-core/split-register.c b/gnucash/register/ledger-core/split-register.c
new file mode 100644
index 0000000..ca5c977
--- /dev/null
+++ b/gnucash/register/ledger-core/split-register.c
@@ -0,0 +1,2992 @@
+/********************************************************************\
+ * 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 at gnu.org                   *
+ *                                                                  *
+\********************************************************************/
+/*
+ * split-register.c
+ * author Copyright (c) 1998-2000 Linas Vepstas <linas at linas.org>
+ * author Copyright (c) 2000-2001 Dave Peticolas <dave at krondo.com>
+ */
+#include "config.h"
+
+#include <glib.h>
+#include <glib/gi18n.h>
+#include <libguile.h>
+
+#include <gnc-gdate-utils.h>
+#include "combocell.h"
+#include "datecell.h"
+#include "dialog-utils.h"
+#include "gnc-component-manager.h"
+#include "split-register-p.h"
+#include "gnc-ledger-display.h"
+#include "gnc-prefs.h"
+#include "gnc-ui.h"
+#include "gnc-warnings.h"
+#include "guile-util.h"
+#include "numcell.h"
+#include "pricecell.h"
+#include "quickfillcell.h"
+#include "recncell.h"
+#include "split-register.h"
+#include "split-register-control.h"
+#include "split-register-layout.h"
+#include "split-register-model.h"
+#include "split-register-model-save.h"
+#include "table-allgui.h"
+#include "dialog-account.h"
+#include "dialog-dup-trans.h"
+#include "engine-helpers.h"
+#include "qofbookslots.h"
+
+
+/** static variables ******************************************************/
+
+/* This static indicates the debugging module that this .o belongs to. */
+static QofLogModule log_module = GNC_MOD_LEDGER;
+
+/* The copied split or transaction, if any */
+static CursorClass copied_class = CURSOR_CLASS_NONE;
+static SCM copied_item = SCM_UNDEFINED;
+static GncGUID copied_leader_guid;
+/* A denominator representing number of digits to the right of the decimal point
+ * displayed in a price cell. */
+static int PRICE_CELL_DENOM = 1000000;
+/** static prototypes *****************************************************/
+
+static gboolean gnc_split_register_save_to_scm (SplitRegister *reg,
+        SCM trans_scm, SCM split_scm,
+        gboolean use_cut_semantics);
+static gboolean gnc_split_register_auto_calc (SplitRegister *reg,
+        Split *split);
+
+
+/** implementations *******************************************************/
+
+/* Uses the scheme split copying routines */
+static void
+gnc_copy_split_onto_split(Split *from, Split *to, gboolean use_cut_semantics)
+{
+    SCM split_scm;
+
+    if ((from == NULL) || (to == NULL))
+        return;
+
+    split_scm = gnc_copy_split(from, use_cut_semantics);
+    if (split_scm == SCM_UNDEFINED)
+        return;
+
+    gnc_copy_split_scm_onto_split(split_scm, to, gnc_get_current_book ());
+}
+
+/* Uses the scheme transaction copying routines */
+void
+gnc_copy_trans_onto_trans(Transaction *from, Transaction *to,
+                          gboolean use_cut_semantics,
+                          gboolean do_commit)
+{
+    SCM trans_scm;
+
+    if ((from == NULL) || (to == NULL))
+        return;
+
+    trans_scm = gnc_copy_trans(from, use_cut_semantics);
+    if (trans_scm == SCM_UNDEFINED)
+        return;
+
+    gnc_copy_trans_scm_onto_trans(trans_scm, to, do_commit,
+                                  gnc_get_current_book ());
+}
+
+static int
+gnc_split_get_value_denom (Split *split)
+{
+    gnc_commodity *currency;
+    int denom;
+
+    currency = xaccTransGetCurrency (xaccSplitGetParent (split));
+    denom = gnc_commodity_get_fraction (currency);
+    if (denom == 0)
+    {
+        gnc_commodity *commodity = gnc_default_currency ();
+        denom = gnc_commodity_get_fraction (commodity);
+        if (denom == 0)
+            denom = 100;
+    }
+
+    return denom;
+}
+
+static int
+gnc_split_get_amount_denom (Split *split)
+{
+    int denom;
+
+    denom = xaccAccountGetCommoditySCU (xaccSplitGetAccount (split));
+    if (denom == 0)
+    {
+        gnc_commodity *commodity = gnc_default_currency ();
+        denom = gnc_commodity_get_fraction (commodity);
+        if (denom == 0)
+            denom = 100;
+    }
+
+    return denom;
+}
+
+/* returns TRUE if begin_edit was aborted */
+gboolean
+gnc_split_register_begin_edit_or_warn(SRInfo *info, Transaction *trans)
+{
+    ENTER("info=%p, trans=%p", info, trans);
+
+    if (!xaccTransIsOpen(trans))
+    {
+        xaccTransBeginEdit(trans);
+        /* This is now the pending transaction */
+        info->pending_trans_guid = *xaccTransGetGUID(trans);
+        LEAVE("opened and marked pending");
+        return FALSE;
+    }
+    else
+    {
+        Split       *blank_split = xaccSplitLookup (&info->blank_split_guid,
+                                   gnc_get_current_book ());
+        Transaction *blank_trans = xaccSplitGetParent (blank_split);
+
+        if (trans == blank_trans)
+        {
+            /* This is a brand-new transaction. It is already
+             * open, so just mark it as pending. */
+            info->pending_trans_guid = *xaccTransGetGUID(trans);
+            LEAVE("already open, now pending.");
+            return FALSE;
+        }
+        else
+        {
+            GtkWidget *parent = NULL;
+            if (info->get_parent)
+                parent = info->get_parent(info->user_data);
+            gnc_error_dialog(parent, "%s", _("This transaction is already being edited in another register. Please finish editing it there first."));
+            LEAVE("already editing");
+            return TRUE;
+        }
+    }
+    LEAVE(" ");
+    return FALSE;  /* to satisfy static code analysis */
+}
+
+void
+gnc_split_register_expand_current_trans (SplitRegister *reg, gboolean expand)
+{
+    SRInfo *info = gnc_split_register_get_info (reg);
+    VirtualLocation virt_loc;
+
+    if (!reg)
+        return;
+
+    if (reg->style == REG_STYLE_AUTO_LEDGER ||
+            reg->style == REG_STYLE_JOURNAL)
+        return;
+
+    /* ok, so I just wanted an excuse to use exclusive-or */
+    if (!(expand ^ info->trans_expanded))
+        return;
+
+    if (!expand)
+    {
+        virt_loc = reg->table->current_cursor_loc;
+        gnc_split_register_get_trans_split (reg, virt_loc.vcell_loc,
+                                            &virt_loc.vcell_loc);
+
+        if (gnc_table_find_close_valid_cell (reg->table, &virt_loc, FALSE))
+            gnc_table_move_cursor_gui (reg->table, virt_loc);
+        else
+        {
+            PERR ("Can't find place to go!");
+            return;
+        }
+    }
+
+    info->trans_expanded = expand;
+
+    gnc_table_set_virt_cell_cursor (reg->table,
+                                    reg->table->current_cursor_loc.vcell_loc,
+                                    gnc_split_register_get_active_cursor (reg));
+
+    gnc_split_register_set_trans_visible(
+        reg, reg->table->current_cursor_loc.vcell_loc, expand, FALSE);
+
+    virt_loc = reg->table->current_cursor_loc;
+    if (!expand || !gnc_table_virtual_loc_valid (reg->table, virt_loc, FALSE))
+    {
+        if (gnc_table_find_close_valid_cell (reg->table, &virt_loc, FALSE))
+            gnc_table_move_cursor_gui (reg->table, virt_loc);
+        else
+        {
+            PERR ("Can't find place to go!");
+            return;
+        }
+    }
+
+    gnc_table_refresh_gui (reg->table, TRUE);
+
+    if (expand)
+        gnc_split_register_show_trans (reg,
+                                       reg->table->current_cursor_loc.vcell_loc);
+}
+
+gboolean
+gnc_split_register_current_trans_expanded (SplitRegister *reg)
+{
+    SRInfo *info = gnc_split_register_get_info (reg);
+
+    if (!reg)
+        return FALSE;
+
+    if (reg->style == REG_STYLE_AUTO_LEDGER ||
+            reg->style == REG_STYLE_JOURNAL)
+        return TRUE;
+
+    return info->trans_expanded;
+}
+
+Transaction *
+gnc_split_register_get_current_trans (SplitRegister *reg)
+{
+    Split *split;
+    VirtualCellLocation vcell_loc;
+
+    if (reg == NULL)
+        return NULL;
+
+    split = gnc_split_register_get_current_split (reg);
+    if (split != NULL)
+        return xaccSplitGetParent(split);
+
+    /* Split is blank. Assume it is the blank split of a multi-line
+     * transaction. Go back one row to find a split in the transaction. */
+    vcell_loc = reg->table->current_cursor_loc.vcell_loc;
+
+    vcell_loc.virt_row--;
+
+    split = gnc_split_register_get_split (reg, vcell_loc);
+
+    return xaccSplitGetParent (split);
+}
+
+Split *
+gnc_split_register_get_current_split (SplitRegister *reg)
+{
+    if (reg == NULL)
+        return NULL;
+
+    return gnc_split_register_get_split(
+               reg, reg->table->current_cursor_loc.vcell_loc);
+}
+
+Split *
+gnc_split_register_get_blank_split (SplitRegister *reg)
+{
+    SRInfo *info = gnc_split_register_get_info (reg);
+
+    if (!reg) return NULL;
+
+    return xaccSplitLookup (&info->blank_split_guid, gnc_get_current_book ());
+}
+
+gboolean
+gnc_split_register_get_split_virt_loc (SplitRegister *reg, Split *split,
+                                       VirtualCellLocation *vcell_loc)
+{
+    Table *table;
+    int v_row;
+    int v_col;
+
+    if (!reg || !split) return FALSE;
+
+    table = reg->table;
+
+    /* go backwards because typically you search for splits at the end
+     * and because we find split rows before transaction rows. */
+
+    for (v_row = table->num_virt_rows - 1; v_row > 0; v_row--)
+        for (v_col = 0; v_col < table->num_virt_cols; v_col++)
+        {
+            VirtualCellLocation vc_loc = { v_row, v_col };
+            VirtualCell *vcell;
+            Split *s;
+
+            vcell = gnc_table_get_virtual_cell (table, vc_loc);
+            if (!vcell || !vcell->visible)
+                continue;
+
+            s = xaccSplitLookup (vcell->vcell_data, gnc_get_current_book ());
+
+            if (s == split)
+            {
+                if (vcell_loc)
+                    *vcell_loc = vc_loc;
+
+                return TRUE;
+            }
+        }
+
+    return FALSE;
+}
+
+gboolean
+gnc_split_register_get_split_amount_virt_loc (SplitRegister *reg, Split *split,
+        VirtualLocation *virt_loc)
+{
+    VirtualLocation v_loc;
+    CursorClass cursor_class;
+    const char *cell_name;
+    gnc_numeric value;
+
+    if (!gnc_split_register_get_split_virt_loc (reg, split, &v_loc.vcell_loc))
+        return FALSE;
+
+    cursor_class = gnc_split_register_get_cursor_class (reg, v_loc.vcell_loc);
+
+    value = xaccSplitGetValue (split);
+
+    switch (cursor_class)
+    {
+    case CURSOR_CLASS_SPLIT:
+    case CURSOR_CLASS_TRANS:
+        cell_name = (gnc_numeric_negative_p (value)) ? CRED_CELL : DEBT_CELL;
+        break;
+    default:
+        return FALSE;
+    }
+
+    if (!gnc_table_get_cell_location (reg->table, cell_name,
+                                      v_loc.vcell_loc, &v_loc))
+        return FALSE;
+
+    if (virt_loc == NULL)
+        return TRUE;
+
+    *virt_loc = v_loc;
+
+    return TRUE;
+}
+
+Split *
+gnc_split_register_duplicate_current (SplitRegister *reg)
+{
+    SRInfo *info = gnc_split_register_get_info(reg);
+    CursorClass cursor_class;
+    Transaction *trans;
+    Split *return_split;
+    Split *trans_split;
+    Split *blank_split;
+    gboolean changed;
+    Split *split;
+
+    ENTER("reg=%p", reg);
+
+    blank_split = xaccSplitLookup(&info->blank_split_guid,
+                                  gnc_get_current_book ());
+    split = gnc_split_register_get_current_split (reg);
+    trans = gnc_split_register_get_current_trans (reg);
+    trans_split = gnc_split_register_get_current_trans_split (reg, NULL);
+
+    /* This shouldn't happen, but be paranoid. */
+    if (trans == NULL)
+    {
+        LEAVE("no transaction");
+        return NULL;
+    }
+
+    cursor_class = gnc_split_register_get_current_cursor_class (reg);
+
+    /* Can't do anything with this. */
+    if (cursor_class == CURSOR_CLASS_NONE)
+    {
+        LEAVE("no cursor class");
+        return NULL;
+    }
+
+    /* This shouldn't happen, but be paranoid. */
+    if ((split == NULL) && (cursor_class == CURSOR_CLASS_TRANS))
+    {
+        LEAVE("no split with transaction class");
+        return NULL;
+    }
+
+    changed = gnc_table_current_cursor_changed (reg->table, FALSE);
+
+    /* See if we were asked to duplicate an unchanged blank split.
+     * There's no point in doing that! */
+    if (!changed && ((split == NULL) || (split == blank_split)))
+    {
+        LEAVE("skip unchanged blank split");
+        return NULL;
+    }
+
+    gnc_suspend_gui_refresh ();
+
+    /* If the cursor has been edited, we are going to have to commit
+     * it before we can duplicate. Make sure the user wants to do that. */
+    if (changed)
+    {
+        GtkWidget *dialog, *window;
+        gint response;
+        const char *title = _("Save transaction before duplicating?");
+        const char *message =
+            _("The current transaction has been changed. Would you like to "
+              "record the changes before duplicating the transaction, or "
+              "cancel the duplication?");
+
+        window = gnc_split_register_get_parent(reg);
+        dialog = gtk_message_dialog_new(GTK_WINDOW(window),
+                                        GTK_DIALOG_DESTROY_WITH_PARENT,
+                                        GTK_MESSAGE_QUESTION,
+                                        GTK_BUTTONS_CANCEL,
+                                        "%s", title);
+        gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
+                "%s", message);
+        gtk_dialog_add_button(GTK_DIALOG(dialog),
+                              _("_Record"), GTK_RESPONSE_ACCEPT);
+        response = gnc_dialog_run(GTK_DIALOG(dialog), GNC_PREF_WARN_REG_TRANS_DUP);
+        gtk_widget_destroy(dialog);
+
+        if (response != GTK_RESPONSE_ACCEPT)
+        {
+            gnc_resume_gui_refresh ();
+            LEAVE("save cancelled");
+            return NULL;
+        }
+
+        gnc_split_register_save (reg, TRUE);
+
+        /* If the split is NULL, then we were on a blank split row
+         * in an expanded transaction. The new split (created by
+         * gnc_split_register_save above) will be the last split in the
+         * current transaction, as it was just added. */
+        if (split == NULL)
+            split = xaccTransGetSplit (trans, xaccTransCountSplits (trans) - 1);
+    }
+
+    /* Ok, we are now ready to make the copy. */
+
+    if (cursor_class == CURSOR_CLASS_SPLIT)
+    {
+        Split *new_split;
+        char *out_num;
+        gboolean new_act_num = FALSE;
+
+        /* We are on a split in an expanded transaction.
+         * Just copy the split and add it to the transaction.
+         * However, if the split-action field is being used as the register
+         * number, and the action field is a number, request a new value or
+         * cancel. Need to get next number and update account last num from
+         * split account not register account, which may be the same or not */
+
+        if (!reg->use_tran_num_for_num_field
+            && gnc_strisnum (gnc_get_num_action (NULL, split)))
+        {
+            Account *account = xaccSplitGetAccount (split);
+            const char *in_num = NULL;
+            const char* title = _("New Split Information");
+            time64 date = info->last_date_entered;
+
+            if (account)
+                in_num = xaccAccountGetLastNum (account);
+            else
+                in_num = gnc_get_num_action (NULL, split);
+            if (!gnc_dup_trans_dialog (gnc_split_register_get_parent (reg),
+                                   title, FALSE, &date, in_num, &out_num, NULL, NULL))
+            {
+                gnc_resume_gui_refresh ();
+                LEAVE("dup cancelled");
+                return NULL;
+            }
+            new_act_num = TRUE;
+        }
+
+        new_split = xaccMallocSplit (gnc_get_current_book ());
+
+        xaccTransBeginEdit (trans);
+        xaccSplitSetParent (new_split, trans);
+        gnc_copy_split_onto_split (split, new_split, FALSE);
+        if (new_act_num) /* if new number supplied by user dialog */
+            gnc_set_num_action (NULL, new_split, out_num, NULL);
+        xaccTransCommitEdit (trans);
+
+        if (new_act_num && gnc_strisnum (out_num))
+        {
+            Account *account = xaccSplitGetAccount (new_split);
+
+            /* If current register is for account, set last num */
+            if (xaccAccountEqual(account,
+                                    gnc_split_register_get_default_account(reg),
+                                    TRUE))
+            {
+                NumCell *num_cell;
+                num_cell = (NumCell *) gnc_table_layout_get_cell (reg->table->layout,
+                       NUM_CELL);
+                if (gnc_num_cell_set_last_num (num_cell, out_num))
+                    gnc_split_register_set_last_num (reg, out_num);
+            }
+            else
+            {
+                xaccAccountSetLastNum (account, out_num);
+            }
+        }
+
+        return_split = new_split;
+
+        info->cursor_hint_split = new_split;
+        info->cursor_hint_cursor_class = CURSOR_CLASS_SPLIT;
+        if (new_act_num)
+            g_free (out_num);
+    }
+    else
+    {
+        NumCell *num_cell;
+        Transaction *new_trans;
+        int trans_split_index;
+        int split_index;
+        const char *in_num = NULL;
+        const char *in_tnum = NULL;
+        char *out_num = NULL;
+        char *out_tnum = NULL;
+        time64 date;
+        gboolean use_autoreadonly = qof_book_uses_autoreadonly(gnc_get_current_book());
+
+        /* We are on a transaction row. Copy the whole transaction. */
+
+        date = info->last_date_entered;
+        if (gnc_strisnum (gnc_get_num_action (trans, trans_split)))
+        {
+            Account *account = gnc_split_register_get_default_account (reg);
+
+            if (account)
+                in_num = xaccAccountGetLastNum (account);
+            else
+                in_num = gnc_get_num_action (trans, trans_split);
+            in_tnum = (reg->use_tran_num_for_num_field
+                                        ? NULL
+                                        : gnc_get_num_action (trans, NULL));
+        }
+
+        if (!gnc_dup_trans_dialog (gnc_split_register_get_parent (reg), NULL,
+                                   TRUE, &date, in_num, &out_num, in_tnum, &out_tnum))
+        {
+            gnc_resume_gui_refresh ();
+            LEAVE("dup cancelled");
+            return NULL;
+        }
+
+        if (use_autoreadonly)
+        {
+            GDate d;
+            GDate *readonly_threshold = qof_book_get_autoreadonly_gdate(gnc_get_current_book());
+            gnc_gdate_set_time64 (&d, date);
+            if (g_date_compare(&d, readonly_threshold) < 0)
+            {
+                GtkWidget *dialog = gtk_message_dialog_new(NULL,
+                                    0,
+                                    GTK_MESSAGE_ERROR,
+                                    GTK_BUTTONS_OK,
+                                    "%s", _("Cannot store a transaction at this date"));
+                gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
+                        "%s", _("The entered date of the duplicated transaction is older than the \"Read-Only Threshold\" set for this book. "
+                                "This setting can be changed in File -> Properties -> Accounts."));
+                gtk_dialog_run(GTK_DIALOG(dialog));
+                gtk_widget_destroy(dialog);
+
+                g_date_free(readonly_threshold);
+                return NULL;
+            }
+            g_date_free(readonly_threshold);
+        }
+
+        split_index = xaccTransGetSplitIndex(trans, split);
+        trans_split_index = xaccTransGetSplitIndex(trans, trans_split);
+
+        /* we should *always* find the split, but be paranoid */
+        if (split_index < 0)
+        {
+            gnc_resume_gui_refresh ();
+            LEAVE("no split");
+            return NULL;
+        }
+
+        new_trans = xaccMallocTransaction (gnc_get_current_book ());
+
+        xaccTransBeginEdit (new_trans);
+        gnc_copy_trans_onto_trans (trans, new_trans, FALSE, FALSE);
+        xaccTransSetDatePostedSecsNormalized (new_trans, date);
+        /* We also must set a new DateEntered on the new entry
+         * because otherwise the ordering is not deterministic */
+        xaccTransSetDateEnteredSecs(new_trans, gnc_time(NULL));
+
+        /* set per book option */
+        gnc_set_num_action (new_trans, NULL, out_num, out_tnum);
+        if (!reg->use_tran_num_for_num_field)
+        {
+            /* find split in new_trans that equals trans_split and set
+             * split_action to out_num */
+            gnc_set_num_action (NULL,
+                                xaccTransGetSplit (new_trans, trans_split_index),
+                                out_num, NULL);
+            /* note that if the transaction has multiple splits to the register
+             * account, only the anchor split will be set with user input. The
+             * user will have to adjust other splits manually. */
+        }
+        xaccTransCommitEdit (new_trans);
+
+        num_cell = (NumCell *) gnc_table_layout_get_cell (reg->table->layout,
+                   NUM_CELL);
+        if (gnc_num_cell_set_last_num (num_cell, out_num))
+            gnc_split_register_set_last_num (reg, out_num);
+
+        g_free (out_num);
+        if (!reg->use_tran_num_for_num_field)
+            g_free (out_tnum);
+
+        /* This shouldn't happen, but be paranoid. */
+        if (split_index >= xaccTransCountSplits (new_trans))
+            split_index = 0;
+
+        return_split = xaccTransGetSplit (new_trans, split_index);
+        trans_split = xaccTransGetSplit (new_trans, trans_split_index);
+
+        info->cursor_hint_trans = new_trans;
+        info->cursor_hint_split = return_split;
+        info->cursor_hint_trans_split = trans_split;
+        info->cursor_hint_cursor_class = CURSOR_CLASS_TRANS;
+
+        info->trans_expanded = FALSE;
+    }
+
+    /* Refresh the GUI. */
+    gnc_resume_gui_refresh ();
+
+    LEAVE(" ");
+    return return_split;
+}
+
+static void
+gnc_split_register_copy_current_internal (SplitRegister *reg,
+        gboolean use_cut_semantics)
+{
+    SRInfo *info = gnc_split_register_get_info(reg);
+    CursorClass cursor_class;
+    Transaction *trans;
+    Split *blank_split;
+    gboolean changed;
+    Split *split;
+    SCM new_item;
+
+    g_return_if_fail(reg);
+    ENTER("reg=%p, use_cut_semantics=%s", reg,
+          use_cut_semantics ? "TRUE" : "FALSE");
+
+    blank_split = xaccSplitLookup(&info->blank_split_guid,
+                                  gnc_get_current_book ());
+    split = gnc_split_register_get_current_split (reg);
+    trans = gnc_split_register_get_current_trans (reg);
+
+    /* This shouldn't happen, but be paranoid. */
+    if (trans == NULL)
+    {
+        LEAVE("no trans");
+        return;
+    }
+
+    cursor_class = gnc_split_register_get_current_cursor_class (reg);
+
+    /* Can't do anything with this. */
+    if (cursor_class == CURSOR_CLASS_NONE)
+    {
+        LEAVE("no cursor class");
+        return;
+    }
+
+    /* This shouldn't happen, but be paranoid. */
+    if ((split == NULL) && (cursor_class == CURSOR_CLASS_TRANS))
+    {
+        g_warning("BUG DETECTED: transaction cursor with no anchoring split!");
+        LEAVE("transaction cursor with no anchoring split");
+        return;
+    }
+
+    changed = gnc_table_current_cursor_changed (reg->table, FALSE);
+
+    /* See if we were asked to copy an unchanged blank split. Don't. */
+    if (!changed && ((split == NULL) || (split == blank_split)))
+    {
+        /* We're either on an unedited, brand-new split or an unedited, brand-new
+         * transaction (the transaction anchored by the blank split.) */
+        /* FIXME: This doesn't work exactly right. When entering a new transaction,
+         *        you can edit the description, move to a split row, then move
+         *        back to the description, then ask for a copy, and this code will
+         *        be reached. It forgets that you changed the row the first time
+         *        you were there.  -Charles */
+        LEAVE("nothing to copy/cut");
+        return;
+    }
+
+    /* Ok, we are now ready to make the copy. */
+
+    if (cursor_class == CURSOR_CLASS_SPLIT)
+    {
+        /* We are on a split in an expanded transaction. Just copy the split. */
+        new_item = gnc_copy_split(split, use_cut_semantics);
+
+        if (new_item != SCM_UNDEFINED)
+        {
+            if (changed)
+                gnc_split_register_save_to_scm (reg, SCM_UNDEFINED, new_item,
+                                                use_cut_semantics);
+
+            copied_leader_guid = *guid_null();
+        }
+    }
+    else
+    {
+        /* We are on a transaction row. Copy the whole transaction. */
+        new_item = gnc_copy_trans(trans, use_cut_semantics);
+
+        if (new_item != SCM_UNDEFINED)
+        {
+            if (changed)
+            {
+                int split_index;
+                SCM split_scm;
+
+                split_index = xaccTransGetSplitIndex(trans, split);
+                if (split_index >= 0)
+                    split_scm = gnc_trans_scm_get_split_scm(new_item, split_index);
+                else
+                    split_scm = SCM_UNDEFINED;
+
+                gnc_split_register_save_to_scm (reg, new_item, split_scm,
+                                                use_cut_semantics);
+            }
+
+            copied_leader_guid = info->default_account;
+        }
+    }
+
+    if (new_item == SCM_UNDEFINED)
+    {
+        g_warning("BUG DETECTED: copy failed");
+        LEAVE("copy failed");
+        return;
+    }
+
+    /* unprotect the old object, if any */
+    if (copied_item != SCM_UNDEFINED)
+        scm_gc_unprotect_object(copied_item);
+
+    copied_item = new_item;
+    scm_gc_protect_object(copied_item);
+
+    copied_class = cursor_class;
+    LEAVE("%s %s", use_cut_semantics ? "cut" : "copied",
+          cursor_class == CURSOR_CLASS_SPLIT ? "split" : "transaction");
+}
+
+void
+gnc_split_register_copy_current (SplitRegister *reg)
+{
+    gnc_split_register_copy_current_internal (reg, FALSE);
+}
+
+void
+gnc_split_register_cut_current (SplitRegister *reg)
+{
+    SRInfo *info = gnc_split_register_get_info (reg);
+    CursorClass cursor_class;
+    Transaction *trans;
+    Split *blank_split;
+    gboolean changed;
+    Split *split;
+
+    blank_split = xaccSplitLookup (&info->blank_split_guid,
+                                   gnc_get_current_book ());
+    split = gnc_split_register_get_current_split (reg);
+    trans = gnc_split_register_get_current_trans (reg);
+
+    /* This shouldn't happen, but be paranoid. */
+    if (trans == NULL)
+        return;
+
+    cursor_class = gnc_split_register_get_current_cursor_class (reg);
+
+    /* Can't do anything with this. */
+    if (cursor_class == CURSOR_CLASS_NONE)
+        return;
+
+    /* This shouldn't happen, but be paranoid. */
+    if ((split == NULL) && (cursor_class == CURSOR_CLASS_TRANS))
+        return;
+
+    changed = gnc_table_current_cursor_changed (reg->table, FALSE);
+
+    /* See if we were asked to cut an unchanged blank split. Don't. */
+    if (!changed && ((split == NULL) || (split == blank_split)))
+        return;
+
+    gnc_split_register_copy_current_internal (reg, TRUE);
+
+    if (cursor_class == CURSOR_CLASS_SPLIT)
+        gnc_split_register_delete_current_split (reg);
+    else
+        gnc_split_register_delete_current_trans (reg);
+}
+
+void
+gnc_split_register_paste_current (SplitRegister *reg)
+{
+    SRInfo *info = gnc_split_register_get_info(reg);
+    CursorClass cursor_class;
+    Transaction *trans;
+    Transaction *blank_trans;
+    Split *blank_split;
+    Split *trans_split;
+    Split *split;
+
+    ENTER("reg=%p", reg);
+
+    if (copied_class == CURSOR_CLASS_NONE)
+    {
+        LEAVE("no copied cursor class");
+        return;
+    }
+
+    blank_split = xaccSplitLookup (&info->blank_split_guid,
+                                   gnc_get_current_book ());
+    blank_trans = xaccSplitGetParent (blank_split);
+    split = gnc_split_register_get_current_split (reg);
+    trans = gnc_split_register_get_current_trans (reg);
+
+    trans_split = gnc_split_register_get_current_trans_split (reg, NULL);
+
+    /* This shouldn't happen, but be paranoid. */
+    if (trans == NULL)
+    {
+        LEAVE("no transaction");
+        return;
+    }
+
+    cursor_class = gnc_split_register_get_current_cursor_class (reg);
+
+    /* Can't do anything with this. */
+    if (cursor_class == CURSOR_CLASS_NONE)
+    {
+        LEAVE("no current cursor class");
+        return;
+    }
+
+    /* This shouldn't happen, but be paranoid. */
+    if ((split == NULL) && (cursor_class == CURSOR_CLASS_TRANS))
+    {
+        g_warning("BUG DETECTED: transaction cursor with no anchoring split!");
+        LEAVE("transaction cursor with no anchoring split");
+        return;
+    }
+
+    if (cursor_class == CURSOR_CLASS_SPLIT)
+    {
+        const char *message = _("You are about to overwrite an existing split. "
+                                "Are you sure you want to do that?");
+
+        if (copied_class == CURSOR_CLASS_TRANS)
+        {
+            /* An entire transaction was copied, but we're just on a split. */
+            LEAVE("can't copy trans to split");
+            return;
+        }
+
+        /* Ask before overwriting an existing split. */
+        if (split != NULL &&
+                !gnc_verify_dialog (gnc_split_register_get_parent (reg),
+                                    FALSE, "%s", message))
+        {
+            LEAVE("user cancelled");
+            return;
+        }
+
+        gnc_suspend_gui_refresh ();
+
+        if (split == NULL)
+        {
+            /* We are on a null split in an expanded transaction. */
+            split = xaccMallocSplit(gnc_get_current_book ());
+            xaccSplitSetParent(split, trans);
+        }
+
+        gnc_copy_split_scm_onto_split(copied_item, split,
+                                      gnc_get_current_book ());
+    }
+    else
+    {
+        const char *message = _("You are about to overwrite an existing "
+                                "transaction. "
+                                "Are you sure you want to do that?");
+        Account * copied_leader;
+        const GncGUID *new_guid;
+        int trans_split_index;
+        int split_index;
+        int num_splits;
+
+        if (copied_class == CURSOR_CLASS_SPLIT)
+        {
+            LEAVE("can't copy split to transaction");
+            return;
+        }
+
+        /* Ask before overwriting an existing transaction. */
+        if (split != blank_split &&
+                !gnc_verify_dialog(gnc_split_register_get_parent(reg),
+                                   FALSE, "%s", message))
+        {
+            LEAVE("user cancelled");
+            return;
+        }
+
+        /* Open the transaction for editing. */
+        if (gnc_split_register_begin_edit_or_warn(info, trans))
+        {
+            LEAVE("can't begin editing");
+            return;
+        }
+
+        gnc_suspend_gui_refresh ();
+
+        DEBUG("Pasting txn, trans=%p, split=%p, blank_trans=%p, blank_split=%p",
+              trans, split, blank_trans, blank_split);
+
+        split_index = xaccTransGetSplitIndex(trans, split);
+        trans_split_index = xaccTransGetSplitIndex(trans, trans_split);
+
+        copied_leader = xaccAccountLookup(&copied_leader_guid,
+                                          gnc_get_current_book());
+        if (copied_leader && (gnc_split_register_get_default_account(reg) != NULL))
+        {
+            new_guid = &info->default_account;
+            gnc_copy_trans_scm_onto_trans_swap_accounts(copied_item, trans,
+                    &copied_leader_guid,
+                    new_guid, FALSE,
+                    gnc_get_current_book ());
+        }
+        else
+            gnc_copy_trans_scm_onto_trans(copied_item, trans, FALSE,
+                                          gnc_get_current_book ());
+
+        num_splits = xaccTransCountSplits(trans);
+        if (split_index >= num_splits)
+            split_index = 0;
+
+        if (trans == blank_trans)
+        {
+            /* In pasting, the blank split is deleted. Pick a new one. */
+            blank_split = xaccTransGetSplit(trans, 0);
+            info->blank_split_guid = *xaccSplitGetGUID (blank_split);
+            info->blank_split_edited = TRUE;
+            info->auto_complete = FALSE;
+            DEBUG("replacement blank_split=%p", blank_split);
+
+            /* NOTE: At this point, the blank transaction virtual cell is still
+             *       anchored by the old, deleted blank split. The register will
+             *       have to be reloaded (redrawn) to correct this. */
+        }
+
+        info->cursor_hint_trans = trans;
+        info->cursor_hint_split = xaccTransGetSplit(trans, split_index);
+        info->cursor_hint_trans_split = xaccTransGetSplit(trans,
+                                        trans_split_index);
+        info->cursor_hint_cursor_class = CURSOR_CLASS_TRANS;
+    }
+
+    /* Refresh the GUI. */
+    gnc_resume_gui_refresh ();
+    LEAVE(" ");
+}
+
+void
+gnc_split_register_delete_current_split (SplitRegister *reg)
+{
+    SRInfo *info = gnc_split_register_get_info (reg);
+    Transaction *pending_trans;
+    Transaction *trans;
+    Split *blank_split;
+    Split *split;
+
+    if (!reg) return;
+
+    blank_split = xaccSplitLookup (&info->blank_split_guid,
+                                   gnc_get_current_book ());
+
+    pending_trans = xaccTransLookup (&info->pending_trans_guid,
+                                     gnc_get_current_book ());
+
+    /* get the current split based on cursor position */
+    split = gnc_split_register_get_current_split (reg);
+    if (split == NULL)
+        return;
+
+    /* If we are deleting the blank split, just cancel. The user is
+     * allowed to delete the blank split as a method for discarding
+     * any edits they may have made to it. */
+    if (split == blank_split)
+    {
+        gnc_split_register_cancel_cursor_split_changes (reg);
+        return;
+    }
+
+    gnc_suspend_gui_refresh ();
+
+    trans = xaccSplitGetParent(split);
+
+    /* Check pending transaction */
+    if (trans == pending_trans)
+    {
+        g_assert(xaccTransIsOpen(trans));
+    }
+    else
+    {
+        g_assert(!pending_trans);
+        if (gnc_split_register_begin_edit_or_warn(info, trans))
+        {
+            gnc_resume_gui_refresh ();
+            return;
+        }
+    }
+    xaccSplitDestroy (split);
+
+    gnc_resume_gui_refresh ();
+    gnc_split_register_redraw(reg);
+}
+
+void
+gnc_split_register_delete_current_trans (SplitRegister *reg)
+{
+    SRInfo *info = gnc_split_register_get_info (reg);
+    Transaction *pending_trans;
+    Transaction *trans;
+    Split *blank_split;
+    Split *split;
+    gboolean was_open;
+
+    ENTER("reg=%p", reg);
+    if (!reg)
+    {
+        LEAVE("no register");
+        return;
+    }
+
+    blank_split = xaccSplitLookup (&info->blank_split_guid,
+                                   gnc_get_current_book ());
+    pending_trans = xaccTransLookup (&info->pending_trans_guid,
+                                     gnc_get_current_book ());
+
+    /* get the current split based on cursor position */
+    split = gnc_split_register_get_current_split (reg);
+    if (split == NULL)
+    {
+        LEAVE("no split");
+        return;
+    }
+
+    gnc_suspend_gui_refresh ();
+    trans = xaccSplitGetParent(split);
+
+    /* If we just deleted the blank split, clean up. The user is
+     * allowed to delete the blank split as a method for discarding
+     * any edits they may have made to it. */
+    if (split == blank_split)
+    {
+        DEBUG("deleting blank split");
+        info->blank_split_guid = *guid_null();
+        info->auto_complete = FALSE;
+    }
+    else
+    {
+        info->trans_expanded = FALSE;
+    }
+
+    /* Check pending transaction */
+    if (trans == pending_trans)
+    {
+        DEBUG("clearing pending trans");
+        info->pending_trans_guid = *guid_null();
+        pending_trans = NULL;
+    }
+
+    was_open = xaccTransIsOpen(trans);
+    xaccTransDestroy(trans);
+    if (was_open)
+    {
+        DEBUG("committing");
+        xaccTransCommitEdit(trans);
+    }
+    gnc_resume_gui_refresh ();
+    LEAVE(" ");
+}
+
+void
+gnc_split_register_void_current_trans (SplitRegister *reg, const char *reason)
+{
+    SRInfo *info = gnc_split_register_get_info (reg);
+    Transaction *pending_trans;
+    Transaction *trans;
+    Split *blank_split;
+    Split *split;
+
+    if (!reg) return;
+
+    blank_split = xaccSplitLookup (&info->blank_split_guid,
+                                   gnc_get_current_book ());
+    pending_trans = xaccTransLookup (&info->pending_trans_guid,
+                                     gnc_get_current_book ());
+
+    /* get the current split based on cursor position */
+    split = gnc_split_register_get_current_split (reg);
+    if (split == NULL)
+        return;
+
+    /* Bail if trying to void the blank split. */
+    if (split == blank_split)
+        return;
+
+    /* already voided. */
+    if (xaccSplitGetReconcile (split) == VREC)
+        return;
+
+    info->trans_expanded = FALSE;
+
+    gnc_suspend_gui_refresh ();
+
+    trans = xaccSplitGetParent(split);
+    xaccTransVoid(trans, reason);
+
+    /* Check pending transaction */
+    if (trans == pending_trans)
+    {
+        info->pending_trans_guid = *guid_null();
+        pending_trans = NULL;
+    }
+    if (xaccTransIsOpen(trans))
+    {
+        PERR("We should not be voiding an open transaction.");
+        xaccTransCommitEdit(trans);
+    }
+    gnc_resume_gui_refresh ();
+}
+
+void
+gnc_split_register_unvoid_current_trans (SplitRegister *reg)
+{
+    SRInfo *info = gnc_split_register_get_info (reg);
+    Transaction *pending_trans;
+    Transaction *trans;
+    Split *blank_split;
+    Split *split;
+
+    if (!reg) return;
+
+    blank_split = xaccSplitLookup (&info->blank_split_guid,
+                                   gnc_get_current_book ());
+    pending_trans = xaccTransLookup (&info->pending_trans_guid,
+                                     gnc_get_current_book ());
+
+    /* get the current split based on cursor position */
+    split = gnc_split_register_get_current_split (reg);
+    if (split == NULL)
+        return;
+
+    /* Bail if trying to unvoid the blank split. */
+    if (split == blank_split)
+        return;
+
+    /* not voided. */
+    if (xaccSplitGetReconcile (split) != VREC)
+        return;
+
+    info->trans_expanded = FALSE;
+
+    gnc_suspend_gui_refresh ();
+
+    trans = xaccSplitGetParent(split);
+
+    xaccTransUnvoid(trans);
+
+    /* Check pending transaction */
+    if (trans == pending_trans)
+    {
+        info->pending_trans_guid = *guid_null();
+        pending_trans = NULL;
+    }
+
+    gnc_resume_gui_refresh ();
+}
+
+void
+gnc_split_register_empty_current_trans_except_split (SplitRegister *reg,
+        Split *split)
+{
+    SRInfo *info;
+    Transaction *trans;
+    Transaction *pending;
+    int i = 0;
+    Split *s;
+
+    if ((reg == NULL)  || (split == NULL))
+        return;
+
+    gnc_suspend_gui_refresh ();
+    info = gnc_split_register_get_info(reg);
+    pending = xaccTransLookup(&info->pending_trans_guid, gnc_get_current_book());
+
+    trans = xaccSplitGetParent(split);
+    if (!pending)
+    {
+        if (gnc_split_register_begin_edit_or_warn(info, trans))
+        {
+            gnc_resume_gui_refresh ();
+            return;
+        }
+    }
+    else if (pending == trans)
+    {
+        g_assert(xaccTransIsOpen(trans));
+    }
+    else g_assert_not_reached();
+
+    while ((s = xaccTransGetSplit(trans, i)) != NULL)
+    {
+        if (s != split)
+            xaccSplitDestroy(s);
+        else i++;
+    }
+
+    gnc_resume_gui_refresh ();
+    gnc_split_register_redraw(reg);
+}
+
+void
+gnc_split_register_empty_current_trans (SplitRegister *reg)
+{
+    Split *split;
+
+    /* get the current split based on cursor position */
+    split = gnc_split_register_get_current_split (reg);
+    gnc_split_register_empty_current_trans_except_split (reg, split);
+}
+
+void
+gnc_split_register_cancel_cursor_split_changes (SplitRegister *reg)
+{
+    VirtualLocation virt_loc;
+
+    if (reg == NULL)
+        return;
+
+    virt_loc = reg->table->current_cursor_loc;
+
+    if (!gnc_table_current_cursor_changed (reg->table, FALSE))
+        return;
+
+    /* We're just cancelling the current split here, not the transaction.
+     * When cancelling edits, reload the cursor from the transaction. */
+    gnc_table_clear_current_cursor_changes (reg->table);
+
+    if (gnc_table_find_close_valid_cell (reg->table, &virt_loc, FALSE))
+        gnc_table_move_cursor_gui (reg->table, virt_loc);
+
+    gnc_table_refresh_gui (reg->table, TRUE);
+}
+
+void
+gnc_split_register_cancel_cursor_trans_changes (SplitRegister *reg)
+{
+    SRInfo *info = gnc_split_register_get_info (reg);
+    Transaction *pending_trans;
+
+    pending_trans = xaccTransLookup (&info->pending_trans_guid,
+                                     gnc_get_current_book ());
+
+    /* Get the currently open transaction, rollback the edits on it, and
+     * then repaint everything. To repaint everything, make a note of
+     * all of the accounts that will be affected by this rollback. */
+    if (!xaccTransIsOpen (pending_trans))
+    {
+        gnc_split_register_cancel_cursor_split_changes (reg);
+        return;
+    }
+
+    if (!pending_trans)
+        return;
+
+    gnc_suspend_gui_refresh ();
+
+    xaccTransRollbackEdit (pending_trans);
+
+    info->pending_trans_guid = *guid_null ();
+
+    gnc_resume_gui_refresh ();
+    gnc_split_register_redraw(reg);
+}
+
+void
+gnc_split_register_redraw (SplitRegister *reg)
+{
+    gnc_ledger_display_refresh_by_split_register (reg);
+}
+
+/* Copy from the register object to scheme. This needs to be
+ * in sync with gnc_split_register_save and xaccSRSaveChangedCells. */
+static gboolean
+gnc_split_register_save_to_scm (SplitRegister *reg,
+                                SCM trans_scm, SCM split_scm,
+                                gboolean use_cut_semantics)
+{
+    SCM other_split_scm = SCM_UNDEFINED;
+    Transaction *trans;
+
+    /* use the changed flag to avoid heavy-weight updates
+     * of the split & transaction fields. This will help
+     * cut down on uneccessary register redraws. */
+    if (!gnc_table_current_cursor_changed (reg->table, FALSE))
+        return FALSE;
+
+    /* get the handle to the current split and transaction */
+    trans = gnc_split_register_get_current_trans (reg);
+    if (trans == NULL)
+        return FALSE;
+
+    /* copy the contents from the cursor to the split */
+    if (gnc_table_layout_get_cell_changed (reg->table->layout, DATE_CELL, TRUE))
+    {
+        BasicCell *cell;
+        Timespec ts;
+
+        cell = gnc_table_layout_get_cell (reg->table->layout, DATE_CELL);
+        gnc_date_cell_get_date ((DateCell *) cell, &ts);
+
+        gnc_trans_scm_set_date(trans_scm, &ts);
+    }
+
+    if (gnc_table_layout_get_cell_changed (reg->table->layout, NUM_CELL, TRUE))
+    {
+        const char *value;
+
+        value = gnc_table_layout_get_cell_value (reg->table->layout, NUM_CELL);
+        if (reg->use_tran_num_for_num_field)
+            gnc_trans_scm_set_num (trans_scm, value);
+     /* else this contains the same as ACTN_CELL which is already handled below *
+      * and the TNUM_CELL contains transaction number which is handled in next  *
+      * if statement. */
+    }
+
+    if (gnc_table_layout_get_cell_changed (reg->table->layout, TNUM_CELL, TRUE))
+    {
+        const char *value;
+
+        value = gnc_table_layout_get_cell_value (reg->table->layout, TNUM_CELL);
+        if (!reg->use_tran_num_for_num_field)
+            gnc_trans_scm_set_num (trans_scm, value);
+     /* else this cell is not used */
+    }
+
+    if (gnc_table_layout_get_cell_changed (reg->table->layout, DESC_CELL, TRUE))
+    {
+        const char *value;
+
+        value = gnc_table_layout_get_cell_value (reg->table->layout, DESC_CELL);
+        gnc_trans_scm_set_description (trans_scm, value);
+    }
+
+    if (gnc_table_layout_get_cell_changed (reg->table->layout, NOTES_CELL, TRUE))
+    {
+        const char *value;
+
+        value = gnc_table_layout_get_cell_value (reg->table->layout, NOTES_CELL);
+        gnc_trans_scm_set_notes (trans_scm, value);
+    }
+
+    if (gnc_table_layout_get_cell_changed (reg->table->layout, RECN_CELL, TRUE))
+    {
+        BasicCell *cell;
+        char flag;
+
+        cell = gnc_table_layout_get_cell (reg->table->layout, RECN_CELL);
+        flag = gnc_recn_cell_get_flag ((RecnCell *) cell);
+
+        gnc_split_scm_set_reconcile_state(split_scm, flag);
+    }
+
+    if (gnc_table_layout_get_cell_changed (reg->table->layout, ACTN_CELL, TRUE))
+    {
+        const char *value;
+
+        value = gnc_table_layout_get_cell_value (reg->table->layout, ACTN_CELL);
+        gnc_split_scm_set_action (split_scm, value);
+    }
+
+    if (gnc_table_layout_get_cell_changed (reg->table->layout, MEMO_CELL, TRUE))
+    {
+        const char *value;
+
+        value = gnc_table_layout_get_cell_value (reg->table->layout, MEMO_CELL);
+        gnc_split_scm_set_memo (split_scm, value);
+    }
+
+    if (gnc_table_layout_get_cell_changed (reg->table->layout, XFRM_CELL, TRUE))
+    {
+        Account *new_account;
+
+        new_account = gnc_split_register_get_account (reg, XFRM_CELL);
+
+        if (new_account != NULL)
+            gnc_split_scm_set_account (split_scm, new_account);
+    }
+
+    if (reg->style == REG_STYLE_LEDGER)
+        other_split_scm = gnc_trans_scm_get_other_split_scm (trans_scm, split_scm);
+
+    if (gnc_table_layout_get_cell_changed (reg->table->layout, MXFRM_CELL, TRUE))
+    {
+        other_split_scm = gnc_trans_scm_get_other_split_scm (trans_scm, split_scm);
+
+        if (other_split_scm == SCM_UNDEFINED)
+        {
+            if (gnc_trans_scm_get_num_splits(trans_scm) == 1)
+            {
+                Split *temp_split;
+
+                temp_split = xaccMallocSplit (gnc_get_current_book ());
+                other_split_scm = gnc_copy_split (temp_split, use_cut_semantics);
+                xaccSplitDestroy (temp_split);
+
+                gnc_trans_scm_append_split_scm (trans_scm, other_split_scm);
+            }
+        }
+
+        if (other_split_scm != SCM_UNDEFINED)
+        {
+            Account *new_account;
+
+            new_account = gnc_split_register_get_account (reg, MXFRM_CELL);
+
+            if (new_account != NULL)
+                gnc_split_scm_set_account (other_split_scm, new_account);
+        }
+    }
+
+    if (gnc_table_layout_get_cell_changed (reg->table->layout,
+                                           DEBT_CELL, TRUE) ||
+            gnc_table_layout_get_cell_changed (reg->table->layout,
+                    CRED_CELL, TRUE))
+    {
+        BasicCell *cell;
+        gnc_numeric new_value;
+        gnc_numeric credit;
+        gnc_numeric debit;
+
+        cell = gnc_table_layout_get_cell (reg->table->layout, CRED_CELL);
+        credit = gnc_price_cell_get_value ((PriceCell *) cell);
+
+        cell = gnc_table_layout_get_cell (reg->table->layout, DEBT_CELL);
+        debit = gnc_price_cell_get_value ((PriceCell *) cell);
+
+        new_value = gnc_numeric_sub_fixed (debit, credit);
+
+        gnc_split_scm_set_value (split_scm, new_value);
+    }
+
+    if (gnc_table_layout_get_cell_changed (reg->table->layout, PRIC_CELL, TRUE))
+    {
+        /* do nothing for now */
+    }
+
+    if (gnc_table_layout_get_cell_changed (reg->table->layout, SHRS_CELL, TRUE))
+    {
+        BasicCell *cell;
+        gnc_numeric shares;
+
+        cell = gnc_table_layout_get_cell (reg->table->layout, SHRS_CELL);
+
+        shares = gnc_price_cell_get_value ((PriceCell *) cell);
+
+        gnc_split_scm_set_amount (split_scm, shares);
+    }
+
+    if (gnc_table_layout_get_cell_changed (reg->table->layout,
+                                           DEBT_CELL, TRUE) ||
+            gnc_table_layout_get_cell_changed (reg->table->layout,
+                    CRED_CELL, TRUE) ||
+            gnc_table_layout_get_cell_changed (reg->table->layout,
+                    PRIC_CELL, TRUE) ||
+            gnc_table_layout_get_cell_changed (reg->table->layout,
+                    SHRS_CELL, TRUE))
+    {
+        if (other_split_scm != SCM_UNDEFINED)
+        {
+            gnc_numeric num;
+
+            num = gnc_split_scm_get_amount (split_scm);
+            gnc_split_scm_set_amount (other_split_scm, gnc_numeric_neg (num));
+
+            num = gnc_split_scm_get_value (split_scm);
+            gnc_split_scm_set_value (other_split_scm, gnc_numeric_neg (num));
+        }
+    }
+
+    return TRUE;
+}
+
+gboolean
+gnc_split_register_save (SplitRegister *reg, gboolean do_commit)
+{
+    SRInfo *info = gnc_split_register_get_info (reg);
+    Transaction *pending_trans;
+    Transaction *blank_trans;
+    Transaction *trans;
+    Account *account;
+    Split *blank_split;
+    const char *memo;
+    const char *desc;
+    Split *split;
+
+    ENTER("reg=%p, do_commit=%s", reg, do_commit ? "TRUE" : "FALSE");
+
+    if (!reg)
+    {
+        LEAVE("no register");
+        return FALSE;
+    }
+
+    blank_split = xaccSplitLookup (&info->blank_split_guid,
+                                   gnc_get_current_book ());
+
+    pending_trans = xaccTransLookup (&info->pending_trans_guid,
+                                     gnc_get_current_book ());
+
+    blank_trans = xaccSplitGetParent (blank_split);
+
+    /* get the handle to the current split and transaction */
+    split = gnc_split_register_get_current_split (reg);
+    trans = gnc_split_register_get_current_trans (reg);
+    if (trans == NULL)
+    {
+        LEAVE("no transaction");
+        return FALSE;
+    }
+
+    /* use the changed flag to avoid heavy-weight updates
+     * of the split & transaction fields. This will help
+     * cut down on unnecessary register redraws. */
+    if (!gnc_table_current_cursor_changed (reg->table, FALSE))
+    {
+        if (!do_commit)
+        {
+            LEAVE("commit unnecessary");
+            return FALSE;
+        }
+
+        if (!xaccTransIsOpen(trans))
+        {
+            LEAVE("transaction not open");
+            return FALSE;
+        }
+
+        if (trans == pending_trans ||
+                (trans == blank_trans && info->blank_split_edited))
+        {
+            /* We are going to commit. */
+
+            gnc_suspend_gui_refresh ();
+
+            if (trans == blank_trans)
+            {
+                /* We have to clear the blank split before the
+                 * refresh or a new one won't be created. */
+                info->last_date_entered = xaccTransGetDate (trans);
+                info->blank_split_guid = *guid_null ();
+                info->blank_split_edited = FALSE;
+                info->auto_complete = FALSE;
+            }
+
+            /* We have to clear the pending guid *before* committing the
+             * trans, because the event handler will find it otherwise. */
+            if (trans == pending_trans)
+                info->pending_trans_guid = *guid_null ();
+
+            PINFO("committing trans (%p)", trans);
+            xaccTransCommitEdit(trans);
+
+            gnc_resume_gui_refresh ();
+        }
+        else
+            DEBUG("leaving trans (%p) open", trans);
+
+        LEAVE("unchanged cursor");
+        return TRUE;
+    }
+
+    DEBUG("save split=%p", split);
+    DEBUG("blank_split=%p, blank_trans=%p, pending_trans=%p, trans=%p",
+          blank_split, blank_trans, pending_trans, trans);
+
+    /* Act on any changes to the current cell before the save. */
+    (void) gnc_split_register_check_cell (reg,
+                                          gnc_table_get_current_cell_name (reg->table));
+
+    if (!gnc_split_register_auto_calc (reg, split))
+    {
+        LEAVE("auto calc failed");
+        return FALSE;
+    }
+
+    /* Validate the transfer account names */
+    (void)gnc_split_register_get_account (reg, MXFRM_CELL);
+    (void)gnc_split_register_get_account (reg, XFRM_CELL);
+
+    /* Maybe deal with exchange-rate transfers */
+    if (gnc_split_register_handle_exchange (reg, FALSE))
+    {
+        LEAVE("no exchange rate");
+        return TRUE;
+    }
+
+    gnc_suspend_gui_refresh ();
+
+    /* determine whether we should commit the pending transaction */
+    if (pending_trans != trans)
+    {
+        // FIXME: How could the pending transaction not be open?
+        // FIXME: For that matter, how could an open pending
+        // transaction ever not be the current trans?
+        if (xaccTransIsOpen (pending_trans))
+        {
+            g_warning("Impossible? commiting pending %p", pending_trans);
+            xaccTransCommitEdit (pending_trans);
+        }
+        else if (pending_trans)
+        {
+            g_critical("BUG DETECTED! pending transaction (%p) not open",
+                       pending_trans);
+            g_assert_not_reached();
+        }
+
+        if (trans == blank_trans)
+        {
+            /* Don't begin editing the blank trans, because it's
+               already open, but mark it pending now. */
+            g_assert(xaccTransIsOpen(blank_trans));
+            /* This is now the pending transaction */
+            info->pending_trans_guid = *xaccTransGetGUID(blank_trans);
+        }
+        else
+        {
+            PINFO("beginning edit of trans %p", trans);
+            if (gnc_split_register_begin_edit_or_warn(info, trans))
+            {
+                gnc_resume_gui_refresh ();
+                LEAVE("transaction opened elsewhere");
+                return FALSE;
+            }
+        }
+        pending_trans = trans;
+    }
+    g_assert(xaccTransIsOpen(trans));
+
+    /* If we are saving a brand new transaction and the blank split hasn't
+     * been edited, then we need to give it a default account. */
+    /* Q: Why check 'split == blank_split'? Isn't 'trans == blank_trans'
+     *    even better? What if there were some way that we could be on
+     *    a row other than the transaction row or blank split row, but
+     *    the blank split still hasn't been edited? It seems to be assumed
+     *    that it isn't possible, but... -Charles, Jan 2009 */
+    if (split == blank_split && !info->blank_split_edited)
+    {
+        /* If we've reached this point, it means that the blank split is
+         * anchoring the transaction - see gnc_split_register_add_transaction()
+         * for an explanation - and the transaction has been edited (as evidenced
+         * by the earlier check for a changed cursor.) Since the blank split
+         * itself has not been edited, we'll have to assign a default account. */
+        account = gnc_split_register_get_default_account(reg);
+        if (account)
+            xaccSplitSetAccount(blank_split, account);
+        xaccTransSetDateEnteredSecs(trans, gnc_time (NULL));
+    }
+
+    if (split == NULL)
+    {
+        /* If we were asked to save data for a row for which there is no
+         * associated split, then assume that this was an "empty" row - see
+         * gnc_split_register_add_transaction() for an explanation. This row
+         * is used to add splits to an existing transaction, or to add the
+         * 2nd through nth split rows to a brand new transaction.
+         * xaccSRGetCurrent will handle this case, too. We will create
+         * a new split, copy the row contents to that split, and append
+         * the split to the pre-existing transaction. */
+        Split *trans_split;
+
+        split = xaccMallocSplit (gnc_get_current_book ());
+        xaccTransAppendSplit (trans, split);
+
+        gnc_table_set_virt_cell_data (reg->table,
+                                      reg->table->current_cursor_loc.vcell_loc,
+                                      xaccSplitGetGUID (split));
+        DEBUG("assigned cell to new split=%p", split);
+
+        trans_split = gnc_split_register_get_current_trans_split (reg, NULL);
+        if ((info->cursor_hint_trans == trans) &&
+                (info->cursor_hint_trans_split == trans_split) &&
+                (info->cursor_hint_split == NULL))
+        {
+            info->cursor_hint_split = split;
+            info->cursor_hint_cursor_class = CURSOR_CLASS_SPLIT;
+        }
+    }
+
+    DEBUG("updating trans=%p", trans);
+
+    {
+        SRSaveData *sd;
+
+        sd = gnc_split_register_save_data_new (
+                 trans, split, (info->trans_expanded ||
+                                reg->style == REG_STYLE_AUTO_LEDGER ||
+                                reg->style == REG_STYLE_JOURNAL));
+        gnc_table_save_cells (reg->table, sd);
+        gnc_split_register_save_data_destroy (sd);
+    }
+
+    memo = xaccSplitGetMemo (split);
+    memo = memo ? memo : "(null)";
+    desc = xaccTransGetDescription (trans);
+    desc = desc ? desc : "(null)";
+    PINFO ("finished saving split \"%s\" of trans \"%s\"", memo, desc);
+
+    /* If the modified split is the "blank split", then it is now an
+     * official part of the account. Set the blank split to NULL, so we
+     * can be sure of getting a new blank split. Also, save the date
+     * for the new blank split. */
+    if (trans == blank_trans)
+    {
+        if (do_commit)
+        {
+            info->blank_split_guid = *guid_null ();
+            info->auto_complete = FALSE;
+            blank_split = NULL;
+            info->last_date_entered = xaccTransGetDate (trans);
+        }
+        else
+            info->blank_split_edited = TRUE;
+    }
+
+    /* If requested, commit the current transaction and set the pending
+     * transaction to NULL. */
+    if (do_commit)
+    {
+        g_assert(trans == blank_trans || trans == pending_trans);
+        if (pending_trans == trans)
+        {
+            pending_trans = NULL;
+            info->pending_trans_guid = *guid_null ();
+        }
+        xaccTransCommitEdit (trans);
+    }
+
+    gnc_table_clear_current_cursor_changes (reg->table);
+
+    gnc_resume_gui_refresh ();
+
+    LEAVE(" ");
+    return TRUE;
+}
+
+
+Account *
+gnc_split_register_get_account_by_name (SplitRegister *reg, BasicCell * bcell,
+                                        const char *name)
+{
+    const char *placeholder = _("The account %s does not allow transactions.");
+    const char *missing = _("The account %s does not exist. "
+                            "Would you like to create it?");
+    char *account_name;
+    ComboCell *cell = (ComboCell *) bcell;
+    Account *account;
+    static gboolean creating_account = FALSE;
+
+    if (!name || (strlen(name) == 0))
+        return NULL;
+
+    /* Find the account */
+    account = gnc_account_lookup_for_register (gnc_get_current_root_account (), name);
+    if (!account)
+        account = gnc_account_lookup_by_code(gnc_get_current_root_account(), name);
+
+    if (!account && !creating_account)
+    {
+        /* Ask if they want to create a new one. */
+        if (!gnc_verify_dialog (gnc_split_register_get_parent (reg),
+                                TRUE, missing, name))
+            return NULL;
+        creating_account = TRUE;
+        /* User said yes, they want to create a new account. */
+        account = gnc_ui_new_accounts_from_name_window (name);
+        creating_account = FALSE;
+        if (!account)
+            return NULL;
+    }
+
+    /* Now have the account. */
+    account_name = gnc_get_account_name_for_register (account);
+    if (g_strcmp0(account_name, gnc_basic_cell_get_value(bcell)))
+    {
+        /* The name has changed. Update the cell. */
+        gnc_combo_cell_set_value (cell, account_name);
+        gnc_basic_cell_set_changed (&cell->cell, TRUE);
+    }
+    g_free (account_name);
+
+    /* See if the account (either old or new) is a placeholder. */
+    if (xaccAccountGetPlaceholder (account))
+    {
+        gnc_error_dialog (gnc_split_register_get_parent (reg),
+                          placeholder, name);
+    }
+
+    /* Be seeing you. */
+    return account;
+}
+
+Account *
+gnc_split_register_get_account (SplitRegister *reg, const char * cell_name)
+{
+    BasicCell *cell;
+    const char *name;
+
+    if (!gnc_table_layout_get_cell_changed (reg->table->layout, cell_name, TRUE))
+        return NULL;
+
+    cell = gnc_table_layout_get_cell (reg->table->layout, cell_name);
+    if (!cell)
+        return NULL;
+    name = gnc_basic_cell_get_value (cell);
+    return gnc_split_register_get_account_by_name (reg, cell, name);
+}
+
+static gnc_numeric
+calculate_value (SplitRegister *reg)
+{
+    gnc_numeric credit;
+    gnc_numeric debit;
+
+    PriceCell *cell = (PriceCell*)gnc_table_layout_get_cell (reg->table->layout,
+                                                             CRED_CELL);
+    credit = gnc_price_cell_get_value (cell);
+
+    cell = (PriceCell*)gnc_table_layout_get_cell (reg->table->layout,
+                                                  DEBT_CELL);
+    debit = gnc_price_cell_get_value (cell);
+
+    return gnc_numeric_sub_fixed (debit, credit);
+}
+
+
+static int
+recalc_message_box (SplitRegister *reg, gboolean shares_changed,
+                    gboolean price_changed, gboolean value_changed)
+{
+    int choice;
+    int default_value;
+    GList *node;
+    GList *radio_list = NULL;
+    const char *title = _("Recalculate Transaction");
+    const char *message = _("The values entered for this transaction "
+                            "are inconsistent. Which value would you "
+                            "like to have recalculated?");
+
+    if (shares_changed)
+        radio_list = g_list_append (radio_list, g_strdup_printf ("%s (%s)",
+                                                                 _("_Shares"),
+                                                                 _("Changed")));
+    else
+        radio_list = g_list_append (radio_list, g_strdup (_("_Shares")));
+
+    if (price_changed)
+        radio_list = g_list_append (radio_list, g_strdup_printf ("%s (%s)",
+                                                                 _("_Price"),
+                                                                 _("Changed")));
+    else
+        radio_list = g_list_append (radio_list, g_strdup (_("_Price")));
+
+    if (value_changed)
+        radio_list = g_list_append (radio_list, g_strdup_printf ("%s (%s)",
+                                                                 _("_Value"),
+                                                                 _("Changed")));
+    else
+        radio_list = g_list_append (radio_list, g_strdup (_("_Value")));
+
+    if (price_changed) default_value = 2;  /* change the value */
+    else  default_value = 1;  /* change the value */
+
+    choice = gnc_choose_radio_option_dialog
+        (gnc_split_register_get_parent (reg),
+         title,
+         message,
+         _("_Recalculate"),
+         default_value,
+         radio_list);
+
+    for (node = radio_list; node; node = node->next)
+        g_free (node->data);
+
+    g_list_free (radio_list);
+
+    return choice;
+}
+
+static void
+recalculate_shares (Split* split, SplitRegister *reg,
+               gnc_numeric value, gnc_numeric price, gboolean value_changed)
+{
+    gint64 denom = gnc_split_get_amount_denom (split);
+    gnc_numeric amount = gnc_numeric_div (value, price, denom,
+                                          GNC_HOW_RND_ROUND_HALF_UP);
+
+    BasicCell *cell = gnc_table_layout_get_cell (reg->table->layout, SHRS_CELL);
+    gnc_price_cell_set_value ((PriceCell *) cell, amount);
+    gnc_basic_cell_set_changed (cell, TRUE);
+
+    if (value_changed)
+    {
+        cell = gnc_table_layout_get_cell (reg->table->layout, PRIC_CELL);
+        gnc_basic_cell_set_changed (cell, FALSE);
+    }
+}
+
+static void
+recalculate_price (Split *split, SplitRegister *reg,
+              gnc_numeric value, gnc_numeric amount)
+{
+    BasicCell *price_cell;
+    gnc_numeric price = gnc_numeric_div (value, amount,
+                                         GNC_DENOM_AUTO,
+                                         GNC_HOW_DENOM_EXACT);
+
+    if (gnc_numeric_negative_p (price))
+    {
+        BasicCell *debit_cell;
+        BasicCell *credit_cell;
+
+        debit_cell = gnc_table_layout_get_cell (reg->table->layout,
+                                                DEBT_CELL);
+
+        credit_cell = gnc_table_layout_get_cell (reg->table->layout,
+                                                 CRED_CELL);
+
+        price = gnc_numeric_neg (price);
+
+        gnc_price_cell_set_debt_credit_value ((PriceCell *) debit_cell,
+                                              (PriceCell *) credit_cell,
+                                              gnc_numeric_neg (value));
+
+        gnc_basic_cell_set_changed (debit_cell, TRUE);
+        gnc_basic_cell_set_changed (credit_cell, TRUE);
+    }
+
+    price_cell = gnc_table_layout_get_cell (reg->table->layout, PRIC_CELL);
+    gnc_price_cell_set_value ((PriceCell *) price_cell, price);
+    gnc_basic_cell_set_changed (price_cell, TRUE);
+}
+
+static void
+recalculate_value (Split *split, SplitRegister *reg,
+              gnc_numeric price, gnc_numeric amount, gboolean shares_changed)
+{
+    BasicCell *debit_cell = gnc_table_layout_get_cell (reg->table->layout,
+                                                       DEBT_CELL);
+    BasicCell *credit_cell = gnc_table_layout_get_cell (reg->table->layout,
+                                                        CRED_CELL);
+    gint64 denom = gnc_split_get_value_denom (split);
+    gnc_numeric value = gnc_numeric_mul (price, amount, denom,
+                                         GNC_HOW_RND_ROUND_HALF_UP);
+
+    gnc_price_cell_set_debt_credit_value ((PriceCell *) debit_cell,
+                                          (PriceCell *) credit_cell, value);
+
+    gnc_basic_cell_set_changed (debit_cell, TRUE);
+    gnc_basic_cell_set_changed (credit_cell, TRUE);
+
+    if (shares_changed)
+    {
+        BasicCell *cell = gnc_table_layout_get_cell (reg->table->layout,
+                                                     PRIC_CELL);
+        gnc_basic_cell_set_changed (cell, FALSE);
+    }
+}
+
+static void
+record_price (SplitRegister *reg, Account *account, gnc_numeric value,
+              PriceSource source)
+{
+    Transaction *trans = gnc_split_register_get_current_trans (reg);
+    QofBook *book = qof_instance_get_book (QOF_INSTANCE (account));
+    GNCPriceDB *pricedb = gnc_pricedb_get_db (book);
+    gnc_commodity *comm = xaccAccountGetCommodity (account);
+    gnc_commodity *curr = xaccTransGetCurrency (trans);
+    GNCPrice *price;
+    gnc_numeric price_value;
+    int scu = gnc_commodity_get_fraction(curr);
+    Timespec ts;
+    BasicCell *cell = gnc_table_layout_get_cell (reg->table->layout, DATE_CELL);
+    gboolean swap = FALSE;
+
+    /* Only record the price for account types that don't have a
+     * "rate" cell. They'll get handled later by
+     * gnc_split_register_handle_exchange.
+     */
+    if (gnc_split_reg_has_rate_cell (reg->type))
+        return;
+    gnc_date_cell_get_date ((DateCell*)cell, &ts);
+    price = gnc_pricedb_lookup_day (pricedb, comm, curr, ts);
+    if (gnc_commodity_equiv (comm, gnc_price_get_currency (price)))
+            swap = TRUE;
+
+    if (price)
+    {
+        price_value = gnc_price_get_value(price);
+        if (gnc_numeric_equal(swap ? gnc_numeric_invert(value) : value,
+                              price_value))
+        {
+            gnc_price_unref (price);
+            return;
+        }
+        if (gnc_price_get_source(price) < PRICE_SOURCE_XFER_DLG_VAL)
+        {
+            /* Existing price is preferred over this one. */
+            gnc_price_unref(price);
+            return;
+        }
+        if (swap)
+        {
+            value = gnc_numeric_invert(value);
+            scu = gnc_commodity_get_fraction(comm);
+        }
+        value = gnc_numeric_convert(value, scu * COMMODITY_DENOM_MULT,
+                                    GNC_HOW_RND_ROUND_HALF_UP);
+        gnc_price_begin_edit (price);
+        gnc_price_set_time (price, ts);
+        gnc_price_set_source (price, source);
+        gnc_price_set_typestr (price, PRICE_TYPE_TRN);
+        gnc_price_set_value (price, value);
+        gnc_price_commit_edit (price);
+        gnc_price_unref (price);
+        return;
+    }
+
+    value = gnc_numeric_convert(value, scu * COMMODITY_DENOM_MULT,
+                                GNC_HOW_RND_ROUND_HALF_UP);
+    price = gnc_price_create (book);
+    gnc_price_begin_edit (price);
+    gnc_price_set_commodity (price, comm);
+    gnc_price_set_currency (price, curr);
+    gnc_price_set_time (price, ts);
+    gnc_price_set_source (price, source);
+    gnc_price_set_typestr (price, PRICE_TYPE_TRN);
+    gnc_price_set_value (price, value);
+    gnc_pricedb_add_price (pricedb, price);
+    gnc_price_commit_edit (price);
+}
+
+static gboolean
+gnc_split_register_auto_calc (SplitRegister *reg, Split *split)
+{
+    PriceCell *cell = NULL;
+    gboolean recalc_shares = FALSE;
+    gboolean recalc_price = FALSE;
+    gboolean recalc_value = FALSE;
+    gboolean price_changed;
+    gboolean value_changed;
+    gboolean shares_changed;
+    gnc_numeric calc_value;
+    gnc_numeric value;
+    gnc_numeric price;
+    gnc_numeric amount;
+    Account *account;
+    int denom;
+    int choice;
+    PriceSource source = PRICE_SOURCE_USER_PRICE;
+
+    if (STOCK_REGISTER    != reg->type &&
+        CURRENCY_REGISTER != reg->type &&
+        PORTFOLIO_LEDGER  != reg->type)
+        return TRUE;
+
+    account = gnc_split_register_get_account (reg, XFRM_CELL);
+
+    if (!account)
+        account = xaccSplitGetAccount (split);
+
+    if (!account)
+        account = gnc_split_register_get_default_account (reg);
+
+    if (!xaccAccountIsPriced(account))
+        return TRUE;
+
+    price_changed = gnc_table_layout_get_cell_changed (reg->table->layout,
+                    PRIC_CELL, TRUE);
+    value_changed = (gnc_table_layout_get_cell_changed (reg->table->layout,
+                      DEBT_CELL, TRUE) ||
+                      gnc_table_layout_get_cell_changed (reg->table->layout,
+                              CRED_CELL, TRUE));
+    shares_changed = gnc_table_layout_get_cell_changed (reg->table->layout,
+                     SHRS_CELL, TRUE);
+
+    if (!price_changed && !value_changed && !shares_changed)
+        return TRUE;
+
+    /* If we are using commodity trading accounts then the value may
+       not really be the value.  Punt if so. */
+    if (xaccTransUseTradingAccounts (xaccSplitGetParent (split)))
+    {
+        gnc_commodity *acc_commodity;
+        acc_commodity = xaccAccountGetCommodity (account);
+        if (! (xaccAccountIsPriced (account) ||
+                !gnc_commodity_is_iso (acc_commodity)))
+            return TRUE;
+    }
+
+    if (shares_changed)
+    {
+        cell = (PriceCell *) gnc_table_layout_get_cell (reg->table->layout,
+                SHRS_CELL);
+        amount = gnc_price_cell_get_value (cell);
+    }
+    else
+        amount = xaccSplitGetAmount (split);
+
+    if (price_changed)
+    {
+        cell = (PriceCell *) gnc_table_layout_get_cell (reg->table->layout,
+                PRIC_CELL);
+        price = gnc_price_cell_get_value (cell);
+    }
+    else
+        price = xaccSplitGetSharePrice (split);
+
+    if (value_changed)
+        value = calculate_value (reg);
+    else
+        value = xaccSplitGetValue (split);
+
+
+    /* Check if shares and price are BOTH zero (and value is non-zero).
+     * If so, we can assume that this is an income-correcting split
+     */
+    if (gnc_numeric_zero_p(amount) && gnc_numeric_zero_p(price) &&
+            !gnc_numeric_zero_p(value))
+    {
+        return TRUE;
+    }
+
+    /* Check if precisely one value is zero. If so, we can assume that the
+     * zero value needs to be recalculated.   */
+
+    if (!gnc_numeric_zero_p (amount))
+    {
+        if (gnc_numeric_zero_p (price))
+        {
+            if (!gnc_numeric_zero_p (value))
+                recalc_price = TRUE;
+        }
+        else if (gnc_numeric_zero_p (value))
+            recalc_value = TRUE;
+    }
+    else if (!gnc_numeric_zero_p (price))
+        if (!gnc_numeric_zero_p (value))
+            recalc_shares = TRUE;
+
+    /* If we have not already flagged a recalc, check if this is a split
+     * which has 2 of the 3 values changed. */
+
+    if ((!recalc_shares) &&
+            (!recalc_price)  &&
+            (!recalc_value))
+    {
+        if (price_changed && value_changed)
+        {
+            if (!shares_changed)
+                recalc_shares = TRUE;
+        }
+        else if (value_changed && shares_changed)
+            recalc_price = TRUE;
+        else if (price_changed && shares_changed)
+            recalc_value = TRUE;
+    }
+
+    calc_value = gnc_numeric_mul (price, amount,
+                                  GNC_DENOM_AUTO, GNC_HOW_DENOM_LCD);
+
+    denom = gnc_split_get_value_denom (split);
+
+    /*  Now, if we have not flagged one of the recalcs, and value and
+     *  calc_value are not the same number, then we need to ask for
+     *  help from the user. */
+
+    if (!recalc_shares &&
+        !recalc_price &&
+        !recalc_value &&
+        !gnc_numeric_same (value, calc_value, denom, GNC_HOW_RND_ROUND_HALF_UP))
+    {
+        choice = recalc_message_box(reg, shares_changed,
+                                    price_changed,
+                                    value_changed);
+        switch (choice)
+        {
+        case 0: /* Modify number of shares */
+            recalc_shares = TRUE;
+            break;
+        case 1: /* Modify the share price */
+            recalc_price = TRUE;
+            break;
+        case 2: /* Modify total value */
+            recalc_value = TRUE;
+            break;
+        default: /* Cancel */
+            return FALSE;
+        }
+    }
+
+    if (recalc_shares && !gnc_numeric_zero_p (price))
+        recalculate_shares (split, reg, value, price, value_changed);
+
+    if (recalc_price && !gnc_numeric_zero_p (amount))
+    {
+        recalculate_price (split, reg, value, amount);
+        price_changed = TRUE;
+        source = PRICE_SOURCE_SPLIT_REG;
+    }
+    if (recalc_value)
+        recalculate_value (split, reg, price, amount, shares_changed);
+
+    if (price_changed)
+    {
+        cell = (PriceCell *) gnc_table_layout_get_cell (reg->table->layout,
+                PRIC_CELL);
+        price = gnc_price_cell_get_value (cell);
+	if (gnc_numeric_positive_p(price))
+	    record_price (reg, account, price, source);
+    }
+    return TRUE;
+}
+
+static GNCAccountType
+gnc_split_register_type_to_account_type (SplitRegisterType sr_type)
+{
+    switch (sr_type)
+    {
+    case BANK_REGISTER:
+        return ACCT_TYPE_BANK;
+    case CASH_REGISTER:
+        return ACCT_TYPE_CASH;
+    case ASSET_REGISTER:
+        return ACCT_TYPE_ASSET;
+    case CREDIT_REGISTER:
+        return ACCT_TYPE_CREDIT;
+    case LIABILITY_REGISTER:
+        return ACCT_TYPE_LIABILITY;
+    case PAYABLE_REGISTER:
+        return ACCT_TYPE_PAYABLE;
+    case RECEIVABLE_REGISTER:
+        return ACCT_TYPE_RECEIVABLE;
+    case INCOME_LEDGER:
+    case INCOME_REGISTER:
+        return ACCT_TYPE_INCOME;
+    case EXPENSE_REGISTER:
+        return ACCT_TYPE_EXPENSE;
+    case STOCK_REGISTER:
+    case PORTFOLIO_LEDGER:
+        return ACCT_TYPE_STOCK;
+    case CURRENCY_REGISTER:
+        return ACCT_TYPE_CURRENCY;
+    case TRADING_REGISTER:
+        return ACCT_TYPE_TRADING;
+    case GENERAL_JOURNAL:
+        return ACCT_TYPE_NONE;
+    case EQUITY_REGISTER:
+        return ACCT_TYPE_EQUITY;
+    case SEARCH_LEDGER:
+        return ACCT_TYPE_NONE;
+    default:
+        return ACCT_TYPE_NONE;
+    }
+}
+
+const char *
+gnc_split_register_get_debit_string (SplitRegister *reg)
+{
+    SRInfo *info = gnc_split_register_get_info (reg);
+
+    if (!reg)
+        return NULL;
+
+    if (info->debit_str)
+        return info->debit_str;
+
+    info->debit_str =
+        gnc_get_debit_string
+        (gnc_split_register_type_to_account_type (reg->type));
+
+    if (info->debit_str)
+        return info->debit_str;
+
+    info->debit_str = g_strdup (_("Debit"));
+
+    return info->debit_str;
+}
+
+const char *
+gnc_split_register_get_credit_string (SplitRegister *reg)
+{
+    SRInfo *info = gnc_split_register_get_info (reg);
+
+    if (!reg)
+        return NULL;
+
+    if (info->credit_str)
+        return info->credit_str;
+
+    info->credit_str =
+        gnc_get_credit_string
+        (gnc_split_register_type_to_account_type (reg->type));
+
+    if (info->credit_str)
+        return info->credit_str;
+
+    info->credit_str = g_strdup (_("Credit"));
+
+    return info->credit_str;
+}
+
+gboolean
+gnc_split_register_changed (SplitRegister *reg)
+{
+    SRInfo *info = gnc_split_register_get_info (reg);
+    Transaction *pending_trans;
+
+    ENTER("reg=%p", reg);
+
+    if (reg == NULL)
+    {
+        LEAVE("no register");
+        return FALSE;
+    }
+
+    if (gnc_table_current_cursor_changed (reg->table, FALSE))
+    {
+        LEAVE("cursor changed");
+        return TRUE;
+    }
+
+    pending_trans = xaccTransLookup (&info->pending_trans_guid,
+                                     gnc_get_current_book ());
+    if (xaccTransIsOpen (pending_trans))
+    {
+        LEAVE("open and pending txn");
+        return TRUE;
+    }
+
+    LEAVE("register unchanged");
+    return FALSE;
+}
+
+void
+gnc_split_register_show_present_divider (SplitRegister *reg,
+        gboolean show_present)
+{
+    SRInfo *info = gnc_split_register_get_info (reg);
+
+    if (reg == NULL)
+        return;
+
+    info->show_present_divider = show_present;
+}
+
+gboolean
+gnc_split_register_full_refresh_ok (SplitRegister *reg)
+{
+    SRInfo *info = gnc_split_register_get_info (reg);
+
+    if (!info)
+        return FALSE;
+
+    return info->full_refresh;
+}
+
+/* configAction strings into the action cell */
+/* hack alert -- this stuff really, really should be in a config file ... */
+static void
+gnc_split_register_config_action (SplitRegister *reg)
+{
+    ComboCell *cell;
+
+    cell = (ComboCell *) gnc_table_layout_get_cell (reg->table->layout,
+            ACTN_CELL);
+
+    /* setup strings in the action pull-down */
+    switch (reg->type)
+    {
+    case BANK_REGISTER:
+        /* broken ! FIXME bg */
+    case SEARCH_LEDGER:
+        /* Translators: This string has a context prefix; the translation
+        	must only contain the part after the | character. */
+        gnc_combo_cell_add_menu_item (cell, Q_("Action Column|Deposit"));
+        gnc_combo_cell_add_menu_item (cell, _("Withdraw"));
+        gnc_combo_cell_add_menu_item (cell, _("Check"));
+        gnc_combo_cell_add_menu_item (cell, _("Interest"));
+        gnc_combo_cell_add_menu_item (cell, _("ATM Deposit"));
+        gnc_combo_cell_add_menu_item (cell, _("ATM Draw"));
+        gnc_combo_cell_add_menu_item (cell, _("Teller"));
+        gnc_combo_cell_add_menu_item (cell, _("Charge"));
+        gnc_combo_cell_add_menu_item (cell, _("Payment"));
+        gnc_combo_cell_add_menu_item (cell, _("Receipt"));
+        gnc_combo_cell_add_menu_item (cell, _("Increase"));
+        gnc_combo_cell_add_menu_item (cell, _("Decrease"));
+        /* Action: Point Of Sale */
+        gnc_combo_cell_add_menu_item (cell, _("POS"));
+        gnc_combo_cell_add_menu_item (cell, _("Phone"));
+        gnc_combo_cell_add_menu_item (cell, _("Online"));
+        /* Action: Automatic Deposit ?!? */
+        gnc_combo_cell_add_menu_item (cell, _("AutoDep"));
+        gnc_combo_cell_add_menu_item (cell, _("Wire"));
+        gnc_combo_cell_add_menu_item (cell, _("Credit"));
+        gnc_combo_cell_add_menu_item (cell, _("Direct Debit"));
+        gnc_combo_cell_add_menu_item (cell, _("Transfer"));
+        break;
+    case CASH_REGISTER:
+        gnc_combo_cell_add_menu_item (cell, _("Increase"));
+        gnc_combo_cell_add_menu_item (cell, _("Decrease"));
+        gnc_combo_cell_add_menu_item (cell, _("Buy"));
+        gnc_combo_cell_add_menu_item (cell, _("Sell"));
+        break;
+    case ASSET_REGISTER:
+        gnc_combo_cell_add_menu_item (cell, _("Buy"));
+        gnc_combo_cell_add_menu_item (cell, _("Sell"));
+        gnc_combo_cell_add_menu_item (cell, _("Fee"));
+        break;
+    case CREDIT_REGISTER:
+        gnc_combo_cell_add_menu_item (cell, _("ATM Deposit"));
+        gnc_combo_cell_add_menu_item (cell, _("ATM Draw"));
+        gnc_combo_cell_add_menu_item (cell, _("Buy"));
+        gnc_combo_cell_add_menu_item (cell, _("Credit"));
+        gnc_combo_cell_add_menu_item (cell, _("Fee"));
+        gnc_combo_cell_add_menu_item (cell, _("Interest"));
+        gnc_combo_cell_add_menu_item (cell, _("Online"));
+        gnc_combo_cell_add_menu_item (cell, _("Sell"));
+        break;
+    case LIABILITY_REGISTER:
+        gnc_combo_cell_add_menu_item (cell, _("Buy"));
+        gnc_combo_cell_add_menu_item (cell, _("Sell"));
+        gnc_combo_cell_add_menu_item (cell, _("Loan"));
+        gnc_combo_cell_add_menu_item (cell, _("Interest"));
+        gnc_combo_cell_add_menu_item (cell, _("Payment"));
+        break;
+    case RECEIVABLE_REGISTER:
+    case PAYABLE_REGISTER:
+        gnc_combo_cell_add_menu_item (cell, _("Invoice"));
+        gnc_combo_cell_add_menu_item (cell, _("Payment"));
+        gnc_combo_cell_add_menu_item (cell, _("Interest"));
+        gnc_combo_cell_add_menu_item (cell, _("Credit"));
+        break;
+    case INCOME_LEDGER:
+    case INCOME_REGISTER:
+        gnc_combo_cell_add_menu_item (cell, _("Increase"));
+        gnc_combo_cell_add_menu_item (cell, _("Decrease"));
+        gnc_combo_cell_add_menu_item (cell, _("Buy"));
+        gnc_combo_cell_add_menu_item (cell, _("Sell"));
+        gnc_combo_cell_add_menu_item (cell, _("Interest"));
+        gnc_combo_cell_add_menu_item (cell, _("Payment"));
+        gnc_combo_cell_add_menu_item (cell, _("Rebate"));
+        gnc_combo_cell_add_menu_item (cell, _("Paycheck"));
+        break;
+    case EXPENSE_REGISTER:
+    case TRADING_REGISTER:
+        gnc_combo_cell_add_menu_item (cell, _("Increase"));
+        gnc_combo_cell_add_menu_item (cell, _("Decrease"));
+        gnc_combo_cell_add_menu_item (cell, _("Buy"));
+        gnc_combo_cell_add_menu_item (cell, _("Sell"));
+        break;
+    case GENERAL_JOURNAL:
+    case EQUITY_REGISTER:
+        gnc_combo_cell_add_menu_item (cell, _("Buy"));
+        gnc_combo_cell_add_menu_item (cell, _("Sell"));
+        gnc_combo_cell_add_menu_item (cell, _("Equity"));
+        break;
+    case STOCK_REGISTER:
+    case PORTFOLIO_LEDGER:
+    case CURRENCY_REGISTER:
+        gnc_combo_cell_add_menu_item (cell, ACTION_BUY_STR);
+        gnc_combo_cell_add_menu_item (cell, ACTION_SELL_STR);
+        gnc_combo_cell_add_menu_item (cell, _("Price"));
+        gnc_combo_cell_add_menu_item (cell, _("Fee"));
+        /* Action: Dividend */
+        gnc_combo_cell_add_menu_item (cell, _("Dividend"));
+        gnc_combo_cell_add_menu_item (cell, _("Interest"));
+        /* Action: Long Term Capital Gains */
+        gnc_combo_cell_add_menu_item (cell, _("LTCG"));
+        /* Action: Short Term Capital Gains */
+        gnc_combo_cell_add_menu_item (cell, _("STCG"));
+        gnc_combo_cell_add_menu_item (cell, _("Income"));
+        /* Action: Distribution */
+        gnc_combo_cell_add_menu_item (cell, _("Dist"));
+        /* Translators: This string has a disambiguation prefix */
+        gnc_combo_cell_add_menu_item (cell, Q_("Action Column|Split"));
+        break;
+
+    default:
+        gnc_combo_cell_add_menu_item (cell, _("Increase"));
+        gnc_combo_cell_add_menu_item (cell, _("Decrease"));
+        gnc_combo_cell_add_menu_item (cell, _("Buy"));
+        gnc_combo_cell_add_menu_item (cell, _("Sell"));
+        break;
+    }
+}
+
+static void
+gnc_split_register_config_cells (SplitRegister *reg)
+{
+    gnc_combo_cell_add_ignore_string
+    ((ComboCell *)
+     gnc_table_layout_get_cell (reg->table->layout, MXFRM_CELL),
+     SPLIT_TRANS_STR);
+
+    gnc_combo_cell_add_ignore_string
+    ((ComboCell *)
+     gnc_table_layout_get_cell (reg->table->layout, MXFRM_CELL),
+     STOCK_SPLIT_STR);
+
+    /* the action cell */
+    gnc_combo_cell_set_autosize
+    ((ComboCell *)
+     gnc_table_layout_get_cell (reg->table->layout, ACTN_CELL), TRUE);
+
+    /* Use 6 decimal places for prices and "exchange rates"  */
+    gnc_price_cell_set_fraction
+    ((PriceCell *)
+     gnc_table_layout_get_cell (reg->table->layout, PRIC_CELL),
+     PRICE_CELL_DENOM);
+
+    /* Initialize shares and share balance cells */
+    gnc_price_cell_set_print_info
+    ((PriceCell *) gnc_table_layout_get_cell (reg->table->layout, SHRS_CELL),
+     gnc_default_share_print_info ());
+
+    gnc_price_cell_set_print_info
+    ((PriceCell *) gnc_table_layout_get_cell (reg->table->layout, TSHRS_CELL),
+     gnc_default_share_print_info ());
+
+    /* Initialize the rate cell
+     * use a share_print_info to make sure we don't have rounding errors
+     */
+    gnc_price_cell_set_print_info
+    ((PriceCell *) gnc_table_layout_get_cell (reg->table->layout, RATE_CELL),
+     gnc_default_share_print_info());
+
+    /* The action cell should accept strings not in the list */
+    gnc_combo_cell_set_strict
+    ((ComboCell *)
+     gnc_table_layout_get_cell (reg->table->layout, ACTN_CELL), FALSE);
+
+    /* number format for share quantities in stock ledgers */
+    switch (reg->type)
+    {
+    case CURRENCY_REGISTER:
+    case STOCK_REGISTER:
+    case PORTFOLIO_LEDGER:
+        gnc_price_cell_set_print_info
+        ((PriceCell *)
+         gnc_table_layout_get_cell (reg->table->layout, PRIC_CELL),
+         gnc_default_price_print_info ());
+        break;
+
+    default:
+        break;
+    }
+
+    /* add menu items for the action cell */
+    gnc_split_register_config_action (reg);
+}
+
+static void
+split_register_pref_changed (gpointer prefs, gchar *pref, gpointer user_data)
+{
+    SplitRegister * reg = user_data;
+    SRInfo *info;
+
+    g_return_if_fail(pref);
+    if (reg == NULL)
+        return;
+
+    info = reg->sr_info;
+    if (!info)
+        return;
+
+    if (g_str_has_suffix(pref, GNC_PREF_ACCOUNTING_LABELS))
+    {
+        /* Release current strings. Will be reloaded at next reference. */
+        g_free (info->debit_str);
+        g_free (info->tdebit_str);
+        g_free (info->credit_str);
+        g_free (info->tcredit_str);
+
+        info->debit_str = NULL;
+        info->tdebit_str = NULL;
+        info->credit_str = NULL;
+        info->tcredit_str = NULL;
+
+    }
+    else if (g_str_has_suffix(pref, GNC_PREF_ACCOUNT_SEPARATOR))
+    {
+        info->separator_changed = TRUE;
+    }
+    else
+    {
+        g_warning("split_register_pref_changed: Unknown preference %s", pref);
+    }
+}
+
+static void
+split_register_book_option_changed (gpointer new_val, gpointer user_data)
+{
+    SplitRegister * reg = user_data;
+    gboolean *new_data = (gboolean*)new_val;
+
+    if (reg == NULL)
+        return;
+
+    reg->use_tran_num_for_num_field = (*new_data ? FALSE : TRUE);
+}
+
+static void
+gnc_split_register_init (SplitRegister *reg,
+                         SplitRegisterType type,
+                         SplitRegisterStyle style,
+                         gboolean use_double_line,
+                         gboolean do_auto_complete,
+                         gboolean is_template)
+{
+    TableLayout *layout;
+    TableModel *model;
+    TableControl *control;
+
+    /* Register 'destroy' callback */
+    gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL,
+                           GNC_PREF_ACCOUNTING_LABELS,
+                           split_register_pref_changed,
+                           reg);
+    gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL,
+                           GNC_PREF_ACCOUNT_SEPARATOR,
+                           split_register_pref_changed,
+                           reg);
+    gnc_book_option_register_cb(OPTION_NAME_NUM_FIELD_SOURCE,
+                                split_register_book_option_changed,
+                                reg);
+
+    reg->sr_info = NULL;
+
+    reg->type = type;
+    reg->style = style;
+    reg->use_double_line = use_double_line;
+    reg->do_auto_complete = do_auto_complete;
+    reg->is_template = is_template;
+    reg->use_tran_num_for_num_field =
+                (qof_book_use_split_action_for_num_field(gnc_get_current_book())
+                    ? FALSE : TRUE);
+
+    layout = gnc_split_register_layout_new (reg);
+
+    if (is_template)
+        model = gnc_template_register_model_new ();
+    else
+        model = gnc_split_register_model_new ();
+    model->handler_user_data = reg;
+
+    control = gnc_split_register_control_new ();
+    control->user_data = reg;
+
+    reg->table = gnc_table_new (layout, model, control);
+
+    gnc_split_register_config_cells (reg);
+
+    /* Set up header */
+    {
+        VirtualCellLocation vcell_loc = { 0, 0 };
+        CellBlock *header;
+
+        header = gnc_table_layout_get_cursor (reg->table->layout, CURSOR_HEADER);
+
+        gnc_table_set_vcell (reg->table, header, NULL, TRUE, TRUE, vcell_loc);
+    }
+
+    /* Set up first and only initial row */
+    {
+        VirtualLocation vloc;
+        CellBlock *cursor;
+
+        vloc.vcell_loc.virt_row = 1;
+        vloc.vcell_loc.virt_col = 0;
+        vloc.phys_row_offset = 0;
+        vloc.phys_col_offset = 0;
+
+        cursor = gnc_table_layout_get_cursor (reg->table->layout,
+                                              CURSOR_SINGLE_LEDGER);
+
+        gnc_table_set_vcell (reg->table, cursor, NULL, TRUE, TRUE, vloc.vcell_loc);
+
+        if (gnc_table_find_close_valid_cell (reg->table, &vloc, FALSE))
+            gnc_table_move_cursor (reg->table, vloc);
+        else
+        {
+            PERR ("Can't find valid initial location");
+        }
+    }
+}
+
+SplitRegister *
+gnc_split_register_new (SplitRegisterType type,
+                        SplitRegisterStyle style,
+                        gboolean use_double_line,
+                        gboolean is_template)
+{
+    SplitRegister * reg;
+    gboolean default_do_auto_complete = TRUE;
+
+    reg = g_new0 (SplitRegister, 1);
+
+    if (type >= NUM_SINGLE_REGISTER_TYPES)
+        style = REG_STYLE_JOURNAL;
+
+    gnc_split_register_init (reg,
+                             type,
+                             style,
+                             use_double_line,
+                             default_do_auto_complete,
+                             is_template);
+
+    return reg;
+}
+
+void
+gnc_split_register_config (SplitRegister *reg,
+                           SplitRegisterType newtype,
+                           SplitRegisterStyle newstyle,
+                           gboolean use_double_line)
+{
+    if (!reg) return;
+
+    /* If shrinking the transaction split, put the cursor on the first row of the trans */
+    if (reg->use_double_line && !use_double_line)
+    {
+        VirtualLocation virt_loc = reg->table->current_cursor_loc;
+        if (gnc_table_find_close_valid_cell (reg->table, &virt_loc, FALSE))
+        {
+            if (virt_loc.phys_row_offset)
+            {
+                gnc_table_move_vertical_position (reg->table, &virt_loc, -virt_loc.phys_row_offset);
+                gnc_table_move_cursor_gui (reg->table, virt_loc);
+            }
+        }
+        else
+        {
+            /* WTF?  Go to a known safe location. */
+            virt_loc.vcell_loc.virt_row = 1;
+            virt_loc.vcell_loc.virt_col = 0;
+            virt_loc.phys_row_offset = 0;
+            virt_loc.phys_col_offset = 0;
+            gnc_table_move_cursor_gui (reg->table, virt_loc);
+        }
+    }
+
+    reg->type = newtype;
+
+    if (reg->type >= NUM_SINGLE_REGISTER_TYPES)
+        newstyle = REG_STYLE_JOURNAL;
+
+    reg->style = newstyle;
+    reg->use_double_line = use_double_line;
+
+    gnc_table_realize_gui (reg->table);
+}
+
+void
+gnc_split_register_set_auto_complete(SplitRegister *reg,
+                                     gboolean do_auto_complete)
+{
+    g_return_if_fail(reg);
+    reg->do_auto_complete = do_auto_complete;
+}
+
+static void
+gnc_split_register_destroy_info (SplitRegister *reg)
+{
+    SRInfo *info;
+
+    if (reg == NULL)
+        return;
+
+    info = reg->sr_info;
+    if (!info)
+        return;
+
+    g_free (info->debit_str);
+    g_free (info->tdebit_str);
+    g_free (info->credit_str);
+    g_free (info->tcredit_str);
+
+    info->debit_str = NULL;
+    info->tdebit_str = NULL;
+    info->credit_str = NULL;
+    info->tcredit_str = NULL;
+
+    g_free (reg->sr_info);
+
+    reg->sr_info = NULL;
+}
+
+void
+gnc_split_register_set_data (SplitRegister *reg, void *user_data,
+                             SRGetParentCallback get_parent)
+{
+    SRInfo *info = gnc_split_register_get_info (reg);
+
+    g_return_if_fail (reg != NULL);
+
+    info->user_data = user_data;
+    info->get_parent = get_parent;
+}
+
+static void
+gnc_split_register_cleanup (SplitRegister *reg)
+{
+    SRInfo *info = gnc_split_register_get_info (reg);
+    Transaction *pending_trans;
+    Transaction *blank_trans = NULL;
+    Split *blank_split;
+
+    ENTER("reg=%p", reg);
+
+    blank_split = xaccSplitLookup (&info->blank_split_guid,
+                                   gnc_get_current_book ());
+
+    pending_trans = xaccTransLookup (&info->pending_trans_guid,
+                                     gnc_get_current_book ());
+
+    gnc_suspend_gui_refresh ();
+
+    /* Destroy the transaction containing the "blank split", which was only
+     * created to support the area for entering a new transaction. Since the
+     * register is closing, this transaction is no longer needed. */
+    if (blank_split != NULL)
+    {
+        gboolean was_open;
+
+        blank_trans = xaccSplitGetParent (blank_split);
+
+        DEBUG("blank_split=%p, blank_trans=%p, pending_trans=%p",
+              blank_split, blank_trans, pending_trans);
+
+        /* Destroying the transaction will automatically remove its splits. */
+        was_open = xaccTransIsOpen (blank_trans);
+        xaccTransDestroy (blank_trans);
+        if (was_open)
+            xaccTransCommitEdit (blank_trans);
+
+        /* Update the register info. */
+        if (blank_trans == pending_trans)
+        {
+            info->pending_trans_guid = *guid_null ();
+            pending_trans = NULL;
+        }
+        info->blank_split_guid = *guid_null ();
+        info->auto_complete = FALSE;
+        blank_split = NULL;
+    }
+
+    /* be sure to take care of any open transactions */
+    if (pending_trans != NULL)
+    {
+        g_critical("BUG DETECTED: pending_trans=%p, blank_split=%p, blank_trans=%p",
+                   pending_trans, blank_split, blank_trans);
+        g_assert_not_reached();
+        info->pending_trans_guid = *guid_null ();
+        /* CAS: It's not clear to me that we'd really want to commit
+           here, rather than rollback. But, maybe this is just dead
+           code. */
+        if (xaccTransIsOpen (pending_trans))
+            xaccTransCommitEdit (pending_trans);
+        else g_assert_not_reached();
+
+        pending_trans = NULL;
+    }
+
+    gnc_split_register_destroy_info (reg);
+
+    gnc_resume_gui_refresh ();
+
+    LEAVE(" ");
+}
+
+void
+gnc_split_register_destroy (SplitRegister *reg)
+{
+    g_return_if_fail(reg);
+
+    ENTER("reg=%p", reg);
+
+    gnc_prefs_remove_cb_by_func (GNC_PREFS_GROUP_GENERAL,
+                                 GNC_PREF_ACCOUNTING_LABELS,
+                                 split_register_pref_changed,
+                                 reg);
+    gnc_prefs_remove_cb_by_func (GNC_PREFS_GROUP_GENERAL,
+                                 GNC_PREF_ACCOUNT_SEPARATOR,
+                                 split_register_pref_changed,
+                                 reg);
+    gnc_book_option_remove_cb(OPTION_NAME_NUM_FIELD_SOURCE,
+                                split_register_book_option_changed,
+                                reg);
+    gnc_split_register_cleanup (reg);
+
+    gnc_table_destroy (reg->table);
+    reg->table = NULL;
+
+    /* free the memory itself */
+    g_free (reg);
+    LEAVE(" ");
+}
+
+void
+gnc_split_register_set_read_only (SplitRegister *reg, gboolean read_only)
+{
+    gnc_table_model_set_read_only (reg->table->model, read_only);
+}
diff --git a/src/register/ledger-core/split-register.h b/gnucash/register/ledger-core/split-register.h
similarity index 100%
rename from src/register/ledger-core/split-register.h
rename to gnucash/register/ledger-core/split-register.h
diff --git a/src/register/ledger-core/test/CMakeLists.txt b/gnucash/register/ledger-core/test/CMakeLists.txt
similarity index 100%
rename from src/register/ledger-core/test/CMakeLists.txt
rename to gnucash/register/ledger-core/test/CMakeLists.txt
diff --git a/gnucash/register/ledger-core/test/Makefile.am b/gnucash/register/ledger-core/test/Makefile.am
new file mode 100644
index 0000000..34fe1b9
--- /dev/null
+++ b/gnucash/register/ledger-core/test/Makefile.am
@@ -0,0 +1,15 @@
+TESTS =  test-link-module
+
+check_PROGRAMS = test-link-module
+
+test_link_module_SOURCES=test-link-module.c
+test_link_module_LDADD=\
+	$(top_builddir)/libgnucash/engine/libgncmod-engine.la \
+        $(top_builddir)/libgnucash/app-utils/libgncmod-app-utils.la \
+	${top_builddir}/gnucash/gnome-utils/libgncmod-gnome-utils.la \
+	${top_builddir}/gnucash/gnome/libgnc-gnome.la \
+    ../libgncmod-ledger-core.la
+
+AM_CPPFLAGS = -I${top_srcdir}/common/test-core -I.. ${GLIB_CFLAGS}
+
+EXTRA_DIST = CMakeLists.txt
diff --git a/src/register/ledger-core/test/test-link-module.c b/gnucash/register/ledger-core/test/test-link-module.c
similarity index 100%
rename from src/register/ledger-core/test/test-link-module.c
rename to gnucash/register/ledger-core/test/test-link-module.c
diff --git a/src/register/register-core/CMakeLists.txt b/gnucash/register/register-core/CMakeLists.txt
similarity index 100%
rename from src/register/register-core/CMakeLists.txt
rename to gnucash/register/register-core/CMakeLists.txt
diff --git a/gnucash/register/register-core/Makefile.am b/gnucash/register/register-core/Makefile.am
new file mode 100644
index 0000000..83324a6
--- /dev/null
+++ b/gnucash/register/register-core/Makefile.am
@@ -0,0 +1,70 @@
+SUBDIRS = . test
+
+pkglib_LTLIBRARIES = libgncmod-register-core.la
+
+libgncmod_register_core_la_LDFLAGS = -avoid-version
+
+libgncmod_register_core_la_LIBADD = \
+  ${top_builddir}/libgnucash/gnc-module/libgnc-module.la \
+  ${top_builddir}/libgnucash/engine/libgncmod-engine.la \
+  ${top_builddir}/libgnucash/core-utils/libgnc-core-utils.la \
+  ${top_builddir}/libgnucash/app-utils/libgncmod-app-utils.la \
+  ${top_builddir}/gnucash/gnome-utils/libgncmod-gnome-utils.la \
+  ${GUILE_LIBS} \
+  ${GLIB_LIBS}
+
+libgncmod_register_core_la_SOURCES = \
+  gncmod-register-core.c \
+  basiccell.c \
+  cell-factory.c \
+  cellblock.c \
+  formulacell.c \
+  gtable.c \
+  numcell.c \
+  pricecell.c \
+  quickfillcell.c \
+  recncell.c \
+  checkboxcell.c \
+  register-common.c \
+  table-allgui.c \
+  table-control.c \
+  table-layout.c \
+  table-model.c
+
+
+gncincludedir = ${GNC_INCLUDE_DIR}
+gncinclude_HEADERS = \
+  basiccell.h \
+  cell-factory.h \
+  cellblock.h \
+  combocell.h \
+  datecell.h \
+  formulacell.h \
+  gtable.h \
+  numcell.h \
+  pricecell.h \
+  quickfillcell.h \
+  recncell.h \
+  checkboxcell.h \
+  register-common.h \
+  table-allgui.h \
+  table-control.h \
+  table-layout.h \
+  table-model.h
+
+AM_CPPFLAGS = \
+  -I${top_srcdir}/common \
+  -I${top_srcdir}/libgnucash/engine \
+  -I${top_srcdir}/libgnucash/core-utils \
+  -I${top_srcdir}/libgnucash/app-utils \
+  -I${top_srcdir}/libgnucash/gnc-module \
+  -I${top_srcdir}/gnucash/gnome-utils \
+  ${GUILE_CFLAGS} \
+  ${GTK_CFLAGS} \
+  ${GLIB_CFLAGS}
+
+CLEANFILES = $(BUILT_SOURCES)
+
+AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.register.core\"
+
+EXTRA_DIST = CMakeLists.txt
diff --git a/src/register/register-core/README b/gnucash/register/register-core/README
similarity index 100%
rename from src/register/register-core/README
rename to gnucash/register/register-core/README
diff --git a/src/register/register-core/basiccell.c b/gnucash/register/register-core/basiccell.c
similarity index 100%
rename from src/register/register-core/basiccell.c
rename to gnucash/register/register-core/basiccell.c
diff --git a/src/register/register-core/basiccell.h b/gnucash/register/register-core/basiccell.h
similarity index 100%
rename from src/register/register-core/basiccell.h
rename to gnucash/register/register-core/basiccell.h
diff --git a/src/register/register-core/cell-factory.c b/gnucash/register/register-core/cell-factory.c
similarity index 100%
rename from src/register/register-core/cell-factory.c
rename to gnucash/register/register-core/cell-factory.c
diff --git a/src/register/register-core/cell-factory.h b/gnucash/register/register-core/cell-factory.h
similarity index 100%
rename from src/register/register-core/cell-factory.h
rename to gnucash/register/register-core/cell-factory.h
diff --git a/src/register/register-core/cellblock.c b/gnucash/register/register-core/cellblock.c
similarity index 100%
rename from src/register/register-core/cellblock.c
rename to gnucash/register/register-core/cellblock.c
diff --git a/src/register/register-core/cellblock.h b/gnucash/register/register-core/cellblock.h
similarity index 100%
rename from src/register/register-core/cellblock.h
rename to gnucash/register/register-core/cellblock.h
diff --git a/src/register/register-core/checkboxcell.c b/gnucash/register/register-core/checkboxcell.c
similarity index 100%
rename from src/register/register-core/checkboxcell.c
rename to gnucash/register/register-core/checkboxcell.c
diff --git a/src/register/register-core/checkboxcell.h b/gnucash/register/register-core/checkboxcell.h
similarity index 100%
rename from src/register/register-core/checkboxcell.h
rename to gnucash/register/register-core/checkboxcell.h
diff --git a/src/register/register-core/combocell.h b/gnucash/register/register-core/combocell.h
similarity index 100%
rename from src/register/register-core/combocell.h
rename to gnucash/register/register-core/combocell.h
diff --git a/src/register/register-core/datecell.h b/gnucash/register/register-core/datecell.h
similarity index 100%
rename from src/register/register-core/datecell.h
rename to gnucash/register/register-core/datecell.h
diff --git a/src/register/register-core/formulacell.c b/gnucash/register/register-core/formulacell.c
similarity index 100%
rename from src/register/register-core/formulacell.c
rename to gnucash/register/register-core/formulacell.c
diff --git a/src/register/register-core/formulacell.h b/gnucash/register/register-core/formulacell.h
similarity index 100%
rename from src/register/register-core/formulacell.h
rename to gnucash/register/register-core/formulacell.h
diff --git a/src/register/register-core/gncmod-register-core.c b/gnucash/register/register-core/gncmod-register-core.c
similarity index 100%
rename from src/register/register-core/gncmod-register-core.c
rename to gnucash/register/register-core/gncmod-register-core.c
diff --git a/src/register/register-core/gtable.c b/gnucash/register/register-core/gtable.c
similarity index 100%
rename from src/register/register-core/gtable.c
rename to gnucash/register/register-core/gtable.c
diff --git a/src/register/register-core/gtable.h b/gnucash/register/register-core/gtable.h
similarity index 100%
rename from src/register/register-core/gtable.h
rename to gnucash/register/register-core/gtable.h
diff --git a/src/register/register-core/numcell.c b/gnucash/register/register-core/numcell.c
similarity index 100%
rename from src/register/register-core/numcell.c
rename to gnucash/register/register-core/numcell.c
diff --git a/src/register/register-core/numcell.h b/gnucash/register/register-core/numcell.h
similarity index 100%
rename from src/register/register-core/numcell.h
rename to gnucash/register/register-core/numcell.h
diff --git a/src/register/register-core/pricecell.c b/gnucash/register/register-core/pricecell.c
similarity index 100%
rename from src/register/register-core/pricecell.c
rename to gnucash/register/register-core/pricecell.c
diff --git a/src/register/register-core/pricecell.h b/gnucash/register/register-core/pricecell.h
similarity index 100%
rename from src/register/register-core/pricecell.h
rename to gnucash/register/register-core/pricecell.h
diff --git a/src/register/register-core/quickfillcell.c b/gnucash/register/register-core/quickfillcell.c
similarity index 100%
rename from src/register/register-core/quickfillcell.c
rename to gnucash/register/register-core/quickfillcell.c
diff --git a/src/register/register-core/quickfillcell.h b/gnucash/register/register-core/quickfillcell.h
similarity index 100%
rename from src/register/register-core/quickfillcell.h
rename to gnucash/register/register-core/quickfillcell.h
diff --git a/src/register/register-core/recncell.c b/gnucash/register/register-core/recncell.c
similarity index 100%
rename from src/register/register-core/recncell.c
rename to gnucash/register/register-core/recncell.c
diff --git a/src/register/register-core/recncell.h b/gnucash/register/register-core/recncell.h
similarity index 100%
rename from src/register/register-core/recncell.h
rename to gnucash/register/register-core/recncell.h
diff --git a/src/register/register-core/register-common.c b/gnucash/register/register-core/register-common.c
similarity index 100%
rename from src/register/register-core/register-common.c
rename to gnucash/register/register-core/register-common.c
diff --git a/src/register/register-core/register-common.h b/gnucash/register/register-core/register-common.h
similarity index 100%
rename from src/register/register-core/register-common.h
rename to gnucash/register/register-core/register-common.h
diff --git a/src/register/register-core/table-allgui.c b/gnucash/register/register-core/table-allgui.c
similarity index 100%
rename from src/register/register-core/table-allgui.c
rename to gnucash/register/register-core/table-allgui.c
diff --git a/src/register/register-core/table-allgui.h b/gnucash/register/register-core/table-allgui.h
similarity index 100%
rename from src/register/register-core/table-allgui.h
rename to gnucash/register/register-core/table-allgui.h
diff --git a/src/register/register-core/table-control.c b/gnucash/register/register-core/table-control.c
similarity index 100%
rename from src/register/register-core/table-control.c
rename to gnucash/register/register-core/table-control.c
diff --git a/src/register/register-core/table-control.h b/gnucash/register/register-core/table-control.h
similarity index 100%
rename from src/register/register-core/table-control.h
rename to gnucash/register/register-core/table-control.h
diff --git a/src/register/register-core/table-layout.c b/gnucash/register/register-core/table-layout.c
similarity index 100%
rename from src/register/register-core/table-layout.c
rename to gnucash/register/register-core/table-layout.c
diff --git a/src/register/register-core/table-layout.h b/gnucash/register/register-core/table-layout.h
similarity index 100%
rename from src/register/register-core/table-layout.h
rename to gnucash/register/register-core/table-layout.h
diff --git a/src/register/register-core/table-model.c b/gnucash/register/register-core/table-model.c
similarity index 100%
rename from src/register/register-core/table-model.c
rename to gnucash/register/register-core/table-model.c
diff --git a/src/register/register-core/table-model.h b/gnucash/register/register-core/table-model.h
similarity index 100%
rename from src/register/register-core/table-model.h
rename to gnucash/register/register-core/table-model.h
diff --git a/src/register/register-core/test/CMakeLists.txt b/gnucash/register/register-core/test/CMakeLists.txt
similarity index 100%
rename from src/register/register-core/test/CMakeLists.txt
rename to gnucash/register/register-core/test/CMakeLists.txt
diff --git a/gnucash/register/register-core/test/Makefile.am b/gnucash/register/register-core/test/Makefile.am
new file mode 100644
index 0000000..84387df
--- /dev/null
+++ b/gnucash/register/register-core/test/Makefile.am
@@ -0,0 +1,24 @@
+TESTS =  \
+  test-link-module
+#  test-load-module
+
+#GNC_TEST_DEPS := \
+#
+
+#TESTS_ENVIRONMENT := \
+#  $(shell ${abs_top_srcdir}/common/gnc-test-env.pl --noexports ${GNC_TEST_DEPS})
+
+check_PROGRAMS = \
+  test-link-module
+
+test_link_module_SOURCES=test-link-module.c
+test_link_module_LDADD=\
+  ${top_builddir}/libgnucash/engine/libgncmod-engine.la \
+  ${top_builddir}/libgnucash/app-utils/libgncmod-app-utils.la \
+  ${top_builddir}/gnucash/gnome-utils/libgncmod-gnome-utils.la \
+  ../libgncmod-register-core.la
+
+EXTRA_DIST = CMakeLists.txt
+#            test-load-module
+
+AM_CPPFLAGS = ${GLIB_CFLAGS} -I${top_srcdir}/common/test-core -I..
diff --git a/src/register/register-core/test/test-link-module.c b/gnucash/register/register-core/test/test-link-module.c
similarity index 100%
rename from src/register/register-core/test/test-link-module.c
rename to gnucash/register/register-core/test/test-link-module.c
diff --git a/gnucash/register/register-gnome/CMakeLists.txt b/gnucash/register/register-gnome/CMakeLists.txt
new file mode 100644
index 0000000..a3c17bb
--- /dev/null
+++ b/gnucash/register/register-gnome/CMakeLists.txt
@@ -0,0 +1,64 @@
+ADD_SUBDIRECTORY(test)
+
+SET (register_gnome_SOURCES
+  gncmod-register-gnome.c
+  combocell-gnome.c
+  datecell-gnome.c
+  formulacell-gnome.c
+  gnucash-color.c
+  gnucash-cursor.c
+  gnucash-date-picker.c
+  gnucash-header.c
+  gnucash-item-edit.c
+  gnucash-item-list.c
+  gnucash-register.c
+  gnucash-scrolled-window.c
+  gnucash-sheet-private.c
+  gnucash-sheet.c
+  gnucash-style.c
+  pricecell-gnome.c
+  quickfillcell-gnome.c
+  table-gnome.c
+)
+
+SET (register_gnome_noinst_HEADERS
+  formulacell-gnome.h
+  gnucash-color.h
+  gnucash-cursor.h
+  gnucash-date-picker.h
+  gnucash-header.h
+  gnucash-item-edit.h
+  gnucash-item-list.h
+  gnucash-register.h
+  gnucash-scrolled-window.h
+  gnucash-sheet.h
+  gnucash-sheetP.h
+  gnucash-style.h
+  pricecell-gnome.h
+  quickfillcell-gnome.h
+  table-gnome.h
+)
+
+# Add dependency on config.h
+SET_SOURCE_FILES_PROPERTIES (${register_gnome_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
+
+ADD_LIBRARY (gncmod-register-gnome ${register_gnome_SOURCES} ${register_gnome_noinst_HEADERS})
+
+TARGET_LINK_LIBRARIES(gncmod-register-gnome gncmod-register-core ${GTK3_LDFLAGS})
+
+TARGET_COMPILE_DEFINITIONS(gncmod-register-gnome PRIVATE -DG_LOG_DOMAIN=\"gnc.register.gnome\")
+
+TARGET_INCLUDE_DIRECTORIES(gncmod-register-gnome
+    PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
+    PRIVATE ${CMAKE_SOURCE_DIR}/gnucash/register/ledger-core ${GTK3_INCLUDE_DIRS}
+)
+
+INSTALL(TARGETS gncmod-register-gnome
+  LIBRARY DESTINATION lib/gnucash
+  ARCHIVE DESTINATION lib/gnucash
+  RUNTIME DESTINATION bin)
+# No headers to install
+
+SET_LOCAL_DIST(register_gnome_DIST_local CMakeLists.txt Makefile.am ${register_gnome_SOURCES} ${register_gnome_noinst_HEADERS})
+
+SET(register_gnome_DIST ${register_gnome_DIST_local} ${test_register_gnome_DIST} PARENT_SCOPE)
diff --git a/gnucash/register/register-gnome/Makefile.am b/gnucash/register/register-gnome/Makefile.am
new file mode 100644
index 0000000..87c45fc
--- /dev/null
+++ b/gnucash/register/register-gnome/Makefile.am
@@ -0,0 +1,69 @@
+SUBDIRS = . test
+
+pkglib_LTLIBRARIES = libgncmod-register-gnome.la
+
+libgncmod_register_gnome_la_LDFLAGS = -avoid-version
+
+libgncmod_register_gnome_la_LIBADD = \
+  ${top_builddir}/gnucash/register/register-core/libgncmod-register-core.la \
+  ${top_builddir}/libgnucash/core-utils/libgnc-core-utils.la \
+  ${top_builddir}/libgnucash/gnc-module/libgnc-module.la \
+  ${top_builddir}/libgnucash/engine/libgncmod-engine.la \
+  ${top_builddir}/libgnucash/app-utils/libgncmod-app-utils.la \
+  ${top_builddir}/gnucash/gnome-utils/libgncmod-gnome-utils.la \
+  ${GLIB_LIBS} \
+  ${GTK_LIBS}
+
+libgncmod_register_gnome_la_SOURCES = \
+  gncmod-register-gnome.c \
+  combocell-gnome.c \
+  datecell-gnome.c \
+  formulacell-gnome.c \
+  gnucash-color.c \
+  gnucash-cursor.c \
+  gnucash-date-picker.c \
+  gnucash-header.c \
+  gnucash-item-edit.c \
+  gnucash-item-list.c \
+  gnucash-register.c \
+  gnucash-scrolled-window.c \
+  gnucash-sheet-private.c \
+  gnucash-sheet.c \
+  gnucash-style.c \
+  pricecell-gnome.c \
+  quickfillcell-gnome.c \
+  table-gnome.c 
+
+noinst_HEADERS = \
+  formulacell-gnome.h \
+  gnucash-color.h \
+  gnucash-cursor.h \
+  gnucash-date-picker.h \
+  gnucash-header.h \
+  gnucash-item-edit.h \
+  gnucash-item-list.h \
+  gnucash-register.h \
+  gnucash-scrolled-window.h \
+  gnucash-sheet.h \
+  gnucash-sheetP.h \
+  gnucash-style.h \
+  pricecell-gnome.h \
+  quickfillcell-gnome.h \
+  table-gnome.h
+
+AM_CPPFLAGS = \
+  -I${top_srcdir}/common \
+  -I${top_srcdir}/libgnucash/core-utils \
+  -I${top_srcdir}/libgnucash/engine \
+  -I${top_srcdir}/libgnucash/gnc-module \
+  -I${top_srcdir}/libgnucash/app-utils \
+  -I${top_srcdir}/gnucash/gnome-utils \
+  -I${top_srcdir}/gnucash/register/ledger-core \
+  -I${top_srcdir}/gnucash/register/register-core \
+  ${GLIB_CFLAGS} \
+  ${GTK_CFLAGS} \
+  ${GTK_XIM_FLAGS}
+
+AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.register.gnome\"
+
+EXTRA_DIST = CMakeLists.txt
diff --git a/src/register/register-gnome/combocell-gnome.c b/gnucash/register/register-gnome/combocell-gnome.c
similarity index 100%
rename from src/register/register-gnome/combocell-gnome.c
rename to gnucash/register/register-gnome/combocell-gnome.c
diff --git a/src/register/register-gnome/datecell-gnome.c b/gnucash/register/register-gnome/datecell-gnome.c
similarity index 100%
rename from src/register/register-gnome/datecell-gnome.c
rename to gnucash/register/register-gnome/datecell-gnome.c
diff --git a/src/register/register-gnome/formulacell-gnome.c b/gnucash/register/register-gnome/formulacell-gnome.c
similarity index 100%
rename from src/register/register-gnome/formulacell-gnome.c
rename to gnucash/register/register-gnome/formulacell-gnome.c
diff --git a/src/register/register-gnome/formulacell-gnome.h b/gnucash/register/register-gnome/formulacell-gnome.h
similarity index 100%
rename from src/register/register-gnome/formulacell-gnome.h
rename to gnucash/register/register-gnome/formulacell-gnome.h
diff --git a/src/register/register-gnome/gncmod-register-gnome.c b/gnucash/register/register-gnome/gncmod-register-gnome.c
similarity index 100%
rename from src/register/register-gnome/gncmod-register-gnome.c
rename to gnucash/register/register-gnome/gncmod-register-gnome.c
diff --git a/src/register/register-gnome/gnucash-color.c b/gnucash/register/register-gnome/gnucash-color.c
similarity index 100%
rename from src/register/register-gnome/gnucash-color.c
rename to gnucash/register/register-gnome/gnucash-color.c
diff --git a/src/register/register-gnome/gnucash-color.h b/gnucash/register/register-gnome/gnucash-color.h
similarity index 100%
rename from src/register/register-gnome/gnucash-color.h
rename to gnucash/register/register-gnome/gnucash-color.h
diff --git a/src/register/register-gnome/gnucash-cursor.c b/gnucash/register/register-gnome/gnucash-cursor.c
similarity index 100%
rename from src/register/register-gnome/gnucash-cursor.c
rename to gnucash/register/register-gnome/gnucash-cursor.c
diff --git a/src/register/register-gnome/gnucash-cursor.h b/gnucash/register/register-gnome/gnucash-cursor.h
similarity index 100%
rename from src/register/register-gnome/gnucash-cursor.h
rename to gnucash/register/register-gnome/gnucash-cursor.h
diff --git a/src/register/register-gnome/gnucash-date-picker.c b/gnucash/register/register-gnome/gnucash-date-picker.c
similarity index 100%
rename from src/register/register-gnome/gnucash-date-picker.c
rename to gnucash/register/register-gnome/gnucash-date-picker.c
diff --git a/src/register/register-gnome/gnucash-date-picker.h b/gnucash/register/register-gnome/gnucash-date-picker.h
similarity index 100%
rename from src/register/register-gnome/gnucash-date-picker.h
rename to gnucash/register/register-gnome/gnucash-date-picker.h
diff --git a/src/register/register-gnome/gnucash-header.c b/gnucash/register/register-gnome/gnucash-header.c
similarity index 100%
rename from src/register/register-gnome/gnucash-header.c
rename to gnucash/register/register-gnome/gnucash-header.c
diff --git a/src/register/register-gnome/gnucash-header.h b/gnucash/register/register-gnome/gnucash-header.h
similarity index 100%
rename from src/register/register-gnome/gnucash-header.h
rename to gnucash/register/register-gnome/gnucash-header.h
diff --git a/src/register/register-gnome/gnucash-item-edit.c b/gnucash/register/register-gnome/gnucash-item-edit.c
similarity index 100%
rename from src/register/register-gnome/gnucash-item-edit.c
rename to gnucash/register/register-gnome/gnucash-item-edit.c
diff --git a/src/register/register-gnome/gnucash-item-edit.h b/gnucash/register/register-gnome/gnucash-item-edit.h
similarity index 100%
rename from src/register/register-gnome/gnucash-item-edit.h
rename to gnucash/register/register-gnome/gnucash-item-edit.h
diff --git a/src/register/register-gnome/gnucash-item-list.c b/gnucash/register/register-gnome/gnucash-item-list.c
similarity index 100%
rename from src/register/register-gnome/gnucash-item-list.c
rename to gnucash/register/register-gnome/gnucash-item-list.c
diff --git a/src/register/register-gnome/gnucash-item-list.h b/gnucash/register/register-gnome/gnucash-item-list.h
similarity index 100%
rename from src/register/register-gnome/gnucash-item-list.h
rename to gnucash/register/register-gnome/gnucash-item-list.h
diff --git a/src/register/register-gnome/gnucash-register.c b/gnucash/register/register-gnome/gnucash-register.c
similarity index 100%
rename from src/register/register-gnome/gnucash-register.c
rename to gnucash/register/register-gnome/gnucash-register.c
diff --git a/src/register/register-gnome/gnucash-register.h b/gnucash/register/register-gnome/gnucash-register.h
similarity index 100%
rename from src/register/register-gnome/gnucash-register.h
rename to gnucash/register/register-gnome/gnucash-register.h
diff --git a/src/register/register-gnome/gnucash-scrolled-window.c b/gnucash/register/register-gnome/gnucash-scrolled-window.c
similarity index 100%
rename from src/register/register-gnome/gnucash-scrolled-window.c
rename to gnucash/register/register-gnome/gnucash-scrolled-window.c
diff --git a/src/register/register-gnome/gnucash-scrolled-window.h b/gnucash/register/register-gnome/gnucash-scrolled-window.h
similarity index 100%
rename from src/register/register-gnome/gnucash-scrolled-window.h
rename to gnucash/register/register-gnome/gnucash-scrolled-window.h
diff --git a/src/register/register-gnome/gnucash-sheet-private.c b/gnucash/register/register-gnome/gnucash-sheet-private.c
similarity index 100%
rename from src/register/register-gnome/gnucash-sheet-private.c
rename to gnucash/register/register-gnome/gnucash-sheet-private.c
diff --git a/src/register/register-gnome/gnucash-sheet.c b/gnucash/register/register-gnome/gnucash-sheet.c
similarity index 100%
rename from src/register/register-gnome/gnucash-sheet.c
rename to gnucash/register/register-gnome/gnucash-sheet.c
diff --git a/src/register/register-gnome/gnucash-sheet.h b/gnucash/register/register-gnome/gnucash-sheet.h
similarity index 100%
rename from src/register/register-gnome/gnucash-sheet.h
rename to gnucash/register/register-gnome/gnucash-sheet.h
diff --git a/src/register/register-gnome/gnucash-sheetP.h b/gnucash/register/register-gnome/gnucash-sheetP.h
similarity index 100%
rename from src/register/register-gnome/gnucash-sheetP.h
rename to gnucash/register/register-gnome/gnucash-sheetP.h
diff --git a/src/register/register-gnome/gnucash-style.c b/gnucash/register/register-gnome/gnucash-style.c
similarity index 100%
rename from src/register/register-gnome/gnucash-style.c
rename to gnucash/register/register-gnome/gnucash-style.c
diff --git a/src/register/register-gnome/gnucash-style.h b/gnucash/register/register-gnome/gnucash-style.h
similarity index 100%
rename from src/register/register-gnome/gnucash-style.h
rename to gnucash/register/register-gnome/gnucash-style.h
diff --git a/src/register/register-gnome/pricecell-gnome.c b/gnucash/register/register-gnome/pricecell-gnome.c
similarity index 100%
rename from src/register/register-gnome/pricecell-gnome.c
rename to gnucash/register/register-gnome/pricecell-gnome.c
diff --git a/src/register/register-gnome/pricecell-gnome.h b/gnucash/register/register-gnome/pricecell-gnome.h
similarity index 100%
rename from src/register/register-gnome/pricecell-gnome.h
rename to gnucash/register/register-gnome/pricecell-gnome.h
diff --git a/src/register/register-gnome/quickfillcell-gnome.c b/gnucash/register/register-gnome/quickfillcell-gnome.c
similarity index 100%
rename from src/register/register-gnome/quickfillcell-gnome.c
rename to gnucash/register/register-gnome/quickfillcell-gnome.c
diff --git a/src/register/register-gnome/quickfillcell-gnome.h b/gnucash/register/register-gnome/quickfillcell-gnome.h
similarity index 100%
rename from src/register/register-gnome/quickfillcell-gnome.h
rename to gnucash/register/register-gnome/quickfillcell-gnome.h
diff --git a/src/register/register-gnome/table-gnome.c b/gnucash/register/register-gnome/table-gnome.c
similarity index 100%
rename from src/register/register-gnome/table-gnome.c
rename to gnucash/register/register-gnome/table-gnome.c
diff --git a/src/register/register-gnome/table-gnome.h b/gnucash/register/register-gnome/table-gnome.h
similarity index 100%
rename from src/register/register-gnome/table-gnome.h
rename to gnucash/register/register-gnome/table-gnome.h
diff --git a/src/register/register-gnome/test/CMakeLists.txt b/gnucash/register/register-gnome/test/CMakeLists.txt
similarity index 100%
rename from src/register/register-gnome/test/CMakeLists.txt
rename to gnucash/register/register-gnome/test/CMakeLists.txt
diff --git a/gnucash/register/register-gnome/test/Makefile.am b/gnucash/register/register-gnome/test/Makefile.am
new file mode 100644
index 0000000..2a7a65f
--- /dev/null
+++ b/gnucash/register/register-gnome/test/Makefile.am
@@ -0,0 +1,24 @@
+TESTS =  \
+  test-link-module
+#  test-load-module
+
+#GNC_TEST_DEPS := \
+#
+
+#TESTS_ENVIRONMENT := \
+#  $(shell ${abs_top_srcdir}/common/gnc-test-env.pl --noexports ${GNC_TEST_DEPS})
+
+check_PROGRAMS = \
+  test-link-module
+
+test_link_module_SOURCES = test-link-module.c
+test_link_module_LDADD = \
+  ${top_builddir}/libgnucash/engine/libgncmod-engine.la \
+  ${top_builddir}/libgnucash/app-utils/libgncmod-app-utils.la \
+  ${top_builddir}/gnucash/gnome-utils/libgncmod-gnome-utils.la \
+  ../libgncmod-register-gnome.la
+
+EXTRA_DIST = CMakeLists.txt
+#            test-load-module
+
+AM_CPPFLAGS = -I${top_srcdir}/common/test-core -I.. ${GLIB_CFLAGS}
diff --git a/src/register/register-gnome/test/test-link-module.c b/gnucash/register/register-gnome/test/test-link-module.c
similarity index 100%
rename from src/register/register-gnome/test/test-link-module.c
rename to gnucash/register/register-gnome/test/test-link-module.c
diff --git a/src/report/CMakeLists.txt b/gnucash/report/CMakeLists.txt
similarity index 100%
rename from src/report/CMakeLists.txt
rename to gnucash/report/CMakeLists.txt
diff --git a/src/report/Makefile.am b/gnucash/report/Makefile.am
similarity index 100%
rename from src/report/Makefile.am
rename to gnucash/report/Makefile.am
diff --git a/gnucash/report/business-reports/CMakeLists.txt b/gnucash/report/business-reports/CMakeLists.txt
new file mode 100644
index 0000000..224ba51
--- /dev/null
+++ b/gnucash/report/business-reports/CMakeLists.txt
@@ -0,0 +1,48 @@
+
+SET (business_reports_SCHEME
+  aging.scm
+  customer-summary.scm
+  easy-invoice.scm
+  fancy-invoice.scm
+  taxinvoice.scm
+  receipt.scm
+  invoice.scm
+  job-report.scm
+  owner-report.scm
+  payables.scm
+  receivables.scm
+  balsheet-eg.scm
+  business-reports.scm
+)
+
+SET(business_reports_DATA
+  taxinvoice.eguile.scm
+  taxinvoice.css
+  receipt.eguile.scm
+  receipt.css
+  balsheet-eg.css
+  balsheet-eg.eguile.scm
+)
+
+SET(GUILE_OUTPUT_DIR   gnucash/report)
+SET(GUILE_MODULES      libgnucash/app-utils libgnucash/engine gnucash/html gnucash/gnome-utils
+                       gnucash/report/report-system gnucash/report/standard-reports)
+SET(GUILE_LOAD_DIRS    libgnucash/app-utils libgnucash/core-utils libgnucash/engine libgnucash/gnc-module gnucash/gnome-utils
+                       libgnucash/scm gnucash/report/business_reports gnucash/report/report-system gnucash/report/standard-reports)
+SET(GUILE_LIBRARY_DIRS libgnucash/app-utils libgnucash/core-utils libgnucash/engine libgnucash/gnc-module gnucash/gnome-utils
+                       gnucash/report/report-system gnucash/report/standard-reports)
+SET(GUILE_DEPENDS      scm-business-reports-links scm-standard-reports)
+
+GNC_ADD_SCHEME_TARGETS(scm-business-reports
+  "${business_reports_SCHEME}"
+  ${GUILE_OUTPUT_DIR} 
+  "${GUILE_MODULES}"
+  "${GUILE_LOAD_DIRS}"
+  "${GUILE_LIBRARY_DIRS}"
+  "${GUILE_DEPENDS}"
+  TRUE
+)
+
+INSTALL(FILES ${business_reports_DATA} DESTINATION ${SCHEME_INSTALLED_SOURCE_DIR}/gnucash/report)
+
+SET_DIST_LIST(business_reports_DIST CMakeLists.txt Makefile.am ${business_reports_SCHEME} ${business_reports_DATA})
diff --git a/gnucash/report/business-reports/Makefile.am b/gnucash/report/business-reports/Makefile.am
new file mode 100644
index 0000000..3c08cf2
--- /dev/null
+++ b/gnucash/report/business-reports/Makefile.am
@@ -0,0 +1,99 @@
+gncscmmoddir = ${GNC_SCM_INSTALL_DIR}/gnucash/report
+gncscmmod_DATA = \
+   aging.scm \
+   customer-summary.scm \
+   easy-invoice.scm \
+   fancy-invoice.scm \
+   taxinvoice.scm \
+   receipt.scm \
+   invoice.scm \
+   job-report.scm \
+   owner-report.scm \
+   payables.scm \
+   receivables.scm \
+   balsheet-eg.scm \
+   business-reports.scm
+
+# Note: list these files separately because they can't be compiled by guile2
+#       templates are a mixture of scheme and hmtl
+#       css files are not scheme at all
+gncscmtpldir = ${GNC_SCM_INSTALL_DIR}/gnucash/report
+gncscmtpl_DATA = \
+   taxinvoice.eguile.scm \
+   taxinvoice.css \
+   receipt.eguile.scm \
+   receipt.css \
+   balsheet-eg.css \
+   balsheet-eg.eguile.scm
+
+if GNUCASH_SEPARATE_BUILDDIR
+SCM_FILE_LINKS = ${gncscmmod_DATA} \
+  ${gncscmtpl_DATA}
+endif
+
+.scm-links:
+	$(RM) -rf gnucash
+	mkdir -p  gnucash
+	mkdir -p  gnucash/report
+if GNUCASH_SEPARATE_BUILDDIR
+	for X in ${SCM_FILE_LINKS} ; do \
+	  $(LN_S) -f ${srcdir}/$$X . ; \
+	done
+endif
+	( cd gnucash/report; for A in $(gncscmmod_DATA) ; do $(LN_S) -f ../../$$A . ; done )
+if ! OS_WIN32
+# Windows knows no "ln -s" but uses "cp": must copy every time (see bug #566567).
+	touch .scm-links
+endif
+
+if GNC_HAVE_GUILE_2
+GUILE_COMPILE_ENV = \
+  --gnc-module-dir ${top_builddir}/libgnucash/app-utils \
+  --gnc-module-dir ${top_builddir}/libgnucash/engine \
+  --gnc-module-dir ${top_builddir}/gnucash/gnome-utils \
+  --gnc-module-dir ${top_builddir}/gnucash/html \
+  --gnc-module-dir ${top_builddir}/gnucash/report/report-system \
+  --guile-load-dir ${top_builddir}/libgnucash/app-utils \
+  --guile-load-dir ${top_builddir}/libgnucash/core-utils \
+  --guile-load-dir ${top_builddir}/libgnucash/engine \
+  --guile-load-dir ${top_builddir}/libgnucash/gnc-module \
+  --guile-load-dir ${top_builddir}/gnucash/gnome-utils \
+  --guile-load-dir ${top_builddir}/gnucash/report/report-system \
+  --guile-load-dir ${top_builddir}/gnucash/report/standard-reports \
+  --guile-load-dir ${top_builddir}/gnucash/report/business-reports \
+  --guile-load-dir ${top_builddir}/libgnucash/scm \
+  --library-dir    ${top_builddir}/libgnucash/engine \
+  --library-dir    ${top_builddir}/libgnucash/app-utils \
+  --library-dir    ${top_builddir}/libgnucash/core-utils \
+  --library-dir    ${top_builddir}/gnucash/gnome-utils \
+  --library-dir    ${top_builddir}/libgnucash/backend/xml \
+  --library-dir    ${top_builddir}/libgnucash/backend/sql \
+  --library-dir    ${top_builddir}/gnucash/html \
+  --library-dir    ${top_builddir}/libgnucash/gnc-module \
+  --library-dir    ${top_builddir}/gnucash/report/report-system
+
+
+%.go : %.scm .scm-links $(pkglib_LTLIBRARIES)
+	GNC_UNINSTALLED=yes \
+	GNC_BUILDDIR=${top_builddir} \
+	$(shell ${abs_top_srcdir}/common/gnc-test-env.pl --noexports ${GUILE_COMPILE_ENV}) \
+	$(GUILD) compile -o $@ $<
+
+gncscmmodcachedir = ${pkglibdir}/scm/ccache/@GUILE_EFFECTIVE_VERSION@/gnucash/report
+gncscmmodcache_DATA = $(gncscmmod_DATA:.scm=.go)
+endif
+
+clean-local:
+	$(RM) -rf gnucash
+
+noinst_DATA = .scm-links
+
+EXTRA_DIST = \
+  ${gncscmmod_DATA} \
+  ${gncscmtpl_DATA} \
+  CMakeLists.txt
+
+CLEANFILES = .scm-links ${gncscmmodcache_DATA}
+DISTCLEANFILES = ${SCM_FILE_LINKS}
+
+AM_CPPFLAGS = -DG_LOG_DOMAIN=\"gnc.business.reports\"
diff --git a/src/report/business-reports/aging.scm b/gnucash/report/business-reports/aging.scm
similarity index 100%
rename from src/report/business-reports/aging.scm
rename to gnucash/report/business-reports/aging.scm
diff --git a/src/report/business-reports/balsheet-eg.css b/gnucash/report/business-reports/balsheet-eg.css
similarity index 100%
rename from src/report/business-reports/balsheet-eg.css
rename to gnucash/report/business-reports/balsheet-eg.css
diff --git a/src/report/business-reports/balsheet-eg.eguile.scm b/gnucash/report/business-reports/balsheet-eg.eguile.scm
similarity index 100%
rename from src/report/business-reports/balsheet-eg.eguile.scm
rename to gnucash/report/business-reports/balsheet-eg.eguile.scm
diff --git a/src/report/business-reports/balsheet-eg.scm b/gnucash/report/business-reports/balsheet-eg.scm
similarity index 100%
rename from src/report/business-reports/balsheet-eg.scm
rename to gnucash/report/business-reports/balsheet-eg.scm
diff --git a/src/report/business-reports/business-reports.scm b/gnucash/report/business-reports/business-reports.scm
similarity index 100%
rename from src/report/business-reports/business-reports.scm
rename to gnucash/report/business-reports/business-reports.scm
diff --git a/src/report/business-reports/customer-summary.scm b/gnucash/report/business-reports/customer-summary.scm
similarity index 100%
rename from src/report/business-reports/customer-summary.scm
rename to gnucash/report/business-reports/customer-summary.scm
diff --git a/src/report/business-reports/easy-invoice.scm b/gnucash/report/business-reports/easy-invoice.scm
similarity index 100%
rename from src/report/business-reports/easy-invoice.scm
rename to gnucash/report/business-reports/easy-invoice.scm
diff --git a/src/report/business-reports/fancy-invoice.scm b/gnucash/report/business-reports/fancy-invoice.scm
similarity index 100%
rename from src/report/business-reports/fancy-invoice.scm
rename to gnucash/report/business-reports/fancy-invoice.scm
diff --git a/src/report/business-reports/invoice.scm b/gnucash/report/business-reports/invoice.scm
similarity index 100%
rename from src/report/business-reports/invoice.scm
rename to gnucash/report/business-reports/invoice.scm
diff --git a/src/report/business-reports/job-report.scm b/gnucash/report/business-reports/job-report.scm
similarity index 100%
rename from src/report/business-reports/job-report.scm
rename to gnucash/report/business-reports/job-report.scm
diff --git a/src/report/business-reports/owner-report.scm b/gnucash/report/business-reports/owner-report.scm
similarity index 100%
rename from src/report/business-reports/owner-report.scm
rename to gnucash/report/business-reports/owner-report.scm
diff --git a/src/report/business-reports/payables.scm b/gnucash/report/business-reports/payables.scm
similarity index 100%
rename from src/report/business-reports/payables.scm
rename to gnucash/report/business-reports/payables.scm
diff --git a/src/report/business-reports/receipt.css b/gnucash/report/business-reports/receipt.css
similarity index 100%
rename from src/report/business-reports/receipt.css
rename to gnucash/report/business-reports/receipt.css
diff --git a/src/report/business-reports/receipt.eguile.scm b/gnucash/report/business-reports/receipt.eguile.scm
similarity index 100%
rename from src/report/business-reports/receipt.eguile.scm
rename to gnucash/report/business-reports/receipt.eguile.scm
diff --git a/src/report/business-reports/receipt.scm b/gnucash/report/business-reports/receipt.scm
similarity index 100%
rename from src/report/business-reports/receipt.scm
rename to gnucash/report/business-reports/receipt.scm
diff --git a/src/report/business-reports/receivables.scm b/gnucash/report/business-reports/receivables.scm
similarity index 100%
rename from src/report/business-reports/receivables.scm
rename to gnucash/report/business-reports/receivables.scm
diff --git a/src/report/business-reports/taxinvoice.css b/gnucash/report/business-reports/taxinvoice.css
similarity index 100%
rename from src/report/business-reports/taxinvoice.css
rename to gnucash/report/business-reports/taxinvoice.css
diff --git a/src/report/business-reports/taxinvoice.eguile.scm b/gnucash/report/business-reports/taxinvoice.eguile.scm
similarity index 100%
rename from src/report/business-reports/taxinvoice.eguile.scm
rename to gnucash/report/business-reports/taxinvoice.eguile.scm
diff --git a/src/report/business-reports/taxinvoice.scm b/gnucash/report/business-reports/taxinvoice.scm
similarity index 100%
rename from src/report/business-reports/taxinvoice.scm
rename to gnucash/report/business-reports/taxinvoice.scm
diff --git a/src/report/jqplot/CMakeLists.txt b/gnucash/report/jqplot/CMakeLists.txt
similarity index 100%
rename from src/report/jqplot/CMakeLists.txt
rename to gnucash/report/jqplot/CMakeLists.txt
diff --git a/src/report/jqplot/MIT-LICENSE.txt b/gnucash/report/jqplot/MIT-LICENSE.txt
similarity index 100%
rename from src/report/jqplot/MIT-LICENSE.txt
rename to gnucash/report/jqplot/MIT-LICENSE.txt
diff --git a/src/report/jqplot/Makefile.am b/gnucash/report/jqplot/Makefile.am
similarity index 100%
rename from src/report/jqplot/Makefile.am
rename to gnucash/report/jqplot/Makefile.am
diff --git a/src/report/jqplot/README.txt b/gnucash/report/jqplot/README.txt
similarity index 100%
rename from src/report/jqplot/README.txt
rename to gnucash/report/jqplot/README.txt
diff --git a/src/report/jqplot/changes.txt b/gnucash/report/jqplot/changes.txt
similarity index 100%
rename from src/report/jqplot/changes.txt
rename to gnucash/report/jqplot/changes.txt
diff --git a/src/report/jqplot/copyright.txt b/gnucash/report/jqplot/copyright.txt
similarity index 100%
rename from src/report/jqplot/copyright.txt
rename to gnucash/report/jqplot/copyright.txt
diff --git a/src/report/jqplot/excanvas.js b/gnucash/report/jqplot/excanvas.js
similarity index 100%
rename from src/report/jqplot/excanvas.js
rename to gnucash/report/jqplot/excanvas.js
diff --git a/src/report/jqplot/excanvas.min.js b/gnucash/report/jqplot/excanvas.min.js
similarity index 100%
rename from src/report/jqplot/excanvas.min.js
rename to gnucash/report/jqplot/excanvas.min.js
diff --git a/src/report/jqplot/gpl-2.0.txt b/gnucash/report/jqplot/gpl-2.0.txt
similarity index 100%
rename from src/report/jqplot/gpl-2.0.txt
rename to gnucash/report/jqplot/gpl-2.0.txt
diff --git a/src/report/jqplot/jqPlotCssStyling.txt b/gnucash/report/jqplot/jqPlotCssStyling.txt
similarity index 100%
rename from src/report/jqplot/jqPlotCssStyling.txt
rename to gnucash/report/jqplot/jqPlotCssStyling.txt
diff --git a/src/report/jqplot/jqPlotOptions.txt b/gnucash/report/jqplot/jqPlotOptions.txt
similarity index 100%
rename from src/report/jqplot/jqPlotOptions.txt
rename to gnucash/report/jqplot/jqPlotOptions.txt
diff --git a/src/report/jqplot/jquery-1.4.2.min.js b/gnucash/report/jqplot/jquery-1.4.2.min.js
similarity index 100%
rename from src/report/jqplot/jquery-1.4.2.min.js
rename to gnucash/report/jqplot/jquery-1.4.2.min.js
diff --git a/src/report/jqplot/jquery.jqplot.css b/gnucash/report/jqplot/jquery.jqplot.css
similarity index 100%
rename from src/report/jqplot/jquery.jqplot.css
rename to gnucash/report/jqplot/jquery.jqplot.css
diff --git a/src/report/jqplot/jquery.jqplot.js b/gnucash/report/jqplot/jquery.jqplot.js
similarity index 100%
rename from src/report/jqplot/jquery.jqplot.js
rename to gnucash/report/jqplot/jquery.jqplot.js
diff --git a/src/report/jqplot/jquery.jqplot.min.css b/gnucash/report/jqplot/jquery.jqplot.min.css
similarity index 100%
rename from src/report/jqplot/jquery.jqplot.min.css
rename to gnucash/report/jqplot/jquery.jqplot.min.css
diff --git a/src/report/jqplot/jquery.jqplot.min.js b/gnucash/report/jqplot/jquery.jqplot.min.js
similarity index 100%
rename from src/report/jqplot/jquery.jqplot.min.js
rename to gnucash/report/jqplot/jquery.jqplot.min.js
diff --git a/src/report/jqplot/jquery.js b/gnucash/report/jqplot/jquery.js
similarity index 100%
rename from src/report/jqplot/jquery.js
rename to gnucash/report/jqplot/jquery.js
diff --git a/src/report/jqplot/jquery.min.js b/gnucash/report/jqplot/jquery.min.js
similarity index 100%
rename from src/report/jqplot/jquery.min.js
rename to gnucash/report/jqplot/jquery.min.js
diff --git a/src/report/jqplot/optionsTutorial.txt b/gnucash/report/jqplot/optionsTutorial.txt
similarity index 100%
rename from src/report/jqplot/optionsTutorial.txt
rename to gnucash/report/jqplot/optionsTutorial.txt
diff --git a/src/report/jqplot/plugins/jqplot.BezierCurveRenderer.js b/gnucash/report/jqplot/plugins/jqplot.BezierCurveRenderer.js
similarity index 100%
rename from src/report/jqplot/plugins/jqplot.BezierCurveRenderer.js
rename to gnucash/report/jqplot/plugins/jqplot.BezierCurveRenderer.js
diff --git a/src/report/jqplot/plugins/jqplot.BezierCurveRenderer.min.js b/gnucash/report/jqplot/plugins/jqplot.BezierCurveRenderer.min.js
similarity index 100%
rename from src/report/jqplot/plugins/jqplot.BezierCurveRenderer.min.js
rename to gnucash/report/jqplot/plugins/jqplot.BezierCurveRenderer.min.js
diff --git a/src/report/jqplot/plugins/jqplot.barRenderer.js b/gnucash/report/jqplot/plugins/jqplot.barRenderer.js
similarity index 100%
rename from src/report/jqplot/plugins/jqplot.barRenderer.js
rename to gnucash/report/jqplot/plugins/jqplot.barRenderer.js
diff --git a/src/report/jqplot/plugins/jqplot.barRenderer.min.js b/gnucash/report/jqplot/plugins/jqplot.barRenderer.min.js
similarity index 100%
rename from src/report/jqplot/plugins/jqplot.barRenderer.min.js
rename to gnucash/report/jqplot/plugins/jqplot.barRenderer.min.js
diff --git a/src/report/jqplot/plugins/jqplot.blockRenderer.js b/gnucash/report/jqplot/plugins/jqplot.blockRenderer.js
similarity index 100%
rename from src/report/jqplot/plugins/jqplot.blockRenderer.js
rename to gnucash/report/jqplot/plugins/jqplot.blockRenderer.js
diff --git a/src/report/jqplot/plugins/jqplot.blockRenderer.min.js b/gnucash/report/jqplot/plugins/jqplot.blockRenderer.min.js
similarity index 100%
rename from src/report/jqplot/plugins/jqplot.blockRenderer.min.js
rename to gnucash/report/jqplot/plugins/jqplot.blockRenderer.min.js
diff --git a/src/report/jqplot/plugins/jqplot.bubbleRenderer.js b/gnucash/report/jqplot/plugins/jqplot.bubbleRenderer.js
similarity index 100%
rename from src/report/jqplot/plugins/jqplot.bubbleRenderer.js
rename to gnucash/report/jqplot/plugins/jqplot.bubbleRenderer.js
diff --git a/src/report/jqplot/plugins/jqplot.bubbleRenderer.min.js b/gnucash/report/jqplot/plugins/jqplot.bubbleRenderer.min.js
similarity index 100%
rename from src/report/jqplot/plugins/jqplot.bubbleRenderer.min.js
rename to gnucash/report/jqplot/plugins/jqplot.bubbleRenderer.min.js
diff --git a/src/report/jqplot/plugins/jqplot.canvasAxisLabelRenderer.js b/gnucash/report/jqplot/plugins/jqplot.canvasAxisLabelRenderer.js
similarity index 100%
rename from src/report/jqplot/plugins/jqplot.canvasAxisLabelRenderer.js
rename to gnucash/report/jqplot/plugins/jqplot.canvasAxisLabelRenderer.js
diff --git a/src/report/jqplot/plugins/jqplot.canvasAxisLabelRenderer.min.js b/gnucash/report/jqplot/plugins/jqplot.canvasAxisLabelRenderer.min.js
similarity index 100%
rename from src/report/jqplot/plugins/jqplot.canvasAxisLabelRenderer.min.js
rename to gnucash/report/jqplot/plugins/jqplot.canvasAxisLabelRenderer.min.js
diff --git a/src/report/jqplot/plugins/jqplot.canvasAxisTickRenderer.js b/gnucash/report/jqplot/plugins/jqplot.canvasAxisTickRenderer.js
similarity index 100%
rename from src/report/jqplot/plugins/jqplot.canvasAxisTickRenderer.js
rename to gnucash/report/jqplot/plugins/jqplot.canvasAxisTickRenderer.js
diff --git a/src/report/jqplot/plugins/jqplot.canvasAxisTickRenderer.min.js b/gnucash/report/jqplot/plugins/jqplot.canvasAxisTickRenderer.min.js
similarity index 100%
rename from src/report/jqplot/plugins/jqplot.canvasAxisTickRenderer.min.js
rename to gnucash/report/jqplot/plugins/jqplot.canvasAxisTickRenderer.min.js
diff --git a/src/report/jqplot/plugins/jqplot.canvasOverlay.js b/gnucash/report/jqplot/plugins/jqplot.canvasOverlay.js
similarity index 100%
rename from src/report/jqplot/plugins/jqplot.canvasOverlay.js
rename to gnucash/report/jqplot/plugins/jqplot.canvasOverlay.js
diff --git a/src/report/jqplot/plugins/jqplot.canvasOverlay.min.js b/gnucash/report/jqplot/plugins/jqplot.canvasOverlay.min.js
similarity index 100%
rename from src/report/jqplot/plugins/jqplot.canvasOverlay.min.js
rename to gnucash/report/jqplot/plugins/jqplot.canvasOverlay.min.js
diff --git a/src/report/jqplot/plugins/jqplot.canvasTextRenderer.js b/gnucash/report/jqplot/plugins/jqplot.canvasTextRenderer.js
similarity index 100%
rename from src/report/jqplot/plugins/jqplot.canvasTextRenderer.js
rename to gnucash/report/jqplot/plugins/jqplot.canvasTextRenderer.js
diff --git a/src/report/jqplot/plugins/jqplot.canvasTextRenderer.min.js b/gnucash/report/jqplot/plugins/jqplot.canvasTextRenderer.min.js
similarity index 100%
rename from src/report/jqplot/plugins/jqplot.canvasTextRenderer.min.js
rename to gnucash/report/jqplot/plugins/jqplot.canvasTextRenderer.min.js
diff --git a/src/report/jqplot/plugins/jqplot.categoryAxisRenderer.js b/gnucash/report/jqplot/plugins/jqplot.categoryAxisRenderer.js
similarity index 100%
rename from src/report/jqplot/plugins/jqplot.categoryAxisRenderer.js
rename to gnucash/report/jqplot/plugins/jqplot.categoryAxisRenderer.js
diff --git a/src/report/jqplot/plugins/jqplot.categoryAxisRenderer.min.js b/gnucash/report/jqplot/plugins/jqplot.categoryAxisRenderer.min.js
similarity index 100%
rename from src/report/jqplot/plugins/jqplot.categoryAxisRenderer.min.js
rename to gnucash/report/jqplot/plugins/jqplot.categoryAxisRenderer.min.js
diff --git a/src/report/jqplot/plugins/jqplot.ciParser.js b/gnucash/report/jqplot/plugins/jqplot.ciParser.js
similarity index 100%
rename from src/report/jqplot/plugins/jqplot.ciParser.js
rename to gnucash/report/jqplot/plugins/jqplot.ciParser.js
diff --git a/src/report/jqplot/plugins/jqplot.ciParser.min.js b/gnucash/report/jqplot/plugins/jqplot.ciParser.min.js
similarity index 100%
rename from src/report/jqplot/plugins/jqplot.ciParser.min.js
rename to gnucash/report/jqplot/plugins/jqplot.ciParser.min.js
diff --git a/src/report/jqplot/plugins/jqplot.cursor.js b/gnucash/report/jqplot/plugins/jqplot.cursor.js
similarity index 100%
rename from src/report/jqplot/plugins/jqplot.cursor.js
rename to gnucash/report/jqplot/plugins/jqplot.cursor.js
diff --git a/src/report/jqplot/plugins/jqplot.cursor.min.js b/gnucash/report/jqplot/plugins/jqplot.cursor.min.js
similarity index 100%
rename from src/report/jqplot/plugins/jqplot.cursor.min.js
rename to gnucash/report/jqplot/plugins/jqplot.cursor.min.js
diff --git a/src/report/jqplot/plugins/jqplot.dateAxisRenderer.js b/gnucash/report/jqplot/plugins/jqplot.dateAxisRenderer.js
similarity index 100%
rename from src/report/jqplot/plugins/jqplot.dateAxisRenderer.js
rename to gnucash/report/jqplot/plugins/jqplot.dateAxisRenderer.js
diff --git a/src/report/jqplot/plugins/jqplot.dateAxisRenderer.min.js b/gnucash/report/jqplot/plugins/jqplot.dateAxisRenderer.min.js
similarity index 100%
rename from src/report/jqplot/plugins/jqplot.dateAxisRenderer.min.js
rename to gnucash/report/jqplot/plugins/jqplot.dateAxisRenderer.min.js
diff --git a/src/report/jqplot/plugins/jqplot.donutRenderer.js b/gnucash/report/jqplot/plugins/jqplot.donutRenderer.js
similarity index 100%
rename from src/report/jqplot/plugins/jqplot.donutRenderer.js
rename to gnucash/report/jqplot/plugins/jqplot.donutRenderer.js
diff --git a/src/report/jqplot/plugins/jqplot.donutRenderer.min.js b/gnucash/report/jqplot/plugins/jqplot.donutRenderer.min.js
similarity index 100%
rename from src/report/jqplot/plugins/jqplot.donutRenderer.min.js
rename to gnucash/report/jqplot/plugins/jqplot.donutRenderer.min.js
diff --git a/src/report/jqplot/plugins/jqplot.dragable.js b/gnucash/report/jqplot/plugins/jqplot.dragable.js
similarity index 100%
rename from src/report/jqplot/plugins/jqplot.dragable.js
rename to gnucash/report/jqplot/plugins/jqplot.dragable.js
diff --git a/src/report/jqplot/plugins/jqplot.dragable.min.js b/gnucash/report/jqplot/plugins/jqplot.dragable.min.js
similarity index 100%
rename from src/report/jqplot/plugins/jqplot.dragable.min.js
rename to gnucash/report/jqplot/plugins/jqplot.dragable.min.js
diff --git a/src/report/jqplot/plugins/jqplot.enhancedLegendRenderer.js b/gnucash/report/jqplot/plugins/jqplot.enhancedLegendRenderer.js
similarity index 100%
rename from src/report/jqplot/plugins/jqplot.enhancedLegendRenderer.js
rename to gnucash/report/jqplot/plugins/jqplot.enhancedLegendRenderer.js
diff --git a/src/report/jqplot/plugins/jqplot.enhancedLegendRenderer.min.js b/gnucash/report/jqplot/plugins/jqplot.enhancedLegendRenderer.min.js
similarity index 100%
rename from src/report/jqplot/plugins/jqplot.enhancedLegendRenderer.min.js
rename to gnucash/report/jqplot/plugins/jqplot.enhancedLegendRenderer.min.js
diff --git a/src/report/jqplot/plugins/jqplot.funnelRenderer.js b/gnucash/report/jqplot/plugins/jqplot.funnelRenderer.js
similarity index 100%
rename from src/report/jqplot/plugins/jqplot.funnelRenderer.js
rename to gnucash/report/jqplot/plugins/jqplot.funnelRenderer.js
diff --git a/src/report/jqplot/plugins/jqplot.funnelRenderer.min.js b/gnucash/report/jqplot/plugins/jqplot.funnelRenderer.min.js
similarity index 100%
rename from src/report/jqplot/plugins/jqplot.funnelRenderer.min.js
rename to gnucash/report/jqplot/plugins/jqplot.funnelRenderer.min.js
diff --git a/src/report/jqplot/plugins/jqplot.highlighter.js b/gnucash/report/jqplot/plugins/jqplot.highlighter.js
similarity index 100%
rename from src/report/jqplot/plugins/jqplot.highlighter.js
rename to gnucash/report/jqplot/plugins/jqplot.highlighter.js
diff --git a/src/report/jqplot/plugins/jqplot.highlighter.min.js b/gnucash/report/jqplot/plugins/jqplot.highlighter.min.js
similarity index 100%
rename from src/report/jqplot/plugins/jqplot.highlighter.min.js
rename to gnucash/report/jqplot/plugins/jqplot.highlighter.min.js
diff --git a/src/report/jqplot/plugins/jqplot.json2.js b/gnucash/report/jqplot/plugins/jqplot.json2.js
similarity index 100%
rename from src/report/jqplot/plugins/jqplot.json2.js
rename to gnucash/report/jqplot/plugins/jqplot.json2.js
diff --git a/src/report/jqplot/plugins/jqplot.json2.min.js b/gnucash/report/jqplot/plugins/jqplot.json2.min.js
similarity index 100%
rename from src/report/jqplot/plugins/jqplot.json2.min.js
rename to gnucash/report/jqplot/plugins/jqplot.json2.min.js
diff --git a/src/report/jqplot/plugins/jqplot.logAxisRenderer.js b/gnucash/report/jqplot/plugins/jqplot.logAxisRenderer.js
similarity index 100%
rename from src/report/jqplot/plugins/jqplot.logAxisRenderer.js
rename to gnucash/report/jqplot/plugins/jqplot.logAxisRenderer.js
diff --git a/src/report/jqplot/plugins/jqplot.logAxisRenderer.min.js b/gnucash/report/jqplot/plugins/jqplot.logAxisRenderer.min.js
similarity index 100%
rename from src/report/jqplot/plugins/jqplot.logAxisRenderer.min.js
rename to gnucash/report/jqplot/plugins/jqplot.logAxisRenderer.min.js
diff --git a/src/report/jqplot/plugins/jqplot.mekkoAxisRenderer.js b/gnucash/report/jqplot/plugins/jqplot.mekkoAxisRenderer.js
similarity index 100%
rename from src/report/jqplot/plugins/jqplot.mekkoAxisRenderer.js
rename to gnucash/report/jqplot/plugins/jqplot.mekkoAxisRenderer.js
diff --git a/src/report/jqplot/plugins/jqplot.mekkoAxisRenderer.min.js b/gnucash/report/jqplot/plugins/jqplot.mekkoAxisRenderer.min.js
similarity index 100%
rename from src/report/jqplot/plugins/jqplot.mekkoAxisRenderer.min.js
rename to gnucash/report/jqplot/plugins/jqplot.mekkoAxisRenderer.min.js
diff --git a/src/report/jqplot/plugins/jqplot.mekkoRenderer.js b/gnucash/report/jqplot/plugins/jqplot.mekkoRenderer.js
similarity index 100%
rename from src/report/jqplot/plugins/jqplot.mekkoRenderer.js
rename to gnucash/report/jqplot/plugins/jqplot.mekkoRenderer.js
diff --git a/src/report/jqplot/plugins/jqplot.mekkoRenderer.min.js b/gnucash/report/jqplot/plugins/jqplot.mekkoRenderer.min.js
similarity index 100%
rename from src/report/jqplot/plugins/jqplot.mekkoRenderer.min.js
rename to gnucash/report/jqplot/plugins/jqplot.mekkoRenderer.min.js
diff --git a/src/report/jqplot/plugins/jqplot.meterGaugeRenderer.js b/gnucash/report/jqplot/plugins/jqplot.meterGaugeRenderer.js
similarity index 100%
rename from src/report/jqplot/plugins/jqplot.meterGaugeRenderer.js
rename to gnucash/report/jqplot/plugins/jqplot.meterGaugeRenderer.js
diff --git a/src/report/jqplot/plugins/jqplot.meterGaugeRenderer.min.js b/gnucash/report/jqplot/plugins/jqplot.meterGaugeRenderer.min.js
similarity index 100%
rename from src/report/jqplot/plugins/jqplot.meterGaugeRenderer.min.js
rename to gnucash/report/jqplot/plugins/jqplot.meterGaugeRenderer.min.js
diff --git a/src/report/jqplot/plugins/jqplot.mobile.js b/gnucash/report/jqplot/plugins/jqplot.mobile.js
similarity index 100%
rename from src/report/jqplot/plugins/jqplot.mobile.js
rename to gnucash/report/jqplot/plugins/jqplot.mobile.js
diff --git a/src/report/jqplot/plugins/jqplot.mobile.min.js b/gnucash/report/jqplot/plugins/jqplot.mobile.min.js
similarity index 100%
rename from src/report/jqplot/plugins/jqplot.mobile.min.js
rename to gnucash/report/jqplot/plugins/jqplot.mobile.min.js
diff --git a/src/report/jqplot/plugins/jqplot.ohlcRenderer.js b/gnucash/report/jqplot/plugins/jqplot.ohlcRenderer.js
similarity index 100%
rename from src/report/jqplot/plugins/jqplot.ohlcRenderer.js
rename to gnucash/report/jqplot/plugins/jqplot.ohlcRenderer.js
diff --git a/src/report/jqplot/plugins/jqplot.ohlcRenderer.min.js b/gnucash/report/jqplot/plugins/jqplot.ohlcRenderer.min.js
similarity index 100%
rename from src/report/jqplot/plugins/jqplot.ohlcRenderer.min.js
rename to gnucash/report/jqplot/plugins/jqplot.ohlcRenderer.min.js
diff --git a/src/report/jqplot/plugins/jqplot.pieRenderer.js b/gnucash/report/jqplot/plugins/jqplot.pieRenderer.js
similarity index 100%
rename from src/report/jqplot/plugins/jqplot.pieRenderer.js
rename to gnucash/report/jqplot/plugins/jqplot.pieRenderer.js
diff --git a/src/report/jqplot/plugins/jqplot.pieRenderer.min.js b/gnucash/report/jqplot/plugins/jqplot.pieRenderer.min.js
similarity index 100%
rename from src/report/jqplot/plugins/jqplot.pieRenderer.min.js
rename to gnucash/report/jqplot/plugins/jqplot.pieRenderer.min.js
diff --git a/src/report/jqplot/plugins/jqplot.pointLabels.js b/gnucash/report/jqplot/plugins/jqplot.pointLabels.js
similarity index 100%
rename from src/report/jqplot/plugins/jqplot.pointLabels.js
rename to gnucash/report/jqplot/plugins/jqplot.pointLabels.js
diff --git a/src/report/jqplot/plugins/jqplot.pointLabels.min.js b/gnucash/report/jqplot/plugins/jqplot.pointLabels.min.js
similarity index 100%
rename from src/report/jqplot/plugins/jqplot.pointLabels.min.js
rename to gnucash/report/jqplot/plugins/jqplot.pointLabels.min.js
diff --git a/src/report/jqplot/plugins/jqplot.pyramidAxisRenderer.js b/gnucash/report/jqplot/plugins/jqplot.pyramidAxisRenderer.js
similarity index 100%
rename from src/report/jqplot/plugins/jqplot.pyramidAxisRenderer.js
rename to gnucash/report/jqplot/plugins/jqplot.pyramidAxisRenderer.js
diff --git a/src/report/jqplot/plugins/jqplot.pyramidAxisRenderer.min.js b/gnucash/report/jqplot/plugins/jqplot.pyramidAxisRenderer.min.js
similarity index 100%
rename from src/report/jqplot/plugins/jqplot.pyramidAxisRenderer.min.js
rename to gnucash/report/jqplot/plugins/jqplot.pyramidAxisRenderer.min.js
diff --git a/src/report/jqplot/plugins/jqplot.pyramidGridRenderer.js b/gnucash/report/jqplot/plugins/jqplot.pyramidGridRenderer.js
similarity index 100%
rename from src/report/jqplot/plugins/jqplot.pyramidGridRenderer.js
rename to gnucash/report/jqplot/plugins/jqplot.pyramidGridRenderer.js
diff --git a/src/report/jqplot/plugins/jqplot.pyramidGridRenderer.min.js b/gnucash/report/jqplot/plugins/jqplot.pyramidGridRenderer.min.js
similarity index 100%
rename from src/report/jqplot/plugins/jqplot.pyramidGridRenderer.min.js
rename to gnucash/report/jqplot/plugins/jqplot.pyramidGridRenderer.min.js
diff --git a/src/report/jqplot/plugins/jqplot.pyramidRenderer.js b/gnucash/report/jqplot/plugins/jqplot.pyramidRenderer.js
similarity index 100%
rename from src/report/jqplot/plugins/jqplot.pyramidRenderer.js
rename to gnucash/report/jqplot/plugins/jqplot.pyramidRenderer.js
diff --git a/src/report/jqplot/plugins/jqplot.pyramidRenderer.min.js b/gnucash/report/jqplot/plugins/jqplot.pyramidRenderer.min.js
similarity index 100%
rename from src/report/jqplot/plugins/jqplot.pyramidRenderer.min.js
rename to gnucash/report/jqplot/plugins/jqplot.pyramidRenderer.min.js
diff --git a/src/report/jqplot/plugins/jqplot.trendline.js b/gnucash/report/jqplot/plugins/jqplot.trendline.js
similarity index 100%
rename from src/report/jqplot/plugins/jqplot.trendline.js
rename to gnucash/report/jqplot/plugins/jqplot.trendline.js
diff --git a/src/report/jqplot/plugins/jqplot.trendline.min.js b/gnucash/report/jqplot/plugins/jqplot.trendline.min.js
similarity index 100%
rename from src/report/jqplot/plugins/jqplot.trendline.min.js
rename to gnucash/report/jqplot/plugins/jqplot.trendline.min.js
diff --git a/src/report/jqplot/usage.txt b/gnucash/report/jqplot/usage.txt
similarity index 100%
rename from src/report/jqplot/usage.txt
rename to gnucash/report/jqplot/usage.txt
diff --git a/src/report/locale-specific/CMakeLists.txt b/gnucash/report/locale-specific/CMakeLists.txt
similarity index 100%
rename from src/report/locale-specific/CMakeLists.txt
rename to gnucash/report/locale-specific/CMakeLists.txt
diff --git a/src/report/locale-specific/Makefile.am b/gnucash/report/locale-specific/Makefile.am
similarity index 100%
rename from src/report/locale-specific/Makefile.am
rename to gnucash/report/locale-specific/Makefile.am
diff --git a/gnucash/report/locale-specific/us/CMakeLists.txt b/gnucash/report/locale-specific/us/CMakeLists.txt
new file mode 100644
index 0000000..41da7bd
--- /dev/null
+++ b/gnucash/report/locale-specific/us/CMakeLists.txt
@@ -0,0 +1,59 @@
+ADD_SUBDIRECTORY(test)
+
+SET(locale_reports_us_SOURCES
+  gncmod-locale-reports-us.c
+)
+
+ADD_LIBRARY(gncmod-locale-reports-us ${locale_reports_us_SOURCES})
+
+TARGET_LINK_LIBRARIES(gncmod-locale-reports-us gnc-module gncmod-app-utils gncmod-gnome-utils
+                         ${GUILE_LDFLAGS} ${GLIB2_LDFLAGS})
+
+TARGET_COMPILE_DEFINITIONS(gncmod-locale-reports-us PRIVATE -DG_LOG_DOMAIN=\"gnc.report.locale.us\")
+
+
+INSTALL(TARGETS gncmod-locale-reports-us
+  LIBRARY DESTINATION lib/gnucash
+  ARCHIVE DESTINATION lib/gnucash
+  RUNTIME DESTINATION bin)
+# No headers to install
+
+# Scheme
+
+SET(gncmod_local_reports_us_SCHEME_1 taxtxf.scm taxtxf-de_DE.scm)
+
+
+SET(gncmod_local_reports_us_SCHEME_2 us.scm de_DE.scm)
+
+
+SET(GUILE_MODULES libgnucash/app-utils libgnucash/engine gnucash/gnome-utils gnucash/html gnucash/report/report-system gnucash/tax/us)
+SET(GUILE_LOAD_DIRS  libgnucash/app-utils libgnucash/core-utils libgnucash/engine libgnucash/gnc-module gnucash/gnome-utils gnucash/report/report-system
+                     libgnucash/scm libgnucash/tax/us)
+SET(GUILE_LIBRARY_DIRS libgnucash/engine libgnucash/app-utils libgnucash/core-utils libgnucash/gnc-module gnucash/gnome-utils
+                       gnucash/html gnucash/report/report-system)
+SET(GUILE_DEPENDS   gncmod-html scm-tax-us-1 scm-tax-us-2 scm-report-system-3)
+
+GNC_ADD_SCHEME_TARGETS(scm-report-locale-specific-1
+  "${gncmod_local_reports_us_SCHEME_1}"
+  gnucash/report
+  "${GUILE_MODULES}"
+  "${GUILE_LOAD_DIRS}"
+  "${GUILE_LIBRARY_DIRS}"
+  "${GUILE_DEPENDS}"
+  FALSE
+)
+
+GNC_ADD_SCHEME_TARGETS(scm-report-locale-specific-2
+  "${gncmod_local_reports_us_SCHEME_2}"
+  gnucash/report/locale-specific
+  "${GUILE_MODULES}"
+  "${GUILE_LOAD_DIRS}"
+  "${GUILE_LIBRARY_DIRS}"
+  "scm-report-locale-specific-1;${GUILE_DEPENDS}"
+  FALSE
+)
+
+SET_LOCAL_DIST(locale_specific_us_DIST_local CMakeLists.txt Makefile.am
+        ${locale_reports_us_SOURCES} ${gncmod_local_reports_us_SCHEME_1} ${gncmod_local_reports_us_SCHEME_2})
+
+SET(locale_specific_us_DIST ${locale_specific_us_DIST_local} ${test_locale_specific_us_DIST} PARENT_SCOPE)
diff --git a/gnucash/report/locale-specific/us/Makefile.am b/gnucash/report/locale-specific/us/Makefile.am
new file mode 100644
index 0000000..474e662
--- /dev/null
+++ b/gnucash/report/locale-specific/us/Makefile.am
@@ -0,0 +1,113 @@
+SUBDIRS = . test
+
+pkglib_LTLIBRARIES = libgncmod-locale-reports-us.la
+
+libgncmod_locale_reports_us_la_SOURCES = \
+  gncmod-locale-reports-us.c 
+
+libgncmod_locale_reports_us_la_LDFLAGS = -avoid-version
+
+libgncmod_locale_reports_us_la_LIBADD = \
+  ${top_builddir}/libgnucash/gnc-module/libgnc-module.la \
+  $(top_builddir)/libgnucash/app-utils/libgncmod-app-utils.la \
+  $(top_builddir)/gnucash/gnome-utils/libgncmod-gnome-utils.la \
+  ${GUILE_LIBS} \
+  ${GLIB_LIBS} 
+
+
+AM_CPPFLAGS = \
+  -I${top_srcdir}/common \
+  -I${top_srcdir}/libgnucash/gnc-module \
+  ${GUILE_CFLAGS} ${GLIB_CFLAGS}
+
+## This is unused and therefore no longer installed and/or loaded
+gncscmrptdir = ${GNC_SCM_INSTALL_DIR}/gnucash/report/locale-specific
+gncscmrpt_DATA = us.scm de_DE.scm
+
+gncscmmoddir = ${GNC_SCM_INSTALL_DIR}/gnucash/report/
+gncscmmod_DATA = taxtxf.scm taxtxf-de_DE.scm
+
+if GNUCASH_SEPARATE_BUILDDIR
+#For executing test cases
+SCM_FILE_LINKS = \
+  ${gncscmrpt_DATA} \
+  ${gncscmmod_DATA}
+endif
+
+.scm-links:
+	$(RM) -rf gnucash
+	mkdir -p  gnucash
+	mkdir -p  gnucash/report
+	mkdir -p  gnucash/report/locale-specific
+if GNUCASH_SEPARATE_BUILDDIR
+	for X in ${SCM_FILE_LINKS} ; do \
+	  $(LN_S) -f ${srcdir}/$$X . ; \
+	done
+endif
+	( cd gnucash/report/locale-specific; for A in $(gncscmrpt_DATA) ; do $(LN_S) -f ../../../$$A . ; done )
+	( cd gnucash/report; for A in $(gncscmmod_DATA) ; do $(LN_S) -f ../../$$A . ; done )
+if ! OS_WIN32
+# Windows knows no "ln -s" but uses "cp": must copy every time (see bug #566567).
+	touch .scm-links
+endif
+
+if GNC_HAVE_GUILE_2
+GUILE_COMPILE_ENV = \
+  --gnc-module-dir ${top_builddir}/libgnucash/app-utils \
+  --gnc-module-dir ${top_builddir}/libgnucash/engine \
+  --gnc-module-dir ${top_builddir}/gnucash/gnome-utils \
+  --gnc-module-dir ${top_builddir}/gnucash/html \
+  --gnc-module-dir ${top_builddir}/gnucash/report/report-system \
+  --gnc-module-dir ${top_builddir}/gnucash/report/locale-specific/us \
+  --gnc-module-dir ${top_builddir}/libgnucash/tax/us \
+  --guile-load-dir ${top_builddir}/libgnucash/app-utils \
+  --guile-load-dir ${top_builddir}/libgnucash/core-utils \
+  --guile-load-dir ${top_builddir}/libgnucash/engine \
+  --guile-load-dir ${top_builddir}/libgnucash/gnc-module \
+  --guile-load-dir ${top_builddir}/gnucash/gnome-utils \
+  --guile-load-dir ${top_builddir}/gnucash/report/report-system \
+  --guile-load-dir ${top_builddir}/gnucash/report/locale-specific/us \
+  --guile-load-dir ${top_builddir}/libgnucash/scm \
+  --guile-load-dir ${top_builddir}/libgnucash/tax/us \
+  --library-dir    ${top_builddir}/libgnucash/engine \
+  --library-dir    ${top_builddir}/libgnucash/app-utils \
+  --library-dir    ${top_builddir}/libgnucash/core-utils \
+  --library-dir    ${top_builddir}/libgnucash/gnc-module \
+  --library-dir    ${top_builddir}/gnucash/gnome-utils \
+  --library-dir    ${top_builddir}/libgnucash/backend/xml \
+  --library-dir    ${top_builddir}/libgnucash/backend/sql \
+  --library-dir    ${top_builddir}/gnucash/html \
+  --library-dir    ${top_builddir}/gnucash/report/report-system \
+  --library-dir    ${top_builddir}/gnucash/report/locale-specific/us
+
+%.go : %.scm .scm-links $(pkglib_LTLIBRARIES)
+	GNC_UNINSTALLED=yes \
+	GNC_BUILDDIR=${top_builddir} \
+	$(shell ${abs_top_srcdir}/common/gnc-test-env.pl --noexports ${GUILE_COMPILE_ENV}) \
+	$(GUILD) compile -o $@ $<
+
+gncscmmodcachedir = ${pkglibdir}/scm/ccache/@GUILE_EFFECTIVE_VERSION@/gnucash/report
+gncscmmodcache_DATA = $(gncscmmod_DATA:.scm=.go)
+
+gncscmrptcachedir = ${pkglibdir}/scm/ccache/@GUILE_EFFECTIVE_VERSION@/gnucash/report/locale-specific
+gncscmrptcache_DATA = $(gncscmrpt_DATA:.scm=.go)
+endif
+
+clean-local:
+	$(RM) -rf gnucash
+
+noinst_DATA = .scm-links
+
+EXTRA_DIST = \
+  ${gncscmmod_DATA} \
+  ${gncscmrpt_DATA} \
+  CMakeLists.txt
+
+CLEANFILES = \
+	.scm-links \
+	${gncscmmodcache_DATA} \
+	${gncscmrptcache_DATA}
+
+DISTCLEANFILES = ${SCM_FILE_LINKS}
+
+AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.report.locale.us\"
diff --git a/src/report/locale-specific/us/de_DE.scm b/gnucash/report/locale-specific/us/de_DE.scm
similarity index 100%
rename from src/report/locale-specific/us/de_DE.scm
rename to gnucash/report/locale-specific/us/de_DE.scm
diff --git a/src/report/locale-specific/us/gncmod-locale-reports-us.c b/gnucash/report/locale-specific/us/gncmod-locale-reports-us.c
similarity index 100%
rename from src/report/locale-specific/us/gncmod-locale-reports-us.c
rename to gnucash/report/locale-specific/us/gncmod-locale-reports-us.c
diff --git a/src/report/locale-specific/us/taxtxf-de_DE.scm b/gnucash/report/locale-specific/us/taxtxf-de_DE.scm
similarity index 100%
rename from src/report/locale-specific/us/taxtxf-de_DE.scm
rename to gnucash/report/locale-specific/us/taxtxf-de_DE.scm
diff --git a/src/report/locale-specific/us/taxtxf.scm b/gnucash/report/locale-specific/us/taxtxf.scm
similarity index 100%
rename from src/report/locale-specific/us/taxtxf.scm
rename to gnucash/report/locale-specific/us/taxtxf.scm
diff --git a/src/report/locale-specific/us/test/CMakeLists.txt b/gnucash/report/locale-specific/us/test/CMakeLists.txt
similarity index 100%
rename from src/report/locale-specific/us/test/CMakeLists.txt
rename to gnucash/report/locale-specific/us/test/CMakeLists.txt
diff --git a/gnucash/report/locale-specific/us/test/Makefile.am b/gnucash/report/locale-specific/us/test/Makefile.am
new file mode 100644
index 0000000..18c7ff9
--- /dev/null
+++ b/gnucash/report/locale-specific/us/test/Makefile.am
@@ -0,0 +1,29 @@
+TESTS = test-link-module
+
+GNC_TEST_DEPS = --gnc-module-dir ${top_builddir}/libgnucash/engine \
+  --gnc-module-dir ${top_builddir}/libgnucash/tax/us \
+  --gnc-module-dir ${top_builddir}/gnucash/report/report-system \
+  --gnc-module-dir ${top_builddir}/gnucash/report/locale-specific/us \
+  --guile-load-dir ${top_builddir}/libgnucash/gnc-module \
+  --guile-load-dir ${top_builddir}/libgnucash/engine \
+  --guile-load-dir ${top_builddir}/libgnucash/tax/us \
+  --library-dir    ${top_builddir}/libgnucash/core-utils \
+  --library-dir    ${top_builddir}/libgnucash/gnc-module \
+  --library-dir    ${top_builddir}/libgnucash/engine \
+  --library-dir    ${top_builddir}/libgnucash/app-utils
+
+TESTS_ENVIRONMENT = \
+  GUILE_WARN_DEPRECATED=no \
+  GUILE="${GUILE}" \
+  $(shell ${abs_top_srcdir}/common/gnc-test-env.pl --noexports ${GNC_TEST_DEPS})
+
+check_PROGRAMS = test-link-module
+
+testit:
+	${TESTS_ENVIRONMENT} gdb guile
+
+test_link_module_SOURCES = test-link-module.c
+test_link_module_LDADD= \
+  ${top_builddir}/gnucash/report/locale-specific/us/libgncmod-locale-reports-us.la
+
+EXTRA_DIST = CMakeLists.txt
diff --git a/src/report/locale-specific/us/test/test-link-module.c b/gnucash/report/locale-specific/us/test/test-link-module.c
similarity index 100%
rename from src/report/locale-specific/us/test/test-link-module.c
rename to gnucash/report/locale-specific/us/test/test-link-module.c
diff --git a/src/report/locale-specific/us/test/test-load-module.in b/gnucash/report/locale-specific/us/test/test-load-module.in
similarity index 100%
rename from src/report/locale-specific/us/test/test-load-module.in
rename to gnucash/report/locale-specific/us/test/test-load-module.in
diff --git a/src/report/locale-specific/us/us.scm b/gnucash/report/locale-specific/us/us.scm
similarity index 100%
rename from src/report/locale-specific/us/us.scm
rename to gnucash/report/locale-specific/us/us.scm
diff --git a/gnucash/report/report-gnome/CMakeLists.txt b/gnucash/report/report-gnome/CMakeLists.txt
new file mode 100644
index 0000000..3df3aa9
--- /dev/null
+++ b/gnucash/report/report-gnome/CMakeLists.txt
@@ -0,0 +1,81 @@
+ADD_SUBDIRECTORY(test)
+
+SET (report_gnome_HEADERS
+  dialog-report-column-view.h
+  dialog-custom-report.h
+  dialog-report-style-sheet.h
+  gnc-plugin-page-report.h
+  window-report.h
+)
+
+IF (BUILDING_FROM_VCS)
+  SET (SWIG_REPORT_GNOME_C ${CMAKE_CURRENT_BINARY_DIR}/swig-report-gnome.c)
+  GNC_ADD_SWIG_COMMAND (swig-report-gnome-c ${SWIG_REPORT_GNOME_C} ${CMAKE_CURRENT_SOURCE_DIR}/report-gnome.i ${report_gnome_HEADERS})
+ELSE()
+  SET (SWIG_REPORT_GNOME_C swig-report-gnome.c)
+ENDIF()
+
+SET (report_gnome_SOURCES
+  dialog-report-column-view.c
+  dialog-custom-report.c
+  dialog-report-style-sheet.c
+  gnc-plugin-page-report.c
+  gncmod-report-gnome.c
+  window-report.c
+)
+
+ADD_LIBRARY (gncmod-report-gnome
+  ${report_gnome_SOURCES}
+  ${report_gnome_HEADERS}
+  ${SWIG_REPORT_GNOME_C}
+)
+TARGET_LINK_LIBRARIES(gncmod-report-gnome gncmod-report-system gncmod-html gncmod-gnome-utils
+      ${GUILE_LDFLAGS} ${GTK3_LDFLAGS})
+
+TARGET_COMPILE_DEFINITIONS (gncmod-report-gnome PRIVATE -DG_LOG_DOMAIN=\"gnc.report.gui\")
+
+TARGET_INCLUDE_DIRECTORIES(gncmod-report-gnome PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
+
+INSTALL(TARGETS gncmod-report-gnome
+  LIBRARY DESTINATION lib/gnucash
+  ARCHIVE DESTINATION lib/gnucash
+  RUNTIME DESTINATION bin)
+
+INSTALL(FILES ${report_gnome_HEADERS} DESTINATION include/gnucash)
+
+# Scheme
+
+SET(report_gnome_SCHEME
+    report-gnome.scm
+)
+
+SET(GUILE_OUTPUT_DIR   gnucash/report)
+SET(GUILE_MODULES      libgnucash/app-utils libgnucash/scm libgnucash/engine libgnucash/gnc-module gnucash/gnome-utils gnucash/reports/report-system gnucash/report/utility-reports)
+SET(GUILE_LOAD_DIRS    libgnucash/app-utils libgnucash/gnc-module libgnucash/engine libgnucash/scm libgnucash/core-utils gnucash/gnome-utils)
+SET(GUILE_LIBRARY_DIRS libgnucash/app-utils libgnucash/core-utils libgnucash/engine libgnucash/gnc-module gnucash/gnome-utils gnucash/report-gnome)
+SET(GUILE_DEPENDS      gncmod-report-gnome gncmod-engine scm-app-utils scm-gnome-utils scm-core-utils scm-gnc-module scm-scm scm-standard-reports scm-business-reports scm-utility-reports)
+
+GNC_ADD_SCHEME_TARGETS(scm-report-gnome
+    "${report_gnome_SCHEME}"
+    ${GUILE_OUTPUT_DIR}
+    "${GUILE_MODULES}"
+    "${GUILE_LOAD_DIRS}"
+    "${GUILE_LIBRARY_DIRS}"
+    "${GUILE_DEPENDS}"
+    FALSE
+)
+
+SET(report_gnome_GLADE dialog-custom-report.glade dialog-report.glade)
+
+INSTALL(FILES ${report_gnome_GLADE} DESTINATION share/gnucash/gtkbuilder)
+
+SET(report_gnome_UI gnc-plugin-page-report-ui.xml)
+
+INSTALL(FILES ${report_gnome_UI} DESTINATION share/gnucash/ui)
+
+FILE(COPY ${report_gnome_UI} DESTINATION ${DATADIR_BUILD}/gnucash/ui)
+FILE(COPY ${report_gnome_GLADE} DESTINATION ${DATADIR_BUILD}/gnucash/gtkbuilder)
+
+SET_LOCAL_DIST(report_gnome_DIST_local CMakeLists.txt Makefile.am report-gnome.i ${report_gnome_HEADERS} ${report_gnome_SOURCES}
+        ${report_gnome_SCHEME} ${report_gnome_GLADE} ${report_gnome_UI})
+SET(report_gnome_DIST ${report_gnome_DIST_local} ${test_report_gnome_DIST} PARENT_SCOPE)
diff --git a/gnucash/report/report-gnome/Makefile.am b/gnucash/report/report-gnome/Makefile.am
new file mode 100644
index 0000000..c52927d
--- /dev/null
+++ b/gnucash/report/report-gnome/Makefile.am
@@ -0,0 +1,147 @@
+SUBDIRS = . test
+
+pkglib_LTLIBRARIES = libgncmod-report-gnome.la
+
+AM_CPPFLAGS = \
+  -I${top_srcdir}/common \
+  -I${top_builddir}/common \
+  -I${top_srcdir}/libgnucash/core-utils \
+  -I${top_srcdir}/libgnucash/gnc-module \
+  -I${top_srcdir}/libgnucash/engine \
+  -I${top_srcdir}/libgnucash/app-utils \
+  -I${top_srcdir}/gnucash/gnome-utils \
+  -I${top_srcdir}/gnucash/gnome \
+  -I${top_srcdir}/gnucash/html \
+  -I${top_srcdir}/gnucash/report/report-system \
+  ${GUILE_CFLAGS} \
+  ${GTK_CFLAGS} \
+  ${GLIB_CFLAGS}
+
+libgncmod_report_gnome_la_SOURCES = \
+  swig-report-gnome.c \
+  dialog-report-column-view.c \
+  dialog-custom-report.c \
+  dialog-report-style-sheet.c \
+  gnc-plugin-page-report.c \
+  gncmod-report-gnome.c \
+  window-report.c
+
+gncincludedir = ${GNC_INCLUDE_DIR}
+gncinclude_HEADERS = \
+  dialog-report-column-view.h \
+  dialog-custom-report.h \
+  dialog-report-style-sheet.h \
+  gnc-plugin-page-report.h \
+  window-report.h
+
+libgncmod_report_gnome_la_LDFLAGS = -avoid-version
+
+libgncmod_report_gnome_la_LIBADD = \
+  ${top_builddir}/libgnucash/core-utils/libgnc-core-utils.la \
+  ${top_builddir}/libgnucash/gnc-module/libgnc-module.la \
+  ${top_builddir}/libgnucash/engine/libgncmod-engine.la \
+  ${top_builddir}/libgnucash/app-utils/libgncmod-app-utils.la \
+  ${top_builddir}/gnucash/gnome-utils/libgncmod-gnome-utils.la \
+  ${top_builddir}/gnucash/html/libgncmod-html.la \
+  ${top_builddir}/gnucash/report/report-system/libgncmod-report-system.la \
+  ${GUILE_LIBS} \
+  ${GLIB_LIBS}
+
+if BUILDING_FROM_VCS
+swig-report-gnome.c: report-gnome.i ${top_srcdir}/common/base-typemaps.i
+	$(SWIG) -guile $(SWIG_ARGS) -Linkage module \
+	-I${top_srcdir}/common -o $@ $<
+if ! OS_WIN32
+if ! SWIG_DIST_FAIL
+	if ! `grep "define scm_from_utf8_string" $@ > /dev/null 2>&1`; then \
+	  patch $@ $(top_srcdir)/common/swig-utf8.patch; \
+	fi
+endif
+endif
+endif
+
+gncscmmoddir = ${GNC_SCM_INSTALL_DIR}/gnucash/report
+gncscmmod_DATA = report-gnome.scm
+
+noinst_DATA = .scm-links
+
+gtkbuilderdir = $(GNC_GTKBUILDER_DIR)
+gtkbuilder_DATA = \
+  dialog-report.glade \
+  dialog-custom-report.glade
+
+uidir = $(GNC_UI_DIR)
+
+ui_DATA = \
+	gnc-plugin-page-report-ui.xml
+
+EXTRA_DIST = \
+  report-gnome.i \
+  ${gtkbuilder_DATA} \
+  ${gncscmmod_DATA} \
+  ${ui_DATA} \
+  CMakeLists.txt
+
+if GNUCASH_SEPARATE_BUILDDIR
+#Only needed when srcdir and builddir are different
+# for running
+SCM_FILE_LINKS = ${gncscmmod_DATA}
+endif
+
+.scm-links: 
+	$(RM) -rf gnucash
+	mkdir -p  gnucash
+	mkdir -p  gnucash/report
+if GNUCASH_SEPARATE_BUILDDIR
+	for X in ${SCM_FILE_LINKS} ; do \
+	  $(LN_S) -f ${srcdir}/$$X . ; \
+	done
+endif
+	( cd gnucash/report; for A in $(gncscmmod_DATA) ; do $(LN_S) -f ../../$$A . ; done )
+if ! OS_WIN32
+# Windows knows no "ln -s" but uses "cp": must copy every time (see bug #566567).
+	touch .scm-links
+endif
+
+if GNC_HAVE_GUILE_2
+GUILE_COMPILE_ENV = \
+  --gnc-module-dir ${top_builddir}/libgnucash/app-utils \
+  --gnc-module-dir ${top_builddir}/libgnucash/engine \
+  --gnc-module-dir ${top_builddir}/gnucash/html \
+  --gnc-module-dir ${top_builddir}/gnucash/report/report-system \
+  --guile-load-dir ${top_builddir}/libgnucash/app-utils \
+  --guile-load-dir ${top_builddir}/libgnucash/core-utils \
+  --guile-load-dir ${top_builddir}/libgnucash/engine \
+  --guile-load-dir ${top_builddir}/libgnucash/gnc-module \
+  --guile-load-dir ${top_builddir}/gnucash/gnome-utils \
+  --guile-load-dir ${top_builddir}/gnucash/report/report-system \
+  --guile-load-dir ${top_builddir}/gnucash/report/utility-reports \
+  --guile-load-dir ${top_builddir}/libgnucash/scm \
+  --library-dir    ${top_builddir}/libgnucash/engine \
+  --library-dir    ${top_builddir}/libgnucash/app-utils \
+  --library-dir    ${top_builddir}/libgnucash/core-utils \
+  --library-dir    ${top_builddir}/libgnucash/gnc-module \
+  --library-dir    ${top_builddir}/gnucash/gnome-utils \
+  --library-dir    ${top_builddir}/libgnucash/backend/xml \
+  --library-dir    ${top_builddir}/libgnucash/backend/sql \
+  --library-dir    ${top_builddir}/gnucash/html \
+  --library-dir    ${top_builddir}/gnucash/report/report-system \
+  --library-dir    ${top_builddir}/gnucash/report/report-gnome
+
+%.go : %.scm .scm-links $(pkglib_LTLIBRARIES)
+	GNC_UNINSTALLED=yes \
+	GNC_BUILDDIR=${top_builddir} \
+	$(shell ${abs_top_srcdir}/common/gnc-test-env.pl --noexports ${GUILE_COMPILE_ENV}) \
+	$(GUILD) compile -o $@ $<
+
+gncscmmodcachedir = ${pkglibdir}/scm/ccache/@GUILE_EFFECTIVE_VERSION@/gnucash/report
+gncscmmodcache_DATA = $(gncscmmod_DATA:.scm=.go)
+endif
+
+clean-local:
+	rm -rf gnucash
+
+CLEANFILES = report .scm-links ${SCM_FILE_LINKS} ${gncscmmodcache_DATA}
+MAINTAINERCLEANFILES = swig-report-gnome.c
+
+AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.report.gui\"
diff --git a/src/report/report-gnome/dialog-custom-report.c b/gnucash/report/report-gnome/dialog-custom-report.c
similarity index 100%
rename from src/report/report-gnome/dialog-custom-report.c
rename to gnucash/report/report-gnome/dialog-custom-report.c
diff --git a/src/report/report-gnome/dialog-custom-report.glade b/gnucash/report/report-gnome/dialog-custom-report.glade
similarity index 100%
rename from src/report/report-gnome/dialog-custom-report.glade
rename to gnucash/report/report-gnome/dialog-custom-report.glade
diff --git a/src/report/report-gnome/dialog-custom-report.h b/gnucash/report/report-gnome/dialog-custom-report.h
similarity index 100%
rename from src/report/report-gnome/dialog-custom-report.h
rename to gnucash/report/report-gnome/dialog-custom-report.h
diff --git a/src/report/report-gnome/dialog-report-column-view.c b/gnucash/report/report-gnome/dialog-report-column-view.c
similarity index 100%
rename from src/report/report-gnome/dialog-report-column-view.c
rename to gnucash/report/report-gnome/dialog-report-column-view.c
diff --git a/src/report/report-gnome/dialog-report-column-view.h b/gnucash/report/report-gnome/dialog-report-column-view.h
similarity index 100%
rename from src/report/report-gnome/dialog-report-column-view.h
rename to gnucash/report/report-gnome/dialog-report-column-view.h
diff --git a/src/report/report-gnome/dialog-report-style-sheet.c b/gnucash/report/report-gnome/dialog-report-style-sheet.c
similarity index 100%
rename from src/report/report-gnome/dialog-report-style-sheet.c
rename to gnucash/report/report-gnome/dialog-report-style-sheet.c
diff --git a/src/report/report-gnome/dialog-report-style-sheet.h b/gnucash/report/report-gnome/dialog-report-style-sheet.h
similarity index 100%
rename from src/report/report-gnome/dialog-report-style-sheet.h
rename to gnucash/report/report-gnome/dialog-report-style-sheet.h
diff --git a/src/report/report-gnome/dialog-report.glade b/gnucash/report/report-gnome/dialog-report.glade
similarity index 100%
rename from src/report/report-gnome/dialog-report.glade
rename to gnucash/report/report-gnome/dialog-report.glade
diff --git a/src/report/report-gnome/gnc-plugin-page-report-ui.xml b/gnucash/report/report-gnome/gnc-plugin-page-report-ui.xml
similarity index 100%
rename from src/report/report-gnome/gnc-plugin-page-report-ui.xml
rename to gnucash/report/report-gnome/gnc-plugin-page-report-ui.xml
diff --git a/gnucash/report/report-gnome/gnc-plugin-page-report.c b/gnucash/report/report-gnome/gnc-plugin-page-report.c
new file mode 100644
index 0000000..9712193
--- /dev/null
+++ b/gnucash/report/report-gnome/gnc-plugin-page-report.c
@@ -0,0 +1,1952 @@
+/* gnc-plugin-page-report.c
+ * Copyright (C) 2004 Joshua Sled <jsled at asynchronous.org>
+ * Copyright (C) 2005 David Hampton <hampton at employees.org>
+ *
+ * Originally from window-report.c:
+ * Copyright (C) 1997 Robin D. Clark
+ * Copyright (C) 1998 Linas Vepstas
+ * Copyright (C) 1999 Jeremy Collins ( gtk-xmhtml port )
+ * Copyright (C) 2000 Dave Peticolas
+ * Copyright (C) 2000 Bill Gribble
+ *
+ * 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 at gnu.org
+ */
+
+/** @addtogroup GUI
+    @{ */
+/** @addtogroup GuiReport Reports
+    @{ */
+/** @file gnc-plugin-page-report.c
+    @brief  Report page.
+    @author Copyright (C) 2004 Joshua Sled <jsled at asynchronous.org>
+    @author Copyright (C) 2005 David Hampton <hampton at employees.org>
+*/
+
+#include "config.h"
+
+#include <gtk/gtk.h>
+#include <glib/gi18n.h>
+#include <glib/gstdio.h>
+#include <libguile.h>
+#include <sys/stat.h>
+#include <errno.h>
+
+#include <gnc-glib-utils.h>
+#include "gfec.h"
+#include "dialog-custom-report.h"
+#include "dialog-utils.h"
+#include "gnc-component-manager.h"
+#include "gnc-engine.h"
+#include "gnc-gnome-utils.h"
+#include "gnc-guile-utils.h"
+#include "gnc-html-history.h"
+#include "gnc-html.h"
+#include "gnc-html-factory.h"
+#include "gnc-file.h"
+#include "gnc-filepath-utils.h"
+#include "gnc-plugin.h"
+#include "gnc-plugin-page-report.h"
+#include "gnc-plugin-file-history.h"
+#include "gnc-prefs.h"
+#include "gnc-report.h"
+#include "gnc-session.h"
+#include "gnc-ui-util.h"
+#include "gnc-ui.h"
+#include "gnc-window.h"
+#include "option-util.h"
+#include "window-report.h"
+#include "swig-runtime.h"
+#include "business-options.h"
+#include "gnc-icons.h"
+#include "print-session.h"
+
+#define WINDOW_REPORT_CM_CLASS "window-report"
+
+/* NW: you can add GNC_MOD_REPORT to gnc-engine.h
+or simply define it locally. Any unique string with
+a gnucash- prefix will do. Then just set a log level
+with qof_log_set_level().*/
+static QofLogModule log_module = GNC_MOD_GUI;
+
+static GObjectClass *parent_class = NULL;
+
+// A static GHashTable to record the usage count for each printer
+// output name. FIXME: Currently this isn't cleaned up at program
+// shutdown because there isn't a place to easily insert a finalize()
+// function for this. Oh well.
+static GHashTable *static_report_printnames = NULL;
+
+// Property-id values.
+enum
+{
+    PROP_0,
+    PROP_REPORT_ID,
+};
+
+typedef struct GncPluginPageReportPrivate
+{
+    /// The report-id
+    int reportId;
+    gint component_manager_id;
+
+    /// The report which this Page is satisfying
+    SCM cur_report;
+    /// The Option DB for this report.
+    GNCOptionDB *cur_odb;
+    SCM option_change_cb_id;
+
+    /* initial_report is special; it's the one that's saved and
+     * restored.  The name_change_callback only gets called when
+     * the initial_report name is changed. */
+    SCM          initial_report;
+    GNCOptionDB  * initial_odb;
+    SCM          name_change_cb_id;
+
+    /* keep a list of edited reports so that we can destroy them when
+     * the window is closed. */
+    SCM          edited_reports;
+
+    /* The page is in the process of reloading the html */
+    gboolean	reloading;
+
+    /// the gnc_html abstraction this PluginPage contains
+//        gnc_html *html;
+    GncHtml *html;
+
+    /// the container the above HTML widget is in.
+    GtkContainer *container;
+} GncPluginPageReportPrivate;
+
+#define GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(o)  \
+   (G_TYPE_INSTANCE_GET_PRIVATE ((o), GNC_TYPE_PLUGIN_PAGE_REPORT, GncPluginPageReportPrivate))
+
+static void gnc_plugin_page_report_class_init( GncPluginPageReportClass *klass );
+static void gnc_plugin_page_report_init( GncPluginPageReport *plugin_page );
+static GObject *gnc_plugin_page_report_constructor(GType this_type, guint n_properties, GObjectConstructParam *properties);
+static void gnc_plugin_page_report_finalize (GObject *object);
+static void gnc_plugin_page_report_setup( GncPluginPage *ppage );
+
+static void gnc_plugin_page_report_constr_init(GncPluginPageReport *plugin_page, gint reportId);
+
+static GtkWidget* gnc_plugin_page_report_create_widget( GncPluginPage *plugin_page );
+static void gnc_plugin_page_report_destroy_widget( GncPluginPage *plugin_page );
+static void gnc_plugin_page_report_save_page (GncPluginPage *plugin_page, GKeyFile *file, const gchar *group);
+static GncPluginPage *gnc_plugin_page_report_recreate_page (GtkWidget *window, GKeyFile *file, const gchar *group);
+static void gnc_plugin_page_report_name_changed (GncPluginPage *page, const gchar *name);
+static void gnc_plugin_page_report_update_edit_menu (GncPluginPage *page, gboolean hide);
+static gboolean gnc_plugin_page_report_finish_pending (GncPluginPage *page);
+
+static int gnc_plugin_page_report_check_urltype(URLType t);
+//static void gnc_plugin_page_report_load_cb(gnc_html * html, URLType type,
+static void gnc_plugin_page_report_load_cb(GncHtml * html, URLType type,
+        const gchar * location, const gchar * label,
+        gpointer data);
+static void gnc_plugin_page_report_refresh (gpointer data);
+static void gnc_plugin_page_report_set_fwd_button(GncPluginPageReport * page, int enabled);
+static void gnc_plugin_page_report_set_back_button(GncPluginPageReport * page, int enabled);
+static void gnc_plugin_page_report_history_destroy_cb(gnc_html_history_node * node, gpointer user_data);
+static void close_handler(gpointer user_data);
+void gnc_plugin_page_report_destroy(GncPluginPageReportPrivate *priv);
+static void gnc_plugin_page_report_option_change_cb(gpointer data);
+
+void gnc_plugin_page_report_remove_edited_report(GncPluginPageReportPrivate *priv, SCM report);
+void gnc_plugin_page_report_add_edited_report(GncPluginPageReportPrivate *priv, SCM report);
+void gnc_plugin_page_report_raise_editor(SCM report);
+
+static void gnc_plugin_page_report_forw_cb(GtkAction *action, GncPluginPageReport *rep);
+static void gnc_plugin_page_report_back_cb(GtkAction *action, GncPluginPageReport *rep);
+static void gnc_plugin_page_report_reload_cb(GtkAction *action, GncPluginPageReport *rep);
+static void gnc_plugin_page_report_stop_cb(GtkAction *action, GncPluginPageReport *rep);
+static void gnc_plugin_page_report_save_cb(GtkAction *action, GncPluginPageReport *rep);
+static void gnc_plugin_page_report_save_as_cb(GtkAction *action, GncPluginPageReport *rep);
+static void gnc_plugin_page_report_export_cb(GtkAction *action, GncPluginPageReport *rep);
+static void gnc_plugin_page_report_options_cb(GtkAction *action, GncPluginPageReport *rep);
+static void gnc_plugin_page_report_print_cb(GtkAction *action, GncPluginPageReport *rep);
+static void gnc_plugin_page_report_exportpdf_cb(GtkAction *action, GncPluginPageReport *rep);
+static void gnc_plugin_page_report_copy_cb(GtkAction *action, GncPluginPageReport *rep);
+
+GType
+gnc_plugin_page_report_get_type (void)
+{
+    static GType gnc_plugin_page_report_type = 0;
+
+    if (gnc_plugin_page_report_type == 0)
+    {
+        static const GTypeInfo our_info =
+        {
+            sizeof (GncPluginPageReportClass),
+            NULL,
+            NULL,
+            (GClassInitFunc) gnc_plugin_page_report_class_init,
+            NULL,
+            NULL,
+            sizeof (GncPluginPageReport),
+            0,
+            (GInstanceInitFunc) gnc_plugin_page_report_init
+        };
+
+        gnc_plugin_page_report_type = g_type_register_static (GNC_TYPE_PLUGIN_PAGE,
+                                      "GncPluginPageReport",
+                                      &our_info, 0);
+    }
+
+    return gnc_plugin_page_report_type;
+}
+
+static void
+gnc_plugin_page_report_get_property( GObject *obj,
+                                     guint prop_id,
+                                     GValue *value,
+                                     GParamSpec *pspec )
+{
+    GncPluginPageReport *rep;
+    GncPluginPageReportPrivate *priv;
+
+    rep = GNC_PLUGIN_PAGE_REPORT( obj );
+    priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(rep);
+
+    switch ( prop_id )
+    {
+    case PROP_REPORT_ID:
+        g_value_set_int( value, priv->reportId );
+        break;
+    default:
+        PERR( "Unknown property id %d", prop_id );
+        break;
+    }
+}
+
+static void
+gnc_plugin_page_report_set_property( GObject *obj,
+                                     guint prop_id,
+                                     const GValue *value,
+                                     GParamSpec *pspec )
+{
+    GncPluginPageReport *rep;
+    GncPluginPageReportPrivate *priv;
+
+    rep = GNC_PLUGIN_PAGE_REPORT( obj );
+    priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(rep);
+
+    DEBUG( "setting property with id %d / %p to value %d",
+           prop_id, priv, g_value_get_int( value ) );
+
+    switch ( prop_id )
+    {
+    case PROP_REPORT_ID:
+        priv->reportId = g_value_get_int( value );
+        break;
+    default:
+        PERR( "unknown property id %d", prop_id );
+        break;
+    }
+
+}
+
+static void
+gnc_plugin_page_report_class_init (GncPluginPageReportClass *klass)
+{
+    GObjectClass *object_class = G_OBJECT_CLASS (klass);
+    GncPluginPageClass *gnc_plugin_page_class = GNC_PLUGIN_PAGE_CLASS(klass);
+
+    parent_class = g_type_class_peek_parent (klass);
+
+    object_class->constructor = gnc_plugin_page_report_constructor;
+    object_class->finalize = gnc_plugin_page_report_finalize;
+
+    object_class->set_property = gnc_plugin_page_report_set_property;
+    object_class->get_property = gnc_plugin_page_report_get_property;
+
+    gnc_plugin_page_class->tab_icon        = GNC_ICON_ACCOUNT_REPORT;
+    gnc_plugin_page_class->plugin_name     = GNC_PLUGIN_PAGE_REPORT_NAME;
+
+    gnc_plugin_page_class->create_widget   = gnc_plugin_page_report_create_widget;
+    gnc_plugin_page_class->destroy_widget  = gnc_plugin_page_report_destroy_widget;
+    gnc_plugin_page_class->save_page       = gnc_plugin_page_report_save_page;
+    gnc_plugin_page_class->recreate_page   = gnc_plugin_page_report_recreate_page;
+    gnc_plugin_page_class->page_name_changed = gnc_plugin_page_report_name_changed;
+    gnc_plugin_page_class->update_edit_menu_actions = gnc_plugin_page_report_update_edit_menu;
+    gnc_plugin_page_class->finish_pending   = gnc_plugin_page_report_finish_pending;
+
+    g_type_class_add_private(klass, sizeof(GncPluginPageReportPrivate));
+
+    // create the "reportId" property
+    g_object_class_install_property( object_class,
+                                     PROP_REPORT_ID,
+                                     g_param_spec_int( "report-id",
+                                             _("The numeric ID of the report."),
+                                             _("The numeric ID of the report."),
+                                             -1, G_MAXINT, -1, G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE ) );
+
+    /* JSLED: report-selected?
+    	plugin_page_signals[ACCOUNT_SELECTED] =
+    	  g_signal_new ("account_selected",
+    			G_OBJECT_CLASS_TYPE (object_class),
+    			G_SIGNAL_RUN_FIRST,
+    			G_STRUCT_OFFSET (GncPluginPageReportClass, account_selected),
+    			NULL, NULL,
+    			g_cclosure_marshal_VOID__POINTER,
+    			G_TYPE_NONE, 1,
+    			G_TYPE_POINTER);
+    */
+
+    // Also initialize the report name usage count table
+    if (!static_report_printnames)
+        static_report_printnames = g_hash_table_new_full(g_str_hash,
+                                   g_str_equal, g_free, NULL);
+}
+
+static void
+gnc_plugin_page_report_finalize (GObject *object)
+{
+    g_return_if_fail (GNC_IS_PLUGIN_PAGE_REPORT (object));
+
+    ENTER("object %p", object);
+    G_OBJECT_CLASS (parent_class)->finalize (object);
+    LEAVE(" ");
+}
+
+static void
+gnc_plugin_page_report_set_progressbar (GncPluginPage *page, gboolean set)
+{
+    GtkWidget *progressbar;
+    GtkAllocation allocation;
+
+    progressbar = gnc_window_get_progressbar (GNC_WINDOW(page->window));
+    gtk_widget_get_allocation (GTK_WIDGET(progressbar), &allocation); 
+
+    // this sets the minimum size of the progressbar to that allocated
+    if (set)
+        gtk_widget_set_size_request (GTK_WIDGET(progressbar), -1, allocation.height);
+    else
+        gtk_widget_set_size_request (GTK_WIDGET(progressbar), -1, -1); //reset
+}
+
+static gboolean
+gnc_plugin_page_report_load_uri (GncPluginPage *page)
+{
+    GncPluginPageReport *report;
+    GncPluginPageReportPrivate *priv;
+    URLType type;
+    char * id_name;
+    char * child_name;
+    char * url_location = NULL;
+    char * url_label = NULL;
+
+    report = GNC_PLUGIN_PAGE_REPORT(page);
+    priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(report);
+
+    // FIXME.  This is f^-1(f(x)), isn't it?
+    DEBUG( "Load uri id=%d", priv->reportId );
+    id_name = g_strdup_printf("id=%d", priv->reportId );
+    child_name = gnc_build_url( URL_TYPE_REPORT, id_name, NULL );
+    type = gnc_html_parse_url( priv->html, child_name, &url_location, &url_label);
+    DEBUG( "passing id_name=[%s] child_name=[%s] type=[%s], location=[%s], label=[%s]",
+           id_name, child_name ? child_name : "(null)",
+           type ? type : "(null)", url_location ? url_location : "(null)",
+           url_label ? url_label : "(null)" );
+
+    g_free(id_name);
+    g_free(child_name);
+
+    gtk_widget_show_all( GTK_WIDGET(priv->container) );
+
+    // this sets the window for the progressbar
+    gnc_window_set_progressbar_window( GNC_WINDOW(page->window) );
+
+    // this sets the minimum size of the progressbar to that allocated
+    gnc_plugin_page_report_set_progressbar( page, TRUE );
+
+    gnc_html_show_url(priv->html, type, url_location, url_label, 0);
+    g_free(url_location);
+
+    gnc_plugin_page_report_set_progressbar( page, FALSE );
+
+    // this resets the window for the progressbar to NULL
+    gnc_window_set_progressbar_window( NULL );
+
+    return FALSE;
+}
+
+static void
+gnc_plugin_page_report_realize_uri (GtkWidget *widget, GncPluginPage *page)
+{
+    GtkAllocation allocation;
+
+    gtk_widget_get_allocation (widget, &allocation);
+    PINFO("Realized Container size is %dw x %dh", allocation.width, allocation.height);
+
+    /* load uri when view idle */
+    g_idle_add ((GSourceFunc)gnc_plugin_page_report_load_uri, page);
+}
+
+static
+GtkWidget*
+gnc_plugin_page_report_create_widget( GncPluginPage *page )
+{
+    GncPluginPageReport *report;
+    GncPluginPageReportPrivate *priv;
+    GtkWindow *topLvl;
+    URLType type;
+    char * id_name;
+    char * child_name;
+    char * url_location = NULL;
+    char * url_label = NULL;
+
+    ENTER("page %p", page);
+
+    report = GNC_PLUGIN_PAGE_REPORT(page);
+    priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(report);
+
+    topLvl = GTK_WINDOW(gnc_ui_get_toplevel());
+//        priv->html = gnc_html_new( topLvl );
+    priv->html = gnc_html_factory_create_html();
+    gnc_html_set_parent( priv->html, topLvl );
+
+    gnc_html_history_set_node_destroy_cb(gnc_html_get_history(priv->html),
+                                         gnc_plugin_page_report_history_destroy_cb,
+                                         (gpointer)priv);
+
+    priv->container = GTK_CONTAINER(gtk_frame_new(NULL));
+    gtk_frame_set_shadow_type(GTK_FRAME(priv->container), GTK_SHADOW_NONE);
+
+    // Set the style context for this page so it can be easily manipulated with css
+    gnc_widget_set_style_context (GTK_WIDGET(priv->container), "GncReportPage");
+
+    gtk_container_add(GTK_CONTAINER(priv->container),
+                      gnc_html_get_widget(priv->html));
+
+    priv->component_manager_id =
+        gnc_register_gui_component(WINDOW_REPORT_CM_CLASS, NULL,
+                                   close_handler, page);
+    gnc_gui_component_set_session(priv->component_manager_id,
+                                  gnc_get_current_session());
+
+    gnc_html_set_urltype_cb(priv->html, gnc_plugin_page_report_check_urltype);
+    gnc_html_set_load_cb(priv->html, gnc_plugin_page_report_load_cb, report);
+
+    /* We need to call the load call back so the report appears to of been run
+     so it will get saved properly if the report is not realized in session */
+    id_name = g_strdup_printf("id=%d", priv->reportId );
+    child_name = gnc_build_url( URL_TYPE_REPORT, id_name, NULL );
+    type = gnc_html_parse_url( priv->html, child_name, &url_location, &url_label);
+
+    gnc_plugin_page_report_load_cb (priv->html, type, id_name, url_label, report);
+    g_free(id_name);
+    g_free(child_name);
+
+    // FIXME.  This is f^-1(f(x)), isn't it?
+    DEBUG( "id=%d", priv->reportId );
+
+    /* load uri when view is realized */
+    g_signal_connect (G_OBJECT(GTK_WIDGET(priv->container)), "realize",
+                      G_CALLBACK(gnc_plugin_page_report_realize_uri), page);
+
+    gtk_widget_show_all( GTK_WIDGET(priv->container) );
+    LEAVE("container %p", priv->container);
+    return GTK_WIDGET( priv->container );
+}
+
+/********************************************************************
+ * gnc_plugin_page_report_check_urltype
+ * is it OK to show a certain URLType in this window?
+ ********************************************************************/
+static int
+gnc_plugin_page_report_check_urltype(URLType t)
+{
+    if (!g_strcmp0 (t, URL_TYPE_REPORT))
+    {
+        return TRUE;
+    }
+    else
+    {
+        return FALSE;
+    }
+}
+
+/**
+ * Simply get the initial report given the id, so we can do initialization
+ * things like setup the tab name based on the report's name.
+ **/
+static void
+gnc_plugin_page_report_setup( GncPluginPage *ppage )
+{
+    GncPluginPageReport *report = GNC_PLUGIN_PAGE_REPORT(ppage);
+    GncPluginPageReportPrivate *priv;
+    SCM  set_needs_save = scm_c_eval_string("gnc:report-set-needs-save?!");
+    SCM  inst_report;
+    int  report_id;
+
+    priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(report);
+    priv->cur_report        = SCM_BOOL_F;
+    priv->initial_report    = SCM_BOOL_F;
+    priv->edited_reports    = SCM_EOL;
+    priv->name_change_cb_id = SCM_BOOL_F;
+
+    g_object_get( ppage, "report-id", &report_id, NULL );
+
+    PINFO("report-id: %d\n", report_id);
+
+    /* get the inst-report from the Scheme-side hash, and get its
+     * options and editor thunk */
+    if ((inst_report = gnc_report_find(report_id)) == SCM_BOOL_F)
+    {
+        return;
+    }
+
+    if (priv->initial_report == SCM_BOOL_F)
+    {
+        priv->initial_report = inst_report;
+        scm_gc_protect_object(priv->initial_report);
+    }
+
+    // all reports need [to be] saved immediately after they're created.
+    PINFO("set needs save");
+    scm_call_2(set_needs_save, inst_report, SCM_BOOL_T);
+}
+
+/********************************************************************
+ * gnc_plugin_page_report_load_cb
+ * called after a report is loaded into the gnc_html widget
+ ********************************************************************/
+static void
+//gnc_plugin_page_report_load_cb(gnc_html * html, URLType type,
+gnc_plugin_page_report_load_cb(GncHtml * html, URLType type,
+                               const gchar * location, const gchar * label,
+                               gpointer data)
+{
+    GncPluginPageReport *report = GNC_PLUGIN_PAGE_REPORT(data);
+    GncPluginPageReportPrivate *priv;
+    int  report_id;
+    SCM  get_options    = scm_c_eval_string("gnc:report-options");
+    SCM  set_needs_save = scm_c_eval_string("gnc:report-set-needs-save?!");
+    SCM  inst_report;
+
+    ENTER( "load_cb: type=[%s], location=[%s], label=[%s]",
+           type ? type : "(null)", location ? location : "(null)",
+           label ? label : "(null)" );
+
+    /* we get this callback if a new report is requested to be loaded OR
+     * if any URL is clicked.  If an options URL is clicked, we want to
+     * know about it */
+    priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(report);
+    if (!g_strcmp0 (type, URL_TYPE_REPORT)
+            && location
+            && (strlen(location) > 3)
+            && !strncmp("id=", location, 3))
+    {
+        report_id = atoi(location + 3);
+        DEBUG( "parsed id=%d", report_id );
+    }
+    else if (!g_strcmp0( type, URL_TYPE_OPTIONS)
+             && location
+             && (strlen(location) > 10)
+             && !strncmp("report-id=", location, 10))
+    {
+        report_id = atoi(location + 10);
+        inst_report = gnc_report_find(report_id);
+        if (inst_report != SCM_BOOL_F)
+        {
+            gnc_plugin_page_report_add_edited_report(priv, inst_report);
+        }
+        LEAVE("");
+        return;
+    }
+    else
+    {
+        LEAVE( " unknown URL type [%s] location [%s]", type, location );
+        return;
+    }
+
+    /* get the inst-report from the hash, and get its
+     * options and editor thunk */
+    if ((inst_report = gnc_report_find(report_id)) == SCM_BOOL_F)
+    {
+        LEAVE( "error getting inst_report" );
+        return;
+    }
+
+    if (priv->initial_report == SCM_BOOL_F)
+    {
+        priv->initial_report = inst_report;
+        scm_gc_protect_object(priv->initial_report);
+
+        DEBUG("calling set_needs_save for report with id=%d", report_id);
+        scm_call_2(set_needs_save, inst_report, SCM_BOOL_T);
+
+        priv->initial_odb = gnc_option_db_new(scm_call_1(get_options, inst_report));
+        priv->name_change_cb_id =
+            gnc_option_db_register_change_callback(priv->initial_odb,
+                    gnc_plugin_page_report_refresh,
+                    priv,
+                    "General", "Report name");
+    }
+
+    if ((priv->cur_report != SCM_BOOL_F) && (priv->cur_odb != NULL))
+    {
+        gnc_option_db_unregister_change_callback_id(priv->cur_odb,
+                priv->option_change_cb_id);
+        gnc_option_db_destroy(priv->cur_odb);
+        priv->cur_odb = NULL;
+    }
+
+    if (priv->cur_report != SCM_BOOL_F)
+        scm_gc_unprotect_object(priv->cur_report);
+    priv->cur_report = inst_report;
+    scm_gc_protect_object(priv->cur_report);
+
+    priv->cur_odb = gnc_option_db_new(scm_call_1(get_options, inst_report));
+    priv->option_change_cb_id =
+        gnc_option_db_register_change_callback(priv->cur_odb,
+                gnc_plugin_page_report_option_change_cb,
+                report, NULL, NULL);
+
+    if (gnc_html_history_forward_p(gnc_html_get_history(priv->html)))
+    {
+        gnc_plugin_page_report_set_fwd_button(report, TRUE);
+    }
+    else
+    {
+        gnc_plugin_page_report_set_fwd_button(report, FALSE);
+    }
+
+    if (gnc_html_history_back_p(gnc_html_get_history(priv->html)))
+    {
+        gnc_plugin_page_report_set_back_button(report, TRUE);
+    }
+    else
+    {
+        gnc_plugin_page_report_set_back_button(report, FALSE);
+    }
+
+    LEAVE( "done" );
+}
+
+
+/** This function is called when one of the options for a report
+ *  page has changed.  It is responsible for marking the report as
+ *  dirty, and causing the report to reload using the new options.
+ *
+ *  @note This function currently also calls the main window code to
+ *  update it if the name of the report has changed.  This code should
+ *  eventually go away, and the only way to change the name should be
+ *  via the main window.
+ *
+ *  @param data A pointer to the GncPluginPageReport data structure
+ *  that describes a report. */
+static void
+gnc_plugin_page_report_option_change_cb(gpointer data)
+{
+    GncPluginPage *page;
+    GncPluginPageReport *report;
+    GncPluginPageReportPrivate *priv;
+    SCM dirty_report = scm_c_eval_string("gnc:report-set-dirty?!");
+    const gchar *old_name;
+    gchar *new_name;
+
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REPORT(data));
+    report = GNC_PLUGIN_PAGE_REPORT(data);
+    priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(report);
+    page = GNC_PLUGIN_PAGE(report);
+
+    DEBUG( "option_change" );
+    if (priv->cur_report == SCM_BOOL_F)
+        return;
+    DEBUG( "set-dirty, queue-draw" );
+
+    /* Update the page (i.e. the notebook tab and window title) */
+    old_name = gnc_plugin_page_get_page_name(GNC_PLUGIN_PAGE(report));
+    new_name = gnc_option_db_lookup_string_option(priv->cur_odb, "General",
+               "Report name", NULL);
+    if (strcmp(old_name, new_name) != 0)
+    {
+        /* Bug 727130, 760711 - remove only the non-printable
+         * characters from the new name */
+        gnc_utf8_strip_invalid_and_controls(new_name);
+        ENTER("Cleaned-up new report name: %s", new_name);
+        main_window_update_page_name(GNC_PLUGIN_PAGE(report), new_name);
+	}
+    g_free(new_name);
+
+    /* it's probably already dirty, but make sure */
+    scm_call_2(dirty_report, priv->cur_report, SCM_BOOL_T);
+
+    // prevent closing this page while loading...
+    priv->reloading = TRUE;
+
+    // this sets the window for the progressbar
+    gnc_window_set_progressbar_window( GNC_WINDOW(page->window) );
+
+    // this sets the minimum size of the progressbar to that allocated
+    gnc_plugin_page_report_set_progressbar( page, TRUE );
+
+    /* Now queue the fact that we need to reload this report */
+    gnc_html_reload( priv->html, TRUE ); //reload by rebuild
+
+    gnc_plugin_page_report_set_progressbar( page, FALSE );
+
+    // this resets the window for the progressbar to NULL
+    gnc_window_set_progressbar_window( NULL );
+
+    priv->reloading = FALSE;
+}
+
+/* FIXME: This function does... nothing?  */
+static void
+gnc_plugin_page_report_history_destroy_cb(gnc_html_history_node * node,
+        gpointer user_data)
+{
+#if 0
+    static SCM         remover = SCM_BOOL_F;
+    int                report_id;
+
+    if (remover == SCM_BOOL_F)
+    {
+        remover = scm_c_eval_string("gnc:report-remove-by-id");
+    }
+
+    if (node
+            && !g_strcmp0 (node->type, URL_TYPE_REPORT)\
+            && !strncmp("id=", node->location, 3))
+    {
+        sscanf(node->location + 3, "%d", &report_id);
+        /*    printf("unreffing report %d and children\n", report_id);
+              scm_call_1(remover, scm_from_int (report_id)); */
+    }
+    else
+    {
+        return;
+    }
+#endif
+}
+
+// @param data is actually GncPluginPageReportPrivate
+static void
+gnc_plugin_page_report_refresh(gpointer data)
+{
+    // FIXME?
+    DEBUG( "report-refresh called" );
+    // something like ... gnc_plugin_page_report_redraw( NULL, (GncPluginPageReportPrivate*)data );
+    return;
+}
+
+static void
+gnc_plugin_page_report_destroy_widget(GncPluginPage *plugin_page)
+{
+    GncPluginPageReportPrivate *priv;
+
+    // FIXME: cleanup other resources.
+
+    PINFO("destroy widget");
+    priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(plugin_page);
+
+    if (priv->component_manager_id)
+    {
+        gnc_unregister_gui_component(priv->component_manager_id);
+        priv->component_manager_id = 0;
+    }
+
+    gnc_plugin_page_report_destroy(priv);
+    gnc_report_remove_by_id(priv->reportId);
+}
+
+
+/** The key name used it the state file for storing the report
+ *  options. */
+#define SCHEME_OPTIONS   "SchemeOptions"
+#define SCHEME_OPTIONS_N "SchemeOptions%d"
+
+
+/** Save enough information about this report page that it can be
+ *  recreated next time the user starts gnucash.
+ *
+ *  @param plugin_page The page to save.
+ *
+ *  @param key_file A pointer to the GKeyFile data structure where the
+ *  page information should be written.
+ *
+ *  @param group_name The group name to use when saving data. */
+static void
+gnc_plugin_page_report_save_page (GncPluginPage *plugin_page,
+                                  GKeyFile *key_file,
+                                  const gchar *group_name)
+{
+    GncPluginPageReport *report;
+    GncPluginPageReportPrivate *priv;
+    SCM gen_save_text, scm_text;
+    SCM get_embedded_list, embedded, item, tmp_report;
+    SCM  get_options;
+    gint count, id;
+    gchar *text, *key_name;
+
+    g_return_if_fail (GNC_IS_PLUGIN_PAGE_REPORT(plugin_page));
+    g_return_if_fail (key_file != NULL);
+    g_return_if_fail (group_name != NULL);
+
+    ENTER("page %p, key_file %p, group_name %s", plugin_page, key_file,
+          group_name);
+
+    report = GNC_PLUGIN_PAGE_REPORT(plugin_page);
+    priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(report);
+
+    if (!priv || !priv->cur_report || scm_is_null(priv->cur_report) ||
+            SCM_UNBNDP(priv->cur_report) || SCM_BOOL_F == priv->cur_report)
+    {
+        LEAVE("not saving invalid report");
+        return;
+    }
+
+    gen_save_text = scm_c_eval_string("gnc:report-serialize");
+    get_embedded_list = scm_c_eval_string("gnc:report-embedded-list");
+    get_options    = scm_c_eval_string("gnc:report-options");
+    embedded = scm_call_1(get_embedded_list, scm_call_1(get_options, priv->cur_report));
+    count = scm_ilength(embedded);
+    while (count-- > 0)
+    {
+        item = SCM_CAR(embedded);
+        embedded = SCM_CDR(embedded);
+        if (!scm_is_number(item))
+            continue;
+        id = scm_to_int (item);
+        tmp_report = gnc_report_find(id);
+        scm_text = scm_call_1(gen_save_text, tmp_report);
+        if (!scm_is_string (scm_text))
+        {
+            DEBUG("child report %d: nothing to save", id);
+            continue;
+        }
+
+        key_name = g_strdup_printf(SCHEME_OPTIONS_N, id);
+        text = gnc_scm_strip_comments(scm_text);
+        g_key_file_set_value(key_file, group_name, key_name, text);
+        g_free(text);
+        g_free(key_name);
+    }
+
+    scm_text = scm_call_1(gen_save_text, priv->cur_report);
+    if (!scm_is_string (scm_text))
+    {
+        LEAVE("nothing to save");
+        return;
+    }
+
+    text = gnc_scm_strip_comments(scm_text);
+    g_key_file_set_value(key_file, group_name, SCHEME_OPTIONS, text);
+    g_free(text);
+    LEAVE(" ");
+}
+
+
+/** Create a new report page based on the information saved during a
+ *  previous instantiation of gnucash.
+ *
+ *  @param window The window where this page should be installed.
+ *
+ *  @param key_file A pointer to the GKeyFile data structure where the
+ *  page information should be read.
+ *
+ *  @param group_name The group name to use when restoring data. */
+static GncPluginPage *
+gnc_plugin_page_report_recreate_page (GtkWidget *window,
+                                      GKeyFile *key_file,
+                                      const gchar *group_name)
+{
+    GncPluginPage *page;
+    gchar **keys;
+    gsize i, num_keys;
+    GError *error = NULL;
+    gchar *option_string;
+    gint report_id;
+    SCM scm_id, final_id = SCM_BOOL_F;
+    SCM report;
+
+    g_return_val_if_fail(key_file, NULL);
+    g_return_val_if_fail(group_name, NULL);
+    ENTER("key_file %p, group_name %s", key_file, group_name);
+
+    keys = g_key_file_get_keys(key_file, group_name, &num_keys, &error);
+    if (error)
+    {
+        g_warning("error reading group %s key list: %s",
+                  group_name, error->message);
+        g_error_free(error);
+        LEAVE("no keys");
+        return NULL;
+    }
+
+    for (i = 0; i < num_keys; i++)
+    {
+        if (strncmp(keys[i], SCHEME_OPTIONS, strlen(SCHEME_OPTIONS)) != 0)
+            continue;
+        option_string = g_key_file_get_value(key_file, group_name,
+                                              keys[i], &error);
+        if (error)
+        {
+            g_warning("error reading group %s key %s: %s",
+                      group_name, keys[i], error->message);
+            g_error_free(error);
+            LEAVE("bad value");
+            return NULL;
+        }
+
+        scm_id = scm_c_eval_string(option_string);
+        g_free(option_string);
+
+        if (!scm_integer_p(scm_id))
+        {
+            DEBUG("report id not an integer for key %s", keys[i]);
+            return NULL;
+        }
+
+        if (final_id == SCM_BOOL_F)
+        {
+            if (g_strcmp0(keys[i], SCHEME_OPTIONS) == 0)
+            {
+                final_id = scm_id;
+            }
+        }
+    }
+
+    if (final_id == SCM_BOOL_F)
+    {
+        LEAVE("report not specified");
+        return NULL;
+    }
+
+    report_id = scm_to_int(final_id);
+    report = gnc_report_find(report_id);
+    if (!report)
+    {
+        LEAVE("report doesn't exist");
+        return NULL;
+    }
+
+    page = gnc_plugin_page_report_new( report_id );
+
+    LEAVE(" ");
+    return page;
+}
+
+
+/** Update a report page to reflect a name change made by external
+ *  code.  This is called from the main window code when a page's name
+ *  is changes.  The report code will update its copy of the name and
+ *  regenerate the report.
+ *
+ *  @internal
+ *
+ *  @param page The page whose name has changed.
+ *
+ *  @param name The new name for the page. */
+static void
+gnc_plugin_page_report_name_changed (GncPluginPage *page, const gchar *name)
+{
+    GncPluginPageReportPrivate *priv;
+    const gchar *old_name;
+
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REPORT(page));
+    g_return_if_fail(name != NULL);
+
+    ENTER("page %p, name %s", page, name);
+    priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(page);
+
+    /* Is this a redundant call? */
+    old_name = gnc_option_db_lookup_string_option(priv->cur_odb, "General",
+               "Report name", NULL);
+    DEBUG("Comparing old name '%s' to new name '%s'",
+          old_name ? old_name : "(null)", name);
+    if (old_name && (strcmp(old_name, name) == 0))
+    {
+        LEAVE("no change");
+        return;
+    }
+
+    /* Store the new name for the report. */
+    gnc_option_db_set_string_option(priv->cur_odb, "General",
+                                    "Report name", name);
+
+    /* Have to manually call the option change hook. */
+    gnc_plugin_page_report_option_change_cb(page);
+    LEAVE(" ");
+}
+
+static void
+gnc_plugin_page_report_update_edit_menu (GncPluginPage *page, gboolean hide)
+{
+    GtkAction *action;
+
+    action = gnc_plugin_page_get_action (page, "EditCopyAction");
+    gtk_action_set_sensitive (action, TRUE);
+    gtk_action_set_visible (action, TRUE);
+    action = gnc_plugin_page_get_action (page, "EditCutAction");
+    gtk_action_set_sensitive (action, FALSE);
+    gtk_action_set_visible (action, !hide);
+    action = gnc_plugin_page_get_action (page, "EditPasteAction");
+    gtk_action_set_sensitive (action, FALSE);
+    gtk_action_set_visible (action, !hide);
+}
+
+static gboolean
+gnc_plugin_page_report_finish_pending (GncPluginPage *page)
+{
+    GncPluginPageReportPrivate *priv;
+    GncPluginPageReport *report;
+
+    report = GNC_PLUGIN_PAGE_REPORT(page);
+    priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(report);
+    return !priv->reloading;
+}
+
+
+/********************************************************************
+ * gnc_report_window_destroy
+ * free and destroy a window
+ ********************************************************************/
+void
+gnc_plugin_page_report_destroy(GncPluginPageReportPrivate * priv)
+{
+    SCM  get_editor = scm_c_eval_string("gnc:report-editor-widget");
+    SCM  set_editor = scm_c_eval_string("gnc:report-set-editor-widget!");
+    SCM  edited, editor;
+
+    /* close any open editors */
+    for (edited = scm_list_copy(priv->edited_reports); !scm_is_null(edited);
+            edited = SCM_CDR(edited))
+    {
+        editor = scm_call_1(get_editor, SCM_CAR(edited));
+        scm_call_2(set_editor, SCM_CAR(edited), SCM_BOOL_F);
+        if (editor != SCM_BOOL_F)
+        {
+            GtkWidget *w = NULL;
+#define FUNC_NAME "gtk_widget_destroy"
+            w = SWIG_MustGetPtr(editor,
+                                SWIG_TypeQuery("_p_GtkWidget"), 1, 0);
+#undef FUNC_NAME
+            gtk_widget_destroy(GTK_WIDGET(w));
+        }
+    }
+
+    if (priv->initial_odb)
+    {
+        gnc_option_db_unregister_change_callback_id(priv->initial_odb,
+                priv->name_change_cb_id);
+
+        gnc_option_db_destroy(priv->initial_odb);
+        priv->initial_odb = NULL;
+    }
+
+    gnc_html_destroy(priv->html);
+
+    priv->container     = NULL;
+    priv->html          = NULL;
+
+    if (priv->cur_report != SCM_BOOL_F)
+        scm_gc_unprotect_object(priv->cur_report);
+    if (priv->edited_reports != SCM_EOL)
+        scm_gc_unprotect_object(priv->edited_reports);
+}
+
+/** Short labels for use on the toolbar buttons. */
+static action_toolbar_labels toolbar_labels[] =
+{
+    { "FilePrintAction", 	    N_("Print") },
+    { "ReportExportAction",   N_("Export") },
+    { "ReportOptionsAction",  N_("Options") },
+    { NULL, NULL },
+};
+
+static const gchar *initially_insensitive_actions[] =
+{
+    NULL
+};
+
+static void
+gnc_plugin_page_report_init ( GncPluginPageReport *plugin_page )
+{
+}
+
+static GObject*
+gnc_plugin_page_report_constructor(GType this_type, guint n_properties, GObjectConstructParam *properties)
+{
+    GObject *obj;
+    GncPluginPageReportClass *our_class;
+    GObjectClass *parent_class;
+    gint reportId = -42;
+    int i;
+
+    our_class = GNC_PLUGIN_PAGE_REPORT_CLASS (
+                    g_type_class_peek (GNC_TYPE_PLUGIN_PAGE_REPORT));
+    parent_class = G_OBJECT_CLASS (g_type_class_peek_parent (our_class));
+    obj = parent_class->constructor(this_type, n_properties, properties);
+
+    for (i = 0; i < n_properties; i++)
+    {
+        GObjectConstructParam prop = properties[i];
+        if (strcmp(prop.pspec->name, "report-id") == 0)
+        {
+            reportId = g_value_get_int(prop.value);
+        }
+    }
+
+    gnc_plugin_page_report_constr_init(GNC_PLUGIN_PAGE_REPORT(obj), reportId);
+
+    return obj;
+}
+
+static void
+gnc_plugin_page_report_constr_init(GncPluginPageReport *plugin_page, gint reportId)
+{
+    GncPluginPageReportPrivate *priv;
+    GtkActionGroup *action_group;
+    GncPluginPage *parent;
+    gboolean use_new;
+    gchar *name;
+    gchar *saved_reports_path = gnc_build_dotgnucash_path (SAVED_REPORTS_FILE);
+    gchar *report_save_str = g_strdup_printf (
+        _("Update the current report's saved configuration. "
+        "The report will be saved in the file %s. "), saved_reports_path);
+    gchar *report_saveas_str = g_strdup_printf (
+        _("Add the current report's configuration to the `Saved Report Configurations' menu. "
+        "The report will be saved in the file %s. "), saved_reports_path);
+
+    GtkActionEntry report_actions[] =
+    {
+        {
+            "FilePrintAction", "document-print", N_("_Print Report..."), "<primary>p",
+            N_("Print the current report"),
+            G_CALLBACK(gnc_plugin_page_report_print_cb)
+        },
+        {
+            "FilePrintPDFAction", GNC_ICON_PDF_EXPORT, N_("Export as P_DF..."), NULL,
+            N_("Export the current report as a PDF document"),
+            G_CALLBACK(gnc_plugin_page_report_exportpdf_cb)
+        },
+        {
+            "EditCutAction", "edit-cut", N_("Cu_t"), "<primary>X",
+            N_("Cut the current selection and copy it to clipboard"),
+            NULL
+        },
+        {
+            "EditCopyAction", "edit-copy", N_("_Copy"), "<primary>C",
+            N_("Copy the current selection to clipboard"),
+            G_CALLBACK(gnc_plugin_page_report_copy_cb)
+        },
+        {
+            "EditPasteAction", "edit-paste", N_("_Paste"), "<primary>V",
+            N_("Paste the clipboard content at the cursor position"),
+            NULL
+        },
+        {
+            "ViewRefreshAction", "view-refresh", N_("_Refresh"), "<primary>r",
+            N_("Refresh this window"),
+            G_CALLBACK (gnc_plugin_page_report_reload_cb)
+        },
+        {
+            "ReportSaveAction", "document-save", N_("Save _Report Configuration"), "<primary><alt>s",
+            report_save_str, G_CALLBACK(gnc_plugin_page_report_save_cb)
+        },
+        {
+            "ReportSaveAsAction", "document-save-as", N_("Save Report Configuration As..."), "<primary><alt><shift>s",
+            report_saveas_str, G_CALLBACK(gnc_plugin_page_report_save_as_cb)
+        },
+        {
+            "ReportExportAction", "go-next", N_("Export _Report"), NULL,
+            N_("Export HTML-formatted report to file"),
+            G_CALLBACK(gnc_plugin_page_report_export_cb)
+        },
+        {
+            "ReportOptionsAction", "document-properties", N_("_Report Options"), NULL,
+            N_("Edit report options"),
+            G_CALLBACK(gnc_plugin_page_report_options_cb)
+        },
+
+        {
+            "ReportBackAction", "go-previous", N_("Back"), NULL,
+            N_("Move back one step in the history"),
+            G_CALLBACK(gnc_plugin_page_report_back_cb)
+        },
+        {
+            "ReportForwAction", "go-next", N_("Forward"), NULL,
+            N_("Move forward one step in the history"),
+            G_CALLBACK(gnc_plugin_page_report_forw_cb)
+        },
+        {
+            "ReportReloadAction", "view-refresh", N_("Reload"), NULL,
+            N_("Reload the current page"),
+            G_CALLBACK(gnc_plugin_page_report_reload_cb)
+        },
+        {
+            "ReportStopAction", "process-stop", N_("Stop"), NULL,
+            N_("Cancel outstanding HTML requests"),
+            G_CALLBACK(gnc_plugin_page_report_stop_cb)
+        },
+    };
+    guint num_report_actions = G_N_ELEMENTS( report_actions );
+
+    DEBUG( "property reportId=%d", reportId );
+    priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(plugin_page);
+    priv->reportId = reportId;
+
+    gnc_plugin_page_report_setup( GNC_PLUGIN_PAGE(plugin_page) );
+
+    /* Init parent declared variables */
+    parent = GNC_PLUGIN_PAGE(plugin_page);
+    use_new = gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL_REPORT, GNC_PREF_USE_NEW);
+    name = gnc_report_name( priv->initial_report );
+    g_object_set(G_OBJECT(plugin_page),
+                 "page-name",      name,
+                 "page-uri",       "default:",
+                 "ui-description", "gnc-plugin-page-report-ui.xml",
+                 "use-new-window", use_new,
+                 NULL);
+    g_free(name);
+
+    /* change me when the system supports multiple books */
+    gnc_plugin_page_add_book(parent, gnc_get_current_book());
+
+    /* Create menu and toolbar information */
+    action_group =
+        gnc_plugin_page_create_action_group(parent,
+                                            "GncPluginPageReportActions");
+    gtk_action_group_add_actions( action_group,
+                                  report_actions,
+                                  num_report_actions,
+                                  plugin_page );
+    gnc_plugin_update_actions(action_group,
+                              initially_insensitive_actions,
+                              "sensitive", FALSE);
+    gnc_plugin_init_short_names (action_group, toolbar_labels);
+
+    g_free (saved_reports_path);
+    g_free (report_save_str);
+    g_free (report_saveas_str);
+}
+
+GncPluginPage*
+gnc_plugin_page_report_new( int reportId )
+{
+    GncPluginPageReport *plugin_page;
+
+    DEBUG( "report id = %d", reportId );
+    plugin_page = g_object_new( GNC_TYPE_PLUGIN_PAGE_REPORT,
+                                "report-id", reportId, NULL );
+    DEBUG( "plugin_page: %p", plugin_page );
+    DEBUG( "set %d on page %p", reportId, plugin_page );
+    return GNC_PLUGIN_PAGE( plugin_page );
+}
+
+void
+gnc_plugin_page_report_remove_edited_report(GncPluginPageReportPrivate *priv,
+        SCM report)
+{
+    SCM new_edited = scm_delete(priv->edited_reports, report);
+    if (priv->edited_reports != SCM_EOL)
+        scm_gc_unprotect_object(priv->edited_reports);
+    priv->edited_reports = new_edited;
+    if (new_edited != SCM_EOL)
+        scm_gc_protect_object(priv->edited_reports);
+}
+
+void
+gnc_plugin_page_report_add_edited_report(GncPluginPageReportPrivate *priv,
+        SCM report)
+{
+    SCM new_edited = scm_cons(report, priv->edited_reports);
+    if (priv->edited_reports != SCM_EOL)
+        scm_gc_unprotect_object(priv->edited_reports);
+    priv->edited_reports = new_edited;
+    if (new_edited != SCM_EOL)
+        scm_gc_protect_object(priv->edited_reports);
+}
+
+void
+gnc_plugin_page_report_raise_editor(SCM report)
+{
+    SCM get_editor = scm_c_eval_string("gnc:report-editor-widget");
+    SCM editor = scm_call_1(get_editor, report);
+#define FUNC_NAME "gtk_window_present"
+    GtkWidget *w = SWIG_MustGetPtr(editor,
+                                   SWIG_TypeQuery("_p_GtkWidget"), 1, 0);
+#undef FUNC_NAME
+    gtk_window_present(GTK_WINDOW(w));
+}
+
+static void
+close_handler (gpointer user_data)
+{
+    GncPluginPage *plugin_page = GNC_PLUGIN_PAGE(user_data);
+    DEBUG("in close handler\n");
+    gnc_main_window_close_page (plugin_page);
+}
+
+static void
+gnc_plugin_page_report_set_fwd_button(GncPluginPageReport *report, int enabled)
+{
+    GtkAction *act;
+
+    act = gnc_plugin_page_get_action(GNC_PLUGIN_PAGE(report),
+                                     "ReportForwAction" );
+    gtk_action_set_sensitive(act, enabled);
+}
+
+static void
+gnc_plugin_page_report_set_back_button(GncPluginPageReport *report, int enabled)
+{
+    GtkAction *act;
+
+    act = gnc_plugin_page_get_action(GNC_PLUGIN_PAGE(report),
+                                     "ReportBackAction" );
+    gtk_action_set_sensitive(act, enabled);
+}
+
+// ------------------------------------------------------------
+// GTK ACTION CALLBACKS
+
+static void
+gnc_plugin_page_report_forw_cb( GtkAction *action, GncPluginPageReport *report )
+{
+    GncPluginPageReportPrivate *priv;
+    gnc_html_history_node * node = NULL;
+
+    DEBUG( "forw" );
+    priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(report);
+    gnc_html_history_forward(gnc_html_get_history(priv->html));
+    node = gnc_html_history_get_current(gnc_html_get_history(priv->html));
+    if (node)
+    {
+        gnc_html_show_url(priv->html, node->type, node->location,
+                          node->label, 0);
+    }
+}
+
+static void
+gnc_plugin_page_report_back_cb( GtkAction *action, GncPluginPageReport *report )
+{
+    GncPluginPageReportPrivate *priv;
+    gnc_html_history_node * node;
+
+    DEBUG( "back" );
+    priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(report);
+    gnc_html_history_back(gnc_html_get_history(priv->html));
+    node = gnc_html_history_get_current(gnc_html_get_history(priv->html));
+    if (node)
+    {
+        gnc_html_show_url(priv->html, node->type, node->location,
+                          node->label, 0);
+    }
+}
+
+static void
+gnc_plugin_page_report_reload_cb( GtkAction *action, GncPluginPageReport *report )
+{
+    GncPluginPage *page;
+    GncPluginPageReportPrivate *priv;
+    SCM dirty_report;
+
+    DEBUG( "reload" );
+    page = GNC_PLUGIN_PAGE(report);
+    priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(report);
+    if (priv->cur_report == SCM_BOOL_F)
+        return;
+
+    DEBUG( "reload-redraw" );
+    dirty_report = scm_c_eval_string("gnc:report-set-dirty?!");
+    scm_call_2(dirty_report, priv->cur_report, SCM_BOOL_T);
+
+    /* now queue the fact that we need to reload this report */
+
+    // prevent closing this page while loading...
+    priv->reloading = TRUE;
+    // this sets the window for the progressbar
+    gnc_window_set_progressbar_window( GNC_WINDOW(page->window) );
+
+    // this sets the minimum size of the progressbar to that allocated
+    gnc_plugin_page_report_set_progressbar( page, TRUE );
+
+    gnc_html_reload( priv->html, TRUE ); //reload by rebuild
+
+    gnc_plugin_page_report_set_progressbar( page, FALSE );
+
+    // this resets the window for the progressbar to NULL
+    gnc_window_set_progressbar_window( NULL );
+    priv->reloading = FALSE;
+}
+
+static void
+gnc_plugin_page_report_stop_cb( GtkAction *action, GncPluginPageReport *report )
+{
+    GncPluginPageReportPrivate *priv;
+
+    priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(report);
+    gnc_html_cancel(priv->html);
+}
+
+/* Returns SCM_BOOL_F if cancel. Returns SCM_BOOL_T if html.
+ * Otherwise returns pair from export_types. */
+static SCM
+gnc_get_export_type_choice (SCM export_types)
+{
+    GList * choices = NULL;
+    gboolean bad = FALSE;
+    GList * node;
+    int choice;
+    SCM tail;
+
+    if (!scm_is_list (export_types))
+        return SCM_BOOL_F;
+
+    for (tail = export_types; !scm_is_null (tail); tail = SCM_CDR (tail))
+    {
+        SCM pair = SCM_CAR (tail);
+        char * name;
+        SCM scm;
+
+        if (!scm_is_pair (pair))
+        {
+            g_warning ("unexpected list element");
+            bad = TRUE;
+            break;
+        }
+
+        scm = SCM_CAR (pair);
+        if (!scm_is_string (scm))
+        {
+            g_warning ("unexpected pair element");
+            bad = TRUE;
+            break;
+        }
+
+        name = gnc_scm_to_utf8_string (scm);
+        choices = g_list_prepend (choices, name);
+    }
+
+    if (!bad)
+    {
+        choices = g_list_reverse (choices);
+
+        choices = g_list_prepend (choices, g_strdup (_("HTML")));
+
+        choice = gnc_choose_radio_option_dialog
+                 (NULL, _("Choose export format"),
+                  _("Choose the export format for this report:"),
+                  NULL, 0, choices);
+    }
+    else
+        choice = -1;
+
+    for (node = choices; node; node = node->next)
+        g_free (node->data);
+    g_list_free (choices);
+
+    if (choice < 0)
+        return SCM_BOOL_F;
+
+    if (choice == 0)
+        return SCM_BOOL_T;
+
+    choice--;
+    if (choice >= scm_ilength (export_types))
+        return SCM_BOOL_F;
+
+    return scm_list_ref (export_types, scm_from_int  (choice));
+}
+
+static char *
+gnc_get_export_filename (SCM choice)
+{
+    char * filepath;
+    GStatBuf statbuf;
+    char * title;
+    const gchar * html_type = _("HTML");
+    char * type;
+    int rc;
+    char * default_dir;
+
+    if (choice == SCM_BOOL_T)
+        type = g_strdup (html_type);
+    else
+        type = gnc_scm_to_utf8_string(SCM_CAR (choice));
+
+    /* %s is the type of what is about to be saved, e.g. "HTML". */
+    title = g_strdup_printf (_("Save %s To File"), type);
+    default_dir = gnc_get_default_directory(GNC_PREFS_GROUP_REPORT);
+
+    filepath = gnc_file_dialog (title, NULL, default_dir, GNC_FILE_DIALOG_EXPORT);
+
+    /* Try to test for extension on file name, add if missing */
+    if (g_strrstr(filepath, ".") == NULL)
+        filepath = g_strconcat(filepath, ".", g_ascii_strdown(type, strlen(type)), NULL);
+
+    g_free (type);
+    g_free (title);
+    g_free (default_dir);
+
+    if (!filepath)
+        return NULL;
+
+    default_dir = g_path_get_dirname(filepath);
+    gnc_set_default_directory (GNC_PREFS_GROUP_REPORT, default_dir);
+    g_free(default_dir);
+
+    rc = g_stat (filepath, &statbuf);
+
+    /* Check for an error that isn't a non-existent file. */
+    if (rc != 0 && errno != ENOENT)
+    {
+        /* %s is the strerror(3) string of the error that occurred. */
+        const char *format = _("You cannot save to that filename.\n\n%s");
+
+        gnc_error_dialog (NULL, format, strerror(errno));
+        g_free(filepath);
+        return NULL;
+    }
+
+    /* Check for a file that isn't a regular file. */
+    if (rc == 0 && !S_ISREG (statbuf.st_mode))
+    {
+        const char *message = _("You cannot save to that file.");
+
+        gnc_error_dialog (NULL, "%s", message);
+        g_free(filepath);
+        return NULL;
+    }
+
+    if (rc == 0)
+    {
+        const char *format = _("The file %s already exists. "
+                               "Are you sure you want to overwrite it?");
+
+        if (!gnc_verify_dialog (NULL, FALSE, format, filepath))
+        {
+            g_free(filepath);
+            return NULL;
+        }
+    }
+
+    return filepath;
+}
+
+static void
+gnc_plugin_page_report_save_as_cb( GtkAction *action, GncPluginPageReport *report )
+{
+    GncPluginPageReportPrivate *priv;
+    SCM save_func;
+    SCM rpt_id;
+
+    priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(report);
+    if (priv->cur_report == SCM_BOOL_F)
+        return;
+
+    /* Create a new report template based on the current report's settings
+     * and allow the user to rename the template.
+     */
+    save_func = scm_c_eval_string("gnc:report-to-template-new");
+    rpt_id = scm_call_1(save_func, priv->cur_report);
+
+    /* Open Preconfigured Reports dialog to allow user to change the name */
+    if (!scm_is_null (rpt_id))
+    {
+        GncPluginPage *reportPage = GNC_PLUGIN_PAGE (report);
+        GtkWidget *window = reportPage->window;
+
+        if (window)
+            g_return_if_fail(GNC_IS_MAIN_WINDOW(window));
+
+        gnc_ui_custom_report_edit_name (GNC_MAIN_WINDOW (window), rpt_id);
+    }
+
+}
+
+static void
+gnc_plugin_page_report_save_cb( GtkAction *action, GncPluginPageReport *report )
+{
+    GncPluginPageReportPrivate *priv;
+    SCM check_func, save_func;
+    SCM rpt_id;
+
+    priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(report);
+    if (priv->cur_report == SCM_BOOL_F)
+        return;
+
+    check_func = scm_c_eval_string("gnc:is-custom-report-type");
+    if (scm_is_true (scm_call_1 (check_func, priv->cur_report)))
+    {
+        /* The current report is already based on a custom report.
+         * Replace the existing one instead of adding a new one
+         */
+        save_func = scm_c_eval_string("gnc:report-to-template-update");
+        rpt_id = scm_call_1(save_func, priv->cur_report);
+        (void)rpt_id;
+    }
+    else
+    {
+        /* The current report is not based on a custom report.
+         * So let's create a new report template based on this report
+         * and allow the user to change the name.
+         */
+        gnc_plugin_page_report_save_as_cb (action, report);
+    }
+}
+
+static void
+gnc_plugin_page_report_export_cb( GtkAction *action, GncPluginPageReport *report )
+{
+    GncPluginPageReportPrivate *priv;
+    char * filepath;
+    SCM export_types;
+    SCM export_thunk;
+    gboolean result;
+    SCM choice;
+
+    priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(report);
+    export_types = scm_call_1 (scm_c_eval_string ("gnc:report-export-types"),
+                               priv->cur_report);
+
+    export_thunk = scm_call_1 (scm_c_eval_string ("gnc:report-export-thunk"),
+                               priv->cur_report);
+
+    if (scm_is_list (export_types) && scm_is_procedure (export_thunk))
+        choice = gnc_get_export_type_choice (export_types);
+    else
+        choice = SCM_BOOL_T;
+
+    if (choice == SCM_BOOL_F)
+        return;
+
+    filepath = gnc_get_export_filename (choice);
+    if (!filepath)
+        return;
+
+    if (scm_is_pair (choice))
+    {
+        SCM file_scm;
+        SCM res;
+
+        choice = SCM_CDR (choice);
+        file_scm = scm_from_locale_string (filepath);
+
+        res = scm_call_3 (export_thunk, priv->cur_report, choice, file_scm);
+
+        result = (res != SCM_BOOL_F);
+    }
+    else
+        result = gnc_html_export_to_file (priv->html, filepath);
+
+    if (!result)
+    {
+        const char *fmt = _("Could not open the file %s. "
+                            "The error is: %s");
+        gnc_error_dialog( NULL, fmt, filepath ? filepath : "(null)",
+                          strerror (errno) ? strerror (errno) : "" );
+    }
+
+    g_free(filepath);
+    return;
+}
+
+static void
+gnc_plugin_page_report_options_cb( GtkAction *action, GncPluginPageReport *report )
+{
+    GncPluginPageReportPrivate *priv;
+
+    priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(report);
+    if (priv->cur_report == SCM_BOOL_F)
+        return;
+
+    if (gnc_report_edit_options (priv->cur_report))
+        gnc_plugin_page_report_add_edited_report(priv, priv->cur_report);
+}
+
+static GncInvoice *lookup_invoice(GncPluginPageReportPrivate *priv)
+{
+    g_assert(priv);
+    return gnc_option_db_lookup_invoice_option(priv->cur_odb, "General",
+            "Invoice Number", NULL);
+}
+
+#define GNC_PREFS_GROUP_REPORT_PDFEXPORT GNC_PREFS_GROUP_GENERAL_REPORT ".pdf-export"
+#define GNC_PREF_FILENAME_DATE_FMT "filename-date-format"
+#define GNC_PREF_FILENAME_FMT "filename-format"
+
+static gchar *report_create_jobname(GncPluginPageReportPrivate *priv)
+{
+    gchar *job_name = NULL;
+    gchar *report_name = NULL;
+    const gchar *report_number = "";
+    gchar *job_date;
+    const gchar *default_jobname = N_("GnuCash-Report");
+
+    g_assert(priv);
+
+    {
+        // Look up the date format that was chosen in the preferences database
+        QofDateFormat date_format_here;
+        QofDateFormat date_format_old = qof_date_format_get();
+        char *format_code = gnc_prefs_get_string(GNC_PREFS_GROUP_REPORT_PDFEXPORT,
+                            GNC_PREF_FILENAME_DATE_FMT);
+        if (*format_code == '\0')
+        {
+            g_free(format_code);
+            format_code = g_strdup("locale");
+        }
+
+        if (gnc_date_string_to_dateformat(format_code, &date_format_here))
+        {
+            PERR("Incorrect date format code");
+            if (format_code != NULL)
+                free(format_code);
+        }
+
+        // To apply this chosen date format, temporarily switch the
+        // process-wide default to our chosen date format. Note: It is a
+        // totally brain-dead implementation of qof_print_date() to not offer a
+        // variation where the QofDateFormat can be passed as an argument.
+        // Hrmpf.
+        qof_date_format_set(date_format_here);
+
+        job_date = qof_print_date( time( NULL ) );
+
+        // Restore to the original general  date format
+        qof_date_format_set(date_format_old);
+    }
+
+
+    if (priv->cur_report == SCM_BOOL_F)
+        report_name = g_strdup (_(default_jobname));
+    else
+    {
+        /* Gather some information from the report to generate a
+         * decent print job name.
+         * FIXME: this is a bit of a hack. It would be better if each
+         *        report had a hidden job name option, because the
+         *        generic reporting code shouldn't know what makes
+         *        a decent job name for each report.
+         *
+         *        Also, the "Report name" for an invoice report is
+         *        "Printable Invoice", which is not what the user wants to see,
+         *        so I added yet another hack below for this. cstim.
+         */
+        GncInvoice *invoice;
+        report_name = gnc_option_db_lookup_string_option(priv->cur_odb, "General",
+                      "Report name", NULL);
+        if (!report_name)
+            report_name = g_strdup (_(default_jobname));
+        if (g_strcmp0(report_name, _("Printable Invoice")) == 0
+                || g_strcmp0(report_name, _("Tax Invoice")) == 0
+                || g_strcmp0(report_name, _("Easy Invoice")) == 0
+                || g_strcmp0(report_name, _("Fancy Invoice")) == 0)
+        {
+            /* Again HACK alert: We modify this single known string here into
+             * something more appropriate. */
+            g_free(report_name);
+            report_name = g_strdup(_("Invoice"));
+        }
+
+        invoice = lookup_invoice(priv);
+        if (invoice)
+        {
+            // Report is for an invoice. Hence, we get a number of the invoice.
+            report_number = gncInvoiceGetID(invoice);
+        }
+    }
+
+    if (report_name && job_date)
+    {
+        // Look up the sprintf format of the output name from the preferences database
+        char* format = gnc_prefs_get_string(GNC_PREFS_GROUP_REPORT_PDFEXPORT, GNC_PREF_FILENAME_FMT);
+
+        job_name = g_strdup_printf(format, report_name, report_number, job_date);
+
+        g_free(format);
+    }
+    g_free (report_name);
+    g_free (job_date);
+
+    {
+        char forbidden_char = '/';
+        // Now remove the characters that are not allowed in file
+        // names. FIXME: Check for all disallowed characters here!
+        while (strchr(job_name, forbidden_char))
+        {
+            *strchr(job_name, forbidden_char) = '_';
+        }
+    }
+
+    {
+        /* And one final checking issue: We want to avoid allocating
+         * the same name twice for a saved PDF.  Hence, we keep a
+         * GHashTable with the usage count of existing output
+         * names. (Because I'm lazy, I just use a static GHashTable
+         * for this.) */
+        gpointer value;
+        gboolean already_found;
+        g_assert(static_report_printnames);
+
+        // Lookup the existing usage count
+        value = g_hash_table_lookup(static_report_printnames, job_name);
+        already_found = (value != NULL);
+        if (!value)
+        {
+            value = GINT_TO_POINTER(0);
+        }
+
+        // Increment the stored usage count
+        value = GINT_TO_POINTER(1 + GPOINTER_TO_INT(value));
+        // and store it again
+        g_hash_table_insert(static_report_printnames, g_strdup(job_name), value);
+
+        // If the previous usage count was more than 0, append the current
+        // count (which is now 2 or higher) to the resulting name
+        if (already_found)
+        {
+            // The name was already in use, so modify the name again
+            gchar *tmp = g_strdup_printf("%s_%d", job_name, (int) GPOINTER_TO_INT(value));
+            g_free(job_name);
+            job_name = tmp;
+        }
+    }
+
+    return job_name;
+}
+
+static void
+gnc_plugin_page_report_print_cb( GtkAction *action, GncPluginPageReport *report )
+{
+    GncPluginPageReportPrivate *priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(report);
+    gchar *job_name = report_create_jobname(priv);
+
+    //g_warning("Setting job name=%s", job_name);
+
+#ifdef WEBKIT1
+    gnc_html_print (priv->html, job_name, TRUE);
+#else
+    gnc_html_print (priv->html);
+#endif
+
+    g_free (job_name);
+}
+
+static void
+gnc_plugin_page_report_exportpdf_cb( GtkAction *action, GncPluginPageReport *report )
+{
+    GncPluginPageReportPrivate *priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(report);
+    gchar *job_name = report_create_jobname(priv);
+    GncInvoice *invoice;
+    GncOwner *owner = NULL;
+
+    // Do we have an invoice report?
+    invoice = lookup_invoice(priv);
+    if (invoice)
+    {
+        // Does this invoice also have an owner?
+        owner = (GncOwner*) gncInvoiceGetOwner(invoice);
+        if (owner)
+        {
+	    QofInstance *inst = qofOwnerGetOwner (owner);
+	    gchar *dirname = NULL;
+	    qof_instance_get (inst, "export-pdf-dir", &dirname, NULL);
+            // Yes. In the kvp, look up the key for the Export-PDF output
+            // directory. If it exists, prepend this to the job name so that
+            // we can export to PDF.
+	    if (dirname && g_file_test(dirname,
+				       G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR))
+	    {
+		gchar *tmp = g_build_filename(dirname, job_name, NULL);
+		g_free(job_name);
+		job_name = tmp;
+	    }
+        }
+    }
+
+    //g_warning("Setting job name=%s", job_name);
+
+#ifdef WEBKIT1
+    gnc_html_print (priv->html, job_name, TRUE);
+#else
+    gnc_html_print (priv->html);
+#endif
+
+    if (owner)
+    {
+	/* As this is an invoice report with some owner, we will try
+	 * to look up the chosen output directory from the print
+	 * settings and store it again in the owner kvp.
+	 */
+        GtkPrintSettings *print_settings = gnc_print_get_settings();
+        if (print_settings &&
+	    gtk_print_settings_has_key(print_settings,
+				       GNC_GTK_PRINT_SETTINGS_EXPORT_DIR))
+        {
+            const char* dirname = gtk_print_settings_get(print_settings,
+                                  GNC_GTK_PRINT_SETTINGS_EXPORT_DIR);
+            // Only store the directory if it exists.
+            if (g_file_test(dirname, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR))
+            {
+                QofInstance *inst = qofOwnerGetOwner(owner);
+                gncOwnerBeginEdit(owner);
+		qof_instance_set (inst, "export-pdf-dir", dirname);
+		gncOwnerCommitEdit(owner);
+            }
+        }
+    }
+
+    g_free (job_name);
+}
+
+static void
+gnc_plugin_page_report_copy_cb(GtkAction *action, GncPluginPageReport *report)
+{
+    GncPluginPageReportPrivate *priv;
+
+    priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(report);
+    gnc_html_copy_to_clipboard(priv->html);
+}
+
+/********************************************************************
+ * gnc_main_window_open_report()
+ * open an report in a top level window from an ID number
+ ********************************************************************/
+
+void
+gnc_main_window_open_report(int report_id, GncMainWindow *window)
+{
+    GncPluginPage *reportPage;
+
+    if (window)
+        g_return_if_fail(GNC_IS_MAIN_WINDOW(window));
+
+    reportPage = gnc_plugin_page_report_new( report_id );
+    gnc_main_window_open_page( window, reportPage );
+}
+
+void
+gnc_main_window_open_report_url(const char * url, GncMainWindow *window)
+{
+    GncPluginPage *reportPage;
+
+    DEBUG( "report url: [%s]\n", url );
+
+    if (window)
+        g_return_if_fail(GNC_IS_MAIN_WINDOW(window));
+
+    reportPage = gnc_plugin_page_report_new( 42 /* url? */ );
+    gnc_main_window_open_page( window, reportPage );
+}
+
+/** @} */
+/** @} */
diff --git a/src/report/report-gnome/gnc-plugin-page-report.h b/gnucash/report/report-gnome/gnc-plugin-page-report.h
similarity index 100%
rename from src/report/report-gnome/gnc-plugin-page-report.h
rename to gnucash/report/report-gnome/gnc-plugin-page-report.h
diff --git a/src/report/report-gnome/gncmod-report-gnome.c b/gnucash/report/report-gnome/gncmod-report-gnome.c
similarity index 100%
rename from src/report/report-gnome/gncmod-report-gnome.c
rename to gnucash/report/report-gnome/gncmod-report-gnome.c
diff --git a/src/report/report-gnome/report-gnome.i b/gnucash/report/report-gnome/report-gnome.i
similarity index 100%
rename from src/report/report-gnome/report-gnome.i
rename to gnucash/report/report-gnome/report-gnome.i
diff --git a/src/report/report-gnome/report-gnome.scm b/gnucash/report/report-gnome/report-gnome.scm
similarity index 100%
rename from src/report/report-gnome/report-gnome.scm
rename to gnucash/report/report-gnome/report-gnome.scm
diff --git a/gnucash/report/report-gnome/test/CMakeLists.txt b/gnucash/report/report-gnome/test/CMakeLists.txt
new file mode 100644
index 0000000..a20af2f
--- /dev/null
+++ b/gnucash/report/report-gnome/test/CMakeLists.txt
@@ -0,0 +1,19 @@
+SET(REPORT_GNOME_TEST_INCLUDE_DIRS
+  ${CMAKE_SOURCE_DIR}/libgnucash/gnc-module
+  ${GUILE_INCLUDE_DIRS}
+
+)
+SET(REPORT_GNOME_TEST_LIBS gnc-module)
+
+GNC_ADD_TEST_WITH_GUILE(test-link-module-report-gnome test-link-module.c
+  REPORT_GNOME_TEST_INCLUDE_DIRS REPORT_GNOME_TEST_LIBS
+)
+
+GNC_ADD_SCHEME_TEST(test-load-module-report-gnome
+  test-load-module.in
+)
+
+CONFIGURE_FILE(test-load-module.in test-load-module @ONLY)
+
+SET_DIST_LIST(test_report_gnome_DIST CMakeLists.txt Makefile.am test-link-module.c test-load-module.in)
+
diff --git a/gnucash/report/report-gnome/test/Makefile.am b/gnucash/report/report-gnome/test/Makefile.am
new file mode 100644
index 0000000..648f412
--- /dev/null
+++ b/gnucash/report/report-gnome/test/Makefile.am
@@ -0,0 +1,65 @@
+AM_CPPFLAGS = \
+  -I${top_srcdir} \
+  -I${top_srcdir}/common \
+  -I${top_srcdir}/common/test-core \
+  -I${top_srcdir}/libgnucash/engine \
+  -I${top_srcdir}/libgnucash/gnc-module \
+  ${GUILE_CFLAGS} \
+  ${GLIB_CFLAGS}
+
+LDADD = \
+  ${top_builddir}/libgnucash/engine/libgncmod-engine.la \
+  ${top_builddir}/libgnucash/gnc-module/libgnc-module.la \
+  ${top_builddir}/gnucash/report/report-gnome/libgncmod-report-gnome.la \
+  $(top_builddir)/libgnucash/app-utils/libgncmod-app-utils.la \
+  ${top_builddir}/gnucash/gnome-utils/libgncmod-gnome-utils.la \
+  ${GLIB_LIBS} \
+  ${GUILE_LIBS}
+
+TESTS = \
+  test-link-module \
+  test-load-module
+
+GNC_TEST_DEPS = --gnc-module-dir ${top_builddir}/libgnucash/engine \
+  --gnc-module-dir ${top_builddir}/libgnucash/app-utils \
+  --gnc-module-dir ${top_builddir}/gnucash/gnome-utils \
+  --gnc-module-dir ${top_builddir}/gnucash/html \
+  --gnc-module-dir ${top_builddir}/gnucash/report/report-system \
+  --gnc-module-dir ${top_builddir}/gnucash/report/report-gnome \
+\
+  --guile-load-dir ${top_builddir}/libgnucash/gnc-module \
+  --guile-load-dir ${top_builddir}/libgnucash/scm \
+  --guile-load-dir ${top_builddir}/libgnucash/engine \
+  --guile-load-dir ${top_builddir}/libgnucash/core-utils \
+  --guile-load-dir ${top_builddir}/libgnucash/app-utils \
+  --guile-load-dir ${top_builddir}/gnucash/gnome-utils \
+  --guile-load-dir ${top_builddir}/gnucash/report/report-system \
+  --guile-load-dir ${top_builddir}/gnucash/report/standard-reports \
+  --guile-load-dir ${top_builddir}/gnucash/report/business-reports \
+  --guile-load-dir ${top_builddir}/gnucash/report/utility-reports \
+  --guile-load-dir ${top_builddir}/gnucash/report/report-gnome \
+\
+  --library-dir    ${top_builddir}/gnucash/report/report-gnome \
+  --library-dir    ${top_builddir}/gnucash/report/report-system \
+  --library-dir    ${top_builddir}/libgnucash/core-utils \
+  --library-dir    ${top_builddir}/libgnucash/app-utils \
+  --library-dir    ${top_builddir}/libgnucash/gnc-module \
+  --library-dir    ${top_builddir}/libgnucash/engine \
+  --library-dir    ${top_builddir}/libgnucash/backend/xml \
+  --library-dir    ${top_builddir}/libgnucash/backend/sql \
+  --library-dir    ${top_builddir}/gnucash/gnome-utils \
+  --library-dir    ${top_builddir}/gnucash/html \
+  --library-dir    ${top_builddir}/gnucash/report/report-system \
+  --library-dir    ${top_builddir}/gnucash/report/report-gnome
+
+
+TESTS_ENVIRONMENT = \
+  GUILE_WARN_DEPRECATED=no \
+  GUILE="${GUILE}" \
+  GNC_BUILDDIR="${abs_top_builddir}" \
+  $(shell ${abs_top_srcdir}/common/gnc-test-env.pl --noexports ${GNC_TEST_DEPS})
+
+
+check_PROGRAMS = test-link-module
+
+EXTRA_DIST = test-load-module CMakeLists.txt
diff --git a/src/report/report-gnome/test/test-link-module.c b/gnucash/report/report-gnome/test/test-link-module.c
similarity index 100%
rename from src/report/report-gnome/test/test-link-module.c
rename to gnucash/report/report-gnome/test/test-link-module.c
diff --git a/src/report/report-gnome/test/test-load-module.in b/gnucash/report/report-gnome/test/test-load-module.in
similarity index 100%
rename from src/report/report-gnome/test/test-load-module.in
rename to gnucash/report/report-gnome/test/test-load-module.in
diff --git a/src/report/report-gnome/window-report.c b/gnucash/report/report-gnome/window-report.c
similarity index 100%
rename from src/report/report-gnome/window-report.c
rename to gnucash/report/report-gnome/window-report.c
diff --git a/src/report/report-gnome/window-report.h b/gnucash/report/report-gnome/window-report.h
similarity index 100%
rename from src/report/report-gnome/window-report.h
rename to gnucash/report/report-gnome/window-report.h
diff --git a/gnucash/report/report-system/CMakeLists.txt b/gnucash/report/report-system/CMakeLists.txt
new file mode 100644
index 0000000..c6eec39
--- /dev/null
+++ b/gnucash/report/report-system/CMakeLists.txt
@@ -0,0 +1,118 @@
+ADD_SUBDIRECTORY(test)
+
+SET (report_system_HEADERS
+  gnc-report.h
+)  
+
+IF (BUILDING_FROM_VCS)
+  SET (SWIG_REPORT_SYSTEM_C ${CMAKE_CURRENT_BINARY_DIR}/swig-report-system.c)
+  GNC_ADD_SWIG_COMMAND (swig-report-system-c ${SWIG_REPORT_SYSTEM_C} ${CMAKE_CURRENT_SOURCE_DIR}/report-system.i ${report_system_HEADERS})
+ELSE()
+  SET (SWIG_REPORT_SYSTEM_C swig-report-system.c)
+ENDIF()
+
+
+SET (report_system_SOURCES
+  gncmod-report-system.c
+  gnc-report.c
+)  
+
+ADD_LIBRARY (gncmod-report-system
+  ${report_system_SOURCES}
+  ${report_system_HEADERS}
+  ${SWIG_REPORT_SYSTEM_C}
+)
+
+TARGET_COMPILE_DEFINITIONS(gncmod-report-system PRIVATE -DG_LOG_DOMAIN=\"gnc.report.core\")
+
+TARGET_LINK_LIBRARIES(gncmod-report-system gnc-module gncmod-app-utils ${GTK3_LDFLAGS} ${GUILE_LDFLAGS})
+
+TARGET_INCLUDE_DIRECTORIES (gncmod-report-system
+    PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${GTK3_INCLUDE_DIRS}
+)
+
+
+INSTALL(TARGETS gncmod-report-system
+  LIBRARY DESTINATION lib/gnucash
+  ARCHIVE DESTINATION lib/gnucash
+  RUNTIME DESTINATION bin)
+
+INSTALL(FILES ${report_system_HEADERS} DESTINATION include/gnucash)
+
+# Scheme
+
+SET (report_system_SCHEME
+    report-system.scm
+    eguile-gnc.scm
+    eguile-utilities.scm
+    eguile-html-utilities.scm
+)
+
+SET (report_system_SCHEME_2
+    collectors.scm
+    list-extras.scm
+    report-collectors.scm
+)
+
+SET (report_system_SCHEME_3
+    commodity-utilities.scm
+    html-acct-table.scm
+    html-barchart.scm
+    html-document.scm
+    html-fonts.scm
+    html-piechart.scm
+    html-scatter.scm
+    html-linechart.scm
+    html-style-info.scm
+    html-style-sheet.scm
+    html-table.scm
+    html-text.scm
+    html-utilities.scm
+    html-jqplot.scm
+    options-utilities.scm
+    report-utilities.scm
+    report.scm
+)
+
+
+SET(GUILE_MODULES      libgnucash/app-utils libgnucash/engine gnucash/html gnucash/gnome-utils)
+SET(GUILE_LOAD_DIRS    libgnucash/app-utils libgnucash/core-utils libgnucash/engine libgnucash/gnc-module gnucash/gnome-utils gnucash/report/report-system libgnucash/scm)
+SET(GUILE_LIBRARY_DIRS libgnucash/app-utils libgnucash/core-utils libgnucash/engine libgnucash/gnc-module gnucash/gnome-utils)
+SET(GUILE_DEPENDS      gncmod-html gncmod-gnome-utils gncmod-report-system scm-app-utils scm-gnome-utils)
+
+
+GNC_ADD_SCHEME_TARGETS(scm-report-system
+  "${report_system_SCHEME}"
+  "gnucash/report"
+  "${GUILE_MODULES}"
+  "${GUILE_LOAD_DIRS}"
+  "${GUILE_LIBRARY_DIRS}"
+  "${GUILE_DEPENDS}"
+  FALSE
+)
+
+GNC_ADD_SCHEME_TARGETS(scm-report-system-2
+  "${report_system_SCHEME_2}"
+  "gnucash/report/report-system"
+  "${GUILE_MODULES}"
+  "${GUILE_LOAD_DIRS}"
+  "${GUILE_LIBRARY_DIRS}"
+  scm-report-system
+  FALSE
+)
+
+GNC_ADD_SCHEME_TARGETS(scm-report-system-3
+  "${report_system_SCHEME_3}"
+  ""
+  "${GUILE_MODULES}"
+  "${GUILE_LOAD_DIRS}"
+  "${GUILE_LIBRARY_DIRS}"
+  scm-report-system-2
+  FALSE
+)
+
+SET_LOCAL_DIST(report_system_DIST_local CMakeLists.txt Makefile.am report-system.i
+        ${report_system_HEADERS} ${report_system_SOURCES} ${report_system_SCHEME} ${report_system_SCHEME_1}
+        ${report_system_SCHEME_2} ${report_system_SCHEME_3})
+
+SET(report_system_DIST ${report_system_DIST_local} ${test_report_system_DIST} PARENT_SCOPE)
diff --git a/gnucash/report/report-system/Makefile.am b/gnucash/report/report-system/Makefile.am
new file mode 100644
index 0000000..6673447
--- /dev/null
+++ b/gnucash/report/report-system/Makefile.am
@@ -0,0 +1,170 @@
+SUBDIRS = . test
+
+pkglib_LTLIBRARIES = libgncmod-report-system.la
+
+libgncmod_report_system_la_SOURCES = \
+  swig-report-system.c \
+  gncmod-report-system.c \
+  gnc-report.c
+
+gncincludedir = ${GNC_INCLUDE_DIR}
+gncinclude_HEADERS = \
+  gnc-report.h
+
+libgncmod_report_system_la_LDFLAGS = -avoid-version
+
+libgncmod_report_system_la_LIBADD = \
+  ${top_builddir}/libgnucash/core-utils/libgnc-core-utils.la \
+  ${top_builddir}/libgnucash/engine/libgncmod-engine.la \
+  ${top_builddir}/libgnucash/gnc-module/libgnc-module.la \
+  ${top_builddir}/libgnucash/app-utils/libgncmod-app-utils.la \
+  ${top_builddir}/libgnucash/engine/libgncmod-engine.la \
+  ${GUILE_LIBS} \
+  ${GLIB_LIBS} \
+  ${GTK_LIBS}
+
+if BUILDING_FROM_VCS
+swig-report-system.c: report-system.i ${top_srcdir}/common/base-typemaps.i
+	$(SWIG) -guile $(SWIG_ARGS) -Linkage module \
+	-I${top_srcdir}/common -o $@ $<
+if ! OS_WIN32
+if ! SWIG_DIST_FAIL
+	if ! `grep "define scm_from_utf8_string" $@ > /dev/null 2>&1`; then \
+	  patch $@ $(top_srcdir)/common/swig-utf8.patch; \
+	fi
+endif
+endif
+endif
+
+AM_CPPFLAGS = \
+  -I${top_srcdir}/common \
+  -I${top_srcdir}/libgnucash/core-utils \
+  -I${top_srcdir}/libgnucash/gnc-module \
+  -I${top_srcdir}/libgnucash/app-utils \
+  -I${top_srcdir}/libgnucash/engine \
+  ${GLIB_CFLAGS} \
+  ${GTK_CFLAGS} \
+  ${GUILE_CFLAGS}
+
+gncscmdir = ${GNC_SCM_INSTALL_DIR}
+gncscm_DATA = \
+     commodity-utilities.scm  \
+     html-acct-table.scm \
+     html-barchart.scm \
+     html-document.scm \
+     html-fonts.scm \
+     html-piechart.scm \
+     html-scatter.scm \
+     html-linechart.scm \
+     html-style-info.scm \
+     html-style-sheet.scm \
+     html-table.scm \
+     html-text.scm \
+     html-utilities.scm \
+     html-jqplot.scm \
+     options-utilities.scm \
+     report-utilities.scm \
+     report.scm
+
+gncmodscmdir = ${GNC_SCM_INSTALL_DIR}/gnucash/report/report-system
+gncmodscm_DATA = \
+     collectors.scm \
+     list-extras.scm \
+     report-collectors.scm
+
+gncscmmoddir = ${GNC_SCM_INSTALL_DIR}/gnucash/report/
+gncscmmod_DATA = \
+    report-system.scm \
+	eguile-gnc.scm \
+	eguile-utilities.scm \
+	eguile-html-utilities.scm
+
+if GNUCASH_SEPARATE_BUILDDIR
+#For executing test cases
+# for running
+SCM_FILE_LINKS = \
+  ${gncscmmod_DATA} \
+  ${gncscm_DATA} \
+  ${gncmodscm_DATA}
+endif
+
+.scm-links:
+	$(RM) -rf gnucash
+	mkdir -p  gnucash
+	mkdir -p  gnucash/report
+	mkdir -p  gnucash/report/report-system
+if GNUCASH_SEPARATE_BUILDDIR
+	for X in ${SCM_FILE_LINKS} ; do \
+	  $(LN_S) -f ${srcdir}/$$X . ; \
+	done
+endif
+	( cd gnucash/report; for A in $(gncscmmod_DATA) ; do $(LN_S) -f ../../$$A . ; done )
+	( cd gnucash/report/report-system; for A in $(gncmodscm_DATA) ; do $(LN_S) -f ../../../$$A . ; done )
+if ! OS_WIN32
+# Windows knows no "ln -s" but uses "cp": must copy every time (see bug #566567).
+	touch .scm-links
+endif
+
+if GNC_HAVE_GUILE_2
+GUILE_COMPILE_ENV = \
+  --gnc-module-dir ${top_builddir}/libgnucash/app-utils \
+  --gnc-module-dir ${top_builddir}/libgnucash/engine \
+  --gnc-module-dir ${top_builddir}/gnucash/html \
+  --gnc-module-dir ${top_builddir}/gnucash/gnome-utils \
+  --gnc-module-dir ${top_builddir}/gnucash/report/report-system \
+  --guile-load-dir ${top_builddir}/libgnucash/app-utils \
+  --guile-load-dir ${top_builddir}/libgnucash/core-utils \
+  --guile-load-dir ${top_builddir}/libgnucash/engine \
+  --guile-load-dir ${top_builddir}/libgnucash/gnc-module \
+  --guile-load-dir ${top_builddir}/gnucash/gnome-utils \
+  --guile-load-dir ${top_builddir}/libgnucash/scm \
+  --guile-load-dir ${top_builddir}/gnucash/report/report-system \
+  --library-dir    ${top_builddir}/libgnucash/engine \
+  --library-dir    ${top_builddir}/libgnucash/app-utils \
+  --library-dir    ${top_builddir}/libgnucash/core-utils \
+  --library-dir    ${top_builddir}/libgnucash/gnc-module \
+  --library-dir    ${top_builddir}/gnucash/gnome-utils \
+  --library-dir    ${top_builddir}/libgnucash/backend/xml \
+  --library-dir    ${top_builddir}/libgnucash/backend/sql \
+  --library-dir    ${top_builddir}/gnucash/html \
+  --library-dir    ${top_builddir}/gnucash/report/report-system
+
+%.go : %.scm .scm-links $(pkglib_LTLIBRARIES)
+	GNC_UNINSTALLED=yes \
+	GNC_BUILDDIR=${top_builddir} \
+	$(shell ${abs_top_srcdir}/common/gnc-test-env.pl --noexports ${GUILE_COMPILE_ENV}) \
+	$(GUILD) compile -o $@ $<
+
+gncscmmodcachedir = ${pkglibdir}/scm/ccache/@GUILE_EFFECTIVE_VERSION@/gnucash/report
+gncscmmodcache_DATA = $(gncscmmod_DATA:.scm=.go)
+
+gncmodscmcachedir = ${pkglibdir}/scm/ccache/@GUILE_EFFECTIVE_VERSION@/gnucash/report/report-system
+gncmodscmcache_DATA = $(gncmodscm_DATA:.scm=.go)
+
+gncscmcachedir = ${pkglibdir}/scm/ccache/@GUILE_EFFECTIVE_VERSION@
+gncscmcache_DATA = $(gncscm_DATA:.scm=.go)
+endif
+
+noinst_DATA = .scm-links
+
+EXTRA_DIST = \
+	report-system.i \
+	${gncscmmod_DATA} \
+	${gncscm_DATA} \
+	${gncmodscm_DATA} \
+	CMakeLists.txt
+
+clean-local:
+	rm -rf gnucash
+
+CLEANFILES = \
+	report \
+	.scm-links \
+	${SCM_FILE_LINKS} \
+	${gncscmmodcache_DATA} \
+	${gncmodscmcache_DATA} \
+	${gncscmcache_DATA}
+
+MAINTAINERCLEANFILES = swig-report-system.c
+
+AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.report.core\"
diff --git a/src/report/report-system/collectors.scm b/gnucash/report/report-system/collectors.scm
similarity index 100%
rename from src/report/report-system/collectors.scm
rename to gnucash/report/report-system/collectors.scm
diff --git a/src/report/report-system/commodity-utilities.scm b/gnucash/report/report-system/commodity-utilities.scm
similarity index 100%
rename from src/report/report-system/commodity-utilities.scm
rename to gnucash/report/report-system/commodity-utilities.scm
diff --git a/src/report/report-system/doc/report-html.txt b/gnucash/report/report-system/doc/report-html.txt
similarity index 100%
rename from src/report/report-system/doc/report-html.txt
rename to gnucash/report/report-system/doc/report-html.txt
diff --git a/src/report/report-system/eguile-gnc.scm b/gnucash/report/report-system/eguile-gnc.scm
similarity index 100%
rename from src/report/report-system/eguile-gnc.scm
rename to gnucash/report/report-system/eguile-gnc.scm
diff --git a/src/report/report-system/eguile-html-utilities.scm b/gnucash/report/report-system/eguile-html-utilities.scm
similarity index 100%
rename from src/report/report-system/eguile-html-utilities.scm
rename to gnucash/report/report-system/eguile-html-utilities.scm
diff --git a/src/report/report-system/eguile-utilities.scm b/gnucash/report/report-system/eguile-utilities.scm
similarity index 100%
rename from src/report/report-system/eguile-utilities.scm
rename to gnucash/report/report-system/eguile-utilities.scm
diff --git a/src/report/report-system/gnc-report.c b/gnucash/report/report-system/gnc-report.c
similarity index 100%
rename from src/report/report-system/gnc-report.c
rename to gnucash/report/report-system/gnc-report.c
diff --git a/src/report/report-system/gnc-report.h b/gnucash/report/report-system/gnc-report.h
similarity index 100%
rename from src/report/report-system/gnc-report.h
rename to gnucash/report/report-system/gnc-report.h
diff --git a/src/report/report-system/gncmod-report-system.c b/gnucash/report/report-system/gncmod-report-system.c
similarity index 100%
rename from src/report/report-system/gncmod-report-system.c
rename to gnucash/report/report-system/gncmod-report-system.c
diff --git a/src/report/report-system/html-acct-table.scm b/gnucash/report/report-system/html-acct-table.scm
similarity index 100%
rename from src/report/report-system/html-acct-table.scm
rename to gnucash/report/report-system/html-acct-table.scm
diff --git a/src/report/report-system/html-barchart.scm b/gnucash/report/report-system/html-barchart.scm
similarity index 100%
rename from src/report/report-system/html-barchart.scm
rename to gnucash/report/report-system/html-barchart.scm
diff --git a/src/report/report-system/html-document.scm b/gnucash/report/report-system/html-document.scm
similarity index 100%
rename from src/report/report-system/html-document.scm
rename to gnucash/report/report-system/html-document.scm
diff --git a/src/report/report-system/html-fonts.scm b/gnucash/report/report-system/html-fonts.scm
similarity index 100%
rename from src/report/report-system/html-fonts.scm
rename to gnucash/report/report-system/html-fonts.scm
diff --git a/src/report/report-system/html-jqplot.scm b/gnucash/report/report-system/html-jqplot.scm
similarity index 100%
rename from src/report/report-system/html-jqplot.scm
rename to gnucash/report/report-system/html-jqplot.scm
diff --git a/src/report/report-system/html-linechart.scm b/gnucash/report/report-system/html-linechart.scm
similarity index 100%
rename from src/report/report-system/html-linechart.scm
rename to gnucash/report/report-system/html-linechart.scm
diff --git a/src/report/report-system/html-piechart.scm b/gnucash/report/report-system/html-piechart.scm
similarity index 100%
rename from src/report/report-system/html-piechart.scm
rename to gnucash/report/report-system/html-piechart.scm
diff --git a/src/report/report-system/html-scatter.scm b/gnucash/report/report-system/html-scatter.scm
similarity index 100%
rename from src/report/report-system/html-scatter.scm
rename to gnucash/report/report-system/html-scatter.scm
diff --git a/src/report/report-system/html-style-info.scm b/gnucash/report/report-system/html-style-info.scm
similarity index 100%
rename from src/report/report-system/html-style-info.scm
rename to gnucash/report/report-system/html-style-info.scm
diff --git a/src/report/report-system/html-style-sheet.scm b/gnucash/report/report-system/html-style-sheet.scm
similarity index 100%
rename from src/report/report-system/html-style-sheet.scm
rename to gnucash/report/report-system/html-style-sheet.scm
diff --git a/src/report/report-system/html-table.scm b/gnucash/report/report-system/html-table.scm
similarity index 100%
rename from src/report/report-system/html-table.scm
rename to gnucash/report/report-system/html-table.scm
diff --git a/src/report/report-system/html-text.scm b/gnucash/report/report-system/html-text.scm
similarity index 100%
rename from src/report/report-system/html-text.scm
rename to gnucash/report/report-system/html-text.scm
diff --git a/src/report/report-system/html-utilities.scm b/gnucash/report/report-system/html-utilities.scm
similarity index 100%
rename from src/report/report-system/html-utilities.scm
rename to gnucash/report/report-system/html-utilities.scm
diff --git a/src/report/report-system/list-extras.scm b/gnucash/report/report-system/list-extras.scm
similarity index 100%
rename from src/report/report-system/list-extras.scm
rename to gnucash/report/report-system/list-extras.scm
diff --git a/src/report/report-system/options-utilities.scm b/gnucash/report/report-system/options-utilities.scm
similarity index 100%
rename from src/report/report-system/options-utilities.scm
rename to gnucash/report/report-system/options-utilities.scm
diff --git a/src/report/report-system/report-collectors.scm b/gnucash/report/report-system/report-collectors.scm
similarity index 100%
rename from src/report/report-system/report-collectors.scm
rename to gnucash/report/report-system/report-collectors.scm
diff --git a/src/report/report-system/report-system.i b/gnucash/report/report-system/report-system.i
similarity index 100%
rename from src/report/report-system/report-system.i
rename to gnucash/report/report-system/report-system.i
diff --git a/src/report/report-system/report-system.scm b/gnucash/report/report-system/report-system.scm
similarity index 100%
rename from src/report/report-system/report-system.scm
rename to gnucash/report/report-system/report-system.scm
diff --git a/src/report/report-system/report-utilities.scm b/gnucash/report/report-system/report-utilities.scm
similarity index 100%
rename from src/report/report-system/report-utilities.scm
rename to gnucash/report/report-system/report-utilities.scm
diff --git a/src/report/report-system/report.scm b/gnucash/report/report-system/report.scm
similarity index 100%
rename from src/report/report-system/report.scm
rename to gnucash/report/report-system/report.scm
diff --git a/gnucash/report/report-system/test/CMakeLists.txt b/gnucash/report/report-system/test/CMakeLists.txt
new file mode 100644
index 0000000..0b0a05a
--- /dev/null
+++ b/gnucash/report/report-system/test/CMakeLists.txt
@@ -0,0 +1,32 @@
+
+SET(REPORT_SYSTEM_TEST_INCLUDE_DIRS
+  ${CMAKE_SOURCE_DIR}/libgnucash/gnc-module
+  ${GUILE_INCLUDE_DIRS}
+)
+SET(REPORT_SYSTEM_TEST_LIBS gnc-module)
+
+GNC_ADD_TEST_WITH_GUILE(test-link-module-report-system test-link-module.c
+  REPORT_SYSTEM_TEST_INCLUDE_DIRS REPORT_SYSTEM_TEST_LIBS
+)
+
+GNC_ADD_SCHEME_TEST(test-load-module-report-system test-load-module.in)
+GNC_ADD_SCHEME_TEST(test-collectors test-collectors.scm)
+GNC_ADD_SCHEME_TEST(test-list-extras test-list-extras.scm)
+GNC_ADD_SCHEME_TEST(test-report-utilities test-report-utilities.scm)
+# This test is not run in the autotools build.
+#GNC_ADD_SCHEME_TEST(test-test-extras test-test-extras.scm)
+
+GNC_ADD_SCHEME_TARGETS(scm-test-report-system
+  test-extras.scm
+  gnucash/report/report-system/test
+  ""
+  ""
+  ""
+  "scm-gnc-module;scm-test-engine;scm-report-system-3"
+  FALSE
+)
+
+CONFIGURE_FILE(test-load-module.in test-load-module @ONLY)
+
+SET_DIST_LIST(test_report_system_DIST CMakeLists.txt Makefile.am test-collectors.scm test-extras.scm test-link-module.c
+        test-load-module.in test-report-utilities.scm test-list-extras.scm)
\ No newline at end of file
diff --git a/gnucash/report/report-system/test/Makefile.am b/gnucash/report/report-system/test/Makefile.am
new file mode 100644
index 0000000..fcdd1fe
--- /dev/null
+++ b/gnucash/report/report-system/test/Makefile.am
@@ -0,0 +1,101 @@
+AM_CPPFLAGS = \
+  -I${top_srcdir} \
+  -I${top_srcdir}/common \
+  -I${top_srcdir}/common/test-core \
+  -I${top_srcdir}/libgnucash/engine \
+  -I${top_srcdir}/libgnucash/gnc-module \
+  ${GUILE_CFLAGS} \
+  ${GLIB_CFLAGS}
+
+LDADD = \
+  ${top_builddir}/libgnucash/engine/libgncmod-engine.la \
+  ${top_builddir}/libgnucash/gnc-module/libgnc-module.la \
+  ${GLIB_LIBS} \
+  ${GUILE_LIBS}
+
+TESTS = \
+  test-link-module \
+  test-load-module \
+  $(SCM_TESTS)
+
+SCM_TESTS = \
+	test-collectors \
+	test-list-extras \
+	test-report-utilities
+
+SCM_TEST_SRCS = $(SCM_TESTS:%=%.scm)
+
+GNC_TEST_DEPS = --gnc-module-dir ${top_builddir}/libgnucash/engine \
+  --gnc-module-dir ${top_builddir}/libgnucash/app-utils \
+  --gnc-module-dir ${top_builddir}/gnucash/gnome-utils \
+  --gnc-module-dir ${top_builddir}/gnucash/html \
+  --gnc-module-dir ${top_builddir}/gnucash/report/report-system \
+  --gnc-module-dir ${top_builddir}/gnucash/report/report-system/test \
+  --gnc-module-dir ${top_builddir}/libgnucash/engine/test \
+  --gnc-module-dir ${top_builddir}/libgnucash/backend/xml \
+  --gnc-module-dir ${top_builddir}/libgnucash/backend/sql \
+  --gnc-module-dir ${top_builddir}/libgnucash/backend/dbi \
+ \
+  --guile-load-dir ${top_builddir}/libgnucash/gnc-module \
+  --guile-load-dir ${top_builddir}/libgnucash/scm \
+  --guile-load-dir ${top_builddir}/libgnucash/engine \
+  --guile-load-dir ${top_builddir}/libgnucash/engine/test \
+  --guile-load-dir ${top_builddir}/libgnucash/core-utils \
+  --guile-load-dir ${top_builddir}/libgnucash/app-utils \
+  --guile-load-dir ${top_builddir}/gnucash/gnome-utils \
+  --guile-load-dir ${top_builddir}/gnucash/report/report-system \
+  --guile-load-dir ${top_builddir}/gnucash/report/report-system/test \
+\
+  --library-dir    ${top_builddir}/gnucash/report/report-system \
+  --library-dir    ${top_builddir}/libgnucash/core-utils \
+  --library-dir    ${top_builddir}/libgnucash/app-utils \
+  --library-dir    ${top_builddir}/gnucash/gnome-utils \
+  --library-dir    ${top_builddir}/libgnucash/engine \
+  --library-dir    ${top_builddir}/libgnucash/backend/xml \
+  --library-dir    ${top_builddir}/libgnucash/backend/sql  \
+  --library-dir    ${top_builddir}/libgnucash/backend/dbi  \
+  --library-dir    ${top_builddir}/libgnucash/gnc-module
+
+$(SCM_TESTS): %: $(srcdir)/%.scm Makefile .scm-links
+	echo 'export GNC_BUILDDIR="${abs_top_builddir}";' > $@
+	echo 'export GNC_UNINSTALLED=yes;' >> $@
+	echo '${GUILE} --debug -l $(srcdir)/$*.scm -c "(exit (run-test))"' >> $@
+	chmod a+x $@
+
+TESTS_ENVIRONMENT = \
+  GUILE_WARN_DEPRECATED=no \
+  GUILE="${GUILE}" \
+  GNC_BUILDDIR="${abs_top_builddir}" \
+  $(shell ${abs_top_srcdir}/common/gnc-test-env.pl --noexports ${GNC_TEST_DEPS})
+
+
+check_PROGRAMS = test-link-module
+
+SCM_TEST_HELPERS = test-extras.scm
+
+EXTRA_DIST = \
+	test-load-module \
+	$(SCM_TEST_HELPERS) \
+	$(SCM_TEST_SRCS) \
+	CMakeLists.txt
+
+testit:
+	$(TESTS_ENVIRONMENT) libtool --mode execute gdb test-link-module
+
+
+.scm-links:
+	$(RM) -rf gnucash
+	mkdir -p  gnucash/report/report-system/test
+	( cd gnucash/report/report-system/test; for A in $(SCM_TEST_HELPERS) ; do $(LN_S) -f $(abs_srcdir)/$$A . ; done )
+if ! OS_WIN32
+# Windows knows no "ln -s" but uses "cp": must copy every time (see bug #566567).
+	touch .scm-links
+endif
+
+clean-local:
+	$(RM) -rf gnucash
+	$(RM) *.log
+
+noinst_DATA = .scm-links
+CLEANFILES = .scm-links
+DISTCLEANFILES = $(SCM_TESTS)
diff --git a/src/report/report-system/test/test-collectors.scm b/gnucash/report/report-system/test/test-collectors.scm
similarity index 100%
rename from src/report/report-system/test/test-collectors.scm
rename to gnucash/report/report-system/test/test-collectors.scm
diff --git a/src/report/report-system/test/test-extras.scm b/gnucash/report/report-system/test/test-extras.scm
similarity index 100%
rename from src/report/report-system/test/test-extras.scm
rename to gnucash/report/report-system/test/test-extras.scm
diff --git a/src/report/report-system/test/test-link-module.c b/gnucash/report/report-system/test/test-link-module.c
similarity index 100%
rename from src/report/report-system/test/test-link-module.c
rename to gnucash/report/report-system/test/test-link-module.c
diff --git a/src/report/report-system/test/test-list-extras.scm b/gnucash/report/report-system/test/test-list-extras.scm
similarity index 100%
rename from src/report/report-system/test/test-list-extras.scm
rename to gnucash/report/report-system/test/test-list-extras.scm
diff --git a/src/report/report-system/test/test-load-module.in b/gnucash/report/report-system/test/test-load-module.in
similarity index 100%
rename from src/report/report-system/test/test-load-module.in
rename to gnucash/report/report-system/test/test-load-module.in
diff --git a/src/report/report-system/test/test-report-utilities.scm b/gnucash/report/report-system/test/test-report-utilities.scm
similarity index 100%
rename from src/report/report-system/test/test-report-utilities.scm
rename to gnucash/report/report-system/test/test-report-utilities.scm
diff --git a/src/report/report-system/test/test-test-extras.scm b/gnucash/report/report-system/test/test-test-extras.scm
similarity index 100%
rename from src/report/report-system/test/test-test-extras.scm
rename to gnucash/report/report-system/test/test-test-extras.scm
diff --git a/gnucash/report/standard-reports/CMakeLists.txt b/gnucash/report/standard-reports/CMakeLists.txt
new file mode 100644
index 0000000..c8d46e4
--- /dev/null
+++ b/gnucash/report/standard-reports/CMakeLists.txt
@@ -0,0 +1,71 @@
+
+ADD_SUBDIRECTORY(test)
+
+SET (standard_reports_SCHEME standard-reports.scm)
+
+SET (standard_reports_SCHEME_2
+    account-piecharts.scm
+    account-summary.scm
+    advanced-portfolio.scm
+    average-balance.scm
+    balance-sheet.scm
+    budget-balance-sheet.scm
+    budget-barchart.scm
+    budget-flow.scm
+    budget-income-statement.scm
+    budget.scm
+    cash-flow.scm
+    category-barchart.scm
+    daily-reports.scm
+    equity-statement.scm
+    general-journal.scm
+    general-ledger.scm
+    income-statement.scm
+    net-barchart.scm
+    net-linechart.scm
+    portfolio.scm
+    price-scatter.scm
+    register.scm
+    sx-summary.scm
+    transaction.scm
+    trial-balance.scm
+    )
+
+SET(GUILE_MODULES      libgnucash/app-utils libgnucash/engine gnucash/gnome-utils gnucash/html gnucash/report/report-system)
+SET(GUILE_LOAD_DIRS    libgnucash/app-utils libgnucash/engine libgnucash/core-utils libgnucash/gnc-module gnucash/gnome-utils gnucash/report/report-system libgnucash/scm)
+SET(GUILE_LIBRARY_DIRS libgnucash/app-utils libgnucash/engine libgnucash/core-utils libgnucash/gnc-module gnucash/gnome-utils gnucash/report/report-system)
+SET(GUILE_DEPENDS      gncmod-html scm-app-utils scm-gnome-utils scm-report-system scm-report-system-3)
+
+GNC_ADD_SCHEME_TARGETS(scm-standard-reports-1
+  "${standard_reports_SCHEME}"
+  "gnucash/report"
+  "${GUILE_MODULES}"
+  "${GUILE_LOAD_DIRS}"
+  "${GUILE_LIBRARY_DIRS}"
+  "scm-standard-reports-2;${GUILE_DEPENDS}"
+  TRUE
+)
+
+GNC_ADD_SCHEME_TARGETS(scm-standard-reports-2
+  "${standard_reports_SCHEME_2}"
+  "gnucash/report/standard-reports"
+  "${GUILE_MODULES}"
+  "${GUILE_LOAD_DIRS}"
+  "${GUILE_LIBRARY_DIRS}"
+  "scm-standard-reports-2-links;${GUILE_DEPENDS}"
+  TRUE
+)
+
+ADD_CUSTOM_TARGET(scm-standard-reports ALL DEPENDS scm-standard-reports-2 scm-standard-reports)
+
+# FIXME: This is a hack since core-utils assumes an autotools build environment.
+
+SET(STD_RPT_DIR ${CMAKE_CURRENT_BINARY_DIR}/gnucash/report)
+FILE(MAKE_DIRECTORY ${STD_RPT_DIR})
+FILE(COPY standard-reports.scm DESTINATION ${STD_RPT_DIR})
+
+FILE(MAKE_DIRECTORY ${STD_RPT_DIR}/standard-reports)
+FILE(COPY ${standard_reports_SCHEME_2} DESTINATION ${STD_RPT_DIR}/standard-reports)
+
+SET_LOCAL_DIST(standard_reports_DIST_local CMakeLists.txt Makefile.am ${standard_reports_SCHEME} ${standard_reports_SCHEME_2})
+SET(standard_reports_DIST ${standard_reports_DIST_local} ${test_standard_reports_DIST} PARENT_SCOPE)
diff --git a/gnucash/report/standard-reports/Makefile.am b/gnucash/report/standard-reports/Makefile.am
new file mode 100644
index 0000000..5d0bf60
--- /dev/null
+++ b/gnucash/report/standard-reports/Makefile.am
@@ -0,0 +1,114 @@
+SUBDIRS = . test
+
+gncscmmoddir = ${GNC_SCM_INSTALL_DIR}/gnucash/report/
+gncscmmod_DATA = \
+   standard-reports.scm
+
+gncscmrptdir = ${GNC_SCM_INSTALL_DIR}/gnucash/report/standard-reports
+gncscmrpt_DATA = \
+   account-piecharts.scm \
+   account-summary.scm \
+   advanced-portfolio.scm \
+   average-balance.scm \
+   balance-sheet.scm \
+   budget.scm \
+   budget-balance-sheet.scm \
+   budget-barchart.scm \
+   budget-flow.scm \
+   budget-income-statement.scm \
+   cash-flow.scm \
+   category-barchart.scm \
+   daily-reports.scm \
+   equity-statement.scm \
+   general-journal.scm \
+   general-ledger.scm \
+   income-statement.scm \
+   net-barchart.scm \
+   net-linechart.scm \
+   portfolio.scm \
+   price-scatter.scm \
+   register.scm \
+   sx-summary.scm \
+   trial-balance.scm \
+   transaction.scm
+
+
+
+if GNUCASH_SEPARATE_BUILDDIR
+#For executing test cases
+SCM_FILE_LINKS = ${gncscmmod_DATA} ${gncscmrpt_DATA}
+endif
+
+.scm-links:
+	$(RM) -rf gnucash
+	mkdir -p  gnucash
+	mkdir -p  gnucash/report
+	mkdir -p  gnucash/report/standard-reports
+if GNUCASH_SEPARATE_BUILDDIR
+	for X in ${SCM_FILE_LINKS} ; do \
+	  $(LN_S) -f ${srcdir}/$$X . ; \
+	done
+endif
+	( cd gnucash/report; for A in $(gncscmmod_DATA) ; do $(LN_S) -f ../../$$A . ; done )
+	( cd gnucash/report/standard-reports; for A in $(gncscmrpt_DATA) ; do $(LN_S) -f ../../../$$A . ; done )
+if ! OS_WIN32
+# Windows knows no "ln -s" but uses "cp": must copy every time (see bug #566567).
+	touch .scm-links
+endif
+
+if GNC_HAVE_GUILE_2
+GUILE_COMPILE_ENV = \
+  --gnc-module-dir ${top_builddir}/libgnucash/app-utils \
+  --gnc-module-dir ${top_builddir}/libgnucash/engine \
+  --gnc-module-dir ${top_builddir}/gnucash/gnome-utils \
+  --gnc-module-dir ${top_builddir}/gnucash/html \
+  --gnc-module-dir ${top_builddir}/gnucash/report/report-system \
+  --guile-load-dir ${top_builddir}/libgnucash/app-utils \
+  --guile-load-dir ${top_builddir}/libgnucash/core-utils \
+  --guile-load-dir ${top_builddir}/libgnucash/engine \
+  --guile-load-dir ${top_builddir}/libgnucash/gnc-module \
+  --guile-load-dir ${top_builddir}/gnucash/gnome-utils \
+  --guile-load-dir ${top_builddir}/gnucash/report/report-system \
+  --guile-load-dir ${top_builddir}/gnucash/report/standard-reports \
+  --guile-load-dir ${top_builddir}/libgnucash/scm \
+  --library-dir    ${top_builddir}/libgnucash/engine \
+  --library-dir    ${top_builddir}/libgnucash/app-utils \
+  --library-dir    ${top_builddir}/libgnucash/core-utils \
+  --library-dir    ${top_builddir}/libgnucash/gnc-module \
+  --library-dir    ${top_builddir}/gnucash/gnome-utils \
+  --library-dir    ${top_builddir}/libgnucash/backend/xml \
+  --library-dir    ${top_builddir}/libgnucash/backend/sql \
+  --library-dir    ${top_builddir}/gnucash/html \
+  --library-dir    ${top_builddir}/gnucash/report/report-system
+
+%.go : %.scm .scm-links $(pkglib_LTLIBRARIES)
+	GNC_UNINSTALLED=yes \
+	GNC_BUILDDIR=${top_builddir} \
+	$(shell ${abs_top_srcdir}/common/gnc-test-env.pl --noexports ${GUILE_COMPILE_ENV}) \
+	$(GUILD) compile -o $@ $<
+
+gncscmmodcachedir = ${pkglibdir}/scm/ccache/@GUILE_EFFECTIVE_VERSION@/gnucash/report
+gncscmmodcache_DATA = $(gncscmmod_DATA:.scm=.go)
+
+gncscmrptcachedir = ${pkglibdir}/scm/ccache/@GUILE_EFFECTIVE_VERSION@/gnucash/report/standard-reports
+gncscmrptcache_DATA = $(gncscmrpt_DATA:.scm=.go)
+endif
+
+clean-local:
+	$(RM) -rf gnucash
+
+noinst_DATA = .scm-links
+
+EXTRA_DIST = \
+	${gncscmmod_DATA} \
+	${gncscmrpt_DATA} \
+	CMakeLists.txt
+
+CLEANFILES = \
+	.scm-links \
+	${gncscmmodcache_DATA} \
+	${gncscmrptcache_DATA}
+
+DISTCLEANFILES = ${SCM_FILE_LINKS}
+
+AM_CPPFLAGS = -DG_LOG_DOMAIN=\"gnc.report.standard\"
diff --git a/src/report/standard-reports/account-piecharts.scm b/gnucash/report/standard-reports/account-piecharts.scm
similarity index 100%
rename from src/report/standard-reports/account-piecharts.scm
rename to gnucash/report/standard-reports/account-piecharts.scm
diff --git a/src/report/standard-reports/account-summary.scm b/gnucash/report/standard-reports/account-summary.scm
similarity index 100%
rename from src/report/standard-reports/account-summary.scm
rename to gnucash/report/standard-reports/account-summary.scm
diff --git a/gnucash/report/standard-reports/advanced-portfolio.scm b/gnucash/report/standard-reports/advanced-portfolio.scm
new file mode 100644
index 0000000..6a05845
--- /dev/null
+++ b/gnucash/report/standard-reports/advanced-portfolio.scm
@@ -0,0 +1,1203 @@
+;; -*-scheme-*- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; advanced-portfolio.scm
+;; by Martijn van Oosterhout (kleptog at svana.org) Feb 2002
+;; modified for GnuCash 1.8 by Herbert Thoma (herbie at hthoma.de) Oct 2002
+;;
+;; Heavily based on portfolio.scm
+;; by Robert Merkel (rgmerk at mira.net)
+;;
+;; 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 at gnu.org
+;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(define-module (gnucash report standard-reports advanced-portfolio))
+
+(use-modules (gnucash main)) ;; FIXME: delete after we finish modularizing.
+(use-modules (srfi srfi-1))
+(use-modules (gnucash gnc-module))
+(use-modules (gnucash gettext))
+
+(use-modules (gnucash printf))
+
+(gnc:module-load "gnucash/report/report-system" 0)
+
+(define reportname (N_ "Advanced Portfolio"))
+
+(define optname-price-source (N_ "Price Source"))
+(define optname-shares-digits (N_ "Share decimal places"))
+(define optname-zero-shares (N_ "Include accounts with no shares"))
+(define optname-show-symbol (N_ "Show ticker symbols"))
+(define optname-show-listing (N_ "Show listings"))
+(define optname-show-price (N_ "Show prices"))
+(define optname-show-shares (N_ "Show number of shares"))
+(define optname-basis-method (N_ "Basis calculation method"))
+(define optname-prefer-pricelist (N_ "Set preference for price list data"))
+(define optname-brokerage-fees (N_ "How to report brokerage fees"))
+
+;; To avoid overflows in our calculations, define a denominator for prices and unit values
+(define price-denom 100000000)
+(define units-denom 100000000)
+
+(define (options-generator)
+  (let* ((options (gnc:new-options))
+         ;; This is just a helper function for making options.
+         ;; See libgnucash/scm/options.scm for details.
+         (add-option
+          (lambda (new-option)
+            (gnc:register-option options new-option))))
+
+    ;; General Tab
+    ;; date at which to report balance
+    (gnc:options-add-report-date!
+     options gnc:pagename-general
+     (N_ "Date") "a")
+
+    (gnc:options-add-currency!
+     options gnc:pagename-general (N_ "Report's currency") "c")
+
+    (add-option
+     (gnc:make-multichoice-option
+      gnc:pagename-general optname-price-source
+      "d" (N_ "The source of price information.") 'pricedb-nearest
+      (list (vector 'pricedb-latest
+		    (N_ "Most recent")
+		    (N_ "The most recent recorded price."))
+	    (vector 'pricedb-nearest
+		    (N_ "Nearest in time")
+		    (N_ "The price recorded nearest in time to the report date."))
+	    )))
+
+    (add-option
+     (gnc:make-multichoice-option
+      gnc:pagename-general optname-basis-method
+      "e" (N_ "Basis calculation method.") 'average-basis
+      (list (vector 'average-basis
+		    (N_ "Average")
+		    (N_ "Use average cost of all shares for basis."))
+	    (vector 'fifo-basis
+		    (N_ "FIFO")
+		    (N_ "Use first-in first-out method for basis."))
+	    (vector 'filo-basis
+		    (N_ "LIFO")
+		    (N_ "Use last-in first-out method for basis."))
+	    )))
+
+    (add-option
+     (gnc:make-simple-boolean-option
+      gnc:pagename-general optname-prefer-pricelist "f"
+      (N_ "Prefer use of price editor pricing over transactions, where applicable.")
+      #t))
+
+    (add-option
+     (gnc:make-multichoice-option
+      gnc:pagename-general optname-brokerage-fees
+      "g" (N_ "How to report commissions and other brokerage fees.") 'include-in-basis
+      (list (vector 'include-in-basis
+                    (N_ "Include in basis")
+                    (N_ "Include brokerage fees in the basis for the asset."))
+            (vector 'include-in-gain
+                    (N_ "Include in gain")
+                    (N_  "Include brokerage fees in the gain and loss but not in the basis."))
+            (vector 'ignore-brokerage
+                    (N_ "Ignore")
+                    (N_ "Ignore brokerage fees entirely."))
+            )))
+
+    (gnc:register-option
+      options
+      (gnc:make-simple-boolean-option
+	gnc:pagename-display optname-show-symbol "a"
+	(N_ "Display the ticker symbols.")
+	#t))
+
+    (gnc:register-option
+      options
+      (gnc:make-simple-boolean-option
+	gnc:pagename-display optname-show-listing "b"
+	(N_ "Display exchange listings.")
+	#t))
+
+    (gnc:register-option
+      options
+      (gnc:make-simple-boolean-option
+	gnc:pagename-display optname-show-shares "c"
+	(N_ "Display numbers of shares in accounts.")
+	#t))
+
+    (add-option
+     (gnc:make-number-range-option
+      gnc:pagename-display optname-shares-digits
+      "d" (N_ "The number of decimal places to use for share numbers.") 2
+      0 6 0 1))
+
+    (gnc:register-option
+      options
+      (gnc:make-simple-boolean-option
+	gnc:pagename-display optname-show-price "e"
+	(N_ "Display share prices.")
+	#t))
+
+    ;; Account tab
+    (add-option
+     (gnc:make-account-list-option
+      gnc:pagename-accounts (N_ "Accounts")
+      "b"
+      (N_ "Stock Accounts to report on.")
+      (lambda () (filter gnc:account-is-stock?
+                         (gnc-account-get-descendants-sorted
+                          (gnc-get-current-root-account))))
+      (lambda (accounts) (list  #t
+                                (filter gnc:account-is-stock? accounts)))
+      #t))
+
+    (gnc:register-option
+     options
+     (gnc:make-simple-boolean-option
+      gnc:pagename-accounts optname-zero-shares "e"
+      (N_ "Include accounts that have a zero share balances.")
+      #f))
+
+    (gnc:options-set-default-section options gnc:pagename-general)
+    options))
+
+;; This is the rendering function. It accepts a database of options
+;; and generates an object of type <html-document>.  See the file
+;; report-html.txt for documentation; the file report-html.scm
+;; includes all the relevant Scheme code. The option database passed
+;; to the function is one created by the options-generator function
+;; defined above.
+
+(define (advanced-portfolio-renderer report-obj)
+
+ (let ((work-done 0)
+       (work-to-do 0)
+       (warn-no-price #f)
+       (warn-price-dirty #f))
+
+  ;; These are some helper functions for looking up option values.
+  (define (get-op section name)
+    (gnc:lookup-option (gnc:report-options report-obj) section name))
+
+  (define (get-option section name)
+    (gnc:option-value (get-op section name)))
+
+  (define (split-account-type? split type)
+    (eq? type (xaccAccountGetType (xaccSplitGetAccount split))))
+
+  (define (same-split? s1 s2)
+    (equal? (gncSplitGetGUID s1) (gncSplitGetGUID s2)))
+
+  (define (same-account? a1 a2)
+    (equal? (gncAccountGetGUID a1) (gncAccountGetGUID a2)))
+
+  ;; sum up the contents of the b-list built by basis-builder below
+  (define (sum-basis b-list currency-frac)
+    (if (not (eqv? b-list '()))
+	(gnc-numeric-add (gnc-numeric-mul (caar b-list) (cdar b-list) currency-frac GNC-RND-ROUND)
+			 (sum-basis (cdr b-list) currency-frac) currency-frac GNC-RND-ROUND)
+	(gnc-numeric-zero)
+	)
+    )
+
+  ;; sum up the total number of units in the b-list built by basis-builder below
+  (define (units-basis b-list)
+    (if (not (eqv? b-list '()))
+	(gnc-numeric-add (caar b-list) (units-basis (cdr b-list))
+			 units-denom GNC-RND-ROUND)
+	(gnc-numeric-zero)
+	)
+    )
+
+  ;; apply a ratio to an existing basis-list, useful for splits/mergers and spinoffs
+  ;; I need to get a brain and use (map) for this.
+  (define (apply-basis-ratio b-list units-ratio value-ratio)
+    (if (not (eqv? b-list '()))
+	(cons (cons (gnc-numeric-mul units-ratio (caar b-list) units-denom GNC-RND-ROUND)
+		    (gnc-numeric-mul value-ratio (cdar b-list) price-denom GNC-RND-ROUND))
+	      (apply-basis-ratio (cdr b-list) units-ratio value-ratio))
+	'()
+	)
+    )
+
+  ;; this builds a list for basis calculation and handles average, fifo and lifo methods
+  ;; the list is cons cells of (units-of-stock . price-per-unit)... average method produces only one
+  ;; cell that mutates to the new average. Need to add a date checker so that we allow for prices
+  ;; coming in out of order, such as a transfer with a price adjusted to carryover the basis.
+  (define (basis-builder b-list b-units b-value b-method currency-frac)
+    (gnc:debug "actually in basis-builder")
+    (gnc:debug "b-list is " b-list " b-units is " (gnc-numeric-to-string b-units)
+               " b-value is " (gnc-numeric-to-string b-value) " b-method is " b-method)
+
+    ;; if there is no b-value, then this is a split/merger and needs special handling
+    (cond
+
+     ;; we have value and positive units, add units to basis
+     ((and (not (gnc-numeric-zero-p b-value))
+	   (gnc-numeric-positive-p b-units))
+      (case b-method
+	((average-basis)
+	 (if (not (eqv? b-list '()))
+	     (list (cons (gnc-numeric-add b-units
+					  (caar b-list) units-denom GNC-RND-ROUND)
+			 (gnc-numeric-div
+			  (gnc-numeric-add b-value
+					   (gnc-numeric-mul (caar b-list)
+							    (cdar b-list)
+							    GNC-DENOM-AUTO GNC-DENOM-REDUCE)
+					   GNC-DENOM-AUTO GNC-DENOM-REDUCE)
+			  (gnc-numeric-add b-units
+					   (caar b-list) GNC-DENOM-AUTO GNC-DENOM-REDUCE)
+			  price-denom GNC-RND-ROUND)))
+	     (append b-list
+		     (list (cons b-units (gnc-numeric-div
+					  b-value b-units price-denom GNC-RND-ROUND))))))
+	(else (append b-list
+		      (list (cons b-units (gnc-numeric-div
+					   b-value b-units price-denom GNC-RND-ROUND)))))))
+
+     ;; we have value and negative units, remove units from basis
+     ((and (not (gnc-numeric-zero-p b-value))
+	   (gnc-numeric-negative-p b-units))
+      (if (not (eqv? b-list '()))
+          (case b-method
+            ((fifo-basis)
+             (case (gnc-numeric-compare (gnc-numeric-abs b-units) (caar b-list))
+               ((-1)
+                 ;; Sold less than the first lot, create a new first lot from the remainder
+                 (let ((new-units (gnc-numeric-add b-units (caar b-list) units-denom GNC-RND-ROUND)))
+                        (cons (cons new-units (cdar b-list)) (cdr b-list))))
+               ((0)
+                 ;; Sold all of the first lot
+                 (cdr b-list))
+               ((1)
+                 ;; Sold more than the first lot, delete it and recurse
+                 (basis-builder (cdr b-list) (gnc-numeric-add b-units (caar b-list) units-denom GNC-RND-ROUND)
+                                b-value  ;; Only the sign of b-value matters since the new b-units is negative
+                                b-method currency-frac))))
+            ((filo-basis)
+             (let ((rev-b-list (reverse b-list)))
+               (case (gnc-numeric-compare (gnc-numeric-abs b-units) (caar rev-b-list))
+                 ((-1)
+                   ;; Sold less than the last lot
+                 (let ((new-units (gnc-numeric-add b-units (caar rev-b-list) units-denom GNC-RND-ROUND)))
+                        (reverse (cons (cons new-units (cdar rev-b-list)) (cdr rev-b-list)))))
+                 ((0)
+                   ;; Sold all of the last lot
+                   (reverse (cdr rev-b-list))
+                 )
+                 ((1)
+                   ;; Sold more than the last lot
+                   (basis-builder (reverse (cdr rev-b-list)) (gnc-numeric-add b-units (caar rev-b-list) units-denom GNC-RND-ROUND)
+                                           b-value b-method currency-frac)
+                 ))))
+            ((average-basis)
+             (list (cons (gnc-numeric-add
+                          (caar b-list) b-units units-denom GNC-RND-ROUND)
+                         (cdar b-list)))))
+          '()
+          ))
+
+     ;; no value, just units, this is a split/merge...
+     ((and (gnc-numeric-zero-p b-value)
+	   (not (gnc-numeric-zero-p b-units)))
+	(let* ((current-units (units-basis b-list))
+	       (units-ratio (gnc-numeric-div (gnc-numeric-add b-units current-units GNC-DENOM-AUTO GNC-DENOM-REDUCE)
+					     current-units GNC-DENOM-AUTO GNC-DENOM-REDUCE))
+               ;; If the units ratio is zero the stock is worthless and the value should be zero too
+	       (value-ratio (if (gnc-numeric-zero-p units-ratio)
+	                        (gnc-numeric-zero)
+                                (gnc-numeric-div (gnc:make-gnc-numeric 1 1) units-ratio GNC-DENOM-AUTO GNC-DENOM-REDUCE))))
+
+	  (gnc:debug "blist is " b-list " current units is "
+	             (gnc-numeric-to-string current-units)
+	             " value ratio is " (gnc-numeric-to-string value-ratio)
+	             " units ratio is " (gnc-numeric-to-string units-ratio))
+	  (apply-basis-ratio b-list units-ratio value-ratio)
+	  ))
+
+	;; If there are no units, just a value, then its a spin-off,
+	;; calculate a ratio for the values, but leave the units alone
+	;; with a ratio of 1
+     ((and (gnc-numeric-zero-p b-units)
+	   (not (gnc-numeric-zero-p b-value)))
+      (let* ((current-value (sum-basis b-list GNC-DENOM-AUTO))
+	     (value-ratio (gnc-numeric-div (gnc-numeric-add b-value current-value GNC-DENOM-AUTO GNC-DENOM-REDUCE)
+					   current-value GNC-DENOM-AUTO GNC-DENOM-REDUCE)))
+
+	(gnc:debug "this is a spinoff")
+	(gnc:debug "blist is " b-list " value ratio is " (gnc-numeric-to-string value-ratio))
+	(apply-basis-ratio b-list (gnc:make-gnc-numeric 1 1) value-ratio))
+      )
+
+     ;; when all else fails, just send the b-list back
+     (else
+      b-list)
+     )
+    )
+
+  ;; Given a price list and a currency find the price for that currency on the list.
+  ;; If there is none for the requested currency, return the first one.
+  ;; The price list is released but the price returned is ref counted.
+  (define (find-price price-list currency)
+    (if (eqv? price-list '()) #f
+      (let ((price (car price-list)))
+        (for-each
+          (lambda (p)
+            (if (gnc-commodity-equiv currency (gnc-price-get-currency p))
+                (set! price p))
+            (if (gnc-commodity-equiv currency (gnc-price-get-commodity p))
+                (set! price (gnc-price-invert p))))
+          price-list)
+        (gnc-price-ref price)
+        (gnc-price-list-destroy price-list)
+        price)))
+
+  ;; Return true if either account is the parent of the other or they are siblings
+  (define (parent-or-sibling? a1 a2)
+    (let ((a2parent (gnc-account-get-parent a2))
+          (a1parent (gnc-account-get-parent a1)))
+          (or (same-account? a2parent a1)
+              (same-account? a1parent a2)
+              (same-account? a1parent a2parent))))
+
+  ;; Test whether the given split is the source of a spin off transaction
+  ;; This will be a no-units split with only one other split.
+  ;; xaccSplitGetOtherSplit only returns on a two-split txn.  It's not a spinoff
+  ;; is the other split is in an income or expense account.
+  (define (spin-off? split current)
+     (let ((other-split (xaccSplitGetOtherSplit split)))
+          (and (gnc-numeric-zero-p (xaccSplitGetAmount split))
+               (same-account? current (xaccSplitGetAccount split))
+               (not (null? other-split))
+               (not (split-account-type? other-split ACCT-TYPE-EXPENSE))
+               (not (split-account-type? other-split ACCT-TYPE-INCOME)))))
+
+
+(define (table-add-stock-rows table accounts to-date
+                                currency price-fn exchange-fn price-source
+				include-empty show-symbol show-listing show-shares show-price
+                                basis-method prefer-pricelist handle-brokerage-fees
+                                total-basis total-value
+                                total-moneyin total-moneyout total-income total-gain
+                                total-ugain total-brokerage)
+
+   (let ((share-print-info
+	  (gnc-share-print-info-places
+	   (inexact->exact (get-option gnc:pagename-display
+      			       optname-shares-digits)))))
+
+    (define (table-add-stock-rows-internal accounts odd-row?)
+      (if (null? accounts) total-value
+          (let* ((row-style (if odd-row? "normal-row" "alternate-row"))
+                 (current (car accounts))
+                 (rest (cdr accounts))
+		 ;; commodity is the actual stock/thing we are looking at
+                 (commodity (xaccAccountGetCommodity current))
+                 (ticker-symbol (gnc-commodity-get-mnemonic commodity))
+                 (listing (gnc-commodity-get-namespace commodity))
+                 (unit-collector (gnc:account-get-comm-balance-at-date
+                                  current to-date #f))
+                 (units (cadr (unit-collector 'getpair commodity #f)))
+
+                 ;; Counter to keep track of stuff
+                 (brokeragecoll (gnc:make-commodity-collector))
+                 (dividendcoll  (gnc:make-commodity-collector))
+                 (moneyincoll   (gnc:make-commodity-collector))
+                 (moneyoutcoll  (gnc:make-commodity-collector))
+                 (gaincoll      (gnc:make-commodity-collector))
+
+
+		 ;; the price of the commodity at the time of the report
+                 (price (price-fn commodity currency to-date))
+		 ;; the value of the commodity, expressed in terms of
+		 ;; the report's currency.
+                 (value (gnc:make-gnc-monetary currency (gnc-numeric-zero)))  ;; Set later
+                 (currency-frac (gnc-commodity-get-fraction currency))
+
+		 (pricing-txn #f)
+		 (use-txn #f)
+		 (basis-list '())
+		 ;; setup an alist for the splits we've already seen.
+		 (seen_trans '())
+		 ;; Account used to hold remainders from income reinvestments and
+		 ;; running total of amount moved there
+		 (drp-holding-account #f)
+		 (drp-holding-amount (gnc-numeric-zero))
+		 )
+
+            (define (my-exchange-fn fromunits tocurrency)
+              (if (and (gnc-commodity-equiv currency tocurrency)
+                       (gnc-commodity-equiv (gnc:gnc-monetary-commodity fromunits) commodity))
+                    ;; Have a price for this commodity, but not necessarily in the report's
+                    ;; currency.  Get the value in the commodity's currency and convert it to
+                    ;; report currency.
+                    (exchange-fn
+                      ;; This currency will usually be the same as tocurrency so the
+                      ;; call to exchange-fn below will do nothing
+                      (gnc:make-gnc-monetary
+                        (if use-txn
+                            (gnc:gnc-monetary-commodity price)
+                            (gnc-price-get-currency price))
+                        (gnc-numeric-mul (gnc:gnc-monetary-amount fromunits)
+                                         (if use-txn
+                                             (gnc:gnc-monetary-amount price)
+                                             (gnc-price-get-value price))
+                                         currency-frac GNC-RND-ROUND))
+                      tocurrency)
+                    (exchange-fn fromunits tocurrency)))
+
+            (gnc:debug "Starting account " (xaccAccountGetName current) ", initial price: "
+                   (if price
+                     (gnc-commodity-value->string
+	 	         (list (gnc-price-get-currency price) (gnc-price-get-value price)))
+	 	     #f))
+
+            ;; If we have a price that can't be converted to the report currency
+            ;; don't use it
+            (if (and price (gnc-numeric-zero-p (gnc:gnc-monetary-amount
+                                       (exchange-fn
+                                          (gnc:make-gnc-monetary
+                                            (gnc-price-get-currency price)
+                                            (gnc:make-gnc-numeric 100 1))
+                                          currency))))
+                (set! price #f))
+
+            ;; If we are told to use a pricing transaction, or if we don't have a price
+            ;; from the price DB, find a good transaction to use.
+            (if (and (not use-txn)
+                     (or (not price) (not prefer-pricelist)))
+                  (let ((split-list (reverse (gnc:get-match-commodity-splits-sorted
+                                                 (list current)
+                                                 (case price-source
+                                                   ((pricedb-latest) (gnc:get-today))
+                                                   ((pricedb-nearest) to-date)
+                                                   (else (gnc:get-today)))  ;; error, but don't crash
+                                                 #f))))  ;; Any currency
+                        ;; Find the first (most recent) one that can be converted to report currency
+                        (while (and (not use-txn) (not (eqv? split-list '())))
+                          (let ((split (car split-list)))
+                            (if (and (not (gnc-numeric-zero-p (xaccSplitGetAmount split)))
+                                     (not (gnc-numeric-zero-p (xaccSplitGetValue split))))
+                              (let* ((trans (xaccSplitGetParent split))
+                                     (trans-currency (xaccTransGetCurrency trans))
+                                     (trans-price (exchange-fn (gnc:make-gnc-monetary
+                                                                   trans-currency
+                                                                   (xaccSplitGetSharePrice split))
+                                                               currency)))
+                                (if (not (gnc-numeric-zero-p (gnc:gnc-monetary-amount trans-price)))
+                                  ;; We can exchange the price from this transaction into the report currency
+                                  (begin
+                                    (if price (gnc-price-unref price))
+                                    (set! pricing-txn trans)
+                                    (set! price trans-price)
+                                    (gnc:debug "Transaction price is " (gnc:monetary->string price))
+                                    (set! use-txn #t))
+                                  (set! split-list (cdr split-list))))
+                              (set! split-list (cdr split-list)))
+                            ))))
+
+            ;; If we still don't have a price, use a price of 1 and complain later
+            (if (not price)
+              (begin
+                (set! price (gnc:make-gnc-monetary currency (gnc:make-gnc-numeric 1 1)))
+                ;; If use-txn is set, but pricing-txn isn't set, it's a bogus price
+                (set! use-txn #t)
+                (set! pricing-txn #f)
+              )
+            )
+
+            ;; Now that we have a pricing transaction if needed, set the value of the asset
+            (set! value (my-exchange-fn (gnc:make-gnc-monetary commodity units) currency))
+            (gnc:debug "Value " (gnc:monetary->string value)
+                       " from " (gnc-commodity-numeric->string commodity units))
+
+	    (for-each
+	     ;; we're looking at each split we find in the account. these splits
+	     ;; could refer to the same transaction, so we have to examine each
+	     ;; split, determine what kind of split it is and then act accordingly.
+	     (lambda (split)
+	       (set! work-done (+ 1 work-done))
+	       (gnc:report-percent-done (* 100 (/ work-done work-to-do)))
+
+	       (let* ((parent (xaccSplitGetParent split))
+		      (txn-date (gnc-transaction-get-date-posted parent))
+		      (commod-currency (xaccTransGetCurrency parent))
+		      (commod-currency-frac (gnc-commodity-get-fraction commod-currency)))
+
+		 (if (and (gnc:timepair-le txn-date to-date)
+		          (not (assoc-ref seen_trans (gncTransGetGUID parent))))
+		     (let ((trans-income (gnc-numeric-zero))
+		           (trans-brokerage (gnc-numeric-zero))
+		           (trans-shares (gnc-numeric-zero))
+		           (shares-bought (gnc-numeric-zero))
+		           (trans-sold (gnc-numeric-zero))
+		           (trans-bought (gnc-numeric-zero))
+		           (trans-spinoff (gnc-numeric-zero))
+		           (trans-drp-residual (gnc-numeric-zero))
+		           (trans-drp-account #f))
+
+		       (gnc:debug "Transaction " (xaccTransGetDescription parent))
+		       ;; Add this transaction to the list of processed transactions so we don't
+		       ;; do it again if there is another split in it for this account
+		       (set! seen_trans (acons (gncTransGetGUID parent) #t seen_trans))
+
+		       ;; Go through all the splits in the transaction to get an overall idea of
+		       ;; what it does in terms of income, money in or out, shares bought or sold, etc.
+		       (for-each
+		         (lambda (s)
+                           (let ((split-units (xaccSplitGetAmount s))
+                                 (split-value (xaccSplitGetValue s)))
+
+                             (gnc:debug "Pass 1: split units " (gnc-numeric-to-string split-units) " split-value "
+                                        (gnc-numeric-to-string split-value) " commod-currency "
+                                        (gnc-commodity-get-printname commod-currency))
+
+                             (cond
+                                ((split-account-type? s ACCT-TYPE-EXPENSE)
+                                 ;; Brokerage expense unless a two split transaction with other split
+                                 ;; in the stock account in which case it's a stock donation to charity.
+                                 (if (not (same-account? current (xaccSplitGetAccount (xaccSplitGetOtherSplit s))))
+                                   (set! trans-brokerage
+                                         (gnc-numeric-add trans-brokerage split-value commod-currency-frac GNC-RND-ROUND))))
+
+                                ((split-account-type? s ACCT-TYPE-INCOME)
+                                 (set! trans-income (gnc-numeric-sub trans-income split-value
+                                                             commod-currency-frac GNC-RND-ROUND)))
+
+                                ((same-account? current (xaccSplitGetAccount s))
+                                 (set! trans-shares (gnc-numeric-add trans-shares (gnc-numeric-abs split-units)
+                                                  units-denom GNC-RND-ROUND))
+                                 (if (gnc-numeric-zero-p split-units)
+                                     (if (spin-off? s current)
+                                         ;; Count money used in a spin off as money out
+                                         (if (gnc-numeric-negative-p split-value)
+                                             (set! trans-spinoff (gnc-numeric-sub trans-spinoff split-value
+                                                                                  commod-currency-frac GNC-RND-ROUND)))
+                                         (if (not (gnc-numeric-zero-p split-value))
+                                              ;; Gain/loss split (amount zero, value non-zero, and not spinoff).  There will be
+                                              ;; a corresponding income split that will incorrectly be added to trans-income
+                                              ;; Fix that by subtracting it here
+                                              (set! trans-income (gnc-numeric-sub trans-income split-value
+                                                                                  commod-currency-frac GNC-RND-ROUND))))
+                                     ;; Non-zero amount, add the value to the sale or purchase total.
+                                     (if (gnc-numeric-positive-p split-value)
+                                          (begin
+                                             (set! trans-bought
+                                                  (gnc-numeric-add trans-bought split-value commod-currency-frac GNC-RND-ROUND))
+                                             (set! shares-bought
+                                                  (gnc-numeric-add shares-bought split-units units-denom GNC-RND-ROUND)))
+                                          (set! trans-sold
+                                               (gnc-numeric-sub trans-sold split-value commod-currency-frac GNC-RND-ROUND)))))
+
+                                ((split-account-type? s ACCT-TYPE-ASSET)
+                                 ;; If all the asset accounts mentioned in the transaction are siblings of each other
+                                 ;; keep track of the money transferred to them if it is in the correct currency
+                                 (if (not trans-drp-account)
+                                     (begin
+                                       (set! trans-drp-account (xaccSplitGetAccount s))
+                                         (if (gnc-commodity-equiv commod-currency (xaccAccountGetCommodity trans-drp-account))
+                                             (set! trans-drp-residual split-value)
+                                             (set! trans-drp-account 'none)))
+                                     (if (not (eq? trans-drp-account 'none))
+                                       (if (parent-or-sibling? trans-drp-account (xaccSplitGetAccount s))
+                                           (set! trans-drp-residual (gnc-numeric-add trans-drp-residual split-value
+                                                                                     commod-currency-frac GNC-RND-ROUND))
+                                           (set! trans-drp-account 'none))))))
+		         ))
+		         (xaccTransGetSplitList parent)
+		       )
+
+		       (gnc:debug "Income: " (gnc-numeric-to-string trans-income)
+		                  " Brokerage: " (gnc-numeric-to-string trans-brokerage)
+		                  " Shares traded: " (gnc-numeric-to-string trans-shares)
+		                  " Shares bought: " (gnc-numeric-to-string shares-bought))
+		       (gnc:debug " Value sold: " (gnc-numeric-to-string trans-sold)
+		                  " Value purchased: " (gnc-numeric-to-string trans-bought)
+		                  " Spinoff value " (gnc-numeric-to-string trans-spinoff)
+		                  " Trans DRP residual: " (gnc-numeric-to-string trans-drp-residual))
+
+		       ;; We need to calculate several things for this transaction:
+		       ;; 1. Total income: this is already in trans-income
+		       ;; 2. Change in basis: calculated by loop below that looks at every
+		       ;;    that acquires or disposes of shares
+		       ;; 3. Realized gain: also calculated below while calculating basis
+		       ;; 4. Money in to the account: this is the value of shares bought
+		       ;;    except those purchased with reinvested income
+		       ;; 5. Money out: the money received by disposing of shares.   This
+		       ;;    is in trans-sold plus trans-spinoff
+		       ;; 6. Brokerage fees: this is in trans-brokerage
+
+		       ;; Income
+		       (dividendcoll 'add commod-currency trans-income)
+
+                       ;; Brokerage fees.  May be either ignored or part of basis, but that
+                       ;; will be dealt with elsewhere.
+                       (brokeragecoll 'add commod-currency trans-brokerage)
+
+                       ;; Add brokerage fees to trans-bought if not ignoring them and there are any
+                       (if (and (not (eq? handle-brokerage-fees 'ignore-brokerage))
+                                (gnc-numeric-positive-p trans-brokerage)
+                                (gnc-numeric-positive-p trans-shares))
+                           (let* ((fee-frac (gnc-numeric-div shares-bought trans-shares GNC-DENOM-AUTO GNC-DENOM-REDUCE))
+                                  (fees (gnc-numeric-mul trans-brokerage fee-frac commod-currency-frac GNC-RND-ROUND)))
+                                 (set! trans-bought (gnc-numeric-add trans-bought fees commod-currency-frac GNC-RND-ROUND))))
+
+                       ;; Update the running total of the money in the DRP residual account.  This is relevant
+                       ;; if this is a reinvestment transaction (both income and purchase) and there seems to
+                       ;; asset accounts used to hold excess income.
+                       (if (and trans-drp-account
+                                (not (eq? trans-drp-account 'none))
+                                (gnc-numeric-positive-p trans-income)
+                                (gnc-numeric-positive-p trans-bought))
+                           (if (not drp-holding-account)
+                               (begin
+                                 (set! drp-holding-account trans-drp-account)
+                                 (set! drp-holding-amount trans-drp-residual))
+                               (if (and (not (eq? drp-holding-account 'none))
+                                        (parent-or-sibling? trans-drp-account drp-holding-account))
+                                   (set! drp-holding-amount (gnc-numeric-add drp-holding-amount trans-drp-residual
+                                                                              commod-currency-frac GNC-RND-ROUND))
+                                   (begin
+                                     ;; Wrong account (or no account), assume there isn't a DRP holding account
+                                     (set! drp-holding-account 'none)
+                                     (set trans-drp-residual (gnc-numeric-zero))
+                                     (set! drp-holding-amount (gnc-numeric-zero))))))
+
+                       ;; Set trans-bought to the amount of money moved in to the account which was used to
+                       ;; purchase more shares.  If this is not a DRP transaction then all money used to purchase
+                       ;; shares is money in.
+                       (if (and (gnc-numeric-positive-p trans-income)
+                                (gnc-numeric-positive-p trans-bought))
+                           (begin
+                             (set! trans-bought (gnc-numeric-sub trans-bought trans-income
+                                                                 commod-currency-frac GNC-RND-ROUND))
+                             (set! trans-bought (gnc-numeric-add trans-bought trans-drp-residual
+                                                                 commod-currency-frac GNC-RND-ROUND))
+                             (set! trans-bought (gnc-numeric-sub trans-bought drp-holding-amount
+                                                                 commod-currency-frac GNC-RND-ROUND))
+                             ;; If the DRP holding account balance is negative, adjust it by the amount
+                             ;; used in this transaction
+                             (if (and (gnc-numeric-negative-p drp-holding-amount)
+                                      (gnc-numeric-positive-p trans-bought))
+                                 (set! drp-holding-amount (gnc-numeric-add drp-holding-amount trans-bought
+                                                                           commod-currency-frac GNC-RND-ROUND)))
+                             ;; Money in is never more than amount spent to purchase shares
+                             (if (gnc-numeric-negative-p trans-bought)
+                                 (set! trans-bought (gnc-numeric-zero)))))
+
+                       (gnc:debug "Adjusted trans-bought " (gnc-numeric-to-string trans-bought)
+                                  " DRP holding account " (gnc-numeric-to-string drp-holding-amount))
+
+                       (moneyincoll 'add commod-currency trans-bought)
+                       (moneyoutcoll 'add commod-currency trans-sold)
+                       (moneyoutcoll 'add commod-currency trans-spinoff)
+
+                       ;; Look at splits again to handle changes in basis and realized gains
+		       (for-each
+		         (lambda (s)
+                           (let
+                              ;; get the split's units and value
+                              ((split-units (xaccSplitGetAmount s))
+                               (split-value (xaccSplitGetValue s)))
+
+                             (gnc:debug "Pass 2: split units " (gnc-numeric-to-string split-units) " split-value "
+                                        (gnc-numeric-to-string split-value) " commod-currency "
+                                        (gnc-commodity-get-printname commod-currency))
+
+                             (cond
+                               ((and (not (gnc-numeric-zero-p split-units))
+                                     (same-account? current (xaccSplitGetAccount s)))
+                                ;; Split into subject account with non-zero amount.  This is a purchase
+                                ;; or a sale, adjust the basis
+				(let* ((split-value-currency (gnc:gnc-monetary-amount
+								(my-exchange-fn (gnc:make-gnc-monetary
+								   commod-currency split-value) currency)))
+			               (orig-basis (sum-basis basis-list currency-frac))
+			               ;; proportion of the fees attributable to this split
+			               (fee-ratio (gnc-numeric-div (gnc-numeric-abs split-units) trans-shares
+			                                           GNC-DENOM-AUTO GNC-DENOM-REDUCE))
+			               ;; Fees for this split in report currency
+			               (fees-currency (gnc:gnc-monetary-amount (my-exchange-fn
+			                               (gnc:make-gnc-monetary commod-currency
+			                                 (gnc-numeric-mul fee-ratio trans-brokerage
+			                                                commod-currency-frac GNC-RND-ROUND))
+			                                currency)))
+			               (split-value-with-fees (if (eq? handle-brokerage-fees 'include-in-basis)
+			                                          ;; Include brokerage fees in basis
+			                                          (gnc-numeric-add split-value-currency fees-currency
+			                                                        currency-frac GNC-RND-ROUND)
+			                                          split-value-currency)))
+                                  (gnc:debug "going in to basis list " basis-list " " (gnc-numeric-to-string split-units) " "
+                                             (gnc-numeric-to-string split-value-with-fees))
+
+				  ;; adjust the basis
+				  (set! basis-list (basis-builder basis-list split-units split-value-with-fees
+								  basis-method currency-frac))
+                                  (gnc:debug  "coming out of basis list " basis-list)
+
+                                  ;; If it's a sale or the stock is worthless, calculate the gain
+                                  (if (not (gnc-numeric-positive-p split-value))
+                                       ;; Split value is zero or negative.  If it's zero it's either a stock split/merge
+                                       ;; or the stock has become worthless (which looks like a merge where the number
+                                       ;; of shares goes to zero).  If the value is negative then it's a disposal of some sort.
+                                       (let ((new-basis (sum-basis basis-list currency-frac)))
+                                              (if (or (gnc-numeric-zero-p new-basis)
+                                                      (gnc-numeric-negative-p split-value))
+                                                ;; Split value is negative or new basis is zero (stock is worthless),
+                                                ;; Capital gain is money out minus change in basis
+                                                (let ((gain (gnc-numeric-sub (gnc-numeric-abs split-value-with-fees)
+                                                                          (gnc-numeric-sub orig-basis new-basis
+                                                                                           currency-frac GNC-RND-ROUND)
+                                                                          currency-frac GNC-RND-ROUND)))
+                                                       (gnc:debug "Old basis=" (gnc-numeric-to-string orig-basis)
+                                                                  " New basis=" (gnc-numeric-to-string new-basis)
+                                                                  " Gain=" (gnc-numeric-to-string gain))
+                                                       (gaincoll 'add currency gain)))))))
+
+                               ;; here is where we handle a spin-off txn. This will be a no-units
+                               ;; split with only one other split. xaccSplitGetOtherSplit only
+                               ;; returns on a two-split txn.  It's not a spinoff is the other split is
+                               ;; in an income or expense account.
+                               ((spin-off? s current)
+                                  (gnc:debug "before spin-off basis list " basis-list)
+                                  (set! basis-list (basis-builder basis-list split-units (gnc:gnc-monetary-amount
+                                                                                          (my-exchange-fn (gnc:make-gnc-monetary
+                                                                                                        commod-currency split-value)
+                                                                                                       currency))
+                                                                                                       basis-method
+                                                                                                       currency-frac))
+                                  (gnc:debug "after spin-off basis list "  basis-list))
+                             )
+		         ))
+		         (xaccTransGetSplitList parent)
+		       )
+		      )
+		   )
+		 )
+	       )
+	     (xaccAccountGetSplitList current)
+	     )
+
+	    ;; Look for income and expense transactions that don't have a split in the
+	    ;; the account we're processing.  We do this as follow
+	    ;; 1. Make sure the parent account is a currency-valued asset or bank account
+	    ;; 2. If so go through all the splits in that account
+	    ;; 3. If a split is part of a two split transaction where the other split is
+	    ;;    to an income or expense account and the leaf name of that account is the
+	    ;;    same as the leaf name of the account we're processing, add it to the
+	    ;;    income or expense accumulator
+	    ;;
+	    ;; In other words with an account structure like
+	    ;;
+	    ;;   Assets (type ASSET)
+	    ;;     Broker (type ASSET)
+	    ;;       Widget Stock (type STOCK)
+	    ;;   Income (type INCOME)
+	    ;;     Dividends (type INCOME)
+	    ;;       Widget Stock (type INCOME)
+	    ;;
+	    ;; If you are producing a report on "Assets:Broker:Widget Stock" a
+	    ;; transaction that debits the Assets:Broker account and credits the
+	    ;; "Income:Dividends:Widget Stock" account will count as income in
+	    ;; the report even though it doesn't have a split in the account
+	    ;; being reported on.
+
+	    (let ((parent-account (gnc-account-get-parent current))
+	          (account-name (xaccAccountGetName current)))
+	      (if (and (not (null? parent-account))
+	               (member (xaccAccountGetType parent-account) (list ACCT-TYPE-ASSET ACCT-TYPE-BANK))
+	               (gnc-commodity-is-currency (xaccAccountGetCommodity parent-account)))
+	        (for-each
+	          (lambda (split)
+	            (let* ((other-split (xaccSplitGetOtherSplit split))
+	                   ;; This is safe because xaccSplitGetAccount returns null for a null split
+	                   (other-acct (xaccSplitGetAccount other-split))
+	                   (parent (xaccSplitGetParent split))
+	                   (txn-date (gnc-transaction-get-date-posted parent)))
+	              (if (and (not (null? other-acct))
+	                       (gnc:timepair-le txn-date to-date)
+	                       (string=? (xaccAccountGetName other-acct) account-name)
+	                       (gnc-commodity-is-currency (xaccAccountGetCommodity other-acct)))
+	                ;; This is a two split transaction where the other split is to an
+	                ;; account with the same name as the current account.  If it's an
+	                ;; income or expense account accumulate the value of the transaction
+	                (let ((val (xaccSplitGetValue split))
+	                      (curr (xaccAccountGetCommodity other-acct)))
+                          (cond ((split-account-type? other-split ACCT-TYPE-INCOME)
+	                         (gnc:debug "More income " (gnc-numeric-to-string val))
+	                         (dividendcoll 'add curr val))
+                                ((split-account-type? other-split ACCT-TYPE-EXPENSE)
+                                 (gnc:debug "More expense " (gnc-numeric-to-string
+                                                             (gnc-numeric-neg val)))
+                                 (brokeragecoll 'add curr (gnc-numeric-neg val)))
+	                  )
+	                )
+	              )
+	            )
+	          )
+	          (xaccAccountGetSplitList parent-account)
+	        )
+	      )
+	    )
+
+	    (gnc:debug "pricing txn is " pricing-txn)
+	    (gnc:debug "use txn is " use-txn)
+	    (gnc:debug "prefer-pricelist is " prefer-pricelist)
+	    (gnc:debug "price is " price)
+
+	    (gnc:debug "basis we're using to build rows is " (gnc-numeric-to-string (sum-basis basis-list
+	                                                            currency-frac)))
+	    (gnc:debug "but the actual basis list is " basis-list)
+
+            (if (eq? handle-brokerage-fees 'include-in-gain)
+	      (gaincoll 'minusmerge brokeragecoll #f))
+
+	  (if (or include-empty (not (gnc-numeric-zero-p units)))
+	    (let* ((moneyin (gnc:sum-collector-commodity moneyincoll currency my-exchange-fn))
+		  (moneyout (gnc:sum-collector-commodity moneyoutcoll currency my-exchange-fn))
+                  (brokerage (gnc:sum-collector-commodity brokeragecoll currency my-exchange-fn))
+		  (income (gnc:sum-collector-commodity dividendcoll currency my-exchange-fn))
+		  ;; just so you know, gain == realized gain, ugain == un-realized gain, bothgain, well..
+		  (gain (gnc:sum-collector-commodity gaincoll currency my-exchange-fn))
+		  (ugain (gnc:make-gnc-monetary currency
+						(gnc-numeric-sub (gnc:gnc-monetary-amount (my-exchange-fn value currency))
+								 (sum-basis basis-list (gnc-commodity-get-fraction currency))
+								 currency-frac GNC-RND-ROUND)))
+		  (bothgain (gnc:make-gnc-monetary currency  (gnc-numeric-add (gnc:gnc-monetary-amount gain)
+									      (gnc:gnc-monetary-amount ugain)
+									      currency-frac GNC-RND-ROUND)))
+		  (totalreturn (gnc:make-gnc-monetary currency (gnc-numeric-add (gnc:gnc-monetary-amount bothgain)
+										    (gnc:gnc-monetary-amount income)
+										currency-frac GNC-RND-ROUND)))
+
+		  (activecols (list (gnc:html-account-anchor current)))
+		  )
+
+              ;; If we're using the txn, warn the user
+              (if use-txn
+                  (if pricing-txn
+                      (set! warn-price-dirty #t)
+                      (set! warn-no-price #t)
+                  ))
+
+	      (total-value 'add (gnc:gnc-monetary-commodity value) (gnc:gnc-monetary-amount value))
+	      (total-moneyin 'merge moneyincoll #f)
+	      (total-moneyout 'merge moneyoutcoll #f)
+              (total-brokerage 'merge brokeragecoll #f)
+	      (total-income 'merge dividendcoll #f)
+	      (total-gain 'merge gaincoll #f)
+	      (total-ugain 'add (gnc:gnc-monetary-commodity ugain) (gnc:gnc-monetary-amount ugain))
+	      (total-basis 'add currency (sum-basis basis-list currency-frac))
+
+	      ;; build a list for the row  based on user selections
+	      (if show-symbol (append! activecols (list (gnc:make-html-table-header-cell/markup "text-cell" ticker-symbol))))
+	      (if show-listing (append! activecols (list (gnc:make-html-table-header-cell/markup "text-cell" listing))))
+	      (if show-shares (append! activecols (list (gnc:make-html-table-header-cell/markup
+ 	        "number-cell" (xaccPrintAmount units share-print-info)))))
+	      (if show-price (append! activecols (list (gnc:make-html-table-header-cell/markup
+	        "number-cell"
+	        (if use-txn
+	            (if pricing-txn
+                        (gnc:html-transaction-anchor
+                         pricing-txn
+                         price
+                         )
+                         price
+                     )
+	 	    (gnc:html-price-anchor
+	 	     price
+	 	     (gnc:make-gnc-monetary
+	  	     (gnc-price-get-currency price)
+		     (gnc-price-get-value price)))
+		    )))))
+ 	      (append! activecols (list (if use-txn (if pricing-txn "*" "**") " ")
+					(gnc:make-html-table-header-cell/markup
+					 "number-cell" (gnc:make-gnc-monetary currency (sum-basis basis-list
+					                         currency-frac)))
+					(gnc:make-html-table-header-cell/markup "number-cell" value)
+					(gnc:make-html-table-header-cell/markup "number-cell" moneyin)
+					(gnc:make-html-table-header-cell/markup "number-cell" moneyout)
+					(gnc:make-html-table-header-cell/markup "number-cell" gain)
+					(gnc:make-html-table-header-cell/markup "number-cell" ugain)
+					(gnc:make-html-table-header-cell/markup "number-cell" bothgain)
+					(gnc:make-html-table-header-cell/markup "number-cell"
+					    (let* ((moneyinvalue (gnc-numeric-to-double
+								  (gnc:gnc-monetary-amount moneyin)))
+					           (bothgainvalue (gnc-numeric-to-double
+								   (gnc:gnc-monetary-amount bothgain)))
+                                             )
+					      (if (= 0.0 moneyinvalue)
+						  ""
+						  (sprintf #f "%.2f%%" (* 100 (/ bothgainvalue moneyinvalue)))))
+					)
+					(gnc:make-html-table-header-cell/markup "number-cell" income)))
+	      (if (not (eq? handle-brokerage-fees 'ignore-brokerage))
+		  (append! activecols (list (gnc:make-html-table-header-cell/markup "number-cell" brokerage))))
+	      (append! activecols (list (gnc:make-html-table-header-cell/markup "number-cell" totalreturn)
+					(gnc:make-html-table-header-cell/markup "number-cell"
+					    (let* ((moneyinvalue (gnc-numeric-to-double
+								  (gnc:gnc-monetary-amount moneyin)))
+					           (totalreturnvalue (gnc-numeric-to-double
+								      (gnc:gnc-monetary-amount totalreturn)))
+                                             )
+					      (if (= 0.0 moneyinvalue)
+						  ""
+						  (sprintf #f "%.2f%%" (* 100 (/ totalreturnvalue moneyinvalue))))))
+					 )
+			)
+
+	      (gnc:html-table-append-row/markup!
+	       table
+	       row-style
+	       activecols)
+
+              (if (and (not use-txn) price) (gnc-price-unref price))
+	      (table-add-stock-rows-internal rest (not odd-row?))
+	      )
+	    (begin
+	      (if (and (not use-txn) price) (gnc-price-unref price))
+	      (table-add-stock-rows-internal rest odd-row?)
+	      )
+            )
+	    )))
+
+    (set! work-to-do (gnc:accounts-count-splits accounts))
+    (table-add-stock-rows-internal accounts #t)))
+
+  ;; Tell the user that we're starting.
+  (gnc:report-starting reportname)
+
+  ;; The first thing we do is make local variables for all the specific
+  ;; options in the set of options given to the function. This set will
+  ;; be generated by the options generator above.
+  (let ((to-date     (gnc:date-option-absolute-time
+                      (get-option gnc:pagename-general "Date")))
+        (accounts    (get-option gnc:pagename-accounts "Accounts"))
+        (currency    (get-option gnc:pagename-general "Report's currency"))
+        (price-source (get-option gnc:pagename-general
+                                  optname-price-source))
+        (report-title (get-option gnc:pagename-general
+                                  gnc:optname-reportname))
+        (include-empty (get-option gnc:pagename-accounts
+                                  optname-zero-shares))
+	(show-symbol (get-option gnc:pagename-display
+				  optname-show-symbol))
+	(show-listing (get-option gnc:pagename-display
+				  optname-show-listing))
+	(show-shares (get-option gnc:pagename-display
+				  optname-show-shares))
+	(show-price (get-option gnc:pagename-display
+				  optname-show-price))
+	(basis-method (get-option gnc:pagename-general
+				  optname-basis-method))
+	(prefer-pricelist (get-option gnc:pagename-general
+				      optname-prefer-pricelist))
+	(handle-brokerage-fees (get-option gnc:pagename-general
+				  optname-brokerage-fees))
+
+	(total-basis (gnc:make-commodity-collector))
+        (total-value    (gnc:make-commodity-collector))
+        (total-moneyin  (gnc:make-commodity-collector))
+        (total-moneyout (gnc:make-commodity-collector))
+        (total-income   (gnc:make-commodity-collector))
+        (total-gain     (gnc:make-commodity-collector)) ;; realized gain
+	(total-ugain (gnc:make-commodity-collector))    ;; unrealized gain
+        (total-brokerage (gnc:make-commodity-collector))
+	;;document will be the HTML document that we return.
+        (table (gnc:make-html-table))
+        (document (gnc:make-html-document)))
+
+    (gnc:html-document-set-title!
+     document (string-append
+               report-title
+               (sprintf #f " %s" (gnc-print-date to-date))))
+
+    (if (not (null? accounts))
+        ; at least 1 account selected
+        (let* ((exchange-fn (gnc:case-exchange-fn price-source currency to-date))
+               (pricedb (gnc-pricedb-get-db (gnc-get-current-book)))
+               (price-fn
+                (case price-source
+                  ((pricedb-latest)
+                   (lambda (foreign domestic date)
+                    (find-price (gnc-pricedb-lookup-latest-any-currency pricedb foreign)
+                                domestic)))
+                  ((pricedb-nearest)
+                   (lambda (foreign domestic date)
+                    (find-price (gnc-pricedb-lookup-nearest-in-time-any-currency
+		     pricedb foreign (timespecCanonicalDayTime date)) domestic)))))
+	       (headercols (list (_ "Account")))
+	       (totalscols (list (gnc:make-html-table-cell/markup "total-label-cell" (_ "Total"))))
+	       (sum-total-moneyin (gnc-numeric-zero))
+	       (sum-total-income (gnc-numeric-zero))
+	       (sum-total-both-gains (gnc-numeric-zero))
+	       (sum-total-gain (gnc-numeric-zero))
+	       (sum-total-ugain (gnc-numeric-zero))
+	       (sum-total-brokerage (gnc-numeric-zero))
+	       (sum-total-totalreturn (gnc-numeric-zero))) ;;end of let
+
+	  ;;begin building lists for which columns to display
+          (if show-symbol
+	      (begin (append! headercols (list (_ "Symbol")))
+		     (append! totalscols (list " "))))
+
+	  (if show-listing
+	      (begin (append! headercols (list (_ "Listing")))
+		     (append! totalscols (list " "))))
+
+	  (if show-shares
+	      (begin (append! headercols (list (_ "Shares")))
+		     (append! totalscols (list " "))))
+
+	  (if show-price
+	      (begin (append! headercols (list (_ "Price")))
+		     (append! totalscols (list " "))))
+
+	  (append! headercols (list " "
+				    (_ "Basis")
+				    (_ "Value")
+				    (_ "Money In")
+				    (_ "Money Out")
+				    (_ "Realized Gain")
+				    (_ "Unrealized Gain")
+				    (_ "Total Gain")
+				    (_ "Rate of Gain")
+				    (_ "Income")))
+
+	  (if (not (eq? handle-brokerage-fees 'ignore-brokerage))
+	      (append! headercols (list (_ "Brokerage Fees"))))
+
+	  (append! headercols (list (_ "Total Return")
+				    (_ "Rate of Return")))
+
+          (append! totalscols (list " "))
+
+          (gnc:html-table-set-col-headers!
+           table
+	   headercols)
+
+          (table-add-stock-rows
+           table accounts to-date currency price-fn exchange-fn price-source
+           include-empty show-symbol show-listing show-shares show-price basis-method
+	   prefer-pricelist handle-brokerage-fees
+           total-basis total-value total-moneyin total-moneyout
+           total-income total-gain total-ugain total-brokerage)
+
+
+	  (set! sum-total-moneyin (gnc:sum-collector-commodity total-moneyin currency exchange-fn))
+	  (set! sum-total-income (gnc:sum-collector-commodity total-income currency exchange-fn))
+	  (set! sum-total-gain (gnc:sum-collector-commodity total-gain currency exchange-fn))
+	  (set! sum-total-ugain (gnc:sum-collector-commodity total-ugain currency exchange-fn))
+	  (set! sum-total-both-gains (gnc:make-gnc-monetary currency (gnc-numeric-add (gnc:gnc-monetary-amount sum-total-gain)
+										      (gnc:gnc-monetary-amount sum-total-ugain)
+										      (gnc-commodity-get-fraction currency) GNC-RND-ROUND)))
+	  (set! sum-total-brokerage (gnc:sum-collector-commodity total-brokerage currency exchange-fn))
+	  (set! sum-total-totalreturn (gnc:make-gnc-monetary currency (gnc-numeric-add (gnc:gnc-monetary-amount sum-total-both-gains)
+										           (gnc:gnc-monetary-amount sum-total-income)
+										       (gnc-commodity-get-fraction currency) GNC-RND-ROUND)))
+
+          (gnc:html-table-append-row/markup!
+           table
+           "grand-total"
+           (list
+            (gnc:make-html-table-cell/size
+             1 17 (gnc:make-html-text (gnc:html-markup-hr)))))
+
+	  ;; finish building the totals columns, now that totals are complete
+	  (append! totalscols (list
+			       (gnc:make-html-table-cell/markup
+				"total-number-cell" (gnc:sum-collector-commodity total-basis currency exchange-fn))
+			       (gnc:make-html-table-cell/markup
+				"total-number-cell" (gnc:sum-collector-commodity total-value currency exchange-fn))
+			       (gnc:make-html-table-cell/markup
+				"total-number-cell" sum-total-moneyin)
+			       (gnc:make-html-table-cell/markup
+				"total-number-cell" (gnc:sum-collector-commodity total-moneyout currency exchange-fn))
+			       (gnc:make-html-table-cell/markup
+				"total-number-cell" sum-total-gain)
+			       (gnc:make-html-table-cell/markup
+				"total-number-cell" sum-total-ugain)
+			       (gnc:make-html-table-cell/markup
+				"total-number-cell" sum-total-both-gains)
+			       (gnc:make-html-table-cell/markup
+				"total-number-cell"
+				(let* ((totalinvalue (gnc-numeric-to-double
+						      (gnc:gnc-monetary-amount sum-total-moneyin)))
+				       (totalgainvalue (gnc-numeric-to-double
+							(gnc:gnc-monetary-amount sum-total-both-gains)))
+				       )
+				  (if (= 0.0 totalinvalue)
+				      ""
+				      (sprintf #f "%.2f%%" (* 100 (/ totalgainvalue totalinvalue))))))
+			       (gnc:make-html-table-cell/markup
+				"total-number-cell" sum-total-income)))
+	  (if (not (eq? handle-brokerage-fees 'ignore-brokerage))
+	      (append! totalscols (list
+			       (gnc:make-html-table-cell/markup
+                                "total-number-cell" sum-total-brokerage))))
+	  (append! totalscols (list
+			       (gnc:make-html-table-cell/markup
+                                "total-number-cell" sum-total-totalreturn)
+			       (gnc:make-html-table-cell/markup
+				"total-number-cell"
+				(let* ((totalinvalue (gnc-numeric-to-double
+						      (gnc:gnc-monetary-amount sum-total-moneyin)))
+				       (totalreturnvalue (gnc-numeric-to-double
+						          (gnc:gnc-monetary-amount sum-total-totalreturn)))
+				 )
+				  (if (= 0.0 totalinvalue)
+				      ""
+				      (sprintf #f "%.2f%%" (* 100 (/ totalreturnvalue totalinvalue))))))
+			       ))
+
+
+          (gnc:html-table-append-row/markup!
+           table
+           "grand-total"
+           totalscols
+            )
+
+          (gnc:html-document-add-object! document table)
+          (if warn-price-dirty
+              (gnc:html-document-append-objects! document
+                                                 (list (gnc:make-html-text (_ "* this commodity data was built using transaction pricing instead of the price list."))
+						       (gnc:make-html-text (gnc:html-markup-br))
+						       (gnc:make-html-text (_ "If you are in a multi-currency situation, the exchanges may not be correct.")))))
+
+          (if warn-no-price
+              (gnc:html-document-append-objects! document
+                                                 (list (gnc:make-html-text (if warn-price-dirty (gnc:html-markup-br) ""))
+                                                       (gnc:make-html-text (_ "** this commodity has no price and a price of 1 has been used.")))))
+)
+
+					;if no accounts selected.
+        (gnc:html-document-add-object!
+         document
+	 (gnc:html-make-no-account-warning
+	  report-title (gnc:report-id report-obj))))
+
+    (gnc:report-finished)
+    document)))
+
+(gnc:define-report
+ 'version 1
+ 'report-guid "21d7cfc59fc74f22887596ebde7e462d"
+ 'name reportname
+ 'menu-path (list gnc:menuname-asset-liability)
+ 'options-generator options-generator
+ 'renderer advanced-portfolio-renderer)
diff --git a/src/report/standard-reports/average-balance.scm b/gnucash/report/standard-reports/average-balance.scm
similarity index 100%
rename from src/report/standard-reports/average-balance.scm
rename to gnucash/report/standard-reports/average-balance.scm
diff --git a/src/report/standard-reports/balance-sheet.scm b/gnucash/report/standard-reports/balance-sheet.scm
similarity index 100%
rename from src/report/standard-reports/balance-sheet.scm
rename to gnucash/report/standard-reports/balance-sheet.scm
diff --git a/src/report/standard-reports/budget-balance-sheet.scm b/gnucash/report/standard-reports/budget-balance-sheet.scm
similarity index 100%
rename from src/report/standard-reports/budget-balance-sheet.scm
rename to gnucash/report/standard-reports/budget-balance-sheet.scm
diff --git a/gnucash/report/standard-reports/budget-barchart.scm b/gnucash/report/standard-reports/budget-barchart.scm
new file mode 100644
index 0000000..33cadc9
--- /dev/null
+++ b/gnucash/report/standard-reports/budget-barchart.scm
@@ -0,0 +1,379 @@
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; net-barchart.scm : Display a time series for either net worth or
+;; net profit.
+;;
+;; By Robert Merkel <rgmerk at mira.net>
+;; and Christian Stimming <stimming at tu-harburg.de>
+;;
+;; 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 at gnu.org
+;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(define-module (gnucash report standard-reports budget-barchart))
+
+(use-modules (srfi srfi-1))
+(use-modules (gnucash main)) ;; FIXME: delete after we finish modularizing.
+(use-modules (gnucash gnc-module))
+(use-modules (gnucash gettext))
+
+(use-modules (gnucash printf))
+
+(gnc:module-load "gnucash/report/report-system" 0)
+
+;; included since Bug726449
+(use-modules (ice-9 regex)) ;; for regexp-substitute/global, used by jpqplot
+(load-from-path "html-jqplot") ;; for jqplot-escape-string
+
+(define reportname (N_ "Budget Chart"))
+
+(define optname-accounts (N_ "Accounts"))
+(define optname-budget (N_ "Budget"))
+
+(define optname-running-sum (N_ "Running Sum"))
+(define optname-chart-type (N_ "Chart Type"))
+(define optname-plot-width (N_ "Plot Width"))
+(define optname-plot-height (N_ "Plot Height"))
+(define optname-from-date (N_ "Start Date"))
+(define optname-to-date (N_ "End Date"))
+
+(define optname-depth-limit (N_ "Levels of Subaccounts"))
+(define opthelp-depth-limit
+  (N_ "Maximum number of levels in the account tree displayed."))
+
+;(define (options-generator inc-exp?)
+(define (options-generator)
+  (let* (
+      (options (gnc:new-options)) 
+      ;; This is just a helper function for making options.
+      ;; See libgnucash/scm/options.scm for details.
+      (add-option 
+        (lambda (new-option)
+          (gnc:register-option options new-option)))
+    )
+    ;; Option to select Budget
+    (add-option (gnc:make-budget-option
+        gnc:pagename-general optname-budget
+        "a" (N_ "Budget to use.")))
+
+    ;; date interval
+    (gnc:options-add-date-interval!
+     options gnc:pagename-general
+     optname-from-date optname-to-date "b")
+
+    ;; Option to select the accounts to that will be displayed
+    (add-option (gnc:make-account-list-option
+        gnc:pagename-accounts optname-accounts
+        "c" (N_ "Report on these accounts.")
+        (lambda ()
+	  (gnc:filter-accountlist-type
+	    (list ACCT-TYPE-BANK ACCT-TYPE-ASSET ACCT-TYPE-LIABILITY)
+	    (gnc-account-get-descendants-sorted (gnc-get-current-root-account))))
+        #f #t))
+
+    (gnc:options-add-account-levels!
+     options gnc:pagename-accounts optname-depth-limit
+     "d" opthelp-depth-limit 6)
+
+    ;; Display tab
+    (add-option
+     (gnc:make-simple-boolean-option
+      gnc:pagename-display 
+      optname-running-sum
+      "a"
+      (N_ "Calculate as running sum?")
+      #t))
+
+    ;; Display tab
+    (add-option
+      (gnc:make-multichoice-option
+        gnc:pagename-display                  ;; tab name
+        optname-chart-type                    ;; displayed option name
+        "b"                                   ;; localization in the tab
+        (N_ "This is a multi choice option.") ;; option help text
+        'bars                                 ;; default selectioin
+        (list
+          (list->vector
+            (list 'bars
+                  (N_ "Barchart")
+                  (N_ "Show the report as a bar chart.")
+            )
+          )
+          (list->vector
+            (list 'lines
+                  (N_ "Linechart")
+                  (N_ "Show the report as a line chart.")
+            )
+          )
+        )
+      )
+    )
+
+    (gnc:options-add-plot-size! 
+     options gnc:pagename-display 
+     optname-plot-width optname-plot-height "c" (cons 'percent 100.0) (cons 'percent 100.0))
+
+    ;; Set default page
+    (gnc:options-set-default-section options gnc:pagename-general)
+
+    ;; Return options
+    options
+))
+
+
+;; For each period in the budget:
+;; Retrieve the budgeted running sum and actual running sum
+;; for bac chart.
+;;
+;; Create bar and and values
+;;
+(define (gnc:chart-create-budget-actual budget acct running-sum chart-type width height from-tp to-tp)
+  (let* (
+          (chart #f)
+          (report-start-time (car from-tp))
+          (report-end-time (car to-tp))
+        )
+
+    (if (eqv? chart-type 'bars)
+      (begin
+        ;; Setup barchart
+        (set! chart (gnc:make-html-barchart))
+        (gnc:html-barchart-set-title! chart (xaccAccountGetName acct))
+        (gnc:html-barchart-set-width! chart width)
+        (gnc:html-barchart-set-height! chart height)
+        (gnc:html-barchart-set-row-labels-rotated?! chart #t)
+        (gnc:html-barchart-set-col-labels!
+          chart (list (_ "Budget") (_ "Actual")))
+        (gnc:html-barchart-set-col-colors!
+          chart '("blue" "red"))
+      )
+      ;; else
+      (begin
+        ;; Setup linechart
+        (set! chart (gnc:make-html-linechart))
+        (gnc:html-linechart-set-title! chart (xaccAccountGetName acct))
+        (gnc:html-linechart-set-width! chart width)
+        (gnc:html-linechart-set-height! chart height)
+        (gnc:html-linechart-set-row-labels-rotated?! chart #t)
+        (gnc:html-linechart-set-col-labels!
+          chart (list (_ "Budget") (_ "Actual")))
+        (gnc:html-linechart-set-col-colors!
+          chart '("blue" "red"))
+      )
+    )
+
+    ;; Prepair vars for running sums, and to loop though periods
+    (let* (
+        (num-periods (gnc-budget-get-num-periods budget))
+        (period 0)
+        (bgt-sum 0)
+        (act-sum 0)
+        (date (gnc-budget-get-period-start-date budget period))
+        (period-start-time (car date))
+        (bgt-vals '())
+        (act-vals '())
+        (date-iso-string-list '())
+        (save-fmt (qof-date-format-get))
+      )
+
+      ;; make sure jqplot receives the date strings in ISO format (Bug763257)
+      (qof-date-format-set QOF-DATE-FORMAT-ISO)
+
+      ;; Loop through periods
+      (while (< period num-periods)
+        ;;add calc new running sums
+	(if running-sum
+          (begin
+            (set! bgt-sum (+ bgt-sum
+              (gnc-numeric-to-double
+                (gnc:get-account-period-rolledup-budget-value budget acct period))))
+	    (set! act-sum (+ act-sum
+              (gnc-numeric-to-double
+                (gnc-budget-get-account-period-actual-value budget acct period))))
+          )
+        )
+        (if (<= report-start-time period-start-time)
+	  ;; within reporting period, update the display lists
+          (begin
+            (if (not running-sum)
+              (begin
+	        (set! bgt-sum
+                  (gnc-numeric-to-double
+                    (gnc:get-account-period-rolledup-budget-value budget acct period)))
+	        (set! act-sum
+                  (gnc-numeric-to-double
+                    (gnc-budget-get-account-period-actual-value budget acct period)))
+              )
+            )
+            (set! bgt-vals (append bgt-vals (list bgt-sum)))
+            (set! act-vals (append act-vals (list act-sum)))
+            (set! date-iso-string-list (append date-iso-string-list (list (gnc-print-date date))))
+          )
+        )
+        ;; prepare data for next loop repetition
+        (set! period (+ period 1))
+        (set! date (gnc-budget-get-period-start-date budget period))
+        (set! period-start-time (car date))
+        (if (< report-end-time period-start-time)
+          (set! period num-periods) ;; reporting period has ended, break the loop
+        )
+      )
+
+      ;; restore the date strings format
+      (qof-date-format-set save-fmt)
+
+      (if (eqv? chart-type 'bars)
+        (begin
+          ;; Add data to the bar chart
+          (gnc:html-barchart-append-column! chart bgt-vals)
+          (gnc:html-barchart-append-column! chart act-vals)
+          (gnc:html-barchart-set-row-labels! chart date-iso-string-list)
+          (if running-sum
+            (gnc:html-barchart-set-subtitle! chart
+              (string-append "Bgt:"
+                         (jqplot-escape-string (number->string bgt-sum))
+                         "<br /> Act:"
+                         (jqplot-escape-string (number->string act-sum))
+              )
+            )
+          )
+        )
+        ;; else
+        (begin
+          ;; Add data to the line chart
+          (gnc:html-linechart-append-column! chart bgt-vals)
+          (gnc:html-linechart-append-column! chart act-vals)
+          (gnc:html-linechart-set-row-labels! chart date-iso-string-list)
+          (if running-sum
+            (gnc:html-linechart-set-subtitle! chart
+              (string-append "Bgt:"
+                         (jqplot-escape-string (number->string bgt-sum))
+                         "<br /> Act:"
+                         (jqplot-escape-string (number->string act-sum))
+              )
+            )
+          )
+        )
+      )
+    )
+
+    ;; Return newly created chart
+    chart
+))
+
+
+;; This is the rendering function. It accepts a database of options
+;; and generates an object of type <html-document>.  See the file
+;; report-html.txt for documentation; the file report-html.scm
+;; includes all the relevant Scheme code. The option database passed
+;; to the function is one created by the options-generator function
+;; defined above.
+(define (net-renderer report-obj)
+
+  ;; This is a helper function for looking up option values.
+  (define (get-option section name)
+    (gnc:option-value 
+     (gnc:lookup-option (gnc:report-options report-obj) section name)))
+
+  ;; This is a helper function to find out the level of the account
+  ;; with in the account tree
+  (define (get-account-level account level)
+    (let (
+           (parent (gnc-account-get-parent account))
+         )
+      (cond
+        (
+          (null? parent) ;; exit
+          level
+        )
+        (else
+          (get-account-level parent (+ level 1))
+        )
+      )
+    )
+  )
+
+  (let* (
+      (budget (get-option gnc:pagename-general optname-budget))
+      (budget-valid? (and budget (not (null? budget))))
+      (running-sum (get-option gnc:pagename-display optname-running-sum))
+      (chart-type (get-option gnc:pagename-display optname-chart-type))
+      (height (get-option gnc:pagename-display optname-plot-height))
+      (width (get-option gnc:pagename-display optname-plot-width))
+      (accounts (get-option gnc:pagename-accounts optname-accounts))
+      (depth-limit (get-option gnc:pagename-accounts optname-depth-limit))
+      (report-title (get-option gnc:pagename-general
+        gnc:optname-reportname))
+      (document (gnc:make-html-document))
+      (from-date-tp (gnc:timepair-start-day-time
+                      (gnc:date-option-absolute-time
+                        (get-option gnc:pagename-general optname-from-date))))
+      (to-date-tp (gnc:timepair-end-day-time
+                    (gnc:date-option-absolute-time
+                      (get-option gnc:pagename-general optname-to-date))))
+    )
+    (cond
+      ((null? accounts)
+        ;; No accounts selected
+        (gnc:html-document-add-object!
+          document
+            (gnc:html-make-no-account-warning 
+              report-title (gnc:report-id report-obj))))
+
+      ((not budget-valid?)
+        ;; No budget selected.
+        (gnc:html-document-add-object!
+          document (gnc:html-make-generic-budget-warning reportname)))
+
+      ;; Else create chart for each account
+      (else
+        (for-each
+          (lambda (acct)
+            (if (or
+                  (and (equal? depth-limit 'all)
+                       (null? (gnc-account-get-descendants acct))
+                  )
+                  (and (not (equal? depth-limit 'all))
+                       (<= (get-account-level acct 0) depth-limit)
+                       (null? (gnc-account-get-descendants acct))
+                  )
+                  (and (not (equal? depth-limit 'all))
+                       (= (get-account-level acct 0) depth-limit)
+                  )
+                )
+              (gnc:html-document-add-object!
+                document
+                (gnc:chart-create-budget-actual budget acct running-sum chart-type width height from-date-tp to-date-tp)
+              )
+            )
+          )
+          accounts
+        )
+      )
+    ) ;; end cond
+    
+    document
+))
+
+;; Here we define the actual report
+(gnc:define-report
+ 'version 1
+ 'name reportname
+ 'report-guid "415cd38d39054d9e9c4040455290c2b1"
+ 'menu-path (list gnc:menuname-budget)
+ 'options-generator (lambda () (options-generator))
+ 'renderer (lambda (report-obj) (net-renderer report-obj)))
diff --git a/src/report/standard-reports/budget-flow.scm b/gnucash/report/standard-reports/budget-flow.scm
similarity index 100%
rename from src/report/standard-reports/budget-flow.scm
rename to gnucash/report/standard-reports/budget-flow.scm
diff --git a/src/report/standard-reports/budget-income-statement.scm b/gnucash/report/standard-reports/budget-income-statement.scm
similarity index 100%
rename from src/report/standard-reports/budget-income-statement.scm
rename to gnucash/report/standard-reports/budget-income-statement.scm
diff --git a/src/report/standard-reports/budget.scm b/gnucash/report/standard-reports/budget.scm
similarity index 100%
rename from src/report/standard-reports/budget.scm
rename to gnucash/report/standard-reports/budget.scm
diff --git a/src/report/standard-reports/cash-flow.scm b/gnucash/report/standard-reports/cash-flow.scm
similarity index 100%
rename from src/report/standard-reports/cash-flow.scm
rename to gnucash/report/standard-reports/cash-flow.scm
diff --git a/src/report/standard-reports/category-barchart.scm b/gnucash/report/standard-reports/category-barchart.scm
similarity index 100%
rename from src/report/standard-reports/category-barchart.scm
rename to gnucash/report/standard-reports/category-barchart.scm
diff --git a/src/report/standard-reports/daily-reports.scm b/gnucash/report/standard-reports/daily-reports.scm
similarity index 100%
rename from src/report/standard-reports/daily-reports.scm
rename to gnucash/report/standard-reports/daily-reports.scm
diff --git a/src/report/standard-reports/equity-statement.scm b/gnucash/report/standard-reports/equity-statement.scm
similarity index 100%
rename from src/report/standard-reports/equity-statement.scm
rename to gnucash/report/standard-reports/equity-statement.scm
diff --git a/src/report/standard-reports/general-journal.scm b/gnucash/report/standard-reports/general-journal.scm
similarity index 100%
rename from src/report/standard-reports/general-journal.scm
rename to gnucash/report/standard-reports/general-journal.scm
diff --git a/src/report/standard-reports/general-ledger.scm b/gnucash/report/standard-reports/general-ledger.scm
similarity index 100%
rename from src/report/standard-reports/general-ledger.scm
rename to gnucash/report/standard-reports/general-ledger.scm
diff --git a/src/report/standard-reports/income-statement.scm b/gnucash/report/standard-reports/income-statement.scm
similarity index 100%
rename from src/report/standard-reports/income-statement.scm
rename to gnucash/report/standard-reports/income-statement.scm
diff --git a/gnucash/report/standard-reports/net-barchart.scm b/gnucash/report/standard-reports/net-barchart.scm
new file mode 100644
index 0000000..a180983
--- /dev/null
+++ b/gnucash/report/standard-reports/net-barchart.scm
@@ -0,0 +1,480 @@
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; net-barchart.scm : Display a time series for either net worth or
+;; net profit.
+;;
+;; By Robert Merkel <rgmerk at mira.net>
+;; and Christian Stimming <stimming at tu-harburg.de>
+;;
+;; 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 at gnu.org
+;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(define-module (gnucash report standard-reports net-barchart))
+
+(use-modules (srfi srfi-1))
+(use-modules (gnucash main)) ;; FIXME: delete after we finish modularizing.
+(use-modules (gnucash gnc-module))
+(use-modules (gnucash gettext))
+
+(use-modules (gnucash printf))
+(use-modules (gnucash report report-system report-collectors))
+(use-modules (gnucash report report-system collectors))
+(use-modules (gnucash report standard-reports category-barchart)) ; for guids of called reports
+
+(gnc:module-load "gnucash/report/report-system" 0)
+
+;; included since Bug726449
+(use-modules (ice-9 regex)) ;; for regexp-substitute/global, used by jpqplot
+(load-from-path "html-jqplot") ;; for jqplot-escape-string
+
+(define reportname (N_ "Income/Expense Chart"))
+
+(define optname-from-date (N_ "Start Date"))
+(define optname-to-date (N_ "End Date"))
+(define optname-stepsize (N_ "Step Size"))
+(define optname-report-currency (N_ "Report's currency"))
+(define optname-price-source (N_ "Price Source"))
+
+(define optname-accounts (N_ "Accounts"))
+
+(define optname-inc-exp (N_ "Show Income/Expense"))
+(define optname-show-profit (N_ "Show Net Profit"))
+
+(define optname-sep-bars (N_ "Show Asset & Liability bars"))
+(define optname-net-bars (N_ "Show Net Worth bars"))
+
+(define optname-plot-width (N_ "Plot Width"))
+(define optname-plot-height (N_ "Plot Height"))
+
+(define (options-generator inc-exp?)
+  (let* ((options (gnc:new-options))
+         ;; This is just a helper function for making options.
+         ;; See libgnucash/scm/options.scm for details.
+         (add-option
+          (lambda (new-option)
+            (gnc:register-option options new-option))))
+
+    ;; General tab
+    (gnc:options-add-date-interval!
+     options gnc:pagename-general
+     optname-from-date optname-to-date "a")
+
+    (gnc:options-add-interval-choice!
+     options gnc:pagename-general optname-stepsize "b" 'MonthDelta)
+
+    (gnc:options-add-currency!
+     options gnc:pagename-general optname-report-currency "c")
+
+    (gnc:options-add-price-source!
+     options gnc:pagename-general
+     optname-price-source "d" 'weighted-average)
+
+    ;; Account tab
+    (add-option
+     (gnc:make-account-list-option
+      gnc:pagename-accounts optname-accounts
+      "a"
+      (N_ "Report on these accounts, if chosen account level allows.")
+      (lambda ()
+        (filter
+         (if inc-exp?
+             gnc:account-is-inc-exp?
+             (lambda (account) (not (gnc:account-is-inc-exp? account))))
+         (gnc-account-get-descendants-sorted (gnc-get-current-root-account))))
+      (lambda (accounts)
+        (list #t
+              (filter
+               (if inc-exp?
+                   gnc:account-is-inc-exp?
+                   (lambda (account)
+                     (not (gnc:account-is-inc-exp? account))))
+               accounts)))
+      #t))
+
+    ;; Display tab
+    (add-option
+     (gnc:make-simple-boolean-option
+      gnc:pagename-display
+      (if inc-exp? optname-inc-exp optname-sep-bars)
+      "a"
+      (if inc-exp?
+          (N_ "Show Income and Expenses?")
+          (N_ "Show the Asset and the Liability bars?"))
+      #t))
+
+    (add-option
+     (gnc:make-simple-boolean-option
+      gnc:pagename-display
+      (if inc-exp? optname-show-profit optname-net-bars)
+      "b"
+      (if inc-exp?
+          (N_ "Show the net profit?")
+          (N_ "Show a Net Worth bar?"))
+      #t))
+
+    (add-option
+     (gnc:make-simple-boolean-option
+      gnc:pagename-display
+      (N_ "Show table")
+      "c" (N_ "Display a table of the selected data.")
+      #f))
+
+    (gnc:options-add-plot-size! 
+     options gnc:pagename-display 
+     optname-plot-width optname-plot-height "d" (cons 'percent 100.0) (cons 'percent 100.0))
+
+    (gnc:options-set-default-section options gnc:pagename-general)
+
+    options))
+
+;; This is the rendering function. It accepts a database of options
+;; and generates an object of type <html-document>.  See the file
+;; report-html.txt for documentation; the file report-html.scm
+;; includes all the relevant Scheme code. The option database passed
+;; to the function is one created by the options-generator function
+;; defined above.
+(define (net-renderer report-obj inc-exp?)
+
+  ;; This is a helper function for looking up option values.
+  (define (get-option section name)
+    (gnc:option-value
+     (gnc:lookup-option (gnc:report-options report-obj) section name)))
+
+  (gnc:report-starting reportname)
+  (let* ((to-date-tp (gnc:timepair-end-day-time
+                      (gnc:date-option-absolute-time
+                       (get-option gnc:pagename-general
+				   optname-to-date))))
+         (from-date-tp (gnc:timepair-start-day-time
+                        (gnc:date-option-absolute-time
+                         (get-option gnc:pagename-general
+				     optname-from-date))))
+         (interval (get-option gnc:pagename-general optname-stepsize))
+         (report-currency (get-option gnc:pagename-general
+                                      optname-report-currency))
+         (price-source (get-option gnc:pagename-general
+                                   optname-price-source))
+
+         (accounts (get-option gnc:pagename-accounts optname-accounts))
+
+         (show-sep? (get-option gnc:pagename-display
+				(if inc-exp? optname-inc-exp
+				    optname-sep-bars)))
+         (show-net? (get-option gnc:pagename-display
+				(if inc-exp? optname-show-profit
+				    optname-net-bars)))
+         (height (get-option gnc:pagename-display optname-plot-height))
+         (width (get-option gnc:pagename-display optname-plot-width))
+
+         (commodity-list #f)
+         (exchange-fn #f)
+
+         (dates-list ((if inc-exp? gnc:make-date-interval-list
+                          gnc:make-date-list)
+                      ((if inc-exp? gnc:timepair-start-day-time
+                           gnc:timepair-end-day-time) from-date-tp)
+                      (gnc:timepair-end-day-time to-date-tp)
+                      (gnc:deltasym-to-delta interval)))
+	 (report-title (get-option gnc:pagename-general
+                                  gnc:optname-reportname))
+         (classified-accounts (gnc:decompose-accountlist accounts))
+         (show-table? (get-option gnc:pagename-display (N_ "Show table")))
+         (document (gnc:make-html-document))
+         (chart (gnc:make-html-barchart))
+         (non-zeros #f))
+
+    (define (add-column! data-list)
+      (begin
+        (gnc:html-barchart-append-column! chart data-list)
+        (if (gnc:not-all-zeros data-list) (set! non-zeros #t))
+        #f))
+
+    ;; This exchanges the commodity-collector 'c' to one single
+    ;; 'report-currency' according to the exchange-fn. Returns a
+    ;; double.
+    (define (collector->double c date)
+      (if (not (gnc:timepair? date))
+	  (throw 'wrong))
+      (gnc-numeric-to-double
+       (gnc:gnc-monetary-amount
+        (gnc:sum-collector-commodity
+         c report-currency
+         (lambda (a b) (exchange-fn a b date))))))
+
+    ;; This calculates the balances for all the 'accounts' for each
+    ;; element of the list 'dates'. If income?==#t, the signs get
+    ;; reversed according to income-sign-reverse general option
+    ;; settings. Uses the collector->double conversion function
+    ;; above. Returns a list of doubles.
+    (define (process-datelist accounts dates income?)
+      (map
+       (lambda (date)
+         (collector->double
+          ((if inc-exp?
+               (if income?
+                   gnc:accounts-get-comm-total-income
+                   gnc:accounts-get-comm-total-expense)
+               gnc:accounts-get-comm-total-assets)
+           accounts
+           (lambda (account)
+             (if inc-exp?
+                 ;; for inc-exp, 'date' is a pair of time values, else
+                 ;; it is a time value.
+                 (gnc:account-get-comm-balance-interval
+                  account (first date) (second date) #f)
+                 (gnc:account-get-comm-balance-at-date
+                  account date #f))))
+          (if inc-exp? (second date) date)))
+       dates))
+
+    (gnc:report-percent-done 1)
+    (set! commodity-list (gnc:accounts-get-commodities
+                          (append
+                           (gnc:acccounts-get-all-subaccounts accounts)
+                           accounts)
+                          report-currency))
+    (gnc:report-percent-done 10)
+    (set! exchange-fn (gnc:case-exchange-time-fn
+                       price-source report-currency
+                       commodity-list to-date-tp
+		       10 40))
+    (gnc:report-percent-done 50)
+
+    (if
+     (not (null? accounts))
+     (let* ((assets-list #f)
+            (liability-list #f)
+            (net-list #f)
+	    (progress-range (cons 50 80))
+            (date-string-list (map
+                               (if inc-exp?
+                                   (lambda (date-list-item)
+                                     (gnc-print-date
+                                      (car date-list-item)))
+                                   gnc-print-date)
+                               dates-list)))
+       (let* ((the-acount-destination-alist
+	       (if inc-exp?
+		   (append (map (lambda (account) (cons account 'asset))
+				 (assoc-ref classified-accounts ACCT-TYPE-INCOME))
+			   (map (lambda (account) (cons account 'liability))
+				 (assoc-ref classified-accounts ACCT-TYPE-EXPENSE)))
+		   (append  (map (lambda (account) (cons account 'asset))
+				 (assoc-ref classified-accounts ACCT-TYPE-ASSET))
+			    (map (lambda (account) (cons account 'liability))
+				 (assoc-ref classified-accounts ACCT-TYPE-LIABILITY)))))
+	      (account-reformat (if inc-exp?
+				    (lambda (account result)
+				      (map (lambda (collector date-interval)
+					     (- (collector->double collector (second date-interval))))
+					   result dates-list))
+				    (lambda (account result)
+				      (let ((commodity-collector (gnc:make-commodity-collector)))
+					(collector-end (fold (lambda (next date list-collector)
+							       (commodity-collector 'merge next #f)
+							       (collector-add list-collector
+									      (collector->double
+									       commodity-collector date)))
+							     (collector-into-list)
+							     result
+							     dates-list))))))
+	      (work (category-by-account-report-work inc-exp?
+					  dates-list
+					  the-acount-destination-alist
+					  (lambda (account date)
+					    (make-gnc-collector-collector))
+					  account-reformat))
+	      (rpt (category-by-account-report-do-work work progress-range))
+	      (assets (assoc-ref rpt 'asset))
+	      (liabilities (assoc-ref rpt 'liability)))
+	 (set! assets-list (if assets (car assets)
+			       (map (lambda (d) 0) dates-list)))
+	 (set! liability-list (if liabilities (car liabilities)
+				  (map (lambda (d) 0) dates-list)))
+	 )
+
+       (gnc:report-percent-done 80)
+       (set! net-list
+             (map + assets-list liability-list))
+       (gnc:report-percent-done 90)
+
+       (gnc:html-barchart-set-title!
+        chart report-title)
+       (gnc:html-barchart-set-subtitle!
+        chart (sprintf #f
+                       (_ "%s to %s")
+                       (jqplot-escape-string (gnc-print-date from-date-tp))
+                       (jqplot-escape-string (gnc-print-date to-date-tp))))
+       (gnc:html-barchart-set-width! chart width)
+       (gnc:html-barchart-set-height! chart height)
+       (gnc:html-barchart-set-row-labels! chart date-string-list)
+       (gnc:html-barchart-set-y-axis-label!
+        chart (gnc-commodity-get-mnemonic report-currency))
+       ;; Determine whether we have enough space for horizontal labels
+       ;; -- kind of a hack. Assumptions: y-axis labels and legend
+       ;; require 200 pixels, and each x-axes label needs 60 pixels.
+       ;;(gnc:html-barchart-set-row-labels-rotated?!
+       ;; chart (< (/ (- width 200)
+       ;;             (length date-string-list)) 60))
+
+       ;; Add the data
+       (if show-sep?
+           (begin
+             (add-column! assets-list)
+             (add-column!		      ;;(if inc-exp?
+              (map - liability-list)
+              ;;liability-list)
+              )))
+       (if show-net?
+           (add-column! net-list))
+
+       ;; Legend labels, colors
+       (gnc:html-barchart-set-col-labels!
+        chart (append
+               (if show-sep?
+                   (if inc-exp?
+                       (list (_ "Income") (_ "Expense"))
+                       (list (_ "Assets") (_ "Liabilities")))
+                   '())
+               (if show-net?
+                   (if inc-exp?
+                       (list (_ "Net Profit"))
+                       (list (_ "Net Worth")))
+                   '())))
+       (gnc:html-barchart-set-col-colors!
+        chart (append
+               (if show-sep?
+                   '("blue" "red") '())
+               (if show-net?
+                   '("green") '())))
+
+       ;; URLs for income/expense or asset/liabilities bars.
+;;       (if show-sep?
+;;           (let ((urls
+;;                  (list
+;;                   (gnc:make-report-anchor
+;;                    (if inc-exp?
+;;                        category-barchart-income-uuid
+;;                        category-barchart-asset-uuid)
+;;                    report-obj
+;;                    (list
+;;                     (list gnc:pagename-display
+;;                           "Use Stacked Bars" #t)
+;;                     (list gnc:pagename-general
+;;                           gnc:optname-reportname
+;;                           (if inc-exp?
+;;                               (_ "Income Chart")
+;;                               (_ "Asset Chart")))))
+;;                   (gnc:make-report-anchor
+;;                    (if inc-exp?
+;;                        category-barchart-expense-uuid
+;;                        category-barchart-liability-uuid)
+;;                    report-obj
+;;                    (list
+;;                     (list gnc:pagename-display
+;;                           "Use Stacked Bars" #t)
+;;                     (list gnc:pagename-general
+;;                           gnc:optname-reportname
+;;                           (if inc-exp?
+;;                               (_ "Expense Chart")
+;;                               (_ "Liability Chart"))))))))
+;;             (gnc:html-barchart-set-button-1-bar-urls!
+;;              chart urls)
+;;             (gnc:html-barchart-set-button-1-legend-urls!
+;;              chart urls)))
+
+       ;; Test for all-zero data here.
+       (if non-zeros
+           (begin
+           (gnc:html-document-add-object! document chart)
+             (if show-table?
+             (let ((table (gnc:make-html-table)))
+                (gnc:html-table-set-col-headers!
+                 table
+                 (append
+                  (list (_ "Date"))
+                  (if show-sep?
+                      (if inc-exp?
+                          (list (_ "Income") (_ "Expense"))
+                          (list (_ "Assets") (_ "Liabilities")))
+                      '())
+                  (if show-net?
+                      (if inc-exp?
+                          (list (_ "Net Profit"))
+                          (list (_ "Net Worth")))
+                      '()))
+                 )
+               (gnc:html-table-append-column! table date-string-list)
+               (if show-sep?
+                   (begin
+                     (gnc:html-table-append-column! table assets-list)
+                     (gnc:html-table-append-column! table liability-list)
+                    )
+                   )
+               (if show-net?
+                   (gnc:html-table-append-column! table net-list)
+                   )
+               ;; set numeric columns to align right
+                (for-each
+                 (lambda (col)
+                   (gnc:html-table-set-col-style!
+                    table col "td"
+                    'attribute (list "class" "number-cell")))
+                 '(1 2 3))
+
+              (gnc:html-document-add-object! document table))
+             ))
+           (gnc:html-document-add-object!
+            document
+            (gnc:html-make-empty-data-warning
+	     report-title (gnc:report-id report-obj)))))
+
+     ;; else no accounts selected
+     (gnc:html-document-add-object!
+      document
+      (gnc:html-make-no-account-warning
+       report-title (gnc:report-id report-obj))))
+
+    (gnc:report-finished)
+    document))
+
+;; Export reports
+
+(export net-worth-barchart-uuid)
+(export income-expense-barchart-uuid)
+
+(define net-worth-barchart-uuid "cbba1696c8c24744848062c7f1cf4a72")
+(define income-expense-barchart-uuid "80769921e87943adade887b9835a7685")
+
+;; Here we define the actual report
+(gnc:define-report
+ 'version 1
+ 'name (N_ "Net Worth Barchart")
+ 'report-guid net-worth-barchart-uuid
+ 'menu-path (list gnc:menuname-asset-liability)
+ 'options-generator (lambda () (options-generator #f))
+ 'renderer (lambda (report-obj) (net-renderer report-obj #f)))
+
+(gnc:define-report
+ 'version 1
+ 'name reportname
+ 'report-guid income-expense-barchart-uuid
+ 'menu-name (N_ "Income & Expense Barchart")
+ 'menu-path (list gnc:menuname-income-expense)
+ 'options-generator (lambda () (options-generator #t))
+ 'renderer (lambda (report-obj) (net-renderer report-obj #t)))
diff --git a/gnucash/report/standard-reports/net-linechart.scm b/gnucash/report/standard-reports/net-linechart.scm
new file mode 100644
index 0000000..2738187
--- /dev/null
+++ b/gnucash/report/standard-reports/net-linechart.scm
@@ -0,0 +1,535 @@
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; net-linechart.scm : Display a time series line chart for
+;; either net worth or net profit.
+;;
+;; By Robert Merkel <rgmerk at mira.net>
+;; and Christian Stimming <stimming at tu-harburg.de>
+;; and Mike Evans <mikee at saxicooa.co.uk>
+;;
+;; 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 at gnu.org
+;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(define-module (gnucash report standard-reports net-linechart))
+
+(use-modules (srfi srfi-1))
+(use-modules (gnucash main)) ;; FIXME: delete after we finish modularizing.
+(use-modules (gnucash gnc-module))
+(use-modules (gnucash gettext))
+
+(use-modules (gnucash printf))
+(use-modules (gnucash report report-system report-collectors))
+(use-modules (gnucash report report-system collectors))
+(use-modules (gnucash report standard-reports category-barchart)) ; for guids of called reports
+(gnc:module-load "gnucash/report/report-system" 0)
+
+(define reportname (N_ "Income/Expense Chart"))
+
+(define optname-from-date (N_ "Start Date"))
+(define optname-to-date (N_ "End Date"))
+(define optname-stepsize (N_ "Step Size"))
+(define optname-report-currency (N_ "Report's currency"))
+(define optname-price-source (N_ "Price Source"))
+
+(define optname-accounts (N_ "Accounts"))
+
+(define optname-inc-exp (N_ "Show Income/Expense"))
+(define optname-show-profit (N_ "Show Net Profit"))
+
+(define optname-sep-bars (N_ "Show Asset & Liability"))
+(define optname-net-bars (N_ "Show Net Worth"))
+
+(define optname-plot-width (N_ "Plot Width"))
+(define optname-plot-height (N_ "Plot Height"))
+
+(define optname-line-width (N_ "Line Width"))
+(define opthelp-line-width (N_ "Set line width in pixels."))
+
+(define optname-markers (N_ "Data markers?"))
+
+;;(define optname-x-grid (N_ "X grid"))
+(define optname-y-grid (N_ "Grid"))
+
+
+
+(define (options-generator inc-exp?)
+  (let* ((options (gnc:new-options))
+         ;; This is just a helper function for making options.
+         ;; See libgnucash/scm/options.scm for details.
+         (add-option
+          (lambda (new-option)
+            (gnc:register-option options new-option))))
+
+    ;; General tab
+    (gnc:options-add-date-interval!
+     options gnc:pagename-general
+     optname-from-date optname-to-date "a")
+
+    (gnc:options-add-interval-choice!
+     options gnc:pagename-general optname-stepsize "b" 'MonthDelta)
+
+    (gnc:options-add-currency!
+     options gnc:pagename-general optname-report-currency "c")
+
+    (gnc:options-add-price-source!
+     options gnc:pagename-general
+     optname-price-source "d" 'weighted-average)
+
+    ;; Account tab
+    (add-option
+     (gnc:make-account-list-option
+      gnc:pagename-accounts optname-accounts
+      "a"
+      (N_ "Report on these accounts, if chosen account level allows.")
+      (lambda ()
+        (filter
+         (if inc-exp?
+             gnc:account-is-inc-exp?
+             (lambda (account) (not (gnc:account-is-inc-exp? account))))
+         (gnc-account-get-descendants-sorted (gnc-get-current-root-account))))
+      (lambda (accounts)
+        (list #t
+              (filter
+               (if inc-exp?
+                   gnc:account-is-inc-exp?
+                   (lambda (account)
+                     (not (gnc:account-is-inc-exp? account))))
+               accounts)))
+      #t))
+
+    ;; Display tab
+    (add-option
+     (gnc:make-simple-boolean-option
+      gnc:pagename-display
+      (if inc-exp? optname-inc-exp optname-sep-bars)
+      "a"
+      (if inc-exp?
+          (N_ "Show Income and Expenses?")
+          (N_ "Show the Asset and the Liability bars?"))
+      #t))
+
+    (add-option
+     (gnc:make-simple-boolean-option
+      gnc:pagename-display
+      (if inc-exp? optname-show-profit optname-net-bars)
+      "b"
+      (if inc-exp?
+          (N_ "Show the net profit?")
+          (N_ "Show a Net Worth bar?"))
+      #t))
+
+    (add-option
+     (gnc:make-simple-boolean-option
+      gnc:pagename-display
+      (N_ "Show table")
+      "c" (N_ "Display a table of the selected data.")
+      #f))
+
+    (gnc:options-add-plot-size! 
+     options gnc:pagename-display 
+     optname-plot-width optname-plot-height "d" (cons 'percent 100.0) (cons 'percent 100.0))
+
+
+     (add-option
+     (gnc:make-number-range-option
+      gnc:pagename-display optname-line-width
+      "e" opthelp-line-width
+      1.5 0.5 5 1 0.1 ))
+
+
+    (add-option
+     (gnc:make-simple-boolean-option
+      gnc:pagename-display optname-y-grid
+      "f" (N_ "Add grid lines.")
+      #t))
+
+    ;(add-option
+    ; (gnc:make-simple-boolean-option
+    ;  gnc:pagename-display optname-x-grid
+    ;  "g" (N_ "Add vertical grid lines.")
+    ;  #f))
+
+    (add-option
+     (gnc:make-simple-boolean-option
+      gnc:pagename-display optname-markers
+      "g" (N_ "Display a mark for each data point.")
+      #t))
+
+    (gnc:options-set-default-section options gnc:pagename-general)
+
+    options))
+
+;; This is the rendering function. It accepts a database of options
+;; and generates an object of type <html-document>.  See the file
+;; report-html.txt for documentation; the file report-html.scm
+;; includes all the relevant Scheme code. The option database passed
+;; to the function is one created by the options-generator function
+;; defined above.
+(define (net-renderer report-obj inc-exp?)
+
+  ;; This is a helper function for looking up option values.
+  (define (get-option section name)
+    (gnc:option-value
+     (gnc:lookup-option (gnc:report-options report-obj) section name)))
+
+  (gnc:report-starting reportname)
+  (let* ((to-date-tp (gnc:timepair-end-day-time
+                      (gnc:date-option-absolute-time
+                       (get-option gnc:pagename-general
+				   optname-to-date))))
+         (from-date-tp (gnc:timepair-start-day-time
+                        (gnc:date-option-absolute-time
+                         (get-option gnc:pagename-general
+				     optname-from-date))))
+         (interval (get-option gnc:pagename-general optname-stepsize))
+         (report-currency (get-option gnc:pagename-general
+                                      optname-report-currency))
+         (price-source (get-option gnc:pagename-general
+                                   optname-price-source))
+
+         (accounts (get-option gnc:pagename-accounts optname-accounts))
+
+         (show-sep? (get-option gnc:pagename-display
+				(if inc-exp? optname-inc-exp
+				    optname-sep-bars)))
+         (show-net? (get-option gnc:pagename-display
+				(if inc-exp? optname-show-profit
+				    optname-net-bars)))
+         (height (get-option gnc:pagename-display optname-plot-height))
+         (width (get-option gnc:pagename-display optname-plot-width))
+        (markers (get-option gnc:pagename-display optname-markers))
+
+        (line-width (get-option gnc:pagename-display optname-line-width))
+        (y-grid (get-option gnc:pagename-display optname-y-grid))
+        ;(x-grid (get-option gnc:pagename-display optname-x-grid))
+
+         (commodity-list #f)
+         (exchange-fn #f)
+
+         (dates-list ((if inc-exp? gnc:make-date-interval-list
+                          gnc:make-date-list)
+                      ((if inc-exp? gnc:timepair-start-day-time
+                           gnc:timepair-end-day-time) from-date-tp)
+                      (gnc:timepair-end-day-time to-date-tp)
+                      (gnc:deltasym-to-delta interval)))
+	 (report-title (get-option gnc:pagename-general
+                                  gnc:optname-reportname))
+         (classified-accounts (gnc:decompose-accountlist accounts))
+         (show-table? (get-option gnc:pagename-display (N_ "Show table")))
+         (document (gnc:make-html-document))
+         (chart (gnc:make-html-linechart))
+         (non-zeros #f))
+
+    (define (add-column! data-list)
+      (begin
+        (gnc:html-linechart-append-column! chart data-list)
+        (if (gnc:not-all-zeros data-list) (set! non-zeros #t))
+        #f))
+
+    ;; This exchanges the commodity-collector 'c' to one single
+    ;; 'report-currency' according to the exchange-fn. Returns a
+    ;; double.
+    (define (collector->double c date)
+      (if (not (gnc:timepair? date))
+	  (throw 'wrong))
+      (gnc-numeric-to-double
+       (gnc:gnc-monetary-amount
+        (gnc:sum-collector-commodity
+         c report-currency
+         (lambda (a b) (exchange-fn a b date))))))
+
+    ;; This calculates the balances for all the 'accounts' for each
+    ;; element of the list 'dates'. If income?==#t, the signs get
+    ;; reversed according to income-sign-reverse general option
+    ;; settings. Uses the collector->double conversion function
+    ;; above. Returns a list of doubles.
+    (define (process-datelist accounts dates income?)
+      (map
+       (lambda (date)
+         (collector->double
+          ((if inc-exp?
+               (if income?
+                   gnc:accounts-get-comm-total-income
+                   gnc:accounts-get-comm-total-expense)
+               gnc:accounts-get-comm-total-assets)
+           accounts
+           (lambda (account)
+             (if inc-exp?
+                 ;; for inc-exp, 'date' is a pair of time values, else
+                 ;; it is a time value.
+                 (gnc:account-get-comm-balance-interval
+                  account (first date) (second date) #f)
+                 (gnc:account-get-comm-balance-at-date
+                  account date #f))))
+          (if inc-exp? (second date) date)))
+       dates))
+
+    (gnc:report-percent-done 1)
+    (set! commodity-list (gnc:accounts-get-commodities
+                          (append
+                           (gnc:acccounts-get-all-subaccounts accounts)
+                           accounts)
+                          report-currency))
+    (gnc:report-percent-done 10)
+    (set! exchange-fn (gnc:case-exchange-time-fn
+                       price-source report-currency
+                       commodity-list to-date-tp
+		       10 40))
+    (gnc:report-percent-done 50)
+
+    (if
+     (not (null? accounts))
+     (let* ((assets-list #f)
+            (liability-list #f)
+            (net-list #f)
+	    (progress-range (cons 50 80))
+            ;; Here the date strings for the x-axis labels are
+            ;; created.
+            (date-string-list '())
+            (date-iso-string-list '())
+            (save-fmt (qof-date-format-get)))
+
+       (define (datelist->stringlist dates-list)
+         (map (lambda (date-list-item)
+                      (gnc-print-date
+                       (if inc-exp?
+                           (car date-list-item)
+                           date-list-item)))
+              dates-list))
+
+       (let* ((the-acount-destination-alist
+	       (if inc-exp?
+		   (append (map (lambda (account) (cons account 'asset))
+				 (assoc-ref classified-accounts ACCT-TYPE-INCOME))
+			   (map (lambda (account) (cons account 'liability))
+				 (assoc-ref classified-accounts ACCT-TYPE-EXPENSE)))
+		   (append  (map (lambda (account) (cons account 'asset))
+				 (assoc-ref classified-accounts ACCT-TYPE-ASSET))
+			    (map (lambda (account) (cons account 'liability))
+				 (assoc-ref classified-accounts ACCT-TYPE-LIABILITY)))))
+	      (account-reformat (if inc-exp?
+				    (lambda (account result)
+				      (map (lambda (collector date-interval)
+					     (- (collector->double collector (second date-interval))))
+					   result dates-list))
+				    (lambda (account result)
+				      (let ((commodity-collector (gnc:make-commodity-collector)))
+					(collector-end (fold (lambda (next date list-collector)
+							       (commodity-collector 'merge next #f)
+							       (collector-add list-collector
+									      (collector->double
+									       commodity-collector date)))
+							     (collector-into-list)
+							     result
+							     dates-list))))))
+	      (work (category-by-account-report-work inc-exp?
+					  dates-list
+					  the-acount-destination-alist
+					  (lambda (account date)
+					    (make-gnc-collector-collector))
+					  account-reformat))
+	      (rpt (category-by-account-report-do-work work progress-range))
+	      (assets (assoc-ref rpt 'asset))
+	      (liabilities (assoc-ref rpt 'liability)))
+	 (set! assets-list (if assets (car assets)
+			       (map (lambda (d) 0) dates-list)))
+	 (set! liability-list (if liabilities (car liabilities)
+				  (map (lambda (d) 0) dates-list)))
+	 )
+
+       (gnc:report-percent-done 80)
+       (set! net-list
+             (map + assets-list liability-list))
+       (gnc:report-percent-done 90)
+
+       (gnc:html-linechart-set-title!
+        chart report-title)
+       (gnc:html-linechart-set-subtitle!
+        chart (sprintf #f
+                       (_ "%s to %s")
+                       (gnc-print-date from-date-tp)
+                       (gnc-print-date to-date-tp)))
+       (gnc:html-linechart-set-width! chart width)
+       (gnc:html-linechart-set-height! chart height)
+
+       (qof-date-format-set QOF-DATE-FORMAT-ISO)
+       (set! date-iso-string-list (datelist->stringlist dates-list))
+       (qof-date-format-set save-fmt)
+       (gnc:html-linechart-set-row-labels! chart date-iso-string-list)
+
+       (gnc:html-linechart-set-major-grid?! chart y-grid)
+       (gnc:html-linechart-set-y-axis-label!
+        chart (gnc-commodity-get-mnemonic report-currency))
+
+       ;; Add the data
+       (if show-sep?
+           (begin
+             (add-column! assets-list)
+             (add-column!		      ;;(if inc-exp?
+              (map - liability-list)
+              ;;liability-list)
+              )))
+       (if show-net?
+           (add-column! net-list))
+
+       ;; Legend labels, colors
+       (gnc:html-linechart-set-col-labels!
+        chart (append
+               (if show-sep?
+                   (if inc-exp?
+                       (list (_ "Income") (_ "Expense"))
+                       (list (_ "Assets") (_ "Liabilities")))
+                   '())
+               (if show-net?
+                   (if inc-exp?
+                       (list (_ "Net Profit"))
+                       (list (_ "Net Worth")))
+                   '())))
+       (gnc:html-linechart-set-col-colors!
+        chart (append
+               (if show-sep?
+                   '("blue" "red") '())
+               (if show-net?
+                   '("green") '())))
+
+        ;; Set the line width and markers
+        (gnc:html-linechart-set-line-width!
+            chart line-width)
+        (gnc:html-linechart-set-markers?!
+            chart markers)
+
+       ;; URLs for income/expense or asset/liabilities bars.
+;;       (if show-sep?
+;;           (let ((urls
+;;                  (list
+;;                   (gnc:make-report-anchor
+;;                    (if inc-exp?
+;;                        category-barchart-income-uuid
+;;                        category-barchart-asset-uuid)
+;;                    report-obj
+;;                    (list
+;;                     (list gnc:pagename-display
+;;                           "Use Stacked Lines" #t)
+;;                     (list gnc:pagename-general
+;;                           gnc:optname-reportname
+;;                           (if inc-exp?
+;;                               (_ "Income Chart")
+;;                               (_ "Asset Chart")))))
+;;                   (gnc:make-report-anchor
+;;                    (if inc-exp?
+;;                        category-barchart-expense-uuid
+;;                        category-barchart-liability-uuid)
+;;                    report-obj
+;;                    (list
+;;                     (list gnc:pagename-display
+;;                           "Use Stacked Lines" #t)
+;;                     (list gnc:pagename-general
+;;                           gnc:optname-reportname
+;;                           (if inc-exp?
+;;                               (_ "Expense Chart")
+;;                               (_ "Liability Chart"))))))))
+;;             (gnc:html-linechart-set-button-1-line-urls!
+;;              chart urls)
+;;             (gnc:html-linechart-set-button-1-legend-urls!
+;;              chart urls)))
+
+       ;; Test for all-zero data here.
+       (if non-zeros
+           (begin
+           (gnc:html-document-add-object! document chart)
+             (if show-table?
+             (let ((table (gnc:make-html-table)))
+                (gnc:html-table-set-style!
+                  table "table"
+                  'attribute (list "border" 0)
+                  'attribute (list "cellspacing" 0)
+                  'attribute (list "cellpadding" 4))
+                (gnc:html-table-set-col-headers!
+                 table
+                 (append
+                  (list (_ "Date"))
+                  (if show-sep?
+                      (if inc-exp?
+                          (list (_ "Income") (_ "Expense"))
+                          (list (_ "Assets") (_ "Liabilities")))
+                      '())
+                  (if show-net?
+                      (if inc-exp?
+                          (list (_ "Net Profit"))
+                          (list (_ "Net Worth")))
+                      '()))
+                 )
+               (set! date-string-list (datelist->stringlist dates-list))
+               (gnc:html-table-append-column! table date-string-list)
+               (if show-sep?
+                   (begin
+                     (gnc:html-table-append-column! table assets-list)
+                     (gnc:html-table-append-column! table liability-list)
+                    )
+                   )
+               (if show-net?
+                   (gnc:html-table-append-column! table net-list)
+                   )
+               ;; set numeric columns to align right
+                (for-each
+                 (lambda (col)
+                   (gnc:html-table-set-col-style!
+                    table col "td"
+                    'attribute (list "class" "number-cell")))
+                 '(1 2 3))
+
+              (gnc:html-document-add-object! document table))
+             ))
+           (gnc:html-document-add-object!
+            document
+            (gnc:html-make-empty-data-warning
+	     report-title (gnc:report-id report-obj)))))
+
+     ;; else no accounts selected
+     (gnc:html-document-add-object!
+      document
+      (gnc:html-make-no-account-warning
+       report-title (gnc:report-id report-obj))))
+
+    (gnc:report-finished)
+    document))
+
+;; Export reports
+
+(export net-worth-linechart-uuid)
+(define net-worth-linechart-uuid "d8b63264186b11e19038001558291366")
+
+;; Here we define the actual report
+(gnc:define-report
+ 'version 1
+ 'name (N_ "Net Worth Linechart")
+ 'report-guid net-worth-linechart-uuid
+ 'menu-path (list gnc:menuname-asset-liability)
+ 'options-generator (lambda () (options-generator #f))
+ 'renderer (lambda (report-obj) (net-renderer report-obj #f)))
+
+;; Not sure if a line chart makes sense for Income & Expense
+;; Feel free to uncomment and try it though
+(gnc:define-report
+ 'version 1
+ 'name reportname
+ 'report-guid "e533c998186b11e1b2e2001558291366"
+ 'menu-name (N_ "Income & Expense Linechart")
+ 'menu-path (list gnc:menuname-income-expense)
+ 'options-generator (lambda () (options-generator #t))
+ 'renderer (lambda (report-obj) (net-renderer report-obj #t)))
diff --git a/gnucash/report/standard-reports/portfolio.scm b/gnucash/report/standard-reports/portfolio.scm
new file mode 100644
index 0000000..548077b
--- /dev/null
+++ b/gnucash/report/standard-reports/portfolio.scm
@@ -0,0 +1,303 @@
+;; -*-scheme-*- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; portfolio.scm
+;; by Robert Merkel (rgmerk at mira.net)
+;;
+;; 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 at gnu.org
+;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(define-module (gnucash report standard-reports portfolio))
+
+(use-modules (gnucash main)) ;; FIXME: delete after we finish modularizing.
+(use-modules (srfi srfi-1))
+(use-modules (gnucash gnc-module))
+(use-modules (gnucash gettext))
+
+(use-modules (gnucash printf))
+
+(gnc:module-load "gnucash/report/report-system" 0)
+
+(define reportname (N_ "Investment Portfolio"))
+
+(define optname-price-source (N_ "Price Source"))
+(define optname-shares-digits (N_ "Share decimal places"))
+(define optname-zero-shares (N_ "Include accounts with no shares"))
+
+(define (options-generator)
+  (let* ((options (gnc:new-options))
+         ;; This is just a helper function for making options.
+         ;; See libgnucash/scm/options.scm for details.
+         (add-option
+          (lambda (new-option)
+            (gnc:register-option options new-option))))
+
+    ;; General Tab
+    ;; date at which to report balance
+    (gnc:options-add-report-date!
+     options gnc:pagename-general
+     (N_ "Date") "a")
+
+    (gnc:options-add-currency!
+     options gnc:pagename-general (N_ "Report's currency") "c")
+
+    (gnc:options-add-price-source!
+     options gnc:pagename-general
+     optname-price-source "d" 'pricedb-latest)
+
+    (add-option
+     (gnc:make-number-range-option
+      gnc:pagename-general optname-shares-digits
+      "e" (N_ "The number of decimal places to use for share numbers.") 2
+      0 6 0 1))
+
+    ;; Account tab
+    (add-option
+     (gnc:make-account-list-option
+      gnc:pagename-accounts (N_ "Accounts")
+      "b"
+      (N_ "Stock Accounts to report on.")
+      (lambda () (filter gnc:account-is-stock?
+                         (gnc-account-get-descendants-sorted
+                          (gnc-get-current-root-account))))
+      (lambda (accounts) (list  #t
+                                (filter gnc:account-is-stock? accounts)))
+      #t))
+
+    (gnc:register-option
+     options
+     (gnc:make-simple-boolean-option
+      gnc:pagename-accounts optname-zero-shares "e"
+      (N_ "Include accounts that have a zero share balances.")
+      #f))
+
+    (gnc:options-set-default-section options gnc:pagename-general)
+    options))
+
+;; This is the rendering function. It accepts a database of options
+;; and generates an object of type <html-document>.  See the file
+;; report-html.txt for documentation; the file report-html.scm
+;; includes all the relevant Scheme code. The option database passed
+;; to the function is one created by the options-generator function
+;; defined above.
+(define (portfolio-renderer report-obj)
+
+ (let ((work-done 0)
+       (work-to-do 0))
+
+  ;; These are some helper functions for looking up option values.
+  (define (get-op section name)
+    (gnc:lookup-option (gnc:report-options report-obj) section name))
+
+  (define (get-option section name)
+    (gnc:option-value (get-op section name)))
+
+  (define (table-add-stock-rows table accounts to-date currency
+                                exchange-fn price-fn include-empty collector)
+
+   (let ((share-print-info
+	  (gnc-share-print-info-places
+	   (inexact->exact (get-option gnc:pagename-general
+				       optname-shares-digits)))))
+
+    (define (table-add-stock-rows-internal accounts odd-row?)
+      (if (null? accounts) collector
+          (let* ((row-style (if odd-row? "normal-row" "alternate-row"))
+                 (current (car accounts))
+                 (rest (cdr accounts))
+                 (commodity (xaccAccountGetCommodity current))
+                 (ticker-symbol (gnc-commodity-get-mnemonic commodity))
+                 (listing (gnc-commodity-get-namespace commodity))
+                 (unit-collector (gnc:account-get-comm-balance-at-date
+                                  current to-date #f))
+                 (units (cadr (unit-collector 'getpair commodity #f)))
+
+                 (price-info (price-fn commodity to-date))
+                 (price (car price-info))
+                 (price-monetary (if price
+                                     (gnc:make-gnc-monetary
+                                      (gnc-price-get-currency price)
+                                      (gnc-price-get-value price))
+                                     (gnc:make-gnc-monetary
+                                      currency
+                                      (cdr price-info))))
+                 (value (exchange-fn (gnc:make-gnc-monetary commodity units)
+                                     currency)))
+
+	    (set! work-done (+ 1 work-done))
+	    (gnc:report-percent-done (* 100 (/ work-done work-to-do)))
+	    (if (or include-empty (not (gnc-numeric-zero-p units)))
+		(begin (collector 'add currency (gnc:gnc-monetary-amount value))
+		       (gnc:html-table-append-row/markup!
+			table
+			row-style
+			(list (gnc:html-account-anchor current)
+			      (gnc:make-html-table-header-cell/markup "text-cell" ticker-symbol)
+			      (gnc:make-html-table-header-cell/markup "text-cell" listing)
+			      (gnc:make-html-table-header-cell/markup
+			       "number-cell"
+			       (xaccPrintAmount units share-print-info))
+			      (gnc:make-html-table-header-cell/markup
+			       "number-cell"
+                               (gnc:html-price-anchor price price-monetary))
+			      (gnc:make-html-table-header-cell/markup
+			       "number-cell" value)))
+		       ;;(display (sprintf #f "Shares: %6.6d  " (gnc-numeric-to-double units)))
+		       ;;(display units) (newline)
+		       (if price (gnc-price-unref price))
+		       (table-add-stock-rows-internal rest (not odd-row?)))
+		(begin (if price (gnc-price-unref price))
+		       (table-add-stock-rows-internal rest odd-row?))))))
+
+    (set! work-to-do (length accounts))
+    (table-add-stock-rows-internal accounts #t)))
+
+  ;; Tell the user that we're starting.
+  (gnc:report-starting reportname)
+
+  ;; The first thing we do is make local variables for all the specific
+  ;; options in the set of options given to the function. This set will
+  ;; be generated by the options generator above.
+  (let ((to-date     (gnc:date-option-absolute-time
+                      (get-option gnc:pagename-general "Date")))
+        (accounts    (get-option gnc:pagename-accounts "Accounts"))
+        (currency    (get-option gnc:pagename-general "Report's currency"))
+        (report-title (get-option gnc:pagename-general
+                                  gnc:optname-reportname))
+        (price-source (get-option gnc:pagename-general
+                                  optname-price-source))
+        (include-empty (get-option gnc:pagename-accounts
+                                  optname-zero-shares))
+
+        (collector   (gnc:make-commodity-collector))
+        ;; document will be the HTML document that we return.
+        (table (gnc:make-html-table))
+        (document (gnc:make-html-document)))
+
+    (gnc:html-document-set-title!
+     document (string-append
+               report-title
+               (sprintf #f " %s" (gnc-print-date to-date))))
+
+    ;(gnc:debug "accounts" accounts)
+    (if (not (null? accounts))
+        (let* ((commodity-list (gnc:accounts-get-commodities
+                                (append
+                                 (gnc:acccounts-get-all-subaccounts
+                                  accounts) accounts) currency))
+               (pricedb (gnc-pricedb-get-db (gnc-get-current-book)))
+	       (exchange-fn (gnc:case-exchange-fn price-source currency to-date))
+               (price-fn
+                (case price-source
+                  ((weighted-average average-cost)
+                   (lambda (foreign date)
+                    (cons #f (gnc-numeric-div
+                               (gnc:gnc-monetary-amount
+                                  (exchange-fn (gnc:make-gnc-monetary foreign
+                                                  (gnc-numeric-create 10000 1))
+                                                  currency))
+                               (gnc-numeric-create 10000 1)
+                               GNC-DENOM-AUTO
+                               (logior (GNC-DENOM-SIGFIGS 5) GNC-RND-ROUND)))))
+                  ((pricedb-latest)
+                   (lambda (foreign date)
+                     (let* ((price
+                             (gnc-pricedb-lookup-latest-any-currency
+                              pricedb foreign))
+                            (fn (if (and price (> (length price) 0))
+                                    (let* ((the_price
+                                            (if (gnc-commodity-equiv
+                                                 foreign
+                                                 (gnc-price-get-commodity (car price)))
+                                                (car price)
+                                                (gnc-price-invert (car price))))
+                                           (v (gnc-price-get-value the_price)))
+                                          (gnc-price-ref (car price))
+                                          (cons (car price) v))
+                                        (cons #f (gnc-numeric-zero)))))
+                       (if price (gnc-price-list-destroy price))
+                       fn)))
+                  ((pricedb-nearest)
+                   (lambda (foreign date)
+                     (let*  ((price
+                             (gnc-pricedb-lookup-nearest-in-time-any-currency
+                              pricedb foreign (timespecCanonicalDayTime date)))
+                            (fn (if (and price (> (length price) 0))
+                                    (let* ((the_price
+                                            (if (gnc-commodity-equiv
+                                                 foreign
+                                                 (gnc-price-get-commodity (car price)))
+                                                (car price)
+                                                (gnc-price-invert (car price))))
+                                           (v (gnc-price-get-value (car price))))
+                                           (gnc-price-ref (car price))
+                                           (cons (car price) v))
+                                         (cons #f (gnc-numeric-zero)))))
+                       (if price (gnc-price-list-destroy price))
+                       fn))))))
+
+          (gnc:html-table-set-col-headers!
+           table
+           (list (_ "Account")
+                 (_ "Symbol")
+                 (_ "Listing")
+                 (_ "Units")
+                 (_ "Price")
+                 (_ "Value")))
+
+          (table-add-stock-rows
+           table accounts to-date currency
+           exchange-fn price-fn include-empty collector)
+
+          (gnc:html-table-append-row/markup!
+           table
+           "grand-total"
+           (list
+            (gnc:make-html-table-cell/size
+             1 6 (gnc:make-html-text (gnc:html-markup-hr)))))
+
+          (collector
+           'format
+           (lambda (currency amount)
+             (gnc:html-table-append-row/markup!
+              table
+              "grand-total"
+              (list (gnc:make-html-table-cell/markup
+                     "total-label-cell" (_ "Total"))
+                    (gnc:make-html-table-cell/size/markup
+                     1 5 "total-number-cell"
+                     (gnc:make-gnc-monetary currency amount)))))
+           #f)
+
+          (gnc:html-document-add-object! document table))
+
+                                        ;if no accounts selected.
+        (gnc:html-document-add-object!
+         document
+	 (gnc:html-make-no-account-warning
+	  report-title (gnc:report-id report-obj))))
+
+    (gnc:report-finished)
+    document)))
+
+(gnc:define-report
+ 'version 1
+ 'name reportname
+ 'report-guid "4a6b82e8678c4f3d9e85d9f09634ca89"
+ 'menu-path (list gnc:menuname-asset-liability)
+ 'options-generator options-generator
+ 'renderer portfolio-renderer)
diff --git a/src/report/standard-reports/price-scatter.scm b/gnucash/report/standard-reports/price-scatter.scm
similarity index 100%
rename from src/report/standard-reports/price-scatter.scm
rename to gnucash/report/standard-reports/price-scatter.scm
diff --git a/src/report/standard-reports/register.scm b/gnucash/report/standard-reports/register.scm
similarity index 100%
rename from src/report/standard-reports/register.scm
rename to gnucash/report/standard-reports/register.scm
diff --git a/src/report/standard-reports/standard-reports.scm b/gnucash/report/standard-reports/standard-reports.scm
similarity index 100%
rename from src/report/standard-reports/standard-reports.scm
rename to gnucash/report/standard-reports/standard-reports.scm
diff --git a/src/report/standard-reports/sx-summary.scm b/gnucash/report/standard-reports/sx-summary.scm
similarity index 100%
rename from src/report/standard-reports/sx-summary.scm
rename to gnucash/report/standard-reports/sx-summary.scm
diff --git a/src/report/standard-reports/test/CMakeLists.txt b/gnucash/report/standard-reports/test/CMakeLists.txt
similarity index 100%
rename from src/report/standard-reports/test/CMakeLists.txt
rename to gnucash/report/standard-reports/test/CMakeLists.txt
diff --git a/gnucash/report/standard-reports/test/Makefile.am b/gnucash/report/standard-reports/test/Makefile.am
new file mode 100644
index 0000000..d6d5153
--- /dev/null
+++ b/gnucash/report/standard-reports/test/Makefile.am
@@ -0,0 +1,86 @@
+TESTS = $(SCM_TESTS)
+
+SCM_TESTS = \
+	test-cash-flow \
+	test-standard-category-report \
+	test-standard-net-barchart \
+	test-standard-net-linechart
+
+SCM_TEST_SRCS = $(SCM_TESTS:%=%.scm)
+
+GNC_TEST_DEPS = \
+  --gnc-module-dir ${top_builddir}/libgnucash/engine \
+  --gnc-module-dir ${top_builddir}/libgnucash/engine/test \
+  --gnc-module-dir ${top_builddir}/libgnucash/app-utils \
+  --gnc-module-dir ${top_builddir}/gnucash/gnome-utils \
+  --gnc-module-dir ${top_builddir}/gnucash/html \
+  --gnc-module-dir ${top_builddir}/gnucash/report/app-utils \
+  --gnc-module-dir ${top_builddir}/gnucash/report/report-system \
+  --gnc-module-dir ${top_builddir}/gnucash/report/report-system/test \
+\
+  --guile-load-dir ${top_builddir}/libgnucash/gnc-module \
+  --guile-load-dir ${top_builddir}/libgnucash/scm \
+  --guile-load-dir ${top_builddir}/libgnucash/engine \
+  --guile-load-dir ${top_builddir}/libgnucash/engine/test \
+  --guile-load-dir ${top_builddir}/libgnucash/core-utils \
+  --guile-load-dir ${top_builddir}/libgnucash/app-utils \
+  --guile-load-dir ${top_builddir}/gnucash/gnome-utils \
+  --guile-load-dir ${top_builddir}/gnucash/report/report-system \
+  --guile-load-dir ${top_builddir}/gnucash/report/report-system/test \
+  --guile-load-dir ${top_builddir}/gnucash/report/standard-reports \
+  --guile-load-dir ${top_builddir}/gnucash/report/standard-reports/test \
+\
+  --library-dir    ${top_builddir}/gnucash/report/report-system \
+  --library-dir    ${top_builddir}/libgnucash/core-utils \
+  --library-dir    ${top_builddir}/libgnucash/app-utils \
+  --library-dir    ${top_builddir}/gnucash/gnome-utils \
+  --library-dir    ${top_builddir}/libgnucash/engine \
+  --library-dir    ${top_builddir}/libgnucash/backend/xml \
+  --library-dir    ${top_builddir}/libgnucash/backend/sql \
+  --library-dir    ${top_builddir}/libgnucash/gnc-module
+
+$(SCM_TESTS): %: $(srcdir)/%.scm Makefile .scm-links
+	echo 'export GNC_BUILDDIR="${abs_top_builddir}";' > $@
+	echo 'export GNC_UNINSTALLED=yes;' >> $@
+	echo '${GUILE} --debug -l $(srcdir)/$*.scm -c "(exit (run-test))"' >> $@
+	chmod a+x $@
+
+TESTS_ENVIRONMENT = \
+  GUILE_WARN_DEPRECATED=no \
+  GUILE="${GUILE}" \
+  GNC_BUILDDIR="${abs_top_builddir}" \
+  $(shell ${abs_top_srcdir}/common/gnc-test-env.pl --noexports ${GNC_TEST_DEPS})
+
+
+SCM_TEST_HELPERS = \
+	test-generic-category-report.scm \
+	test-generic-net-barchart.scm \
+	test-generic-net-linechart.scm
+
+EXTRA_DIST = \
+	$(SCM_TEST_HELPERS) \
+	$(SCM_TEST_SRCS) \
+	CMakeLists.txt
+
+.scm-links:
+	$(RM) -rf gnucash
+	mkdir -p  gnucash/report/standard-reports/test
+	( cd gnucash/report/standard-reports/test; for A in $(SCM_TEST_HELPERS) ; do $(LN_S) -f $(abs_srcdir)/$$A . ; done )
+if ! OS_WIN32
+# Windows knows no "ln -s" but uses "cp": must copy every time (see bug #566567).
+	touch .scm-links
+endif
+
+interp:
+	$(TESTS_ENVIRONMENT) ${GUILE} --debug
+
+debug:
+	$(TESTS_ENVIRONMENT) gdb --args $(shell cat $(TEST))
+
+clean-local:
+	$(RM) -rf gnucash
+
+noinst_DATA = .scm-links
+CLEANFILES = .scm-links *.log
+DISTCLEANFILES = $(SCM_TESTS)
+
diff --git a/src/report/standard-reports/test/test-cash-flow.scm b/gnucash/report/standard-reports/test/test-cash-flow.scm
similarity index 100%
rename from src/report/standard-reports/test/test-cash-flow.scm
rename to gnucash/report/standard-reports/test/test-cash-flow.scm
diff --git a/src/report/standard-reports/test/test-generic-category-report.scm b/gnucash/report/standard-reports/test/test-generic-category-report.scm
similarity index 100%
rename from src/report/standard-reports/test/test-generic-category-report.scm
rename to gnucash/report/standard-reports/test/test-generic-category-report.scm
diff --git a/src/report/standard-reports/test/test-generic-net-barchart.scm b/gnucash/report/standard-reports/test/test-generic-net-barchart.scm
similarity index 100%
rename from src/report/standard-reports/test/test-generic-net-barchart.scm
rename to gnucash/report/standard-reports/test/test-generic-net-barchart.scm
diff --git a/src/report/standard-reports/test/test-generic-net-linechart.scm b/gnucash/report/standard-reports/test/test-generic-net-linechart.scm
similarity index 100%
rename from src/report/standard-reports/test/test-generic-net-linechart.scm
rename to gnucash/report/standard-reports/test/test-generic-net-linechart.scm
diff --git a/src/report/standard-reports/test/test-standard-category-report.scm b/gnucash/report/standard-reports/test/test-standard-category-report.scm
similarity index 100%
rename from src/report/standard-reports/test/test-standard-category-report.scm
rename to gnucash/report/standard-reports/test/test-standard-category-report.scm
diff --git a/src/report/standard-reports/test/test-standard-net-barchart.scm b/gnucash/report/standard-reports/test/test-standard-net-barchart.scm
similarity index 100%
rename from src/report/standard-reports/test/test-standard-net-barchart.scm
rename to gnucash/report/standard-reports/test/test-standard-net-barchart.scm
diff --git a/src/report/standard-reports/test/test-standard-net-linechart.scm b/gnucash/report/standard-reports/test/test-standard-net-linechart.scm
similarity index 100%
rename from src/report/standard-reports/test/test-standard-net-linechart.scm
rename to gnucash/report/standard-reports/test/test-standard-net-linechart.scm
diff --git a/src/report/standard-reports/transaction.scm b/gnucash/report/standard-reports/transaction.scm
similarity index 100%
rename from src/report/standard-reports/transaction.scm
rename to gnucash/report/standard-reports/transaction.scm
diff --git a/src/report/standard-reports/trial-balance.scm b/gnucash/report/standard-reports/trial-balance.scm
similarity index 100%
rename from src/report/standard-reports/trial-balance.scm
rename to gnucash/report/standard-reports/trial-balance.scm
diff --git a/gnucash/report/stylesheets/CMakeLists.txt b/gnucash/report/stylesheets/CMakeLists.txt
new file mode 100644
index 0000000..bd0e89b
--- /dev/null
+++ b/gnucash/report/stylesheets/CMakeLists.txt
@@ -0,0 +1,85 @@
+ADD_SUBDIRECTORY(test)
+
+SET(stylesheets_SOURCES
+  gnc-plugin-stylesheets.c
+  gncmod-stylesheets.c
+)
+
+SET(stylesheets_noinst_HEADERS
+  gnc-plugin-stylesheets.h
+)
+
+ADD_LIBRARY(gncmod-stylesheets MODULE ${stylesheets_SOURCES} ${stylesheets_noinst_HEADERS})
+
+TARGET_LINK_LIBRARIES(gncmod-stylesheets gncmod-report-gnome gncmod-report-system gncmod-gnome-utils gnc-module
+    ${GUILE_LDFLAGS} ${GTK3_LDFLAGS} ${GLIB2_LDFLAGS})
+
+TARGET_COMPILE_DEFINITIONS(gncmod-stylesheets PRIVATE -DG_LOG_DOMAIN=\"gnc.report.core\")
+
+SET(LIB_DIR lib/gnucash)
+IF (WIN32)
+  SET(LIB_DIR bin)
+ENDIF(WIN32)
+
+
+INSTALL(TARGETS gncmod-stylesheets
+  LIBRARY DESTINATION ${LIB_DIR}
+  ARCHIVE DESTINATION ${LIB_DIR}
+  RUNTIME DESTINATION bin)
+
+# No headers to install
+
+# Scheme
+
+SET(stylesheets_SCHEME_1
+  stylesheet-plain.scm
+  stylesheet-fancy.scm
+  stylesheet-footer.scm
+  stylesheet-easy.scm
+  stylesheet-head-or-tail.scm
+)
+
+SET(stylesheets_SCHEME_2
+  stylesheets.scm
+)
+
+SET(GUILE_OUTPUT_DIR gnucash/report)
+SET(GUILE_MODULES libgnucash/app-utils libgnucash/engine gnucash/html gnucash/gnome-utils gnucash/report/report-system)
+SET(GUILE_LOAD_DIRS libgnucash/app-utils libgnucash/core-utils libgnucash/engine libgnucash/gnc-module gnucash/gnome-utils gnucash/report/report-system libgnucash/scm)
+SET(GUILE_LIBRARY_DIRS libgnucash/engine libgnucash/app-utils libgnucash/core-utils libgnucash/gnc-module gnucash/gnome-utils gnucash/html gnucash/report/report-system)
+SET(GUILE_DEPENDS gncmod-html scm-app-utils scm-report-system-3)
+
+GNC_ADD_SCHEME_TARGETS(scm-report-stylesheets-1
+  "${stylesheets_SCHEME_1}"
+  ${GUILE_OUTPUT_DIR}
+  "${GUILE_MODULES}"
+  "${GUILE_LOAD_DIRS}"
+  "${GUILE_LIBRARY_DIRS}"
+  "${GUILE_DEPENDS}"
+  TRUE
+)
+
+GNC_ADD_SCHEME_TARGETS(scm-report-stylesheets-2
+  "${stylesheets_SCHEME_2}"
+  ${GUILE_OUTPUT_DIR}
+  "${GUILE_MODULES}"
+  "${GUILE_LOAD_DIRS}"
+  "${GUILE_LIBRARY_DIRS}"
+  "scm-report-stylesheets-1;${GUILE_DEPENDS}"
+  TRUE
+)
+
+ADD_CUSTOM_TARGET(scm-report-stylesheets ALL DEPENDS scm-report-stylesheets-1 scm-report-stylesheets-2)
+
+SET(stylesheets_UI gnc-plugin-stylesheets-ui.xml)
+
+INSTALL(FILES ${stylesheets_UI} DESTINATION share/gnucash/ui)
+
+FILE(COPY ${stylesheets_UI}
+  DESTINATION ${DATADIR_BUILD}/gnucash/ui)
+
+SET_LOCAL_DIST(stylesheets_DIST_local CMakeLists.txt Makefile.am
+        ${stylesheets_SOURCES} ${stylesheets_noinst_HEADERS}
+        ${stylesheets_SCHEME_1} ${stylesheets_SCHEME_2}  ${stylesheets_UI})
+
+SET(stylesheets_DIST ${stylesheets_DIST_local} ${test_stylesheets_DIST} PARENT_SCOPE)
diff --git a/gnucash/report/stylesheets/Makefile.am b/gnucash/report/stylesheets/Makefile.am
new file mode 100644
index 0000000..1de87a7
--- /dev/null
+++ b/gnucash/report/stylesheets/Makefile.am
@@ -0,0 +1,116 @@
+SUBDIRS = . test
+
+pkglib_LTLIBRARIES = libgncmod-stylesheets.la
+
+libgncmod_stylesheets_la_SOURCES = \
+  gnc-plugin-stylesheets.c \
+  gncmod-stylesheets.c 
+
+noinst_HEADERS = \
+  gnc-plugin-stylesheets.h
+
+libgncmod_stylesheets_la_LDFLAGS = -module -avoid-version
+
+libgncmod_stylesheets_la_LIBADD = \
+  ${top_builddir}/gnucash/report/report-gnome/libgncmod-report-gnome.la \
+  ${top_builddir}/gnucash/report/report-system/libgncmod-report-system.la \
+  ${top_builddir}/gnucash/gnome-utils/libgncmod-gnome-utils.la \
+  ${top_builddir}/libgnucash/gnc-module/libgnc-module.la \
+  ${top_builddir}/libgnucash/engine/libgncmod-engine.la \
+  ${GUILE_LIBS} \
+  ${GTK_LIBS} \
+  ${GLIB_LIBS}
+
+AM_CPPFLAGS = \
+  -I${top_srcdir}/common \
+  -I${top_srcdir}/libgnucash/gnc-module \
+  -I${top_srcdir}/libgnucash/engine \
+  -I${top_srcdir}/libgnucash/app-utils \
+  -I${top_srcdir}/gnucash/gnome \
+  -I${top_srcdir}/gnucash/gnome-utils \
+  -I${top_srcdir}/gnucash/report/report-gnome \
+  ${GUILE_CFLAGS} \
+  ${GLIB_CFLAGS} \
+  ${GTK_CFLAGS}
+
+gncscmmoddir = ${GNC_SCM_INSTALL_DIR}/gnucash/report/
+gncscmmod_DATA = \
+  stylesheets.scm \
+  stylesheet-plain.scm \
+  stylesheet-fancy.scm \
+  stylesheet-footer.scm \
+  stylesheet-easy.scm \
+  stylesheet-head-or-tail.scm
+
+if GNUCASH_SEPARATE_BUILDDIR
+#For executing test cases
+SCM_FILE_LINKS = ${gncscmmod_DATA}
+endif
+
+.scm-links:
+	$(RM) -rf gnucash
+	mkdir -p  gnucash
+	mkdir -p  gnucash/report
+if GNUCASH_SEPARATE_BUILDDIR
+	for X in ${SCM_FILE_LINKS} ; do \
+	  $(LN_S) -f ${srcdir}/$$X . ; \
+	done
+endif
+	( cd gnucash/report; for A in $(gncscmmod_DATA) ; do $(LN_S) -f ../../$$A . ; done )
+if ! OS_WIN32
+# Windows knows no "ln -s" but uses "cp": must copy every time (see bug #566567).
+	touch .scm-links
+endif
+
+if GNC_HAVE_GUILE_2
+GUILE_COMPILE_ENV = \
+  --gnc-module-dir ${top_builddir}/libgnucash/app-utils \
+  --gnc-module-dir ${top_builddir}/libgnucash/engine \
+  --gnc-module-dir ${top_builddir}/gnucash/html \
+  --gnc-module-dir ${top_builddir}/gnucash/gnome-utils \
+  --gnc-module-dir ${top_builddir}/gnucash/report/report-system \
+  --gnc-module-dir ${top_builddir}/gnucash/report/stylesheets \
+  --guile-load-dir ${top_builddir}/libgnucash/app-utils \
+  --guile-load-dir ${top_builddir}/libgnucash/core-utils \
+  --guile-load-dir ${top_builddir}/libgnucash/engine \
+  --guile-load-dir ${top_builddir}/libgnucash/gnc-module \
+  --guile-load-dir ${top_builddir}/gnucash/gnome-utils \
+  --guile-load-dir ${top_builddir}/gnucash/report/report-system \
+  --guile-load-dir ${top_builddir}/gnucash/report/stylesheets \
+  --guile-load-dir ${top_builddir}/libgnucash/scm \
+  --library-dir    ${top_builddir}/libgnucash/engine \
+  --library-dir    ${top_builddir}/libgnucash/app-utils \
+  --library-dir    ${top_builddir}/libgnucash/core-utils \
+  --library-dir    ${top_builddir}/libgnucash/gnc-module \
+  --library-dir    ${top_builddir}/gnucash/gnome-utils \
+  --library-dir    ${top_builddir}/libgnucash/backend/xml \
+  --library-dir    ${top_builddir}/libgnucash/backend/sql \
+  --library-dir    ${top_builddir}/gnucash/html \
+  --library-dir    ${top_builddir}/gnucash/report/report-system \
+  --library-dir    ${top_builddir}/gnucash/report/stylesheets
+
+%.go : %.scm .scm-links $(pkglib_LTLIBRARIES)
+	GNC_UNINSTALLED=yes \
+	GNC_BUILDDIR=${top_builddir} \
+	$(shell ${abs_top_srcdir}/common/gnc-test-env.pl --noexports ${GUILE_COMPILE_ENV}) \
+	$(GUILD) compile -o $@ $<
+
+gncscmmodcachedir = ${pkglibdir}/scm/ccache/@GUILE_EFFECTIVE_VERSION@/gnucash/report
+gncscmmodcache_DATA = $(gncscmmod_DATA:.scm=.go)
+endif
+
+clean-local:
+	$(RM) -rf gnucash
+
+noinst_DATA = .scm-links
+
+uidir = $(GNC_UI_DIR)
+dist_ui_DATA = \
+	gnc-plugin-stylesheets-ui.xml
+
+EXTRA_DIST = ${gncscmmod_DATA} CMakeLists.txt
+
+CLEANFILES = .scm-links ${gncscmmodcache_DATA}
+DISTCLEANFILES = ${SCM_FILE_LINKS}
+
+AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.report.core\"
diff --git a/src/report/stylesheets/gnc-plugin-stylesheets-ui.xml b/gnucash/report/stylesheets/gnc-plugin-stylesheets-ui.xml
similarity index 100%
rename from src/report/stylesheets/gnc-plugin-stylesheets-ui.xml
rename to gnucash/report/stylesheets/gnc-plugin-stylesheets-ui.xml
diff --git a/src/report/stylesheets/gnc-plugin-stylesheets.c b/gnucash/report/stylesheets/gnc-plugin-stylesheets.c
similarity index 100%
rename from src/report/stylesheets/gnc-plugin-stylesheets.c
rename to gnucash/report/stylesheets/gnc-plugin-stylesheets.c
diff --git a/src/report/stylesheets/gnc-plugin-stylesheets.h b/gnucash/report/stylesheets/gnc-plugin-stylesheets.h
similarity index 100%
rename from src/report/stylesheets/gnc-plugin-stylesheets.h
rename to gnucash/report/stylesheets/gnc-plugin-stylesheets.h
diff --git a/src/report/stylesheets/gncmod-stylesheets.c b/gnucash/report/stylesheets/gncmod-stylesheets.c
similarity index 100%
rename from src/report/stylesheets/gncmod-stylesheets.c
rename to gnucash/report/stylesheets/gncmod-stylesheets.c
diff --git a/src/report/stylesheets/stylesheet-easy.scm b/gnucash/report/stylesheets/stylesheet-easy.scm
similarity index 100%
rename from src/report/stylesheets/stylesheet-easy.scm
rename to gnucash/report/stylesheets/stylesheet-easy.scm
diff --git a/src/report/stylesheets/stylesheet-fancy.scm b/gnucash/report/stylesheets/stylesheet-fancy.scm
similarity index 100%
rename from src/report/stylesheets/stylesheet-fancy.scm
rename to gnucash/report/stylesheets/stylesheet-fancy.scm
diff --git a/src/report/stylesheets/stylesheet-footer.scm b/gnucash/report/stylesheets/stylesheet-footer.scm
similarity index 100%
rename from src/report/stylesheets/stylesheet-footer.scm
rename to gnucash/report/stylesheets/stylesheet-footer.scm
diff --git a/src/report/stylesheets/stylesheet-head-or-tail.scm b/gnucash/report/stylesheets/stylesheet-head-or-tail.scm
similarity index 100%
rename from src/report/stylesheets/stylesheet-head-or-tail.scm
rename to gnucash/report/stylesheets/stylesheet-head-or-tail.scm
diff --git a/src/report/stylesheets/stylesheet-plain.scm b/gnucash/report/stylesheets/stylesheet-plain.scm
similarity index 100%
rename from src/report/stylesheets/stylesheet-plain.scm
rename to gnucash/report/stylesheets/stylesheet-plain.scm
diff --git a/src/report/stylesheets/stylesheets.scm b/gnucash/report/stylesheets/stylesheets.scm
similarity index 100%
rename from src/report/stylesheets/stylesheets.scm
rename to gnucash/report/stylesheets/stylesheets.scm
diff --git a/src/report/stylesheets/test/CMakeLists.txt b/gnucash/report/stylesheets/test/CMakeLists.txt
similarity index 100%
rename from src/report/stylesheets/test/CMakeLists.txt
rename to gnucash/report/stylesheets/test/CMakeLists.txt
diff --git a/gnucash/report/stylesheets/test/Makefile.am b/gnucash/report/stylesheets/test/Makefile.am
new file mode 100644
index 0000000..f3f5c02
--- /dev/null
+++ b/gnucash/report/stylesheets/test/Makefile.am
@@ -0,0 +1,38 @@
+TESTS=test-load-module
+
+GNC_TEST_DEPS = --gnc-module-dir ${top_builddir}/libgnucash/engine \
+  --gnc-module-dir ${top_builddir}/libgnucash/app-utils \
+  --gnc-module-dir ${top_builddir}/gnucash/gnome-utils \
+  --gnc-module-dir ${top_builddir}/gnucash/html \
+  --gnc-module-dir ${top_builddir}/gnucash/report/report-system \
+  --gnc-module-dir ${top_builddir}/gnucash/report/stylesheets \
+\
+  --guile-load-dir ${top_builddir}/common/test-core \
+  --guile-load-dir ${top_builddir}/libgnucash/gnc-module \
+  --guile-load-dir ${top_builddir}/libgnucash/engine \
+  --guile-load-dir ${top_builddir}/libgnucash/scm \
+  --guile-load-dir ${top_builddir}/libgnucash/core-utils \
+  --guile-load-dir ${top_builddir}/libgnucash/app-utils \
+  --guile-load-dir ${top_builddir}/gnucash/gnome-utils \
+  --guile-load-dir ${top_builddir}/gnucash/report/report-system \
+  --guile-load-dir ${top_builddir}/gnucash/report/stylesheets \
+\
+  --library-dir    ${top_builddir}/common/test-core \
+  --library-dir    ${top_builddir}/libgnucash/core-utils \
+  --library-dir    ${top_builddir}/libgnucash/gnc-module \
+  --library-dir    ${top_builddir}/libgnucash/engine \
+  --library-dir    ${top_builddir}/libgnucash/backend/xml \
+  --library-dir    ${top_builddir}/libgnucash/backend/sql \
+  --library-dir    ${top_builddir}/libgnucash/app-utils \
+  --library-dir    ${top_builddir}/gnucash/gnome-utils \
+  --library-dir    ${top_builddir}/gnucash/html \
+  --library-dir    ${top_builddir}/gnucash/report/report-system \
+  --library-dir    ${top_builddir}/gnucash/report/report-gnome
+
+TESTS_ENVIRONMENT = \
+  GUILE_WARN_DEPRECATED=no \
+  GUILE="${GUILE}" \
+  GNC_BUILDDIR="${abs_top_builddir}" \
+  $(shell ${abs_top_srcdir}/common/gnc-test-env.pl --noexports ${GNC_TEST_DEPS})
+
+EXTRA_DIST = test-load-module CMakeLists.txt
diff --git a/src/report/stylesheets/test/test-load-module.in b/gnucash/report/stylesheets/test/test-load-module.in
similarity index 100%
rename from src/report/stylesheets/test/test-load-module.in
rename to gnucash/report/stylesheets/test/test-load-module.in
diff --git a/gnucash/report/utility-reports/CMakeLists.txt b/gnucash/report/utility-reports/CMakeLists.txt
new file mode 100644
index 0000000..c3221a7
--- /dev/null
+++ b/gnucash/report/utility-reports/CMakeLists.txt
@@ -0,0 +1,30 @@
+# Scheme
+
+SET(utility_reports_SCHEME
+  hello-world.scm
+  utility-reports.scm
+  view-column.scm
+  welcome-to-gnucash.scm
+)
+
+SET(GUILE_OUTPUT_DIR     gnucash/report)
+SET(GUILE_MODULES        libgnucash/app-utils libgnucash/engine gnucash/gnome-utils gnucash/html gnucash/report/report-system)
+SET(GUILE_LOAD_DIRS      libgnucash/app-utils libgnucash/core-utils libgnucash/engine libgnucash/gnc-module
+                            gnucash/gnome-utils gnucash/report/report-system libgnucash/scm)
+SET(GUILE_LIBRARY_DIRS   libgnucash/engine libgnucash/app-utils libgnucash/core-utils libgnucash/gnc-module gnucash/gnome-utils gnucash/html
+                              gnucash/report/report-system)
+SET(GUILE_DEPENDS        scm-utility-reports-links scm-app-utils scm-report-system-3)
+
+GNC_ADD_SCHEME_TARGETS(scm-utility-reports
+  "${utility_reports_SCHEME}"
+  ${GUILE_OUTPUT_DIR}
+  "${GUILE_MODULES}"
+  "${GUILE_LOAD_DIRS}"
+  "${GUILE_LIBRARY_DIRS}"
+  "${GUILE_DEPENDS}"
+  TRUE
+)
+
+SET_LOCAL_DIST(utility_reports_DIST_local CMakeLists.txt Makefile.am
+        ${utility_reports_SCHEME})
+SET(utility_reports_DIST ${utility_reports_DIST_local} ${test_utility_reports_DIST} PARENT_SCOPE)
diff --git a/gnucash/report/utility-reports/Makefile.am b/gnucash/report/utility-reports/Makefile.am
new file mode 100644
index 0000000..289ef72
--- /dev/null
+++ b/gnucash/report/utility-reports/Makefile.am
@@ -0,0 +1,76 @@
+gncscmmoddir = ${GNC_SCM_INSTALL_DIR}/gnucash/report/
+gncscmmod_DATA = \
+  hello-world.scm \
+  utility-reports.scm \
+  view-column.scm \
+  welcome-to-gnucash.scm
+
+#  test-graphing.scm -- not intended for general public?!? Surely not translated at all.
+
+if GNUCASH_SEPARATE_BUILDDIR
+#For separate build directory
+SCM_FILE_LINKS = \
+  ${gncscmmod_DATA}
+endif
+
+.scm-links:
+	$(RM) -rf gnucash
+	mkdir -p  gnucash
+	mkdir -p  gnucash/report
+if GNUCASH_SEPARATE_BUILDDIR
+	for X in ${SCM_FILE_LINKS} ; do \
+	  $(LN_S) -f ${srcdir}/$$X . ; \
+	done
+endif
+	( cd gnucash/report; for A in $(gncscmmod_DATA) ; do $(LN_S) -f ../../$$A . ; done )
+if ! OS_WIN32
+# Windows knows no "ln -s" but uses "cp": must copy every time (see bug #566567).
+	touch .scm-links
+endif
+
+if GNC_HAVE_GUILE_2
+GUILE_COMPILE_ENV = \
+  --gnc-module-dir ${top_builddir}/libgnucash/app-utils \
+  --gnc-module-dir ${top_builddir}/libgnucash/engine \
+  --gnc-module-dir ${top_builddir}/gnucash/gnome-utils \
+  --gnc-module-dir ${top_builddir}/gnucash/html \
+  --gnc-module-dir ${top_builddir}/gnucash/report/report-system \
+  --guile-load-dir ${top_builddir}/libgnucash/app-utils \
+  --guile-load-dir ${top_builddir}/libgnucash/core-utils \
+  --guile-load-dir ${top_builddir}/libgnucash/engine \
+  --guile-load-dir ${top_builddir}/libgnucash/gnc-module \
+  --guile-load-dir ${top_builddir}/gnucash/gnome-utils \
+  --guile-load-dir ${top_builddir}/gnucash/report/report-system \
+  --guile-load-dir ${top_builddir}/gnucash/report/utility-reports \
+  --guile-load-dir ${top_builddir}/libgnucash/scm \
+  --library-dir    ${top_builddir}/libgnucash/engine \
+  --library-dir    ${top_builddir}/libgnucash/app-utils \
+  --library-dir    ${top_builddir}/libgnucash/core-utils \
+  --library-dir    ${top_builddir}/libgnucash/gnc-module \
+  --library-dir    ${top_builddir}/gnucash/gnome-utils \
+  --library-dir    ${top_builddir}/libgnucash/backend/xml \
+  --library-dir    ${top_builddir}/libgnucash/backend/sql \
+  --library-dir    ${top_builddir}/gnucash/html \
+  --library-dir    ${top_builddir}/gnucash/report/report-system
+
+%.go : %.scm .scm-links $(pkglib_LTLIBRARIES)
+	GNC_UNINSTALLED=yes \
+	GNC_BUILDDIR=${top_builddir} \
+	$(shell ${abs_top_srcdir}/common/gnc-test-env.pl --noexports ${GUILE_COMPILE_ENV}) \
+	$(GUILD) compile -o $@ $<
+
+gncscmmodcachedir = ${pkglibdir}/scm/ccache/@GUILE_EFFECTIVE_VERSION@/gnucash/report
+gncscmmodcache_DATA = $(gncscmmod_DATA:.scm=.go)
+endif
+
+clean-local:
+	$(RM) -rf gnucash
+
+noinst_DATA = .scm-links
+
+EXTRA_DIST = ${gncscmmod_DATA} CMakeLists.txt
+
+CLEANFILES = .scm-links ${gncscmmodcache_DATA}
+DISTCLEANFILES = ${SCM_FILE_LINKS}
+
+AM_CPPFLAGS = -DG_LOG_DOMAIN=\"gnc.report.util\"
diff --git a/gnucash/report/utility-reports/hello-world.scm b/gnucash/report/utility-reports/hello-world.scm
new file mode 100644
index 0000000..ad8c5a1
--- /dev/null
+++ b/gnucash/report/utility-reports/hello-world.scm
@@ -0,0 +1,522 @@
+;; -*-scheme-*-
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; 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 at gnu.org
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+
+;; This is a sample guile report generator for GnuCash.
+;; It illustrates the basic techniques used to create
+;; new reports for GnuCash.
+
+(define-module (gnucash report hello-world))
+(use-modules (gnucash main)) ;; FIXME: delete after we finish modularizing.
+(use-modules (gnucash gnc-module))
+(use-modules (gnucash gettext))
+
+;; 'debug is deprecated and unused since guile 2
+(cond-expand
+  (guile-2 )
+  (else
+    (debug-enable 'debug)))
+(debug-enable 'backtrace)
+
+(gnc:module-load "gnucash/report/report-system" 0)
+(gnc:module-load "gnucash/html" 0) ;for gnc-build-url
+
+;; This function will generate a set of options that GnuCash
+;; will use to display a dialog where the user can select
+;; values for your report's parameters.
+(define (options-generator)    
+  (let* ((options (gnc:new-options)) 
+         ;; This is just a helper function for making options.
+         ;; See libgnucash/app-utils/options.scm for details.
+         (add-option 
+          (lambda (new-option)
+            (gnc:register-option options new-option))))
+    
+    ;; This is a boolean option. It is in Section 'Hello, World!'
+    ;; and is named 'Boolean Option'. Its sorting key is 'a',
+    ;; thus it will come before options with sorting keys
+    ;; 'b', 'c', etc. in the same section. The default value
+    ;; is #t (true). The phrase 'This is a boolean option'
+    ;; will be displayed as help text when the user puts
+    ;; the mouse pointer over the option.
+    (add-option
+     (gnc:make-simple-boolean-option
+      (N_ "Hello, World!") (N_ "Boolean Option")
+      "a" (N_ "This is a boolean option.") #t))
+    
+    ;; This is a multichoice option. The user can choose between
+    ;; the values 'first, 'second, 'third, or 'fourth. These are guile
+    ;; symbols. The value 'first will be displayed as "First Option"
+    ;; and have a help string of "Help for first option.". The default
+    ;; value is 'third.
+    (add-option
+     (gnc:make-multichoice-option
+      (N_ "Hello, World!") (N_ "Multi Choice Option")
+      "b" (N_ "This is a multi choice option.") 'third
+      (list (list->vector
+             (list 'first
+                   (N_ "First Option")
+                   (N_ "Help for first option.")))
+            (list->vector
+             (list 'second
+                   (N_ "Second Option")
+                   (N_ "Help for second option.")))
+            (list->vector
+             (list 'third
+                   (N_ "Third Option")
+                   (N_ "Help for third option.")))
+            (list->vector
+             (list 'fourth
+                   (N_ "Fourth Options")
+                   (N_ "The fourth option rules!"))))))
+    
+    ;; This is a string option. Users can type anything they want
+    ;; as a value. The default value is "Hello, World". This is
+    ;; in the same section as the option above. It will be shown
+    ;; after the option above because its key is 'b' while the
+    ;; other key is 'a'.
+    (add-option
+     (gnc:make-string-option
+      (N_ "Hello, World!") (N_ "String Option")
+      "c" (N_ "This is a string option.") (N_ "Hello, World")))
+    
+    ;; This is a date/time option. The user can pick a date and,
+    ;; possibly, a time. Times are stored as a pair
+    ;; (seconds . nanoseconds) measured from Jan 1, 1970, i.e.,
+    ;; Unix time. The last option is false, so the user can only
+    ;; select a date, not a time. The default value is the current
+    ;; time.
+    (add-option
+     (gnc:make-date-option
+      (N_ "Hello, World!") (N_ "Just a Date Option")
+      "d" (N_ "This is a date option.")
+      (lambda () (cons 'absolute (cons (current-time) 0)))
+      #f 'absolute #f ))
+    
+    ;; This is another date option, but the user can also select
+    ;; the time.
+    (add-option
+     (gnc:make-date-option
+      (N_ "Hello, World!") (N_ "Time and Date Option")
+      "e" (N_ "This is a date option with time.")
+      (lambda () (cons 'absolute (cons (current-time) 0)))
+      #t 'absolute #f ))
+    
+    (add-option
+     (gnc:make-date-option
+      (N_ "Hello, World!") (N_ "Combo Date Option")
+      "y" (N_ "This is a combination date option.")
+      (lambda () (cons 'relative 'start-cal-year))
+      #f 'both '(start-cal-year start-prev-year end-prev-year) ))
+    
+    (add-option
+     (gnc:make-date-option
+      (N_ "Hello, World!") (N_ "Relative Date Option")
+      "x" (N_ "This is a relative date option.")
+      (lambda () (cons 'relative 'start-cal-year))
+      #f 'relative '(start-cal-year start-prev-year end-prev-year) ))
+    
+    ;; This is a number range option. The user can enter a number
+    ;; between a lower and upper bound given below. There are also
+    ;; arrows the user can click to go up or down, the amount changed
+    ;; by a single click is given by the step size.
+    (add-option
+     (gnc:make-number-range-option
+      (N_ "Hello, World!") (N_ "Number Option")
+      "ee" (N_ "This is a number option.")
+      1500.0  ;; default
+      0.0     ;; lower bound
+      10000.0 ;; upper bound
+      2.0     ;; number of decimals
+      0.01    ;; step size
+      ))
+    
+    ;; This is a color option, defined by rgba values. A color value
+    ;; is a list where the elements are the red, green, blue, and
+    ;; alpha channel values respectively. The penultimate argument
+    ;; (255) is the allowed range of rgba values. The final argument
+    ;; (#f) indicates the alpha value should be ignored. You can get
+    ;; a color string from a color option with gnc:color-option->html,
+    ;; which will scale the values appropriately according the range.
+    (add-option
+     (gnc:make-color-option
+      (N_ "Hello, World!") (N_ "Background Color")
+      "f" (N_ "This is a color option.")
+      (list #xf6 #xff #xdb 0)
+      255
+      #f))
+    (add-option
+     (gnc:make-color-option
+      (N_ "Hello, World!") (N_ "Text Color")
+      "f" (N_ "This is a color option.")
+      (list #x00 #x00 #x00 0)
+      255
+      #f))
+    
+    ;; This is an account list option. The user can select one
+    ;; or (possibly) more accounts from the list of accounts
+    ;; in the current file. Values are scheme handles to actual
+    ;; C pointers to accounts. 
+    ;; The #f value indicates that any account will be accepted.
+    ;; Instead of a #f values, you could provide a function that
+    ;; accepts a list of account values and returns a pair. If
+    ;; the first element is #t, the second element is the list
+    ;; of accounts actually accepted. If the first element is
+    ;; #f, the accounts are rejected and the second element is
+    ;; and error string. The last argument is #t which means
+    ;; the user is allowed to select more than one account.
+    ;; The default value for this option is the currently
+    ;; selected account in the main window, if any.
+    (add-option
+     (gnc:make-account-list-option
+      (N_ "Hello Again") (N_ "An account list option")
+      "g" (N_ "This is an account list option.")
+      ;; FIXME : this used to be gnc:get-current-accounts, but 
+      ;; that doesn't exist any more.
+      (lambda () '())
+      #f #t))
+    
+    ;; This is a list option. The user can select one or (possibly)
+    ;; more values from a list. The list of acceptable values is
+    ;; the same format as a multichoice option. The value of the
+    ;; option is a list of symbols.
+    (add-option
+     (gnc:make-list-option
+      (N_ "Hello Again") (N_ "A list option")
+      "h" (N_ "This is a list option.")
+      (list 'good)
+      (list (list->vector
+             (list 'good
+                   (N_ "The Good")
+                   (N_ "Good option.")))
+            (list->vector
+             (list 'bad
+                   (N_ "The Bad")
+                   (N_ "Bad option.")))
+            (list->vector
+             (list 'ugly
+                   (N_ "The Ugly")
+                   (N_ "Ugly option."))))))
+    
+    ;; This option is for testing. When true, the report generates
+    ;; an exception.
+    (add-option
+     (gnc:make-simple-boolean-option
+      (N_ "Testing") (N_ "Crash the report")
+      "a" 
+      (N_ "This is for testing. \
+Your reports probably shouldn't have an \
+option like this.") 
+      #f))
+    
+    (gnc:options-set-default-section options "Hello, World!")      
+    options))
+
+;; This is the rendering function. It accepts a database of options
+;; and generates an object of type <html-document>.  See the file
+;; report-html.txt for documentation; the file report-html.scm
+;; includes all the relevant Scheme code. The option database passed
+;; to the function is one created by the options-generator function
+;; defined above.
+(define (hello-world-renderer report-obj)
+  ;; These are some helper functions for looking up option values.
+  (define (get-op section name)
+    (gnc:lookup-option (gnc:report-options report-obj) section name))
+  
+  (define (op-value section name)
+    (gnc:option-value (get-op section name)))
+
+  ;; The first thing we do is make local variables for all the specific
+  ;; options in the set of options given to the function. This set will
+  ;; be generated by the options generator above.
+  (let ((bool-val     (op-value "Hello, World!" "Boolean Option"))
+        (mult-val     (op-value "Hello, World!" "Multi Choice Option"))
+        (string-val   (op-value "Hello, World!" "String Option"))
+        (date-val     (gnc:date-option-absolute-time
+                       (op-value "Hello, World!" "Just a Date Option")))
+        (date2-val    (gnc:date-option-absolute-time
+                       (op-value "Hello, World!" "Time and Date Option")))
+        (rel-date-val (gnc:date-option-absolute-time
+                       (op-value "Hello, World!" "Relative Date Option")))
+        (combo-date-val (gnc:date-option-absolute-time
+                         (op-value "Hello, World!" "Combo Date Option")))
+        (num-val      (op-value "Hello, World!" "Number Option"))
+        (bg-color-op  (get-op   "Hello, World!" "Background Color"))
+        (txt-color-op (get-op   "Hello, World!" "Text Color"))
+        (accounts     (op-value "Hello Again"   "An account list option"))
+        (list-val     (op-value "Hello Again"   "A list option"))
+        (crash-val    (op-value "Testing"       "Crash the report"))
+        
+        ;; document will be the HTML document that we return.
+        (document (gnc:make-html-document)))
+
+    ;; Crash if asked to.
+    (if crash-val (string-length #f)) ;; string-length needs a string
+
+    ;; these are samples of different date options. for a simple
+    ;; date with day, month, and year but no time you should use
+    ;; gnc-print-date
+    (let ((time-string (strftime "%X" (gnc-localtime (current-time))))
+          (date-string (strftime "%x" (gnc-localtime (car date-val))))
+          (date-string2 (strftime "%x %X" (gnc-localtime (car date2-val))))
+          (rel-date-string (strftime "%x" (gnc-localtime (car rel-date-val))))
+          (combo-date-string
+           (strftime "%x" (gnc-localtime (car combo-date-val)))))
+
+      ;; Here's where we fill the report document with content.  We
+      ;; do this by adding 'html objects' such as text, tables, and
+      ;; graphs to the html document we already created.
+      
+      ;; the report's style sheet (an "invisible" option that every
+      ;; report has) will usually set the default background color,
+      ;; but we can override that here.  You set background color in
+      ;; HTML by specifying the "bgcolor" attribute for the <body>
+      ;; tag.
+
+      ;; every HTML object has "styles" for markup and data.  the
+      ;; style for an HTML tag such as "body" tells the HTML
+      ;; document how to render the markup and content for tagged
+      ;; elements.  For each tag, you can specify a font-face,
+      ;; font-color, and font-size to render the contents of the
+      ;; element, and any number of attributes to put in the
+      ;; start-tag.  You can pass 'inheritable? #f if you wish the
+      ;; style to apply only to markup in the object itself and not
+      ;; to its components.  You can also override the tag itself if
+      ;; you want to create your own custom markup (see
+      ;; documentation).
+      
+      ;; in this case, we are saying "every time you see <body>
+      ;; markup anywhere in 'document' or its components, add the
+      ;; attribute "bgcolor=0xXXXXXX" in the start tag, and enclose
+      ;; the content in a <font> block to set the font color".
+      ;; Altogether, we get
+      ;;
+      ;; <body bgcolor=0xXXXXXXX>
+      ;; <font color="0xXXXXXX"> (body) </font>
+      ;; </body>
+
+      ;; of course if a component object explicitly selects a 
+      ;; different font that will override the body font.
+      
+      (gnc:html-document-set-style!
+       document "body" 
+       'attribute (list "bgcolor" (gnc:color-option->html bg-color-op))
+       'font-color (gnc:color-option->html txt-color-op))
+      
+      ;; the title of the report will be rendered by the 
+      ;; selected style sheet.  All we have to do is set it in the
+      ;; HTML document.
+      
+      ;; Note we invoke the _ function upon this string.
+      ;; The _ function works the same way as in C -- if a
+      ;; translation of the given string is available for the
+      ;; current locale, then the translation is returned,
+      ;; otherwise the original string is returned.
+      (gnc:html-document-set-title! document (_ "Hello, World"))
+
+      ;; we make a "text object" to add a bunch of text to.
+      ;; the function gnc:make-html-text can take any number of 
+      ;; arguments.  The gnc:html-markup functions are designed
+      ;; to work with the style system so that you can control
+      ;; the appearance of the report from the Gnucash UI; you 
+      ;; should use the HTML markup functions whenever possible
+      ;; rather than including literal HTML in your report.
+
+      (gnc:html-document-add-object!
+       document
+       (gnc:make-html-text         
+        (gnc:html-markup-p
+         (gnc:html-markup/format
+          (_ "This is a sample GnuCash report. \
+See the guile (scheme) source code in the scm/report directory \
+for details on writing your own reports, \
+or extending existing reports.")))
+        (gnc:html-markup-p
+         (gnc:html-markup/format
+          (_ "For help on writing reports, or to contribute your brand \
+new, totally cool report, consult the mailing list %s.")
+          (gnc:html-markup-anchor 
+           "mailto:gnucash-devel at gnucash.org"
+           (gnc:html-markup-tt "gnucash-devel at gnucash.org")))
+         (_ "For details on subscribing to that list, see <http://www.gnucash.org/>.")
+         (_ "You can learn more about writing scheme at <http://www.scheme.com/tspl2d/>."))
+
+        (gnc:html-markup-p
+         (gnc:html-markup/format
+          (_ "The current time is %s.") 
+          (gnc:html-markup-b time-string)))
+
+        (gnc:html-markup-p
+         (gnc:html-markup/format
+          (_ "The boolean option is %s.")
+          (gnc:html-markup-b (if bool-val (_ "true") (_ "false")))))
+
+        (gnc:html-markup-p
+         (gnc:html-markup/format
+          (_ "The multi-choice option is %s.")
+          (gnc:html-markup-b (symbol->string mult-val))))
+
+        (gnc:html-markup-p
+         (gnc:html-markup/format
+          (_ "The string option is %s.") 
+          (gnc:html-markup-b string-val)))
+
+        (gnc:html-markup-p
+         (gnc:html-markup/format
+          (_ "The date option is %s.") 
+          (gnc:html-markup-b date-string)))
+
+        (gnc:html-markup-p
+         (gnc:html-markup/format
+          (_ "The date and time option is %s.") 
+          (gnc:html-markup-b date-string2)))
+
+        (gnc:html-markup-p
+         (gnc:html-markup/format 
+          (_ "The relative date option is %s.")
+          (gnc:html-markup-b rel-date-string)))
+
+        (gnc:html-markup-p
+         (gnc:html-markup/format 
+          (_ "The combination date option is %s.")
+          (gnc:html-markup-b combo-date-string)))
+
+        (gnc:html-markup-p
+         (gnc:html-markup/format 
+          (_ "The number option is %s.")
+          (gnc:html-markup-b (number->string num-val))))
+
+        ;; Here we print the value of the number option formatted as
+        ;; currency. When printing currency values, you should use
+        ;; the function (xaccPrintAmount), which is defined in
+        ;; report-utilities. This functions will format the number
+        ;; appropriately in the current locale. Don't try to format
+        ;; it yourself -- it will be wrong in other locales.
+        (gnc:html-markup-p 
+         (gnc:html-markup/format
+          (_ "The number option formatted as currency is %s.")
+          (gnc:html-markup-b
+           (xaccPrintAmount
+            (gnc:make-gnc-numeric (inexact->exact num-val) 1)
+            (gnc-default-print-info #f)))))))
+
+      ;; you can add as many objects as you want.  Here's another 
+      ;; one.  We'll make a single-column table of the selected list 
+      ;; options just for grins. 
+      (gnc:html-document-add-object!
+       document
+       (gnc:make-html-text
+        (gnc:html-markup-p (_ "Items you selected:"))))
+
+      (if (not (null? list-val))
+          (let ((table (gnc:make-html-table)))
+            (gnc:html-table-append-column! 
+             table (map symbol->string list-val))
+            (gnc:html-table-set-caption! table 
+                                         (_ "List items selected"))
+            (gnc:html-document-add-object! document table))
+          (let ((txt (gnc:make-html-text)))
+            (gnc:html-text-append!
+             txt
+             (gnc:html-markup-p (_ "(You selected no list items.)")))
+            (gnc:html-document-add-object! document txt)))
+      
+      ;; here's a bullet list of accounts.  We can mark up the
+      ;; account name with an <a></a> anchor with a special HREF to
+      ;; open a Gnucash register when the link is clicked.  What you
+      ;; need to do is pass the HREF "gnc-register:account=My
+      ;; Account Name" to html-markup-anchor.  The account name
+      ;; passed must be the "full" account name that you get from
+      ;; gnc-account-get-full-name.  You should build this url using
+      ;; (gnc-build-url ...)
+      ;;
+      ;; html-markup-anchor takes the link to jump to as its first
+      ;; arg and then puts the remaining args in the body of the
+      ;; link).
+      ;;
+      ;; html-markup-ul makes a "<ul>" unnumbered list, and takes as
+      ;; its one argument a list of items to put in <li> blocks.
+      (if (not (null? accounts))
+          (gnc:html-document-add-object!
+           document
+           (gnc:make-html-text
+            (gnc:html-markup-ul
+             (map 
+              (lambda (acct)
+                (gnc:html-markup-anchor 
+		 (gnc-build-url URL-TYPE-REGISTER
+				     (string-append "account=" 
+						    (gnc-account-get-full-name
+						     acct))
+				     "")
+                 (xaccAccountGetName acct)))
+              accounts))))
+          (gnc:html-document-add-object!
+           document
+           (gnc:make-html-text
+            (gnc:html-markup-p (_ "You have selected no accounts.")))))
+            
+      (gnc:html-document-add-object! 
+       document 
+       (gnc:make-html-text 
+        (gnc:html-markup-anchor (gnc-build-url URL-TYPE-HELP "gnucash-guide" "") (_ "Display help"))))
+
+      (gnc:html-document-add-object! 
+       document 
+       (gnc:make-html-text 
+        (gnc:html-markup-p (_ "Have a nice day!"))))
+      
+      document)))
+
+;; Here we define the actual report with gnc:define-report
+(gnc:define-report
+ 
+ ;; The version of this report.
+ 'version 1
+ 
+ ;; The name of this report. This will be used, among other things,
+ ;; for making its menu item in the main menu. You need to use the
+ ;; untranslated value here!
+ 'name (N_ "Hello, World")
+
+ ;; The GUID for this report. This string should be unique, set once
+ ;; and left alone forever after that. In theory, you could use any
+ ;; unique string, even a meaningful one (!) but its probably best to
+ ;; use a true uuid. Get them from `uuidgen | sed -e s/-//g` and paste
+ ;; the results in here. You must make a new guid for each report!
+ 'report-guid "898d78ec92854402bf76e20a36d24ade"
+
+ ;; The name in the menu
+ ;; (only necessary if it differs from the name)
+ 'menu-name (N_ "Sample Report with Examples")
+
+ ;; A tip that is used to provide additional information about the
+ ;; report to the user.
+ 'menu-tip (N_ "A sample report with examples.")
+
+ ;; A path describing where to put the report in the menu system.
+ ;; In this case, it's going under the utility menu.
+ 'menu-path (list gnc:menuname-utility)
+
+ ;; The options generator function defined above.
+ 'options-generator options-generator
+ 
+ ;; The rendering function defined above.
+ 'renderer hello-world-renderer)
diff --git a/src/report/utility-reports/test-graphing.scm b/gnucash/report/utility-reports/test-graphing.scm
similarity index 100%
rename from src/report/utility-reports/test-graphing.scm
rename to gnucash/report/utility-reports/test-graphing.scm
diff --git a/src/report/utility-reports/utility-reports.scm b/gnucash/report/utility-reports/utility-reports.scm
similarity index 100%
rename from src/report/utility-reports/utility-reports.scm
rename to gnucash/report/utility-reports/utility-reports.scm
diff --git a/src/report/utility-reports/view-column.scm b/gnucash/report/utility-reports/view-column.scm
similarity index 100%
rename from src/report/utility-reports/view-column.scm
rename to gnucash/report/utility-reports/view-column.scm
diff --git a/src/report/utility-reports/welcome-to-gnucash.scm b/gnucash/report/utility-reports/welcome-to-gnucash.scm
similarity index 100%
rename from src/report/utility-reports/welcome-to-gnucash.scm
rename to gnucash/report/utility-reports/welcome-to-gnucash.scm
diff --git a/libgnucash/CMakeLists.txt b/libgnucash/CMakeLists.txt
new file mode 100644
index 0000000..cd3206e
--- /dev/null
+++ b/libgnucash/CMakeLists.txt
@@ -0,0 +1,21 @@
+# CMakeLists.txt for libgnucash/
+
+# The subdirectories
+ADD_SUBDIRECTORY (app-utils)
+ADD_SUBDIRECTORY (backend)
+ADD_SUBDIRECTORY (core-utils)
+ADD_SUBDIRECTORY (doc)
+ADD_SUBDIRECTORY (engine)
+ADD_SUBDIRECTORY (gnc-module)
+ADD_SUBDIRECTORY (pixmaps)
+ADD_SUBDIRECTORY (quotes)
+ADD_SUBDIRECTORY (scm)
+ADD_SUBDIRECTORY (tax)
+
+ADD_DEFINITIONS (-DHAVE_CONFIG_H)
+
+SET_LOCAL_DIST(libgnucash_DIST_local CMakeLists.txt Makefile.am ${libgnucash_EXTRA_DIST})
+
+SET(libgnucash_DIST ${libgnucash_DIST_local} ${app_utils_DIST} ${backend_DIST}
+             ${core_utils_DIST} ${doc_DIST} ${engine_DIST} ${gnc_module_DIST}
+             ${pixmaps_DIST} ${quotes_DIST} ${scm_DIST} ${tax_DIST} PARENT_SCOPE)
diff --git a/libgnucash/Makefile.am b/libgnucash/Makefile.am
new file mode 100644
index 0000000..dc9681c
--- /dev/null
+++ b/libgnucash/Makefile.am
@@ -0,0 +1,21 @@
+# These directories do not contain any gtk dependencies
+# Note the unusual ordering of some test directories. This is
+# because test-core depends on engine and the test directories
+# in turn depend on test-core. This would not have been necessary
+# if we had only one big Makefile instead of a recursive build.
+# As we intend to move to cmake it's not worth fixing this any more.
+SUBDIRS = \
+  doc \
+  pixmaps \
+  core-utils \
+  gnc-module \
+  engine \
+  ../common/test-core \
+  core-utils/test \
+  gnc-module/test \
+  engine/test \
+  backend \
+  scm \
+  quotes \
+  app-utils \
+  tax
diff --git a/libgnucash/app-utils/CMakeLists.txt b/libgnucash/app-utils/CMakeLists.txt
new file mode 100644
index 0000000..3ceaf39
--- /dev/null
+++ b/libgnucash/app-utils/CMakeLists.txt
@@ -0,0 +1,223 @@
+ADD_SUBDIRECTORY(test)
+# Build the library
+
+SET (app_utils_noinst_HEADERS
+  calculation/finvar.h
+  calculation/finproto.h
+  calculation/fin_spl_protos.h
+  calculation/fin_static_proto.h
+)
+
+SET (app_utils_HEADERS
+  QuickFill.h
+  business-helpers.h
+  business-options.h
+  file-utils.h
+  gfec.h
+  gnc-basic-gobject.h
+  gnc-account-merge.h
+  gnc-accounting-period.h
+  gnc-addr-quickfill.h
+  gnc-component-manager.h
+  gnc-entry-quickfill.h
+  gnc-euro.h
+  gnc-exp-parser.h
+  gnc-gdate-utils.h
+  gnc-gettext-util.h
+  gnc-gsettings.h
+  gnc-help-utils.h
+  gnc-helpers.h
+  gnc-prefs-utils.h
+  gnc-state.h  
+  gnc-sx-instance-model.h
+  gnc-ui-util.h
+  gnc-ui-balances.h
+  guile-util.h
+  option-util.h
+
+)
+
+
+IF (BUILDING_FROM_VCS)
+  # Command to generate the swig-app-utils.c wrapper file
+  SET (SWIG_APP_UTILS_GUILE_C ${CMAKE_CURRENT_BINARY_DIR}/swig-app-utils-guile.c)
+  GNC_ADD_SWIG_COMMAND (swig-apputils-guile-c ${SWIG_APP_UTILS_GUILE_C} ${CMAKE_CURRENT_SOURCE_DIR}/app-utils.i)
+  SET (SWIG_APP_UTILS_PYTHON_C ${CMAKE_CURRENT_BINARY_DIR}/swig-app-utils-python.c)
+  GNC_ADD_SWIG_PYTHON_COMMAND (swig-app-utils-python ${SWIG_APP_UTILS_PYTHON_C} ${CMAKE_CURRENT_SOURCE_DIR}/app-utils.i)
+ELSE()
+  SET (SWIG_APP_UTILS_GUILE_C swig-app-utils-guile.c)
+  SET (SWIG_APP_UTILS_PYTHON_C swig-app-utils-python.c)
+ENDIF()
+
+SET (app_utils_SOURCES
+  calculation/expression_parser.c
+  calculation/fin.c
+  business-helpers.c
+  business-options.c
+  QuickFill.c
+  file-utils.c
+  gfec.c
+  gnc-account-merge.c
+  gnc-accounting-period.c
+  gnc-addr-quickfill.c
+  gnc-component-manager.c
+  gnc-entry-quickfill.c
+  gnc-euro.c
+  gnc-exp-parser.c
+  gnc-gdate-utils.c
+  gnc-gettext-util.c
+  gnc-gsettings.c
+  gnc-helpers.c
+  gnc-prefs-utils.c
+  gnc-sx-instance-model.c
+  gnc-state.c
+  gnc-ui-util.c
+  gnc-ui-balances.c
+  gncmod-app-utils.c
+  guile-util.c
+  option-util.c
+)
+
+SET_SOURCE_FILES_PROPERTIES (${app_utils_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
+
+SET(app_utils_ALL_SOURCES ${app_utils_SOURCES} ${app_utils_HEADERS} ${app_utils_noinst_HEADERS})
+SET(app_utils_ALL_LIBRARIES gncmod-engine gnc-module ${GIO_LDFLAGS} ${LIBXML2_LDFLAGS} ${LIBXSLT_LDFLAGS})
+SET(app_utils_ALL_INCLUDES  ${CMAKE_CURRENT_SOURCE_DIR}/calculation ${GIO_INCLUDE_DIRS} ${LIBXML2_INCLUDE_DIRS}
+    ${LIBXSLT_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/libgnucash/backend ${CMAKE_SOURCE_DIR}/libgnucash/engine)
+
+IF (WIN32)
+  LIST(APPEND app_utils_ALL_SOURCES gnc-help-utils.c)
+  LIST(APPEND app_utils_ALL_LIBRARIES ${HTMLHELP_LIBRARY})
+  LIST(APPEND app_utils_ALL_INCLUDES ${HTMLHELP_INCLUDE_PATH})
+ENDIF()
+
+
+ADD_LIBRARY (gncmod-app-utils ${app_utils_ALL_SOURCES} ${SWIG_APP_UTILS_GUILE_C})
+TARGET_LINK_LIBRARIES(gncmod-app-utils ${app_utils_ALL_LIBRARIES})
+
+TARGET_INCLUDE_DIRECTORIES (gncmod-app-utils
+    PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
+    PRIVATE ${app_utils_ALL_INCLUDES}
+)
+TARGET_COMPILE_DEFINITIONS (gncmod-app-utils PRIVATE -DG_LOG_DOMAIN=\"gnc.app-utils\")
+
+INSTALL(TARGETS gncmod-app-utils
+  LIBRARY DESTINATION lib/gnucash
+  ARCHIVE DESTINATION lib/gnucash
+  RUNTIME DESTINATION bin
+)
+
+IF (WITH_PYTHON)
+  ADD_LIBRARY (gncmod-app-utils-python ${app_utils_ALL_SOURCES} ${SWIG_APP_UTILS_PYTHON_C})
+
+  TARGET_LINK_LIBRARIES(gncmod-app-utils-python ${app_utils_ALL_LIBRARIES} ${PYTHON_LIBRARIES})
+
+  TARGET_INCLUDE_DIRECTORIES (gncmod-app-utils-python
+    PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
+    PRIVATE ${app_utils_ALL_INCLUDES} ${PYTHON_INCLUDE_DIRS}
+  )
+  TARGET_COMPILE_DEFINITIONS (gncmod-app-utils-python PRIVATE -DG_LOG_DOMAIN=\"gnc.app-utils\")
+
+  INSTALL(TARGETS gncmod-app-utils-python
+    LIBRARY DESTINATION lib/gnucash
+    ARCHIVE DESTINATION lib/gnucash
+    RUNTIME DESTINATION bin
+  )
+ENDIF()
+
+
+
+INSTALL(FILES ${app_utils_HEADERS} DESTINATION include/gnucash)
+
+IF (WITH_OFX)
+  FILE(READ ${CMAKE_SOURCE_DIR}/gnucash/import-export/ofx/migratable-prefs-ofx.xml MIGRATABLE_PREFS_OFX)
+ENDIF()
+
+IF (WITH_AQBANKING)
+  FILE(READ ${CMAKE_SOURCE_DIR}/gnucash/import-export/aqb/migratable-prefs-aqbanking.xml MIGRATABLE_PREFS_AQBANKING)
+ENDIF()
+
+SET(MIGRATABLE_PREFS_XML ${DATADIR_BUILD}/gnucash/migratable-prefs.xml)
+FILE(COPY make-prefs-migration-script.xsl DESTINATION ${DATADIR_BUILD}/gnucash)
+
+CONFIGURE_FILE(migratable-prefs.xml.in ${MIGRATABLE_PREFS_XML})
+# This configure_file is to generate the file for autotools
+CONFIGURE_FILE(migratable-prefs.xml.in migratable-prefs.xml)
+
+INSTALL(FILES ${MIGRATABLE_PREFS_XML} DESTINATION share/gnucash)
+INSTALL(FILES make-prefs-migration-script.xsl DESTINATION share/gnucash)
+
+# And now handle scheme files
+
+SET (app_utils_SCHEME_2
+    app-utils.scm
+)
+
+SET (app_utils_SCHEME_1
+    hooks.scm
+    business-options.scm
+    c-interface.scm
+    config-var.scm
+    date-utilities.scm
+    migrate-prefs.scm
+    options.scm
+    prefs.scm
+    simple-obj.scm
+)
+
+SET(app_utils_SCHEME_3
+    business-prefs.scm
+)
+
+SET(GUILE_MODULES      libgnucash/engine)
+SET(GUILE_LOAD_DIRS    libgnucash/app-utils libgnucash/core-utils libgnucash/engine libgnucash/gnc-module libgnucash/scm)
+SET(GUILE_LIBRARY_DIRS libgnucash/app-utils libgnucash/core-utils libgnucash/engine libgnucash/gnc-module)
+SET(GUILE_DEPENDS      gncmod-app-utils scm-core-utils scm-engine scm-scm)
+
+GNC_ADD_SCHEME_TARGETS(scm-gettext
+  gettext.scm
+  gnucash
+  libgnucash/app-utils
+  ""
+  ""
+  gncmod-app-utils
+  FALSE
+)
+
+GNC_ADD_SCHEME_TARGETS(scm-app-utils-1
+  "${app_utils_SCHEME_1}"
+  ""
+  "${GUILE_MODULES}"
+  "${GUILE_LOAD_DIRS}"
+  "${GUILE_LIBRARY_DIRS}"
+  "scm-gettext;${GUILE_DEPENDS}"
+  FALSE
+)
+
+GNC_ADD_SCHEME_TARGETS(scm-app-utils-2
+  "${app_utils_SCHEME_2}"
+  "gnucash"
+  "${GUILE_MODULES}"
+  "${GUILE_LOAD_DIRS}"
+  "${GUILE_LIBRARY_DIRS}"
+  scm-app-utils-1
+  FALSE
+)
+
+GNC_ADD_SCHEME_TARGETS(scm-app-utils-3
+  "${app_utils_SCHEME_3}"
+  ""
+  "${GUILE_MODULES}"
+  "${GUILE_LOAD_DIRS}"
+  "${GUILE_LIBRARY_DIRS}"
+  scm-app-utils-2
+  FALSE
+)
+
+ADD_CUSTOM_TARGET(scm-app-utils ALL DEPENDS scm-app-utils-3 scm-app-utils-2 scm-app-utils-1 scm-gettext)
+
+SET_LOCAL_DIST(app_utils_DIST_local
+        ${app_utils_ALL_SOURCES} gettext.scm ${app_utils_SCHEME_1} ${app_utils_SCHEME_2} ${app_utils_SCHEME_3}
+        app-utils.i CMakeLists.txt gnc-help-utils.c Makefile.am
+        make-prefs-migration-script.xsl migratable-prefs.xml.in README)
+SET(app_utils_DIST ${app_utils_DIST_local} ${test_app_utils_DIST} PARENT_SCOPE)
diff --git a/libgnucash/app-utils/Makefile.am b/libgnucash/app-utils/Makefile.am
new file mode 100644
index 0000000..7b3f5df
--- /dev/null
+++ b/libgnucash/app-utils/Makefile.am
@@ -0,0 +1,241 @@
+# 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 at gnu.org
+
+SUBDIRS = . test
+
+pkglib_LTLIBRARIES = libgncmod-app-utils.la
+
+AM_CPPFLAGS = \
+  -Wno-error=deprecated-declarations \
+  -I$(top_srcdir)/lib/libc \
+  -I${top_srcdir}/common \
+  -I${top_builddir}/common \
+  -I${top_srcdir}/libgnucash/gnc-module \
+  -I${top_srcdir}/libgnucash/app-utils/calculation \
+  -I${top_srcdir}/libgnucash/core-utils \
+  -I${top_srcdir}/libgnucash/engine \
+  -I${top_srcdir}/libgnucash/backend \
+  ${GUILE_CFLAGS} \
+  ${PYTHON_CPPFLAGS} \
+  ${GLIB_CFLAGS} \
+  ${LIBXML2_CFLAGS} \
+  ${LIBXSLT_CFLAGS}
+
+libgncmod_app_utils_la_SOURCES = \
+  calculation/expression_parser.c \
+  calculation/fin.c \
+  swig-app-utils-guile.c \
+  business-helpers.c \
+  business-options.c \
+  QuickFill.c \
+  file-utils.c \
+  gfec.c \
+  gnc-account-merge.c \
+  gnc-accounting-period.c \
+  gnc-addr-quickfill.c \
+  gnc-component-manager.c \
+  gnc-entry-quickfill.c \
+  gnc-euro.c \
+  gnc-exp-parser.c \
+  gnc-gdate-utils.c \
+  gnc-gettext-util.c \
+  gnc-gsettings.c \
+  gnc-helpers.c \
+  gnc-prefs-utils.c \
+  gnc-sx-instance-model.c \
+  gnc-state.c \
+  gncmod-app-utils.c \
+  gnc-ui-balances.c \
+  gnc-ui-util.c \
+  guile-util.c \
+  option-util.c
+
+gncincludedir = ${GNC_INCLUDE_DIR}
+gncinclude_HEADERS = \
+  QuickFill.h \
+  business-helpers.h \
+  business-options.h \
+  file-utils.h \
+  gfec.h \
+  gnc-basic-gobject.h \
+  gnc-account-merge.h \
+  gnc-accounting-period.h \
+  gnc-addr-quickfill.h \
+  gnc-component-manager.h \
+  gnc-entry-quickfill.h \
+  gnc-euro.h \
+  gnc-exp-parser.h \
+  gnc-gdate-utils.h \
+  gnc-gettext-util.h \
+  gnc-gsettings.h \
+  gnc-help-utils.h \
+  gnc-helpers.h \
+  gnc-prefs-utils.h \
+  gnc-sx-instance-model.h \
+  gnc-state.h \
+  gnc-ui-balances.h \
+  gnc-ui-util.h \
+  guile-util.h \
+  option-util.h
+
+libgncmod_app_utils_la_LDFLAGS = -avoid-version
+
+libgncmod_app_utils_la_LIBADD = \
+  ${top_builddir}/libgnucash/gnc-module/libgnc-module.la \
+  ${top_builddir}/libgnucash/engine/libgncmod-engine.la \
+  ${top_builddir}/libgnucash/core-utils/libgnc-core-utils.la \
+  ${GUILE_LIBS} \
+  ${GLIB_LIBS} \
+  ${LIBXML2_LIBS} \
+  ${LIBXSLT_LIBS}
+
+if BUILDING_FROM_VCS
+swig-app-utils-guile.c: app-utils.i ${top_srcdir}/common/base-typemaps.i
+	$(SWIG) -guile $(SWIG_ARGS) -Linkage module \
+	-I${top_srcdir}/common -o $@ $<
+if ! OS_WIN32
+if ! SWIG_DIST_FAIL
+	if ! `grep "define scm_from_utf8_string" $@ > /dev/null 2>&1`; then \
+	  patch $@ $(top_srcdir)/common/swig-utf8.patch; \
+	fi
+endif
+endif
+swig-app-utils-python.c: app-utils.i ${top_srcdir}/common/base-typemaps.i
+	$(SWIG) -python -Wall -Werror $(SWIG_ARGS) \
+	-I${top_srcdir}/common -o $@ $<
+endif
+
+if WITH_PYTHON
+pkglib_LTLIBRARIES += libgncmod-app-utils-python.la
+
+libgncmod_app_utils_python_la_SOURCES = \
+  swig-app-utils-python.c
+
+libgncmod_app_utils_python_la_LDFLAGS = \
+  ${PYTHON_LDFLAGS}
+
+libgncmod_app_utils_python_la_LIBADD = \
+  ${PYTHON_LIBS} \
+  ${PYTHON_EXTRA_LIBS} \
+  libgncmod-app-utils.la
+endif
+
+gncscmmoddir = ${GNC_SCM_INSTALL_DIR}/gnucash
+gncscmmod_DATA = \
+  gettext.scm \
+  app-utils.scm
+
+gncscmdir = ${GNC_SCM_INSTALL_DIR}
+gncscm_DATA = \
+  business-options.scm \
+  business-prefs.scm \
+  c-interface.scm \
+  config-var.scm \
+  date-utilities.scm \
+  hooks.scm \
+  migrate-prefs.scm \
+  options.scm \
+  prefs.scm \
+  simple-obj.scm
+  
+prefsmigrationdir = $(GNC_SHAREDIR)
+prefsmigration_DATA = \
+  make-prefs-migration-script.xsl \
+  migratable-prefs.xml
+
+noinst_DATA = .scm-links
+
+noinst_HEADERS = \
+  calculation/finvar.h \
+  calculation/finproto.h \
+  calculation/fin_spl_protos.h \
+  calculation/fin_static_proto.h
+
+EXTRA_DIST = \
+  swig-app-utils-python.c \
+  app-utils.i \
+  ${gncscmmod_DATA} \
+  ${gncscm_DATA} \
+  ${prefsmigration_DATA} \
+  CMakeLists.txt
+
+if OS_WIN32
+libgncmod_app_utils_la_SOURCES += gnc-help-utils.c
+libgncmod_app_utils_la_LIBADD += $(HTMLHELP_LIBS)
+else
+EXTRA_DIST += gnc-help-utils.c
+endif
+
+if GNUCASH_SEPARATE_BUILDDIR
+#For executing test cases
+SCM_FILE_LINKS = \
+  ${gncscmmod_DATA} \
+  ${gncscm_DATA}
+endif
+
+.scm-links: 
+	$(RM) -rf gnucash
+	mkdir -p  gnucash
+if GNUCASH_SEPARATE_BUILDDIR
+	for X in ${SCM_FILE_LINKS} ; do \
+	  $(LN_S) -f ${srcdir}/$$X . ; \
+	done
+endif
+	( cd gnucash; for A in $(gncscmmod_DATA) ; do $(LN_S) -f ../$$A . ; done )
+if ! OS_WIN32
+# Windows knows no "ln -s" but uses "cp": must copy every time (see bug #566567).
+	touch .scm-links
+endif
+
+if GNC_HAVE_GUILE_2
+GUILE_COMPILE_ENV = \
+  --gnc-module-dir ${top_builddir}/libgnucash/engine \
+  --guile-load-dir ${top_builddir}/libgnucash/app-utils \
+  --guile-load-dir ${top_builddir}/libgnucash/core-utils \
+  --guile-load-dir ${top_builddir}/libgnucash/engine \
+  --guile-load-dir ${top_builddir}/libgnucash/gnc-module \
+  --guile-load-dir ${top_builddir}/libgnucash/scm \
+  --library-dir    ${top_builddir}/libgnucash/core-utils \
+  --library-dir    ${top_builddir}/libgnucash/gnc-module \
+  --library-dir    ${top_builddir}/libgnucash/engine \
+  --library-dir    ${top_builddir}/libgnucash/app-utils
+
+%.go : %.scm .scm-links $(pkglib_LTLIBRARIES)
+	GNC_UNINSTALLED=yes \
+	GNC_BUILDDIR=${top_builddir} \
+	$(shell ${abs_top_srcdir}/common/gnc-test-env.pl --noexports ${GUILE_COMPILE_ENV}) \
+	$(GUILD) compile -o $@ $<
+
+gncscmmodcachedir = ${pkglibdir}/scm/ccache/@GUILE_EFFECTIVE_VERSION@/gnucash
+gncscmmodcache_DATA = $(gncscmmod_DATA:.scm=.go)
+
+gncscmcachedir = ${pkglibdir}/scm/ccache/@GUILE_EFFECTIVE_VERSION@
+gncscmcache_DATA = $(gncscm_DATA:.scm=.go)
+endif
+
+clean-local:
+	rm -rf gnucash
+
+CLEANFILES = \
+	${SCM_FILE_LINKS} \
+	 .scm-links \
+	${gncscmcache_DATA} \
+	${gncscmmodcache_DATA}
+
+MAINTAINERCLEANFILES = swig-app-utils-guile.c swig-app-utils-python.c
+
+AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.app-utils\"
diff --git a/src/app-utils/QuickFill.c b/libgnucash/app-utils/QuickFill.c
similarity index 100%
rename from src/app-utils/QuickFill.c
rename to libgnucash/app-utils/QuickFill.c
diff --git a/src/app-utils/QuickFill.h b/libgnucash/app-utils/QuickFill.h
similarity index 100%
rename from src/app-utils/QuickFill.h
rename to libgnucash/app-utils/QuickFill.h
diff --git a/src/app-utils/README b/libgnucash/app-utils/README
similarity index 100%
rename from src/app-utils/README
rename to libgnucash/app-utils/README
diff --git a/libgnucash/app-utils/app-utils.i b/libgnucash/app-utils/app-utils.i
new file mode 100644
index 0000000..7ded4ef
--- /dev/null
+++ b/libgnucash/app-utils/app-utils.i
@@ -0,0 +1,177 @@
+/********************************************************************\
+ * 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 at gnu.org                   *
+ *                                                                  *
+\********************************************************************/
+
+%module sw_app_utils
+%{
+/* Includes the header in the wrapper code */
+#include <config.h>
+#include <option-util.h>
+#include <gnc-euro.h>
+#include <gnc-exp-parser.h>
+#include <gnc-ui-util.h>
+#include <gnc-gettext-util.h>
+#include <gnc-prefs-utils.h>
+#include <gnc-helpers.h>
+#include <gnc-accounting-period.h>
+#include <gnc-session.h>
+#include <gnc-component-manager.h>
+#include <guile-util.h>
+#include <gnc-sx-instance-model.h>
+
+#include "engine-helpers-guile.h"
+%}
+
+#if defined(SWIGGUILE)
+%{
+#include "guile-mappings.h"
+
+SCM scm_init_sw_app_utils_module (void);
+%}
+#endif
+
+#if defined(SWIGPYTHON)
+%{
+/* avoid no previous prototype warning/error */
+#if PY_VERSION_HEX >= 0x03000000
+PyObject*
+#else
+void
+#endif
+SWIG_init (void);
+%}
+#endif
+
+%import "base-typemaps.i"
+
+typedef void (*GNCOptionChangeCallback) (gpointer user_data);
+typedef int GNCOptionDBHandle;
+
+void gnc_prefs_init();
+
+QofBook * gnc_get_current_book (void);
+QofSession * gnc_get_current_session (void);
+const gchar * gnc_get_current_book_tax_name (void);
+const gchar * gnc_get_current_book_tax_type (void);
+Account * gnc_get_current_root_account (void);
+
+%newobject gnc_gettext_helper;
+char * gnc_gettext_helper(const char *string);
+
+GNCOptionDB * gnc_option_db_new(SCM guile_options);
+void gnc_option_db_destroy(GNCOptionDB *odb);
+
+void gnc_option_db_set_option_selectable_by_name(SCM guile_option,
+      const char *section, const char *name, gboolean selectable);
+
+#if defined(SWIGGUILE)
+%typemap(out) GncCommodityList * {
+  SCM list = SCM_EOL;
+  GList *node;
+
+  for (node = $1; node; node = node->next)
+    list = scm_cons(gnc_quoteinfo2scm(node->data), list);
+
+  $result = scm_reverse(list);
+}
+
+%inline %{
+typedef GList GncCommodityList;
+
+GncCommodityList *
+gnc_commodity_table_get_quotable_commodities(const gnc_commodity_table * table);
+%}
+
+gnc_commodity * gnc_default_currency (void);
+gnc_commodity * gnc_default_report_currency (void);
+
+void gncp_option_invoke_callback(GNCOptionChangeCallback callback, void *data);
+void gnc_option_db_register_option(GNCOptionDBHandle handle,
+        SCM guile_option);
+
+GNCPrintAmountInfo gnc_default_print_info (gboolean use_symbol);
+GNCPrintAmountInfo gnc_account_print_info (const Account *account,
+        gboolean use_symbol);
+GNCPrintAmountInfo gnc_commodity_print_info (const gnc_commodity *commodity,
+        gboolean use_symbol);
+GNCPrintAmountInfo gnc_share_print_info_places (int decplaces);
+const char * xaccPrintAmount (gnc_numeric val, GNCPrintAmountInfo info);
+
+gchar *number_to_words(gdouble val, gint64 denom);
+const gchar *printable_value (gdouble val, gint denom);
+
+gboolean gnc_reverse_balance (const Account *account);
+
+gboolean gnc_is_euro_currency(const gnc_commodity * currency);
+gnc_numeric gnc_convert_to_euro(const gnc_commodity * currency,
+        gnc_numeric value);
+gnc_numeric gnc_convert_from_euro(const gnc_commodity * currency,
+        gnc_numeric value);
+
+time64 gnc_accounting_period_fiscal_start(void);
+time64 gnc_accounting_period_fiscal_end(void);
+
+void gnc_register_kvp_option_generator(QofIdType id_type, SCM generator);
+
+%typemap(in) GList * {
+  SCM path_scm = $input;
+  GList *path = NULL;
+  while (!scm_is_null (path_scm))
+  {
+    SCM key_scm = SCM_CAR (path_scm);
+    char *key;
+    gchar* gkey;
+    if (!scm_is_string (key_scm))
+      break;
+    key = scm_to_locale_string (key_scm);
+    gkey = g_strdup (key);
+    free (key);
+    path = g_list_prepend (path, gkey);
+    path_scm = SCM_CDR (path_scm);
+  }
+  $1 = g_list_reverse (path);
+}
+Process *gnc_spawn_process_async(GList *argl, const gboolean search_path);
+%clear GList *;
+
+gint gnc_process_get_fd(const Process *proc, const guint std_fd);
+void gnc_detach_process(Process *proc, const gboolean kill_it);
+
+time64 gnc_parse_time_to_time64(const gchar *s, const gchar *format);
+
+%typemap(out) GHashTable * {
+  SCM table = scm_c_make_hash_table (g_hash_table_size($1) + 17);
+  GHashTableIter iter;
+  gpointer key, value;
+
+  g_hash_table_iter_init (&iter, $1);
+  while (g_hash_table_iter_next (&iter, &key, &value)) {
+    const GncGUID* c_guid = (const GncGUID*) key;
+    const gnc_numeric* c_numeric = (const gnc_numeric*) value;
+    SCM scm_guid = gnc_guid2scm(*c_guid);
+    SCM scm_numeric = gnc_numeric_to_scm(*c_numeric);
+
+    scm_hash_set_x(table, scm_guid, scm_numeric);
+  }
+  g_hash_table_destroy($1);
+  $result = table;
+}
+GHashTable* gnc_sx_all_instantiate_cashflow_all(GDate range_start, GDate range_end);
+%clear GHashTable *;
+#endif
diff --git a/src/app-utils/app-utils.scm b/libgnucash/app-utils/app-utils.scm
similarity index 100%
rename from src/app-utils/app-utils.scm
rename to libgnucash/app-utils/app-utils.scm
diff --git a/src/app-utils/business-helpers.c b/libgnucash/app-utils/business-helpers.c
similarity index 100%
rename from src/app-utils/business-helpers.c
rename to libgnucash/app-utils/business-helpers.c
diff --git a/src/app-utils/business-helpers.h b/libgnucash/app-utils/business-helpers.h
similarity index 100%
rename from src/app-utils/business-helpers.h
rename to libgnucash/app-utils/business-helpers.h
diff --git a/src/app-utils/business-options.c b/libgnucash/app-utils/business-options.c
similarity index 100%
rename from src/app-utils/business-options.c
rename to libgnucash/app-utils/business-options.c
diff --git a/src/app-utils/business-options.h b/libgnucash/app-utils/business-options.h
similarity index 100%
rename from src/app-utils/business-options.h
rename to libgnucash/app-utils/business-options.h
diff --git a/src/app-utils/business-options.scm b/libgnucash/app-utils/business-options.scm
similarity index 100%
rename from src/app-utils/business-options.scm
rename to libgnucash/app-utils/business-options.scm
diff --git a/src/app-utils/business-prefs.scm b/libgnucash/app-utils/business-prefs.scm
similarity index 100%
rename from src/app-utils/business-prefs.scm
rename to libgnucash/app-utils/business-prefs.scm
diff --git a/src/app-utils/c-interface.scm b/libgnucash/app-utils/c-interface.scm
similarity index 100%
rename from src/app-utils/c-interface.scm
rename to libgnucash/app-utils/c-interface.scm
diff --git a/src/app-utils/calculation/expression_parser.c b/libgnucash/app-utils/calculation/expression_parser.c
similarity index 100%
rename from src/app-utils/calculation/expression_parser.c
rename to libgnucash/app-utils/calculation/expression_parser.c
diff --git a/src/app-utils/calculation/fin.c b/libgnucash/app-utils/calculation/fin.c
similarity index 100%
rename from src/app-utils/calculation/fin.c
rename to libgnucash/app-utils/calculation/fin.c
diff --git a/src/app-utils/calculation/fin_spl_protos.h b/libgnucash/app-utils/calculation/fin_spl_protos.h
similarity index 100%
rename from src/app-utils/calculation/fin_spl_protos.h
rename to libgnucash/app-utils/calculation/fin_spl_protos.h
diff --git a/src/app-utils/calculation/fin_static_proto.h b/libgnucash/app-utils/calculation/fin_static_proto.h
similarity index 100%
rename from src/app-utils/calculation/fin_static_proto.h
rename to libgnucash/app-utils/calculation/fin_static_proto.h
diff --git a/src/app-utils/calculation/finproto.h b/libgnucash/app-utils/calculation/finproto.h
similarity index 100%
rename from src/app-utils/calculation/finproto.h
rename to libgnucash/app-utils/calculation/finproto.h
diff --git a/src/app-utils/calculation/finvar.h b/libgnucash/app-utils/calculation/finvar.h
similarity index 100%
rename from src/app-utils/calculation/finvar.h
rename to libgnucash/app-utils/calculation/finvar.h
diff --git a/src/app-utils/config-var.scm b/libgnucash/app-utils/config-var.scm
similarity index 100%
rename from src/app-utils/config-var.scm
rename to libgnucash/app-utils/config-var.scm
diff --git a/src/app-utils/date-utilities.scm b/libgnucash/app-utils/date-utilities.scm
similarity index 100%
rename from src/app-utils/date-utilities.scm
rename to libgnucash/app-utils/date-utilities.scm
diff --git a/src/app-utils/file-utils.c b/libgnucash/app-utils/file-utils.c
similarity index 100%
rename from src/app-utils/file-utils.c
rename to libgnucash/app-utils/file-utils.c
diff --git a/src/app-utils/file-utils.h b/libgnucash/app-utils/file-utils.h
similarity index 100%
rename from src/app-utils/file-utils.h
rename to libgnucash/app-utils/file-utils.h
diff --git a/src/app-utils/gettext.scm b/libgnucash/app-utils/gettext.scm
similarity index 100%
rename from src/app-utils/gettext.scm
rename to libgnucash/app-utils/gettext.scm
diff --git a/src/app-utils/gfec.c b/libgnucash/app-utils/gfec.c
similarity index 100%
rename from src/app-utils/gfec.c
rename to libgnucash/app-utils/gfec.c
diff --git a/src/app-utils/gfec.h b/libgnucash/app-utils/gfec.h
similarity index 100%
rename from src/app-utils/gfec.h
rename to libgnucash/app-utils/gfec.h
diff --git a/src/app-utils/gnc-account-merge.c b/libgnucash/app-utils/gnc-account-merge.c
similarity index 100%
rename from src/app-utils/gnc-account-merge.c
rename to libgnucash/app-utils/gnc-account-merge.c
diff --git a/src/app-utils/gnc-account-merge.h b/libgnucash/app-utils/gnc-account-merge.h
similarity index 100%
rename from src/app-utils/gnc-account-merge.h
rename to libgnucash/app-utils/gnc-account-merge.h
diff --git a/src/app-utils/gnc-accounting-period.c b/libgnucash/app-utils/gnc-accounting-period.c
similarity index 100%
rename from src/app-utils/gnc-accounting-period.c
rename to libgnucash/app-utils/gnc-accounting-period.c
diff --git a/src/app-utils/gnc-accounting-period.h b/libgnucash/app-utils/gnc-accounting-period.h
similarity index 100%
rename from src/app-utils/gnc-accounting-period.h
rename to libgnucash/app-utils/gnc-accounting-period.h
diff --git a/libgnucash/app-utils/gnc-addr-quickfill.c b/libgnucash/app-utils/gnc-addr-quickfill.c
new file mode 100644
index 0000000..3e5c9e9
--- /dev/null
+++ b/libgnucash/app-utils/gnc-addr-quickfill.c
@@ -0,0 +1,226 @@
+/********************************************************************\
+ * gnc-addr-quickfill.c -- Create an address line quick-fill  *
+ * Copyright (C) 2011 Christian Stimming <christian at cstimming.de>   *
+ *                                                                  *
+ * 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 at gnu.org                   *
+ *                                                                  *
+\********************************************************************/
+
+#include "config.h"
+#include "gnc-addr-quickfill.h"
+#include "gnc-event.h"
+#include "gnc-engine.h"
+#include "gncAddress.h"
+
+/* This static indicates the debugging module that this .o belongs to. */
+G_GNUC_UNUSED static QofLogModule log_module = GNC_MOD_REGISTER;
+
+typedef struct
+{
+    QuickFill *qf_addr2;
+    QuickFill *qf_addr3;
+    QuickFill *qf_addr4;
+    QuickFillSort qf_sort;
+    QofBook *book;
+    gint  listener;
+} AddressQF;
+
+static void
+listen_for_gncaddress_events(QofInstance *entity,  QofEventId event_type,
+                             gpointer user_data, gpointer event_data)
+{
+    AddressQF *qfb = user_data;
+    const char *addr2, *addr3, *addr4;
+
+    /* We only listen for GncAddress events */
+    if (!GNC_IS_ADDRESS (entity))
+        return;
+
+    /* We listen for MODIFY (if the description was changed into
+     * something non-empty, so we add the string to the quickfill) and
+     * DESTROY (to remove the description from the quickfill). */
+    if (0 == (event_type & (QOF_EVENT_MODIFY | QOF_EVENT_DESTROY)))
+        return;
+
+    /*     g_warning("entity %p, entity type %s, event type %s, user data %p, ecent data %p", */
+    /*               entity, entity->e_type, qofeventid_to_string(event_type), user_data, event_data); */
+
+    addr2 = gncAddressGetAddr2(GNC_ADDRESS(entity));
+    addr3 = gncAddressGetAddr3(GNC_ADDRESS(entity));
+    addr4 = gncAddressGetAddr4(GNC_ADDRESS(entity));
+    if (event_type & QOF_EVENT_MODIFY)
+    {
+        /* If the description was changed into something non-empty, so
+         * we add the string to the quickfill */
+        if (addr2 && strlen(addr2) > 0)
+        {
+            /* Add the new string to the quickfill */
+            gnc_quickfill_insert (qfb->qf_addr2, addr2, QUICKFILL_LIFO);
+        }
+        if (addr3 && strlen(addr3) > 0)
+        {
+            /* Add the new string to the quickfill */
+            gnc_quickfill_insert (qfb->qf_addr3, addr3, QUICKFILL_LIFO);
+        }
+        if (addr4 && strlen(addr4) > 0)
+        {
+            /* Add the new string to the quickfill */
+            gnc_quickfill_insert (qfb->qf_addr4, addr4, QUICKFILL_LIFO);
+        }
+    }
+    else if (event_type & QOF_EVENT_DESTROY)
+    {
+        if (addr2 && strlen(addr2) > 0)
+        {
+            /* Remove the description from the quickfill */
+            gnc_quickfill_insert (qfb->qf_addr2, addr2, QUICKFILL_LIFO);
+        }
+        if (addr3 && strlen(addr3) > 0)
+        {
+            /* Remove the description from the quickfill */
+            gnc_quickfill_insert (qfb->qf_addr3, addr3, QUICKFILL_LIFO);
+        }
+        if (addr4 && strlen(addr4) > 0)
+        {
+            /* Remove the description from the quickfill */
+            gnc_quickfill_insert (qfb->qf_addr4, addr4, QUICKFILL_LIFO);
+        }
+    }
+}
+
+static void
+shared_quickfill_destroy (QofBook *book, gpointer key, gpointer user_data)
+{
+    AddressQF *qfb = user_data;
+    gnc_quickfill_destroy (qfb->qf_addr2);
+    gnc_quickfill_destroy (qfb->qf_addr3);
+    gnc_quickfill_destroy (qfb->qf_addr4);
+    qof_event_unregister_handler (qfb->listener);
+    g_free (qfb);
+}
+
+static void address_cb(gpointer data, gpointer user_data)
+{
+    const GncAddress* address = data;
+    AddressQF *s = (AddressQF *) user_data;
+
+    gnc_quickfill_insert (s->qf_addr2,
+                          gncAddressGetAddr2(address),
+                          s->qf_sort);
+
+    gnc_quickfill_insert (s->qf_addr3,
+                          gncAddressGetAddr3(address),
+                          s->qf_sort);
+
+    gnc_quickfill_insert (s->qf_addr4,
+                          gncAddressGetAddr4(address),
+                          s->qf_sort);
+}
+
+/** Creates a new query that searches for all GncAddress items in the
+ * current book. */
+static QofQuery *new_query_for_addresss(QofBook *book)
+{
+    QofQuery *query = qof_query_create_for (GNC_ID_ADDRESS);
+    g_assert(book);
+    qof_query_set_book (query, book);
+
+    /* No particular sort order here. */
+
+    return query;
+}
+
+static AddressQF* build_shared_quickfill (QofBook *book, const char * key)
+{
+    AddressQF *result;
+    QofQuery *query = new_query_for_addresss(book);
+    GList *entries = qof_query_run(query);
+
+    /*     g_warning("Found %d GncAddress items", g_list_length (entries)); */
+
+    result = g_new0(AddressQF, 1);
+
+    result->qf_addr2 = gnc_quickfill_new();
+    result->qf_addr3 = gnc_quickfill_new();
+    result->qf_addr4 = gnc_quickfill_new();
+    result->qf_sort = QUICKFILL_ALPHA;
+    result->book = book;
+
+    g_list_foreach (entries, address_cb, result);
+
+    qof_query_destroy(query);
+
+    result->listener =
+        qof_event_register_handler (listen_for_gncaddress_events,
+                                    result);
+
+    qof_book_set_data_fin (book, key, result, shared_quickfill_destroy);
+
+    return result;
+}
+
+QuickFill * gnc_get_shared_address_addr2_quickfill (QofBook *book, const char * key)
+{
+    AddressQF *qfb;
+
+    g_assert(book);
+    g_assert(key);
+
+    qfb = qof_book_get_data (book, key);
+
+    if (!qfb)
+    {
+        qfb = build_shared_quickfill(book, key);
+    }
+
+    return qfb->qf_addr2;
+}
+
+QuickFill * gnc_get_shared_address_addr3_quickfill (QofBook *book, const char * key)
+{
+    AddressQF *qfb;
+
+    g_assert(book);
+    g_assert(key);
+
+    qfb = qof_book_get_data (book, key);
+
+    if (!qfb)
+    {
+        qfb = build_shared_quickfill(book, key);
+    }
+
+    return qfb->qf_addr3;
+}
+
+QuickFill * gnc_get_shared_address_addr4_quickfill (QofBook *book, const char * key)
+{
+    AddressQF *qfb;
+
+    g_assert(book);
+    g_assert(key);
+
+    qfb = qof_book_get_data (book, key);
+
+    if (!qfb)
+    {
+        qfb = build_shared_quickfill(book, key);
+    }
+
+    return qfb->qf_addr4;
+}
diff --git a/libgnucash/app-utils/gnc-addr-quickfill.h b/libgnucash/app-utils/gnc-addr-quickfill.h
new file mode 100644
index 0000000..28d1215
--- /dev/null
+++ b/libgnucash/app-utils/gnc-addr-quickfill.h
@@ -0,0 +1,81 @@
+/********************************************************************\
+ * gnc-addr-quickfill.h -- Create an address line quick-fill  *
+ * Copyright (C) 2011 Christian Stimming <christian at cstimming.de>   *
+ *                                                                  *
+ * 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 at gnu.org                   *
+ *                                                                  *
+\********************************************************************/
+/** @addtogroup QuickFill Auto-complete typed user input.
+   @{
+*/
+/** Similar to the @ref Account_QuickFill account name quickfill, we
+ * create a cached quickfill with the address lines of all GncAddress.
+*/
+
+#ifndef GNC_ADDR_QUICKFILL_H
+#define GNC_ADDR_QUICKFILL_H
+
+#include "qof.h"
+#include "QuickFill.h"
+
+/** Create/fetch a quickfill GncAddress description strings on the Addr2 part.
+ *
+ *  Multiple, distinct quickfills, for different uses, are allowed.
+ *  Each is identified with the 'key'.  Be sure to use distinct,
+ *  unique keys that don't conflict with other users of QofBook.
+ *
+ *  This code listens to GncAddress creation events, and automatically
+ *  adds new items to the quickfill list.  This code also listens to
+ *  the item deletion events and removes those entries from the
+ *  quickfill; however, this does not yet seem to fully remove them
+ *  from the GUI.
+ *
+ * \param book The book
+ * \param key The identifier to look up the shared object in the book
+ *
+ * \return The shared QuickFill object which is created on first
+ * calling of this function and subsequently looked up in the book by
+ * using the key.
+ */
+QuickFill * gnc_get_shared_address_addr2_quickfill (QofBook *book,
+        const char * key);
+
+/** Create/fetch a quickfill GncAddress description strings on the
+ * Addr3 part.
+ *
+ * Identical to gnc_get_shared_address_addr2_quickfill(). You should
+ * also use the same key as for the other function because the
+ * internal quickfills are updated simultaneously.
+ */
+QuickFill * gnc_get_shared_address_addr3_quickfill (QofBook *book,
+        const char * key);
+
+/** Create/fetch a quickfill GncAddress description strings on the
+ * Addr4 part.
+ *
+ * Identical to gnc_get_shared_address_addr2_quickfill(). You should
+ * also use the same key as for the other function because the
+ * internal quickfills are updated simultaneously.
+ */
+QuickFill * gnc_get_shared_address_addr4_quickfill (QofBook *book,
+        const char * key);
+
+#endif
+
+/** @} */
+/** @} */
diff --git a/src/app-utils/gnc-basic-gobject.h b/libgnucash/app-utils/gnc-basic-gobject.h
similarity index 100%
rename from src/app-utils/gnc-basic-gobject.h
rename to libgnucash/app-utils/gnc-basic-gobject.h
diff --git a/src/app-utils/gnc-component-manager.c b/libgnucash/app-utils/gnc-component-manager.c
similarity index 100%
rename from src/app-utils/gnc-component-manager.c
rename to libgnucash/app-utils/gnc-component-manager.c
diff --git a/src/app-utils/gnc-component-manager.h b/libgnucash/app-utils/gnc-component-manager.h
similarity index 100%
rename from src/app-utils/gnc-component-manager.h
rename to libgnucash/app-utils/gnc-component-manager.h
diff --git a/libgnucash/app-utils/gnc-entry-quickfill.c b/libgnucash/app-utils/gnc-entry-quickfill.c
new file mode 100644
index 0000000..e847e65
--- /dev/null
+++ b/libgnucash/app-utils/gnc-entry-quickfill.c
@@ -0,0 +1,167 @@
+/********************************************************************\
+ * gnc-entry-quickfill.c -- Create an entry description quick-fill  *
+ * Copyright (C) 2010 Christian Stimming <christian at cstimming.de>   *
+ *                                                                  *
+ * 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 at gnu.org                   *
+ *                                                                  *
+\********************************************************************/
+
+#include "config.h"
+#include "gnc-entry-quickfill.h"
+#include "gnc-event.h"
+#include "gncEntry.h"
+
+/* This static indicates the debugging module that this .o belongs to. */
+G_GNUC_UNUSED static QofLogModule log_module = GNC_MOD_REGISTER;
+
+typedef struct
+{
+    QuickFill *qf;
+    QuickFillSort qf_sort;
+    QofBook *book;
+    gint  listener;
+    gboolean using_invoices;
+} EntryQF;
+
+static void
+listen_for_gncentry_events(QofInstance *entity,  QofEventId event_type,
+                           gpointer user_data, gpointer event_data)
+{
+    EntryQF *qfb = user_data;
+    QuickFill *qf = qfb->qf;
+    const char *desc;
+
+    /* We only listen for GncEntry events */
+    if (!GNC_IS_ENTRY (entity))
+        return;
+
+    /* We listen for MODIFY (if the description was changed into
+     * something non-empty, so we add the string to the quickfill) and
+     * DESTROY (to remove the description from the quickfill). */
+    if (0 == (event_type & (QOF_EVENT_MODIFY | QOF_EVENT_DESTROY)))
+        return;
+
+    /*     g_warning("entity %p, entity type %s, event type %s, user data %p, ecent data %p", */
+    /*               entity, entity->e_type, qofeventid_to_string(event_type), user_data, event_data); */
+
+    desc = gncEntryGetDescription(GNC_ENTRY(entity));
+    if (event_type & QOF_EVENT_MODIFY)
+    {
+        /* If the description was changed into something non-empty, so
+         * we add the string to the quickfill */
+        if (!desc || strlen(desc) == 0)
+            return;
+
+        /* Add the new string to the quickfill */
+        gnc_quickfill_insert (qf, desc, QUICKFILL_LIFO);
+    }
+    else if (event_type & QOF_EVENT_DESTROY)
+    {
+        if (!desc || strlen(desc) == 0)
+            return;
+
+        /* Remove the description from the quickfill */
+        gnc_quickfill_insert (qf, desc, QUICKFILL_LIFO);
+    }
+}
+
+static void
+shared_quickfill_destroy (QofBook *book, gpointer key, gpointer user_data)
+{
+    EntryQF *qfb = user_data;
+    gnc_quickfill_destroy (qfb->qf);
+    qof_event_unregister_handler (qfb->listener);
+    g_free (qfb);
+}
+
+static void entry_cb(gpointer data, gpointer user_data)
+{
+    const GncEntry* entry = data;
+    EntryQF *s = (EntryQF *) user_data;
+    if (s->using_invoices == (gncEntryGetInvAccount(entry) != NULL))
+    {
+        gnc_quickfill_insert (s->qf,
+                              gncEntryGetDescription(entry),
+                              s->qf_sort);
+    }
+}
+
+/** Creates a new query that searches for all GncEntry items in the
+ * current book. */
+static QofQuery *new_query_for_entrys(QofBook *book)
+{
+    GSList *primary_sort_params = NULL;
+    QofQuery *query = qof_query_create_for (GNC_ID_ENTRY);
+    g_assert(book);
+    qof_query_set_book (query, book);
+
+    /* Set the sort order: By DATE_ENTERED, increasing, and returning
+     * only one single resulting item. */
+    primary_sort_params = qof_query_build_param_list(ENTRY_DATE_ENTERED, NULL);
+    qof_query_set_sort_order (query, primary_sort_params, NULL, NULL);
+    qof_query_set_sort_increasing (query, TRUE, TRUE, TRUE);
+
+    return query;
+}
+
+static EntryQF* build_shared_quickfill (QofBook *book, const char * key, gboolean use_invoices)
+{
+    EntryQF *result;
+    QofQuery *query = new_query_for_entrys(book);
+    GList *entries = qof_query_run(query);
+
+    /*     g_warning("Found %d GncEntry items", g_list_length (entries)); */
+
+    result = g_new0(EntryQF, 1);
+
+    result->using_invoices = use_invoices;
+    result->qf = gnc_quickfill_new();
+    result->qf_sort = QUICKFILL_LIFO;
+    result->book = book;
+
+    g_list_foreach (entries, entry_cb, result);
+
+    qof_query_destroy(query);
+
+    result->listener =
+        qof_event_register_handler (listen_for_gncentry_events,
+                                    result);
+
+    qof_book_set_data_fin (book, key, result, shared_quickfill_destroy);
+
+    return result;
+}
+
+QuickFill * gnc_get_shared_entry_desc_quickfill (QofBook *book,
+        const char * key, gboolean use_invoices)
+{
+    EntryQF *qfb;
+
+    g_assert(book);
+    g_assert(key);
+
+    qfb = qof_book_get_data (book, key);
+
+    if (!qfb)
+    {
+        qfb = build_shared_quickfill(book, key, use_invoices);
+    }
+
+    g_assert(use_invoices == qfb->using_invoices);
+    return qfb->qf;
+}
diff --git a/libgnucash/app-utils/gnc-entry-quickfill.h b/libgnucash/app-utils/gnc-entry-quickfill.h
new file mode 100644
index 0000000..b6993d7
--- /dev/null
+++ b/libgnucash/app-utils/gnc-entry-quickfill.h
@@ -0,0 +1,67 @@
+/********************************************************************\
+ * gnc-entry-quickfill.h -- Create an entry description quick-fill  *
+ * Copyright (C) 2010 Christian Stimming <christian at cstimming.de>   *
+ *                                                                  *
+ * 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 at gnu.org                   *
+ *                                                                  *
+\********************************************************************/
+/** @addtogroup QuickFill Auto-complete typed user input.
+   @{
+*/
+/** Similar to the @ref Account_QuickFill account name quickfill, we
+ * create a cached quickfill with the description of all entries.
+*/
+
+#ifndef GNC_ENTRY_QUICKFILL_H
+#define GNC_ENTRY_QUICKFILL_H
+
+#include "qof.h"
+#include "QuickFill.h"
+
+/** Create/fetch a quickfill GncEntry description strings.
+ *
+ *  Multiple, distinct quickfills, for different uses, are allowed.
+ *  Each is identified with the 'key'.  Be sure to use distinct,
+ *  unique keys that don't conflict with other users of QofBook.
+ *
+ *  This code listens to entry creation events, and automatically adds
+ *  new entry's descriptions to the quickfill list.  This code also
+ *  listens to the entry's deletion events and removes those
+ *  descriptions from the quickfill; however, this does not yet seem
+ *  to fully remove them from the GUI.
+ *
+ * \param book The book
+ * \param key The identifier to look up the shared object in the book
+ *
+ * \param use_invoices If TRUE, this quickfill considers only the
+ * entries from GncInvoice objects. If FALSE, this quickfill considers
+ * only the entries from bills/expense vouchers. Watch out: This
+ * parameter must be identical each time the same key is used for
+ * lookup, or otherwise an assertion will fail.
+ *
+ * \return The shared QuickFill object which is created on first
+ * calling of this function and subsequently looked up in the book by
+ * using the key.
+ */
+QuickFill * gnc_get_shared_entry_desc_quickfill (QofBook *book,
+        const char * key, gboolean use_invoices);
+
+#endif
+
+/** @} */
+/** @} */
diff --git a/libgnucash/app-utils/gnc-euro.c b/libgnucash/app-utils/gnc-euro.c
new file mode 100644
index 0000000..518e255
--- /dev/null
+++ b/libgnucash/app-utils/gnc-euro.c
@@ -0,0 +1,234 @@
+/********************************************************************\
+ * gnc-euro.c -- utilities for EURO currency                        *
+ *                                                                  *
+ * Copyright (C) 2000 Herbert Thoma                                 *
+ *                                                                  *
+ * 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, write to the Free Software      *
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.        *
+ *                                                                  *
+\********************************************************************/
+
+#include "config.h"
+
+#include "gnc-euro.h"
+
+#include <glib/gi18n.h>
+#include <math.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "gnc-ui-util.h"
+
+/* local structs */
+typedef struct
+{
+    const char *currency;
+    double rate;
+} gnc_euro_rate_struct;
+
+
+/* This array MUST be sorted ! */
+/* The rates are per EURO */
+static gnc_euro_rate_struct gnc_euro_rates[] =
+{
+    { "ATS",  13.7603 },  /* austrian schilling */
+    { "BEF",  40.3399 },  /* belgian franc */
+    { "BFR",  40.3399 },  /* belgian franc */
+    { "CYP",  .585274 },  /* cyprus pound */
+    { "DEM",  1.95583 },  /* german mark */
+    { "DM",   1.95583 },  /* german mark */
+    { "EEK",  15.6466 },  /* Estonian Kroon */
+    { "ESC",  200.482 },  /* portugese escudo */
+    { "ESP",  166.386 },  /* spanish peseta */
+    { "EUR",  1.00000 },  /* euro */
+    { "EURO", 1.00000 },  /* euro */
+    { "FF",   6.55957 },  /* french franc */
+    { "FIM",  5.94573 },  /* finnmark */
+    { "FMK",  5.94573 },  /* finnmark */
+    { "FRF",  6.55957 },  /* french franc */
+    { "GRD",  340.750 },  /* greek drachma */
+    { "HFL",  2.20371 },  /* netherland gulden */
+    { "IEP",  .787564 },  /* irish pound */
+    { "IRP",  .787564 },  /* irish pound */
+    { "ITL",  1936.27 },  /* italian lira */
+    { "LFR",  40.3399 },  /* luxembourg franc */
+    { "LIT",  1936.27 },  /* italian lira */
+    { "LUF",  40.3399 },  /* luxembourg franc */
+    { "LVL",  .702804 },  /* latvian lats */
+    { "MTL",  .429300 },  /* maltese lira */
+    { "NLG",  2.20371 },  /* netherland gulden */
+    { "PTA",  166.386 },  /* spanish peseta */
+    { "PTE",  200.482 },  /* portugese escudo */
+    { "S",    13.7603 },  /* austrian schilling */
+    { "SCH",  13.7603 },  /* austrian schilling */
+    { "SIT",  239.640 },  /* slovenian tolar */
+    { "SKK",  30.1260 }   /* slovak koruna */
+};
+
+static int
+gnc_euro_rate_compare (const void * key, const void * value)
+{
+    const gnc_commodity * curr = key;
+    const gnc_euro_rate_struct * euro = value;
+
+    if (!key || !value)
+        return -1;
+
+    return g_ascii_strcasecmp(gnc_commodity_get_mnemonic(curr), euro->currency);
+}
+
+#if 0 /* Not Used */
+static int
+gnc_euro_rate_compare_code (const void * key, const void * value)
+{
+    const char *code = key;
+    const gnc_euro_rate_struct * euro = value;
+
+    if (!key || !value)
+        return -1;
+
+    return g_ascii_strcasecmp (code, euro->currency);
+}
+#endif
+
+/* ------------------------------------------------------ */
+
+gboolean
+gnc_is_euro_currency(const gnc_commodity * currency)
+{
+    gnc_euro_rate_struct *result;
+
+    if (currency == NULL)
+        return FALSE;
+
+    if (!gnc_commodity_is_iso(currency))
+        return FALSE;
+
+    result = bsearch(currency,
+                     gnc_euro_rates,
+                     sizeof(gnc_euro_rates) / sizeof(gnc_euro_rate_struct),
+                     sizeof(gnc_euro_rate_struct),
+                     gnc_euro_rate_compare);
+
+    if (result == NULL)
+        return FALSE;
+
+    return TRUE;
+}
+
+/* ------------------------------------------------------ */
+
+gnc_numeric
+gnc_convert_to_euro(const gnc_commodity * currency, gnc_numeric value)
+{
+    gnc_euro_rate_struct *result;
+
+    if (currency == NULL)
+        return gnc_numeric_zero ();
+
+    if (!gnc_commodity_is_iso(currency))
+        return gnc_numeric_zero ();
+
+    result = bsearch(currency,
+                     gnc_euro_rates,
+                     sizeof(gnc_euro_rates) / sizeof(gnc_euro_rate_struct),
+                     sizeof(gnc_euro_rate_struct),
+                     gnc_euro_rate_compare);
+
+    if (result == NULL)
+        return gnc_numeric_zero ();
+
+    /* round to 2 decimal places */
+    {
+        gnc_numeric rate;
+
+        rate = double_to_gnc_numeric (result->rate, 100000, GNC_HOW_RND_ROUND_HALF_UP);
+
+        /* EC Regulation 1103/97 states we should use "Round half away from zero"
+         * See http://europa.eu/legislation_summaries/economic_and_monetary_affairs/institutional_and_economic_framework/l25025_en.htm */
+        return gnc_numeric_div (value, rate, 100, GNC_HOW_RND_ROUND_HALF_UP);
+    }
+}
+
+/* ------------------------------------------------------ */
+
+gnc_numeric
+gnc_convert_from_euro(const gnc_commodity * currency, gnc_numeric value)
+{
+    gnc_euro_rate_struct * result;
+
+    if (currency == NULL)
+        return gnc_numeric_zero ();
+
+    if (!gnc_commodity_is_iso(currency))
+        return gnc_numeric_zero ();
+
+    result = bsearch(currency,
+                     gnc_euro_rates,
+                     sizeof(gnc_euro_rates) / sizeof(gnc_euro_rate_struct),
+                     sizeof(gnc_euro_rate_struct),
+                     gnc_euro_rate_compare);
+
+    if (result == NULL)
+        return gnc_numeric_zero ();
+
+    {
+        gnc_numeric rate;
+
+        rate = double_to_gnc_numeric (result->rate, 100000, GNC_HOW_RND_ROUND_HALF_UP);
+
+        /* EC Regulation 1103/97 states we should use "Round half away from zero"
+         * See http://europa.eu/legislation_summaries/economic_and_monetary_affairs/institutional_and_economic_framework/l25025_en.htm */
+        return gnc_numeric_mul (value, rate, gnc_commodity_get_fraction (currency),
+                                GNC_HOW_RND_ROUND_HALF_UP);
+    }
+}
+
+/* ------------------------------------------------------ */
+
+gnc_numeric
+gnc_euro_currency_get_rate (const gnc_commodity *currency)
+{
+    gnc_euro_rate_struct * result;
+
+    if (currency == NULL)
+        return gnc_numeric_zero ();
+
+    if (!gnc_commodity_is_iso(currency))
+        return gnc_numeric_zero ();
+
+    result = bsearch(currency,
+                     gnc_euro_rates,
+                     sizeof(gnc_euro_rates) / sizeof(gnc_euro_rate_struct),
+                     sizeof(gnc_euro_rate_struct),
+                     gnc_euro_rate_compare);
+
+    if (result == NULL)
+        return gnc_numeric_zero ();
+
+    return double_to_gnc_numeric (result->rate, GNC_DENOM_AUTO,
+                                  GNC_HOW_DENOM_SIGFIGS(6) | GNC_HOW_RND_ROUND_HALF_UP);
+}
+
+/* ------------------------------------------------------ */
+
+gnc_commodity *
+gnc_get_euro (void)
+{
+    gnc_commodity_table *table;
+
+    table = gnc_commodity_table_get_table (gnc_get_current_book ());
+
+    return gnc_commodity_table_lookup (table, GNC_COMMODITY_NS_CURRENCY, "EUR");
+}
diff --git a/src/app-utils/gnc-euro.h b/libgnucash/app-utils/gnc-euro.h
similarity index 100%
rename from src/app-utils/gnc-euro.h
rename to libgnucash/app-utils/gnc-euro.h
diff --git a/src/app-utils/gnc-exp-parser.c b/libgnucash/app-utils/gnc-exp-parser.c
similarity index 100%
rename from src/app-utils/gnc-exp-parser.c
rename to libgnucash/app-utils/gnc-exp-parser.c
diff --git a/src/app-utils/gnc-exp-parser.h b/libgnucash/app-utils/gnc-exp-parser.h
similarity index 100%
rename from src/app-utils/gnc-exp-parser.h
rename to libgnucash/app-utils/gnc-exp-parser.h
diff --git a/src/app-utils/gnc-gdate-utils.c b/libgnucash/app-utils/gnc-gdate-utils.c
similarity index 100%
rename from src/app-utils/gnc-gdate-utils.c
rename to libgnucash/app-utils/gnc-gdate-utils.c
diff --git a/src/app-utils/gnc-gdate-utils.h b/libgnucash/app-utils/gnc-gdate-utils.h
similarity index 100%
rename from src/app-utils/gnc-gdate-utils.h
rename to libgnucash/app-utils/gnc-gdate-utils.h
diff --git a/src/app-utils/gnc-gettext-util.c b/libgnucash/app-utils/gnc-gettext-util.c
similarity index 100%
rename from src/app-utils/gnc-gettext-util.c
rename to libgnucash/app-utils/gnc-gettext-util.c
diff --git a/src/app-utils/gnc-gettext-util.h b/libgnucash/app-utils/gnc-gettext-util.h
similarity index 100%
rename from src/app-utils/gnc-gettext-util.h
rename to libgnucash/app-utils/gnc-gettext-util.h
diff --git a/src/app-utils/gnc-gsettings.c b/libgnucash/app-utils/gnc-gsettings.c
similarity index 100%
rename from src/app-utils/gnc-gsettings.c
rename to libgnucash/app-utils/gnc-gsettings.c
diff --git a/src/app-utils/gnc-gsettings.h b/libgnucash/app-utils/gnc-gsettings.h
similarity index 100%
rename from src/app-utils/gnc-gsettings.h
rename to libgnucash/app-utils/gnc-gsettings.h
diff --git a/src/app-utils/gnc-help-utils.c b/libgnucash/app-utils/gnc-help-utils.c
similarity index 100%
rename from src/app-utils/gnc-help-utils.c
rename to libgnucash/app-utils/gnc-help-utils.c
diff --git a/src/app-utils/gnc-help-utils.h b/libgnucash/app-utils/gnc-help-utils.h
similarity index 100%
rename from src/app-utils/gnc-help-utils.h
rename to libgnucash/app-utils/gnc-help-utils.h
diff --git a/src/app-utils/gnc-helpers.c b/libgnucash/app-utils/gnc-helpers.c
similarity index 100%
rename from src/app-utils/gnc-helpers.c
rename to libgnucash/app-utils/gnc-helpers.c
diff --git a/src/app-utils/gnc-helpers.h b/libgnucash/app-utils/gnc-helpers.h
similarity index 100%
rename from src/app-utils/gnc-helpers.h
rename to libgnucash/app-utils/gnc-helpers.h
diff --git a/libgnucash/app-utils/gnc-prefs-utils.c b/libgnucash/app-utils/gnc-prefs-utils.c
new file mode 100644
index 0000000..a633825
--- /dev/null
+++ b/libgnucash/app-utils/gnc-prefs-utils.c
@@ -0,0 +1,126 @@
+/********************************************************************\
+ * gnc-prefs-utils.c -- utility functions for preferences management*
+ * Copyright (C) 2013 Geert Janssens <geert at kobaltwit.be>           *
+ *                                                                  *
+ * 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 at gnu.org                   *
+ *                                                                  *
+\********************************************************************/
+
+#include "config.h"
+
+#include "gnc-gsettings.h"
+#include "gnc-prefs-utils.h"
+#include "gnc-prefs.h"
+#include "xml/gnc-backend-xml.h"
+
+static QofLogModule log_module = G_LOG_DOMAIN;
+
+/* Keys used for core preferences */
+#define GNC_PREF_FILE_COMPRESSION    "file-compression"
+#define GNC_PREF_RETAIN_TYPE_NEVER   "retain-type-never"
+#define GNC_PREF_RETAIN_TYPE_DAYS    "retain-type-days"
+#define GNC_PREF_RETAIN_TYPE_FOREVER "retain-type-forever"
+#define GNC_PREF_RETAIN_DAYS         "retain-days"
+
+/***************************************************************
+ * Initialization                                              *
+ ***************************************************************/
+static void
+file_retain_changed_cb(gpointer gsettings, gchar *key, gpointer user_data)
+{
+    if (gnc_prefs_is_set_up())
+    {
+        gint days = (int)gnc_prefs_get_float(GNC_PREFS_GROUP_GENERAL, GNC_PREF_RETAIN_DAYS);
+        gnc_prefs_set_file_retention_days (days);
+    }
+}
+
+static void
+file_retain_type_changed_cb(gpointer gsettings, gchar *key, gpointer user_data)
+{
+    XMLFileRetentionType type = XML_RETAIN_ALL;
+
+    if (gnc_prefs_is_set_up())
+    {
+        if (gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL, GNC_PREF_RETAIN_TYPE_NEVER))
+            type = XML_RETAIN_NONE;
+        else if (gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL, GNC_PREF_RETAIN_TYPE_DAYS))
+            type = XML_RETAIN_DAYS;
+        else if (!gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL, GNC_PREF_RETAIN_TYPE_FOREVER))
+            PWARN("no file retention policy was set, assuming conservative policy 'forever'");
+
+        gnc_prefs_set_file_retention_policy (type);
+    }
+}
+
+static void
+file_compression_changed_cb(gpointer gsettings, gchar *key, gpointer user_data)
+{
+    if (gnc_prefs_is_set_up())
+    {
+        gboolean file_compression = gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL, GNC_PREF_FILE_COMPRESSION);
+        gnc_prefs_set_file_save_compressed (file_compression);
+    }
+}
+
+
+void gnc_prefs_init (void)
+{
+    gnc_gsettings_load_backend();
+
+    /* Initialize the core preferences by reading their values from the loaded backend.
+     * Note: of no backend was loaded, these functions will return sane default values.
+     */
+    file_retain_changed_cb (NULL, NULL, NULL);
+    file_retain_type_changed_cb (NULL, NULL, NULL);
+    file_compression_changed_cb (NULL, NULL, NULL);
+
+    /* Check for invalid retain_type (days)/retain_days (0) combo.
+     * This can happen either because a user changed the preferences
+     * manually outside of GnuCash, or because the user upgraded from
+     * gnucash version 2.3.15 or older. Back then, 0 retain_days meant
+     * "keep forever". From 2.3.15 on this is controlled via a multiple
+     * choice ("retain_type").
+     * So if we find a 0 retain_days value with a "days" retain_type,
+     * we will silently and conservatively interpret is as meaning
+     * retain forever ("forever" retain_type).
+     */
+    if ( (gnc_prefs_get_file_retention_policy () == XML_RETAIN_DAYS) &&
+            (gnc_prefs_get_file_retention_days () == 0 ) )
+    {
+        gnc_prefs_set_file_retention_policy (XML_RETAIN_ALL);
+        gnc_prefs_set_file_retention_days (30);
+        gnc_prefs_set_bool (GNC_PREFS_GROUP_GENERAL, GNC_PREF_RETAIN_TYPE_FOREVER, TRUE);
+        gnc_prefs_set_float (GNC_PREFS_GROUP_GENERAL, GNC_PREF_RETAIN_DAYS, 30);
+        PWARN("retain 0 days policy was set, but this is probably not what the user wanted,\n"
+              "assuming conservative policy 'forever'");
+    }
+
+    /* Add hooks to update core preferences whenever the associated preference changes */
+    gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL, GNC_PREF_RETAIN_DAYS,
+                           file_retain_changed_cb, NULL);
+    gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL, GNC_PREF_RETAIN_TYPE_NEVER,
+                           file_retain_type_changed_cb, NULL);
+    gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL, GNC_PREF_RETAIN_TYPE_DAYS,
+                           file_retain_type_changed_cb, NULL);
+    gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL, GNC_PREF_RETAIN_TYPE_FOREVER,
+                           file_retain_type_changed_cb, NULL);
+    gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL, GNC_PREF_FILE_COMPRESSION,
+                           file_compression_changed_cb, NULL);
+
+}
diff --git a/src/app-utils/gnc-prefs-utils.h b/libgnucash/app-utils/gnc-prefs-utils.h
similarity index 100%
rename from src/app-utils/gnc-prefs-utils.h
rename to libgnucash/app-utils/gnc-prefs-utils.h
diff --git a/src/app-utils/gnc-state.c b/libgnucash/app-utils/gnc-state.c
similarity index 100%
rename from src/app-utils/gnc-state.c
rename to libgnucash/app-utils/gnc-state.c
diff --git a/src/app-utils/gnc-state.h b/libgnucash/app-utils/gnc-state.h
similarity index 100%
rename from src/app-utils/gnc-state.h
rename to libgnucash/app-utils/gnc-state.h
diff --git a/src/app-utils/gnc-sx-instance-model.c b/libgnucash/app-utils/gnc-sx-instance-model.c
similarity index 100%
rename from src/app-utils/gnc-sx-instance-model.c
rename to libgnucash/app-utils/gnc-sx-instance-model.c
diff --git a/src/app-utils/gnc-sx-instance-model.h b/libgnucash/app-utils/gnc-sx-instance-model.h
similarity index 100%
rename from src/app-utils/gnc-sx-instance-model.h
rename to libgnucash/app-utils/gnc-sx-instance-model.h
diff --git a/src/app-utils/gnc-ui-balances.c b/libgnucash/app-utils/gnc-ui-balances.c
similarity index 100%
rename from src/app-utils/gnc-ui-balances.c
rename to libgnucash/app-utils/gnc-ui-balances.c
diff --git a/src/app-utils/gnc-ui-balances.h b/libgnucash/app-utils/gnc-ui-balances.h
similarity index 100%
rename from src/app-utils/gnc-ui-balances.h
rename to libgnucash/app-utils/gnc-ui-balances.h
diff --git a/libgnucash/app-utils/gnc-ui-util.c b/libgnucash/app-utils/gnc-ui-util.c
new file mode 100644
index 0000000..739465d
--- /dev/null
+++ b/libgnucash/app-utils/gnc-ui-util.c
@@ -0,0 +1,2457 @@
+/********************************************************************\
+ * gnc-ui-util.c -- utility functions for the GnuCash UI            *
+ * Copyright (C) 2000 Dave Peticolas <dave at krondo.com>              *
+ *                                                                  *
+ * 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 at gnu.org                   *
+\********************************************************************/
+
+#include "config.h"
+
+#ifdef __MINGW32__
+#define __USE_MINGW_ANSI_STDIO 1
+#endif
+#include "gnc-ui-util.h"
+#include <glib.h>
+#include <glib/gi18n.h>
+#include <gio/gio.h>
+#include <libguile.h>
+#include <ctype.h>
+#include <errno.h>
+#include <limits.h>
+#include <locale.h>
+#include <math.h>
+#if defined(G_OS_WIN32) && !defined(_MSC_VER)
+# include <pow.h>
+#endif
+#include <stdarg.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+
+#include "qof.h"
+#include "guile-mappings.h"
+#include "gnc-prefs.h"
+#include "gnc-module.h"
+#include "Account.h"
+#include "Transaction.h"
+#include "gnc-engine.h"
+#include "gnc-euro.h"
+#include "gnc-hooks.h"
+#include "gnc-session.h"
+#include "engine-helpers.h"
+#include "gnc-locale-utils.h"
+#include "gnc-component-manager.h"
+#include "gnc-features.h"
+#include "gnc-guile-utils.h"
+
+#define GNC_PREF_CURRENCY_CHOICE_LOCALE "currency-choice-locale"
+#define GNC_PREF_CURRENCY_CHOICE_OTHER  "currency-choice-other"
+#define GNC_PREF_CURRENCY_OTHER         "currency-other"
+#define GNC_PREF_REVERSED_ACCTS_NONE    "reversed-accounts-none"
+#define GNC_PREF_REVERSED_ACCTS_CREDIT  "reversed-accounts-credit"
+#define GNC_PREF_REVERSED_ACCTS_INC_EXP "reversed-accounts-incomeexpense"
+
+static QofLogModule log_module = GNC_MOD_GUI;
+
+static gboolean auto_decimal_enabled = FALSE;
+static int auto_decimal_places = 2;    /* default, can be changed */
+
+static gboolean reverse_balance_inited = FALSE;
+static gboolean reverse_type[NUM_ACCOUNT_TYPES];
+
+/* Cache currency ISO codes and only look them up in the settings when
+ * absolutely necessary. Can't cache a pointer to the data structure
+ * as that will change any time the book changes. */
+static gchar *user_default_currency = NULL;
+static gchar *user_report_currency = NULL;
+
+gchar *gnc_normalize_account_separator (const gchar* separator)
+{
+    gchar *new_sep=NULL;
+
+    if (!separator || !*separator || g_strcmp0(separator, "colon") == 0)
+            new_sep = g_strdup (":");
+        else if (g_strcmp0(separator, "slash") == 0)
+            new_sep = g_strdup ("/");
+        else if (g_strcmp0(separator, "backslash") == 0)
+            new_sep = g_strdup ("\\");
+        else if (g_strcmp0(separator, "dash") == 0)
+            new_sep = g_strdup ("-");
+        else if (g_strcmp0(separator, "period") == 0)
+            new_sep = g_strdup (".");
+        else
+            new_sep = g_strdup (separator);
+
+    return new_sep;
+}
+/********************************************************************\
+ * gnc_configure_account_separator                                  *
+ *   updates the current account separator character                *
+ *                                                                  *
+ * Args: none                                                       *
+ \*******************************************************************/
+static void
+gnc_configure_account_separator (void)
+{
+    gchar *separator;
+    char *string;
+
+    string = gnc_prefs_get_string(GNC_PREFS_GROUP_GENERAL, GNC_PREF_ACCOUNT_SEPARATOR);
+    separator = gnc_normalize_account_separator (string);
+
+    gnc_set_account_separator(separator);
+
+    g_free(string);
+    g_free(separator);
+}
+
+
+static void
+gnc_configure_reverse_balance (void)
+{
+    gint i;
+
+    for (i = 0; i < NUM_ACCOUNT_TYPES; i++)
+        reverse_type[i] = FALSE;
+
+    if (gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL, GNC_PREF_REVERSED_ACCTS_INC_EXP))
+    {
+        reverse_type[ACCT_TYPE_INCOME]  = TRUE;
+        reverse_type[ACCT_TYPE_EXPENSE] = TRUE;
+    }
+    else if (gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL, GNC_PREF_REVERSED_ACCTS_CREDIT))
+    {
+        reverse_type[ACCT_TYPE_LIABILITY] = TRUE;
+        reverse_type[ACCT_TYPE_PAYABLE]   = TRUE;
+        reverse_type[ACCT_TYPE_EQUITY]    = TRUE;
+        reverse_type[ACCT_TYPE_INCOME]    = TRUE;
+        reverse_type[ACCT_TYPE_CREDIT]    = TRUE;
+    }
+    else if (!gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL, GNC_PREF_REVERSED_ACCTS_NONE))
+        PWARN("no reversed account preference set, using none");
+
+}
+
+static void
+gnc_reverse_balance_init (void)
+{
+    gnc_configure_reverse_balance ();
+    reverse_balance_inited = TRUE;
+}
+
+gboolean
+gnc_reverse_balance (const Account *account)
+{
+    int type;
+
+    if (account == NULL)
+        return FALSE;
+
+    type = xaccAccountGetType (account);
+    if ((type < 0) || (type >= NUM_ACCOUNT_TYPES))
+        return FALSE;
+
+    if (!reverse_balance_inited)
+        gnc_reverse_balance_init ();
+
+    return reverse_type[type];
+}
+
+
+gchar *
+gnc_get_default_directory (const gchar *section)
+{
+    gchar *dir;
+
+    dir = gnc_prefs_get_string (section, GNC_PREF_LAST_PATH);
+    if (!dir)
+#ifdef G_OS_WIN32
+        dir = g_strdup (g_get_user_data_dir ()); /* equivalent of "My Documents" */
+#else
+        dir = g_strdup (g_get_home_dir ());
+#endif
+
+    return dir;
+}
+
+void
+gnc_set_default_directory (const gchar *section, const gchar *directory)
+{
+    gnc_prefs_set_string(section, GNC_PREF_LAST_PATH, directory);
+}
+
+QofBook *
+gnc_get_current_book (void)
+{
+    return qof_session_get_book (gnc_get_current_session ());
+}
+
+/* If there is no current session, there is no book and we must be dealing
+ * with a new book. When gnucash is started with --nofile, there is
+ * initially no session (and no book), but by the time we check, one
+ * could have been created (for example, if an empty account tree tab is
+ * opened, a session is created which creates a new, but empty, book).
+ * A session is created and a book is loaded from a backend when gnucash is
+ * started with a file, but selecting 'new file' keeps a session open. So we
+ * need to check as well for a book with no accounts (root with no children). */
+gboolean
+gnc_is_new_book (void)
+{
+    return ((!gnc_current_session_exist() ||
+                            (gnc_current_session_exist() &&
+                                !gnc_account_get_children(
+                                    gnc_book_get_root_account(
+                                        gnc_get_current_book()))))
+                            ? TRUE : FALSE);
+}
+
+#define OPTION_TAXUS_NAME "book/tax_US/name"
+#define OPTION_TAXUS_TYPE "book/tax_US/type"
+
+void
+gnc_set_current_book_tax_name (const gchar *tax_name)
+{
+    qof_book_set_string_option(gnc_get_current_book(), OPTION_TAXUS_NAME, tax_name);
+}
+
+const gchar *
+gnc_get_current_book_tax_name (void)
+{
+    return qof_book_get_string_option(gnc_get_current_book(), OPTION_TAXUS_NAME);
+}
+
+void
+gnc_set_current_book_tax_type (const gchar *tax_type)
+{
+    qof_book_set_string_option(gnc_get_current_book(), OPTION_TAXUS_TYPE, tax_type);
+}
+
+const gchar *
+gnc_get_current_book_tax_type (void)
+{
+    return qof_book_get_string_option(gnc_get_current_book(), OPTION_TAXUS_TYPE);
+}
+
+/** Calls gnc_book_option_num_field_source_change to initiate registered
+  * callbacks when num_field_source book option changes so that
+  * registers/reports can update themselves; sets feature flag */
+void
+gnc_book_option_num_field_source_change_cb (gboolean num_action)
+{
+    gnc_suspend_gui_refresh ();
+    if (num_action)
+    {
+    /* Set a feature flag in the book for use of the split action field as number.
+     * This will prevent older GnuCash versions that don't support this feature
+     * from opening this file. */
+        gnc_features_set_used (gnc_get_current_book(),
+                                                GNC_FEATURE_NUM_FIELD_SOURCE);
+    }
+    gnc_book_option_num_field_source_change (num_action);
+    gnc_resume_gui_refresh ();
+}
+
+/** Calls gnc_book_option_book_currency_selected to initiate registered
+  * callbacks when currency accounting book option changes to book-currency so
+  * that registers/reports can update themselves; sets feature flag */
+void
+gnc_book_option_book_currency_selected_cb (gboolean use_book_currency)
+{
+    gnc_suspend_gui_refresh ();
+    if (use_book_currency)
+    {
+    /* Set a feature flag in the book for use of book currency. This will
+     * prevent older GnuCash versions that don't support this feature from
+     * opening this file. */
+        gnc_features_set_used (gnc_get_current_book(),
+                                GNC_FEATURE_BOOK_CURRENCY);
+    }
+    gnc_book_option_book_currency_selected (use_book_currency);
+    gnc_resume_gui_refresh ();
+}
+
+/** Returns TRUE if both book-currency and default gain/loss policy KVPs exist
+  * and are valid and trading accounts are not used. */
+gboolean
+gnc_book_use_book_currency (QofBook *book)
+{
+    const gchar *policy;
+    const gchar *currency;
+
+    if (!book) return FALSE;
+
+    policy = qof_book_get_default_gains_policy (book);
+    currency = qof_book_get_book_currency_name (book);
+
+    /* If either a default gain/loss policy or a book-currency does not exist,
+       book-currency accounting method not valid */
+    if (!policy || !currency)
+       return FALSE;
+
+    /* If both exist, both must be valid */
+    if (!gnc_valid_policy_name (policy) || !gnc_commodity_table_lookup
+                                            (gnc_commodity_table_get_table
+                                              (gnc_get_current_book()),
+                                                GNC_COMMODITY_NS_CURRENCY,
+                                                 currency))
+       return FALSE;
+
+    /* If both exist and are valid, there must be no trading accounts flag */
+    if (qof_book_use_trading_accounts (book))
+       return FALSE;
+
+    return TRUE;
+}
+
+/** Returns pointer to Book Currency name for book or NULL; determines
+  * that both book-currency and default gain/loss policy KVPs exist and that
+  * both are valid, a requirement for the 'book-currency' currency accounting
+  * method to apply. */
+const gchar *
+gnc_book_get_book_currency_name (QofBook *book)
+{
+    if (!book) return NULL;
+
+    if (gnc_book_use_book_currency (book))
+        return qof_book_get_book_currency_name (book);
+
+    return NULL;
+}
+
+/** Returns pointer to Book Currency for book or NULL; determines
+  * that both book-currency and default gain/loss policy KVPs exist and that
+  * both are valid, a requirement for the 'book-currency' currency accounting
+  * method to apply. */
+gnc_commodity *
+gnc_book_get_book_currency (QofBook *book)
+{
+    if (!book) return NULL;
+
+    if (gnc_book_use_book_currency (book))
+        return gnc_commodity_table_lookup
+                    (gnc_commodity_table_get_table(book),
+                     GNC_COMMODITY_NS_CURRENCY,
+                     qof_book_get_book_currency_name (book));
+
+    return NULL;
+}
+
+/** Returns pointer to default gain/loss policy for book or NULL; determines
+  * that both book-currency and default gain/loss policy KVPs exist and that
+  * both are valid, a requirement for the 'book-currency' currency accounting
+  * method to apply. */
+const gchar *
+gnc_book_get_default_gains_policy (QofBook *book)
+{
+    if (!book) return NULL;
+
+    if (gnc_book_use_book_currency (book))
+        return qof_book_get_default_gains_policy (book);
+
+    return NULL;
+}
+
+/** Returns pointer to default gain/loss account for book or NULL; determines
+  * that both book-currency and default gain/loss policy KVPs exist and that
+  * both are valid, a requirement for the 'book-currency' currency accounting
+  * method to apply. Also, account must not be hidden or a placeholder, and
+  * must be of same currency as book-currency and income or expense type */
+Account *
+gnc_book_get_default_gain_loss_acct (QofBook *book)
+{
+    Account *gains_account = NULL;
+
+    if (!book) return NULL;
+
+    if (gnc_book_use_book_currency (book))
+        gains_account = xaccAccountLookup
+                        (qof_book_get_default_gain_loss_acct_guid (book), book);
+
+    if (gains_account &&
+        !xaccAccountGetPlaceholder(gains_account) &&
+        !xaccAccountGetHidden(gains_account) &&
+        (gnc_commodity_equal(xaccAccountGetCommodity(gains_account),
+                                    gnc_book_get_book_currency(book))) &&
+        ((xaccAccountGetType(gains_account) == ACCT_TYPE_INCOME) ||
+            (xaccAccountGetType(gains_account) == ACCT_TYPE_EXPENSE)))
+    {
+        return gains_account;
+    }
+    else
+    {
+        return NULL;
+    }
+}
+
+Account *
+gnc_get_current_root_account (void)
+{
+    return gnc_book_get_root_account (gnc_get_current_book ());
+}
+
+gnc_commodity_table *
+gnc_get_current_commodities (void)
+{
+    return gnc_commodity_table_get_table (gnc_get_current_book ());
+}
+
+gchar *
+gnc_get_account_name_for_register(const Account *account)
+{
+    gboolean show_leaf_accounts;
+    show_leaf_accounts = gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL_REGISTER,
+                                            GNC_PREF_SHOW_LEAF_ACCT_NAMES);
+
+    if (show_leaf_accounts)
+        return g_strdup (xaccAccountGetName (account));
+    else
+        return gnc_account_get_full_name (account);
+}
+
+Account *
+gnc_account_lookup_for_register(const Account *base_account, const char *name)
+{
+    gboolean show_leaf_accounts;
+    show_leaf_accounts = gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL_REGISTER,
+                                            GNC_PREF_SHOW_LEAF_ACCT_NAMES);
+
+    if (show_leaf_accounts)
+        return gnc_account_lookup_by_name (base_account, name);
+    else
+        return gnc_account_lookup_by_full_name (base_account, name);
+}
+
+
+/* Caller is responsible for g_free'ing returned memory */
+char *
+gnc_ui_account_get_tax_info_string (const Account *account)
+{
+    static SCM get_form = SCM_UNDEFINED;
+    static SCM get_desc = SCM_UNDEFINED;
+
+    gboolean tax_related = FALSE;
+    const char *code;
+
+    if (!account)
+        return NULL;
+
+    tax_related = xaccAccountGetTaxRelated (account);
+    code = xaccAccountGetTaxUSCode (account);
+
+    if (!code)
+    {
+        if (!tax_related)
+            return NULL;
+        /* tax_related && !code */
+        else
+            /* Translators: This and the following strings appear on
+             * the account tab if the Tax Info column is displayed,
+             * i.e. if the user wants to record the tax form number
+             * and location on that tax form which corresponds to this
+             * gnucash account. For the US Income Tax support in
+             * gnucash, each tax code that can be assigned to an
+             * account generally corresponds to a specific line number
+             * on a paper form and each form has a unique
+             * identification (e.g., Form 1040, Schedule A). */
+            return g_strdup (_("Tax-related but has no tax code"));
+    }
+    else  /* with tax code */
+    {
+        const gchar *tax_type;
+        GNCAccountType atype;
+        SCM tax_entity_type;
+        SCM category;
+        gchar *num_code = NULL;
+        const gchar *prefix = "N";
+        gchar *return_string = NULL;
+
+        tax_type = gnc_get_current_book_tax_type ();
+        if (tax_type == NULL || (g_strcmp0 (tax_type, "") == 0))
+            return g_strdup (_("Tax entity type not specified"));
+
+        atype = xaccAccountGetType (account);
+        tax_entity_type = scm_from_utf8_string (tax_type);
+
+        if (get_form == SCM_UNDEFINED)
+        {
+            GNCModule module;
+            const gchar *tax_module;
+            /* load the tax info */
+#ifdef LOCALE_SPECIFIC_TAX
+            /* This is a very simple hack that loads the (new, special) German
+               tax definition file in a German locale, or (default) loads the
+               previous US tax file. */
+# ifdef G_OS_WIN32
+            gchar *thislocale = g_win32_getlocale();
+            gboolean is_de_DE = (strncmp(thislocale, "de_DE", 5) == 0);
+            g_free(thislocale);
+# else /* !G_OS_WIN32 */
+            const char *thislocale = setlocale(LC_ALL, NULL);
+            gboolean is_de_DE = (strncmp(thislocale, "de_DE", 5) == 0);
+# endif /* G_OS_WIN32 */
+#else /* LOCALE_SPECIFIC_TAX */
+            gboolean is_de_DE = FALSE;
+#endif /* LOCALE_SPECIFIC_TAX */
+            tax_module = is_de_DE ?
+                         "gnucash/tax/de_DE" :
+                         "gnucash/tax/us";
+
+            module = gnc_module_load ((char *)tax_module, 0);
+
+            g_return_val_if_fail (module, NULL);
+
+            get_form = scm_c_eval_string
+                       ("(false-if-exception gnc:txf-get-form)");
+            get_desc = scm_c_eval_string
+                       ("(false-if-exception gnc:txf-get-description)");
+        }
+
+        g_return_val_if_fail (scm_is_procedure (get_form), NULL);
+        g_return_val_if_fail (scm_is_procedure (get_desc), NULL);
+
+        category = scm_c_eval_string (atype == ACCT_TYPE_INCOME ?
+                                      "txf-income-categories" :
+                                      (atype == ACCT_TYPE_EXPENSE ?
+                                       "txf-expense-categories" :
+                                       (((atype == ACCT_TYPE_BANK)      ||
+                                         (atype == ACCT_TYPE_CASH)      ||
+                                         (atype == ACCT_TYPE_ASSET)     ||
+                                         (atype == ACCT_TYPE_STOCK)     ||
+                                         (atype == ACCT_TYPE_MUTUAL)    ||
+                                         (atype == ACCT_TYPE_RECEIVABLE)) ?
+                                        "txf-asset-categories" :
+                                        (((atype == ACCT_TYPE_CREDIT)    ||
+                                          (atype == ACCT_TYPE_LIABILITY) ||
+                                          (atype == ACCT_TYPE_EQUITY)    ||
+                                          (atype == ACCT_TYPE_PAYABLE)) ?
+                                         "txf-liab-eq-categories" : ""))));
+
+        if (g_str_has_prefix (code, prefix))
+        {
+            const gchar *num_code_tmp;
+            num_code_tmp = g_strdup (code);
+            num_code_tmp++; /* to lose the leading N */
+            num_code = g_strdup (num_code_tmp);
+            num_code_tmp--;
+            g_free ((gpointer *) num_code_tmp);
+        }
+        else
+        {
+            num_code = g_strdup (code);
+        }
+
+        if (category == SCM_UNDEFINED)
+        {
+            if (tax_related)
+                return_string = g_strdup_printf
+                                (_("Tax type %s: invalid code %s for account type"),
+                                 tax_type, num_code);
+            else
+                return_string = g_strdup_printf
+                                (_("Not tax-related; tax type %s: invalid code %s for account type"),
+                                 tax_type, num_code);
+        }
+        else
+        {
+            SCM code_scm;
+            SCM form_scm;
+            code_scm = scm_from_locale_symbol (code);
+            form_scm = scm_call_3 (get_form, category, code_scm, tax_entity_type);
+            if (!scm_is_string (form_scm))
+            {
+                if (tax_related)
+                    return_string =  g_strdup_printf
+                                     (_("Invalid code %s for tax type %s"),
+                                      num_code, tax_type);
+                else
+                    return_string =  g_strdup_printf
+                                     (_("Not tax-related; invalid code %s for tax type %s"),
+                                      num_code, tax_type);
+            }
+            else
+            {
+                gchar *form = NULL;
+
+                /* Note: using scm_to_utf8_string directly here instead
+                   of our wrapper gnc_scm_to_utf8_string. 'form' should
+                   be freed with 'free' instead of 'g_free'. This will
+                   be taken care of automatically during scm_dynwind_end,
+                   because we inform guile of this memory allocation via
+                   scm_dynwind_free a little further. */
+                form = scm_to_utf8_string (form_scm);
+                if (!form)
+                {
+                    if (tax_related)
+                        return_string = g_strdup_printf
+                                        (_("No form: code %s, tax type %s"), num_code,
+                                         tax_type);
+                    else
+                        return_string = g_strdup_printf
+                                        (_("Not tax-related; no form: code %s, tax type %s"),
+                                         num_code, tax_type);
+                }
+                else
+                {
+                    SCM desc_scm;
+
+                    /* Create a dynwind context because we will be calling (scm) functions
+                       that potentially exit non-locally */
+                    scm_dynwind_begin (0);
+                    scm_dynwind_free (form);
+                    desc_scm = scm_call_3 (get_desc, category, code_scm,
+                                           tax_entity_type);
+                    if (!scm_is_string (desc_scm))
+                    {
+                        if (tax_related)
+                            return_string = g_strdup_printf
+                                            (_("No description: form %s, code %s, tax type %s"),
+                                             form, num_code, tax_type);
+                        else
+                            return_string = g_strdup_printf
+                                            (_("Not tax-related; no description: form %s, code %s, tax type %s"),
+                                             form, num_code, tax_type);
+                    }
+                    else
+                    {
+                        gchar *desc = NULL;
+                        desc = gnc_scm_to_utf8_string (desc_scm);
+                        if (!desc)
+                        {
+                            if (tax_related)
+                                return_string = g_strdup_printf
+                                                (_("No description: form %s, code %s, tax type %s"),
+                                                 form, num_code, tax_type);
+                            else
+                                return_string = g_strdup_printf
+                                                (_("Not tax-related; no description: form %s, code %s, tax type %s"),
+                                                 form, num_code, tax_type);
+                        }
+                        else
+                        {
+                            gint64 copy_number;
+                            gchar *copy_txt = NULL;
+                            copy_number = xaccAccountGetTaxUSCopyNumber (account);
+                            copy_txt = (copy_number == 1) ?
+                                       g_strdup ("") :
+                                       g_strdup_printf ("(%d)",
+                                                        (gint) copy_number);
+                            if (tax_related)
+                            {
+                                if (g_strcmp0 (form, "") == 0)
+                                    return_string = g_strdup_printf ("%s", desc);
+                                else
+                                    return_string = g_strdup_printf ("%s%s: %s",
+                                                                     form, copy_txt, desc);
+                            }
+                            else
+                            {
+                                return_string = g_strdup_printf
+                                                (_("Not tax-related; %s%s: %s (code %s, tax type %s)"),
+                                                 form, copy_txt, desc, num_code, tax_type);
+                            }
+                            g_free (copy_txt);
+                        }
+                        g_free (desc);
+                    }
+                    scm_dynwind_end ();
+                }
+            }
+        }
+        g_free (num_code);
+        return return_string;
+    }
+}
+
+/* Caller is responsible for g_free'ing returned memory */
+char *
+gnc_ui_account_get_tax_info_sub_acct_string (const Account *account)
+{
+    GList *descendant, *account_descendants;
+
+    if (!account)
+        return NULL;
+
+    account_descendants = gnc_account_get_descendants (account);
+    if (account_descendants)
+    {
+        gint sub_acct_tax_number = 0;
+        for (descendant = account_descendants; descendant;
+                descendant = g_list_next(descendant))
+        {
+            if (xaccAccountGetTaxRelated (descendant->data))
+                sub_acct_tax_number++;
+        }
+        g_list_free (account_descendants);
+        g_list_free (descendant);
+        /* Translators: This and the following strings appear on
+         * the account tab if the Tax Info column is displayed,
+         * i.e. if the user wants to record the tax form number
+         * and location on that tax form which corresponds to this
+         * gnucash account. For the US Income Tax support in
+         * gnucash, each tax code that can be assigned to an
+         * account generally corresponds to a specific line number
+         * on a paper form and each form has a unique
+         * identification (e.g., Form 1040, Schedule A). */
+        return (sub_acct_tax_number == 0) ? NULL :
+               g_strdup_printf (_("(Tax-related subaccounts: %d)"),
+                                sub_acct_tax_number);
+    }
+    else
+        return NULL;
+}
+
+static const char *
+string_after_colon (const char *msgstr)
+{
+    const char *string_at_colon;
+    g_assert(msgstr);
+    string_at_colon = strchr(msgstr, ':');
+    if (string_at_colon)
+        return string_at_colon + 1;
+    else
+        /* No colon found; we assume the translation contains only the
+           part after the colon, similar to the disambiguation prefixes */
+        return msgstr;
+}
+
+/********************************************************************\
+ * gnc_get_reconcile_str                                            *
+ *   return the i18n'd string for the given reconciled flag         *
+ *                                                                  *
+ * Args: reconciled_flag - the flag to convert into a string        *
+ * Returns: the i18n'd reconciled string                            *
+\********************************************************************/
+const char *
+gnc_get_reconcile_str (char reconciled_flag)
+{
+    switch (reconciled_flag)
+    {
+    case NREC:
+        /* Translators: For the following strings, the single letters
+           after the colon are abbreviations of the word before the
+           colon. You should only translate the letter *after* the colon. */
+        return string_after_colon(_("not cleared:n"));
+    case CREC:
+        /* Translators: Please only translate the letter *after* the colon. */
+        return string_after_colon(_("cleared:c"));
+    case YREC:
+        /* Translators: Please only translate the letter *after* the colon. */
+        return string_after_colon(_("reconciled:y"));
+    case FREC:
+        /* Translators: Please only translate the letter *after* the colon. */
+        return string_after_colon(_("frozen:f"));
+    case VREC:
+        /* Translators: Please only translate the letter *after* the colon. */
+        return string_after_colon(_("void:v"));
+    default:
+        PERR("Bad reconciled flag\n");
+        return NULL;
+    }
+}
+
+/********************************************************************\
+ * gnc_get_reconcile_valid_flags                                    *
+ *   return a string containing the list of reconciled flags        *
+ *                                                                  *
+ * Returns: the i18n'd reconciled flags string                      *
+\********************************************************************/
+const char *
+gnc_get_reconcile_valid_flags (void)
+{
+    static const char flags[] = { NREC, CREC, YREC, FREC, VREC, 0 };
+    return flags;
+}
+
+/********************************************************************\
+ * gnc_get_reconcile_flag_order                                     *
+ *   return a string containing the reconciled-flag change order    *
+ *                                                                  *
+ * Args: reconciled_flag - the flag to convert into a string        *
+ * Returns: the i18n'd reconciled string                            *
+\********************************************************************/
+const char *
+gnc_get_reconcile_flag_order (void)
+{
+    static const char flags[] = { NREC, CREC, 0 };
+    return flags;
+}
+
+
+static const char *
+equity_base_name (GNCEquityType equity_type)
+{
+    switch (equity_type)
+    {
+    case EQUITY_OPENING_BALANCE:
+        return N_("Opening Balances");
+
+    case EQUITY_RETAINED_EARNINGS:
+        return N_("Retained Earnings");
+
+    default:
+        return NULL;
+    }
+}
+
+Account *
+gnc_find_or_create_equity_account (Account *root,
+                                   GNCEquityType equity_type,
+                                   gnc_commodity *currency)
+{
+    Account *parent;
+    Account *account;
+    gboolean name_exists;
+    gboolean base_name_exists;
+    const char *base_name;
+    char *name;
+
+    g_return_val_if_fail (equity_type >= 0, NULL);
+    g_return_val_if_fail (equity_type < NUM_EQUITY_TYPES, NULL);
+    g_return_val_if_fail (currency != NULL, NULL);
+    g_return_val_if_fail (root != NULL, NULL);
+
+    base_name = equity_base_name (equity_type);
+
+    account = gnc_account_lookup_by_name(root, base_name);
+    if (account && xaccAccountGetType (account) != ACCT_TYPE_EQUITY)
+        account = NULL;
+
+    if (!account)
+    {
+        base_name = base_name && *base_name ? _(base_name) : "";
+
+        account = gnc_account_lookup_by_name(root, base_name);
+        if (account && xaccAccountGetType (account) != ACCT_TYPE_EQUITY)
+            account = NULL;
+    }
+
+    base_name_exists = (account != NULL);
+
+    if (account &&
+            gnc_commodity_equiv (currency, xaccAccountGetCommodity (account)))
+        return account;
+
+    name = g_strconcat (base_name, " - ",
+                        gnc_commodity_get_mnemonic (currency), NULL);
+    account = gnc_account_lookup_by_name(root, name);
+    if (account && xaccAccountGetType (account) != ACCT_TYPE_EQUITY)
+        account = NULL;
+
+    name_exists = (account != NULL);
+
+    if (account &&
+            gnc_commodity_equiv (currency, xaccAccountGetCommodity (account)))
+        return account;
+
+    /* Couldn't find one, so create it */
+    if (name_exists && base_name_exists)
+    {
+        PWARN ("equity account with unexpected currency");
+        g_free (name);
+        return NULL;
+    }
+
+    if (!base_name_exists &&
+            gnc_commodity_equiv (currency, gnc_default_currency ()))
+    {
+        g_free (name);
+        name = g_strdup (base_name);
+    }
+
+    parent = gnc_account_lookup_by_name(root, _("Equity"));
+    if (!parent || xaccAccountGetType (parent) != ACCT_TYPE_EQUITY)
+        parent = root;
+    g_assert(parent);
+
+    account = xaccMallocAccount (gnc_account_get_book(root));
+
+    xaccAccountBeginEdit (account);
+
+    xaccAccountSetName (account, name);
+    xaccAccountSetType (account, ACCT_TYPE_EQUITY);
+    xaccAccountSetCommodity (account, currency);
+
+    xaccAccountBeginEdit (parent);
+    gnc_account_append_child (parent, account);
+    xaccAccountCommitEdit (parent);
+
+    xaccAccountCommitEdit (account);
+
+    g_free (name);
+
+    return account;
+}
+
+gboolean
+gnc_account_create_opening_balance (Account *account,
+                                    gnc_numeric balance,
+                                    time64 date,
+                                    QofBook *book)
+{
+    Account *equity_account;
+    Transaction *trans;
+    Split *split;
+
+    if (gnc_numeric_zero_p (balance))
+        return TRUE;
+
+    g_return_val_if_fail (account != NULL, FALSE);
+
+    equity_account =
+        gnc_find_or_create_equity_account (gnc_account_get_root(account),
+                                           EQUITY_OPENING_BALANCE,
+                                           xaccAccountGetCommodity (account));
+    if (!equity_account)
+        return FALSE;
+
+    xaccAccountBeginEdit (account);
+    xaccAccountBeginEdit (equity_account);
+
+    trans = xaccMallocTransaction (book);
+
+    xaccTransBeginEdit (trans);
+
+    xaccTransSetCurrency (trans, gnc_account_or_default_currency (account, NULL));
+    xaccTransSetDatePostedSecsNormalized (trans, date);
+    xaccTransSetDescription (trans, _("Opening Balance"));
+
+    split = xaccMallocSplit (book);
+
+    xaccTransAppendSplit (trans, split);
+    xaccAccountInsertSplit (account, split);
+
+    xaccSplitSetAmount (split, balance);
+    xaccSplitSetValue (split, balance);
+
+    balance = gnc_numeric_neg (balance);
+
+    split = xaccMallocSplit (book);
+
+    xaccTransAppendSplit (trans, split);
+    xaccAccountInsertSplit (equity_account, split);
+
+    xaccSplitSetAmount (split, balance);
+    xaccSplitSetValue (split, balance);
+
+    xaccTransCommitEdit (trans);
+    xaccAccountCommitEdit (equity_account);
+    xaccAccountCommitEdit (account);
+
+    return TRUE;
+}
+
+#if 0 /* Not Used */
+static void
+gnc_lconv_set_utf8 (char **p_value, char *default_value)
+{
+    char *value = *p_value;
+    *p_value = NULL;
+
+    if ((value == NULL) || (value[0] == 0))
+        value = default_value;
+
+#ifdef G_OS_WIN32
+    {
+        /* get number of resulting wide characters */
+        size_t count = mbstowcs (NULL, value, 0);
+        if (count > 0)
+        {
+            /* malloc and convert */
+            wchar_t *wvalue = g_malloc ((count + 1) * sizeof(wchar_t));
+            count = mbstowcs (wvalue, value, count + 1);
+            if (count > 0)
+            {
+                *p_value = g_utf16_to_utf8 (wvalue, -1, NULL, NULL, NULL);
+            }
+            g_free (wvalue);
+        }
+    }
+#else /* !G_OS_WIN32 */
+    *p_value = g_locale_to_utf8 (value, -1, NULL, NULL, NULL);
+#endif
+
+    if (*p_value == NULL)
+    {
+        // The g_locale_to_utf8 conversion failed. FIXME: Should we rather
+        // use an empty string instead of the default_value? Not sure.
+        *p_value = default_value;
+    }
+}
+
+static void
+gnc_lconv_set_char (char *p_value, char default_value)
+{
+    if ((p_value != NULL) && (*p_value == CHAR_MAX))
+        *p_value = default_value;
+}
+#endif /* Not Used */
+
+gnc_commodity *
+gnc_locale_default_currency_nodefault (void)
+{
+    gnc_commodity * currency;
+    gnc_commodity_table *table;
+    const char *code;
+
+    table = gnc_get_current_commodities ();
+    code = gnc_locale_default_iso_currency_code ();
+
+    currency = gnc_commodity_table_lookup (table, GNC_COMMODITY_NS_CURRENCY, code);
+
+    /* Some very old locales (notably on win32) still announce a euro
+       currency as default, although it has been replaced by EUR in
+       2001. We use EUR as default in that case, but the user can always
+       override from gsettings. */
+    if (gnc_is_euro_currency (currency))
+        currency = gnc_get_euro();
+
+    return (currency ? currency : NULL);
+}
+
+gnc_commodity *
+gnc_locale_default_currency (void)
+{
+    gnc_commodity * currency = gnc_locale_default_currency_nodefault ();
+
+    return (currency ? currency :
+            gnc_commodity_table_lookup (gnc_get_current_commodities (),
+                                        GNC_COMMODITY_NS_CURRENCY, "USD"));
+}
+
+
+static gnc_commodity *
+gnc_default_currency_common (gchar *requested_currency,
+                             const gchar *section)
+{
+    gnc_commodity *currency = NULL;
+    gchar  *mnemonic;
+
+    if (requested_currency)
+        return gnc_commodity_table_lookup(gnc_get_current_commodities(),
+                                          GNC_COMMODITY_NS_CURRENCY,
+                                          requested_currency);
+
+    if (gnc_book_use_book_currency (gnc_get_current_book ()))
+        return gnc_book_get_book_currency (gnc_get_current_book ());
+
+    if (gnc_prefs_get_bool (section, GNC_PREF_CURRENCY_CHOICE_OTHER))
+    {
+        mnemonic = gnc_prefs_get_string(section, GNC_PREF_CURRENCY_OTHER);
+        currency = gnc_commodity_table_lookup(gnc_get_current_commodities(),
+                                              GNC_COMMODITY_NS_CURRENCY, mnemonic);
+        DEBUG("mnemonic %s, result %p", mnemonic ? mnemonic : "(null)", currency);
+        g_free(mnemonic);
+    }
+
+    if (!currency)
+        currency = gnc_locale_default_currency ();
+    if (currency)
+    {
+        mnemonic = requested_currency;
+// ??? Does anyone know what this is supposed to be doing?
+//        requested_currency = g_strdup(gnc_commodity_get_mnemonic(currency));
+        g_free(mnemonic);
+    }
+    return currency;
+}
+
+gnc_commodity *
+gnc_default_currency (void)
+{
+    return gnc_default_currency_common (user_default_currency, GNC_PREFS_GROUP_GENERAL);
+}
+
+gnc_commodity * gnc_account_or_default_currency(const Account* account, gboolean * currency_from_account_found)
+{
+    gnc_commodity *currency;
+    if (!account)
+    {
+        if (currency_from_account_found)
+            *currency_from_account_found = FALSE;
+        return gnc_default_currency();
+    }
+
+    currency = gnc_account_get_currency_or_parent(account);
+    if (currency)
+    {
+        if (currency_from_account_found)
+            *currency_from_account_found = TRUE;
+    }
+    else
+    {
+        if (currency_from_account_found)
+            *currency_from_account_found = FALSE;
+        currency = gnc_default_currency();
+    }
+    return currency;
+}
+
+
+
+gnc_commodity *
+gnc_default_report_currency (void)
+{
+    return gnc_default_currency_common (user_report_currency, GNC_PREFS_GROUP_GENERAL_REPORT);
+}
+
+static void
+gnc_currency_changed_cb (GSettings *settings, gchar *key, gpointer user_data)
+{
+    user_default_currency = NULL;
+    user_report_currency = NULL;
+    gnc_hook_run(HOOK_CURRENCY_CHANGED, NULL);
+}
+
+
+GNCPrintAmountInfo
+gnc_default_print_info (gboolean use_symbol)
+{
+    static GNCPrintAmountInfo info;
+    static gboolean got_it = FALSE;
+    struct lconv *lc;
+
+    /* These must be updated each time. */
+    info.use_symbol = use_symbol ? 1 : 0;
+    info.commodity = gnc_default_currency ();
+
+    if (got_it)
+        return info;
+
+    lc = gnc_localeconv ();
+
+    info.max_decimal_places = lc->frac_digits;
+    info.min_decimal_places = lc->frac_digits;
+
+    info.use_separators = 1;
+    info.use_locale = 1;
+    info.monetary = 1;
+    info.force_fit = 0;
+    info.round = 0;
+
+    got_it = TRUE;
+
+    return info;
+}
+
+static gboolean
+is_decimal_fraction (int fraction, guint8 *max_decimal_places_p)
+{
+    guint8 max_decimal_places = 0;
+
+    if (fraction <= 0)
+        return FALSE;
+
+    while (fraction != 1)
+    {
+        if (fraction % 10 != 0)
+            return FALSE;
+
+        fraction = fraction / 10;
+        max_decimal_places += 1;
+    }
+
+    if (max_decimal_places_p)
+        *max_decimal_places_p = max_decimal_places;
+
+    return TRUE;
+}
+
+GNCPrintAmountInfo
+gnc_commodity_print_info (const gnc_commodity *commodity,
+                          gboolean use_symbol)
+{
+    GNCPrintAmountInfo info;
+    gboolean is_iso;
+
+    if (commodity == NULL)
+        return gnc_default_print_info (use_symbol);
+
+    info.commodity = commodity;
+
+    is_iso = gnc_commodity_is_iso (commodity);
+
+    if (is_decimal_fraction (gnc_commodity_get_fraction (commodity),
+                             &info.max_decimal_places))
+    {
+        if (is_iso)
+            info.min_decimal_places = info.max_decimal_places;
+        else
+            info.min_decimal_places = 0;
+    }
+    else
+        info.max_decimal_places = info.min_decimal_places = 0;
+
+    info.use_separators = 1;
+    info.use_symbol = use_symbol ? 1 : 0;
+    info.use_locale = is_iso ? 1 : 0;
+    info.monetary = 1;
+    info.force_fit = 0;
+    info.round = 0;
+
+    return info;
+}
+
+static GNCPrintAmountInfo
+gnc_account_print_info_helper(const Account *account, gboolean use_symbol,
+                              gnc_commodity * (*efffunc)(const Account *),
+                              int (*scufunc)(const Account*))
+{
+    GNCPrintAmountInfo info;
+    gboolean is_iso;
+    int scu;
+
+    if (account == NULL)
+        return gnc_default_print_info (use_symbol);
+
+    info.commodity = efffunc (account);
+
+    is_iso = gnc_commodity_is_iso (info.commodity);
+
+    scu = scufunc (account);
+
+    if (is_decimal_fraction (scu, &info.max_decimal_places))
+    {
+        if (is_iso)
+            info.min_decimal_places = info.max_decimal_places;
+        else
+            info.min_decimal_places = 0;
+    }
+    else
+        info.max_decimal_places = info.min_decimal_places = 0;
+
+    info.use_separators = 1;
+    info.use_symbol = use_symbol ? 1 : 0;
+    info.use_locale = is_iso ? 1 : 0;
+    info.monetary = 1;
+    info.force_fit = 0;
+    info.round = 0;
+
+    return info;
+}
+
+GNCPrintAmountInfo
+gnc_account_print_info (const Account *account, gboolean use_symbol)
+{
+    return gnc_account_print_info_helper(account, use_symbol,
+                                         xaccAccountGetCommodity,
+                                         xaccAccountGetCommoditySCU);
+}
+
+GNCPrintAmountInfo
+gnc_split_amount_print_info (Split *split, gboolean use_symbol)
+{
+    if (!split)
+    {
+        GNCPrintAmountInfo info = gnc_default_share_print_info ();
+        info.use_symbol = use_symbol;
+        return info;
+    }
+
+    return gnc_account_print_info (xaccSplitGetAccount (split), use_symbol);
+}
+
+static GNCPrintAmountInfo
+gnc_default_print_info_helper (int decplaces)
+{
+    GNCPrintAmountInfo info;
+
+    info.commodity = NULL;
+
+    info.max_decimal_places = decplaces;
+    info.min_decimal_places = 0;
+
+    info.use_separators = 1;
+    info.use_symbol = 0;
+    info.use_locale = 1;
+    info.monetary = 1;
+    info.force_fit = 0;
+    info.round = 0;
+
+    return info;
+}
+
+GNCPrintAmountInfo
+gnc_default_share_print_info (void)
+{
+    static GNCPrintAmountInfo info;
+    static gboolean got_it = FALSE;
+
+    if (!got_it)
+    {
+        info = gnc_default_print_info_helper (5);
+        got_it = TRUE;
+    }
+
+    return info;
+}
+
+GNCPrintAmountInfo
+gnc_share_print_info_places (int decplaces)
+{
+    GNCPrintAmountInfo info;
+
+    info = gnc_default_share_print_info ();
+    info.max_decimal_places = decplaces;
+    info.min_decimal_places = decplaces;
+    info.force_fit = 1;
+    info.round = 1;
+    return info;
+}
+
+GNCPrintAmountInfo
+gnc_default_price_print_info (void)
+{
+    static GNCPrintAmountInfo info;
+    static gboolean got_it = FALSE;
+
+    if (!got_it)
+    {
+        info = gnc_default_print_info_helper (6);
+        got_it = TRUE;
+    }
+
+    return info;
+}
+
+GNCPrintAmountInfo
+gnc_integral_print_info (void)
+{
+    static GNCPrintAmountInfo info;
+    static gboolean got_it = FALSE;
+
+    if (!got_it)
+    {
+        info = gnc_default_print_info_helper (0);
+        got_it = TRUE;
+    }
+
+    return info;
+}
+
+/* Utility function for printing non-negative amounts */
+static int
+PrintAmountInternal(char *buf, gnc_numeric val, const GNCPrintAmountInfo *info)
+{
+    struct lconv *lc = gnc_localeconv();
+    int num_whole_digits;
+    char temp_buf[128];
+    gnc_numeric whole, rounding;
+    int min_dp, max_dp;
+    gboolean value_is_negative, value_is_decimal;
+
+    g_return_val_if_fail (info != NULL, 0);
+
+    if (gnc_numeric_check (val))
+    {
+        PWARN ("Bad numeric: %s.",
+               gnc_numeric_errorCode_to_string(gnc_numeric_check (val)));
+        *buf = '\0';
+        return 0;
+    }
+
+    /* Print the absolute value, but remember sign */
+    value_is_negative = gnc_numeric_negative_p (val);
+    val = gnc_numeric_abs (val);
+
+    /* Try to print as decimal. */
+    value_is_decimal = gnc_numeric_to_decimal(&val, NULL);
+
+    /* Force at least auto_decimal_places zeros */
+    if (auto_decimal_enabled)
+    {
+        min_dp = MAX(auto_decimal_places, info->min_decimal_places);
+        max_dp = MAX(auto_decimal_places, info->max_decimal_places);
+    }
+    else
+    {
+        min_dp = info->min_decimal_places;
+        max_dp = info->max_decimal_places;
+    }
+
+    /* Don to limit the number of decimal places _UNLESS_ force_fit is
+     * true. */
+    if (!info->force_fit)
+        max_dp = 99;
+
+    /* rounding? -- can only ROUND if force_fit is also true */
+    if (value_is_decimal && info->round && info->force_fit)
+    {
+        rounding.num = 5; /* Limit the denom to 10^13 ~= 2^44, leaving max at ~524288 */
+        rounding.denom = pow(10, max_dp + 1);
+        val = gnc_numeric_add(val, rounding, val.denom,
+                              GNC_HOW_DENOM_EXACT | GNC_HOW_RND_TRUNC);
+
+        if (gnc_numeric_check(val))
+        {
+            PWARN ("Bad numeric from rounding: %s.",
+                   gnc_numeric_errorCode_to_string(gnc_numeric_check (val)));
+            *buf = '\0';
+            return 0;
+        }
+    }
+
+    /* calculate the integer part and the remainder */
+    whole = gnc_numeric_convert(val, 1, GNC_HOW_RND_TRUNC);
+    val = gnc_numeric_sub (val, whole, GNC_DENOM_AUTO, GNC_HOW_RND_NEVER);
+    if (gnc_numeric_check (val))
+    {
+        PWARN ("Problem with remainder: %s.",
+               gnc_numeric_errorCode_to_string(gnc_numeric_check (val)));
+        *buf = '\0';
+        return 0;
+    }
+
+    /* print the integer part without separators */
+    sprintf(temp_buf, "%" G_GINT64_FORMAT, whole.num);
+    num_whole_digits = strlen (temp_buf);
+
+    if (!info->use_separators)
+        strcpy (buf, temp_buf);
+    else
+    {
+        int group_count;
+        char *separator;
+        char *temp_ptr;
+        char *buf_ptr;
+        char *group;
+        gchar *rev_buf;
+
+        if (info->monetary)
+        {
+            separator = lc->mon_thousands_sep;
+            group = lc->mon_grouping;
+        }
+        else
+        {
+            separator = lc->thousands_sep;
+            group = lc->grouping;
+        }
+
+        buf_ptr = buf;
+        temp_ptr = &temp_buf[num_whole_digits - 1];
+        group_count = 0;
+
+        while (temp_ptr != temp_buf)
+        {
+            *buf_ptr++ = *temp_ptr--;
+
+            if (*group != CHAR_MAX)
+            {
+                group_count++;
+
+                if (group_count == *group)
+                {
+                    g_utf8_strncpy(buf_ptr, separator, 1);
+                    buf_ptr = g_utf8_find_next_char(buf_ptr, NULL);
+                    group_count = 0;
+
+                    /* Peek ahead at the next group code */
+                    switch (group[1])
+                    {
+                        /* A null char means repeat the last group indefinitely */
+                    case '\0':
+                        break;
+                        /* CHAR_MAX means no more grouping allowed */
+                    case CHAR_MAX:
+                        /* fall through */
+                        /* Anything else means another group size */
+                    default:
+                        group++;
+                        break;
+                    }
+                }
+            }
+        }
+
+        /* We built the string backwards, now reverse */
+        *buf_ptr++ = *temp_ptr;
+        *buf_ptr = '\0';
+        rev_buf = g_utf8_strreverse(buf, -1);
+        strcpy (buf, rev_buf);
+        g_free(rev_buf);
+    } /* endif */
+
+    /* at this point, buf contains the whole part of the number */
+
+    /* If it's not decimal, print the fraction as an expression. */
+    if (!value_is_decimal)
+    {
+        val = gnc_numeric_reduce (val);
+
+        if (val.denom > 0)
+            sprintf (temp_buf, "%" G_GINT64_FORMAT "/%" G_GINT64_FORMAT,
+                     val.num, val.denom);
+        else
+            sprintf (temp_buf, "%" G_GINT64_FORMAT " * %" G_GINT64_FORMAT,
+                     val.num, -val.denom);
+
+        if (whole.num == 0)
+            *buf = '\0';
+        else if (value_is_negative)
+            strcat(buf, " - ");
+        else
+            strcat(buf, " + ");
+
+        strcat (buf, temp_buf);
+    }
+    else
+    {
+        char *decimal_point;
+        guint8 num_decimal_places = 0;
+        char *temp_ptr = temp_buf;
+
+        decimal_point = info->monetary
+                        ? lc->mon_decimal_point
+                        : lc->decimal_point;
+        g_utf8_strncpy(temp_ptr, decimal_point, 1);
+        temp_ptr = g_utf8_find_next_char(temp_ptr, NULL);
+
+        while (!gnc_numeric_zero_p (val)
+                && (val.denom != 1)
+                && (num_decimal_places < max_dp))
+        {
+            gint64 digit;
+
+            val.denom = val.denom / 10;
+
+            digit = val.num / val.denom;
+
+            *temp_ptr++ = digit + '0';
+            num_decimal_places++;
+
+            val.num = val.num - (digit * val.denom);
+        }
+
+        while (num_decimal_places < min_dp)
+        {
+            *temp_ptr++ = '0';
+            num_decimal_places++;
+        }
+
+        /* cap the end and move to the last character */
+        *temp_ptr-- = '\0';
+
+        /* Here we strip off trailing decimal zeros per the argument. */
+        while (*temp_ptr == '0' && num_decimal_places > min_dp)
+        {
+            *temp_ptr-- = '\0';
+            num_decimal_places--;
+        }
+
+        if (num_decimal_places > max_dp)
+        {
+            PWARN ("max_decimal_places too small; limit %d, value %s%s",
+                   info->max_decimal_places, buf, temp_buf);
+        }
+
+        if (num_decimal_places > 0)
+            strcat (buf, temp_buf);
+    }
+
+    return strlen(buf);
+}
+
+/**
+ * @param bufp Should be at least 64 chars.
+ **/
+int
+xaccSPrintAmount (char * bufp, gnc_numeric val, GNCPrintAmountInfo info)
+{
+    struct lconv *lc;
+
+    char *orig_bufp = bufp;
+    const char *currency_symbol;
+    const char *sign;
+
+    char cs_precedes;
+    char sep_by_space;
+    char sign_posn;
+
+    gboolean print_sign = TRUE;
+    gboolean print_absolute = FALSE;
+
+    if (!bufp)
+        return 0;
+
+    lc = gnc_localeconv();
+    if (info.use_locale)
+        if (gnc_numeric_negative_p (val))
+        {
+            cs_precedes  = lc->n_cs_precedes;
+            sep_by_space = lc->n_sep_by_space;
+        }
+        else
+        {
+            cs_precedes  = lc->p_cs_precedes;
+            sep_by_space = lc->p_sep_by_space;
+        }
+    else
+    {
+        cs_precedes = TRUE;
+        sep_by_space = TRUE;
+    }
+
+    if (info.commodity && info.use_symbol)
+    {
+        currency_symbol = gnc_commodity_get_nice_symbol (info.commodity);
+        if (!gnc_commodity_is_iso (info.commodity))
+        {
+            cs_precedes  = FALSE;
+            sep_by_space = TRUE;
+        }
+    }
+    else /* !info.use_symbol || !info.commodity */
+        currency_symbol = "";
+
+    if (gnc_numeric_negative_p (val))
+    {
+        sign = lc->negative_sign;
+        sign_posn = lc->n_sign_posn;
+    }
+    else
+    {
+        sign = lc->positive_sign;
+        sign_posn = lc->p_sign_posn;
+    }
+
+    if (gnc_numeric_zero_p (val) || (sign == NULL) || (sign[0] == 0))
+        print_sign = FALSE;
+
+    /* See if we print sign now */
+    if (print_sign && (sign_posn == 1))
+        bufp = g_stpcpy(bufp, sign);
+
+    /* Now see if we print currency */
+    if (cs_precedes)
+    {
+        /* See if we print sign now */
+        if (print_sign && (sign_posn == 3))
+            bufp = g_stpcpy(bufp, sign);
+
+        if (info.use_symbol)
+        {
+            bufp = g_stpcpy(bufp, currency_symbol);
+            if (sep_by_space)
+                bufp = g_stpcpy(bufp, " ");
+        }
+
+        /* See if we print sign now */
+        if (print_sign && (sign_posn == 4))
+            bufp = g_stpcpy(bufp, sign);
+    }
+
+    /* Now see if we print parentheses */
+    if (print_sign && (sign_posn == 0))
+    {
+        bufp = g_stpcpy(bufp, "(");
+        print_absolute = TRUE;
+    }
+
+    /* Now print the value */
+    bufp += PrintAmountInternal(bufp,
+                                print_absolute ? gnc_numeric_abs(val) : val,
+                                &info);
+
+    /* Now see if we print parentheses */
+    if (print_sign && (sign_posn == 0))
+        bufp = g_stpcpy(bufp, ")");
+
+    /* Now see if we print currency */
+    if (!cs_precedes)
+    {
+        /* See if we print sign now */
+        if (print_sign && (sign_posn == 3))
+            bufp = g_stpcpy(bufp, sign);
+
+        if (info.use_symbol)
+        {
+            if (sep_by_space)
+                bufp = g_stpcpy(bufp, " ");
+            bufp = g_stpcpy(bufp, currency_symbol);
+        }
+
+        /* See if we print sign now */
+        if (print_sign && (sign_posn == 4))
+            bufp = g_stpcpy(bufp, sign);
+    }
+
+    /* See if we print sign now */
+    if (print_sign && (sign_posn == 2))
+        bufp = g_stpcpy(bufp, sign);
+
+    /* return length of printed string */
+    return (bufp - orig_bufp);
+}
+
+const char *
+xaccPrintAmount (gnc_numeric val, GNCPrintAmountInfo info)
+{
+    /* hack alert -- this is not thread safe ... */
+    static char buf[1024];
+
+    if (!xaccSPrintAmount (buf, val, info))
+        buf[0] = '\0';
+
+    /* its OK to return buf, since we declared it static */
+    return buf;
+}
+
+
+/********************************************************************\
+ ********************************************************************/
+
+#define FUDGE .00001
+
+/* This function is basically untranslatable. I'd
+   guess out of the 29 translations we have, 20 will have their number
+   wordings in a totally different way than English has (not to
+   mention gender-dependent number endings). Which means this
+   word-by-word translation will be useless or even plain
+   wrong. For this reason, we don't even start to pretend a
+   word-by-word translation would be of any use, so we don't mark any
+   of these strings for translation. cstim, 2007-04-15. */
+static gchar *small_numbers[] =
+{
+    /* Translators: This section is for generating the "amount, in
+       words" field when printing a check. This function gets the
+       wording right for English, but unfortunately not for most other
+       languages. Decide for yourself whether the check printing is
+       actually needed in your language; if not, you can safely skip the
+       translation of all of these strings.  */
+    "Zero", "One", "Two", "Three", "Four",
+    "Five", "Six", "Seven", "Eight", "Nine",
+    "Ten", "Eleven", "Twelve", "Thirteen", "Fourteen",
+    "Fifteen", "Sixteen", "Seventeen", "Eighteen", "Nineteen",
+    "Twenty"
+};
+static gchar *medium_numbers[] =
+{
+    "Zero", "Ten", "Twenty", "Thirty", "Forty",
+    "Fifty", "Sixty", "Seventy", "Eighty", "Ninety"
+};
+static gchar *big_numbers[] =
+{
+    /* Translators: This is the word for the number 10^2 */
+    "Hundred",
+    /* Translators: This is the word for the number 10^3 */
+    "Thousand",
+    /* Translators: This is the word for the number 10^6, one thousand
+       thousands. */
+    "Million",
+    /* Translators: This is the word for the number 10^9, one thousand
+       millions. WATCH OUT: In British English and many other languages
+       this word is used for 10^12 which is one million millions! In
+       contrast to this, here in GnuCash this is used in the American
+       English meaning of 10^9.  */
+    "Billion",
+    /* Translators: This is the word for the number 10^12, one million
+       millions. */
+    "Trillion",
+    /* Translators: This is the word for the number 10^15 */
+    "Quadrillion",
+    /* Translators: This is the word for the number 10^18 */
+    "Quintillion"
+};
+
+static gchar *
+integer_to_words(gint64 val)
+{
+    gint64 log_val, pow_val, this_part;
+    GString *result;
+    gchar *tmp;
+
+    if (val == 0)
+        return g_strdup("zero");
+    if (val < 0)
+        val = -val;
+
+    result = g_string_sized_new(100);
+
+    while (val >= 1000)
+    {
+        log_val = log10(val) / 3 + FUDGE;
+        pow_val = exp(log_val * 3 * G_LN10) + FUDGE;
+        this_part = val / pow_val;
+        val -= this_part * pow_val;
+        tmp = integer_to_words(this_part);
+        g_string_append_printf(result, "%s %s ", tmp,
+                               gettext(big_numbers[log_val]));
+        g_free(tmp);
+    }
+
+    if (val >= 100)
+    {
+        this_part = val / 100;
+        val -= this_part * 100;
+        g_string_append_printf(result, "%s %s ",
+                               gettext(small_numbers[this_part]),
+                               gettext(big_numbers[0]));
+    }
+
+    if (val > 20)
+    {
+        this_part = val / 10;
+        val -= this_part * 10;
+        g_string_append(result, gettext(medium_numbers[this_part]));
+        g_string_append_c(result, ' ');
+    }
+
+    if (val > 0)
+    {
+        this_part = val;
+        val -= this_part;
+        g_string_append(result, gettext(small_numbers[this_part]));
+        g_string_append_c(result, ' ');
+    }
+
+    result = g_string_truncate(result, result->len - 1);
+    return g_string_free(result, FALSE);
+}
+
+#ifdef _MSC_VER
+static double round(double x)
+{
+    // A simple round() implementation because MSVC doesn't seem to have that
+    return floor(x + 0.5);
+}
+#endif
+
+gchar *
+number_to_words(gdouble val, gint64 denom)
+{
+    gint64 int_part, frac_part;
+    gchar *int_string, *nomin_string, *denom_string, *full_string;
+
+    if (val < 0) val = -val;
+    if (denom < 0) denom = -denom;
+
+    int_part = floor(val);
+    frac_part = round((val - int_part) * denom);
+
+    int_string = integer_to_words(int_part);
+    /* Inside of the gettext macro _(...) we must not use any macros but
+       only plain string literals. For this reason, convert the strings
+       separately. */
+    nomin_string = g_strdup_printf("%02" G_GINT64_FORMAT, frac_part);
+    denom_string = g_strdup_printf("%" G_GINT64_FORMAT, denom);
+    full_string =
+        /* Translators: This is for the "amount, in words" field in check
+           printing. The first %s is the integer amount of dollars (or
+           whatever currency), the second and third %s the cent amount as
+           a fraction, e.g. 47/100.  */
+        g_strdup_printf("%s and %s/%s",
+                        int_string, nomin_string, denom_string);
+    g_free(int_string);
+    g_free(nomin_string);
+    g_free(denom_string);
+    return full_string;
+}
+
+gchar *
+numeric_to_words(gnc_numeric val)
+{
+    return number_to_words(gnc_numeric_to_double(val),
+                           gnc_numeric_denom(val));
+}
+
+const gchar *
+printable_value (gdouble val, gint denom)
+{
+    GNCPrintAmountInfo info;
+    gnc_numeric num;
+
+    num = gnc_numeric_create(round(val * denom), denom);
+    info = gnc_share_print_info_places(log10(denom));
+    return xaccPrintAmount (num, info);
+}
+
+/********************************************************************\
+ * xaccParseAmount                                                  *
+ *   parses amount strings using locale data                        *
+ *                                                                  *
+ * Args: in_str   -- pointer to string rep of num                   *
+ *       monetary -- boolean indicating whether value is monetary   *
+ *       result   -- pointer to result location, may be NULL        *
+ *       endstr   -- used to store first digit not used in parsing  *
+ * Return: gboolean -- TRUE if a number found and parsed            *
+ *                     If FALSE, result is not changed              *
+\********************************************************************/
+
+/* Parsing state machine states */
+typedef enum
+{
+    START_ST,       /* Parsing initial whitespace */
+    NEG_ST,         /* Parsed a negative sign or a left paren */
+    PRE_GROUP_ST,   /* Parsing digits before grouping and decimal characters */
+    START_GROUP_ST, /* Start of a digit group encountered (possibly) */
+    IN_GROUP_ST,    /* Within a digit group */
+    FRAC_ST,        /* Parsing the fractional portion of a number */
+    DONE_ST,        /* Finished, number is correct module grouping constraints */
+    NO_NUM_ST       /* Finished, number was malformed */
+} ParseState;
+
+#define done_state(state) (((state) == DONE_ST) || ((state) == NO_NUM_ST))
+
+G_INLINE_FUNC long long int multiplier (int num_decimals);
+
+long long int
+multiplier (int num_decimals)
+{
+    switch (num_decimals)
+    {
+    case 8:
+        return 100000000;
+    case 7:
+        return 10000000;
+    case 6:
+        return 1000000;
+    case 5:
+        return 100000;
+    case 4:
+        return 10000;
+    case 3:
+        return 1000;
+    case 2:
+        return 100;
+    case 1:
+        return 10;
+    default:
+        PERR("bad fraction length");
+        g_assert_not_reached();
+        break;
+    }
+
+    return 1;
+}
+
+gboolean
+xaccParseAmount (const char * in_str, gboolean monetary, gnc_numeric *result,
+                 char **endstr)
+{
+    struct lconv *lc = gnc_localeconv();
+
+    gunichar negative_sign;
+    gunichar decimal_point;
+    gunichar group_separator;
+    char *group;
+
+    negative_sign = g_utf8_get_char(lc->negative_sign);
+    if (monetary)
+    {
+        group_separator = g_utf8_get_char(lc->mon_thousands_sep);
+        decimal_point = g_utf8_get_char(lc->mon_decimal_point);
+        group = lc->mon_grouping;
+    }
+    else
+    {
+        group_separator = g_utf8_get_char(lc->thousands_sep);
+        decimal_point = g_utf8_get_char(lc->decimal_point);
+        group = lc->grouping;
+    }
+
+    return xaccParseAmountExtended(in_str, monetary, negative_sign, decimal_point,
+                                   group_separator, group, NULL, result, endstr);
+}
+
+/* Note: xaccParseAmountExtended causes test-print-parse-amount
+to fail if QOF_SCANF_LLD is simply replaced by G_GINT64_FORMAT. Why?
+A: Because scanf and printf use different symbols for 64-bit numbers.
+*/
+gboolean
+xaccParseAmountExtended (const char * in_str, gboolean monetary,
+                         gunichar negative_sign, gunichar decimal_point,
+                         gunichar group_separator, const char *group, const char *ignore_list,
+                         gnc_numeric *result, char **endstr)
+{
+    gboolean is_negative;
+    gboolean got_decimal;
+    gboolean need_paren;
+    GList * group_data;
+    long long int numer;
+    long long int denom;
+    int count, group_count;
+
+    ParseState state;
+
+    const gchar *in;
+    gunichar uc;
+    gchar *out_str;
+    gchar *out;
+
+    /* Initialize *endstr to in_str */
+    if (endstr != NULL)
+        *endstr = (char *) in_str;
+
+    if (in_str == NULL)
+        return FALSE;
+
+    if (!g_utf8_validate(in_str, -1, &in))
+    {
+        printf("Invalid utf8 string '%s'. Bad character at position %ld.\n",
+               in_str, g_utf8_pointer_to_offset (in_str, in));
+        return FALSE;
+    }
+
+    /* 'out_str' will be used to store digits for numeric conversion.
+     * 'out' will be used to traverse out_str. */
+    out = out_str = g_new(gchar, strlen(in_str) + 128);
+
+    /* 'in' is used to traverse 'in_str'. */
+    in = in_str;
+
+    is_negative = FALSE;
+    got_decimal = FALSE;
+    need_paren = FALSE;
+    group_data = NULL;
+    group_count = 0;
+    numer = 0;
+    denom = 1;
+
+    /* Initialize the state machine */
+    state = START_ST;
+
+    /* This while loop implements a state machine for parsing numbers. */
+    while (TRUE)
+    {
+        ParseState next_state = state;
+
+        uc = g_utf8_get_char(in);
+
+        /* Ignore anything in the 'ignore list' */
+        if (ignore_list && uc && g_utf8_strchr(ignore_list, -1, uc) != NULL)
+        {
+            in = g_utf8_next_char(in);
+            continue;
+        }
+
+        /* Note we never need to check for the end of 'in_str' explicitly.
+         * The 'else' clauses on all the state transitions will handle that. */
+        switch (state)
+        {
+            /* START_ST means we have parsed 0 or more whitespace characters */
+        case START_ST:
+            if (g_unichar_isdigit(uc))
+            {
+                count = g_unichar_to_utf8(uc, out);
+                out += count; /* we record the digits themselves in out_str
+                         * for later conversion by libc routines */
+                next_state = PRE_GROUP_ST;
+            }
+            else if (uc == decimal_point)
+            {
+                next_state = FRAC_ST;
+            }
+            else if (g_unichar_isspace(uc))
+            {
+            }
+            else if (uc == negative_sign)
+            {
+                is_negative = TRUE;
+                next_state = NEG_ST;
+            }
+            else if (uc == '(')
+            {
+                is_negative = TRUE;
+                need_paren = TRUE;
+                next_state = NEG_ST;
+            }
+            else
+            {
+                next_state = NO_NUM_ST;
+            }
+
+            break;
+
+            /* NEG_ST means we have just parsed a negative sign. For now,
+             * we only recognize formats where the negative sign comes first. */
+        case NEG_ST:
+            if (g_unichar_isdigit(uc))
+            {
+                count = g_unichar_to_utf8(uc, out);
+                out += count;
+                next_state = PRE_GROUP_ST;
+            }
+            else if (uc == decimal_point)
+            {
+                next_state = FRAC_ST;
+            }
+            else if (g_unichar_isspace(uc))
+            {
+            }
+            else
+            {
+                next_state = NO_NUM_ST;
+            }
+
+            break;
+
+            /* PRE_GROUP_ST means we have started parsing the number, but
+             * have not encountered a decimal point or a grouping character. */
+        case PRE_GROUP_ST:
+            if (g_unichar_isdigit(uc))
+            {
+                count = g_unichar_to_utf8(uc, out);
+                out += count;
+            }
+            else if (uc == decimal_point)
+            {
+                next_state = FRAC_ST;
+            }
+            else if (uc == group_separator)
+            {
+                next_state = START_GROUP_ST;
+            }
+            else if (uc == ')' && need_paren)
+            {
+                next_state = DONE_ST;
+                need_paren = FALSE;
+            }
+            else
+            {
+                next_state = DONE_ST;
+            }
+
+            break;
+
+            /* START_GROUP_ST means we have just parsed a group character.
+             * Note that group characters might be whitespace!!! In general,
+             * if a decimal point or a group character is whitespace, we
+             * try to interpret it in the fashion that will allow parsing
+             * of the current number to continue. */
+        case START_GROUP_ST:
+            if (g_unichar_isdigit(uc))
+            {
+                count = g_unichar_to_utf8(uc, out);
+                out += count;
+                group_count++; /* We record the number of digits
+                          * in the group for later checking. */
+                next_state = IN_GROUP_ST;
+            }
+            else if (uc == decimal_point)
+            {
+                /* If we now get a decimal point, and both the decimal
+                 * and the group separator are also whitespace, assume
+                 * the last group separator was actually whitespace and
+                 * stop parsing. Otherwise, there's a problem. */
+                if (g_unichar_isspace(group_separator) &&
+                        g_unichar_isspace(decimal_point))
+                    next_state = DONE_ST;
+                else
+                    next_state = NO_NUM_ST;
+            }
+            else if (uc == ')' && need_paren)
+            {
+                if (g_unichar_isspace(group_separator))
+                {
+                    next_state = DONE_ST;
+                    need_paren = FALSE;
+                }
+                else
+                    next_state = NO_NUM_ST;
+            }
+            else
+            {
+                /* If the last group separator is also whitespace,
+                 * assume it was intended as such and stop parsing.
+                 * Otherwise, there is a problem. */
+                if (g_unichar_isspace(group_separator))
+                    next_state = DONE_ST;
+                else
+                    next_state = NO_NUM_ST;
+            }
+            break;
+
+            /* IN_GROUP_ST means we are in the middle of parsing
+             * a group of digits. */
+        case IN_GROUP_ST:
+            if (g_unichar_isdigit(uc))
+            {
+                count = g_unichar_to_utf8(uc, out);
+                out += count;
+                group_count++; /* We record the number of digits
+                          * in the group for later checking. */
+            }
+            else if (uc == decimal_point)
+            {
+                next_state = FRAC_ST;
+            }
+            else if (uc == group_separator)
+            {
+                next_state = START_GROUP_ST;
+            }
+            else if (uc == ')' && need_paren)
+            {
+                next_state = DONE_ST;
+                need_paren = FALSE;
+            }
+            else
+            {
+                next_state = DONE_ST;
+            }
+
+            break;
+
+            /* FRAC_ST means we are now parsing fractional digits. */
+        case FRAC_ST:
+            if (g_unichar_isdigit(uc))
+            {
+                count = g_unichar_to_utf8(uc, out);
+                out += count;
+            }
+            else if (uc == decimal_point)
+            {
+                /* If a subsequent decimal point is also whitespace,
+                 * assume it was intended as such and stop parsing.
+                 * Otherwise, there is a problem. */
+                if (g_unichar_isspace(decimal_point))
+                    next_state = DONE_ST;
+                else
+                    next_state = NO_NUM_ST;
+            }
+            else if (uc == group_separator)
+            {
+                /* If a subsequent group separator is also whitespace,
+                 * assume it was intended as such and stop parsing.
+                 * Otherwise, there is a problem. */
+                if (g_unichar_isspace(group_separator))
+                    next_state = DONE_ST;
+                else
+                    next_state = NO_NUM_ST;
+            }
+            else if (uc == ')' && need_paren)
+            {
+                next_state = DONE_ST;
+                need_paren = FALSE;
+            }
+            else
+            {
+                next_state = DONE_ST;
+            }
+
+            break;
+
+        default:
+            PERR("bad state");
+            g_assert_not_reached();
+            break;
+        }
+
+        /* If we're moving out of the IN_GROUP_ST, record data for the group */
+        if ((state == IN_GROUP_ST) && (next_state != IN_GROUP_ST))
+        {
+            group_data = g_list_prepend(group_data, GINT_TO_POINTER(group_count));
+            group_count = 0;
+        }
+
+        /* If we're moving into the FRAC_ST or out of the machine
+         * without going through FRAC_ST, record the integral value. */
+        if (((next_state == FRAC_ST) && (state != FRAC_ST)) ||
+                ((next_state == DONE_ST) && !got_decimal))
+        {
+            *out = '\0';
+
+            if (*out_str != '\0' && sscanf(out_str, QOF_SCANF_LLD, &numer) < 1)
+            {
+                next_state = NO_NUM_ST;
+            }
+            else if (next_state == FRAC_ST)
+            {
+                /* reset the out pointer to record the fraction */
+                out = out_str;
+                *out = '\0';
+
+                got_decimal = TRUE;
+            }
+        }
+
+        state = next_state;
+        if (done_state (state))
+            break;
+
+        in = g_utf8_next_char(in);
+    }
+
+    /* If there was an error, just quit */
+    if (need_paren || (state == NO_NUM_ST))
+    {
+        g_free(out_str);
+        g_list_free(group_data);
+        return FALSE;
+    }
+
+    /* If there were groups, validate them */
+    if (group_data != NULL)
+    {
+        gboolean good_grouping = TRUE;
+        GList *node;
+
+        /* The groups were built in reverse order. This
+         * is the easiest order to verify them in. */
+        for (node = group_data; group && node; node = node->next)
+        {
+            /* Verify group size */
+            if (*group != GPOINTER_TO_INT(node->data))
+            {
+                good_grouping = FALSE;
+                break;
+            }
+
+            /* Peek ahead at the next group code */
+            switch (group[1])
+            {
+                /* A null char means repeat the last group indefinitely */
+            case '\0':
+                break;
+                /* CHAR_MAX means no more grouping allowed */
+            case CHAR_MAX:
+                if (node->next != NULL)
+                    good_grouping = FALSE;
+                break;
+                /* Anything else means another group size */
+            default:
+                group++;
+                break;
+            }
+
+            if (!good_grouping)
+                break;
+        }
+
+        g_list_free(group_data);
+
+        if (!good_grouping)
+        {
+            g_free(out_str);
+            return FALSE;
+        }
+    }
+
+    /* Cap the end of the fraction string, if any */
+    *out = '\0';
+
+    /* Add in fractional value */
+    if (got_decimal && (*out_str != '\0'))
+    {
+        size_t len;
+        long long int fraction;
+
+        len = strlen(out_str);
+
+        if (len > 8)
+        {
+            out_str[8] = '\0';
+            len = 8;
+        }
+
+        if (sscanf (out_str, QOF_SCANF_LLD, &fraction) < 1)
+        {
+            g_free(out_str);
+            return FALSE;
+        }
+
+        denom = multiplier(len);
+        numer *= denom;
+        numer += fraction;
+    }
+    else if (monetary && auto_decimal_enabled && !got_decimal)
+    {
+        if ((auto_decimal_places > 0) && (auto_decimal_places < 9))
+        {
+            denom = multiplier(auto_decimal_places);
+
+            /* No need to multiply numer by denom at this point,
+             * since by specifying the auto decimal places the
+             * user has effectively determined the scaling factor
+             * for the numerator they entered.
+             */
+        }
+    }
+
+    if (result != NULL)
+    {
+        *result = gnc_numeric_create (numer, denom);
+        if (is_negative)
+            *result = gnc_numeric_neg (*result);
+    }
+
+    if (endstr != NULL)
+        *endstr = (char *) in;
+
+    g_free (out_str);
+
+    return TRUE;
+}
+
+/* enable/disable the auto_decimal_enabled option */
+static void
+gnc_set_auto_decimal_enabled (gpointer settings, gchar *key, gpointer user_data)
+{
+    auto_decimal_enabled =
+            gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL, GNC_PREF_AUTO_DECIMAL_POINT);
+}
+
+/* set the number of auto decimal places to use */
+static void
+gnc_set_auto_decimal_places (gpointer settings, gchar *key, gpointer user_data)
+{
+    auto_decimal_places =
+            gnc_prefs_get_int (GNC_PREFS_GROUP_GENERAL, GNC_PREF_AUTO_DECIMAL_PLACES);
+}
+
+static void
+gnc_auto_decimal_init (void)
+{
+    auto_decimal_enabled =
+        gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL, GNC_PREF_AUTO_DECIMAL_POINT);
+    auto_decimal_places =
+        gnc_prefs_get_int (GNC_PREFS_GROUP_GENERAL, GNC_PREF_AUTO_DECIMAL_PLACES);
+}
+
+void
+gnc_ui_util_init (void)
+{
+    gnc_configure_account_separator ();
+    gnc_auto_decimal_init();
+
+    gnc_prefs_register_cb(GNC_PREFS_GROUP_GENERAL, GNC_PREF_ACCOUNT_SEPARATOR,
+                          gnc_configure_account_separator, NULL);
+    gnc_prefs_register_cb(GNC_PREFS_GROUP_GENERAL, GNC_PREF_REVERSED_ACCTS_NONE,
+                          gnc_configure_reverse_balance, NULL);
+    gnc_prefs_register_cb(GNC_PREFS_GROUP_GENERAL, GNC_PREF_REVERSED_ACCTS_CREDIT,
+                          gnc_configure_reverse_balance, NULL);
+    gnc_prefs_register_cb(GNC_PREFS_GROUP_GENERAL, GNC_PREF_REVERSED_ACCTS_INC_EXP,
+                          gnc_configure_reverse_balance, NULL);
+    gnc_prefs_register_cb(GNC_PREFS_GROUP_GENERAL, GNC_PREF_CURRENCY_CHOICE_LOCALE,
+                          gnc_currency_changed_cb, NULL);
+    gnc_prefs_register_cb(GNC_PREFS_GROUP_GENERAL, GNC_PREF_CURRENCY_CHOICE_OTHER,
+                          gnc_currency_changed_cb, NULL);
+    gnc_prefs_register_cb(GNC_PREFS_GROUP_GENERAL, GNC_PREF_CURRENCY_OTHER,
+                          gnc_currency_changed_cb, NULL);
+    gnc_prefs_register_cb(GNC_PREFS_GROUP_GENERAL_REPORT, GNC_PREF_CURRENCY_CHOICE_LOCALE,
+                          gnc_currency_changed_cb, NULL);
+    gnc_prefs_register_cb(GNC_PREFS_GROUP_GENERAL_REPORT, GNC_PREF_CURRENCY_CHOICE_OTHER,
+                          gnc_currency_changed_cb, NULL);
+    gnc_prefs_register_cb(GNC_PREFS_GROUP_GENERAL_REPORT, GNC_PREF_CURRENCY_OTHER,
+                          gnc_currency_changed_cb, NULL);
+    gnc_prefs_register_cb(GNC_PREFS_GROUP_GENERAL, GNC_PREF_AUTO_DECIMAL_POINT,
+                          gnc_set_auto_decimal_enabled, NULL);
+    gnc_prefs_register_cb(GNC_PREFS_GROUP_GENERAL, GNC_PREF_AUTO_DECIMAL_PLACES,
+                          gnc_set_auto_decimal_places, NULL);
+
+}
diff --git a/src/app-utils/gnc-ui-util.h b/libgnucash/app-utils/gnc-ui-util.h
similarity index 100%
rename from src/app-utils/gnc-ui-util.h
rename to libgnucash/app-utils/gnc-ui-util.h
diff --git a/src/app-utils/gncmod-app-utils.c b/libgnucash/app-utils/gncmod-app-utils.c
similarity index 100%
rename from src/app-utils/gncmod-app-utils.c
rename to libgnucash/app-utils/gncmod-app-utils.c
diff --git a/src/app-utils/guile-util.c b/libgnucash/app-utils/guile-util.c
similarity index 100%
rename from src/app-utils/guile-util.c
rename to libgnucash/app-utils/guile-util.c
diff --git a/src/app-utils/guile-util.h b/libgnucash/app-utils/guile-util.h
similarity index 100%
rename from src/app-utils/guile-util.h
rename to libgnucash/app-utils/guile-util.h
diff --git a/src/app-utils/hooks.scm b/libgnucash/app-utils/hooks.scm
similarity index 100%
rename from src/app-utils/hooks.scm
rename to libgnucash/app-utils/hooks.scm
diff --git a/src/app-utils/make-prefs-migration-script.xsl b/libgnucash/app-utils/make-prefs-migration-script.xsl
similarity index 100%
rename from src/app-utils/make-prefs-migration-script.xsl
rename to libgnucash/app-utils/make-prefs-migration-script.xsl
diff --git a/src/app-utils/migratable-prefs.xml.in b/libgnucash/app-utils/migratable-prefs.xml.in
similarity index 100%
rename from src/app-utils/migratable-prefs.xml.in
rename to libgnucash/app-utils/migratable-prefs.xml.in
diff --git a/src/app-utils/migrate-prefs.scm b/libgnucash/app-utils/migrate-prefs.scm
similarity index 100%
rename from src/app-utils/migrate-prefs.scm
rename to libgnucash/app-utils/migrate-prefs.scm
diff --git a/src/app-utils/option-util.c b/libgnucash/app-utils/option-util.c
similarity index 100%
rename from src/app-utils/option-util.c
rename to libgnucash/app-utils/option-util.c
diff --git a/src/app-utils/option-util.h b/libgnucash/app-utils/option-util.h
similarity index 100%
rename from src/app-utils/option-util.h
rename to libgnucash/app-utils/option-util.h
diff --git a/src/app-utils/options.scm b/libgnucash/app-utils/options.scm
similarity index 100%
rename from src/app-utils/options.scm
rename to libgnucash/app-utils/options.scm
diff --git a/src/app-utils/prefs.scm b/libgnucash/app-utils/prefs.scm
similarity index 100%
rename from src/app-utils/prefs.scm
rename to libgnucash/app-utils/prefs.scm
diff --git a/src/app-utils/simple-obj.scm b/libgnucash/app-utils/simple-obj.scm
similarity index 100%
rename from src/app-utils/simple-obj.scm
rename to libgnucash/app-utils/simple-obj.scm
diff --git a/libgnucash/app-utils/test/CMakeLists.txt b/libgnucash/app-utils/test/CMakeLists.txt
new file mode 100644
index 0000000..1985d36
--- /dev/null
+++ b/libgnucash/app-utils/test/CMakeLists.txt
@@ -0,0 +1,37 @@
+
+SET(APP_UTILS_TEST_INCLUDE_DIRS
+  ${CMAKE_BINARY_DIR}/common # for config.h
+  ${CMAKE_SOURCE_DIR}/common/test-core
+  ${CMAKE_SOURCE_DIR}/libgnucash/app-utils
+  ${CMAKE_SOURCE_DIR}/libgnucash/engine # for qof.h
+  ${CMAKE_SOURCE_DIR}/libgnucash/engine/test-core
+  ${GIO_INCLUDE_DIRS}
+  ${GUILE_INCLUDE_DIRS}
+)
+
+SET(APP_UTILS_TEST_LIBS gncmod-app-utils gncmod-test-engine test-core ${GIO_LDFLAGS} ${GUILE_LDFLAGS})
+
+SET(test_app_utils_SOURCES test-app-utils.c test-option-util.cpp test-gnc-ui-util.c)
+
+MACRO(ADD_APP_UTILS_TEST _TARGET _SOURCE_FILES)
+  GNC_ADD_TEST(${_TARGET} "${_SOURCE_FILES}" APP_UTILS_TEST_INCLUDE_DIRS APP_UTILS_TEST_LIBS)
+ENDMACRO()
+
+ADD_APP_UTILS_TEST(test-exp-parser test-exp-parser.c)
+GNC_ADD_TEST_WITH_GUILE(test-link-module test-link-module APP_UTILS_TEST_INCLUDE_DIRS APP_UTILS_TEST_LIBS)
+ADD_APP_UTILS_TEST(test-print-parse-amount test-print-parse-amount.cpp)
+# This test not run in autotools build.
+#GNC_ADD_TEST_WITH_GUILE(test-print-queries test-print-queries.cpp APP_UTILS_TEST_INCLUDE_DIRS APP_UTILS_TEST_LIBS)
+GNC_ADD_TEST_WITH_GUILE(test-scm-query-string test-scm-query-string.cpp
+  APP_UTILS_TEST_INCLUDE_DIRS APP_UTILS_TEST_LIBS
+)
+ADD_APP_UTILS_TEST(test-sx test-sx.cpp)
+
+GNC_ADD_SCHEME_TEST(scm-test-load-module test-load-module.in)
+# Doesn't work yet:
+#ADD_APP_UTILS_TEST(test-app-utils "${test_app_utils_SOURCES}")
+
+CONFIGURE_FILE(test-load-module.in test-load-module @ONLY)
+
+SET_DIST_LIST(test_app_utils_DIST CMakeLists.txt Makefile.am test-exp-parser.c test-link-module.c test-load-module.in
+        test-print-parse-amount.cpp test-print-queries.cpp test-scm-query-string.cpp test-sx.cpp ${test_app_utils_SOURCES})
diff --git a/libgnucash/app-utils/test/Makefile.am b/libgnucash/app-utils/test/Makefile.am
new file mode 100644
index 0000000..a5aefc8
--- /dev/null
+++ b/libgnucash/app-utils/test/Makefile.am
@@ -0,0 +1,75 @@
+include $(top_srcdir)/test-templates/Makefile.decl
+
+check_PROGRAMS = \
+  test-link-module \
+  test-exp-parser \
+  test-scm-query-string \
+  test-print-parse-amount \
+  test-sx \
+  test-app-utils
+
+TESTS =  \
+  test-load-module \
+  ${check_PROGRAMS}
+
+test_scm_query_string_SOURCES = test-scm-query-string.cpp
+test_sx_SOURCES = test-sx.cpp
+test_print_parse_amount_SOURCES = test-print-parse-amount.cpp
+
+GNC_TEST_DEPS = --gnc-module-dir ${top_builddir}/libgnucash/engine \
+  --gnc-module-dir ${top_builddir}/libgnucash/app-utils \
+  --guile-load-dir ${top_builddir}/libgnucash/core-utils \
+  --guile-load-dir ${top_builddir}/libgnucash/gnc-module \
+  --guile-load-dir ${top_builddir}/libgnucash/engine \
+  --guile-load-dir ${top_builddir}/libgnucash/scm \
+  --guile-load-dir ${top_builddir}/libgnucash/app-utils \
+  --library-dir    ${top_builddir}/libgnucash/core-utils \
+  --library-dir    ${top_builddir}/libgnucash/gnc-module \
+  --library-dir    ${top_builddir}/libgnucash/engine \
+  --library-dir    ${top_builddir}/libgnucash/backend/xml \
+  --library-dir    ${top_builddir}/libgnucash/backend/sql \
+  --library-dir    ${top_builddir}/libgnucash/app-utils
+
+TESTS_ENVIRONMENT = \
+  GUILE_WARN_DEPRECATED=no \
+  GUILE="${GUILE}" \
+  SRCDIR=${srcdir} \
+  GNC_BUILDDIR="${abs_top_builddir}" \
+  $(shell ${abs_top_srcdir}/common/gnc-test-env.pl --noexports ${GNC_TEST_DEPS})
+
+LDADD = \
+   ${top_builddir}/libgnucash/core-utils/libgnc-core-utils.la \
+   ${top_builddir}/libgnucash/engine/libgncmod-engine.la \
+   ${top_builddir}/libgnucash/gnc-module/libgnc-module.la \
+   ${top_builddir}/libgnucash/app-utils/libgncmod-app-utils.la \
+   ${top_builddir}/common/test-core/libtest-core.la \
+   ${top_builddir}/libgnucash/engine/test-core/libgncmod-test-engine.la \
+   ${GUILE_LIBS}
+
+EXTRA_DIST += \
+  test-load-module \
+  test-print-queries.cpp \
+  CMakeLists.txt
+
+AM_CPPFLAGS = \
+  -I${top_srcdir}/common \
+  -I${top_srcdir}/common/test-core \
+  -I${top_srcdir}/libgnucash/engine \
+  -I${top_srcdir}/libgnucash/engine/test-core \
+  -I${top_srcdir}/libgnucash/app-utils \
+  -I${top_srcdir}/libgnucash/gnc-module \
+  -I${top_srcdir}/libgnucash/core-utils \
+  ${GUILE_CFLAGS} \
+  ${GLIB_CFLAGS} \
+  ${BOOST_CPPFLAGS}
+
+test_app_utils_SOURCES = \
+	test-app-utils.c \
+	test-option-util.cpp \
+	test-gnc-ui-util.c
+
+test_app_utils_CXXFLAGS = \
+	${DEFAULT_INCLUDES} \
+	-I${top_srcdir}/${MODULEPATH}/ \
+	-DTESTPROG=test_app_utils \
+	${GLIB_CFLAGS}
diff --git a/src/app-utils/test/test-app-utils.c b/libgnucash/app-utils/test/test-app-utils.c
similarity index 100%
rename from src/app-utils/test/test-app-utils.c
rename to libgnucash/app-utils/test/test-app-utils.c
diff --git a/src/app-utils/test/test-exp-parser.c b/libgnucash/app-utils/test/test-exp-parser.c
similarity index 100%
rename from src/app-utils/test/test-exp-parser.c
rename to libgnucash/app-utils/test/test-exp-parser.c
diff --git a/src/app-utils/test/test-gnc-ui-util.c b/libgnucash/app-utils/test/test-gnc-ui-util.c
similarity index 100%
rename from src/app-utils/test/test-gnc-ui-util.c
rename to libgnucash/app-utils/test/test-gnc-ui-util.c
diff --git a/src/app-utils/test/test-link-module.c b/libgnucash/app-utils/test/test-link-module.c
similarity index 100%
rename from src/app-utils/test/test-link-module.c
rename to libgnucash/app-utils/test/test-link-module.c
diff --git a/src/app-utils/test/test-load-module.in b/libgnucash/app-utils/test/test-load-module.in
similarity index 100%
rename from src/app-utils/test/test-load-module.in
rename to libgnucash/app-utils/test/test-load-module.in
diff --git a/src/app-utils/test/test-option-util.cpp b/libgnucash/app-utils/test/test-option-util.cpp
similarity index 100%
rename from src/app-utils/test/test-option-util.cpp
rename to libgnucash/app-utils/test/test-option-util.cpp
diff --git a/src/app-utils/test/test-print-parse-amount.cpp b/libgnucash/app-utils/test/test-print-parse-amount.cpp
similarity index 100%
rename from src/app-utils/test/test-print-parse-amount.cpp
rename to libgnucash/app-utils/test/test-print-parse-amount.cpp
diff --git a/src/app-utils/test/test-print-queries.cpp b/libgnucash/app-utils/test/test-print-queries.cpp
similarity index 100%
rename from src/app-utils/test/test-print-queries.cpp
rename to libgnucash/app-utils/test/test-print-queries.cpp
diff --git a/src/app-utils/test/test-scm-query-string.cpp b/libgnucash/app-utils/test/test-scm-query-string.cpp
similarity index 100%
rename from src/app-utils/test/test-scm-query-string.cpp
rename to libgnucash/app-utils/test/test-scm-query-string.cpp
diff --git a/src/app-utils/test/test-sx.cpp b/libgnucash/app-utils/test/test-sx.cpp
similarity index 100%
rename from src/app-utils/test/test-sx.cpp
rename to libgnucash/app-utils/test/test-sx.cpp
diff --git a/src/backend/CMakeLists.txt b/libgnucash/backend/CMakeLists.txt
similarity index 100%
rename from src/backend/CMakeLists.txt
rename to libgnucash/backend/CMakeLists.txt
diff --git a/src/backend/Makefile.am b/libgnucash/backend/Makefile.am
similarity index 100%
rename from src/backend/Makefile.am
rename to libgnucash/backend/Makefile.am
diff --git a/src/backend/dbi/.splintrc b/libgnucash/backend/dbi/.splintrc
similarity index 100%
rename from src/backend/dbi/.splintrc
rename to libgnucash/backend/dbi/.splintrc
diff --git a/libgnucash/backend/dbi/CMakeLists.txt b/libgnucash/backend/dbi/CMakeLists.txt
new file mode 100644
index 0000000..bedd23f
--- /dev/null
+++ b/libgnucash/backend/dbi/CMakeLists.txt
@@ -0,0 +1,47 @@
+# CMakeLists.txt for libgnucash/backend/dbi
+
+ADD_SUBDIRECTORY(test)
+
+# Source file gncmod-backend-dbi.c does not appear to be use in Makefile.in, so not included here.
+
+SET (backend_dbi_SOURCES
+  gnc-backend-dbi.cpp
+  gnc-dbisqlresult.cpp
+  gnc-dbisqlconnection.cpp
+)
+SET (backend_dbi_noinst_HEADERS
+  gnc-backend-dbi.h
+  gnc-backend-dbi.hpp
+  gnc-dbisqlresult.hpp
+  gnc-dbisqlconnection.hpp
+  gnc-dbiprovider.hpp
+  gnc-dbiproviderimpl.hpp
+)
+
+SET_LOCAL_DIST(backend_dbi_DIST_local
+        ${backend_dbi_SOURCES} ${backend_dbi_noinst_HEADERS} CMakeLists.txt Makefile.am)
+SET(backend_dbi_DIST ${backend_dbi_DIST_local} ${test_dbi_backend_DIST} PARENT_SCOPE)
+
+# Add dependency on config.h
+SET_SOURCE_FILES_PROPERTIES (${backend_dbi_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
+
+ADD_LIBRARY	(gncmod-backend-dbi
+  ${backend_dbi_SOURCES}
+  ${backend_dbi_noinst_HEADERS}
+)
+
+SET(WINSOCK_LIB "")
+IF(MINGW64)
+  SET(WINSOCK_LIB "-lws2_32")
+ENDIF(MINGW64)
+TARGET_LINK_LIBRARIES(gncmod-backend-dbi gnc-backend-sql gncmod-engine ${GTK2_LDFLAGS} ${Boost_REGEX_LIBRARY} ${LIBDBI_LIBRARY} ${WINSOCK_LIB})
+
+TARGET_COMPILE_DEFINITIONS(gncmod-backend-dbi PRIVATE -DG_LOG_DOMAIN=\"gnc.backend.dbi\")
+
+TARGET_INCLUDE_DIRECTORIES(gncmod-backend-dbi PRIVATE ${LIBDBI_INCLUDE_PATH})
+
+INSTALL(TARGETS gncmod-backend-dbi
+  LIBRARY DESTINATION lib/gnucash
+  ARCHIVE DESTINATION lib/gnucash
+  RUNTIME DESTINATION bin)
+# No headers to install
diff --git a/libgnucash/backend/dbi/Makefile.am b/libgnucash/backend/dbi/Makefile.am
new file mode 100644
index 0000000..f6b6497
--- /dev/null
+++ b/libgnucash/backend/dbi/Makefile.am
@@ -0,0 +1,46 @@
+SUBDIRS = . test
+
+# Now a shared library AND a GModule
+pkglib_LTLIBRARIES = libgncmod-backend-dbi.la
+
+
+# "${top_srcdir}/common/debug" below is for the splint header
+AM_CPPFLAGS = \
+  -I.. -I../.. \
+  -DLOCALE_DIR=\""$(datadir)/locale"\" \
+  -I${top_srcdir}/libgnucash/backend \
+  -I${top_srcdir}/libgnucash/backend/sql \
+  -I${top_srcdir}/common/debug \
+  -I${top_srcdir}/libgnucash/engine \
+  -I${top_srcdir}/libgnucash/core-utils \
+  -I${top_srcdir}/lib/libc \
+  -I${top_srcdir}/common \
+  ${GLIB_CFLAGS} \
+  ${BOOST_CPPFLAGS} \
+  ${WARN_CFLAGS}
+
+libgncmod_backend_dbi_la_SOURCES = \
+  gnc-backend-dbi.cpp \
+  gnc-dbisqlconnection.cpp \
+  gnc-dbisqlresult.cpp
+
+noinst_HEADERS = \
+  gnc-backend-dbi.h \
+  gnc-backend-dbi.hpp \
+  gnc-dbisqlconnection.hpp \
+  gnc-dbisqlresult.hpp \
+  gnc-dbiprovider.hpp \
+  gnc-dbiproviderimpl.hpp
+
+libgncmod_backend_dbi_la_LDFLAGS = -shared -avoid-version
+libgncmod_backend_dbi_la_LIBADD = \
+   ${GLIB_LIBS} \
+   ${top_builddir}/libgnucash/backend/sql/libgnc-backend-sql.la \
+   ${top_builddir}/libgnucash/engine/libgncmod-engine.la \
+   ${top_builddir}/libgnucash/core-utils/libgnc-core-utils.la \
+   ${BOOST_LDFLAGS} -lboost_regex \
+   ${LIBDBI_LIBS}
+
+AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.backend.dbi\"
+
+EXTRA_DIST = CMakeLists.txt
diff --git a/src/backend/dbi/gnc-backend-dbi.cpp b/libgnucash/backend/dbi/gnc-backend-dbi.cpp
similarity index 100%
rename from src/backend/dbi/gnc-backend-dbi.cpp
rename to libgnucash/backend/dbi/gnc-backend-dbi.cpp
diff --git a/src/backend/dbi/gnc-backend-dbi.h b/libgnucash/backend/dbi/gnc-backend-dbi.h
similarity index 100%
rename from src/backend/dbi/gnc-backend-dbi.h
rename to libgnucash/backend/dbi/gnc-backend-dbi.h
diff --git a/src/backend/dbi/gnc-backend-dbi.hpp b/libgnucash/backend/dbi/gnc-backend-dbi.hpp
similarity index 100%
rename from src/backend/dbi/gnc-backend-dbi.hpp
rename to libgnucash/backend/dbi/gnc-backend-dbi.hpp
diff --git a/src/backend/dbi/gnc-dbiprovider.hpp b/libgnucash/backend/dbi/gnc-dbiprovider.hpp
similarity index 100%
rename from src/backend/dbi/gnc-dbiprovider.hpp
rename to libgnucash/backend/dbi/gnc-dbiprovider.hpp
diff --git a/src/backend/dbi/gnc-dbiproviderimpl.hpp b/libgnucash/backend/dbi/gnc-dbiproviderimpl.hpp
similarity index 100%
rename from src/backend/dbi/gnc-dbiproviderimpl.hpp
rename to libgnucash/backend/dbi/gnc-dbiproviderimpl.hpp
diff --git a/src/backend/dbi/gnc-dbisqlconnection.cpp b/libgnucash/backend/dbi/gnc-dbisqlconnection.cpp
similarity index 100%
rename from src/backend/dbi/gnc-dbisqlconnection.cpp
rename to libgnucash/backend/dbi/gnc-dbisqlconnection.cpp
diff --git a/src/backend/dbi/gnc-dbisqlconnection.hpp b/libgnucash/backend/dbi/gnc-dbisqlconnection.hpp
similarity index 100%
rename from src/backend/dbi/gnc-dbisqlconnection.hpp
rename to libgnucash/backend/dbi/gnc-dbisqlconnection.hpp
diff --git a/src/backend/dbi/gnc-dbisqlresult.cpp b/libgnucash/backend/dbi/gnc-dbisqlresult.cpp
similarity index 100%
rename from src/backend/dbi/gnc-dbisqlresult.cpp
rename to libgnucash/backend/dbi/gnc-dbisqlresult.cpp
diff --git a/src/backend/dbi/gnc-dbisqlresult.hpp b/libgnucash/backend/dbi/gnc-dbisqlresult.hpp
similarity index 100%
rename from src/backend/dbi/gnc-dbisqlresult.hpp
rename to libgnucash/backend/dbi/gnc-dbisqlresult.hpp
diff --git a/src/backend/dbi/gncmod-backend-dbi.c b/libgnucash/backend/dbi/gncmod-backend-dbi.c
similarity index 100%
rename from src/backend/dbi/gncmod-backend-dbi.c
rename to libgnucash/backend/dbi/gncmod-backend-dbi.c
diff --git a/libgnucash/backend/dbi/test/CMakeLists.txt b/libgnucash/backend/dbi/test/CMakeLists.txt
new file mode 100644
index 0000000..70a9d93
--- /dev/null
+++ b/libgnucash/backend/dbi/test/CMakeLists.txt
@@ -0,0 +1,40 @@
+
+SET(BACKEND_DBI_TEST_INCLUDE_DIRS
+  ${CMAKE_BINARY_DIR}/common # for config.h
+  ${CMAKE_SOURCE_DIR}/libgnucash/core-utils
+  ${CMAKE_SOURCE_DIR}/libgnucash/backend/dbi/test
+  ${CMAKE_SOURCE_DIR}/libgnucash/backend/sql
+  ${CMAKE_SOURCE_DIR}/libgnucash/engine
+  ${CMAKE_SOURCE_DIR}/libgnucash/engine/test-core
+  ${CMAKE_SOURCE_DIR}/common/test-core
+  ${LIBDBI_INCLUDE_PATH}
+  ${GLIB2_INCLUDE_DIRS}
+)
+SET(BACKEND_DBI_TEST_LIBS gnc-backend-sql gncmod-engine gncmod-test-engine test-core ${Boost_REGEX_LIBRARY} ${LIBDBI_LIBRARY})
+
+SET(test_dbi_backend_SOURCES
+  test-backend-dbi.cpp
+  test-backend-dbi-basic.cpp
+  test-dbi-business-stuff.cpp
+  test-dbi-stuff.cpp
+  ../gnc-backend-dbi.cpp
+  ../gnc-dbisqlconnection.cpp
+  ../gnc-dbisqlresult.cpp
+)
+
+SET(test_dbi_backend_HEADERS test-dbi-business-stuff.h test-dbi-stuff.h)
+
+SET_DIST_LIST(test_dbi_backend_DIST ${test_dbi_backend_SOURCES} ${test_dbi_backend_HEADERS} test-dbi.xml CMakeLists.txt Makefile.am)
+
+# This test does not work on Win32
+IF (NOT WIN32)
+  GNC_ADD_TEST(test-backend-dbi "${test_dbi_backend_SOURCES}"
+    BACKEND_DBI_TEST_INCLUDE_DIRS BACKEND_DBI_TEST_LIBS
+  )
+
+  TARGET_COMPILE_DEFINITIONS(test-backend-dbi PRIVATE
+    TEST_MYSQL_URL=\"${TEST_MYSQL_URL}\"
+    TEST_PGSQL_URL=\"${TEST_PGSQL_URL}\"
+    DBI_TEST_XML_FILENAME=\"${CMAKE_CURRENT_SOURCE_DIR}/test-dbi.xml\"
+  )
+ENDIF()
diff --git a/libgnucash/backend/dbi/test/Makefile.am b/libgnucash/backend/dbi/test/Makefile.am
new file mode 100644
index 0000000..0cc447c
--- /dev/null
+++ b/libgnucash/backend/dbi/test/Makefile.am
@@ -0,0 +1,81 @@
+# Makefile.am for src/backend/dbi/test
+
+include $(top_srcdir)/test-templates/Makefile.decl
+
+AM_CPPFLAGS = \
+  -I${top_srcdir}/lib/libc \
+  -I${top_srcdir}/common \
+  -I${top_srcdir}/libgnucash/core-utils \
+  -I${top_srcdir}/libgnucash/gnc-module \
+  -I${top_srcdir}/common/test-core \
+  -I${top_srcdir}/libgnucash/engine \
+  -I${top_srcdir}/libgnucash/engine/test-core \
+  -I${top_srcdir}/libgnucash/backend/sql \
+  -DTEST_MYSQL_URL=\"${TEST_MYSQL_URL}\" \
+  -DTEST_PGSQL_URL=\"${TEST_PGSQL_URL}\" \
+  ${GLIB_CFLAGS} \
+  ${GUILE_CFLAGS} \
+  ${BOOST_CPPFLAGS}
+
+LDADD = ${top_builddir}/common/test-core/libtest-core.la \
+        ${top_builddir}/libgnucash/gnc-module/libgnc-module.la \
+        ${top_builddir}/libgnucash/engine/libgncmod-engine.la \
+        ${top_builddir}/libgnucash/engine/test-core/libgncmod-test-engine.la \
+        ${top_builddir}/libgnucash/core-utils/libgnc-core-utils.la \
+        ${top_builddir}/libgnucash/backend/sql/libgnc-backend-sql.la \
+        ${top_builddir}/libgnucash/backend/xml/libgnc-backend-xml-utils.la \
+        ${top_builddir}/lib/libc/libc-missing.la
+
+GNC_TEST_DEPS = \
+  --gnc-module-dir ${top_builddir}/libgnucash/engine \
+  --guile-load-dir ${top_builddir}/libgnucash/engine \
+  --library-dir    ${top_builddir}/libgnucash/core-utils \
+  --library-dir    ${top_builddir}/libgnucash/gnc-module \
+  --library-dir    ${top_builddir}/libgnucash/engine \
+  --library-dir    ${top_builddir}/libgnucash/backend/xml
+
+TESTS_ENVIRONMENT = \
+  GNC_BUILDDIR=${abs_top_builddir} \
+  GNC_ACCOUNT_PATH=${top_srcdir}/accounts/C \
+  SRCDIR=${srcdir} \
+  ${gnc_dbd_dir_override} \
+  $(shell ${abs_top_srcdir}/common/gnc-test-env.pl --noexports ${GNC_TEST_DEPS})
+
+EXTRA_DIST += \
+    test-dbi-stuff.h \
+    test-dbi-business-stuff.h \
+    test-dbi.xml \
+    CMakeLists.txt
+
+check_PROGRAMS = test-backend-dbi
+
+TESTS = ${check_PROGRAMS}
+
+if CUSTOM_GNC_DBD_DIR
+gnc_dbd_dir_override = GNC_DBD_DIR="@GNC_DBD_DIR@"
+endif
+
+test_backend_dbi_SOURCES = \
+    test-backend-dbi.cpp \
+    test-backend-dbi-basic.cpp \
+    test-dbi-stuff.cpp \
+    test-dbi-business-stuff.cpp \
+    ../gnc-dbisqlconnection.cpp \
+    ../gnc-backend-dbi.cpp \
+    ../gnc-dbisqlresult.cpp
+
+test_backend_dbi_CPPFLAGS = \
+	-DDBI_TEST_XML_FILENAME=\"${srcdir}/test-dbi.xml\" \
+	${AM_CPPFLAGS}
+
+test_backend_dbi_LDADD = \
+    ${BOOST_LDFLAGS} -lboost_regex \
+    ${LIBDBI_LIBS} \
+    ${LDADD}
+
+AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.backend.dbi\"
+
+# If you let make run parallel builds it complains that there is no rule to make
+# libgncmod-test-dbi.la.  This is wrong, but I can't figure out how to fix it
+# so I'll turn off parallel builds
+#.NOTPARALLEL:
diff --git a/src/backend/dbi/test/test-backend-dbi-basic.cpp b/libgnucash/backend/dbi/test/test-backend-dbi-basic.cpp
similarity index 100%
rename from src/backend/dbi/test/test-backend-dbi-basic.cpp
rename to libgnucash/backend/dbi/test/test-backend-dbi-basic.cpp
diff --git a/src/backend/dbi/test/test-backend-dbi.cpp b/libgnucash/backend/dbi/test/test-backend-dbi.cpp
similarity index 100%
rename from src/backend/dbi/test/test-backend-dbi.cpp
rename to libgnucash/backend/dbi/test/test-backend-dbi.cpp
diff --git a/src/backend/dbi/test/test-dbi-business-stuff.cpp b/libgnucash/backend/dbi/test/test-dbi-business-stuff.cpp
similarity index 100%
rename from src/backend/dbi/test/test-dbi-business-stuff.cpp
rename to libgnucash/backend/dbi/test/test-dbi-business-stuff.cpp
diff --git a/src/backend/dbi/test/test-dbi-business-stuff.h b/libgnucash/backend/dbi/test/test-dbi-business-stuff.h
similarity index 100%
rename from src/backend/dbi/test/test-dbi-business-stuff.h
rename to libgnucash/backend/dbi/test/test-dbi-business-stuff.h
diff --git a/src/backend/dbi/test/test-dbi-stuff.cpp b/libgnucash/backend/dbi/test/test-dbi-stuff.cpp
similarity index 100%
rename from src/backend/dbi/test/test-dbi-stuff.cpp
rename to libgnucash/backend/dbi/test/test-dbi-stuff.cpp
diff --git a/src/backend/dbi/test/test-dbi-stuff.h b/libgnucash/backend/dbi/test/test-dbi-stuff.h
similarity index 100%
rename from src/backend/dbi/test/test-dbi-stuff.h
rename to libgnucash/backend/dbi/test/test-dbi-stuff.h
diff --git a/src/backend/dbi/test/test-dbi.xml b/libgnucash/backend/dbi/test/test-dbi.xml
similarity index 100%
rename from src/backend/dbi/test/test-dbi.xml
rename to libgnucash/backend/dbi/test/test-dbi.xml
diff --git a/src/backend/sql/.splintrc b/libgnucash/backend/sql/.splintrc
similarity index 100%
rename from src/backend/sql/.splintrc
rename to libgnucash/backend/sql/.splintrc
diff --git a/libgnucash/backend/sql/CMakeLists.txt b/libgnucash/backend/sql/CMakeLists.txt
new file mode 100644
index 0000000..2bd6fa0
--- /dev/null
+++ b/libgnucash/backend/sql/CMakeLists.txt
@@ -0,0 +1,83 @@
+# CMakeLists.txt for libgnucash/backend/dbi
+
+ADD_SUBDIRECTORY(test)
+
+SET (backend_sql_SOURCES
+  gnc-account-sql.cpp
+  gnc-address-sql.cpp
+  gnc-bill-term-sql.cpp
+  gnc-book-sql.cpp
+  gnc-budget-sql.cpp
+  gnc-commodity-sql.cpp
+  gnc-customer-sql.cpp
+  gnc-employee-sql.cpp
+  gnc-entry-sql.cpp
+  gnc-invoice-sql.cpp
+  gnc-job-sql.cpp
+  gnc-lots-sql.cpp
+  gnc-order-sql.cpp
+  gnc-owner-sql.cpp
+  gnc-price-sql.cpp
+  gnc-recurrence-sql.cpp
+  gnc-schedxaction-sql.cpp
+  gnc-slots-sql.cpp
+  gnc-tax-table-sql.cpp
+  gnc-transaction-sql.cpp
+  gnc-vendor-sql.cpp
+  gnc-sql-backend.cpp
+  gnc-sql-result.cpp
+  gnc-sql-column-table-entry.cpp
+  gnc-sql-object-backend.cpp
+  escape.cpp
+)
+SET (backend_sql_noinst_HEADERS
+  gnc-account-sql.h
+  gnc-bill-term-sql.h
+  gnc-book-sql.h
+  gnc-budget-sql.h
+  gnc-commodity-sql.h
+  gnc-customer-sql.h
+  gnc-employee-sql.h
+  gnc-entry-sql.h
+  gnc-invoice-sql.h
+  gnc-job-sql.h
+  gnc-lots-sql.h
+  gnc-order-sql.h
+  gnc-price-sql.h
+  gnc-recurrence-sql.h
+  gnc-schedxaction-sql.h
+  gnc-slots-sql.h
+  gnc-tax-table-sql.h
+  gnc-transaction-sql.h
+  gnc-vendor-sql.h
+  gnc-sql-backend.hpp
+  gnc-sql-connection.hpp
+  gnc-sql-result.hpp
+  gnc-sql-column-table-entry.hpp
+  gnc-sql-object-backend.hpp
+  escape.h
+)
+
+SET_LOCAL_DIST(backend_sql_DIST_local ${backend_sql_SOURCES} ${backend_sql_noinst_HEADERS} CMakeLists.txt Makefile.am)
+SET(backend_sql_DIST ${backend_sql_DIST_local} ${test_backend_sql_DIST} PARENT_SCOPE)
+
+# Add dependency on config.h
+SET_SOURCE_FILES_PROPERTIES (${gnc_backend_sql_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
+
+ADD_LIBRARY	(gnc-backend-sql
+  ${backend_sql_SOURCES}
+  ${backend_sql_noinst_HEADERS}
+)
+
+TARGET_LINK_LIBRARIES(gnc-backend-sql gncmod-engine)
+
+TARGET_COMPILE_DEFINITIONS (gnc-backend-sql PRIVATE -DG_LOG_DOMAIN=\"gnc.backend.sql\")
+
+TARGET_INCLUDE_DIRECTORIES(gnc-backend-sql PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
+
+INSTALL(TARGETS gnc-backend-sql
+  LIBRARY DESTINATION lib
+  ARCHIVE DESTINATION lib
+  RUNTIME DESTINATION bin)
+
+# No headers to install
diff --git a/libgnucash/backend/sql/Makefile.am b/libgnucash/backend/sql/Makefile.am
new file mode 100644
index 0000000..db29b11
--- /dev/null
+++ b/libgnucash/backend/sql/Makefile.am
@@ -0,0 +1,84 @@
+include $(top_srcdir)/test-templates/Makefile.decl
+SUBDIRS = . test
+TEST_SUBDIRS = test
+
+# Now a shared library AND a GModule
+lib_LTLIBRARIES = libgnc-backend-sql.la
+
+# "${top_srcdir}/common/debug" below is for the splint header
+AM_CPPFLAGS = \
+  -I.. -I../.. \
+  -DLOCALE_DIR=\""$(datadir)/locale"\" \
+  -I${top_srcdir}/libgnucash/backend \
+  -I${top_srcdir}/common/debug \
+  -I${top_srcdir}/libgnucash/engine \
+  -I${top_srcdir}/libgnucash/core-utils\
+  -I${top_srcdir}/lib/libc\
+  ${GLIB_CFLAGS} \
+  ${GUILE_CFLAGS} \
+  ${WARN_CFLAGS} \
+  ${BOOST_CPPFLAGS}
+
+libgnc_backend_sql_la_SOURCES = \
+  gnc-account-sql.cpp \
+  gnc-address-sql.cpp \
+  gnc-bill-term-sql.cpp \
+  gnc-book-sql.cpp \
+  gnc-budget-sql.cpp \
+  gnc-commodity-sql.cpp \
+  gnc-customer-sql.cpp \
+  gnc-employee-sql.cpp \
+  gnc-entry-sql.cpp \
+  gnc-invoice-sql.cpp \
+  gnc-job-sql.cpp \
+  gnc-lots-sql.cpp \
+  gnc-order-sql.cpp \
+  gnc-owner-sql.cpp \
+  gnc-price-sql.cpp \
+  gnc-recurrence-sql.cpp \
+  gnc-schedxaction-sql.cpp \
+  gnc-slots-sql.cpp \
+  gnc-tax-table-sql.cpp \
+  gnc-transaction-sql.cpp \
+  gnc-vendor-sql.cpp \
+  gnc-sql-backend.cpp \
+  gnc-sql-result.cpp \
+  gnc-sql-column-table-entry.cpp \
+  gnc-sql-object-backend.cpp \
+  escape.cpp
+
+noinst_HEADERS = \
+  gnc-account-sql.h \
+  gnc-bill-term-sql.h \
+  gnc-book-sql.h \
+  gnc-budget-sql.h \
+  gnc-commodity-sql.h \
+  gnc-customer-sql.h \
+  gnc-employee-sql.h \
+  gnc-entry-sql.h \
+  gnc-invoice-sql.h \
+  gnc-job-sql.h \
+  gnc-lots-sql.h \
+  gnc-order-sql.h \
+  gnc-price-sql.h \
+  gnc-recurrence-sql.h \
+  gnc-schedxaction-sql.h \
+  gnc-slots-sql.h \
+  gnc-tax-table-sql.h \
+  gnc-transaction-sql.h \
+  gnc-vendor-sql.h \
+  gnc-sql-backend.hpp \
+  gnc-sql-connection.hpp \
+  gnc-sql-result.hpp \
+  gnc-sql-column-table-entry.hpp \
+  gnc-sql-object-backend.hpp \
+  escape.h
+
+libgnc_backend_sql_la_LIBADD = \
+   ${GLIB_LIBS} \
+   ${GUILE_LIBS} \
+   ${top_builddir}/libgnucash/engine/libgncmod-engine.la
+
+AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.backend.sql\"
+
+EXTRA_DIST += CMakeLists.txt
diff --git a/src/backend/sql/escape.cpp b/libgnucash/backend/sql/escape.cpp
similarity index 100%
rename from src/backend/sql/escape.cpp
rename to libgnucash/backend/sql/escape.cpp
diff --git a/src/backend/sql/escape.h b/libgnucash/backend/sql/escape.h
similarity index 100%
rename from src/backend/sql/escape.h
rename to libgnucash/backend/sql/escape.h
diff --git a/src/backend/sql/gnc-account-sql.cpp b/libgnucash/backend/sql/gnc-account-sql.cpp
similarity index 100%
rename from src/backend/sql/gnc-account-sql.cpp
rename to libgnucash/backend/sql/gnc-account-sql.cpp
diff --git a/src/backend/sql/gnc-account-sql.h b/libgnucash/backend/sql/gnc-account-sql.h
similarity index 100%
rename from src/backend/sql/gnc-account-sql.h
rename to libgnucash/backend/sql/gnc-account-sql.h
diff --git a/src/backend/sql/gnc-address-sql.cpp b/libgnucash/backend/sql/gnc-address-sql.cpp
similarity index 100%
rename from src/backend/sql/gnc-address-sql.cpp
rename to libgnucash/backend/sql/gnc-address-sql.cpp
diff --git a/src/backend/sql/gnc-bill-term-sql.cpp b/libgnucash/backend/sql/gnc-bill-term-sql.cpp
similarity index 100%
rename from src/backend/sql/gnc-bill-term-sql.cpp
rename to libgnucash/backend/sql/gnc-bill-term-sql.cpp
diff --git a/src/backend/sql/gnc-bill-term-sql.h b/libgnucash/backend/sql/gnc-bill-term-sql.h
similarity index 100%
rename from src/backend/sql/gnc-bill-term-sql.h
rename to libgnucash/backend/sql/gnc-bill-term-sql.h
diff --git a/src/backend/sql/gnc-book-sql.cpp b/libgnucash/backend/sql/gnc-book-sql.cpp
similarity index 100%
rename from src/backend/sql/gnc-book-sql.cpp
rename to libgnucash/backend/sql/gnc-book-sql.cpp
diff --git a/src/backend/sql/gnc-book-sql.h b/libgnucash/backend/sql/gnc-book-sql.h
similarity index 100%
rename from src/backend/sql/gnc-book-sql.h
rename to libgnucash/backend/sql/gnc-book-sql.h
diff --git a/src/backend/sql/gnc-budget-sql.cpp b/libgnucash/backend/sql/gnc-budget-sql.cpp
similarity index 100%
rename from src/backend/sql/gnc-budget-sql.cpp
rename to libgnucash/backend/sql/gnc-budget-sql.cpp
diff --git a/src/backend/sql/gnc-budget-sql.h b/libgnucash/backend/sql/gnc-budget-sql.h
similarity index 100%
rename from src/backend/sql/gnc-budget-sql.h
rename to libgnucash/backend/sql/gnc-budget-sql.h
diff --git a/src/backend/sql/gnc-commodity-sql.cpp b/libgnucash/backend/sql/gnc-commodity-sql.cpp
similarity index 100%
rename from src/backend/sql/gnc-commodity-sql.cpp
rename to libgnucash/backend/sql/gnc-commodity-sql.cpp
diff --git a/src/backend/sql/gnc-commodity-sql.h b/libgnucash/backend/sql/gnc-commodity-sql.h
similarity index 100%
rename from src/backend/sql/gnc-commodity-sql.h
rename to libgnucash/backend/sql/gnc-commodity-sql.h
diff --git a/src/backend/sql/gnc-customer-sql.cpp b/libgnucash/backend/sql/gnc-customer-sql.cpp
similarity index 100%
rename from src/backend/sql/gnc-customer-sql.cpp
rename to libgnucash/backend/sql/gnc-customer-sql.cpp
diff --git a/src/backend/sql/gnc-customer-sql.h b/libgnucash/backend/sql/gnc-customer-sql.h
similarity index 100%
rename from src/backend/sql/gnc-customer-sql.h
rename to libgnucash/backend/sql/gnc-customer-sql.h
diff --git a/src/backend/sql/gnc-employee-sql.cpp b/libgnucash/backend/sql/gnc-employee-sql.cpp
similarity index 100%
rename from src/backend/sql/gnc-employee-sql.cpp
rename to libgnucash/backend/sql/gnc-employee-sql.cpp
diff --git a/src/backend/sql/gnc-employee-sql.h b/libgnucash/backend/sql/gnc-employee-sql.h
similarity index 100%
rename from src/backend/sql/gnc-employee-sql.h
rename to libgnucash/backend/sql/gnc-employee-sql.h
diff --git a/src/backend/sql/gnc-entry-sql.cpp b/libgnucash/backend/sql/gnc-entry-sql.cpp
similarity index 100%
rename from src/backend/sql/gnc-entry-sql.cpp
rename to libgnucash/backend/sql/gnc-entry-sql.cpp
diff --git a/src/backend/sql/gnc-entry-sql.h b/libgnucash/backend/sql/gnc-entry-sql.h
similarity index 100%
rename from src/backend/sql/gnc-entry-sql.h
rename to libgnucash/backend/sql/gnc-entry-sql.h
diff --git a/src/backend/sql/gnc-invoice-sql.cpp b/libgnucash/backend/sql/gnc-invoice-sql.cpp
similarity index 100%
rename from src/backend/sql/gnc-invoice-sql.cpp
rename to libgnucash/backend/sql/gnc-invoice-sql.cpp
diff --git a/src/backend/sql/gnc-invoice-sql.h b/libgnucash/backend/sql/gnc-invoice-sql.h
similarity index 100%
rename from src/backend/sql/gnc-invoice-sql.h
rename to libgnucash/backend/sql/gnc-invoice-sql.h
diff --git a/src/backend/sql/gnc-job-sql.cpp b/libgnucash/backend/sql/gnc-job-sql.cpp
similarity index 100%
rename from src/backend/sql/gnc-job-sql.cpp
rename to libgnucash/backend/sql/gnc-job-sql.cpp
diff --git a/src/backend/sql/gnc-job-sql.h b/libgnucash/backend/sql/gnc-job-sql.h
similarity index 100%
rename from src/backend/sql/gnc-job-sql.h
rename to libgnucash/backend/sql/gnc-job-sql.h
diff --git a/src/backend/sql/gnc-lots-sql.cpp b/libgnucash/backend/sql/gnc-lots-sql.cpp
similarity index 100%
rename from src/backend/sql/gnc-lots-sql.cpp
rename to libgnucash/backend/sql/gnc-lots-sql.cpp
diff --git a/src/backend/sql/gnc-lots-sql.h b/libgnucash/backend/sql/gnc-lots-sql.h
similarity index 100%
rename from src/backend/sql/gnc-lots-sql.h
rename to libgnucash/backend/sql/gnc-lots-sql.h
diff --git a/src/backend/sql/gnc-order-sql.cpp b/libgnucash/backend/sql/gnc-order-sql.cpp
similarity index 100%
rename from src/backend/sql/gnc-order-sql.cpp
rename to libgnucash/backend/sql/gnc-order-sql.cpp
diff --git a/src/backend/sql/gnc-order-sql.h b/libgnucash/backend/sql/gnc-order-sql.h
similarity index 100%
rename from src/backend/sql/gnc-order-sql.h
rename to libgnucash/backend/sql/gnc-order-sql.h
diff --git a/src/backend/sql/gnc-owner-sql.cpp b/libgnucash/backend/sql/gnc-owner-sql.cpp
similarity index 100%
rename from src/backend/sql/gnc-owner-sql.cpp
rename to libgnucash/backend/sql/gnc-owner-sql.cpp
diff --git a/src/backend/sql/gnc-price-sql.cpp b/libgnucash/backend/sql/gnc-price-sql.cpp
similarity index 100%
rename from src/backend/sql/gnc-price-sql.cpp
rename to libgnucash/backend/sql/gnc-price-sql.cpp
diff --git a/src/backend/sql/gnc-price-sql.h b/libgnucash/backend/sql/gnc-price-sql.h
similarity index 100%
rename from src/backend/sql/gnc-price-sql.h
rename to libgnucash/backend/sql/gnc-price-sql.h
diff --git a/src/backend/sql/gnc-recurrence-sql.cpp b/libgnucash/backend/sql/gnc-recurrence-sql.cpp
similarity index 100%
rename from src/backend/sql/gnc-recurrence-sql.cpp
rename to libgnucash/backend/sql/gnc-recurrence-sql.cpp
diff --git a/src/backend/sql/gnc-recurrence-sql.h b/libgnucash/backend/sql/gnc-recurrence-sql.h
similarity index 100%
rename from src/backend/sql/gnc-recurrence-sql.h
rename to libgnucash/backend/sql/gnc-recurrence-sql.h
diff --git a/src/backend/sql/gnc-schedxaction-sql.cpp b/libgnucash/backend/sql/gnc-schedxaction-sql.cpp
similarity index 100%
rename from src/backend/sql/gnc-schedxaction-sql.cpp
rename to libgnucash/backend/sql/gnc-schedxaction-sql.cpp
diff --git a/src/backend/sql/gnc-schedxaction-sql.h b/libgnucash/backend/sql/gnc-schedxaction-sql.h
similarity index 100%
rename from src/backend/sql/gnc-schedxaction-sql.h
rename to libgnucash/backend/sql/gnc-schedxaction-sql.h
diff --git a/src/backend/sql/gnc-slots-sql.cpp b/libgnucash/backend/sql/gnc-slots-sql.cpp
similarity index 100%
rename from src/backend/sql/gnc-slots-sql.cpp
rename to libgnucash/backend/sql/gnc-slots-sql.cpp
diff --git a/src/backend/sql/gnc-slots-sql.h b/libgnucash/backend/sql/gnc-slots-sql.h
similarity index 100%
rename from src/backend/sql/gnc-slots-sql.h
rename to libgnucash/backend/sql/gnc-slots-sql.h
diff --git a/src/backend/sql/gnc-sql-backend.cpp b/libgnucash/backend/sql/gnc-sql-backend.cpp
similarity index 100%
rename from src/backend/sql/gnc-sql-backend.cpp
rename to libgnucash/backend/sql/gnc-sql-backend.cpp
diff --git a/src/backend/sql/gnc-sql-backend.hpp b/libgnucash/backend/sql/gnc-sql-backend.hpp
similarity index 100%
rename from src/backend/sql/gnc-sql-backend.hpp
rename to libgnucash/backend/sql/gnc-sql-backend.hpp
diff --git a/src/backend/sql/gnc-sql-column-table-entry.cpp b/libgnucash/backend/sql/gnc-sql-column-table-entry.cpp
similarity index 100%
rename from src/backend/sql/gnc-sql-column-table-entry.cpp
rename to libgnucash/backend/sql/gnc-sql-column-table-entry.cpp
diff --git a/src/backend/sql/gnc-sql-column-table-entry.hpp b/libgnucash/backend/sql/gnc-sql-column-table-entry.hpp
similarity index 100%
rename from src/backend/sql/gnc-sql-column-table-entry.hpp
rename to libgnucash/backend/sql/gnc-sql-column-table-entry.hpp
diff --git a/src/backend/sql/gnc-sql-connection.hpp b/libgnucash/backend/sql/gnc-sql-connection.hpp
similarity index 100%
rename from src/backend/sql/gnc-sql-connection.hpp
rename to libgnucash/backend/sql/gnc-sql-connection.hpp
diff --git a/src/backend/sql/gnc-sql-object-backend.cpp b/libgnucash/backend/sql/gnc-sql-object-backend.cpp
similarity index 100%
rename from src/backend/sql/gnc-sql-object-backend.cpp
rename to libgnucash/backend/sql/gnc-sql-object-backend.cpp
diff --git a/src/backend/sql/gnc-sql-object-backend.hpp b/libgnucash/backend/sql/gnc-sql-object-backend.hpp
similarity index 100%
rename from src/backend/sql/gnc-sql-object-backend.hpp
rename to libgnucash/backend/sql/gnc-sql-object-backend.hpp
diff --git a/src/backend/sql/gnc-sql-result.cpp b/libgnucash/backend/sql/gnc-sql-result.cpp
similarity index 100%
rename from src/backend/sql/gnc-sql-result.cpp
rename to libgnucash/backend/sql/gnc-sql-result.cpp
diff --git a/src/backend/sql/gnc-sql-result.hpp b/libgnucash/backend/sql/gnc-sql-result.hpp
similarity index 100%
rename from src/backend/sql/gnc-sql-result.hpp
rename to libgnucash/backend/sql/gnc-sql-result.hpp
diff --git a/src/backend/sql/gnc-tax-table-sql.cpp b/libgnucash/backend/sql/gnc-tax-table-sql.cpp
similarity index 100%
rename from src/backend/sql/gnc-tax-table-sql.cpp
rename to libgnucash/backend/sql/gnc-tax-table-sql.cpp
diff --git a/src/backend/sql/gnc-tax-table-sql.h b/libgnucash/backend/sql/gnc-tax-table-sql.h
similarity index 100%
rename from src/backend/sql/gnc-tax-table-sql.h
rename to libgnucash/backend/sql/gnc-tax-table-sql.h
diff --git a/src/backend/sql/gnc-transaction-sql.cpp b/libgnucash/backend/sql/gnc-transaction-sql.cpp
similarity index 100%
rename from src/backend/sql/gnc-transaction-sql.cpp
rename to libgnucash/backend/sql/gnc-transaction-sql.cpp
diff --git a/src/backend/sql/gnc-transaction-sql.h b/libgnucash/backend/sql/gnc-transaction-sql.h
similarity index 100%
rename from src/backend/sql/gnc-transaction-sql.h
rename to libgnucash/backend/sql/gnc-transaction-sql.h
diff --git a/src/backend/sql/gnc-vendor-sql.cpp b/libgnucash/backend/sql/gnc-vendor-sql.cpp
similarity index 100%
rename from src/backend/sql/gnc-vendor-sql.cpp
rename to libgnucash/backend/sql/gnc-vendor-sql.cpp
diff --git a/src/backend/sql/gnc-vendor-sql.h b/libgnucash/backend/sql/gnc-vendor-sql.h
similarity index 100%
rename from src/backend/sql/gnc-vendor-sql.h
rename to libgnucash/backend/sql/gnc-vendor-sql.h
diff --git a/libgnucash/backend/sql/test/CMakeLists.txt b/libgnucash/backend/sql/test/CMakeLists.txt
new file mode 100644
index 0000000..e97de3a
--- /dev/null
+++ b/libgnucash/backend/sql/test/CMakeLists.txt
@@ -0,0 +1,25 @@
+
+SET(BACKEND_SQL_TEST_INCLUDE_DIRS
+  ${CMAKE_BINARY_DIR}/common # for config.h
+  ${CMAKE_SOURCE_DIR}/libgnucash/backend/sql
+  ${CMAKE_SOURCE_DIR}/libgnucash/engine
+  ${CMAKE_SOURCE_DIR}/common/test-core
+  ${GLIB2_INCLUDE_DIRS}
+)
+
+SET(test_backend_sql_SOURCES test-sqlbe.cpp utest-gnc-backend-sql.cpp)
+
+SET(BACKEND_SQL_TEST_LIBS gnc-backend-sql gncmod-engine test-core)
+
+SET_DIST_LIST(test_backend_sql_DIST ${test_backend_sql_SOURCES} CMakeLists.txt
+  Makefile.am test-column-types.cpp)
+
+# This test does not actually do anything.
+GNC_ADD_TEST(test-column-types test-column-types.cpp
+   BACKEND_SQL_TEST_INCLUDE_DIRS BACKEND_SQL_TEST_LIBS
+)
+
+GNC_ADD_TEST(test-sqlbe "${test_backend_sql_SOURCES}"
+   BACKEND_SQL_TEST_INCLUDE_DIRS BACKEND_SQL_TEST_LIBS
+)
+TARGET_COMPILE_DEFINITIONS(test-sqlbe PRIVATE TESTPROG=test_sqlbe)
diff --git a/libgnucash/backend/sql/test/Makefile.am b/libgnucash/backend/sql/test/Makefile.am
new file mode 100644
index 0000000..8eaa5ac
--- /dev/null
+++ b/libgnucash/backend/sql/test/Makefile.am
@@ -0,0 +1,72 @@
+SUBDIRS = .
+
+include $(top_srcdir)/test-templates/Makefile.decl
+MODULEPATH = libgnucash/backend/sql
+
+test_column_types_SOURCES = \
+  test-column-types.cpp
+
+check_PROGRAMS = \
+  test-column-types \
+  test-sqlbe
+
+TESTS = ${check_PROGRAMS}
+
+GNC_TEST_DEPS = \
+  --gnc-module-dir ${top_builddir}/libgnucash/engine \
+  --guile-load-dir ${top_builddir}/libgnucash/engine \
+  --library-dir    ${top_builddir}/libgnucash/core-utils \
+  --library-dir    ${top_builddir}/libgnucash/gnc-module \
+  --library-dir    ${top_builddir}/libgnucash/engine \
+  --library-dir    ${top_builddir}/libgnucash/backend/sql
+
+TESTS_ENVIRONMENT = \
+  GNC_ACCOUNT_PATH=${top_srcdir}/accounts/C \
+  SRCDIR=${srcdir} \
+  $(shell ${abs_top_srcdir}/common/gnc-test-env.pl --noexports ${GNC_TEST_DEPS})
+
+LDADD = ${top_builddir}/common/test-core/libtest-core.la \
+        ${top_builddir}/libgnucash/gnc-module/libgnc-module.la \
+        ${top_builddir}/libgnucash/backend/sql/libgnc-backend-sql.la \
+        ${top_builddir}/libgnucash/engine/libgncmod-engine.la \
+        ${top_builddir}/libgnucash/engine/test-core/libgncmod-test-engine.la \
+        ${top_builddir}/libgnucash/core-utils/libgnc-core-utils.la \
+        ${top_builddir}/lib/libc/libc-missing.la
+
+AM_CPPFLAGS = \
+  -I${top_srcdir}/lib/libc \
+  -I${top_srcdir}/common \
+  -I${top_srcdir}/libgnucash/core-utils \
+  -I${top_srcdir}/libgnucash/gnc-module \
+  -I${top_srcdir}/common/test-core \
+  -I${top_srcdir}/libgnucash/engine \
+  -I${top_srcdir}/libgnucash/engine/test-core \
+  -I${top_srcdir}/libgnucash/backend/sql \
+  ${GLIB_CFLAGS} \
+  ${GUILE_CFLAGS}
+
+AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.backend.sql\"
+
+#test_sqlbedir = ${top_srcdir}/${MODULEPATH}/test
+
+test_sqlbe_SOURCES = \
+	test-sqlbe.cpp \
+	utest-gnc-backend-sql.cpp
+
+test_sqlbe_LDADD = \
+	$(top_builddir)/$(MODULEPATH)/libgnc-backend-sql.la \
+	$(top_builddir)/libgnucash/engine/libgncmod-engine.la \
+	$(top_builddir)/common/test-core/libtest-core.la \
+	$(top_builddir)/libgnucash/core-utils/libgnc-core-utils.la \
+	$(GLIB_LIBS)
+
+test_sqlbe_CFLAGS = \
+	-DTESTPROG=test_sqlbe \
+	$(DEFAULT_INCLUDES) \
+	-I$(top_srcdir)/$(MODULEPATH)/ \
+	-I$(top_srcdir)/libgnucash/backend/dbi/ \
+	-I$(top_srcdir)/libgnucash/engine/ \
+	-I$(top_srcdir)/common/test-core/ \
+	$(GLIB_CFLAGS)
+
+EXTRA_DIST += CMakeLists.txt
diff --git a/src/backend/sql/test/test-column-types.cpp b/libgnucash/backend/sql/test/test-column-types.cpp
similarity index 100%
rename from src/backend/sql/test/test-column-types.cpp
rename to libgnucash/backend/sql/test/test-column-types.cpp
diff --git a/src/backend/sql/test/test-sqlbe.cpp b/libgnucash/backend/sql/test/test-sqlbe.cpp
similarity index 100%
rename from src/backend/sql/test/test-sqlbe.cpp
rename to libgnucash/backend/sql/test/test-sqlbe.cpp
diff --git a/src/backend/sql/test/utest-gnc-backend-sql.cpp b/libgnucash/backend/sql/test/utest-gnc-backend-sql.cpp
similarity index 100%
rename from src/backend/sql/test/utest-gnc-backend-sql.cpp
rename to libgnucash/backend/sql/test/utest-gnc-backend-sql.cpp
diff --git a/libgnucash/backend/xml/CMakeLists.txt b/libgnucash/backend/xml/CMakeLists.txt
new file mode 100644
index 0000000..aafc4cd
--- /dev/null
+++ b/libgnucash/backend/xml/CMakeLists.txt
@@ -0,0 +1,129 @@
+# CMakeLists.txt for libgnucash/backend/xml
+
+ADD_SUBDIRECTORY(test)
+
+SET (backend_xml_utils_noinst_HEADERS
+  gnc-backend-xml.h
+  gnc-xml.h
+  gnc-address-xml-v2.h
+  gnc-bill-term-xml-v2.h
+  gnc-customer-xml-v2.h
+  gnc-employee-xml-v2.h
+  gnc-entry-xml-v2.h
+  gnc-invoice-xml-v2.h
+  gnc-job-xml-v2.h
+  gnc-order-xml-v2.h
+  gnc-owner-xml-v2.h
+  gnc-tax-table-xml-v2.h
+  gnc-vendor-xml-v2.h
+  gnc-xml-backend.hpp
+  gnc-xml-helper.h
+  io-example-account.h
+  io-gncxml-gen.h
+  io-gncxml-v2.h
+  io-gncxml.h
+  io-utils.h
+  sixtp-dom-generators.h
+  sixtp-dom-parsers.h
+  sixtp-parsers.h
+  sixtp-stack.h
+  sixtp-utils.h
+  sixtp.h
+  xml-helpers.h
+)
+
+SET (backend_xml_utils_SOURCES
+  gnc-account-xml-v2.cpp
+  gnc-address-xml-v2.cpp
+  gnc-bill-term-xml-v2.cpp
+  gnc-book-xml-v2.cpp
+  gnc-budget-xml-v2.cpp
+  gnc-commodity-xml-v2.cpp
+  gnc-customer-xml-v2.cpp
+  gnc-employee-xml-v2.cpp
+  gnc-entry-xml-v2.cpp
+  gnc-freqspec-xml-v2.cpp
+  gnc-invoice-xml-v2.cpp
+  gnc-job-xml-v2.cpp
+  gnc-lot-xml-v2.cpp
+  gnc-order-xml-v2.cpp
+  gnc-owner-xml-v2.cpp
+  gnc-pricedb-xml-v2.cpp
+  gnc-recurrence-xml-v2.cpp
+  gnc-schedxaction-xml-v2.cpp
+  gnc-tax-table-xml-v2.cpp
+  gnc-transaction-xml-v2.cpp
+  gnc-vendor-xml-v2.cpp
+  gnc-xml-backend.cpp
+  gnc-xml-helper.cpp
+  io-example-account.cpp
+  io-gncxml-gen.cpp
+  io-gncxml-v1.cpp
+  io-gncxml-v2.cpp
+  io-utils.cpp
+  sixtp-dom-generators.cpp
+  sixtp-dom-parsers.cpp
+  sixtp-stack.cpp
+  sixtp-to-dom-parser.cpp
+  sixtp-utils.cpp
+  sixtp.cpp
+)
+
+SET_LOCAL_DIST(backend_xml_DIST_local ${backend_xml_utils_SOURCES}
+  ${backend_xml_utils_noinst_HEADERS} gnc-backend-xml.cpp CMakeLists.txt
+  Makefile.am)
+SET(backend_xml_DIST ${backend_xml_DIST_local} ${test_backend_xml_DIST} PARENT_SCOPE)
+
+# Add dependency on config.h
+SET_SOURCE_FILES_PROPERTIES (${backend_xml_utils_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
+
+ADD_LIBRARY	(gnc-backend-xml-utils
+  ${backend_xml_utils_SOURCES}
+  ${backend_xml_utils_noinst_HEADERS}
+)
+
+TARGET_LINK_LIBRARIES(gnc-backend-xml-utils gncmod-engine ${LIBXML2_LDFLAGS} ${ZLIB_LDFLAGS})
+
+TARGET_INCLUDE_DIRECTORIES (gnc-backend-xml-utils
+  PUBLIC  ${LIBXML2_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}
+  PRIVATE ${ZLIB_INCLUDE_DIRS}
+)
+
+TARGET_COMPILE_DEFINITIONS (gnc-backend-xml-utils PRIVATE -DG_LOG_DOMAIN=\"gnc.backend.xml\" -DU_SHOW_CPLUSPLUS_API=0)
+
+INSTALL(TARGETS gnc-backend-xml-utils
+  LIBRARY DESTINATION lib
+  ARCHIVE DESTINATION lib
+  RUNTIME DESTINATION bin)
+# No headers to install
+
+# ----
+
+SET(libgncmod_backend_xml_SOURCES gnc-backend-xml.cpp)
+
+SET_SOURCE_FILES_PROPERTIES (${libgncmod_backend_xml_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
+
+ADD_LIBRARY(gncmod-backend-xml MODULE ${libgncmod_backend_xml_SOURCES})
+TARGET_LINK_LIBRARIES(gncmod-backend-xml gnc-backend-xml-utils gncmod-engine
+                        gnc-core-utils ${LIBXML2_LDFLAGS} ${GLIB2_LDFLAGS} ${ZLIB_LIBRARY})
+
+TARGET_COMPILE_DEFINITIONS (gncmod-backend-xml PRIVATE -DG_LOG_DOMAIN=\"gnc.backend.xml\" -DU_SHOW_CPLUSPLUS_API=0)
+
+SET(LIB_DIR lib/gnucash)
+IF (WIN32)
+  SET(LIB_DIR bin)
+ENDIF(WIN32)
+
+
+INSTALL(TARGETS gncmod-backend-xml
+  LIBRARY DESTINATION ${LIB_DIR}
+  ARCHIVE DESTINATION ${LIB_DIR}
+  RUNTIME DESTINATION bin)
+
+# ----
+
+# Special normal (non-MODULE) library for cutecash only
+ADD_LIBRARY(gncmod-backend-xml-utils ${libgncmod_backend_xml_SOURCES})
+TARGET_LINK_LIBRARIES(gncmod-backend-xml-utils gnc-backend-xml-utils gncmod-engine
+                        gnc-core-utils ${LIBXML2_LDFLAGS} ${GLIB2_LDFLAGS} ${ZLIB_LIBRARY})
+TARGET_COMPILE_DEFINITIONS (gncmod-backend-xml-utils PRIVATE -DG_LOG_DOMAIN=\"gnc.backend.xml\" -DU_SHOW_CPLUSPLUS_API=0)
diff --git a/libgnucash/backend/xml/Makefile.am b/libgnucash/backend/xml/Makefile.am
new file mode 100644
index 0000000..e16f33e
--- /dev/null
+++ b/libgnucash/backend/xml/Makefile.am
@@ -0,0 +1,107 @@
+SUBDIRS = . test
+
+# Now a shared library AND a GModule
+lib_LTLIBRARIES = libgnc-backend-xml-utils.la
+pkglib_LTLIBRARIES = libgncmod-backend-xml.la
+
+AM_CPPFLAGS = \
+  -I.. -I../.. \
+  -DLOCALE_DIR=\""$(datadir)/locale"\" \
+  -DU_SHOW_CPLUSPLUS_API=0 \
+  -I${top_srcdir}/libgnucash/backend \
+  -I${top_srcdir}/libgnucash/engine \
+  -I${top_srcdir}/libgnucash/core-utils \
+  -I${top_srcdir}/libgnucash/gnc-module \
+  -I${top_srcdir}/lib/libc\
+  -I$(top_srcdir)/common \
+  ${LIBXML2_CFLAGS} \
+  ${GLIB_CFLAGS} \
+  ${BOOST_CPPFLAGS}
+
+libgnc_backend_xml_utils_la_SOURCES = \
+  gnc-account-xml-v2.cpp \
+  gnc-address-xml-v2.cpp \
+  gnc-bill-term-xml-v2.cpp \
+  gnc-book-xml-v2.cpp \
+  gnc-budget-xml-v2.cpp \
+  gnc-commodity-xml-v2.cpp \
+  gnc-customer-xml-v2.cpp \
+  gnc-employee-xml-v2.cpp \
+  gnc-entry-xml-v2.cpp \
+  gnc-freqspec-xml-v2.cpp \
+  gnc-invoice-xml-v2.cpp \
+  gnc-job-xml-v2.cpp \
+  gnc-lot-xml-v2.cpp \
+  gnc-order-xml-v2.cpp \
+  gnc-owner-xml-v2.cpp \
+  gnc-pricedb-xml-v2.cpp \
+  gnc-recurrence-xml-v2.cpp \
+  gnc-schedxaction-xml-v2.cpp \
+  gnc-tax-table-xml-v2.cpp \
+  gnc-transaction-xml-v2.cpp \
+  gnc-vendor-xml-v2.cpp \
+  gnc-xml-backend.cpp \
+  gnc-xml-helper.cpp \
+  io-example-account.cpp \
+  io-gncxml-gen.cpp \
+  io-gncxml-v1.cpp \
+  io-gncxml-v2.cpp \
+  io-utils.cpp \
+  sixtp-dom-generators.cpp \
+  sixtp-dom-parsers.cpp \
+  sixtp-stack.cpp \
+  sixtp-to-dom-parser.cpp \
+  sixtp-utils.cpp \
+  sixtp.cpp
+
+libgncmod_backend_xml_la_SOURCES = \
+  gnc-backend-xml.cpp
+
+noinst_HEADERS = \
+  gnc-backend-xml.h \
+  gnc-xml.h \
+  gnc-address-xml-v2.h \
+  gnc-bill-term-xml-v2.h \
+  gnc-customer-xml-v2.h \
+  gnc-employee-xml-v2.h \
+  gnc-entry-xml-v2.h \
+  gnc-invoice-xml-v2.h \
+  gnc-job-xml-v2.h \
+  gnc-order-xml-v2.h \
+  gnc-owner-xml-v2.h \
+  gnc-tax-table-xml-v2.h \
+  gnc-vendor-xml-v2.h \
+  gnc-xml-backend.hpp \
+  gnc-xml-helper.h \
+  io-example-account.h \
+  io-gncxml-gen.h \
+  io-gncxml-v2.h \
+  io-gncxml.h \
+  io-utils.h \
+  sixtp-dom-generators.h \
+  sixtp-dom-parsers.h \
+  sixtp-parsers.h \
+  sixtp-stack.h \
+  sixtp-utils.h \
+  sixtp.h \
+  xml-helpers.h
+
+libgnc_backend_xml_utils_la_LIBADD = \
+   ${GLIB_LIBS} \
+   ${LIBXML2_LIBS} \
+   ${ZLIB_LIBS} \
+   ${top_builddir}/libgnucash/engine/libgncmod-engine.la \
+   ${top_builddir}/libgnucash/core-utils/libgnc-core-utils.la
+
+libgncmod_backend_xml_la_LDFLAGS = -module -avoid-version
+libgncmod_backend_xml_la_LIBADD = \
+   ${GLIB_LIBS} \
+   ${LIBXML2_LIBS} \
+   ${ZLIB_LIBS} \
+   ${top_builddir}/libgnucash/engine/libgncmod-engine.la \
+   ${top_builddir}/libgnucash/core-utils/libgnc-core-utils.la \
+   libgnc-backend-xml-utils.la
+
+AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.backend.xml\"
+
+EXTRA_DIST = CMakeLists.txt
diff --git a/src/backend/xml/gnc-account-xml-v2.cpp b/libgnucash/backend/xml/gnc-account-xml-v2.cpp
similarity index 100%
rename from src/backend/xml/gnc-account-xml-v2.cpp
rename to libgnucash/backend/xml/gnc-account-xml-v2.cpp
diff --git a/src/backend/xml/gnc-address-xml-v2.cpp b/libgnucash/backend/xml/gnc-address-xml-v2.cpp
similarity index 100%
rename from src/backend/xml/gnc-address-xml-v2.cpp
rename to libgnucash/backend/xml/gnc-address-xml-v2.cpp
diff --git a/src/backend/xml/gnc-address-xml-v2.h b/libgnucash/backend/xml/gnc-address-xml-v2.h
similarity index 100%
rename from src/backend/xml/gnc-address-xml-v2.h
rename to libgnucash/backend/xml/gnc-address-xml-v2.h
diff --git a/src/backend/xml/gnc-backend-xml.cpp b/libgnucash/backend/xml/gnc-backend-xml.cpp
similarity index 100%
rename from src/backend/xml/gnc-backend-xml.cpp
rename to libgnucash/backend/xml/gnc-backend-xml.cpp
diff --git a/src/backend/xml/gnc-backend-xml.h b/libgnucash/backend/xml/gnc-backend-xml.h
similarity index 100%
rename from src/backend/xml/gnc-backend-xml.h
rename to libgnucash/backend/xml/gnc-backend-xml.h
diff --git a/src/backend/xml/gnc-bill-term-xml-v2.cpp b/libgnucash/backend/xml/gnc-bill-term-xml-v2.cpp
similarity index 100%
rename from src/backend/xml/gnc-bill-term-xml-v2.cpp
rename to libgnucash/backend/xml/gnc-bill-term-xml-v2.cpp
diff --git a/src/backend/xml/gnc-bill-term-xml-v2.h b/libgnucash/backend/xml/gnc-bill-term-xml-v2.h
similarity index 100%
rename from src/backend/xml/gnc-bill-term-xml-v2.h
rename to libgnucash/backend/xml/gnc-bill-term-xml-v2.h
diff --git a/src/backend/xml/gnc-book-xml-v2.cpp b/libgnucash/backend/xml/gnc-book-xml-v2.cpp
similarity index 100%
rename from src/backend/xml/gnc-book-xml-v2.cpp
rename to libgnucash/backend/xml/gnc-book-xml-v2.cpp
diff --git a/src/backend/xml/gnc-budget-xml-v2.cpp b/libgnucash/backend/xml/gnc-budget-xml-v2.cpp
similarity index 100%
rename from src/backend/xml/gnc-budget-xml-v2.cpp
rename to libgnucash/backend/xml/gnc-budget-xml-v2.cpp
diff --git a/src/backend/xml/gnc-commodity-xml-v2.cpp b/libgnucash/backend/xml/gnc-commodity-xml-v2.cpp
similarity index 100%
rename from src/backend/xml/gnc-commodity-xml-v2.cpp
rename to libgnucash/backend/xml/gnc-commodity-xml-v2.cpp
diff --git a/src/backend/xml/gnc-customer-xml-v2.cpp b/libgnucash/backend/xml/gnc-customer-xml-v2.cpp
similarity index 100%
rename from src/backend/xml/gnc-customer-xml-v2.cpp
rename to libgnucash/backend/xml/gnc-customer-xml-v2.cpp
diff --git a/src/backend/xml/gnc-customer-xml-v2.h b/libgnucash/backend/xml/gnc-customer-xml-v2.h
similarity index 100%
rename from src/backend/xml/gnc-customer-xml-v2.h
rename to libgnucash/backend/xml/gnc-customer-xml-v2.h
diff --git a/src/backend/xml/gnc-employee-xml-v2.cpp b/libgnucash/backend/xml/gnc-employee-xml-v2.cpp
similarity index 100%
rename from src/backend/xml/gnc-employee-xml-v2.cpp
rename to libgnucash/backend/xml/gnc-employee-xml-v2.cpp
diff --git a/src/backend/xml/gnc-employee-xml-v2.h b/libgnucash/backend/xml/gnc-employee-xml-v2.h
similarity index 100%
rename from src/backend/xml/gnc-employee-xml-v2.h
rename to libgnucash/backend/xml/gnc-employee-xml-v2.h
diff --git a/src/backend/xml/gnc-entry-xml-v2.cpp b/libgnucash/backend/xml/gnc-entry-xml-v2.cpp
similarity index 100%
rename from src/backend/xml/gnc-entry-xml-v2.cpp
rename to libgnucash/backend/xml/gnc-entry-xml-v2.cpp
diff --git a/src/backend/xml/gnc-entry-xml-v2.h b/libgnucash/backend/xml/gnc-entry-xml-v2.h
similarity index 100%
rename from src/backend/xml/gnc-entry-xml-v2.h
rename to libgnucash/backend/xml/gnc-entry-xml-v2.h
diff --git a/src/backend/xml/gnc-freqspec-xml-v2.cpp b/libgnucash/backend/xml/gnc-freqspec-xml-v2.cpp
similarity index 100%
rename from src/backend/xml/gnc-freqspec-xml-v2.cpp
rename to libgnucash/backend/xml/gnc-freqspec-xml-v2.cpp
diff --git a/src/backend/xml/gnc-invoice-xml-v2.cpp b/libgnucash/backend/xml/gnc-invoice-xml-v2.cpp
similarity index 100%
rename from src/backend/xml/gnc-invoice-xml-v2.cpp
rename to libgnucash/backend/xml/gnc-invoice-xml-v2.cpp
diff --git a/src/backend/xml/gnc-invoice-xml-v2.h b/libgnucash/backend/xml/gnc-invoice-xml-v2.h
similarity index 100%
rename from src/backend/xml/gnc-invoice-xml-v2.h
rename to libgnucash/backend/xml/gnc-invoice-xml-v2.h
diff --git a/src/backend/xml/gnc-job-xml-v2.cpp b/libgnucash/backend/xml/gnc-job-xml-v2.cpp
similarity index 100%
rename from src/backend/xml/gnc-job-xml-v2.cpp
rename to libgnucash/backend/xml/gnc-job-xml-v2.cpp
diff --git a/src/backend/xml/gnc-job-xml-v2.h b/libgnucash/backend/xml/gnc-job-xml-v2.h
similarity index 100%
rename from src/backend/xml/gnc-job-xml-v2.h
rename to libgnucash/backend/xml/gnc-job-xml-v2.h
diff --git a/src/backend/xml/gnc-lot-xml-v2.cpp b/libgnucash/backend/xml/gnc-lot-xml-v2.cpp
similarity index 100%
rename from src/backend/xml/gnc-lot-xml-v2.cpp
rename to libgnucash/backend/xml/gnc-lot-xml-v2.cpp
diff --git a/src/backend/xml/gnc-order-xml-v2.cpp b/libgnucash/backend/xml/gnc-order-xml-v2.cpp
similarity index 100%
rename from src/backend/xml/gnc-order-xml-v2.cpp
rename to libgnucash/backend/xml/gnc-order-xml-v2.cpp
diff --git a/src/backend/xml/gnc-order-xml-v2.h b/libgnucash/backend/xml/gnc-order-xml-v2.h
similarity index 100%
rename from src/backend/xml/gnc-order-xml-v2.h
rename to libgnucash/backend/xml/gnc-order-xml-v2.h
diff --git a/src/backend/xml/gnc-owner-xml-v2.cpp b/libgnucash/backend/xml/gnc-owner-xml-v2.cpp
similarity index 100%
rename from src/backend/xml/gnc-owner-xml-v2.cpp
rename to libgnucash/backend/xml/gnc-owner-xml-v2.cpp
diff --git a/src/backend/xml/gnc-owner-xml-v2.h b/libgnucash/backend/xml/gnc-owner-xml-v2.h
similarity index 100%
rename from src/backend/xml/gnc-owner-xml-v2.h
rename to libgnucash/backend/xml/gnc-owner-xml-v2.h
diff --git a/src/backend/xml/gnc-pricedb-xml-v2.cpp b/libgnucash/backend/xml/gnc-pricedb-xml-v2.cpp
similarity index 100%
rename from src/backend/xml/gnc-pricedb-xml-v2.cpp
rename to libgnucash/backend/xml/gnc-pricedb-xml-v2.cpp
diff --git a/src/backend/xml/gnc-recurrence-xml-v2.cpp b/libgnucash/backend/xml/gnc-recurrence-xml-v2.cpp
similarity index 100%
rename from src/backend/xml/gnc-recurrence-xml-v2.cpp
rename to libgnucash/backend/xml/gnc-recurrence-xml-v2.cpp
diff --git a/src/backend/xml/gnc-schedxaction-xml-v2.cpp b/libgnucash/backend/xml/gnc-schedxaction-xml-v2.cpp
similarity index 100%
rename from src/backend/xml/gnc-schedxaction-xml-v2.cpp
rename to libgnucash/backend/xml/gnc-schedxaction-xml-v2.cpp
diff --git a/src/backend/xml/gnc-tax-table-xml-v2.cpp b/libgnucash/backend/xml/gnc-tax-table-xml-v2.cpp
similarity index 100%
rename from src/backend/xml/gnc-tax-table-xml-v2.cpp
rename to libgnucash/backend/xml/gnc-tax-table-xml-v2.cpp
diff --git a/src/backend/xml/gnc-tax-table-xml-v2.h b/libgnucash/backend/xml/gnc-tax-table-xml-v2.h
similarity index 100%
rename from src/backend/xml/gnc-tax-table-xml-v2.h
rename to libgnucash/backend/xml/gnc-tax-table-xml-v2.h
diff --git a/src/backend/xml/gnc-transaction-xml-v2.cpp b/libgnucash/backend/xml/gnc-transaction-xml-v2.cpp
similarity index 100%
rename from src/backend/xml/gnc-transaction-xml-v2.cpp
rename to libgnucash/backend/xml/gnc-transaction-xml-v2.cpp
diff --git a/src/backend/xml/gnc-vendor-xml-v2.cpp b/libgnucash/backend/xml/gnc-vendor-xml-v2.cpp
similarity index 100%
rename from src/backend/xml/gnc-vendor-xml-v2.cpp
rename to libgnucash/backend/xml/gnc-vendor-xml-v2.cpp
diff --git a/src/backend/xml/gnc-vendor-xml-v2.h b/libgnucash/backend/xml/gnc-vendor-xml-v2.h
similarity index 100%
rename from src/backend/xml/gnc-vendor-xml-v2.h
rename to libgnucash/backend/xml/gnc-vendor-xml-v2.h
diff --git a/src/backend/xml/gnc-xml-backend.cpp b/libgnucash/backend/xml/gnc-xml-backend.cpp
similarity index 100%
rename from src/backend/xml/gnc-xml-backend.cpp
rename to libgnucash/backend/xml/gnc-xml-backend.cpp
diff --git a/src/backend/xml/gnc-xml-backend.hpp b/libgnucash/backend/xml/gnc-xml-backend.hpp
similarity index 100%
rename from src/backend/xml/gnc-xml-backend.hpp
rename to libgnucash/backend/xml/gnc-xml-backend.hpp
diff --git a/src/backend/xml/gnc-xml-helper.cpp b/libgnucash/backend/xml/gnc-xml-helper.cpp
similarity index 100%
rename from src/backend/xml/gnc-xml-helper.cpp
rename to libgnucash/backend/xml/gnc-xml-helper.cpp
diff --git a/src/backend/xml/gnc-xml-helper.h b/libgnucash/backend/xml/gnc-xml-helper.h
similarity index 100%
rename from src/backend/xml/gnc-xml-helper.h
rename to libgnucash/backend/xml/gnc-xml-helper.h
diff --git a/src/backend/xml/gnc-xml.h b/libgnucash/backend/xml/gnc-xml.h
similarity index 100%
rename from src/backend/xml/gnc-xml.h
rename to libgnucash/backend/xml/gnc-xml.h
diff --git a/src/backend/xml/gncmod-backend-xml.cpp b/libgnucash/backend/xml/gncmod-backend-xml.cpp
similarity index 100%
rename from src/backend/xml/gncmod-backend-xml.cpp
rename to libgnucash/backend/xml/gncmod-backend-xml.cpp
diff --git a/src/backend/xml/io-example-account.cpp b/libgnucash/backend/xml/io-example-account.cpp
similarity index 100%
rename from src/backend/xml/io-example-account.cpp
rename to libgnucash/backend/xml/io-example-account.cpp
diff --git a/src/backend/xml/io-example-account.h b/libgnucash/backend/xml/io-example-account.h
similarity index 100%
rename from src/backend/xml/io-example-account.h
rename to libgnucash/backend/xml/io-example-account.h
diff --git a/src/backend/xml/io-gncxml-gen.cpp b/libgnucash/backend/xml/io-gncxml-gen.cpp
similarity index 100%
rename from src/backend/xml/io-gncxml-gen.cpp
rename to libgnucash/backend/xml/io-gncxml-gen.cpp
diff --git a/src/backend/xml/io-gncxml-gen.h b/libgnucash/backend/xml/io-gncxml-gen.h
similarity index 100%
rename from src/backend/xml/io-gncxml-gen.h
rename to libgnucash/backend/xml/io-gncxml-gen.h
diff --git a/src/backend/xml/io-gncxml-v1.cpp b/libgnucash/backend/xml/io-gncxml-v1.cpp
similarity index 100%
rename from src/backend/xml/io-gncxml-v1.cpp
rename to libgnucash/backend/xml/io-gncxml-v1.cpp
diff --git a/src/backend/xml/io-gncxml-v2.cpp b/libgnucash/backend/xml/io-gncxml-v2.cpp
similarity index 100%
rename from src/backend/xml/io-gncxml-v2.cpp
rename to libgnucash/backend/xml/io-gncxml-v2.cpp
diff --git a/src/backend/xml/io-gncxml-v2.h b/libgnucash/backend/xml/io-gncxml-v2.h
similarity index 100%
rename from src/backend/xml/io-gncxml-v2.h
rename to libgnucash/backend/xml/io-gncxml-v2.h
diff --git a/src/backend/xml/io-gncxml.h b/libgnucash/backend/xml/io-gncxml.h
similarity index 100%
rename from src/backend/xml/io-gncxml.h
rename to libgnucash/backend/xml/io-gncxml.h
diff --git a/src/backend/xml/io-utils.cpp b/libgnucash/backend/xml/io-utils.cpp
similarity index 100%
rename from src/backend/xml/io-utils.cpp
rename to libgnucash/backend/xml/io-utils.cpp
diff --git a/src/backend/xml/io-utils.h b/libgnucash/backend/xml/io-utils.h
similarity index 100%
rename from src/backend/xml/io-utils.h
rename to libgnucash/backend/xml/io-utils.h
diff --git a/src/backend/xml/sixtp-dom-generators.cpp b/libgnucash/backend/xml/sixtp-dom-generators.cpp
similarity index 100%
rename from src/backend/xml/sixtp-dom-generators.cpp
rename to libgnucash/backend/xml/sixtp-dom-generators.cpp
diff --git a/src/backend/xml/sixtp-dom-generators.h b/libgnucash/backend/xml/sixtp-dom-generators.h
similarity index 100%
rename from src/backend/xml/sixtp-dom-generators.h
rename to libgnucash/backend/xml/sixtp-dom-generators.h
diff --git a/src/backend/xml/sixtp-dom-parsers.cpp b/libgnucash/backend/xml/sixtp-dom-parsers.cpp
similarity index 100%
rename from src/backend/xml/sixtp-dom-parsers.cpp
rename to libgnucash/backend/xml/sixtp-dom-parsers.cpp
diff --git a/src/backend/xml/sixtp-dom-parsers.h b/libgnucash/backend/xml/sixtp-dom-parsers.h
similarity index 100%
rename from src/backend/xml/sixtp-dom-parsers.h
rename to libgnucash/backend/xml/sixtp-dom-parsers.h
diff --git a/src/backend/xml/sixtp-parsers.h b/libgnucash/backend/xml/sixtp-parsers.h
similarity index 100%
rename from src/backend/xml/sixtp-parsers.h
rename to libgnucash/backend/xml/sixtp-parsers.h
diff --git a/src/backend/xml/sixtp-stack.cpp b/libgnucash/backend/xml/sixtp-stack.cpp
similarity index 100%
rename from src/backend/xml/sixtp-stack.cpp
rename to libgnucash/backend/xml/sixtp-stack.cpp
diff --git a/src/backend/xml/sixtp-stack.h b/libgnucash/backend/xml/sixtp-stack.h
similarity index 100%
rename from src/backend/xml/sixtp-stack.h
rename to libgnucash/backend/xml/sixtp-stack.h
diff --git a/src/backend/xml/sixtp-to-dom-parser.cpp b/libgnucash/backend/xml/sixtp-to-dom-parser.cpp
similarity index 100%
rename from src/backend/xml/sixtp-to-dom-parser.cpp
rename to libgnucash/backend/xml/sixtp-to-dom-parser.cpp
diff --git a/src/backend/xml/sixtp-utils.cpp b/libgnucash/backend/xml/sixtp-utils.cpp
similarity index 100%
rename from src/backend/xml/sixtp-utils.cpp
rename to libgnucash/backend/xml/sixtp-utils.cpp
diff --git a/src/backend/xml/sixtp-utils.h b/libgnucash/backend/xml/sixtp-utils.h
similarity index 100%
rename from src/backend/xml/sixtp-utils.h
rename to libgnucash/backend/xml/sixtp-utils.h
diff --git a/src/backend/xml/sixtp.cpp b/libgnucash/backend/xml/sixtp.cpp
similarity index 100%
rename from src/backend/xml/sixtp.cpp
rename to libgnucash/backend/xml/sixtp.cpp
diff --git a/src/backend/xml/sixtp.h b/libgnucash/backend/xml/sixtp.h
similarity index 100%
rename from src/backend/xml/sixtp.h
rename to libgnucash/backend/xml/sixtp.h
diff --git a/libgnucash/backend/xml/test/CMakeLists.txt b/libgnucash/backend/xml/test/CMakeLists.txt
new file mode 100644
index 0000000..fc3d94a
--- /dev/null
+++ b/libgnucash/backend/xml/test/CMakeLists.txt
@@ -0,0 +1,113 @@
+# Common stuff
+ADD_SUBDIRECTORY(test-files)
+
+SET(XML_TEST_INCLUDE_DIRS
+  ${CMAKE_SOURCE_DIR}/libgnucash/backend/xml
+  ${CMAKE_SOURCE_DIR}/libgnucash/backend/xml/test
+  ${CMAKE_SOURCE_DIR}/libgnucash/engine
+  ${CMAKE_SOURCE_DIR}/libgnucash/engine/test-core
+  ${CMAKE_BINARY_DIR}/common # for config.h
+  ${CMAKE_SOURCE_DIR}/common/test-core  # for unittest-support.h
+  ${GLIB2_INCLUDE_DIRS}
+  ${LIBXML2_INCLUDE_DIRS}
+  ${ZLIB_INCLUDE_DIRS}
+)
+
+
+SET(XML_TEST_LIBS gncmod-engine gncmod-test-engine test-core ${LIBXML2_LDFLAGS} -lz)
+
+FUNCTION(ADD_XML_TEST _TARGET _SOURCE_FILES)
+  GNC_ADD_TEST(${_TARGET} "${_SOURCE_FILES}" XML_TEST_INCLUDE_DIRS XML_TEST_LIBS ${ARGN})
+  TARGET_COMPILE_OPTIONS(${_TARGET} PRIVATE -DU_SHOW_CPLUSPLUS_API=0)
+ENDFUNCTION()
+
+
+################################
+
+SET(test_backend_xml_base_SOURCES
+  ${CMAKE_SOURCE_DIR}/libgnucash/backend/xml/sixtp-dom-parsers.cpp
+  ${CMAKE_SOURCE_DIR}/libgnucash/backend/xml/sixtp-dom-generators.cpp
+  ${CMAKE_SOURCE_DIR}/libgnucash/backend/xml/sixtp-utils.cpp
+  ${CMAKE_SOURCE_DIR}/libgnucash/backend/xml/sixtp.cpp
+  ${CMAKE_SOURCE_DIR}/libgnucash/backend/xml/sixtp-stack.cpp
+  ${CMAKE_SOURCE_DIR}/libgnucash/backend/xml/sixtp-to-dom-parser.cpp
+  ${CMAKE_SOURCE_DIR}/libgnucash/backend/xml/gnc-xml-helper.cpp
+)
+
+## the xml backend is now a GModule - this test does
+## not load it as a module and cannot link to it
+## and remain portable.
+
+SET(test_backend_xml_module_SOURCES
+  ${test_backend_xml_base_SOURCES}
+  ${CMAKE_SOURCE_DIR}/libgnucash/backend/xml/io-example-account.cpp
+  ${CMAKE_SOURCE_DIR}/libgnucash/backend/xml/io-gncxml-gen.cpp
+  ${CMAKE_SOURCE_DIR}/libgnucash/backend/xml/io-gncxml-v2.cpp
+  ${CMAKE_SOURCE_DIR}/libgnucash/backend/xml/io-utils.cpp
+  ${CMAKE_SOURCE_DIR}/libgnucash/backend/xml/gnc-account-xml-v2.cpp
+  ${CMAKE_SOURCE_DIR}/libgnucash/backend/xml/gnc-budget-xml-v2.cpp
+  ${CMAKE_SOURCE_DIR}/libgnucash/backend/xml/gnc-lot-xml-v2.cpp
+  ${CMAKE_SOURCE_DIR}/libgnucash/backend/xml/gnc-recurrence-xml-v2.cpp
+  ${CMAKE_SOURCE_DIR}/libgnucash/backend/xml/gnc-schedxaction-xml-v2.cpp
+  ${CMAKE_SOURCE_DIR}/libgnucash/backend/xml/gnc-freqspec-xml-v2.cpp
+  ${CMAKE_SOURCE_DIR}/libgnucash/backend/xml/gnc-transaction-xml-v2.cpp
+  ${CMAKE_SOURCE_DIR}/libgnucash/backend/xml/gnc-commodity-xml-v2.cpp
+  ${CMAKE_SOURCE_DIR}/libgnucash/backend/xml/gnc-book-xml-v2.cpp
+  ${CMAKE_SOURCE_DIR}/libgnucash/backend/xml/gnc-pricedb-xml-v2.cpp
+)
+
+SET_LOCAL_DIST(test_backend_xml_DIST_local CMakeLists.txt grab-types.pl
+  Makefile.am README test-date-converting.cpp test-dom-converters1.cpp
+  test-dom-parser1.cpp test-file-stuff.cpp test-file-stuff.h test-kvp-frames.cpp
+  test-load-backend.cpp test-load-example-account.cpp  test-load-xml2.cpp
+  test-save-in-lang.cpp test-string-converters.cpp test-xml2-is-file.cpp
+  test-xml-account.cpp test-real-data.sh.in test-xml-commodity.cpp
+  test-xml-pricedb.cpp test-xml-transaction.cpp)
+SET(test_backend_xml_DIST ${test_backend_xml_DIST_local} ${test_backend_xml_test_files_DIST} PARENT_SCOPE)
+
+# The test test-dom-parser1.c is not run by Makefile.am
+
+# This line for autotools
+CONFIGURE_FILE(test-real-data.sh.in test-real-data.sh)
+
+ADD_XML_TEST(test-date-converting "${test_backend_xml_base_SOURCES};test-date-converting.cpp")
+ADD_XML_TEST(test-dom-converters1 "${test_backend_xml_base_SOURCES};test-dom-converters1.cpp")
+ADD_XML_TEST(test-kvp-frames      "${test_backend_xml_base_SOURCES};test-kvp-frames.cpp")
+ADD_XML_TEST(test-load-backend  test-load-backend.cpp)
+ADD_XML_TEST(test-load-xml2 test-load-xml2.cpp
+  GNC_TEST_FILES=${CMAKE_CURRENT_SOURCE_DIR}/test-files/xml2
+)
+# Not run in autotools.
+#ADD_XML_TEST(test-save-in-lang test-save-in-lang.cpp
+#  GNC_TEST_FILES=${CMAKE_CURRENT_SOURCE_DIR}/test-files/xml2
+#)
+
+GNC_ADD_TEST_WITH_GUILE(test-load-example-account
+  "${test_backend_xml_module_SOURCES};test-load-example-account.cpp"
+  XML_TEST_INCLUDE_DIRS XML_TEST_LIBS
+  GNC_ACCOUNT_PATH=${CMAKE_SOURCE_DIR}/accounts/C
+)
+TARGET_COMPILE_OPTIONS(test-load-example-account PRIVATE -DU_SHOW_CPLUSPLUS_API=0)
+ADD_XML_TEST(test-string-converters "${test_backend_xml_base_SOURCES};test-string-converters.cpp")
+ADD_XML_TEST(test-xml-account "${test_backend_xml_module_SOURCES};test-xml-account.cpp;test-file-stuff.cpp")
+ADD_XML_TEST(test-xml-commodity "${test_backend_xml_module_SOURCES};test-xml-commodity.cpp;test-file-stuff.cpp")
+ADD_XML_TEST(test-xml-pricedb "${test_backend_xml_module_SOURCES};test-xml-pricedb.cpp;test-file-stuff.cpp")
+ADD_XML_TEST(test-xml-transaction "${test_backend_xml_module_SOURCES};test-xml-transaction.cpp;test-file-stuff.cpp")
+ADD_XML_TEST(test-xml2-is-file "${test_backend_xml_module_SOURCES};test-xml2-is-file.cpp"
+   GNC_TEST_FILES=${CMAKE_CURRENT_SOURCE_DIR}/test-files/xml2)
+
+SET(CMAKE_COMMAND_TMP "")
+IF (${CMAKE_VERSION} VERSION_GREATER 3.1)
+  SET(CMAKE_COMMAND_TMP ${CMAKE_COMMAND} -E env)
+ENDIF()
+
+SET(test-real-data-env
+  SRCDIR=${CMAKE_CURRENT_SOURCE_DIR}
+  VERBOSE=yes
+  TEST_PATH=${CMAKE_BINARY_DIR}/bin
+)
+ADD_TEST(NAME test-real-data
+   COMMAND ${CMAKE_COMMAND_TMP}
+    ${SHELL} ${CMAKE_CURRENT_SOURCE_DIR}/test-real-data.sh.in
+)
+SET_TESTS_PROPERTIES(test-real-data PROPERTIES ENVIRONMENT "${test-real-data-env}")
diff --git a/libgnucash/backend/xml/test/Makefile.am b/libgnucash/backend/xml/test/Makefile.am
new file mode 100644
index 0000000..fc3fe18
--- /dev/null
+++ b/libgnucash/backend/xml/test/Makefile.am
@@ -0,0 +1,284 @@
+#
+SUBDIRS = test-files
+
+test_date_converting_SOURCES = \
+  ${top_srcdir}/libgnucash/backend/xml/sixtp-dom-parsers.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/sixtp-dom-generators.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/sixtp-utils.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/sixtp.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/sixtp-stack.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/sixtp-to-dom-parser.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/gnc-xml-helper.cpp \
+  test-date-converting.cpp
+
+test_dom_converters1_SOURCES = \
+  ${top_srcdir}/libgnucash/backend/xml/sixtp-dom-parsers.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/sixtp-dom-generators.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/sixtp-utils.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/sixtp.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/sixtp-stack.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/sixtp-to-dom-parser.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/gnc-xml-helper.cpp \
+  test-dom-converters1.cpp
+
+test_kvp_frames_SOURCES = \
+  ${top_srcdir}/libgnucash/backend/xml/sixtp-dom-parsers.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/sixtp-dom-generators.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/sixtp-utils.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/sixtp.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/sixtp-stack.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/sixtp-to-dom-parser.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/gnc-xml-helper.cpp \
+  test-kvp-frames.cpp
+
+test_load_backend_SOURCES = \
+test-load-backend.cpp
+test_load_xml2_SOURCES = \
+test-load-xml2.cpp
+test_save_in_lang_SOURCES = \
+test-save-in-lang.cpp
+
+# the xml backend is now a GModule - this test does
+# not load it as a module and cannot link to it
+# and remain portable.
+
+test_load_example_account_SOURCES = \
+  ${top_srcdir}/libgnucash/backend/xml/sixtp-dom-parsers.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/sixtp-dom-generators.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/sixtp-utils.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/sixtp.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/sixtp-stack.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/sixtp-to-dom-parser.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/io-example-account.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/io-gncxml-gen.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/io-gncxml-v2.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/io-utils.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/gnc-account-xml-v2.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/gnc-budget-xml-v2.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/gnc-lot-xml-v2.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/gnc-recurrence-xml-v2.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/gnc-schedxaction-xml-v2.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/gnc-freqspec-xml-v2.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/gnc-transaction-xml-v2.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/gnc-commodity-xml-v2.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/gnc-book-xml-v2.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/gnc-pricedb-xml-v2.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/gnc-xml-helper.cpp \
+  test-load-example-account.cpp
+
+test_string_converters_SOURCES = \
+  ${top_srcdir}/libgnucash/backend/xml/sixtp-dom-parsers.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/sixtp-dom-generators.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/sixtp-utils.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/sixtp.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/sixtp-stack.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/sixtp-to-dom-parser.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/gnc-xml-helper.cpp \
+  test-string-converters.cpp
+
+test_xml_account_SOURCES = \
+  ${top_srcdir}/libgnucash/backend/xml/sixtp-dom-parsers.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/sixtp-dom-generators.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/sixtp-utils.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/sixtp.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/sixtp-stack.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/sixtp-to-dom-parser.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/io-gncxml-gen.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/gnc-account-xml-v2.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/gnc-lot-xml-v2.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/gnc-schedxaction-xml-v2.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/gnc-recurrence-xml-v2.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/gnc-freqspec-xml-v2.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/gnc-transaction-xml-v2.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/gnc-commodity-xml-v2.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/gnc-book-xml-v2.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/gnc-pricedb-xml-v2.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/gnc-budget-xml-v2.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/io-gncxml-v2.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/io-utils.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/gnc-xml-helper.cpp \
+  test-xml-account.cpp
+
+test_xml_commodity_SOURCES = \
+  ${top_srcdir}/libgnucash/backend/xml/sixtp-dom-parsers.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/sixtp-dom-generators.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/sixtp-utils.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/sixtp.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/sixtp-stack.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/sixtp-to-dom-parser.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/io-gncxml-gen.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/gnc-account-xml-v2.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/gnc-lot-xml-v2.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/gnc-schedxaction-xml-v2.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/gnc-recurrence-xml-v2.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/gnc-freqspec-xml-v2.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/gnc-transaction-xml-v2.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/gnc-commodity-xml-v2.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/gnc-book-xml-v2.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/gnc-pricedb-xml-v2.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/gnc-budget-xml-v2.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/io-gncxml-v2.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/io-utils.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/gnc-xml-helper.cpp \
+  test-xml-commodity.cpp
+
+test_xml_pricedb_SOURCES = \
+  ${top_srcdir}/libgnucash/backend/xml/sixtp-dom-parsers.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/sixtp-dom-generators.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/sixtp-utils.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/sixtp.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/sixtp-stack.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/sixtp-to-dom-parser.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/io-gncxml-gen.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/gnc-account-xml-v2.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/gnc-lot-xml-v2.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/gnc-schedxaction-xml-v2.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/gnc-recurrence-xml-v2.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/gnc-freqspec-xml-v2.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/gnc-transaction-xml-v2.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/gnc-commodity-xml-v2.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/gnc-book-xml-v2.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/gnc-pricedb-xml-v2.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/gnc-budget-xml-v2.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/io-gncxml-v2.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/io-utils.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/gnc-xml-helper.cpp \
+  test-xml-pricedb.cpp
+
+test_xml_transaction_SOURCES = \
+  ${top_srcdir}/libgnucash/backend/xml/sixtp-dom-parsers.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/sixtp-dom-generators.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/sixtp-utils.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/sixtp.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/sixtp-stack.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/sixtp-to-dom-parser.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/io-gncxml-gen.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/gnc-account-xml-v2.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/gnc-budget-xml-v2.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/gnc-lot-xml-v2.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/gnc-schedxaction-xml-v2.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/gnc-freqspec-xml-v2.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/gnc-recurrence-xml-v2.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/gnc-transaction-xml-v2.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/gnc-commodity-xml-v2.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/gnc-book-xml-v2.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/gnc-pricedb-xml-v2.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/io-gncxml-v2.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/io-utils.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/gnc-xml-helper.cpp \
+  test-xml-transaction.cpp
+
+test_xml2_is_file_SOURCES = \
+  ${top_srcdir}/libgnucash/backend/xml/sixtp-dom-parsers.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/sixtp-dom-generators.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/sixtp-utils.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/sixtp.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/sixtp-stack.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/sixtp-to-dom-parser.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/gnc-account-xml-v2.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/gnc-budget-xml-v2.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/gnc-lot-xml-v2.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/gnc-recurrence-xml-v2.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/gnc-schedxaction-xml-v2.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/gnc-freqspec-xml-v2.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/gnc-transaction-xml-v2.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/gnc-commodity-xml-v2.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/gnc-book-xml-v2.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/gnc-pricedb-xml-v2.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/io-gncxml-gen.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/io-gncxml-v2.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/io-utils.cpp \
+  ${top_srcdir}/libgnucash/backend/xml/gnc-xml-helper.cpp \
+  test-xml2-is-file.cpp
+
+TESTS = \
+  test-date-converting \
+  test-dom-converters1 \
+  test-kvp-frames \
+  test-load-example-account \
+  test-load-backend \
+  test-load-xml2 \
+  test-real-data.sh \
+  test-string-converters \
+  test-xml-account \
+  test-xml-commodity \
+  test-xml-pricedb \
+  test-xml-transaction \
+  test-xml2-is-file
+
+GNC_TEST_DEPS = \
+  --gnc-module-dir ${top_builddir}/libgnucash/gnc-module \
+  --gnc-module-dir ${top_builddir}/libgnucash/engine \
+  --guile-load-dir ${top_builddir}/libgnucash/gnc-module \
+  --guile-load-dir ${top_builddir}/libgnucash/engine \
+  --library-dir    ${top_builddir}/libgnucash/core-utils \
+  --library-dir    ${top_builddir}/libgnucash/gnc-module \
+  --library-dir    ${top_builddir}/libgnucash/engine \
+  --library-dir    ${top_builddir}/libgnucash/backend/sql  \
+  --library-dir    ${top_builddir}/libgnucash/backend/xml
+
+TESTS_ENVIRONMENT = \
+  GUILE_WARN_DEPRECATED=no \
+  GNC_ACCOUNT_PATH=${top_srcdir}/accounts/C \
+  GNC_TEST_FILES=test-files/xml2 \
+  SRCDIR=${srcdir} \
+  GNC_BUILDDIR="${abs_top_builddir}" \
+  $(shell ${abs_top_srcdir}/common/gnc-test-env.pl --noexports ${GNC_TEST_DEPS})
+
+check_LTLIBRARIES = libgnc-test-file-stuff.la
+
+libgnc_test_file_stuff_la_SOURCES = test-file-stuff.cpp
+libgnc_test_file_stuff_la_LIBADD = \
+  ${top_builddir}/libgnucash/engine/libgncmod-engine.la
+
+check_PROGRAMS = \
+  test-date-converting \
+  test-dom-converters1 \
+  test-kvp-frames \
+  test-load-backend \
+  test-load-example-account \
+  test-load-xml2 \
+  test-save-in-lang \
+  test-string-converters \
+  test-xml-account \
+  test-xml-commodity \
+  test-xml-pricedb \
+  test-xml-transaction \
+  test-xml2-is-file
+
+noinst_HEADERS = test-file-stuff.h
+
+LDADD = \
+        ${top_builddir}/common/test-core/libtest-core.la \
+        ${top_builddir}/libgnucash/gnc-module/libgnc-module.la \
+        ${top_builddir}/libgnucash/engine/libgncmod-engine.la \
+        ${top_builddir}/libgnucash/engine/test-core/libgncmod-test-engine.la \
+        ${top_builddir}/libgnucash/core-utils/libgnc-core-utils.la \
+        ./libgnc-test-file-stuff.la \
+        ${LIBXML2_LIBS} \
+        ${ZLIB_LIBS} \
+        ${top_builddir}/lib/libc/libc-missing.la
+
+AM_CPPFLAGS = \
+  -I${top_srcdir}/lib/libc \
+  -I${top_srcdir}/common \
+  -I${top_srcdir}/libgnucash/core-utils \
+  -I${top_srcdir}/libgnucash/gnc-module \
+  -I${top_srcdir}/common/test-core \
+  -I${top_srcdir}/libgnucash/engine \
+  -I${top_srcdir}/libgnucash/engine/test-core \
+  -I${top_srcdir}/libgnucash/backend/xml \
+  -DU_SHOW_CPLUSPLUS_API=0 \
+  ${LIBXML2_CFLAGS} \
+  ${GLIB_CFLAGS} \
+  ${GUILE_CFLAGS} \
+  ${BOOST_CPPFLAGS}
+
+EXTRA_DIST = \
+  grab-types.pl \
+  test-dom-parser1.cpp \
+  test-real-data.sh \
+  test-xml2-is-file.cpp \
+  CMakeLists.txt
+
+AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.backend.xml\"
diff --git a/src/backend/xml/test/README b/libgnucash/backend/xml/test/README
similarity index 100%
rename from src/backend/xml/test/README
rename to libgnucash/backend/xml/test/README
diff --git a/src/backend/xml/test/grab-types.pl b/libgnucash/backend/xml/test/grab-types.pl
similarity index 100%
rename from src/backend/xml/test/grab-types.pl
rename to libgnucash/backend/xml/test/grab-types.pl
diff --git a/src/backend/xml/test/test-date-converting.cpp b/libgnucash/backend/xml/test/test-date-converting.cpp
similarity index 100%
rename from src/backend/xml/test/test-date-converting.cpp
rename to libgnucash/backend/xml/test/test-date-converting.cpp
diff --git a/src/backend/xml/test/test-dom-converters1.cpp b/libgnucash/backend/xml/test/test-dom-converters1.cpp
similarity index 100%
rename from src/backend/xml/test/test-dom-converters1.cpp
rename to libgnucash/backend/xml/test/test-dom-converters1.cpp
diff --git a/src/backend/xml/test/test-dom-parser1-1.xml b/libgnucash/backend/xml/test/test-dom-parser1-1.xml
similarity index 100%
rename from src/backend/xml/test/test-dom-parser1-1.xml
rename to libgnucash/backend/xml/test/test-dom-parser1-1.xml
diff --git a/src/backend/xml/test/test-dom-parser1.cpp b/libgnucash/backend/xml/test/test-dom-parser1.cpp
similarity index 100%
rename from src/backend/xml/test/test-dom-parser1.cpp
rename to libgnucash/backend/xml/test/test-dom-parser1.cpp
diff --git a/src/backend/xml/test/test-file-stuff.cpp b/libgnucash/backend/xml/test/test-file-stuff.cpp
similarity index 100%
rename from src/backend/xml/test/test-file-stuff.cpp
rename to libgnucash/backend/xml/test/test-file-stuff.cpp
diff --git a/src/backend/xml/test/test-file-stuff.h b/libgnucash/backend/xml/test/test-file-stuff.h
similarity index 100%
rename from src/backend/xml/test/test-file-stuff.h
rename to libgnucash/backend/xml/test/test-file-stuff.h
diff --git a/src/backend/xml/test/test-files/CMakeLists.txt b/libgnucash/backend/xml/test/test-files/CMakeLists.txt
similarity index 100%
rename from src/backend/xml/test/test-files/CMakeLists.txt
rename to libgnucash/backend/xml/test/test-files/CMakeLists.txt
diff --git a/src/backend/xml/test/test-files/Makefile.am b/libgnucash/backend/xml/test/test-files/Makefile.am
similarity index 100%
rename from src/backend/xml/test/test-files/Makefile.am
rename to libgnucash/backend/xml/test/test-files/Makefile.am
diff --git a/src/backend/xml/test/test-files/xml1/Money95bank_fr.gml b/libgnucash/backend/xml/test/test-files/xml1/Money95bank_fr.gml
similarity index 100%
rename from src/backend/xml/test/test-files/xml1/Money95bank_fr.gml
rename to libgnucash/backend/xml/test/test-files/xml1/Money95bank_fr.gml
diff --git a/src/backend/xml/test/test-files/xml1/Money95invst.gml b/libgnucash/backend/xml/test/test-files/xml1/Money95invst.gml
similarity index 100%
rename from src/backend/xml/test/test-files/xml1/Money95invst.gml
rename to libgnucash/backend/xml/test/test-files/xml1/Money95invst.gml
diff --git a/src/backend/xml/test/test-files/xml1/Money95mutual.gml b/libgnucash/backend/xml/test/test-files/xml1/Money95mutual.gml
similarity index 100%
rename from src/backend/xml/test/test-files/xml1/Money95mutual.gml
rename to libgnucash/backend/xml/test/test-files/xml1/Money95mutual.gml
diff --git a/src/backend/xml/test/test-files/xml1/Money95stocks.gml b/libgnucash/backend/xml/test/test-files/xml1/Money95stocks.gml
similarity index 100%
rename from src/backend/xml/test/test-files/xml1/Money95stocks.gml
rename to libgnucash/backend/xml/test/test-files/xml1/Money95stocks.gml
diff --git a/src/backend/xml/test/test-files/xml1/abc.gml b/libgnucash/backend/xml/test/test-files/xml1/abc.gml
similarity index 100%
rename from src/backend/xml/test/test-files/xml1/abc.gml
rename to libgnucash/backend/xml/test/test-files/xml1/abc.gml
diff --git a/src/backend/xml/test/test-files/xml1/abcall.gml b/libgnucash/backend/xml/test/test-files/xml1/abcall.gml
similarity index 100%
rename from src/backend/xml/test/test-files/xml1/abcall.gml
rename to libgnucash/backend/xml/test/test-files/xml1/abcall.gml
diff --git a/src/backend/xml/test/test-files/xml1/carols-data-file b/libgnucash/backend/xml/test/test-files/xml1/carols-data-file
similarity index 100%
rename from src/backend/xml/test/test-files/xml1/carols-data-file
rename to libgnucash/backend/xml/test/test-files/xml1/carols-data-file
diff --git a/src/backend/xml/test/test-files/xml1/carols-data-file.gml b/libgnucash/backend/xml/test/test-files/xml1/carols-data-file.gml
similarity index 100%
rename from src/backend/xml/test/test-files/xml1/carols-data-file.gml
rename to libgnucash/backend/xml/test/test-files/xml1/carols-data-file.gml
diff --git a/src/backend/xml/test/test-files/xml1/cbb-export.gml b/libgnucash/backend/xml/test/test-files/xml1/cbb-export.gml
similarity index 100%
rename from src/backend/xml/test/test-files/xml1/cbb-export.gml
rename to libgnucash/backend/xml/test/test-files/xml1/cbb-export.gml
diff --git a/src/backend/xml/test/test-files/xml1/conrads-file b/libgnucash/backend/xml/test/test-files/xml1/conrads-file
similarity index 100%
rename from src/backend/xml/test/test-files/xml1/conrads-file
rename to libgnucash/backend/xml/test/test-files/xml1/conrads-file
diff --git a/src/backend/xml/test/test-files/xml1/conrads-file.gml b/libgnucash/backend/xml/test/test-files/xml1/conrads-file.gml
similarity index 100%
rename from src/backend/xml/test/test-files/xml1/conrads-file.gml
rename to libgnucash/backend/xml/test/test-files/xml1/conrads-file.gml
diff --git a/src/backend/xml/test/test-files/xml1/every.gml b/libgnucash/backend/xml/test/test-files/xml1/every.gml
similarity index 100%
rename from src/backend/xml/test/test-files/xml1/every.gml
rename to libgnucash/backend/xml/test/test-files/xml1/every.gml
diff --git a/src/backend/xml/test/test-files/xml1/ms-money.gml b/libgnucash/backend/xml/test/test-files/xml1/ms-money.gml
similarity index 100%
rename from src/backend/xml/test/test-files/xml1/ms-money.gml
rename to libgnucash/backend/xml/test/test-files/xml1/ms-money.gml
diff --git a/src/backend/xml/test/test-files/xml1/pricedb1.gml b/libgnucash/backend/xml/test/test-files/xml1/pricedb1.gml
similarity index 100%
rename from src/backend/xml/test/test-files/xml1/pricedb1.gml
rename to libgnucash/backend/xml/test/test-files/xml1/pricedb1.gml
diff --git a/src/backend/xml/test/test-files/xml2/.gitignore b/libgnucash/backend/xml/test/test-files/xml2/.gitignore
similarity index 100%
rename from src/backend/xml/test/test-files/xml2/.gitignore
rename to libgnucash/backend/xml/test/test-files/xml2/.gitignore
diff --git a/src/backend/xml/test/test-files/xml2/CMakeLists.txt b/libgnucash/backend/xml/test/test-files/xml2/CMakeLists.txt
similarity index 100%
rename from src/backend/xml/test/test-files/xml2/CMakeLists.txt
rename to libgnucash/backend/xml/test/test-files/xml2/CMakeLists.txt
diff --git a/src/backend/xml/test/test-files/xml2/Makefile.am b/libgnucash/backend/xml/test/test-files/xml2/Makefile.am
similarity index 100%
rename from src/backend/xml/test/test-files/xml2/Makefile.am
rename to libgnucash/backend/xml/test/test-files/xml2/Makefile.am
diff --git a/src/backend/xml/test/test-files/xml2/Money95bank_fr.gml2 b/libgnucash/backend/xml/test/test-files/xml2/Money95bank_fr.gml2
similarity index 100%
rename from src/backend/xml/test/test-files/xml2/Money95bank_fr.gml2
rename to libgnucash/backend/xml/test/test-files/xml2/Money95bank_fr.gml2
diff --git a/src/backend/xml/test/test-files/xml2/Money95invst.gml2 b/libgnucash/backend/xml/test/test-files/xml2/Money95invst.gml2
similarity index 100%
rename from src/backend/xml/test/test-files/xml2/Money95invst.gml2
rename to libgnucash/backend/xml/test/test-files/xml2/Money95invst.gml2
diff --git a/src/backend/xml/test/test-files/xml2/Money95mutual.gml2 b/libgnucash/backend/xml/test/test-files/xml2/Money95mutual.gml2
similarity index 100%
rename from src/backend/xml/test/test-files/xml2/Money95mutual.gml2
rename to libgnucash/backend/xml/test/test-files/xml2/Money95mutual.gml2
diff --git a/src/backend/xml/test/test-files/xml2/Money95stocks.gml2 b/libgnucash/backend/xml/test/test-files/xml2/Money95stocks.gml2
similarity index 100%
rename from src/backend/xml/test/test-files/xml2/Money95stocks.gml2
rename to libgnucash/backend/xml/test/test-files/xml2/Money95stocks.gml2
diff --git a/src/backend/xml/test/test-files/xml2/abc.gml2 b/libgnucash/backend/xml/test/test-files/xml2/abc.gml2
similarity index 100%
rename from src/backend/xml/test/test-files/xml2/abc.gml2
rename to libgnucash/backend/xml/test/test-files/xml2/abc.gml2
diff --git a/src/backend/xml/test/test-files/xml2/abcall.gml2 b/libgnucash/backend/xml/test/test-files/xml2/abcall.gml2
similarity index 100%
rename from src/backend/xml/test/test-files/xml2/abcall.gml2
rename to libgnucash/backend/xml/test/test-files/xml2/abcall.gml2
diff --git a/src/backend/xml/test/test-files/xml2/carols-data-file.gml2 b/libgnucash/backend/xml/test/test-files/xml2/carols-data-file.gml2
similarity index 100%
rename from src/backend/xml/test/test-files/xml2/carols-data-file.gml2
rename to libgnucash/backend/xml/test/test-files/xml2/carols-data-file.gml2
diff --git a/src/backend/xml/test/test-files/xml2/cbb-export.gml2 b/libgnucash/backend/xml/test/test-files/xml2/cbb-export.gml2
similarity index 100%
rename from src/backend/xml/test/test-files/xml2/cbb-export.gml2
rename to libgnucash/backend/xml/test/test-files/xml2/cbb-export.gml2
diff --git a/src/backend/xml/test/test-files/xml2/conrads-file.gml2 b/libgnucash/backend/xml/test/test-files/xml2/conrads-file.gml2
similarity index 100%
rename from src/backend/xml/test/test-files/xml2/conrads-file.gml2
rename to libgnucash/backend/xml/test/test-files/xml2/conrads-file.gml2
diff --git a/src/backend/xml/test/test-files/xml2/every.gml2 b/libgnucash/backend/xml/test/test-files/xml2/every.gml2
similarity index 100%
rename from src/backend/xml/test/test-files/xml2/every.gml2
rename to libgnucash/backend/xml/test/test-files/xml2/every.gml2
diff --git a/src/backend/xml/test/test-files/xml2/goonies-file.gml2 b/libgnucash/backend/xml/test/test-files/xml2/goonies-file.gml2
similarity index 100%
rename from src/backend/xml/test/test-files/xml2/goonies-file.gml2
rename to libgnucash/backend/xml/test/test-files/xml2/goonies-file.gml2
diff --git a/src/backend/xml/test/test-files/xml2/hierachical-data-file.gml2 b/libgnucash/backend/xml/test/test-files/xml2/hierachical-data-file.gml2
similarity index 100%
rename from src/backend/xml/test/test-files/xml2/hierachical-data-file.gml2
rename to libgnucash/backend/xml/test/test-files/xml2/hierachical-data-file.gml2
diff --git a/src/backend/xml/test/test-files/xml2/ms-money.gml2 b/libgnucash/backend/xml/test/test-files/xml2/ms-money.gml2
similarity index 100%
rename from src/backend/xml/test/test-files/xml2/ms-money.gml2
rename to libgnucash/backend/xml/test/test-files/xml2/ms-money.gml2
diff --git a/src/backend/xml/test/test-files/xml2/pricedb1.gml2 b/libgnucash/backend/xml/test/test-files/xml2/pricedb1.gml2
similarity index 100%
rename from src/backend/xml/test/test-files/xml2/pricedb1.gml2
rename to libgnucash/backend/xml/test/test-files/xml2/pricedb1.gml2
diff --git a/src/backend/xml/test/test-kvp-frames.cpp b/libgnucash/backend/xml/test/test-kvp-frames.cpp
similarity index 100%
rename from src/backend/xml/test/test-kvp-frames.cpp
rename to libgnucash/backend/xml/test/test-kvp-frames.cpp
diff --git a/src/backend/xml/test/test-load-backend.cpp b/libgnucash/backend/xml/test/test-load-backend.cpp
similarity index 100%
rename from src/backend/xml/test/test-load-backend.cpp
rename to libgnucash/backend/xml/test/test-load-backend.cpp
diff --git a/src/backend/xml/test/test-load-example-account.cpp b/libgnucash/backend/xml/test/test-load-example-account.cpp
similarity index 100%
rename from src/backend/xml/test/test-load-example-account.cpp
rename to libgnucash/backend/xml/test/test-load-example-account.cpp
diff --git a/src/backend/xml/test/test-load-xml2.cpp b/libgnucash/backend/xml/test/test-load-xml2.cpp
similarity index 100%
rename from src/backend/xml/test/test-load-xml2.cpp
rename to libgnucash/backend/xml/test/test-load-xml2.cpp
diff --git a/src/backend/xml/test/test-real-data.sh.in b/libgnucash/backend/xml/test/test-real-data.sh.in
similarity index 100%
rename from src/backend/xml/test/test-real-data.sh.in
rename to libgnucash/backend/xml/test/test-real-data.sh.in
diff --git a/src/backend/xml/test/test-save-in-lang.cpp b/libgnucash/backend/xml/test/test-save-in-lang.cpp
similarity index 100%
rename from src/backend/xml/test/test-save-in-lang.cpp
rename to libgnucash/backend/xml/test/test-save-in-lang.cpp
diff --git a/src/backend/xml/test/test-string-converters.cpp b/libgnucash/backend/xml/test/test-string-converters.cpp
similarity index 100%
rename from src/backend/xml/test/test-string-converters.cpp
rename to libgnucash/backend/xml/test/test-string-converters.cpp
diff --git a/src/backend/xml/test/test-xml-account.cpp b/libgnucash/backend/xml/test/test-xml-account.cpp
similarity index 100%
rename from src/backend/xml/test/test-xml-account.cpp
rename to libgnucash/backend/xml/test/test-xml-account.cpp
diff --git a/src/backend/xml/test/test-xml-commodity.cpp b/libgnucash/backend/xml/test/test-xml-commodity.cpp
similarity index 100%
rename from src/backend/xml/test/test-xml-commodity.cpp
rename to libgnucash/backend/xml/test/test-xml-commodity.cpp
diff --git a/src/backend/xml/test/test-xml-pricedb.cpp b/libgnucash/backend/xml/test/test-xml-pricedb.cpp
similarity index 100%
rename from src/backend/xml/test/test-xml-pricedb.cpp
rename to libgnucash/backend/xml/test/test-xml-pricedb.cpp
diff --git a/src/backend/xml/test/test-xml-transaction.cpp b/libgnucash/backend/xml/test/test-xml-transaction.cpp
similarity index 100%
rename from src/backend/xml/test/test-xml-transaction.cpp
rename to libgnucash/backend/xml/test/test-xml-transaction.cpp
diff --git a/src/backend/xml/test/test-xml2-is-file.cpp b/libgnucash/backend/xml/test/test-xml2-is-file.cpp
similarity index 100%
rename from src/backend/xml/test/test-xml2-is-file.cpp
rename to libgnucash/backend/xml/test/test-xml2-is-file.cpp
diff --git a/src/backend/xml/xml-helpers.h b/libgnucash/backend/xml/xml-helpers.h
similarity index 100%
rename from src/backend/xml/xml-helpers.h
rename to libgnucash/backend/xml/xml-helpers.h
diff --git a/libgnucash/core-utils/CMakeLists.txt b/libgnucash/core-utils/CMakeLists.txt
new file mode 100644
index 0000000..7847446
--- /dev/null
+++ b/libgnucash/core-utils/CMakeLists.txt
@@ -0,0 +1,202 @@
+# CMakeLists.txt for libgnucash/core-utils
+
+ADD_SUBDIRECTORY(test)
+
+IF (BUILDING_FROM_VCS)
+  SET (SWIG_CORE_UTILS_GUILE_C ${CMAKE_CURRENT_BINARY_DIR}/swig-core-utils-guile.c)
+  GNC_ADD_SWIG_COMMAND (swig-core-utils-guile-c ${SWIG_CORE_UTILS_GUILE_C} ${CMAKE_CURRENT_SOURCE_DIR}/core-utils.i)
+  SET (SWIG_CORE_UTILS_PYTHON_C ${CMAKE_CURRENT_BINARY_DIR}/swig-core-utils-python.c)
+  GNC_ADD_SWIG_PYTHON_COMMAND (swig-core-utils-python ${SWIG_CORE_UTILS_PYTHON_C} ${CMAKE_CURRENT_SOURCE_DIR}/core-utils.i)
+ELSE()
+  SET(SWIG_CORE_UTILS_GUILE_C swig-core-utils-guile.c)
+  SET(SWIG_CORE_UTILS_PYTHON_C swig-core-utils-python.c)
+ENDIF()
+
+SET (core_utils_SOURCES
+  binreloc.c
+  gnc-prefs.c
+  gnc-environment.c
+  gnc-filepath-utils.c
+  gnc-gkeyfile-utils.c
+  gnc-glib-utils.c
+  gnc-guile-utils.c
+  gnc-jalali.c
+  gnc-locale-utils.c
+  gnc-path.c
+)
+
+# Add dependency on config.h
+SET_SOURCE_FILES_PROPERTIES (${core_utils_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
+
+IF (BUILDING_FROM_VCS)
+  # Command to generate the swig-runtime.h header
+  ADD_CUSTOM_COMMAND (
+    OUTPUT ${SWIG_RUNTIME_H}
+    DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
+    COMMAND ${SWIG_EXECUTABLE} -guile -external-runtime ${SWIG_RUNTIME_H}
+  )
+ENDIF()
+
+ADD_CUSTOM_TARGET(swig-runtime-h DEPENDS ${SWIG_RUNTIME_H})
+
+# Add dependency on swig-runtime.h
+SET_SOURCE_FILES_PROPERTIES (gnc-guile-utils.c PROPERTIES OBJECT_DEPENDS ${SWIG_RUNTIME_H})
+
+SET(prefix ${CMAKE_INSTALL_PREFIX})
+SET(datadir ${DATADIR})
+SET(bindir ${BINDIR})
+SET(libdir ${LIBDIR})
+SET(sysconfdir ${SYSCONFDIR})
+GNC_CONFIGURE(gncla-dir.h.in gncla-dir.h)
+
+### Create gnc-version.h ###
+
+SET (GNC_VERSION_H_IN
+"/* Autogenerated. Do not change. */
+#ifndef GNC_VERSION_H
+#define GNC_VERSION_H
+
+#define GNUCASH_SCM \"git\"
+#define GNUCASH_BUILD_DATE \"@GNUCASH_BUILD_DATE@\"
+#include \"gnc-vcs-info.h\"
+#endif
+")
+
+STRING(TIMESTAMP GNUCASH_BUILD_DATE "%Y-%m-%d")
+
+STRING(CONFIGURE ${GNC_VERSION_H_IN} GNC_VERSION_H_CONTENT)
+
+FILE (WRITE ${CMAKE_CURRENT_BINARY_DIR}/gnc-version.h ${GNC_VERSION_H_CONTENT})
+
+### Create gnc-vcs-info.h
+# The meta-cmake gymnastics here come from https://cmake.org/pipermail/cmake/2010-July/038015.html
+
+FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/gnc-vcs-info.h.in
+   "/* Autogenerated. Do not change. */\n#define GNUCASH_SCM_REV \"@GNUCASH_SCM_REV@\"\n"
+)
+SET(SCM_REV_COMMAND "${CMAKE_SOURCE_DIR}/util/gnc-vcs-info -r")
+FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/version.cmake
+  "EXECUTE_PROCESS(
+    COMMAND ${SHELL} ${SCM_REV_COMMAND} ${CMAKE_SOURCE_DIR}
+    OUTPUT_VARIABLE GNUCASH_SCM_REV
+    OUTPUT_STRIP_TRAILING_WHITESPACE
+  )
+  CONFIGURE_FILE(\${SRC} \${DST} @ONLY)
+")
+
+IF (${CMAKE_VERSION} VERSION_GREATER "3.1")
+  ADD_CUSTOM_TARGET(gnc-vcs-info ALL
+    BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/gnc-vcs-info.h
+    COMMAND ${CMAKE_COMMAND} -D SRC=${CMAKE_CURRENT_BINARY_DIR}/gnc-vcs-info.h.in
+                     -D DST=${CMAKE_CURRENT_BINARY_DIR}/gnc-vcs-info.h
+                     -P ${CMAKE_CURRENT_BINARY_DIR}/version.cmake
+  )
+ELSE()
+  # BYPRODUCTS keyword not supported below 3.2
+  ADD_CUSTOM_TARGET(gnc-vcs-info ALL
+    COMMAND ${CMAKE_COMMAND} -D SRC=${CMAKE_CURRENT_BINARY_DIR}/gnc-vcs-info.h.in
+                     -D DST=${CMAKE_CURRENT_BINARY_DIR}/gnc-vcs-info.h
+                     -P ${CMAKE_CURRENT_BINARY_DIR}/version.cmake
+  )
+ENDIF()
+
+### Compile library
+
+SET(core_utils_noinst_HEADERS
+  binreloc.h
+  gnc-prefs.h
+  gnc-prefs-p.h
+  gnc-environment.h
+  gnc-filepath-utils.h
+  gnc-gkeyfile-utils.h
+  gnc-glib-utils.h
+  gnc-guile-utils.h
+  gnc-jalali.h
+  gnc-locale-utils.h
+  gnc-path.h
+)
+
+SET(core_utils_ALL_SOURCES ${core_utils_SOURCES} ${core_utils_noinst_HEADERS})
+SET(core_utils_ALL_LIBRARIES ${GUILE_LDFLAGS} ${GLIB2_LDFLAGS} ${GOBJECT_LDFLAGS} ${GTK_MAC_LDFLAGS})
+SET(core_utils_ALL_INCLUDES
+  ${CMAKE_SOURCE_DIR}/common
+  ${CMAKE_BINARY_DIR}/common
+  ${CMAKE_CURRENT_BINARY_DIR}
+  ${CMAKE_CURRENT_SOURCE_DIR}
+  ${GLIB2_INCLUDE_DIRS}
+  ${GUILE_INCLUDE_DIRS}
+  ${GTK_MAC_INCLUDE_DIRS})
+
+SET_LOCAL_DIST(core_utils_DIST_local ${core_utils_ALL_SOURCES} CMakeLists.txt Makefile.am core-utils.i core-utils.scm gncla-dir.h.in)
+SET(core_utils_DIST ${core_utils_DIST_local} ${test_core_utils_DIST} PARENT_SCOPE)
+
+IF (MAC_INTEGRATION)
+  LIST(APPEND core_utils_ALL_LIBRARIES ${OSX_EXTRA_LIBRARIES})
+ENDIF()
+
+ADD_LIBRARY	(gnc-core-utils ${core_utils_ALL_SOURCES} ${SWIG_CORE_UTILS_GUILE_C})
+ADD_DEPENDENCIES(gnc-core-utils gnc-vcs-info)
+
+TARGET_LINK_LIBRARIES(gnc-core-utils ${core_utils_ALL_LIBRARIES})
+
+TARGET_COMPILE_DEFINITIONS(gnc-core-utils
+    PRIVATE -DG_LOG_DOMAIN=\"gnc.core-utils\" ${GTK_MAC_CFLAGS_OTHER})
+
+TARGET_INCLUDE_DIRECTORIES(gnc-core-utils PUBLIC ${core_utils_ALL_INCLUDES})
+
+IF (MAC_INTEGRATION)
+  TARGET_COMPILE_OPTIONS(gnc-core-utils PRIVATE ${OSX_EXTRA_COMPILE_FLAGS})
+ENDIF(MAC_INTEGRATION)
+
+INSTALL(TARGETS gnc-core-utils
+  LIBRARY DESTINATION lib
+  ARCHIVE DESTINATION lib
+  RUNTIME DESTINATION bin
+)
+
+IF (WITH_PYTHON)
+  ADD_LIBRARY	(gnc-core-utils-python ${core_utils_ALL_SOURCES} ${SWIG_CORE_UTILS_PYTHON_C})
+  ADD_DEPENDENCIES(gnc-core-utils-python gnc-vcs-info)
+
+  TARGET_LINK_LIBRARIES(gnc-core-utils-python ${core_utils_ALL_LIBRARIES} ${PYTHON_LIBRARIES})
+
+  TARGET_COMPILE_DEFINITIONS(gnc-core-utils-python
+    PRIVATE -DG_LOG_DOMAIN=\"gnc.core-utils\" ${GTK_MAC_CFLAGS_OTHER}
+  )
+
+  TARGET_INCLUDE_DIRECTORIES(gnc-core-utils-python PUBLIC ${core_utils_ALL_INCLUDES} ${PYTHON_INCLUDE_DIRS})
+
+  IF (MAC_INTEGRATION)
+    TARGET_COMPILE_OPTIONS(gnc-core-utils-python PRIVATE ${OSX_EXTRA_COMPILE_FLAGS})
+  ENDIF(MAC_INTEGRATION)
+
+  INSTALL(TARGETS gnc-core-utils-python
+    LIBRARY DESTINATION lib
+    ARCHIVE DESTINATION lib
+    RUNTIME DESTINATION bin
+  )
+
+ENDIF()
+
+# No headers to install
+
+# Scheme
+
+SET (core_utils_SCHEME core-utils.scm)
+
+SET(GUILE_OUTPUT_DIR   gnucash)
+SET(GUILE_MODULES      "")
+SET(GUILE_LOAD_DIRS    libgnucash/core-utils)
+SET(GUILE_LIBRARY_DIRS libgnucash/core-utils)
+SET(GUILE_DEPENDS      gnc-core-utils)
+
+GNC_ADD_SCHEME_TARGETS(scm-core-utils
+    "${core_utils_SCHEME}"
+    ${GUILE_OUTPUT_DIR}
+    "${GUILE_MODULES}"
+    "${GUILE_LOAD_DIRS}"
+    "${GUILE_LIBRARY_DIRS}"
+    "${GUILE_DEPENDS}"
+    FALSE
+)
+
diff --git a/libgnucash/core-utils/Makefile.am b/libgnucash/core-utils/Makefile.am
new file mode 100644
index 0000000..9733c60
--- /dev/null
+++ b/libgnucash/core-utils/Makefile.am
@@ -0,0 +1,194 @@
+# No SUBDIR variable here...
+# The 'test' subdir is added via src/Makefile to handle
+# it's dependency on src/engine
+
+lib_LTLIBRARIES = libgnc-core-utils.la
+
+libgnc_core_utils_la_SOURCES = \
+  binreloc.c \
+  gnc-prefs.c \
+  gnc-environment.c \
+  gnc-filepath-utils.c \
+  gnc-gkeyfile-utils.c \
+  gnc-glib-utils.c \
+  gnc-guile-utils.c \
+  gnc-jalali.c \
+  gnc-locale-utils.c \
+  gnc-path.c \
+  swig-core-utils-guile.c
+
+libgnc_core_utils_la_LIBADD = \
+  ${GUILE_LIBS} \
+  ${GLIB_LIBS} \
+  ${BINRELOC_LIBS} \
+  ${GTK_MAC_LIBS}
+
+
+noinst_HEADERS = \
+  binreloc.h \
+  gnc-prefs.h \
+  gnc-prefs-p.h \
+  gnc-environment.h \
+  gnc-filepath-utils.h \
+  gnc-gkeyfile-utils.h \
+  gnc-glib-utils.h \
+  gnc-guile-utils.h \
+  gnc-jalali.h \
+  gnc-locale-utils.h \
+  gnc-path.h
+
+if BUILDING_FROM_VCS
+swig-core-utils-guile.c: core-utils.i ${top_srcdir}/common/base-typemaps.i
+	$(SWIG) -guile $(SWIG_ARGS) -Linkage module \
+	-I${top_srcdir}/common -o $@ $<
+if ! OS_WIN32
+if ! SWIG_DIST_FAIL
+	if ! `grep "define scm_from_utf8_string" $@ > /dev/null 2>&1`; then \
+	  patch $@ $(top_srcdir)/common/swig-utf8.patch; \
+	fi
+endif
+endif
+swig-core-utils-python.c: core-utils.i ${top_srcdir}/common/base-typemaps.i
+	$(SWIG) -python -Wall -Werror $(SWIG_ARGS) \
+	-I${top_srcdir}/common -o $@ $<
+endif
+
+AM_CPPFLAGS = \
+  ${GUILE_CFLAGS} \
+  ${GLIB_CFLAGS} \
+  ${GTK_MAC_CFLAGS} \
+  -I${top_builddir}/common \
+  -I${top_srcdir}/common
+
+gncscmmoddir = ${GNC_SCM_INSTALL_DIR}/gnucash
+gncscmmod_DATA = core-utils.scm
+
+if GNUCASH_SEPARATE_BUILDDIR
+#Only needed when srcdir and builddir are different
+#for running
+SCM_FILE_LINKS = ${gncscmmod_DATA}
+endif
+
+if WITH_PYTHON
+
+lib_LTLIBRARIES += libgnc-core-utils-python.la
+
+libgnc_core_utils_python_la_SOURCES = \
+	swig-core-utils-python.c
+
+libgnc_core_utils_python_la_LIBADD = \
+	${PYTHON_LIBS} \
+	libgnc-core-utils.la
+
+libgnc_core_utils_python_la_CPPFLAGS = \
+  ${GLIB_CFLAGS} \
+  ${GTK_MAC_CFLAGS} \
+  ${PYTHON_CPPFLAGS} \
+  -I${top_builddir}/common \
+  -I${top_srcdir}/common
+
+endif
+
+.scm-links: 
+	$(RM) -rf gnucash
+	mkdir -p  gnucash
+if GNUCASH_SEPARATE_BUILDDIR
+	for X in ${SCM_FILE_LINKS} ; do \
+	  $(LN_S) -f ${srcdir}/$$X . ; \
+	done
+endif
+	( cd gnucash; for A in $(gncscmmod_DATA) ; do $(LN_S) -f ../$$A . ; done )
+if ! OS_WIN32
+# Windows knows no "ln -s" but uses "cp": must copy every time (see bug #566567).
+	touch .scm-links
+endif
+
+if GNC_HAVE_GUILE_2
+GUILE_COMPILE_ENV = \
+  --library-dir    ${top_builddir}/libgnucash/core-utils
+
+%.go : %.scm .scm-links $(lib_LTLIBRARIES)
+	GNC_UNINSTALLED=yes \
+	GNC_BUILDDIR=${top_builddir} \
+	$(shell ${abs_top_srcdir}/common/gnc-test-env.pl --noexports ${GUILE_COMPILE_ENV})  \
+	$(GUILD) compile -o $@ $<
+
+gncscmmodcachedir = ${pkglibdir}/scm/ccache/@GUILE_EFFECTIVE_VERSION@/gnucash
+gncscmmodcache_DATA = $(gncscmmod_DATA:.scm=.go)
+endif
+
+noinst_DATA = .scm-links
+BUILT_SOURCES = gncla-dir.h gnc-version.h
+EXTRA_DIST = \
+  $(gncscmmod_DATA) \
+  core-utils.i \
+  gncla-dir.h.in \
+  gnc-vcs-info.h \
+  CMakeLists.txt
+
+clean-local:
+	rm -rf gnucash
+
+CLEANFILES = $(BUILT_SOURCES) .scm-links ${gncscmmodcache_DATA}
+
+MAINTAINERCLEANFILES = swig-core-utils-guile.c swig-core-utils-python.c
+
+AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.core-utils\" -DGNC_SCM_INSTALL_DIR="\"${GNC_SCM_INSTALL_DIR}\""
+
+gncla-dir.h: gncla-dir.h.in ${top_builddir}/config.status Makefile
+	rm -f $@.tmp
+	sed < $< > $@.tmp \
+		-e 's#@-DATADIRNAME-@#${DATADIRNAME}#g' \
+		-e 's#@-libdir-@#${libdir}#g' \
+		-e 's#@-bindir-@#${bindir}#g' \
+		-e 's#@-sysconfdir-@#${sysconfdir}#g' \
+		-e 's#@-datadir-@#${datadir}#g' \
+		-e 's#@-prefix-@#${prefix}#g'
+	mv $@.tmp $@
+
+## We borrow guile's convention and use @-...-@ as the substitution
+## brackets here, instead of the usual @... at .  This prevents autoconf
+## from substituting the values directly into the left-hand sides of
+## the sed substitutions.
+gnc-version.h: _gnc-version.h
+	-if [ ! -f gnc-version.h ]; then cp _gnc-version.h gnc-version.h; fi
+	-cmp -s _gnc-version.h gnc-version.h || cp _gnc-version.h gnc-version.h
+	-rm -f _gnc-version.h
+
+_gnc-version.h: gnc-vcs-info.h Makefile
+	@echo "/* Autogenerated. Do not change. */"   > _gnc-version.h
+	@echo "#ifndef GNC_VERSION_H"                >> _gnc-version.h
+	@echo "#define GNC_VERSION_H"                >> _gnc-version.h
+	@echo ""                                     >> _gnc-version.h
+	@scm_info=`${top_srcdir}/util/gnc-vcs-info -t ${top_srcdir}` ; \
+	if [ $$? = 0 ] ; then \
+		echo "#define GNUCASH_SCM \"$$scm_info\"" >> _gnc-version.h ; \
+	fi
+	@echo "#define GNUCASH_BUILD_DATE \"`date +%Y-%m-%d`\"" >> _gnc-version.h
+	@echo "#include \"gnc-vcs-info.h\""          >> _gnc-version.h
+	@echo "#endif"                               >> _gnc-version.h
+
+gnc-vcs-info.h: _gnc-vcs-info.h
+	-if [ ! -f gnc-vcs-info.h ]; then cp _gnc-vcs-info.h gnc-vcs-info.h; fi
+	-cmp -s _gnc-vcs-info.h gnc-vcs-info.h || cp _gnc-vcs-info.h gnc-vcs-info.h
+	-rm -f _gnc-vcs-info.h
+
+_gnc-vcs-info.h: Makefile
+	@scm_info=`${top_srcdir}/util/gnc-vcs-info -r ${top_srcdir}` ; \
+	if [ $$? = 0 ] ; then \
+		if [ -z "$$scm_info" ] ; then \
+			echo "gnc-vcs-info failed.  figure out why." ; \
+			echo "can't determine svn/svk/git/bzr revision from ${top_srcdir}." ; \
+			exit 1 ; \
+		fi ; \
+		echo "/* Autogenerated. Do not change. */"    > _gnc-vcs-info.h ; \
+		echo "#define GNUCASH_SCM_REV \"$$scm_info\"" >> _gnc-vcs-info.h ; \
+	else \
+		if [ -r $(srcdir)/gnc-vcs-info.h ] ; then \
+			cp $(srcdir)/gnc-vcs-info.h _gnc-vcs-info.h ; \
+		else \
+			echo "You're building from svn/svk/git/bzr...  But your build system is broken" ; \
+			echo "Don't do that.   Complain to your build-system creator." ; \
+			exit 1 ; \
+		fi ; \
+	fi
diff --git a/src/core-utils/binreloc.c b/libgnucash/core-utils/binreloc.c
similarity index 100%
rename from src/core-utils/binreloc.c
rename to libgnucash/core-utils/binreloc.c
diff --git a/src/core-utils/binreloc.h b/libgnucash/core-utils/binreloc.h
similarity index 100%
rename from src/core-utils/binreloc.h
rename to libgnucash/core-utils/binreloc.h
diff --git a/src/core-utils/core-utils.i b/libgnucash/core-utils/core-utils.i
similarity index 100%
rename from src/core-utils/core-utils.i
rename to libgnucash/core-utils/core-utils.i
diff --git a/src/core-utils/core-utils.scm b/libgnucash/core-utils/core-utils.scm
similarity index 100%
rename from src/core-utils/core-utils.scm
rename to libgnucash/core-utils/core-utils.scm
diff --git a/src/core-utils/gnc-environment.c b/libgnucash/core-utils/gnc-environment.c
similarity index 100%
rename from src/core-utils/gnc-environment.c
rename to libgnucash/core-utils/gnc-environment.c
diff --git a/src/core-utils/gnc-environment.h b/libgnucash/core-utils/gnc-environment.h
similarity index 100%
rename from src/core-utils/gnc-environment.h
rename to libgnucash/core-utils/gnc-environment.h
diff --git a/src/core-utils/gnc-filepath-utils.c b/libgnucash/core-utils/gnc-filepath-utils.c
similarity index 100%
rename from src/core-utils/gnc-filepath-utils.c
rename to libgnucash/core-utils/gnc-filepath-utils.c
diff --git a/src/core-utils/gnc-filepath-utils.h b/libgnucash/core-utils/gnc-filepath-utils.h
similarity index 100%
rename from src/core-utils/gnc-filepath-utils.h
rename to libgnucash/core-utils/gnc-filepath-utils.h
diff --git a/src/core-utils/gnc-gkeyfile-utils.c b/libgnucash/core-utils/gnc-gkeyfile-utils.c
similarity index 100%
rename from src/core-utils/gnc-gkeyfile-utils.c
rename to libgnucash/core-utils/gnc-gkeyfile-utils.c
diff --git a/src/core-utils/gnc-gkeyfile-utils.h b/libgnucash/core-utils/gnc-gkeyfile-utils.h
similarity index 100%
rename from src/core-utils/gnc-gkeyfile-utils.h
rename to libgnucash/core-utils/gnc-gkeyfile-utils.h
diff --git a/src/core-utils/gnc-glib-utils.c b/libgnucash/core-utils/gnc-glib-utils.c
similarity index 100%
rename from src/core-utils/gnc-glib-utils.c
rename to libgnucash/core-utils/gnc-glib-utils.c
diff --git a/src/core-utils/gnc-glib-utils.h b/libgnucash/core-utils/gnc-glib-utils.h
similarity index 100%
rename from src/core-utils/gnc-glib-utils.h
rename to libgnucash/core-utils/gnc-glib-utils.h
diff --git a/src/core-utils/gnc-guile-utils.c b/libgnucash/core-utils/gnc-guile-utils.c
similarity index 100%
rename from src/core-utils/gnc-guile-utils.c
rename to libgnucash/core-utils/gnc-guile-utils.c
diff --git a/src/core-utils/gnc-guile-utils.h b/libgnucash/core-utils/gnc-guile-utils.h
similarity index 100%
rename from src/core-utils/gnc-guile-utils.h
rename to libgnucash/core-utils/gnc-guile-utils.h
diff --git a/src/core-utils/gnc-jalali.c b/libgnucash/core-utils/gnc-jalali.c
similarity index 100%
rename from src/core-utils/gnc-jalali.c
rename to libgnucash/core-utils/gnc-jalali.c
diff --git a/src/core-utils/gnc-jalali.h b/libgnucash/core-utils/gnc-jalali.h
similarity index 100%
rename from src/core-utils/gnc-jalali.h
rename to libgnucash/core-utils/gnc-jalali.h
diff --git a/src/core-utils/gnc-locale-utils.c b/libgnucash/core-utils/gnc-locale-utils.c
similarity index 100%
rename from src/core-utils/gnc-locale-utils.c
rename to libgnucash/core-utils/gnc-locale-utils.c
diff --git a/src/core-utils/gnc-locale-utils.h b/libgnucash/core-utils/gnc-locale-utils.h
similarity index 100%
rename from src/core-utils/gnc-locale-utils.h
rename to libgnucash/core-utils/gnc-locale-utils.h
diff --git a/src/core-utils/gnc-path.c b/libgnucash/core-utils/gnc-path.c
similarity index 100%
rename from src/core-utils/gnc-path.c
rename to libgnucash/core-utils/gnc-path.c
diff --git a/src/core-utils/gnc-path.h b/libgnucash/core-utils/gnc-path.h
similarity index 100%
rename from src/core-utils/gnc-path.h
rename to libgnucash/core-utils/gnc-path.h
diff --git a/src/core-utils/gnc-prefs-p.h b/libgnucash/core-utils/gnc-prefs-p.h
similarity index 100%
rename from src/core-utils/gnc-prefs-p.h
rename to libgnucash/core-utils/gnc-prefs-p.h
diff --git a/src/core-utils/gnc-prefs.c b/libgnucash/core-utils/gnc-prefs.c
similarity index 100%
rename from src/core-utils/gnc-prefs.c
rename to libgnucash/core-utils/gnc-prefs.c
diff --git a/src/core-utils/gnc-prefs.h b/libgnucash/core-utils/gnc-prefs.h
similarity index 100%
rename from src/core-utils/gnc-prefs.h
rename to libgnucash/core-utils/gnc-prefs.h
diff --git a/src/core-utils/gncla-dir.h.in b/libgnucash/core-utils/gncla-dir.h.in
similarity index 100%
rename from src/core-utils/gncla-dir.h.in
rename to libgnucash/core-utils/gncla-dir.h.in
diff --git a/libgnucash/core-utils/test/CMakeLists.txt b/libgnucash/core-utils/test/CMakeLists.txt
new file mode 100644
index 0000000..15bf1a4
--- /dev/null
+++ b/libgnucash/core-utils/test/CMakeLists.txt
@@ -0,0 +1,18 @@
+
+
+SET(CORE_UTILS_TEST_INCLUDE_DIRS
+  ${CMAKE_BINARY_DIR}/common # for config.h
+  ${CMAKE_SOURCE_DIR}/libgnucash/core-utils
+  ${CMAKE_SOURCE_DIR}/common/test-core
+  ${GLIB2_INCLUDE_DIRS}
+)
+SET(CORE_UTILS_TEST_LIBS gnc-core-utils test-core)
+
+MACRO(ADD_CORE_UTILS_TEST _TARGET _SOURCE_FILES)
+  GNC_ADD_TEST(${_TARGET} "${_SOURCE_FILES}" CORE_UTILS_TEST_INCLUDE_DIRS CORE_UTILS_TEST_LIBS)
+ENDMACRO()
+
+ADD_CORE_UTILS_TEST(test-gnc-glib-utils test-gnc-glib-utils.c)
+ADD_CORE_UTILS_TEST(test-resolve-file-path test-resolve-file-path.c)
+
+SET_DIST_LIST(test_core_utils_DIST CMakeLists.txt Makefile.am test-gnc-glib-utils.c test-resolve-file-path.c)
diff --git a/libgnucash/core-utils/test/Makefile.am b/libgnucash/core-utils/test/Makefile.am
new file mode 100644
index 0000000..c88ace0
--- /dev/null
+++ b/libgnucash/core-utils/test/Makefile.am
@@ -0,0 +1,56 @@
+include $(top_srcdir)/test-templates/Makefile.decl
+MODULEPATH = libgnucash/core-utils
+
+# We add src/engine here, just to load qof.h, which
+# is pulled in via test-core
+AM_CPPFLAGS = \
+  -I${top_srcdir} \
+  -I${top_srcdir}/common \
+  -I${top_srcdir}/common/test-core \
+  -I${top_srcdir}/libgnucash/core-utils \
+  -I${top_srcdir}/libgnucash/engine \
+  ${GUILE_CFLAGS} \
+  ${GLIB_CFLAGS}
+
+LDADD = \
+  ../libgnc-core-utils.la \
+  ${top_builddir}/common/test-core/libtest-core.la \
+  ${GLIB_LIBS}
+
+# these tests are ordered kind more or less in the order
+# that they should be executed, with more basic tests coming first.
+#
+
+TESTS = \
+  test-resolve-file-path \
+  test-gnc-glib-utils
+
+GNC_TEST_DEPS = \
+  --library-dir    ${top_builddir}/libgnucash/core-utils
+
+TESTS_ENVIRONMENT = \
+  SRCDIR=${srcdir} \
+  $(shell ${abs_top_srcdir}/common/gnc-test-env.pl --noexports ${GNC_TEST_DEPS})
+
+check_PROGRAMS = ${TESTS}
+
+test_gnc_glib_utils_SOURCES = \
+  $(top_srcdir)/$(MODULEPATH)/gnc-glib-utils.c \
+  test-gnc-glib-utils.c
+
+test_gnc_glib_utils_LDADD = \
+        ${top_builddir}/common/test-core/libtest-core.la \
+        $(GLIB_LIBS)
+
+test_gnc_glib_utils_CFLAGS = \
+        ${DEFAULT_INCLUDES} \
+        -I${top_srcdir}/${MODULEPATH} \
+        ${GLIB_CFLAGS}
+
+EXTRA_DIST += \
+	CMakeLists.txt
+
+clean-local:
+	rm -f translog.*
+
+distclean-local: clean-local
diff --git a/src/core-utils/test/test-gnc-glib-utils.c b/libgnucash/core-utils/test/test-gnc-glib-utils.c
similarity index 100%
rename from src/core-utils/test/test-gnc-glib-utils.c
rename to libgnucash/core-utils/test/test-gnc-glib-utils.c
diff --git a/src/core-utils/test/test-resolve-file-path.c b/libgnucash/core-utils/test/test-resolve-file-path.c
similarity index 100%
rename from src/core-utils/test/test-resolve-file-path.c
rename to libgnucash/core-utils/test/test-resolve-file-path.c
diff --git a/src/doc/CMakeLists.txt b/libgnucash/doc/CMakeLists.txt
similarity index 100%
rename from src/doc/CMakeLists.txt
rename to libgnucash/doc/CMakeLists.txt
diff --git a/src/doc/Makefile.am b/libgnucash/doc/Makefile.am
similarity index 100%
rename from src/doc/Makefile.am
rename to libgnucash/doc/Makefile.am
diff --git a/src/doc/README b/libgnucash/doc/README
similarity index 100%
rename from src/doc/README
rename to libgnucash/doc/README
diff --git a/src/doc/TODO-schedxactions b/libgnucash/doc/TODO-schedxactions
similarity index 100%
rename from src/doc/TODO-schedxactions
rename to libgnucash/doc/TODO-schedxactions
diff --git a/src/doc/TODO-sixtp b/libgnucash/doc/TODO-sixtp
similarity index 100%
rename from src/doc/TODO-sixtp
rename to libgnucash/doc/TODO-sixtp
diff --git a/src/doc/backup.txt b/libgnucash/doc/backup.txt
similarity index 100%
rename from src/doc/backup.txt
rename to libgnucash/doc/backup.txt
diff --git a/src/doc/books.txt b/libgnucash/doc/books.txt
similarity index 100%
rename from src/doc/books.txt
rename to libgnucash/doc/books.txt
diff --git a/src/doc/budget.txt b/libgnucash/doc/budget.txt
similarity index 100%
rename from src/doc/budget.txt
rename to libgnucash/doc/budget.txt
diff --git a/src/doc/business.txt b/libgnucash/doc/business.txt
similarity index 100%
rename from src/doc/business.txt
rename to libgnucash/doc/business.txt
diff --git a/src/doc/callgrind.txt b/libgnucash/doc/callgrind.txt
similarity index 100%
rename from src/doc/callgrind.txt
rename to libgnucash/doc/callgrind.txt
diff --git a/src/doc/constderv.html b/libgnucash/doc/constderv.html
similarity index 100%
rename from src/doc/constderv.html
rename to libgnucash/doc/constderv.html
diff --git a/src/doc/constraints.txt b/libgnucash/doc/constraints.txt
similarity index 100%
rename from src/doc/constraints.txt
rename to libgnucash/doc/constraints.txt
diff --git a/src/doc/currencies.txt b/libgnucash/doc/currencies.txt
similarity index 100%
rename from src/doc/currencies.txt
rename to libgnucash/doc/currencies.txt
diff --git a/src/doc/design/CMakeLists.txt b/libgnucash/doc/design/CMakeLists.txt
similarity index 100%
rename from src/doc/design/CMakeLists.txt
rename to libgnucash/doc/design/CMakeLists.txt
diff --git a/src/doc/design/Makefile.am b/libgnucash/doc/design/Makefile.am
similarity index 100%
rename from src/doc/design/Makefile.am
rename to libgnucash/doc/design/Makefile.am
diff --git a/src/doc/design/component-manager.texi b/libgnucash/doc/design/component-manager.texi
similarity index 100%
rename from src/doc/design/component-manager.texi
rename to libgnucash/doc/design/component-manager.texi
diff --git a/src/doc/design/concept-index.texi b/libgnucash/doc/design/concept-index.texi
similarity index 100%
rename from src/doc/design/concept-index.texi
rename to libgnucash/doc/design/concept-index.texi
diff --git a/src/doc/design/engine.texi b/libgnucash/doc/design/engine.texi
similarity index 100%
rename from src/doc/design/engine.texi
rename to libgnucash/doc/design/engine.texi
diff --git a/src/doc/design/fdl.texi b/libgnucash/doc/design/fdl.texi
similarity index 100%
rename from src/doc/design/fdl.texi
rename to libgnucash/doc/design/fdl.texi
diff --git a/src/doc/design/function-index.texi b/libgnucash/doc/design/function-index.texi
similarity index 100%
rename from src/doc/design/function-index.texi
rename to libgnucash/doc/design/function-index.texi
diff --git a/src/doc/design/gnucash-design.texi b/libgnucash/doc/design/gnucash-design.texi
similarity index 100%
rename from src/doc/design/gnucash-design.texi
rename to libgnucash/doc/design/gnucash-design.texi
diff --git a/src/doc/design/intro.texi b/libgnucash/doc/design/intro.texi
similarity index 100%
rename from src/doc/design/intro.texi
rename to libgnucash/doc/design/intro.texi
diff --git a/src/doc/design/register.texi b/libgnucash/doc/design/register.texi
similarity index 100%
rename from src/doc/design/register.texi
rename to libgnucash/doc/design/register.texi
diff --git a/src/doc/design/reports.texi b/libgnucash/doc/design/reports.texi
similarity index 100%
rename from src/doc/design/reports.texi
rename to libgnucash/doc/design/reports.texi
diff --git a/src/doc/design/top-level.texi b/libgnucash/doc/design/top-level.texi
similarity index 100%
rename from src/doc/design/top-level.texi
rename to libgnucash/doc/design/top-level.texi
diff --git a/src/doc/design/type-index.texi b/libgnucash/doc/design/type-index.texi
similarity index 100%
rename from src/doc/design/type-index.texi
rename to libgnucash/doc/design/type-index.texi
diff --git a/src/doc/design/user-preferences.texi b/libgnucash/doc/design/user-preferences.texi
similarity index 100%
rename from src/doc/design/user-preferences.texi
rename to libgnucash/doc/design/user-preferences.texi
diff --git a/src/doc/dia/components.dia b/libgnucash/doc/dia/components.dia
similarity index 100%
rename from src/doc/dia/components.dia
rename to libgnucash/doc/dia/components.dia
diff --git a/src/doc/dia/structures-alt.dia b/libgnucash/doc/dia/structures-alt.dia
similarity index 100%
rename from src/doc/dia/structures-alt.dia
rename to libgnucash/doc/dia/structures-alt.dia
diff --git a/src/doc/dia/structures.dia b/libgnucash/doc/dia/structures.dia
similarity index 100%
rename from src/doc/dia/structures.dia
rename to libgnucash/doc/dia/structures.dia
diff --git a/src/doc/doxygen.cfg.in b/libgnucash/doc/doxygen.cfg.in
similarity index 100%
rename from src/doc/doxygen.cfg.in
rename to libgnucash/doc/doxygen.cfg.in
diff --git a/src/doc/doxygen_main_page.c b/libgnucash/doc/doxygen_main_page.c
similarity index 100%
rename from src/doc/doxygen_main_page.c
rename to libgnucash/doc/doxygen_main_page.c
diff --git a/src/doc/engine.txt b/libgnucash/doc/engine.txt
similarity index 100%
rename from src/doc/engine.txt
rename to libgnucash/doc/engine.txt
diff --git a/src/doc/finderv.html b/libgnucash/doc/finderv.html
similarity index 100%
rename from src/doc/finderv.html
rename to libgnucash/doc/finderv.html
diff --git a/src/doc/finutil.html b/libgnucash/doc/finutil.html
similarity index 100%
rename from src/doc/finutil.html
rename to libgnucash/doc/finutil.html
diff --git a/src/doc/g2-architecture.txt b/libgnucash/doc/g2-architecture.txt
similarity index 100%
rename from src/doc/g2-architecture.txt
rename to libgnucash/doc/g2-architecture.txt
diff --git a/src/doc/generic-druid-framework.txt b/libgnucash/doc/generic-druid-framework.txt
similarity index 100%
rename from src/doc/generic-druid-framework.txt
rename to libgnucash/doc/generic-druid-framework.txt
diff --git a/src/doc/gnc-numeric-example.txt b/libgnucash/doc/gnc-numeric-example.txt
similarity index 100%
rename from src/doc/gnc-numeric-example.txt
rename to libgnucash/doc/gnc-numeric-example.txt
diff --git a/src/doc/guid.txt b/libgnucash/doc/guid.txt
similarity index 100%
rename from src/doc/guid.txt
rename to libgnucash/doc/guid.txt
diff --git a/src/doc/loans.txt b/libgnucash/doc/loans.txt
similarity index 100%
rename from src/doc/loans.txt
rename to libgnucash/doc/loans.txt
diff --git a/src/doc/lots.txt b/libgnucash/doc/lots.txt
similarity index 100%
rename from src/doc/lots.txt
rename to libgnucash/doc/lots.txt
diff --git a/src/doc/multicurrency-discussion.txt b/libgnucash/doc/multicurrency-discussion.txt
similarity index 100%
rename from src/doc/multicurrency-discussion.txt
rename to libgnucash/doc/multicurrency-discussion.txt
diff --git a/src/doc/prices.txt b/libgnucash/doc/prices.txt
similarity index 100%
rename from src/doc/prices.txt
rename to libgnucash/doc/prices.txt
diff --git a/src/doc/python-bindings-doxygen.py b/libgnucash/doc/python-bindings-doxygen.py
similarity index 100%
rename from src/doc/python-bindings-doxygen.py
rename to libgnucash/doc/python-bindings-doxygen.py
diff --git a/src/doc/qif.txt b/libgnucash/doc/qif.txt
similarity index 100%
rename from src/doc/qif.txt
rename to libgnucash/doc/qif.txt
diff --git a/src/doc/sx.rst b/libgnucash/doc/sx.rst
similarity index 100%
rename from src/doc/sx.rst
rename to libgnucash/doc/sx.rst
diff --git a/src/doc/tax.txt b/libgnucash/doc/tax.txt
similarity index 100%
rename from src/doc/tax.txt
rename to libgnucash/doc/tax.txt
diff --git a/src/doc/user-prefs-howto.txt b/libgnucash/doc/user-prefs-howto.txt
similarity index 100%
rename from src/doc/user-prefs-howto.txt
rename to libgnucash/doc/user-prefs-howto.txt
diff --git a/src/doc/xml/CMakeLists.txt b/libgnucash/doc/xml/CMakeLists.txt
similarity index 100%
rename from src/doc/xml/CMakeLists.txt
rename to libgnucash/doc/xml/CMakeLists.txt
diff --git a/src/doc/xml/Makefile.am b/libgnucash/doc/xml/Makefile.am
similarity index 100%
rename from src/doc/xml/Makefile.am
rename to libgnucash/doc/xml/Makefile.am
diff --git a/src/doc/xml/README b/libgnucash/doc/xml/README
similarity index 100%
rename from src/doc/xml/README
rename to libgnucash/doc/xml/README
diff --git a/src/doc/xml/account-v2.dtd b/libgnucash/doc/xml/account-v2.dtd
similarity index 100%
rename from src/doc/xml/account-v2.dtd
rename to libgnucash/doc/xml/account-v2.dtd
diff --git a/src/doc/xml/commodity-v2.dtd b/libgnucash/doc/xml/commodity-v2.dtd
similarity index 100%
rename from src/doc/xml/commodity-v2.dtd
rename to libgnucash/doc/xml/commodity-v2.dtd
diff --git a/src/doc/xml/defaults-v1.dtd b/libgnucash/doc/xml/defaults-v1.dtd
similarity index 100%
rename from src/doc/xml/defaults-v1.dtd
rename to libgnucash/doc/xml/defaults-v1.dtd
diff --git a/src/doc/xml/gnucash-v2.rnc b/libgnucash/doc/xml/gnucash-v2.rnc
similarity index 100%
rename from src/doc/xml/gnucash-v2.rnc
rename to libgnucash/doc/xml/gnucash-v2.rnc
diff --git a/src/doc/xml/io-gncxml-version1.dtd b/libgnucash/doc/xml/io-gncxml-version1.dtd
similarity index 100%
rename from src/doc/xml/io-gncxml-version1.dtd
rename to libgnucash/doc/xml/io-gncxml-version1.dtd
diff --git a/src/doc/xml/io-gncxml-version2.dtd b/libgnucash/doc/xml/io-gncxml-version2.dtd
similarity index 100%
rename from src/doc/xml/io-gncxml-version2.dtd
rename to libgnucash/doc/xml/io-gncxml-version2.dtd
diff --git a/src/doc/xml/preferences-v1.dtd b/libgnucash/doc/xml/preferences-v1.dtd
similarity index 100%
rename from src/doc/xml/preferences-v1.dtd
rename to libgnucash/doc/xml/preferences-v1.dtd
diff --git a/src/doc/xml/prices-v1.dtd b/libgnucash/doc/xml/prices-v1.dtd
similarity index 100%
rename from src/doc/xml/prices-v1.dtd
rename to libgnucash/doc/xml/prices-v1.dtd
diff --git a/src/doc/xml/transactions-v2.dtd b/libgnucash/doc/xml/transactions-v2.dtd
similarity index 100%
rename from src/doc/xml/transactions-v2.dtd
rename to libgnucash/doc/xml/transactions-v2.dtd
diff --git a/src/doc/xml/types.dtd b/libgnucash/doc/xml/types.dtd
similarity index 100%
rename from src/doc/xml/types.dtd
rename to libgnucash/doc/xml/types.dtd
diff --git a/src/engine/Account.c b/libgnucash/engine/Account.c
similarity index 100%
rename from src/engine/Account.c
rename to libgnucash/engine/Account.c
diff --git a/src/engine/Account.h b/libgnucash/engine/Account.h
similarity index 100%
rename from src/engine/Account.h
rename to libgnucash/engine/Account.h
diff --git a/src/engine/AccountP.h b/libgnucash/engine/AccountP.h
similarity index 100%
rename from src/engine/AccountP.h
rename to libgnucash/engine/AccountP.h
diff --git a/libgnucash/engine/CMakeLists.txt b/libgnucash/engine/CMakeLists.txt
new file mode 100644
index 0000000..4f25a1e
--- /dev/null
+++ b/libgnucash/engine/CMakeLists.txt
@@ -0,0 +1,329 @@
+# CMakeLists.txt for libgnucash/engine
+
+ADD_SUBDIRECTORY(test-core)
+ADD_SUBDIRECTORY(test)
+
+SET(engine_noinst_HEADERS
+  AccountP.h
+  ScrubP.h
+  SplitP.h
+  SX-book.h
+  SX-ttinfo.h
+  TransactionP.h
+  gnc-backend-prov.hpp
+  gnc-date-p.h
+  gnc-hooks-scm.h
+  gnc-int128.hpp
+  gnc-lot.h
+  gnc-lot-p.h
+  gnc-pricedb-p.h
+  policy-p.h
+  qofbook-p.h
+  qofclass-p.h
+  qofevent-p.h
+  qofobject-p.h
+  qofquery-p.h
+  qofquerycore-p.h
+)
+
+SET (engine_HEADERS
+  Account.h
+  FreqSpec.h
+  Recurrence.h
+  SchedXaction.h
+  SX-book.h
+  SX-ttinfo.h
+  Query.h
+  Scrub.h
+  Scrub2.h
+  ScrubBusiness.h
+  Scrub3.h
+  Split.h
+  TransLog.h
+  Transaction.h
+  cap-gains.h
+  cashobjects.h
+  engine-helpers.h
+  engine-helpers-guile.h
+  glib-helpers.h
+  gnc-aqbanking-templates.h
+  gnc-budget.h
+  gnc-commodity.h
+  gnc-date.h
+  gnc-datetime.hpp
+  gnc-engine.h
+  gnc-event.h
+  gnc-features.h
+  gnc-hooks.h
+  gnc-numeric.h
+  gnc-numeric.hpp
+  gnc-pricedb.h
+  gnc-rational.hpp
+  gnc-rational-rounding.hpp
+  gnc-session.h
+  gnc-timezone.hpp
+  gnc-uri-utils.h
+  gncAddress.h
+  gncAddressP.h
+  gncBillTerm.h
+  gncBillTermP.h
+  gncBusGuile.h
+  gncBusiness.h
+  gncCustomer.h
+  gncCustomerP.h
+  gncEmployee.h
+  gncEmployeeP.h
+  gncEntry.h
+  gncEntryP.h
+  gncIDSearch.h
+  gncInvoice.h
+  gncInvoiceP.h
+  gncJob.h
+  gncJobP.h
+  gncOrder.h
+  gncOrderP.h
+  gncOwner.h
+  gncOwnerP.h
+  gncTaxTable.h
+  gncTaxTableP.h
+  gncVendor.h
+  gncVendorP.h
+  guid.h
+  guid.hpp
+  kvp-frame.hpp
+  kvp-scm.h
+  kvp-value.hpp
+  policy.h
+  qof.h
+  qof-backend.hpp
+  qofbackend.h
+  qofbook.h
+  qofbookslots.h
+  qofchoice.h
+  qofclass.h
+  qofevent.h
+  qofid-p.h
+  qofid.h
+  qofinstance-p.h
+  qofinstance.h
+  qoflog.h
+  qofobject.h
+  qofquery.h
+  qofquerycore.h
+  qofsession.h
+  qofsession.hpp
+  qofutil.h
+  qof-gobject.h
+  qof-string-cache.h
+)
+
+IF (BUILDING_FROM_VCS)
+  # Command to generate the swig-engine.c wrapper file
+  SET (SWIG_ENGINE_C ${CMAKE_CURRENT_BINARY_DIR}/swig-engine.c)
+  GNC_ADD_SWIG_COMMAND (swig-engine-c ${SWIG_ENGINE_C} ${CMAKE_CURRENT_SOURCE_DIR}/engine.i ${engine_HEADERS})
+ELSE()
+  SET (SWIG_ENGINE_C swig-engine.c)
+ENDIF()
+
+# Command to generate the iso-4217-currencies.c file
+SET (ISO_4217_C ${CMAKE_CURRENT_BINARY_DIR}/iso-4217-currencies.c)
+ADD_CUSTOM_COMMAND (
+  OUTPUT ${ISO_4217_C}
+  DEPENDS iso-4217-currencies.xml iso-currencies-to-c.xsl
+  COMMAND
+    ${LIBXSLT_XSLTPROC_EXECUTABLE} -o ${ISO_4217_C} "${CMAKE_CURRENT_SOURCE_DIR}/iso-currencies-to-c.xsl" "${CMAKE_CURRENT_SOURCE_DIR}/iso-4217-currencies.xml"
+    )
+ADD_CUSTOM_TARGET(iso-4217-c DEPENDS ${ISO_4217_C})
+
+SET (engine_SOURCES
+  Account.c
+  Recurrence.c
+  Query.c
+  SchedXaction.c
+  SX-book.c
+  SX-ttinfo.c
+  Scrub.c
+  Scrub2.c
+  Scrub3.c
+  ScrubBusiness.c
+  Split.c
+  TransLog.c
+  Transaction.c
+  cap-gains.c
+  cashobjects.c
+  gnc-aqbanking-templates.cpp
+  gnc-budget.c
+  gnc-commodity.c
+  gnc-date.cpp
+  gnc-datetime.cpp
+  gnc-engine.c
+  gnc-event.c
+  gnc-features.c
+  gnc-hooks.c
+  gnc-int128.cpp
+  gnc-lot.c
+  gnc-numeric.cpp
+  gnc-pricedb.c
+  gnc-rational.cpp
+  gnc-session.c
+  gnc-timezone.cpp
+  gnc-uri-utils.c
+  gncmod-engine.c
+  kvp-scm.cpp
+  engine-helpers.c
+  glib-helpers.c
+  guid.cpp
+  policy.c
+  gncAddress.c
+  gncBillTerm.c
+  gncBusGuile.c
+  gncBusiness.c
+  gncCustomer.c
+  gncEmployee.c
+  gncEntry.c
+  gncIDSearch.c
+  gncInvoice.c
+  gncJob.c
+  gncOrder.c
+  gncOwner.c
+  gncTaxTable.c
+  gncVendor.c
+  kvp-frame.cpp
+  kvp-value.cpp
+  qof-backend.cpp
+  qofbook.cpp
+  qofchoice.cpp
+  qofclass.cpp
+  qofevent.cpp
+  qofid.cpp
+  qofinstance.cpp
+  qoflog.cpp
+  qofobject.cpp
+  qofquery.cpp
+  qofquerycore.cpp
+  qofsession.cpp
+  qofutil.cpp
+  qof-string-cache.cpp
+)
+
+# Add dependency on config.h
+SET_SOURCE_FILES_PROPERTIES (${engine_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
+
+# Add dependency on iso-4217-currencies.c
+SET_SOURCE_FILES_PROPERTIES (gnc-commodity.c PROPERTIES OBJECT_DEPENDS "${ISO_4217_C};${CONFIG_H}")
+
+# Add dependency on swig-runtime.h
+SET_SOURCE_FILES_PROPERTIES (gnc-hooks.c engine-helpers.c kvp-scm.cpp glib-helpers.c PROPERTIES OBJECT_DEPENDS "${CONFIG_H};${SWIG_RUNTIME_H}")
+
+
+
+ADD_LIBRARY (gncmod-engine
+  ${engine_SOURCES}
+  ${engine_HEADERS}
+  ${SWIG_ENGINE_C}
+  ${engine_noinst_HEADERS}
+)
+
+TARGET_LINK_LIBRARIES(gncmod-engine gnc-core-utils gnc-module ${Boost_DATE_TIME_LIBRARIES}  ${Boost_REGEX_LIBRARIES} ${REGEX_LDFLAGS} ${GMODULE_LDFLAGS} ${GLIB2_LDFLAGS} ${GOBJECT_LDFLAGS} ${GUILE_LDFLAGS})
+
+TARGET_COMPILE_DEFINITIONS (gncmod-engine PRIVATE -DG_LOG_DOMAIN=\"gnc.engine\")
+
+TARGET_INCLUDE_DIRECTORIES (gncmod-engine
+    PRIVATE ${CMAKE_CURRENT_BINARY_DIR} # for iso-4217-currencies.c
+    PUBLIC
+        ${CMAKE_CURRENT_SOURCE_DIR}
+        ${CMAKE_BINARY_DIR}/common # for config.h
+        ${CMAKE_SOURCE_DIR}/common # for platform.h
+        ${GLIB2_INCLUDE_DIRS}
+        ${LIBINTL_INCLUDE_PATH}
+        ${REGEX_INCLUDE_PATH}
+        ${CMAKE_SOURCE_DIR}/lib/libc # for strptime.h
+)
+
+INSTALL(TARGETS gncmod-engine
+  LIBRARY DESTINATION lib/gnucash
+  ARCHIVE DESTINATION lib/gnucash
+  RUNTIME DESTINATION bin)
+
+INSTALL(FILES ${engine_HEADERS} DESTINATION include/gnucash)
+
+SET(qof_test_HEADERS
+kvp-frame.hpp
+qofbook.h
+qofinstance.h
+qofobject.h
+qofsession.h
+)
+
+INSTALL(FILES ${qof_test_HEADERS} DESTINATION libexec/gnucash/libgnucash/engine/test)
+
+# Scheme
+
+SET (engine_SCHEME_0
+    engine.scm
+    business-core.scm
+)
+
+SET (engine_SCHEME_1
+    commodity-table.scm
+    engine-interface.scm
+    engine-utilities.scm
+    gnc-numeric.scm
+)
+IF (WIN32)
+  ADD_DEFINITIONS (-DOS_WIN32)
+  SET (engine_SOURCES ${engine_SOURCES}
+  qof-win32.cpp
+  ../../lib/libc/strptime.c
+  )
+ENDIF (WIN32)
+
+SET(BACKEND_DEPENDS gncmod-backend-xml)
+IF (WITH_SQL)
+    LIST(APPEND BACKEND_DEPENDS gncmod-backend-dbi)
+ENDIF(WITH_SQL)
+
+SET(GUILE_MODULES      "")
+SET(GUILE_LOAD_DIRS    libgnucash/gnc-module)
+SET(GUILE_LIBRARY_DIRS libgnucash/gnc-module)
+SET(GUILE_DEPENDS      ${BACKEND_DEPENDS} gnc-module gncmod-engine scm-gnc-module)
+
+
+GNC_ADD_SCHEME_TARGETS(scm-engine-0
+  "${engine_SCHEME_0}"
+  gnucash
+  "${GUILE_MODULES}"
+  "${GUILE_LOAD_DIRS}"
+  "${GUILE_LIBRARY_DIRS}"
+  "${GUILE_DEPENDS}"
+  FALSE
+)
+
+GNC_ADD_SCHEME_TARGETS(scm-engine-1
+  "${engine_SCHEME_1}"
+  ""
+  ""
+  ""
+  ""
+  "scm-engine-0;${GUILE_DEPENDS}"
+  FALSE
+)
+
+ADD_CUSTOM_TARGET(scm-engine ALL DEPENDS scm-engine-1 scm-engine-0)
+
+SET(engine_EXTRA_DIST
+        business-core.i
+        design.txt
+        engine.i
+        engine-common.i
+        extensions.txt
+        iso-4217-currencies.xml
+        iso-currencies-to-c.xsl
+        kvp_doc.txt
+        README
+        README.query-api
+        SX-book-p.h
+        )
+SET_LOCAL_DIST(engine_DIST_local CMakeLists.txt Makefile.am ${engine_SOURCES} ${engine_HEADERS}
+                     ${engine_noinst_HEADERS} ${engine_SCHEME_0} ${engine_SCHEME_1} ${engine_EXTRA_DIST})
+SET(engine_DIST ${engine_DIST_local} ${engine_test_core_DIST} ${test_engine_DIST} PARENT_SCOPE)
diff --git a/src/engine/FreqSpec.h b/libgnucash/engine/FreqSpec.h
similarity index 100%
rename from src/engine/FreqSpec.h
rename to libgnucash/engine/FreqSpec.h
diff --git a/libgnucash/engine/Makefile.am b/libgnucash/engine/Makefile.am
new file mode 100644
index 0000000..b05e021
--- /dev/null
+++ b/libgnucash/engine/Makefile.am
@@ -0,0 +1,332 @@
+# Note the test subdirectory is added in src/Makefile.am rather
+# than here. This is because we need it to build after src/test-core
+# but that directory requires src/engine to be built already...
+SUBDIRS = . test-core
+
+pkglib_LTLIBRARIES = libgncmod-engine.la
+
+AM_CPPFLAGS = \
+	-I${top_srcdir}/lib/libc \
+	-I${top_srcdir}/libgnucash/core-utils \
+	-I${top_srcdir}/common \
+	-I${top_builddir}/common \
+	-I${top_srcdir}/libgnucash/gnc-module \
+	${GLIB_CFLAGS} \
+	${GUILE_CFLAGS} \
+	$(BOOST_CPPFLAGS)
+
+
+libgncmod_engine_la_SOURCES = \
+  Account.c \
+  Recurrence.c \
+  Query.c \
+  SchedXaction.c \
+  SX-book.c \
+  SX-ttinfo.c \
+  Scrub.c \
+  Scrub2.c \
+  Scrub3.c \
+  ScrubBusiness.c \
+  Split.c \
+  TransLog.c \
+  Transaction.c \
+  cap-gains.c \
+  cashobjects.c \
+  gnc-aqbanking-templates.cpp \
+  gnc-budget.c \
+  gnc-commodity.c \
+  gnc-date.cpp \
+  gnc-datetime.cpp \
+  gnc-engine.c \
+  gnc-event.c \
+  gnc-features.c \
+  gnc-hooks.c \
+  gnc-int128.cpp \
+  gnc-lot.c \
+  gnc-numeric.cpp \
+  gnc-pricedb.c \
+  gnc-rational.cpp \
+  gnc-session.c \
+  gnc-timezone.cpp \
+  gnc-uri-utils.c \
+  gncmod-engine.c \
+  guid.cpp \
+  swig-engine.c \
+  kvp-frame.cpp \
+  kvp-scm.cpp \
+  kvp-value.cpp \
+  engine-helpers.c \
+  glib-helpers.c  \
+  policy.c \
+  gncBusGuile.c \
+  gncBusiness.c \
+  gncAddress.c \
+  gncBillTerm.c \
+  gncCustomer.c \
+  gncEmployee.c \
+  gncEntry.c \
+  gncInvoice.c \
+  gncJob.c \
+  gncOrder.c \
+  gncOwner.c \
+  gncTaxTable.c \
+  gncIDSearch.c \
+  gncVendor.c \
+  qof-backend.cpp \
+  qofbook.cpp \
+  qofchoice.cpp \
+  qofclass.cpp \
+  qofevent.cpp \
+  qofid.cpp \
+  qofinstance.cpp \
+  qoflog.cpp \
+  qofobject.cpp \
+  qofquery.cpp \
+  qofquerycore.cpp \
+  qofsession.cpp \
+  qof-string-cache.cpp \
+  qofutil.cpp
+
+if OS_WIN32
+libgncmod_engine_la_SOURCES += qof-win32.cpp
+else
+WIN32_EXTRA_DIST = qof-win32.cpp
+endif
+
+EXTRA_libgncmod_engine_la_SOURCES = iso-4217-currencies.c
+
+gncincludedir = ${GNC_INCLUDE_DIR}
+gncinclude_HEADERS = \
+  Account.h \
+  FreqSpec.h \
+  Recurrence.h \
+  SchedXaction.h \
+  SX-book.h \
+  SX-ttinfo.h \
+  Query.h \
+  Scrub.h \
+  Scrub2.h \
+  Scrub3.h \
+  ScrubBusiness.h \
+  Split.h \
+  TransLog.h \
+  Transaction.h \
+  cap-gains.h \
+  cashobjects.h \
+  engine-helpers.h \
+  engine-helpers-guile.h \
+  glib-helpers.h \
+  gnc-aqbanking-templates.h \
+  gnc-budget.h \
+  gnc-commodity.h \
+  gnc-date.h \
+  gnc-datetime.hpp \
+  gnc-engine.h \
+  gnc-event.h \
+  gnc-features.h \
+  gnc-hooks.h \
+  gnc-numeric.h \
+  gnc-numeric.hpp \
+  gnc-pricedb.h \
+  gnc-rational.hpp \
+  gnc-rational-rounding.hpp \
+  gnc-session.h \
+  gnc-timezone.hpp \
+  gnc-uri-utils.h \
+  gncAddress.h \
+  gncAddressP.h \
+  gncBillTerm.h \
+  gncBillTermP.h \
+  gncBusiness.h \
+  gncBusGuile.h \
+  gncCustomer.h \
+  gncCustomerP.h \
+  gncEmployee.h \
+  gncEmployeeP.h \
+  gncEntry.h \
+  gncEntryP.h \
+  gncInvoice.h \
+  gncInvoiceP.h \
+  gncJob.h \
+  gncJobP.h \
+  gncOrder.h \
+  gncOrderP.h \
+  gncOwner.h \
+  gncOwnerP.h \
+  gncTaxTable.h \
+  gncTaxTableP.h \
+  gncIDSearch.h \
+  gncVendor.h \
+  gncVendorP.h \
+  guid.h \
+  guid.hpp \
+  kvp-frame.hpp \
+  kvp-scm.h \
+  kvp-value.hpp \
+  policy.h \
+  qof.h \
+  qof-backend.hpp \
+  qofbackend.h \
+  qofbook.h \
+  qofbookslots.h \
+  qofchoice.h \
+  qofclass.h \
+  qofevent.h \
+  qofid-p.h \
+  qofid.h \
+  qofinstance-p.h \
+  qofinstance.h \
+  qoflog.h \
+  qofobject.h \
+  qofquery.h \
+  qofquerycore.h \
+  qofsession.h \
+  qofsession.hpp \
+  qofutil.h \
+  qof-gobject.h \
+  qof-string-cache.h
+
+noinst_HEADERS = \
+  AccountP.h \
+  ScrubP.h \
+  SplitP.h \
+  SX-book.h \
+  SX-ttinfo.h \
+  TransactionP.h \
+  gnc-backend-prov.hpp \
+  gnc-date-p.h \
+  gnc-hooks-scm.h \
+  gnc-int128.hpp \
+  gnc-lot.h \
+  gnc-lot-p.h \
+  gnc-pricedb-p.h \
+  policy-p.h  \
+  qofbook-p.h \
+  qofclass-p.h \
+  qofevent-p.h \
+  qofobject-p.h \
+  qofquery-p.h \
+  qofquerycore-p.h
+
+libgncmod_engine_la_LDFLAGS = -avoid-version
+if PLATFORM_WIN32
+libgncmod_engine_la_LDFLAGS += -Wl,-export-all-symbols
+endif
+if CLANG
+libgncmod_engine_la_CFLAGS = ${AM_CFLAGS} -Wno-invalid-source-encoding
+else
+libgncmod_engine_la_CFLAGS = ${AM_CFLAGS}
+endif
+libgncmod_engine_la_LIBADD = \
+  ../gnc-module/libgnc-module.la \
+  ../core-utils/libgnc-core-utils.la \
+  ${GUILE_LIBS} \
+  ${REGEX_LIBS} \
+  ${GLIB_LIBS} \
+  ${BOOST_LDFLAGS} -lboost_regex \
+  ${top_builddir}/lib/libc/libc-missing.la
+
+gncscmmoddir = ${GNC_SCM_INSTALL_DIR}/gnucash
+gncscmmod_DATA = engine.scm \
+  business-core.scm
+
+gncscmdir = ${GNC_SCM_INSTALL_DIR}
+gncscm_DATA = \
+  commodity-table.scm \
+  engine-interface.scm \
+  engine-utilities.scm \
+  gnc-numeric.scm
+
+EXTRA_DIST = \
+  README.query-api \
+  design.txt \
+  extensions.txt \
+  iso-4217-currencies.xml \
+  iso-currencies-to-c.xsl \
+  kvp_doc.txt \
+  SX-book-p.h \
+  engine.i \
+  engine-common.i \
+  business-core.i \
+  ${gncscmmod_DATA} \
+  ${gncscm_DATA} \
+  CMakeLists.txt \
+  ${WIN32_EXTRA_DIST}
+
+if GNUCASH_SEPARATE_BUILDDIR
+#For executing test cases
+SCM_FILE_LINKS = \
+  ${gncscmmod_DATA} \
+  ${gncscm_DATA}
+endif
+
+.scm-links:
+	$(RM) -rf gnucash
+	mkdir -p  gnucash
+if GNUCASH_SEPARATE_BUILDDIR
+	for X in ${SCM_FILE_LINKS} ; do \
+	  $(LN_S) -f ${srcdir}/$$X . ; \
+	done
+endif
+	( cd gnucash; for A in $(gncscmmod_DATA) ; do $(LN_S) -f ../$$A . ; done )
+if ! OS_WIN32
+# Windows knows no "ln -s" but uses "cp": must copy every time (see bug #566567).
+	touch .scm-links
+endif
+
+if GNC_HAVE_GUILE_2
+GUILE_COMPILE_ENV = \
+  --guile-load-dir ${top_builddir}/libgnucash/gnc-module \
+  --library-dir    ${top_builddir}/libgnucash/engine \
+  --library-dir    ${top_builddir}/libgnucash/gnc-module \
+  --library-dir    ${top_builddir}/libgnucash/core-utils
+
+%.go : %.scm .scm-links $(pkglib_LTLIBRARIES)
+	GNC_UNINSTALLED=yes \
+	GNC_BUILDDIR=${top_builddir} \
+	$(shell ${abs_top_srcdir}/common/gnc-test-env.pl --noexports ${GUILE_COMPILE_ENV}) \
+	$(GUILD) compile -o $@ $<
+
+gncscmmodcachedir = ${pkglibdir}/scm/ccache/@GUILE_EFFECTIVE_VERSION@/gnucash
+gncscmmodcache_DATA = $(gncscmmod_DATA:.scm=.go)
+
+gncscmcachedir = ${pkglibdir}/scm/ccache/@GUILE_EFFECTIVE_VERSION@
+gncscmcache_DATA = $(gncscm_DATA:.scm=.go)
+endif
+
+noinst_DATA = .scm-links
+
+if BUILDING_FROM_VCS
+
+swig-engine.c: engine.i $(top_srcdir)/common/base-typemaps.i \
+               $(gncinclude_HEADERS) $(noinst_HEADERS)
+	$(SWIG) -guile $(SWIG_ARGS) -Linkage module \
+	-I${top_srcdir}/common -o $@ $<
+if ! OS_WIN32
+if ! SWIG_DIST_FAIL
+	if ! `grep "define scm_from_utf8_string" $@ > /dev/null 2>&1`; then \
+	  patch $@ $(top_srcdir)/common/swig-utf8.patch; \
+	fi
+endif
+endif
+endif
+
+
+iso-4217-currencies.c: iso-4217-currencies.xml iso-currencies-to-c.xsl
+	$(XSLTPROC) -o $@ $(srcdir)/iso-currencies-to-c.xsl $<
+
+BUILT_SOURCES = iso-4217-currencies.c
+
+CLEANFILES = \
+	$(BUILT_SOURCES) \
+	.scm-links \
+	${SCM_FILE_LINKS} \
+	${gncscmmodcache_DATA} \
+	${gncscmcache_DATA}
+
+MAINTAINERCLEANFILES = swig-engine.c
+
+clean-local:
+	rm -rf gnucash
+
+AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.engine\"
diff --git a/src/engine/Query.c b/libgnucash/engine/Query.c
similarity index 100%
rename from src/engine/Query.c
rename to libgnucash/engine/Query.c
diff --git a/src/engine/Query.h b/libgnucash/engine/Query.h
similarity index 100%
rename from src/engine/Query.h
rename to libgnucash/engine/Query.h
diff --git a/src/engine/README b/libgnucash/engine/README
similarity index 100%
rename from src/engine/README
rename to libgnucash/engine/README
diff --git a/src/engine/README.query-api b/libgnucash/engine/README.query-api
similarity index 100%
rename from src/engine/README.query-api
rename to libgnucash/engine/README.query-api
diff --git a/src/engine/Recurrence.c b/libgnucash/engine/Recurrence.c
similarity index 100%
rename from src/engine/Recurrence.c
rename to libgnucash/engine/Recurrence.c
diff --git a/src/engine/Recurrence.h b/libgnucash/engine/Recurrence.h
similarity index 100%
rename from src/engine/Recurrence.h
rename to libgnucash/engine/Recurrence.h
diff --git a/src/engine/SX-book-p.h b/libgnucash/engine/SX-book-p.h
similarity index 100%
rename from src/engine/SX-book-p.h
rename to libgnucash/engine/SX-book-p.h
diff --git a/src/engine/SX-book.c b/libgnucash/engine/SX-book.c
similarity index 100%
rename from src/engine/SX-book.c
rename to libgnucash/engine/SX-book.c
diff --git a/src/engine/SX-book.h b/libgnucash/engine/SX-book.h
similarity index 100%
rename from src/engine/SX-book.h
rename to libgnucash/engine/SX-book.h
diff --git a/src/engine/SX-ttinfo.c b/libgnucash/engine/SX-ttinfo.c
similarity index 100%
rename from src/engine/SX-ttinfo.c
rename to libgnucash/engine/SX-ttinfo.c
diff --git a/src/engine/SX-ttinfo.h b/libgnucash/engine/SX-ttinfo.h
similarity index 100%
rename from src/engine/SX-ttinfo.h
rename to libgnucash/engine/SX-ttinfo.h
diff --git a/src/engine/SchedXaction.c b/libgnucash/engine/SchedXaction.c
similarity index 100%
rename from src/engine/SchedXaction.c
rename to libgnucash/engine/SchedXaction.c
diff --git a/src/engine/SchedXaction.h b/libgnucash/engine/SchedXaction.h
similarity index 100%
rename from src/engine/SchedXaction.h
rename to libgnucash/engine/SchedXaction.h
diff --git a/src/engine/Scrub.c b/libgnucash/engine/Scrub.c
similarity index 100%
rename from src/engine/Scrub.c
rename to libgnucash/engine/Scrub.c
diff --git a/src/engine/Scrub.h b/libgnucash/engine/Scrub.h
similarity index 100%
rename from src/engine/Scrub.h
rename to libgnucash/engine/Scrub.h
diff --git a/src/engine/Scrub2.c b/libgnucash/engine/Scrub2.c
similarity index 100%
rename from src/engine/Scrub2.c
rename to libgnucash/engine/Scrub2.c
diff --git a/src/engine/Scrub2.h b/libgnucash/engine/Scrub2.h
similarity index 100%
rename from src/engine/Scrub2.h
rename to libgnucash/engine/Scrub2.h
diff --git a/src/engine/Scrub3.c b/libgnucash/engine/Scrub3.c
similarity index 100%
rename from src/engine/Scrub3.c
rename to libgnucash/engine/Scrub3.c
diff --git a/src/engine/Scrub3.h b/libgnucash/engine/Scrub3.h
similarity index 100%
rename from src/engine/Scrub3.h
rename to libgnucash/engine/Scrub3.h
diff --git a/src/engine/ScrubBusiness.c b/libgnucash/engine/ScrubBusiness.c
similarity index 100%
rename from src/engine/ScrubBusiness.c
rename to libgnucash/engine/ScrubBusiness.c
diff --git a/src/engine/ScrubBusiness.h b/libgnucash/engine/ScrubBusiness.h
similarity index 100%
rename from src/engine/ScrubBusiness.h
rename to libgnucash/engine/ScrubBusiness.h
diff --git a/src/engine/ScrubP.h b/libgnucash/engine/ScrubP.h
similarity index 100%
rename from src/engine/ScrubP.h
rename to libgnucash/engine/ScrubP.h
diff --git a/src/engine/Split.c b/libgnucash/engine/Split.c
similarity index 100%
rename from src/engine/Split.c
rename to libgnucash/engine/Split.c
diff --git a/src/engine/Split.h b/libgnucash/engine/Split.h
similarity index 100%
rename from src/engine/Split.h
rename to libgnucash/engine/Split.h
diff --git a/src/engine/SplitP.h b/libgnucash/engine/SplitP.h
similarity index 100%
rename from src/engine/SplitP.h
rename to libgnucash/engine/SplitP.h
diff --git a/src/engine/TransLog.c b/libgnucash/engine/TransLog.c
similarity index 100%
rename from src/engine/TransLog.c
rename to libgnucash/engine/TransLog.c
diff --git a/src/engine/TransLog.h b/libgnucash/engine/TransLog.h
similarity index 100%
rename from src/engine/TransLog.h
rename to libgnucash/engine/TransLog.h
diff --git a/src/engine/Transaction.c b/libgnucash/engine/Transaction.c
similarity index 100%
rename from src/engine/Transaction.c
rename to libgnucash/engine/Transaction.c
diff --git a/src/engine/Transaction.h b/libgnucash/engine/Transaction.h
similarity index 100%
rename from src/engine/Transaction.h
rename to libgnucash/engine/Transaction.h
diff --git a/src/engine/TransactionP.h b/libgnucash/engine/TransactionP.h
similarity index 100%
rename from src/engine/TransactionP.h
rename to libgnucash/engine/TransactionP.h
diff --git a/src/engine/business-core.i b/libgnucash/engine/business-core.i
similarity index 100%
rename from src/engine/business-core.i
rename to libgnucash/engine/business-core.i
diff --git a/src/engine/business-core.scm b/libgnucash/engine/business-core.scm
similarity index 100%
rename from src/engine/business-core.scm
rename to libgnucash/engine/business-core.scm
diff --git a/src/engine/cap-gains.c b/libgnucash/engine/cap-gains.c
similarity index 100%
rename from src/engine/cap-gains.c
rename to libgnucash/engine/cap-gains.c
diff --git a/src/engine/cap-gains.h b/libgnucash/engine/cap-gains.h
similarity index 100%
rename from src/engine/cap-gains.h
rename to libgnucash/engine/cap-gains.h
diff --git a/src/engine/cashobjects.c b/libgnucash/engine/cashobjects.c
similarity index 100%
rename from src/engine/cashobjects.c
rename to libgnucash/engine/cashobjects.c
diff --git a/src/engine/cashobjects.h b/libgnucash/engine/cashobjects.h
similarity index 100%
rename from src/engine/cashobjects.h
rename to libgnucash/engine/cashobjects.h
diff --git a/src/engine/commodity-table.scm b/libgnucash/engine/commodity-table.scm
similarity index 100%
rename from src/engine/commodity-table.scm
rename to libgnucash/engine/commodity-table.scm
diff --git a/src/engine/design.txt b/libgnucash/engine/design.txt
similarity index 100%
rename from src/engine/design.txt
rename to libgnucash/engine/design.txt
diff --git a/src/engine/engine-common.i b/libgnucash/engine/engine-common.i
similarity index 100%
rename from src/engine/engine-common.i
rename to libgnucash/engine/engine-common.i
diff --git a/src/engine/engine-helpers-guile.h b/libgnucash/engine/engine-helpers-guile.h
similarity index 100%
rename from src/engine/engine-helpers-guile.h
rename to libgnucash/engine/engine-helpers-guile.h
diff --git a/src/engine/engine-helpers.c b/libgnucash/engine/engine-helpers.c
similarity index 100%
rename from src/engine/engine-helpers.c
rename to libgnucash/engine/engine-helpers.c
diff --git a/src/engine/engine-helpers.h b/libgnucash/engine/engine-helpers.h
similarity index 100%
rename from src/engine/engine-helpers.h
rename to libgnucash/engine/engine-helpers.h
diff --git a/src/engine/engine-interface.scm b/libgnucash/engine/engine-interface.scm
similarity index 100%
rename from src/engine/engine-interface.scm
rename to libgnucash/engine/engine-interface.scm
diff --git a/src/engine/engine-utilities.scm b/libgnucash/engine/engine-utilities.scm
similarity index 100%
rename from src/engine/engine-utilities.scm
rename to libgnucash/engine/engine-utilities.scm
diff --git a/src/engine/engine.i b/libgnucash/engine/engine.i
similarity index 100%
rename from src/engine/engine.i
rename to libgnucash/engine/engine.i
diff --git a/src/engine/engine.scm b/libgnucash/engine/engine.scm
similarity index 100%
rename from src/engine/engine.scm
rename to libgnucash/engine/engine.scm
diff --git a/src/engine/extensions.txt b/libgnucash/engine/extensions.txt
similarity index 100%
rename from src/engine/extensions.txt
rename to libgnucash/engine/extensions.txt
diff --git a/src/engine/glib-helpers.c b/libgnucash/engine/glib-helpers.c
similarity index 100%
rename from src/engine/glib-helpers.c
rename to libgnucash/engine/glib-helpers.c
diff --git a/src/engine/glib-helpers.h b/libgnucash/engine/glib-helpers.h
similarity index 100%
rename from src/engine/glib-helpers.h
rename to libgnucash/engine/glib-helpers.h
diff --git a/src/engine/gnc-aqbanking-templates.cpp b/libgnucash/engine/gnc-aqbanking-templates.cpp
similarity index 100%
rename from src/engine/gnc-aqbanking-templates.cpp
rename to libgnucash/engine/gnc-aqbanking-templates.cpp
diff --git a/src/engine/gnc-aqbanking-templates.h b/libgnucash/engine/gnc-aqbanking-templates.h
similarity index 100%
rename from src/engine/gnc-aqbanking-templates.h
rename to libgnucash/engine/gnc-aqbanking-templates.h
diff --git a/src/engine/gnc-backend-prov.hpp b/libgnucash/engine/gnc-backend-prov.hpp
similarity index 100%
rename from src/engine/gnc-backend-prov.hpp
rename to libgnucash/engine/gnc-backend-prov.hpp
diff --git a/src/engine/gnc-budget.c b/libgnucash/engine/gnc-budget.c
similarity index 100%
rename from src/engine/gnc-budget.c
rename to libgnucash/engine/gnc-budget.c
diff --git a/src/engine/gnc-budget.h b/libgnucash/engine/gnc-budget.h
similarity index 100%
rename from src/engine/gnc-budget.h
rename to libgnucash/engine/gnc-budget.h
diff --git a/src/engine/gnc-commodity.c b/libgnucash/engine/gnc-commodity.c
similarity index 100%
rename from src/engine/gnc-commodity.c
rename to libgnucash/engine/gnc-commodity.c
diff --git a/src/engine/gnc-commodity.h b/libgnucash/engine/gnc-commodity.h
similarity index 100%
rename from src/engine/gnc-commodity.h
rename to libgnucash/engine/gnc-commodity.h
diff --git a/src/engine/gnc-date-p.h b/libgnucash/engine/gnc-date-p.h
similarity index 100%
rename from src/engine/gnc-date-p.h
rename to libgnucash/engine/gnc-date-p.h
diff --git a/src/engine/gnc-date.cpp b/libgnucash/engine/gnc-date.cpp
similarity index 100%
rename from src/engine/gnc-date.cpp
rename to libgnucash/engine/gnc-date.cpp
diff --git a/src/engine/gnc-date.h b/libgnucash/engine/gnc-date.h
similarity index 100%
rename from src/engine/gnc-date.h
rename to libgnucash/engine/gnc-date.h
diff --git a/src/engine/gnc-datetime.cpp b/libgnucash/engine/gnc-datetime.cpp
similarity index 100%
rename from src/engine/gnc-datetime.cpp
rename to libgnucash/engine/gnc-datetime.cpp
diff --git a/src/engine/gnc-datetime.hpp b/libgnucash/engine/gnc-datetime.hpp
similarity index 100%
rename from src/engine/gnc-datetime.hpp
rename to libgnucash/engine/gnc-datetime.hpp
diff --git a/src/engine/gnc-engine.c b/libgnucash/engine/gnc-engine.c
similarity index 100%
rename from src/engine/gnc-engine.c
rename to libgnucash/engine/gnc-engine.c
diff --git a/src/engine/gnc-engine.h b/libgnucash/engine/gnc-engine.h
similarity index 100%
rename from src/engine/gnc-engine.h
rename to libgnucash/engine/gnc-engine.h
diff --git a/src/engine/gnc-event.c b/libgnucash/engine/gnc-event.c
similarity index 100%
rename from src/engine/gnc-event.c
rename to libgnucash/engine/gnc-event.c
diff --git a/src/engine/gnc-event.h b/libgnucash/engine/gnc-event.h
similarity index 100%
rename from src/engine/gnc-event.h
rename to libgnucash/engine/gnc-event.h
diff --git a/src/engine/gnc-features.c b/libgnucash/engine/gnc-features.c
similarity index 100%
rename from src/engine/gnc-features.c
rename to libgnucash/engine/gnc-features.c
diff --git a/src/engine/gnc-features.h b/libgnucash/engine/gnc-features.h
similarity index 100%
rename from src/engine/gnc-features.h
rename to libgnucash/engine/gnc-features.h
diff --git a/src/engine/gnc-hooks-scm.h b/libgnucash/engine/gnc-hooks-scm.h
similarity index 100%
rename from src/engine/gnc-hooks-scm.h
rename to libgnucash/engine/gnc-hooks-scm.h
diff --git a/src/engine/gnc-hooks.c b/libgnucash/engine/gnc-hooks.c
similarity index 100%
rename from src/engine/gnc-hooks.c
rename to libgnucash/engine/gnc-hooks.c
diff --git a/src/engine/gnc-hooks.h b/libgnucash/engine/gnc-hooks.h
similarity index 100%
rename from src/engine/gnc-hooks.h
rename to libgnucash/engine/gnc-hooks.h
diff --git a/src/engine/gnc-int128.cpp b/libgnucash/engine/gnc-int128.cpp
similarity index 100%
rename from src/engine/gnc-int128.cpp
rename to libgnucash/engine/gnc-int128.cpp
diff --git a/src/engine/gnc-int128.hpp b/libgnucash/engine/gnc-int128.hpp
similarity index 100%
rename from src/engine/gnc-int128.hpp
rename to libgnucash/engine/gnc-int128.hpp
diff --git a/src/engine/gnc-lot-p.h b/libgnucash/engine/gnc-lot-p.h
similarity index 100%
rename from src/engine/gnc-lot-p.h
rename to libgnucash/engine/gnc-lot-p.h
diff --git a/src/engine/gnc-lot.c b/libgnucash/engine/gnc-lot.c
similarity index 100%
rename from src/engine/gnc-lot.c
rename to libgnucash/engine/gnc-lot.c
diff --git a/src/engine/gnc-lot.h b/libgnucash/engine/gnc-lot.h
similarity index 100%
rename from src/engine/gnc-lot.h
rename to libgnucash/engine/gnc-lot.h
diff --git a/src/engine/gnc-numeric.cpp b/libgnucash/engine/gnc-numeric.cpp
similarity index 100%
rename from src/engine/gnc-numeric.cpp
rename to libgnucash/engine/gnc-numeric.cpp
diff --git a/src/engine/gnc-numeric.h b/libgnucash/engine/gnc-numeric.h
similarity index 100%
rename from src/engine/gnc-numeric.h
rename to libgnucash/engine/gnc-numeric.h
diff --git a/src/engine/gnc-numeric.hpp b/libgnucash/engine/gnc-numeric.hpp
similarity index 100%
rename from src/engine/gnc-numeric.hpp
rename to libgnucash/engine/gnc-numeric.hpp
diff --git a/src/engine/gnc-numeric.scm b/libgnucash/engine/gnc-numeric.scm
similarity index 100%
rename from src/engine/gnc-numeric.scm
rename to libgnucash/engine/gnc-numeric.scm
diff --git a/src/engine/gnc-pricedb-p.h b/libgnucash/engine/gnc-pricedb-p.h
similarity index 100%
rename from src/engine/gnc-pricedb-p.h
rename to libgnucash/engine/gnc-pricedb-p.h
diff --git a/src/engine/gnc-pricedb.c b/libgnucash/engine/gnc-pricedb.c
similarity index 100%
rename from src/engine/gnc-pricedb.c
rename to libgnucash/engine/gnc-pricedb.c
diff --git a/src/engine/gnc-pricedb.h b/libgnucash/engine/gnc-pricedb.h
similarity index 100%
rename from src/engine/gnc-pricedb.h
rename to libgnucash/engine/gnc-pricedb.h
diff --git a/src/engine/gnc-rational-rounding.hpp b/libgnucash/engine/gnc-rational-rounding.hpp
similarity index 100%
rename from src/engine/gnc-rational-rounding.hpp
rename to libgnucash/engine/gnc-rational-rounding.hpp
diff --git a/src/engine/gnc-rational.cpp b/libgnucash/engine/gnc-rational.cpp
similarity index 100%
rename from src/engine/gnc-rational.cpp
rename to libgnucash/engine/gnc-rational.cpp
diff --git a/src/engine/gnc-rational.hpp b/libgnucash/engine/gnc-rational.hpp
similarity index 100%
rename from src/engine/gnc-rational.hpp
rename to libgnucash/engine/gnc-rational.hpp
diff --git a/src/engine/gnc-session.c b/libgnucash/engine/gnc-session.c
similarity index 100%
rename from src/engine/gnc-session.c
rename to libgnucash/engine/gnc-session.c
diff --git a/src/engine/gnc-session.h b/libgnucash/engine/gnc-session.h
similarity index 100%
rename from src/engine/gnc-session.h
rename to libgnucash/engine/gnc-session.h
diff --git a/src/engine/gnc-timezone.cpp b/libgnucash/engine/gnc-timezone.cpp
similarity index 100%
rename from src/engine/gnc-timezone.cpp
rename to libgnucash/engine/gnc-timezone.cpp
diff --git a/src/engine/gnc-timezone.hpp b/libgnucash/engine/gnc-timezone.hpp
similarity index 100%
rename from src/engine/gnc-timezone.hpp
rename to libgnucash/engine/gnc-timezone.hpp
diff --git a/src/engine/gnc-uri-utils.c b/libgnucash/engine/gnc-uri-utils.c
similarity index 100%
rename from src/engine/gnc-uri-utils.c
rename to libgnucash/engine/gnc-uri-utils.c
diff --git a/src/engine/gnc-uri-utils.h b/libgnucash/engine/gnc-uri-utils.h
similarity index 100%
rename from src/engine/gnc-uri-utils.h
rename to libgnucash/engine/gnc-uri-utils.h
diff --git a/src/engine/gncAddress.c b/libgnucash/engine/gncAddress.c
similarity index 100%
rename from src/engine/gncAddress.c
rename to libgnucash/engine/gncAddress.c
diff --git a/src/engine/gncAddress.h b/libgnucash/engine/gncAddress.h
similarity index 100%
rename from src/engine/gncAddress.h
rename to libgnucash/engine/gncAddress.h
diff --git a/src/engine/gncAddressP.h b/libgnucash/engine/gncAddressP.h
similarity index 100%
rename from src/engine/gncAddressP.h
rename to libgnucash/engine/gncAddressP.h
diff --git a/src/engine/gncBillTerm.c b/libgnucash/engine/gncBillTerm.c
similarity index 100%
rename from src/engine/gncBillTerm.c
rename to libgnucash/engine/gncBillTerm.c
diff --git a/src/engine/gncBillTerm.h b/libgnucash/engine/gncBillTerm.h
similarity index 100%
rename from src/engine/gncBillTerm.h
rename to libgnucash/engine/gncBillTerm.h
diff --git a/src/engine/gncBillTermP.h b/libgnucash/engine/gncBillTermP.h
similarity index 100%
rename from src/engine/gncBillTermP.h
rename to libgnucash/engine/gncBillTermP.h
diff --git a/src/engine/gncBusGuile.c b/libgnucash/engine/gncBusGuile.c
similarity index 100%
rename from src/engine/gncBusGuile.c
rename to libgnucash/engine/gncBusGuile.c
diff --git a/src/engine/gncBusGuile.h b/libgnucash/engine/gncBusGuile.h
similarity index 100%
rename from src/engine/gncBusGuile.h
rename to libgnucash/engine/gncBusGuile.h
diff --git a/libgnucash/engine/gncBusiness.c b/libgnucash/engine/gncBusiness.c
new file mode 100644
index 0000000..296a55e
--- /dev/null
+++ b/libgnucash/engine/gncBusiness.c
@@ -0,0 +1,99 @@
+/*
+ * gncBusiness.c -- Business helper functions
+ * Copyright (C) 2010 Christian Stimming
+ * Author: Christian Stimming <christian at cstimming.de>
+ *
+ * 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 at gnu.org
+ */
+
+#include "config.h"
+
+#include "gncBusiness.h"
+#include "gncOwner.h"
+
+/* The initialization of the business objects is done in
+ * cashobjects_register() of <engine/cashobjects.h>. */
+
+struct _get_list_userdata
+{
+    GList *result;
+    QofAccessFunc is_active_accessor_func;
+};
+static void get_list_cb (QofInstance *inst, gpointer user_data)
+{
+    struct _get_list_userdata* data = user_data;
+    if (!data->is_active_accessor_func || data->is_active_accessor_func(inst, NULL))
+        data->result = g_list_prepend(data->result, inst);
+}
+
+
+GList * gncBusinessGetList (QofBook *book, const char *type_name,
+                            gboolean all_including_inactive)
+{
+    struct _get_list_userdata data;
+    data.result = NULL;
+    data.is_active_accessor_func = NULL;
+
+    if (!all_including_inactive)
+    {
+        data.is_active_accessor_func =
+            qof_class_get_parameter_getter(type_name, QOF_PARAM_ACTIVE);
+    }
+
+    qof_object_foreach(type_name, book, &get_list_cb, &data);
+
+    return data.result;
+}
+
+static void get_ownerlist_cb (QofInstance *inst, gpointer user_data)
+{
+    struct _get_list_userdata* data = user_data;
+    if (!data->is_active_accessor_func || data->is_active_accessor_func(inst, NULL))
+    {
+        GncOwner *owner = gncOwnerNew();
+        qofOwnerSetEntity(owner, inst);
+        data->result = g_list_prepend(data->result, owner);
+    }
+}
+
+GList * gncBusinessGetOwnerList (QofBook *book, const char *type_name,
+                                 gboolean all_including_inactive)
+{
+    struct _get_list_userdata data;
+    data.result = NULL;
+    data.is_active_accessor_func = NULL;
+
+    if (!all_including_inactive)
+    {
+        data.is_active_accessor_func =
+            qof_class_get_parameter_getter(type_name, QOF_PARAM_ACTIVE);
+    }
+
+    qof_object_foreach(type_name, book, &get_ownerlist_cb, &data);
+
+    return data.result;
+}
+
+gboolean gncBusinessIsPaymentAcctType (GNCAccountType type)
+{
+    if (xaccAccountIsAssetLiabType(type) ||
+        xaccAccountIsEquityType(type))
+        return TRUE;
+    else
+        return FALSE;
+}
diff --git a/src/engine/gncBusiness.h b/libgnucash/engine/gncBusiness.h
similarity index 100%
rename from src/engine/gncBusiness.h
rename to libgnucash/engine/gncBusiness.h
diff --git a/src/engine/gncCustomer.c b/libgnucash/engine/gncCustomer.c
similarity index 100%
rename from src/engine/gncCustomer.c
rename to libgnucash/engine/gncCustomer.c
diff --git a/src/engine/gncCustomer.h b/libgnucash/engine/gncCustomer.h
similarity index 100%
rename from src/engine/gncCustomer.h
rename to libgnucash/engine/gncCustomer.h
diff --git a/src/engine/gncCustomerP.h b/libgnucash/engine/gncCustomerP.h
similarity index 100%
rename from src/engine/gncCustomerP.h
rename to libgnucash/engine/gncCustomerP.h
diff --git a/src/engine/gncEmployee.c b/libgnucash/engine/gncEmployee.c
similarity index 100%
rename from src/engine/gncEmployee.c
rename to libgnucash/engine/gncEmployee.c
diff --git a/src/engine/gncEmployee.h b/libgnucash/engine/gncEmployee.h
similarity index 100%
rename from src/engine/gncEmployee.h
rename to libgnucash/engine/gncEmployee.h
diff --git a/src/engine/gncEmployeeP.h b/libgnucash/engine/gncEmployeeP.h
similarity index 100%
rename from src/engine/gncEmployeeP.h
rename to libgnucash/engine/gncEmployeeP.h
diff --git a/src/engine/gncEntry.c b/libgnucash/engine/gncEntry.c
similarity index 100%
rename from src/engine/gncEntry.c
rename to libgnucash/engine/gncEntry.c
diff --git a/src/engine/gncEntry.h b/libgnucash/engine/gncEntry.h
similarity index 100%
rename from src/engine/gncEntry.h
rename to libgnucash/engine/gncEntry.h
diff --git a/src/engine/gncEntryP.h b/libgnucash/engine/gncEntryP.h
similarity index 100%
rename from src/engine/gncEntryP.h
rename to libgnucash/engine/gncEntryP.h
diff --git a/src/engine/gncIDSearch.c b/libgnucash/engine/gncIDSearch.c
similarity index 100%
rename from src/engine/gncIDSearch.c
rename to libgnucash/engine/gncIDSearch.c
diff --git a/src/engine/gncIDSearch.h b/libgnucash/engine/gncIDSearch.h
similarity index 100%
rename from src/engine/gncIDSearch.h
rename to libgnucash/engine/gncIDSearch.h
diff --git a/src/engine/gncInvoice.c b/libgnucash/engine/gncInvoice.c
similarity index 100%
rename from src/engine/gncInvoice.c
rename to libgnucash/engine/gncInvoice.c
diff --git a/src/engine/gncInvoice.h b/libgnucash/engine/gncInvoice.h
similarity index 100%
rename from src/engine/gncInvoice.h
rename to libgnucash/engine/gncInvoice.h
diff --git a/src/engine/gncInvoiceP.h b/libgnucash/engine/gncInvoiceP.h
similarity index 100%
rename from src/engine/gncInvoiceP.h
rename to libgnucash/engine/gncInvoiceP.h
diff --git a/src/engine/gncJob.c b/libgnucash/engine/gncJob.c
similarity index 100%
rename from src/engine/gncJob.c
rename to libgnucash/engine/gncJob.c
diff --git a/src/engine/gncJob.h b/libgnucash/engine/gncJob.h
similarity index 100%
rename from src/engine/gncJob.h
rename to libgnucash/engine/gncJob.h
diff --git a/src/engine/gncJobP.h b/libgnucash/engine/gncJobP.h
similarity index 100%
rename from src/engine/gncJobP.h
rename to libgnucash/engine/gncJobP.h
diff --git a/src/engine/gncOrder.c b/libgnucash/engine/gncOrder.c
similarity index 100%
rename from src/engine/gncOrder.c
rename to libgnucash/engine/gncOrder.c
diff --git a/src/engine/gncOrder.h b/libgnucash/engine/gncOrder.h
similarity index 100%
rename from src/engine/gncOrder.h
rename to libgnucash/engine/gncOrder.h
diff --git a/src/engine/gncOrderP.h b/libgnucash/engine/gncOrderP.h
similarity index 100%
rename from src/engine/gncOrderP.h
rename to libgnucash/engine/gncOrderP.h
diff --git a/src/engine/gncOwner.c b/libgnucash/engine/gncOwner.c
similarity index 100%
rename from src/engine/gncOwner.c
rename to libgnucash/engine/gncOwner.c
diff --git a/src/engine/gncOwner.h b/libgnucash/engine/gncOwner.h
similarity index 100%
rename from src/engine/gncOwner.h
rename to libgnucash/engine/gncOwner.h
diff --git a/src/engine/gncOwnerP.h b/libgnucash/engine/gncOwnerP.h
similarity index 100%
rename from src/engine/gncOwnerP.h
rename to libgnucash/engine/gncOwnerP.h
diff --git a/src/engine/gncTaxTable.c b/libgnucash/engine/gncTaxTable.c
similarity index 100%
rename from src/engine/gncTaxTable.c
rename to libgnucash/engine/gncTaxTable.c
diff --git a/src/engine/gncTaxTable.h b/libgnucash/engine/gncTaxTable.h
similarity index 100%
rename from src/engine/gncTaxTable.h
rename to libgnucash/engine/gncTaxTable.h
diff --git a/src/engine/gncTaxTableP.h b/libgnucash/engine/gncTaxTableP.h
similarity index 100%
rename from src/engine/gncTaxTableP.h
rename to libgnucash/engine/gncTaxTableP.h
diff --git a/src/engine/gncVendor.c b/libgnucash/engine/gncVendor.c
similarity index 100%
rename from src/engine/gncVendor.c
rename to libgnucash/engine/gncVendor.c
diff --git a/src/engine/gncVendor.h b/libgnucash/engine/gncVendor.h
similarity index 100%
rename from src/engine/gncVendor.h
rename to libgnucash/engine/gncVendor.h
diff --git a/src/engine/gncVendorP.h b/libgnucash/engine/gncVendorP.h
similarity index 100%
rename from src/engine/gncVendorP.h
rename to libgnucash/engine/gncVendorP.h
diff --git a/src/engine/gncmod-engine.c b/libgnucash/engine/gncmod-engine.c
similarity index 100%
rename from src/engine/gncmod-engine.c
rename to libgnucash/engine/gncmod-engine.c
diff --git a/src/engine/guid.cpp b/libgnucash/engine/guid.cpp
similarity index 100%
rename from src/engine/guid.cpp
rename to libgnucash/engine/guid.cpp
diff --git a/src/engine/guid.h b/libgnucash/engine/guid.h
similarity index 100%
rename from src/engine/guid.h
rename to libgnucash/engine/guid.h
diff --git a/src/engine/guid.hpp b/libgnucash/engine/guid.hpp
similarity index 100%
rename from src/engine/guid.hpp
rename to libgnucash/engine/guid.hpp
diff --git a/src/engine/iso-4217-currencies.xml b/libgnucash/engine/iso-4217-currencies.xml
similarity index 100%
rename from src/engine/iso-4217-currencies.xml
rename to libgnucash/engine/iso-4217-currencies.xml
diff --git a/src/engine/iso-currencies-to-c.xsl b/libgnucash/engine/iso-currencies-to-c.xsl
similarity index 100%
rename from src/engine/iso-currencies-to-c.xsl
rename to libgnucash/engine/iso-currencies-to-c.xsl
diff --git a/src/engine/kvp-frame.cpp b/libgnucash/engine/kvp-frame.cpp
similarity index 100%
rename from src/engine/kvp-frame.cpp
rename to libgnucash/engine/kvp-frame.cpp
diff --git a/src/engine/kvp-frame.hpp b/libgnucash/engine/kvp-frame.hpp
similarity index 100%
rename from src/engine/kvp-frame.hpp
rename to libgnucash/engine/kvp-frame.hpp
diff --git a/src/engine/kvp-scm.cpp b/libgnucash/engine/kvp-scm.cpp
similarity index 100%
rename from src/engine/kvp-scm.cpp
rename to libgnucash/engine/kvp-scm.cpp
diff --git a/src/engine/kvp-scm.h b/libgnucash/engine/kvp-scm.h
similarity index 100%
rename from src/engine/kvp-scm.h
rename to libgnucash/engine/kvp-scm.h
diff --git a/src/engine/kvp-value.cpp b/libgnucash/engine/kvp-value.cpp
similarity index 100%
rename from src/engine/kvp-value.cpp
rename to libgnucash/engine/kvp-value.cpp
diff --git a/src/engine/kvp-value.hpp b/libgnucash/engine/kvp-value.hpp
similarity index 100%
rename from src/engine/kvp-value.hpp
rename to libgnucash/engine/kvp-value.hpp
diff --git a/src/engine/kvp_doc.txt b/libgnucash/engine/kvp_doc.txt
similarity index 100%
rename from src/engine/kvp_doc.txt
rename to libgnucash/engine/kvp_doc.txt
diff --git a/src/engine/policy-p.h b/libgnucash/engine/policy-p.h
similarity index 100%
rename from src/engine/policy-p.h
rename to libgnucash/engine/policy-p.h
diff --git a/src/engine/policy.c b/libgnucash/engine/policy.c
similarity index 100%
rename from src/engine/policy.c
rename to libgnucash/engine/policy.c
diff --git a/src/engine/policy.h b/libgnucash/engine/policy.h
similarity index 100%
rename from src/engine/policy.h
rename to libgnucash/engine/policy.h
diff --git a/libgnucash/engine/qof-backend.cpp b/libgnucash/engine/qof-backend.cpp
new file mode 100644
index 0000000..cc87947
--- /dev/null
+++ b/libgnucash/engine/qof-backend.cpp
@@ -0,0 +1,219 @@
+/********************************************************************\
+ * qofbackend.c -- utility routines for dealing with the data backend  *
+ * Copyright (C) 2000 Linas Vepstas <linas at linas.org>               *
+ * Copyright (C) 2004-5 Neil Williams <linux at codehelp.co.uk>        *
+ *                                                                  *
+ * 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 at gnu.org                   *
+ *                                                                  *
+\********************************************************************/
+
+extern "C"
+{
+
+#include <config.h>
+#include "qof.h"
+#include <gnc-path.h>
+}
+
+#include <string>
+#include <algorithm>
+#include <vector>
+
+#include "qof-backend.hpp"
+
+G_GNUC_UNUSED static QofLogModule log_module = QOF_MOD_BACKEND;
+
+#define QOF_CONFIG_DESC    "desc"
+#define QOF_CONFIG_TIP     "tip"
+
+/* *******************************************************************\
+ * error handling                                                   *
+\********************************************************************/
+
+GModuleVec QofBackend::c_be_registry{};
+
+void
+QofBackend::set_error(QofBackendError err)
+{
+    /* use stack-push semantics. Only the earliest error counts */
+    if (m_last_err != ERR_BACKEND_NO_ERR) return;
+    m_last_err = err;
+}
+
+QofBackendError
+QofBackend::get_error()
+{
+    /* use 'stack-pop' semantics */
+    auto err = m_last_err;
+    m_last_err = ERR_BACKEND_NO_ERR;
+    return err;
+}
+
+bool
+QofBackend::check_error()
+{
+    return m_last_err != ERR_BACKEND_NO_ERR;
+}
+
+void
+QofBackend::set_message (std::string&& msg)
+{
+    m_error_msg = msg;
+}
+
+const std::string&&
+QofBackend::get_message ()
+{
+    return std::move(m_error_msg);
+}
+
+/* Helper function that return a directory from which the requested module
+ * can be loaded. This is needed because the location of the modules
+ * depends on
+ * - whether we're running in an installed environment or the build environment
+ * - the operation system
+ * - (in the build environment) which build system is used
+ *
+ * Note parameter rel_path is only used when invoked in the build environment
+ * because each backend module is likely to reside in its own directory. At
+ * install time it is assumed all backend modules reside in one single directory.
+ */
+static char* get_default_module_dir(const char* rel_path)
+{
+    gchar *pkglibdir;
+    const gchar *builddir = g_getenv ("GNC_BUILDDIR");
+    gboolean uninstalled = (g_getenv ("GNC_UNINSTALLED") != NULL
+                            && builddir != NULL);
+
+    if (uninstalled)
+    {
+#ifdef CMAKE_BUILD
+    #ifdef WIN32
+        #define LIBDIR "bin"
+    #else
+        #define LIBDIR "lib/gnucash"
+    #endif
+        pkglibdir = g_build_path (G_DIR_SEPARATOR_S, builddir, LIBDIR, NULL);
+#else
+        if (rel_path)
+            pkglibdir = g_build_path (G_DIR_SEPARATOR_S, builddir,
+                                      "libgnucash", "backend", rel_path, ".libs", NULL);
+        else
+            pkglibdir = g_build_path (G_DIR_SEPARATOR_S, builddir,
+                                      "libgnucash", "backend", ".libs", NULL);
+#endif
+    }
+    else
+        pkglibdir = gnc_path_get_pkglibdir ();
+
+    return pkglibdir;
+}
+
+bool
+QofBackend::register_backend(const char* directory, const char* module_name)
+{
+    if (!g_module_supported ())
+    {
+        PWARN("Modules not supported.");
+        return false;
+    }
+
+    auto absdir = g_strdup(directory);
+    if (!absdir || !g_path_is_absolute(absdir))
+        absdir = get_default_module_dir(directory);
+    auto fullpath = g_module_build_path (absdir, module_name);
+    g_free (absdir);
+/* Darwin modules can have either .so or .dylib for a suffix */
+    if (!g_file_test (fullpath, G_FILE_TEST_EXISTS) &&
+        g_strcmp0 (G_MODULE_SUFFIX, "so") == 0)
+    {
+        auto modname = g_strdup_printf ("lib%s.dylib", module_name);
+        g_free (fullpath);
+        fullpath = g_build_filename (directory, modname, NULL);
+        g_free (modname);
+    }
+    auto backend = g_module_open (fullpath, G_MODULE_BIND_LAZY);
+    g_free (fullpath);
+    if (!backend)
+    {
+        PINFO ("%s: %s\n", PACKAGE, g_module_error ());
+        return false;
+    }
+    void (*module_init_func)(void);
+    if (g_module_symbol (backend, "qof_backend_module_init",
+                         reinterpret_cast<void**>(&module_init_func)))
+        module_init_func ();
+
+    g_module_make_resident (backend);
+    c_be_registry.push_back(backend);
+    return TRUE;
+}
+
+void
+QofBackend::release_backends()
+{
+    for (auto backend : c_be_registry)
+    {
+        void (*module_finalize_func)(void);
+        if (g_module_symbol(backend, "qof_backend_module_finalize",
+                            reinterpret_cast<void**>(&module_finalize_func)))
+            module_finalize_func();
+    }
+}
+/***********************************************************************/
+QofBackendError
+qof_backend_get_error (QofBackend* qof_be)
+{
+    if (qof_be == nullptr) return ERR_BACKEND_NO_ERR;
+    return ((QofBackend*)qof_be)->get_error();
+}
+
+void
+qof_backend_set_error (QofBackend* qof_be, QofBackendError err)
+{
+    if (qof_be == nullptr) return;
+    ((QofBackend*)qof_be)->set_error(err);
+}
+
+gboolean
+qof_backend_can_rollback (QofBackend* qof_be)
+{
+    if (qof_be == nullptr) return FALSE;
+    return true;
+}
+
+void
+qof_backend_rollback_instance (QofBackend* qof_be, QofInstance* inst)
+{
+    if (qof_be == nullptr) return;
+    ((QofBackend*)qof_be)->rollback(inst);
+}
+
+gboolean
+qof_load_backend_library (const char *directory, const char* module_name)
+{
+    return QofBackend::register_backend(directory, module_name);
+}
+
+void
+qof_finalize_backend_libraries(void)
+{
+    QofBackend::release_backends();
+}
+
+/************************* END OF FILE ********************************/
diff --git a/src/engine/qof-backend.hpp b/libgnucash/engine/qof-backend.hpp
similarity index 100%
rename from src/engine/qof-backend.hpp
rename to libgnucash/engine/qof-backend.hpp
diff --git a/src/engine/qof-gobject.h b/libgnucash/engine/qof-gobject.h
similarity index 100%
rename from src/engine/qof-gobject.h
rename to libgnucash/engine/qof-gobject.h
diff --git a/src/engine/qof-string-cache.cpp b/libgnucash/engine/qof-string-cache.cpp
similarity index 100%
rename from src/engine/qof-string-cache.cpp
rename to libgnucash/engine/qof-string-cache.cpp
diff --git a/src/engine/qof-string-cache.h b/libgnucash/engine/qof-string-cache.h
similarity index 100%
rename from src/engine/qof-string-cache.h
rename to libgnucash/engine/qof-string-cache.h
diff --git a/src/engine/qof-win32.cpp b/libgnucash/engine/qof-win32.cpp
similarity index 100%
rename from src/engine/qof-win32.cpp
rename to libgnucash/engine/qof-win32.cpp
diff --git a/src/engine/qof.h b/libgnucash/engine/qof.h
similarity index 100%
rename from src/engine/qof.h
rename to libgnucash/engine/qof.h
diff --git a/src/engine/qofbackend.h b/libgnucash/engine/qofbackend.h
similarity index 100%
rename from src/engine/qofbackend.h
rename to libgnucash/engine/qofbackend.h
diff --git a/src/engine/qofbook-p.h b/libgnucash/engine/qofbook-p.h
similarity index 100%
rename from src/engine/qofbook-p.h
rename to libgnucash/engine/qofbook-p.h
diff --git a/src/engine/qofbook.cpp b/libgnucash/engine/qofbook.cpp
similarity index 100%
rename from src/engine/qofbook.cpp
rename to libgnucash/engine/qofbook.cpp
diff --git a/src/engine/qofbook.h b/libgnucash/engine/qofbook.h
similarity index 100%
rename from src/engine/qofbook.h
rename to libgnucash/engine/qofbook.h
diff --git a/src/engine/qofbookslots.h b/libgnucash/engine/qofbookslots.h
similarity index 100%
rename from src/engine/qofbookslots.h
rename to libgnucash/engine/qofbookslots.h
diff --git a/src/engine/qofchoice.cpp b/libgnucash/engine/qofchoice.cpp
similarity index 100%
rename from src/engine/qofchoice.cpp
rename to libgnucash/engine/qofchoice.cpp
diff --git a/src/engine/qofchoice.h b/libgnucash/engine/qofchoice.h
similarity index 100%
rename from src/engine/qofchoice.h
rename to libgnucash/engine/qofchoice.h
diff --git a/src/engine/qofclass-p.h b/libgnucash/engine/qofclass-p.h
similarity index 100%
rename from src/engine/qofclass-p.h
rename to libgnucash/engine/qofclass-p.h
diff --git a/src/engine/qofclass.cpp b/libgnucash/engine/qofclass.cpp
similarity index 100%
rename from src/engine/qofclass.cpp
rename to libgnucash/engine/qofclass.cpp
diff --git a/src/engine/qofclass.h b/libgnucash/engine/qofclass.h
similarity index 100%
rename from src/engine/qofclass.h
rename to libgnucash/engine/qofclass.h
diff --git a/src/engine/qofevent-p.h b/libgnucash/engine/qofevent-p.h
similarity index 100%
rename from src/engine/qofevent-p.h
rename to libgnucash/engine/qofevent-p.h
diff --git a/src/engine/qofevent.cpp b/libgnucash/engine/qofevent.cpp
similarity index 100%
rename from src/engine/qofevent.cpp
rename to libgnucash/engine/qofevent.cpp
diff --git a/src/engine/qofevent.h b/libgnucash/engine/qofevent.h
similarity index 100%
rename from src/engine/qofevent.h
rename to libgnucash/engine/qofevent.h
diff --git a/src/engine/qofid-p.h b/libgnucash/engine/qofid-p.h
similarity index 100%
rename from src/engine/qofid-p.h
rename to libgnucash/engine/qofid-p.h
diff --git a/src/engine/qofid.cpp b/libgnucash/engine/qofid.cpp
similarity index 100%
rename from src/engine/qofid.cpp
rename to libgnucash/engine/qofid.cpp
diff --git a/src/engine/qofid.h b/libgnucash/engine/qofid.h
similarity index 100%
rename from src/engine/qofid.h
rename to libgnucash/engine/qofid.h
diff --git a/src/engine/qofinstance-p.h b/libgnucash/engine/qofinstance-p.h
similarity index 100%
rename from src/engine/qofinstance-p.h
rename to libgnucash/engine/qofinstance-p.h
diff --git a/src/engine/qofinstance.cpp b/libgnucash/engine/qofinstance.cpp
similarity index 100%
rename from src/engine/qofinstance.cpp
rename to libgnucash/engine/qofinstance.cpp
diff --git a/src/engine/qofinstance.h b/libgnucash/engine/qofinstance.h
similarity index 100%
rename from src/engine/qofinstance.h
rename to libgnucash/engine/qofinstance.h
diff --git a/src/engine/qoflog.cpp b/libgnucash/engine/qoflog.cpp
similarity index 100%
rename from src/engine/qoflog.cpp
rename to libgnucash/engine/qoflog.cpp
diff --git a/src/engine/qoflog.h b/libgnucash/engine/qoflog.h
similarity index 100%
rename from src/engine/qoflog.h
rename to libgnucash/engine/qoflog.h
diff --git a/src/engine/qofobject-p.h b/libgnucash/engine/qofobject-p.h
similarity index 100%
rename from src/engine/qofobject-p.h
rename to libgnucash/engine/qofobject-p.h
diff --git a/src/engine/qofobject.cpp b/libgnucash/engine/qofobject.cpp
similarity index 100%
rename from src/engine/qofobject.cpp
rename to libgnucash/engine/qofobject.cpp
diff --git a/src/engine/qofobject.h b/libgnucash/engine/qofobject.h
similarity index 100%
rename from src/engine/qofobject.h
rename to libgnucash/engine/qofobject.h
diff --git a/src/engine/qofquery-p.h b/libgnucash/engine/qofquery-p.h
similarity index 100%
rename from src/engine/qofquery-p.h
rename to libgnucash/engine/qofquery-p.h
diff --git a/src/engine/qofquery.cpp b/libgnucash/engine/qofquery.cpp
similarity index 100%
rename from src/engine/qofquery.cpp
rename to libgnucash/engine/qofquery.cpp
diff --git a/src/engine/qofquery.h b/libgnucash/engine/qofquery.h
similarity index 100%
rename from src/engine/qofquery.h
rename to libgnucash/engine/qofquery.h
diff --git a/src/engine/qofquerycore-p.h b/libgnucash/engine/qofquerycore-p.h
similarity index 100%
rename from src/engine/qofquerycore-p.h
rename to libgnucash/engine/qofquerycore-p.h
diff --git a/src/engine/qofquerycore.cpp b/libgnucash/engine/qofquerycore.cpp
similarity index 100%
rename from src/engine/qofquerycore.cpp
rename to libgnucash/engine/qofquerycore.cpp
diff --git a/src/engine/qofquerycore.h b/libgnucash/engine/qofquerycore.h
similarity index 100%
rename from src/engine/qofquerycore.h
rename to libgnucash/engine/qofquerycore.h
diff --git a/src/engine/qofsession.cpp b/libgnucash/engine/qofsession.cpp
similarity index 100%
rename from src/engine/qofsession.cpp
rename to libgnucash/engine/qofsession.cpp
diff --git a/src/engine/qofsession.h b/libgnucash/engine/qofsession.h
similarity index 100%
rename from src/engine/qofsession.h
rename to libgnucash/engine/qofsession.h
diff --git a/src/engine/qofsession.hpp b/libgnucash/engine/qofsession.hpp
similarity index 100%
rename from src/engine/qofsession.hpp
rename to libgnucash/engine/qofsession.hpp
diff --git a/src/engine/qofutil.cpp b/libgnucash/engine/qofutil.cpp
similarity index 100%
rename from src/engine/qofutil.cpp
rename to libgnucash/engine/qofutil.cpp
diff --git a/src/engine/qofutil.h b/libgnucash/engine/qofutil.h
similarity index 100%
rename from src/engine/qofutil.h
rename to libgnucash/engine/qofutil.h
diff --git a/libgnucash/engine/test-core/CMakeLists.txt b/libgnucash/engine/test-core/CMakeLists.txt
new file mode 100644
index 0000000..56cfc9f
--- /dev/null
+++ b/libgnucash/engine/test-core/CMakeLists.txt
@@ -0,0 +1,20 @@
+
+
+SET(libgncmod_test_engine_SOURCES
+  gncmod-test-engine.c test-engine-stuff.cpp
+)
+
+ADD_LIBRARY(gncmod-test-engine STATIC ${libgncmod_test_engine_SOURCES})
+
+TARGET_INCLUDE_DIRECTORIES(gncmod-test-engine PRIVATE
+  ${CMAKE_PREFIX_PATH}/include
+  ${GMODULE_INCLUDE_DIRS}
+  ${CMAKE_SOURCE_DIR}/libgnucash/gnc-module
+  ${CMAKE_BINARY_DIR}/common # for config.h
+  ${CMAKE_SOURCE_DIR}/common
+  ${CMAKE_SOURCE_DIR}/libgnucash/engine
+  ${CMAKE_SOURCE_DIR}/common/test-core
+)
+
+SET_DIST_LIST(engine_test_core_DIST CMakeLists.txt Makefile.am ${libgncmod_test_engine_SOURCES}
+        test-engine-stuff.h test-engine-strings.h)
diff --git a/libgnucash/engine/test-core/Makefile.am b/libgnucash/engine/test-core/Makefile.am
new file mode 100644
index 0000000..5e097ab
--- /dev/null
+++ b/libgnucash/engine/test-core/Makefile.am
@@ -0,0 +1,26 @@
+noinst_LTLIBRARIES=libgncmod-test-engine.la
+
+LDADD = \
+  ${top_builddir}/libgnucash/gnc-module/libgnc-module.la \
+  ../libgncmod-engine.la \
+  ${GLIB_LIBS}
+
+libgncmod_test_engine_la_SOURCES = gncmod-test-engine.c test-engine-stuff.cpp
+libgncmod_test_engine_la_LDFLAGS = -module
+libgncmod_test_engine_la_LIBADD = \
+  ${top_builddir}/libgnucash/gnc-module/libgnc-module.la \
+  ../libgncmod-engine.la \
+  ${GLIB_LIBS}
+
+noinst_HEADERS=test-engine-stuff.h test-engine-strings.h
+
+AM_CPPFLAGS = \
+  -I${top_srcdir}/common \
+  -I${top_srcdir}/libgnucash/gnc-module \
+  -I${top_srcdir}/common/test-core \
+  -I${top_srcdir}/libgnucash/engine \
+  ${GLIB_CFLAGS} \
+  ${GUILE_CFLAGS} \
+  ${BOOST_CPPFLAGS}
+
+EXTRA_DIST = CMakeLists.txt
diff --git a/src/engine/test-core/gncmod-test-engine.c b/libgnucash/engine/test-core/gncmod-test-engine.c
similarity index 100%
rename from src/engine/test-core/gncmod-test-engine.c
rename to libgnucash/engine/test-core/gncmod-test-engine.c
diff --git a/src/engine/test-core/test-engine-strings.h b/libgnucash/engine/test-core/test-engine-strings.h
similarity index 100%
rename from src/engine/test-core/test-engine-strings.h
rename to libgnucash/engine/test-core/test-engine-strings.h
diff --git a/src/engine/test-core/test-engine-stuff.cpp b/libgnucash/engine/test-core/test-engine-stuff.cpp
similarity index 100%
rename from src/engine/test-core/test-engine-stuff.cpp
rename to libgnucash/engine/test-core/test-engine-stuff.cpp
diff --git a/src/engine/test-core/test-engine-stuff.h b/libgnucash/engine/test-core/test-engine-stuff.h
similarity index 100%
rename from src/engine/test-core/test-engine-stuff.h
rename to libgnucash/engine/test-core/test-engine-stuff.h
diff --git a/libgnucash/engine/test/CMakeLists.txt b/libgnucash/engine/test/CMakeLists.txt
new file mode 100644
index 0000000..209a120
--- /dev/null
+++ b/libgnucash/engine/test/CMakeLists.txt
@@ -0,0 +1,286 @@
+# Common stuff
+
+SET(ENGINE_TEST_INCLUDE_DIRS
+  ${CMAKE_SOURCE_DIR}/libgnucash/backend/xml
+  ${CMAKE_SOURCE_DIR}/libgnucash/engine
+  ${CMAKE_SOURCE_DIR}/libgnucash/engine/test-core
+  ${CMAKE_BINARY_DIR}/common # for config.h
+  ${CMAKE_SOURCE_DIR}/common/test-core  # for unittest-support.h
+  ${GLIB2_INCLUDE_DIRS}
+)
+
+SET(ENGINE_TEST_LIBS gncmod-engine gncmod-test-engine test-core ${LIBXML2_LDFLAGS} -lm)
+
+MACRO(ADD_ENGINE_TEST _TARGET _SOURCE_FILES)
+  GNC_ADD_TEST(${_TARGET} "${_SOURCE_FILES}" ENGINE_TEST_INCLUDE_DIRS ENGINE_TEST_LIBS)
+ENDMACRO()
+
+CONFIGURE_FILE(test-scm-query-import.in test-scm-query-import @ONLY)
+CONFIGURE_FILE(test-create-account.in test-create-account @ONLY)
+# Not via macro because of unique link requirements
+
+ADD_EXECUTABLE(test-link EXCLUDE_FROM_ALL test-link.c)
+TARGET_LINK_LIBRARIES(test-link gnc-core-utils)
+ADD_TEST(NAME test-link COMMAND test-link)
+ADD_DEPENDENCIES(check test-link)
+
+#################################################
+
+ADD_ENGINE_TEST(test-load-engine test-load-engine.c)
+ADD_ENGINE_TEST(test-guid test-guid.cpp)
+ADD_ENGINE_TEST(test-date test-date.cpp)
+ADD_ENGINE_TEST(test-object test-object.c)
+ADD_ENGINE_TEST(test-commodities test-commodities.cpp)
+
+SET(test_qof_SOURCES
+  test-gnc-date.c
+  test-qof.c
+  test-qofbook.c
+  test-qofinstance.cpp
+  test-qofobject.c
+  test-qof-string-cache.c
+)
+
+SET(test_engine_SOURCES
+  test-engine.c
+  test-engine-kvp-properties.c
+  test-gnc-uri-utils.c
+  utest-Account.cpp
+  utest-Budget.c
+  utest-Entry.c
+  utest-Invoice.c
+  utest-Split.cpp
+  utest-Transaction.cpp
+  utest-gnc-pricedb.c
+)
+
+# This test does not run on Win32
+IF (NOT WIN32)
+  SET(SOURCES ${test_qof_SOURCES} ${CMAKE_SOURCE_DIR}/common/test-core/unittest-support.c)
+  ADD_ENGINE_TEST(test-qof "${SOURCES}")
+  TARGET_COMPILE_DEFINITIONS(test-qof PRIVATE TESTPROG=test_qof)
+
+  SET(SOURCES ${test_engine_SOURCES} ${CMAKE_SOURCE_DIR}/common/test-core/unittest-support.c)
+  ADD_ENGINE_TEST(test-engine "${SOURCES}")
+  TARGET_COMPILE_OPTIONS(test-engine PRIVATE -Wno-write-strings)
+  TARGET_COMPILE_DEFINITIONS(test-engine PRIVATE TESTPROG=test_engine)
+ENDIF()
+
+ADD_ENGINE_TEST(test-account-object test-account-object.cpp)
+ADD_ENGINE_TEST(test-group-vs-book test-group-vs-book.cpp)
+ADD_ENGINE_TEST(test-lots test-lots.cpp)
+ADD_ENGINE_TEST(test-querynew test-querynew.c)
+ADD_ENGINE_TEST(test-query test-query.cpp)
+ADD_ENGINE_TEST(test-split-vs-account test-split-vs-account.cpp)
+ADD_ENGINE_TEST(test-transaction-reversal test-transaction-reversal.cpp)
+ADD_ENGINE_TEST(test-transaction-voiding test-transaction-voiding.cpp)
+ADD_ENGINE_TEST(test-recurrence test-recurrence.c)
+ADD_ENGINE_TEST(test-business test-business.c)
+ADD_ENGINE_TEST(test-address test-address.c)
+ADD_ENGINE_TEST(test-customer test-customer.c)
+ADD_ENGINE_TEST(test-employee test-employee.c)
+ADD_ENGINE_TEST(test-job test-job.c)
+ADD_ENGINE_TEST(test-vendor test-vendor.c)
+
+SET(test_numeric_SOURCES
+  ${CMAKE_SOURCE_DIR}/libgnucash/engine/gnc-numeric.cpp
+  ${CMAKE_SOURCE_DIR}/libgnucash/engine/gnc-rational.cpp
+  ${CMAKE_SOURCE_DIR}/libgnucash/engine/gnc-int128.cpp
+  ${CMAKE_SOURCE_DIR}/libgnucash/engine/test/test-numeric.cpp
+)
+ADD_ENGINE_TEST(test-numeric "${test_numeric_SOURCES}")
+
+SET(MODULEPATH ${CMAKE_SOURCE_DIR}/libgnucash/engine)
+SET(gtest_old_engine_LIBS
+  gncmod-engine
+  ${GLIB2_LDFLAGS}
+  ${Boost_LIBRARIES}
+  ${GTEST_LIB})
+
+SET(gtest_qof_LIBS
+  ${GLIB2_LDFLAGS}
+  ${GOBJECT_LDFLAGS}
+  ${GMODULE_LDFLAGS}
+  ${GTHREAD_LDFLAGS}
+  ${Boost_LIBRARIES}
+  ${GTEST_LIB})
+
+SET(gtest_engine_INCLUDES
+  ${MODULEPATH}
+  ${CMAKE_BINARY_DIR}/common # for config.h
+  ${CMAKE_SOURCE_DIR}/common # for platform.h
+  ${GLIB2_INCLUDE_DIRS}
+  ${GTEST_INCLUDE_DIR})
+
+SET(test_gnc_guid_SOURCES
+  ${MODULEPATH}/guid.cpp
+  test-gnc-guid.cpp
+  ${GTEST_SRC})
+GNC_ADD_TEST(test-gnc-guid "${test_gnc_guid_SOURCES}"
+  gtest_engine_INCLUDES gtest_old_engine_LIBS)
+
+SET(test_kvp_value_SOURCES
+  ${MODULEPATH}/kvp-value.cpp
+  test-kvp-value.cpp
+  test-kvp-frame.cpp
+  ${GTEST_SRC})
+GNC_ADD_TEST(test-kvp-value "${test_kvp_value_SOURCES}"
+  gtest_engine_INCLUDES gtest_old_engine_LIBS)
+
+SET(test_qofsession_SOURCES
+  ${MODULEPATH}/qofsession.cpp
+  test-qofsession.cpp
+  ${GTEST_SRC})
+GNC_ADD_TEST(test-qofsession "${test_qofsession_SOURCES}"
+  gtest_engine_INCLUDES gtest_old_engine_LIBS)
+
+SET(test_gnc_int128_SOURCES
+  ${MODULEPATH}/gnc-int128.cpp
+  gtest-gnc-int128.cpp
+  ${GTEST_SRC})
+GNC_ADD_TEST(test-gnc-int128 "${test_gnc_int128_SOURCES}"
+  gtest_engine_INCLUDES gtest_qof_LIBS)
+
+SET(test_gnc_rational_SOURCES
+  ${MODULEPATH}/gnc-rational.cpp
+  ${MODULEPATH}/gnc-numeric.cpp
+  ${MODULEPATH}/gnc-int128.cpp
+  ${MODULEPATH}/gnc-datetime.cpp
+  ${MODULEPATH}/gnc-timezone.cpp
+  ${MODULEPATH}/gnc-date.cpp
+  ${MODULEPATH}/qoflog.cpp
+  gtest-gnc-rational.cpp
+  ${GTEST_SRC})
+GNC_ADD_TEST(test-gnc-rational "${test_gnc_rational_SOURCES}"
+  gtest_engine_INCLUDES gtest_qof_LIBS)
+
+SET(test_gnc_numeric_SOURCES
+  ${MODULEPATH}/gnc-rational.cpp
+  ${MODULEPATH}/gnc-int128.cpp
+  ${MODULEPATH}/gnc-numeric.cpp
+  ${MODULEPATH}/gnc-datetime.cpp
+  ${MODULEPATH}/gnc-timezone.cpp
+  ${MODULEPATH}/gnc-date.cpp
+  ${MODULEPATH}/qoflog.cpp
+  gtest-gnc-numeric.cpp
+  ${GTEST_SRC})
+GNC_ADD_TEST(test-gnc-numeric "${test_gnc_numeric_SOURCES}"
+  gtest_engine_INCLUDES gtest_qof_LIBS)
+
+SET(test_gnc_timezone_SOURCES
+  ${MODULEPATH}/gnc-timezone.cpp
+  gtest-gnc-timezone.cpp
+  ${GTEST_SRC})
+GNC_ADD_TEST(test-gnc-timezone "${test_gnc_timezone_SOURCES}"
+  gtest_engine_INCLUDES gtest_old_engine_LIBS)
+
+SET(test_gnc_datetime_SOURCES
+  ${MODULEPATH}/gnc-datetime.cpp
+  ${MODULEPATH}/gnc-timezone.cpp
+  ${MODULEPATH}/gnc-date.cpp
+  ${MODULEPATH}/qoflog.cpp
+  gtest-gnc-datetime.cpp
+  ${GTEST_SRC})
+GNC_ADD_TEST(test-gnc-datetime "${test_gnc_datetime_SOURCES}"
+  gtest_engine_INCLUDES gtest_qof_LIBS)
+
+############################
+# This is a C test that needs GUILE environment variables set.
+# It does not pass on Win32.
+GNC_ADD_TEST_WITH_GUILE(test-scm-query test-scm-query.cpp ENGINE_TEST_INCLUDE_DIRS ENGINE_TEST_LIBS)
+############################
+
+GNC_ADD_SCHEME_TEST(scm-test-account test-account.scm)
+GNC_ADD_SCHEME_TEST(scm-test-create-account test-create-account.scm)
+GNC_ADD_SCHEME_TEST(scm-test-test-extra test-test-extras.scm)
+GNC_ADD_SCHEME_TEST(scm-test-split test-split.scm)
+# This check not run in autotools. Doesn't pass.
+#GNC_ADD_SCHEME_TEST(scm-test-scm-query-import test-scm-query-import.scm)
+
+SET(engine_test_SCHEME test-extras.scm)
+
+SET(GUILE_MODULES      "")
+SET(GUILE_LOAD_DIRS    libgnucash/app-utils libgnucash/scm)
+SET(GUILE_LIBRARY_DIRS "")
+SET(GUILE_DEPENDS      scm-app-utils scm-scm)
+
+GNC_ADD_SCHEME_TARGETS(scm-test-engine
+  "${engine_test_SCHEME}"
+  gnucash/engine/test
+  "${GUILE_MODULES}"
+  "${GUILE_LOAD_DIRS}"
+  "${GUILE_LIBRARY_DIRS}"
+  "${GUILE_DEPENDS}"
+  FALSE
+)
+
+SET(test_engine_SOURCES_DIST
+        dummy.cpp
+        gtest-gnc-int128.cpp
+        gtest-gnc-rational.cpp
+        gtest-gnc-numeric.cpp
+        gtest-gnc-timezone.cpp
+        gtest-gnc-datetime.cpp
+        gtest-import-map.cpp
+        test-account-object.cpp
+        test-address.c
+        test-business.c
+        test-commodities.cpp
+        test-customer.c
+        test-date.cpp
+        test-employee.c
+        test-engine-kvp-properties.c
+        test-engine.c
+        test-gnc-date.c
+        test-gnc-guid.cpp
+	test-gnc-uri-utils.c
+        test-group-vs-book.cpp
+        test-guid.cpp
+        test-job.c
+        test-kvp-value.cpp
+        test-kvp-frame.cpp
+        test-link.c
+        test-load-engine.c
+        test-lots.cpp
+        test-numeric.cpp
+        test-object.c
+        test-qof.c
+        test-qofbook.c
+        test-qofinstance.cpp
+        test-qofobject.c
+        test-qofsession.cpp
+        test-qof-string-cache.c
+        test-query.cpp
+        test-querynew.c
+        test-recurrence.c
+        test-scm-query.cpp
+        test-split-vs-account.cpp
+        test-transaction-reversal.cpp
+        test-transaction-voiding.cpp
+        test-vendor.c
+        utest-Account.cpp
+        utest-Budget.c
+        utest-Entry.c
+        utest-Invoice.c
+        utest-Split.cpp
+        utest-Transaction.cpp
+        utest-gnc-pricedb.c
+)
+
+SET(test_engine_SCHEME_DIST
+        test-account.scm
+        test-create-account.scm
+        test-extras.scm
+        test-scm-query-import.scm
+        test-split.scm
+        test-test-extras.scm
+)
+
+SET(test_engine_EXTRA_DIST
+        README
+        test-create-account.in
+        test-scm-query-import.in
+)
+
+SET_DIST_LIST(test_engine_DIST CMakeLists.txt Makefile.am
+        ${test_engine_SOURCES_DIST} ${test_engine_SCHEME_DIST} ${test_engine_EXTRA_DIST})
diff --git a/libgnucash/engine/test/Makefile.am b/libgnucash/engine/test/Makefile.am
new file mode 100644
index 0000000..6210fbb
--- /dev/null
+++ b/libgnucash/engine/test/Makefile.am
@@ -0,0 +1,214 @@
+include $(top_srcdir)/test-templates/Makefile.decl
+
+MODULEPATH = libgnucash/engine
+
+AM_CPPFLAGS = \
+  -I${top_srcdir} \
+  -I${top_srcdir}/common \
+  -I${top_srcdir}/libgnucash/gnc-module \
+  -I${top_srcdir}/common/test-core \
+  -I${top_srcdir}/libgnucash/engine \
+  -I${top_srcdir}/libgnucash/engine/test-core \
+  -I${top_srcdir}/libgnucash/core-utils \
+  ${GUILE_CFLAGS} \
+  ${GLIB_CFLAGS} \
+  ${BOOST_CPPFLAGS}
+
+LDADD = \
+  ${top_builddir}/libgnucash/gnc-module/libgnc-module.la \
+  ${top_builddir}/common/test-core/libtest-core.la \
+  ../libgncmod-engine.la \
+  ../test-core/libgncmod-test-engine.la \
+  ${top_builddir}/libgnucash/core-utils/libgnc-core-utils.la \
+  ${GLIB_LIBS}
+
+test_guid_SOURCES = test-guid.cpp
+
+# these tests are ordered kind more or less in the order
+# that they should be executed, with more basic tests coming first.
+#
+TEST_GROUP_1 = \
+  test-link \
+  test-load-engine \
+  test-guid \
+  test-date \
+  test-object \
+  test-commodities \
+  test-qof \
+  test-engine
+
+TEST_GROUP_2 = \
+  test-account-object \
+  test-group-vs-book \
+  test-lots \
+  test-querynew \
+  test-query \
+  test-split-vs-account  \
+  test-transaction-reversal \
+  test-transaction-voiding \
+  test-recurrence \
+  test-scm-query \
+  test-business \
+  test-address \
+  test-customer \
+  test-employee \
+  test-job \
+  test-vendor
+
+SCM_TESTS = \
+  test-test-extras \
+  test-account \
+  test-split
+
+SCM_TEST_SRCS = $(SCM_TESTS:%=%.scm)
+
+GNC_TEST_DEPS = \
+  --gnc-module-dir ${top_builddir}/libgnucash/engine \
+  --gnc-module-dir ${top_builddir}/libgnucash/engine/test \
+  --gnc-module-dir ${top_builddir}/libgnucash/app-utils \
+  --guile-load-dir ${top_builddir}/libgnucash/gnc-module \
+  --guile-load-dir ${top_builddir}/libgnucash/engine \
+  --guile-load-dir ${top_builddir}/libgnucash/app-utils \
+  --guile-load-dir ${top_builddir}/libgnucash/core-utils \
+  --guile-load-dir ${top_builddir}/libgnucash/scm \
+  --guile-load-dir ${top_builddir}/libgnucash/engine/test \
+  --library-dir    ${top_builddir}/libgnucash/core-utils \
+  --library-dir    ${top_builddir}/libgnucash/gnc-module \
+  --library-dir    ${top_builddir}/libgnucash/engine \
+  --library-dir    ${top_builddir}/libgnucash/app-utils \
+  --library-dir    ${top_builddir}/libgnucash/backend/xml \
+  --library-dir    ${top_builddir}/libgnucash/backend/sql \
+  --library-dir    ${top_builddir}/libgnucash/engine/test
+
+test_account_object_SOURCES = test-account-object.cpp
+test_commodities_SOURCES = test-commodities.cpp
+test_date_SOURCES = test-date.cpp
+test_group_vs_book_SOURCES = test-group-vs-book.cpp
+test_lots_SOURCES = test-lots.cpp
+
+test_query_SOURCES = test-query.cpp
+test_scm_query_SOURCES = test-scm-query.cpp
+test_split_vs_account_SOURCES = test-split-vs-account.cpp
+test_transaction_reversal_SOURCES = test-transaction-reversal.cpp
+test_transaction_voiding_SOURCES = test-transaction-voiding.cpp
+
+$(SCM_TESTS): %: $(srcdir)/%.scm Makefile .scm-links
+	echo 'export GNC_BUILDDIR="${abs_top_builddir}";' > $@
+	echo 'export GNC_UNINSTALLED=yes;' >> $@
+	echo '${GUILE} --debug -l $(srcdir)/$*.scm -c "(exit (run-test))"' >> $@
+	chmod a+x $@
+
+TESTS_ENVIRONMENT = \
+  GUILE_WARN_DEPRECATED=no \
+  GUILE="${GUILE}" \
+  SRCDIR=${srcdir} \
+  GNC_BUILDDIR="${abs_top_builddir}" \
+  $(shell ${abs_top_srcdir}/common/gnc-test-env.pl --noexports ${GNC_TEST_DEPS})
+
+check_PROGRAMS = ${TEST_GROUP_1} ${TEST_GROUP_2}
+
+TESTS = ${TEST_GROUP_1} test-create-account ${TEST_GROUP_2} ${SCM_TESTS}
+
+test_link_SOURCES = test-link.c
+test_link_LDADD = ../libgncmod-engine.la \
+  ${top_builddir}/libgnucash/core-utils/libgnc-core-utils.la
+
+if WITH_GOOGLE_PROFILER
+LDADD += -lprofiler
+endif
+
+SCM_TEST_HELPERS = test-extras.scm
+
+EXTRA_DIST += \
+  test-create-account \
+  test-create-account.scm \
+  test-scm-query-import \
+  test-scm-query-import.scm \
+  $(SCM_TEST_HELPERS) \
+  $(SCM_TEST_SRCS) \
+  CMakeLists.txt
+
+TEST_PROGS += test-engine
+
+.scm-links:
+	$(RM) -rf gnucash
+	mkdir -p  gnucash/engine/test
+	( cd gnucash/engine/test; for A in $(SCM_TEST_HELPERS) ; do $(LN_S) -f $(abs_srcdir)/$$A . ; done )
+if ! OS_WIN32
+# Windows knows no "ln -s" but uses "cp": must copy every time (see bug #566567).
+	touch .scm-links
+endif
+
+noinst_PROGRAMS = ${TEST_PROGS} ${CHECK_PROGS}
+
+noinst_DATA: .scm-links
+
+test_qof_SOURCES = \
+	test-gnc-date.c \
+	test-qof.c \
+	test-qofbook.c \
+	test-qofinstance.cpp \
+	test-qofobject.c \
+	test-qof-string-cache.c
+
+test_qof_LDADD = \
+	$(LDADD)
+test_qof_CFLAGS = \
+	${DEFAULT_INCLUDES} \
+	-I${top_srcdir}/${MODULEPATH}/ \
+	-DTESTPROG=test_qof \
+	${GLIB_CFLAGS} \
+	${AM_CFLAGS}
+
+test_engine_SOURCES = \
+	test-engine.c \
+	test-gnc-uri-utils.c \
+	utest-Account.cpp \
+	utest-Budget.c \
+	utest-Entry.c \
+	utest-Invoice.c \
+	test-engine-kvp-properties.c \
+	utest-gnc-pricedb.c \
+	utest-Transaction.cpp \
+	dummy.cpp \
+	utest-Split.cpp \
+	${top_srcdir}/${MODULEPATH}/gnc-numeric.cpp
+
+test_engine_LDADD = \
+	$(LDADD)
+test_engine_CFLAGS = \
+	${DEFAULT_INCLUDES} \
+	-I${top_srcdir}/${MODULEPATH}/ \
+	-DTESTPROG=test_engine \
+	${GLIB_CFLAGS} \
+	${AM_CFLAGS}
+test_engine_CXXFLAGS = -Wno-write-strings $(AM_CXXFLAGS)
+
+test_import_map_SOURCES = \
+        gtest-import-map.cpp
+test_import_map_LDADD = \
+        ${top_builddir}/libgnucash/engine/libgncmod-engine.la \
+        ${GLIB_LIBS} \
+        ${GTEST_LIBS}
+
+if !GOOGLE_TEST_LIBS
+nodist_test_import_map_SOURCES = \
+        ${GTEST_SRC}/src/gtest_main.cc
+endif
+
+test_import_map_CPPFLAGS = \
+        -I${GTEST_HEADERS} \
+        -I${top_srcdir}/${MODULEPATH} \
+        -I${top_srcdir}/libgnucash/core-utils \
+        ${GLIB_CFLAGS}
+
+TEST_GROUP_1 += test-import-map
+
+
+CLEANFILES = .scm-links
+DISTCLEANFILES = $(SCM_TESTS)
+
+clean-local:
+	rm -f translog.*
+
+distclean-local: clean-local
diff --git a/src/engine/test/README b/libgnucash/engine/test/README
similarity index 100%
rename from src/engine/test/README
rename to libgnucash/engine/test/README
diff --git a/src/engine/test/dummy.cpp b/libgnucash/engine/test/dummy.cpp
similarity index 100%
rename from src/engine/test/dummy.cpp
rename to libgnucash/engine/test/dummy.cpp
diff --git a/src/engine/test/gtest-gnc-datetime.cpp b/libgnucash/engine/test/gtest-gnc-datetime.cpp
similarity index 100%
rename from src/engine/test/gtest-gnc-datetime.cpp
rename to libgnucash/engine/test/gtest-gnc-datetime.cpp
diff --git a/src/engine/test/gtest-gnc-int128.cpp b/libgnucash/engine/test/gtest-gnc-int128.cpp
similarity index 100%
rename from src/engine/test/gtest-gnc-int128.cpp
rename to libgnucash/engine/test/gtest-gnc-int128.cpp
diff --git a/src/engine/test/gtest-gnc-numeric.cpp b/libgnucash/engine/test/gtest-gnc-numeric.cpp
similarity index 100%
rename from src/engine/test/gtest-gnc-numeric.cpp
rename to libgnucash/engine/test/gtest-gnc-numeric.cpp
diff --git a/src/engine/test/gtest-gnc-rational.cpp b/libgnucash/engine/test/gtest-gnc-rational.cpp
similarity index 100%
rename from src/engine/test/gtest-gnc-rational.cpp
rename to libgnucash/engine/test/gtest-gnc-rational.cpp
diff --git a/src/engine/test/gtest-gnc-timezone.cpp b/libgnucash/engine/test/gtest-gnc-timezone.cpp
similarity index 100%
rename from src/engine/test/gtest-gnc-timezone.cpp
rename to libgnucash/engine/test/gtest-gnc-timezone.cpp
diff --git a/src/engine/test/gtest-import-map.cpp b/libgnucash/engine/test/gtest-import-map.cpp
similarity index 100%
rename from src/engine/test/gtest-import-map.cpp
rename to libgnucash/engine/test/gtest-import-map.cpp
diff --git a/src/engine/test/test-account-object.cpp b/libgnucash/engine/test/test-account-object.cpp
similarity index 100%
rename from src/engine/test/test-account-object.cpp
rename to libgnucash/engine/test/test-account-object.cpp
diff --git a/src/engine/test/test-account.scm b/libgnucash/engine/test/test-account.scm
similarity index 100%
rename from src/engine/test/test-account.scm
rename to libgnucash/engine/test/test-account.scm
diff --git a/src/engine/test/test-address.c b/libgnucash/engine/test/test-address.c
similarity index 100%
rename from src/engine/test/test-address.c
rename to libgnucash/engine/test/test-address.c
diff --git a/src/engine/test/test-business.c b/libgnucash/engine/test/test-business.c
similarity index 100%
rename from src/engine/test/test-business.c
rename to libgnucash/engine/test/test-business.c
diff --git a/src/engine/test/test-commodities.cpp b/libgnucash/engine/test/test-commodities.cpp
similarity index 100%
rename from src/engine/test/test-commodities.cpp
rename to libgnucash/engine/test/test-commodities.cpp
diff --git a/src/engine/test/test-create-account.in b/libgnucash/engine/test/test-create-account.in
similarity index 100%
rename from src/engine/test/test-create-account.in
rename to libgnucash/engine/test/test-create-account.in
diff --git a/src/engine/test/test-create-account.scm b/libgnucash/engine/test/test-create-account.scm
similarity index 100%
rename from src/engine/test/test-create-account.scm
rename to libgnucash/engine/test/test-create-account.scm
diff --git a/src/engine/test/test-customer.c b/libgnucash/engine/test/test-customer.c
similarity index 100%
rename from src/engine/test/test-customer.c
rename to libgnucash/engine/test/test-customer.c
diff --git a/src/engine/test/test-date.cpp b/libgnucash/engine/test/test-date.cpp
similarity index 100%
rename from src/engine/test/test-date.cpp
rename to libgnucash/engine/test/test-date.cpp
diff --git a/src/engine/test/test-employee.c b/libgnucash/engine/test/test-employee.c
similarity index 100%
rename from src/engine/test/test-employee.c
rename to libgnucash/engine/test/test-employee.c
diff --git a/src/engine/test/test-engine-kvp-properties.c b/libgnucash/engine/test/test-engine-kvp-properties.c
similarity index 100%
rename from src/engine/test/test-engine-kvp-properties.c
rename to libgnucash/engine/test/test-engine-kvp-properties.c
diff --git a/src/engine/test/test-engine.c b/libgnucash/engine/test/test-engine.c
similarity index 100%
rename from src/engine/test/test-engine.c
rename to libgnucash/engine/test/test-engine.c
diff --git a/src/engine/test/test-extras.scm b/libgnucash/engine/test/test-extras.scm
similarity index 100%
rename from src/engine/test/test-extras.scm
rename to libgnucash/engine/test/test-extras.scm
diff --git a/libgnucash/engine/test/test-gnc-date.c b/libgnucash/engine/test/test-gnc-date.c
new file mode 100644
index 0000000..8e31d5d
--- /dev/null
+++ b/libgnucash/engine/test/test-gnc-date.c
@@ -0,0 +1,2281 @@
+/********************************************************************
+ * utest-gnc-date.c: GLib g_test test suite for gnc-date.c.         *
+ * Copyright 2012 John Ralls <jralls at ceridwen.us>                   *
+ *                                                                  *
+ * 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, you can retrieve it from        *
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html            *
+ * or 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 at gnu.org                   *
+ ********************************************************************/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <config.h>
+#include "platform.h"
+#include <string.h>
+#include <sys/time.h>
+#include <glib.h>
+#include <unittest-support.h>
+/* Add specific headers for this class */
+
+#ifdef __cplusplus
+}
+#endif
+#include "../gnc-date.h"
+#include "../gnc-date-p.h"
+#include <locale.h>
+#include <glib/gprintf.h>
+#include <inttypes.h>
+#ifndef HAVE_STRPTIME
+#  include "strptime.h"
+#endif
+
+static const gchar *suitename = "/qof/gnc-date";
+static const time64 secs_per_year = INT64_C(3600) * (INT64_C(24) * INT64_C(365) + 6);
+static const time64 max_secs = (INT64_C(3600) * (INT64_C(24) * INT64_C(365) + 6)) * (INT64_C(9999) - INT64_C(1970));
+
+typedef struct
+{
+    short hours;
+    short minutes;
+} TZOffset;
+
+typedef struct
+{
+    TZOffset off_zulu;
+    TZOffset off_05w;
+    TZOffset off_0840e;
+    Timespec ts0;
+    Timespec ts1;
+    Timespec ts2;
+    Timespec ts3;
+    Timespec ts4;
+    Timespec ts5;
+} FixtureA;
+
+static int
+offset_secs (TZOffset tz)
+{
+    return 3600 * tz.hours + 60 * tz.minutes;
+}
+
+static char*
+offset_string (TZOffset tz)
+{
+    return g_strdup_printf("%+02d%02d", tz.hours, tz.minutes);
+}
+
+static void setup (FixtureA *f, gconstpointer pData)
+{
+    f->ts0 = (Timespec){gnc_time(NULL), 0};
+    f->off_zulu = (TZOffset){0, 0};
+    f->off_05w = (TZOffset){-5, 0};
+    f->off_0840e = (TZOffset){8, 40};
+    f->ts1 = (Timespec){607009407, 0}; //1989-3-27 13:43:27 Z
+    f->ts2 = (Timespec){1604748079, 0}; //2020-11-7 06:21:19 -05:00
+    f->ts3 = (Timespec){1341398864, 0}; //2012-07-04 19:27:44 +08:40
+    f->ts4 = (Timespec){-261104801, 0}; //1961-09-22 17:53:19 -05:00
+    f->ts5 = (Timespec){2873938879LL, 0}; //2061-01-25 23:21:19 -05:00
+}
+
+typedef struct
+{
+    int yr;
+    int mon;
+    int day;
+    time64 secs;
+} TimeMap;
+
+typedef struct
+{
+    TimeMap test[9];
+} FixtureB;
+
+static void
+setup_begin(FixtureB *f, gconstpointer pData)
+{
+    f->test[0] = (TimeMap){1999, 7, 21, INT64_C(932515200)};
+    f->test[1] = (TimeMap){1918, 3, 31, INT64_C(-1633305600)};
+    f->test[2] = (TimeMap){1918, 4, 1, INT64_C(-1633219200)};
+    f->test[3] = (TimeMap){2057, 11, 20, INT64_C(2773440000)};
+    f->test[4] = (TimeMap){1257, 07, 02, INT64_MAX}; /*invalid year*/
+    f->test[5] = (TimeMap){2017, 02, 29, INT64_MAX}; /*invalid day*/
+    f->test[6] = (TimeMap){2017, 02, 33, INT64_MAX}; /*invalid day*/
+    f->test[7] = (TimeMap){2017, 13, 29, INT64_MAX}; /*invalid month*/
+    f->test[8] = (TimeMap){2017, 03, 16, INT64_C(1489622400)};
+}
+
+static void
+setup_neutral(FixtureB *f, gconstpointer pData)
+{
+    f->test[0] = (TimeMap){1999, 7, 21, INT64_C(932554740)};
+    f->test[1] = (TimeMap){1918, 3, 31, INT64_C(-1633266060)};
+    f->test[2] = (TimeMap){1918, 4, 1, INT64_C(-1633179660)};
+    f->test[3] = (TimeMap){2057, 11, 20, INT64_C(2773479540)};
+    f->test[4] = (TimeMap){1257, 07, 02, INT64_MAX};
+    f->test[5] = (TimeMap){2017, 02, 29, INT64_MAX};
+    f->test[6] = (TimeMap){2017, 02, 33, INT64_MAX};
+    f->test[7] = (TimeMap){2017, 13, 29, INT64_MAX};
+    f->test[8] = (TimeMap){2017, 03, 16, INT64_C(1489661940)};
+}
+
+static void
+setup_end(FixtureB *f, gconstpointer pData)
+{
+    f->test[0] = (TimeMap){1999, 7, 21, INT64_C(932601599)};
+    f->test[1] = (TimeMap){1918, 3, 31, INT64_C(-1633219201)};
+    f->test[2] = (TimeMap){1918, 4, 1, INT64_C(-1633132801)};
+    f->test[3] = (TimeMap){2057, 11, 20, INT64_C(2773526399)};
+    f->test[4] = (TimeMap){1257, 07, 02, INT64_MAX};
+    f->test[5] = (TimeMap){2017, 02, 29, INT64_MAX};
+    f->test[6] = (TimeMap){2017, 02, 33, INT64_MAX};
+    f->test[7] = (TimeMap){2017, 13, 29, INT64_MAX};
+    f->test[8] = (TimeMap){2017, 03, 16, INT64_C(1489708799)};
+}
+
+void test_suite_gnc_date ( void );
+static GTimeZone *tz;
+#define MAXTIME INT64_C(253402214400)
+#define MINTIME INT64_C(-17987443200)
+
+/* gnc_localtime just creates a tm on the heap and calls
+ * gnc_localtime_r with it, so this suffices to test both.
+ */
+static void
+test_gnc_localtime (void)
+{
+    time64 secs[] = {-15767956734LL, -1123692LL, 432761LL,
+                      723349832LL, 887326459367LL,
+                      1364160236LL};
+    guint ind;
+    if (sizeof(time_t) < sizeof(time64))
+        secs[0] = -432761LL;
+
+    for (ind = 0; ind < G_N_ELEMENTS (secs); ind++)
+    {
+        struct tm* time = gnc_localtime (&secs[ind]);
+        time_t tsecs;
+        struct tm* ans;
+        if (secs[ind] > max_secs)
+        {
+            g_assert (time == NULL);
+            continue;
+        }
+        tsecs = (time_t)(secs[ind]);
+        ans = localtime(&tsecs);
+        g_assert_cmpint (time->tm_year, ==, ans->tm_year);
+        g_assert_cmpint (time->tm_mon, ==, ans->tm_mon);
+        g_assert_cmpint (time->tm_mday, ==, ans->tm_mday);
+        g_assert_cmpint (time->tm_hour, ==, ans->tm_hour);
+        g_assert_cmpint (time->tm_min, ==, ans->tm_min);
+        g_assert_cmpint (time->tm_sec, ==, ans->tm_sec);
+        g_assert_cmpint (time->tm_wday, ==, ans->tm_wday);
+        g_assert_cmpint (time->tm_yday, ==, ans->tm_yday);
+        g_assert_cmpint (time->tm_isdst, ==, ans->tm_isdst);
+#ifdef HAVE_STRUCT_TM_GMTOFF
+        g_assert_cmpint (time->tm_gmtoff, ==, ans->tm_gmtoff);
+#endif
+        gnc_tm_free (time);
+    }
+}
+
+static void
+test_gnc_gmtime (void)
+{
+    time64 secs[6] = {-15767956734LL, -1123692LL, 432761LL,
+                      723349832LL, 887326459367LL, 1175964426LL
+                     };
+    struct tm answers[6] =
+    {
+#ifdef HAVE_STRUCT_TM_GMTOFF
+        { 6, 1, 12, 2, 4, -430, 1, 121, 0, 0, NULL },
+        { 48, 51, 23, 18, 11, 69, 4, 351, 0, 0, NULL },
+        { 41, 12, 0, 6, 0, 70, 2, 5, 0, 0, NULL },
+        { 32, 30, 2, 3, 11, 92, 4, 337, 0, 0, NULL },
+        { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL },
+        { 6, 47, 16, 7, 3, 107, 6, 96, 0, 0, NULL },
+#else
+        { 6, 1, 12, 2, 4, -430, 1, 121, 0 },
+        { 48, 51, 23, 18, 11, 69, 4, 351, 0 },
+        { 41, 12, 0, 6, 0, 70, 2, 5, 0 },
+        { 32, 30, 2, 3, 11, 92, 4, 337, 0 },
+        { 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+        { 6, 47, 16, 7, 3, 107, 6, 96, 0 },
+#endif
+    };
+    guint ind;
+    for (ind = 0; ind < G_N_ELEMENTS (secs); ind++)
+    {
+        struct tm* time = gnc_gmtime (&secs[ind]);
+        if ((secs[ind] > max_secs))
+        {
+            g_assert (time == NULL);
+            continue;
+        }
+
+        g_assert_cmpint (time->tm_year, ==, answers[ind].tm_year);
+        g_assert_cmpint (time->tm_mon, ==, answers[ind].tm_mon);
+        g_assert_cmpint (time->tm_mday, ==, answers[ind].tm_mday);
+        g_assert_cmpint (time->tm_hour, ==, answers[ind].tm_hour);
+        g_assert_cmpint (time->tm_min, ==, answers[ind].tm_min);
+        g_assert_cmpint (time->tm_sec, ==, answers[ind].tm_sec);
+        g_assert_cmpint (time->tm_wday, ==, answers[ind].tm_wday);
+        g_assert_cmpint (time->tm_yday, ==, answers[ind].tm_yday);
+        g_assert_cmpint (time->tm_isdst, ==, -1);
+#ifdef HAVE_STRUCT_TM_GMTOFF
+        g_assert_cmpint (time->tm_gmtoff, ==, 0);
+#endif
+        gnc_tm_free (time);
+    }
+}
+
+static void
+test_gnc_mktime (void)
+{
+    time64 ans[5] =
+        { -15752870334LL, -1123692LL, 432761LL, 723349832LL, 1175964426LL};
+
+    struct tm time[5] =
+    {
+#ifdef HAVE_STRUCT_TM_GMTOFF
+        { 6, 41, 2, 24, 9, -430, 0, 0, 1, 0, NULL },
+        { 48, 51, 23, 18, 11, 69, 0, 0, -1, 0, NULL },
+        { 41, 12, 0, 6, 0, 70, 0, 0, -1, 0, NULL },
+        { 32, 30, 2, 3, 11, 92, 0, 0, -1, 0, NULL },
+        { 6, 47, 16, 7, 3, 107, 0, 0, -1, 0, NULL },
+#else
+        { 6, 41, 2, 24, 9, -430, 0, 0, 1 },
+        { 48, 51, 23, 18, 11, 69, 0, 0, -1 },
+        { 41, 12, 0, 6, 0, 70, 0, 0, -1 },
+        { 32, 30, 2, 3, 11, 92, 0, 0, -1 },
+        { 6, 47, 16, 7, 3, 107, 0, 0, -1 },
+#endif
+    };
+    guint ind;
+    int offset = timegm(&time[4]) - mktime(&time[4]);
+
+    for (ind = 0; ind < G_N_ELEMENTS (time); ind++)
+    {
+        time64 secs = gnc_mktime (&time[ind]);
+#if !PLATFORM(WINDOWS)
+	//The timezone database uses local time for some
+	//timezones before 1900, which screws up the offset.
+	if (time[ind].tm_year < 0)
+            continue;
+#endif
+        g_assert_cmpint (secs, ==, ans[ind] - offset);
+
+    }
+}
+
+/* In addition to computing a time offset from a struct tm, mktime is
+ * supposed to normalize struct tms with out-of-range values. This
+ * second test exercises that facility in gnc_mktime.
+ */
+static void
+test_gnc_mktime_normalization (void)
+{
+    time64 ans = 723349832LL;
+
+    struct tm normal_time =
+#ifdef HAVE_STRUCT_TM_GMTOFF
+    {
+        32, 30, 2, 3, 11, 92, 0, 0, -1, 0, NULL
+    };
+#else
+    {
+        32, 30, 2, 3, 11, 92, 0, 0, -1
+    };
+#endif
+
+    struct tm time[4] =
+    {
+#ifdef HAVE_STRUCT_TM_GMTOFF
+        { 92, -31, 27, -29, 24, 91, 0, 0, -1, 0, NULL },
+        { -28, 91, -47, 35, -2, 93, 0, 0, -1, 0, NULL },
+        { -28, 91, -47, 66, -3, 93, 0, 0, -1, 0, NULL },
+        { -28, 91, -47, 35, -26, 95, 0, 0, -1, 0, NULL },
+#else
+        { 92, -31, 27, -29, 24, 91, 0, 0, -1 },
+        { -28, 91, -47, 35, -2, 93, 0, 0, -1 },
+        { -28, 91, -47, 66, -3, 93, 0, 0, -1 },
+        { -28, 91, -47, 35, -26, 95, 0, 0, -1 },
+#endif
+    };
+    guint ind;
+    int offset = timegm(&normal_time) - mktime(&normal_time);
+    for (ind = 0; ind < G_N_ELEMENTS (time); ind++)
+    {
+        time64 secs = gnc_mktime (&time[ind]);
+
+        g_assert_cmpfloat (time[ind].tm_sec, ==, normal_time.tm_sec);
+        g_assert_cmpint (time[ind].tm_min, ==, normal_time.tm_min);
+        g_assert_cmpint (time[ind].tm_hour, ==, normal_time.tm_hour);
+        g_assert_cmpint (time[ind].tm_mday, ==, normal_time.tm_mday);
+        g_assert_cmpint (time[ind].tm_mon, ==, normal_time.tm_mon);
+        g_assert_cmpint (time[ind].tm_year, ==, normal_time.tm_year);
+        g_assert_cmpint (secs, ==, ans - offset);
+    }
+}
+
+static void
+test_gnc_ctime (void)
+{
+    time64 secs[5] = {-15767956734LL, -1123692LL, 432761LL,
+                      723349832LL, 1175964426LL
+                     };
+    guint ind;
+    for (ind = 0; ind < G_N_ELEMENTS (secs); ind++)
+    {
+	time_t time;
+	char *datestr;
+	char check_str[80];
+        if (secs[ind] < INT32_MIN)
+            continue;
+        time = (time_t)secs[ind];
+        datestr = gnc_ctime (&secs[ind]);
+	strftime (check_str, 80, "%a %b %d %H:%M:%S %Y", localtime(&time));
+        g_assert_cmpstr (datestr, ==, check_str);
+        g_free (datestr);
+    }
+}
+
+static void
+test_gnc_time (void)
+{
+    time64 secs1, secs2;
+    secs1 = gnc_time (&secs2);
+    g_assert_cmpint (secs1, ==, secs2);
+    g_assert_cmpint (secs1, ==, time(0));
+}
+
+/* gnc_difftime and gnc_tm_free are just too simple to bother testing. */
+
+/* gnc_date_dateformat_to_string
+const char *gnc_default_strftime_date_format =
+const char*
+gnc_date_dateformat_to_string(QofDateFormat format)// C: 1  Local: 0:0:0
+*/
+
+static void
+test_gnc_date_dateformat_to_string (void)
+{
+    g_assert_cmpstr (gnc_date_dateformat_to_string (QOF_DATE_FORMAT_US), ==, "us");
+    g_assert_cmpstr (gnc_date_dateformat_to_string (QOF_DATE_FORMAT_UK), ==, "uk");
+    g_assert_cmpstr (gnc_date_dateformat_to_string (QOF_DATE_FORMAT_CE), ==, "ce");
+    g_assert_cmpstr (gnc_date_dateformat_to_string (QOF_DATE_FORMAT_ISO), ==, "iso");
+    g_assert_cmpstr (gnc_date_dateformat_to_string (QOF_DATE_FORMAT_UTC), ==, "utc");
+    g_assert_cmpstr (gnc_date_dateformat_to_string (QOF_DATE_FORMAT_LOCALE), ==, "locale");
+    g_assert_cmpstr (gnc_date_dateformat_to_string (QOF_DATE_FORMAT_CUSTOM), ==, "custom");
+    g_assert_cmpstr (gnc_date_dateformat_to_string (QOF_DATE_FORMAT_UNSET), ==, "unset");
+
+}
+/* gnc_date_string_to_dateformat
+gboolean
+gnc_date_string_to_dateformat(const char* fmt_str, QofDateFormat *format)// C: 3 in 3  Local: 0:0:0
+*/
+static void
+test_gnc_date_string_to_dateformat (void)
+{
+    QofDateFormat fmt = 123;
+    g_assert (gnc_date_string_to_dateformat (NULL, &fmt));
+    g_assert_cmpint (fmt, ==, 123);
+    g_assert (!gnc_date_string_to_dateformat ("us", &fmt));
+    g_assert_cmpint (fmt, ==, QOF_DATE_FORMAT_US);
+    g_assert (!gnc_date_string_to_dateformat ("uk", &fmt));
+    g_assert_cmpint (fmt, ==, QOF_DATE_FORMAT_UK);
+    g_assert (!gnc_date_string_to_dateformat ("ce", &fmt));
+    g_assert_cmpint (fmt, ==, QOF_DATE_FORMAT_CE);
+    g_assert (!gnc_date_string_to_dateformat ("iso", &fmt));
+    g_assert_cmpint (fmt, ==, QOF_DATE_FORMAT_ISO);
+    g_assert (!gnc_date_string_to_dateformat ("utc", &fmt));
+    g_assert_cmpint (fmt, ==, QOF_DATE_FORMAT_UTC);
+    g_assert (!gnc_date_string_to_dateformat ("locale", &fmt));
+    g_assert_cmpint (fmt, ==, QOF_DATE_FORMAT_LOCALE);
+    g_assert (!gnc_date_string_to_dateformat ("custom", &fmt));
+    g_assert_cmpint (fmt, ==, QOF_DATE_FORMAT_CUSTOM);
+    g_assert (!gnc_date_string_to_dateformat ("unset", &fmt));
+    g_assert_cmpint (fmt, ==, QOF_DATE_FORMAT_UNSET);
+    fmt = 123;
+    g_assert (gnc_date_string_to_dateformat ("", &fmt));
+    g_assert_cmpint (fmt, ==, 123);
+    g_assert (gnc_date_string_to_dateformat ("foo", &fmt));
+    g_assert_cmpint (fmt, ==, 123);
+
+}
+/* gnc_date_monthformat_to_string
+const char*
+gnc_date_monthformat_to_string(GNCDateMonthFormat format)// C: 1  Local: 0:0:0
+*/
+static void
+test_gnc_date_monthformat_to_string (void)
+{
+    g_assert_cmpstr (gnc_date_monthformat_to_string (GNCDATE_MONTH_NUMBER), ==, "number");
+    g_assert_cmpstr (gnc_date_monthformat_to_string (GNCDATE_MONTH_ABBREV), ==, "abbrev");
+    g_assert_cmpstr (gnc_date_monthformat_to_string (GNCDATE_MONTH_NAME), ==, "name");
+    g_assert (gnc_date_monthformat_to_string (93) == NULL);
+}
+/* gnc_date_string_to_monthformat
+gboolean
+gnc_date_string_to_monthformat(const char *fmt_str, GNCDateMonthFormat *format)// C: 1  Local: 0:0:0
+*/
+static void
+test_gnc_date_string_to_monthformat (void)
+{
+    GNCDateMonthFormat fmt = 123;
+    g_assert (gnc_date_string_to_monthformat (NULL, &fmt));
+    g_assert_cmpint (fmt, ==, 123);
+    g_assert (!gnc_date_string_to_monthformat ("number", &fmt));
+    g_assert_cmpint (fmt, ==, GNCDATE_MONTH_NUMBER);
+    g_assert (!gnc_date_string_to_monthformat ("abbrev", &fmt));
+    g_assert_cmpint (fmt, ==, GNCDATE_MONTH_ABBREV);
+    g_assert (!gnc_date_string_to_monthformat ("name", &fmt));
+    g_assert_cmpint (fmt, ==, GNCDATE_MONTH_NAME);
+    fmt = 123;
+    g_assert (gnc_date_string_to_monthformat ("", &fmt));
+    g_assert_cmpint (fmt, ==, 123);
+    g_assert (gnc_date_string_to_monthformat ("foo", &fmt));
+    g_assert_cmpint (fmt, ==, 123);
+}
+
+static void
+test_gnc_setlocale (int category, gchar *locale)
+{
+    gchar *suffixes[] = {"utf8", "UTF-8"};
+    guint i;
+    /* Msys defines a different set of locales */
+#ifdef G_OS_WIN32
+    if (g_strcmp0 (locale, "en_US") == 0
+            && setlocale (category, "English_US"))
+        return;
+    if (g_strcmp0 (locale, "en_GB") == 0
+            && setlocale (category, "English_UK"))
+        return;
+    if (g_strcmp0 (locale, "fr_FR") == 0
+            && setlocale (category, "French_France"))
+        return;
+
+#endif
+    if (setlocale (category, locale) != NULL)
+        return;
+
+    for (i = 0; i < G_N_ELEMENTS (suffixes); i++)
+    {
+        gchar * modlocale = g_strdup_printf ("%s.%s", locale, suffixes[i]);
+        gchar *localeval = setlocale (category, modlocale);
+        g_free (modlocale);
+        if (localeval != NULL)
+            return;
+    }
+    g_fprintf (stderr, "There are some differences between distros in the way they name"
+              "locales, and this can cause trouble with the locale-based"
+              "formatting. If you get the assert in this function, run locale -a"
+              "and make sure that en_US, en_GB, and fr_FR are installed and that"
+              "if a suffix is needed it's in the suffixes array.");
+    g_assert_not_reached ();
+}
+/* timespec_normalize
+static void
+timespec_normalize(Timespec *t)// Local: 2:0:0
+*/
+static void
+test_timespec_normalize (void)
+{
+    const int offset = 4396432;
+    const int factor = 2;
+    int base = 50;
+    Timespec t = { base, factor * NANOS_PER_SECOND + offset };
+    Testfuncs *tf = gnc_date_load_funcs ();
+
+    tf->timespec_normalize (&t);
+    g_assert_cmpint (t.tv_sec, ==, base + factor);
+    g_assert_cmpint (t.tv_nsec, ==, offset);
+
+    t.tv_sec = base;
+    t.tv_nsec = - factor * NANOS_PER_SECOND - offset;
+    tf->timespec_normalize (&t);
+    g_assert_cmpint (t.tv_sec, ==, base - factor - 1);
+    g_assert_cmpint (t.tv_nsec, ==, NANOS_PER_SECOND - offset);
+
+    t.tv_sec = - base;
+    t.tv_nsec = factor * NANOS_PER_SECOND + offset;
+    tf->timespec_normalize (&t);
+    g_assert_cmpint (t.tv_sec, ==, - base + factor + 1);
+    g_assert_cmpint (t.tv_nsec, ==, - NANOS_PER_SECOND + offset);
+
+    t.tv_sec = - base;
+    t.tv_nsec = - factor * NANOS_PER_SECOND - offset;
+    tf->timespec_normalize (&t);
+    g_assert_cmpint (t.tv_sec, ==, - base - factor);
+    g_assert_cmpint (t.tv_nsec, ==, - offset);
+
+    g_slice_free (Testfuncs, tf);
+}
+
+
+/* timespec_equal
+gboolean
+timespec_equal (const Timespec *ta, const Timespec *tb)// C: 19 in 8  Local: 0:0:0
+*/
+static void
+test_timespec_equal (void)
+{
+    const int sec_per_day = 24 * 3600;
+    const int sec_per_mo = 30 * sec_per_day;
+    const time64 sec_per_yr = 365 * sec_per_day;
+    const int nsec1 = 439652, nsec2 = 132794892, nsec3 = 1132794892;
+    const time64 secs1 = 23 * sec_per_yr + 5 * sec_per_mo + 11 * sec_per_day;
+    const time64 secs2 = 21 * sec_per_yr + 11 * sec_per_mo + 19 * sec_per_day;
+    const time64 secs3 = 72 * sec_per_yr + 2 * sec_per_mo + 26 * sec_per_day;
+    Timespec ta = { secs1, nsec1 };
+    Timespec tb = { secs2, nsec2 };
+    Timespec tc = { secs1, nsec1 };
+    Timespec td = { secs3, nsec1 };
+    Timespec te = { secs1, nsec2 };
+    Timespec tf = { secs2 - 1, nsec3 }; /* When normalized, equal to tb */
+
+    g_assert (timespec_equal (&ta, &ta));
+    g_assert (timespec_equal (&ta, &tc));
+    g_assert (!timespec_equal (&ta, &tb));
+    g_assert (!timespec_equal (&ta, &td));
+    g_assert (!timespec_equal (&ta, &te));
+    g_assert (timespec_equal (&tb, &tf));
+}
+/* timespec_cmp
+gint
+timespec_cmp(const Timespec *ta, const Timespec *tb)// C: 28 in 11  Local: 0:0:0
+*/
+static void
+test_timespec_cmp (void)
+{
+    const int sec_per_day = 24 * 3600;
+    const int sec_per_mo = 30 * sec_per_day;
+    const time64 sec_per_yr = 365 * sec_per_day;
+    const int nsec1 = 439652, nsec2 = 132794892, nsec3 = 1132794892;
+    const time64 secs1 = 23 * sec_per_yr + 5 * sec_per_mo + 11 * sec_per_day;
+    const time64 secs2 = 21 * sec_per_yr + 11 * sec_per_mo + 19 * sec_per_day;
+    const time64 secs3 = 72 * sec_per_yr + 2 * sec_per_mo + 26 * sec_per_day;
+    Timespec ta = { secs1, nsec1 };
+    Timespec tb = { secs2, nsec2 };
+    Timespec tc = { secs1, nsec1 };
+    Timespec td = { secs3, nsec1 };
+    Timespec te = { secs1, nsec2 };
+    Timespec tf = { secs2 - 1, nsec3 }; /* When normalized, equal to tb */
+    Timespec tg = { -secs2, nsec2 };
+    Timespec th = { secs1, -nsec1 };
+
+    g_assert_cmpint (timespec_cmp (&ta, &ta), ==, 0);
+    g_assert_cmpint (timespec_cmp (&ta, &tc), ==, 0);
+    g_assert_cmpint (timespec_cmp (&tf, &tb), ==, 0);
+    g_assert_cmpint (timespec_cmp (&ta, &tb), ==, 1);
+    g_assert_cmpint (timespec_cmp (&te, &ta), ==, 1);
+    g_assert_cmpint (timespec_cmp (&td, &ta), ==, 1);
+    g_assert_cmpint (timespec_cmp (&ta, &te), ==, -1);
+    g_assert_cmpint (timespec_cmp (&ta, &tg), ==, 1);
+    g_assert_cmpint (timespec_cmp (&th, &ta), ==, -1);
+
+}
+/* timespec_diff
+Timespec
+timespec_diff(const Timespec *ta, const Timespec *tb)// C: 4 in 1  Local: 0:0:0
+*/
+static void
+test_timespec_diff (void)
+{
+    const gint sec_per_day = 24 * 3600;
+    const gint sec_per_mo = 30 * sec_per_day;
+    const time64 sec_per_yr = 365 * sec_per_day;
+    const time64 nsec1 = 439652, nsec2 = 132794892, nsec3 = 1132794892;
+    const time64 secs1 = 23 * sec_per_yr + 5 * sec_per_mo + 11 * sec_per_day;
+    const time64 secs2 = 21 * sec_per_yr + 11 * sec_per_mo + 19 * sec_per_day;
+    const time64 secs3 = 72 * sec_per_yr + 2 * sec_per_mo + 26 * sec_per_day;
+    Timespec ta = { secs1, nsec1 };
+    Timespec tb = { secs2, nsec2 };
+    Timespec td = { secs3, nsec1 };
+    Timespec te = { secs1, nsec2 };
+    Timespec tf = { secs2 - 1, nsec3 }; /* When normalized, equal to tb */
+    Timespec tg = { -secs2, nsec2 };
+    Timespec th = { secs1, -nsec3 };
+
+    Timespec tt = timespec_diff (&ta, &ta);
+
+    g_assert_cmpint (tt.tv_sec, ==, 0);
+    g_assert_cmpint (tt.tv_nsec, ==, 0);
+
+    tt = timespec_diff (&ta, &tb);
+    g_assert_cmpint (tt.tv_sec, ==, secs1 - secs2 - 1);
+    g_assert_cmpint (tt.tv_nsec, ==, nsec1 - nsec2 + NANOS_PER_SECOND);
+
+    tt = timespec_diff (&ta, &te);
+    g_assert_cmpint (tt.tv_sec, ==, 0);
+    g_assert_cmpint (tt.tv_nsec, ==, nsec1 - nsec2);
+
+    tt = timespec_diff (&tb, &tf);
+    g_assert_cmpint (tt.tv_sec, ==, 0);
+    g_assert_cmpint (tt.tv_nsec, ==, 0);
+
+    tt = timespec_diff (&tf, &th);
+    if (sizeof (glong) > 4)
+    {
+        glong nsec_diff_norm = 2 * nsec3 - 2 * NANOS_PER_SECOND - NANOS_PER_SECOND;
+        g_assert_cmpint (tt.tv_sec, ==, secs2 - secs1 + 2);
+        g_assert_cmpint (tt.tv_nsec, ==,  nsec_diff_norm);
+    }
+    else
+    {
+        g_assert_cmpint (tt.tv_sec, ==, secs2 - secs1 - 3);
+        g_assert_cmpint (tt.tv_nsec, <, 0); /* Overflow nanosecs */
+    }
+    tt = timespec_diff (&tg, &td);
+    g_assert_cmpint (tt.tv_sec, ==, -secs2 - secs3 + 1);
+    g_assert_cmpint (tt.tv_nsec, ==, nsec2 - nsec1 - NANOS_PER_SECOND);
+
+}
+/* timespec_abs
+Timespec
+timespec_abs(const Timespec *t)// C: 4 in 1  Local: 0:0:0
+*/
+static void
+test_timespec_abs (void)
+{
+    const int sec_per_day = 24 * 3600;
+    const int sec_per_mo = 30 * sec_per_day;
+    const int sec_per_yr = 365 * sec_per_day;
+    const int nsec1 = 439652, nsec2 = 132794892, nsec3 = 1132794892;
+    const time64 secs1 = 23 * sec_per_yr + 5 * sec_per_mo + 11 * sec_per_day;
+    const time64 secs2 = 21 * sec_per_yr + 11 * sec_per_mo + 19 * sec_per_day;
+    Timespec ta = { secs1, nsec1 };
+    Timespec tf = { secs2 - 1, nsec3 }; /* When normalized, equal to tb */
+    Timespec tg = { -secs2, nsec2 };
+    Timespec th = { secs1, -nsec1 };
+
+    Timespec tt = timespec_abs (&ta);
+    g_assert_cmpint (tt.tv_sec, ==, secs1);
+    g_assert_cmpint (tt.tv_nsec, ==, nsec1);
+
+    tt = timespec_abs (&tf);
+    g_assert_cmpint (tt.tv_sec, ==, secs2);
+    g_assert_cmpint (tt.tv_nsec, ==, nsec2);
+
+    tt = timespec_abs (&tg);
+    g_assert_cmpint (tt.tv_sec, ==, secs2 - 1);
+    g_assert_cmpint (tt.tv_nsec, ==, NANOS_PER_SECOND - nsec2);
+
+    tt = timespec_abs (&th);
+    g_assert_cmpint (tt.tv_sec, ==, secs1 - 1);
+    g_assert_cmpint (tt.tv_nsec, ==, NANOS_PER_SECOND - nsec1);
+
+}
+/* timespecCanonicalDayTime
+Timespec
+timespecCanonicalDayTime(Timespec t)// C: 12 in 5 SCM: 19 in 10 Local: 0:0:0
+*/
+static Timespec
+compute_noon_of_day (Timespec *ts)
+{
+    Timespec nt = {0, 0};
+    time_t secs = (time_t)ts->tv_sec;
+    struct tm *time = localtime(&secs);
+    time->tm_hour = 12;
+    time->tm_min = 0;
+    time->tm_sec = 0;
+    nt.tv_sec = mktime(time);
+    return nt;
+}
+
+static void
+test_timespecCanonicalDayTime (void)
+{
+    const int sec_per_day = 24 * 3600;
+    const int sec_per_mo = 30 * sec_per_day;
+    const time64 sec_per_yr = 365 * sec_per_day;
+    const time64 secs = 8 * 3600 + 43 * 60 + 11;
+    const time64 secs1 = 23 * sec_per_yr + 5 * sec_per_mo + 11 * sec_per_day + 8 * 3600 + 43 * 60 + 11;
+    const time64 secs2 = 21 * sec_per_yr + 11 * sec_per_mo + 19 * sec_per_day + 21 * 3600 + 9 * 60 + 48;
+
+    Timespec t0 = { secs, 0 };
+    Timespec ta = { secs1, 0 };
+    Timespec tb = { secs2, 0 };
+
+    Timespec n0 = compute_noon_of_day (&t0);
+    Timespec na = compute_noon_of_day (&ta);
+    Timespec nb = compute_noon_of_day (&tb);
+
+    Timespec r0 = timespecCanonicalDayTime (t0);
+    Timespec ra = timespecCanonicalDayTime (ta);
+    Timespec rb = timespecCanonicalDayTime (tb);
+
+    g_assert_cmpint (n0.tv_sec, ==, r0.tv_sec);
+    g_assert_cmpint (na.tv_sec, ==, ra.tv_sec);
+    g_assert_cmpint (nb.tv_sec, ==, rb.tv_sec);
+
+}
+
+/* gnc_date_get_last_mday
+int gnc_date_get_last_mday (int month, int year)// C: 1  Local: 1:0:0
+*/
+static void
+test_gnc_date_get_last_mday (void)
+{
+    g_assert_cmpint (gnc_date_get_last_mday (0, 1975), ==, 31);
+    g_assert_cmpint (gnc_date_get_last_mday (0, 1980), ==, 31);
+    g_assert_cmpint (gnc_date_get_last_mday (1, 1975), ==, 28);
+    g_assert_cmpint (gnc_date_get_last_mday (1, 1980), ==, 29);
+    g_assert_cmpint (gnc_date_get_last_mday (2, 1975), ==, 31);
+    g_assert_cmpint (gnc_date_get_last_mday (2, 1980), ==, 31);
+    g_assert_cmpint (gnc_date_get_last_mday (3, 1975), ==, 30);
+    g_assert_cmpint (gnc_date_get_last_mday (3, 1980), ==, 30);
+    g_assert_cmpint (gnc_date_get_last_mday (4, 1975), ==, 31);
+    g_assert_cmpint (gnc_date_get_last_mday (4, 1980), ==, 31);
+    g_assert_cmpint (gnc_date_get_last_mday (5, 1975), ==, 30);
+    g_assert_cmpint (gnc_date_get_last_mday (5, 1980), ==, 30);
+    g_assert_cmpint (gnc_date_get_last_mday (6, 1975), ==, 31);
+    g_assert_cmpint (gnc_date_get_last_mday (6, 1980), ==, 31);
+    g_assert_cmpint (gnc_date_get_last_mday (7, 1975), ==, 31);
+    g_assert_cmpint (gnc_date_get_last_mday (7, 1980), ==, 31);
+    g_assert_cmpint (gnc_date_get_last_mday (8, 1975), ==, 30);
+    g_assert_cmpint (gnc_date_get_last_mday (8, 1980), ==, 30);
+    g_assert_cmpint (gnc_date_get_last_mday (9, 1975), ==, 31);
+    g_assert_cmpint (gnc_date_get_last_mday (9, 1980), ==, 31);
+    g_assert_cmpint (gnc_date_get_last_mday (10, 1975), ==, 30);
+    g_assert_cmpint (gnc_date_get_last_mday (10, 1980), ==, 30);
+    g_assert_cmpint (gnc_date_get_last_mday (11, 1975), ==, 31);
+    g_assert_cmpint (gnc_date_get_last_mday (11, 1980), ==, 31);
+    g_assert_cmpint (gnc_date_get_last_mday (1, 2000), ==, 29);
+    g_assert_cmpint (gnc_date_get_last_mday (1, 2400), ==, 28);
+}
+/* Getter, no testing needed.
+QofDateFormat qof_date_format_get (void)// C: 5 in 3  Local: 0:0:0
+*/
+/* qof_date_format_set
+set date format to one of US, UK, CE, ISO OR UTC
+checks to make sure it's a legal value
+param QofDateFormat: enumeration indicating preferred format
+return void
+Globals: dateFormat
+void qof_date_format_set(QofDateFormat df)// C: 3 in 2  Local: 0:0:0
+*/
+static void
+test_qof_date_format_set (void)
+{
+    gchar *msg = "[qof_date_format_set()] non-existent date format set attempted. Setting ISO default";
+    gint loglevel = G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_FATAL;
+    gchar *logdomain = "qof.engine";
+    TestErrorStruct check = {loglevel, logdomain, msg, 0};
+    GLogFunc hdlr = g_log_set_default_handler ((GLogFunc)test_null_handler, &check);
+    g_test_log_set_fatal_handler ((GTestLogFatalFunc)test_checked_handler, &check);
+    qof_date_format_set ((QofDateFormat)((guint)DATE_FORMAT_LAST + 97));
+    g_assert_cmpint (qof_date_format_get (), ==,  QOF_DATE_FORMAT_ISO);
+    g_assert_cmpint (check.hits, ==,1);
+
+    qof_date_format_set (QOF_DATE_FORMAT_UK);
+    g_assert_cmpint (qof_date_format_get (), ==, QOF_DATE_FORMAT_UK);
+    g_assert_cmpint (check.hits, ==,1);
+    g_log_set_default_handler (hdlr, NULL);
+}
+/* qof_date_completion_set
+set dateCompletion to one of QOF_DATE_COMPLETION_THISYEAR (for
+completing the year to the current calendar year) or
+QOF_DATE_COMPLETION_SLIDING (for using a sliding 12-month window). The
+sliding window starts 'backmonth' months before the current month (0-11).
+checks to make sure it's a legal value
+param QofDateCompletion: indicates preferred completion method
+param int: the number of months to go back in time (0-11)
+return void
+Globals: dateCompletion dateCompletionBackMonths
+void qof_date_completion_set(QofDateCompletion dc, int backmonths)// C: 1  Local: 0:0:0
+*/
+/* static void
+test_qof_date_completion_set (void)
+{
+}*/
+/* qof_print_date_dmy_buff
+size_t
+qof_print_date_dmy_buff (char * buff, size_t len, int day, int month, int year)// C: 12 in 3  Local: 2:0:0
+*/
+
+#ifdef HAVE_LANGINFO_D_FMT
+#include <langinfo.h>
+#  define GNC_D_FMT (nl_langinfo (D_FMT))
+#  define GNC_D_T_FMT (nl_langinfo (D_T_FMT))
+#  define GNC_T_FMT (nl_langinfo (T_FMT))
+#elif defined(G_OS_WIN32)
+#  define GNC_D_FMT (qof_win32_get_time_format(QOF_WIN32_PICTURE_DATE))
+#  define GNC_T_FMT (qof_win32_get_time_format(QOF_WIN32_PICTURE_TIME))
+#  define GNC_D_T_FMT (qof_win32_get_time_format(QOF_WIN32_PICTURE_DATETIME))
+#else
+#  define GNC_D_FMT "%Y-%m-%d"
+#  define GNC_D_T_FMT "%Y-%m-%d %r"
+#  define GNC_T_FMT "%r"
+#endif
+
+static void tm_set_dmy (struct tm *tm, gint year, gint month, gint mday)
+{
+    tm->tm_year = year - 1900;
+    tm->tm_mon = month - 1;
+    tm->tm_mday = mday;
+}
+
+static void
+test_qof_print_date_dmy_buff (void)
+{
+    gchar buff[MAX_DATE_LENGTH], t_buff[MAX_DATE_LENGTH];
+    gchar *locale = g_strdup (setlocale (LC_TIME, NULL));
+    struct tm tm = { 0, 0, 0, 0, 0, 0, 0, 0, 0
+#ifdef HAVE_STRUCT_TM_GMTOFF
+        , 0, 0
+#endif
+    };
+
+    qof_date_format_set (QOF_DATE_FORMAT_UK);
+    memset ((gpointer)buff, 0, sizeof (buff));
+    g_assert_cmpint (qof_print_date_dmy_buff (buff, sizeof (buff), 23, 11, 1974), ==, strlen (buff));
+    g_assert_cmpstr (buff, ==, "23/11/1974");
+    memset ((gpointer)buff, 0, sizeof (buff));
+    g_assert_cmpint (qof_print_date_dmy_buff (buff, sizeof (buff), 2, 2, 1961), ==, strlen (buff));
+    g_assert_cmpstr (buff, ==, "02/02/1961");
+    memset ((gpointer)buff, 0, sizeof (buff));
+    g_assert_cmpint (qof_print_date_dmy_buff (buff, sizeof (buff), 16, 6, 2045), ==, strlen (buff));
+    g_assert_cmpstr (buff, ==, "16/06/2045");
+
+    qof_date_format_set (QOF_DATE_FORMAT_CE);
+    memset ((gpointer)buff, 0, sizeof (buff));
+    g_assert_cmpint (qof_print_date_dmy_buff (buff, sizeof (buff), 23, 11, 1974), ==, strlen (buff));
+    g_assert_cmpstr (buff, ==, "23.11.1974");
+    memset ((gpointer)buff, 0, sizeof (buff));
+    g_assert_cmpint (qof_print_date_dmy_buff (buff, sizeof (buff), 2, 2, 1961), ==, strlen (buff));
+    g_assert_cmpstr (buff, ==, "02.02.1961");
+    memset ((gpointer)buff, 0, sizeof (buff));
+    g_assert_cmpint (qof_print_date_dmy_buff (buff, sizeof (buff), 16, 6, 2045), ==, strlen (buff));
+    g_assert_cmpstr (buff, ==, "16.06.2045");
+
+    qof_date_format_set (QOF_DATE_FORMAT_US);
+    memset ((gpointer)buff, 0, sizeof (buff));
+    g_assert_cmpint (qof_print_date_dmy_buff (buff, sizeof (buff), 23, 11, 1974), ==, strlen (buff));
+    g_assert_cmpstr (buff, ==, "11/23/1974");
+    memset ((gpointer)buff, 0, sizeof (buff));
+    g_assert_cmpint (qof_print_date_dmy_buff (buff, sizeof (buff), 2, 2, 1961), ==, strlen (buff));
+    g_assert_cmpstr (buff, ==, "02/02/1961");
+    memset ((gpointer)buff, 0, sizeof (buff));
+    g_assert_cmpint (qof_print_date_dmy_buff (buff, sizeof (buff), 16, 6, 2045), ==, strlen (buff));
+    g_assert_cmpstr (buff, ==, "06/16/2045");
+
+    qof_date_format_set (QOF_DATE_FORMAT_ISO);
+    memset ((gpointer)buff, 0, sizeof (buff));
+    g_assert_cmpint (qof_print_date_dmy_buff (buff, sizeof (buff), 23, 11, 1974), ==, strlen (buff));
+    g_assert_cmpstr (buff, ==, "1974-11-23");
+    memset ((gpointer)buff, 0, sizeof (buff));
+    g_assert_cmpint (qof_print_date_dmy_buff (buff, sizeof (buff), 2, 2, 1961),
+                     ==, strlen (buff));
+    g_assert_cmpstr (buff, ==, "1961-02-02");
+    memset ((gpointer)buff, 0, sizeof (buff));
+    g_assert_cmpint (qof_print_date_dmy_buff (buff, sizeof (buff), 16, 6, 2045),
+                     ==, strlen (buff));
+    g_assert_cmpstr (buff, ==, "2045-06-16");
+
+    qof_date_format_set (QOF_DATE_FORMAT_LOCALE);
+    test_gnc_setlocale (LC_TIME, "en_US");
+    tm_set_dmy (&tm, 1974, 11, 23);
+    strftime(t_buff, MAX_DATE_LENGTH, GNC_D_FMT, &tm);
+    memset ((gpointer)buff, 0, sizeof (buff));
+    g_assert_cmpint (qof_print_date_dmy_buff (buff, sizeof (buff), tm.tm_mday,
+                     tm.tm_mon + 1, tm.tm_year + 1900),
+                     ==, strlen (buff));
+    g_assert_cmpstr (buff, ==, t_buff);
+
+
+    tm_set_dmy (&tm, 1961, 2, 2);
+    strftime(t_buff, MAX_DATE_LENGTH, GNC_D_FMT, &tm);
+    memset ((gpointer)buff, 0, sizeof (buff));
+    g_assert_cmpint (qof_print_date_dmy_buff (buff, sizeof (buff), tm.tm_mday,
+                     tm.tm_mon + 1, tm.tm_year + 1900),
+                     ==, strlen (buff));
+    g_assert_cmpstr (buff, ==, t_buff);
+    memset ((gpointer)buff, 0, sizeof (buff));
+    tm_set_dmy (&tm, 2045, 6, 16);
+    strftime(t_buff, MAX_DATE_LENGTH, GNC_D_FMT, &tm);
+    memset ((gpointer)buff, 0, sizeof (buff));
+    g_assert_cmpint (qof_print_date_dmy_buff (buff, sizeof (buff), tm.tm_mday,
+                     tm.tm_mon + 1, tm.tm_year + 1900),
+                     ==, strlen (buff));
+    g_assert_cmpstr (buff, ==, t_buff);
+
+    test_gnc_setlocale (LC_TIME, "en_GB");
+    tm_set_dmy (&tm, 1974, 11, 23);
+    strftime(t_buff, MAX_DATE_LENGTH, GNC_D_FMT, &tm);
+    memset ((gpointer)buff, 0, sizeof (buff));
+    g_assert_cmpint (qof_print_date_dmy_buff (buff, sizeof (buff), tm.tm_mday,
+                     tm.tm_mon + 1, tm.tm_year + 1900),
+                     ==, strlen (buff));
+    g_assert_cmpstr (buff, ==, t_buff);
+    tm_set_dmy (&tm, 1961, 2, 2);
+    strftime(t_buff, MAX_DATE_LENGTH, GNC_D_FMT, &tm);
+    memset ((gpointer)buff, 0, sizeof (buff));
+    g_assert_cmpint (qof_print_date_dmy_buff (buff, sizeof (buff), tm.tm_mday,
+                     tm.tm_mon + 1, tm.tm_year + 1900),
+                     ==, strlen (buff));
+    g_assert_cmpstr (buff, ==, t_buff);
+    memset ((gpointer)buff, 0, sizeof (buff));
+    tm_set_dmy (&tm, 2045, 6, 16);
+    strftime(t_buff, MAX_DATE_LENGTH, GNC_D_FMT, &tm);
+    memset ((gpointer)buff, 0, sizeof (buff));
+    g_assert_cmpint (qof_print_date_dmy_buff (buff, sizeof (buff), tm.tm_mday,
+                     tm.tm_mon + 1, tm.tm_year + 1900),
+                     ==, strlen (buff));
+    g_assert_cmpstr (buff, ==, t_buff);
+
+    test_gnc_setlocale (LC_TIME, "fr_FR");
+    tm_set_dmy (&tm, 1974, 11, 23);
+    strftime(t_buff, MAX_DATE_LENGTH, GNC_D_FMT, &tm);
+    memset ((gpointer)buff, 0, sizeof (buff));
+    g_assert_cmpint (qof_print_date_dmy_buff (buff, sizeof (buff), tm.tm_mday,
+                     tm.tm_mon + 1, tm.tm_year + 1900),
+                     ==, strlen (buff));
+    g_assert_cmpstr (buff, ==, t_buff);
+    tm_set_dmy (&tm, 1961, 2, 2);
+    strftime(t_buff, MAX_DATE_LENGTH, GNC_D_FMT, &tm);
+    memset ((gpointer)buff, 0, sizeof (buff));
+    g_assert_cmpint (qof_print_date_dmy_buff (buff, sizeof (buff), tm.tm_mday,
+                     tm.tm_mon + 1, tm.tm_year + 1900),
+                     ==, strlen (buff));
+    g_assert_cmpstr (buff, ==, t_buff);
+    memset ((gpointer)buff, 0, sizeof (buff));
+    tm_set_dmy (&tm, 2045, 6, 16);
+    strftime(t_buff, MAX_DATE_LENGTH, GNC_D_FMT, &tm);
+    memset ((gpointer)buff, 0, sizeof (buff));
+    g_assert_cmpint (qof_print_date_dmy_buff (buff, sizeof (buff), tm.tm_mday,
+                     tm.tm_mon + 1, tm.tm_year + 1900),
+                     ==, strlen (buff));
+    g_assert_cmpstr (buff, ==, t_buff);
+
+    setlocale (LC_TIME, locale);
+    g_free (locale);
+}
+
+/* Different distros/OSes define localization date formats. Apple, for
+ * example, uses %d.%m.%Y for fr_FR and %d/%m/%Y for en_GB, while
+ * Debian uses %d/%m/%Y and %d/%m/%y respectively. So to get a test
+ * that works on all of them, we need to check the localized
+ * strftime().
+ *
+ * This is a macro so that the line number in the assert message will
+ * be right.
+ */
+
+#define test_assert_localized_timestring(time, datestr)                 \
+    {                                                                   \
+        gchar t_buff[MAX_DATE_LENGTH];                                  \
+        struct tm *ltime = gnc_localtime ((time64 *)(&time));           \
+        strftime (t_buff, sizeof (t_buff), GNC_D_FMT, ltime);           \
+        gnc_tm_free (ltime);                                            \
+        g_assert_cmpstr (datestr, ==, t_buff);                          \
+    }
+
+
+/* qof_print_date_buff
+size_t
+qof_print_date_buff (char * buff, size_t len, time64 t)// C: 3 in 1  Local: 2:0:0
+*/
+static void
+test_qof_print_date_buff (void)
+{
+    gchar buff[MAX_DATE_LENGTH], ans[MAX_DATE_LENGTH];
+    gchar *locale = g_strdup (setlocale (LC_TIME, NULL));
+
+    time64 time1 = 154440000; //1974-11-23 12:00:00
+    time64 time2 = -281188800; //1961-02-02 12:00:00
+    time64 time3 = 2381227200LL; //2045-06-16 12:00:00
+    struct tm tm1 = {0, 0, 12, 23, 10, 74};
+    struct tm tm2 = {0, 0, 12, 2, 1, 61};
+    struct tm tm3 = {0, 0, 12, 16, 5, 145};
+
+    qof_date_format_set (QOF_DATE_FORMAT_UK);
+    memset ((gpointer)buff, 0, sizeof (buff));
+    g_assert_cmpint (qof_print_date_buff (buff, sizeof (buff), time1),
+                     ==, strlen (buff));
+    g_assert_cmpstr (buff, ==, "23/11/1974");
+    memset ((gpointer)buff, 0, sizeof (buff));
+    g_assert_cmpint (qof_print_date_buff (buff, sizeof (buff), time2),
+                     ==, strlen (buff));
+    g_assert_cmpstr (buff, ==, "02/02/1961");
+
+    memset ((gpointer)buff, 0, sizeof (buff));
+    g_assert_cmpint (qof_print_date_buff (buff, sizeof (buff), time3),
+                     ==, strlen (buff));
+    g_assert_cmpstr (buff, ==, "16/06/2045");
+
+    qof_date_format_set (QOF_DATE_FORMAT_CE);
+    memset ((gpointer)buff, 0, sizeof (buff));
+    g_assert_cmpint (qof_print_date_buff (buff, sizeof (buff), time1),
+                     ==, strlen (buff));
+    g_assert_cmpstr (buff, ==, "23.11.1974");
+    memset ((gpointer)buff, 0, sizeof (buff));
+    g_assert_cmpint (qof_print_date_buff (buff, sizeof (buff), time2),
+                     ==, strlen (buff));
+    g_assert_cmpstr (buff, ==, "02.02.1961");
+
+    memset ((gpointer)buff, 0, sizeof (buff));
+    g_assert_cmpint (qof_print_date_buff (buff, sizeof (buff), time3),
+                     ==, strlen (buff));
+    g_assert_cmpstr (buff, ==, "16.06.2045");
+
+    qof_date_format_set (QOF_DATE_FORMAT_US);
+    memset ((gpointer)buff, 0, sizeof (buff));
+    g_assert_cmpint (qof_print_date_buff (buff, sizeof (buff), time1),
+                     ==, strlen (buff));
+    g_assert_cmpstr (buff, ==, "11/23/1974");
+    memset ((gpointer)buff, 0, sizeof (buff));
+    g_assert_cmpint (qof_print_date_buff (buff, sizeof (buff), time2),
+                     ==, strlen (buff));
+    g_assert_cmpstr (buff, ==, "02/02/1961");
+
+    memset ((gpointer)buff, 0, sizeof (buff));
+    g_assert_cmpint (qof_print_date_buff (buff, sizeof (buff), time3),
+                     ==, strlen (buff));
+    g_assert_cmpstr (buff, ==, "06/16/2045");
+
+    qof_date_format_set (QOF_DATE_FORMAT_ISO);
+    memset ((gpointer)buff, 0, sizeof (buff));
+    g_assert_cmpint (qof_print_date_buff (buff, sizeof (buff), time1),
+                     ==, strlen (buff));
+    g_assert_cmpstr (buff, ==, "1974-11-23");
+    memset ((gpointer)buff, 0, sizeof (buff));
+    g_assert_cmpint (qof_print_date_buff (buff, sizeof (buff), time2),
+                     ==, strlen (buff));
+    g_assert_cmpstr (buff, ==, "1961-02-02");
+
+    memset ((gpointer)buff, 0, sizeof (buff));
+    g_assert_cmpint (qof_print_date_buff (buff, sizeof (buff), time3),
+                     ==, strlen (buff));
+    g_assert_cmpstr (buff, ==, "2045-06-16");
+
+    qof_date_format_set (QOF_DATE_FORMAT_LOCALE);
+    test_gnc_setlocale (LC_TIME, "en_US");
+    memset ((gpointer)buff, 0, sizeof (buff));
+    g_assert_cmpint (qof_print_date_buff (buff, sizeof (buff), time1),
+                     ==, strlen (buff));
+    g_assert_cmpstr (buff, ==, "11/23/1974");
+    memset ((gpointer)buff, 0, sizeof (buff));
+    g_assert_cmpint (qof_print_date_buff (buff, sizeof (buff), time2),
+                     ==, strlen (buff));
+    g_assert_cmpstr (buff, ==, "02/02/1961");
+
+    memset ((gpointer)buff, 0, sizeof (buff));
+    g_assert_cmpint (qof_print_date_buff (buff, sizeof (buff), time3),
+                     ==, strlen (buff));
+    g_assert_cmpstr (buff, ==, "06/16/2045");
+
+    test_gnc_setlocale (LC_TIME, "en_GB");
+    memset ((gpointer)buff, 0, sizeof (buff));
+    g_assert_cmpint (qof_print_date_buff (buff, sizeof (buff), time1),
+                     ==, strlen (buff));
+    strftime(ans, MAX_DATE_LENGTH, GNC_D_FMT, &tm1);
+    g_assert_cmpstr (buff, ==, ans);
+    memset ((gpointer)buff, 0, sizeof (buff));
+    g_assert_cmpint (qof_print_date_buff (buff, sizeof (buff), time2),
+                     ==, strlen (buff));
+    strftime(ans, MAX_DATE_LENGTH, GNC_D_FMT, &tm2);
+    g_assert_cmpstr (buff, ==, ans);
+    memset ((gpointer)buff, 0, sizeof (buff));
+    g_assert_cmpint (qof_print_date_buff (buff, sizeof (buff), time3),
+                     ==, strlen (buff));
+    strftime(ans, MAX_DATE_LENGTH, GNC_D_FMT, &tm3);
+    g_assert_cmpstr (buff, ==, ans);
+
+    test_gnc_setlocale (LC_TIME, "fr_FR");
+    memset ((gpointer)buff, 0, sizeof (buff));
+    g_assert_cmpint (qof_print_date_buff (buff, sizeof (buff), time1),
+                     ==, strlen (buff));
+    strftime(ans, MAX_DATE_LENGTH, GNC_D_FMT, &tm1);
+    g_assert_cmpstr (buff, ==, ans);
+    memset ((gpointer)buff, 0, sizeof (buff));
+    g_assert_cmpint (qof_print_date_buff (buff, sizeof (buff), time2),
+                     ==, strlen (buff));
+    strftime(ans, MAX_DATE_LENGTH, GNC_D_FMT, &tm2);
+    g_assert_cmpstr (buff, ==, ans);
+    memset ((gpointer)buff, 0, sizeof (buff));
+    g_assert_cmpint (qof_print_date_buff (buff, sizeof (buff), time3),
+                     ==, strlen (buff));
+    strftime(ans, MAX_DATE_LENGTH, GNC_D_FMT, &tm3);
+    g_assert_cmpstr (buff, ==, ans);
+
+    setlocale (LC_TIME, locale);
+    g_free (locale);
+}
+/* qof_print_gdate
+size_t
+qof_print_gdate( char *buf, size_t len, const GDate *gd )// C: 6 in 5  Local: 0:0:0
+*/
+static void
+test_qof_print_gdate (void)
+{
+    gchar buff[MAX_DATE_LENGTH], t_buff[MAX_DATE_LENGTH];
+    gchar *locale = g_strdup (setlocale (LC_TIME, NULL));
+    GDate *gd1 = g_date_new_dmy (23, 11, 1974);
+    GDate *gd2 = g_date_new_dmy (2, 2, 1961);
+    GDate *gd3 = g_date_new_dmy (16, 6, 2045);
+
+    qof_date_format_set (QOF_DATE_FORMAT_UK);
+    memset ((gpointer)buff, 0, sizeof (buff));
+    g_assert_cmpint (qof_print_gdate (buff, sizeof (buff), gd1),
+                     ==, strlen (buff));
+    g_assert_cmpstr (buff, ==, "23/11/1974");
+    memset ((gpointer)buff, 0, sizeof (buff));
+    g_assert_cmpint (qof_print_gdate (buff, sizeof (buff), gd2),
+                     ==, strlen (buff));
+    g_assert_cmpstr (buff, ==, "02/02/1961");
+    memset ((gpointer)buff, 0, sizeof (buff));
+    g_assert_cmpint (qof_print_gdate (buff, sizeof (buff), gd3),
+                     ==, strlen (buff));
+    g_assert_cmpstr (buff, ==, "16/06/2045");
+
+    qof_date_format_set (QOF_DATE_FORMAT_CE);
+    memset ((gpointer)buff, 0, sizeof (buff));
+    g_assert_cmpint (qof_print_gdate (buff, sizeof (buff), gd1),
+                     ==, strlen (buff));
+    g_assert_cmpstr (buff, ==, "23.11.1974");
+    memset ((gpointer)buff, 0, sizeof (buff));
+    g_assert_cmpint (qof_print_gdate (buff, sizeof (buff), gd2),
+                     ==, strlen (buff));
+    g_assert_cmpstr (buff, ==, "02.02.1961");
+    memset ((gpointer)buff, 0, sizeof (buff));
+    g_assert_cmpint (qof_print_gdate (buff, sizeof (buff), gd3),
+                     ==, strlen (buff));
+    g_assert_cmpstr (buff, ==, "16.06.2045");
+
+
+    qof_date_format_set (QOF_DATE_FORMAT_US);
+    memset ((gpointer)buff, 0, sizeof (buff));
+    g_assert_cmpint (qof_print_gdate (buff, sizeof (buff), gd1),
+                     ==, strlen (buff));
+    g_assert_cmpstr (buff, ==, "11/23/1974");
+    memset ((gpointer)buff, 0, sizeof (buff));
+    g_assert_cmpint (qof_print_gdate (buff, sizeof (buff), gd2),
+                     ==, strlen (buff));
+    g_assert_cmpstr (buff, ==, "02/02/1961");
+    memset ((gpointer)buff, 0, sizeof (buff));
+    g_assert_cmpint (qof_print_gdate (buff, sizeof (buff), gd3),
+                     ==, strlen (buff));
+    g_assert_cmpstr (buff, ==, "06/16/2045");
+
+
+    qof_date_format_set (QOF_DATE_FORMAT_ISO);
+    memset ((gpointer)buff, 0, sizeof (buff));
+    g_assert_cmpint (qof_print_gdate (buff, sizeof (buff), gd1),
+                     ==, strlen (buff));
+    g_assert_cmpstr (buff, ==, "1974-11-23");
+    memset ((gpointer)buff, 0, sizeof (buff));
+    g_assert_cmpint (qof_print_gdate (buff, sizeof (buff), gd2),
+                     ==, strlen (buff));
+    g_assert_cmpstr (buff, ==, "1961-02-02");
+    memset ((gpointer)buff, 0, sizeof (buff));
+    g_assert_cmpint (qof_print_gdate (buff, sizeof (buff), gd3),
+                     ==, strlen (buff));
+    g_assert_cmpstr (buff, ==, "2045-06-16");
+
+
+    qof_date_format_set (QOF_DATE_FORMAT_LOCALE);
+    test_gnc_setlocale (LC_TIME, "en_US");
+    memset ((gpointer)buff, 0, sizeof (buff));
+    g_assert_cmpint (qof_print_gdate (buff, sizeof (buff), gd1),
+                     ==, strlen (buff));
+    g_date_strftime (t_buff, MAX_DATE_LENGTH, GNC_D_FMT, gd1);
+    g_assert_cmpstr (buff, ==, t_buff);
+    memset ((gpointer)buff, 0, sizeof (buff));
+    g_assert_cmpint (qof_print_gdate (buff, sizeof (buff), gd2),
+                     ==, strlen (buff));
+    g_date_strftime (t_buff, MAX_DATE_LENGTH, GNC_D_FMT, gd2);
+    g_assert_cmpstr (buff, ==, t_buff);
+    memset ((gpointer)buff, 0, sizeof (buff));
+    g_assert_cmpint (qof_print_gdate (buff, sizeof (buff), gd3),
+                     ==, strlen (buff));
+    g_date_strftime (t_buff, MAX_DATE_LENGTH, GNC_D_FMT, gd3);
+    g_assert_cmpstr (buff, ==, t_buff);
+
+    test_gnc_setlocale (LC_TIME, "en_GB");
+    memset ((gpointer)buff, 0, sizeof (buff));
+    g_assert_cmpint (qof_print_gdate (buff, sizeof (buff), gd1),
+                     ==, strlen (buff));
+    g_date_strftime (t_buff, MAX_DATE_LENGTH, GNC_D_FMT, gd1);
+    g_assert_cmpstr (buff, ==, t_buff);
+    memset ((gpointer)buff, 0, sizeof (buff));
+    g_assert_cmpint (qof_print_gdate (buff, sizeof (buff), gd2),
+                     ==, strlen (buff));
+    g_date_strftime (t_buff, MAX_DATE_LENGTH, GNC_D_FMT, gd2);
+    g_assert_cmpstr (buff, ==, t_buff);
+    memset ((gpointer)buff, 0, sizeof (buff));
+    g_assert_cmpint (qof_print_gdate (buff, sizeof (buff), gd3),
+                     ==, strlen (buff));
+    g_date_strftime (t_buff, MAX_DATE_LENGTH, GNC_D_FMT, gd3);
+    g_assert_cmpstr (buff, ==, t_buff);
+
+
+    test_gnc_setlocale (LC_TIME, "fr_FR");
+    memset ((gpointer)buff, 0, sizeof (buff));
+    g_assert_cmpint (qof_print_gdate (buff, sizeof (buff), gd1),
+                     ==, strlen (buff));
+    g_date_strftime (t_buff, MAX_DATE_LENGTH, GNC_D_FMT, gd1);
+    g_assert_cmpstr (buff, ==, t_buff);
+    memset ((gpointer)buff, 0, sizeof (buff));
+    g_assert_cmpint (qof_print_gdate (buff, sizeof (buff), gd2),
+                     ==, strlen (buff));
+    g_date_strftime (t_buff, MAX_DATE_LENGTH, GNC_D_FMT, gd2);
+    g_assert_cmpstr (buff, ==, t_buff);
+    memset ((gpointer)buff, 0, sizeof (buff));
+    g_assert_cmpint (qof_print_gdate (buff, sizeof (buff), gd3),
+                     ==, strlen (buff));
+    g_date_strftime (t_buff, MAX_DATE_LENGTH, GNC_D_FMT, gd3);
+    g_assert_cmpstr (buff, ==, t_buff);
+
+    setlocale (LC_TIME, locale);
+    g_free (locale);
+    g_date_free (gd1);
+    g_date_free (gd2);
+    g_date_free (gd3);
+}
+
+#define test_assert_qof_print_date(time, datestr)  \
+    {                                              \
+        gchar *buf = qof_print_date (time);        \
+        g_assert_cmpstr (buf, ==, datestr);        \
+        g_free (buf);                              \
+    }
+
+#define test_assert_qof_print_date_outside_range(time, datestr)  \
+    {                                              \
+        gchar *buf = qof_print_date (time);        \
+        g_assert_cmpstr (buf, ==, datestr);        \
+        g_free (buf);                              \
+    }
+
+#define test_assert_localized_qof_print_date(time)           \
+    {                                                        \
+        gchar *buf = qof_print_date (time);                  \
+        test_assert_localized_timestring (time, buf);        \
+        g_free (buf);                                        \
+    }
+
+/* qof_print_date
+char *
+qof_print_date (time64 t)// C: 29 in 13  Local: 0:0:0
+*/
+static void
+test_qof_print_date (void)
+{
+    gchar *locale = g_strdup (setlocale (LC_TIME, NULL));
+    char ans[MAX_DATE_LENGTH];
+    time64 time1 = 154440000; //1974-11-23 12:00:00
+    time64 time2 = -281188800; //1961-02-02 12:00:00
+    time64 time3 = 2381227200LL; //2045-06-16 12:00:00
+    struct tm tm1 = {0, 0, 12, 23, 10, 74};
+    struct tm tm2 = {0, 0, 12, 2, 1, 61};
+    struct tm tm3 = {0, 0, 12, 16, 5, 145};
+
+    qof_date_format_set (QOF_DATE_FORMAT_UK);
+    test_assert_qof_print_date (time1, "23/11/1974");
+    test_assert_qof_print_date_outside_range (time2, "02/02/1961");
+    test_assert_qof_print_date_outside_range (time3, "16/06/2045");
+
+    qof_date_format_set (QOF_DATE_FORMAT_CE);
+    test_assert_qof_print_date (time1, "23.11.1974");
+    test_assert_qof_print_date_outside_range (time2, "02.02.1961");
+    test_assert_qof_print_date_outside_range (time3, "16.06.2045");
+
+    qof_date_format_set (QOF_DATE_FORMAT_US);
+    test_assert_qof_print_date (time1, "11/23/1974");
+    test_assert_qof_print_date_outside_range (time2, "02/02/1961");
+    test_assert_qof_print_date_outside_range (time3, "06/16/2045");
+
+    qof_date_format_set (QOF_DATE_FORMAT_ISO);
+    test_assert_qof_print_date (time1, "1974-11-23");
+    test_assert_qof_print_date_outside_range (time2, "1961-02-02");
+    test_assert_qof_print_date_outside_range (time3, "2045-06-16");
+
+    qof_date_format_set (QOF_DATE_FORMAT_LOCALE);
+    test_gnc_setlocale (LC_TIME, "en_US");
+    strftime(ans, MAX_DATE_LENGTH, GNC_D_FMT, &tm1);
+    test_assert_qof_print_date (time1,ans);
+    strftime(ans, MAX_DATE_LENGTH, GNC_D_FMT, &tm2);
+    test_assert_qof_print_date_outside_range (time2, ans);
+    strftime(ans, MAX_DATE_LENGTH, GNC_D_FMT, &tm3);
+    test_assert_qof_print_date_outside_range (time3, ans);
+
+    test_gnc_setlocale (LC_TIME, "en_GB");
+    strftime(ans, MAX_DATE_LENGTH, GNC_D_FMT, &tm1);
+    test_assert_qof_print_date (time1, ans);
+    strftime(ans, MAX_DATE_LENGTH, GNC_D_FMT, &tm2);
+    test_assert_qof_print_date_outside_range (time2, ans);
+    strftime(ans, MAX_DATE_LENGTH, GNC_D_FMT, &tm3);
+    test_assert_qof_print_date_outside_range (time3, ans);
+
+    test_gnc_setlocale (LC_TIME, "fr_FR");
+    strftime(ans, MAX_DATE_LENGTH, GNC_D_FMT, &tm1);
+    test_assert_qof_print_date (time1, ans);
+    strftime(ans, MAX_DATE_LENGTH, GNC_D_FMT, &tm2);
+    test_assert_qof_print_date_outside_range (time2, ans);
+    strftime(ans, MAX_DATE_LENGTH, GNC_D_FMT, &tm3);
+    test_assert_qof_print_date_outside_range (time3,ans);
+
+    setlocale (LC_TIME, locale);
+    g_free (locale);
+}
+/* gnc_print_date
+const char *
+gnc_print_date (Timespec ts)// C: 11 in 9 SCM: 166 in 59 Local: 0:0:0
+*/
+static void
+test_gnc_print_date (void)
+{
+    gchar t_buff[MAX_DATE_LENGTH];
+    gchar *locale = g_strdup (setlocale (LC_TIME, NULL));
+    GDate *gd1 = g_date_new_dmy (23, 11, 1974);
+    GDate *gd2 = g_date_new_dmy (2, 2, 1961);
+    GDate *gd3 = g_date_new_dmy (16, 6, 2045);
+    Timespec tm1 = gdate_to_timespec (*gd1);
+    Timespec tm2 = gdate_to_timespec (*gd2);
+    Timespec tm3 = gdate_to_timespec (*gd3);
+
+
+    qof_date_format_set (QOF_DATE_FORMAT_UK);
+    g_assert_cmpstr (gnc_print_date (tm1), ==, "23/11/1974");
+    g_assert_cmpstr (gnc_print_date (tm2), ==, "02/02/1961");
+    g_assert_cmpstr (gnc_print_date (tm3), ==, "16/06/2045");
+
+    qof_date_format_set (QOF_DATE_FORMAT_CE);
+    g_assert_cmpstr (gnc_print_date (tm1), ==, "23.11.1974");
+    g_assert_cmpstr (gnc_print_date (tm2), ==, "02.02.1961");
+    g_assert_cmpstr (gnc_print_date (tm3), ==, "16.06.2045");
+
+    qof_date_format_set (QOF_DATE_FORMAT_US);
+    g_assert_cmpstr (gnc_print_date (tm1), ==, "11/23/1974");
+    g_assert_cmpstr (gnc_print_date (tm2), ==, "02/02/1961");
+    g_assert_cmpstr (gnc_print_date (tm3), ==, "06/16/2045");
+
+    qof_date_format_set (QOF_DATE_FORMAT_ISO);
+    g_assert_cmpstr (gnc_print_date (tm1), ==, "1974-11-23");
+    g_assert_cmpstr (gnc_print_date (tm2), ==, "1961-02-02");
+    g_assert_cmpstr (gnc_print_date (tm3), ==, "2045-06-16");
+
+    qof_date_format_set (QOF_DATE_FORMAT_LOCALE);
+    test_gnc_setlocale (LC_TIME, "en_US");
+    g_date_strftime (t_buff, MAX_DATE_LENGTH, GNC_D_FMT, gd1);
+    g_assert_cmpstr (gnc_print_date (tm1), ==, t_buff);
+    g_date_strftime (t_buff, MAX_DATE_LENGTH, GNC_D_FMT, gd2);
+    g_assert_cmpstr (gnc_print_date (tm2), ==, t_buff);
+    g_date_strftime (t_buff, MAX_DATE_LENGTH, GNC_D_FMT, gd3);
+    g_assert_cmpstr (gnc_print_date (tm3), ==, t_buff);
+
+    test_gnc_setlocale (LC_TIME, "en_GB");
+    g_date_strftime (t_buff, MAX_DATE_LENGTH, GNC_D_FMT, gd1);
+    g_assert_cmpstr (gnc_print_date (tm1), ==, t_buff);
+    g_date_strftime (t_buff, MAX_DATE_LENGTH, GNC_D_FMT, gd2);
+    g_assert_cmpstr (gnc_print_date (tm2), ==, t_buff);
+    g_date_strftime (t_buff, MAX_DATE_LENGTH, GNC_D_FMT, gd3);
+    g_assert_cmpstr (gnc_print_date (tm3), ==, t_buff);
+
+    test_gnc_setlocale (LC_TIME, "fr_FR");
+    g_date_strftime (t_buff, MAX_DATE_LENGTH, GNC_D_FMT, gd1);
+    g_assert_cmpstr (gnc_print_date (tm1), ==, t_buff);
+    g_date_strftime (t_buff, MAX_DATE_LENGTH, GNC_D_FMT, gd2);
+    g_assert_cmpstr (gnc_print_date (tm2), ==, t_buff);
+    g_date_strftime (t_buff, MAX_DATE_LENGTH, GNC_D_FMT, gd3);
+    g_assert_cmpstr (gnc_print_date (tm3), ==, t_buff);
+
+    setlocale (LC_TIME, locale);
+    g_free (locale);
+    g_date_free (gd1);
+    g_date_free (gd2);
+    g_date_free (gd3);
+}
+/* floordiv
+static int
+floordiv(int a, int b)// Local: 1:0:0
+*/
+/* static void
+test_floordiv (void)
+{
+}*/
+/* qof_scan_date_internal
+qof_scan_date just does passes this through, passing the pre-set QOF_DATE_FORMAT, so we test there rather than exposing this via Testfuncs.
+qof_scan_date_internal (const char *buff, int *day, int *month, int *year,// Local: 3:0:0
+*/
+/* static void
+test_qof_scan_date_internal (void)
+{
+} */
+/* qof_scan_date
+gboolean
+qof_scan_date (const char *buff, int *day, int *month, int *year)// C: 7 in 3  Local: 0:0:0
+*/
+static void
+test_qof_scan_date (void)
+{
+    gchar *locale = g_strdup (setlocale (LC_TIME, NULL));
+    int day = 0, mo = 0, yr = 0;
+    gint year, month;
+    time64 now = gnc_time(NULL);
+    gchar buff[MAX_DATE_LENGTH];
+    struct tm tm = { 0, 0, 0, 0, 0, 0, 0, 0, 0
+#ifndef G_OS_WIN32
+        , 0, 0
+#endif
+    };
+    gnc_localtime_r(&now, &tm);
+    year = tm.tm_year + 1900;
+    month = tm.tm_mon + 1;
+
+    g_assert (!qof_scan_date (NULL, &day, &mo, &yr));
+    g_assert_cmpint (day, ==, 0);
+    g_assert_cmpint (mo, ==, 0);
+    g_assert_cmpint (yr, ==, 0);
+
+    qof_date_format_set (QOF_DATE_FORMAT_UTC);
+    g_assert (qof_scan_date ("1974-11-23", &day, &mo, &yr));
+    g_assert_cmpint (day, ==, 23);
+    g_assert_cmpint (mo, ==, 11);
+    g_assert_cmpint (yr, ==, 1974);
+
+    g_assert (qof_scan_date ("1961-2-2", &day, &mo, &yr));
+    g_assert_cmpint (day, ==, 2);
+    g_assert_cmpint (mo, ==, 2);
+    g_assert_cmpint (yr, ==, 1961);
+
+    g_assert (qof_scan_date ("2045-6-16", &day, &mo, &yr));
+    g_assert_cmpint (day, ==, 16);
+    g_assert_cmpint (mo, ==, 6);
+    g_assert_cmpint (yr, ==, 2045);
+
+    qof_date_format_set (QOF_DATE_FORMAT_US);
+    g_assert (qof_scan_date ("11/23/1974", &day, &mo, &yr));
+    g_assert_cmpint (day, ==, 23);
+    g_assert_cmpint (mo, ==, 11);
+    g_assert_cmpint (yr, ==, 1974);
+
+    g_assert (qof_scan_date ("2/2/1961", &day, &mo, &yr));
+    g_assert_cmpint (day, ==, 2);
+    g_assert_cmpint (mo, ==, 2);
+    g_assert_cmpint (yr, ==, 1961);
+
+    g_assert (qof_scan_date ("6/16/2045", &day, &mo, &yr));
+    g_assert_cmpint (day, ==, 16);
+    g_assert_cmpint (mo, ==, 6);
+    g_assert_cmpint (yr, ==, 2045);
+
+    g_assert (qof_scan_date ("11ì›”23ë…„1974", &day, &mo, &yr));
+    g_assert_cmpint (day, ==, 23);
+    g_assert_cmpint (mo, ==, 11);
+    g_assert_cmpint (yr, ==, 1974);
+
+    g_assert (qof_scan_date ("11月23年1974", &day, &mo, &yr));
+    g_assert_cmpint (day, ==, 23);
+    g_assert_cmpint (mo, ==, 11);
+    g_assert_cmpint (yr, ==, 1974);
+
+    qof_date_completion_set (QOF_DATE_COMPLETION_THISYEAR, 0);
+
+    g_assert (qof_scan_date ("11-23", &day, &mo, &yr));
+    g_assert_cmpint (day, ==, 23);
+    g_assert_cmpint (mo, ==, 11);
+    g_assert_cmpint (yr, ==, year);
+
+    g_assert (qof_scan_date ("23-11", &day, &mo, &yr));
+    g_assert_cmpint (day, ==, 23);
+    g_assert_cmpint (mo, ==, 11);
+    g_assert_cmpint (yr, ==, year);
+
+    if (month < 10) /* Sliding window won't test well after October */
+    {
+        qof_date_completion_set (QOF_DATE_COMPLETION_SLIDING, month + 1);
+
+        g_assert (qof_scan_date ("12-23", &day, &mo, &yr));
+        g_assert_cmpint (day, ==, 23);
+        g_assert_cmpint (mo, ==, 12);
+        g_assert_cmpint (yr, ==, year - 1);
+
+        qof_date_completion_set (QOF_DATE_COMPLETION_THISYEAR, 0);
+    }
+
+    qof_date_format_set (QOF_DATE_FORMAT_UK);
+    g_assert (qof_scan_date ("23/11/1974", &day, &mo, &yr));
+    g_assert_cmpint (day, ==, 23);
+    g_assert_cmpint (mo, ==, 11);
+    g_assert_cmpint (yr, ==, 1974);
+
+    g_assert (qof_scan_date ("2/2/1961", &day, &mo, &yr));
+    g_assert_cmpint (day, ==, 2);
+    g_assert_cmpint (mo, ==, 2);
+    g_assert_cmpint (yr, ==, 1961);
+
+    g_assert (qof_scan_date ("16/6/2045", &day, &mo, &yr));
+    g_assert_cmpint (day, ==, 16);
+    g_assert_cmpint (mo, ==, 6);
+    g_assert_cmpint (yr, ==, 2045);
+
+    qof_date_format_set (QOF_DATE_FORMAT_LOCALE);
+    test_gnc_setlocale (LC_TIME, "en_GB");
+    tm_set_dmy (&tm, 1974, 11, 23);
+    strftime (buff, MAX_DATE_LENGTH, GNC_D_FMT, &tm);
+    g_assert (qof_scan_date (buff, &day, &mo, &yr));
+    g_assert_cmpint (day, ==, tm.tm_mday);
+    g_assert_cmpint (mo, ==, tm.tm_mon + 1);
+    g_assert_cmpint (yr, ==, tm.tm_year + 1900);
+
+    tm_set_dmy (&tm, 1961,2, 2);
+    strftime (buff, MAX_DATE_LENGTH, GNC_D_FMT, &tm);
+    g_assert (qof_scan_date (buff, &day, &mo, &yr));
+    g_assert_cmpint (day, ==, tm.tm_mday);
+    g_assert_cmpint (mo, ==, tm.tm_mon + 1);
+    /* Some locale date formats result in a 2-digit year, which strptime
+     * interprets as being in the current century.
+     */
+    g_assert_cmpint (yr % 100, ==, tm.tm_year % 100);
+
+    tm_set_dmy (&tm, 2045, 6, 16);
+    strftime (buff, MAX_DATE_LENGTH, GNC_D_FMT, &tm);
+    g_assert (qof_scan_date (buff, &day, &mo, &yr));
+    g_assert_cmpint (day, ==, tm.tm_mday);
+    g_assert_cmpint (mo, ==, tm.tm_mon + 1);
+    g_assert_cmpint (yr, ==, tm.tm_year + 1900);
+
+    setlocale (LC_TIME, locale);
+    g_free (locale);
+}
+/* dateSeparator
+return date character
+char dateSeparator (void)// C: 1  Local: 0:0:0
+src/register/register-gnome/datecell-gnome.h
+*/
+/* static void
+test_dateSeparator (void)
+{
+}*/
+/* qof_time_format_from_utf8
+gchar *
+qof_time_format_from_utf8(const gchar *utf8_format)// C: 1  Local: 1:0:0
+*/
+/* static void
+test_qof_time_format_from_utf8 (void)
+{
+}*/
+/* qof_formatted_time_to_utf8
+gchar *
+qof_formatted_time_to_utf8(const gchar *locale_string)// C: 1  Local: 1:0:0
+*/
+/* static void
+test_qof_formatted_time_to_utf8 (void)
+{
+}*/
+/* qof_format_time
+static gchar *
+qof_format_time(const gchar *format, const struct tm *tm)// Local: 1:0:0
+*/
+/* static void
+test_qof_format_time (void)
+{
+}*/
+/* qof_strftime
+gsize
+qof_strftime(gchar *buf, gsize max, const gchar *format, const struct tm *tm)// C: 16 in 9  Local: 5:0:0
+*/
+/* static void
+test_qof_strftime (void)
+{
+}*/
+/* gnc_date_timestamp
+gchar *
+gnc_date_timestamp (void)// C: 2 in 2  Local: 0:0:0
+*/
+static void
+test_gnc_date_timestamp (void)
+{
+    time64 now = gnc_time(NULL);
+    gchar *timestr = gnc_date_timestamp ();
+    struct tm tm0, tm1;
+    gnc_localtime_r(&now, &tm0);
+    g_assert (strptime (timestr, "%Y%m%d%H%M%S", &tm1));
+    g_assert_cmpint (tm0.tm_year, ==, tm1.tm_year);
+    g_assert_cmpint (tm0.tm_mon, ==, tm1.tm_mon);
+    g_assert_cmpint (tm0.tm_mday, ==, tm1.tm_mday);
+    g_assert_cmpint (tm0.tm_hour, ==, tm1.tm_hour);
+    g_assert_cmpint (tm0.tm_min, ==, tm1.tm_min);
+    g_assert_cmpint (tm0.tm_sec, ==, tm1.tm_sec);
+
+    g_free (timestr);
+}
+/* gnc_iso8601_to_timespec_gmt
+Timespec
+gnc_iso8601_to_timespec_gmt(const char *str)// C: 6 in 3  Local: 0:0:0
+*/
+static gint
+get_nanoseconds (GDateTime *gdt)
+{
+    return g_date_time_get_microsecond (gdt) * 1000;
+}
+
+static void
+test_gnc_iso8601_to_timespec_gmt (FixtureA *f, gconstpointer pData)
+{
+    Timespec t;
+
+    t = gnc_iso8601_to_timespec_gmt (NULL);
+    g_assert_cmpint (t.tv_sec, ==, 0);
+    g_assert_cmpint (t.tv_nsec, ==, 0);
+
+    t = gnc_iso8601_to_timespec_gmt ("");
+    g_assert_cmpint (t.tv_sec, ==, 0);
+    g_assert_cmpint (t.tv_nsec, ==, 0);
+
+    t = gnc_iso8601_to_timespec_gmt ("1989-03-27 13:43:27");
+    g_assert_cmpint (t.tv_sec, ==, f->ts1.tv_sec);
+    /* MinGW has some precision issues in the last microsecond digit */
+#ifdef G_OS_WIN32
+    g_assert_cmpint (t.tv_nsec - 2000, <=, f->ts1.tv_nsec);
+    g_assert_cmpint (t.tv_nsec + 2000, >=, f->ts1.tv_nsec);
+#else
+    g_assert_cmpint (t.tv_nsec, ==, f->ts1.tv_nsec);
+#endif
+    t = gnc_iso8601_to_timespec_gmt ("2020-11-07 06:21:19 -05");
+    g_assert_cmpint (t.tv_sec, ==, f->ts2.tv_sec);
+    g_assert_cmpint (t.tv_nsec, ==, f->ts2.tv_nsec);
+
+    t = gnc_iso8601_to_timespec_gmt ("2012-07-04 19:27:44.0+08:40");
+    g_assert_cmpint (t.tv_sec, ==, f->ts3.tv_sec);
+    g_assert_cmpint (t.tv_nsec, ==, f->ts3.tv_nsec);
+
+    t = gnc_iso8601_to_timespec_gmt ("1961-09-22 17:53:19 -05");
+    g_assert_cmpint (t.tv_sec, ==, f->ts4.tv_sec);
+    g_assert_cmpint (t.tv_nsec, ==, f->ts4.tv_nsec);
+
+    t = gnc_iso8601_to_timespec_gmt ("2061-01-25 23:21:19.0 -05:00");
+    g_assert_cmpint (t.tv_sec, ==, f->ts5.tv_sec);
+    g_assert_cmpint (t.tv_nsec, ==, f->ts5.tv_nsec);
+}
+/* gnc_timespec_to_iso8601_buff
+char *
+gnc_timespec_to_iso8601_buff (Timespec ts, char * buff)// C: 18 in 7  Local: 0:0:0
+*/
+static Timespec
+g_date_time_to_timespec (GDateTime *gdt)
+{
+    Timespec t;
+    t.tv_sec = g_date_time_to_unix (gdt);
+    t.tv_nsec = g_date_time_get_microsecond (gdt) * 1000;
+    return t;
+}
+
+#define ISO8601_SIZE MAX_DATE_LENGTH + 4
+static gchar*
+format_timestring (Timespec ts, TZOffset tz)
+{
+  static const unsigned tzlen = MAX_DATE_LENGTH - 26;
+    char *fmt = "%Y-%m-%d %H:%M:%S";
+    struct tm tm;
+    char buf[MAX_DATE_LENGTH], *retval;
+    char tzbuf[tzlen];
+    memset(tzbuf, 0, sizeof(tzbuf));
+    gnc_localtime_r(&ts.tv_sec, &tm);
+#if PLATFORM(WINDOWS)
+    strftime(tzbuf, sizeof(tzbuf), "%Z", &tm);
+#else
+    strftime(tzbuf, sizeof(tzbuf), "%z", &tm);
+#endif
+    memset (buf, 0, sizeof(buf));
+    strftime(buf, sizeof(buf), fmt, &tm);
+    retval = g_strdup_printf ("%s.%06ld %s", buf, ts.tv_nsec / 1000, tzbuf);
+
+    return retval;
+}
+
+static void
+test_gnc_timespec_to_iso8601_buff (FixtureA *f, gconstpointer pData)
+{
+
+    gchar buff[ISO8601_SIZE];
+    gchar *time_str;
+    Timespec t = { 0, 0 };
+    gchar *end;
+
+    memset (buff, 0, sizeof buff);
+
+    end = gnc_timespec_to_iso8601_buff (t, NULL);
+    g_assert (end == NULL);
+
+    end = gnc_timespec_to_iso8601_buff (f->ts0, buff);
+    g_assert_cmpint (end - buff, ==, strlen (buff));
+    time_str = format_timestring (f->ts0, f->off_zulu);
+    g_assert_cmpstr (buff, ==, time_str);
+    g_free (time_str);
+
+    end = gnc_timespec_to_iso8601_buff (f->ts1, buff);
+    time_str = format_timestring (f->ts1, f->off_zulu);
+    g_assert_cmpstr (buff, ==, time_str);
+    g_free (time_str);
+
+
+    end = gnc_timespec_to_iso8601_buff (f->ts2, buff);
+    time_str = format_timestring (f->ts2, f->off_05w);
+    g_assert_cmpstr (buff, ==, time_str);
+    g_free (time_str);
+
+    end = gnc_timespec_to_iso8601_buff (f->ts3, buff);
+    time_str = format_timestring (f->ts3, f->off_0840e);
+    g_assert_cmpstr (buff, ==, time_str);
+    g_free (time_str);
+
+    end = gnc_timespec_to_iso8601_buff (f->ts4, buff);
+    time_str = format_timestring (f->ts4, f->off_05w);
+    g_assert_cmpstr (buff, ==, time_str);
+    g_free (time_str);
+
+    end = gnc_timespec_to_iso8601_buff (f->ts5, buff);
+    time_str = format_timestring (f->ts5, f->off_05w);
+    g_assert_cmpstr (buff, ==, time_str);
+    g_free (time_str);
+}
+/* gnc_timespec2dmy
+void
+gnc_timespec2dmy (Timespec t, int *day, int *month, int *year)// C: 1  Local: 0:0:0
+*/
+static void
+test_gnc_timespec2dmy (FixtureA *f, gconstpointer pData)
+{
+    struct tm tm;
+    int day, r_day, mo, r_mo, yr, r_yr;
+
+
+    gnc_timespec2dmy (f->ts0, &r_day, &r_mo, &r_yr);
+    gnc_localtime_r (&f->ts0.tv_sec, &tm);
+    g_assert_cmpint (r_day, ==, tm.tm_mday);
+    g_assert_cmpint (r_mo, ==, tm.tm_mon + 1);
+    g_assert_cmpint (r_yr, ==, tm.tm_year + 1900);
+
+    gnc_timespec2dmy (f->ts1, &r_day, &r_mo, &r_yr);
+    gnc_localtime_r (&f->ts1.tv_sec, &tm);
+    g_assert_cmpint (r_day, ==, tm.tm_mday);
+    g_assert_cmpint (r_mo, ==, tm.tm_mon + 1);
+    g_assert_cmpint (r_yr, ==, tm.tm_year + 1900);
+
+    gnc_timespec2dmy (f->ts2, &r_day, &r_mo, &r_yr);
+    gnc_localtime_r (&f->ts2.tv_sec, &tm);
+    g_assert_cmpint (r_day, ==, tm.tm_mday);
+    g_assert_cmpint (r_mo, ==, tm.tm_mon + 1);
+    g_assert_cmpint (r_yr, ==, tm.tm_year + 1900);
+
+    gnc_timespec2dmy (f->ts3, &r_day, &r_mo, &r_yr);
+    gnc_localtime_r (&f->ts3.tv_sec, &tm);
+    g_assert_cmpint (r_day, ==, tm.tm_mday);
+    g_assert_cmpint (r_mo, ==, tm.tm_mon + 1);
+    g_assert_cmpint (r_yr, ==, tm.tm_year + 1900);
+
+    gnc_timespec2dmy (f->ts4, &r_day, &r_mo, &r_yr);
+    gnc_localtime_r (&f->ts4.tv_sec, &tm);
+    g_assert_cmpint (r_day, ==, tm.tm_mday);
+    g_assert_cmpint (r_mo, ==, tm.tm_mon + 1);
+    g_assert_cmpint (r_yr, ==, tm.tm_year + 1900);
+
+    gnc_timespec2dmy (f->ts5, &r_day, &r_mo, &r_yr);
+    gnc_localtime_r (&f->ts5.tv_sec, &tm);
+    g_assert_cmpint (r_day, ==, tm.tm_mday);
+    g_assert_cmpint (r_mo, ==, tm.tm_mon + 1);
+    g_assert_cmpint (r_yr, ==, tm.tm_year + 1900);
+
+}
+/* gnc_dmy2timespec_internal
+static Timespec
+gnc_dmy2timespec_internal (int day, int month, int year, gboolean start_of_day)// Local: 2:0:0
+*/
+/* static void
+test_gnc_dmy2timespec_internal (void)
+{
+}*/
+/* gnc_dmy2timespec
+Timespec
+gnc_dmy2timespec (int day, int month, int year)// C: 8 in 5  Local: 1:0:0
+*/
+static void
+test_gnc_dmy2timespec (FixtureB *f, gconstpointer pData)
+{
+    gchar *msg1 = "[qof_dmy2timespec()] Date computation error from Y-M-D 1257-7-2: Time value is outside the supported year range.";
+    gint loglevel = G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_FATAL;
+    gchar *logdomain = "qof.engine";
+    TestErrorStruct check = {loglevel, logdomain, msg1, 0};
+    GLogFunc hdlr = g_log_set_default_handler ((GLogFunc)test_null_handler, &check);
+    g_test_log_set_fatal_handler ((GTestLogFatalFunc)test_checked_handler, &check);
+    for (int i = 0; i < sizeof(f->test)/sizeof(TimeMap); ++i)
+    {
+#ifdef HAVE_STRUCT_TM_GMTOFF
+        struct tm tm = {0, 0, 0, f->test[i].day, f->test[i].mon - 1,
+                        f->test[i].yr - 1900, 0, 0, -1, 0, NULL};
+#else
+        struct tm tm = {0, 0, 0, f->test[i].day, f->test[i].mon - 1,
+                        f->test[i].yr - 1900, 0, 0, -1};
+#endif
+        Timespec r_t = gnc_dmy2timespec (f->test[i].day, f->test[i].mon,
+                                         f->test[i].yr);
+        int offset = gnc_mktime(&tm) - gnc_timegm(&tm);
+        if (f->test[i].secs == INT64_MAX)
+            /* We use INT64_MAX as invalid timespec.secs.
+             * As we can't *add* to the max, we can ignore the tz offset in this case. */
+            g_assert_cmpint (r_t.tv_sec, ==, INT64_MAX);
+        else
+            g_assert_cmpint (r_t.tv_sec, ==, f->test[i].secs + offset);
+    }
+    g_log_set_default_handler (hdlr, 0);
+}
+/* gnc_dmy2timespec_end
+Timespec
+gnc_dmy2timespec_end (int day, int month, int year)// C: 1  Local: 0:0:0
+*/
+static void
+test_gnc_dmy2timespec_end (FixtureB *f, gconstpointer pData)
+{
+    gchar *msg1 = "[qof_dmy2timespec_end()] Date computation error from Y-M-D 1257-7-2: Time value is outside the supported year range.";
+    gint loglevel = G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_FATAL;
+    gchar *logdomain = "qof.engine";
+    TestErrorStruct check = {loglevel, logdomain, msg1, 0};
+    GLogFunc hdlr = g_log_set_default_handler ((GLogFunc)test_null_handler, &check);
+    g_test_log_set_fatal_handler ((GTestLogFatalFunc)test_checked_handler, &check);
+    for (int i = 0; i < sizeof(f->test)/sizeof(TimeMap); ++i)
+    {
+#ifdef HAVE_STRUCT_TM_GMTOFF
+        struct tm tm = {59, 59, 23, f->test[i].day, f->test[i].mon - 1,
+                        f->test[i].yr - 1900, 0, 0, -1, 0, NULL};
+#else
+        struct tm tm = {59, 59, 23, f->test[i].day, f->test[i].mon - 1,
+                        f->test[i].yr - 1900, 0, 0, -1};
+#endif
+        Timespec r_t = gnc_dmy2timespec_end (f->test[i].day, f->test[i].mon,
+                                             f->test[i].yr);
+        int offset = gnc_mktime(&tm) - gnc_timegm(&tm);
+        if (f->test[i].secs == INT64_MAX)
+            /* We use INT64_MAX as invalid timespec.secs.
+             * As we can't *add* to the max, we can ignore the tz offset in this case. */
+            g_assert_cmpint (r_t.tv_sec, ==, INT64_MAX);
+        else
+            g_assert_cmpint (r_t.tv_sec, ==, f->test[i].secs + offset);
+    }
+    g_log_set_default_handler (hdlr, 0);
+}
+
+static GDateTime*
+offset_adjust(GDateTime *gdt)
+{
+     Testfuncs *tf = gnc_date_load_funcs();
+     GTimeZone *zone = tf->timezone_new_local();
+     int interval = g_time_zone_find_interval(zone, G_TIME_TYPE_STANDARD,
+					      g_date_time_to_unix(gdt));
+     int offset = g_time_zone_get_offset(zone, interval) / 60;
+     int off_hr = (offset / 60) + (offset % 60 ? (offset < 0 ? -1 : 1) : 0);
+     int correction = off_hr < -10 ? -10 - off_hr : off_hr > 13 ? 13 - off_hr : 0;
+     GDateTime* new_gdt = g_date_time_add_hours(gdt, correction);
+     g_date_time_unref(gdt);
+     g_slice_free(Testfuncs, tf);
+     return new_gdt;
+}
+
+/*gnc_dmy2timespec_neutral*/
+static void
+test_gnc_dmy2timespec_neutral (FixtureB *f, gconstpointer pData)
+{
+    gchar *msg1 = "[qof_dmy2timespec_neutral()] Date computation error from Y-M-D 1257-7-2: Time value is outside the supported year range.";
+    gint loglevel = G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_FATAL;
+    gchar *logdomain = "qof.engine";
+    TestErrorStruct check = {loglevel, logdomain, msg1, 0};
+    GLogFunc hdlr = g_log_set_default_handler ((GLogFunc)test_null_handler, &check);
+    g_test_log_set_fatal_handler ((GTestLogFatalFunc)test_checked_handler, &check);
+    for (int i = 0; i < sizeof(f->test)/sizeof(TimeMap); ++i)
+    {
+        Timespec r_t = gnc_dmy2timespec_neutral (f->test[i].day, f->test[i].mon,
+                                             f->test[i].yr);
+
+        g_assert_cmpint (r_t.tv_sec, ==, f->test[i].secs);
+    }
+    g_log_set_default_handler (hdlr, 0);
+}
+
+/* gnc_timezone
+long int
+gnc_timezone (const struct tm *tm)// C: 5 in 2  Local: 2:0:0
+*/
+/* static void
+test_gnc_timezone (void)
+{
+}*/
+/* timespecFromTime64
+void
+timespecFromTime64( Timespec *ts, time64 t )// C: 22 in 11  Local: 0:0:0
+*/
+static void
+test_timespecFromTime64 (void)
+{
+     Timespec ts = {-9999, 0};
+     timespecFromTime64 (&ts, MINTIME - 1);
+     g_assert_cmpint (0, ==, ts.tv_sec);
+     timespecFromTime64 (&ts, MINTIME + 1);
+     g_assert_cmpint (MINTIME + 1, ==, ts.tv_sec);
+     timespecFromTime64 (&ts, MAXTIME + 1);
+     g_assert_cmpint (MAXTIME, ==, ts.tv_sec);
+     timespecFromTime64 (&ts, MAXTIME - 1);
+     g_assert_cmpint (MAXTIME - 1, ==, ts.tv_sec);
+}
+/* timespec_now
+Timespec
+timespec_now()// C: 2 in 2  Local: 0:0:0
+*/
+/* static void
+test_timespec_now (void)
+{
+}*/
+/* timespecTotime64
+time64
+timespecTotime64 (Timespec ts)// C: 10 in 6  Local: 1:0:0
+*/
+/* static void
+test_timespecTotime64 (void)
+{
+}*/
+/* timespec_to_gdate
+GDate timespec_to_gdate (Timespec ts)// C: 5 in 4  Local: 0:0:0
+*/
+static void
+test_timespec_to_gdate (FixtureA *f, gconstpointer pData)
+{
+    GDate date1, date2;
+    struct tm tm;
+
+    g_date_clear (&date2, 1);
+
+    date1 = timespec_to_gdate (f->ts0);
+    gnc_localtime_r(&f->ts0.tv_sec, &tm);
+    g_date_set_dmy (&date2, tm.tm_mday, tm.tm_mon + 1, tm.tm_year + 1900);
+    g_assert_cmpint (g_date_get_julian (&date1), ==,
+                     g_date_get_julian (&date2));
+
+    date1 = timespec_to_gdate (f->ts1);
+    gnc_localtime_r(&f->ts1.tv_sec, &tm);
+    g_date_set_dmy (&date2, tm.tm_mday, tm.tm_mon + 1, tm.tm_year + 1900);
+    g_assert_cmpint (g_date_get_julian (&date1), ==,
+                     g_date_get_julian (&date2));
+
+    date1 = timespec_to_gdate (f->ts2);
+    gnc_localtime_r(&f->ts2.tv_sec, &tm);
+    g_date_set_dmy (&date2, tm.tm_mday, tm.tm_mon + 1, tm.tm_year + 1900);
+    g_assert_cmpint (g_date_get_julian (&date1), ==,
+                     g_date_get_julian (&date2));
+
+    date1 = timespec_to_gdate (f->ts3);
+    gnc_localtime_r(&f->ts3.tv_sec, &tm);
+    g_date_set_dmy (&date2, tm.tm_mday, tm.tm_mon + 1, tm.tm_year + 1900);
+    g_assert_cmpint (g_date_get_julian (&date1), ==,
+                     g_date_get_julian (&date2));
+
+    date1 = timespec_to_gdate (f->ts4);
+    gnc_localtime_r(&f->ts4.tv_sec, &tm);
+    g_date_set_dmy (&date2, tm.tm_mday, tm.tm_mon + 1, tm.tm_year + 1900);
+    g_assert_cmpint (g_date_get_julian (&date1), ==,
+                     g_date_get_julian (&date2));
+
+    date1 = timespec_to_gdate (f->ts5);
+    gnc_localtime_r(&f->ts5.tv_sec, &tm);
+    g_date_set_dmy (&date2, tm.tm_mday, tm.tm_mon + 1, tm.tm_year + 1900);
+    g_assert_cmpint (g_date_get_julian (&date1), ==,
+                     g_date_get_julian (&date2));
+}
+
+/* gdate_to_timespec
+Timespec gdate_to_timespec (GDate d)// C: 7 in 6  Local: 0:0:0
+*/
+static void
+test_gdate_to_timespec (FixtureB *f, gconstpointer pData)
+{
+
+    gchar *msg = "g_date_set_dmy: assertion 'g_date_valid_dmy (day, m, y)' failed";
+    gint loglevel = G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_FATAL;
+    gchar *logdomain = G_LOG_DOMAIN;
+    TestErrorStruct check = {loglevel, logdomain, msg, 0};
+    GLogFunc hdlr = g_log_set_default_handler ((GLogFunc)test_null_handler, &check);
+    g_test_log_set_fatal_handler ((GTestLogFatalFunc)test_checked_handler, &check);
+    for (int i = 0; i < sizeof(f->test)/sizeof(TimeMap); ++i)
+    {
+        GDate gd, gd2;
+        Timespec r_t;
+        g_date_clear(&gd, 1);
+        g_date_clear(&gd2, 1);
+        g_date_set_dmy(&gd, f->test[i].day, f->test[i].mon, f->test[i].yr);
+        r_t = gdate_to_timespec(gd);
+        g_assert_cmpint (r_t.tv_sec, ==, f->test[i].secs);
+        if (f->test[i].secs < INT64_MAX)
+        {
+            gd2 = timespec_to_gdate(r_t);
+            g_assert (g_date_compare (&gd2, &gd) == 0);
+        }
+    }
+    g_log_set_default_handler (hdlr, 0);
+}
+/* gnc_tm_get_day_start
+static void
+gnc_tm_get_day_start (struct tm *tm, time64 time_val)// Local: 3:0:0
+*/
+/* static void
+test_gnc_tm_get_day_start (void)
+{
+}*/
+/* gnc_tm_get_day_end
+static void
+gnc_tm_get_day_end (struct tm *tm, time64 time_val)// Local: 3:0:0
+*/
+/* static void
+test_gnc_tm_get_day_end (void)
+{
+}*/
+/* gnc_time64_get_day_start
+time64
+gnc_time64_get_day_start (time64 time_val)// C: 8 in 7  Local: 0:0:0
+*/
+
+static void
+tm_day_begin(struct tm *tm)
+{
+    tm->tm_hour = 0;
+    tm->tm_min = 0;
+    tm->tm_sec = 0;
+}
+
+static void
+test_gnc_time64_get_day_start (FixtureA *f, gconstpointer pData)
+{
+    struct tm tm;
+    time64 t_time, r_time;
+
+    gnc_localtime_r(&f->ts0.tv_sec, &tm);
+    tm_day_begin(&tm);
+    t_time = gnc_mktime(&tm);
+    r_time = gnc_time64_get_day_start (f->ts0.tv_sec);
+    g_assert_cmpint (t_time, ==, r_time);
+
+    gnc_localtime_r(&f->ts1.tv_sec, &tm);
+    tm_day_begin(&tm);
+    t_time = gnc_mktime(&tm);
+    r_time = gnc_time64_get_day_start (f->ts1.tv_sec);
+    g_assert_cmpint (t_time, ==, r_time);
+
+    gnc_localtime_r(&f->ts2.tv_sec, &tm);
+    tm_day_begin(&tm);
+    t_time = gnc_mktime(&tm);
+    r_time = gnc_time64_get_day_start (f->ts2.tv_sec);
+    g_assert_cmpint (t_time, ==, r_time);
+
+    gnc_localtime_r(&f->ts3.tv_sec, &tm);
+    tm_day_begin(&tm);
+    t_time = gnc_mktime(&tm);
+    r_time = gnc_time64_get_day_start (f->ts3.tv_sec);
+    g_assert_cmpint (t_time, ==, r_time);
+
+    gnc_localtime_r(&f->ts4.tv_sec, &tm);
+    tm_day_begin(&tm);
+    t_time = gnc_mktime(&tm);
+    r_time = gnc_time64_get_day_start (f->ts4.tv_sec);
+    g_assert_cmpint (t_time, ==, r_time);
+
+    gnc_localtime_r(&f->ts5.tv_sec, &tm);
+    tm_day_begin(&tm);
+    t_time = gnc_mktime(&tm);
+    r_time = gnc_time64_get_day_start (f->ts5.tv_sec);
+    g_assert_cmpint (t_time, ==, r_time);
+
+ }
+/* gnc_time64_get_day_end
+time64
+gnc_time64_get_day_end (time64 time_val)// C: 12 in 8  Local: 0:0:0
+*/
+static void
+tm_day_end(struct tm *tm)
+{
+    tm->tm_hour = 23;
+    tm->tm_min = 59;
+    tm->tm_sec = 59;
+}
+
+static void
+test_gnc_time64_get_day_end (FixtureA *f, gconstpointer pData)
+{
+    struct tm tm;
+    time64 t_time, r_time;
+
+    gnc_localtime_r(&f->ts0.tv_sec, &tm);
+    tm_day_end(&tm);
+    t_time = gnc_mktime(&tm);
+    r_time = gnc_time64_get_day_end (f->ts0.tv_sec);
+    g_assert_cmpint (t_time, ==, r_time);
+
+    gnc_localtime_r(&f->ts1.tv_sec, &tm);
+    tm_day_end(&tm);
+    t_time = gnc_mktime(&tm);
+    r_time = gnc_time64_get_day_end (f->ts1.tv_sec);
+    g_assert_cmpint (t_time, ==, r_time);
+
+    gnc_localtime_r(&f->ts2.tv_sec, &tm);
+    tm_day_end(&tm);
+    t_time = gnc_mktime(&tm);
+    r_time = gnc_time64_get_day_end (f->ts2.tv_sec);
+    g_assert_cmpint (t_time, ==, r_time);
+
+    gnc_localtime_r(&f->ts3.tv_sec, &tm);
+    tm_day_end(&tm);
+    t_time = gnc_mktime(&tm);
+    r_time = gnc_time64_get_day_end (f->ts3.tv_sec);
+    g_assert_cmpint (t_time, ==, r_time);
+
+    gnc_localtime_r(&f->ts4.tv_sec, &tm);
+    tm_day_end(&tm);
+    t_time = gnc_mktime(&tm);
+    r_time = gnc_time64_get_day_end (f->ts4.tv_sec);
+    g_assert_cmpint (t_time, ==, r_time);
+
+    gnc_localtime_r(&f->ts5.tv_sec, &tm);
+    tm_day_end(&tm);
+    t_time = gnc_mktime(&tm);
+    r_time = gnc_time64_get_day_end (f->ts5.tv_sec);
+    g_assert_cmpint (t_time, ==, r_time);
+
+}
+/* gnc_tm_get_today_start
+void
+gnc_tm_get_today_start (struct tm *tm)// C: 3 in 3  Local: 0:0:0
+*/
+/* static void
+test_gnc_tm_get_today_start (void)
+{
+}*/
+// Not Used
+/* gnc_tm_get_today_end
+void
+gnc_tm_get_today_end (struct tm *tm)// Local: 0:0:0
+*/
+/* gnc_time64_get_today_start
+time64
+gnc_time64_get_today_start (void)// C: 7 in 4  Local: 0:0:0
+*/
+/* static void
+test_gnc_time64_get_today_start (void)
+{
+}*/
+/* gnc_time64_get_today_end
+time64
+gnc_time64_get_today_end (void)// C: 8 in 5  Local: 0:0:0
+*/
+/* static void
+test_gnc_time64_get_today_end (void)
+{
+}*/
+/* gnc_dow_abbrev
+void
+gnc_dow_abbrev(gchar *buf, int buf_len, int dow)// C: 4 in 2  Local: 0:0:0
+*/
+/* static void
+test_gnc_dow_abbrev (void)
+{
+}*/
+/* timespec_boxed_copy_func
+static gpointer
+timespec_boxed_copy_func( gpointer in_timespec )// Local: 0:1:0
+*/
+/* static void
+test_timespec_boxed_copy_func (void)
+{
+}*/
+/* timespec_boxed_free_func
+static void
+timespec_boxed_free_func( gpointer in_timespec )// Local: 0:1:0
+*/
+/* static void
+test_timespec_boxed_free_func (void)
+{
+}*/
+// Not Used
+/* timespec_get_type
+GType
+timespec_get_type( void )// Local: 0:0:0
+*/
+
+
+void
+test_suite_gnc_date (void)
+{
+    tz = g_time_zone_new_local();
+    GNC_TEST_ADD_FUNC (suitename, "gnc localtime", test_gnc_localtime);
+    GNC_TEST_ADD_FUNC (suitename, "gnc gmtime", test_gnc_gmtime);
+    GNC_TEST_ADD_FUNC (suitename, "gnc mktime", test_gnc_mktime);
+    GNC_TEST_ADD_FUNC (suitename, "gnc mktime normalization", test_gnc_mktime_normalization);
+    GNC_TEST_ADD_FUNC (suitename, "gnc ctime", test_gnc_ctime);
+    GNC_TEST_ADD_FUNC (suitename, "gnc time", test_gnc_time);
+
+    GNC_TEST_ADD_FUNC (suitename, "gnc date dateformat to string", test_gnc_date_dateformat_to_string);
+    GNC_TEST_ADD_FUNC (suitename, "gnc date string to dateformat", test_gnc_date_string_to_dateformat);
+    GNC_TEST_ADD_FUNC (suitename, "gnc date monthformat to string", test_gnc_date_monthformat_to_string);
+    GNC_TEST_ADD_FUNC (suitename, "gnc date string to monthformat", test_gnc_date_string_to_monthformat);
+    GNC_TEST_ADD_FUNC (suitename, "timespec normalize", test_timespec_normalize);
+    GNC_TEST_ADD_FUNC (suitename, "timespec equal", test_timespec_equal);
+    GNC_TEST_ADD_FUNC (suitename, "timespec cmp", test_timespec_cmp);
+    GNC_TEST_ADD_FUNC (suitename, "timespec diff", test_timespec_diff);
+    GNC_TEST_ADD_FUNC (suitename, "timespec abs", test_timespec_abs);
+    GNC_TEST_ADD_FUNC (suitename, "timespecCanonicalDayTime", test_timespecCanonicalDayTime);
+    GNC_TEST_ADD_FUNC (suitename, "date get last mday", test_gnc_date_get_last_mday);
+    GNC_TEST_ADD_FUNC (suitename, "qof date format set", test_qof_date_format_set);
+// GNC_TEST_ADD_FUNC (suitename, "qof date completion set", test_qof_date_completion_set);
+    GNC_TEST_ADD_FUNC (suitename, "qof print date dmy buff", test_qof_print_date_dmy_buff);
+    GNC_TEST_ADD_FUNC (suitename, "qof print date buff", test_qof_print_date_buff);
+    GNC_TEST_ADD_FUNC (suitename, "qof print gdate", test_qof_print_gdate);
+    GNC_TEST_ADD_FUNC (suitename, "qof print date", test_qof_print_date);
+    GNC_TEST_ADD_FUNC (suitename, "gnc print date", test_gnc_print_date);
+// GNC_TEST_ADD_FUNC (suitename, "floordiv", test_floordiv);
+// GNC_TEST_ADD_FUNC (suitename, "qof scan date internal", test_qof_scan_date_internal);
+    GNC_TEST_ADD_FUNC (suitename, "qof scan date", test_qof_scan_date);
+// GNC_TEST_ADD_FUNC (suitename, "dateSeparator", test_dateSeparator);
+// GNC_TEST_ADD_FUNC (suitename, "qof time format from utf8", test_qof_time_format_from_utf8);
+// GNC_TEST_ADD_FUNC (suitename, "qof formatted time to utf8", test_qof_formatted_time_to_utf8);
+// GNC_TEST_ADD_FUNC (suitename, "qof format time", test_qof_format_time);
+// GNC_TEST_ADD_FUNC (suitename, "qof strftime", test_qof_strftime);
+    GNC_TEST_ADD_FUNC (suitename, "gnc_date_timestamp", test_gnc_date_timestamp);
+    GNC_TEST_ADD (suitename, "gnc iso8601 to timespec gmt", FixtureA, NULL, setup, test_gnc_iso8601_to_timespec_gmt, NULL);
+    GNC_TEST_ADD (suitename, "gnc timespec to iso8601 buff", FixtureA, NULL, setup, test_gnc_timespec_to_iso8601_buff, NULL);
+    GNC_TEST_ADD (suitename, "gnc timespec2dmy", FixtureA, NULL, setup, test_gnc_timespec2dmy, NULL);
+// GNC_TEST_ADD_FUNC (suitename, "gnc dmy2timespec internal", test_gnc_dmy2timespec_internal);
+
+    GNC_TEST_ADD (suitename, "gnc dmy2timespec", FixtureB, NULL, setup_begin, test_gnc_dmy2timespec, NULL);
+    GNC_TEST_ADD (suitename, "gnc dmy2timespec end", FixtureB, NULL, setup_end, test_gnc_dmy2timespec_end, NULL);
+    GNC_TEST_ADD (suitename, "gnc dmy2timespec Neutral", FixtureB, NULL, setup_neutral, test_gnc_dmy2timespec_neutral, NULL);
+// GNC_TEST_ADD_FUNC (suitename, "gnc timezone", test_gnc_timezone);
+    GNC_TEST_ADD_FUNC (suitename, "timespecFromTime64", test_timespecFromTime64);
+// GNC_TEST_ADD_FUNC (suitename, "timespec now", test_timespec_now);
+// GNC_TEST_ADD_FUNC (suitename, "timespecToTime t", test_timespecTotime64);
+    GNC_TEST_ADD (suitename, "timespec to gdate", FixtureA, NULL, setup, test_timespec_to_gdate, NULL);
+    GNC_TEST_ADD (suitename, "gdate to timespec", FixtureB, NULL, setup_neutral, test_gdate_to_timespec, NULL);
+// GNC_TEST_ADD_FUNC (suitename, "gnc tm get day start", test_gnc_tm_get_day_start);
+// GNC_TEST_ADD_FUNC (suitename, "gnc tm get day end", test_gnc_tm_get_day_end);
+    GNC_TEST_ADD (suitename, "gnc time64 get day start", FixtureA, NULL, setup, test_gnc_time64_get_day_start, NULL);
+    GNC_TEST_ADD (suitename, "gnc time64 get day end", FixtureA, NULL, setup, test_gnc_time64_get_day_end, NULL);
+// GNC_TEST_ADD_FUNC (suitename, "gnc tm get today start", test_gnc_tm_get_today_start);
+// GNC_TEST_ADD_FUNC (suitename, "gnc timet get today start", test_gnc_time64_get_today_start);
+// GNC_TEST_ADD_FUNC (suitename, "gnc timet get today end", test_gnc_time64_get_today_end);
+// GNC_TEST_ADD_FUNC (suitename, "gnc dow abbrev", test_gnc_dow_abbrev);
+// GNC_TEST_ADD_FUNC (suitename, "timespec boxed copy func", test_timespec_boxed_copy_func);
+// GNC_TEST_ADD_FUNC (suitename, "timespec boxed free func", test_timespec_boxed_free_func);
+    g_time_zone_unref(tz);
+}
diff --git a/src/engine/test/test-gnc-guid-old.cpp b/libgnucash/engine/test/test-gnc-guid-old.cpp
similarity index 100%
rename from src/engine/test/test-gnc-guid-old.cpp
rename to libgnucash/engine/test/test-gnc-guid-old.cpp
diff --git a/src/engine/test/test-gnc-guid.cpp b/libgnucash/engine/test/test-gnc-guid.cpp
similarity index 100%
rename from src/engine/test/test-gnc-guid.cpp
rename to libgnucash/engine/test/test-gnc-guid.cpp
diff --git a/src/engine/test/test-gnc-uri-utils.c b/libgnucash/engine/test/test-gnc-uri-utils.c
similarity index 100%
rename from src/engine/test/test-gnc-uri-utils.c
rename to libgnucash/engine/test/test-gnc-uri-utils.c
diff --git a/src/engine/test/test-group-vs-book.cpp b/libgnucash/engine/test/test-group-vs-book.cpp
similarity index 100%
rename from src/engine/test/test-group-vs-book.cpp
rename to libgnucash/engine/test/test-group-vs-book.cpp
diff --git a/src/engine/test/test-guid.cpp b/libgnucash/engine/test/test-guid.cpp
similarity index 100%
rename from src/engine/test/test-guid.cpp
rename to libgnucash/engine/test/test-guid.cpp
diff --git a/src/engine/test/test-job.c b/libgnucash/engine/test/test-job.c
similarity index 100%
rename from src/engine/test/test-job.c
rename to libgnucash/engine/test/test-job.c
diff --git a/src/engine/test/test-kvp-frame.cpp b/libgnucash/engine/test/test-kvp-frame.cpp
similarity index 100%
rename from src/engine/test/test-kvp-frame.cpp
rename to libgnucash/engine/test/test-kvp-frame.cpp
diff --git a/src/engine/test/test-kvp-value.cpp b/libgnucash/engine/test/test-kvp-value.cpp
similarity index 100%
rename from src/engine/test/test-kvp-value.cpp
rename to libgnucash/engine/test/test-kvp-value.cpp
diff --git a/src/engine/test/test-link.c b/libgnucash/engine/test/test-link.c
similarity index 100%
rename from src/engine/test/test-link.c
rename to libgnucash/engine/test/test-link.c
diff --git a/src/engine/test/test-load-engine.c b/libgnucash/engine/test/test-load-engine.c
similarity index 100%
rename from src/engine/test/test-load-engine.c
rename to libgnucash/engine/test/test-load-engine.c
diff --git a/src/engine/test/test-lots.cpp b/libgnucash/engine/test/test-lots.cpp
similarity index 100%
rename from src/engine/test/test-lots.cpp
rename to libgnucash/engine/test/test-lots.cpp
diff --git a/src/engine/test/test-numeric.cpp b/libgnucash/engine/test/test-numeric.cpp
similarity index 100%
rename from src/engine/test/test-numeric.cpp
rename to libgnucash/engine/test/test-numeric.cpp
diff --git a/src/engine/test/test-object.c b/libgnucash/engine/test/test-object.c
similarity index 100%
rename from src/engine/test/test-object.c
rename to libgnucash/engine/test/test-object.c
diff --git a/src/engine/test/test-qof-string-cache.c b/libgnucash/engine/test/test-qof-string-cache.c
similarity index 100%
rename from src/engine/test/test-qof-string-cache.c
rename to libgnucash/engine/test/test-qof-string-cache.c
diff --git a/src/engine/test/test-qof.c b/libgnucash/engine/test/test-qof.c
similarity index 100%
rename from src/engine/test/test-qof.c
rename to libgnucash/engine/test/test-qof.c
diff --git a/src/engine/test/test-qofbackend.c b/libgnucash/engine/test/test-qofbackend.c
similarity index 100%
rename from src/engine/test/test-qofbackend.c
rename to libgnucash/engine/test/test-qofbackend.c
diff --git a/src/engine/test/test-qofbook.c b/libgnucash/engine/test/test-qofbook.c
similarity index 100%
rename from src/engine/test/test-qofbook.c
rename to libgnucash/engine/test/test-qofbook.c
diff --git a/src/engine/test/test-qofinstance.cpp b/libgnucash/engine/test/test-qofinstance.cpp
similarity index 100%
rename from src/engine/test/test-qofinstance.cpp
rename to libgnucash/engine/test/test-qofinstance.cpp
diff --git a/src/engine/test/test-qofobject.c b/libgnucash/engine/test/test-qofobject.c
similarity index 100%
rename from src/engine/test/test-qofobject.c
rename to libgnucash/engine/test/test-qofobject.c
diff --git a/src/engine/test/test-qofsession-old.cpp b/libgnucash/engine/test/test-qofsession-old.cpp
similarity index 100%
rename from src/engine/test/test-qofsession-old.cpp
rename to libgnucash/engine/test/test-qofsession-old.cpp
diff --git a/src/engine/test/test-qofsession.cpp b/libgnucash/engine/test/test-qofsession.cpp
similarity index 100%
rename from src/engine/test/test-qofsession.cpp
rename to libgnucash/engine/test/test-qofsession.cpp
diff --git a/src/engine/test/test-query.cpp b/libgnucash/engine/test/test-query.cpp
similarity index 100%
rename from src/engine/test/test-query.cpp
rename to libgnucash/engine/test/test-query.cpp
diff --git a/src/engine/test/test-querynew.c b/libgnucash/engine/test/test-querynew.c
similarity index 100%
rename from src/engine/test/test-querynew.c
rename to libgnucash/engine/test/test-querynew.c
diff --git a/src/engine/test/test-recurrence.c b/libgnucash/engine/test/test-recurrence.c
similarity index 100%
rename from src/engine/test/test-recurrence.c
rename to libgnucash/engine/test/test-recurrence.c
diff --git a/src/engine/test/test-scm-query-import.in b/libgnucash/engine/test/test-scm-query-import.in
similarity index 100%
rename from src/engine/test/test-scm-query-import.in
rename to libgnucash/engine/test/test-scm-query-import.in
diff --git a/src/engine/test/test-scm-query-import.scm b/libgnucash/engine/test/test-scm-query-import.scm
similarity index 100%
rename from src/engine/test/test-scm-query-import.scm
rename to libgnucash/engine/test/test-scm-query-import.scm
diff --git a/src/engine/test/test-scm-query.cpp b/libgnucash/engine/test/test-scm-query.cpp
similarity index 100%
rename from src/engine/test/test-scm-query.cpp
rename to libgnucash/engine/test/test-scm-query.cpp
diff --git a/src/engine/test/test-split-vs-account.cpp b/libgnucash/engine/test/test-split-vs-account.cpp
similarity index 100%
rename from src/engine/test/test-split-vs-account.cpp
rename to libgnucash/engine/test/test-split-vs-account.cpp
diff --git a/src/engine/test/test-split.scm b/libgnucash/engine/test/test-split.scm
similarity index 100%
rename from src/engine/test/test-split.scm
rename to libgnucash/engine/test/test-split.scm
diff --git a/src/engine/test/test-test-extras.scm b/libgnucash/engine/test/test-test-extras.scm
similarity index 100%
rename from src/engine/test/test-test-extras.scm
rename to libgnucash/engine/test/test-test-extras.scm
diff --git a/src/engine/test/test-transaction-reversal.cpp b/libgnucash/engine/test/test-transaction-reversal.cpp
similarity index 100%
rename from src/engine/test/test-transaction-reversal.cpp
rename to libgnucash/engine/test/test-transaction-reversal.cpp
diff --git a/src/engine/test/test-transaction-voiding.cpp b/libgnucash/engine/test/test-transaction-voiding.cpp
similarity index 100%
rename from src/engine/test/test-transaction-voiding.cpp
rename to libgnucash/engine/test/test-transaction-voiding.cpp
diff --git a/src/engine/test/test-vendor.c b/libgnucash/engine/test/test-vendor.c
similarity index 100%
rename from src/engine/test/test-vendor.c
rename to libgnucash/engine/test/test-vendor.c
diff --git a/src/engine/test/utest-Account.cpp b/libgnucash/engine/test/utest-Account.cpp
similarity index 100%
rename from src/engine/test/utest-Account.cpp
rename to libgnucash/engine/test/utest-Account.cpp
diff --git a/src/engine/test/utest-Budget.c b/libgnucash/engine/test/utest-Budget.c
similarity index 100%
rename from src/engine/test/utest-Budget.c
rename to libgnucash/engine/test/utest-Budget.c
diff --git a/src/engine/test/utest-Entry.c b/libgnucash/engine/test/utest-Entry.c
similarity index 100%
rename from src/engine/test/utest-Entry.c
rename to libgnucash/engine/test/utest-Entry.c
diff --git a/src/engine/test/utest-Invoice.c b/libgnucash/engine/test/utest-Invoice.c
similarity index 100%
rename from src/engine/test/utest-Invoice.c
rename to libgnucash/engine/test/utest-Invoice.c
diff --git a/src/engine/test/utest-Split.cpp b/libgnucash/engine/test/utest-Split.cpp
similarity index 100%
rename from src/engine/test/utest-Split.cpp
rename to libgnucash/engine/test/utest-Split.cpp
diff --git a/src/engine/test/utest-Transaction.cpp b/libgnucash/engine/test/utest-Transaction.cpp
similarity index 100%
rename from src/engine/test/utest-Transaction.cpp
rename to libgnucash/engine/test/utest-Transaction.cpp
diff --git a/src/engine/test/utest-gnc-pricedb.c b/libgnucash/engine/test/utest-gnc-pricedb.c
similarity index 100%
rename from src/engine/test/utest-gnc-pricedb.c
rename to libgnucash/engine/test/utest-gnc-pricedb.c
diff --git a/src/engine/xlate.pl b/libgnucash/engine/xlate.pl
similarity index 100%
rename from src/engine/xlate.pl
rename to libgnucash/engine/xlate.pl
diff --git a/libgnucash/gnc-module/CMakeLists.txt b/libgnucash/gnc-module/CMakeLists.txt
new file mode 100644
index 0000000..519bb1f
--- /dev/null
+++ b/libgnucash/gnc-module/CMakeLists.txt
@@ -0,0 +1,69 @@
+# CMakeLists.txt for libgnucash/gnc-module
+ADD_SUBDIRECTORY(test)
+
+IF (BUILDING_FROM_VCS)
+  # Command to generate the swig-gnc-module.c wrapper file
+  SET (SWIG_GNC_MODULE_C ${CMAKE_CURRENT_BINARY_DIR}/swig-gnc-module.c)
+  GNC_ADD_SWIG_COMMAND (swig-gnc-module-c ${SWIG_GNC_MODULE_C} ${CMAKE_CURRENT_SOURCE_DIR}/gnc-module.i)
+ELSE()
+  SET (SWIG_GNC_MODULE_C swig-gnc-module.c)
+ENDIF()
+
+SET (gnc_module_SOURCES gnc-module.c)
+
+# Add dependency on config.h
+SET_SOURCE_FILES_PROPERTIES (${gnc_module_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
+
+SET (gnc_module_HEADERS
+  gnc-module.h
+  gnc-module-api.h
+)
+
+ADD_LIBRARY	(gnc-module
+  ${gnc_module_SOURCES}
+  ${gnc_module_HEADERS}
+  ${SWIG_GNC_MODULE_C}
+)
+
+TARGET_LINK_LIBRARIES(gnc-module ${GUILE_LDFLAGS} ${GMODULE_LDFLAGS} ${GLIB2_LDFLAGS})
+
+TARGET_COMPILE_DEFINITIONS (gnc-module PRIVATE -DG_LOG_DOMAIN=\"gnc.module\")
+
+TARGET_INCLUDE_DIRECTORIES (gnc-module
+    PRIVATE ${GUILE_INCLUDE_DIRS}
+    PUBLIC  ${CMAKE_CURRENT_SOURCE_DIR}
+            ${CMAKE_SOURCE_DIR}/common
+            ${CMAKE_BINARY_DIR}/common # for config.h
+            ${GLIB2_INCLUDE_DIRS}
+)
+
+INSTALL(TARGETS gnc-module
+  LIBRARY DESTINATION lib
+  ARCHIVE DESTINATION lib
+  RUNTIME DESTINATION bin)
+
+INSTALL(FILES ${gnc_module_HEADERS} DESTINATION include/gnucash)
+
+# --- Compile Scheme file(s) ---
+
+SET (gnc_module_SCHEME gnc-module.scm)
+
+SET(GUILE_OUTPUT_DIR   gnucash)
+SET(GUILE_MODULES      "")
+SET(GUILE_LOAD_DIRS    "")
+SET(GUILE_LIBRARY_DIRS "")
+SET(GUILE_DEPENDS      gnc-module)
+
+GNC_ADD_SCHEME_TARGETS(scm-gnc-module
+  "${gnc_module_SCHEME}"
+  ${GUILE_OUTPUT_DIR} 
+  "${GUILE_MODULES}"
+  "${GUILE_LOAD_DIRS}"
+  "${GUILE_LIBRARY_DIRS}"
+  "${GUILE_DEPENDS}"
+  FALSE
+)
+
+SET_LOCAL_DIST(gnc_module_DIST_local CMakeLists.txt Makefile.am ${gnc_module_SOURCES} ${gnc_module_HEADERS}
+        gnc-module.i gnc-module.scm README)
+SET(gnc_module_DIST ${gnc_module_DIST_local} ${test_gnc_module_DIST} PARENT_SCOPE)
diff --git a/libgnucash/gnc-module/Makefile.am b/libgnucash/gnc-module/Makefile.am
new file mode 100644
index 0000000..d7b3748
--- /dev/null
+++ b/libgnucash/gnc-module/Makefile.am
@@ -0,0 +1,90 @@
+# No SUBDIR variable here...
+# The 'test' subdir is added via src/Makefile to handle
+# it's dependency on src/engine
+
+AM_CPPFLAGS = \
+   -I${top_srcdir}/lib/libc \
+   -I${top_srcdir}/common \
+   -I${top_srcdir}/libgnucash/core-utils \
+   ${GLIB_CFLAGS} \
+   ${GUILE_CFLAGS}
+
+lib_LTLIBRARIES = libgnc-module.la
+
+libgnc_module_la_SOURCES = gnc-module.c swig-gnc-module.c
+
+libgnc_module_la_LIBADD = \
+  ../core-utils/libgnc-core-utils.la \
+  ${top_builddir}/lib/libc/libc-missing.la \
+  ${GLIB_LIBS} \
+  ${GUILE_LIBS}
+
+gncscmmoddir = ${GNC_SCM_INSTALL_DIR}/gnucash
+gncscmmod_DATA = gnc-module.scm
+
+gncincludedir = ${GNC_INCLUDE_DIR}
+gncinclude_HEADERS = \
+  gnc-module-api.h \
+  gnc-module.h
+
+noinst_DATA = .scm-links
+
+if BUILDING_FROM_VCS
+swig-gnc-module.c: gnc-module.i ${top_srcdir}/common/base-typemaps.i
+	$(SWIG) -guile $(SWIG_ARGS) -Linkage module \
+	-I${top_srcdir}/common -o $@ $<
+if ! OS_WIN32
+if ! SWIG_DIST_FAIL
+	if ! `grep "define scm_from_utf8_string" $@ > /dev/null 2>&1`; then \
+	  patch $@ $(top_srcdir)/common/swig-utf8.patch; \
+	fi
+endif
+endif
+endif
+
+EXTRA_DIST = \
+  ${gncscmmod_DATA} \
+  gnc-module.i \
+  CMakeLists.txt
+
+if GNUCASH_SEPARATE_BUILDDIR
+#For executing test cases
+SCM_FILE_LINKS = ${gncscmmod_DATA}
+endif
+
+.scm-links: 
+	$(RM) -rf gnucash
+	mkdir -p  gnucash
+if GNUCASH_SEPARATE_BUILDDIR
+	for X in ${SCM_FILE_LINKS} ; do \
+	  $(LN_S) -f ${srcdir}/$$X . ; \
+	done
+endif
+	( cd gnucash; for A in $(gncscmmod_DATA) ; do $(LN_S) -f ../$$A . ; done )
+if ! OS_WIN32
+# Windows knows no "ln -s" but uses "cp": must copy every time (see bug #566567).
+	touch .scm-links
+endif
+
+if GNC_HAVE_GUILE_2
+GUILE_COMPILE_ENV = \
+  --library-dir    ${top_builddir}/libgnucash/gnc-module \
+  --library-dir    ${top_builddir}/libgnucash/core-utils
+
+%.go : %.scm .scm-links $(lib_LTLIBRARIES)
+	GNC_UNINSTALLED=yes \
+	GNC_BUILDDIR=${top_builddir} \
+	$(shell ${abs_top_srcdir}/common/gnc-test-env.pl --noexports ${GUILE_COMPILE_ENV}) \
+	$(GUILD) compile -o $@ $<
+
+gncscmmodcachedir = ${pkglibdir}/scm/ccache/@GUILE_EFFECTIVE_VERSION@/gnucash
+gncscmmodcache_DATA = $(gncscmmod_DATA:.scm=.go)
+endif
+
+clean-local:
+	rm -rf gnucash
+
+CLEANFILES = .scm-links ${SCM_FILE_LINKS} ${gncscmmodcache_DATA}
+MAINTAINERCLEANFILES = swig-gnc-module.c
+
+AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.module\"
diff --git a/src/gnc-module/README b/libgnucash/gnc-module/README
similarity index 100%
rename from src/gnc-module/README
rename to libgnucash/gnc-module/README
diff --git a/src/gnc-module/doc/design.txt b/libgnucash/gnc-module/doc/design.txt
similarity index 100%
rename from src/gnc-module/doc/design.txt
rename to libgnucash/gnc-module/doc/design.txt
diff --git a/src/gnc-module/gnc-module-api.h b/libgnucash/gnc-module/gnc-module-api.h
similarity index 100%
rename from src/gnc-module/gnc-module-api.h
rename to libgnucash/gnc-module/gnc-module-api.h
diff --git a/src/gnc-module/gnc-module.c b/libgnucash/gnc-module/gnc-module.c
similarity index 100%
rename from src/gnc-module/gnc-module.c
rename to libgnucash/gnc-module/gnc-module.c
diff --git a/src/gnc-module/gnc-module.h b/libgnucash/gnc-module/gnc-module.h
similarity index 100%
rename from src/gnc-module/gnc-module.h
rename to libgnucash/gnc-module/gnc-module.h
diff --git a/src/gnc-module/gnc-module.i b/libgnucash/gnc-module/gnc-module.i
similarity index 100%
rename from src/gnc-module/gnc-module.i
rename to libgnucash/gnc-module/gnc-module.i
diff --git a/src/gnc-module/gnc-module.scm b/libgnucash/gnc-module/gnc-module.scm
similarity index 100%
rename from src/gnc-module/gnc-module.scm
rename to libgnucash/gnc-module/gnc-module.scm
diff --git a/libgnucash/gnc-module/test/CMakeLists.txt b/libgnucash/gnc-module/test/CMakeLists.txt
new file mode 100644
index 0000000..99dd66d
--- /dev/null
+++ b/libgnucash/gnc-module/test/CMakeLists.txt
@@ -0,0 +1,114 @@
+
+ADD_SUBDIRECTORY(mod-foo)
+ADD_SUBDIRECTORY(mod-bar)
+ADD_SUBDIRECTORY(mod-baz)
+ADD_SUBDIRECTORY(misc-mods)
+
+SET(GNC_MODULE_TEST_INCLUDE_DIRS
+  ${CMAKE_BINARY_DIR}/common # for config.h
+  ${CMAKE_SOURCE_DIR}/libgnucash/gnc-module
+  ${CMAKE_SOURCE_DIR}/common/test-core
+  ${GLIB2_INCLUDE_DIRS}
+  ${GUILE_INCLUDE_DIRS}
+)
+
+SET(GNC_MODULE_TEST_LIBS gnc-module test-core)
+
+MACRO(ADD_GNC_MODULE_TEST _TARGET _SOURCE_FILES)
+  GNC_ADD_TEST(${_TARGET} "${_SOURCE_FILES}" GNC_MODULE_TEST_INCLUDE_DIRS GNC_MODULE_TEST_LIBS)
+ENDMACRO()
+
+FUNCTION(RUN_TEST_WITH_GUILE _TARGET _SOURCE_FILE)
+  GET_GUILE_ENV()
+  SET(CMAKE_COMMAND_TMP "")
+  IF (${CMAKE_VERSION} VERSION_GREATER 3.1)
+    SET(CMAKE_COMMAND_TMP ${CMAKE_COMMAND} -E env "${GUILE_ENV}")
+  ENDIF()
+  ADD_TEST(NAME ${_TARGET}
+    COMMAND ${CMAKE_COMMAND_TMP}
+      ${GUILE_EXECUTABLE} -s ${_SOURCE_FILE}
+  )
+
+  SET_TESTS_PROPERTIES(${_TARGET} PROPERTIES ENVIRONMENT "${GUILE_ENV};${ARGN}")
+ENDFUNCTION()
+
+GNC_ADD_TEST_WITH_GUILE(test-load-c test-load-c.c GNC_MODULE_TEST_INCLUDE_DIRS GNC_MODULE_TEST_LIBS)
+
+RUN_TEST_WITH_GUILE(test-load-scm ${CMAKE_CURRENT_SOURCE_DIR}/test-load-scm.in)
+
+RUN_TEST_WITH_GUILE(test-load-deps ${CMAKE_CURRENT_SOURCE_DIR}/test-load-deps.in)
+
+RUN_TEST_WITH_GUILE(test-scm-init ${CMAKE_CURRENT_SOURCE_DIR}/test-scm-init.in)
+
+RUN_TEST_WITH_GUILE(test-scm-multi ${CMAKE_CURRENT_SOURCE_DIR}/test-scm-multi.in)
+
+RUN_TEST_WITH_GUILE(test-scm-dynload ${CMAKE_CURRENT_SOURCE_DIR}/test-scm-dynload.in)
+
+GNC_ADD_TEST_WITH_GUILE(test-modsysver test-modsysver.c
+  GNC_MODULE_TEST_INCLUDE_DIRS GNC_MODULE_TEST_LIBS
+)
+GNC_ADD_TEST_WITH_GUILE(test-incompatdep test-incompatdep.c
+  GNC_MODULE_TEST_INCLUDE_DIRS GNC_MODULE_TEST_LIBS
+)
+GNC_ADD_TEST_WITH_GUILE(test-agedver test-agedver.c
+  GNC_MODULE_TEST_INCLUDE_DIRS GNC_MODULE_TEST_LIBS
+)
+
+SET(_LIBDIR ${CMAKE_BINARY_DIR}/lib)
+IF (WIN32)
+  SET(_LIBDIR ${CMAKE_BINARY_DIR}/bin)
+ENDIF()
+GNC_ADD_TEST(test-dynload test-dynload.c
+  GNC_MODULE_TEST_INCLUDE_DIRS GNC_MODULE_TEST_LIBS
+  LIBDIR=${_LIBDIR}
+)
+
+SET(GUILE ${GUILE_EXECUTABLE})
+CONFIGURE_FILE(test-gwrapped-c.in test-gwrapped-c @ONLY)
+CONFIGURE_FILE(test-scm-module.in test-scm-module @ONLY)
+CONFIGURE_FILE(test-load-deps.in test-load-deps @ONLY)
+CONFIGURE_FILE(test-load-scm.in test-load-scm @ONLY)
+CONFIGURE_FILE(test-scm-dynload.in test-scm-dynload @ONLY)
+CONFIGURE_FILE(test-scm-init.in test-scm-init @ONLY)
+CONFIGURE_FILE(test-scm-multi.in test-scm-multi @ONLY)
+
+FUNCTION(RUN_GUILE_SHELL_TEST _TARGET _SOURCE_FILE)
+  GET_GUILE_ENV()
+  SET(CMAKE_COMMAND_TMP "")
+  IF (${CMAKE_VERSION} VERSION_GREATER 3.1)
+    SET(CMAKE_COMMAND_TMP ${CMAKE_COMMAND} -E env "${GUILE_ENV}")
+  ENDIF()
+  ADD_TEST(NAME ${_TARGET}
+    COMMAND ${CMAKE_COMMAND_TMP}
+      ${SHELL} ${_SOURCE_FILE}
+  )
+  SET_TESTS_PROPERTIES(${_TARGET} PROPERTIES ENVIRONMENT "${GUILE_ENV}")
+ENDFUNCTION()
+
+RUN_GUILE_SHELL_TEST(test-gwrapped-c ${CMAKE_CURRENT_BINARY_DIR}/test-gwrapped-c)
+
+RUN_GUILE_SHELL_TEST(test-scm-module ${CMAKE_CURRENT_BINARY_DIR}/test-scm-module)
+
+SET(test_gnc_module_SOURCE_DIST
+  test-agedver.c
+  test-dynload.c
+  test-incompatdep.c
+  test-load-c.c
+  test-modsysver.c
+)
+
+SET(test_gnc_module_EXTRA_DIST
+  README
+  test-gwrapped-c.in
+  test-load-deps.in
+  test-load-scm.in
+  test-scm-dynload.in
+  test-scm-init.in
+  test-scm-module.in
+  test-scm-multi.in
+)
+
+SET_LOCAL_DIST(test_gnc_module_DIST_local CMakeLists.txt Makefile.am README ${test_gnc_module_SOURCE_DIST} ${test_gnc_module_EXTRA_DIST})
+
+SET(test_gnc_module_DIST ${test_gnc_module_DIST_local} ${misc_mods_DIST}
+                         ${mod_bar_DIST} ${mod_baz_DIST} ${mod_foo_DIST} PARENT_SCOPE)
diff --git a/libgnucash/gnc-module/test/Makefile.am b/libgnucash/gnc-module/test/Makefile.am
new file mode 100644
index 0000000..13b0188
--- /dev/null
+++ b/libgnucash/gnc-module/test/Makefile.am
@@ -0,0 +1,72 @@
+SUBDIRS = mod-foo mod-bar mod-baz misc-mods
+
+LDADD = \
+  ${top_builddir}/common/test-core/libtest-core.la \
+  ../libgnc-module.la ${GLIB_LIBS} ${GUILE_LIBS}
+
+AM_CPPFLAGS = \
+  -I${top_srcdir}/common \
+  -I${top_srcdir}/libgnucash/gnc-module \
+  -I${top_srcdir}/common/test-core \
+  -I${top_srcdir}/libgnucash/engine \
+  ${GUILE_CFLAGS} \
+  ${GLIB_CFLAGS}
+
+TESTS = \
+  test-load-c \
+  test-load-scm \
+  test-gwrapped-c \
+  test-scm-module \
+  test-scm-multi \
+  test-load-deps \
+  test-modsysver \
+  test-incompatdep \
+  test-agedver \
+  test-dynload \
+  test-scm-dynload \
+  test-scm-init
+
+GNC_TEST_DEPS = \
+  --gnc-module-dir ${top_builddir}/libgnucash/gnc-module \
+  --gnc-module-dir ${top_builddir}/libgnucash/gnc-module/test/mod-foo \
+  --gnc-module-dir ${top_builddir}/libgnucash/gnc-module/test/mod-bar \
+  --gnc-module-dir ${top_builddir}/libgnucash/gnc-module/test/mod-baz \
+  --gnc-module-dir ${top_builddir}/libgnucash/gnc-module/test/misc-mods \
+  --guile-load-dir ${top_builddir}/common/test-core \
+  --guile-load-dir ${top_builddir}/libgnucash/gnc-module \
+  --guile-load-dir ${top_srcdir}/libgnucash/gnc-module/test/mod-foo \
+  --guile-load-dir ${top_srcdir}/libgnucash/gnc-module/test/mod-baz \
+  --guile-load-dir ${top_srcdir}/libgnucash/gnc-module/test/mod-bar \
+  --library-dir    ${top_builddir}/libgnucash/core-utils \
+  --library-dir    ${top_builddir}/common/test-core \
+  --library-dir    ${top_builddir}/libgnucash/gnc-module \
+  --library-dir    ${top_builddir}/libgnucash/gnc-module/test/mod-foo \
+  --library-dir    ${top_builddir}/libgnucash/gnc-module/test/mod-bar \
+  --library-dir    ${top_builddir}/libgnucash/gnc-module/test/mod-baz
+
+TESTS_ENVIRONMENT = \
+  GUILE_WARN_DEPRECATED=no \
+  GUILE="${GUILE}" \
+  $(shell ${abs_top_srcdir}/common/gnc-test-env.pl --noexports ${GNC_TEST_DEPS})
+
+check_PROGRAMS = \
+  test-load-c \
+  test-modsysver \
+  test-incompatdep \
+  test-agedver \
+  test-dynload
+
+test_dynload_LDFLAGS = ${GUILE_LIBS}
+
+EXTRA_DIST = \
+  test-gwrapped-c \
+  test-load-deps \
+  test-load-scm \
+  test-scm-dynload \
+  test-scm-init \
+  test-scm-module \
+  test-scm-multi \
+  CMakeLists.txt
+
+foo:
+	${TESTS_ENVIRONMENT} strace -f -o xxx ./test-load-c
diff --git a/src/gnc-module/test/README b/libgnucash/gnc-module/test/README
similarity index 100%
rename from src/gnc-module/test/README
rename to libgnucash/gnc-module/test/README
diff --git a/libgnucash/gnc-module/test/misc-mods/CMakeLists.txt b/libgnucash/gnc-module/test/misc-mods/CMakeLists.txt
new file mode 100644
index 0000000..0196333
--- /dev/null
+++ b/libgnucash/gnc-module/test/misc-mods/CMakeLists.txt
@@ -0,0 +1,16 @@
+
+INCLUDE_DIRECTORIES(
+  ${CMAKE_SOURCE_DIR}/libgnucash/gnc-module
+  ${GLIB2_INCLUDE_DIRS}
+)
+
+ADD_LIBRARY(gncmod_agedver EXCLUDE_FROM_ALL agedver.c)
+TARGET_LINK_LIBRARIES(gncmod_agedver ${GLIB2_LDFLAGS})
+
+ADD_LIBRARY(gncmod_futuremodsys  EXCLUDE_FROM_ALL futuremodsys.c)
+TARGET_LINK_LIBRARIES(gncmod_futuremodsys ${GLIB2_LDFLAGS})
+
+ADD_LIBRARY(gncmod_incompatdep  EXCLUDE_FROM_ALL incompatdep.c)
+TARGET_LINK_LIBRARIES(gncmod_incompatdep gnc-module ${GLIB2_LDFLAGS})
+
+SET_DIST_LIST(misc_mods_DIST CMakeLists.txt Makefile.am agedver.c futuremodsys.c incompatdep.c)
\ No newline at end of file
diff --git a/libgnucash/gnc-module/test/misc-mods/Makefile.am b/libgnucash/gnc-module/test/misc-mods/Makefile.am
new file mode 100644
index 0000000..d83af0e
--- /dev/null
+++ b/libgnucash/gnc-module/test/misc-mods/Makefile.am
@@ -0,0 +1,30 @@
+AM_CPPFLAGS = \
+  -I${top_srcdir}/common \
+  -I${top_srcdir}/libgnucash/gnc-module \
+  ${GLIB_CFLAGS} \
+  ${GUILE_CFLAGS}
+
+LDADD = -L../.. -L../../.libs
+
+PWD := $(shell pwd)
+check_LTLIBRARIES=libgncmod_futuremodsys.la libgncmod_incompatdep.la libgncmod_agedver.la
+
+libgncmod_futuremodsys_la_SOURCES=futuremodsys.c
+libgncmod_futuremodsys_la_LDFLAGS=-rpath ${PWD} -avoid-version -module
+libgncmod_futuremodsys_la_LIBADD = \
+  $(GLIB_LIBS)
+
+libgncmod_incompatdep_la_SOURCES=incompatdep.c
+libgncmod_incompatdep_la_LDFLAGS=--rpath ${PWD} -avoid-version -module
+libgncmod_incompatdep_la_LIBADD = \
+  ../../libgnc-module.la \
+  $(GLIB_LIBS)
+
+libgncmod_agedver_la_SOURCES=agedver.c
+libgncmod_agedver_la_LDFLAGS=-rpath ${PWD} -avoid-version -module
+libgncmod_agedver_la_LIBADD = \
+  $(GLIB_LIBS)
+
+CLEANFILES = *.so* *.a
+
+EXTRA_DIST = CMakeLists.txt
diff --git a/src/gnc-module/test/misc-mods/agedver.c b/libgnucash/gnc-module/test/misc-mods/agedver.c
similarity index 100%
rename from src/gnc-module/test/misc-mods/agedver.c
rename to libgnucash/gnc-module/test/misc-mods/agedver.c
diff --git a/src/gnc-module/test/misc-mods/futuremodsys.c b/libgnucash/gnc-module/test/misc-mods/futuremodsys.c
similarity index 100%
rename from src/gnc-module/test/misc-mods/futuremodsys.c
rename to libgnucash/gnc-module/test/misc-mods/futuremodsys.c
diff --git a/src/gnc-module/test/misc-mods/incompatdep.c b/libgnucash/gnc-module/test/misc-mods/incompatdep.c
similarity index 100%
rename from src/gnc-module/test/misc-mods/incompatdep.c
rename to libgnucash/gnc-module/test/misc-mods/incompatdep.c
diff --git a/libgnucash/gnc-module/test/mod-bar/CMakeLists.txt b/libgnucash/gnc-module/test/mod-bar/CMakeLists.txt
new file mode 100644
index 0000000..36b5905
--- /dev/null
+++ b/libgnucash/gnc-module/test/mod-bar/CMakeLists.txt
@@ -0,0 +1,24 @@
+
+IF (BUILDING_FROM_VCS)
+  SET (SWIG_BAR_C ${CMAKE_CURRENT_BINARY_DIR}/swig-bar.c)
+  GNC_ADD_SWIG_COMMAND (swig-bar-c ${SWIG_BAR_C} ${CMAKE_CURRENT_SOURCE_DIR}/bar.i bar.h)
+ELSE()
+  SET (SWIG_BAR_C ${CMAKE_CURRENT_SOURCE_DIR}/swig-bar.c)
+ENDIF()
+
+ADD_LIBRARY(bar EXCLUDE_FROM_ALL bar.c bar.h)
+ADD_LIBRARY(gncmodbar EXCLUDE_FROM_ALL gnc-mod-bar.c)
+SET_SOURCE_FILES_PROPERTIES (gnc-mod-bar.c PROPERTY OBJECT_DEPENDS ${SWIG_BAR_C})
+
+TARGET_LINK_LIBRARIES(gncmodbar bar gnc-module)
+TARGET_INCLUDE_DIRECTORIES(gncmodbar PRIVATE
+  ${CMAKE_BINARY_DIR}/common
+  ${CMAKE_CURRENT_SOURCE_DIR}
+  ${CMAKE_CURRENT_BINARY_DIR}
+  ${CMAKE_SOURCE_DIR}/common
+  ${CMAKE_SOURCE_DIR}/libgnucash/gnc-module
+  ${GLIB2_INCLUDE_DIRS}
+  ${GUILE_INCLUDE_DIRS}
+)
+
+SET_DIST_LIST(mod_bar_DIST CMakeLists.txt Makefile.am bar.c gnucash/bar.scm bar.h bar.i gnc-mod-bar.c)
\ No newline at end of file
diff --git a/libgnucash/gnc-module/test/mod-bar/Makefile.am b/libgnucash/gnc-module/test/mod-bar/Makefile.am
new file mode 100644
index 0000000..9261530
--- /dev/null
+++ b/libgnucash/gnc-module/test/mod-bar/Makefile.am
@@ -0,0 +1,43 @@
+AM_CPPFLAGS = \
+  -I${top_srcdir}/common \
+  -I${top_srcdir}/libgnucash/gnc-module \
+  ${GUILE_CFLAGS} \
+  ${GLIB_CFLAGS}
+
+PWD := $(shell pwd)
+check_LTLIBRARIES = libbar.la libgncmodbar.la
+
+libbar_la_SOURCES = bar.c
+libbar_la_LDFLAGS = -rpath ${PWD}
+
+# Make swig-bar.c for dist. It is an automatic dependency
+# of gnc-mod-bar.c
+noinst_HEADERS = \
+  bar.h \
+  swig-bar.c
+
+libgncmodbar_la_SOURCES=gnc-mod-bar.c
+libgncmodbar_la_LDFLAGS=-rpath ${PWD} -avoid-version
+libgncmodbar_la_LIBADD=libbar.la \
+  $(GUILE_LIBS) \
+  $(GLIB_LIBS)
+
+if BUILDING_FROM_VCS
+swig-bar.c: bar.i
+	$(SWIG) -guile $(SWIG_ARGS) -Linkage module -o $@ $<
+if ! OS_WIN32
+if ! SWIG_DIST_FAIL
+	if ! `grep "define scm_from_utf8_string" $@ > /dev/null 2>&1`; then \
+	  patch $@ $(top_srcdir)/common/swig-utf8.patch; \
+	fi
+endif
+endif
+endif
+
+EXTRA_DIST = \
+  bar.i \
+  gnucash/bar.scm \
+  CMakeLists.txt
+
+BUILT_SOURCES = swig-bar.c
+MAINTAINERCLEANFILES = swig-bar.c
diff --git a/src/gnc-module/test/mod-bar/bar.c b/libgnucash/gnc-module/test/mod-bar/bar.c
similarity index 100%
rename from src/gnc-module/test/mod-bar/bar.c
rename to libgnucash/gnc-module/test/mod-bar/bar.c
diff --git a/src/gnc-module/test/mod-bar/bar.h b/libgnucash/gnc-module/test/mod-bar/bar.h
similarity index 100%
rename from src/gnc-module/test/mod-bar/bar.h
rename to libgnucash/gnc-module/test/mod-bar/bar.h
diff --git a/src/gnc-module/test/mod-bar/bar.i b/libgnucash/gnc-module/test/mod-bar/bar.i
similarity index 100%
rename from src/gnc-module/test/mod-bar/bar.i
rename to libgnucash/gnc-module/test/mod-bar/bar.i
diff --git a/src/gnc-module/test/mod-bar/gnc-mod-bar.c b/libgnucash/gnc-module/test/mod-bar/gnc-mod-bar.c
similarity index 100%
rename from src/gnc-module/test/mod-bar/gnc-mod-bar.c
rename to libgnucash/gnc-module/test/mod-bar/gnc-mod-bar.c
diff --git a/src/gnc-module/test/mod-bar/gnucash/bar.scm b/libgnucash/gnc-module/test/mod-bar/gnucash/bar.scm
similarity index 100%
rename from src/gnc-module/test/mod-bar/gnucash/bar.scm
rename to libgnucash/gnc-module/test/mod-bar/gnucash/bar.scm
diff --git a/libgnucash/gnc-module/test/mod-baz/CMakeLists.txt b/libgnucash/gnc-module/test/mod-baz/CMakeLists.txt
new file mode 100644
index 0000000..f287b7d
--- /dev/null
+++ b/libgnucash/gnc-module/test/mod-baz/CMakeLists.txt
@@ -0,0 +1,30 @@
+
+IF (BUILDING_FROM_VCS)
+  SET (SWIG_BAZ_C ${CMAKE_CURRENT_BINARY_DIR}/swig-baz.c)
+  GNC_ADD_SWIG_COMMAND (swig-baz-c ${SWIG_BAZ_C} ${CMAKE_CURRENT_SOURCE_DIR}/baz.i baz.h)
+ELSE()
+  SET (SWIG_BAZ_C ${CMAKE_CURRENT_SOURCE_DIR}/swig-baz.c)
+ENDIF()
+
+ADD_LIBRARY(baz EXCLUDE_FROM_ALL baz.c baz.h)
+TARGET_INCLUDE_DIRECTORIES(baz PRIVATE
+  ${CMAKE_SOURCE_DIR}/libgnucash/gnc-module/test/mod-foo
+)
+TARGET_LINK_LIBRARIES(baz foo)
+
+
+ADD_LIBRARY(gncmodbaz EXCLUDE_FROM_ALL gnc-mod-baz.c)
+SET_SOURCE_FILES_PROPERTIES (gnc-mod-baz.c PROPERTY OBJECT_DEPENDS ${SWIG_BAZ_C})
+
+TARGET_LINK_LIBRARIES(gncmodbaz baz gnc-module)
+TARGET_INCLUDE_DIRECTORIES(gncmodbaz PRIVATE
+  ${CMAKE_BINARY_DIR}/common
+  ${CMAKE_CURRENT_SOURCE_DIR}
+  ${CMAKE_CURRENT_BINARY_DIR}
+  ${CMAKE_SOURCE_DIR}/common
+  ${CMAKE_SOURCE_DIR}/libgnucash/gnc-module
+  ${GLIB2_INCLUDE_DIRS}
+  ${GUILE_INCLUDE_DIRS}
+)
+
+SET_DIST_LIST(mod_baz_DIST CMakeLists.txt Makefile.am baz.c gnucash/baz.scm baz.h baz.i gnc-mod-baz.c)
\ No newline at end of file
diff --git a/libgnucash/gnc-module/test/mod-baz/Makefile.am b/libgnucash/gnc-module/test/mod-baz/Makefile.am
new file mode 100644
index 0000000..6914f93
--- /dev/null
+++ b/libgnucash/gnc-module/test/mod-baz/Makefile.am
@@ -0,0 +1,47 @@
+AM_CPPFLAGS = \
+  -I${top_srcdir}/common \
+  -I${top_srcdir}/libgnucash/gnc-module \
+  -I${top_srcdir}/libgnucash/gnc-module/test/mod-foo \
+  ${GLIB_CFLAGS} \
+  ${GUILE_CFLAGS}
+
+PWD := $(shell pwd)
+check_LTLIBRARIES = libbaz.la libgncmodbaz.la
+
+libbaz_la_SOURCES = baz.c
+libbaz_la_LDFLAGS = -rpath ${PWD}
+libbaz_la_LIBADD = ../mod-foo/libfoo.la
+
+# Make swig-baz.c for dist. It is an automatic dependency
+# of gnc-mod-baz.c
+noinst_HEADERS = \
+  baz.h \
+  swig-baz.c
+
+libgncmodbaz_la_SOURCES = gnc-mod-baz.c
+libgncmodbaz_la_LDFLAGS = -rpath ${PWD} -avoid-version
+libgncmodbaz_la_LIBADD = \
+  libbaz.la \
+  ../../libgnc-module.la \
+  $(GUILE_LIBS) \
+  $(GLIB_LIBS)
+
+if BUILDING_FROM_VCS
+swig-baz.c: baz.i
+	$(SWIG) -guile $(SWIG_ARGS) -Linkage module -o $@ $<
+if ! OS_WIN32
+if ! SWIG_DIST_FAIL
+	if ! `grep "define scm_from_utf8_string" $@ > /dev/null 2>&1`; then \
+	  patch $@ $(top_srcdir)/common/swig-utf8.patch; \
+	fi
+endif
+endif
+endif
+
+EXTRA_DIST = \
+  baz.i \
+  gnucash/baz.scm \
+  CMakeLists.txt
+
+BUILT_SOURCES = swig-baz.c
+MAINTAINERCLEANFILES = swig-baz.c
diff --git a/src/gnc-module/test/mod-baz/baz.c b/libgnucash/gnc-module/test/mod-baz/baz.c
similarity index 100%
rename from src/gnc-module/test/mod-baz/baz.c
rename to libgnucash/gnc-module/test/mod-baz/baz.c
diff --git a/src/gnc-module/test/mod-baz/baz.h b/libgnucash/gnc-module/test/mod-baz/baz.h
similarity index 100%
rename from src/gnc-module/test/mod-baz/baz.h
rename to libgnucash/gnc-module/test/mod-baz/baz.h
diff --git a/src/gnc-module/test/mod-baz/baz.i b/libgnucash/gnc-module/test/mod-baz/baz.i
similarity index 100%
rename from src/gnc-module/test/mod-baz/baz.i
rename to libgnucash/gnc-module/test/mod-baz/baz.i
diff --git a/src/gnc-module/test/mod-baz/gnc-mod-baz.c b/libgnucash/gnc-module/test/mod-baz/gnc-mod-baz.c
similarity index 100%
rename from src/gnc-module/test/mod-baz/gnc-mod-baz.c
rename to libgnucash/gnc-module/test/mod-baz/gnc-mod-baz.c
diff --git a/src/gnc-module/test/mod-baz/gnucash/baz.scm b/libgnucash/gnc-module/test/mod-baz/gnucash/baz.scm
similarity index 100%
rename from src/gnc-module/test/mod-baz/gnucash/baz.scm
rename to libgnucash/gnc-module/test/mod-baz/gnucash/baz.scm
diff --git a/libgnucash/gnc-module/test/mod-foo/CMakeLists.txt b/libgnucash/gnc-module/test/mod-foo/CMakeLists.txt
new file mode 100644
index 0000000..c98c7d2
--- /dev/null
+++ b/libgnucash/gnc-module/test/mod-foo/CMakeLists.txt
@@ -0,0 +1,24 @@
+
+IF (BUILDING_FROM_VCS)
+  SET (SWIG_FOO_C ${CMAKE_CURRENT_BINARY_DIR}/swig-foo.c)
+  GNC_ADD_SWIG_COMMAND (swig-foo-c ${SWIG_FOO_C} ${CMAKE_CURRENT_SOURCE_DIR}/foo.i foo.h)
+ELSE()
+  SET (SWIG_FOO_C ${CMAKE_CURRENT_SOURCE_DIR}/swig-foo.c)
+ENDIF()
+
+ADD_LIBRARY(foo EXCLUDE_FROM_ALL foo.c foo.h)
+ADD_LIBRARY(gncmodfoo EXCLUDE_FROM_ALL gnc-mod-foo.c)
+SET_SOURCE_FILES_PROPERTIES (gnc-mod-foo.c PROPERTY OBJECT_DEPENDS ${SWIG_FOO_C})
+
+TARGET_LINK_LIBRARIES(gncmodfoo foo gnc-module)
+TARGET_INCLUDE_DIRECTORIES(gncmodfoo PRIVATE
+  ${CMAKE_BINARY_DIR}/common
+  ${CMAKE_CURRENT_SOURCE_DIR}
+  ${CMAKE_CURRENT_BINARY_DIR}
+  ${CMAKE_SOURCE_DIR}/common
+  ${CMAKE_SOURCE_DIR}/libgnucash/gnc-module
+  ${GLIB2_INCLUDE_DIRS}
+  ${GUILE_INCLUDE_DIRS}
+)
+
+SET_DIST_LIST(mod_foo_DIST CMakeLists.txt Makefile.am foo.i gnucash/foo.scm foo.c foo.h gnc-mod-foo.c)
diff --git a/libgnucash/gnc-module/test/mod-foo/Makefile.am b/libgnucash/gnc-module/test/mod-foo/Makefile.am
new file mode 100644
index 0000000..bc92a3e
--- /dev/null
+++ b/libgnucash/gnc-module/test/mod-foo/Makefile.am
@@ -0,0 +1,44 @@
+AM_CPPFLAGS=\
+  -I${top_srcdir}/common \
+  -I${top_srcdir}/libgnucash/gnc-module \
+  ${GUILE_CFLAGS} \
+  ${GLIB_CFLAGS}
+
+PWD := $(shell pwd)
+check_LTLIBRARIES=libfoo.la libgncmodfoo.la
+
+libfoo_la_SOURCES = foo.c
+libfoo_la_LDFLAGS = -rpath ${PWD}
+
+# Make swig-foo.c for dist. It is an automatic dependency
+# of gnc-mod-foo.c
+noinst_HEADERS = \
+  foo.h \
+  swig-foo.c
+
+libgncmodfoo_la_SOURCES = gnc-mod-foo.c
+libgncmodfoo_la_LDFLAGS = -rpath ${PWD} -avoid-version
+libgncmodfoo_la_LIBADD = \
+  libfoo.la \
+  $(GUILE_LIBS) \
+  $(GLIB_LIBS)
+
+EXTRA_DIST = \
+  foo.i \
+  gnucash/foo.scm \
+  CMakeLists.txt
+
+if BUILDING_FROM_VCS
+swig-foo.c: foo.i
+	$(SWIG) -guile $(SWIG_ARGS) -Linkage module -o $@ $<
+if ! OS_WIN32
+if ! SWIG_DIST_FAIL
+	if ! `grep "define scm_from_utf8_string" $@ > /dev/null 2>&1`; then \
+	  patch $@ $(top_srcdir)/common/swig-utf8.patch; \
+	fi
+endif
+endif
+endif
+
+BUILT_SOURCES = swig-foo.c
+MAINTAINERCLEANFILES = swig-foo.c
diff --git a/src/gnc-module/test/mod-foo/foo.c b/libgnucash/gnc-module/test/mod-foo/foo.c
similarity index 100%
rename from src/gnc-module/test/mod-foo/foo.c
rename to libgnucash/gnc-module/test/mod-foo/foo.c
diff --git a/src/gnc-module/test/mod-foo/foo.h b/libgnucash/gnc-module/test/mod-foo/foo.h
similarity index 100%
rename from src/gnc-module/test/mod-foo/foo.h
rename to libgnucash/gnc-module/test/mod-foo/foo.h
diff --git a/src/gnc-module/test/mod-foo/foo.i b/libgnucash/gnc-module/test/mod-foo/foo.i
similarity index 100%
rename from src/gnc-module/test/mod-foo/foo.i
rename to libgnucash/gnc-module/test/mod-foo/foo.i
diff --git a/src/gnc-module/test/mod-foo/gnc-mod-foo.c b/libgnucash/gnc-module/test/mod-foo/gnc-mod-foo.c
similarity index 100%
rename from src/gnc-module/test/mod-foo/gnc-mod-foo.c
rename to libgnucash/gnc-module/test/mod-foo/gnc-mod-foo.c
diff --git a/src/gnc-module/test/mod-foo/gnucash/foo.scm b/libgnucash/gnc-module/test/mod-foo/gnucash/foo.scm
similarity index 100%
rename from src/gnc-module/test/mod-foo/gnucash/foo.scm
rename to libgnucash/gnc-module/test/mod-foo/gnucash/foo.scm
diff --git a/libgnucash/gnc-module/test/test-agedver.c b/libgnucash/gnc-module/test/test-agedver.c
new file mode 100644
index 0000000..16469f3
--- /dev/null
+++ b/libgnucash/gnc-module/test/test-agedver.c
@@ -0,0 +1,62 @@
+/********************************************************************\
+ * 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 at gnu.org                   *
+ *                                                                  *
+\********************************************************************/
+
+#include "config.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <libguile.h>
+
+#include "gnc-module.h"
+#include <unittest-support.h>
+
+static void
+guile_main(void *closure, int argc, char ** argv)
+{
+    GNCModule foo;
+    gchar *msg = "Module '../../../libgnucash/gnc-module/test/misc-mods/.libs/libgncmod_futuremodsys.so' requires newer module system\n";
+    gchar *logdomain = "gnc.module";
+    guint loglevel = G_LOG_LEVEL_WARNING;
+    TestErrorStruct check = { loglevel, logdomain, msg };
+    g_log_set_handler (logdomain, loglevel,
+                       (GLogFunc)test_checked_handler, &check);
+    g_test_message("  test-agedver.c:  asking for an old but supported interface ...");
+
+    gnc_module_system_init();
+
+    foo = gnc_module_load("gnucash/agedver", 5);
+
+    if (foo)
+    {
+        printf("  ok\n");
+        exit(0);
+    }
+    else
+    {
+        printf(" failed\n");
+        exit(-1);
+    }
+}
+
+int
+main(int argc, char ** argv)
+{
+    scm_boot_guile(argc, argv, guile_main, NULL);
+    return 0;
+}
diff --git a/libgnucash/gnc-module/test/test-dynload.c b/libgnucash/gnc-module/test/test-dynload.c
new file mode 100644
index 0000000..6c30553
--- /dev/null
+++ b/libgnucash/gnc-module/test/test-dynload.c
@@ -0,0 +1,112 @@
+/*********************************************************************
+ * test-dynload.c
+ * test the ability to dlopen the gnc_module library and initialize
+ * it via dlsym
+ *********************************************************************/
+/********************************************************************\
+ * 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 at gnu.org                   *
+ *                                                                  *
+\********************************************************************/
+
+
+#include "config.h"
+#include <stdio.h>
+#include <gmodule.h>
+#include <libguile.h>
+#include <unittest-support.h>
+
+#include "gnc-module.h"
+
+static void
+guile_main(void *closure, int argc, char ** argv)
+{
+    GModule *gmodule;
+    gchar *msg = "Module '../../../libgnucash/gnc-module/test/misc-mods/.libs/libgncmod_futuremodsys.so' requires newer module system\n";
+    gchar *logdomain = "gnc.module";
+    gchar *modpath;
+    guint loglevel = G_LOG_LEVEL_WARNING;
+    const char *libdir = g_getenv("LIBDIR");
+    TestErrorStruct check = { loglevel, logdomain, msg };
+    g_log_set_handler (logdomain, loglevel,
+                       (GLogFunc)test_checked_handler, &check);
+
+    if (libdir == NULL)
+    {
+        libdir = "../.libs";
+    }
+
+    g_test_message("  test-dynload.c: testing dynamic linking of libgnc-module ...");
+#ifdef G_OS_WIN32
+/* MinGW builds libgnc-module-0.dll */
+    if (libdir == NULL)
+    {
+        modpath = g_module_build_path ("../.libs", "gnc-module-0");
+    }
+    else
+    {
+        modpath = g_module_build_path (libdir, "gnc-module");
+    }
+#elif defined(GNC_PLATFORM_OSX)
+/* We build libgnc-module as a shared library for testing, and on OSX
+ * that means that g_module_build_path (), which uses ".so", doesn't
+ * build the right path name.
+ */
+    if (libdir == NULL)
+    {
+        modpath = g_build_filename ("..", ".libs", "libgnc-module.dylib", NULL);
+    }
+    else
+    {
+        modpath = g_build_filename (libdir, "libgnc-module.dylib", NULL);
+    }
+#else /* Regular Unix */
+    modpath = g_module_build_path (libdir, "gnc-module");
+#endif
+    gmodule = g_module_open(modpath, 0);
+
+    if (gmodule)
+    {
+        gpointer ptr;
+        if (g_module_symbol(gmodule, "gnc_module_system_init", &ptr))
+        {
+            void (* fn)(void) = ptr;
+            fn();
+            printf(" OK\n");
+            exit(0);
+        }
+        else
+        {
+            printf(" failed to find gnc_module_system_init\n");
+            exit(-1);
+        }
+    }
+    else
+    {
+        printf(" failed to open library.\n");
+        printf("%s\n", g_module_error());
+        exit(-1);
+    }
+}
+
+int
+main(int argc, char ** argv)
+{
+    scm_boot_guile(argc, argv, guile_main, NULL);
+    return 0;
+}
+
diff --git a/src/gnc-module/test/test-gwrapped-c.in b/libgnucash/gnc-module/test/test-gwrapped-c.in
similarity index 100%
rename from src/gnc-module/test/test-gwrapped-c.in
rename to libgnucash/gnc-module/test/test-gwrapped-c.in
diff --git a/libgnucash/gnc-module/test/test-incompatdep.c b/libgnucash/gnc-module/test/test-incompatdep.c
new file mode 100644
index 0000000..ad303db
--- /dev/null
+++ b/libgnucash/gnc-module/test/test-incompatdep.c
@@ -0,0 +1,67 @@
+/********************************************************************\
+ * 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 at gnu.org                   *
+ *                                                                  *
+\********************************************************************/
+
+#include "config.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <libguile.h>
+#include <unittest-support.h>
+
+#include "gnc-module.h"
+
+static void
+guile_main(void *closure, int argc, char ** argv)
+{
+    GNCModule foo;
+    gchar *msg1 = "Module '../../../libgnucash/gnc-module/test/misc-mods/.libs/libgncmod_futuremodsys.so' requires newer module system\n";
+    gchar *msg2 = "Could not locate module gnucash/incompatdep interface v.0";
+    gchar *logdomain = "gnc.module";
+    guint loglevel = G_LOG_LEVEL_WARNING;
+    TestErrorStruct check1 = { loglevel, logdomain, msg1 };
+    TestErrorStruct check2 = { loglevel, logdomain, msg2 };
+    test_add_error (&check1);
+    test_add_error (&check2);
+    g_log_set_handler (logdomain, loglevel,
+                       (GLogFunc)test_list_handler, NULL);
+
+    g_test_message("  test-incompatdep.c:  loading a module with bad deps ...\n");
+
+    gnc_module_system_init();
+
+    foo = gnc_module_load("gnucash/incompatdep", 0);
+
+    if (!foo)
+    {
+        printf("  ok\n");
+        exit(0);
+    }
+    else
+    {
+        printf("  oops! loaded incompatible module\n");
+        exit(-1);
+    }
+}
+
+int
+main(int argc, char ** argv)
+{
+    scm_boot_guile(argc, argv, guile_main, NULL);
+    return 0;
+}
diff --git a/libgnucash/gnc-module/test/test-load-c.c b/libgnucash/gnc-module/test/test-load-c.c
new file mode 100644
index 0000000..5341452
--- /dev/null
+++ b/libgnucash/gnc-module/test/test-load-c.c
@@ -0,0 +1,67 @@
+/********************************************************************\
+ * 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 at gnu.org                   *
+ *                                                                  *
+\********************************************************************/
+
+#include "config.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <libguile.h>
+#include <unittest-support.h>
+
+#include "gnc-module.h"
+
+static void
+guile_main(void *closure, int argc, char ** argv)
+{
+    GNCModule foo;
+    gchar *msg = "Module '../../../libgnucash/gnc-module/test/misc-mods/.libs/libgncmod_futuremodsys.so' requires newer module system\n";
+    gchar *logdomain = "gnc.module";
+    guint loglevel = G_LOG_LEVEL_WARNING;
+    TestErrorStruct check = { loglevel, logdomain, msg };
+    g_log_set_handler (logdomain, loglevel,
+                       (GLogFunc)test_checked_handler, &check);
+
+    g_test_message("  test-load-c.c: testing module load/unload from C ... ");
+
+    gnc_module_system_init();
+
+    foo = gnc_module_load("gnucash/foo", 0);
+
+    if (!foo)
+    {
+        g_test_message("  Failed to load foo\n");
+        exit(-1);
+    }
+
+    if (!gnc_module_unload(foo))
+    {
+        g_test_message("  Failed to unload foo\n");
+        exit(-1);
+    }
+    g_test_message(" successful.\n");
+
+    exit(0);
+}
+
+int
+main(int argc, char ** argv)
+{
+    scm_boot_guile(argc, argv, guile_main, NULL);
+    return 0;
+}
diff --git a/src/gnc-module/test/test-load-deps.in b/libgnucash/gnc-module/test/test-load-deps.in
similarity index 100%
rename from src/gnc-module/test/test-load-deps.in
rename to libgnucash/gnc-module/test/test-load-deps.in
diff --git a/src/gnc-module/test/test-load-scm.in b/libgnucash/gnc-module/test/test-load-scm.in
similarity index 100%
rename from src/gnc-module/test/test-load-scm.in
rename to libgnucash/gnc-module/test/test-load-scm.in
diff --git a/libgnucash/gnc-module/test/test-modsysver.c b/libgnucash/gnc-module/test/test-modsysver.c
new file mode 100644
index 0000000..fe7d63b
--- /dev/null
+++ b/libgnucash/gnc-module/test/test-modsysver.c
@@ -0,0 +1,68 @@
+/********************************************************************\
+ * 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 at gnu.org                   *
+ *                                                                  *
+\********************************************************************/
+
+#include "config.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <libguile.h>
+#include <unittest-support.h>
+
+#include "gnc-module.h"
+
+static void
+guile_main(void *closure, int argc, char ** argv)
+{
+    GNCModule foo;
+    gchar *msg1 = "Module '../../../libgnucash/gnc-module/test/misc-mods/.libs/libgncmod_futuremodsys.so' requires newer module system\n";
+    gchar *msg2 = "Could not locate module gnucash/futuremodsys interface v.0";
+    gchar *logdomain = "gnc.module";
+    guint loglevel = G_LOG_LEVEL_WARNING;
+    TestErrorStruct check1 = { loglevel, logdomain, msg1 };
+    TestErrorStruct check2 = { loglevel, logdomain, msg2 };
+    test_add_error (&check1);
+    test_add_error (&check2);
+    g_log_set_handler (logdomain, loglevel,
+                       (GLogFunc)test_list_handler, NULL);
+
+    g_test_message("  test-modsysver.c: checking for a module we shouldn't find ...\n");
+
+    gnc_module_system_init();
+
+    foo = gnc_module_load("gnucash/futuremodsys", 0);
+
+    if (!foo)
+    {
+        printf("  ok\n");
+        exit(0);
+    }
+    else
+    {
+        printf("  oops! loaded incompatible module\n");
+        exit(-1);
+    }
+    test_clear_error_list ();
+}
+
+int
+main(int argc, char ** argv)
+{
+    scm_boot_guile(argc, argv, guile_main, NULL);
+    return 0;
+}
diff --git a/src/gnc-module/test/test-scm-dynload.in b/libgnucash/gnc-module/test/test-scm-dynload.in
similarity index 100%
rename from src/gnc-module/test/test-scm-dynload.in
rename to libgnucash/gnc-module/test/test-scm-dynload.in
diff --git a/src/gnc-module/test/test-scm-init.in b/libgnucash/gnc-module/test/test-scm-init.in
similarity index 100%
rename from src/gnc-module/test/test-scm-init.in
rename to libgnucash/gnc-module/test/test-scm-init.in
diff --git a/src/gnc-module/test/test-scm-module.in b/libgnucash/gnc-module/test/test-scm-module.in
similarity index 100%
rename from src/gnc-module/test/test-scm-module.in
rename to libgnucash/gnc-module/test/test-scm-module.in
diff --git a/src/gnc-module/test/test-scm-multi.in b/libgnucash/gnc-module/test/test-scm-multi.in
similarity index 100%
rename from src/gnc-module/test/test-scm-multi.in
rename to libgnucash/gnc-module/test/test-scm-multi.in
diff --git a/src/pixmaps/CMakeLists.txt b/libgnucash/pixmaps/CMakeLists.txt
similarity index 100%
rename from src/pixmaps/CMakeLists.txt
rename to libgnucash/pixmaps/CMakeLists.txt
diff --git a/src/pixmaps/Makefile.am b/libgnucash/pixmaps/Makefile.am
similarity index 100%
rename from src/pixmaps/Makefile.am
rename to libgnucash/pixmaps/Makefile.am
diff --git a/src/pixmaps/gnucash-icon-48x48.bmp b/libgnucash/pixmaps/gnucash-icon-48x48.bmp
similarity index 100%
rename from src/pixmaps/gnucash-icon-48x48.bmp
rename to libgnucash/pixmaps/gnucash-icon-48x48.bmp
diff --git a/src/pixmaps/gnucash-icon.ico b/libgnucash/pixmaps/gnucash-icon.ico
similarity index 100%
rename from src/pixmaps/gnucash-icon.ico
rename to libgnucash/pixmaps/gnucash-icon.ico
diff --git a/src/pixmaps/gnucash_splash.png b/libgnucash/pixmaps/gnucash_splash.png
similarity index 100%
rename from src/pixmaps/gnucash_splash.png
rename to libgnucash/pixmaps/gnucash_splash.png
diff --git a/src/pixmaps/hicolor/128x128/apps/gnucash-icon.png b/libgnucash/pixmaps/hicolor/128x128/apps/gnucash-icon.png
similarity index 100%
rename from src/pixmaps/hicolor/128x128/apps/gnucash-icon.png
rename to libgnucash/pixmaps/hicolor/128x128/apps/gnucash-icon.png
diff --git a/src/pixmaps/hicolor/16x16/actions/gnc-account-delete.png b/libgnucash/pixmaps/hicolor/16x16/actions/gnc-account-delete.png
similarity index 100%
rename from src/pixmaps/hicolor/16x16/actions/gnc-account-delete.png
rename to libgnucash/pixmaps/hicolor/16x16/actions/gnc-account-delete.png
diff --git a/src/pixmaps/hicolor/16x16/actions/gnc-account-edit.png b/libgnucash/pixmaps/hicolor/16x16/actions/gnc-account-edit.png
similarity index 100%
rename from src/pixmaps/hicolor/16x16/actions/gnc-account-edit.png
rename to libgnucash/pixmaps/hicolor/16x16/actions/gnc-account-edit.png
diff --git a/src/pixmaps/hicolor/16x16/actions/gnc-account-new.png b/libgnucash/pixmaps/hicolor/16x16/actions/gnc-account-new.png
similarity index 100%
rename from src/pixmaps/hicolor/16x16/actions/gnc-account-new.png
rename to libgnucash/pixmaps/hicolor/16x16/actions/gnc-account-new.png
diff --git a/src/pixmaps/hicolor/16x16/actions/gnc-account-open.png b/libgnucash/pixmaps/hicolor/16x16/actions/gnc-account-open.png
similarity index 100%
rename from src/pixmaps/hicolor/16x16/actions/gnc-account-open.png
rename to libgnucash/pixmaps/hicolor/16x16/actions/gnc-account-open.png
diff --git a/src/pixmaps/hicolor/16x16/actions/gnc-account-report.png b/libgnucash/pixmaps/hicolor/16x16/actions/gnc-account-report.png
similarity index 100%
rename from src/pixmaps/hicolor/16x16/actions/gnc-account-report.png
rename to libgnucash/pixmaps/hicolor/16x16/actions/gnc-account-report.png
diff --git a/src/pixmaps/hicolor/16x16/actions/gnc-account.png b/libgnucash/pixmaps/hicolor/16x16/actions/gnc-account.png
similarity index 100%
rename from src/pixmaps/hicolor/16x16/actions/gnc-account.png
rename to libgnucash/pixmaps/hicolor/16x16/actions/gnc-account.png
diff --git a/src/pixmaps/hicolor/16x16/actions/gnc-gnome-pdf.png b/libgnucash/pixmaps/hicolor/16x16/actions/gnc-gnome-pdf.png
similarity index 100%
rename from src/pixmaps/hicolor/16x16/actions/gnc-gnome-pdf.png
rename to libgnucash/pixmaps/hicolor/16x16/actions/gnc-gnome-pdf.png
diff --git a/src/pixmaps/hicolor/16x16/actions/gnc-invoice-duplicate.png b/libgnucash/pixmaps/hicolor/16x16/actions/gnc-invoice-duplicate.png
similarity index 100%
rename from src/pixmaps/hicolor/16x16/actions/gnc-invoice-duplicate.png
rename to libgnucash/pixmaps/hicolor/16x16/actions/gnc-invoice-duplicate.png
diff --git a/src/pixmaps/hicolor/16x16/actions/gnc-invoice-edit.png b/libgnucash/pixmaps/hicolor/16x16/actions/gnc-invoice-edit.png
similarity index 100%
rename from src/pixmaps/hicolor/16x16/actions/gnc-invoice-edit.png
rename to libgnucash/pixmaps/hicolor/16x16/actions/gnc-invoice-edit.png
diff --git a/src/pixmaps/hicolor/16x16/actions/gnc-invoice-new.png b/libgnucash/pixmaps/hicolor/16x16/actions/gnc-invoice-new.png
similarity index 100%
rename from src/pixmaps/hicolor/16x16/actions/gnc-invoice-new.png
rename to libgnucash/pixmaps/hicolor/16x16/actions/gnc-invoice-new.png
diff --git a/src/pixmaps/hicolor/16x16/actions/gnc-invoice-pay.png b/libgnucash/pixmaps/hicolor/16x16/actions/gnc-invoice-pay.png
similarity index 100%
rename from src/pixmaps/hicolor/16x16/actions/gnc-invoice-pay.png
rename to libgnucash/pixmaps/hicolor/16x16/actions/gnc-invoice-pay.png
diff --git a/src/pixmaps/hicolor/16x16/actions/gnc-invoice-post.png b/libgnucash/pixmaps/hicolor/16x16/actions/gnc-invoice-post.png
similarity index 100%
rename from src/pixmaps/hicolor/16x16/actions/gnc-invoice-post.png
rename to libgnucash/pixmaps/hicolor/16x16/actions/gnc-invoice-post.png
diff --git a/src/pixmaps/hicolor/16x16/actions/gnc-invoice-unpost.png b/libgnucash/pixmaps/hicolor/16x16/actions/gnc-invoice-unpost.png
similarity index 100%
rename from src/pixmaps/hicolor/16x16/actions/gnc-invoice-unpost.png
rename to libgnucash/pixmaps/hicolor/16x16/actions/gnc-invoice-unpost.png
diff --git a/src/pixmaps/hicolor/16x16/actions/gnc-invoice.png b/libgnucash/pixmaps/hicolor/16x16/actions/gnc-invoice.png
similarity index 100%
rename from src/pixmaps/hicolor/16x16/actions/gnc-invoice.png
rename to libgnucash/pixmaps/hicolor/16x16/actions/gnc-invoice.png
diff --git a/src/pixmaps/hicolor/16x16/actions/gnc-jumpto.png b/libgnucash/pixmaps/hicolor/16x16/actions/gnc-jumpto.png
similarity index 100%
rename from src/pixmaps/hicolor/16x16/actions/gnc-jumpto.png
rename to libgnucash/pixmaps/hicolor/16x16/actions/gnc-jumpto.png
diff --git a/src/pixmaps/hicolor/16x16/actions/gnc-split-trans.png b/libgnucash/pixmaps/hicolor/16x16/actions/gnc-split-trans.png
similarity index 100%
rename from src/pixmaps/hicolor/16x16/actions/gnc-split-trans.png
rename to libgnucash/pixmaps/hicolor/16x16/actions/gnc-split-trans.png
diff --git a/src/pixmaps/hicolor/16x16/actions/gnc-sx-new.png b/libgnucash/pixmaps/hicolor/16x16/actions/gnc-sx-new.png
similarity index 100%
rename from src/pixmaps/hicolor/16x16/actions/gnc-sx-new.png
rename to libgnucash/pixmaps/hicolor/16x16/actions/gnc-sx-new.png
diff --git a/src/pixmaps/hicolor/16x16/actions/gnc-transfer.png b/libgnucash/pixmaps/hicolor/16x16/actions/gnc-transfer.png
similarity index 100%
rename from src/pixmaps/hicolor/16x16/actions/gnc-transfer.png
rename to libgnucash/pixmaps/hicolor/16x16/actions/gnc-transfer.png
diff --git a/src/pixmaps/hicolor/16x16/apps/gnucash-icon.png b/libgnucash/pixmaps/hicolor/16x16/apps/gnucash-icon.png
similarity index 100%
rename from src/pixmaps/hicolor/16x16/apps/gnucash-icon.png
rename to libgnucash/pixmaps/hicolor/16x16/apps/gnucash-icon.png
diff --git a/src/pixmaps/hicolor/22x22/apps/gnucash-icon.png b/libgnucash/pixmaps/hicolor/22x22/apps/gnucash-icon.png
similarity index 100%
rename from src/pixmaps/hicolor/22x22/apps/gnucash-icon.png
rename to libgnucash/pixmaps/hicolor/22x22/apps/gnucash-icon.png
diff --git a/src/pixmaps/hicolor/24x24/actions/gnc-account-delete.png b/libgnucash/pixmaps/hicolor/24x24/actions/gnc-account-delete.png
similarity index 100%
rename from src/pixmaps/hicolor/24x24/actions/gnc-account-delete.png
rename to libgnucash/pixmaps/hicolor/24x24/actions/gnc-account-delete.png
diff --git a/src/pixmaps/hicolor/24x24/actions/gnc-account-edit.png b/libgnucash/pixmaps/hicolor/24x24/actions/gnc-account-edit.png
similarity index 100%
rename from src/pixmaps/hicolor/24x24/actions/gnc-account-edit.png
rename to libgnucash/pixmaps/hicolor/24x24/actions/gnc-account-edit.png
diff --git a/src/pixmaps/hicolor/24x24/actions/gnc-account-new.png b/libgnucash/pixmaps/hicolor/24x24/actions/gnc-account-new.png
similarity index 100%
rename from src/pixmaps/hicolor/24x24/actions/gnc-account-new.png
rename to libgnucash/pixmaps/hicolor/24x24/actions/gnc-account-new.png
diff --git a/src/pixmaps/hicolor/24x24/actions/gnc-account-open.png b/libgnucash/pixmaps/hicolor/24x24/actions/gnc-account-open.png
similarity index 100%
rename from src/pixmaps/hicolor/24x24/actions/gnc-account-open.png
rename to libgnucash/pixmaps/hicolor/24x24/actions/gnc-account-open.png
diff --git a/src/pixmaps/hicolor/24x24/actions/gnc-account-report.png b/libgnucash/pixmaps/hicolor/24x24/actions/gnc-account-report.png
similarity index 100%
rename from src/pixmaps/hicolor/24x24/actions/gnc-account-report.png
rename to libgnucash/pixmaps/hicolor/24x24/actions/gnc-account-report.png
diff --git a/src/pixmaps/hicolor/24x24/actions/gnc-account.png b/libgnucash/pixmaps/hicolor/24x24/actions/gnc-account.png
similarity index 100%
rename from src/pixmaps/hicolor/24x24/actions/gnc-account.png
rename to libgnucash/pixmaps/hicolor/24x24/actions/gnc-account.png
diff --git a/src/pixmaps/hicolor/24x24/actions/gnc-gnome-pdf.png b/libgnucash/pixmaps/hicolor/24x24/actions/gnc-gnome-pdf.png
similarity index 100%
rename from src/pixmaps/hicolor/24x24/actions/gnc-gnome-pdf.png
rename to libgnucash/pixmaps/hicolor/24x24/actions/gnc-gnome-pdf.png
diff --git a/src/pixmaps/hicolor/24x24/actions/gnc-invoice-duplicate.png b/libgnucash/pixmaps/hicolor/24x24/actions/gnc-invoice-duplicate.png
similarity index 100%
rename from src/pixmaps/hicolor/24x24/actions/gnc-invoice-duplicate.png
rename to libgnucash/pixmaps/hicolor/24x24/actions/gnc-invoice-duplicate.png
diff --git a/src/pixmaps/hicolor/24x24/actions/gnc-invoice-edit.png b/libgnucash/pixmaps/hicolor/24x24/actions/gnc-invoice-edit.png
similarity index 100%
rename from src/pixmaps/hicolor/24x24/actions/gnc-invoice-edit.png
rename to libgnucash/pixmaps/hicolor/24x24/actions/gnc-invoice-edit.png
diff --git a/src/pixmaps/hicolor/24x24/actions/gnc-invoice-new.png b/libgnucash/pixmaps/hicolor/24x24/actions/gnc-invoice-new.png
similarity index 100%
rename from src/pixmaps/hicolor/24x24/actions/gnc-invoice-new.png
rename to libgnucash/pixmaps/hicolor/24x24/actions/gnc-invoice-new.png
diff --git a/src/pixmaps/hicolor/24x24/actions/gnc-invoice-pay.png b/libgnucash/pixmaps/hicolor/24x24/actions/gnc-invoice-pay.png
similarity index 100%
rename from src/pixmaps/hicolor/24x24/actions/gnc-invoice-pay.png
rename to libgnucash/pixmaps/hicolor/24x24/actions/gnc-invoice-pay.png
diff --git a/src/pixmaps/hicolor/24x24/actions/gnc-invoice-post.png b/libgnucash/pixmaps/hicolor/24x24/actions/gnc-invoice-post.png
similarity index 100%
rename from src/pixmaps/hicolor/24x24/actions/gnc-invoice-post.png
rename to libgnucash/pixmaps/hicolor/24x24/actions/gnc-invoice-post.png
diff --git a/src/pixmaps/hicolor/24x24/actions/gnc-invoice-unpost.png b/libgnucash/pixmaps/hicolor/24x24/actions/gnc-invoice-unpost.png
similarity index 100%
rename from src/pixmaps/hicolor/24x24/actions/gnc-invoice-unpost.png
rename to libgnucash/pixmaps/hicolor/24x24/actions/gnc-invoice-unpost.png
diff --git a/src/pixmaps/hicolor/24x24/actions/gnc-invoice.png b/libgnucash/pixmaps/hicolor/24x24/actions/gnc-invoice.png
similarity index 100%
rename from src/pixmaps/hicolor/24x24/actions/gnc-invoice.png
rename to libgnucash/pixmaps/hicolor/24x24/actions/gnc-invoice.png
diff --git a/src/pixmaps/hicolor/24x24/actions/gnc-jumpto.png b/libgnucash/pixmaps/hicolor/24x24/actions/gnc-jumpto.png
similarity index 100%
rename from src/pixmaps/hicolor/24x24/actions/gnc-jumpto.png
rename to libgnucash/pixmaps/hicolor/24x24/actions/gnc-jumpto.png
diff --git a/src/pixmaps/hicolor/24x24/actions/gnc-split-trans.png b/libgnucash/pixmaps/hicolor/24x24/actions/gnc-split-trans.png
similarity index 100%
rename from src/pixmaps/hicolor/24x24/actions/gnc-split-trans.png
rename to libgnucash/pixmaps/hicolor/24x24/actions/gnc-split-trans.png
diff --git a/src/pixmaps/hicolor/24x24/actions/gnc-sx-new.png b/libgnucash/pixmaps/hicolor/24x24/actions/gnc-sx-new.png
similarity index 100%
rename from src/pixmaps/hicolor/24x24/actions/gnc-sx-new.png
rename to libgnucash/pixmaps/hicolor/24x24/actions/gnc-sx-new.png
diff --git a/src/pixmaps/hicolor/24x24/actions/gnc-transfer.png b/libgnucash/pixmaps/hicolor/24x24/actions/gnc-transfer.png
similarity index 100%
rename from src/pixmaps/hicolor/24x24/actions/gnc-transfer.png
rename to libgnucash/pixmaps/hicolor/24x24/actions/gnc-transfer.png
diff --git a/src/pixmaps/hicolor/24x24/apps/gnucash-icon.png b/libgnucash/pixmaps/hicolor/24x24/apps/gnucash-icon.png
similarity index 100%
rename from src/pixmaps/hicolor/24x24/apps/gnucash-icon.png
rename to libgnucash/pixmaps/hicolor/24x24/apps/gnucash-icon.png
diff --git a/src/pixmaps/hicolor/256x256/apps/gnucash-icon.png b/libgnucash/pixmaps/hicolor/256x256/apps/gnucash-icon.png
similarity index 100%
rename from src/pixmaps/hicolor/256x256/apps/gnucash-icon.png
rename to libgnucash/pixmaps/hicolor/256x256/apps/gnucash-icon.png
diff --git a/src/pixmaps/hicolor/32x32/apps/gnucash-icon.png b/libgnucash/pixmaps/hicolor/32x32/apps/gnucash-icon.png
similarity index 100%
rename from src/pixmaps/hicolor/32x32/apps/gnucash-icon.png
rename to libgnucash/pixmaps/hicolor/32x32/apps/gnucash-icon.png
diff --git a/src/pixmaps/hicolor/48x48/apps/gnucash-icon.png b/libgnucash/pixmaps/hicolor/48x48/apps/gnucash-icon.png
similarity index 100%
rename from src/pixmaps/hicolor/48x48/apps/gnucash-icon.png
rename to libgnucash/pixmaps/hicolor/48x48/apps/gnucash-icon.png
diff --git a/src/pixmaps/hicolor/64x64/apps/gnucash-icon.png b/libgnucash/pixmaps/hicolor/64x64/apps/gnucash-icon.png
similarity index 100%
rename from src/pixmaps/hicolor/64x64/apps/gnucash-icon.png
rename to libgnucash/pixmaps/hicolor/64x64/apps/gnucash-icon.png
diff --git a/src/pixmaps/hicolor/96x96/apps/gnucash-icon.png b/libgnucash/pixmaps/hicolor/96x96/apps/gnucash-icon.png
similarity index 100%
rename from src/pixmaps/hicolor/96x96/apps/gnucash-icon.png
rename to libgnucash/pixmaps/hicolor/96x96/apps/gnucash-icon.png
diff --git a/src/pixmaps/hicolor/scalable/apps/gnucash-icon.svg b/libgnucash/pixmaps/hicolor/scalable/apps/gnucash-icon.svg
similarity index 100%
rename from src/pixmaps/hicolor/scalable/apps/gnucash-icon.svg
rename to libgnucash/pixmaps/hicolor/scalable/apps/gnucash-icon.svg
diff --git a/src/quotes/CMakeLists.txt b/libgnucash/quotes/CMakeLists.txt
similarity index 100%
rename from src/quotes/CMakeLists.txt
rename to libgnucash/quotes/CMakeLists.txt
diff --git a/src/quotes/Makefile.am b/libgnucash/quotes/Makefile.am
similarity index 100%
rename from src/quotes/Makefile.am
rename to libgnucash/quotes/Makefile.am
diff --git a/src/quotes/Quote_example.pl b/libgnucash/quotes/Quote_example.pl
similarity index 100%
rename from src/quotes/Quote_example.pl
rename to libgnucash/quotes/Quote_example.pl
diff --git a/src/quotes/README b/libgnucash/quotes/README
similarity index 100%
rename from src/quotes/README
rename to libgnucash/quotes/README
diff --git a/src/quotes/gnc-fq-check.in b/libgnucash/quotes/gnc-fq-check.in
similarity index 100%
rename from src/quotes/gnc-fq-check.in
rename to libgnucash/quotes/gnc-fq-check.in
diff --git a/src/quotes/gnc-fq-dump b/libgnucash/quotes/gnc-fq-dump
similarity index 100%
rename from src/quotes/gnc-fq-dump
rename to libgnucash/quotes/gnc-fq-dump
diff --git a/src/quotes/gnc-fq-helper.in b/libgnucash/quotes/gnc-fq-helper.in
similarity index 100%
rename from src/quotes/gnc-fq-helper.in
rename to libgnucash/quotes/gnc-fq-helper.in
diff --git a/src/quotes/gnc-fq-update.in b/libgnucash/quotes/gnc-fq-update.in
similarity index 100%
rename from src/quotes/gnc-fq-update.in
rename to libgnucash/quotes/gnc-fq-update.in
diff --git a/src/quotes/gnc-value-portfolio b/libgnucash/quotes/gnc-value-portfolio
similarity index 100%
rename from src/quotes/gnc-value-portfolio
rename to libgnucash/quotes/gnc-value-portfolio
diff --git a/libgnucash/scm/CMakeLists.txt b/libgnucash/scm/CMakeLists.txt
new file mode 100644
index 0000000..72f0d78
--- /dev/null
+++ b/libgnucash/scm/CMakeLists.txt
@@ -0,0 +1,70 @@
+ADD_SUBDIRECTORY(gnumeric)
+
+SET (BUILD_CONFIG_SCM ${CMAKE_CURRENT_BINARY_DIR}/build-config.scm)
+
+SET (scm_SCHEME_4
+    substring-search.scm
+    xml-generator.scm
+)
+
+# We need to replace a couple of variables in build-config.scm. Normally, I 
+# would use CONFIGURE_FILE to do this. But this scheme files is using a different
+# replacement marking scheme ("@-", "-@") than the usual one with just "@" 
+# that CONFIGURE_FILE expects.
+
+# FIXME: ${BUILD_CONFIG_SCM} needs a rule to cause it to be generated, I think.
+
+IF (HAVE_GUILE1)
+  GNC_CONFIGURE(build-config.scm.in build-config.scm)
+ELSE()
+  GNC_CONFIGURE2(build-config-scm build-config.scm.in build-config.scm)
+ENDIF()
+
+# CONFIGURE_FILE(build-config.scm.in ${BUILD_CONFIG_SCM})
+
+SET(GUILE_MODULES      "")
+SET(GUILE_LOAD_DIRS    libgnucash/core-utils libgnucash/gnc-module)
+SET(GUILE_LIBRARY_DIRS libgnucash/core-utils libgnucash/gnc-module)
+SET(GUILE_DEPENDS      scm-core-utils scm-gnc-module)
+
+SET(scm_SCHEME_0
+  fin.scm
+  string.scm
+  ${BUILD_CONFIG_SCM}
+  substring-search.scm
+  xml-generator.scm
+)
+
+GNC_ADD_SCHEME_TARGETS(scm-scm-0 "${scm_SCHEME_0}" "" "" "" "" "" FALSE)
+
+GNC_ADD_SCHEME_TARGETS(scm-scm-1 "printf.scm" gnucash "" "" "" "" FALSE)
+
+GNC_ADD_SCHEME_TARGETS(scm-scm-2
+  main.scm
+  gnucash
+  "${GUILE_MODULES}"
+  "${GUILE_LOAD_DIRS}"
+  "${GUILE_LIBRARY_DIRS}"
+  "scm-scm-1;${GUILE_DEPENDS}"  # requires printf.scm from scm-scm-1 and modules from GUILE_DEPENDS
+  FALSE
+)
+
+# depends on main.scm
+GNC_ADD_SCHEME_TARGETS(scm-scm-3
+  price-quotes.scm
+  gnucash
+  "${GUILE_MODULES}"
+  "${GUILE_LOAD_DIRS}"
+  "${GUILE_LIBRARY_DIRS}"
+  "scm-scm-2;scm-scm-0"  # depends on build_config.scm
+  FALSE)
+
+ADD_CUSTOM_TARGET(scm-scm ALL DEPENDS scm-scm-3 scm-scm-2 scm-scm-1 scm-scm-0 scm-gnumeric)
+
+INSTALL(FILES config DESTINATION etc/gnucash)
+
+SET_LOCAL_DIST(scm_DIST_local config CMakeLists.txt Makefile.am fin.scm string.scm build-config.scm.in substring-search.scm
+                              xml-generator.scm main.scm price-quotes.scm printf.scm ${scm_SCHEME_4})
+SET(scm_DIST ${scm_DIST_local} ${scm_gnumeric_DIST} PARENT_SCOPE)
+
+
diff --git a/libgnucash/scm/Makefile.am b/libgnucash/scm/Makefile.am
new file mode 100644
index 0000000..d6647c7
--- /dev/null
+++ b/libgnucash/scm/Makefile.am
@@ -0,0 +1,89 @@
+
+SUBDIRS = gnumeric
+
+gncscmdir = ${GNC_SCM_INSTALL_DIR}
+gncscmmoddir = ${GNC_SCM_INSTALL_DIR}/gnucash
+
+gncscmmod_DATA = main.scm price-quotes.scm printf.scm
+
+gnc_regular_scm_files = \
+  string.scm \
+  fin.scm \
+  substring-search.scm \
+  xml-generator.scm
+
+gncscm_DATA = \
+  build-config.scm \
+  ${gnc_regular_scm_files}
+
+noinst_DATA = .scm-links
+
+configdir = ${GNC_CONFIGDIR}
+config_DATA = config
+
+if GNUCASH_SEPARATE_BUILDDIR
+SCM_FILE_LINKS = \
+  ${gncscmmod_DATA} \
+  ${gnc_regular_scm_files}
+endif
+
+.scm-links: 
+	$(RM) -rf gnucash
+	mkdir -p  gnucash
+if GNUCASH_SEPARATE_BUILDDIR
+	for X in ${SCM_FILE_LINKS} ; do \
+	  $(LN_S) -f ${srcdir}/$$X . ; \
+	done
+endif
+	( cd gnucash; for A in $(gncscmmod_DATA) ; do $(LN_S) -f ../$$A . ; done )
+if ! OS_WIN32
+# Windows knows no "ln -s" but uses "cp": must copy every time (see bug #566567).
+	touch .scm-links
+endif
+
+if GNC_HAVE_GUILE_2
+GUILE_COMPILE_ENV = \
+  --guile-load-dir ${top_builddir}/libgnucash/core-utils \
+  --guile-load-dir ${top_builddir}/libgnucash/gnc-module \
+  --guile-load-dir ${top_builddir}/libgnucash/scm \
+  --library-dir    ${top_builddir}/libgnucash/core-utils \
+  --library-dir    ${top_builddir}/libgnucash/gnc-module \
+  --library-dir    ${top_builddir}/libgnucash/engine
+
+%.go : %.scm .scm-links
+	$(shell ${abs_top_srcdir}/common/gnc-test-env.pl --noexports ${GUILE_COMPILE_ENV}) \
+	$(GUILD) compile -o $@ $<
+
+gncscmmodcachedir = ${pkglibdir}/scm/ccache/@GUILE_EFFECTIVE_VERSION@/gnucash
+gncscmmodcache_DATA = $(gncscmmod_DATA:.scm=.go)
+
+gncscmcachedir = ${pkglibdir}/scm/ccache/@GUILE_EFFECTIVE_VERSION@
+gncscmcache_DATA = $(gncscm_DATA:.scm=.go)
+endif
+
+clean-local:
+	$(RM) -rf gnucash
+
+SCM_FILES = ${gncscm_DATA} ${gncscmmod_DATA}
+
+EXTRA_DIST = \
+  build-config.scm.in \
+  config \
+  ${SCM_FILES} \
+  CMakeLists.txt
+
+## We borrow guile's convention and use @-...-@ as the substitution
+## brackets here, instead of the usual @... at .  This prevents autoconf
+## from substituting the values directly into the left-hand sides of
+## the sed substitutions.  *sigh*
+build-config.scm: ${srcdir}/build-config.scm.in Makefile
+	rm -f $@.tmp
+	sed < $< > $@.tmp \
+            -e 's#@-VERSION-@#${VERSION}#' \
+            -e 's#@-GNC_HELPDIR-@#${GNC_HELPDIR}#'
+	mv $@.tmp $@
+
+CLEANFILES = .scm-links ${gncscmmodcache_DATA} ${gncscmcache_DATA}
+
+DISTCLEANFILES = ${SCM_FILE_LINKS}
+MAINTAINERCLEANFILES = build-config.scm
diff --git a/src/scm/build-config.scm.in b/libgnucash/scm/build-config.scm.in
similarity index 100%
rename from src/scm/build-config.scm.in
rename to libgnucash/scm/build-config.scm.in
diff --git a/src/scm/config b/libgnucash/scm/config
similarity index 100%
rename from src/scm/config
rename to libgnucash/scm/config
diff --git a/src/scm/fin.scm b/libgnucash/scm/fin.scm
similarity index 100%
rename from src/scm/fin.scm
rename to libgnucash/scm/fin.scm
diff --git a/src/scm/gnumeric/CMakeLists.txt b/libgnucash/scm/gnumeric/CMakeLists.txt
similarity index 100%
rename from src/scm/gnumeric/CMakeLists.txt
rename to libgnucash/scm/gnumeric/CMakeLists.txt
diff --git a/src/scm/gnumeric/Makefile.am b/libgnucash/scm/gnumeric/Makefile.am
similarity index 100%
rename from src/scm/gnumeric/Makefile.am
rename to libgnucash/scm/gnumeric/Makefile.am
diff --git a/src/scm/gnumeric/gnumeric-utilities.scm b/libgnucash/scm/gnumeric/gnumeric-utilities.scm
similarity index 100%
rename from src/scm/gnumeric/gnumeric-utilities.scm
rename to libgnucash/scm/gnumeric/gnumeric-utilities.scm
diff --git a/src/scm/gnumeric/table-utils.scm b/libgnucash/scm/gnumeric/table-utils.scm
similarity index 100%
rename from src/scm/gnumeric/table-utils.scm
rename to libgnucash/scm/gnumeric/table-utils.scm
diff --git a/src/scm/main.scm b/libgnucash/scm/main.scm
similarity index 100%
rename from src/scm/main.scm
rename to libgnucash/scm/main.scm
diff --git a/src/scm/price-quotes.scm b/libgnucash/scm/price-quotes.scm
similarity index 100%
rename from src/scm/price-quotes.scm
rename to libgnucash/scm/price-quotes.scm
diff --git a/src/scm/printf.scm b/libgnucash/scm/printf.scm
similarity index 100%
rename from src/scm/printf.scm
rename to libgnucash/scm/printf.scm
diff --git a/src/scm/string.scm b/libgnucash/scm/string.scm
similarity index 100%
rename from src/scm/string.scm
rename to libgnucash/scm/string.scm
diff --git a/src/scm/substring-search.scm b/libgnucash/scm/substring-search.scm
similarity index 100%
rename from src/scm/substring-search.scm
rename to libgnucash/scm/substring-search.scm
diff --git a/src/scm/xml-generator.scm b/libgnucash/scm/xml-generator.scm
similarity index 100%
rename from src/scm/xml-generator.scm
rename to libgnucash/scm/xml-generator.scm
diff --git a/src/tax/CMakeLists.txt b/libgnucash/tax/CMakeLists.txt
similarity index 100%
rename from src/tax/CMakeLists.txt
rename to libgnucash/tax/CMakeLists.txt
diff --git a/src/tax/Makefile.am b/libgnucash/tax/Makefile.am
similarity index 100%
rename from src/tax/Makefile.am
rename to libgnucash/tax/Makefile.am
diff --git a/libgnucash/tax/us/CMakeLists.txt b/libgnucash/tax/us/CMakeLists.txt
new file mode 100644
index 0000000..62aac51
--- /dev/null
+++ b/libgnucash/tax/us/CMakeLists.txt
@@ -0,0 +1,51 @@
+ADD_SUBDIRECTORY(test)
+
+SET(tax_us_SOURCES gncmod-tax-us.c)
+
+# Add dependency on config.h
+SET_SOURCE_FILES_PROPERTIES (${tax_us_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
+
+ADD_LIBRARY(gncmod-tax-us ${tax_us_SOURCES})
+TARGET_LINK_LIBRARIES(gncmod-tax-us gnc-module ${GLIB2_LDFLAGS} ${GUILE_LDFLAGS})
+
+TARGET_INCLUDE_DIRECTORIES(gncmod-tax-us
+    PRIVATE ${CMAKE_BINARY_DIR}/common ${GUILE_INCLUDE_DIRS})
+
+INSTALL(TARGETS gncmod-tax-us
+  LIBRARY DESTINATION lib/gnucash
+  ARCHIVE DESTINATION lib/gnucash
+  RUNTIME DESTINATION bin)
+# No headers to install
+
+# Scheme
+
+SET(gncmod_tax_us_SCHEME_1 txf.scm txf-help.scm txf-de_DE.scm txf-help-de_DE.scm)
+SET(gncmod_tax_us_SCHEME_2 de_DE.scm us.scm)
+
+SET(GUILE_MODULES      libgnucash/app-utils libgnucash/engine)
+SET(GUILE_LOAD_DIRS    libgnucash/app-utils libgnucash/core-utils libgnucash/engine libgnucash/gnc-module libgnucash/scm)
+SET(GUILE_LIBRARY_DIRS libgnucash/app-utils libgnucash/engine libgnucash/gnc-module)
+SET(GUILE_DEPENDS      scm-app-utils)
+
+GNC_ADD_SCHEME_TARGETS(scm-tax-us-1
+  "${gncmod_tax_us_SCHEME_1}"
+  ""
+  "${GUILE_MODULES}"
+  "${GUILE_LOAD_DIRS}"
+  "${GUILE_LIBRARY_DIRS}"
+  "${GUILE_DEPENDS}"
+  FALSE
+  )
+GNC_ADD_SCHEME_TARGETS(scm-tax-us-2
+  "${gncmod_tax_us_SCHEME_2}"
+  gnucash/tax
+  "${GUILE_MODULES}"
+  "${GUILE_LOAD_DIRS}"
+  "${GUILE_LIBRARY_DIRS}"
+  "${GUILE_DEPENDS}"
+  FALSE
+  )
+
+SET_LOCAL_DIST(tax_us_DIST_local CMakeLists.txt Makefile.am ${tax_us_SOURCES} ${gncmod_tax_us_SCHEME_1} ${gncmod_tax_us_SCHEME_2})
+SET(tax_us_DIST ${tax_us_DIST_local} ${test_tax_us_DIST} PARENT_SCOPE)
+
diff --git a/libgnucash/tax/us/Makefile.am b/libgnucash/tax/us/Makefile.am
new file mode 100644
index 0000000..ac7d2d5
--- /dev/null
+++ b/libgnucash/tax/us/Makefile.am
@@ -0,0 +1,85 @@
+SUBDIRS = . test
+
+pkglib_LTLIBRARIES = libgncmod-tax-us.la
+
+libgncmod_tax_us_la_SOURCES = \
+  gncmod-tax-us.c 
+
+libgncmod_tax_us_la_LDFLAGS = -avoid-version
+
+libgncmod_tax_us_la_LIBADD = \
+ ${GUILE_LIBS} \
+ ${GLIB_LIBS}
+
+AM_CPPFLAGS = \
+  -I${top_srcdir}/common \
+  -I${top_srcdir}/libgnucash/gnc-module \
+  ${GLIB_CFLAGS} ${GUILE_CFLAGS}
+
+gncscmmoddir = ${GNC_SCM_INSTALL_DIR}/gnucash/tax
+gncscmmod_DATA = us.scm de_DE.scm
+
+gncscmdir = ${GNC_SCM_INSTALL_DIR}
+gncscm_DATA = txf.scm txf-help.scm txf-de_DE.scm txf-help-de_DE.scm 
+
+if GNUCASH_SEPARATE_BUILDDIR
+#For executing test cases
+SCM_FILE_LINKS = \
+  ${gncscmmod_DATA} \
+  ${gncscm_DATA}
+endif
+
+.scm-links:
+	$(RM) -rf gnucash
+	mkdir -p gnucash
+	mkdir -p gnucash/tax
+if GNUCASH_SEPARATE_BUILDDIR
+	for X in ${SCM_FILE_LINKS} ; do \
+	  $(LN_S) -f ${srcdir}/$$X . ; \
+	done
+endif
+	( cd gnucash/tax; for A in $(gncscmmod_DATA) ; do $(LN_S) -f ../../$$A . ; done )
+if ! OS_WIN32
+# Windows knows no "ln -s" but uses "cp": must copy every time (see bug #566567).
+	touch .scm-links
+endif
+
+if GNC_HAVE_GUILE_2
+GUILE_COMPILE_ENV = \
+  --gnc-module-dir ${top_builddir}/libgnucash/engine \
+  --guile-load-dir ${top_builddir}/libgnucash/app-utils \
+  --guile-load-dir ${top_builddir}/libgnucash/core-utils \
+  --guile-load-dir ${top_builddir}/libgnucash/engine \
+  --guile-load-dir ${top_builddir}/libgnucash/gnc-module \
+  --guile-load-dir ${top_builddir}/libgnucash/scm \
+  --library-dir    ${top_builddir}/libgnucash/engine \
+  --library-dir    ${top_builddir}/libgnucash/app-utils \
+  --library-dir    ${top_builddir}/libgnucash/core-utils \
+  --library-dir    ${top_builddir}/libgnucash/gnc-module
+
+%.go : %.scm .scm-links $(pkglib_LTLIBRARIES)
+	GNC_UNINSTALLED=yes \
+	GNC_BUILDDIR=${top_builddir} \
+	$(shell ${abs_top_srcdir}/common/gnc-test-env.pl --noexports ${GUILE_COMPILE_ENV}) \
+	$(GUILD) compile -o $@ $<
+
+gncscmmodcachedir = ${pkglibdir}/scm/ccache/@GUILE_EFFECTIVE_VERSION@/gnucash/tax
+gncscmmodcache_DATA = $(gncscmmod_DATA:.scm=.go)
+
+gncscmcachedir = ${pkglibdir}/scm/ccache/@GUILE_EFFECTIVE_VERSION@
+gncscmcache_DATA = $(gncscm_DATA:.scm=.go)
+endif
+
+clean-local:
+	$(RM) -rf gnucash
+
+noinst_DATA = .scm-links
+
+EXTRA_DIST = \
+  ${gncscmmod_DATA} \
+  ${gncscm_DATA} \
+  CMakeLists.txt
+
+CLEANFILES = .scm-links ${gncscmmodcache_DATA} ${gncscmcache_DATA}
+
+DISTCLEANFILES = ${SCM_FILE_LINKS}
diff --git a/src/tax/us/de_DE.scm b/libgnucash/tax/us/de_DE.scm
similarity index 100%
rename from src/tax/us/de_DE.scm
rename to libgnucash/tax/us/de_DE.scm
diff --git a/src/tax/us/de_DE/taxtxf - LIES MICH.txt b/libgnucash/tax/us/de_DE/taxtxf - LIES MICH.txt
similarity index 100%
rename from src/tax/us/de_DE/taxtxf - LIES MICH.txt
rename to libgnucash/tax/us/de_DE/taxtxf - LIES MICH.txt
diff --git a/src/tax/us/de_DE/txf-USt-Bericht.html b/libgnucash/tax/us/de_DE/txf-USt-Bericht.html
similarity index 100%
rename from src/tax/us/de_DE/txf-USt-Bericht.html
rename to libgnucash/tax/us/de_DE/txf-USt-Bericht.html
diff --git a/src/tax/us/de_DE/txf-USt-VA Anleitung 2011.pdf b/libgnucash/tax/us/de_DE/txf-USt-VA Anleitung 2011.pdf
similarity index 100%
rename from src/tax/us/de_DE/txf-USt-VA Anleitung 2011.pdf
rename to libgnucash/tax/us/de_DE/txf-USt-VA Anleitung 2011.pdf
diff --git a/src/tax/us/gncmod-tax-us.c b/libgnucash/tax/us/gncmod-tax-us.c
similarity index 100%
rename from src/tax/us/gncmod-tax-us.c
rename to libgnucash/tax/us/gncmod-tax-us.c
diff --git a/src/tax/us/test/CMakeLists.txt b/libgnucash/tax/us/test/CMakeLists.txt
similarity index 100%
rename from src/tax/us/test/CMakeLists.txt
rename to libgnucash/tax/us/test/CMakeLists.txt
diff --git a/libgnucash/tax/us/test/Makefile.am b/libgnucash/tax/us/test/Makefile.am
new file mode 100644
index 0000000..70f98af
--- /dev/null
+++ b/libgnucash/tax/us/test/Makefile.am
@@ -0,0 +1,19 @@
+TESTS = test-link-module
+
+# Some of these dirs may not be needed anymore.
+GNC_TEST_DEPS = \
+  --gnc-module-dir ${top_builddir}/libgnucash/tax/us \
+  --guile-load-dir ${top_builddir}/libgnucash/gnc-module \
+  --guile-load-dir ${top_builddir}/libgnucash/tax/us \
+  --library-dir    ${top_builddir}/libgnucash/core-utils \
+  --library-dir    ${top_builddir}/libgnucash/gnc-module
+
+TESTS_ENVIRONMENT = \
+  GUILE="${GUILE}" \
+  $(shell ${abs_top_srcdir}/common/gnc-test-env.pl --noexports ${GNC_TEST_DEPS})
+
+check_PROGRAMS=test-link-module
+test_link_module_SOURCES=test-link-module.c
+test_link_module_LDADD=../libgncmod-tax-us.la ${GUILE_LIBS} ${GLIB_LIBS}
+
+EXTRA_DIST = CMakeLists.txt
diff --git a/src/tax/us/test/test-link-module.c b/libgnucash/tax/us/test/test-link-module.c
similarity index 100%
rename from src/tax/us/test/test-link-module.c
rename to libgnucash/tax/us/test/test-link-module.c
diff --git a/src/tax/us/test/test-load-module.in b/libgnucash/tax/us/test/test-load-module.in
similarity index 100%
rename from src/tax/us/test/test-load-module.in
rename to libgnucash/tax/us/test/test-load-module.in
diff --git a/src/tax/us/txf-de_DE.scm b/libgnucash/tax/us/txf-de_DE.scm
similarity index 100%
rename from src/tax/us/txf-de_DE.scm
rename to libgnucash/tax/us/txf-de_DE.scm
diff --git a/src/tax/us/txf-help-de_DE.scm b/libgnucash/tax/us/txf-help-de_DE.scm
similarity index 100%
rename from src/tax/us/txf-help-de_DE.scm
rename to libgnucash/tax/us/txf-help-de_DE.scm
diff --git a/src/tax/us/txf-help.scm b/libgnucash/tax/us/txf-help.scm
similarity index 100%
rename from src/tax/us/txf-help.scm
rename to libgnucash/tax/us/txf-help.scm
diff --git a/src/tax/us/txf.scm b/libgnucash/tax/us/txf.scm
similarity index 100%
rename from src/tax/us/txf.scm
rename to libgnucash/tax/us/txf.scm
diff --git a/src/tax/us/us.scm b/libgnucash/tax/us/us.scm
similarity index 100%
rename from src/tax/us/us.scm
rename to libgnucash/tax/us/us.scm
diff --git a/make-gnucash-potfiles.in b/make-gnucash-potfiles.in
index a3d58ac..ad75a39 100644
--- a/make-gnucash-potfiles.in
+++ b/make-gnucash-potfiles.in
@@ -37,7 +37,7 @@ close IN;
 # in order to use the same algorithm in both cmake and autools based builds
 
 my @possible_files = `cd @-SRCDIR-@ && \\
-                      find src lib -name '*.c' \\
+                      find bindings common libgnucash gnucash lib -name '*.c' \\
                       -o -name '*.cpp' -o -name '*.glade' \\
                       -o -name '*.desktop.in' -o -name '*.keys.in' \\
                       -o -name '*.gschema.xml.in.in' -o -name '*.scm' \\
@@ -76,8 +76,8 @@ foreach my $file (@possible_files) {
     print $type . $path . $name . "\n";
 }
 
-# These are also added, even though they are outside of src/
-print "src/gnome/gnucash.appdata.xml.in\n";
-print "src/gnome/gnucash.desktop.in.in\n";
-print "src/engine/qofbookslots.h\n";
+# These are manually added, because they're not picked up by the generation script
+print "gnucash/gnome/gnucash.appdata.xml.in\n";
+print "gnucash/gnome/gnucash.desktop.in.in\n";
+print "libgnucash/engine/qofbookslots.h\n";
 print "doc/tip_of_the_day.list.in\n";
diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt
index bf8f0ba..7fc3091 100644
--- a/po/CMakeLists.txt
+++ b/po/CMakeLists.txt
@@ -73,10 +73,10 @@ FUNCTION(MAKE_GNUCASH_POTFILES)
     ${CMAKE_SOURCE_DIR}/*.c ${CMAKE_SOURCE_DIR}/*.cpp ${CMAKE_SOURCE_DIR}/*.glade ${CMAKE_SOURCE_DIR}/*.desktop.in
     ${CMAKE_SOURCE_DIR}/*.keys.in  ${CMAKE_SOURCE_DIR}/*.gschema.xml.in.in ${CMAKE_SOURCE_DIR}/*.scm)
 
-  # Only consider files in the src/ directory. Also check against list of ignore patterns
+  # Only consider files in the common, libgnucash, and gnucash/ directories. Also check against list of ignore patterns
   SET(FILES "")
   FOREACH(path ${FILES_IN})
-    STRING(REGEX MATCH "^(src/|lib)" IS_SRC ${path})
+    STRING(REGEX MATCH "^(common/|lib|gnucash|bindings)" IS_SRC ${path})
     IF (IS_SRC)
       SET(IS_IGNORED FALSE)
       FOREACH(pattern ${IGNORE_PATTERNS})
@@ -129,10 +129,10 @@ FUNCTION(MAKE_GNUCASH_POTFILES)
     FILE(APPEND ${POTFILES_IN_PATH} "${path}\n")
   ENDFOREACH()
 
-  # These are also added, even though they are outside of src/
-  FILE(APPEND ${POTFILES_IN_PATH} "src/gnome/gnucash.appdata.xml.in
-src/gnome/gnucash.desktop.in.in
-src/engine/qofbookslots.h
+  # These are manually added, because they're not picked up by the generation script
+  FILE(APPEND ${POTFILES_IN_PATH} "gnucash/gnome/gnucash.appdata.xml.in
+gnucash/gnome/gnucash.desktop.in.in
+libgnucash/engine/qofbookslots.h
 doc/tip_of_the_day.list.in
 ")
 
diff --git a/po/POTFILES.ignore b/po/POTFILES.ignore
index 6d5b9a4..fd3be29 100644
--- a/po/POTFILES.ignore
+++ b/po/POTFILES.ignore
@@ -1,10 +1,10 @@
 # Work around the intltool-0.35.5 / automake-1.10 failures
 # due to "missing" files.  These files may be distributed.
-src/gnome/gnucash.desktop.in.in
-src/gnome/gnucash.desktop.in
-src/engine/iso-4217-currencies.c
+gnucash/gnome/gnucash.desktop.in.in
+gnucash/gnome/gnucash.desktop.in
+libgnucash/engine/iso-4217-currencies.c
 # The features in import-export/qif are still unused.
-src/import-export/qif/qif-defaults.c
-src/import-export/qif/qif-parse.c
+gnucash/import-export/qif/qif-defaults.c
+gnucash/import-export/qif/qif-parse.c
 # This file is autogenerated, so it's only in the tree after an in-source build:
-src/gnome-utils/gnc-warnings.c
+gnucash/gnome-utils/gnc-warnings.c
diff --git a/po/POTFILES.in b/po/POTFILES.in
index b5d9eec..b504006 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -1,5 +1,466 @@
 # This is a list of files which contain translatable strings.
 # This file was generated by ../make-gnucash-potfiles.
+gnucash/bin/gnucash-bin.c
+gnucash/gnome/assistant-acct-period.c
+gnucash/gnome/assistant-hierarchy.c
+gnucash/gnome/assistant-loan.c
+gnucash/gnome/assistant-stock-split.c
+gnucash/gnome/business-gnome-utils.c
+gnucash/gnome/business-options-gnome.c
+gnucash/gnome/business-urls.c
+gnucash/gnome/dialog-billterms.c
+gnucash/gnome/dialog-choose-owner.c
+gnucash/gnome/dialog-commodities.c
+gnucash/gnome/dialog-customer.c
+gnucash/gnome/dialog-date-close.c
+gnucash/gnome/dialog-employee.c
+gnucash/gnome/dialog-fincalc.c
+gnucash/gnome/dialog-find-account.c
+gnucash/gnome/dialog-find-transactions2.c
+gnucash/gnome/dialog-find-transactions.c
+gnucash/gnome/dialog-imap-editor.c
+gnucash/gnome/dialog-invoice.c
+gnucash/gnome/dialog-job.c
+gnucash/gnome/dialog-lot-viewer.c
+gnucash/gnome/dialog-new-user.c
+gnucash/gnome/dialog-order.c
+gnucash/gnome/dialog-payment.c
+gnucash/gnome/dialog-price-edit-db.c
+gnucash/gnome/dialog-price-editor.c
+gnucash/gnome/dialog-print-check.c
+gnucash/gnome/dialog-progress.c
+gnucash/gnome/dialog-sx-editor2.c
+gnucash/gnome/dialog-sx-editor.c
+gnucash/gnome/dialog-sx-from-trans.c
+gnucash/gnome/dialog-sx-since-last-run.c
+gnucash/gnome/dialog-tax-info.c
+gnucash/gnome/dialog-trans-assoc.c
+gnucash/gnome/dialog-vendor.c
+gnucash/gnome/gnc-budget-view.c
+gnucash/gnome/gnc-plugin-account-tree.c
+gnucash/gnome/gnc-plugin-basic-commands.c
+gnucash/gnome/gnc-plugin-budget.c
+gnucash/gnome/gnc-plugin-business.c
+gnucash/gnome/gnc-plugin-page-account-tree.c
+gnucash/gnome/gnc-plugin-page-budget.c
+gnucash/gnome/gnc-plugin-page-invoice.c
+gnucash/gnome/gnc-plugin-page-owner-tree.c
+gnucash/gnome/gnc-plugin-page-register2.c
+gnucash/gnome/gnc-plugin-page-register.c
+gnucash/gnome/gnc-plugin-page-sx-list.c
+gnucash/gnome/gnc-plugin-register2.c
+gnucash/gnome/gnc-plugin-register.c
+gnucash/gnome/gnc-split-reg2.c
+gnucash/gnome/gnc-split-reg.c
+[type: gettext/gsettings]gnucash/gnome/gschemas/org.gnucash.dialogs.business.gschema.xml.in.in
+[type: gettext/gsettings]gnucash/gnome/gschemas/org.gnucash.dialogs.checkprinting.gschema.xml.in.in
+[type: gettext/gsettings]gnucash/gnome/gschemas/org.gnucash.dialogs.commodities.gschema.xml.in.in
+[type: gettext/gsettings]gnucash/gnome/gschemas/org.gnucash.dialogs.gschema.xml.in.in
+[type: gettext/gsettings]gnucash/gnome/gschemas/org.gnucash.dialogs.reconcile.gschema.xml.in.in
+[type: gettext/gsettings]gnucash/gnome/gschemas/org.gnucash.dialogs.sxs.gschema.xml.in.in
+[type: gettext/gsettings]gnucash/gnome/gschemas/org.gnucash.dialogs.totd.gschema.xml.in.in
+[type: gettext/gsettings]gnucash/gnome/gschemas/org.gnucash.gschema.xml.in.in
+[type: gettext/gsettings]gnucash/gnome/gschemas/org.gnucash.window.pages.account.tree.gschema.xml.in.in
+[type: gettext/gsettings]gnucash/gnome/gschemas/org.gnucash.window.pages.gschema.xml.in.in
+gnucash/gnome/gtkbuilder/assistant-acct-period.glade
+gnucash/gnome/gtkbuilder/assistant-hierarchy.glade
+gnucash/gnome/gtkbuilder/assistant-loan.glade
+gnucash/gnome/gtkbuilder/assistant-stock-split.glade
+gnucash/gnome/gtkbuilder/business-options-gnome.glade
+gnucash/gnome/gtkbuilder/business-prefs.glade
+gnucash/gnome/gtkbuilder/dialog-billterms.glade
+gnucash/gnome/gtkbuilder/dialog-choose-owner.glade
+gnucash/gnome/gtkbuilder/dialog-commodities.glade
+gnucash/gnome/gtkbuilder/dialog-customer.glade
+gnucash/gnome/gtkbuilder/dialog-date-close.glade
+gnucash/gnome/gtkbuilder/dialog-employee.glade
+gnucash/gnome/gtkbuilder/dialog-fincalc.glade
+gnucash/gnome/gtkbuilder/dialog-find-account.glade
+gnucash/gnome/gtkbuilder/dialog-imap-editor.glade
+gnucash/gnome/gtkbuilder/dialog-invoice.glade
+gnucash/gnome/gtkbuilder/dialog-job.glade
+gnucash/gnome/gtkbuilder/dialog-lot-viewer.glade
+gnucash/gnome/gtkbuilder/dialog-new-user.glade
+gnucash/gnome/gtkbuilder/dialog-order.glade
+gnucash/gnome/gtkbuilder/dialog-payment.glade
+gnucash/gnome/gtkbuilder/dialog-price.glade
+gnucash/gnome/gtkbuilder/dialog-print-check.glade
+gnucash/gnome/gtkbuilder/dialog-progress.glade
+gnucash/gnome/gtkbuilder/dialog-sx.glade
+gnucash/gnome/gtkbuilder/dialog-tax-info.glade
+gnucash/gnome/gtkbuilder/dialog-trans-assoc.glade
+gnucash/gnome/gtkbuilder/dialog-vendor.glade
+gnucash/gnome/gtkbuilder/gnc-plugin-page-budget.glade
+gnucash/gnome/gtkbuilder/gnc-plugin-page-register2.glade
+gnucash/gnome/gtkbuilder/gnc-plugin-page-register.glade
+gnucash/gnome/gtkbuilder/window-autoclear.glade
+gnucash/gnome/gtkbuilder/window-reconcile.glade
+gnucash/gnome/reconcile-view.c
+gnucash/gnome/search-owner.c
+gnucash/gnome/top-level.c
+gnucash/gnome/window-autoclear.c
+gnucash/gnome/window-reconcile2.c
+gnucash/gnome/window-reconcile.c
+gnucash/gnome-search/dialog-search.c
+gnucash/gnome-search/dialog-search.glade
+gnucash/gnome-search/gnc-general-search.c
+gnucash/gnome-search/gncmod-gnome-search.c
+gnucash/gnome-search/search-account.c
+gnucash/gnome-search/search-boolean.c
+gnucash/gnome-search/search-core-type.c
+gnucash/gnome-search/search-core-utils.c
+gnucash/gnome-search/search-date.c
+gnucash/gnome-search/search-double.c
+gnucash/gnome-search/search-int64.c
+gnucash/gnome-search/search-numeric.c
+gnucash/gnome-search/search-reconciled.c
+gnucash/gnome-search/search-string.c
+gnucash/gnome-utils/account-quickfill.c
+gnucash/gnome-utils/assistant-xml-encoding.c
+gnucash/gnome-utils/cursors.c
+gnucash/gnome-utils/dialog-account.c
+gnucash/gnome-utils/dialog-book-close.c
+gnucash/gnome-utils/dialog-commodity.c
+gnucash/gnome-utils/dialog-dup-trans.c
+gnucash/gnome-utils/dialog-file-access.c
+gnucash/gnome-utils/dialog-object-references.c
+gnucash/gnome-utils/dialog-options.c
+gnucash/gnome-utils/dialog-preferences.c
+gnucash/gnome-utils/dialog-query-view.c
+gnucash/gnome-utils/dialog-reset-warnings.c
+gnucash/gnome-utils/dialog-tax-table.c
+gnucash/gnome-utils/dialog-totd.c
+gnucash/gnome-utils/dialog-transfer.c
+gnucash/gnome-utils/dialog-userpass.c
+gnucash/gnome-utils/dialog-utils.c
+gnucash/gnome-utils/gnc-account-sel.c
+gnucash/gnome-utils/gnc-amount-edit.c
+gnucash/gnome-utils/gnc-autosave.c
+gnucash/gnome-utils/gnc-cell-renderer-date.c
+gnucash/gnome-utils/gnc-cell-renderer-popup.c
+gnucash/gnome-utils/gnc-cell-renderer-popup-entry.c
+gnucash/gnome-utils/gnc-combott.c
+gnucash/gnome-utils/gnc-commodity-edit.c
+gnucash/gnome-utils/gnc-currency-edit.c
+gnucash/gnome-utils/gnc-date-delta.c
+gnucash/gnome-utils/gnc-date-edit.c
+gnucash/gnome-utils/gnc-date-format.c
+gnucash/gnome-utils/gnc-dense-cal.c
+gnucash/gnome-utils/gnc-dense-cal-model.c
+gnucash/gnome-utils/gnc-dense-cal-store.c
+gnucash/gnome-utils/gnc-embedded-window.c
+gnucash/gnome-utils/gnc-file.c
+gnucash/gnome-utils/gnc-frequency.c
+gnucash/gnome-utils/gnc-general-select.c
+gnucash/gnome-utils/gnc-gnome-utils.c
+gnucash/gnome-utils/gnc-gobject-utils.c
+gnucash/gnome-utils/gnc-gtk-utils.c
+gnucash/gnome-utils/gnc-gui-query.c
+gnucash/gnome-utils/gnc-icons.c
+gnucash/gnome-utils/gnc-keyring.c
+gnucash/gnome-utils/gnc-main-window.c
+gnucash/gnome-utils/gnc-menu-extensions.c
+gnucash/gnome-utils/gnc-menu-extensions.scm
+gnucash/gnome-utils/gncmod-gnome-utils.c
+gnucash/gnome-utils/gnc-period-select.c
+gnucash/gnome-utils/gnc-plugin.c
+gnucash/gnome-utils/gnc-plugin-file-history.c
+gnucash/gnome-utils/gnc-plugin-manager.c
+gnucash/gnome-utils/gnc-plugin-menu-additions.c
+gnucash/gnome-utils/gnc-plugin-page.c
+gnucash/gnome-utils/gnc-query-view.c
+gnucash/gnome-utils/gnc-recurrence.c
+gnucash/gnome-utils/gnc-splash.c
+gnucash/gnome-utils/gnc-sx-instance-dense-cal-adapter.c
+gnucash/gnome-utils/gnc-sx-list-tree-model-adapter.c
+gnucash/gnome-utils/gnc-tree-control-split-reg.c
+gnucash/gnome-utils/gnc-tree-model-account.c
+gnucash/gnome-utils/gnc-tree-model-account-types.c
+gnucash/gnome-utils/gnc-tree-model-budget.c
+gnucash/gnome-utils/gnc-tree-model.c
+gnucash/gnome-utils/gnc-tree-model-commodity.c
+gnucash/gnome-utils/gnc-tree-model-owner.c
+gnucash/gnome-utils/gnc-tree-model-price.c
+gnucash/gnome-utils/gnc-tree-model-split-reg.c
+gnucash/gnome-utils/gnc-tree-util-split-reg.c
+gnucash/gnome-utils/gnc-tree-view-account.c
+gnucash/gnome-utils/gnc-tree-view.c
+gnucash/gnome-utils/gnc-tree-view-commodity.c
+gnucash/gnome-utils/gnc-tree-view-owner.c
+gnucash/gnome-utils/gnc-tree-view-price.c
+gnucash/gnome-utils/gnc-tree-view-split-reg.c
+gnucash/gnome-utils/gnc-tree-view-sx-list.c
+gnucash/gnome-utils/gnc-window.c
+gnucash/gnome-utils/gnome-utils.scm
+[type: gettext/gsettings]gnucash/gnome-utils/gschemas/org.gnucash.history.gschema.xml.in.in
+[type: gettext/gsettings]gnucash/gnome-utils/gschemas/org.gnucash.warnings.gschema.xml.in.in
+gnucash/gnome-utils/gtkbuilder/assistant-xml-encoding.glade
+gnucash/gnome-utils/gtkbuilder/dialog-account.glade
+gnucash/gnome-utils/gtkbuilder/dialog-book-close.glade
+gnucash/gnome-utils/gtkbuilder/dialog-commodity.glade
+gnucash/gnome-utils/gtkbuilder/dialog-file-access.glade
+gnucash/gnome-utils/gtkbuilder/dialog-object-references.glade
+gnucash/gnome-utils/gtkbuilder/dialog-options.glade
+gnucash/gnome-utils/gtkbuilder/dialog-preferences.glade
+gnucash/gnome-utils/gtkbuilder/dialog-query-view.glade
+gnucash/gnome-utils/gtkbuilder/dialog-reset-warnings.glade
+gnucash/gnome-utils/gtkbuilder/dialog-tax-table.glade
+gnucash/gnome-utils/gtkbuilder/dialog-totd.glade
+gnucash/gnome-utils/gtkbuilder/dialog-transfer.glade
+gnucash/gnome-utils/gtkbuilder/dialog-userpass.glade
+gnucash/gnome-utils/gtkbuilder/gnc-date-format.glade
+gnucash/gnome-utils/gtkbuilder/gnc-frequency.glade
+gnucash/gnome-utils/gtkbuilder/gnc-recurrence.glade
+gnucash/gnome-utils/gtkbuilder/gnc-tree-view-owner.glade
+gnucash/gnome-utils/misc-gnome-utils.c
+gnucash/gnome-utils/print-session.c
+gnucash/gnome-utils/search-param.c
+gnucash/gnome-utils/tree-view-utils.c
+gnucash/gnome-utils/window-main-summarybar.c
+gnucash/html/gnc-html.c
+gnucash/html/gnc-html-factory.c
+gnucash/html/gnc-html-history.c
+gnucash/html/gnc-html-webkit1.c
+gnucash/html/gnc-html-webkit2.c
+gnucash/html/gncmod-html.c
+gnucash/import-export/aqb/assistant-ab-initial.c
+gnucash/import-export/aqb/assistant-ab-initial.glade
+gnucash/import-export/aqb/dialog-ab-daterange.c
+gnucash/import-export/aqb/dialog-ab.glade
+gnucash/import-export/aqb/dialog-ab-pref.glade
+gnucash/import-export/aqb/dialog-ab-trans.c
+gnucash/import-export/aqb/gnc-ab-getbalance.c
+gnucash/import-export/aqb/gnc-ab-gettrans.c
+gnucash/import-export/aqb/gnc-ab-kvp.c
+gnucash/import-export/aqb/gnc-ab-transfer.c
+gnucash/import-export/aqb/gnc-ab-utils.c
+gnucash/import-export/aqb/gnc-file-aqb-import.c
+gnucash/import-export/aqb/gnc-gwen-gui.c
+gnucash/import-export/aqb/gncmod-aqbanking.c
+gnucash/import-export/aqb/gnc-plugin-aqbanking.c
+[type: gettext/gsettings]gnucash/import-export/aqb/gschemas/org.gnucash.dialogs.import.hbci.gschema.xml.in.in
+gnucash/import-export/csv-exp/assistant-csv-export.c
+gnucash/import-export/csv-exp/assistant-csv-export.glade
+gnucash/import-export/csv-exp/csv-transactions-export.c
+gnucash/import-export/csv-exp/csv-tree-export.c
+gnucash/import-export/csv-exp/gncmod-csv-export.c
+gnucash/import-export/csv-exp/gnc-plugin-csv-export.c
+[type: gettext/gsettings]gnucash/import-export/csv-exp/gschemas/org.gnucash.dialogs.export.csv.gschema.xml.in.in
+gnucash/import-export/csv-imp/assistant-csv-account-import.c
+gnucash/import-export/csv-imp/assistant-csv-account-import.glade
+gnucash/import-export/csv-imp/assistant-csv-trans-import.cpp
+gnucash/import-export/csv-imp/assistant-csv-trans-import.glade
+gnucash/import-export/csv-imp/csv-account-import.c
+gnucash/import-export/csv-imp/gnc-csv-account-map.c
+gnucash/import-export/csv-imp/gnc-csv-gnumeric-popup.c
+gnucash/import-export/csv-imp/gnc-csv-tokenizer.cpp
+gnucash/import-export/csv-imp/gnc-csv-trans-settings.cpp
+gnucash/import-export/csv-imp/gnc-dummy-tokenizer.cpp
+gnucash/import-export/csv-imp/gnc-fw-tokenizer.cpp
+gnucash/import-export/csv-imp/gncmod-csv-import.c
+gnucash/import-export/csv-imp/gnc-plugin-csv-import.c
+gnucash/import-export/csv-imp/gnc-tokenizer.cpp
+gnucash/import-export/csv-imp/gnc-trans-props.cpp
+gnucash/import-export/csv-imp/gnc-tx-import.cpp
+[type: gettext/gsettings]gnucash/import-export/csv-imp/gschemas/org.gnucash.dialogs.import.csv.gschema.xml.in.in
+gnucash/import-export/dialog-import.glade
+gnucash/import-export/gncmod-generic-import.c
+[type: gettext/gsettings]gnucash/import-export/gschemas/org.gnucash.dialogs.import.generic.gschema.xml.in.in
+gnucash/import-export/import-account-matcher.c
+gnucash/import-export/import-backend.c
+gnucash/import-export/import-commodity-matcher.c
+gnucash/import-export/import-format-dialog.c
+gnucash/import-export/import-main-matcher.c
+gnucash/import-export/import-match-picker.c
+gnucash/import-export/import-parse.c
+gnucash/import-export/import-pending-matches.c
+gnucash/import-export/import-settings.c
+gnucash/import-export/import-utilities.c
+gnucash/import-export/log-replay/gnc-log-replay.c
+gnucash/import-export/log-replay/gncmod-log-replay.c
+gnucash/import-export/log-replay/gnc-plugin-log-replay.c
+gnucash/import-export/ofx/gncmod-ofx-import.c
+gnucash/import-export/ofx/gnc-ofx-import.c
+gnucash/import-export/ofx/gnc-ofx-kvp.c
+gnucash/import-export/ofx/gnc-plugin-ofx.c
+[type: gettext/gsettings]gnucash/import-export/ofx/gschemas/org.gnucash.dialogs.import.ofx.gschema.xml.in.in
+gnucash/import-export/qif/qif-context.c
+gnucash/import-export/qif/qif-file.c
+gnucash/import-export/qif/qif-objects.c
+gnucash/import-export/qif-imp/assistant-qif-import.c
+gnucash/import-export/qif-imp/assistant-qif-import.glade
+gnucash/import-export/qif-imp/dialog-account-picker.c
+gnucash/import-export/qif-imp/dialog-account-picker.glade
+gnucash/import-export/qif-imp/gncmod-qif-import.c
+gnucash/import-export/qif-imp/gnc-plugin-qif-import.c
+[type: gettext/gsettings]gnucash/import-export/qif-imp/gschemas/org.gnucash.dialogs.import.qif.gschema.xml.in.in
+gnucash/import-export/qif-imp/qif-dialog-utils.scm
+gnucash/import-export/qif-imp/qif-file.scm
+gnucash/import-export/qif-imp/qif-guess-map.scm
+gnucash/import-export/qif-imp/qif-import.scm
+gnucash/import-export/qif-imp/qif-merge-groups.scm
+gnucash/import-export/qif-imp/qif-objects.scm
+gnucash/import-export/qif-imp/qif-parse.scm
+gnucash/import-export/qif-imp/qif-to-gnc.scm
+gnucash/import-export/qif-imp/qif-utils.scm
+gnucash/plugins/bi_import/dialog-bi-import.c
+gnucash/plugins/bi_import/dialog-bi-import-gui.c
+gnucash/plugins/bi_import/dialog-bi-import-helper.c
+gnucash/plugins/bi_import/gncmod-bi-import.c
+gnucash/plugins/bi_import/gnc-plugin-bi-import.c
+gnucash/plugins/bi_import/gtkbuilder/dialog-bi-import-gui.glade
+gnucash/plugins/customer_import/dialog-customer-import.c
+gnucash/plugins/customer_import/dialog-customer-import-gui.c
+gnucash/plugins/customer_import/gnc-plugin-customer_import.c
+gnucash/plugins/customer_import/gtkbuilder/dialog-customer-import-gui.glade
+gnucash/plugins/customer_import/libgncmod-customer_import.c
+gnucash/plugins/example/gncmod-example.c
+gnucash/plugins/example/gnc-plugin.example.c
+gnucash/python/gncmod-python.c
+gnucash/register/ledger-core/gncEntryLedger.c
+gnucash/register/ledger-core/gncEntryLedgerControl.c
+gnucash/register/ledger-core/gncEntryLedgerDisplay.c
+gnucash/register/ledger-core/gncEntryLedgerLayout.c
+gnucash/register/ledger-core/gncEntryLedgerLoad.c
+gnucash/register/ledger-core/gncEntryLedgerModel.c
+gnucash/register/ledger-core/gnc-ledger-display2.c
+gnucash/register/ledger-core/gnc-ledger-display.c
+gnucash/register/ledger-core/gncmod-ledger-core.c
+gnucash/register/ledger-core/split-register.c
+gnucash/register/ledger-core/split-register-control.c
+gnucash/register/ledger-core/split-register-layout.c
+gnucash/register/ledger-core/split-register-load.c
+gnucash/register/ledger-core/split-register-model.c
+gnucash/register/ledger-core/split-register-model-save.c
+gnucash/register/ledger-core/split-register-util.c
+gnucash/register/register-core/basiccell.c
+gnucash/register/register-core/cellblock.c
+gnucash/register/register-core/cell-factory.c
+gnucash/register/register-core/checkboxcell.c
+gnucash/register/register-core/formulacell.c
+gnucash/register/register-core/gncmod-register-core.c
+gnucash/register/register-core/gtable.c
+gnucash/register/register-core/numcell.c
+gnucash/register/register-core/pricecell.c
+gnucash/register/register-core/quickfillcell.c
+gnucash/register/register-core/recncell.c
+gnucash/register/register-core/register-common.c
+gnucash/register/register-core/table-allgui.c
+gnucash/register/register-core/table-control.c
+gnucash/register/register-core/table-layout.c
+gnucash/register/register-core/table-model.c
+gnucash/register/register-gnome/combocell-gnome.c
+gnucash/register/register-gnome/datecell-gnome.c
+gnucash/register/register-gnome/formulacell-gnome.c
+gnucash/register/register-gnome/gncmod-register-gnome.c
+gnucash/register/register-gnome/gnucash-color.c
+gnucash/register/register-gnome/gnucash-cursor.c
+gnucash/register/register-gnome/gnucash-date-picker.c
+gnucash/register/register-gnome/gnucash-header.c
+gnucash/register/register-gnome/gnucash-item-edit.c
+gnucash/register/register-gnome/gnucash-item-list.c
+gnucash/register/register-gnome/gnucash-register.c
+gnucash/register/register-gnome/gnucash-scrolled-window.c
+gnucash/register/register-gnome/gnucash-sheet.c
+gnucash/register/register-gnome/gnucash-sheet-private.c
+gnucash/register/register-gnome/gnucash-style.c
+gnucash/register/register-gnome/pricecell-gnome.c
+gnucash/register/register-gnome/quickfillcell-gnome.c
+gnucash/register/register-gnome/table-gnome.c
+gnucash/report/business-reports/aging.scm
+gnucash/report/business-reports/balsheet-eg.eguile.scm
+gnucash/report/business-reports/balsheet-eg.scm
+gnucash/report/business-reports/business-reports.scm
+gnucash/report/business-reports/customer-summary.scm
+gnucash/report/business-reports/easy-invoice.scm
+gnucash/report/business-reports/fancy-invoice.scm
+gnucash/report/business-reports/invoice.scm
+gnucash/report/business-reports/job-report.scm
+gnucash/report/business-reports/owner-report.scm
+gnucash/report/business-reports/payables.scm
+gnucash/report/business-reports/receipt.eguile.scm
+gnucash/report/business-reports/receipt.scm
+gnucash/report/business-reports/receivables.scm
+gnucash/report/business-reports/taxinvoice.eguile.scm
+gnucash/report/business-reports/taxinvoice.scm
+gnucash/report/locale-specific/us/de_DE.scm
+gnucash/report/locale-specific/us/gncmod-locale-reports-us.c
+gnucash/report/locale-specific/us/taxtxf-de_DE.scm
+gnucash/report/locale-specific/us/taxtxf.scm
+gnucash/report/locale-specific/us/us.scm
+gnucash/report/report-gnome/dialog-custom-report.c
+gnucash/report/report-gnome/dialog-custom-report.glade
+gnucash/report/report-gnome/dialog-report-column-view.c
+gnucash/report/report-gnome/dialog-report.glade
+gnucash/report/report-gnome/dialog-report-style-sheet.c
+gnucash/report/report-gnome/gncmod-report-gnome.c
+gnucash/report/report-gnome/gnc-plugin-page-report.c
+gnucash/report/report-gnome/report-gnome.scm
+gnucash/report/report-gnome/window-report.c
+gnucash/report/report-system/collectors.scm
+gnucash/report/report-system/commodity-utilities.scm
+gnucash/report/report-system/eguile-gnc.scm
+gnucash/report/report-system/eguile-html-utilities.scm
+gnucash/report/report-system/eguile-utilities.scm
+gnucash/report/report-system/gncmod-report-system.c
+gnucash/report/report-system/gnc-report.c
+gnucash/report/report-system/html-acct-table.scm
+gnucash/report/report-system/html-barchart.scm
+gnucash/report/report-system/html-document.scm
+gnucash/report/report-system/html-fonts.scm
+gnucash/report/report-system/html-jqplot.scm
+gnucash/report/report-system/html-linechart.scm
+gnucash/report/report-system/html-piechart.scm
+gnucash/report/report-system/html-scatter.scm
+gnucash/report/report-system/html-style-info.scm
+gnucash/report/report-system/html-style-sheet.scm
+gnucash/report/report-system/html-table.scm
+gnucash/report/report-system/html-text.scm
+gnucash/report/report-system/html-utilities.scm
+gnucash/report/report-system/list-extras.scm
+gnucash/report/report-system/options-utilities.scm
+gnucash/report/report-system/report-collectors.scm
+gnucash/report/report-system/report.scm
+gnucash/report/report-system/report-system.scm
+gnucash/report/report-system/report-utilities.scm
+gnucash/report/standard-reports/account-piecharts.scm
+gnucash/report/standard-reports/account-summary.scm
+gnucash/report/standard-reports/advanced-portfolio.scm
+gnucash/report/standard-reports/average-balance.scm
+gnucash/report/standard-reports/balance-sheet.scm
+gnucash/report/standard-reports/budget-balance-sheet.scm
+gnucash/report/standard-reports/budget-barchart.scm
+gnucash/report/standard-reports/budget-flow.scm
+gnucash/report/standard-reports/budget-income-statement.scm
+gnucash/report/standard-reports/budget.scm
+gnucash/report/standard-reports/cash-flow.scm
+gnucash/report/standard-reports/category-barchart.scm
+gnucash/report/standard-reports/daily-reports.scm
+gnucash/report/standard-reports/equity-statement.scm
+gnucash/report/standard-reports/general-journal.scm
+gnucash/report/standard-reports/general-ledger.scm
+gnucash/report/standard-reports/income-statement.scm
+gnucash/report/standard-reports/net-barchart.scm
+gnucash/report/standard-reports/net-linechart.scm
+gnucash/report/standard-reports/portfolio.scm
+gnucash/report/standard-reports/price-scatter.scm
+gnucash/report/standard-reports/register.scm
+gnucash/report/standard-reports/standard-reports.scm
+gnucash/report/standard-reports/sx-summary.scm
+gnucash/report/standard-reports/transaction.scm
+gnucash/report/standard-reports/trial-balance.scm
+gnucash/report/stylesheets/gncmod-stylesheets.c
+gnucash/report/stylesheets/gnc-plugin-stylesheets.c
+gnucash/report/stylesheets/stylesheet-easy.scm
+gnucash/report/stylesheets/stylesheet-fancy.scm
+gnucash/report/stylesheets/stylesheet-footer.scm
+gnucash/report/stylesheets/stylesheet-head-or-tail.scm
+gnucash/report/stylesheets/stylesheet-plain.scm
+gnucash/report/stylesheets/stylesheets.scm
+gnucash/report/utility-reports/hello-world.scm
+gnucash/report/utility-reports/utility-reports.scm
+gnucash/report/utility-reports/view-column.scm
+gnucash/report/utility-reports/welcome-to-gnucash.scm
 lib/goffice/go-charmap-sel.c
 lib/goffice/go-glib-extras.c
 lib/goffice/go-optionmenu.c
@@ -7,676 +468,215 @@ lib/libc/libc-missing-noop.c
 lib/libc/setenv.c
 lib/libc/strfmon.c
 lib/libc/strptime.c
-src/app-utils/app-utils.scm
-src/app-utils/business-helpers.c
-src/app-utils/business-options.c
-src/app-utils/business-options.scm
-src/app-utils/business-prefs.scm
-src/app-utils/calculation/expression_parser.c
-src/app-utils/calculation/fin.c
-src/app-utils/c-interface.scm
-src/app-utils/config-var.scm
-src/app-utils/date-utilities.scm
-src/app-utils/file-utils.c
-src/app-utils/gettext.scm
-src/app-utils/gfec.c
-src/app-utils/gnc-accounting-period.c
-src/app-utils/gnc-account-merge.c
-src/app-utils/gnc-addr-quickfill.c
-src/app-utils/gnc-component-manager.c
-src/app-utils/gnc-entry-quickfill.c
-src/app-utils/gnc-euro.c
-src/app-utils/gnc-exp-parser.c
-src/app-utils/gnc-gdate-utils.c
-src/app-utils/gnc-gettext-util.c
-src/app-utils/gnc-gsettings.c
-src/app-utils/gnc-helpers.c
-src/app-utils/gnc-help-utils.c
-src/app-utils/gncmod-app-utils.c
-src/app-utils/gnc-prefs-utils.c
-src/app-utils/gnc-state.c
-src/app-utils/gnc-sx-instance-model.c
-src/app-utils/gnc-ui-balances.c
-src/app-utils/gnc-ui-util.c
-src/app-utils/guile-util.c
-src/app-utils/hooks.scm
-src/app-utils/migrate-prefs.scm
-src/app-utils/options.scm
-src/app-utils/option-util.c
-src/app-utils/prefs.scm
-src/app-utils/QuickFill.c
-src/app-utils/simple-obj.scm
-src/backend/dbi/gnc-backend-dbi.cpp
-src/backend/dbi/gnc-dbisqlconnection.cpp
-src/backend/dbi/gnc-dbisqlresult.cpp
-src/backend/sql/escape.cpp
-src/backend/sql/gnc-account-sql.cpp
-src/backend/sql/gnc-address-sql.cpp
-src/backend/sql/gnc-bill-term-sql.cpp
-src/backend/sql/gnc-book-sql.cpp
-src/backend/sql/gnc-budget-sql.cpp
-src/backend/sql/gnc-commodity-sql.cpp
-src/backend/sql/gnc-customer-sql.cpp
-src/backend/sql/gnc-employee-sql.cpp
-src/backend/sql/gnc-entry-sql.cpp
-src/backend/sql/gnc-invoice-sql.cpp
-src/backend/sql/gnc-job-sql.cpp
-src/backend/sql/gnc-lots-sql.cpp
-src/backend/sql/gnc-order-sql.cpp
-src/backend/sql/gnc-owner-sql.cpp
-src/backend/sql/gnc-price-sql.cpp
-src/backend/sql/gnc-recurrence-sql.cpp
-src/backend/sql/gnc-schedxaction-sql.cpp
-src/backend/sql/gnc-slots-sql.cpp
-src/backend/sql/gnc-sql-backend.cpp
-src/backend/sql/gnc-sql-column-table-entry.cpp
-src/backend/sql/gnc-sql-object-backend.cpp
-src/backend/sql/gnc-sql-result.cpp
-src/backend/sql/gnc-tax-table-sql.cpp
-src/backend/sql/gnc-transaction-sql.cpp
-src/backend/sql/gnc-vendor-sql.cpp
-src/backend/xml/gnc-account-xml-v2.cpp
-src/backend/xml/gnc-address-xml-v2.cpp
-src/backend/xml/gnc-backend-xml.cpp
-src/backend/xml/gnc-bill-term-xml-v2.cpp
-src/backend/xml/gnc-book-xml-v2.cpp
-src/backend/xml/gnc-budget-xml-v2.cpp
-src/backend/xml/gnc-commodity-xml-v2.cpp
-src/backend/xml/gnc-customer-xml-v2.cpp
-src/backend/xml/gnc-employee-xml-v2.cpp
-src/backend/xml/gnc-entry-xml-v2.cpp
-src/backend/xml/gnc-freqspec-xml-v2.cpp
-src/backend/xml/gnc-invoice-xml-v2.cpp
-src/backend/xml/gnc-job-xml-v2.cpp
-src/backend/xml/gnc-lot-xml-v2.cpp
-src/backend/xml/gnc-order-xml-v2.cpp
-src/backend/xml/gnc-owner-xml-v2.cpp
-src/backend/xml/gnc-pricedb-xml-v2.cpp
-src/backend/xml/gnc-recurrence-xml-v2.cpp
-src/backend/xml/gnc-schedxaction-xml-v2.cpp
-src/backend/xml/gnc-tax-table-xml-v2.cpp
-src/backend/xml/gnc-transaction-xml-v2.cpp
-src/backend/xml/gnc-vendor-xml-v2.cpp
-src/backend/xml/gnc-xml-backend.cpp
-src/backend/xml/gnc-xml-helper.cpp
-src/backend/xml/io-example-account.cpp
-src/backend/xml/io-gncxml-gen.cpp
-src/backend/xml/io-gncxml-v1.cpp
-src/backend/xml/io-gncxml-v2.cpp
-src/backend/xml/io-utils.cpp
-src/backend/xml/sixtp.cpp
-src/backend/xml/sixtp-dom-generators.cpp
-src/backend/xml/sixtp-dom-parsers.cpp
-src/backend/xml/sixtp-stack.cpp
-src/backend/xml/sixtp-to-dom-parser.cpp
-src/backend/xml/sixtp-utils.cpp
-src/bin/gnucash-bin.c
-src/core-utils/binreloc.c
-src/core-utils/core-utils.scm
-src/core-utils/gnc-environment.c
-src/core-utils/gnc-filepath-utils.c
-src/core-utils/gnc-gkeyfile-utils.c
-src/core-utils/gnc-glib-utils.c
-src/core-utils/gnc-guile-utils.c
-src/core-utils/gnc-jalali.c
-src/core-utils/gnc-locale-utils.c
-src/core-utils/gnc-path.c
-src/core-utils/gnc-prefs.c
-src/doc/doxygen_main_page.c
-src/engine/Account.c
-src/engine/business-core.scm
-src/engine/cap-gains.c
-src/engine/cashobjects.c
-src/engine/commodity-table.scm
-src/engine/engine-helpers.c
-src/engine/engine-interface.scm
-src/engine/engine.scm
-src/engine/engine-utilities.scm
-src/engine/glib-helpers.c
-src/engine/gncAddress.c
-src/engine/gnc-aqbanking-templates.cpp
-src/engine/gncBillTerm.c
-src/engine/gnc-budget.c
-src/engine/gncBusGuile.c
-src/engine/gncBusiness.c
-src/engine/gnc-commodity.c
-src/engine/gncCustomer.c
-src/engine/gnc-date.cpp
-src/engine/gnc-datetime.cpp
-src/engine/gncEmployee.c
-src/engine/gnc-engine.c
-src/engine/gncEntry.c
-src/engine/gnc-event.c
-src/engine/gnc-features.c
-src/engine/gnc-hooks.c
-src/engine/gncIDSearch.c
-src/engine/gnc-int128.cpp
-src/engine/gncInvoice.c
-src/engine/gncJob.c
-src/engine/gnc-lot.c
-src/engine/gncmod-engine.c
-src/engine/gnc-numeric.cpp
-src/engine/gnc-numeric.scm
-src/engine/gncOrder.c
-src/engine/gncOwner.c
-src/engine/gnc-pricedb.c
-src/engine/gnc-rational.cpp
-src/engine/gnc-session.c
-src/engine/gncTaxTable.c
-src/engine/gnc-timezone.cpp
-src/engine/gnc-uri-utils.c
-src/engine/gncVendor.c
-src/engine/guid.cpp
-src/engine/kvp-frame.cpp
-src/engine/kvp-scm.cpp
-src/engine/kvp-value.cpp
-src/engine/policy.c
-src/engine/qof-backend.cpp
-src/engine/qofbook.cpp
-src/engine/qofchoice.cpp
-src/engine/qofclass.cpp
-src/engine/qofevent.cpp
-src/engine/qofid.cpp
-src/engine/qofinstance.cpp
-src/engine/qoflog.cpp
-src/engine/qofobject.cpp
-src/engine/qofquerycore.cpp
-src/engine/qofquery.cpp
-src/engine/qofsession.cpp
-src/engine/qof-string-cache.cpp
-src/engine/qofutil.cpp
-src/engine/qof-win32.cpp
-src/engine/Query.c
-src/engine/Recurrence.c
-src/engine/SchedXaction.c
-src/engine/Scrub2.c
-src/engine/Scrub3.c
-src/engine/ScrubBusiness.c
-src/engine/Scrub.c
-src/engine/Split.c
-src/engine/SX-book.c
-src/engine/SX-ttinfo.c
-src/engine/Transaction.c
-src/engine/TransLog.c
-src/gnc-module/gnc-module.c
-src/gnc-module/gnc-module.scm
-src/gnome/assistant-acct-period.c
-src/gnome/assistant-hierarchy.c
-src/gnome/assistant-loan.c
-src/gnome/assistant-stock-split.c
-src/gnome/business-gnome-utils.c
-src/gnome/business-options-gnome.c
-src/gnome/business-urls.c
-src/gnome/dialog-billterms.c
-src/gnome/dialog-choose-owner.c
-src/gnome/dialog-commodities.c
-src/gnome/dialog-customer.c
-src/gnome/dialog-date-close.c
-src/gnome/dialog-employee.c
-src/gnome/dialog-fincalc.c
-src/gnome/dialog-find-account.c
-src/gnome/dialog-find-transactions2.c
-src/gnome/dialog-find-transactions.c
-src/gnome/dialog-imap-editor.c
-src/gnome/dialog-invoice.c
-src/gnome/dialog-job.c
-src/gnome/dialog-lot-viewer.c
-src/gnome/dialog-new-user.c
-src/gnome/dialog-order.c
-src/gnome/dialog-payment.c
-src/gnome/dialog-price-edit-db.c
-src/gnome/dialog-price-editor.c
-src/gnome/dialog-print-check.c
-src/gnome/dialog-progress.c
-src/gnome/dialog-sx-editor2.c
-src/gnome/dialog-sx-editor.c
-src/gnome/dialog-sx-from-trans.c
-src/gnome/dialog-sx-since-last-run.c
-src/gnome/dialog-tax-info.c
-src/gnome/dialog-trans-assoc.c
-src/gnome/dialog-vendor.c
-src/gnome/gnc-budget-view.c
-src/gnome/gnc-plugin-account-tree.c
-src/gnome/gnc-plugin-basic-commands.c
-src/gnome/gnc-plugin-budget.c
-src/gnome/gnc-plugin-business.c
-src/gnome/gnc-plugin-page-account-tree.c
-src/gnome/gnc-plugin-page-budget.c
-src/gnome/gnc-plugin-page-invoice.c
-src/gnome/gnc-plugin-page-owner-tree.c
-src/gnome/gnc-plugin-page-register2.c
-src/gnome/gnc-plugin-page-register.c
-src/gnome/gnc-plugin-page-sx-list.c
-src/gnome/gnc-plugin-register2.c
-src/gnome/gnc-plugin-register.c
-src/gnome/gnc-split-reg2.c
-src/gnome/gnc-split-reg.c
-[type: gettext/gsettings]src/gnome/gschemas/org.gnucash.dialogs.business.gschema.xml.in.in
-[type: gettext/gsettings]src/gnome/gschemas/org.gnucash.dialogs.checkprinting.gschema.xml.in.in
-[type: gettext/gsettings]src/gnome/gschemas/org.gnucash.dialogs.commodities.gschema.xml.in.in
-[type: gettext/gsettings]src/gnome/gschemas/org.gnucash.dialogs.gschema.xml.in.in
-[type: gettext/gsettings]src/gnome/gschemas/org.gnucash.dialogs.reconcile.gschema.xml.in.in
-[type: gettext/gsettings]src/gnome/gschemas/org.gnucash.dialogs.sxs.gschema.xml.in.in
-[type: gettext/gsettings]src/gnome/gschemas/org.gnucash.dialogs.totd.gschema.xml.in.in
-[type: gettext/gsettings]src/gnome/gschemas/org.gnucash.gschema.xml.in.in
-[type: gettext/gsettings]src/gnome/gschemas/org.gnucash.window.pages.account.tree.gschema.xml.in.in
-[type: gettext/gsettings]src/gnome/gschemas/org.gnucash.window.pages.gschema.xml.in.in
-src/gnome/gtkbuilder/assistant-acct-period.glade
-src/gnome/gtkbuilder/assistant-hierarchy.glade
-src/gnome/gtkbuilder/assistant-loan.glade
-src/gnome/gtkbuilder/assistant-stock-split.glade
-src/gnome/gtkbuilder/business-options-gnome.glade
-src/gnome/gtkbuilder/business-prefs.glade
-src/gnome/gtkbuilder/dialog-billterms.glade
-src/gnome/gtkbuilder/dialog-choose-owner.glade
-src/gnome/gtkbuilder/dialog-commodities.glade
-src/gnome/gtkbuilder/dialog-customer.glade
-src/gnome/gtkbuilder/dialog-date-close.glade
-src/gnome/gtkbuilder/dialog-employee.glade
-src/gnome/gtkbuilder/dialog-fincalc.glade
-src/gnome/gtkbuilder/dialog-find-account.glade
-src/gnome/gtkbuilder/dialog-imap-editor.glade
-src/gnome/gtkbuilder/dialog-invoice.glade
-src/gnome/gtkbuilder/dialog-job.glade
-src/gnome/gtkbuilder/dialog-lot-viewer.glade
-src/gnome/gtkbuilder/dialog-new-user.glade
-src/gnome/gtkbuilder/dialog-order.glade
-src/gnome/gtkbuilder/dialog-payment.glade
-src/gnome/gtkbuilder/dialog-price.glade
-src/gnome/gtkbuilder/dialog-print-check.glade
-src/gnome/gtkbuilder/dialog-progress.glade
-src/gnome/gtkbuilder/dialog-sx.glade
-src/gnome/gtkbuilder/dialog-tax-info.glade
-src/gnome/gtkbuilder/dialog-trans-assoc.glade
-src/gnome/gtkbuilder/dialog-vendor.glade
-src/gnome/gtkbuilder/gnc-plugin-page-budget.glade
-src/gnome/gtkbuilder/gnc-plugin-page-register2.glade
-src/gnome/gtkbuilder/gnc-plugin-page-register.glade
-src/gnome/gtkbuilder/window-autoclear.glade
-src/gnome/gtkbuilder/window-reconcile.glade
-src/gnome/reconcile-view.c
-src/gnome/search-owner.c
-src/gnome/top-level.c
-src/gnome/window-autoclear.c
-src/gnome/window-reconcile2.c
-src/gnome/window-reconcile.c
-src/gnome-search/dialog-search.c
-src/gnome-search/dialog-search.glade
-src/gnome-search/gnc-general-search.c
-src/gnome-search/gncmod-gnome-search.c
-src/gnome-search/search-account.c
-src/gnome-search/search-boolean.c
-src/gnome-search/search-core-type.c
-src/gnome-search/search-core-utils.c
-src/gnome-search/search-date.c
-src/gnome-search/search-double.c
-src/gnome-search/search-int64.c
-src/gnome-search/search-numeric.c
-src/gnome-search/search-reconciled.c
-src/gnome-search/search-string.c
-src/gnome-utils/account-quickfill.c
-src/gnome-utils/assistant-xml-encoding.c
-src/gnome-utils/cursors.c
-src/gnome-utils/dialog-account.c
-src/gnome-utils/dialog-book-close.c
-src/gnome-utils/dialog-commodity.c
-src/gnome-utils/dialog-dup-trans.c
-src/gnome-utils/dialog-file-access.c
-src/gnome-utils/dialog-object-references.c
-src/gnome-utils/dialog-options.c
-src/gnome-utils/dialog-preferences.c
-src/gnome-utils/dialog-query-view.c
-src/gnome-utils/dialog-reset-warnings.c
-src/gnome-utils/dialog-tax-table.c
-src/gnome-utils/dialog-totd.c
-src/gnome-utils/dialog-transfer.c
-src/gnome-utils/dialog-userpass.c
-src/gnome-utils/dialog-utils.c
-src/gnome-utils/gnc-account-sel.c
-src/gnome-utils/gnc-amount-edit.c
-src/gnome-utils/gnc-autosave.c
-src/gnome-utils/gnc-cell-renderer-date.c
-src/gnome-utils/gnc-cell-renderer-popup.c
-src/gnome-utils/gnc-cell-renderer-popup-entry.c
-src/gnome-utils/gnc-combott.c
-src/gnome-utils/gnc-commodity-edit.c
-src/gnome-utils/gnc-currency-edit.c
-src/gnome-utils/gnc-date-delta.c
-src/gnome-utils/gnc-date-edit.c
-src/gnome-utils/gnc-date-format.c
-src/gnome-utils/gnc-dense-cal.c
-src/gnome-utils/gnc-dense-cal-model.c
-src/gnome-utils/gnc-dense-cal-store.c
-src/gnome-utils/gnc-embedded-window.c
-src/gnome-utils/gnc-file.c
-src/gnome-utils/gnc-frequency.c
-src/gnome-utils/gnc-general-select.c
-src/gnome-utils/gnc-gnome-utils.c
-src/gnome-utils/gnc-gobject-utils.c
-src/gnome-utils/gnc-gtk-utils.c
-src/gnome-utils/gnc-gui-query.c
-src/gnome-utils/gnc-icons.c
-src/gnome-utils/gnc-keyring.c
-src/gnome-utils/gnc-main-window.c
-src/gnome-utils/gnc-menu-extensions.c
-src/gnome-utils/gnc-menu-extensions.scm
-src/gnome-utils/gncmod-gnome-utils.c
-src/gnome-utils/gnc-period-select.c
-src/gnome-utils/gnc-plugin.c
-src/gnome-utils/gnc-plugin-file-history.c
-src/gnome-utils/gnc-plugin-manager.c
-src/gnome-utils/gnc-plugin-menu-additions.c
-src/gnome-utils/gnc-plugin-page.c
-src/gnome-utils/gnc-query-view.c
-src/gnome-utils/gnc-recurrence.c
-src/gnome-utils/gnc-splash.c
-src/gnome-utils/gnc-sx-instance-dense-cal-adapter.c
-src/gnome-utils/gnc-sx-list-tree-model-adapter.c
-src/gnome-utils/gnc-tree-control-split-reg.c
-src/gnome-utils/gnc-tree-model-account.c
-src/gnome-utils/gnc-tree-model-account-types.c
-src/gnome-utils/gnc-tree-model-budget.c
-src/gnome-utils/gnc-tree-model.c
-src/gnome-utils/gnc-tree-model-commodity.c
-src/gnome-utils/gnc-tree-model-owner.c
-src/gnome-utils/gnc-tree-model-price.c
-src/gnome-utils/gnc-tree-model-split-reg.c
-src/gnome-utils/gnc-tree-util-split-reg.c
-src/gnome-utils/gnc-tree-view-account.c
-src/gnome-utils/gnc-tree-view.c
-src/gnome-utils/gnc-tree-view-commodity.c
-src/gnome-utils/gnc-tree-view-owner.c
-src/gnome-utils/gnc-tree-view-price.c
-src/gnome-utils/gnc-tree-view-split-reg.c
-src/gnome-utils/gnc-tree-view-sx-list.c
-src/gnome-utils/gnc-window.c
-src/gnome-utils/gnome-utils.scm
-[type: gettext/gsettings]src/gnome-utils/gschemas/org.gnucash.history.gschema.xml.in.in
-[type: gettext/gsettings]src/gnome-utils/gschemas/org.gnucash.warnings.gschema.xml.in.in
-src/gnome-utils/gtkbuilder/assistant-xml-encoding.glade
-src/gnome-utils/gtkbuilder/dialog-account.glade
-src/gnome-utils/gtkbuilder/dialog-book-close.glade
-src/gnome-utils/gtkbuilder/dialog-commodity.glade
-src/gnome-utils/gtkbuilder/dialog-file-access.glade
-src/gnome-utils/gtkbuilder/dialog-object-references.glade
-src/gnome-utils/gtkbuilder/dialog-options.glade
-src/gnome-utils/gtkbuilder/dialog-preferences.glade
-src/gnome-utils/gtkbuilder/dialog-query-view.glade
-src/gnome-utils/gtkbuilder/dialog-reset-warnings.glade
-src/gnome-utils/gtkbuilder/dialog-tax-table.glade
-src/gnome-utils/gtkbuilder/dialog-totd.glade
-src/gnome-utils/gtkbuilder/dialog-transfer.glade
-src/gnome-utils/gtkbuilder/dialog-userpass.glade
-src/gnome-utils/gtkbuilder/gnc-date-format.glade
-src/gnome-utils/gtkbuilder/gnc-frequency.glade
-src/gnome-utils/gtkbuilder/gnc-recurrence.glade
-src/gnome-utils/gtkbuilder/gnc-tree-view-owner.glade
-src/gnome-utils/misc-gnome-utils.c
-src/gnome-utils/print-session.c
-src/gnome-utils/search-param.c
-src/gnome-utils/tree-view-utils.c
-src/gnome-utils/window-main-summarybar.c
-src/html/gnc-html.c
-src/html/gnc-html-factory.c
-src/html/gnc-html-history.c
-src/html/gnc-html-webkit1.c
-src/html/gnc-html-webkit2.c
-src/html/gncmod-html.c
-src/import-export/aqb/assistant-ab-initial.c
-src/import-export/aqb/assistant-ab-initial.glade
-src/import-export/aqb/dialog-ab-daterange.c
-src/import-export/aqb/dialog-ab.glade
-src/import-export/aqb/dialog-ab-pref.glade
-src/import-export/aqb/dialog-ab-trans.c
-src/import-export/aqb/gnc-ab-getbalance.c
-src/import-export/aqb/gnc-ab-gettrans.c
-src/import-export/aqb/gnc-ab-kvp.c
-src/import-export/aqb/gnc-ab-transfer.c
-src/import-export/aqb/gnc-ab-utils.c
-src/import-export/aqb/gnc-file-aqb-import.c
-src/import-export/aqb/gnc-gwen-gui.c
-src/import-export/aqb/gncmod-aqbanking.c
-src/import-export/aqb/gnc-plugin-aqbanking.c
-[type: gettext/gsettings]src/import-export/aqb/gschemas/org.gnucash.dialogs.import.hbci.gschema.xml.in.in
-src/import-export/csv-exp/assistant-csv-export.c
-src/import-export/csv-exp/assistant-csv-export.glade
-src/import-export/csv-exp/csv-transactions-export.c
-src/import-export/csv-exp/csv-tree-export.c
-src/import-export/csv-exp/gncmod-csv-export.c
-src/import-export/csv-exp/gnc-plugin-csv-export.c
-[type: gettext/gsettings]src/import-export/csv-exp/gschemas/org.gnucash.dialogs.export.csv.gschema.xml.in.in
-src/import-export/csv-imp/assistant-csv-account-import.c
-src/import-export/csv-imp/assistant-csv-account-import.glade
-src/import-export/csv-imp/assistant-csv-trans-import.cpp
-src/import-export/csv-imp/assistant-csv-trans-import.glade
-src/import-export/csv-imp/csv-account-import.c
-src/import-export/csv-imp/gnc-csv-account-map.c
-src/import-export/csv-imp/gnc-csv-gnumeric-popup.c
-src/import-export/csv-imp/gnc-csv-tokenizer.cpp
-src/import-export/csv-imp/gnc-csv-trans-settings.cpp
-src/import-export/csv-imp/gnc-dummy-tokenizer.cpp
-src/import-export/csv-imp/gnc-fw-tokenizer.cpp
-src/import-export/csv-imp/gncmod-csv-import.c
-src/import-export/csv-imp/gnc-plugin-csv-import.c
-src/import-export/csv-imp/gnc-tokenizer.cpp
-src/import-export/csv-imp/gnc-trans-props.cpp
-src/import-export/csv-imp/gnc-tx-import.cpp
-[type: gettext/gsettings]src/import-export/csv-imp/gschemas/org.gnucash.dialogs.import.csv.gschema.xml.in.in
-src/import-export/dialog-import.glade
-src/import-export/gncmod-generic-import.c
-[type: gettext/gsettings]src/import-export/gschemas/org.gnucash.dialogs.import.generic.gschema.xml.in.in
-src/import-export/import-account-matcher.c
-src/import-export/import-backend.c
-src/import-export/import-commodity-matcher.c
-src/import-export/import-format-dialog.c
-src/import-export/import-main-matcher.c
-src/import-export/import-match-picker.c
-src/import-export/import-parse.c
-src/import-export/import-pending-matches.c
-src/import-export/import-settings.c
-src/import-export/import-utilities.c
-src/import-export/log-replay/gnc-log-replay.c
-src/import-export/log-replay/gncmod-log-replay.c
-src/import-export/log-replay/gnc-plugin-log-replay.c
-src/import-export/ofx/gncmod-ofx-import.c
-src/import-export/ofx/gnc-ofx-import.c
-src/import-export/ofx/gnc-ofx-kvp.c
-src/import-export/ofx/gnc-plugin-ofx.c
-[type: gettext/gsettings]src/import-export/ofx/gschemas/org.gnucash.dialogs.import.ofx.gschema.xml.in.in
-src/import-export/qif/qif-context.c
-src/import-export/qif/qif-file.c
-src/import-export/qif/qif-objects.c
-src/import-export/qif-imp/assistant-qif-import.c
-src/import-export/qif-imp/assistant-qif-import.glade
-src/import-export/qif-imp/dialog-account-picker.c
-src/import-export/qif-imp/dialog-account-picker.glade
-src/import-export/qif-imp/gncmod-qif-import.c
-src/import-export/qif-imp/gnc-plugin-qif-import.c
-[type: gettext/gsettings]src/import-export/qif-imp/gschemas/org.gnucash.dialogs.import.qif.gschema.xml.in.in
-src/import-export/qif-imp/qif-dialog-utils.scm
-src/import-export/qif-imp/qif-file.scm
-src/import-export/qif-imp/qif-guess-map.scm
-src/import-export/qif-imp/qif-import.scm
-src/import-export/qif-imp/qif-merge-groups.scm
-src/import-export/qif-imp/qif-objects.scm
-src/import-export/qif-imp/qif-parse.scm
-src/import-export/qif-imp/qif-to-gnc.scm
-src/import-export/qif-imp/qif-utils.scm
-src/plugins/bi_import/dialog-bi-import.c
-src/plugins/bi_import/dialog-bi-import-gui.c
-src/plugins/bi_import/dialog-bi-import-helper.c
-src/plugins/bi_import/gncmod-bi-import.c
-src/plugins/bi_import/gnc-plugin-bi-import.c
-src/plugins/bi_import/gtkbuilder/dialog-bi-import-gui.glade
-src/plugins/customer_import/dialog-customer-import.c
-src/plugins/customer_import/dialog-customer-import-gui.c
-src/plugins/customer_import/gnc-plugin-customer_import.c
-src/plugins/customer_import/gtkbuilder/dialog-customer-import-gui.glade
-src/plugins/customer_import/libgncmod-customer_import.c
-src/plugins/example/gncmod-example.c
-src/plugins/example/gnc-plugin.example.c
-src/python/gncmod-python.c
-src/register/ledger-core/gncEntryLedger.c
-src/register/ledger-core/gncEntryLedgerControl.c
-src/register/ledger-core/gncEntryLedgerDisplay.c
-src/register/ledger-core/gncEntryLedgerLayout.c
-src/register/ledger-core/gncEntryLedgerLoad.c
-src/register/ledger-core/gncEntryLedgerModel.c
-src/register/ledger-core/gnc-ledger-display2.c
-src/register/ledger-core/gnc-ledger-display.c
-src/register/ledger-core/gncmod-ledger-core.c
-src/register/ledger-core/split-register.c
-src/register/ledger-core/split-register-control.c
-src/register/ledger-core/split-register-layout.c
-src/register/ledger-core/split-register-load.c
-src/register/ledger-core/split-register-model.c
-src/register/ledger-core/split-register-model-save.c
-src/register/ledger-core/split-register-util.c
-src/register/register-core/basiccell.c
-src/register/register-core/cellblock.c
-src/register/register-core/cell-factory.c
-src/register/register-core/checkboxcell.c
-src/register/register-core/formulacell.c
-src/register/register-core/gncmod-register-core.c
-src/register/register-core/gtable.c
-src/register/register-core/numcell.c
-src/register/register-core/pricecell.c
-src/register/register-core/quickfillcell.c
-src/register/register-core/recncell.c
-src/register/register-core/register-common.c
-src/register/register-core/table-allgui.c
-src/register/register-core/table-control.c
-src/register/register-core/table-layout.c
-src/register/register-core/table-model.c
-src/register/register-gnome/combocell-gnome.c
-src/register/register-gnome/datecell-gnome.c
-src/register/register-gnome/formulacell-gnome.c
-src/register/register-gnome/gncmod-register-gnome.c
-src/register/register-gnome/gnucash-color.c
-src/register/register-gnome/gnucash-cursor.c
-src/register/register-gnome/gnucash-date-picker.c
-src/register/register-gnome/gnucash-header.c
-src/register/register-gnome/gnucash-item-edit.c
-src/register/register-gnome/gnucash-item-list.c
-src/register/register-gnome/gnucash-register.c
-src/register/register-gnome/gnucash-scrolled-window.c
-src/register/register-gnome/gnucash-sheet.c
-src/register/register-gnome/gnucash-sheet-private.c
-src/register/register-gnome/gnucash-style.c
-src/register/register-gnome/pricecell-gnome.c
-src/register/register-gnome/quickfillcell-gnome.c
-src/register/register-gnome/table-gnome.c
-src/report/business-reports/aging.scm
-src/report/business-reports/balsheet-eg.eguile.scm
-src/report/business-reports/balsheet-eg.scm
-src/report/business-reports/business-reports.scm
-src/report/business-reports/customer-summary.scm
-src/report/business-reports/easy-invoice.scm
-src/report/business-reports/fancy-invoice.scm
-src/report/business-reports/invoice.scm
-src/report/business-reports/job-report.scm
-src/report/business-reports/owner-report.scm
-src/report/business-reports/payables.scm
-src/report/business-reports/receipt.eguile.scm
-src/report/business-reports/receipt.scm
-src/report/business-reports/receivables.scm
-src/report/business-reports/taxinvoice.eguile.scm
-src/report/business-reports/taxinvoice.scm
-src/report/locale-specific/us/de_DE.scm
-src/report/locale-specific/us/gncmod-locale-reports-us.c
-src/report/locale-specific/us/taxtxf-de_DE.scm
-src/report/locale-specific/us/taxtxf.scm
-src/report/locale-specific/us/us.scm
-src/report/report-gnome/dialog-custom-report.c
-src/report/report-gnome/dialog-custom-report.glade
-src/report/report-gnome/dialog-report-column-view.c
-src/report/report-gnome/dialog-report.glade
-src/report/report-gnome/dialog-report-style-sheet.c
-src/report/report-gnome/gncmod-report-gnome.c
-src/report/report-gnome/gnc-plugin-page-report.c
-src/report/report-gnome/report-gnome.scm
-src/report/report-gnome/window-report.c
-src/report/report-system/collectors.scm
-src/report/report-system/commodity-utilities.scm
-src/report/report-system/eguile-gnc.scm
-src/report/report-system/eguile-html-utilities.scm
-src/report/report-system/eguile-utilities.scm
-src/report/report-system/gncmod-report-system.c
-src/report/report-system/gnc-report.c
-src/report/report-system/html-acct-table.scm
-src/report/report-system/html-barchart.scm
-src/report/report-system/html-document.scm
-src/report/report-system/html-fonts.scm
-src/report/report-system/html-jqplot.scm
-src/report/report-system/html-linechart.scm
-src/report/report-system/html-piechart.scm
-src/report/report-system/html-scatter.scm
-src/report/report-system/html-style-info.scm
-src/report/report-system/html-style-sheet.scm
-src/report/report-system/html-table.scm
-src/report/report-system/html-text.scm
-src/report/report-system/html-utilities.scm
-src/report/report-system/list-extras.scm
-src/report/report-system/options-utilities.scm
-src/report/report-system/report-collectors.scm
-src/report/report-system/report.scm
-src/report/report-system/report-system.scm
-src/report/report-system/report-utilities.scm
-src/report/standard-reports/account-piecharts.scm
-src/report/standard-reports/account-summary.scm
-src/report/standard-reports/advanced-portfolio.scm
-src/report/standard-reports/average-balance.scm
-src/report/standard-reports/balance-sheet.scm
-src/report/standard-reports/budget-balance-sheet.scm
-src/report/standard-reports/budget-barchart.scm
-src/report/standard-reports/budget-flow.scm
-src/report/standard-reports/budget-income-statement.scm
-src/report/standard-reports/budget.scm
-src/report/standard-reports/cash-flow.scm
-src/report/standard-reports/category-barchart.scm
-src/report/standard-reports/daily-reports.scm
-src/report/standard-reports/equity-statement.scm
-src/report/standard-reports/general-journal.scm
-src/report/standard-reports/general-ledger.scm
-src/report/standard-reports/income-statement.scm
-src/report/standard-reports/net-barchart.scm
-src/report/standard-reports/net-linechart.scm
-src/report/standard-reports/portfolio.scm
-src/report/standard-reports/price-scatter.scm
-src/report/standard-reports/register.scm
-src/report/standard-reports/standard-reports.scm
-src/report/standard-reports/sx-summary.scm
-src/report/standard-reports/transaction.scm
-src/report/standard-reports/trial-balance.scm
-src/report/stylesheets/gncmod-stylesheets.c
-src/report/stylesheets/gnc-plugin-stylesheets.c
-src/report/stylesheets/stylesheet-easy.scm
-src/report/stylesheets/stylesheet-fancy.scm
-src/report/stylesheets/stylesheet-footer.scm
-src/report/stylesheets/stylesheet-head-or-tail.scm
-src/report/stylesheets/stylesheet-plain.scm
-src/report/stylesheets/stylesheets.scm
-src/report/utility-reports/hello-world.scm
-src/report/utility-reports/utility-reports.scm
-src/report/utility-reports/view-column.scm
-src/report/utility-reports/welcome-to-gnucash.scm
-src/scm/fin.scm
-src/scm/gnumeric/gnumeric-utilities.scm
-src/scm/gnumeric/table-utils.scm
-src/scm/main.scm
-src/scm/price-quotes.scm
-src/scm/printf.scm
-src/scm/string.scm
-src/scm/substring-search.scm
-src/scm/xml-generator.scm
-src/tax/us/de_DE.scm
-src/tax/us/gncmod-tax-us.c
-src/tax/us/txf-de_DE.scm
-src/tax/us/txf-help-de_DE.scm
-src/tax/us/txf-help.scm
-src/tax/us/txf.scm
-src/tax/us/us.scm
-src/gnome/gnucash.appdata.xml.in
-src/gnome/gnucash.desktop.in.in
-src/engine/qofbookslots.h
+libgnucash/app-utils/app-utils.scm
+libgnucash/app-utils/business-helpers.c
+libgnucash/app-utils/business-options.c
+libgnucash/app-utils/business-options.scm
+libgnucash/app-utils/business-prefs.scm
+libgnucash/app-utils/calculation/expression_parser.c
+libgnucash/app-utils/calculation/fin.c
+libgnucash/app-utils/c-interface.scm
+libgnucash/app-utils/config-var.scm
+libgnucash/app-utils/date-utilities.scm
+libgnucash/app-utils/file-utils.c
+libgnucash/app-utils/gettext.scm
+libgnucash/app-utils/gfec.c
+libgnucash/app-utils/gnc-accounting-period.c
+libgnucash/app-utils/gnc-account-merge.c
+libgnucash/app-utils/gnc-addr-quickfill.c
+libgnucash/app-utils/gnc-component-manager.c
+libgnucash/app-utils/gnc-entry-quickfill.c
+libgnucash/app-utils/gnc-euro.c
+libgnucash/app-utils/gnc-exp-parser.c
+libgnucash/app-utils/gnc-gdate-utils.c
+libgnucash/app-utils/gnc-gettext-util.c
+libgnucash/app-utils/gnc-gsettings.c
+libgnucash/app-utils/gnc-helpers.c
+libgnucash/app-utils/gnc-help-utils.c
+libgnucash/app-utils/gncmod-app-utils.c
+libgnucash/app-utils/gnc-prefs-utils.c
+libgnucash/app-utils/gnc-state.c
+libgnucash/app-utils/gnc-sx-instance-model.c
+libgnucash/app-utils/gnc-ui-balances.c
+libgnucash/app-utils/gnc-ui-util.c
+libgnucash/app-utils/guile-util.c
+libgnucash/app-utils/hooks.scm
+libgnucash/app-utils/migrate-prefs.scm
+libgnucash/app-utils/options.scm
+libgnucash/app-utils/option-util.c
+libgnucash/app-utils/prefs.scm
+libgnucash/app-utils/QuickFill.c
+libgnucash/app-utils/simple-obj.scm
+libgnucash/backend/dbi/gnc-backend-dbi.cpp
+libgnucash/backend/dbi/gnc-dbisqlconnection.cpp
+libgnucash/backend/dbi/gnc-dbisqlresult.cpp
+libgnucash/backend/sql/escape.cpp
+libgnucash/backend/sql/gnc-account-sql.cpp
+libgnucash/backend/sql/gnc-address-sql.cpp
+libgnucash/backend/sql/gnc-bill-term-sql.cpp
+libgnucash/backend/sql/gnc-book-sql.cpp
+libgnucash/backend/sql/gnc-budget-sql.cpp
+libgnucash/backend/sql/gnc-commodity-sql.cpp
+libgnucash/backend/sql/gnc-customer-sql.cpp
+libgnucash/backend/sql/gnc-employee-sql.cpp
+libgnucash/backend/sql/gnc-entry-sql.cpp
+libgnucash/backend/sql/gnc-invoice-sql.cpp
+libgnucash/backend/sql/gnc-job-sql.cpp
+libgnucash/backend/sql/gnc-lots-sql.cpp
+libgnucash/backend/sql/gnc-order-sql.cpp
+libgnucash/backend/sql/gnc-owner-sql.cpp
+libgnucash/backend/sql/gnc-price-sql.cpp
+libgnucash/backend/sql/gnc-recurrence-sql.cpp
+libgnucash/backend/sql/gnc-schedxaction-sql.cpp
+libgnucash/backend/sql/gnc-slots-sql.cpp
+libgnucash/backend/sql/gnc-sql-backend.cpp
+libgnucash/backend/sql/gnc-sql-column-table-entry.cpp
+libgnucash/backend/sql/gnc-sql-object-backend.cpp
+libgnucash/backend/sql/gnc-sql-result.cpp
+libgnucash/backend/sql/gnc-tax-table-sql.cpp
+libgnucash/backend/sql/gnc-transaction-sql.cpp
+libgnucash/backend/sql/gnc-vendor-sql.cpp
+libgnucash/backend/xml/gnc-account-xml-v2.cpp
+libgnucash/backend/xml/gnc-address-xml-v2.cpp
+libgnucash/backend/xml/gnc-backend-xml.cpp
+libgnucash/backend/xml/gnc-bill-term-xml-v2.cpp
+libgnucash/backend/xml/gnc-book-xml-v2.cpp
+libgnucash/backend/xml/gnc-budget-xml-v2.cpp
+libgnucash/backend/xml/gnc-commodity-xml-v2.cpp
+libgnucash/backend/xml/gnc-customer-xml-v2.cpp
+libgnucash/backend/xml/gnc-employee-xml-v2.cpp
+libgnucash/backend/xml/gnc-entry-xml-v2.cpp
+libgnucash/backend/xml/gnc-freqspec-xml-v2.cpp
+libgnucash/backend/xml/gnc-invoice-xml-v2.cpp
+libgnucash/backend/xml/gnc-job-xml-v2.cpp
+libgnucash/backend/xml/gnc-lot-xml-v2.cpp
+libgnucash/backend/xml/gnc-order-xml-v2.cpp
+libgnucash/backend/xml/gnc-owner-xml-v2.cpp
+libgnucash/backend/xml/gnc-pricedb-xml-v2.cpp
+libgnucash/backend/xml/gnc-recurrence-xml-v2.cpp
+libgnucash/backend/xml/gnc-schedxaction-xml-v2.cpp
+libgnucash/backend/xml/gnc-tax-table-xml-v2.cpp
+libgnucash/backend/xml/gnc-transaction-xml-v2.cpp
+libgnucash/backend/xml/gnc-vendor-xml-v2.cpp
+libgnucash/backend/xml/gnc-xml-backend.cpp
+libgnucash/backend/xml/gnc-xml-helper.cpp
+libgnucash/backend/xml/io-example-account.cpp
+libgnucash/backend/xml/io-gncxml-gen.cpp
+libgnucash/backend/xml/io-gncxml-v1.cpp
+libgnucash/backend/xml/io-gncxml-v2.cpp
+libgnucash/backend/xml/io-utils.cpp
+libgnucash/backend/xml/sixtp.cpp
+libgnucash/backend/xml/sixtp-dom-generators.cpp
+libgnucash/backend/xml/sixtp-dom-parsers.cpp
+libgnucash/backend/xml/sixtp-stack.cpp
+libgnucash/backend/xml/sixtp-to-dom-parser.cpp
+libgnucash/backend/xml/sixtp-utils.cpp
+libgnucash/core-utils/binreloc.c
+libgnucash/core-utils/core-utils.scm
+libgnucash/core-utils/gnc-environment.c
+libgnucash/core-utils/gnc-filepath-utils.c
+libgnucash/core-utils/gnc-gkeyfile-utils.c
+libgnucash/core-utils/gnc-glib-utils.c
+libgnucash/core-utils/gnc-guile-utils.c
+libgnucash/core-utils/gnc-jalali.c
+libgnucash/core-utils/gnc-locale-utils.c
+libgnucash/core-utils/gnc-path.c
+libgnucash/core-utils/gnc-prefs.c
+libgnucash/doc/doxygen_main_page.c
+libgnucash/engine/Account.c
+libgnucash/engine/business-core.scm
+libgnucash/engine/cap-gains.c
+libgnucash/engine/cashobjects.c
+libgnucash/engine/commodity-table.scm
+libgnucash/engine/engine-helpers.c
+libgnucash/engine/engine-interface.scm
+libgnucash/engine/engine.scm
+libgnucash/engine/engine-utilities.scm
+libgnucash/engine/glib-helpers.c
+libgnucash/engine/gncAddress.c
+libgnucash/engine/gnc-aqbanking-templates.cpp
+libgnucash/engine/gncBillTerm.c
+libgnucash/engine/gnc-budget.c
+libgnucash/engine/gncBusGuile.c
+libgnucash/engine/gncBusiness.c
+libgnucash/engine/gnc-commodity.c
+libgnucash/engine/gncCustomer.c
+libgnucash/engine/gnc-date.cpp
+libgnucash/engine/gnc-datetime.cpp
+libgnucash/engine/gncEmployee.c
+libgnucash/engine/gnc-engine.c
+libgnucash/engine/gncEntry.c
+libgnucash/engine/gnc-event.c
+libgnucash/engine/gnc-features.c
+libgnucash/engine/gnc-hooks.c
+libgnucash/engine/gncIDSearch.c
+libgnucash/engine/gnc-int128.cpp
+libgnucash/engine/gncInvoice.c
+libgnucash/engine/gncJob.c
+libgnucash/engine/gnc-lot.c
+libgnucash/engine/gncmod-engine.c
+libgnucash/engine/gnc-numeric.cpp
+libgnucash/engine/gnc-numeric.scm
+libgnucash/engine/gncOrder.c
+libgnucash/engine/gncOwner.c
+libgnucash/engine/gnc-pricedb.c
+libgnucash/engine/gnc-rational.cpp
+libgnucash/engine/gnc-session.c
+libgnucash/engine/gncTaxTable.c
+libgnucash/engine/gnc-timezone.cpp
+libgnucash/engine/gnc-uri-utils.c
+libgnucash/engine/gncVendor.c
+libgnucash/engine/guid.cpp
+libgnucash/engine/kvp-frame.cpp
+libgnucash/engine/kvp-scm.cpp
+libgnucash/engine/kvp-value.cpp
+libgnucash/engine/policy.c
+libgnucash/engine/qof-backend.cpp
+libgnucash/engine/qofbook.cpp
+libgnucash/engine/qofchoice.cpp
+libgnucash/engine/qofclass.cpp
+libgnucash/engine/qofevent.cpp
+libgnucash/engine/qofid.cpp
+libgnucash/engine/qofinstance.cpp
+libgnucash/engine/qoflog.cpp
+libgnucash/engine/qofobject.cpp
+libgnucash/engine/qofquerycore.cpp
+libgnucash/engine/qofquery.cpp
+libgnucash/engine/qofsession.cpp
+libgnucash/engine/qof-string-cache.cpp
+libgnucash/engine/qofutil.cpp
+libgnucash/engine/qof-win32.cpp
+libgnucash/engine/Query.c
+libgnucash/engine/Recurrence.c
+libgnucash/engine/SchedXaction.c
+libgnucash/engine/Scrub2.c
+libgnucash/engine/Scrub3.c
+libgnucash/engine/ScrubBusiness.c
+libgnucash/engine/Scrub.c
+libgnucash/engine/Split.c
+libgnucash/engine/SX-book.c
+libgnucash/engine/SX-ttinfo.c
+libgnucash/engine/Transaction.c
+libgnucash/engine/TransLog.c
+libgnucash/gnc-module/gnc-module.c
+libgnucash/gnc-module/gnc-module.scm
+libgnucash/scm/fin.scm
+libgnucash/scm/gnumeric/gnumeric-utilities.scm
+libgnucash/scm/gnumeric/table-utils.scm
+libgnucash/scm/main.scm
+libgnucash/scm/price-quotes.scm
+libgnucash/scm/printf.scm
+libgnucash/scm/string.scm
+libgnucash/scm/substring-search.scm
+libgnucash/scm/xml-generator.scm
+libgnucash/tax/us/de_DE.scm
+libgnucash/tax/us/gncmod-tax-us.c
+libgnucash/tax/us/txf-de_DE.scm
+libgnucash/tax/us/txf-help-de_DE.scm
+libgnucash/tax/us/txf-help.scm
+libgnucash/tax/us/txf.scm
+libgnucash/tax/us/us.scm
+gnucash/gnome/gnucash.appdata.xml.in
+gnucash/gnome/gnucash.desktop.in.in
+libgnucash/engine/qofbookslots.h
 doc/tip_of_the_day.list.in
diff --git a/po/POTFILES.skip b/po/POTFILES.skip
index 11ae5e5..38b05ab 100644
--- a/po/POTFILES.skip
+++ b/po/POTFILES.skip
@@ -1,9 +1,9 @@
 # These are files that we don't want to translate, because they are
 # not distributed.
-src/backend/dbi/gncmod-backend-dbi.c
-src/backend/xml/gncmod-backend-xml.c
-src/backend/xml/gncmod-backend-xml.cpp
-src/gnome-utils/gnc-tree-model-selection.c
+libgnucash/backend/dbi/gncmod-backend-dbi.c
+libgnucash/backend/xml/gncmod-backend-xml.c
+libgnucash/backend/xml/gncmod-backend-xml.cpp
+gnucash/gnome-utils/gnc-tree-model-selection.c
 
 # Skip softlinks to scm files. These softlinks are created in builddir
 # for testing purposes, intltool-extract isn't smart enough to ignore
@@ -11,92 +11,91 @@ src/gnome-utils/gnc-tree-model-selection.c
 # and intltool-update use absolute paths to the srcdir when it's not
 # the same as builddir which messes up the file names in gnucash.pot.
 
-src/app-utils/gnucash/app-utils.scm
-src/app-utils/gnucash/gettext.scm
-src/business/business-gnome/gnucash/business-gnome.scm
-src/core-utils/gnucash/core-utils.scm
-src/engine/gnucash/business-core.scm
-src/engine/gnucash/engine.scm
-src/gnc-module/gnucash/gnc-module.scm
-src/gnome-utils/gnucash/gnome-utils.scm
-src/import-export/qif-imp/gnucash/import-export/qif-import.scm
-src/import-export/qif-imp/qif-import/qif-dialog-utils.scm
-src/import-export/qif-imp/qif-import/qif-file.scm
-src/import-export/qif-imp/qif-import/qif-guess-map.scm
-src/import-export/qif-imp/qif-import/qif-import.scm
-src/import-export/qif-imp/qif-import/qif-merge-groups.scm
-src/import-export/qif-imp/qif-import/qif-objects.scm
-src/import-export/qif-imp/qif-import/qif-parse.scm
-src/import-export/qif-imp/qif-import/qif-to-gnc.scm
-src/import-export/qif-imp/qif-import/qif-utils.scm
-src/report/business-reports/gnucash/report/aging.scm
-src/report/business-reports/gnucash/report/balsheet-eg.eguile.scm
-src/report/business-reports/gnucash/report/balsheet-eg.scm
-src/report/business-reports/gnucash/report/business-reports.scm
-src/report/business-reports/gnucash/report/customer-summary.scm
-src/report/business-reports/gnucash/report/easy-invoice.scm
-src/report/business-reports/gnucash/report/fancy-invoice.scm
-src/report/business-reports/gnucash/report/invoice.scm
-src/report/business-reports/gnucash/report/job-report.scm
-src/report/business-reports/gnucash/report/owner-report.scm
-src/report/business-reports/gnucash/report/payables.scm
-src/report/business-reports/gnucash/report/receipt.eguile.scm
-src/report/business-reports/gnucash/report/receipt.scm
-src/report/business-reports/gnucash/report/receivables.scm
-src/report/business-reports/gnucash/report/taxinvoice.eguile.scm
-src/report/business-reports/gnucash/report/taxinvoice.scm
-src/report/locale-specific/us/gnucash/report/locale-specific/de_DE.scm
-src/report/locale-specific/us/gnucash/report/locale-specific/us.scm
-src/report/locale-specific/us/gnucash/report/taxtxf-de_DE.scm
-src/report/locale-specific/us/gnucash/report/taxtxf.scm
-src/report/report-gnome/gnucash/report/report-gnome.scm
-src/report/report-system/gnucash/report/eguile-gnc.scm
-src/report/report-system/gnucash/report/eguile-html-utilities.scm
-src/report/report-system/gnucash/report/eguile-utilities.scm
-src/report/report-system/gnucash/report/report-system.scm
-src/report/report-system/gnucash/report/report-system/collectors.scm
-src/report/report-system/gnucash/report/report-system/list-extras.scm
-src/report/report-system/gnucash/report/report-system/report-collectors.scm
-src/report/standard-reports/gnucash/report/standard-reports.scm
-src/report/standard-reports/gnucash/report/standard-reports/account-piecharts.scm
-src/report/standard-reports/gnucash/report/standard-reports/account-summary.scm
-src/report/standard-reports/gnucash/report/standard-reports/advanced-portfolio.scm
-src/report/standard-reports/gnucash/report/standard-reports/average-balance.scm
-src/report/standard-reports/gnucash/report/standard-reports/balance-sheet.scm
-src/report/standard-reports/gnucash/report/standard-reports/budget-balance-sheet.scm
-src/report/standard-reports/gnucash/report/standard-reports/budget-barchart.scm
-src/report/standard-reports/gnucash/report/standard-reports/budget-flow.scm
-src/report/standard-reports/gnucash/report/standard-reports/budget-income-statement.scm
-src/report/standard-reports/gnucash/report/standard-reports/budget.scm
-src/report/standard-reports/gnucash/report/standard-reports/cash-flow.scm
-src/report/standard-reports/gnucash/report/standard-reports/category-barchart.scm
-src/report/standard-reports/gnucash/report/standard-reports/daily-reports.scm
-src/report/standard-reports/gnucash/report/standard-reports/equity-statement.scm
-src/report/standard-reports/gnucash/report/standard-reports/general-journal.scm
-src/report/standard-reports/gnucash/report/standard-reports/general-ledger.scm
-src/report/standard-reports/gnucash/report/standard-reports/income-statement.scm
-src/report/standard-reports/gnucash/report/standard-reports/net-barchart.scm
-src/report/standard-reports/gnucash/report/standard-reports/net-linechart.scm
-src/report/standard-reports/gnucash/report/standard-reports/portfolio.scm
-src/report/standard-reports/gnucash/report/standard-reports/price-scatter.scm
-src/report/standard-reports/gnucash/report/standard-reports/register.scm
-src/report/standard-reports/gnucash/report/standard-reports/sx-summary.scm
-src/report/standard-reports/gnucash/report/standard-reports/transaction.scm
-src/report/standard-reports/gnucash/report/standard-reports/trial-balance.scm
-src/report/stylesheets/gnucash/report/stylesheet-easy.scm
-src/report/stylesheets/gnucash/report/stylesheet-fancy.scm
-src/report/stylesheets/gnucash/report/stylesheet-footer.scm
-src/report/stylesheets/gnucash/report/stylesheet-head-or-tail.scm
-src/report/stylesheets/gnucash/report/stylesheet-plain.scm
-src/report/stylesheets/gnucash/report/stylesheets.scm
-src/report/utility-reports/gnucash/report/hello-world.scm
-src/report/utility-reports/gnucash/report/utility-reports.scm
-src/report/utility-reports/gnucash/report/view-column.scm
-src/report/utility-reports/gnucash/report/welcome-to-gnucash.scm
-src/scm/build-config.scm
-src/scm/build-config.scm.in
-src/scm/gnucash/main.scm
-src/scm/gnucash/price-quotes.scm
-src/scm/gnucash/printf.scm
-src/tax/us/gnucash/tax/de_DE.scm
-src/tax/us/gnucash/tax/us.scm
+libgnucash/app-utils/gnucash/app-utils.scm
+libgnucash/app-utils/gnucash/gettext.scm
+libgnucash/core-utils/gnucash/core-utils.scm
+libgnucash/engine/gnucash/business-core.scm
+libgnucash/engine/gnucash/engine.scm
+libgnucash/gnc-module/gnucash/gnc-module.scm
+gnucash/gnome-utils/gnucash/gnome-utils.scm
+gnucash/import-export/qif-imp/gnucash/import-export/qif-import.scm
+gnucash/import-export/qif-imp/qif-import/qif-dialog-utils.scm
+gnucash/import-export/qif-imp/qif-import/qif-file.scm
+gnucash/import-export/qif-imp/qif-import/qif-guess-map.scm
+gnucash/import-export/qif-imp/qif-import/qif-import.scm
+gnucash/import-export/qif-imp/qif-import/qif-merge-groups.scm
+gnucash/import-export/qif-imp/qif-import/qif-objects.scm
+gnucash/import-export/qif-imp/qif-import/qif-parse.scm
+gnucash/import-export/qif-imp/qif-import/qif-to-gnc.scm
+gnucash/import-export/qif-imp/qif-import/qif-utils.scm
+gnucash/report/business-reports/gnucash/report/aging.scm
+gnucash/report/business-reports/gnucash/report/balsheet-eg.eguile.scm
+gnucash/report/business-reports/gnucash/report/balsheet-eg.scm
+gnucash/report/business-reports/gnucash/report/business-reports.scm
+gnucash/report/business-reports/gnucash/report/customer-summary.scm
+gnucash/report/business-reports/gnucash/report/easy-invoice.scm
+gnucash/report/business-reports/gnucash/report/fancy-invoice.scm
+gnucash/report/business-reports/gnucash/report/invoice.scm
+gnucash/report/business-reports/gnucash/report/job-report.scm
+gnucash/report/business-reports/gnucash/report/owner-report.scm
+gnucash/report/business-reports/gnucash/report/payables.scm
+gnucash/report/business-reports/gnucash/report/receipt.eguile.scm
+gnucash/report/business-reports/gnucash/report/receipt.scm
+gnucash/report/business-reports/gnucash/report/receivables.scm
+gnucash/report/business-reports/gnucash/report/taxinvoice.eguile.scm
+gnucash/report/business-reports/gnucash/report/taxinvoice.scm
+gnucash/report/locale-specific/us/gnucash/report/locale-specific/de_DE.scm
+gnucash/report/locale-specific/us/gnucash/report/locale-specific/us.scm
+gnucash/report/locale-specific/us/gnucash/report/taxtxf-de_DE.scm
+gnucash/report/locale-specific/us/gnucash/report/taxtxf.scm
+gnucash/report/report-gnome/gnucash/report/report-gnome.scm
+gnucash/report/report-system/gnucash/report/eguile-gnc.scm
+gnucash/report/report-system/gnucash/report/eguile-html-utilities.scm
+gnucash/report/report-system/gnucash/report/eguile-utilities.scm
+gnucash/report/report-system/gnucash/report/report-system.scm
+gnucash/report/report-system/gnucash/report/report-system/collectors.scm
+gnucash/report/report-system/gnucash/report/report-system/list-extras.scm
+gnucash/report/report-system/gnucash/report/report-system/report-collectors.scm
+gnucash/report/standard-reports/gnucash/report/standard-reports.scm
+gnucash/report/standard-reports/gnucash/report/standard-reports/account-piecharts.scm
+gnucash/report/standard-reports/gnucash/report/standard-reports/account-summary.scm
+gnucash/report/standard-reports/gnucash/report/standard-reports/advanced-portfolio.scm
+gnucash/report/standard-reports/gnucash/report/standard-reports/average-balance.scm
+gnucash/report/standard-reports/gnucash/report/standard-reports/balance-sheet.scm
+gnucash/report/standard-reports/gnucash/report/standard-reports/budget-balance-sheet.scm
+gnucash/report/standard-reports/gnucash/report/standard-reports/budget-barchart.scm
+gnucash/report/standard-reports/gnucash/report/standard-reports/budget-flow.scm
+gnucash/report/standard-reports/gnucash/report/standard-reports/budget-income-statement.scm
+gnucash/report/standard-reports/gnucash/report/standard-reports/budget.scm
+gnucash/report/standard-reports/gnucash/report/standard-reports/cash-flow.scm
+gnucash/report/standard-reports/gnucash/report/standard-reports/category-barchart.scm
+gnucash/report/standard-reports/gnucash/report/standard-reports/daily-reports.scm
+gnucash/report/standard-reports/gnucash/report/standard-reports/equity-statement.scm
+gnucash/report/standard-reports/gnucash/report/standard-reports/general-journal.scm
+gnucash/report/standard-reports/gnucash/report/standard-reports/general-ledger.scm
+gnucash/report/standard-reports/gnucash/report/standard-reports/income-statement.scm
+gnucash/report/standard-reports/gnucash/report/standard-reports/net-barchart.scm
+gnucash/report/standard-reports/gnucash/report/standard-reports/net-linechart.scm
+gnucash/report/standard-reports/gnucash/report/standard-reports/portfolio.scm
+gnucash/report/standard-reports/gnucash/report/standard-reports/price-scatter.scm
+gnucash/report/standard-reports/gnucash/report/standard-reports/register.scm
+gnucash/report/standard-reports/gnucash/report/standard-reports/sx-summary.scm
+gnucash/report/standard-reports/gnucash/report/standard-reports/transaction.scm
+gnucash/report/standard-reports/gnucash/report/standard-reports/trial-balance.scm
+gnucash/report/stylesheets/gnucash/report/stylesheet-easy.scm
+gnucash/report/stylesheets/gnucash/report/stylesheet-fancy.scm
+gnucash/report/stylesheets/gnucash/report/stylesheet-footer.scm
+gnucash/report/stylesheets/gnucash/report/stylesheet-head-or-tail.scm
+gnucash/report/stylesheets/gnucash/report/stylesheet-plain.scm
+gnucash/report/stylesheets/gnucash/report/stylesheets.scm
+gnucash/report/utility-reports/gnucash/report/hello-world.scm
+gnucash/report/utility-reports/gnucash/report/utility-reports.scm
+gnucash/report/utility-reports/gnucash/report/view-column.scm
+gnucash/report/utility-reports/gnucash/report/welcome-to-gnucash.scm
+libgnucash/scm/build-config.scm
+libgnucash/scm/build-config.scm.in
+libgnucash/scm/gnucash/main.scm
+libgnucash/scm/gnucash/price-quotes.scm
+libgnucash/scm/gnucash/printf.scm
+libgnucash/tax/us/gnucash/tax/de_DE.scm
+libgnucash/tax/us/gnucash/tax/us.scm
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
deleted file mode 100644
index 312a7e6..0000000
--- a/src/CMakeLists.txt
+++ /dev/null
@@ -1,46 +0,0 @@
-# CMakeLists.txt for src/
-
-# The subdirectories
-ADD_SUBDIRECTORY (core-utils)
-ADD_SUBDIRECTORY (debug)
-ADD_SUBDIRECTORY (doc)
-ADD_SUBDIRECTORY (gnc-module)
-ADD_SUBDIRECTORY (engine)
-ADD_SUBDIRECTORY (backend)
-ADD_SUBDIRECTORY (app-utils)
-ADD_SUBDIRECTORY (pixmaps)
-ADD_SUBDIRECTORY (quotes)
-ADD_SUBDIRECTORY (scm)
-ADD_SUBDIRECTORY (tax)
-ADD_SUBDIRECTORY (test-core)
-
-IF (WITH_GNUCASH)
-  ADD_SUBDIRECTORY (bin)
-  ADD_SUBDIRECTORY (cmake_modules)
-  ADD_SUBDIRECTORY (gnome)
-  ADD_SUBDIRECTORY (gnome-utils)
-  ADD_SUBDIRECTORY (gnome-search)
-  ADD_SUBDIRECTORY (html)
-  ADD_SUBDIRECTORY (import-export)
-  ADD_SUBDIRECTORY (optional)
-  ADD_SUBDIRECTORY (plugins)
-  ADD_SUBDIRECTORY (python)
-  ADD_SUBDIRECTORY (register)
-  ADD_SUBDIRECTORY(report)
-ENDIF (WITH_GNUCASH)
-
-SET(src_EXTRA_DIST
-        base-typemaps.i
-        config.h.cmake.in
-        gnc-test-env.pl
-        guile-mappings.h
-        platform.h
-        README
-        README.modules)
-
-SET_LOCAL_DIST(src_DIST_local CMakeLists.txt Makefile.am ${src_EXTRA_DIST})
-
-SET(src_DIST ${src_DIST_local} ${app_utils_DIST} ${backend_DIST} ${bin_DIST} ${cmake_modules_DIST}
-             ${core_utils_DIST} ${debug_DIST} ${doc_DIST} ${engine_DIST} ${gnc_module_DIST} ${gnome_DIST} ${gnome_search_DIST}
-             ${gnome_utils_DIST} ${html_DIST} ${import_export_DIST} ${optional_DIST} ${plugins_DIST} ${pixmaps_DIST} ${python_DIST}
-             ${quotes_DIST} ${register_DIST} ${report_DIST} ${scm_DIST} ${tax_DIST} ${test_core_DIST} PARENT_SCOPE)
diff --git a/src/Makefile.am b/src/Makefile.am
deleted file mode 100644
index 00fe7b6..0000000
--- a/src/Makefile.am
+++ /dev/null
@@ -1,84 +0,0 @@
-# These directories do not contain any gtk dependencies
-# Note the unusual ordering of some test directories. This is
-# because test-core depends on engine and the test directories
-# in turn depend on test-core.
-NONGUI_SUBDIRS = \
-  debug \
-  doc \
-  pixmaps \
-  core-utils \
-  gnc-module \
-  engine \
-  test-core \
-  core-utils/test \
-  gnc-module/test \
-  engine/test \
-  backend \
-  scm \
-  quotes \
-  app-utils \
-  tax
-
-if WITH_PYTHON
-   PYTHON_DIR = python
-endif
-
-# These directories should also not contain any gtk dependencies, but
-# currently there is a gtk based console in the python bindings
-# that should probably live elsewhere.
-ALMOST_NONGUI_SUBDIRS = \
-  ${PYTHON_DIR}
-
-# These directories contain the code with gtk dependency
-GUI_SUBDIRS = \
-  gnome-utils \
-  html \
-  gnome-search \
-  report \
-  register \
-  gnome \
-  import-export \
-  optional \
-  plugins \
-  bin
-
-# Need to include '.' in order to build swig-runtime.h
-if GNUCASH_ENABLE_GUI
-SUBDIRS = . $(NONGUI_SUBDIRS) $(ALMOST_NONGUI_SUBDIRS) $(GUI_SUBDIRS)
-else
-# Note: In non-GUI build, "optional" needs to be added as well, but
-# cannot be added in the variable because in with-GUI mode it depends
-# on other parts.
-SUBDIRS = . $(NONGUI_SUBDIRS) $(ALMOST_NONGUI_SUBDIRS) optional
-endif
-
-noinst_HEADERS = \
-  swig-runtime.h
-
-if BUILDING_FROM_VCS
-swig-runtime.h:
-	$(SWIG) -guile -external-runtime $@
-endif
-MAINTAINERCLEANFILES = swig-runtime.h
-
-EXTRA_DIST = \
-  base-typemaps.i \
-  cmake_modules/MacroAppendForeach.cmake \
-  cmake_modules/GncAddSwigCommand.cmake \
-  cmake_modules/GncAddTest.cmake \
-  cmake_modules/MakeDist.cmake \
-  cmake_modules/COPYING-CMAKE-SCRIPTS.txt \
-  cmake_modules/MakeDistFiles.cmake \
-  cmake_modules/MacroAddSourceFileCompileFlags.cmake \
-  cmake_modules/MakeDistCheck.cmake \
-  cmake_modules/GncConfigure.cmake \
-  cmake_modules/GncAddSchemeTargets.cmake \
-  cmake_modules/GncAddGSchemaTargets.cmake \
-  cmake_modules/GncFindPkgConfig.cmake \
-  cmake_modules/CMakeLists.txt \
-  config.h.cmake.in \
-  README.modules \
-  gnc-test-env.pl \
-  guile-mappings.h \
-  platform.h \
-  CMakeLists.txt
diff --git a/src/README b/src/README
deleted file mode 100644
index 375208e..0000000
--- a/src/README
+++ /dev/null
@@ -1,11 +0,0 @@
-This directory contains the source for GnuCash.
-See README.modules for the layout of the module subdirectories.
-The non-module directories are:
-
-  doc: various notes about design and the design documentation.
-  experimental: for experimental systems.
-  gnome: misc code for the gtk/gnome front end.
-  optional: bits supported via ./configure --enable-* or --with-* args.
-  pixmaps: various runtime images.
-  quotes: code for downloading stock quotes.
-  scm: misc scheme code.
diff --git a/src/README.modules b/src/README.modules
deleted file mode 100644
index 3bc005b..0000000
--- a/src/README.modules
+++ /dev/null
@@ -1,50 +0,0 @@
--*-text-*-
-
-'Modules' in Gnucash are relatively self-contained segments of code that
-can be dynamically loaded at runtime.  While this may have been a great
-design when gnucash was pure guile, it turns out this needlessly complicates
-the current mix of C, C++ and guile. So expect this gnc-module based 
-modularization to be greatly reduced in the future. All the core parts should
-be loadable straight away as dynamic libraries. This is currently not feasible
-so the gnc-module functionality will still be around for some time and perhaps
-forever as a way to extend gnucash with external code.
-
-We're not there yet :) 
-
-Here are the bits that are still using the module system so far (this list is probably
-outdated already, but can serve as a starting point to figure out which modules
-can already be de-modularized):.
-
-gnc-module                  The module system (actually not a module itself)
-
-engine                      The engine module, without any backends
-
-backend/xml                 Binary and XML (v1 and v2) backends
-
-backend/dbi                 SQL based backends: postgres, mysql, sqlite3 (all
-                            via the dbi interface)
-
-register/ledger-core        The xacc SplitLedger and MultiLedger parts formerly
-                            in src/
-register/register-core      Toolkit independent register code, formerly in 
-                            src/register/
-register/register-gnome     Gnome-specific register code, formerly in 
-                            src/register/gnome
-
-import-export/qif-import    the old qif importer with Gnome druid 
-import-export/qif-io-core   new qif import/export module.  unfinished.
-
-report/report-system        the report infrastructure and HTML handling 
-report/locale-specific-reports  reports that should only be loaded in 
-                                certain locales. subdir per locale. 
-report/stylesheets          predefined style sheet templates 
-report/report-gnome         Gnome gui for displaying reports.
-
-app-utils                   utils for the gnucash app framework (component 
-                            mgr, cmd line processing, gettext stuff, etc)
-
-gnome-utils                 Extensions and utilities for using Gnome/Gtk
-                            with GnuCash, including new widgets.
-
-tax/us                      US tax information
-
diff --git a/src/app-utils/CMakeLists.txt b/src/app-utils/CMakeLists.txt
deleted file mode 100644
index ebd2ad9..0000000
--- a/src/app-utils/CMakeLists.txt
+++ /dev/null
@@ -1,223 +0,0 @@
-ADD_SUBDIRECTORY(test)
-# Build the library
-
-SET (app_utils_noinst_HEADERS
-  calculation/finvar.h
-  calculation/finproto.h
-  calculation/fin_spl_protos.h
-  calculation/fin_static_proto.h
-)
-
-SET (app_utils_HEADERS
-  QuickFill.h
-  business-helpers.h
-  business-options.h
-  file-utils.h
-  gfec.h
-  gnc-basic-gobject.h
-  gnc-account-merge.h
-  gnc-accounting-period.h
-  gnc-addr-quickfill.h
-  gnc-component-manager.h
-  gnc-entry-quickfill.h
-  gnc-euro.h
-  gnc-exp-parser.h
-  gnc-gdate-utils.h
-  gnc-gettext-util.h
-  gnc-gsettings.h
-  gnc-help-utils.h
-  gnc-helpers.h
-  gnc-prefs-utils.h
-  gnc-state.h  
-  gnc-sx-instance-model.h
-  gnc-ui-util.h
-  gnc-ui-balances.h
-  guile-util.h
-  option-util.h
-
-)
-
-
-IF (BUILDING_FROM_VCS)
-  # Command to generate the swig-app-utils.c wrapper file
-  SET (SWIG_APP_UTILS_GUILE_C ${CMAKE_CURRENT_BINARY_DIR}/swig-app-utils-guile.c)
-  GNC_ADD_SWIG_COMMAND (swig-apputils-guile-c ${SWIG_APP_UTILS_GUILE_C} ${CMAKE_CURRENT_SOURCE_DIR}/app-utils.i)
-  SET (SWIG_APP_UTILS_PYTHON_C ${CMAKE_CURRENT_BINARY_DIR}/swig-app-utils-python.c)
-  GNC_ADD_SWIG_PYTHON_COMMAND (swig-app-utils-python ${SWIG_APP_UTILS_PYTHON_C} ${CMAKE_CURRENT_SOURCE_DIR}/app-utils.i)
-ELSE()
-  SET (SWIG_APP_UTILS_GUILE_C swig-app-utils-guile.c)
-  SET (SWIG_APP_UTILS_PYTHON_C swig-app-utils-python.c)
-ENDIF()
-
-SET (app_utils_SOURCES
-  calculation/expression_parser.c
-  calculation/fin.c
-  business-helpers.c
-  business-options.c
-  QuickFill.c
-  file-utils.c
-  gfec.c
-  gnc-account-merge.c
-  gnc-accounting-period.c
-  gnc-addr-quickfill.c
-  gnc-component-manager.c
-  gnc-entry-quickfill.c
-  gnc-euro.c
-  gnc-exp-parser.c
-  gnc-gdate-utils.c
-  gnc-gettext-util.c
-  gnc-gsettings.c
-  gnc-helpers.c
-  gnc-prefs-utils.c
-  gnc-sx-instance-model.c
-  gnc-state.c
-  gnc-ui-util.c
-  gnc-ui-balances.c
-  gncmod-app-utils.c
-  guile-util.c
-  option-util.c
-)
-
-SET_SOURCE_FILES_PROPERTIES (${app_utils_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
-
-SET(app_utils_ALL_SOURCES ${app_utils_SOURCES} ${app_utils_HEADERS} ${app_utils_noinst_HEADERS})
-SET(app_utils_ALL_LIBRARIES gncmod-engine gnc-module ${GIO_LDFLAGS} ${LIBXML2_LDFLAGS} ${LIBXSLT_LDFLAGS})
-SET(app_utils_ALL_INCLUDES  ${CMAKE_CURRENT_SOURCE_DIR}/calculation ${GIO_INCLUDE_DIRS} ${LIBXML2_INCLUDE_DIRS}
-                            ${LIBXSLT_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/engine)
-
-IF (WIN32)
-  LIST(APPEND app_utils_ALL_SOURCES gnc-help-utils.c)
-  LIST(APPEND app_utils_ALL_LIBRARIES ${HTMLHELP_LIBRARY})
-  LIST(APPEND app_utils_ALL_INCLUDES ${HTMLHELP_INCLUDE_PATH})
-ENDIF()
-
-
-ADD_LIBRARY (gncmod-app-utils ${app_utils_ALL_SOURCES} ${SWIG_APP_UTILS_GUILE_C})
-TARGET_LINK_LIBRARIES(gncmod-app-utils ${app_utils_ALL_LIBRARIES})
-
-TARGET_INCLUDE_DIRECTORIES (gncmod-app-utils
-    PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
-    PRIVATE ${app_utils_ALL_INCLUDES}
-)
-TARGET_COMPILE_DEFINITIONS (gncmod-app-utils PRIVATE -DG_LOG_DOMAIN=\"gnc.app-utils\")
-
-INSTALL(TARGETS gncmod-app-utils
-  LIBRARY DESTINATION lib/gnucash
-  ARCHIVE DESTINATION lib/gnucash
-  RUNTIME DESTINATION bin
-)
-
-IF (WITH_PYTHON)
-  ADD_LIBRARY (gncmod-app-utils-python ${app_utils_ALL_SOURCES} ${SWIG_APP_UTILS_PYTHON_C})
-
-  TARGET_LINK_LIBRARIES(gncmod-app-utils-python ${app_utils_ALL_LIBRARIES} ${PYTHON_LIBRARIES})
-
-  TARGET_INCLUDE_DIRECTORIES (gncmod-app-utils-python
-    PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
-    PRIVATE ${app_utils_ALL_INCLUDES} ${PYTHON_INCLUDE_DIRS}
-  )
-  TARGET_COMPILE_DEFINITIONS (gncmod-app-utils-python PRIVATE -DG_LOG_DOMAIN=\"gnc.app-utils\")
-
-  INSTALL(TARGETS gncmod-app-utils-python
-    LIBRARY DESTINATION lib/gnucash
-    ARCHIVE DESTINATION lib/gnucash
-    RUNTIME DESTINATION bin
-  )
-ENDIF()
-
-
-
-INSTALL(FILES ${app_utils_HEADERS} DESTINATION include/gnucash)
-
-IF (WITH_OFX)
-  FILE(READ ${CMAKE_SOURCE_DIR}/src/import-export/ofx/migratable-prefs-ofx.xml MIGRATABLE_PREFS_OFX)
-ENDIF()
-
-IF (WITH_AQBANKING)
-  FILE(READ ${CMAKE_SOURCE_DIR}/src/import-export/aqb/migratable-prefs-aqbanking.xml MIGRATABLE_PREFS_AQBANKING)
-ENDIF()
-
-SET(MIGRATABLE_PREFS_XML ${DATADIR_BUILD}/gnucash/migratable-prefs.xml)
-FILE(COPY make-prefs-migration-script.xsl DESTINATION ${DATADIR_BUILD}/gnucash)
-
-CONFIGURE_FILE(migratable-prefs.xml.in ${MIGRATABLE_PREFS_XML})
-# This configure_file is to generate the file for autotools
-CONFIGURE_FILE(migratable-prefs.xml.in migratable-prefs.xml)
-
-INSTALL(FILES ${MIGRATABLE_PREFS_XML} DESTINATION share/gnucash)
-INSTALL(FILES make-prefs-migration-script.xsl DESTINATION share/gnucash)
-
-# And now handle scheme files
-
-SET (app_utils_SCHEME_2
-    app-utils.scm
-)
-
-SET (app_utils_SCHEME_1
-    hooks.scm
-    business-options.scm
-    c-interface.scm
-    config-var.scm
-    date-utilities.scm
-    migrate-prefs.scm
-    options.scm
-    prefs.scm
-    simple-obj.scm
-)
-
-SET(app_utils_SCHEME_3
-    business-prefs.scm
-)
-
-SET(GUILE_MODULES      src/engine)
-SET(GUILE_LOAD_DIRS    src/app-utils src/core-utils src/engine src/gnc-module src/scm)
-SET(GUILE_LIBRARY_DIRS src/app-utils src/core-utils src/engine src/gnc-module)
-SET(GUILE_DEPENDS      gncmod-app-utils scm-core-utils scm-engine scm-scm)
-
-GNC_ADD_SCHEME_TARGETS(scm-gettext
-  gettext.scm
-  gnucash
-  src/app-utils
-  ""
-  ""
-  gncmod-app-utils
-  FALSE
-)
-
-GNC_ADD_SCHEME_TARGETS(scm-app-utils-1
-  "${app_utils_SCHEME_1}"
-  ""
-  "${GUILE_MODULES}"
-  "${GUILE_LOAD_DIRS}"
-  "${GUILE_LIBRARY_DIRS}"
-  "scm-gettext;${GUILE_DEPENDS}"
-  FALSE
-)
-
-GNC_ADD_SCHEME_TARGETS(scm-app-utils-2
-  "${app_utils_SCHEME_2}"
-  "gnucash"
-  "${GUILE_MODULES}"
-  "${GUILE_LOAD_DIRS}"
-  "${GUILE_LIBRARY_DIRS}"
-  scm-app-utils-1
-  FALSE
-)
-
-GNC_ADD_SCHEME_TARGETS(scm-app-utils-3
-  "${app_utils_SCHEME_3}"
-  ""
-  "${GUILE_MODULES}"
-  "${GUILE_LOAD_DIRS}"
-  "${GUILE_LIBRARY_DIRS}"
-  scm-app-utils-2
-  FALSE
-)
-
-ADD_CUSTOM_TARGET(scm-app-utils ALL DEPENDS scm-app-utils-3 scm-app-utils-2 scm-app-utils-1 scm-gettext)
-
-SET_LOCAL_DIST(app_utils_DIST_local
-        ${app_utils_ALL_SOURCES} gettext.scm ${app_utils_SCHEME_1} ${app_utils_SCHEME_2} ${app_utils_SCHEME_3}
-        app-utils.i CMakeLists.txt gnc-help-utils.c Makefile.am
-        make-prefs-migration-script.xsl migratable-prefs.xml.in README)
-SET(app_utils_DIST ${app_utils_DIST_local} ${test_app_utils_DIST} PARENT_SCOPE)
diff --git a/src/app-utils/Makefile.am b/src/app-utils/Makefile.am
deleted file mode 100644
index 7f55114..0000000
--- a/src/app-utils/Makefile.am
+++ /dev/null
@@ -1,241 +0,0 @@
-# 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 at gnu.org
-
-SUBDIRS = . test
-
-pkglib_LTLIBRARIES = libgncmod-app-utils.la
-
-AM_CPPFLAGS = \
-  -Wno-error=deprecated-declarations \
-  -I$(top_srcdir)/lib/libc \
-  -I${top_srcdir}/src \
-  -I${top_builddir}/src \
-  -I${top_srcdir}/src/gnc-module \
-  -I${top_srcdir}/src/app-utils/calculation \
-  -I${top_srcdir}/src/core-utils \
-  -I${top_srcdir}/src/engine \
-  -I${top_srcdir}/src/backend/xml \
-  ${GUILE_CFLAGS} \
-  ${PYTHON_CPPFLAGS} \
-  ${GLIB_CFLAGS} \
-  ${LIBXML2_CFLAGS} \
-  ${LIBXSLT_CFLAGS}
-
-libgncmod_app_utils_la_SOURCES = \
-  calculation/expression_parser.c \
-  calculation/fin.c \
-  swig-app-utils-guile.c \
-  business-helpers.c \
-  business-options.c \
-  QuickFill.c \
-  file-utils.c \
-  gfec.c \
-  gnc-account-merge.c \
-  gnc-accounting-period.c \
-  gnc-addr-quickfill.c \
-  gnc-component-manager.c \
-  gnc-entry-quickfill.c \
-  gnc-euro.c \
-  gnc-exp-parser.c \
-  gnc-gdate-utils.c \
-  gnc-gettext-util.c \
-  gnc-gsettings.c \
-  gnc-helpers.c \
-  gnc-prefs-utils.c \
-  gnc-sx-instance-model.c \
-  gnc-state.c \
-  gncmod-app-utils.c \
-  gnc-ui-balances.c \
-  gnc-ui-util.c \
-  guile-util.c \
-  option-util.c
-
-gncincludedir = ${GNC_INCLUDE_DIR}
-gncinclude_HEADERS = \
-  QuickFill.h \
-  business-helpers.h \
-  business-options.h \
-  file-utils.h \
-  gfec.h \
-  gnc-basic-gobject.h \
-  gnc-account-merge.h \
-  gnc-accounting-period.h \
-  gnc-addr-quickfill.h \
-  gnc-component-manager.h \
-  gnc-entry-quickfill.h \
-  gnc-euro.h \
-  gnc-exp-parser.h \
-  gnc-gdate-utils.h \
-  gnc-gettext-util.h \
-  gnc-gsettings.h \
-  gnc-help-utils.h \
-  gnc-helpers.h \
-  gnc-prefs-utils.h \
-  gnc-sx-instance-model.h \
-  gnc-state.h \
-  gnc-ui-balances.h \
-  gnc-ui-util.h \
-  guile-util.h \
-  option-util.h
-
-libgncmod_app_utils_la_LDFLAGS = -avoid-version
-
-libgncmod_app_utils_la_LIBADD = \
-  ${top_builddir}/src/gnc-module/libgnc-module.la \
-  ${top_builddir}/src/engine/libgncmod-engine.la \
-  ${top_builddir}/src/core-utils/libgnc-core-utils.la \
-  ${GUILE_LIBS} \
-  ${GLIB_LIBS} \
-  ${LIBXML2_LIBS} \
-  ${LIBXSLT_LIBS}
-
-if BUILDING_FROM_VCS
-swig-app-utils-guile.c: app-utils.i ${top_srcdir}/src/base-typemaps.i
-	$(SWIG) -guile $(SWIG_ARGS) -Linkage module \
-	-I${top_srcdir}/src -o $@ $<
-if ! OS_WIN32
-if ! SWIG_DIST_FAIL
-	if ! `grep "define scm_from_utf8_string" $@ > /dev/null 2>&1`; then \
-	  patch $@ $(top_srcdir)/src/swig-utf8.patch; \
-	fi
-endif
-endif
-swig-app-utils-python.c: app-utils.i ${top_srcdir}/src/base-typemaps.i
-	$(SWIG) -python -Wall -Werror $(SWIG_ARGS) \
-	-I${top_srcdir}/src -o $@ $<
-endif
-
-if WITH_PYTHON
-pkglib_LTLIBRARIES += libgncmod-app-utils-python.la
-
-libgncmod_app_utils_python_la_SOURCES = \
-  swig-app-utils-python.c
-
-libgncmod_app_utils_python_la_LDFLAGS = \
-  ${PYTHON_LDFLAGS}
-
-libgncmod_app_utils_python_la_LIBADD = \
-  ${PYTHON_LIBS} \
-  ${PYTHON_EXTRA_LIBS} \
-  libgncmod-app-utils.la
-endif
-
-gncscmmoddir = ${GNC_SCM_INSTALL_DIR}/gnucash
-gncscmmod_DATA = \
-  gettext.scm \
-  app-utils.scm
-
-gncscmdir = ${GNC_SCM_INSTALL_DIR}
-gncscm_DATA = \
-  business-options.scm \
-  business-prefs.scm \
-  c-interface.scm \
-  config-var.scm \
-  date-utilities.scm \
-  hooks.scm \
-  migrate-prefs.scm \
-  options.scm \
-  prefs.scm \
-  simple-obj.scm
-  
-prefsmigrationdir = $(GNC_SHAREDIR)
-prefsmigration_DATA = \
-  make-prefs-migration-script.xsl \
-  migratable-prefs.xml
-
-noinst_DATA = .scm-links
-
-noinst_HEADERS = \
-  calculation/finvar.h \
-  calculation/finproto.h \
-  calculation/fin_spl_protos.h \
-  calculation/fin_static_proto.h
-
-EXTRA_DIST = \
-  swig-app-utils-python.c \
-  app-utils.i \
-  ${gncscmmod_DATA} \
-  ${gncscm_DATA} \
-  ${prefsmigration_DATA} \
-  CMakeLists.txt
-
-if OS_WIN32
-libgncmod_app_utils_la_SOURCES += gnc-help-utils.c
-libgncmod_app_utils_la_LIBADD += $(HTMLHELP_LIBS)
-else
-EXTRA_DIST += gnc-help-utils.c
-endif
-
-if GNUCASH_SEPARATE_BUILDDIR
-#For executing test cases
-SCM_FILE_LINKS = \
-  ${gncscmmod_DATA} \
-  ${gncscm_DATA}
-endif
-
-.scm-links: 
-	$(RM) -rf gnucash
-	mkdir -p  gnucash
-if GNUCASH_SEPARATE_BUILDDIR
-	for X in ${SCM_FILE_LINKS} ; do \
-	  $(LN_S) -f ${srcdir}/$$X . ; \
-	done
-endif
-	( cd gnucash; for A in $(gncscmmod_DATA) ; do $(LN_S) -f ../$$A . ; done )
-if ! OS_WIN32
-# Windows knows no "ln -s" but uses "cp": must copy every time (see bug #566567).
-	touch .scm-links
-endif
-
-if GNC_HAVE_GUILE_2
-GUILE_COMPILE_ENV = \
-  --gnc-module-dir ${top_builddir}/src/engine \
-  --guile-load-dir ${top_builddir}/src/app-utils \
-  --guile-load-dir ${top_builddir}/src/core-utils \
-  --guile-load-dir ${top_builddir}/src/engine \
-  --guile-load-dir ${top_builddir}/src/gnc-module \
-  --guile-load-dir ${top_builddir}/src/scm \
-  --library-dir    ${top_builddir}/src/core-utils \
-  --library-dir    ${top_builddir}/src/gnc-module \
-  --library-dir    ${top_builddir}/src/engine \
-  --library-dir    ${top_builddir}/src/app-utils
-
-%.go : %.scm .scm-links $(pkglib_LTLIBRARIES)
-	GNC_UNINSTALLED=yes \
-	GNC_BUILDDIR=${top_builddir} \
-	$(shell ${abs_top_srcdir}/src/gnc-test-env.pl --noexports ${GUILE_COMPILE_ENV}) \
-	$(GUILD) compile -o $@ $<
-
-gncscmmodcachedir = ${pkglibdir}/scm/ccache/@GUILE_EFFECTIVE_VERSION@/gnucash
-gncscmmodcache_DATA = $(gncscmmod_DATA:.scm=.go)
-
-gncscmcachedir = ${pkglibdir}/scm/ccache/@GUILE_EFFECTIVE_VERSION@
-gncscmcache_DATA = $(gncscm_DATA:.scm=.go)
-endif
-
-clean-local:
-	rm -rf gnucash
-
-CLEANFILES = \
-	${SCM_FILE_LINKS} \
-	 .scm-links \
-	${gncscmcache_DATA} \
-	${gncscmmodcache_DATA}
-
-MAINTAINERCLEANFILES = swig-app-utils-guile.c swig-app-utils-python.c
-
-AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.app-utils\"
diff --git a/src/app-utils/app-utils.i b/src/app-utils/app-utils.i
deleted file mode 100644
index 4226900..0000000
--- a/src/app-utils/app-utils.i
+++ /dev/null
@@ -1,177 +0,0 @@
-/********************************************************************\
- * 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 at gnu.org                   *
- *                                                                  *
-\********************************************************************/
-
-%module sw_app_utils
-%{
-/* Includes the header in the wrapper code */
-#include <config.h>
-#include <option-util.h>
-#include <gnc-euro.h>
-#include <gnc-exp-parser.h>
-#include <gnc-ui-util.h>
-#include <gnc-gettext-util.h>
-#include <gnc-prefs-utils.h>
-#include <gnc-helpers.h>
-#include <gnc-accounting-period.h>
-#include <gnc-session.h>
-#include <gnc-component-manager.h>
-#include <guile-util.h>
-#include <app-utils/gnc-sx-instance-model.h>
-
-#include "engine-helpers-guile.h"
-%}
-
-#if defined(SWIGGUILE)
-%{
-#include "guile-mappings.h"
-
-SCM scm_init_sw_app_utils_module (void);
-%}
-#endif
-
-#if defined(SWIGPYTHON)
-%{
-/* avoid no previous prototype warning/error */
-#if PY_VERSION_HEX >= 0x03000000
-PyObject*
-#else
-void
-#endif
-SWIG_init (void);
-%}
-#endif
-
-%import "base-typemaps.i"
-
-typedef void (*GNCOptionChangeCallback) (gpointer user_data);
-typedef int GNCOptionDBHandle;
-
-void gnc_prefs_init();
-
-QofBook * gnc_get_current_book (void);
-QofSession * gnc_get_current_session (void);
-const gchar * gnc_get_current_book_tax_name (void);
-const gchar * gnc_get_current_book_tax_type (void);
-Account * gnc_get_current_root_account (void);
-
-%newobject gnc_gettext_helper;
-char * gnc_gettext_helper(const char *string);
-
-GNCOptionDB * gnc_option_db_new(SCM guile_options);
-void gnc_option_db_destroy(GNCOptionDB *odb);
-
-void gnc_option_db_set_option_selectable_by_name(SCM guile_option,
-      const char *section, const char *name, gboolean selectable);
-
-#if defined(SWIGGUILE)
-%typemap(out) GncCommodityList * {
-  SCM list = SCM_EOL;
-  GList *node;
-
-  for (node = $1; node; node = node->next)
-    list = scm_cons(gnc_quoteinfo2scm(node->data), list);
-
-  $result = scm_reverse(list);
-}
-
-%inline %{
-typedef GList GncCommodityList;
-
-GncCommodityList *
-gnc_commodity_table_get_quotable_commodities(const gnc_commodity_table * table);
-%}
-
-gnc_commodity * gnc_default_currency (void);
-gnc_commodity * gnc_default_report_currency (void);
-
-void gncp_option_invoke_callback(GNCOptionChangeCallback callback, void *data);
-void gnc_option_db_register_option(GNCOptionDBHandle handle,
-        SCM guile_option);
-
-GNCPrintAmountInfo gnc_default_print_info (gboolean use_symbol);
-GNCPrintAmountInfo gnc_account_print_info (const Account *account,
-        gboolean use_symbol);
-GNCPrintAmountInfo gnc_commodity_print_info (const gnc_commodity *commodity,
-        gboolean use_symbol);
-GNCPrintAmountInfo gnc_share_print_info_places (int decplaces);
-const char * xaccPrintAmount (gnc_numeric val, GNCPrintAmountInfo info);
-
-gchar *number_to_words(gdouble val, gint64 denom);
-const gchar *printable_value (gdouble val, gint denom);
-
-gboolean gnc_reverse_balance (const Account *account);
-
-gboolean gnc_is_euro_currency(const gnc_commodity * currency);
-gnc_numeric gnc_convert_to_euro(const gnc_commodity * currency,
-        gnc_numeric value);
-gnc_numeric gnc_convert_from_euro(const gnc_commodity * currency,
-        gnc_numeric value);
-
-time64 gnc_accounting_period_fiscal_start(void);
-time64 gnc_accounting_period_fiscal_end(void);
-
-void gnc_register_kvp_option_generator(QofIdType id_type, SCM generator);
-
-%typemap(in) GList * {
-  SCM path_scm = $input;
-  GList *path = NULL;
-  while (!scm_is_null (path_scm))
-  {
-    SCM key_scm = SCM_CAR (path_scm);
-    char *key;
-    gchar* gkey;
-    if (!scm_is_string (key_scm))
-      break;
-    key = scm_to_locale_string (key_scm);
-    gkey = g_strdup (key);
-    free (key);
-    path = g_list_prepend (path, gkey);
-    path_scm = SCM_CDR (path_scm);
-  }
-  $1 = g_list_reverse (path);
-}
-Process *gnc_spawn_process_async(GList *argl, const gboolean search_path);
-%clear GList *;
-
-gint gnc_process_get_fd(const Process *proc, const guint std_fd);
-void gnc_detach_process(Process *proc, const gboolean kill_it);
-
-time64 gnc_parse_time_to_time64(const gchar *s, const gchar *format);
-
-%typemap(out) GHashTable * {
-  SCM table = scm_c_make_hash_table (g_hash_table_size($1) + 17);
-  GHashTableIter iter;
-  gpointer key, value;
-
-  g_hash_table_iter_init (&iter, $1);
-  while (g_hash_table_iter_next (&iter, &key, &value)) {
-    const GncGUID* c_guid = (const GncGUID*) key;
-    const gnc_numeric* c_numeric = (const gnc_numeric*) value;
-    SCM scm_guid = gnc_guid2scm(*c_guid);
-    SCM scm_numeric = gnc_numeric_to_scm(*c_numeric);
-
-    scm_hash_set_x(table, scm_guid, scm_numeric);
-  }
-  g_hash_table_destroy($1);
-  $result = table;
-}
-GHashTable* gnc_sx_all_instantiate_cashflow_all(GDate range_start, GDate range_end);
-%clear GHashTable *;
-#endif
diff --git a/src/app-utils/gnc-addr-quickfill.c b/src/app-utils/gnc-addr-quickfill.c
deleted file mode 100644
index b0a0745..0000000
--- a/src/app-utils/gnc-addr-quickfill.c
+++ /dev/null
@@ -1,226 +0,0 @@
-/********************************************************************\
- * gnc-addr-quickfill.c -- Create an address line quick-fill  *
- * Copyright (C) 2011 Christian Stimming <christian at cstimming.de>   *
- *                                                                  *
- * 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 at gnu.org                   *
- *                                                                  *
-\********************************************************************/
-
-#include "config.h"
-#include "gnc-addr-quickfill.h"
-#include "engine/gnc-event.h"
-#include "engine/gnc-engine.h"
-#include "engine/gncAddress.h"
-
-/* This static indicates the debugging module that this .o belongs to. */
-G_GNUC_UNUSED static QofLogModule log_module = GNC_MOD_REGISTER;
-
-typedef struct
-{
-    QuickFill *qf_addr2;
-    QuickFill *qf_addr3;
-    QuickFill *qf_addr4;
-    QuickFillSort qf_sort;
-    QofBook *book;
-    gint  listener;
-} AddressQF;
-
-static void
-listen_for_gncaddress_events(QofInstance *entity,  QofEventId event_type,
-                             gpointer user_data, gpointer event_data)
-{
-    AddressQF *qfb = user_data;
-    const char *addr2, *addr3, *addr4;
-
-    /* We only listen for GncAddress events */
-    if (!GNC_IS_ADDRESS (entity))
-        return;
-
-    /* We listen for MODIFY (if the description was changed into
-     * something non-empty, so we add the string to the quickfill) and
-     * DESTROY (to remove the description from the quickfill). */
-    if (0 == (event_type & (QOF_EVENT_MODIFY | QOF_EVENT_DESTROY)))
-        return;
-
-    /*     g_warning("entity %p, entity type %s, event type %s, user data %p, ecent data %p", */
-    /*               entity, entity->e_type, qofeventid_to_string(event_type), user_data, event_data); */
-
-    addr2 = gncAddressGetAddr2(GNC_ADDRESS(entity));
-    addr3 = gncAddressGetAddr3(GNC_ADDRESS(entity));
-    addr4 = gncAddressGetAddr4(GNC_ADDRESS(entity));
-    if (event_type & QOF_EVENT_MODIFY)
-    {
-        /* If the description was changed into something non-empty, so
-         * we add the string to the quickfill */
-        if (addr2 && strlen(addr2) > 0)
-        {
-            /* Add the new string to the quickfill */
-            gnc_quickfill_insert (qfb->qf_addr2, addr2, QUICKFILL_LIFO);
-        }
-        if (addr3 && strlen(addr3) > 0)
-        {
-            /* Add the new string to the quickfill */
-            gnc_quickfill_insert (qfb->qf_addr3, addr3, QUICKFILL_LIFO);
-        }
-        if (addr4 && strlen(addr4) > 0)
-        {
-            /* Add the new string to the quickfill */
-            gnc_quickfill_insert (qfb->qf_addr4, addr4, QUICKFILL_LIFO);
-        }
-    }
-    else if (event_type & QOF_EVENT_DESTROY)
-    {
-        if (addr2 && strlen(addr2) > 0)
-        {
-            /* Remove the description from the quickfill */
-            gnc_quickfill_insert (qfb->qf_addr2, addr2, QUICKFILL_LIFO);
-        }
-        if (addr3 && strlen(addr3) > 0)
-        {
-            /* Remove the description from the quickfill */
-            gnc_quickfill_insert (qfb->qf_addr3, addr3, QUICKFILL_LIFO);
-        }
-        if (addr4 && strlen(addr4) > 0)
-        {
-            /* Remove the description from the quickfill */
-            gnc_quickfill_insert (qfb->qf_addr4, addr4, QUICKFILL_LIFO);
-        }
-    }
-}
-
-static void
-shared_quickfill_destroy (QofBook *book, gpointer key, gpointer user_data)
-{
-    AddressQF *qfb = user_data;
-    gnc_quickfill_destroy (qfb->qf_addr2);
-    gnc_quickfill_destroy (qfb->qf_addr3);
-    gnc_quickfill_destroy (qfb->qf_addr4);
-    qof_event_unregister_handler (qfb->listener);
-    g_free (qfb);
-}
-
-static void address_cb(gpointer data, gpointer user_data)
-{
-    const GncAddress* address = data;
-    AddressQF *s = (AddressQF *) user_data;
-
-    gnc_quickfill_insert (s->qf_addr2,
-                          gncAddressGetAddr2(address),
-                          s->qf_sort);
-
-    gnc_quickfill_insert (s->qf_addr3,
-                          gncAddressGetAddr3(address),
-                          s->qf_sort);
-
-    gnc_quickfill_insert (s->qf_addr4,
-                          gncAddressGetAddr4(address),
-                          s->qf_sort);
-}
-
-/** Creates a new query that searches for all GncAddress items in the
- * current book. */
-static QofQuery *new_query_for_addresss(QofBook *book)
-{
-    QofQuery *query = qof_query_create_for (GNC_ID_ADDRESS);
-    g_assert(book);
-    qof_query_set_book (query, book);
-
-    /* No particular sort order here. */
-
-    return query;
-}
-
-static AddressQF* build_shared_quickfill (QofBook *book, const char * key)
-{
-    AddressQF *result;
-    QofQuery *query = new_query_for_addresss(book);
-    GList *entries = qof_query_run(query);
-
-    /*     g_warning("Found %d GncAddress items", g_list_length (entries)); */
-
-    result = g_new0(AddressQF, 1);
-
-    result->qf_addr2 = gnc_quickfill_new();
-    result->qf_addr3 = gnc_quickfill_new();
-    result->qf_addr4 = gnc_quickfill_new();
-    result->qf_sort = QUICKFILL_ALPHA;
-    result->book = book;
-
-    g_list_foreach (entries, address_cb, result);
-
-    qof_query_destroy(query);
-
-    result->listener =
-        qof_event_register_handler (listen_for_gncaddress_events,
-                                    result);
-
-    qof_book_set_data_fin (book, key, result, shared_quickfill_destroy);
-
-    return result;
-}
-
-QuickFill * gnc_get_shared_address_addr2_quickfill (QofBook *book, const char * key)
-{
-    AddressQF *qfb;
-
-    g_assert(book);
-    g_assert(key);
-
-    qfb = qof_book_get_data (book, key);
-
-    if (!qfb)
-    {
-        qfb = build_shared_quickfill(book, key);
-    }
-
-    return qfb->qf_addr2;
-}
-
-QuickFill * gnc_get_shared_address_addr3_quickfill (QofBook *book, const char * key)
-{
-    AddressQF *qfb;
-
-    g_assert(book);
-    g_assert(key);
-
-    qfb = qof_book_get_data (book, key);
-
-    if (!qfb)
-    {
-        qfb = build_shared_quickfill(book, key);
-    }
-
-    return qfb->qf_addr3;
-}
-
-QuickFill * gnc_get_shared_address_addr4_quickfill (QofBook *book, const char * key)
-{
-    AddressQF *qfb;
-
-    g_assert(book);
-    g_assert(key);
-
-    qfb = qof_book_get_data (book, key);
-
-    if (!qfb)
-    {
-        qfb = build_shared_quickfill(book, key);
-    }
-
-    return qfb->qf_addr4;
-}
diff --git a/src/app-utils/gnc-addr-quickfill.h b/src/app-utils/gnc-addr-quickfill.h
deleted file mode 100644
index df738b8..0000000
--- a/src/app-utils/gnc-addr-quickfill.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/********************************************************************\
- * gnc-addr-quickfill.h -- Create an address line quick-fill  *
- * Copyright (C) 2011 Christian Stimming <christian at cstimming.de>   *
- *                                                                  *
- * 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 at gnu.org                   *
- *                                                                  *
-\********************************************************************/
-/** @addtogroup QuickFill Auto-complete typed user input.
-   @{
-*/
-/** Similar to the @ref Account_QuickFill account name quickfill, we
- * create a cached quickfill with the address lines of all GncAddress.
-*/
-
-#ifndef GNC_ADDR_QUICKFILL_H
-#define GNC_ADDR_QUICKFILL_H
-
-#include "qof.h"
-#include "app-utils/QuickFill.h"
-
-/** Create/fetch a quickfill GncAddress description strings on the Addr2 part.
- *
- *  Multiple, distinct quickfills, for different uses, are allowed.
- *  Each is identified with the 'key'.  Be sure to use distinct,
- *  unique keys that don't conflict with other users of QofBook.
- *
- *  This code listens to GncAddress creation events, and automatically
- *  adds new items to the quickfill list.  This code also listens to
- *  the item deletion events and removes those entries from the
- *  quickfill; however, this does not yet seem to fully remove them
- *  from the GUI.
- *
- * \param book The book
- * \param key The identifier to look up the shared object in the book
- *
- * \return The shared QuickFill object which is created on first
- * calling of this function and subsequently looked up in the book by
- * using the key.
- */
-QuickFill * gnc_get_shared_address_addr2_quickfill (QofBook *book,
-        const char * key);
-
-/** Create/fetch a quickfill GncAddress description strings on the
- * Addr3 part.
- *
- * Identical to gnc_get_shared_address_addr2_quickfill(). You should
- * also use the same key as for the other function because the
- * internal quickfills are updated simultaneously.
- */
-QuickFill * gnc_get_shared_address_addr3_quickfill (QofBook *book,
-        const char * key);
-
-/** Create/fetch a quickfill GncAddress description strings on the
- * Addr4 part.
- *
- * Identical to gnc_get_shared_address_addr2_quickfill(). You should
- * also use the same key as for the other function because the
- * internal quickfills are updated simultaneously.
- */
-QuickFill * gnc_get_shared_address_addr4_quickfill (QofBook *book,
-        const char * key);
-
-#endif
-
-/** @} */
-/** @} */
diff --git a/src/app-utils/gnc-entry-quickfill.c b/src/app-utils/gnc-entry-quickfill.c
deleted file mode 100644
index c7d775d..0000000
--- a/src/app-utils/gnc-entry-quickfill.c
+++ /dev/null
@@ -1,167 +0,0 @@
-/********************************************************************\
- * gnc-entry-quickfill.c -- Create an entry description quick-fill  *
- * Copyright (C) 2010 Christian Stimming <christian at cstimming.de>   *
- *                                                                  *
- * 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 at gnu.org                   *
- *                                                                  *
-\********************************************************************/
-
-#include "config.h"
-#include "gnc-entry-quickfill.h"
-#include "engine/gnc-event.h"
-#include "engine/gncEntry.h"
-
-/* This static indicates the debugging module that this .o belongs to. */
-G_GNUC_UNUSED static QofLogModule log_module = GNC_MOD_REGISTER;
-
-typedef struct
-{
-    QuickFill *qf;
-    QuickFillSort qf_sort;
-    QofBook *book;
-    gint  listener;
-    gboolean using_invoices;
-} EntryQF;
-
-static void
-listen_for_gncentry_events(QofInstance *entity,  QofEventId event_type,
-                           gpointer user_data, gpointer event_data)
-{
-    EntryQF *qfb = user_data;
-    QuickFill *qf = qfb->qf;
-    const char *desc;
-
-    /* We only listen for GncEntry events */
-    if (!GNC_IS_ENTRY (entity))
-        return;
-
-    /* We listen for MODIFY (if the description was changed into
-     * something non-empty, so we add the string to the quickfill) and
-     * DESTROY (to remove the description from the quickfill). */
-    if (0 == (event_type & (QOF_EVENT_MODIFY | QOF_EVENT_DESTROY)))
-        return;
-
-    /*     g_warning("entity %p, entity type %s, event type %s, user data %p, ecent data %p", */
-    /*               entity, entity->e_type, qofeventid_to_string(event_type), user_data, event_data); */
-
-    desc = gncEntryGetDescription(GNC_ENTRY(entity));
-    if (event_type & QOF_EVENT_MODIFY)
-    {
-        /* If the description was changed into something non-empty, so
-         * we add the string to the quickfill */
-        if (!desc || strlen(desc) == 0)
-            return;
-
-        /* Add the new string to the quickfill */
-        gnc_quickfill_insert (qf, desc, QUICKFILL_LIFO);
-    }
-    else if (event_type & QOF_EVENT_DESTROY)
-    {
-        if (!desc || strlen(desc) == 0)
-            return;
-
-        /* Remove the description from the quickfill */
-        gnc_quickfill_insert (qf, desc, QUICKFILL_LIFO);
-    }
-}
-
-static void
-shared_quickfill_destroy (QofBook *book, gpointer key, gpointer user_data)
-{
-    EntryQF *qfb = user_data;
-    gnc_quickfill_destroy (qfb->qf);
-    qof_event_unregister_handler (qfb->listener);
-    g_free (qfb);
-}
-
-static void entry_cb(gpointer data, gpointer user_data)
-{
-    const GncEntry* entry = data;
-    EntryQF *s = (EntryQF *) user_data;
-    if (s->using_invoices == (gncEntryGetInvAccount(entry) != NULL))
-    {
-        gnc_quickfill_insert (s->qf,
-                              gncEntryGetDescription(entry),
-                              s->qf_sort);
-    }
-}
-
-/** Creates a new query that searches for all GncEntry items in the
- * current book. */
-static QofQuery *new_query_for_entrys(QofBook *book)
-{
-    GSList *primary_sort_params = NULL;
-    QofQuery *query = qof_query_create_for (GNC_ID_ENTRY);
-    g_assert(book);
-    qof_query_set_book (query, book);
-
-    /* Set the sort order: By DATE_ENTERED, increasing, and returning
-     * only one single resulting item. */
-    primary_sort_params = qof_query_build_param_list(ENTRY_DATE_ENTERED, NULL);
-    qof_query_set_sort_order (query, primary_sort_params, NULL, NULL);
-    qof_query_set_sort_increasing (query, TRUE, TRUE, TRUE);
-
-    return query;
-}
-
-static EntryQF* build_shared_quickfill (QofBook *book, const char * key, gboolean use_invoices)
-{
-    EntryQF *result;
-    QofQuery *query = new_query_for_entrys(book);
-    GList *entries = qof_query_run(query);
-
-    /*     g_warning("Found %d GncEntry items", g_list_length (entries)); */
-
-    result = g_new0(EntryQF, 1);
-
-    result->using_invoices = use_invoices;
-    result->qf = gnc_quickfill_new();
-    result->qf_sort = QUICKFILL_LIFO;
-    result->book = book;
-
-    g_list_foreach (entries, entry_cb, result);
-
-    qof_query_destroy(query);
-
-    result->listener =
-        qof_event_register_handler (listen_for_gncentry_events,
-                                    result);
-
-    qof_book_set_data_fin (book, key, result, shared_quickfill_destroy);
-
-    return result;
-}
-
-QuickFill * gnc_get_shared_entry_desc_quickfill (QofBook *book,
-        const char * key, gboolean use_invoices)
-{
-    EntryQF *qfb;
-
-    g_assert(book);
-    g_assert(key);
-
-    qfb = qof_book_get_data (book, key);
-
-    if (!qfb)
-    {
-        qfb = build_shared_quickfill(book, key, use_invoices);
-    }
-
-    g_assert(use_invoices == qfb->using_invoices);
-    return qfb->qf;
-}
diff --git a/src/app-utils/gnc-entry-quickfill.h b/src/app-utils/gnc-entry-quickfill.h
deleted file mode 100644
index 5fb4552..0000000
--- a/src/app-utils/gnc-entry-quickfill.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/********************************************************************\
- * gnc-entry-quickfill.h -- Create an entry description quick-fill  *
- * Copyright (C) 2010 Christian Stimming <christian at cstimming.de>   *
- *                                                                  *
- * 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 at gnu.org                   *
- *                                                                  *
-\********************************************************************/
-/** @addtogroup QuickFill Auto-complete typed user input.
-   @{
-*/
-/** Similar to the @ref Account_QuickFill account name quickfill, we
- * create a cached quickfill with the description of all entries.
-*/
-
-#ifndef GNC_ENTRY_QUICKFILL_H
-#define GNC_ENTRY_QUICKFILL_H
-
-#include "qof.h"
-#include "app-utils/QuickFill.h"
-
-/** Create/fetch a quickfill GncEntry description strings.
- *
- *  Multiple, distinct quickfills, for different uses, are allowed.
- *  Each is identified with the 'key'.  Be sure to use distinct,
- *  unique keys that don't conflict with other users of QofBook.
- *
- *  This code listens to entry creation events, and automatically adds
- *  new entry's descriptions to the quickfill list.  This code also
- *  listens to the entry's deletion events and removes those
- *  descriptions from the quickfill; however, this does not yet seem
- *  to fully remove them from the GUI.
- *
- * \param book The book
- * \param key The identifier to look up the shared object in the book
- *
- * \param use_invoices If TRUE, this quickfill considers only the
- * entries from GncInvoice objects. If FALSE, this quickfill considers
- * only the entries from bills/expense vouchers. Watch out: This
- * parameter must be identical each time the same key is used for
- * lookup, or otherwise an assertion will fail.
- *
- * \return The shared QuickFill object which is created on first
- * calling of this function and subsequently looked up in the book by
- * using the key.
- */
-QuickFill * gnc_get_shared_entry_desc_quickfill (QofBook *book,
-        const char * key, gboolean use_invoices);
-
-#endif
-
-/** @} */
-/** @} */
diff --git a/src/app-utils/gnc-euro.c b/src/app-utils/gnc-euro.c
deleted file mode 100644
index 4771efd..0000000
--- a/src/app-utils/gnc-euro.c
+++ /dev/null
@@ -1,234 +0,0 @@
-/********************************************************************\
- * gnc-euro.c -- utilities for EURO currency                        *
- *                                                                  *
- * Copyright (C) 2000 Herbert Thoma                                 *
- *                                                                  *
- * 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, write to the Free Software      *
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.        *
- *                                                                  *
-\********************************************************************/
-
-#include "config.h"
-
-#include "gnc-euro.h"
-
-#include <glib/gi18n.h>
-#include <math.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "app-utils/gnc-ui-util.h"
-
-/* local structs */
-typedef struct
-{
-    const char *currency;
-    double rate;
-} gnc_euro_rate_struct;
-
-
-/* This array MUST be sorted ! */
-/* The rates are per EURO */
-static gnc_euro_rate_struct gnc_euro_rates[] =
-{
-    { "ATS",  13.7603 },  /* austrian schilling */
-    { "BEF",  40.3399 },  /* belgian franc */
-    { "BFR",  40.3399 },  /* belgian franc */
-    { "CYP",  .585274 },  /* cyprus pound */
-    { "DEM",  1.95583 },  /* german mark */
-    { "DM",   1.95583 },  /* german mark */
-    { "EEK",  15.6466 },  /* Estonian Kroon */
-    { "ESC",  200.482 },  /* portugese escudo */
-    { "ESP",  166.386 },  /* spanish peseta */
-    { "EUR",  1.00000 },  /* euro */
-    { "EURO", 1.00000 },  /* euro */
-    { "FF",   6.55957 },  /* french franc */
-    { "FIM",  5.94573 },  /* finnmark */
-    { "FMK",  5.94573 },  /* finnmark */
-    { "FRF",  6.55957 },  /* french franc */
-    { "GRD",  340.750 },  /* greek drachma */
-    { "HFL",  2.20371 },  /* netherland gulden */
-    { "IEP",  .787564 },  /* irish pound */
-    { "IRP",  .787564 },  /* irish pound */
-    { "ITL",  1936.27 },  /* italian lira */
-    { "LFR",  40.3399 },  /* luxembourg franc */
-    { "LIT",  1936.27 },  /* italian lira */
-    { "LUF",  40.3399 },  /* luxembourg franc */
-    { "LVL",  .702804 },  /* latvian lats */
-    { "MTL",  .429300 },  /* maltese lira */
-    { "NLG",  2.20371 },  /* netherland gulden */
-    { "PTA",  166.386 },  /* spanish peseta */
-    { "PTE",  200.482 },  /* portugese escudo */
-    { "S",    13.7603 },  /* austrian schilling */
-    { "SCH",  13.7603 },  /* austrian schilling */
-    { "SIT",  239.640 },  /* slovenian tolar */
-    { "SKK",  30.1260 }   /* slovak koruna */
-};
-
-static int
-gnc_euro_rate_compare (const void * key, const void * value)
-{
-    const gnc_commodity * curr = key;
-    const gnc_euro_rate_struct * euro = value;
-
-    if (!key || !value)
-        return -1;
-
-    return g_ascii_strcasecmp(gnc_commodity_get_mnemonic(curr), euro->currency);
-}
-
-#if 0 /* Not Used */
-static int
-gnc_euro_rate_compare_code (const void * key, const void * value)
-{
-    const char *code = key;
-    const gnc_euro_rate_struct * euro = value;
-
-    if (!key || !value)
-        return -1;
-
-    return g_ascii_strcasecmp (code, euro->currency);
-}
-#endif
-
-/* ------------------------------------------------------ */
-
-gboolean
-gnc_is_euro_currency(const gnc_commodity * currency)
-{
-    gnc_euro_rate_struct *result;
-
-    if (currency == NULL)
-        return FALSE;
-
-    if (!gnc_commodity_is_iso(currency))
-        return FALSE;
-
-    result = bsearch(currency,
-                     gnc_euro_rates,
-                     sizeof(gnc_euro_rates) / sizeof(gnc_euro_rate_struct),
-                     sizeof(gnc_euro_rate_struct),
-                     gnc_euro_rate_compare);
-
-    if (result == NULL)
-        return FALSE;
-
-    return TRUE;
-}
-
-/* ------------------------------------------------------ */
-
-gnc_numeric
-gnc_convert_to_euro(const gnc_commodity * currency, gnc_numeric value)
-{
-    gnc_euro_rate_struct *result;
-
-    if (currency == NULL)
-        return gnc_numeric_zero ();
-
-    if (!gnc_commodity_is_iso(currency))
-        return gnc_numeric_zero ();
-
-    result = bsearch(currency,
-                     gnc_euro_rates,
-                     sizeof(gnc_euro_rates) / sizeof(gnc_euro_rate_struct),
-                     sizeof(gnc_euro_rate_struct),
-                     gnc_euro_rate_compare);
-
-    if (result == NULL)
-        return gnc_numeric_zero ();
-
-    /* round to 2 decimal places */
-    {
-        gnc_numeric rate;
-
-        rate = double_to_gnc_numeric (result->rate, 100000, GNC_HOW_RND_ROUND_HALF_UP);
-
-        /* EC Regulation 1103/97 states we should use "Round half away from zero"
-         * See http://europa.eu/legislation_summaries/economic_and_monetary_affairs/institutional_and_economic_framework/l25025_en.htm */
-        return gnc_numeric_div (value, rate, 100, GNC_HOW_RND_ROUND_HALF_UP);
-    }
-}
-
-/* ------------------------------------------------------ */
-
-gnc_numeric
-gnc_convert_from_euro(const gnc_commodity * currency, gnc_numeric value)
-{
-    gnc_euro_rate_struct * result;
-
-    if (currency == NULL)
-        return gnc_numeric_zero ();
-
-    if (!gnc_commodity_is_iso(currency))
-        return gnc_numeric_zero ();
-
-    result = bsearch(currency,
-                     gnc_euro_rates,
-                     sizeof(gnc_euro_rates) / sizeof(gnc_euro_rate_struct),
-                     sizeof(gnc_euro_rate_struct),
-                     gnc_euro_rate_compare);
-
-    if (result == NULL)
-        return gnc_numeric_zero ();
-
-    {
-        gnc_numeric rate;
-
-        rate = double_to_gnc_numeric (result->rate, 100000, GNC_HOW_RND_ROUND_HALF_UP);
-
-        /* EC Regulation 1103/97 states we should use "Round half away from zero"
-         * See http://europa.eu/legislation_summaries/economic_and_monetary_affairs/institutional_and_economic_framework/l25025_en.htm */
-        return gnc_numeric_mul (value, rate, gnc_commodity_get_fraction (currency),
-                                GNC_HOW_RND_ROUND_HALF_UP);
-    }
-}
-
-/* ------------------------------------------------------ */
-
-gnc_numeric
-gnc_euro_currency_get_rate (const gnc_commodity *currency)
-{
-    gnc_euro_rate_struct * result;
-
-    if (currency == NULL)
-        return gnc_numeric_zero ();
-
-    if (!gnc_commodity_is_iso(currency))
-        return gnc_numeric_zero ();
-
-    result = bsearch(currency,
-                     gnc_euro_rates,
-                     sizeof(gnc_euro_rates) / sizeof(gnc_euro_rate_struct),
-                     sizeof(gnc_euro_rate_struct),
-                     gnc_euro_rate_compare);
-
-    if (result == NULL)
-        return gnc_numeric_zero ();
-
-    return double_to_gnc_numeric (result->rate, GNC_DENOM_AUTO,
-                                  GNC_HOW_DENOM_SIGFIGS(6) | GNC_HOW_RND_ROUND_HALF_UP);
-}
-
-/* ------------------------------------------------------ */
-
-gnc_commodity *
-gnc_get_euro (void)
-{
-    gnc_commodity_table *table;
-
-    table = gnc_commodity_table_get_table (gnc_get_current_book ());
-
-    return gnc_commodity_table_lookup (table, GNC_COMMODITY_NS_CURRENCY, "EUR");
-}
diff --git a/src/app-utils/gnc-prefs-utils.c b/src/app-utils/gnc-prefs-utils.c
deleted file mode 100644
index 7d22f5a..0000000
--- a/src/app-utils/gnc-prefs-utils.c
+++ /dev/null
@@ -1,126 +0,0 @@
-/********************************************************************\
- * gnc-prefs-utils.c -- utility functions for preferences management*
- * Copyright (C) 2013 Geert Janssens <geert at kobaltwit.be>           *
- *                                                                  *
- * 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 at gnu.org                   *
- *                                                                  *
-\********************************************************************/
-
-#include "config.h"
-
-#include "gnc-gsettings.h"
-#include "gnc-prefs-utils.h"
-#include "gnc-prefs.h"
-#include "backend/xml/gnc-backend-xml.h"
-
-static QofLogModule log_module = G_LOG_DOMAIN;
-
-/* Keys used for core preferences */
-#define GNC_PREF_FILE_COMPRESSION    "file-compression"
-#define GNC_PREF_RETAIN_TYPE_NEVER   "retain-type-never"
-#define GNC_PREF_RETAIN_TYPE_DAYS    "retain-type-days"
-#define GNC_PREF_RETAIN_TYPE_FOREVER "retain-type-forever"
-#define GNC_PREF_RETAIN_DAYS         "retain-days"
-
-/***************************************************************
- * Initialization                                              *
- ***************************************************************/
-static void
-file_retain_changed_cb(gpointer gsettings, gchar *key, gpointer user_data)
-{
-    if (gnc_prefs_is_set_up())
-    {
-        gint days = (int)gnc_prefs_get_float(GNC_PREFS_GROUP_GENERAL, GNC_PREF_RETAIN_DAYS);
-        gnc_prefs_set_file_retention_days (days);
-    }
-}
-
-static void
-file_retain_type_changed_cb(gpointer gsettings, gchar *key, gpointer user_data)
-{
-    XMLFileRetentionType type = XML_RETAIN_ALL;
-
-    if (gnc_prefs_is_set_up())
-    {
-        if (gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL, GNC_PREF_RETAIN_TYPE_NEVER))
-            type = XML_RETAIN_NONE;
-        else if (gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL, GNC_PREF_RETAIN_TYPE_DAYS))
-            type = XML_RETAIN_DAYS;
-        else if (!gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL, GNC_PREF_RETAIN_TYPE_FOREVER))
-            PWARN("no file retention policy was set, assuming conservative policy 'forever'");
-
-        gnc_prefs_set_file_retention_policy (type);
-    }
-}
-
-static void
-file_compression_changed_cb(gpointer gsettings, gchar *key, gpointer user_data)
-{
-    if (gnc_prefs_is_set_up())
-    {
-        gboolean file_compression = gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL, GNC_PREF_FILE_COMPRESSION);
-        gnc_prefs_set_file_save_compressed (file_compression);
-    }
-}
-
-
-void gnc_prefs_init (void)
-{
-    gnc_gsettings_load_backend();
-
-    /* Initialize the core preferences by reading their values from the loaded backend.
-     * Note: of no backend was loaded, these functions will return sane default values.
-     */
-    file_retain_changed_cb (NULL, NULL, NULL);
-    file_retain_type_changed_cb (NULL, NULL, NULL);
-    file_compression_changed_cb (NULL, NULL, NULL);
-
-    /* Check for invalid retain_type (days)/retain_days (0) combo.
-     * This can happen either because a user changed the preferences
-     * manually outside of GnuCash, or because the user upgraded from
-     * gnucash version 2.3.15 or older. Back then, 0 retain_days meant
-     * "keep forever". From 2.3.15 on this is controlled via a multiple
-     * choice ("retain_type").
-     * So if we find a 0 retain_days value with a "days" retain_type,
-     * we will silently and conservatively interpret is as meaning
-     * retain forever ("forever" retain_type).
-     */
-    if ( (gnc_prefs_get_file_retention_policy () == XML_RETAIN_DAYS) &&
-            (gnc_prefs_get_file_retention_days () == 0 ) )
-    {
-        gnc_prefs_set_file_retention_policy (XML_RETAIN_ALL);
-        gnc_prefs_set_file_retention_days (30);
-        gnc_prefs_set_bool (GNC_PREFS_GROUP_GENERAL, GNC_PREF_RETAIN_TYPE_FOREVER, TRUE);
-        gnc_prefs_set_float (GNC_PREFS_GROUP_GENERAL, GNC_PREF_RETAIN_DAYS, 30);
-        PWARN("retain 0 days policy was set, but this is probably not what the user wanted,\n"
-              "assuming conservative policy 'forever'");
-    }
-
-    /* Add hooks to update core preferences whenever the associated preference changes */
-    gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL, GNC_PREF_RETAIN_DAYS,
-                           file_retain_changed_cb, NULL);
-    gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL, GNC_PREF_RETAIN_TYPE_NEVER,
-                           file_retain_type_changed_cb, NULL);
-    gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL, GNC_PREF_RETAIN_TYPE_DAYS,
-                           file_retain_type_changed_cb, NULL);
-    gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL, GNC_PREF_RETAIN_TYPE_FOREVER,
-                           file_retain_type_changed_cb, NULL);
-    gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL, GNC_PREF_FILE_COMPRESSION,
-                           file_compression_changed_cb, NULL);
-
-}
diff --git a/src/app-utils/gnc-ui-util.c b/src/app-utils/gnc-ui-util.c
deleted file mode 100644
index 42597fc..0000000
--- a/src/app-utils/gnc-ui-util.c
+++ /dev/null
@@ -1,2457 +0,0 @@
-/********************************************************************\
- * gnc-ui-util.c -- utility functions for the GnuCash UI            *
- * Copyright (C) 2000 Dave Peticolas <dave at krondo.com>              *
- *                                                                  *
- * 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 at gnu.org                   *
-\********************************************************************/
-
-#include "config.h"
-
-#ifdef __MINGW32__
-#define __USE_MINGW_ANSI_STDIO 1
-#endif
-#include "gnc-ui-util.h"
-#include <glib.h>
-#include <glib/gi18n.h>
-#include <gio/gio.h>
-#include <libguile.h>
-#include <ctype.h>
-#include <errno.h>
-#include <limits.h>
-#include <locale.h>
-#include <math.h>
-#if defined(G_OS_WIN32) && !defined(_MSC_VER)
-# include <pow.h>
-#endif
-#include <stdarg.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-
-#include "qof.h"
-#include "guile-mappings.h"
-#include "gnc-prefs.h"
-#include "gnc-module/gnc-module.h"
-#include "engine/Account.h"
-#include "engine/Transaction.h"
-#include "engine/gnc-engine.h"
-#include "app-utils/gnc-euro.h"
-#include "engine/gnc-hooks.h"
-#include "engine/gnc-session.h"
-#include "engine-helpers.h"
-#include "gnc-locale-utils.h"
-#include "gnc-component-manager.h"
-#include "gnc-features.h"
-#include "gnc-guile-utils.h"
-
-#define GNC_PREF_CURRENCY_CHOICE_LOCALE "currency-choice-locale"
-#define GNC_PREF_CURRENCY_CHOICE_OTHER  "currency-choice-other"
-#define GNC_PREF_CURRENCY_OTHER         "currency-other"
-#define GNC_PREF_REVERSED_ACCTS_NONE    "reversed-accounts-none"
-#define GNC_PREF_REVERSED_ACCTS_CREDIT  "reversed-accounts-credit"
-#define GNC_PREF_REVERSED_ACCTS_INC_EXP "reversed-accounts-incomeexpense"
-
-static QofLogModule log_module = GNC_MOD_GUI;
-
-static gboolean auto_decimal_enabled = FALSE;
-static int auto_decimal_places = 2;    /* default, can be changed */
-
-static gboolean reverse_balance_inited = FALSE;
-static gboolean reverse_type[NUM_ACCOUNT_TYPES];
-
-/* Cache currency ISO codes and only look them up in the settings when
- * absolutely necessary. Can't cache a pointer to the data structure
- * as that will change any time the book changes. */
-static gchar *user_default_currency = NULL;
-static gchar *user_report_currency = NULL;
-
-gchar *gnc_normalize_account_separator (const gchar* separator)
-{
-    gchar *new_sep=NULL;
-
-    if (!separator || !*separator || g_strcmp0(separator, "colon") == 0)
-            new_sep = g_strdup (":");
-        else if (g_strcmp0(separator, "slash") == 0)
-            new_sep = g_strdup ("/");
-        else if (g_strcmp0(separator, "backslash") == 0)
-            new_sep = g_strdup ("\\");
-        else if (g_strcmp0(separator, "dash") == 0)
-            new_sep = g_strdup ("-");
-        else if (g_strcmp0(separator, "period") == 0)
-            new_sep = g_strdup (".");
-        else
-            new_sep = g_strdup (separator);
-
-    return new_sep;
-}
-/********************************************************************\
- * gnc_configure_account_separator                                  *
- *   updates the current account separator character                *
- *                                                                  *
- * Args: none                                                       *
- \*******************************************************************/
-static void
-gnc_configure_account_separator (void)
-{
-    gchar *separator;
-    char *string;
-
-    string = gnc_prefs_get_string(GNC_PREFS_GROUP_GENERAL, GNC_PREF_ACCOUNT_SEPARATOR);
-    separator = gnc_normalize_account_separator (string);
-
-    gnc_set_account_separator(separator);
-
-    g_free(string);
-    g_free(separator);
-}
-
-
-static void
-gnc_configure_reverse_balance (void)
-{
-    gint i;
-
-    for (i = 0; i < NUM_ACCOUNT_TYPES; i++)
-        reverse_type[i] = FALSE;
-
-    if (gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL, GNC_PREF_REVERSED_ACCTS_INC_EXP))
-    {
-        reverse_type[ACCT_TYPE_INCOME]  = TRUE;
-        reverse_type[ACCT_TYPE_EXPENSE] = TRUE;
-    }
-    else if (gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL, GNC_PREF_REVERSED_ACCTS_CREDIT))
-    {
-        reverse_type[ACCT_TYPE_LIABILITY] = TRUE;
-        reverse_type[ACCT_TYPE_PAYABLE]   = TRUE;
-        reverse_type[ACCT_TYPE_EQUITY]    = TRUE;
-        reverse_type[ACCT_TYPE_INCOME]    = TRUE;
-        reverse_type[ACCT_TYPE_CREDIT]    = TRUE;
-    }
-    else if (!gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL, GNC_PREF_REVERSED_ACCTS_NONE))
-        PWARN("no reversed account preference set, using none");
-
-}
-
-static void
-gnc_reverse_balance_init (void)
-{
-    gnc_configure_reverse_balance ();
-    reverse_balance_inited = TRUE;
-}
-
-gboolean
-gnc_reverse_balance (const Account *account)
-{
-    int type;
-
-    if (account == NULL)
-        return FALSE;
-
-    type = xaccAccountGetType (account);
-    if ((type < 0) || (type >= NUM_ACCOUNT_TYPES))
-        return FALSE;
-
-    if (!reverse_balance_inited)
-        gnc_reverse_balance_init ();
-
-    return reverse_type[type];
-}
-
-
-gchar *
-gnc_get_default_directory (const gchar *section)
-{
-    gchar *dir;
-
-    dir = gnc_prefs_get_string (section, GNC_PREF_LAST_PATH);
-    if (!dir)
-#ifdef G_OS_WIN32
-        dir = g_strdup (g_get_user_data_dir ()); /* equivalent of "My Documents" */
-#else
-        dir = g_strdup (g_get_home_dir ());
-#endif
-
-    return dir;
-}
-
-void
-gnc_set_default_directory (const gchar *section, const gchar *directory)
-{
-    gnc_prefs_set_string(section, GNC_PREF_LAST_PATH, directory);
-}
-
-QofBook *
-gnc_get_current_book (void)
-{
-    return qof_session_get_book (gnc_get_current_session ());
-}
-
-/* If there is no current session, there is no book and we must be dealing
- * with a new book. When gnucash is started with --nofile, there is
- * initially no session (and no book), but by the time we check, one
- * could have been created (for example, if an empty account tree tab is
- * opened, a session is created which creates a new, but empty, book).
- * A session is created and a book is loaded from a backend when gnucash is
- * started with a file, but selecting 'new file' keeps a session open. So we
- * need to check as well for a book with no accounts (root with no children). */
-gboolean
-gnc_is_new_book (void)
-{
-    return ((!gnc_current_session_exist() ||
-                            (gnc_current_session_exist() &&
-                                !gnc_account_get_children(
-                                    gnc_book_get_root_account(
-                                        gnc_get_current_book()))))
-                            ? TRUE : FALSE);
-}
-
-#define OPTION_TAXUS_NAME "book/tax_US/name"
-#define OPTION_TAXUS_TYPE "book/tax_US/type"
-
-void
-gnc_set_current_book_tax_name (const gchar *tax_name)
-{
-    qof_book_set_string_option(gnc_get_current_book(), OPTION_TAXUS_NAME, tax_name);
-}
-
-const gchar *
-gnc_get_current_book_tax_name (void)
-{
-    return qof_book_get_string_option(gnc_get_current_book(), OPTION_TAXUS_NAME);
-}
-
-void
-gnc_set_current_book_tax_type (const gchar *tax_type)
-{
-    qof_book_set_string_option(gnc_get_current_book(), OPTION_TAXUS_TYPE, tax_type);
-}
-
-const gchar *
-gnc_get_current_book_tax_type (void)
-{
-    return qof_book_get_string_option(gnc_get_current_book(), OPTION_TAXUS_TYPE);
-}
-
-/** Calls gnc_book_option_num_field_source_change to initiate registered
-  * callbacks when num_field_source book option changes so that
-  * registers/reports can update themselves; sets feature flag */
-void
-gnc_book_option_num_field_source_change_cb (gboolean num_action)
-{
-    gnc_suspend_gui_refresh ();
-    if (num_action)
-    {
-    /* Set a feature flag in the book for use of the split action field as number.
-     * This will prevent older GnuCash versions that don't support this feature
-     * from opening this file. */
-        gnc_features_set_used (gnc_get_current_book(),
-                                                GNC_FEATURE_NUM_FIELD_SOURCE);
-    }
-    gnc_book_option_num_field_source_change (num_action);
-    gnc_resume_gui_refresh ();
-}
-
-/** Calls gnc_book_option_book_currency_selected to initiate registered
-  * callbacks when currency accounting book option changes to book-currency so
-  * that registers/reports can update themselves; sets feature flag */
-void
-gnc_book_option_book_currency_selected_cb (gboolean use_book_currency)
-{
-    gnc_suspend_gui_refresh ();
-    if (use_book_currency)
-    {
-    /* Set a feature flag in the book for use of book currency. This will
-     * prevent older GnuCash versions that don't support this feature from
-     * opening this file. */
-        gnc_features_set_used (gnc_get_current_book(),
-                                GNC_FEATURE_BOOK_CURRENCY);
-    }
-    gnc_book_option_book_currency_selected (use_book_currency);
-    gnc_resume_gui_refresh ();
-}
-
-/** Returns TRUE if both book-currency and default gain/loss policy KVPs exist
-  * and are valid and trading accounts are not used. */
-gboolean
-gnc_book_use_book_currency (QofBook *book)
-{
-    const gchar *policy;
-    const gchar *currency;
-
-    if (!book) return FALSE;
-
-    policy = qof_book_get_default_gains_policy (book);
-    currency = qof_book_get_book_currency_name (book);
-
-    /* If either a default gain/loss policy or a book-currency does not exist,
-       book-currency accounting method not valid */
-    if (!policy || !currency)
-       return FALSE;
-
-    /* If both exist, both must be valid */
-    if (!gnc_valid_policy_name (policy) || !gnc_commodity_table_lookup
-                                            (gnc_commodity_table_get_table
-                                              (gnc_get_current_book()),
-                                                GNC_COMMODITY_NS_CURRENCY,
-                                                 currency))
-       return FALSE;
-
-    /* If both exist and are valid, there must be no trading accounts flag */
-    if (qof_book_use_trading_accounts (book))
-       return FALSE;
-
-    return TRUE;
-}
-
-/** Returns pointer to Book Currency name for book or NULL; determines
-  * that both book-currency and default gain/loss policy KVPs exist and that
-  * both are valid, a requirement for the 'book-currency' currency accounting
-  * method to apply. */
-const gchar *
-gnc_book_get_book_currency_name (QofBook *book)
-{
-    if (!book) return NULL;
-
-    if (gnc_book_use_book_currency (book))
-        return qof_book_get_book_currency_name (book);
-
-    return NULL;
-}
-
-/** Returns pointer to Book Currency for book or NULL; determines
-  * that both book-currency and default gain/loss policy KVPs exist and that
-  * both are valid, a requirement for the 'book-currency' currency accounting
-  * method to apply. */
-gnc_commodity *
-gnc_book_get_book_currency (QofBook *book)
-{
-    if (!book) return NULL;
-
-    if (gnc_book_use_book_currency (book))
-        return gnc_commodity_table_lookup
-                    (gnc_commodity_table_get_table(book),
-                     GNC_COMMODITY_NS_CURRENCY,
-                     qof_book_get_book_currency_name (book));
-
-    return NULL;
-}
-
-/** Returns pointer to default gain/loss policy for book or NULL; determines
-  * that both book-currency and default gain/loss policy KVPs exist and that
-  * both are valid, a requirement for the 'book-currency' currency accounting
-  * method to apply. */
-const gchar *
-gnc_book_get_default_gains_policy (QofBook *book)
-{
-    if (!book) return NULL;
-
-    if (gnc_book_use_book_currency (book))
-        return qof_book_get_default_gains_policy (book);
-
-    return NULL;
-}
-
-/** Returns pointer to default gain/loss account for book or NULL; determines
-  * that both book-currency and default gain/loss policy KVPs exist and that
-  * both are valid, a requirement for the 'book-currency' currency accounting
-  * method to apply. Also, account must not be hidden or a placeholder, and
-  * must be of same currency as book-currency and income or expense type */
-Account *
-gnc_book_get_default_gain_loss_acct (QofBook *book)
-{
-    Account *gains_account = NULL;
-
-    if (!book) return NULL;
-
-    if (gnc_book_use_book_currency (book))
-        gains_account = xaccAccountLookup
-                        (qof_book_get_default_gain_loss_acct_guid (book), book);
-
-    if (gains_account &&
-        !xaccAccountGetPlaceholder(gains_account) &&
-        !xaccAccountGetHidden(gains_account) &&
-        (gnc_commodity_equal(xaccAccountGetCommodity(gains_account),
-                                    gnc_book_get_book_currency(book))) &&
-        ((xaccAccountGetType(gains_account) == ACCT_TYPE_INCOME) ||
-            (xaccAccountGetType(gains_account) == ACCT_TYPE_EXPENSE)))
-    {
-        return gains_account;
-    }
-    else
-    {
-        return NULL;
-    }
-}
-
-Account *
-gnc_get_current_root_account (void)
-{
-    return gnc_book_get_root_account (gnc_get_current_book ());
-}
-
-gnc_commodity_table *
-gnc_get_current_commodities (void)
-{
-    return gnc_commodity_table_get_table (gnc_get_current_book ());
-}
-
-gchar *
-gnc_get_account_name_for_register(const Account *account)
-{
-    gboolean show_leaf_accounts;
-    show_leaf_accounts = gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL_REGISTER,
-                                            GNC_PREF_SHOW_LEAF_ACCT_NAMES);
-
-    if (show_leaf_accounts)
-        return g_strdup (xaccAccountGetName (account));
-    else
-        return gnc_account_get_full_name (account);
-}
-
-Account *
-gnc_account_lookup_for_register(const Account *base_account, const char *name)
-{
-    gboolean show_leaf_accounts;
-    show_leaf_accounts = gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL_REGISTER,
-                                            GNC_PREF_SHOW_LEAF_ACCT_NAMES);
-
-    if (show_leaf_accounts)
-        return gnc_account_lookup_by_name (base_account, name);
-    else
-        return gnc_account_lookup_by_full_name (base_account, name);
-}
-
-
-/* Caller is responsible for g_free'ing returned memory */
-char *
-gnc_ui_account_get_tax_info_string (const Account *account)
-{
-    static SCM get_form = SCM_UNDEFINED;
-    static SCM get_desc = SCM_UNDEFINED;
-
-    gboolean tax_related = FALSE;
-    const char *code;
-
-    if (!account)
-        return NULL;
-
-    tax_related = xaccAccountGetTaxRelated (account);
-    code = xaccAccountGetTaxUSCode (account);
-
-    if (!code)
-    {
-        if (!tax_related)
-            return NULL;
-        /* tax_related && !code */
-        else
-            /* Translators: This and the following strings appear on
-             * the account tab if the Tax Info column is displayed,
-             * i.e. if the user wants to record the tax form number
-             * and location on that tax form which corresponds to this
-             * gnucash account. For the US Income Tax support in
-             * gnucash, each tax code that can be assigned to an
-             * account generally corresponds to a specific line number
-             * on a paper form and each form has a unique
-             * identification (e.g., Form 1040, Schedule A). */
-            return g_strdup (_("Tax-related but has no tax code"));
-    }
-    else  /* with tax code */
-    {
-        const gchar *tax_type;
-        GNCAccountType atype;
-        SCM tax_entity_type;
-        SCM category;
-        gchar *num_code = NULL;
-        const gchar *prefix = "N";
-        gchar *return_string = NULL;
-
-        tax_type = gnc_get_current_book_tax_type ();
-        if (tax_type == NULL || (g_strcmp0 (tax_type, "") == 0))
-            return g_strdup (_("Tax entity type not specified"));
-
-        atype = xaccAccountGetType (account);
-        tax_entity_type = scm_from_utf8_string (tax_type);
-
-        if (get_form == SCM_UNDEFINED)
-        {
-            GNCModule module;
-            const gchar *tax_module;
-            /* load the tax info */
-#ifdef LOCALE_SPECIFIC_TAX
-            /* This is a very simple hack that loads the (new, special) German
-               tax definition file in a German locale, or (default) loads the
-               previous US tax file. */
-# ifdef G_OS_WIN32
-            gchar *thislocale = g_win32_getlocale();
-            gboolean is_de_DE = (strncmp(thislocale, "de_DE", 5) == 0);
-            g_free(thislocale);
-# else /* !G_OS_WIN32 */
-            const char *thislocale = setlocale(LC_ALL, NULL);
-            gboolean is_de_DE = (strncmp(thislocale, "de_DE", 5) == 0);
-# endif /* G_OS_WIN32 */
-#else /* LOCALE_SPECIFIC_TAX */
-            gboolean is_de_DE = FALSE;
-#endif /* LOCALE_SPECIFIC_TAX */
-            tax_module = is_de_DE ?
-                         "gnucash/tax/de_DE" :
-                         "gnucash/tax/us";
-
-            module = gnc_module_load ((char *)tax_module, 0);
-
-            g_return_val_if_fail (module, NULL);
-
-            get_form = scm_c_eval_string
-                       ("(false-if-exception gnc:txf-get-form)");
-            get_desc = scm_c_eval_string
-                       ("(false-if-exception gnc:txf-get-description)");
-        }
-
-        g_return_val_if_fail (scm_is_procedure (get_form), NULL);
-        g_return_val_if_fail (scm_is_procedure (get_desc), NULL);
-
-        category = scm_c_eval_string (atype == ACCT_TYPE_INCOME ?
-                                      "txf-income-categories" :
-                                      (atype == ACCT_TYPE_EXPENSE ?
-                                       "txf-expense-categories" :
-                                       (((atype == ACCT_TYPE_BANK)      ||
-                                         (atype == ACCT_TYPE_CASH)      ||
-                                         (atype == ACCT_TYPE_ASSET)     ||
-                                         (atype == ACCT_TYPE_STOCK)     ||
-                                         (atype == ACCT_TYPE_MUTUAL)    ||
-                                         (atype == ACCT_TYPE_RECEIVABLE)) ?
-                                        "txf-asset-categories" :
-                                        (((atype == ACCT_TYPE_CREDIT)    ||
-                                          (atype == ACCT_TYPE_LIABILITY) ||
-                                          (atype == ACCT_TYPE_EQUITY)    ||
-                                          (atype == ACCT_TYPE_PAYABLE)) ?
-                                         "txf-liab-eq-categories" : ""))));
-
-        if (g_str_has_prefix (code, prefix))
-        {
-            const gchar *num_code_tmp;
-            num_code_tmp = g_strdup (code);
-            num_code_tmp++; /* to lose the leading N */
-            num_code = g_strdup (num_code_tmp);
-            num_code_tmp--;
-            g_free ((gpointer *) num_code_tmp);
-        }
-        else
-        {
-            num_code = g_strdup (code);
-        }
-
-        if (category == SCM_UNDEFINED)
-        {
-            if (tax_related)
-                return_string = g_strdup_printf
-                                (_("Tax type %s: invalid code %s for account type"),
-                                 tax_type, num_code);
-            else
-                return_string = g_strdup_printf
-                                (_("Not tax-related; tax type %s: invalid code %s for account type"),
-                                 tax_type, num_code);
-        }
-        else
-        {
-            SCM code_scm;
-            SCM form_scm;
-            code_scm = scm_from_locale_symbol (code);
-            form_scm = scm_call_3 (get_form, category, code_scm, tax_entity_type);
-            if (!scm_is_string (form_scm))
-            {
-                if (tax_related)
-                    return_string =  g_strdup_printf
-                                     (_("Invalid code %s for tax type %s"),
-                                      num_code, tax_type);
-                else
-                    return_string =  g_strdup_printf
-                                     (_("Not tax-related; invalid code %s for tax type %s"),
-                                      num_code, tax_type);
-            }
-            else
-            {
-                gchar *form = NULL;
-
-                /* Note: using scm_to_utf8_string directly here instead
-                   of our wrapper gnc_scm_to_utf8_string. 'form' should
-                   be freed with 'free' instead of 'g_free'. This will
-                   be taken care of automatically during scm_dynwind_end,
-                   because we inform guile of this memory allocation via
-                   scm_dynwind_free a little further. */
-                form = scm_to_utf8_string (form_scm);
-                if (!form)
-                {
-                    if (tax_related)
-                        return_string = g_strdup_printf
-                                        (_("No form: code %s, tax type %s"), num_code,
-                                         tax_type);
-                    else
-                        return_string = g_strdup_printf
-                                        (_("Not tax-related; no form: code %s, tax type %s"),
-                                         num_code, tax_type);
-                }
-                else
-                {
-                    SCM desc_scm;
-
-                    /* Create a dynwind context because we will be calling (scm) functions
-                       that potentially exit non-locally */
-                    scm_dynwind_begin (0);
-                    scm_dynwind_free (form);
-                    desc_scm = scm_call_3 (get_desc, category, code_scm,
-                                           tax_entity_type);
-                    if (!scm_is_string (desc_scm))
-                    {
-                        if (tax_related)
-                            return_string = g_strdup_printf
-                                            (_("No description: form %s, code %s, tax type %s"),
-                                             form, num_code, tax_type);
-                        else
-                            return_string = g_strdup_printf
-                                            (_("Not tax-related; no description: form %s, code %s, tax type %s"),
-                                             form, num_code, tax_type);
-                    }
-                    else
-                    {
-                        gchar *desc = NULL;
-                        desc = gnc_scm_to_utf8_string (desc_scm);
-                        if (!desc)
-                        {
-                            if (tax_related)
-                                return_string = g_strdup_printf
-                                                (_("No description: form %s, code %s, tax type %s"),
-                                                 form, num_code, tax_type);
-                            else
-                                return_string = g_strdup_printf
-                                                (_("Not tax-related; no description: form %s, code %s, tax type %s"),
-                                                 form, num_code, tax_type);
-                        }
-                        else
-                        {
-                            gint64 copy_number;
-                            gchar *copy_txt = NULL;
-                            copy_number = xaccAccountGetTaxUSCopyNumber (account);
-                            copy_txt = (copy_number == 1) ?
-                                       g_strdup ("") :
-                                       g_strdup_printf ("(%d)",
-                                                        (gint) copy_number);
-                            if (tax_related)
-                            {
-                                if (g_strcmp0 (form, "") == 0)
-                                    return_string = g_strdup_printf ("%s", desc);
-                                else
-                                    return_string = g_strdup_printf ("%s%s: %s",
-                                                                     form, copy_txt, desc);
-                            }
-                            else
-                            {
-                                return_string = g_strdup_printf
-                                                (_("Not tax-related; %s%s: %s (code %s, tax type %s)"),
-                                                 form, copy_txt, desc, num_code, tax_type);
-                            }
-                            g_free (copy_txt);
-                        }
-                        g_free (desc);
-                    }
-                    scm_dynwind_end ();
-                }
-            }
-        }
-        g_free (num_code);
-        return return_string;
-    }
-}
-
-/* Caller is responsible for g_free'ing returned memory */
-char *
-gnc_ui_account_get_tax_info_sub_acct_string (const Account *account)
-{
-    GList *descendant, *account_descendants;
-
-    if (!account)
-        return NULL;
-
-    account_descendants = gnc_account_get_descendants (account);
-    if (account_descendants)
-    {
-        gint sub_acct_tax_number = 0;
-        for (descendant = account_descendants; descendant;
-                descendant = g_list_next(descendant))
-        {
-            if (xaccAccountGetTaxRelated (descendant->data))
-                sub_acct_tax_number++;
-        }
-        g_list_free (account_descendants);
-        g_list_free (descendant);
-        /* Translators: This and the following strings appear on
-         * the account tab if the Tax Info column is displayed,
-         * i.e. if the user wants to record the tax form number
-         * and location on that tax form which corresponds to this
-         * gnucash account. For the US Income Tax support in
-         * gnucash, each tax code that can be assigned to an
-         * account generally corresponds to a specific line number
-         * on a paper form and each form has a unique
-         * identification (e.g., Form 1040, Schedule A). */
-        return (sub_acct_tax_number == 0) ? NULL :
-               g_strdup_printf (_("(Tax-related subaccounts: %d)"),
-                                sub_acct_tax_number);
-    }
-    else
-        return NULL;
-}
-
-static const char *
-string_after_colon (const char *msgstr)
-{
-    const char *string_at_colon;
-    g_assert(msgstr);
-    string_at_colon = strchr(msgstr, ':');
-    if (string_at_colon)
-        return string_at_colon + 1;
-    else
-        /* No colon found; we assume the translation contains only the
-           part after the colon, similar to the disambiguation prefixes */
-        return msgstr;
-}
-
-/********************************************************************\
- * gnc_get_reconcile_str                                            *
- *   return the i18n'd string for the given reconciled flag         *
- *                                                                  *
- * Args: reconciled_flag - the flag to convert into a string        *
- * Returns: the i18n'd reconciled string                            *
-\********************************************************************/
-const char *
-gnc_get_reconcile_str (char reconciled_flag)
-{
-    switch (reconciled_flag)
-    {
-    case NREC:
-        /* Translators: For the following strings, the single letters
-           after the colon are abbreviations of the word before the
-           colon. You should only translate the letter *after* the colon. */
-        return string_after_colon(_("not cleared:n"));
-    case CREC:
-        /* Translators: Please only translate the letter *after* the colon. */
-        return string_after_colon(_("cleared:c"));
-    case YREC:
-        /* Translators: Please only translate the letter *after* the colon. */
-        return string_after_colon(_("reconciled:y"));
-    case FREC:
-        /* Translators: Please only translate the letter *after* the colon. */
-        return string_after_colon(_("frozen:f"));
-    case VREC:
-        /* Translators: Please only translate the letter *after* the colon. */
-        return string_after_colon(_("void:v"));
-    default:
-        PERR("Bad reconciled flag\n");
-        return NULL;
-    }
-}
-
-/********************************************************************\
- * gnc_get_reconcile_valid_flags                                    *
- *   return a string containing the list of reconciled flags        *
- *                                                                  *
- * Returns: the i18n'd reconciled flags string                      *
-\********************************************************************/
-const char *
-gnc_get_reconcile_valid_flags (void)
-{
-    static const char flags[] = { NREC, CREC, YREC, FREC, VREC, 0 };
-    return flags;
-}
-
-/********************************************************************\
- * gnc_get_reconcile_flag_order                                     *
- *   return a string containing the reconciled-flag change order    *
- *                                                                  *
- * Args: reconciled_flag - the flag to convert into a string        *
- * Returns: the i18n'd reconciled string                            *
-\********************************************************************/
-const char *
-gnc_get_reconcile_flag_order (void)
-{
-    static const char flags[] = { NREC, CREC, 0 };
-    return flags;
-}
-
-
-static const char *
-equity_base_name (GNCEquityType equity_type)
-{
-    switch (equity_type)
-    {
-    case EQUITY_OPENING_BALANCE:
-        return N_("Opening Balances");
-
-    case EQUITY_RETAINED_EARNINGS:
-        return N_("Retained Earnings");
-
-    default:
-        return NULL;
-    }
-}
-
-Account *
-gnc_find_or_create_equity_account (Account *root,
-                                   GNCEquityType equity_type,
-                                   gnc_commodity *currency)
-{
-    Account *parent;
-    Account *account;
-    gboolean name_exists;
-    gboolean base_name_exists;
-    const char *base_name;
-    char *name;
-
-    g_return_val_if_fail (equity_type >= 0, NULL);
-    g_return_val_if_fail (equity_type < NUM_EQUITY_TYPES, NULL);
-    g_return_val_if_fail (currency != NULL, NULL);
-    g_return_val_if_fail (root != NULL, NULL);
-
-    base_name = equity_base_name (equity_type);
-
-    account = gnc_account_lookup_by_name(root, base_name);
-    if (account && xaccAccountGetType (account) != ACCT_TYPE_EQUITY)
-        account = NULL;
-
-    if (!account)
-    {
-        base_name = base_name && *base_name ? _(base_name) : "";
-
-        account = gnc_account_lookup_by_name(root, base_name);
-        if (account && xaccAccountGetType (account) != ACCT_TYPE_EQUITY)
-            account = NULL;
-    }
-
-    base_name_exists = (account != NULL);
-
-    if (account &&
-            gnc_commodity_equiv (currency, xaccAccountGetCommodity (account)))
-        return account;
-
-    name = g_strconcat (base_name, " - ",
-                        gnc_commodity_get_mnemonic (currency), NULL);
-    account = gnc_account_lookup_by_name(root, name);
-    if (account && xaccAccountGetType (account) != ACCT_TYPE_EQUITY)
-        account = NULL;
-
-    name_exists = (account != NULL);
-
-    if (account &&
-            gnc_commodity_equiv (currency, xaccAccountGetCommodity (account)))
-        return account;
-
-    /* Couldn't find one, so create it */
-    if (name_exists && base_name_exists)
-    {
-        PWARN ("equity account with unexpected currency");
-        g_free (name);
-        return NULL;
-    }
-
-    if (!base_name_exists &&
-            gnc_commodity_equiv (currency, gnc_default_currency ()))
-    {
-        g_free (name);
-        name = g_strdup (base_name);
-    }
-
-    parent = gnc_account_lookup_by_name(root, _("Equity"));
-    if (!parent || xaccAccountGetType (parent) != ACCT_TYPE_EQUITY)
-        parent = root;
-    g_assert(parent);
-
-    account = xaccMallocAccount (gnc_account_get_book(root));
-
-    xaccAccountBeginEdit (account);
-
-    xaccAccountSetName (account, name);
-    xaccAccountSetType (account, ACCT_TYPE_EQUITY);
-    xaccAccountSetCommodity (account, currency);
-
-    xaccAccountBeginEdit (parent);
-    gnc_account_append_child (parent, account);
-    xaccAccountCommitEdit (parent);
-
-    xaccAccountCommitEdit (account);
-
-    g_free (name);
-
-    return account;
-}
-
-gboolean
-gnc_account_create_opening_balance (Account *account,
-                                    gnc_numeric balance,
-                                    time64 date,
-                                    QofBook *book)
-{
-    Account *equity_account;
-    Transaction *trans;
-    Split *split;
-
-    if (gnc_numeric_zero_p (balance))
-        return TRUE;
-
-    g_return_val_if_fail (account != NULL, FALSE);
-
-    equity_account =
-        gnc_find_or_create_equity_account (gnc_account_get_root(account),
-                                           EQUITY_OPENING_BALANCE,
-                                           xaccAccountGetCommodity (account));
-    if (!equity_account)
-        return FALSE;
-
-    xaccAccountBeginEdit (account);
-    xaccAccountBeginEdit (equity_account);
-
-    trans = xaccMallocTransaction (book);
-
-    xaccTransBeginEdit (trans);
-
-    xaccTransSetCurrency (trans, gnc_account_or_default_currency (account, NULL));
-    xaccTransSetDatePostedSecsNormalized (trans, date);
-    xaccTransSetDescription (trans, _("Opening Balance"));
-
-    split = xaccMallocSplit (book);
-
-    xaccTransAppendSplit (trans, split);
-    xaccAccountInsertSplit (account, split);
-
-    xaccSplitSetAmount (split, balance);
-    xaccSplitSetValue (split, balance);
-
-    balance = gnc_numeric_neg (balance);
-
-    split = xaccMallocSplit (book);
-
-    xaccTransAppendSplit (trans, split);
-    xaccAccountInsertSplit (equity_account, split);
-
-    xaccSplitSetAmount (split, balance);
-    xaccSplitSetValue (split, balance);
-
-    xaccTransCommitEdit (trans);
-    xaccAccountCommitEdit (equity_account);
-    xaccAccountCommitEdit (account);
-
-    return TRUE;
-}
-
-#if 0 /* Not Used */
-static void
-gnc_lconv_set_utf8 (char **p_value, char *default_value)
-{
-    char *value = *p_value;
-    *p_value = NULL;
-
-    if ((value == NULL) || (value[0] == 0))
-        value = default_value;
-
-#ifdef G_OS_WIN32
-    {
-        /* get number of resulting wide characters */
-        size_t count = mbstowcs (NULL, value, 0);
-        if (count > 0)
-        {
-            /* malloc and convert */
-            wchar_t *wvalue = g_malloc ((count + 1) * sizeof(wchar_t));
-            count = mbstowcs (wvalue, value, count + 1);
-            if (count > 0)
-            {
-                *p_value = g_utf16_to_utf8 (wvalue, -1, NULL, NULL, NULL);
-            }
-            g_free (wvalue);
-        }
-    }
-#else /* !G_OS_WIN32 */
-    *p_value = g_locale_to_utf8 (value, -1, NULL, NULL, NULL);
-#endif
-
-    if (*p_value == NULL)
-    {
-        // The g_locale_to_utf8 conversion failed. FIXME: Should we rather
-        // use an empty string instead of the default_value? Not sure.
-        *p_value = default_value;
-    }
-}
-
-static void
-gnc_lconv_set_char (char *p_value, char default_value)
-{
-    if ((p_value != NULL) && (*p_value == CHAR_MAX))
-        *p_value = default_value;
-}
-#endif /* Not Used */
-
-gnc_commodity *
-gnc_locale_default_currency_nodefault (void)
-{
-    gnc_commodity * currency;
-    gnc_commodity_table *table;
-    const char *code;
-
-    table = gnc_get_current_commodities ();
-    code = gnc_locale_default_iso_currency_code ();
-
-    currency = gnc_commodity_table_lookup (table, GNC_COMMODITY_NS_CURRENCY, code);
-
-    /* Some very old locales (notably on win32) still announce a euro
-       currency as default, although it has been replaced by EUR in
-       2001. We use EUR as default in that case, but the user can always
-       override from gsettings. */
-    if (gnc_is_euro_currency (currency))
-        currency = gnc_get_euro();
-
-    return (currency ? currency : NULL);
-}
-
-gnc_commodity *
-gnc_locale_default_currency (void)
-{
-    gnc_commodity * currency = gnc_locale_default_currency_nodefault ();
-
-    return (currency ? currency :
-            gnc_commodity_table_lookup (gnc_get_current_commodities (),
-                                        GNC_COMMODITY_NS_CURRENCY, "USD"));
-}
-
-
-static gnc_commodity *
-gnc_default_currency_common (gchar *requested_currency,
-                             const gchar *section)
-{
-    gnc_commodity *currency = NULL;
-    gchar  *mnemonic;
-
-    if (requested_currency)
-        return gnc_commodity_table_lookup(gnc_get_current_commodities(),
-                                          GNC_COMMODITY_NS_CURRENCY,
-                                          requested_currency);
-
-    if (gnc_book_use_book_currency (gnc_get_current_book ()))
-        return gnc_book_get_book_currency (gnc_get_current_book ());
-
-    if (gnc_prefs_get_bool (section, GNC_PREF_CURRENCY_CHOICE_OTHER))
-    {
-        mnemonic = gnc_prefs_get_string(section, GNC_PREF_CURRENCY_OTHER);
-        currency = gnc_commodity_table_lookup(gnc_get_current_commodities(),
-                                              GNC_COMMODITY_NS_CURRENCY, mnemonic);
-        DEBUG("mnemonic %s, result %p", mnemonic ? mnemonic : "(null)", currency);
-        g_free(mnemonic);
-    }
-
-    if (!currency)
-        currency = gnc_locale_default_currency ();
-    if (currency)
-    {
-        mnemonic = requested_currency;
-// ??? Does anyone know what this is supposed to be doing?
-//        requested_currency = g_strdup(gnc_commodity_get_mnemonic(currency));
-        g_free(mnemonic);
-    }
-    return currency;
-}
-
-gnc_commodity *
-gnc_default_currency (void)
-{
-    return gnc_default_currency_common (user_default_currency, GNC_PREFS_GROUP_GENERAL);
-}
-
-gnc_commodity * gnc_account_or_default_currency(const Account* account, gboolean * currency_from_account_found)
-{
-    gnc_commodity *currency;
-    if (!account)
-    {
-        if (currency_from_account_found)
-            *currency_from_account_found = FALSE;
-        return gnc_default_currency();
-    }
-
-    currency = gnc_account_get_currency_or_parent(account);
-    if (currency)
-    {
-        if (currency_from_account_found)
-            *currency_from_account_found = TRUE;
-    }
-    else
-    {
-        if (currency_from_account_found)
-            *currency_from_account_found = FALSE;
-        currency = gnc_default_currency();
-    }
-    return currency;
-}
-
-
-
-gnc_commodity *
-gnc_default_report_currency (void)
-{
-    return gnc_default_currency_common (user_report_currency, GNC_PREFS_GROUP_GENERAL_REPORT);
-}
-
-static void
-gnc_currency_changed_cb (GSettings *settings, gchar *key, gpointer user_data)
-{
-    user_default_currency = NULL;
-    user_report_currency = NULL;
-    gnc_hook_run(HOOK_CURRENCY_CHANGED, NULL);
-}
-
-
-GNCPrintAmountInfo
-gnc_default_print_info (gboolean use_symbol)
-{
-    static GNCPrintAmountInfo info;
-    static gboolean got_it = FALSE;
-    struct lconv *lc;
-
-    /* These must be updated each time. */
-    info.use_symbol = use_symbol ? 1 : 0;
-    info.commodity = gnc_default_currency ();
-
-    if (got_it)
-        return info;
-
-    lc = gnc_localeconv ();
-
-    info.max_decimal_places = lc->frac_digits;
-    info.min_decimal_places = lc->frac_digits;
-
-    info.use_separators = 1;
-    info.use_locale = 1;
-    info.monetary = 1;
-    info.force_fit = 0;
-    info.round = 0;
-
-    got_it = TRUE;
-
-    return info;
-}
-
-static gboolean
-is_decimal_fraction (int fraction, guint8 *max_decimal_places_p)
-{
-    guint8 max_decimal_places = 0;
-
-    if (fraction <= 0)
-        return FALSE;
-
-    while (fraction != 1)
-    {
-        if (fraction % 10 != 0)
-            return FALSE;
-
-        fraction = fraction / 10;
-        max_decimal_places += 1;
-    }
-
-    if (max_decimal_places_p)
-        *max_decimal_places_p = max_decimal_places;
-
-    return TRUE;
-}
-
-GNCPrintAmountInfo
-gnc_commodity_print_info (const gnc_commodity *commodity,
-                          gboolean use_symbol)
-{
-    GNCPrintAmountInfo info;
-    gboolean is_iso;
-
-    if (commodity == NULL)
-        return gnc_default_print_info (use_symbol);
-
-    info.commodity = commodity;
-
-    is_iso = gnc_commodity_is_iso (commodity);
-
-    if (is_decimal_fraction (gnc_commodity_get_fraction (commodity),
-                             &info.max_decimal_places))
-    {
-        if (is_iso)
-            info.min_decimal_places = info.max_decimal_places;
-        else
-            info.min_decimal_places = 0;
-    }
-    else
-        info.max_decimal_places = info.min_decimal_places = 0;
-
-    info.use_separators = 1;
-    info.use_symbol = use_symbol ? 1 : 0;
-    info.use_locale = is_iso ? 1 : 0;
-    info.monetary = 1;
-    info.force_fit = 0;
-    info.round = 0;
-
-    return info;
-}
-
-static GNCPrintAmountInfo
-gnc_account_print_info_helper(const Account *account, gboolean use_symbol,
-                              gnc_commodity * (*efffunc)(const Account *),
-                              int (*scufunc)(const Account*))
-{
-    GNCPrintAmountInfo info;
-    gboolean is_iso;
-    int scu;
-
-    if (account == NULL)
-        return gnc_default_print_info (use_symbol);
-
-    info.commodity = efffunc (account);
-
-    is_iso = gnc_commodity_is_iso (info.commodity);
-
-    scu = scufunc (account);
-
-    if (is_decimal_fraction (scu, &info.max_decimal_places))
-    {
-        if (is_iso)
-            info.min_decimal_places = info.max_decimal_places;
-        else
-            info.min_decimal_places = 0;
-    }
-    else
-        info.max_decimal_places = info.min_decimal_places = 0;
-
-    info.use_separators = 1;
-    info.use_symbol = use_symbol ? 1 : 0;
-    info.use_locale = is_iso ? 1 : 0;
-    info.monetary = 1;
-    info.force_fit = 0;
-    info.round = 0;
-
-    return info;
-}
-
-GNCPrintAmountInfo
-gnc_account_print_info (const Account *account, gboolean use_symbol)
-{
-    return gnc_account_print_info_helper(account, use_symbol,
-                                         xaccAccountGetCommodity,
-                                         xaccAccountGetCommoditySCU);
-}
-
-GNCPrintAmountInfo
-gnc_split_amount_print_info (Split *split, gboolean use_symbol)
-{
-    if (!split)
-    {
-        GNCPrintAmountInfo info = gnc_default_share_print_info ();
-        info.use_symbol = use_symbol;
-        return info;
-    }
-
-    return gnc_account_print_info (xaccSplitGetAccount (split), use_symbol);
-}
-
-static GNCPrintAmountInfo
-gnc_default_print_info_helper (int decplaces)
-{
-    GNCPrintAmountInfo info;
-
-    info.commodity = NULL;
-
-    info.max_decimal_places = decplaces;
-    info.min_decimal_places = 0;
-
-    info.use_separators = 1;
-    info.use_symbol = 0;
-    info.use_locale = 1;
-    info.monetary = 1;
-    info.force_fit = 0;
-    info.round = 0;
-
-    return info;
-}
-
-GNCPrintAmountInfo
-gnc_default_share_print_info (void)
-{
-    static GNCPrintAmountInfo info;
-    static gboolean got_it = FALSE;
-
-    if (!got_it)
-    {
-        info = gnc_default_print_info_helper (5);
-        got_it = TRUE;
-    }
-
-    return info;
-}
-
-GNCPrintAmountInfo
-gnc_share_print_info_places (int decplaces)
-{
-    GNCPrintAmountInfo info;
-
-    info = gnc_default_share_print_info ();
-    info.max_decimal_places = decplaces;
-    info.min_decimal_places = decplaces;
-    info.force_fit = 1;
-    info.round = 1;
-    return info;
-}
-
-GNCPrintAmountInfo
-gnc_default_price_print_info (void)
-{
-    static GNCPrintAmountInfo info;
-    static gboolean got_it = FALSE;
-
-    if (!got_it)
-    {
-        info = gnc_default_print_info_helper (6);
-        got_it = TRUE;
-    }
-
-    return info;
-}
-
-GNCPrintAmountInfo
-gnc_integral_print_info (void)
-{
-    static GNCPrintAmountInfo info;
-    static gboolean got_it = FALSE;
-
-    if (!got_it)
-    {
-        info = gnc_default_print_info_helper (0);
-        got_it = TRUE;
-    }
-
-    return info;
-}
-
-/* Utility function for printing non-negative amounts */
-static int
-PrintAmountInternal(char *buf, gnc_numeric val, const GNCPrintAmountInfo *info)
-{
-    struct lconv *lc = gnc_localeconv();
-    int num_whole_digits;
-    char temp_buf[128];
-    gnc_numeric whole, rounding;
-    int min_dp, max_dp;
-    gboolean value_is_negative, value_is_decimal;
-
-    g_return_val_if_fail (info != NULL, 0);
-
-    if (gnc_numeric_check (val))
-    {
-        PWARN ("Bad numeric: %s.",
-               gnc_numeric_errorCode_to_string(gnc_numeric_check (val)));
-        *buf = '\0';
-        return 0;
-    }
-
-    /* Print the absolute value, but remember sign */
-    value_is_negative = gnc_numeric_negative_p (val);
-    val = gnc_numeric_abs (val);
-
-    /* Try to print as decimal. */
-    value_is_decimal = gnc_numeric_to_decimal(&val, NULL);
-
-    /* Force at least auto_decimal_places zeros */
-    if (auto_decimal_enabled)
-    {
-        min_dp = MAX(auto_decimal_places, info->min_decimal_places);
-        max_dp = MAX(auto_decimal_places, info->max_decimal_places);
-    }
-    else
-    {
-        min_dp = info->min_decimal_places;
-        max_dp = info->max_decimal_places;
-    }
-
-    /* Don to limit the number of decimal places _UNLESS_ force_fit is
-     * true. */
-    if (!info->force_fit)
-        max_dp = 99;
-
-    /* rounding? -- can only ROUND if force_fit is also true */
-    if (value_is_decimal && info->round && info->force_fit)
-    {
-        rounding.num = 5; /* Limit the denom to 10^13 ~= 2^44, leaving max at ~524288 */
-        rounding.denom = pow(10, max_dp + 1);
-        val = gnc_numeric_add(val, rounding, val.denom,
-                              GNC_HOW_DENOM_EXACT | GNC_HOW_RND_TRUNC);
-
-        if (gnc_numeric_check(val))
-        {
-            PWARN ("Bad numeric from rounding: %s.",
-                   gnc_numeric_errorCode_to_string(gnc_numeric_check (val)));
-            *buf = '\0';
-            return 0;
-        }
-    }
-
-    /* calculate the integer part and the remainder */
-    whole = gnc_numeric_convert(val, 1, GNC_HOW_RND_TRUNC);
-    val = gnc_numeric_sub (val, whole, GNC_DENOM_AUTO, GNC_HOW_RND_NEVER);
-    if (gnc_numeric_check (val))
-    {
-        PWARN ("Problem with remainder: %s.",
-               gnc_numeric_errorCode_to_string(gnc_numeric_check (val)));
-        *buf = '\0';
-        return 0;
-    }
-
-    /* print the integer part without separators */
-    sprintf(temp_buf, "%" G_GINT64_FORMAT, whole.num);
-    num_whole_digits = strlen (temp_buf);
-
-    if (!info->use_separators)
-        strcpy (buf, temp_buf);
-    else
-    {
-        int group_count;
-        char *separator;
-        char *temp_ptr;
-        char *buf_ptr;
-        char *group;
-        gchar *rev_buf;
-
-        if (info->monetary)
-        {
-            separator = lc->mon_thousands_sep;
-            group = lc->mon_grouping;
-        }
-        else
-        {
-            separator = lc->thousands_sep;
-            group = lc->grouping;
-        }
-
-        buf_ptr = buf;
-        temp_ptr = &temp_buf[num_whole_digits - 1];
-        group_count = 0;
-
-        while (temp_ptr != temp_buf)
-        {
-            *buf_ptr++ = *temp_ptr--;
-
-            if (*group != CHAR_MAX)
-            {
-                group_count++;
-
-                if (group_count == *group)
-                {
-                    g_utf8_strncpy(buf_ptr, separator, 1);
-                    buf_ptr = g_utf8_find_next_char(buf_ptr, NULL);
-                    group_count = 0;
-
-                    /* Peek ahead at the next group code */
-                    switch (group[1])
-                    {
-                        /* A null char means repeat the last group indefinitely */
-                    case '\0':
-                        break;
-                        /* CHAR_MAX means no more grouping allowed */
-                    case CHAR_MAX:
-                        /* fall through */
-                        /* Anything else means another group size */
-                    default:
-                        group++;
-                        break;
-                    }
-                }
-            }
-        }
-
-        /* We built the string backwards, now reverse */
-        *buf_ptr++ = *temp_ptr;
-        *buf_ptr = '\0';
-        rev_buf = g_utf8_strreverse(buf, -1);
-        strcpy (buf, rev_buf);
-        g_free(rev_buf);
-    } /* endif */
-
-    /* at this point, buf contains the whole part of the number */
-
-    /* If it's not decimal, print the fraction as an expression. */
-    if (!value_is_decimal)
-    {
-        val = gnc_numeric_reduce (val);
-
-        if (val.denom > 0)
-            sprintf (temp_buf, "%" G_GINT64_FORMAT "/%" G_GINT64_FORMAT,
-                     val.num, val.denom);
-        else
-            sprintf (temp_buf, "%" G_GINT64_FORMAT " * %" G_GINT64_FORMAT,
-                     val.num, -val.denom);
-
-        if (whole.num == 0)
-            *buf = '\0';
-        else if (value_is_negative)
-            strcat(buf, " - ");
-        else
-            strcat(buf, " + ");
-
-        strcat (buf, temp_buf);
-    }
-    else
-    {
-        char *decimal_point;
-        guint8 num_decimal_places = 0;
-        char *temp_ptr = temp_buf;
-
-        decimal_point = info->monetary
-                        ? lc->mon_decimal_point
-                        : lc->decimal_point;
-        g_utf8_strncpy(temp_ptr, decimal_point, 1);
-        temp_ptr = g_utf8_find_next_char(temp_ptr, NULL);
-
-        while (!gnc_numeric_zero_p (val)
-                && (val.denom != 1)
-                && (num_decimal_places < max_dp))
-        {
-            gint64 digit;
-
-            val.denom = val.denom / 10;
-
-            digit = val.num / val.denom;
-
-            *temp_ptr++ = digit + '0';
-            num_decimal_places++;
-
-            val.num = val.num - (digit * val.denom);
-        }
-
-        while (num_decimal_places < min_dp)
-        {
-            *temp_ptr++ = '0';
-            num_decimal_places++;
-        }
-
-        /* cap the end and move to the last character */
-        *temp_ptr-- = '\0';
-
-        /* Here we strip off trailing decimal zeros per the argument. */
-        while (*temp_ptr == '0' && num_decimal_places > min_dp)
-        {
-            *temp_ptr-- = '\0';
-            num_decimal_places--;
-        }
-
-        if (num_decimal_places > max_dp)
-        {
-            PWARN ("max_decimal_places too small; limit %d, value %s%s",
-                   info->max_decimal_places, buf, temp_buf);
-        }
-
-        if (num_decimal_places > 0)
-            strcat (buf, temp_buf);
-    }
-
-    return strlen(buf);
-}
-
-/**
- * @param bufp Should be at least 64 chars.
- **/
-int
-xaccSPrintAmount (char * bufp, gnc_numeric val, GNCPrintAmountInfo info)
-{
-    struct lconv *lc;
-
-    char *orig_bufp = bufp;
-    const char *currency_symbol;
-    const char *sign;
-
-    char cs_precedes;
-    char sep_by_space;
-    char sign_posn;
-
-    gboolean print_sign = TRUE;
-    gboolean print_absolute = FALSE;
-
-    if (!bufp)
-        return 0;
-
-    lc = gnc_localeconv();
-    if (info.use_locale)
-        if (gnc_numeric_negative_p (val))
-        {
-            cs_precedes  = lc->n_cs_precedes;
-            sep_by_space = lc->n_sep_by_space;
-        }
-        else
-        {
-            cs_precedes  = lc->p_cs_precedes;
-            sep_by_space = lc->p_sep_by_space;
-        }
-    else
-    {
-        cs_precedes = TRUE;
-        sep_by_space = TRUE;
-    }
-
-    if (info.commodity && info.use_symbol)
-    {
-        currency_symbol = gnc_commodity_get_nice_symbol (info.commodity);
-        if (!gnc_commodity_is_iso (info.commodity))
-        {
-            cs_precedes  = FALSE;
-            sep_by_space = TRUE;
-        }
-    }
-    else /* !info.use_symbol || !info.commodity */
-        currency_symbol = "";
-
-    if (gnc_numeric_negative_p (val))
-    {
-        sign = lc->negative_sign;
-        sign_posn = lc->n_sign_posn;
-    }
-    else
-    {
-        sign = lc->positive_sign;
-        sign_posn = lc->p_sign_posn;
-    }
-
-    if (gnc_numeric_zero_p (val) || (sign == NULL) || (sign[0] == 0))
-        print_sign = FALSE;
-
-    /* See if we print sign now */
-    if (print_sign && (sign_posn == 1))
-        bufp = g_stpcpy(bufp, sign);
-
-    /* Now see if we print currency */
-    if (cs_precedes)
-    {
-        /* See if we print sign now */
-        if (print_sign && (sign_posn == 3))
-            bufp = g_stpcpy(bufp, sign);
-
-        if (info.use_symbol)
-        {
-            bufp = g_stpcpy(bufp, currency_symbol);
-            if (sep_by_space)
-                bufp = g_stpcpy(bufp, " ");
-        }
-
-        /* See if we print sign now */
-        if (print_sign && (sign_posn == 4))
-            bufp = g_stpcpy(bufp, sign);
-    }
-
-    /* Now see if we print parentheses */
-    if (print_sign && (sign_posn == 0))
-    {
-        bufp = g_stpcpy(bufp, "(");
-        print_absolute = TRUE;
-    }
-
-    /* Now print the value */
-    bufp += PrintAmountInternal(bufp,
-                                print_absolute ? gnc_numeric_abs(val) : val,
-                                &info);
-
-    /* Now see if we print parentheses */
-    if (print_sign && (sign_posn == 0))
-        bufp = g_stpcpy(bufp, ")");
-
-    /* Now see if we print currency */
-    if (!cs_precedes)
-    {
-        /* See if we print sign now */
-        if (print_sign && (sign_posn == 3))
-            bufp = g_stpcpy(bufp, sign);
-
-        if (info.use_symbol)
-        {
-            if (sep_by_space)
-                bufp = g_stpcpy(bufp, " ");
-            bufp = g_stpcpy(bufp, currency_symbol);
-        }
-
-        /* See if we print sign now */
-        if (print_sign && (sign_posn == 4))
-            bufp = g_stpcpy(bufp, sign);
-    }
-
-    /* See if we print sign now */
-    if (print_sign && (sign_posn == 2))
-        bufp = g_stpcpy(bufp, sign);
-
-    /* return length of printed string */
-    return (bufp - orig_bufp);
-}
-
-const char *
-xaccPrintAmount (gnc_numeric val, GNCPrintAmountInfo info)
-{
-    /* hack alert -- this is not thread safe ... */
-    static char buf[1024];
-
-    if (!xaccSPrintAmount (buf, val, info))
-        buf[0] = '\0';
-
-    /* its OK to return buf, since we declared it static */
-    return buf;
-}
-
-
-/********************************************************************\
- ********************************************************************/
-
-#define FUDGE .00001
-
-/* This function is basically untranslatable. I'd
-   guess out of the 29 translations we have, 20 will have their number
-   wordings in a totally different way than English has (not to
-   mention gender-dependent number endings). Which means this
-   word-by-word translation will be useless or even plain
-   wrong. For this reason, we don't even start to pretend a
-   word-by-word translation would be of any use, so we don't mark any
-   of these strings for translation. cstim, 2007-04-15. */
-static gchar *small_numbers[] =
-{
-    /* Translators: This section is for generating the "amount, in
-       words" field when printing a check. This function gets the
-       wording right for English, but unfortunately not for most other
-       languages. Decide for yourself whether the check printing is
-       actually needed in your language; if not, you can safely skip the
-       translation of all of these strings.  */
-    "Zero", "One", "Two", "Three", "Four",
-    "Five", "Six", "Seven", "Eight", "Nine",
-    "Ten", "Eleven", "Twelve", "Thirteen", "Fourteen",
-    "Fifteen", "Sixteen", "Seventeen", "Eighteen", "Nineteen",
-    "Twenty"
-};
-static gchar *medium_numbers[] =
-{
-    "Zero", "Ten", "Twenty", "Thirty", "Forty",
-    "Fifty", "Sixty", "Seventy", "Eighty", "Ninety"
-};
-static gchar *big_numbers[] =
-{
-    /* Translators: This is the word for the number 10^2 */
-    "Hundred",
-    /* Translators: This is the word for the number 10^3 */
-    "Thousand",
-    /* Translators: This is the word for the number 10^6, one thousand
-       thousands. */
-    "Million",
-    /* Translators: This is the word for the number 10^9, one thousand
-       millions. WATCH OUT: In British English and many other languages
-       this word is used for 10^12 which is one million millions! In
-       contrast to this, here in GnuCash this is used in the American
-       English meaning of 10^9.  */
-    "Billion",
-    /* Translators: This is the word for the number 10^12, one million
-       millions. */
-    "Trillion",
-    /* Translators: This is the word for the number 10^15 */
-    "Quadrillion",
-    /* Translators: This is the word for the number 10^18 */
-    "Quintillion"
-};
-
-static gchar *
-integer_to_words(gint64 val)
-{
-    gint64 log_val, pow_val, this_part;
-    GString *result;
-    gchar *tmp;
-
-    if (val == 0)
-        return g_strdup("zero");
-    if (val < 0)
-        val = -val;
-
-    result = g_string_sized_new(100);
-
-    while (val >= 1000)
-    {
-        log_val = log10(val) / 3 + FUDGE;
-        pow_val = exp(log_val * 3 * G_LN10) + FUDGE;
-        this_part = val / pow_val;
-        val -= this_part * pow_val;
-        tmp = integer_to_words(this_part);
-        g_string_append_printf(result, "%s %s ", tmp,
-                               gettext(big_numbers[log_val]));
-        g_free(tmp);
-    }
-
-    if (val >= 100)
-    {
-        this_part = val / 100;
-        val -= this_part * 100;
-        g_string_append_printf(result, "%s %s ",
-                               gettext(small_numbers[this_part]),
-                               gettext(big_numbers[0]));
-    }
-
-    if (val > 20)
-    {
-        this_part = val / 10;
-        val -= this_part * 10;
-        g_string_append(result, gettext(medium_numbers[this_part]));
-        g_string_append_c(result, ' ');
-    }
-
-    if (val > 0)
-    {
-        this_part = val;
-        val -= this_part;
-        g_string_append(result, gettext(small_numbers[this_part]));
-        g_string_append_c(result, ' ');
-    }
-
-    result = g_string_truncate(result, result->len - 1);
-    return g_string_free(result, FALSE);
-}
-
-#ifdef _MSC_VER
-static double round(double x)
-{
-    // A simple round() implementation because MSVC doesn't seem to have that
-    return floor(x + 0.5);
-}
-#endif
-
-gchar *
-number_to_words(gdouble val, gint64 denom)
-{
-    gint64 int_part, frac_part;
-    gchar *int_string, *nomin_string, *denom_string, *full_string;
-
-    if (val < 0) val = -val;
-    if (denom < 0) denom = -denom;
-
-    int_part = floor(val);
-    frac_part = round((val - int_part) * denom);
-
-    int_string = integer_to_words(int_part);
-    /* Inside of the gettext macro _(...) we must not use any macros but
-       only plain string literals. For this reason, convert the strings
-       separately. */
-    nomin_string = g_strdup_printf("%02" G_GINT64_FORMAT, frac_part);
-    denom_string = g_strdup_printf("%" G_GINT64_FORMAT, denom);
-    full_string =
-        /* Translators: This is for the "amount, in words" field in check
-           printing. The first %s is the integer amount of dollars (or
-           whatever currency), the second and third %s the cent amount as
-           a fraction, e.g. 47/100.  */
-        g_strdup_printf("%s and %s/%s",
-                        int_string, nomin_string, denom_string);
-    g_free(int_string);
-    g_free(nomin_string);
-    g_free(denom_string);
-    return full_string;
-}
-
-gchar *
-numeric_to_words(gnc_numeric val)
-{
-    return number_to_words(gnc_numeric_to_double(val),
-                           gnc_numeric_denom(val));
-}
-
-const gchar *
-printable_value (gdouble val, gint denom)
-{
-    GNCPrintAmountInfo info;
-    gnc_numeric num;
-
-    num = gnc_numeric_create(round(val * denom), denom);
-    info = gnc_share_print_info_places(log10(denom));
-    return xaccPrintAmount (num, info);
-}
-
-/********************************************************************\
- * xaccParseAmount                                                  *
- *   parses amount strings using locale data                        *
- *                                                                  *
- * Args: in_str   -- pointer to string rep of num                   *
- *       monetary -- boolean indicating whether value is monetary   *
- *       result   -- pointer to result location, may be NULL        *
- *       endstr   -- used to store first digit not used in parsing  *
- * Return: gboolean -- TRUE if a number found and parsed            *
- *                     If FALSE, result is not changed              *
-\********************************************************************/
-
-/* Parsing state machine states */
-typedef enum
-{
-    START_ST,       /* Parsing initial whitespace */
-    NEG_ST,         /* Parsed a negative sign or a left paren */
-    PRE_GROUP_ST,   /* Parsing digits before grouping and decimal characters */
-    START_GROUP_ST, /* Start of a digit group encountered (possibly) */
-    IN_GROUP_ST,    /* Within a digit group */
-    FRAC_ST,        /* Parsing the fractional portion of a number */
-    DONE_ST,        /* Finished, number is correct module grouping constraints */
-    NO_NUM_ST       /* Finished, number was malformed */
-} ParseState;
-
-#define done_state(state) (((state) == DONE_ST) || ((state) == NO_NUM_ST))
-
-G_INLINE_FUNC long long int multiplier (int num_decimals);
-
-long long int
-multiplier (int num_decimals)
-{
-    switch (num_decimals)
-    {
-    case 8:
-        return 100000000;
-    case 7:
-        return 10000000;
-    case 6:
-        return 1000000;
-    case 5:
-        return 100000;
-    case 4:
-        return 10000;
-    case 3:
-        return 1000;
-    case 2:
-        return 100;
-    case 1:
-        return 10;
-    default:
-        PERR("bad fraction length");
-        g_assert_not_reached();
-        break;
-    }
-
-    return 1;
-}
-
-gboolean
-xaccParseAmount (const char * in_str, gboolean monetary, gnc_numeric *result,
-                 char **endstr)
-{
-    struct lconv *lc = gnc_localeconv();
-
-    gunichar negative_sign;
-    gunichar decimal_point;
-    gunichar group_separator;
-    char *group;
-
-    negative_sign = g_utf8_get_char(lc->negative_sign);
-    if (monetary)
-    {
-        group_separator = g_utf8_get_char(lc->mon_thousands_sep);
-        decimal_point = g_utf8_get_char(lc->mon_decimal_point);
-        group = lc->mon_grouping;
-    }
-    else
-    {
-        group_separator = g_utf8_get_char(lc->thousands_sep);
-        decimal_point = g_utf8_get_char(lc->decimal_point);
-        group = lc->grouping;
-    }
-
-    return xaccParseAmountExtended(in_str, monetary, negative_sign, decimal_point,
-                                   group_separator, group, NULL, result, endstr);
-}
-
-/* Note: xaccParseAmountExtended causes test-print-parse-amount
-to fail if QOF_SCANF_LLD is simply replaced by G_GINT64_FORMAT. Why?
-A: Because scanf and printf use different symbols for 64-bit numbers.
-*/
-gboolean
-xaccParseAmountExtended (const char * in_str, gboolean monetary,
-                         gunichar negative_sign, gunichar decimal_point,
-                         gunichar group_separator, const char *group, const char *ignore_list,
-                         gnc_numeric *result, char **endstr)
-{
-    gboolean is_negative;
-    gboolean got_decimal;
-    gboolean need_paren;
-    GList * group_data;
-    long long int numer;
-    long long int denom;
-    int count, group_count;
-
-    ParseState state;
-
-    const gchar *in;
-    gunichar uc;
-    gchar *out_str;
-    gchar *out;
-
-    /* Initialize *endstr to in_str */
-    if (endstr != NULL)
-        *endstr = (char *) in_str;
-
-    if (in_str == NULL)
-        return FALSE;
-
-    if (!g_utf8_validate(in_str, -1, &in))
-    {
-        printf("Invalid utf8 string '%s'. Bad character at position %ld.\n",
-               in_str, g_utf8_pointer_to_offset (in_str, in));
-        return FALSE;
-    }
-
-    /* 'out_str' will be used to store digits for numeric conversion.
-     * 'out' will be used to traverse out_str. */
-    out = out_str = g_new(gchar, strlen(in_str) + 128);
-
-    /* 'in' is used to traverse 'in_str'. */
-    in = in_str;
-
-    is_negative = FALSE;
-    got_decimal = FALSE;
-    need_paren = FALSE;
-    group_data = NULL;
-    group_count = 0;
-    numer = 0;
-    denom = 1;
-
-    /* Initialize the state machine */
-    state = START_ST;
-
-    /* This while loop implements a state machine for parsing numbers. */
-    while (TRUE)
-    {
-        ParseState next_state = state;
-
-        uc = g_utf8_get_char(in);
-
-        /* Ignore anything in the 'ignore list' */
-        if (ignore_list && uc && g_utf8_strchr(ignore_list, -1, uc) != NULL)
-        {
-            in = g_utf8_next_char(in);
-            continue;
-        }
-
-        /* Note we never need to check for the end of 'in_str' explicitly.
-         * The 'else' clauses on all the state transitions will handle that. */
-        switch (state)
-        {
-            /* START_ST means we have parsed 0 or more whitespace characters */
-        case START_ST:
-            if (g_unichar_isdigit(uc))
-            {
-                count = g_unichar_to_utf8(uc, out);
-                out += count; /* we record the digits themselves in out_str
-                         * for later conversion by libc routines */
-                next_state = PRE_GROUP_ST;
-            }
-            else if (uc == decimal_point)
-            {
-                next_state = FRAC_ST;
-            }
-            else if (g_unichar_isspace(uc))
-            {
-            }
-            else if (uc == negative_sign)
-            {
-                is_negative = TRUE;
-                next_state = NEG_ST;
-            }
-            else if (uc == '(')
-            {
-                is_negative = TRUE;
-                need_paren = TRUE;
-                next_state = NEG_ST;
-            }
-            else
-            {
-                next_state = NO_NUM_ST;
-            }
-
-            break;
-
-            /* NEG_ST means we have just parsed a negative sign. For now,
-             * we only recognize formats where the negative sign comes first. */
-        case NEG_ST:
-            if (g_unichar_isdigit(uc))
-            {
-                count = g_unichar_to_utf8(uc, out);
-                out += count;
-                next_state = PRE_GROUP_ST;
-            }
-            else if (uc == decimal_point)
-            {
-                next_state = FRAC_ST;
-            }
-            else if (g_unichar_isspace(uc))
-            {
-            }
-            else
-            {
-                next_state = NO_NUM_ST;
-            }
-
-            break;
-
-            /* PRE_GROUP_ST means we have started parsing the number, but
-             * have not encountered a decimal point or a grouping character. */
-        case PRE_GROUP_ST:
-            if (g_unichar_isdigit(uc))
-            {
-                count = g_unichar_to_utf8(uc, out);
-                out += count;
-            }
-            else if (uc == decimal_point)
-            {
-                next_state = FRAC_ST;
-            }
-            else if (uc == group_separator)
-            {
-                next_state = START_GROUP_ST;
-            }
-            else if (uc == ')' && need_paren)
-            {
-                next_state = DONE_ST;
-                need_paren = FALSE;
-            }
-            else
-            {
-                next_state = DONE_ST;
-            }
-
-            break;
-
-            /* START_GROUP_ST means we have just parsed a group character.
-             * Note that group characters might be whitespace!!! In general,
-             * if a decimal point or a group character is whitespace, we
-             * try to interpret it in the fashion that will allow parsing
-             * of the current number to continue. */
-        case START_GROUP_ST:
-            if (g_unichar_isdigit(uc))
-            {
-                count = g_unichar_to_utf8(uc, out);
-                out += count;
-                group_count++; /* We record the number of digits
-                          * in the group for later checking. */
-                next_state = IN_GROUP_ST;
-            }
-            else if (uc == decimal_point)
-            {
-                /* If we now get a decimal point, and both the decimal
-                 * and the group separator are also whitespace, assume
-                 * the last group separator was actually whitespace and
-                 * stop parsing. Otherwise, there's a problem. */
-                if (g_unichar_isspace(group_separator) &&
-                        g_unichar_isspace(decimal_point))
-                    next_state = DONE_ST;
-                else
-                    next_state = NO_NUM_ST;
-            }
-            else if (uc == ')' && need_paren)
-            {
-                if (g_unichar_isspace(group_separator))
-                {
-                    next_state = DONE_ST;
-                    need_paren = FALSE;
-                }
-                else
-                    next_state = NO_NUM_ST;
-            }
-            else
-            {
-                /* If the last group separator is also whitespace,
-                 * assume it was intended as such and stop parsing.
-                 * Otherwise, there is a problem. */
-                if (g_unichar_isspace(group_separator))
-                    next_state = DONE_ST;
-                else
-                    next_state = NO_NUM_ST;
-            }
-            break;
-
-            /* IN_GROUP_ST means we are in the middle of parsing
-             * a group of digits. */
-        case IN_GROUP_ST:
-            if (g_unichar_isdigit(uc))
-            {
-                count = g_unichar_to_utf8(uc, out);
-                out += count;
-                group_count++; /* We record the number of digits
-                          * in the group for later checking. */
-            }
-            else if (uc == decimal_point)
-            {
-                next_state = FRAC_ST;
-            }
-            else if (uc == group_separator)
-            {
-                next_state = START_GROUP_ST;
-            }
-            else if (uc == ')' && need_paren)
-            {
-                next_state = DONE_ST;
-                need_paren = FALSE;
-            }
-            else
-            {
-                next_state = DONE_ST;
-            }
-
-            break;
-
-            /* FRAC_ST means we are now parsing fractional digits. */
-        case FRAC_ST:
-            if (g_unichar_isdigit(uc))
-            {
-                count = g_unichar_to_utf8(uc, out);
-                out += count;
-            }
-            else if (uc == decimal_point)
-            {
-                /* If a subsequent decimal point is also whitespace,
-                 * assume it was intended as such and stop parsing.
-                 * Otherwise, there is a problem. */
-                if (g_unichar_isspace(decimal_point))
-                    next_state = DONE_ST;
-                else
-                    next_state = NO_NUM_ST;
-            }
-            else if (uc == group_separator)
-            {
-                /* If a subsequent group separator is also whitespace,
-                 * assume it was intended as such and stop parsing.
-                 * Otherwise, there is a problem. */
-                if (g_unichar_isspace(group_separator))
-                    next_state = DONE_ST;
-                else
-                    next_state = NO_NUM_ST;
-            }
-            else if (uc == ')' && need_paren)
-            {
-                next_state = DONE_ST;
-                need_paren = FALSE;
-            }
-            else
-            {
-                next_state = DONE_ST;
-            }
-
-            break;
-
-        default:
-            PERR("bad state");
-            g_assert_not_reached();
-            break;
-        }
-
-        /* If we're moving out of the IN_GROUP_ST, record data for the group */
-        if ((state == IN_GROUP_ST) && (next_state != IN_GROUP_ST))
-        {
-            group_data = g_list_prepend(group_data, GINT_TO_POINTER(group_count));
-            group_count = 0;
-        }
-
-        /* If we're moving into the FRAC_ST or out of the machine
-         * without going through FRAC_ST, record the integral value. */
-        if (((next_state == FRAC_ST) && (state != FRAC_ST)) ||
-                ((next_state == DONE_ST) && !got_decimal))
-        {
-            *out = '\0';
-
-            if (*out_str != '\0' && sscanf(out_str, QOF_SCANF_LLD, &numer) < 1)
-            {
-                next_state = NO_NUM_ST;
-            }
-            else if (next_state == FRAC_ST)
-            {
-                /* reset the out pointer to record the fraction */
-                out = out_str;
-                *out = '\0';
-
-                got_decimal = TRUE;
-            }
-        }
-
-        state = next_state;
-        if (done_state (state))
-            break;
-
-        in = g_utf8_next_char(in);
-    }
-
-    /* If there was an error, just quit */
-    if (need_paren || (state == NO_NUM_ST))
-    {
-        g_free(out_str);
-        g_list_free(group_data);
-        return FALSE;
-    }
-
-    /* If there were groups, validate them */
-    if (group_data != NULL)
-    {
-        gboolean good_grouping = TRUE;
-        GList *node;
-
-        /* The groups were built in reverse order. This
-         * is the easiest order to verify them in. */
-        for (node = group_data; group && node; node = node->next)
-        {
-            /* Verify group size */
-            if (*group != GPOINTER_TO_INT(node->data))
-            {
-                good_grouping = FALSE;
-                break;
-            }
-
-            /* Peek ahead at the next group code */
-            switch (group[1])
-            {
-                /* A null char means repeat the last group indefinitely */
-            case '\0':
-                break;
-                /* CHAR_MAX means no more grouping allowed */
-            case CHAR_MAX:
-                if (node->next != NULL)
-                    good_grouping = FALSE;
-                break;
-                /* Anything else means another group size */
-            default:
-                group++;
-                break;
-            }
-
-            if (!good_grouping)
-                break;
-        }
-
-        g_list_free(group_data);
-
-        if (!good_grouping)
-        {
-            g_free(out_str);
-            return FALSE;
-        }
-    }
-
-    /* Cap the end of the fraction string, if any */
-    *out = '\0';
-
-    /* Add in fractional value */
-    if (got_decimal && (*out_str != '\0'))
-    {
-        size_t len;
-        long long int fraction;
-
-        len = strlen(out_str);
-
-        if (len > 8)
-        {
-            out_str[8] = '\0';
-            len = 8;
-        }
-
-        if (sscanf (out_str, QOF_SCANF_LLD, &fraction) < 1)
-        {
-            g_free(out_str);
-            return FALSE;
-        }
-
-        denom = multiplier(len);
-        numer *= denom;
-        numer += fraction;
-    }
-    else if (monetary && auto_decimal_enabled && !got_decimal)
-    {
-        if ((auto_decimal_places > 0) && (auto_decimal_places < 9))
-        {
-            denom = multiplier(auto_decimal_places);
-
-            /* No need to multiply numer by denom at this point,
-             * since by specifying the auto decimal places the
-             * user has effectively determined the scaling factor
-             * for the numerator they entered.
-             */
-        }
-    }
-
-    if (result != NULL)
-    {
-        *result = gnc_numeric_create (numer, denom);
-        if (is_negative)
-            *result = gnc_numeric_neg (*result);
-    }
-
-    if (endstr != NULL)
-        *endstr = (char *) in;
-
-    g_free (out_str);
-
-    return TRUE;
-}
-
-/* enable/disable the auto_decimal_enabled option */
-static void
-gnc_set_auto_decimal_enabled (gpointer settings, gchar *key, gpointer user_data)
-{
-    auto_decimal_enabled =
-            gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL, GNC_PREF_AUTO_DECIMAL_POINT);
-}
-
-/* set the number of auto decimal places to use */
-static void
-gnc_set_auto_decimal_places (gpointer settings, gchar *key, gpointer user_data)
-{
-    auto_decimal_places =
-            gnc_prefs_get_int (GNC_PREFS_GROUP_GENERAL, GNC_PREF_AUTO_DECIMAL_PLACES);
-}
-
-static void
-gnc_auto_decimal_init (void)
-{
-    auto_decimal_enabled =
-        gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL, GNC_PREF_AUTO_DECIMAL_POINT);
-    auto_decimal_places =
-        gnc_prefs_get_int (GNC_PREFS_GROUP_GENERAL, GNC_PREF_AUTO_DECIMAL_PLACES);
-}
-
-void
-gnc_ui_util_init (void)
-{
-    gnc_configure_account_separator ();
-    gnc_auto_decimal_init();
-
-    gnc_prefs_register_cb(GNC_PREFS_GROUP_GENERAL, GNC_PREF_ACCOUNT_SEPARATOR,
-                          gnc_configure_account_separator, NULL);
-    gnc_prefs_register_cb(GNC_PREFS_GROUP_GENERAL, GNC_PREF_REVERSED_ACCTS_NONE,
-                          gnc_configure_reverse_balance, NULL);
-    gnc_prefs_register_cb(GNC_PREFS_GROUP_GENERAL, GNC_PREF_REVERSED_ACCTS_CREDIT,
-                          gnc_configure_reverse_balance, NULL);
-    gnc_prefs_register_cb(GNC_PREFS_GROUP_GENERAL, GNC_PREF_REVERSED_ACCTS_INC_EXP,
-                          gnc_configure_reverse_balance, NULL);
-    gnc_prefs_register_cb(GNC_PREFS_GROUP_GENERAL, GNC_PREF_CURRENCY_CHOICE_LOCALE,
-                          gnc_currency_changed_cb, NULL);
-    gnc_prefs_register_cb(GNC_PREFS_GROUP_GENERAL, GNC_PREF_CURRENCY_CHOICE_OTHER,
-                          gnc_currency_changed_cb, NULL);
-    gnc_prefs_register_cb(GNC_PREFS_GROUP_GENERAL, GNC_PREF_CURRENCY_OTHER,
-                          gnc_currency_changed_cb, NULL);
-    gnc_prefs_register_cb(GNC_PREFS_GROUP_GENERAL_REPORT, GNC_PREF_CURRENCY_CHOICE_LOCALE,
-                          gnc_currency_changed_cb, NULL);
-    gnc_prefs_register_cb(GNC_PREFS_GROUP_GENERAL_REPORT, GNC_PREF_CURRENCY_CHOICE_OTHER,
-                          gnc_currency_changed_cb, NULL);
-    gnc_prefs_register_cb(GNC_PREFS_GROUP_GENERAL_REPORT, GNC_PREF_CURRENCY_OTHER,
-                          gnc_currency_changed_cb, NULL);
-    gnc_prefs_register_cb(GNC_PREFS_GROUP_GENERAL, GNC_PREF_AUTO_DECIMAL_POINT,
-                          gnc_set_auto_decimal_enabled, NULL);
-    gnc_prefs_register_cb(GNC_PREFS_GROUP_GENERAL, GNC_PREF_AUTO_DECIMAL_PLACES,
-                          gnc_set_auto_decimal_places, NULL);
-
-}
diff --git a/src/app-utils/test/CMakeLists.txt b/src/app-utils/test/CMakeLists.txt
deleted file mode 100644
index 43b4cbb..0000000
--- a/src/app-utils/test/CMakeLists.txt
+++ /dev/null
@@ -1,37 +0,0 @@
-
-SET(APP_UTILS_TEST_INCLUDE_DIRS
-  ${CMAKE_SOURCE_DIR}/src/app-utils
-  ${CMAKE_SOURCE_DIR}/src/test-core
-  ${CMAKE_SOURCE_DIR}/src/engine # for qof.h
-  ${CMAKE_SOURCE_DIR}/src/engine/test-core
-  ${CMAKE_BINARY_DIR}/src # for config.h
-  ${GIO_INCLUDE_DIRS}
-  ${GUILE_INCLUDE_DIRS}
-)
-
-SET(APP_UTILS_TEST_LIBS gncmod-app-utils gncmod-test-engine test-core ${GIO_LDFLAGS} ${GUILE_LDFLAGS})
-
-SET(test_app_utils_SOURCES test-app-utils.c test-option-util.cpp test-gnc-ui-util.c)
-
-MACRO(ADD_APP_UTILS_TEST _TARGET _SOURCE_FILES)
-  GNC_ADD_TEST(${_TARGET} "${_SOURCE_FILES}" APP_UTILS_TEST_INCLUDE_DIRS APP_UTILS_TEST_LIBS)
-ENDMACRO()
-
-ADD_APP_UTILS_TEST(test-exp-parser test-exp-parser.c)
-GNC_ADD_TEST_WITH_GUILE(test-link-module test-link-module APP_UTILS_TEST_INCLUDE_DIRS APP_UTILS_TEST_LIBS)
-ADD_APP_UTILS_TEST(test-print-parse-amount test-print-parse-amount.cpp)
-# This test not run in autotools build.
-#GNC_ADD_TEST_WITH_GUILE(test-print-queries test-print-queries.cpp APP_UTILS_TEST_INCLUDE_DIRS APP_UTILS_TEST_LIBS)
-GNC_ADD_TEST_WITH_GUILE(test-scm-query-string test-scm-query-string.cpp
-  APP_UTILS_TEST_INCLUDE_DIRS APP_UTILS_TEST_LIBS
-)
-ADD_APP_UTILS_TEST(test-sx test-sx.cpp)
-
-GNC_ADD_SCHEME_TEST(scm-test-load-module test-load-module.in)
-# Doesn't work yet:
-#ADD_APP_UTILS_TEST(test-app-utils "${test_app_utils_SOURCES}")
-
-CONFIGURE_FILE(test-load-module.in test-load-module @ONLY)
-
-SET_DIST_LIST(test_app_utils_DIST CMakeLists.txt Makefile.am test-exp-parser.c test-link-module.c test-load-module.in
-        test-print-parse-amount.cpp test-print-queries.cpp test-scm-query-string.cpp test-sx.cpp ${test_app_utils_SOURCES})
diff --git a/src/app-utils/test/Makefile.am b/src/app-utils/test/Makefile.am
deleted file mode 100644
index af52d0c..0000000
--- a/src/app-utils/test/Makefile.am
+++ /dev/null
@@ -1,75 +0,0 @@
-include $(top_srcdir)/test-templates/Makefile.decl
-
-check_PROGRAMS = \
-  test-link-module \
-  test-exp-parser \
-  test-scm-query-string \
-  test-print-parse-amount \
-  test-sx \
-  test-app-utils
-
-TESTS =  \
-  test-load-module \
-  ${check_PROGRAMS}
-
-test_scm_query_string_SOURCES = test-scm-query-string.cpp
-test_sx_SOURCES = test-sx.cpp
-test_print_parse_amount_SOURCES = test-print-parse-amount.cpp
-
-GNC_TEST_DEPS = --gnc-module-dir ${top_builddir}/src/engine \
-  --gnc-module-dir ${top_builddir}/src/app-utils \
-  --guile-load-dir ${top_builddir}/src/core-utils \
-  --guile-load-dir ${top_builddir}/src/gnc-module \
-  --guile-load-dir ${top_builddir}/src/engine \
-  --guile-load-dir ${top_builddir}/src/scm \
-  --guile-load-dir ${top_builddir}/src/app-utils \
-  --library-dir    ${top_builddir}/src/core-utils \
-  --library-dir    ${top_builddir}/src/gnc-module \
-  --library-dir    ${top_builddir}/src/engine \
-  --library-dir    ${top_builddir}/src/backend/xml \
-  --library-dir    ${top_builddir}/src/backend/sql \
-  --library-dir    ${top_builddir}/src/app-utils
-
-TESTS_ENVIRONMENT = \
-  GUILE_WARN_DEPRECATED=no \
-  GUILE="${GUILE}" \
-  SRCDIR=${srcdir} \
-  GNC_BUILDDIR="${abs_top_builddir}" \
-  $(shell ${abs_top_srcdir}/src/gnc-test-env.pl --noexports ${GNC_TEST_DEPS})
-
-LDADD = \
-   ${top_builddir}/src/core-utils/libgnc-core-utils.la \
-   ${top_builddir}/src/engine/libgncmod-engine.la \
-   ${top_builddir}/src/gnc-module/libgnc-module.la \
-   ${top_builddir}/src/app-utils/libgncmod-app-utils.la \
-   ${top_builddir}/src/test-core/libtest-core.la \
-   ${top_builddir}/src/engine/test-core/libgncmod-test-engine.la \
-   ${GUILE_LIBS}
-
-EXTRA_DIST += \
-  test-load-module \
-  test-print-queries.cpp \
-  CMakeLists.txt
-
-AM_CPPFLAGS = \
-  -I${top_srcdir}/src \
-  -I${top_srcdir}/src/test-core \
-  -I${top_srcdir}/src/engine \
-  -I${top_srcdir}/src/engine/test-core \
-  -I${top_srcdir}/src/app-utils \
-  -I${top_srcdir}/src/gnc-module \
-  -I${top_srcdir}/src/core-utils \
-  ${GUILE_CFLAGS} \
-  ${GLIB_CFLAGS} \
-  ${BOOST_CPPFLAGS}
-
-test_app_utils_SOURCES = \
-	test-app-utils.c \
-	test-option-util.cpp \
-	test-gnc-ui-util.c
-
-test_app_utils_CXXFLAGS = \
-	${DEFAULT_INCLUDES} \
-	-I${top_srcdir}/${MODULEPATH}/ \
-	-DTESTPROG=test_app_utils \
-	${GLIB_CFLAGS}
diff --git a/src/backend/dbi/CMakeLists.txt b/src/backend/dbi/CMakeLists.txt
deleted file mode 100644
index f8028bd..0000000
--- a/src/backend/dbi/CMakeLists.txt
+++ /dev/null
@@ -1,47 +0,0 @@
-# CMakeLists.txt for src/backend/dbi
-
-ADD_SUBDIRECTORY(test)
-
-# Source file gncmod-backend-dbi.c does not appear to be use in Makefile.in, so not included here.
-
-SET (backend_dbi_SOURCES
-  gnc-backend-dbi.cpp
-  gnc-dbisqlresult.cpp
-  gnc-dbisqlconnection.cpp
-)
-SET (backend_dbi_noinst_HEADERS
-  gnc-backend-dbi.h
-  gnc-backend-dbi.hpp
-  gnc-dbisqlresult.hpp
-  gnc-dbisqlconnection.hpp
-  gnc-dbiprovider.hpp
-  gnc-dbiproviderimpl.hpp
-)
-
-SET_LOCAL_DIST(backend_dbi_DIST_local
-        ${backend_dbi_SOURCES} ${backend_dbi_noinst_HEADERS} CMakeLists.txt Makefile.am)
-SET(backend_dbi_DIST ${backend_dbi_DIST_local} ${test_dbi_backend_DIST} PARENT_SCOPE)
-
-# Add dependency on config.h
-SET_SOURCE_FILES_PROPERTIES (${backend_dbi_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
-
-ADD_LIBRARY	(gncmod-backend-dbi
-  ${backend_dbi_SOURCES}
-  ${backend_dbi_noinst_HEADERS}
-)
-
-SET(WINSOCK_LIB "")
-IF(MINGW64)
-  SET(WINSOCK_LIB "-lws2_32")
-ENDIF(MINGW64)
-TARGET_LINK_LIBRARIES(gncmod-backend-dbi gnc-backend-sql gncmod-engine ${GTK2_LDFLAGS} ${Boost_REGEX_LIBRARY} ${LIBDBI_LIBRARY} ${WINSOCK_LIB})
-
-TARGET_COMPILE_DEFINITIONS(gncmod-backend-dbi PRIVATE -DG_LOG_DOMAIN=\"gnc.backend.dbi\")
-
-TARGET_INCLUDE_DIRECTORIES(gncmod-backend-dbi PRIVATE ${LIBDBI_INCLUDE_PATH})
-
-INSTALL(TARGETS gncmod-backend-dbi
-  LIBRARY DESTINATION lib/gnucash
-  ARCHIVE DESTINATION lib/gnucash
-  RUNTIME DESTINATION bin)
-# No headers to install
diff --git a/src/backend/dbi/Makefile.am b/src/backend/dbi/Makefile.am
deleted file mode 100644
index 86ecc90..0000000
--- a/src/backend/dbi/Makefile.am
+++ /dev/null
@@ -1,46 +0,0 @@
-SUBDIRS = . test
-
-# Now a shared library AND a GModule
-pkglib_LTLIBRARIES = libgncmod-backend-dbi.la
-
-
-# "${top_srcdir}/src/debug" below is for the splint header
-AM_CPPFLAGS = \
-  -I.. -I../.. \
-  -DLOCALE_DIR=\""$(datadir)/locale"\" \
-  -I${top_srcdir}/src/backend \
-  -I${top_srcdir}/src/backend/sql \
-  -I${top_srcdir}/src/debug \
-  -I${top_srcdir}/src/engine \
-  -I${top_srcdir}/src/core-utils \
-  -I${top_srcdir}/lib/libc \
-  -I${top_srcdir}/src \
-  ${GLIB_CFLAGS} \
-  ${BOOST_CPPFLAGS} \
-  ${WARN_CFLAGS}
-
-libgncmod_backend_dbi_la_SOURCES = \
-  gnc-backend-dbi.cpp \
-  gnc-dbisqlconnection.cpp \
-  gnc-dbisqlresult.cpp
-
-noinst_HEADERS = \
-  gnc-backend-dbi.h \
-  gnc-backend-dbi.hpp \
-  gnc-dbisqlconnection.hpp \
-  gnc-dbisqlresult.hpp \
-  gnc-dbiprovider.hpp \
-  gnc-dbiproviderimpl.hpp
-
-libgncmod_backend_dbi_la_LDFLAGS = -shared -avoid-version
-libgncmod_backend_dbi_la_LIBADD = \
-   ${GLIB_LIBS} \
-   ${top_builddir}/src/backend/sql/libgnc-backend-sql.la \
-   ${top_builddir}/src/engine/libgncmod-engine.la \
-   ${top_builddir}/src/core-utils/libgnc-core-utils.la \
-   ${BOOST_LDFLAGS} -lboost_regex \
-   ${LIBDBI_LIBS}
-
-AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.backend.dbi\"
-
-EXTRA_DIST = CMakeLists.txt
diff --git a/src/backend/dbi/test/CMakeLists.txt b/src/backend/dbi/test/CMakeLists.txt
deleted file mode 100644
index 637519b..0000000
--- a/src/backend/dbi/test/CMakeLists.txt
+++ /dev/null
@@ -1,40 +0,0 @@
-
-SET(BACKEND_DBI_TEST_INCLUDE_DIRS
-  ${CMAKE_BINARY_DIR}/src # for config.h
-  ${CMAKE_SOURCE_DIR}/src/core-utils
-  ${CMAKE_SOURCE_DIR}/src/backend/dbi/test
-  ${CMAKE_SOURCE_DIR}/src/backend/sql
-  ${CMAKE_SOURCE_DIR}/src/engine
-  ${CMAKE_SOURCE_DIR}/src/engine/test-core
-  ${CMAKE_SOURCE_DIR}/src/test-core
-  ${LIBDBI_INCLUDE_PATH}
-  ${GLIB2_INCLUDE_DIRS}
-)
-SET(BACKEND_DBI_TEST_LIBS gnc-backend-sql gncmod-engine gncmod-test-engine test-core ${Boost_REGEX_LIBRARY} ${LIBDBI_LIBRARY})
-
-SET(test_dbi_backend_SOURCES
-  test-backend-dbi.cpp
-  test-backend-dbi-basic.cpp
-  test-dbi-business-stuff.cpp
-  test-dbi-stuff.cpp
-  ../gnc-backend-dbi.cpp
-  ../gnc-dbisqlconnection.cpp
-  ../gnc-dbisqlresult.cpp
-)
-
-SET(test_dbi_backend_HEADERS test-dbi-business-stuff.h test-dbi-stuff.h)
-
-SET_DIST_LIST(test_dbi_backend_DIST ${test_dbi_backend_SOURCES} ${test_dbi_backend_HEADERS} test-dbi.xml CMakeLists.txt Makefile.am)
-
-# This test does not work on Win32
-IF (NOT WIN32)
-  GNC_ADD_TEST(test-backend-dbi "${test_dbi_backend_SOURCES}"
-    BACKEND_DBI_TEST_INCLUDE_DIRS BACKEND_DBI_TEST_LIBS
-  )
-
-  TARGET_COMPILE_DEFINITIONS(test-backend-dbi PRIVATE
-    TEST_MYSQL_URL=\"${TEST_MYSQL_URL}\"
-    TEST_PGSQL_URL=\"${TEST_PGSQL_URL}\"
-    DBI_TEST_XML_FILENAME=\"${CMAKE_CURRENT_SOURCE_DIR}/test-dbi.xml\"
-  )
-ENDIF()
diff --git a/src/backend/dbi/test/Makefile.am b/src/backend/dbi/test/Makefile.am
deleted file mode 100644
index 13e52cb..0000000
--- a/src/backend/dbi/test/Makefile.am
+++ /dev/null
@@ -1,81 +0,0 @@
-# Makefile.am for src/backend/dbi/test
-
-include $(top_srcdir)/test-templates/Makefile.decl
-
-AM_CPPFLAGS = \
-  -I${top_srcdir}/lib/libc \
-  -I${top_srcdir}/src \
-  -I${top_srcdir}/src/core-utils \
-  -I${top_srcdir}/src/gnc-module \
-  -I${top_srcdir}/src/test-core \
-  -I${top_srcdir}/src/engine \
-  -I${top_srcdir}/src/engine/test-core \
-  -I${top_srcdir}/src/backend/sql \
-  -DTEST_MYSQL_URL=\"${TEST_MYSQL_URL}\" \
-  -DTEST_PGSQL_URL=\"${TEST_PGSQL_URL}\" \
-  ${GLIB_CFLAGS} \
-  ${GUILE_CFLAGS} \
-  ${BOOST_CPPFLAGS}
-
-LDADD = ${top_builddir}/src/test-core/libtest-core.la \
-        ${top_builddir}/src/gnc-module/libgnc-module.la \
-        ${top_builddir}/src/engine/libgncmod-engine.la \
-        ${top_builddir}/src/engine/test-core/libgncmod-test-engine.la \
-        ${top_builddir}/src/core-utils/libgnc-core-utils.la \
-        ${top_builddir}/src/backend/sql/libgnc-backend-sql.la \
-        ${top_builddir}/src/backend/xml/libgnc-backend-xml-utils.la \
-        ${top_builddir}/lib/libc/libc-missing.la
-
-GNC_TEST_DEPS = \
-  --gnc-module-dir ${top_builddir}/src/engine \
-  --guile-load-dir ${top_builddir}/src/engine \
-  --library-dir    ${top_builddir}/src/core-utils \
-  --library-dir    ${top_builddir}/src/gnc-module \
-  --library-dir    ${top_builddir}/src/engine \
-  --library-dir    ${top_builddir}/src/backend/xml
-
-TESTS_ENVIRONMENT = \
-  GNC_BUILDDIR=${abs_top_builddir} \
-  GNC_ACCOUNT_PATH=${top_srcdir}/accounts/C \
-  SRCDIR=${srcdir} \
-  ${gnc_dbd_dir_override} \
-  $(shell ${abs_top_srcdir}/src/gnc-test-env.pl --noexports ${GNC_TEST_DEPS})
-
-EXTRA_DIST += \
-    test-dbi-stuff.h \
-    test-dbi-business-stuff.h \
-    test-dbi.xml \
-    CMakeLists.txt
-
-check_PROGRAMS = test-backend-dbi
-
-TESTS = ${check_PROGRAMS}
-
-if CUSTOM_GNC_DBD_DIR
-gnc_dbd_dir_override = GNC_DBD_DIR="@GNC_DBD_DIR@"
-endif
-
-test_backend_dbi_SOURCES = \
-    test-backend-dbi.cpp \
-    test-backend-dbi-basic.cpp \
-    test-dbi-stuff.cpp \
-    test-dbi-business-stuff.cpp \
-    ../gnc-dbisqlconnection.cpp \
-    ../gnc-backend-dbi.cpp \
-    ../gnc-dbisqlresult.cpp
-
-test_backend_dbi_CPPFLAGS = \
-	-DDBI_TEST_XML_FILENAME=\"${srcdir}/test-dbi.xml\" \
-	${AM_CPPFLAGS}
-
-test_backend_dbi_LDADD = \
-    ${BOOST_LDFLAGS} -lboost_regex \
-    ${LIBDBI_LIBS} \
-    ${LDADD}
-
-AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.backend.dbi\"
-
-# If you let make run parallel builds it complains that there is no rule to make
-# libgncmod-test-dbi.la.  This is wrong, but I can't figure out how to fix it
-# so I'll turn off parallel builds
-#.NOTPARALLEL:
diff --git a/src/backend/sql/CMakeLists.txt b/src/backend/sql/CMakeLists.txt
deleted file mode 100644
index 89d06d9..0000000
--- a/src/backend/sql/CMakeLists.txt
+++ /dev/null
@@ -1,83 +0,0 @@
-# CMakeLists.txt for src/backend/dbi
-
-ADD_SUBDIRECTORY(test)
-
-SET (backend_sql_SOURCES
-  gnc-account-sql.cpp
-  gnc-address-sql.cpp
-  gnc-bill-term-sql.cpp
-  gnc-book-sql.cpp
-  gnc-budget-sql.cpp
-  gnc-commodity-sql.cpp
-  gnc-customer-sql.cpp
-  gnc-employee-sql.cpp
-  gnc-entry-sql.cpp
-  gnc-invoice-sql.cpp
-  gnc-job-sql.cpp
-  gnc-lots-sql.cpp
-  gnc-order-sql.cpp
-  gnc-owner-sql.cpp
-  gnc-price-sql.cpp
-  gnc-recurrence-sql.cpp
-  gnc-schedxaction-sql.cpp
-  gnc-slots-sql.cpp
-  gnc-tax-table-sql.cpp
-  gnc-transaction-sql.cpp
-  gnc-vendor-sql.cpp
-  gnc-sql-backend.cpp
-  gnc-sql-result.cpp
-  gnc-sql-column-table-entry.cpp
-  gnc-sql-object-backend.cpp
-  escape.cpp
-)
-SET (backend_sql_noinst_HEADERS
-  gnc-account-sql.h
-  gnc-bill-term-sql.h
-  gnc-book-sql.h
-  gnc-budget-sql.h
-  gnc-commodity-sql.h
-  gnc-customer-sql.h
-  gnc-employee-sql.h
-  gnc-entry-sql.h
-  gnc-invoice-sql.h
-  gnc-job-sql.h
-  gnc-lots-sql.h
-  gnc-order-sql.h
-  gnc-price-sql.h
-  gnc-recurrence-sql.h
-  gnc-schedxaction-sql.h
-  gnc-slots-sql.h
-  gnc-tax-table-sql.h
-  gnc-transaction-sql.h
-  gnc-vendor-sql.h
-  gnc-sql-backend.hpp
-  gnc-sql-connection.hpp
-  gnc-sql-result.hpp
-  gnc-sql-column-table-entry.hpp
-  gnc-sql-object-backend.hpp
-  escape.h
-)
-
-SET_LOCAL_DIST(backend_sql_DIST_local ${backend_sql_SOURCES} ${backend_sql_noinst_HEADERS} CMakeLists.txt Makefile.am)
-SET(backend_sql_DIST ${backend_sql_DIST_local} ${test_backend_sql_DIST} PARENT_SCOPE)
-
-# Add dependency on config.h
-SET_SOURCE_FILES_PROPERTIES (${gnc_backend_sql_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
-
-ADD_LIBRARY	(gnc-backend-sql
-  ${backend_sql_SOURCES}
-  ${backend_sql_noinst_HEADERS}
-)
-
-TARGET_LINK_LIBRARIES(gnc-backend-sql gncmod-engine)
-
-TARGET_COMPILE_DEFINITIONS (gnc-backend-sql PRIVATE -DG_LOG_DOMAIN=\"gnc.backend.sql\")
-
-TARGET_INCLUDE_DIRECTORIES(gnc-backend-sql PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
-
-INSTALL(TARGETS gnc-backend-sql
-  LIBRARY DESTINATION lib
-  ARCHIVE DESTINATION lib
-  RUNTIME DESTINATION bin)
-
-# No headers to install
diff --git a/src/backend/sql/Makefile.am b/src/backend/sql/Makefile.am
deleted file mode 100644
index 07c26d8..0000000
--- a/src/backend/sql/Makefile.am
+++ /dev/null
@@ -1,84 +0,0 @@
-include $(top_srcdir)/test-templates/Makefile.decl
-SUBDIRS = . test
-TEST_SUBDIRS = test
-
-# Now a shared library AND a GModule
-lib_LTLIBRARIES = libgnc-backend-sql.la
-
-# "${top_srcdir}/src/debug" below is for the splint header
-AM_CPPFLAGS = \
-  -I.. -I../.. \
-  -DLOCALE_DIR=\""$(datadir)/locale"\" \
-  -I${top_srcdir}/src/backend \
-  -I${top_srcdir}/src/debug \
-  -I${top_srcdir}/src/engine \
-  -I${top_srcdir}/src/core-utils\
-  -I${top_srcdir}/lib/libc\
-  ${GLIB_CFLAGS} \
-  ${GUILE_CFLAGS} \
-  ${WARN_CFLAGS} \
-  ${BOOST_CPPFLAGS}
-
-libgnc_backend_sql_la_SOURCES = \
-  gnc-account-sql.cpp \
-  gnc-address-sql.cpp \
-  gnc-bill-term-sql.cpp \
-  gnc-book-sql.cpp \
-  gnc-budget-sql.cpp \
-  gnc-commodity-sql.cpp \
-  gnc-customer-sql.cpp \
-  gnc-employee-sql.cpp \
-  gnc-entry-sql.cpp \
-  gnc-invoice-sql.cpp \
-  gnc-job-sql.cpp \
-  gnc-lots-sql.cpp \
-  gnc-order-sql.cpp \
-  gnc-owner-sql.cpp \
-  gnc-price-sql.cpp \
-  gnc-recurrence-sql.cpp \
-  gnc-schedxaction-sql.cpp \
-  gnc-slots-sql.cpp \
-  gnc-tax-table-sql.cpp \
-  gnc-transaction-sql.cpp \
-  gnc-vendor-sql.cpp \
-  gnc-sql-backend.cpp \
-  gnc-sql-result.cpp \
-  gnc-sql-column-table-entry.cpp \
-  gnc-sql-object-backend.cpp \
-  escape.cpp
-
-noinst_HEADERS = \
-  gnc-account-sql.h \
-  gnc-bill-term-sql.h \
-  gnc-book-sql.h \
-  gnc-budget-sql.h \
-  gnc-commodity-sql.h \
-  gnc-customer-sql.h \
-  gnc-employee-sql.h \
-  gnc-entry-sql.h \
-  gnc-invoice-sql.h \
-  gnc-job-sql.h \
-  gnc-lots-sql.h \
-  gnc-order-sql.h \
-  gnc-price-sql.h \
-  gnc-recurrence-sql.h \
-  gnc-schedxaction-sql.h \
-  gnc-slots-sql.h \
-  gnc-tax-table-sql.h \
-  gnc-transaction-sql.h \
-  gnc-vendor-sql.h \
-  gnc-sql-backend.hpp \
-  gnc-sql-connection.hpp \
-  gnc-sql-result.hpp \
-  gnc-sql-column-table-entry.hpp \
-  gnc-sql-object-backend.hpp \
-  escape.h
-
-libgnc_backend_sql_la_LIBADD = \
-   ${GLIB_LIBS} \
-   ${GUILE_LIBS} \
-   ${top_builddir}/src/engine/libgncmod-engine.la
-
-AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.backend.sql\"
-
-EXTRA_DIST += CMakeLists.txt
diff --git a/src/backend/sql/test/CMakeLists.txt b/src/backend/sql/test/CMakeLists.txt
deleted file mode 100644
index 545487c..0000000
--- a/src/backend/sql/test/CMakeLists.txt
+++ /dev/null
@@ -1,25 +0,0 @@
-
-SET(BACKEND_SQL_TEST_INCLUDE_DIRS
-  ${CMAKE_BINARY_DIR}/src # for config.h
-  ${CMAKE_SOURCE_DIR}/src/backend/sql
-  ${CMAKE_SOURCE_DIR}/src/engine
-  ${CMAKE_SOURCE_DIR}/src/test-core
-  ${GLIB2_INCLUDE_DIRS}
-)
-
-SET(test_backend_sql_SOURCES test-sqlbe.cpp utest-gnc-backend-sql.cpp)
-
-SET(BACKEND_SQL_TEST_LIBS gnc-backend-sql gncmod-engine test-core)
-
-SET_DIST_LIST(test_backend_sql_DIST ${test_backend_sql_SOURCES} CMakeLists.txt
-  Makefile.am test-column-types.cpp)
-
-# This test does not actually do anything.
-GNC_ADD_TEST(test-column-types test-column-types.cpp
-   BACKEND_SQL_TEST_INCLUDE_DIRS BACKEND_SQL_TEST_LIBS
-)
-
-GNC_ADD_TEST(test-sqlbe "${test_backend_sql_SOURCES}"
-   BACKEND_SQL_TEST_INCLUDE_DIRS BACKEND_SQL_TEST_LIBS
-)
-TARGET_COMPILE_DEFINITIONS(test-sqlbe PRIVATE TESTPROG=test_sqlbe)
diff --git a/src/backend/sql/test/Makefile.am b/src/backend/sql/test/Makefile.am
deleted file mode 100644
index 8ec28ad..0000000
--- a/src/backend/sql/test/Makefile.am
+++ /dev/null
@@ -1,72 +0,0 @@
-SUBDIRS = .
-
-include $(top_srcdir)/test-templates/Makefile.decl
-MODULEPATH = src/backend/sql
-
-test_column_types_SOURCES = \
-  test-column-types.cpp
-
-check_PROGRAMS = \
-  test-column-types \
-  test-sqlbe
-
-TESTS = ${check_PROGRAMS}
-
-GNC_TEST_DEPS = \
-  --gnc-module-dir ${top_builddir}/src/engine \
-  --guile-load-dir ${top_builddir}/src/engine \
-  --library-dir    ${top_builddir}/src/core-utils \
-  --library-dir    ${top_builddir}/src/gnc-module \
-  --library-dir    ${top_builddir}/src/engine \
-  --library-dir    ${top_builddir}/src/backend/sql
-
-TESTS_ENVIRONMENT = \
-  GNC_ACCOUNT_PATH=${top_srcdir}/accounts/C \
-  SRCDIR=${srcdir} \
-  $(shell ${abs_top_srcdir}/src/gnc-test-env.pl --noexports ${GNC_TEST_DEPS})
-
-LDADD = ${top_builddir}/src/test-core/libtest-core.la \
-        ${top_builddir}/src/gnc-module/libgnc-module.la \
-        ${top_builddir}/src/backend/sql/libgnc-backend-sql.la \
-        ${top_builddir}/src/engine/libgncmod-engine.la \
-        ${top_builddir}/src/engine/test-core/libgncmod-test-engine.la \
-        ${top_builddir}/src/core-utils/libgnc-core-utils.la \
-        ${top_builddir}/lib/libc/libc-missing.la
-
-AM_CPPFLAGS = \
-  -I${top_srcdir}/lib/libc \
-  -I${top_srcdir}/src \
-  -I${top_srcdir}/src/core-utils \
-  -I${top_srcdir}/src/gnc-module \
-  -I${top_srcdir}/src/test-core \
-  -I${top_srcdir}/src/engine \
-  -I${top_srcdir}/src/engine/test-core \
-  -I${top_srcdir}/src/backend/sql \
-  ${GLIB_CFLAGS} \
-  ${GUILE_CFLAGS}
-
-AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.backend.sql\"
-
-#test_sqlbedir = ${top_srcdir}/${MODULEPATH}/test
-
-test_sqlbe_SOURCES = \
-	test-sqlbe.cpp \
-	utest-gnc-backend-sql.cpp
-
-test_sqlbe_LDADD = \
-	$(top_builddir)/$(MODULEPATH)/libgnc-backend-sql.la \
-	$(top_builddir)/src/engine/libgncmod-engine.la \
-	$(top_builddir)/src/test-core/libtest-core.la \
-	$(top_builddir)/src/core-utils/libgnc-core-utils.la \
-	$(GLIB_LIBS)
-
-test_sqlbe_CFLAGS = \
-	-DTESTPROG=test_sqlbe \
-	$(DEFAULT_INCLUDES) \
-	-I$(top_srcdir)/$(MODULEPATH)/ \
-	-I$(top_srcdir)/src/backend/dbi/ \
-	-I$(top_srcdir)/src/engine/ \
-	-I$(top_srcdir)/src/test-core/ \
-	$(GLIB_CFLAGS)
-
-EXTRA_DIST += CMakeLists.txt
diff --git a/src/backend/xml/CMakeLists.txt b/src/backend/xml/CMakeLists.txt
deleted file mode 100644
index fa10ebd..0000000
--- a/src/backend/xml/CMakeLists.txt
+++ /dev/null
@@ -1,129 +0,0 @@
-# CMakeLists.txt for src/backend/xml
-
-ADD_SUBDIRECTORY(test)
-
-SET (backend_xml_utils_noinst_HEADERS
-  gnc-backend-xml.h
-  gnc-xml.h
-  gnc-address-xml-v2.h
-  gnc-bill-term-xml-v2.h
-  gnc-customer-xml-v2.h
-  gnc-employee-xml-v2.h
-  gnc-entry-xml-v2.h
-  gnc-invoice-xml-v2.h
-  gnc-job-xml-v2.h
-  gnc-order-xml-v2.h
-  gnc-owner-xml-v2.h
-  gnc-tax-table-xml-v2.h
-  gnc-vendor-xml-v2.h
-  gnc-xml-backend.hpp
-  gnc-xml-helper.h
-  io-example-account.h
-  io-gncxml-gen.h
-  io-gncxml-v2.h
-  io-gncxml.h
-  io-utils.h
-  sixtp-dom-generators.h
-  sixtp-dom-parsers.h
-  sixtp-parsers.h
-  sixtp-stack.h
-  sixtp-utils.h
-  sixtp.h
-  xml-helpers.h
-)
-
-SET (backend_xml_utils_SOURCES
-  gnc-account-xml-v2.cpp
-  gnc-address-xml-v2.cpp
-  gnc-bill-term-xml-v2.cpp
-  gnc-book-xml-v2.cpp
-  gnc-budget-xml-v2.cpp
-  gnc-commodity-xml-v2.cpp
-  gnc-customer-xml-v2.cpp
-  gnc-employee-xml-v2.cpp
-  gnc-entry-xml-v2.cpp
-  gnc-freqspec-xml-v2.cpp
-  gnc-invoice-xml-v2.cpp
-  gnc-job-xml-v2.cpp
-  gnc-lot-xml-v2.cpp
-  gnc-order-xml-v2.cpp
-  gnc-owner-xml-v2.cpp
-  gnc-pricedb-xml-v2.cpp
-  gnc-recurrence-xml-v2.cpp
-  gnc-schedxaction-xml-v2.cpp
-  gnc-tax-table-xml-v2.cpp
-  gnc-transaction-xml-v2.cpp
-  gnc-vendor-xml-v2.cpp
-  gnc-xml-backend.cpp
-  gnc-xml-helper.cpp
-  io-example-account.cpp
-  io-gncxml-gen.cpp
-  io-gncxml-v1.cpp
-  io-gncxml-v2.cpp
-  io-utils.cpp
-  sixtp-dom-generators.cpp
-  sixtp-dom-parsers.cpp
-  sixtp-stack.cpp
-  sixtp-to-dom-parser.cpp
-  sixtp-utils.cpp
-  sixtp.cpp
-)
-
-SET_LOCAL_DIST(backend_xml_DIST_local ${backend_xml_utils_SOURCES}
-  ${backend_xml_utils_noinst_HEADERS} gnc-backend-xml.cpp CMakeLists.txt
-  Makefile.am)
-SET(backend_xml_DIST ${backend_xml_DIST_local} ${test_backend_xml_DIST} PARENT_SCOPE)
-
-# Add dependency on config.h
-SET_SOURCE_FILES_PROPERTIES (${backend_xml_utils_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
-
-ADD_LIBRARY	(gnc-backend-xml-utils
-  ${backend_xml_utils_SOURCES}
-  ${backend_xml_utils_noinst_HEADERS}
-)
-
-TARGET_LINK_LIBRARIES(gnc-backend-xml-utils gncmod-engine ${LIBXML2_LDFLAGS} ${ZLIB_LDFLAGS})
-
-TARGET_INCLUDE_DIRECTORIES (gnc-backend-xml-utils
-  PUBLIC  ${LIBXML2_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}
-  PRIVATE ${ZLIB_INCLUDE_DIRS}
-)
-
-TARGET_COMPILE_DEFINITIONS (gnc-backend-xml-utils PRIVATE -DG_LOG_DOMAIN=\"gnc.backend.xml\" -DU_SHOW_CPLUSPLUS_API=0)
-
-INSTALL(TARGETS gnc-backend-xml-utils
-  LIBRARY DESTINATION lib
-  ARCHIVE DESTINATION lib
-  RUNTIME DESTINATION bin)
-# No headers to install
-
-# ----
-
-SET(libgncmod_backend_xml_SOURCES gnc-backend-xml.cpp)
-
-SET_SOURCE_FILES_PROPERTIES (${libgncmod_backend_xml_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
-
-ADD_LIBRARY(gncmod-backend-xml MODULE ${libgncmod_backend_xml_SOURCES})
-TARGET_LINK_LIBRARIES(gncmod-backend-xml gnc-backend-xml-utils gncmod-engine
-                        gnc-core-utils ${LIBXML2_LDFLAGS} ${GLIB2_LDFLAGS} ${ZLIB_LIBRARY})
-
-TARGET_COMPILE_DEFINITIONS (gncmod-backend-xml PRIVATE -DG_LOG_DOMAIN=\"gnc.backend.xml\" -DU_SHOW_CPLUSPLUS_API=0)
-
-SET(LIB_DIR lib/gnucash)
-IF (WIN32)
-  SET(LIB_DIR bin)
-ENDIF(WIN32)
-
-
-INSTALL(TARGETS gncmod-backend-xml
-  LIBRARY DESTINATION ${LIB_DIR}
-  ARCHIVE DESTINATION ${LIB_DIR}
-  RUNTIME DESTINATION bin)
-
-# ----
-
-# Special normal (non-MODULE) library for cutecash only
-ADD_LIBRARY(gncmod-backend-xml-utils ${libgncmod_backend_xml_SOURCES})
-TARGET_LINK_LIBRARIES(gncmod-backend-xml-utils gnc-backend-xml-utils gncmod-engine
-                        gnc-core-utils ${LIBXML2_LDFLAGS} ${GLIB2_LDFLAGS} ${ZLIB_LIBRARY})
-TARGET_COMPILE_DEFINITIONS (gncmod-backend-xml-utils PRIVATE -DG_LOG_DOMAIN=\"gnc.backend.xml\" -DU_SHOW_CPLUSPLUS_API=0)
diff --git a/src/backend/xml/Makefile.am b/src/backend/xml/Makefile.am
deleted file mode 100644
index eb58ca3..0000000
--- a/src/backend/xml/Makefile.am
+++ /dev/null
@@ -1,107 +0,0 @@
-SUBDIRS = . test
-
-# Now a shared library AND a GModule
-lib_LTLIBRARIES = libgnc-backend-xml-utils.la
-pkglib_LTLIBRARIES = libgncmod-backend-xml.la
-
-AM_CPPFLAGS = \
-  -I.. -I../.. \
-  -DLOCALE_DIR=\""$(datadir)/locale"\" \
-  -DU_SHOW_CPLUSPLUS_API=0 \
-  -I${top_srcdir}/src/backend \
-  -I${top_srcdir}/src/engine \
-  -I${top_srcdir}/src/core-utils \
-  -I${top_srcdir}/src/gnc-module \
-  -I${top_srcdir}/lib/libc\
-  -I$(top_srcdir)/src \
-  ${LIBXML2_CFLAGS} \
-  ${GLIB_CFLAGS} \
-  ${BOOST_CPPFLAGS}
-
-libgnc_backend_xml_utils_la_SOURCES = \
-  gnc-account-xml-v2.cpp \
-  gnc-address-xml-v2.cpp \
-  gnc-bill-term-xml-v2.cpp \
-  gnc-book-xml-v2.cpp \
-  gnc-budget-xml-v2.cpp \
-  gnc-commodity-xml-v2.cpp \
-  gnc-customer-xml-v2.cpp \
-  gnc-employee-xml-v2.cpp \
-  gnc-entry-xml-v2.cpp \
-  gnc-freqspec-xml-v2.cpp \
-  gnc-invoice-xml-v2.cpp \
-  gnc-job-xml-v2.cpp \
-  gnc-lot-xml-v2.cpp \
-  gnc-order-xml-v2.cpp \
-  gnc-owner-xml-v2.cpp \
-  gnc-pricedb-xml-v2.cpp \
-  gnc-recurrence-xml-v2.cpp \
-  gnc-schedxaction-xml-v2.cpp \
-  gnc-tax-table-xml-v2.cpp \
-  gnc-transaction-xml-v2.cpp \
-  gnc-vendor-xml-v2.cpp \
-  gnc-xml-backend.cpp \
-  gnc-xml-helper.cpp \
-  io-example-account.cpp \
-  io-gncxml-gen.cpp \
-  io-gncxml-v1.cpp \
-  io-gncxml-v2.cpp \
-  io-utils.cpp \
-  sixtp-dom-generators.cpp \
-  sixtp-dom-parsers.cpp \
-  sixtp-stack.cpp \
-  sixtp-to-dom-parser.cpp \
-  sixtp-utils.cpp \
-  sixtp.cpp
-
-libgncmod_backend_xml_la_SOURCES = \
-  gnc-backend-xml.cpp
-
-noinst_HEADERS = \
-  gnc-backend-xml.h \
-  gnc-xml.h \
-  gnc-address-xml-v2.h \
-  gnc-bill-term-xml-v2.h \
-  gnc-customer-xml-v2.h \
-  gnc-employee-xml-v2.h \
-  gnc-entry-xml-v2.h \
-  gnc-invoice-xml-v2.h \
-  gnc-job-xml-v2.h \
-  gnc-order-xml-v2.h \
-  gnc-owner-xml-v2.h \
-  gnc-tax-table-xml-v2.h \
-  gnc-vendor-xml-v2.h \
-  gnc-xml-backend.hpp \
-  gnc-xml-helper.h \
-  io-example-account.h \
-  io-gncxml-gen.h \
-  io-gncxml-v2.h \
-  io-gncxml.h \
-  io-utils.h \
-  sixtp-dom-generators.h \
-  sixtp-dom-parsers.h \
-  sixtp-parsers.h \
-  sixtp-stack.h \
-  sixtp-utils.h \
-  sixtp.h \
-  xml-helpers.h
-
-libgnc_backend_xml_utils_la_LIBADD = \
-   ${GLIB_LIBS} \
-   ${LIBXML2_LIBS} \
-   ${ZLIB_LIBS} \
-   ${top_builddir}/src/engine/libgncmod-engine.la \
-   ${top_builddir}/src/core-utils/libgnc-core-utils.la
-
-libgncmod_backend_xml_la_LDFLAGS = -module -avoid-version
-libgncmod_backend_xml_la_LIBADD = \
-   ${GLIB_LIBS} \
-   ${LIBXML2_LIBS} \
-   ${ZLIB_LIBS} \
-   ${top_builddir}/src/engine/libgncmod-engine.la \
-   ${top_builddir}/src/core-utils/libgnc-core-utils.la \
-   libgnc-backend-xml-utils.la
-
-AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.backend.xml\"
-
-EXTRA_DIST = CMakeLists.txt
diff --git a/src/backend/xml/test/CMakeLists.txt b/src/backend/xml/test/CMakeLists.txt
deleted file mode 100644
index 62ccb71..0000000
--- a/src/backend/xml/test/CMakeLists.txt
+++ /dev/null
@@ -1,113 +0,0 @@
-# Common stuff
-ADD_SUBDIRECTORY(test-files)
-
-SET(XML_TEST_INCLUDE_DIRS
-  ${CMAKE_SOURCE_DIR}/src/backend/xml
-  ${CMAKE_SOURCE_DIR}/src/backend/xml/test
-  ${CMAKE_SOURCE_DIR}/src/engine
-  ${CMAKE_SOURCE_DIR}/src/engine/test-core
-  ${CMAKE_BINARY_DIR}/src # for config.h
-  ${CMAKE_SOURCE_DIR}/src/test-core  # for unittest-support.h
-  ${GLIB2_INCLUDE_DIRS}
-  ${LIBXML2_INCLUDE_DIRS}
-  ${ZLIB_INCLUDE_DIRS}
-)
-
-
-SET(XML_TEST_LIBS gncmod-engine gncmod-test-engine test-core ${LIBXML2_LDFLAGS} -lz)
-
-FUNCTION(ADD_XML_TEST _TARGET _SOURCE_FILES)
-  GNC_ADD_TEST(${_TARGET} "${_SOURCE_FILES}" XML_TEST_INCLUDE_DIRS XML_TEST_LIBS ${ARGN})
-  TARGET_COMPILE_OPTIONS(${_TARGET} PRIVATE -DU_SHOW_CPLUSPLUS_API=0)
-ENDFUNCTION()
-
-
-################################
-
-SET(test_backend_xml_base_SOURCES
-  ${CMAKE_SOURCE_DIR}/src/backend/xml/sixtp-dom-parsers.cpp
-  ${CMAKE_SOURCE_DIR}/src/backend/xml/sixtp-dom-generators.cpp
-  ${CMAKE_SOURCE_DIR}/src/backend/xml/sixtp-utils.cpp
-  ${CMAKE_SOURCE_DIR}/src/backend/xml/sixtp.cpp
-  ${CMAKE_SOURCE_DIR}/src/backend/xml/sixtp-stack.cpp
-  ${CMAKE_SOURCE_DIR}/src/backend/xml/sixtp-to-dom-parser.cpp
-  ${CMAKE_SOURCE_DIR}/src/backend/xml/gnc-xml-helper.cpp
-)
-
-## the xml backend is now a GModule - this test does
-## not load it as a module and cannot link to it
-## and remain portable.
-
-SET(test_backend_xml_module_SOURCES
-  ${test_backend_xml_base_SOURCES}
-  ${CMAKE_SOURCE_DIR}/src/backend/xml/io-example-account.cpp
-  ${CMAKE_SOURCE_DIR}/src/backend/xml/io-gncxml-gen.cpp
-  ${CMAKE_SOURCE_DIR}/src/backend/xml/io-gncxml-v2.cpp
-  ${CMAKE_SOURCE_DIR}/src/backend/xml/io-utils.cpp
-  ${CMAKE_SOURCE_DIR}/src/backend/xml/gnc-account-xml-v2.cpp
-  ${CMAKE_SOURCE_DIR}/src/backend/xml/gnc-budget-xml-v2.cpp
-  ${CMAKE_SOURCE_DIR}/src/backend/xml/gnc-lot-xml-v2.cpp
-  ${CMAKE_SOURCE_DIR}/src/backend/xml/gnc-recurrence-xml-v2.cpp
-  ${CMAKE_SOURCE_DIR}/src/backend/xml/gnc-schedxaction-xml-v2.cpp
-  ${CMAKE_SOURCE_DIR}/src/backend/xml/gnc-freqspec-xml-v2.cpp
-  ${CMAKE_SOURCE_DIR}/src/backend/xml/gnc-transaction-xml-v2.cpp
-  ${CMAKE_SOURCE_DIR}/src/backend/xml/gnc-commodity-xml-v2.cpp
-  ${CMAKE_SOURCE_DIR}/src/backend/xml/gnc-book-xml-v2.cpp
-  ${CMAKE_SOURCE_DIR}/src/backend/xml/gnc-pricedb-xml-v2.cpp
-)
-
-SET_LOCAL_DIST(test_backend_xml_DIST_local CMakeLists.txt grab-types.pl
-  Makefile.am README test-date-converting.cpp test-dom-converters1.cpp
-  test-dom-parser1.cpp test-file-stuff.cpp test-file-stuff.h test-kvp-frames.cpp
-  test-load-backend.cpp test-load-example-account.cpp  test-load-xml2.cpp
-  test-save-in-lang.cpp test-string-converters.cpp test-xml2-is-file.cpp
-  test-xml-account.cpp test-real-data.sh.in test-xml-commodity.cpp
-  test-xml-pricedb.cpp test-xml-transaction.cpp)
-SET(test_backend_xml_DIST ${test_backend_xml_DIST_local} ${test_backend_xml_test_files_DIST} PARENT_SCOPE)
-
-# The test test-dom-parser1.c is not run by Makefile.am
-
-# This line for autotools
-CONFIGURE_FILE(test-real-data.sh.in test-real-data.sh)
-
-ADD_XML_TEST(test-date-converting "${test_backend_xml_base_SOURCES};test-date-converting.cpp")
-ADD_XML_TEST(test-dom-converters1 "${test_backend_xml_base_SOURCES};test-dom-converters1.cpp")
-ADD_XML_TEST(test-kvp-frames      "${test_backend_xml_base_SOURCES};test-kvp-frames.cpp")
-ADD_XML_TEST(test-load-backend  test-load-backend.cpp)
-ADD_XML_TEST(test-load-xml2 test-load-xml2.cpp
-  GNC_TEST_FILES=${CMAKE_CURRENT_SOURCE_DIR}/test-files/xml2
-)
-# Not run in autotools.
-#ADD_XML_TEST(test-save-in-lang test-save-in-lang.cpp
-#  GNC_TEST_FILES=${CMAKE_CURRENT_SOURCE_DIR}/test-files/xml2
-#)
-
-GNC_ADD_TEST_WITH_GUILE(test-load-example-account
-  "${test_backend_xml_module_SOURCES};test-load-example-account.cpp"
-  XML_TEST_INCLUDE_DIRS XML_TEST_LIBS
-  GNC_ACCOUNT_PATH=${CMAKE_SOURCE_DIR}/accounts/C
-)
-TARGET_COMPILE_OPTIONS(test-load-example-account PRIVATE -DU_SHOW_CPLUSPLUS_API=0)
-ADD_XML_TEST(test-string-converters "${test_backend_xml_base_SOURCES};test-string-converters.cpp")
-ADD_XML_TEST(test-xml-account "${test_backend_xml_module_SOURCES};test-xml-account.cpp;test-file-stuff.cpp")
-ADD_XML_TEST(test-xml-commodity "${test_backend_xml_module_SOURCES};test-xml-commodity.cpp;test-file-stuff.cpp")
-ADD_XML_TEST(test-xml-pricedb "${test_backend_xml_module_SOURCES};test-xml-pricedb.cpp;test-file-stuff.cpp")
-ADD_XML_TEST(test-xml-transaction "${test_backend_xml_module_SOURCES};test-xml-transaction.cpp;test-file-stuff.cpp")
-ADD_XML_TEST(test-xml2-is-file "${test_backend_xml_module_SOURCES};test-xml2-is-file.cpp"
-   GNC_TEST_FILES=${CMAKE_CURRENT_SOURCE_DIR}/test-files/xml2)
-
-SET(CMAKE_COMMAND_TMP "")
-IF (${CMAKE_VERSION} VERSION_GREATER 3.1)
-  SET(CMAKE_COMMAND_TMP ${CMAKE_COMMAND} -E env)
-ENDIF()
-
-SET(test-real-data-env
-  SRCDIR=${CMAKE_CURRENT_SOURCE_DIR}
-  VERBOSE=yes
-  TEST_PATH=${CMAKE_BINARY_DIR}/bin
-)
-ADD_TEST(NAME test-real-data
-   COMMAND ${CMAKE_COMMAND_TMP}
-    ${SHELL} ${CMAKE_CURRENT_SOURCE_DIR}/test-real-data.sh.in
-)
-SET_TESTS_PROPERTIES(test-real-data PROPERTIES ENVIRONMENT "${test-real-data-env}")
diff --git a/src/backend/xml/test/Makefile.am b/src/backend/xml/test/Makefile.am
deleted file mode 100644
index 7bebc33..0000000
--- a/src/backend/xml/test/Makefile.am
+++ /dev/null
@@ -1,284 +0,0 @@
-#
-SUBDIRS = test-files
-
-test_date_converting_SOURCES = \
-  ${top_srcdir}/src/backend/xml/sixtp-dom-parsers.cpp \
-  ${top_srcdir}/src/backend/xml/sixtp-dom-generators.cpp \
-  ${top_srcdir}/src/backend/xml/sixtp-utils.cpp \
-  ${top_srcdir}/src/backend/xml/sixtp.cpp \
-  ${top_srcdir}/src/backend/xml/sixtp-stack.cpp \
-  ${top_srcdir}/src/backend/xml/sixtp-to-dom-parser.cpp \
-  ${top_srcdir}/src/backend/xml/gnc-xml-helper.cpp \
-  test-date-converting.cpp
-
-test_dom_converters1_SOURCES = \
-  ${top_srcdir}/src/backend/xml/sixtp-dom-parsers.cpp \
-  ${top_srcdir}/src/backend/xml/sixtp-dom-generators.cpp \
-  ${top_srcdir}/src/backend/xml/sixtp-utils.cpp \
-  ${top_srcdir}/src/backend/xml/sixtp.cpp \
-  ${top_srcdir}/src/backend/xml/sixtp-stack.cpp \
-  ${top_srcdir}/src/backend/xml/sixtp-to-dom-parser.cpp \
-  ${top_srcdir}/src/backend/xml/gnc-xml-helper.cpp \
-  test-dom-converters1.cpp
-
-test_kvp_frames_SOURCES = \
-  ${top_srcdir}/src/backend/xml/sixtp-dom-parsers.cpp \
-  ${top_srcdir}/src/backend/xml/sixtp-dom-generators.cpp \
-  ${top_srcdir}/src/backend/xml/sixtp-utils.cpp \
-  ${top_srcdir}/src/backend/xml/sixtp.cpp \
-  ${top_srcdir}/src/backend/xml/sixtp-stack.cpp \
-  ${top_srcdir}/src/backend/xml/sixtp-to-dom-parser.cpp \
-  ${top_srcdir}/src/backend/xml/gnc-xml-helper.cpp \
-  test-kvp-frames.cpp
-
-test_load_backend_SOURCES = \
-test-load-backend.cpp
-test_load_xml2_SOURCES = \
-test-load-xml2.cpp
-test_save_in_lang_SOURCES = \
-test-save-in-lang.cpp
-
-# the xml backend is now a GModule - this test does
-# not load it as a module and cannot link to it
-# and remain portable.
-
-test_load_example_account_SOURCES = \
-  ${top_srcdir}/src/backend/xml/sixtp-dom-parsers.cpp \
-  ${top_srcdir}/src/backend/xml/sixtp-dom-generators.cpp \
-  ${top_srcdir}/src/backend/xml/sixtp-utils.cpp \
-  ${top_srcdir}/src/backend/xml/sixtp.cpp \
-  ${top_srcdir}/src/backend/xml/sixtp-stack.cpp \
-  ${top_srcdir}/src/backend/xml/sixtp-to-dom-parser.cpp \
-  ${top_srcdir}/src/backend/xml/io-example-account.cpp \
-  ${top_srcdir}/src/backend/xml/io-gncxml-gen.cpp \
-  ${top_srcdir}/src/backend/xml/io-gncxml-v2.cpp \
-  ${top_srcdir}/src/backend/xml/io-utils.cpp \
-  ${top_srcdir}/src/backend/xml/gnc-account-xml-v2.cpp \
-  ${top_srcdir}/src/backend/xml/gnc-budget-xml-v2.cpp \
-  ${top_srcdir}/src/backend/xml/gnc-lot-xml-v2.cpp \
-  ${top_srcdir}/src/backend/xml/gnc-recurrence-xml-v2.cpp \
-  ${top_srcdir}/src/backend/xml/gnc-schedxaction-xml-v2.cpp \
-  ${top_srcdir}/src/backend/xml/gnc-freqspec-xml-v2.cpp \
-  ${top_srcdir}/src/backend/xml/gnc-transaction-xml-v2.cpp \
-  ${top_srcdir}/src/backend/xml/gnc-commodity-xml-v2.cpp \
-  ${top_srcdir}/src/backend/xml/gnc-book-xml-v2.cpp \
-  ${top_srcdir}/src/backend/xml/gnc-pricedb-xml-v2.cpp \
-  ${top_srcdir}/src/backend/xml/gnc-xml-helper.cpp \
-  test-load-example-account.cpp
-
-test_string_converters_SOURCES = \
-  ${top_srcdir}/src/backend/xml/sixtp-dom-parsers.cpp \
-  ${top_srcdir}/src/backend/xml/sixtp-dom-generators.cpp \
-  ${top_srcdir}/src/backend/xml/sixtp-utils.cpp \
-  ${top_srcdir}/src/backend/xml/sixtp.cpp \
-  ${top_srcdir}/src/backend/xml/sixtp-stack.cpp \
-  ${top_srcdir}/src/backend/xml/sixtp-to-dom-parser.cpp \
-  ${top_srcdir}/src/backend/xml/gnc-xml-helper.cpp \
-  test-string-converters.cpp
-
-test_xml_account_SOURCES = \
-  ${top_srcdir}/src/backend/xml/sixtp-dom-parsers.cpp \
-  ${top_srcdir}/src/backend/xml/sixtp-dom-generators.cpp \
-  ${top_srcdir}/src/backend/xml/sixtp-utils.cpp \
-  ${top_srcdir}/src/backend/xml/sixtp.cpp \
-  ${top_srcdir}/src/backend/xml/sixtp-stack.cpp \
-  ${top_srcdir}/src/backend/xml/sixtp-to-dom-parser.cpp \
-  ${top_srcdir}/src/backend/xml/io-gncxml-gen.cpp \
-  ${top_srcdir}/src/backend/xml/gnc-account-xml-v2.cpp \
-  ${top_srcdir}/src/backend/xml/gnc-lot-xml-v2.cpp \
-  ${top_srcdir}/src/backend/xml/gnc-schedxaction-xml-v2.cpp \
-  ${top_srcdir}/src/backend/xml/gnc-recurrence-xml-v2.cpp \
-  ${top_srcdir}/src/backend/xml/gnc-freqspec-xml-v2.cpp \
-  ${top_srcdir}/src/backend/xml/gnc-transaction-xml-v2.cpp \
-  ${top_srcdir}/src/backend/xml/gnc-commodity-xml-v2.cpp \
-  ${top_srcdir}/src/backend/xml/gnc-book-xml-v2.cpp \
-  ${top_srcdir}/src/backend/xml/gnc-pricedb-xml-v2.cpp \
-  ${top_srcdir}/src/backend/xml/gnc-budget-xml-v2.cpp \
-  ${top_srcdir}/src/backend/xml/io-gncxml-v2.cpp \
-  ${top_srcdir}/src/backend/xml/io-utils.cpp \
-  ${top_srcdir}/src/backend/xml/gnc-xml-helper.cpp \
-  test-xml-account.cpp
-
-test_xml_commodity_SOURCES = \
-  ${top_srcdir}/src/backend/xml/sixtp-dom-parsers.cpp \
-  ${top_srcdir}/src/backend/xml/sixtp-dom-generators.cpp \
-  ${top_srcdir}/src/backend/xml/sixtp-utils.cpp \
-  ${top_srcdir}/src/backend/xml/sixtp.cpp \
-  ${top_srcdir}/src/backend/xml/sixtp-stack.cpp \
-  ${top_srcdir}/src/backend/xml/sixtp-to-dom-parser.cpp \
-  ${top_srcdir}/src/backend/xml/io-gncxml-gen.cpp \
-  ${top_srcdir}/src/backend/xml/gnc-account-xml-v2.cpp \
-  ${top_srcdir}/src/backend/xml/gnc-lot-xml-v2.cpp \
-  ${top_srcdir}/src/backend/xml/gnc-schedxaction-xml-v2.cpp \
-  ${top_srcdir}/src/backend/xml/gnc-recurrence-xml-v2.cpp \
-  ${top_srcdir}/src/backend/xml/gnc-freqspec-xml-v2.cpp \
-  ${top_srcdir}/src/backend/xml/gnc-transaction-xml-v2.cpp \
-  ${top_srcdir}/src/backend/xml/gnc-commodity-xml-v2.cpp \
-  ${top_srcdir}/src/backend/xml/gnc-book-xml-v2.cpp \
-  ${top_srcdir}/src/backend/xml/gnc-pricedb-xml-v2.cpp \
-  ${top_srcdir}/src/backend/xml/gnc-budget-xml-v2.cpp \
-  ${top_srcdir}/src/backend/xml/io-gncxml-v2.cpp \
-  ${top_srcdir}/src/backend/xml/io-utils.cpp \
-  ${top_srcdir}/src/backend/xml/gnc-xml-helper.cpp \
-  test-xml-commodity.cpp
-
-test_xml_pricedb_SOURCES = \
-  ${top_srcdir}/src/backend/xml/sixtp-dom-parsers.cpp \
-  ${top_srcdir}/src/backend/xml/sixtp-dom-generators.cpp \
-  ${top_srcdir}/src/backend/xml/sixtp-utils.cpp \
-  ${top_srcdir}/src/backend/xml/sixtp.cpp \
-  ${top_srcdir}/src/backend/xml/sixtp-stack.cpp \
-  ${top_srcdir}/src/backend/xml/sixtp-to-dom-parser.cpp \
-  ${top_srcdir}/src/backend/xml/io-gncxml-gen.cpp \
-  ${top_srcdir}/src/backend/xml/gnc-account-xml-v2.cpp \
-  ${top_srcdir}/src/backend/xml/gnc-lot-xml-v2.cpp \
-  ${top_srcdir}/src/backend/xml/gnc-schedxaction-xml-v2.cpp \
-  ${top_srcdir}/src/backend/xml/gnc-recurrence-xml-v2.cpp \
-  ${top_srcdir}/src/backend/xml/gnc-freqspec-xml-v2.cpp \
-  ${top_srcdir}/src/backend/xml/gnc-transaction-xml-v2.cpp \
-  ${top_srcdir}/src/backend/xml/gnc-commodity-xml-v2.cpp \
-  ${top_srcdir}/src/backend/xml/gnc-book-xml-v2.cpp \
-  ${top_srcdir}/src/backend/xml/gnc-pricedb-xml-v2.cpp \
-  ${top_srcdir}/src/backend/xml/gnc-budget-xml-v2.cpp \
-  ${top_srcdir}/src/backend/xml/io-gncxml-v2.cpp \
-  ${top_srcdir}/src/backend/xml/io-utils.cpp \
-  ${top_srcdir}/src/backend/xml/gnc-xml-helper.cpp \
-  test-xml-pricedb.cpp
-
-test_xml_transaction_SOURCES = \
-  ${top_srcdir}/src/backend/xml/sixtp-dom-parsers.cpp \
-  ${top_srcdir}/src/backend/xml/sixtp-dom-generators.cpp \
-  ${top_srcdir}/src/backend/xml/sixtp-utils.cpp \
-  ${top_srcdir}/src/backend/xml/sixtp.cpp \
-  ${top_srcdir}/src/backend/xml/sixtp-stack.cpp \
-  ${top_srcdir}/src/backend/xml/sixtp-to-dom-parser.cpp \
-  ${top_srcdir}/src/backend/xml/io-gncxml-gen.cpp \
-  ${top_srcdir}/src/backend/xml/gnc-account-xml-v2.cpp \
-  ${top_srcdir}/src/backend/xml/gnc-budget-xml-v2.cpp \
-  ${top_srcdir}/src/backend/xml/gnc-lot-xml-v2.cpp \
-  ${top_srcdir}/src/backend/xml/gnc-schedxaction-xml-v2.cpp \
-  ${top_srcdir}/src/backend/xml/gnc-freqspec-xml-v2.cpp \
-  ${top_srcdir}/src/backend/xml/gnc-recurrence-xml-v2.cpp \
-  ${top_srcdir}/src/backend/xml/gnc-transaction-xml-v2.cpp \
-  ${top_srcdir}/src/backend/xml/gnc-commodity-xml-v2.cpp \
-  ${top_srcdir}/src/backend/xml/gnc-book-xml-v2.cpp \
-  ${top_srcdir}/src/backend/xml/gnc-pricedb-xml-v2.cpp \
-  ${top_srcdir}/src/backend/xml/io-gncxml-v2.cpp \
-  ${top_srcdir}/src/backend/xml/io-utils.cpp \
-  ${top_srcdir}/src/backend/xml/gnc-xml-helper.cpp \
-  test-xml-transaction.cpp
-
-test_xml2_is_file_SOURCES = \
-  ${top_srcdir}/src/backend/xml/sixtp-dom-parsers.cpp \
-  ${top_srcdir}/src/backend/xml/sixtp-dom-generators.cpp \
-  ${top_srcdir}/src/backend/xml/sixtp-utils.cpp \
-  ${top_srcdir}/src/backend/xml/sixtp.cpp \
-  ${top_srcdir}/src/backend/xml/sixtp-stack.cpp \
-  ${top_srcdir}/src/backend/xml/sixtp-to-dom-parser.cpp \
-  ${top_srcdir}/src/backend/xml/gnc-account-xml-v2.cpp \
-  ${top_srcdir}/src/backend/xml/gnc-budget-xml-v2.cpp \
-  ${top_srcdir}/src/backend/xml/gnc-lot-xml-v2.cpp \
-  ${top_srcdir}/src/backend/xml/gnc-recurrence-xml-v2.cpp \
-  ${top_srcdir}/src/backend/xml/gnc-schedxaction-xml-v2.cpp \
-  ${top_srcdir}/src/backend/xml/gnc-freqspec-xml-v2.cpp \
-  ${top_srcdir}/src/backend/xml/gnc-transaction-xml-v2.cpp \
-  ${top_srcdir}/src/backend/xml/gnc-commodity-xml-v2.cpp \
-  ${top_srcdir}/src/backend/xml/gnc-book-xml-v2.cpp \
-  ${top_srcdir}/src/backend/xml/gnc-pricedb-xml-v2.cpp \
-  ${top_srcdir}/src/backend/xml/io-gncxml-gen.cpp \
-  ${top_srcdir}/src/backend/xml/io-gncxml-v2.cpp \
-  ${top_srcdir}/src/backend/xml/io-utils.cpp \
-  ${top_srcdir}/src/backend/xml/gnc-xml-helper.cpp \
-  test-xml2-is-file.cpp
-
-TESTS = \
-  test-date-converting \
-  test-dom-converters1 \
-  test-kvp-frames \
-  test-load-example-account \
-  test-load-backend \
-  test-load-xml2 \
-  test-real-data.sh \
-  test-string-converters \
-  test-xml-account \
-  test-xml-commodity \
-  test-xml-pricedb \
-  test-xml-transaction \
-  test-xml2-is-file
-
-GNC_TEST_DEPS = \
-  --gnc-module-dir ${top_builddir}/src/gnc-module \
-  --gnc-module-dir ${top_builddir}/src/engine \
-  --guile-load-dir ${top_builddir}/src/gnc-module \
-  --guile-load-dir ${top_builddir}/src/engine \
-  --library-dir    ${top_builddir}/src/core-utils \
-  --library-dir    ${top_builddir}/src/gnc-module \
-  --library-dir    ${top_builddir}/src/engine \
-  --library-dir    ${top_builddir}/src/backend/sql  \
-  --library-dir    ${top_builddir}/src/backend/xml
-
-TESTS_ENVIRONMENT = \
-  GUILE_WARN_DEPRECATED=no \
-  GNC_ACCOUNT_PATH=${top_srcdir}/accounts/C \
-  GNC_TEST_FILES=test-files/xml2 \
-  SRCDIR=${srcdir} \
-  GNC_BUILDDIR="${abs_top_builddir}" \
-  $(shell ${abs_top_srcdir}/src/gnc-test-env.pl --noexports ${GNC_TEST_DEPS})
-
-check_LTLIBRARIES = libgnc-test-file-stuff.la
-
-libgnc_test_file_stuff_la_SOURCES = test-file-stuff.cpp
-libgnc_test_file_stuff_la_LIBADD = \
-  ${top_builddir}/src/engine/libgncmod-engine.la
-
-check_PROGRAMS = \
-  test-date-converting \
-  test-dom-converters1 \
-  test-kvp-frames \
-  test-load-backend \
-  test-load-example-account \
-  test-load-xml2 \
-  test-save-in-lang \
-  test-string-converters \
-  test-xml-account \
-  test-xml-commodity \
-  test-xml-pricedb \
-  test-xml-transaction \
-  test-xml2-is-file
-
-noinst_HEADERS = test-file-stuff.h
-
-LDADD = \
-        ${top_builddir}/src/test-core/libtest-core.la \
-        ${top_builddir}/src/gnc-module/libgnc-module.la \
-        ${top_builddir}/src/engine/libgncmod-engine.la \
-        ${top_builddir}/src/engine/test-core/libgncmod-test-engine.la \
-        ${top_builddir}/src/core-utils/libgnc-core-utils.la \
-        ./libgnc-test-file-stuff.la \
-        ${LIBXML2_LIBS} \
-        ${ZLIB_LIBS} \
-        ${top_builddir}/lib/libc/libc-missing.la
-
-AM_CPPFLAGS = \
-  -I${top_srcdir}/lib/libc \
-  -I${top_srcdir}/src \
-  -I${top_srcdir}/src/core-utils \
-  -I${top_srcdir}/src/gnc-module \
-  -I${top_srcdir}/src/test-core \
-  -I${top_srcdir}/src/engine \
-  -I${top_srcdir}/src/engine/test-core \
-  -I${top_srcdir}/src/backend/xml \
-  -DU_SHOW_CPLUSPLUS_API=0 \
-  ${LIBXML2_CFLAGS} \
-  ${GLIB_CFLAGS} \
-  ${GUILE_CFLAGS} \
-  ${BOOST_CPPFLAGS}
-
-EXTRA_DIST = \
-  grab-types.pl \
-  test-dom-parser1.cpp \
-  test-real-data.sh \
-  test-xml2-is-file.cpp \
-  CMakeLists.txt
-
-AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.backend.xml\"
diff --git a/src/bin/Makefile.am b/src/bin/Makefile.am
deleted file mode 100644
index e6e254c..0000000
--- a/src/bin/Makefile.am
+++ /dev/null
@@ -1,148 +0,0 @@
-# Order is important here.
-if !PLATFORM_WIN32
-SUBDIRS = . overrides test
-else
-SUBDIRS = . test
-endif
-
-AM_CPPFLAGS = -I${top_builddir} ${GLIB_CFLAGS} ${GNOME_CFLAGS} ${GTK_CFLAGS} \
-  -DPKGSYSCONFDIR=\"${GNC_CONFIGDIR}\" \
-  -DPKGDATADIR=\"${GNC_SHAREDIR}\" \
-  -I${top_srcdir}/src \
-  -I${top_builddir}/src \
-  -I${top_srcdir}/src/core-utils \
-  -I${top_srcdir}/src/app-utils \
-  -I${top_srcdir}/src/gnome-utils \
-  -I${top_srcdir}/src/engine \
-  -I${top_srcdir}/src/gnome \
-  -I${top_builddir}/src \
-  -I${top_builddir}/src/core-utils \
-  -I${top_srcdir}/src/gnc-module \
-  -I${top_srcdir}/src/report/report-system \
-  ${GUILE_CFLAGS} \
-  ${GTK_MAC_CFLAGS}
-
-SUFFIXES = .rc
-
-config_DATA = environment
-configdir = ${GNC_CONFIGDIR}
-
-# Some settings are platform dependent. Let's define them per platform.
-if PLATFORM_WIN32
-# Windows specific settings go here:
-GNUCASH_RESOURCE_FILE = gnucash.rc
-dist_noinst_DATA = gnucash.rc
-
-.rc.o:
-	$(AM_V_GEN)$(RC) -I${top_srcdir}/src/pixmaps -i '$<' --input-format=rc -o '$@' -O coff
-
-else !PLATFORM_WIN32
-# All other platforms use these settings:
-PLATFORM_FILES = gnucash-valgrind
-
-endif !PLATFORM_WIN32
-
-BIN_NAME = gnucash
-bin_PROGRAMS = ${BIN_NAME}
-gnucash_SOURCES = gnucash-bin.c ${GNUCASH_RESOURCE_FILE}
-gnucash_LDADD = \
-  ${top_builddir}/src/register/ledger-core/libgncmod-ledger-core.la \
-  ${top_builddir}/src/report/report-gnome/libgncmod-report-gnome.la \
-  ${top_builddir}/src/gnome/libgnc-gnome.la \
-  ${top_builddir}/src/gnome-utils/libgncmod-gnome-utils.la \
-  ${top_builddir}/src/app-utils/libgncmod-app-utils.la \
-  ${top_builddir}/src/engine/libgncmod-engine.la \
-  ${top_builddir}/src/gnc-module/libgnc-module.la \
-  ${top_builddir}/src/core-utils/libgnc-core-utils.la \
-  ${top_builddir}/src/report/report-system/libgncmod-report-system.la \
-  ${GUILE_LIBS} \
-  ${GLIB_LIBS} \
-  ${GTK_LIBS}
-
-if WITH_GOOGLE_PROFILER
-gnucash_LDADD += -lprofiler
-endif
-
-GNUCASH_BIN_INSTALL_NAME=`echo ${BIN_NAME} | sed -e '$(transform)'`
-
-gnucash-valgrind: gnucash-valgrind.in ${top_builddir}/config.status Makefile
-	rm -f $@.tmp
-	sed < $< > $@.tmp \
-	    -e "s#@-TOP_SRC_DIR-@#${abs_top_srcdir}#g" \
-	    -e "s#@-GNUCASH_BIN_INSTALL_NAME-@#${GNUCASH_BIN_INSTALL_NAME}#g"
-	mv $@.tmp $@
-	chmod u+x $@
-
-environment: environment.in ${top_builddir}/config.status Makefile
-	rm -f $@.tmp
-	sed < $< > $@.tmp \
-	    -e '/@-NOTE.*-@/ D' \
-	    -e "s#@-GUILE_EFFECTIVE_VERSION-@#@GUILE_EFFECTIVE_VERSION@#g"
-if CUSTOM_GNC_DBD_DIR
-	echo 'GNC_DBD_DIR=@GNC_DBD_DIR@' >> $@.tmp
-endif
-    # Set XDG_DATA_DIRS if necessary.  The three components of the search path are the
-    # directory used by GnuCash, whatever was specified in the environment at run time, and
-    # the default value specified via configure.
-	if [ "a$(datadir)" != "a/usr/share" ] && [ "a$(datadir)" != "a/usr/local/share" ]; \
-	then \
-		echo >> $@.tmp; \
-		echo "# GnuCash was not installed in the default location" >> $@.tmp; \
-		echo "# XDG_DATA_DIRS will be set so that our documentation" >> $@.tmp; \
-		echo "# and gsettings schemas are found." >> $@.tmp; \
-		echo "XDG_DATA_DIRS=$(datadir);{XDG_DATA_DIRS};${GNC_SYSTEM_XDG_DATA_DIRS}" >> $@.tmp; \
-	fi
-if WITH_PYTHON
-	if [ "${PYTHON_SITE_PKG}" != "${pyexecdir}" ]; \
-	then \
-		echo  >> $@.tmp; \
-		echo "# Define PYTHONPATH for non default installation path." >> $@.tmp; \
-		echo "PYTHONPATH=${pyexecdir};{PYTHONPATH}" >> $@.tmp; \
-	fi
-endif
-	mv $@.tmp $@
-
-CLEANFILES = $(BUILT_SOURCES) ${config_DATA} ${PLATFORM_FILES}
-
-if !PLATFORM_WIN32
-# The gnucash scripts don't make sense on Windows, so will only be
-# generated and included on the other platforms.
-# We handle gnucash scripts in a somewhat unexpected way, but we do
-# this so that a user who doesn't necessarily have the right
-# directories in their path can still invoke these commands via their
-# full path, say /some/dir/not/in/path/gnucash and still have the
-# right thing happen (i.e. they'll still get the right guile, and the
-# right scripts if they sub-exec anything from their scripts).  If you
-# want to add another gnucash script, please add the name here (which
-# will cause the bindir wrapper to be created, and then put the actual
-# code in a script of the same name in ./overrides.  Oh, and don't
-# forget to add your script to configure.in's "Adjustments" section if
-# you need to.
-#
-# For testing and other reasons, overrides/* scripts should not modify
-# the path to re-insert the overrides dir.  This should only be done
-# by these top-level "common" scripts.
-gnc_common_scripts = gnucash-env gnucash-make-guids
-
-bin_SCRIPTS = \
-    ${gnc_common_scripts} \
-	${PLATFORM_FILES}
-
-# if you change gncoverridedir, make sure you change ./overrides/Makefile.am too.
-gncoverridesdir = ${GNC_LIBEXECDIR}/overrides
-
-## Gnucash scripts -- real code is in overrides, these just get you there.
-${gnc_common_scripts}: generate-gnc-script ${top_builddir}/config.status
-	${srcdir}/generate-gnc-script $@ "${gncoverridesdir}"
-
-CLEANFILES += ${gnc_common_scripts}
-
-endif
-
-EXTRA_DIST = \
-	generate-gnc-script \
-	gnucash-valgrind.in \
-	environment.in \
-	CMakeLists.txt
-
-AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.bin\"
diff --git a/src/bin/gnucash-bin.c b/src/bin/gnucash-bin.c
deleted file mode 100644
index 2a1187a..0000000
--- a/src/bin/gnucash-bin.c
+++ /dev/null
@@ -1,819 +0,0 @@
-/*
- * gnucash-bin.c -- The program entry point for GnuCash
- *
- * Copyright (C) 2006 Chris Shoemaker <c.shoemaker at cox.net>
- *
- * 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 at gnu.org
- */
-#include "config.h"
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <libguile.h>
-#include <gtk/gtk.h>
-#include <glib/gi18n.h>
-#include "glib.h"
-#include "gnc-module.h"
-#include "gnc-path.h"
-#include "binreloc.h"
-#include "gnc-locale-utils.h"
-#include "core-utils/gnc-version.h"
-#include "gnc-engine.h"
-#include "gnc-environment.h"
-#include "gnc-filepath-utils.h"
-#include "gnc-ui-util.h"
-#include "gnc-file.h"
-#include "gnc-hooks.h"
-#include "top-level.h"
-#include "gfec.h"
-#include "gnc-commodity.h"
-#include "gnc-prefs.h"
-#include "gnc-prefs-utils.h"
-#include "gnc-gsettings.h"
-#include "gnc-report.h"
-#include "gnc-main-window.h"
-#include "gnc-splash.h"
-#include "gnc-gnome-utils.h"
-#include "gnc-plugin-file-history.h"
-#include "dialog-new-user.h"
-#include "gnc-session.h"
-#include "engine-helpers-guile.h"
-#include "swig-runtime.h"
-
-/* This static indicates the debugging module that this .o belongs to.  */
-static QofLogModule log_module = GNC_MOD_GUI;
-
-#ifdef HAVE_GETTEXT
-#  include <libintl.h>
-#  include <locale.h>
-#endif
-
-#ifdef MAC_INTEGRATION
-#  include <Foundation/Foundation.h>
-#endif
-
-/* GNUCASH_SCM is defined whenever we're building from an svn/svk/git/bzr tree */
-#ifdef GNUCASH_SCM
-static int is_development_version = TRUE;
-#else
-static int is_development_version = FALSE;
-#define GNUCASH_SCM ""
-#endif
-
-/* Command-line option variables */
-static int          gnucash_show_version = 0;
-static int          debugging        = 0;
-static int          extra            = 0;
-static gchar      **log_flags        = NULL;
-static gchar       *log_to_filename  = NULL;
-static int          nofile           = 0;
-static const gchar *gsettings_prefix = NULL;
-static const char  *add_quotes_file  = NULL;
-static char        *namespace_regexp = NULL;
-static const char  *file_to_load     = NULL;
-static gchar      **args_remaining   = NULL;
-
-static GOptionEntry options[] =
-{
-    {
-        "version", 'v', 0, G_OPTION_ARG_NONE, &gnucash_show_version,
-        N_("Show GnuCash version"), NULL
-    },
-
-    {
-        "debug", '\0', 0, G_OPTION_ARG_NONE, &debugging,
-        N_("Enable debugging mode: provide deep detail in the logs.\nThis is equivalent to: --log \"=info\" --log \"qof=info\" --log \"gnc=info\""), NULL
-    },
-
-    {
-        "extra", '\0', 0, G_OPTION_ARG_NONE, &extra,
-        N_("Enable extra/development/debugging features."), NULL
-    },
-
-    {
-        "log", '\0', 0, G_OPTION_ARG_STRING_ARRAY, &log_flags,
-        N_("Log level overrides, of the form \"modulename={debug,info,warn,crit,error}\"\nExamples: \"--log qof=debug\" or \"--log gnc.backend.file.sx=info\"\nThis can be invoked multiple times."),
-        NULL
-    },
-
-    {
-        "logto", '\0', 0, G_OPTION_ARG_STRING, &log_to_filename,
-        N_("File to log into; defaults to \"/tmp/gnucash.trace\"; can be \"stderr\" or \"stdout\"."),
-        NULL
-    },
-
-    {
-        "nofile", '\0', 0, G_OPTION_ARG_NONE, &nofile,
-        N_("Do not load the last file opened"), NULL
-    },
-    {
-        "gsettings-prefix", '\0', 0, G_OPTION_ARG_STRING, &gsettings_prefix,
-        N_("Set the prefix for gsettings schemas for gsettings queries. This can be useful to have a different settings tree while debugging."),
-        /* Translators: Argument description for autohelp; see
-           http://developer.gnome.org/doc/API/2.0/glib/glib-Commandline-option-parser.html */
-        N_("GSETTINGSPREFIX")
-    },
-    {
-        "add-price-quotes", '\0', 0, G_OPTION_ARG_STRING, &add_quotes_file,
-        N_("Add price quotes to given GnuCash datafile"),
-        /* Translators: Argument description for autohelp; see
-           http://developer.gnome.org/doc/API/2.0/glib/glib-Commandline-option-parser.html */
-        N_("FILE")
-    },
-    {
-        "namespace", '\0', 0, G_OPTION_ARG_STRING, &namespace_regexp,
-        N_("Regular expression determining which namespace commodities will be retrieved"),
-        /* Translators: Argument description for autohelp; see
-           http://developer.gnome.org/doc/API/2.0/glib/glib-Commandline-option-parser.html */
-        N_("REGEXP")
-    },
-    {
-        G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_STRING_ARRAY, &args_remaining, NULL, N_("[datafile]") },
-    { NULL }
-};
-
-static void
-gnc_print_unstable_message(void)
-{
-    if (!is_development_version) return;
-
-    g_print("\n\n%s\n%s\n%s\n%s\n",
-            _("This is a development version. It may or may not work."),
-            _("Report bugs and other problems to gnucash-devel at gnucash.org"),
-            _("You can also lookup and file bug reports at http://bugzilla.gnome.org"),
-            _("To find the last stable version, please refer to http://www.gnucash.org"));
-}
-
-#ifdef MAC_INTEGRATION
-static void
-mac_set_currency_locale(NSLocale *locale, NSString *locale_str)
-{
-    /* If the currency doesn't match the base locale, we need to find a locale that does match, because setlocale won't know what to do with just a currency identifier. */
-    if (![[locale objectForKey: NSLocaleCurrencyCode] isEqualToString:
-	  [[[NSLocale alloc] initWithLocaleIdentifier: locale_str] objectForKey: NSLocaleCurrencyCode]]) {
-	NSArray *all_locales = [NSLocale availableLocaleIdentifiers];
-	NSEnumerator *locale_iter = [all_locales objectEnumerator];
-	NSString *this_locale;
-	NSString *currency = [locale objectForKey: NSLocaleCurrencyCode];
-	NSString *money_locale = nil;
-	while ((this_locale = (NSString*)[locale_iter nextObject]))
-	{
-	    NSLocale *templocale = [[NSLocale alloc]
-				    initWithLocaleIdentifier: this_locale];
-	    if ([[templocale objectForKey: NSLocaleCurrencyCode]
-		 isEqualToString: currency])
-	    {
-		money_locale = this_locale;
-		[templocale release];
-		break;
-	    }
-	    [templocale release];
-	}
-	if (money_locale)
-	    setlocale(LC_MONETARY, [money_locale UTF8String]);
-    }
-}
-/* The locale that we got from AppKit isn't a supported POSIX one, so we need to
- * find something close. First see if we can find another locale for the
- * country; failing that, try the language. Ultimately fall back on en_US.
- */
-static NSString*
-mac_find_close_country(NSString *locale_str, NSString *country_str,
-                       NSString *lang_str)
-{
-    NSArray *all_locales = [NSLocale availableLocaleIdentifiers];
-    NSEnumerator *locale_iter = [all_locales objectEnumerator];
-    NSString *this_locale, *new_locale = nil;
-    PWARN("Apple Locale is set to a value %s not supported"
-          " by the C runtime", [locale_str UTF8String]);
-    while ((this_locale = (NSString*)[locale_iter nextObject]))
-        if ([[[NSLocale componentsFromLocaleIdentifier: this_locale]
-              objectForKey: NSLocaleCountryCode]
-             isEqualToString: country_str] &&
-            setlocale (LC_ALL, [this_locale UTF8String]))
-        {
-            new_locale = this_locale;
-            break;
-        }
-    if (new_locale)
-        locale_str = new_locale;
-    else
-        while ((this_locale = (NSString*)[locale_iter nextObject]))
-            if ([[[NSLocale componentsFromLocaleIdentifier: this_locale]
-                  objectForKey: NSLocaleLanguageCode]
-                 isEqualToString: lang_str] &&
-                setlocale (LC_ALL, [this_locale UTF8String]))
-            {
-                new_locale = this_locale;
-                break;
-            }
-    if (new_locale)
-        locale_str = new_locale;
-    else
-    {
-        locale_str = @"en_US";
-        setlocale(LC_ALL, [locale_str UTF8String]);
-    }
-    PWARN("Using %s instead.", [locale_str UTF8String]);
-    return locale_str;
-}
-
-/* Language subgroups (e.g., US English) are reported in the form "ll-SS"
- * (e.g. again, "en-US"), not what gettext wants. We convert those to
- * old-style locales, which is easy for most cases. There are two where it
- * isn't, though: Simplified Chinese (zh-Hans) and traditional Chinese
- * (zh-Hant), which are normally assigned the locales zh_CN and zh_TW,
- * respectively. Those are handled specially.
- */
-static NSString*
-mac_convert_complex_language(NSString* this_lang)
-{
-    NSArray *elements = [this_lang componentsSeparatedByString: @"-"];
-    if ([elements count] == 1)
-        return this_lang;
-    if ([[elements objectAtIndex: 0] isEqualToString: @"zh"]) {
-        if ([[elements objectAtIndex: 1] isEqualToString: @"Hans"])
-            this_lang = @"zh_CN";
-        else
-            this_lang = @"zh_TW";
-    }
-    else
-        this_lang = [elements componentsJoinedByString: @"_"];
-    return this_lang;
-}
-
-static void
-mac_set_languages(NSArray* languages, NSString *lang_str)
-{
-    /* Process the language list. */
-
-    const gchar *langs = NULL;
-    NSEnumerator *lang_iter = [languages objectEnumerator];
-    NSArray *new_languages = [NSArray array];
-    NSString *this_lang = NULL;
-    NSRange not_found = {NSNotFound, 0};
-    while ((this_lang = [lang_iter nextObject])) {
-        this_lang = [this_lang stringByTrimmingCharactersInSet:
-                     [NSCharacterSet characterSetWithCharactersInString: @"\""]];
-        this_lang = mac_convert_complex_language(this_lang);
-        new_languages = [new_languages arrayByAddingObject: this_lang];
-/* If it's an English language, add the "C" locale after it so that
- * any messages can default to it */
-        if (!NSEqualRanges([this_lang rangeOfString: @"en"], not_found))
-            new_languages = [new_languages arrayByAddingObject: @"C"];
-        if (![new_languages containsObject: lang_str]) {
-            NSArray *temp_array = [NSArray arrayWithObject: lang_str];
-            new_languages = [temp_array arrayByAddingObjectsFromArray: new_languages];
-        }
-        langs = [[new_languages componentsJoinedByString:@":"] UTF8String];
-    }
-    if (langs && strlen(langs) > 0)
-    {
-        PWARN("Language list: %s", langs);
-        g_setenv("LANGUAGE", langs, TRUE);
-    }
-}
-
-static void
-set_mac_locale()
-{
-    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
-    NSUserDefaults *defs = [NSUserDefaults standardUserDefaults];
-    NSLocale *locale = [NSLocale currentLocale];
-    NSString *lang_str, *country_str, *locale_str;
-    NSArray *languages = [[defs arrayForKey: @"AppleLanguages"] retain];
-    @try
-    {
-        lang_str = [locale objectForKey: NSLocaleLanguageCode];
-        country_str = [locale objectForKey: NSLocaleCountryCode];
-	locale_str = [[lang_str stringByAppendingString: @"_"]
-		      stringByAppendingString: country_str];
-    }
-    @catch (NSException *err)
-    {
-	PWARN("Locale detection raised error %s: %s. "
-	      "Check that your locale settings in "
-	      "System Preferences>Languages & Text are set correctly.",
-	      [[err name] UTF8String], [[err reason] UTF8String]);
-	locale_str = @"_";
-    }
-/* If we didn't get a valid current locale, the string will be just "_" */
-    if ([locale_str isEqualToString: @"_"])
-	locale_str = @"en_US";
-
-    lang_str = mac_convert_complex_language(lang_str);
-    if (!setlocale(LC_ALL, [locale_str UTF8String]))
-        locale_str =  mac_find_close_country(locale_str, country_str, lang_str);
-    if (g_getenv("LANG") == NULL)
-	g_setenv("LANG", [locale_str UTF8String], TRUE);
-    mac_set_currency_locale(locale, locale_str);
-/* Now call gnc_localeconv() to force creation of the app locale
- * before another call to setlocale messes it up. */
-    gnc_localeconv ();
-    /* Process the languages, including the one from the Apple locale. */
-    if ([languages count] > 0)
-        mac_set_languages(languages, lang_str);
-    else
-        g_setenv("LANGUAGE", [lang_str UTF8String], TRUE);
-    [languages release];
-    [pool drain];
-}
-#endif /* MAC_INTEGRATION */
-
-static gboolean
-try_load_config_array(const gchar *fns[])
-{
-    gchar *filename;
-    int i;
-
-    for (i = 0; fns[i]; i++)
-    {
-        filename = gnc_build_dotgnucash_path(fns[i]);
-        if (gfec_try_load(filename))
-        {
-            g_free(filename);
-            return TRUE;
-        }
-        g_free(filename);
-    }
-    return FALSE;
-}
-
-static void
-update_message(const gchar *msg)
-{
-    gnc_update_splash_screen(msg, GNC_SPLASH_PERCENTAGE_UNKNOWN);
-    g_message("%s", msg);
-}
-
-static void
-load_system_config(void)
-{
-    static int is_system_config_loaded = FALSE;
-    gchar *system_config_dir;
-    gchar *system_config;
-
-    if (is_system_config_loaded) return;
-
-    update_message("loading system configuration");
-    system_config_dir = gnc_path_get_pkgsysconfdir();
-    system_config = g_build_filename(system_config_dir, "config", NULL);
-    is_system_config_loaded = gfec_try_load(system_config);
-    g_free(system_config_dir);
-    g_free(system_config);
-}
-
-static void
-load_user_config(void)
-{
-    /* Don't continue adding to this list. When 2.0 rolls around bump
-       the 1.4 (unnumbered) files off the list. */
-    static const gchar *user_config_files[] =
-    {
-        "config-2.0.user", "config-1.8.user", "config-1.6.user",
-        "config.user", NULL
-    };
-    static const gchar *auto_config_files[] =
-    {
-        "config-2.0.auto", "config-1.8.auto", "config-1.6.auto",
-        "config.auto", NULL
-    };
-    static const gchar *saved_report_files[] =
-    {
-        SAVED_REPORTS_FILE, SAVED_REPORTS_FILE_OLD_REV, NULL
-    };
-    static const gchar *stylesheet_files[] = { "stylesheets-2.0", NULL};
-    static int is_user_config_loaded = FALSE;
-
-    if (is_user_config_loaded)
-        return;
-    else is_user_config_loaded = TRUE;
-
-    update_message("loading user configuration");
-    try_load_config_array(user_config_files);
-    update_message("loading auto configuration");
-    try_load_config_array(auto_config_files);
-    update_message("loading saved reports");
-    try_load_config_array(saved_report_files);
-    update_message("loading stylesheets");
-    try_load_config_array(stylesheet_files);
-}
-
-/* Parse command line options, using GOption interface.
- * We can't let gtk_init_with_args do it because it fails
- * before parsing any arguments if the GUI can't be initialized.
- */
-static void
-gnc_parse_command_line(int *argc, char ***argv)
-{
-
-    GError *error = NULL;
-    GOptionContext *context = g_option_context_new (_("- GnuCash personal and small business finance management"));
-
-    g_option_context_add_main_entries (context, options, GETTEXT_PACKAGE);
-    g_option_context_add_group (context, gtk_get_option_group(FALSE));
-    if (!g_option_context_parse (context, argc, argv, &error))
-    {
-        g_printerr (_("%s\nRun '%s --help' to see a full list of available command line options.\n"),
-                    error->message, *argv[0]);
-        g_error_free (error);
-        exit (1);
-    }
-    g_option_context_free (context);
-
-    if (gnucash_show_version)
-    {
-        gchar *fixed_message;
-
-        if (is_development_version)
-        {
-            fixed_message = g_strdup_printf(_("GnuCash %s development version"), VERSION);
-
-            /* Translators: 1st %s is a fixed message, which is translated independently;
-                            2nd %s is the scm type (svn/svk/git/bzr);
-                            3rd %s is the scm revision number;
-                            4th %s is the build date */
-            g_print ( _("%s\nThis copy was built from %s rev %s on %s."),
-                      fixed_message, GNUCASH_SCM, GNUCASH_SCM_REV,
-                      GNUCASH_BUILD_DATE );
-        }
-        else
-        {
-            fixed_message = g_strdup_printf(_("GnuCash %s"), VERSION);
-
-            /* Translators: 1st %s is a fixed message, which is translated independently;
-                            2nd %s is the scm (svn/svk/git/bzr) revision number;
-                            3rd %s is the build date */
-            g_print ( _("%s\nThis copy was built from rev %s on %s."),
-                      fixed_message, GNUCASH_SCM_REV, GNUCASH_BUILD_DATE );
-        }
-        g_print("\n");
-        g_free (fixed_message);
-        exit(0);
-    }
-
-    gnc_prefs_set_debugging(debugging);
-    gnc_prefs_set_extra(extra);
-
-    if (gsettings_prefix)
-        gnc_gsettings_set_prefix(g_strdup(gsettings_prefix));
-
-    if (namespace_regexp)
-        gnc_prefs_set_namespace_regexp(namespace_regexp);
-
-    if (args_remaining)
-        file_to_load = args_remaining[0];
-}
-
-static void
-load_gnucash_modules()
-{
-    int i, len;
-    struct
-    {
-        gchar * name;
-        int version;
-        gboolean optional;
-    } modules[] =
-    {
-        { "gnucash/app-utils", 0, FALSE },
-        { "gnucash/engine", 0, FALSE },
-        { "gnucash/register/ledger-core", 0, FALSE },
-        { "gnucash/register/register-core", 0, FALSE },
-        { "gnucash/register/register-gnome", 0, FALSE },
-        { "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 },
-        { "gnucash/import-export/log-replay", 0, TRUE },
-        { "gnucash/import-export/aqbanking", 0, TRUE },
-        { "gnucash/report/report-system", 0, FALSE },
-        { "gnucash/report/stylesheets", 0, FALSE },
-        { "gnucash/report/locale-specific/us", 0, FALSE },
-        { "gnucash/report/report-gnome", 0, FALSE },
-        { "gnucash/python", 0, TRUE },
-        { "gnucash/plugins/bi_import", 0, TRUE},
-        { "gnucash/plugins/customer_import", 0, TRUE},
-    };
-
-    /* module initializations go here */
-    len = sizeof(modules) / sizeof(*modules);
-    for (i = 0; i < len; i++)
-    {
-        DEBUG("Loading module %s started", modules[i].name);
-        gnc_update_splash_screen(modules[i].name, GNC_SPLASH_PERCENTAGE_UNKNOWN);
-        if (modules[i].optional)
-            gnc_module_load_optional(modules[i].name, modules[i].version);
-        else
-            gnc_module_load(modules[i].name, modules[i].version);
-        DEBUG("Loading module %s finished", modules[i].name);
-    }
-    if (!gnc_engine_is_initialized())
-    {
-        /* On Windows this check used to fail anyway, see
-         * https://lists.gnucash.org/pipermail/gnucash-devel/2006-September/018529.html
-         * but more recently it seems to work as expected
-         * again. 2006-12-20, cstim. */
-        g_warning("GnuCash engine failed to initialize.  Exiting.\n");
-        exit(1);
-    }
-}
-
-static void
-inner_main_add_price_quotes(void *closure, int argc, char **argv)
-{
-    SCM mod, add_quotes, scm_book, scm_result = SCM_BOOL_F;
-    QofSession *session = NULL;
-
-    scm_c_eval_string("(debug-set! stack 200000)");
-
-    mod = scm_c_resolve_module("gnucash price-quotes");
-    scm_set_current_module(mod);
-
-    /* Don't load the modules since the stylesheet module crashes if the
-       GUI is not initialized */
-#ifdef PRICE_QUOTES_NEED_MODULES
-    load_gnucash_modules();
-#endif
-    gnc_prefs_init ();
-    qof_event_suspend();
-    scm_c_eval_string("(gnc:price-quotes-install-sources)");
-
-    if (!gnc_quote_source_fq_installed())
-    {
-        g_print("%s", _("No quotes retrieved. Finance::Quote isn't "
-                        "installed properly.\n"));
-        goto fail;
-    }
-
-    add_quotes = scm_c_eval_string("gnc:book-add-quotes");
-    session = gnc_get_current_session();
-    if (!session) goto fail;
-
-    qof_session_begin(session, add_quotes_file, FALSE, FALSE, FALSE);
-    if (qof_session_get_error(session) != ERR_BACKEND_NO_ERR) goto fail;
-
-    qof_session_load(session, NULL);
-    if (qof_session_get_error(session) != ERR_BACKEND_NO_ERR) goto fail;
-
-    scm_book = gnc_book_to_scm(qof_session_get_book(session));
-    scm_result = scm_call_2(add_quotes, SCM_BOOL_F, scm_book);
-
-    qof_session_save(session, NULL);
-    if (qof_session_get_error(session) != ERR_BACKEND_NO_ERR) goto fail;
-
-    qof_session_destroy(session);
-    if (!scm_is_true(scm_result))
-    {
-        g_warning("Failed to add quotes to %s.", add_quotes_file);
-        goto fail;
-    }
-
-    qof_event_resume();
-    gnc_shutdown(0);
-    return;
-fail:
-    if (session && qof_session_get_error(session) != ERR_BACKEND_NO_ERR)
-        g_warning("Session Error: %s", qof_session_get_error_message(session));
-    qof_event_resume();
-    gnc_shutdown(1);
-}
-
-static char *
-get_file_to_load()
-{
-    if (file_to_load)
-        return g_strdup(file_to_load);
-    else
-        return gnc_history_get_last();
-}
-
-static void
-inner_main (void *closure, int argc, char **argv)
-{
-    SCM main_mod;
-    char* fn;
-
-    scm_c_eval_string("(debug-set! stack 200000)");
-
-    main_mod = scm_c_resolve_module("gnucash main");
-    scm_set_current_module(main_mod);
-
-    /* GnuCash switched to gsettings to store its preferences in version 2.5.6
-     * Migrate the user's preferences from gconf if needed */
-    gnc_gsettings_migrate_from_gconf();
-
-    load_gnucash_modules();
-
-    /* Load the config before starting up the gui. This insures that
-     * custom reports have been read into memory before the Reports
-     * menu is created. */
-    load_system_config();
-    load_user_config();
-
-    /* Setting-up the report menu must come after the module
-       loading but before the gui initialization. */
-    scm_c_use_module("gnucash report report-gnome");
-    scm_c_eval_string("(gnc:report-menu-setup)");
-
-    /* TODO: After some more guile-extraction, this should happen even
-       before booting guile.  */
-    gnc_main_gui_init();
-
-    gnc_hook_add_dangler(HOOK_UI_SHUTDOWN, (GFunc)gnc_file_quit, NULL);
-
-    /* Install Price Quote Sources */
-    gnc_update_splash_screen(_("Checking Finance::Quote..."), GNC_SPLASH_PERCENTAGE_UNKNOWN);
-    scm_c_use_module("gnucash price-quotes");
-    scm_c_eval_string("(gnc:price-quotes-install-sources)");
-
-    gnc_hook_run(HOOK_STARTUP, NULL);
-
-    if (!nofile && (fn = get_file_to_load()))
-    {
-        gnc_update_splash_screen(_("Loading data..."), GNC_SPLASH_PERCENTAGE_UNKNOWN);
-        gnc_file_open_file(fn, /*open_readonly*/ FALSE);
-        g_free(fn);
-    }
-    else if (gnc_prefs_get_bool(GNC_PREFS_GROUP_NEW_USER, GNC_PREF_FIRST_STARTUP))
-    {
-        gnc_destroy_splash_screen();
-        gnc_ui_new_user_dialog();
-    }
-    /* Ensure temporary preferences are temporary */
-    gnc_prefs_reset_group (GNC_PREFS_GROUP_WARNINGS_TEMP);
-
-    gnc_destroy_splash_screen();
-    gnc_main_window_show_all_windows();
-
-    gnc_hook_run(HOOK_UI_POST_STARTUP, NULL);
-    gnc_ui_start_event_loop();
-    gnc_hook_remove_dangler(HOOK_UI_SHUTDOWN, (GFunc)gnc_file_quit);
-
-    gnc_shutdown(0);
-    return;
-}
-
-static void
-gnc_log_init()
-{
-    if (log_to_filename != NULL)
-    {
-        qof_log_init_filename_special(log_to_filename);
-    }
-    else
-    {
-        /* initialize logging to our file. */
-        gchar *tracefilename;
-        tracefilename = g_build_filename(g_get_tmp_dir(), "gnucash.trace",
-                                         (gchar *)NULL);
-        qof_log_init_filename(tracefilename);
-        g_free(tracefilename);
-    }
-
-    // set a reasonable default.
-    qof_log_set_default(QOF_LOG_WARNING);
-
-    gnc_log_default();
-
-    if (gnc_prefs_is_debugging_enabled())
-    {
-        qof_log_set_level("", QOF_LOG_INFO);
-        qof_log_set_level("qof", QOF_LOG_INFO);
-        qof_log_set_level("gnc", QOF_LOG_INFO);
-    }
-
-    {
-        gchar *log_config_filename;
-        log_config_filename = gnc_build_dotgnucash_path("log.conf");
-        if (g_file_test(log_config_filename, G_FILE_TEST_EXISTS))
-            qof_log_parse_log_config(log_config_filename);
-        g_free(log_config_filename);
-    }
-
-    if (log_flags != NULL)
-    {
-        int i = 0;
-        for (; log_flags[i] != NULL; i++)
-        {
-            QofLogLevel level;
-            gchar **parts = NULL;
-
-            gchar *log_opt = log_flags[i];
-            parts = g_strsplit(log_opt, "=", 2);
-            if (parts == NULL || parts[0] == NULL || parts[1] == NULL)
-            {
-                g_warning("string [%s] not parseable", log_opt);
-                continue;
-            }
-
-            level = qof_log_level_from_string(parts[1]);
-            qof_log_set_level(parts[0], level);
-            g_strfreev(parts);
-        }
-    }
-}
-
-int
-main(int argc, char ** argv)
-{
-    gchar *sys_locale = NULL;
-#if !defined(G_THREADS_ENABLED) || defined(G_THREADS_IMPL_NONE)
-#    error "No GLib thread implementation available!"
-#endif
-#ifdef ENABLE_BINRELOC
-    {
-        GError *binreloc_error = NULL;
-        if (!gnc_gbr_init(&binreloc_error))
-        {
-            g_print("main: Error on gnc_gbr_init: %s\n", binreloc_error->message);
-            g_error_free(binreloc_error);
-        }
-    }
-#endif
-
-    /* This should be called before gettext is initialized
-     * The user may have configured a different language via
-     * the environment file.
-     */
-#ifdef MAC_INTEGRATION
-    set_mac_locale();
-#endif
-    gnc_environment_setup();
-#ifndef MAC_INTEGRATION /* setlocale already done */
-    sys_locale = g_strdup (setlocale (LC_ALL, ""));
-    if (!sys_locale)
-      {
-        g_print ("The locale defined in the environment isn't supported. "
-                 "Falling back to the 'C' (US English) locale\n");
-        g_setenv ("LC_ALL", "C", TRUE);
-        setlocale (LC_ALL, "C");
-      }
-#endif
-#ifdef HAVE_GETTEXT
-    {
-        gchar *localedir = gnc_path_get_localedir();
-        bindtextdomain(GETTEXT_PACKAGE, localedir);
-        textdomain(GETTEXT_PACKAGE);
-        bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
-        g_free(localedir);
-    }
-#endif
-    
-    gnc_parse_command_line(&argc, &argv);
-    gnc_print_unstable_message();
-
-    gnc_log_init();
-
-#ifndef MAC_INTEGRATION
-    /* Write some locale details to the log to simplify debugging
-     * To be on the safe side, only do this if not on OS X,
-     * to avoid unintentionally messing up the locale settings */
-    PINFO ("System locale returned %s", sys_locale ? sys_locale : "(null)");
-    PINFO ("Effective locale set to %s.", setlocale (LC_ALL, ""));
-    g_free (sys_locale);
-#endif
-
-    /* If asked via a command line parameter, fetch quotes only */
-    if (add_quotes_file)
-    {
-        /* First initialize the module system, even though gtk hasn't been initialized. */
-        gnc_module_system_init();
-        scm_boot_guile(argc, argv, inner_main_add_price_quotes, 0);
-        exit(0);  /* never reached */
-    }
-
-    /* We need to initialize gtk before looking up all modules */
-    if(!gtk_init_check (&argc, &argv))
-    {
-        g_printerr(_("%s\nRun '%s --help' to see a full list of available command line options.\n"),
-                   _("Error: could not initialize graphical user interface and option add-price-quotes was not set.\n"
-                     "       Perhaps you need to set the $DISPLAY environment variable ?"),
-                   argv[0]);
-        return 1;
-    }
-
-    /* Now the module files are looked up, which might cause some library
-    initialization to be run, hence gtk must be initialized beforehand. */
-    gnc_module_system_init();
-
-    gnc_gui_init();
-    scm_boot_guile(argc, argv, inner_main, 0);
-    exit(0); /* never reached */
-}
diff --git a/src/bin/overrides/gnucash-build-env.in b/src/bin/overrides/gnucash-build-env.in
deleted file mode 100644
index ec2e5df..0000000
--- a/src/bin/overrides/gnucash-build-env.in
+++ /dev/null
@@ -1,89 +0,0 @@
-#!/bin/sh
-
-# Usage: gnucash-build-env
-
-# Usage: gnucash-build-env any-cmd [ args ... ]
-# runs any-cmd in gnucash's build environment.
-
-# As with all the other gnucash overrides scripts, expects PATH to be
-# set appropriately.
-
-top_srcdir="@-GNC_SRCDIR-@"
-top_builddir="@-GNC_BUILDDIR-@"
-
-if test "${GNC_CONFIG_PATH}"x = x
-then
-  GNC_CONFIG_PATH="(\"${top_srcdir}/src/scm\")"
-  export GNC_CONFIG_PATH
-fi
-
-if test "${GNC_SHARE_PATH}"x = x
-then
-  GNC_SHARE_PATH="(\"${top_srcdir}/src/scm\" \"${top_srcdir}/src/quotes\")"
-  export GNC_SHARE_PATH
-fi
-
-if test "${GNC_DOC_PATH}"x = x
-then
-  GNC_DOC_PATH="(\"${top_srcdir}/src/scm\")"
-  export GNC_DOC_PATH
-fi
-
-set +x
-eval `${top_srcdir}/src/gnc-test-env.pl \
-  --gnc-module-dir ${top_builddir}/src/engine \
-  --gnc-module-dir ${top_builddir}/src/backend/xml \
-  --gnc-module-dir ${top_builddir}/src/network-utils \
-  --gnc-module-dir ${top_builddir}/src/calculation \
-  --gnc-module-dir ${top_builddir}/src/tax/us \
-  --gnc-module-dir ${top_builddir}/src/app-utils \
-  --gnc-module-dir ${top_builddir}/src/gnome-utils \
-  --gnc-module-dir ${top_builddir}/src/gnome-search \
-  --gnc-module-dir ${top_builddir}/src/report/locale-specific/us \
-  --gnc-module-dir ${top_builddir}/src/report/report-gnome \
-  --gnc-module-dir ${top_builddir}/src/report/stylesheets \
-  --gnc-module-dir ${top_builddir}/src/register/register-core \
-  --gnc-module-dir ${top_builddir}/src/register/register-gnome \
-  --gnc-module-dir ${top_builddir}/src/register/ledger-core \
-  --gnc-module-dir ${top_builddir}/src/import-export \
-  --gnc-module-dir ${top_builddir}/src/import-export/qif-import \
-  --gnc-module-dir ${top_builddir}/src/import-export/ofx \
-  --gnc-module-dir ${top_builddir}/src/import-export/hbci \
-  --gnc-module-dir ${top_builddir}/src/import-export/log-replay \
-  --guile-load-dir ${top_builddir}/src/core-utils \
-  --guile-load-dir ${top_builddir}/src/gnc-module \
-  --guile-load-dir ${top_builddir}/src/engine \
-  --guile-load-dir ${top_builddir}/src/scm \
-  --guile-load-dir ${top_builddir}/src/tax/us \
-  --guile-load-dir ${top_builddir}/src/app-utils \
-  --guile-load-dir ${top_builddir}/src/gnome-utils \
-  --guile-load-dir ${top_builddir}/src/report/report-system \
-  --guile-load-dir ${top_builddir}/src/report/standard-reports \
-  --guile-load-dir ${top_builddir}/src/report/business-reports \
-  --guile-load-dir ${top_builddir}/src/report/utility-reports \
-  --guile-load-dir ${top_builddir}/src/report/locale-specific/us \
-  --guile-load-dir ${top_builddir}/src/report/report-gnome \
-  --guile-load-dir ${top_builddir}/src/report/stylesheets \
-  --guile-load-dir ${top_builddir}/src/import-export/qif-import \
-  --library-dir    ${top_builddir}/src/test-core \
-  --library-dir    ${top_builddir}/src/core-utils \
-  --library-dir    ${top_builddir}/src/calculation \
-  --library-dir    ${top_builddir}/src/app-utils \
-  --library-dir    ${top_builddir}/src/gnome-utils \
-  --library-dir    ${top_builddir}/src/html \
-  --library-dir    ${top_builddir}/src/engine \
-  --library-dir    ${top_builddir}/src/backend/xml \
-  --library-dir    ${top_builddir}/src/backend/sql  \
-  --library-dir    ${top_builddir}/src/gnc-module \
-  --library-dir    ${top_builddir}/src/gnome \
-  --library-dir    ${top_builddir}/src/gnome-search \
-  --library-dir    ${top_builddir}/src/import-export \
-  --library-dir    ${top_builddir}/src/register/register-gnome \
-  --library-dir    ${top_builddir}/src/register/register-core \
-  --library-dir    ${top_builddir}/src/register/ledger-core \
-  --library-dir    ${top_builddir}/src/report/report-system \
-  --library-dir    ${top_builddir}/src/report/report-gnome
-  `
-LD_LIBRARY_PATH="${DYLD_LIBRARY_PATH}"
-
-exec "$@"
diff --git a/src/cmake_modules/GncAddSchemeTargets.cmake b/src/cmake_modules/GncAddSchemeTargets.cmake
deleted file mode 100644
index f30b9c2..0000000
--- a/src/cmake_modules/GncAddSchemeTargets.cmake
+++ /dev/null
@@ -1,183 +0,0 @@
-# GncAddSchemeTargets.cmake Define a command to compile Scheme programs with Guile
-# Copyright (c) 2015, Rob Gowin
-# Copyright 2017 John Ralls <jralls at ceridwen.us>
-#
-# 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 at gnu.org
-
-#Guile and ltdl require MSYS paths on MinGW-w64; this function transforms them.
-FUNCTION(MAKE_UNIX_PATH PATH)
-    STRING(REGEX REPLACE "^([A-Za-z]):" "/\\1" newpath ${${PATH}})
-    string(REGEX REPLACE "\\\\" "/" newpath ${newpath})
-    SET(${PATH} ${newpath} PARENT_SCOPE)
-ENDFUNCTION()
-
-#PATH variables in the environment are separated by colons, but CMake lists are separated by semicolons. This function transforms the separators.
-FUNCTION(MAKE_UNIX_PATH_LIST PATH)
-    STRING(REPLACE ";" ":" newpath "${${PATH}}")
-    SET(${PATH} ${newpath} PARENT_SCOPE)
-ENDFUNCTION()
-
-FUNCTION(GNC_ADD_SCHEME_TARGETS _TARGET _SOURCE_FILES _OUTPUT_DIR
-                                _GUILE_MODULES _GUILE_LOAD_DIRS
-				_GUILE_LIBRARY_DIRS _GUILE_DEPENDS
-				MAKE_LINKS)
-  SET(__DEBUG FALSE)
-  IF (__DEBUG)
-    MESSAGE("Parameters to COMPILE_SCHEME for target ${_TARGET}")
-    MESSAGE("   SOURCE_FILES: ${_SOURCE_FILES}")
-    MESSAGE("   GUILE_MODULES: ${_GUILE_MODULES}")
-    MESSAGE("   GUILE_LOAD_DIRS: ${_GUILE_LOAD_DIRS}")
-    MESSAGE("   GUILE_LIBRARY_DIRS: ${_GUILE_LIBRARY_DIRS}")
-    MESSAGE("   GUILE_DEPENDS: ${_GUILE_DEPENDS}")
-    MESSAGE("   DIRECTORIES: ${BINDIR_BUILD}, ${LIBDIR_BUILD}, ${DATADIR_BUILD}")
-  ENDIF(__DEBUG)
-  SET(_CMD "create_symlink")
-  IF(WIN32)
-    SET(_CMD "copy")
-  ENDIF(WIN32)
-  SET(current_srcdir ${CMAKE_CURRENT_SOURCE_DIR})
-  SET(current_bindir ${CMAKE_CURRENT_BINARY_DIR})
-  SET(build_bindir ${BINDIR_BUILD})
-  SET(build_libdir ${LIBDIR_BUILD})
-  SET(build_datadir ${DATADIR_BUILD})
-  IF(MINGW64)
-    MAKE_UNIX_PATH(build_bindir)
-    MAKE_UNIX_PATH(build_libdir)
-    MAKE_UNIX_PATH(build_datadir)
-    MAKE_UNIX_PATH(current_bindir)
-    MAKE_UNIX_PATH(current_srcdir)
-    MAKE_UNIX_PATH(CMAKE_BINARY_DIR)
-    MAKE_UNIX_PATH(CMAKE_SOURCE_DIR)
-  ENDIF(MINGW64)
-
-  # For guile 1, we simple link (or copy, for Windows) each source file to the dest directory
-  IF(HAVE_GUILE1 OR MAKE_LINKS)
-    SET(_LINK_DIR ${DATADIR_BUILD}/gnucash/scm/${_OUTPUT_DIR})
-    FILE(MAKE_DIRECTORY ${_LINK_DIR})
-    SET(_SCHEME_LINKS "")
-    FOREACH(scheme_file ${_SOURCE_FILES})
-      SET(_SOURCE_FILE ${current_srcdir}/${scheme_file})
-      IF(IS_ABSOLUTE ${scheme_file})
-        SET(_SOURCE_FILE ${scheme_file})
-      ENDIF()
-      GET_FILENAME_COMPONENT(name ${scheme_file} NAME)
-      SET(_OUTPUT_FILE ${_LINK_DIR}/${name})
-      IF(NOT EXISTS ${_OUTPUT_FILE})
-        LIST(APPEND _SCHEME_LINKS ${_OUTPUT_FILE})
-        ADD_CUSTOM_COMMAND(
-            OUTPUT ${_OUTPUT_FILE}
-            COMMAND ${CMAKE_COMMAND} -E ${_CMD} ${_SOURCE_FILE} ${_OUTPUT_FILE}
-        )
-      ENDIF()
-    ENDFOREACH(scheme_file)
-    IF(HAVE_GUILE1)
-      ADD_CUSTOM_TARGET(${_TARGET} ALL DEPENDS ${_SCHEME_LINKS})
-    ELSE()
-      ADD_CUSTOM_TARGET(${_TARGET}-links ALL DEPENDS ${_SCHEME_LINKS})
-    ENDIF()
-  ENDIF(HAVE_GUILE1 OR MAKE_LINKS)
-
-  IF(HAVE_GUILE2)
-    # Construct the guile source and compiled load paths
-
-    SET(_GUILE_LOAD_PATH "${current_srcdir}"
-        "${current_bindir}" "${CMAKE_BINARY_DIR}/src/scm")  # to pick up generated build-config.scm
-    SET(_GUILE_LOAD_COMPILED_PATH "${current_bindir}")
-    FOREACH (load_item ${_GUILE_LOAD_DIRS})
-      LIST(APPEND _GUILE_LOAD_PATH "${CMAKE_SOURCE_DIR}/${load_item}")
-    ENDFOREACH(load_item)
-
-    SET(_GUILE_CACHE_DIR ${LIBDIR_BUILD}/gnucash/scm/ccache/2.0)
-    SET(_GUILE_LOAD_PATH "${current_srcdir}")
-    IF (MAKE_LINKS)
-      LIST(APPEND _GUILE_LOAD_PATH "${build_datadir}/gnucash/scm")
-    ENDIF()
-    SET(_GUILE_LOAD_COMPILED_PATH ${build_libdir}/gnucash/scm/ccache/2.0)
-
-    SET(_TARGET_FILES "")
-
-    FOREACH(source_file ${_SOURCE_FILES})
-      SET(guile_depends ${_GUILE_DEPENDS})
-      GET_FILENAME_COMPONENT(basename ${source_file} NAME_WE)
-
-      SET(output_file ${basename}.go)
-      SET(_TMP_OUTPUT_DIR ${_OUTPUT_DIR})
-      IF (_TMP_OUTPUT_DIR)
-        SET(output_file ${_OUTPUT_DIR}/${basename}.go)
-      ENDIF()
-      SET(output_file ${_GUILE_CACHE_DIR}/${output_file})
-      LIST(APPEND _TARGET_FILES ${output_file})
-
-      SET(source_file_abs_path ${CMAKE_CURRENT_SOURCE_DIR}/${source_file})
-      IF (IS_ABSOLUTE ${source_file})
-        SET(source_file_abs_path ${source_file})
-      ENDIF()
-      IF (__DEBUG)
-        MESSAGE("ADD_CUSTOM_COMMAND: output = ${output_file}")
-      ENDIF()
-      SET(CMAKE_COMMMAND_TMP "")
-      IF (${CMAKE_VERSION} VERSION_GREATER 3.1)
-        SET(CMAKE_COMMAND_TMP ${CMAKE_COMMAND} -E env)
-      ENDIF()
-      IF (MINGW64)
-	set(fpath "")
-	foreach(dir $ENV{PATH})
-	  MAKE_UNIX_PATH(dir)
-	  set(fpath "${fpath}${dir}:")
-	endforeach(dir)
-        SET(LIBRARY_PATH "PATH=\"${build_bindir}:${fpath}\"")
-      ELSE (MINGW64)
-        SET (LIBRARY_PATH "LD_LIBRARY_PATH=${LIBDIR_BUILD}:${LIBDIR_BUILD}/gnucash:${_GUILE_LD_LIBRARY_PATH}")
-      ENDIF (MINGW64)
-      IF (APPLE)
-        SET (LIBRARY_PATH "DYLD_LIBRARY_PATH=${LIBDIR_BUILD}:${LIBDIR_BUILD}/gnucash:${_GUILE_LD_LIBRARY_PATH}")
-      ENDIF (APPLE)
-      SET(_GNC_MODULE_PATH "")
-      IF(MINGW64)
-	SET(_GNC_MODULE_PATH "${build_bindir}")
-      ELSE(MINGW64)
-        SET(_GNC_MODULE_PATH "${LIBDIR_BUILD}" "${LIBDIR_BUILD}/gnucash" "${GNC_MODULE_PATH}")
-      ENDIF(MINGW64)
-      MAKE_UNIX_PATH_LIST(_GUILE_LOAD_PATH)
-      MAKE_UNIX_PATH_LIST(_GUILE_LOAD_COMPILED_PATH)
-      MAKE_UNIX_PATH_LIST(_GUILE_MODULES)
-      MAKE_UNIX_PATH_LIST(_GUILE_LD_LIBRARY_PATH)
-      MAKE_UNIX_PATH_LIST(_GNC_MODULE_PATH)
-      IF (__DEBUG)
-	MESSAGE("  ")
-	MESSAGE("   LIBRARY_PATH: ${LIBRARY_PATH}")
-	MESSAGE("   GUILE_LOAD_PATH: ${_GUILE_LOAD_PATH}")
-	MESSAGE("   GUILE_LOAD_COMPILED_PATH: ${_GUILE_LOAD_COMPILED_PATH}")
-	MESSAGE("   GNC_MODULE_PATH: ${_GNC_MODULE_PATH}")
-      ENDIF(__DEBUG)
-      ADD_CUSTOM_COMMAND(
-        OUTPUT ${output_file}
-        COMMAND ${CMAKE_COMMAND_TMP}
-	   ${LIBRARY_PATH}
-           GNC_UNINSTALLED=YES
-           GNC_BUILDDIR=${CMAKE_BINARY_DIR}
-           GUILE_LOAD_PATH=${_GUILE_LOAD_PATH}
-           GUILE_LOAD_COMPILED_PATH=${_GUILE_LOAD_COMPILED_PATH}
-           GNC_MODULE_PATH=${_GNC_MODULE_PATH}
-           ${GUILE_EXECUTABLE} -e '\(@@ \(guild\) main\)' -s ${GUILD_EXECUTABLE} compile -o ${output_file} ${source_file_abs_path}
-        DEPENDS ${guile_depends}
-        MAIN_DEPENDENCY ${source_file_abs_path}
-      )
-    ENDFOREACH(source_file)
-    IF (__DEBUG)
-      MESSAGE("TARGET_FILES are ${_TARGET_FILES}")
-    ENDIF(__DEBUG)
-    ADD_CUSTOM_TARGET(${_TARGET} ALL DEPENDS ${_TARGET_FILES})
-    INSTALL(FILES ${_TARGET_FILES} DESTINATION ${SCHEME_INSTALLED_CACHE_DIR}/${_OUTPUT_DIR})
-  ENDIF(HAVE_GUILE2)
-  INSTALL(FILES ${_SOURCE_FILES} DESTINATION ${SCHEME_INSTALLED_SOURCE_DIR}/${_OUTPUT_DIR})
-ENDFUNCTION(GNC_ADD_SCHEME_TARGETS)
diff --git a/src/cmake_modules/GncAddSwigCommand.cmake b/src/cmake_modules/GncAddSwigCommand.cmake
deleted file mode 100644
index cffd611..0000000
--- a/src/cmake_modules/GncAddSwigCommand.cmake
+++ /dev/null
@@ -1,31 +0,0 @@
-# Copyright (c) 2010, Christian Stimming
-
-
-# Redistribution and use is allowed according to the terms of the BSD license.
-# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
-
-MACRO (GNC_ADD_SWIG_COMMAND _target _output _input)
-
-ADD_CUSTOM_COMMAND (
-  OUTPUT ${_output}
-  DEPENDS ${_input} ${CMAKE_SOURCE_DIR}/src/base-typemaps.i ${ARGN}
-COMMAND ${SWIG_EXECUTABLE} -guile ${SWIG_ARGS} -Linkage module -I${CMAKE_SOURCE_DIR}/src/engine -I${CMAKE_SOURCE_DIR}/src  -o ${_output} ${_input}
-)
-
-ADD_CUSTOM_TARGET(${_target} DEPENDS ${_output})
-
-ENDMACRO (GNC_ADD_SWIG_COMMAND)
-
-
-MACRO (GNC_ADD_SWIG_PYTHON_COMMAND _target _output _input)
-
-  ADD_CUSTOM_COMMAND(OUTPUT ${_output}
-
-    COMMAND ${SWIG_EXECUTABLE} -python -Wall -Werror ${SWIG_ARGS}
-       -I${CMAKE_SOURCE_DIR}/src
-       -I${CMAKE_SOURCE_DIR}/src/engine -I${CMAKE_SOURCE_DIR}/src/app-utils
-       -o ${_output} ${_input}
-    DEPENDS ${_input} ${CMAKE_SOURCE_DIR}/src/base-typemaps.i ${ARGN}
-  )
-  ADD_CUSTOM_TARGET(${_target} ALL DEPENDS ${_output} ${CMAKE_SOURCE_DIR}/src/base-typemaps.i ${_input} ${ARGN})
-ENDMACRO()
diff --git a/src/cmake_modules/GncAddTest.cmake b/src/cmake_modules/GncAddTest.cmake
deleted file mode 100644
index fc87714..0000000
--- a/src/cmake_modules/GncAddTest.cmake
+++ /dev/null
@@ -1,163 +0,0 @@
-
-
-FUNCTION(GET_GUILE_ENV)
-  SET(_GNC_MODULE_PATH ${CMAKE_BINARY_DIR}/lib:${CMAKE_BINARY_DIR}/lib/gnucash)
-  IF (WIN32)
-    SET(_GNC_MODULE_PATH ${CMAKE_BINARY_DIR}/bin)
-  ENDIF()
-  SET(env "")
-  LIST(APPEND env "GNC_UNINSTALLED=yes")
-  LIST(APPEND env "GNC_BUILDDIR=${CMAKE_BINARY_DIR}")
-  LIST(APPEND env "GUILE_WARN_DEPRECATED=no")
-  IF (APPLE)
-    LIST(APPEND env "DYLD_LIBRARY_PATH=${_GNC_MODULE_PATH}")
-  ENDIF()
-  IF (UNIX)
-    LIST(APPEND env LD_LIBRARY_PATH=${_GNC_MODULE_PATH})
-  ENDIF()
-  IF (MINGW64)
-    set(fpath "")
-    set(path $ENV{PATH})
-    list(INSERT path 0 ${CMAKE_BINARY_DIR}/bin)
-    foreach(dir ${path})
-      string(REGEX REPLACE "^([A-Za-z]):" "/\\1" dir ${dir})
-      string(REGEX REPLACE "\\\\" "/" dir ${dir})
-      set(fpath "${fpath}${dir}:")
-    endforeach(dir)
-    LIST(APPEND env "PATH=${fpath}")
-    set(compiled_path "${CMAKE_BINARY_DIR}/lib/gnucash/scm/ccache/2.0")
-    string(REGEX REPLACE "^([A-Za-z]):" "/\\1" compiled_path ${compiled_path})
-    LIST(APPEND env GUILE_LOAD_COMPILED_PATH=${compiled_path})
-  ENDIF(MINGW64)
-  LIST(APPEND env "GNC_MODULE_PATH=${_GNC_MODULE_PATH}")
-  LIST(APPEND env "GUILE=${GUILE_EXECUTABLE}")
-
-  IF (NOT WIN32)
-    LIST(APPEND env "GUILE_LOAD_COMPILED_PATH=${CMAKE_BINARY_DIR}/lib/gnucash/scm/ccache/2.0")
-  ENDIF()
-  SET(guile_load_paths "")
-  LIST(APPEND guile_load_paths ${CMAKE_CURRENT_SOURCE_DIR}/mod-foo)
-  LIST(APPEND guile_load_paths ${CMAKE_CURRENT_SOURCE_DIR}/mod-bar)
-  LIST(APPEND guile_load_paths ${CMAKE_CURRENT_SOURCE_DIR}/mod-baz)
-  IF (WIN32)
-    LIST(APPEND guile_load_paths ${CMAKE_BINARY_DIR}/share/gnucash/scm)
-  ENDIF()
-  SET(guile_load_path "${guile_load_paths}")
-  IF (MINGW64)
-    set(new_path "")
-    FOREACH(load_item ${guile_load_path})
-      string(REGEX REPLACE "^([A-Za-z]):" "/\\1" load_item ${load_item})
-      list(APPEND new_path ${load_item})
-    ENDFOREACH(load_item)
-    set(guile_load_path ${new_path})
-  ENDIF (MINGW64)
-  IF (WIN32 AND NOT MINGW64)
-    STRING(REPLACE ";" "\\\\;" GUILE_LOAD_PATH "${guile_load_path}")
-  ELSE()
-    STRING(REPLACE ";" ":" GUILE_LOAD_PATH "${guile_load_path}")
-  ENDIF()
-  LIST(APPEND env GUILE_LOAD_PATH=${GUILE_LOAD_PATH})
-  SET(GUILE_ENV ${env} PARENT_SCOPE)
-ENDFUNCTION()
-
-
-FUNCTION(GNC_ADD_TEST _TARGET _SOURCE_FILES TEST_INCLUDE_VAR_NAME TEST_LIBS_VAR_NAME)
-  SET(HAVE_ENV_VARS FALSE)
-  IF (${ARGC} GREATER 4)
-    # Extra arguments are treated as environment variables
-    SET(HAVE_ENV_VARS TRUE)
-  ENDIF()
-  SET(TEST_INCLUDE_DIRS ${${TEST_INCLUDE_VAR_NAME}})
-  SET(TEST_LIBS ${${TEST_LIBS_VAR_NAME}})
-  SET_SOURCE_FILES_PROPERTIES (${_SOURCE_FILES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
-  ADD_EXECUTABLE(${_TARGET} EXCLUDE_FROM_ALL ${_SOURCE_FILES})
-  TARGET_LINK_LIBRARIES(${_TARGET} ${TEST_LIBS})
-  TARGET_INCLUDE_DIRECTORIES(${_TARGET} PRIVATE ${TEST_INCLUDE_DIRS})
-  IF (${HAVE_ENV_VARS})
-    SET(CMAKE_COMMAND_TMP "")
-    IF (${CMAKE_VERSION} VERSION_GREATER 3.1)
-      SET(CMAKE_COMMAND_TMP ${CMAKE_COMMAND} -E env "GNC_BUILDDIR=${CMAKE_BINARY_DIR};${ARGN}")
-    ENDIF()
-    ADD_TEST(${_TARGET} ${CMAKE_COMMAND_TMP}
-      ${CMAKE_BINARY_DIR}/bin/${_TARGET}
-    )
-    SET_TESTS_PROPERTIES(${_TARGET} PROPERTIES ENVIRONMENT "GNC_BUILDDIR=${CMAKE_BINARY_DIR};${ARGN}")
-  ELSE()
-    ADD_TEST(NAME ${_TARGET} COMMAND ${_TARGET})
-    SET_TESTS_PROPERTIES(${_TARGET} PROPERTIES ENVIRONMENT "GNC_BUILDDIR=${CMAKE_BINARY_DIR}")
-  ENDIF()
-  ADD_DEPENDENCIES(check ${_TARGET})
-ENDFUNCTION()
-
-FUNCTION(GNC_ADD_TEST_WITH_GUILE _TARGET _SOURCE_FILES TEST_INCLUDE_VAR_NAME TEST_LIBS_VAR_NAME)
-  GET_GUILE_ENV()
-  GNC_ADD_TEST(${_TARGET} "${_SOURCE_FILES}" "${TEST_INCLUDE_VAR_NAME}" "${TEST_LIBS_VAR_NAME}"
-    "${GUILE_ENV};${ARGN}"
-  )
-ENDFUNCTION()
-
-
-FUNCTION(GNC_ADD_SCHEME_TEST _TARGET _SOURCE_FILE)
-  SET(CMAKE_COMMAND_TMP "")
-  IF (${CMAKE_VERSION} VERSION_GREATER 3.1)
-    SET(CMAKE_COMMAND_TMP ${CMAKE_COMMAND} -E env)
-  ENDIF()
-  ADD_TEST(${_TARGET} ${CMAKE_COMMAND_TMP}
-    ${GUILE_EXECUTABLE} --debug -l ${CMAKE_CURRENT_SOURCE_DIR}/${_SOURCE_FILE} -c "(exit (run-test))"
-  )
-  GET_GUILE_ENV()
-  SET_TESTS_PROPERTIES(${_TARGET} PROPERTIES ENVIRONMENT "${GUILE_ENV};${ARGN}")
-ENDFUNCTION()
-
-FUNCTION(GNC_GTEST_CONFIGURE)
-  MESSAGE(STATUS "Checking for GTEST")
-  IF (NOT DEFINED ${GTEST_ROOT})
-    SET(GTEST_ROOT $ENV{GTEST_ROOT})
-  ENDIF()
-  IF (NOT DEFINED ${GMOCK_ROOT})
-    SET(GMOCK_ROOT $ENV{GMOCK_ROOT})
-  ENDIF()
-  FIND_PATH(GTEST_INCLUDE_DIR gtest/gtest.h
-    PATHS ${GTEST_ROOT}/include ${GMOCK_ROOT}/gtest/include /usr/include)
-  FIND_PATH(GTEST_SRC_DIR src/gtest-all.cc
-    PATHS ${GTEST_ROOT} ${GMOCK_ROOT}/gtest /usr/src/gtest)
-  FIND_LIBRARY(GTEST_SHARED_LIB gtest)
-  FIND_LIBRARY(GTEST_MAIN_LIB gtest_main)
-  IF ((GTEST_SHARED_LIB OR GTEST_SRC_DIR) AND GTEST_INCLUDE_DIR)
-    SET(THREADS_PREFER_PTHREAD_FLAG ON)
-    FIND_PACKAGE(Threads REQUIRED)
-    SET(GTEST_FOUND YES CACHE INTERNAL "Found GTest")
-    IF(GTEST_SHARED_LIB)
-      SET(GTEST_LIB "${GTEST_SHARED_LIB};${GTEST_MAIN_LIB}" PARENT_SCOPE)
-      UNSET(GTEST_SRC_DIR CACHE)
-    ELSE()
-      SET(GTEST_SRC "${GTEST_SRC_DIR}/src/gtest_main.cc" PARENT_SCOPE)
-      SET(GTEST_LIB "${CMAKE_BINARY_DIR}/src/test-core/libgtest.a" PARENT_SCOPE)
-    ENDIF()
-  ELSE()
-    MESSAGE(FATAL_ERROR "GTEST not found. Please install it or set GTEST_ROOT or GMOCK_ROOT")
-  ENDIF()
-
-  MESSAGE(STATUS "Checking for GMOCK")
-  FIND_PATH(GMOCK_INCLUDE_DIR gmock/gmock.h
-    PATHS ${GMOCK_ROOT}/include /usr/include)
-  unset(GMOCK_SRC_DIR CACHE)
-  FIND_PATH(GMOCK_SRC_DIR src/gmock-all.cc
-    PATHS ${GMOCK_ROOT} /usr/src/gmock)
-  if (GMOCK_SRC_DIR)
-    SET(GMOCK_MAIN_SRC_DIR "${GMOCK_SRC_DIR}/src")
-  else()
-    FIND_PATH(GMOCK_SRC_DIR gmock-all.cc
-      PATHS ${GMOCK_ROOT} /usr/src/gmock)
-    if (GMOCK_SRC_DIR)
-      SET(GMOCK_MAIN_SRC_DIR "${GMOCK_SRC_DIR}")
-    endif()
-  endif()
-  if (GMOCK_INCLUDE_DIR AND GMOCK_SRC_DIR)
-    SET(GMOCK_FOUND YES PARENT_SCOPE)
-    SET(GMOCK_SRC "${GMOCK_MAIN_SRC_DIR}/gmock-all.cc" PARENT_SCOPE)
-    SET(GMOCK_LIB "${CMAKE_BINARY_DIR}/src/test-core/libgmock.a" PARENT_SCOPE)
-  ELSE()
-    MESSAGE(FATAL_ERROR "GMOCK not found. Please install it or set GMOCK_ROOT")
-  ENDIF()
-ENDFUNCTION()
diff --git a/src/cmake_modules/MakeDist.cmake b/src/cmake_modules/MakeDist.cmake
deleted file mode 100644
index b31f946..0000000
--- a/src/cmake_modules/MakeDist.cmake
+++ /dev/null
@@ -1,207 +0,0 @@
-# This file implements the process of making source distribution tarballs. It expects to find list in
-# 'dist_manifest.txt' of all of the files to be included in the distribution, EXCEPT those
-# files that are generated. The list of generated files is specified in MakeDistFiles.cmake in the
-# COPY_FROM_BUILD and COPY_FROM_BUILD_2 variables.
-#
-# Given all of these files, the procedure is to:
-# 1. Remove any existing dist directory and make a new one.
-# 2. Copy of all the files in dist_manifest.text, COPY_FROM_BUILD and COPY_FROM_BUILD_2
-#    into the dist directory.
-# 3. Run autogen.sh if build a dist from Git.
-# 4. Create the tarball and compress it with gzip and bzip2.
-# 5. Then remove the dist directory.
-
-include(${CMAKE_MODULE_PATH}/MakeDistFiles.cmake)
-
-FUNCTION(FIND_AUTOMAKE AUTOMAKE_VAR ACLOCAL_VAR AUTOMAKE_VERSION_VAR NEED_OVERRIDE_VAR)
-    FIND_PROGRAM(AUTOMAKE automake)
-    EXECUTE_PROCESS(
-            COMMAND ${AUTOMAKE} --version
-            RESULT_VARIABLE AUTOMAKE_RESULT
-            OUTPUT_VARIABLE AUTOMAKE_OUTPUT
-            ERROR_VARIABLE AUTOMAKE_ERROR
-    )
-
-    # GnuCash will not pass distcheck under automake 1.15+
-    # See if automake-1.11 is available. If so use, that
-    SET(AUTOMAKE_OK TRUE)
-    SET(NEED_OVERRIDE FALSE)
-    IF(${AUTOMAKE} STREQUAL AUTOMAKE-NOTFOUND)
-      SET(AUTOMAKE_OK FALSE)
-    ELSE()
-      STRING(REGEX REPLACE ".*automake \\(GNU automake\\) ([0-9]\\.[0-9]+).*" "\\1" AUTOMAKE_VERSION "${AUTOMAKE_OUTPUT}")
-
-      IF (${AUTOMAKE_VERSION} VERSION_GREATER "1.14")
-        SET(AUTOMAKE_OK FALSE)
-      ELSE()
-        FIND_PROGRAM(ACLOCAL aclocal)
-        IF(${ACLOCAL} STREQUAL ACLOCAL-NOTFOUND)
-            MESSAGE(FATAL_ERROR "Found ok version of automake, but can't find aclocal")
-        ENDIF()
-      ENDIF()
-    ENDIF()
-    IF (NOT AUTOMAKE_OK)
-        FIND_PROGRAM(AUTOMAKE11 automake-1.11)
-        IF (${AUTOMAKE11} STREQUAL AUTOMAKE11-NOTFOUND)
-            IF (${AUTOMAKE} STREQUAL AUTOMAKE-NOTFOUND)
-                MESSAGE(FATAL_ERROR "Can't find 'automake' or 'automake-1.11'")
-            ELSE()
-                MESSAGE("Automake is incompatible version 1.15+, but can't find automake-1.11")
-                MESSAGE("  You can set AUTOTOOLS_IN_DIST=OFF to exclude autotools support.")
-                MESSAGE(FATAL_ERROR "automake not compatible")
-            ENDIF()
-        ELSE()
-            SET(AUTOMAKE ${AUTOMAKE11})
-            SET(AUTOMAKE_VERSION 1.11)
-            SET(NEED_OVERRIDE TRUE)
-            FIND_PROGRAM(ACLOCAL aclocal-1.11)
-            IF(${ACLOCAL} STREQUAL ACLOCAL-NOTFOUND)
-                MESSAGE(FATAL_ERROR "Found automake-1.11, but not aclocal-1.11")
-            ENDIF()
-        ENDIF()
-    ENDIF()
-    SET(${AUTOMAKE_VAR} ${AUTOMAKE} PARENT_SCOPE)
-    SET(${ACLOCAL_VAR} ${ACLOCAL} PARENT_SCOPE)
-    SET(${AUTOMAKE_VERSION_VAR} ${AUTOMAKE_VERSION} PARENT_SCOPE)
-    SET(${NEED_OVERRIDE_VAR} ${NEED_OVERRIDE} PARENT_SCOPE)
-ENDFUNCTION()
-
-
-FUNCTION(MAKE_DIST PACKAGE_PREFIX GNUCASH_SOURCE_DIR BUILD_SOURCE_DIR BUILDING_FROM_VCS)
-
-    SET(CMAKE_COMMAND_TMP "")
-    IF (${CMAKE_VERSION} VERSION_GREATER 3.1)
-        SET(CMAKE_COMMAND_TMP ${CMAKE_COMMAND} -E env)
-    ENDIF()
-
-    # -- Remove any existing packaging directory.
-    FILE(REMOVE_RECURSE ${PACKAGE_PREFIX})
-
-    IF (EXISTS ${PACKAGE_PREFIX})
-        MESSAGE(FATAL_ERROR "Unable to remove existing dist directory \"${PACKAGE_PREFIX}\". Cannot continue.")
-    ENDIF()
-
-
-    # -- Copy in distributed files
-    IF(NOT EXISTS dist_manifest.txt)
-        message(FATAL_ERROR "Cannot find dist manifest: dist_manifest.txt")
-    ENDIF()
-
-    file(STRINGS dist_manifest.txt ALL_DIST)
-
-    FOREACH(file ${ALL_DIST})
-        IF(NOT EXISTS ${GNUCASH_SOURCE_DIR}/${file})
-            MESSAGE(FATAL_ERROR "Can't find dist file ${GNUCASH_SOURCE_DIR}/${file}")
-        ENDIF()
-        GET_FILENAME_COMPONENT(dir ${file} DIRECTORY)
-        FILE(MAKE_DIRECTORY ${PACKAGE_PREFIX}/${dir})
-        FILE(COPY ${GNUCASH_SOURCE_DIR}/${file} DESTINATION ${PACKAGE_PREFIX}/${dir})
-    ENDFOREACH()
-
-    # -- Copy in build products that are distributed.
-
-    FOREACH(file ${COPY_FROM_BUILD} ${COPY_FROM_BUILD_2})
-        EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E copy ${BUILD_SOURCE_DIR}/${file} ${PACKAGE_PREFIX}/${file})
-        IF (NOT EXISTS ${PACKAGE_PREFIX}/${file})
-            MESSAGE(FATAL_ERROR "Copy of ${BUILD_SOURCE_DIR}/${file} to dist dir '${PACKAGE_PREFIX}' failed.")
-        ENDIF()
-    ENDFOREACH()
-
-
-    CMAKE_POLICY(SET CMP0012 NEW)
-
-    IF (${BUILDING_FROM_VCS} AND AUTOTOOLS_IN_DIST)
-        FIND_AUTOMAKE(AUTOMAKE ACLOCAL AUTOMAKE_VERSION NEED_OVERRIDE)
-        # -- Run autogen.sh to cause Makefile.in files to be created.
-        SET(CMAKE_COMMAND_AUTOTOOLS ${SHELL} -c)
-        IF (${CMAKE_VERSION} VERSION_GREATER 3.1)
-            SET(CMAKE_COMMAND_AUTOTOOLS ${CMAKE_COMMAND} -E env)
-        ENDIF()
-        IF (${NEED_OVERRIDE})
-          EXECUTE_PROCESS(
-                  COMMAND ${CMAKE_COMMAND_AUTOTOOLS} AUTOMAKE=${AUTOMAKE} ACLOCAL=${ACLOCAL} ./autogen.sh
-                  WORKING_DIRECTORY ${PACKAGE_PREFIX}
-                  RESULT_VARIABLE AUTOGEN_RESULT
-                  OUTPUT_VARIABLE AUTOGEN_OUTPUT
-          )
-        ELSE()
-            EXECUTE_PROCESS(
-                    COMMAND ${CMAKE_COMMAND_AUTOTOOLS} ./autogen.sh
-                    WORKING_DIRECTORY ${PACKAGE_PREFIX}
-                    RESULT_VARIABLE AUTOGEN_RESULT
-                    OUTPUT_VARIABLE AUTOGEN_OUTPUT
-            )
-        ENDIF()
-        IF(NOT ${AUTOGEN_RESULT} STREQUAL "0")
-            MESSAGE(FATAL_ERROR "autogen.sh step failed: ${AUTOGEN_RESULT}")
-        ENDIF()
-        # -- Remove autogen files as they are not distributed.
-
-        FILE(REMOVE ${PACKAGE_PREFIX}/autogen.sh)
-        FILE(REMOVE_RECURSE ${PACKAGE_PREFIX}/autom4te.cache)
-
-        # -- Autogen.sh creates some files a symbolic links that we turn into real files here.
-
-        IF (UNIX) # No symbolic links on Windows
-            SET(LINKS missing config.guess COPYING depcomp INSTALL install-sh config.sub compile)
-            IF(${AUTOMAKE_VERSION} VERSION_GREATER 1.11)
-                LIST(APPEND LINKS test-driver)
-            ENDIF()
-            FOREACH(link ${LINKS})
-                GET_FILENAME_COMPONENT(realpath ${PACKAGE_PREFIX}/${link} REALPATH)
-                FILE(REMOVE ${PACKAGE_PREFIX}/${link})
-                FILE(COPY ${realpath} DESTINATION ${PACKAGE_PREFIX})
-            ENDFOREACH(link)
-
-            FOREACH(link src/doc/design/mdate-sh src/doc/design/texinfo.tex)
-                GET_FILENAME_COMPONENT(dir ${link} DIRECTORY)
-                GET_FILENAME_COMPONENT(realpath ${PACKAGE_PREFIX}/${link} REALPATH)
-                FILE(REMOVE ${PACKAGE_PREFIX}/${link})
-                FILE(COPY ${realpath} DESTINATION ${PACKAGE_PREFIX}/${dir})
-            ENDFOREACH(link)
-        ENDIF(UNIX)
-
-    ENDIF()
-
-    # -- Create the tarball.
-
-    EXECUTE_PROCESS_AND_CHECK_RESULT(
-            COMMAND ${CMAKE_COMMAND} -E tar cf ${PACKAGE_PREFIX}.tar ${PACKAGE_PREFIX}
-            WORKING_DIRECTORY .
-            ERROR_MSG "tar command to create ${PACKAGE_PREFIX}.tar failed."
-    )
-
-    # -- Compress the tarball with gzip
-    EXECUTE_PROCESS(
-        COMMAND ${CMAKE_COMMAND} -E copy ${PACKAGE_PREFIX}.tar ${PACKAGE_PREFIX}.tar.save
-    )
-    EXECUTE_PROCESS_AND_CHECK_RESULT(
-            COMMAND ${CMAKE_COMMAND_TMP} gzip -f ${PACKAGE_PREFIX}.tar
-            WORKING_DIRECTORY .
-            ERROR_MSG "gzip command to create ${PACKAGE_PREFIX}.tar.gz failed."
-    )
-
-    # -- Compress the tarball with bzip2
-    EXECUTE_PROCESS(
-        COMMAND ${CMAKE_COMMAND} -E rename ${PACKAGE_PREFIX}.tar.save ${PACKAGE_PREFIX}.tar
-    )
-    EXECUTE_PROCESS_AND_CHECK_RESULT(
-            COMMAND ${CMAKE_COMMAND_TMP} bzip2 -f ${PACKAGE_PREFIX}.tar
-            WORKING_DIRECTORY .
-            ERROR_MSG "bzip2 command to create ${PACKAGE_PREFIX}.tar.bz2 failed."
-    )
-
-    # -- Clean up packaging directory.
-
-    FILE(REMOVE_RECURSE ${PACKAGE_PREFIX})
-
-    IF(EXISTS ${PACKAGE_PREFIX})
-        MESSAGE(WARNING "Could not remove packaging directory '${PACKAGE_PREFIX}'")
-    ENDIF()
-
-    # -- All done.
-
-    MESSAGE("\n\nDistributions ${PACKAGE_PREFIX}.tar.gz and ${PACKAGE_PREFIX}.tar.bz2 created.\n\n")
-ENDFUNCTION()
-
-MAKE_DIST(${PACKAGE_PREFIX} ${GNUCASH_SOURCE_DIR} ${BUILD_SOURCE_DIR} ${BUILDING_FROM_VCS})
diff --git a/src/cmake_modules/MakeDistFiles.cmake b/src/cmake_modules/MakeDistFiles.cmake
deleted file mode 100644
index fbddb2a..0000000
--- a/src/cmake_modules/MakeDistFiles.cmake
+++ /dev/null
@@ -1,110 +0,0 @@
-
-IF (${CMAKE_VERSION} VERSION_LESS 3.3)
-    INCLUDE(CMakeParseArguments)
-ENDIF()
-
-
-FUNCTION(SET_LOCAL_DIST output)
-    SET(dist_files "")
-    FOREACH(file ${ARGN})
-        FILE(RELATIVE_PATH relative ${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/${file})
-        LIST(APPEND dist_files ${relative})
-    ENDFOREACH()
-    SET (${output} ${dist_files} PARENT_SCOPE)
-ENDFUNCTION()
-
-MACRO(SET_DIST_LIST output)
-    SET_LOCAL_DIST(${output}_TMP ${ARGN})
-    SET(${output} ${${output}_TMP} PARENT_SCOPE)
-ENDMACRO()
-
-FUNCTION(EXECUTE_PROCESS_AND_CHECK_RESULT)
-    cmake_parse_arguments(VARS "" "WORKING_DIRECTORY;ERROR_MSG" "COMMAND" ${ARGN})
-    EXECUTE_PROCESS(
-            COMMAND ${VARS_COMMAND}
-            WORKING_DIRECTORY ${VARS_WORKING_DIRECTORY}
-            RESULT_VARIABLE RESULT
-    )
-    IF (NOT "${RESULT}" STREQUAL "0")
-        MESSAGE(FATAL_ERROR ${VARS_ERROR_MSG})
-    ENDIF()
-ENDFUNCTION()
-
-
-# This is a list of files generated at build time that
-# should be copied into the dist tarball. An item in
-# this list should be a file, not a directory or glob.
-# File in this list become dependenices of the 'dist'
-# target.
-
-
-SET(COPY_FROM_BUILD
-  ChangeLog
-  src/app-utils/migratable-prefs.xml
-  src/app-utils/swig-app-utils-guile.c
-  src/app-utils/swig-app-utils-python.c
-  src/app-utils/test/test-load-module
-  src/backend/xml/test/test-real-data.sh
-  src/bin/gnucash.rc
-  src/bin/overrides/gnucash-make-guids
-  src/bin/test/test-version
-  src/core-utils/gnc-vcs-info.h
-  src/core-utils/swig-core-utils-guile.c
-  src/core-utils/swig-core-utils-python.c
-  src/doc/design/gnucash-design.info
-  src/engine/iso-4217-currencies.c
-  src/engine/swig-engine.c
-  src/engine/test/test-create-account
-  src/engine/test/test-scm-query-import
-  src/gnc-module/swig-gnc-module.c
-  src/gnc-module/test/mod-bar/swig-bar.c
-  src/gnc-module/test/mod-baz/swig-baz.c
-  src/gnc-module/test/mod-foo/swig-foo.c
-  src/gnc-module/test/test-gwrapped-c
-  src/gnc-module/test/test-load-deps
-  src/gnc-module/test/test-load-scm
-  src/gnc-module/test/test-scm-dynload
-  src/gnc-module/test/test-scm-init
-  src/gnc-module/test/test-scm-module
-  src/gnc-module/test/test-scm-multi
-  src/gnome/gnucash.desktop.in
-  src/gnome/swig-gnome.c
-  src/gnome-utils/gnc-warnings.c
-  src/gnome-utils/swig-gnome-utils.c
-  src/gnome-utils/test/test-load-module
-  src/html/swig-gnc-html.c
-  src/optional/python-bindings/gnucash_core.c
-  src/report/report-gnome/swig-report-gnome.c
-  src/report/report-gnome/test/test-load-module
-  src/report/report-system/swig-report-system.c
-  src/report/report-system/test/test-load-module
-  src/report/stylesheets/test/test-load-module
-  src/scm/build-config.scm
-  src/swig-runtime.h
-  src/test-core/swig-unittest-support-guile.c
-  src/test-core/swig-unittest-support-python.c
-)
-
-# This list is similiar to the COPY_FROM_BUILD list
-# above, except that we don't create an explicit
-# dependency on this for the 'dist' target. I need
-# to fix the creation of these files so that we
-# can add the as dependencies for 'dist'. These
-# file are not generated using CONFIGURE_FILE(),
-# so CMake does not realize these are generated files.
-
-# Items marked with GNC_CONFIGURE can be
-# properly generated when we drop autotools, because
-# then the source file can use the @XXX@ convention
-# instead of @-XXX-@
-
-SET(COPY_FROM_BUILD_2
-        doc/gnucash.1  # Uses GNC_CONFIGURE
-        packaging/gnucash.spec # Uses GNC_CONFIGURE
-        po/gnucash.pot
-        src/doc/design/stamp-vti
-        src/doc/design/version.texi
-        src/optional/python-bindings/gnucash_core_c.py
-        src/test-core/unittest_support.py
-
-        )
diff --git a/src/core-utils/CMakeLists.txt b/src/core-utils/CMakeLists.txt
deleted file mode 100644
index eefe503..0000000
--- a/src/core-utils/CMakeLists.txt
+++ /dev/null
@@ -1,201 +0,0 @@
-# CMakeLists.txt for src/core-utils
-
-ADD_SUBDIRECTORY(test)
-
-IF (BUILDING_FROM_VCS)
-  SET (SWIG_CORE_UTILS_GUILE_C ${CMAKE_CURRENT_BINARY_DIR}/swig-core-utils-guile.c)
-  GNC_ADD_SWIG_COMMAND (swig-core-utils-guile-c ${SWIG_CORE_UTILS_GUILE_C} ${CMAKE_CURRENT_SOURCE_DIR}/core-utils.i)
-  SET (SWIG_CORE_UTILS_PYTHON_C ${CMAKE_CURRENT_BINARY_DIR}/swig-core-utils-python.c)
-  GNC_ADD_SWIG_PYTHON_COMMAND (swig-core-utils-python ${SWIG_CORE_UTILS_PYTHON_C} ${CMAKE_CURRENT_SOURCE_DIR}/core-utils.i)
-ELSE()
-  SET(SWIG_CORE_UTILS_GUILE_C swig-core-utils-guile.c)
-  SET(SWIG_CORE_UTILS_PYTHON_C swig-core-utils-python.c)
-ENDIF()
-
-SET (core_utils_SOURCES
-  binreloc.c
-  gnc-prefs.c
-  gnc-environment.c
-  gnc-filepath-utils.c
-  gnc-gkeyfile-utils.c
-  gnc-glib-utils.c
-  gnc-guile-utils.c
-  gnc-jalali.c
-  gnc-locale-utils.c
-  gnc-path.c
-)
-
-# Add dependency on config.h
-SET_SOURCE_FILES_PROPERTIES (${core_utils_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
-
-IF (BUILDING_FROM_VCS)
-  # Command to generate the swig-runtime.h header
-  ADD_CUSTOM_COMMAND (
-    OUTPUT ${SWIG_RUNTIME_H}
-    DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
-    COMMAND ${SWIG_EXECUTABLE} -guile -external-runtime ${SWIG_RUNTIME_H}
-  )
-ENDIF()
-
-ADD_CUSTOM_TARGET(swig-runtime-h DEPENDS ${SWIG_RUNTIME_H})
-
-# Add dependency on swig-runtime.h
-SET_SOURCE_FILES_PROPERTIES (gnc-guile-utils.c PROPERTIES OBJECT_DEPENDS ${SWIG_RUNTIME_H})
-
-SET(prefix ${CMAKE_INSTALL_PREFIX})
-SET(datadir ${DATADIR})
-SET(bindir ${BINDIR})
-SET(libdir ${LIBDIR})
-SET(sysconfdir ${SYSCONFDIR})
-GNC_CONFIGURE(gncla-dir.h.in gncla-dir.h)
-
-### Create gnc-version.h ###
-
-SET (GNC_VERSION_H_IN
-"/* Autogenerated. Do not change. */
-#ifndef GNC_VERSION_H
-#define GNC_VERSION_H
-
-#define GNUCASH_SCM \"git\"
-#define GNUCASH_BUILD_DATE \"@GNUCASH_BUILD_DATE@\"
-#include \"gnc-vcs-info.h\"
-#endif
-")
-
-STRING(TIMESTAMP GNUCASH_BUILD_DATE "%Y-%m-%d")
-
-STRING(CONFIGURE ${GNC_VERSION_H_IN} GNC_VERSION_H_CONTENT)
-
-FILE (WRITE ${CMAKE_CURRENT_BINARY_DIR}/gnc-version.h ${GNC_VERSION_H_CONTENT})
-
-### Create gnc-vcs-info.h
-# The meta-cmake gymnastics here come from https://cmake.org/pipermail/cmake/2010-July/038015.html
-
-FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/gnc-vcs-info.h.in
-   "/* Autogenerated. Do not change. */\n#define GNUCASH_SCM_REV \"@GNUCASH_SCM_REV@\"\n"
-)
-SET(SCM_REV_COMMAND "${CMAKE_SOURCE_DIR}/util/gnc-vcs-info -r")
-FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/version.cmake
-  "EXECUTE_PROCESS(
-    COMMAND ${SHELL} ${SCM_REV_COMMAND} ${CMAKE_SOURCE_DIR}
-    OUTPUT_VARIABLE GNUCASH_SCM_REV
-    OUTPUT_STRIP_TRAILING_WHITESPACE
-  )
-  CONFIGURE_FILE(\${SRC} \${DST} @ONLY)
-")
-
-IF (${CMAKE_VERSION} VERSION_GREATER "3.1")
-  ADD_CUSTOM_TARGET(gnc-vcs-info ALL
-    BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/gnc-vcs-info.h
-    COMMAND ${CMAKE_COMMAND} -D SRC=${CMAKE_CURRENT_BINARY_DIR}/gnc-vcs-info.h.in
-                     -D DST=${CMAKE_CURRENT_BINARY_DIR}/gnc-vcs-info.h
-                     -P ${CMAKE_CURRENT_BINARY_DIR}/version.cmake
-  )
-ELSE()
-  # BYPRODUCTS keyword not supported below 3.2
-  ADD_CUSTOM_TARGET(gnc-vcs-info ALL
-    COMMAND ${CMAKE_COMMAND} -D SRC=${CMAKE_CURRENT_BINARY_DIR}/gnc-vcs-info.h.in
-                     -D DST=${CMAKE_CURRENT_BINARY_DIR}/gnc-vcs-info.h
-                     -P ${CMAKE_CURRENT_BINARY_DIR}/version.cmake
-  )
-ENDIF()
-
-### Compile library
-
-SET(core_utils_noinst_HEADERS
-  binreloc.h
-  gnc-prefs.h
-  gnc-prefs-p.h
-  gnc-environment.h
-  gnc-filepath-utils.h
-  gnc-gkeyfile-utils.h
-  gnc-glib-utils.h
-  gnc-guile-utils.h
-  gnc-jalali.h
-  gnc-locale-utils.h
-  gnc-path.h
-)
-
-SET(core_utils_ALL_SOURCES ${core_utils_SOURCES} ${core_utils_noinst_HEADERS})
-SET(core_utils_ALL_LIBRARIES ${GUILE_LDFLAGS} ${GLIB2_LDFLAGS} ${GOBJECT_LDFLAGS} ${GTK_MAC_LDFLAGS})
-SET(core_utils_ALL_INCLUDES
-  ${CMAKE_SOURCE_DIR}/src
-  ${CMAKE_CURRENT_BINARY_DIR}
-  ${CMAKE_CURRENT_SOURCE_DIR}
-  ${GLIB2_INCLUDE_DIRS}
-  ${GUILE_INCLUDE_DIRS}
-  ${GTK_MAC_INCLUDE_DIRS})
-
-SET_LOCAL_DIST(core_utils_DIST_local ${core_utils_ALL_SOURCES} CMakeLists.txt Makefile.am core-utils.i core-utils.scm gncla-dir.h.in)
-SET(core_utils_DIST ${core_utils_DIST_local} ${test_core_utils_DIST} PARENT_SCOPE)
-
-IF (MAC_INTEGRATION)
-  LIST(APPEND core_utils_ALL_LIBRARIES ${OSX_EXTRA_LIBRARIES})
-ENDIF()
-
-ADD_LIBRARY	(gnc-core-utils ${core_utils_ALL_SOURCES} ${SWIG_CORE_UTILS_GUILE_C})
-ADD_DEPENDENCIES(gnc-core-utils gnc-vcs-info)
-
-TARGET_LINK_LIBRARIES(gnc-core-utils ${core_utils_ALL_LIBRARIES})
-
-TARGET_COMPILE_DEFINITIONS(gnc-core-utils
-    PRIVATE -DG_LOG_DOMAIN=\"gnc.core-utils\" ${GTK_MAC_CFLAGS_OTHER})
-
-TARGET_INCLUDE_DIRECTORIES(gnc-core-utils PUBLIC ${core_utils_ALL_INCLUDES})
-
-IF (MAC_INTEGRATION)
-  TARGET_COMPILE_OPTIONS(gnc-core-utils PRIVATE ${OSX_EXTRA_COMPILE_FLAGS})
-ENDIF(MAC_INTEGRATION)
-
-INSTALL(TARGETS gnc-core-utils
-  LIBRARY DESTINATION lib
-  ARCHIVE DESTINATION lib
-  RUNTIME DESTINATION bin
-)
-
-IF (WITH_PYTHON)
-  ADD_LIBRARY	(gnc-core-utils-python ${core_utils_ALL_SOURCES} ${SWIG_CORE_UTILS_PYTHON_C})
-  ADD_DEPENDENCIES(gnc-core-utils-python gnc-vcs-info)
-
-  TARGET_LINK_LIBRARIES(gnc-core-utils-python ${core_utils_ALL_LIBRARIES} ${PYTHON_LIBRARIES})
-
-  TARGET_COMPILE_DEFINITIONS(gnc-core-utils-python
-    PRIVATE -DG_LOG_DOMAIN=\"gnc.core-utils\" ${GTK_MAC_CFLAGS_OTHER}
-  )
-
-  TARGET_INCLUDE_DIRECTORIES(gnc-core-utils-python PUBLIC ${core_utils_ALL_INCLUDES} ${PYTHON_INCLUDE_DIRS})
-
-  IF (MAC_INTEGRATION)
-    TARGET_COMPILE_OPTIONS(gnc-core-utils-python PRIVATE ${OSX_EXTRA_COMPILE_FLAGS})
-  ENDIF(MAC_INTEGRATION)
-
-  INSTALL(TARGETS gnc-core-utils-python
-    LIBRARY DESTINATION lib
-    ARCHIVE DESTINATION lib
-    RUNTIME DESTINATION bin
-  )
-
-ENDIF()
-
-# No headers to install
-
-# Scheme
-
-SET (core_utils_SCHEME core-utils.scm)
-
-SET(GUILE_OUTPUT_DIR   gnucash)
-SET(GUILE_MODULES      "")
-SET(GUILE_LOAD_DIRS    src/core-utils)
-SET(GUILE_LIBRARY_DIRS src/core-utils)
-SET(GUILE_DEPENDS      gnc-core-utils)
-
-GNC_ADD_SCHEME_TARGETS(scm-core-utils
-    "${core_utils_SCHEME}"
-    ${GUILE_OUTPUT_DIR}
-    "${GUILE_MODULES}"
-    "${GUILE_LOAD_DIRS}"
-    "${GUILE_LIBRARY_DIRS}"
-    "${GUILE_DEPENDS}"
-    FALSE
-)
-
diff --git a/src/core-utils/Makefile.am b/src/core-utils/Makefile.am
deleted file mode 100644
index c827c4a..0000000
--- a/src/core-utils/Makefile.am
+++ /dev/null
@@ -1,194 +0,0 @@
-# No SUBDIR variable here...
-# The 'test' subdir is added via src/Makefile to handle
-# it's dependency on src/engine
-
-lib_LTLIBRARIES = libgnc-core-utils.la
-
-libgnc_core_utils_la_SOURCES = \
-  binreloc.c \
-  gnc-prefs.c \
-  gnc-environment.c \
-  gnc-filepath-utils.c \
-  gnc-gkeyfile-utils.c \
-  gnc-glib-utils.c \
-  gnc-guile-utils.c \
-  gnc-jalali.c \
-  gnc-locale-utils.c \
-  gnc-path.c \
-  swig-core-utils-guile.c
-
-libgnc_core_utils_la_LIBADD = \
-  ${GUILE_LIBS} \
-  ${GLIB_LIBS} \
-  ${BINRELOC_LIBS} \
-  ${GTK_MAC_LIBS}
-
-
-noinst_HEADERS = \
-  binreloc.h \
-  gnc-prefs.h \
-  gnc-prefs-p.h \
-  gnc-environment.h \
-  gnc-filepath-utils.h \
-  gnc-gkeyfile-utils.h \
-  gnc-glib-utils.h \
-  gnc-guile-utils.h \
-  gnc-jalali.h \
-  gnc-locale-utils.h \
-  gnc-path.h
-
-if BUILDING_FROM_VCS
-swig-core-utils-guile.c: core-utils.i ${top_srcdir}/src/base-typemaps.i
-	$(SWIG) -guile $(SWIG_ARGS) -Linkage module \
-	-I${top_srcdir}/src -o $@ $<
-if ! OS_WIN32
-if ! SWIG_DIST_FAIL
-	if ! `grep "define scm_from_utf8_string" $@ > /dev/null 2>&1`; then \
-	  patch $@ $(top_srcdir)/src/swig-utf8.patch; \
-	fi
-endif
-endif
-swig-core-utils-python.c: core-utils.i ${top_srcdir}/src/base-typemaps.i
-	$(SWIG) -python -Wall -Werror $(SWIG_ARGS) \
-	-I${top_srcdir}/src -o $@ $<
-endif
-
-AM_CPPFLAGS = \
-  ${GUILE_CFLAGS} \
-  ${GLIB_CFLAGS} \
-  ${GTK_MAC_CFLAGS} \
-  -I${top_builddir}/src \
-  -I${top_srcdir}/src
-
-gncscmmoddir = ${GNC_SCM_INSTALL_DIR}/gnucash
-gncscmmod_DATA = core-utils.scm
-
-if GNUCASH_SEPARATE_BUILDDIR
-#Only needed when srcdir and builddir are different
-#for running
-SCM_FILE_LINKS = ${gncscmmod_DATA}
-endif
-
-if WITH_PYTHON
-
-lib_LTLIBRARIES += libgnc-core-utils-python.la
-
-libgnc_core_utils_python_la_SOURCES = \
-	swig-core-utils-python.c
-
-libgnc_core_utils_python_la_LIBADD = \
-	${PYTHON_LIBS} \
-	libgnc-core-utils.la
-
-libgnc_core_utils_python_la_CPPFLAGS = \
-  ${GLIB_CFLAGS} \
-  ${GTK_MAC_CFLAGS} \
-  ${PYTHON_CPPFLAGS} \
-  -I${top_builddir}/src \
-  -I${top_srcdir}/src
-
-endif
-
-.scm-links: 
-	$(RM) -rf gnucash
-	mkdir -p  gnucash
-if GNUCASH_SEPARATE_BUILDDIR
-	for X in ${SCM_FILE_LINKS} ; do \
-	  $(LN_S) -f ${srcdir}/$$X . ; \
-	done
-endif
-	( cd gnucash; for A in $(gncscmmod_DATA) ; do $(LN_S) -f ../$$A . ; done )
-if ! OS_WIN32
-# Windows knows no "ln -s" but uses "cp": must copy every time (see bug #566567).
-	touch .scm-links
-endif
-
-if GNC_HAVE_GUILE_2
-GUILE_COMPILE_ENV = \
-  --library-dir    ${top_builddir}/src/core-utils
-
-%.go : %.scm .scm-links $(lib_LTLIBRARIES)
-	GNC_UNINSTALLED=yes \
-	GNC_BUILDDIR=${top_builddir} \
-	$(shell ${abs_top_srcdir}/src/gnc-test-env.pl --noexports ${GUILE_COMPILE_ENV})  \
-	$(GUILD) compile -o $@ $<
-
-gncscmmodcachedir = ${pkglibdir}/scm/ccache/@GUILE_EFFECTIVE_VERSION@/gnucash
-gncscmmodcache_DATA = $(gncscmmod_DATA:.scm=.go)
-endif
-
-noinst_DATA = .scm-links
-BUILT_SOURCES = gncla-dir.h gnc-version.h
-EXTRA_DIST = \
-  $(gncscmmod_DATA) \
-  core-utils.i \
-  gncla-dir.h.in \
-  gnc-vcs-info.h \
-  CMakeLists.txt
-
-clean-local:
-	rm -rf gnucash
-
-CLEANFILES = $(BUILT_SOURCES) .scm-links ${gncscmmodcache_DATA}
-
-MAINTAINERCLEANFILES = swig-core-utils-guile.c swig-core-utils-python.c
-
-AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.core-utils\" -DGNC_SCM_INSTALL_DIR="\"${GNC_SCM_INSTALL_DIR}\""
-
-gncla-dir.h: gncla-dir.h.in ${top_builddir}/config.status Makefile
-	rm -f $@.tmp
-	sed < $< > $@.tmp \
-		-e 's#@-DATADIRNAME-@#${DATADIRNAME}#g' \
-		-e 's#@-libdir-@#${libdir}#g' \
-		-e 's#@-bindir-@#${bindir}#g' \
-		-e 's#@-sysconfdir-@#${sysconfdir}#g' \
-		-e 's#@-datadir-@#${datadir}#g' \
-		-e 's#@-prefix-@#${prefix}#g'
-	mv $@.tmp $@
-
-## We borrow guile's convention and use @-...-@ as the substitution
-## brackets here, instead of the usual @... at .  This prevents autoconf
-## from substituting the values directly into the left-hand sides of
-## the sed substitutions.
-gnc-version.h: _gnc-version.h
-	-if [ ! -f gnc-version.h ]; then cp _gnc-version.h gnc-version.h; fi
-	-cmp -s _gnc-version.h gnc-version.h || cp _gnc-version.h gnc-version.h
-	-rm -f _gnc-version.h
-
-_gnc-version.h: gnc-vcs-info.h Makefile
-	@echo "/* Autogenerated. Do not change. */"   > _gnc-version.h
-	@echo "#ifndef GNC_VERSION_H"                >> _gnc-version.h
-	@echo "#define GNC_VERSION_H"                >> _gnc-version.h
-	@echo ""                                     >> _gnc-version.h
-	@scm_info=`${top_srcdir}/util/gnc-vcs-info -t ${top_srcdir}` ; \
-	if [ $$? = 0 ] ; then \
-		echo "#define GNUCASH_SCM \"$$scm_info\"" >> _gnc-version.h ; \
-	fi
-	@echo "#define GNUCASH_BUILD_DATE \"`date +%Y-%m-%d`\"" >> _gnc-version.h
-	@echo "#include \"gnc-vcs-info.h\""          >> _gnc-version.h
-	@echo "#endif"                               >> _gnc-version.h
-
-gnc-vcs-info.h: _gnc-vcs-info.h
-	-if [ ! -f gnc-vcs-info.h ]; then cp _gnc-vcs-info.h gnc-vcs-info.h; fi
-	-cmp -s _gnc-vcs-info.h gnc-vcs-info.h || cp _gnc-vcs-info.h gnc-vcs-info.h
-	-rm -f _gnc-vcs-info.h
-
-_gnc-vcs-info.h: Makefile
-	@scm_info=`${top_srcdir}/util/gnc-vcs-info -r ${top_srcdir}` ; \
-	if [ $$? = 0 ] ; then \
-		if [ -z "$$scm_info" ] ; then \
-			echo "gnc-vcs-info failed.  figure out why." ; \
-			echo "can't determine svn/svk/git/bzr revision from ${top_srcdir}." ; \
-			exit 1 ; \
-		fi ; \
-		echo "/* Autogenerated. Do not change. */"    > _gnc-vcs-info.h ; \
-		echo "#define GNUCASH_SCM_REV \"$$scm_info\"" >> _gnc-vcs-info.h ; \
-	else \
-		if [ -r $(srcdir)/gnc-vcs-info.h ] ; then \
-			cp $(srcdir)/gnc-vcs-info.h _gnc-vcs-info.h ; \
-		else \
-			echo "You're building from svn/svk/git/bzr...  But your build system is broken" ; \
-			echo "Don't do that.   Complain to your build-system creator." ; \
-			exit 1 ; \
-		fi ; \
-	fi
diff --git a/src/core-utils/test/CMakeLists.txt b/src/core-utils/test/CMakeLists.txt
deleted file mode 100644
index ed51fbe..0000000
--- a/src/core-utils/test/CMakeLists.txt
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-SET(CORE_UTILS_TEST_INCLUDE_DIRS
-  ${CMAKE_BINARY_DIR}/src # for config.h
-  ${CMAKE_SOURCE_DIR}/src/core-utils
-  ${CMAKE_SOURCE_DIR}/src/test-core
-  ${GLIB2_INCLUDE_DIRS}
-)
-SET(CORE_UTILS_TEST_LIBS gnc-core-utils test-core)
-
-MACRO(ADD_CORE_UTILS_TEST _TARGET _SOURCE_FILES)
-  GNC_ADD_TEST(${_TARGET} "${_SOURCE_FILES}" CORE_UTILS_TEST_INCLUDE_DIRS CORE_UTILS_TEST_LIBS)
-ENDMACRO()
-
-ADD_CORE_UTILS_TEST(test-gnc-glib-utils test-gnc-glib-utils.c)
-ADD_CORE_UTILS_TEST(test-resolve-file-path test-resolve-file-path.c)
-
-SET_DIST_LIST(test_core_utils_DIST CMakeLists.txt Makefile.am test-gnc-glib-utils.c test-resolve-file-path.c)
diff --git a/src/core-utils/test/Makefile.am b/src/core-utils/test/Makefile.am
deleted file mode 100644
index a097569..0000000
--- a/src/core-utils/test/Makefile.am
+++ /dev/null
@@ -1,56 +0,0 @@
-include $(top_srcdir)/test-templates/Makefile.decl
-MODULEPATH = src/core-utils
-
-# We add src/engine here, just to load qof.h, which
-# is pulled in via test-core
-AM_CPPFLAGS = \
-  -I${top_srcdir} \
-  -I${top_srcdir}/src \
-  -I${top_srcdir}/src/test-core \
-  -I${top_srcdir}/src/core-utils \
-  -I${top_srcdir}/src/engine \
-  ${GUILE_CFLAGS} \
-  ${GLIB_CFLAGS}
-
-LDADD = \
-  ../libgnc-core-utils.la \
-  ${top_builddir}/src/test-core/libtest-core.la \
-  ${GLIB_LIBS}
-
-# these tests are ordered kind more or less in the order
-# that they should be executed, with more basic tests coming first.
-#
-
-TESTS = \
-  test-resolve-file-path \
-  test-gnc-glib-utils
-
-GNC_TEST_DEPS = \
-  --library-dir    ${top_builddir}/src/core-utils
-
-TESTS_ENVIRONMENT = \
-  SRCDIR=${srcdir} \
-  $(shell ${abs_top_srcdir}/src/gnc-test-env.pl --noexports ${GNC_TEST_DEPS})
-
-check_PROGRAMS = ${TESTS}
-
-test_gnc_glib_utils_SOURCES = \
-  $(top_srcdir)/$(MODULEPATH)/gnc-glib-utils.c \
-  test-gnc-glib-utils.c
-
-test_gnc_glib_utils_LDADD = \
-        ${top_builddir}/src/test-core/libtest-core.la \
-        $(GLIB_LIBS)
-
-test_gnc_glib_utils_CFLAGS = \
-        ${DEFAULT_INCLUDES} \
-        -I${top_srcdir}/${MODULEPATH} \
-        ${GLIB_CFLAGS}
-
-EXTRA_DIST += \
-	CMakeLists.txt
-
-clean-local:
-	rm -f translog.*
-
-distclean-local: clean-local
diff --git a/src/engine/CMakeLists.txt b/src/engine/CMakeLists.txt
deleted file mode 100644
index c47c102..0000000
--- a/src/engine/CMakeLists.txt
+++ /dev/null
@@ -1,328 +0,0 @@
-# CMakeLists.txt for src/engine
-
-ADD_SUBDIRECTORY(test-core)
-ADD_SUBDIRECTORY(test)
-
-SET(engine_noinst_HEADERS
-  AccountP.h
-  ScrubP.h
-  SplitP.h
-  SX-book.h
-  SX-ttinfo.h
-  TransactionP.h
-  gnc-backend-prov.hpp
-  gnc-date-p.h
-  gnc-hooks-scm.h
-  gnc-int128.hpp
-  gnc-lot.h
-  gnc-lot-p.h
-  gnc-pricedb-p.h
-  policy-p.h
-  qofbook-p.h
-  qofclass-p.h
-  qofevent-p.h
-  qofobject-p.h
-  qofquery-p.h
-  qofquerycore-p.h
-  qofsession.hpp
-)
-
-SET (engine_HEADERS
-  Account.h
-  FreqSpec.h
-  Recurrence.h
-  SchedXaction.h
-  SX-book.h
-  SX-ttinfo.h
-  Query.h
-  Scrub.h
-  Scrub2.h
-  ScrubBusiness.h
-  Scrub3.h
-  Split.h
-  TransLog.h
-  Transaction.h
-  cap-gains.h
-  cashobjects.h
-  engine-helpers.h
-  engine-helpers-guile.h
-  glib-helpers.h
-  gnc-aqbanking-templates.h
-  gnc-budget.h
-  gnc-commodity.h
-  gnc-date.h
-  gnc-datetime.hpp
-  gnc-engine.h
-  gnc-event.h
-  gnc-features.h
-  gnc-hooks.h
-  gnc-numeric.h
-  gnc-numeric.hpp
-  gnc-pricedb.h
-  gnc-rational.hpp
-  gnc-rational-rounding.hpp
-  gnc-session.h
-  gnc-timezone.hpp
-  gnc-uri-utils.h
-  guid.h
-  kvp-frame.hpp
-  kvp-scm.h
-  kvp-value.hpp
-  policy.h
-  qof.h
-  qof-backend.hpp
-  qofbackend.h
-  qofbook.h
-  qofbookslots.h
-  qofchoice.h
-  qofclass.h
-  qofevent.h
-  qofid-p.h
-  qofid.h
-  qofinstance-p.h
-  qofinstance.h
-  qoflog.h
-  qofobject.h
-  qofquery.h
-  qofquerycore.h
-  qofsession.h
-  qofutil.h
-  qof-gobject.h
-  qof-string-cache.h
-  gncAddress.h
-  gncAddressP.h
-  gncBillTerm.h
-  gncBillTermP.h
-  gncBusGuile.h
-  gncBusiness.h
-  gncCustomer.h
-  gncCustomerP.h
-  gncEmployee.h
-  gncEmployeeP.h
-  gncEntry.h
-  gncEntryP.h
-  gncIDSearch.h
-  gncInvoice.h
-  gncInvoiceP.h
-  gncJob.h
-  gncJobP.h
-  gncOrder.h
-  gncOrderP.h
-  gncOwner.h
-  gncOwnerP.h
-  gncTaxTable.h
-  gncTaxTableP.h
-  gncVendor.h
-  gncVendorP.h
-)
-
-IF (BUILDING_FROM_VCS)
-  # Command to generate the swig-engine.c wrapper file
-  SET (SWIG_ENGINE_C ${CMAKE_CURRENT_BINARY_DIR}/swig-engine.c)
-  GNC_ADD_SWIG_COMMAND (swig-engine-c ${SWIG_ENGINE_C} ${CMAKE_CURRENT_SOURCE_DIR}/engine.i ${engine_HEADERS})
-ELSE()
-  SET (SWIG_ENGINE_C swig-engine.c)
-ENDIF()
-
-# Command to generate the iso-4217-currencies.c file
-SET (ISO_4217_C ${CMAKE_CURRENT_BINARY_DIR}/iso-4217-currencies.c)
-ADD_CUSTOM_COMMAND (
-  OUTPUT ${ISO_4217_C}
-  DEPENDS iso-4217-currencies.xml iso-currencies-to-c.xsl
-  COMMAND
-    ${LIBXSLT_XSLTPROC_EXECUTABLE} -o ${ISO_4217_C} "${CMAKE_CURRENT_SOURCE_DIR}/iso-currencies-to-c.xsl" "${CMAKE_CURRENT_SOURCE_DIR}/iso-4217-currencies.xml"
-    )
-ADD_CUSTOM_TARGET(iso-4217-c DEPENDS ${ISO_4217_C})
-
-SET (engine_SOURCES
-  Account.c
-  Recurrence.c
-  Query.c
-  SchedXaction.c
-  SX-book.c
-  SX-ttinfo.c
-  Scrub.c
-  Scrub2.c
-  Scrub3.c
-  ScrubBusiness.c
-  Split.c
-  TransLog.c
-  Transaction.c
-  cap-gains.c
-  cashobjects.c
-  gnc-aqbanking-templates.cpp
-  gnc-budget.c
-  gnc-commodity.c
-  gnc-date.cpp
-  gnc-datetime.cpp
-  gnc-engine.c
-  gnc-event.c
-  gnc-features.c
-  gnc-hooks.c
-  gnc-int128.cpp
-  gnc-lot.c
-  gnc-numeric.cpp
-  gnc-pricedb.c
-  gnc-rational.cpp
-  gnc-session.c
-  gnc-timezone.cpp
-  gnc-uri-utils.c
-  gncmod-engine.c
-  kvp-scm.cpp
-  engine-helpers.c
-  glib-helpers.c
-  guid.cpp
-  policy.c
-  gncAddress.c
-  gncBillTerm.c
-  gncBusGuile.c
-  gncBusiness.c
-  gncCustomer.c
-  gncEmployee.c
-  gncEntry.c
-  gncIDSearch.c
-  gncInvoice.c
-  gncJob.c
-  gncOrder.c
-  gncOwner.c
-  gncTaxTable.c
-  gncVendor.c
-  kvp-frame.cpp
-  kvp-value.cpp
-  qof-backend.cpp
-  qofbook.cpp
-  qofchoice.cpp
-  qofclass.cpp
-  qofevent.cpp
-  qofid.cpp
-  qofinstance.cpp
-  qoflog.cpp
-  qofobject.cpp
-  qofquery.cpp
-  qofquerycore.cpp
-  qofsession.cpp
-  qofutil.cpp
-  qof-string-cache.cpp
-)
-
-# Add dependency on config.h
-SET_SOURCE_FILES_PROPERTIES (${engine_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
-
-# Add dependency on iso-4217-currencies.c
-SET_SOURCE_FILES_PROPERTIES (gnc-commodity.c PROPERTIES OBJECT_DEPENDS "${ISO_4217_C};${CONFIG_H}")
-
-# Add dependency on swig-runtime.h
-SET_SOURCE_FILES_PROPERTIES (gnc-hooks.c engine-helpers.c kvp-scm.cpp glib-helpers.c PROPERTIES OBJECT_DEPENDS "${CONFIG_H};${SWIG_RUNTIME_H}")
-
-
-
-ADD_LIBRARY (gncmod-engine
-  ${engine_SOURCES}
-  ${engine_HEADERS}
-  ${SWIG_ENGINE_C}
-  ${engine_noinst_HEADERS}
-)
-
-TARGET_LINK_LIBRARIES(gncmod-engine gnc-core-utils gnc-module ${Boost_DATE_TIME_LIBRARIES}  ${Boost_REGEX_LIBRARIES} ${REGEX_LDFLAGS} ${GMODULE_LDFLAGS} ${GLIB2_LDFLAGS} ${GOBJECT_LDFLAGS} ${GUILE_LDFLAGS})
-
-TARGET_COMPILE_DEFINITIONS (gncmod-engine PRIVATE -DG_LOG_DOMAIN=\"gnc.engine\")
-
-TARGET_INCLUDE_DIRECTORIES (gncmod-engine
-    PRIVATE ${CMAKE_CURRENT_BINARY_DIR} # for iso-4217-currencies.c
-    PUBLIC
-        ${CMAKE_CURRENT_SOURCE_DIR}
-        ${CMAKE_BINARY_DIR}/src # for config.h
-        ${CMAKE_SOURCE_DIR}/src # for platform.h
-        ${GLIB2_INCLUDE_DIRS}
-        ${LIBINTL_INCLUDE_PATH}
-        ${REGEX_INCLUDE_PATH}
-        ${CMAKE_SOURCE_DIR}/lib/libc # for strptime.h
-)
-
-INSTALL(TARGETS gncmod-engine
-  LIBRARY DESTINATION lib/gnucash
-  ARCHIVE DESTINATION lib/gnucash
-  RUNTIME DESTINATION bin)
-
-INSTALL(FILES ${engine_HEADERS} DESTINATION include/gnucash)
-
-SET(qof_test_HEADERS
-kvp-frame.hpp
-qofbook.h
-qofinstance.h
-qofobject.h
-qofsession.h
-)
-
-INSTALL(FILES ${qof_test_HEADERS} DESTINATION libexec/gnucash/src/engine/test)
-
-# Scheme
-
-SET (engine_SCHEME_0
-    engine.scm
-    business-core.scm
-)
-
-SET (engine_SCHEME_1
-    commodity-table.scm
-    engine-interface.scm
-    engine-utilities.scm
-    gnc-numeric.scm
-)
-IF (WIN32)
-  ADD_DEFINITIONS (-DOS_WIN32)
-  SET (engine_SOURCES ${engine_SOURCES}
-  qof-win32.cpp
-  ../../lib/libc/strptime.c
-  )
-ENDIF (WIN32)
-
-SET(BACKEND_DEPENDS gncmod-backend-xml)
-IF (WITH_SQL)
-    LIST(APPEND BACKEND_DEPENDS gncmod-backend-dbi)
-ENDIF(WITH_SQL)
-
-SET(GUILE_MODULES      "")
-SET(GUILE_LOAD_DIRS    src/gnc-module)
-SET(GUILE_LIBRARY_DIRS src/gnc-module)
-SET(GUILE_DEPENDS      ${BACKEND_DEPENDS} gnc-module gncmod-engine scm-gnc-module)
-
-
-GNC_ADD_SCHEME_TARGETS(scm-engine-0
-  "${engine_SCHEME_0}"
-  gnucash
-  "${GUILE_MODULES}"
-  "${GUILE_LOAD_DIRS}"
-  "${GUILE_LIBRARY_DIRS}"
-  "${GUILE_DEPENDS}"
-  FALSE
-)
-
-GNC_ADD_SCHEME_TARGETS(scm-engine-1
-  "${engine_SCHEME_1}"
-  ""
-  ""
-  ""
-  ""
-  "scm-engine-0;${GUILE_DEPENDS}"
-  FALSE
-)
-
-ADD_CUSTOM_TARGET(scm-engine ALL DEPENDS scm-engine-1 scm-engine-0)
-
-SET(engine_EXTRA_DIST
-        business-core.i
-        design.txt
-        engine.i
-        engine-common.i
-        extensions.txt
-        iso-4217-currencies.xml
-        iso-currencies-to-c.xsl
-        kvp_doc.txt
-        README
-        README.query-api
-        SX-book-p.h
-        )
-SET_LOCAL_DIST(engine_DIST_local CMakeLists.txt Makefile.am ${engine_SOURCES} ${engine_HEADERS}
-                     ${engine_noinst_HEADERS} ${engine_SCHEME_0} ${engine_SCHEME_1} ${engine_EXTRA_DIST})
-SET(engine_DIST ${engine_DIST_local} ${engine_test_core_DIST} ${test_engine_DIST} PARENT_SCOPE)
diff --git a/src/engine/Makefile.am b/src/engine/Makefile.am
deleted file mode 100644
index c0ba0b5..0000000
--- a/src/engine/Makefile.am
+++ /dev/null
@@ -1,330 +0,0 @@
-# Note the test subdirectory is added in src/Makefile.am rather
-# than here. This is because we need it to build after src/test-core
-# but that directory requires src/engine to be built already...
-SUBDIRS = . test-core
-
-pkglib_LTLIBRARIES = libgncmod-engine.la
-
-AM_CPPFLAGS = \
-	-I${top_srcdir}/lib/libc \
-	-I${top_srcdir}/src/core-utils \
-	-I${top_srcdir}/src \
-	-I${top_builddir}/src \
-	-I${top_srcdir}/src/gnc-module \
-	${GLIB_CFLAGS} \
-	${GUILE_CFLAGS} \
-	$(BOOST_CPPFLAGS)
-
-
-libgncmod_engine_la_SOURCES = \
-  Account.c \
-  Recurrence.c \
-  Query.c \
-  SchedXaction.c \
-  SX-book.c \
-  SX-ttinfo.c \
-  Scrub.c \
-  Scrub2.c \
-  Scrub3.c \
-  ScrubBusiness.c \
-  Split.c \
-  TransLog.c \
-  Transaction.c \
-  cap-gains.c \
-  cashobjects.c \
-  gnc-aqbanking-templates.cpp \
-  gnc-budget.c \
-  gnc-commodity.c \
-  gnc-date.cpp \
-  gnc-datetime.cpp \
-  gnc-engine.c \
-  gnc-event.c \
-  gnc-features.c \
-  gnc-hooks.c \
-  gnc-int128.cpp \
-  gnc-lot.c \
-  gnc-numeric.cpp \
-  gnc-pricedb.c \
-  gnc-rational.cpp \
-  gnc-session.c \
-  gnc-timezone.cpp \
-  gnc-uri-utils.c \
-  gncmod-engine.c \
-  guid.cpp \
-  swig-engine.c \
-  kvp-frame.cpp \
-  kvp-scm.cpp \
-  kvp-value.cpp \
-  engine-helpers.c \
-  glib-helpers.c  \
-  policy.c \
-  gncBusGuile.c \
-  gncBusiness.c \
-  gncAddress.c \
-  gncBillTerm.c \
-  gncCustomer.c \
-  gncEmployee.c \
-  gncEntry.c \
-  gncInvoice.c \
-  gncJob.c \
-  gncOrder.c \
-  gncOwner.c \
-  gncTaxTable.c \
-  gncIDSearch.c \
-  gncVendor.c \
-  qof-backend.cpp \
-  qofbook.cpp \
-  qofchoice.cpp \
-  qofclass.cpp \
-  qofevent.cpp \
-  qofid.cpp \
-  qofinstance.cpp \
-  qoflog.cpp \
-  qofobject.cpp \
-  qofquery.cpp \
-  qofquerycore.cpp \
-  qofsession.cpp \
-  qof-string-cache.cpp \
-  qofutil.cpp
-
-if OS_WIN32
-libgncmod_engine_la_SOURCES += qof-win32.cpp
-else
-WIN32_EXTRA_DIST = qof-win32.cpp
-endif
-
-EXTRA_libgncmod_engine_la_SOURCES = iso-4217-currencies.c
-
-gncincludedir = ${GNC_INCLUDE_DIR}
-gncinclude_HEADERS = \
-  Account.h \
-  FreqSpec.h \
-  Recurrence.h \
-  SchedXaction.h \
-  SX-book.h \
-  SX-ttinfo.h \
-  Query.h \
-  Scrub.h \
-  Scrub2.h \
-  Scrub3.h \
-  ScrubBusiness.h \
-  Split.h \
-  TransLog.h \
-  Transaction.h \
-  cap-gains.h \
-  cashobjects.h \
-  engine-helpers.h \
-  engine-helpers-guile.h \
-  glib-helpers.h \
-  gnc-aqbanking-templates.h \
-  gnc-budget.h \
-  gnc-commodity.h \
-  gnc-date-p.h \
-  gnc-date.h \
-  gnc-datetime.hpp \
-  gnc-engine.h \
-  gnc-event.h \
-  gnc-features.h \
-  gnc-hooks.h \
-  gnc-numeric.h \
-  gnc-numeric.hpp \
-  gnc-pricedb.h \
-  gnc-rational.hpp \
-  gnc-rational-rounding.hpp \
-  gnc-session.h \
-  gnc-timezone.hpp \
-  gnc-uri-utils.h \
-  guid.h \
-  kvp-frame.hpp \
-  kvp-scm.h \
-  kvp-value.hpp \
-  policy.h \
-  gncAddress.h \
-  gncAddressP.h \
-  gncBillTerm.h \
-  gncBillTermP.h \
-  gncBusiness.h \
-  gncBusGuile.h \
-  gncCustomer.h \
-  gncCustomerP.h \
-  gncEmployee.h \
-  gncEmployeeP.h \
-  gncEntry.h \
-  gncEntryP.h \
-  gncInvoice.h \
-  gncInvoiceP.h \
-  gncJob.h \
-  gncJobP.h \
-  gncOrder.h \
-  gncOrderP.h \
-  gncOwner.h \
-  gncOwnerP.h \
-  gncTaxTable.h \
-  gncTaxTableP.h \
-  gncIDSearch.h \
-  gncVendor.h \
-  gncVendorP.h \
-  qof.h \
-  qof-backend.hpp \
-  qofbackend.h \
-  qofbook.h \
-  qofbookslots.h \
-  qofchoice.h \
-  qofclass.h \
-  qofevent.h \
-  qofid-p.h \
-  qofid.h \
-  qofinstance-p.h \
-  qofinstance.h \
-  qoflog.h \
-  qofobject.h \
-  qofquery.h \
-  qofquerycore.h \
-  qofsession.h \
-  qofsession.hpp \
-  qof-string-cache.h \
-  qofutil.h \
-  qof-gobject.h
-
-noinst_HEADERS = \
-  AccountP.h \
-  ScrubP.h \
-  SplitP.h \
-  SX-book.h \
-  SX-ttinfo.h \
-  TransactionP.h \
-  gnc-backend-prov.hpp \
-  gnc-hooks-scm.h \
-  gnc-lot.h \
-  gnc-lot-p.h \
-  gnc-pricedb-p.h \
-  policy-p.h  \
-  qofclass-p.h \
-  qofevent-p.h \
-  gnc-int128.hpp \
-  qofobject-p.h \
-  qofquery-p.h \
-  qofquerycore-p.h
-
-libgncmod_engine_la_LDFLAGS = -avoid-version
-if PLATFORM_WIN32
-libgncmod_engine_la_LDFLAGS += -Wl,-export-all-symbols
-endif
-if CLANG
-libgncmod_engine_la_CFLAGS = ${AM_CFLAGS} -Wno-invalid-source-encoding
-else
-libgncmod_engine_la_CFLAGS = ${AM_CFLAGS}
-endif
-libgncmod_engine_la_LIBADD = \
-  ../gnc-module/libgnc-module.la \
-  ../core-utils/libgnc-core-utils.la \
-  ${GUILE_LIBS} \
-  ${REGEX_LIBS} \
-  ${GLIB_LIBS} \
-  ${BOOST_LDFLAGS} -lboost_regex \
-  ${top_builddir}/lib/libc/libc-missing.la
-
-gncscmmoddir = ${GNC_SCM_INSTALL_DIR}/gnucash
-gncscmmod_DATA = engine.scm \
-  business-core.scm
-
-gncscmdir = ${GNC_SCM_INSTALL_DIR}
-gncscm_DATA = \
-  commodity-table.scm \
-  engine-interface.scm \
-  engine-utilities.scm \
-  gnc-numeric.scm
-
-EXTRA_DIST = \
-  README.query-api \
-  design.txt \
-  extensions.txt \
-  iso-4217-currencies.xml \
-  iso-currencies-to-c.xsl \
-  kvp_doc.txt \
-  SX-book-p.h \
-  engine.i \
-  engine-common.i \
-  business-core.i \
-  ${gncscmmod_DATA} \
-  ${gncscm_DATA} \
-  CMakeLists.txt \
-  ${WIN32_EXTRA_DIST}
-
-if GNUCASH_SEPARATE_BUILDDIR
-#For executing test cases
-SCM_FILE_LINKS = \
-  ${gncscmmod_DATA} \
-  ${gncscm_DATA}
-endif
-
-.scm-links:
-	$(RM) -rf gnucash
-	mkdir -p  gnucash
-if GNUCASH_SEPARATE_BUILDDIR
-	for X in ${SCM_FILE_LINKS} ; do \
-	  $(LN_S) -f ${srcdir}/$$X . ; \
-	done
-endif
-	( cd gnucash; for A in $(gncscmmod_DATA) ; do $(LN_S) -f ../$$A . ; done )
-if ! OS_WIN32
-# Windows knows no "ln -s" but uses "cp": must copy every time (see bug #566567).
-	touch .scm-links
-endif
-
-if GNC_HAVE_GUILE_2
-GUILE_COMPILE_ENV = \
-  --guile-load-dir ${top_builddir}/src/gnc-module \
-  --library-dir    ${top_builddir}/src/engine \
-  --library-dir    ${top_builddir}/src/gnc-module \
-  --library-dir    ${top_builddir}/src/core-utils
-
-%.go : %.scm .scm-links $(pkglib_LTLIBRARIES)
-	GNC_UNINSTALLED=yes \
-	GNC_BUILDDIR=${top_builddir} \
-	$(shell ${abs_top_srcdir}/src/gnc-test-env.pl --noexports ${GUILE_COMPILE_ENV}) \
-	$(GUILD) compile -o $@ $<
-
-gncscmmodcachedir = ${pkglibdir}/scm/ccache/@GUILE_EFFECTIVE_VERSION@/gnucash
-gncscmmodcache_DATA = $(gncscmmod_DATA:.scm=.go)
-
-gncscmcachedir = ${pkglibdir}/scm/ccache/@GUILE_EFFECTIVE_VERSION@
-gncscmcache_DATA = $(gncscm_DATA:.scm=.go)
-endif
-
-noinst_DATA = .scm-links
-
-if BUILDING_FROM_VCS
-
-swig-engine.c: engine.i $(top_srcdir)/src/base-typemaps.i \
-               $(gncinclude_HEADERS) $(noinst_HEADERS)
-	$(SWIG) -guile $(SWIG_ARGS) -Linkage module \
-	-I${top_srcdir}/src -o $@ $<
-if ! OS_WIN32
-if ! SWIG_DIST_FAIL
-	if ! `grep "define scm_from_utf8_string" $@ > /dev/null 2>&1`; then \
-	  patch $@ $(top_srcdir)/src/swig-utf8.patch; \
-	fi
-endif
-endif
-endif
-
-
-iso-4217-currencies.c: iso-4217-currencies.xml iso-currencies-to-c.xsl
-	$(XSLTPROC) -o $@ $(srcdir)/iso-currencies-to-c.xsl $<
-
-BUILT_SOURCES = iso-4217-currencies.c
-
-CLEANFILES = \
-	$(BUILT_SOURCES) \
-	.scm-links \
-	${SCM_FILE_LINKS} \
-	${gncscmmodcache_DATA} \
-	${gncscmcache_DATA}
-
-MAINTAINERCLEANFILES = swig-engine.c
-
-clean-local:
-	rm -rf gnucash
-
-AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.engine\"
diff --git a/src/engine/gncBusiness.c b/src/engine/gncBusiness.c
deleted file mode 100644
index eb8d62d..0000000
--- a/src/engine/gncBusiness.c
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * gncBusiness.c -- Business helper functions
- * Copyright (C) 2010 Christian Stimming
- * Author: Christian Stimming <christian at cstimming.de>
- *
- * 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 at gnu.org
- */
-
-#include "config.h"
-
-#include "gncBusiness.h"
-#include "engine/gncOwner.h"
-
-/* The initialization of the business objects is done in
- * cashobjects_register() of <engine/cashobjects.h>. */
-
-struct _get_list_userdata
-{
-    GList *result;
-    QofAccessFunc is_active_accessor_func;
-};
-static void get_list_cb (QofInstance *inst, gpointer user_data)
-{
-    struct _get_list_userdata* data = user_data;
-    if (!data->is_active_accessor_func || data->is_active_accessor_func(inst, NULL))
-        data->result = g_list_prepend(data->result, inst);
-}
-
-
-GList * gncBusinessGetList (QofBook *book, const char *type_name,
-                            gboolean all_including_inactive)
-{
-    struct _get_list_userdata data;
-    data.result = NULL;
-    data.is_active_accessor_func = NULL;
-
-    if (!all_including_inactive)
-    {
-        data.is_active_accessor_func =
-            qof_class_get_parameter_getter(type_name, QOF_PARAM_ACTIVE);
-    }
-
-    qof_object_foreach(type_name, book, &get_list_cb, &data);
-
-    return data.result;
-}
-
-static void get_ownerlist_cb (QofInstance *inst, gpointer user_data)
-{
-    struct _get_list_userdata* data = user_data;
-    if (!data->is_active_accessor_func || data->is_active_accessor_func(inst, NULL))
-    {
-        GncOwner *owner = gncOwnerNew();
-        qofOwnerSetEntity(owner, inst);
-        data->result = g_list_prepend(data->result, owner);
-    }
-}
-
-GList * gncBusinessGetOwnerList (QofBook *book, const char *type_name,
-                                 gboolean all_including_inactive)
-{
-    struct _get_list_userdata data;
-    data.result = NULL;
-    data.is_active_accessor_func = NULL;
-
-    if (!all_including_inactive)
-    {
-        data.is_active_accessor_func =
-            qof_class_get_parameter_getter(type_name, QOF_PARAM_ACTIVE);
-    }
-
-    qof_object_foreach(type_name, book, &get_ownerlist_cb, &data);
-
-    return data.result;
-}
-
-gboolean gncBusinessIsPaymentAcctType (GNCAccountType type)
-{
-    if (xaccAccountIsAssetLiabType(type) ||
-        xaccAccountIsEquityType(type))
-        return TRUE;
-    else
-        return FALSE;
-}
diff --git a/src/engine/qof-backend.cpp b/src/engine/qof-backend.cpp
deleted file mode 100644
index 24f58a9..0000000
--- a/src/engine/qof-backend.cpp
+++ /dev/null
@@ -1,219 +0,0 @@
-/********************************************************************\
- * qofbackend.c -- utility routines for dealing with the data backend  *
- * Copyright (C) 2000 Linas Vepstas <linas at linas.org>               *
- * Copyright (C) 2004-5 Neil Williams <linux at codehelp.co.uk>        *
- *                                                                  *
- * 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 at gnu.org                   *
- *                                                                  *
-\********************************************************************/
-
-extern "C"
-{
-
-#include <config.h>
-#include "qof.h"
-#include <gnc-path.h>
-}
-
-#include <string>
-#include <algorithm>
-#include <vector>
-
-#include "qof-backend.hpp"
-
-G_GNUC_UNUSED static QofLogModule log_module = QOF_MOD_BACKEND;
-
-#define QOF_CONFIG_DESC    "desc"
-#define QOF_CONFIG_TIP     "tip"
-
-/* *******************************************************************\
- * error handling                                                   *
-\********************************************************************/
-
-GModuleVec QofBackend::c_be_registry{};
-
-void
-QofBackend::set_error(QofBackendError err)
-{
-    /* use stack-push semantics. Only the earliest error counts */
-    if (m_last_err != ERR_BACKEND_NO_ERR) return;
-    m_last_err = err;
-}
-
-QofBackendError
-QofBackend::get_error()
-{
-    /* use 'stack-pop' semantics */
-    auto err = m_last_err;
-    m_last_err = ERR_BACKEND_NO_ERR;
-    return err;
-}
-
-bool
-QofBackend::check_error()
-{
-    return m_last_err != ERR_BACKEND_NO_ERR;
-}
-
-void
-QofBackend::set_message (std::string&& msg)
-{
-    m_error_msg = msg;
-}
-
-const std::string&&
-QofBackend::get_message ()
-{
-    return std::move(m_error_msg);
-}
-
-/* Helper function that return a directory from which the requested module
- * can be loaded. This is needed because the location of the modules
- * depends on
- * - whether we're running in an installed environment or the build environment
- * - the operation system
- * - (in the build environment) which build system is used
- *
- * Note parameter rel_path is only used when invoked in the build environment
- * because each backend module is likely to reside in its own directory. At
- * install time it is assumed all backend modules reside in one single directory.
- */
-static char* get_default_module_dir(const char* rel_path)
-{
-    gchar *pkglibdir;
-    const gchar *builddir = g_getenv ("GNC_BUILDDIR");
-    gboolean uninstalled = (g_getenv ("GNC_UNINSTALLED") != NULL
-                            && builddir != NULL);
-
-    if (uninstalled)
-    {
-#ifdef CMAKE_BUILD
-    #ifdef WIN32
-        #define LIBDIR "bin"
-    #else
-        #define LIBDIR "lib/gnucash"
-    #endif
-        pkglibdir = g_build_path (G_DIR_SEPARATOR_S, builddir, LIBDIR, NULL);
-#else
-        if (rel_path)
-            pkglibdir = g_build_path (G_DIR_SEPARATOR_S, builddir,
-                                      "src", "backend", rel_path, ".libs", NULL);
-        else
-            pkglibdir = g_build_path (G_DIR_SEPARATOR_S, builddir,
-                                      "src", "backend", ".libs", NULL);
-#endif
-    }
-    else
-        pkglibdir = gnc_path_get_pkglibdir ();
-
-    return pkglibdir;
-}
-
-bool
-QofBackend::register_backend(const char* directory, const char* module_name)
-{
-    if (!g_module_supported ())
-    {
-        PWARN("Modules not supported.");
-        return false;
-    }
-
-    auto absdir = g_strdup(directory);
-    if (!absdir || !g_path_is_absolute(absdir))
-        absdir = get_default_module_dir(directory);
-    auto fullpath = g_module_build_path (absdir, module_name);
-    g_free (absdir);
-/* Darwin modules can have either .so or .dylib for a suffix */
-    if (!g_file_test (fullpath, G_FILE_TEST_EXISTS) &&
-        g_strcmp0 (G_MODULE_SUFFIX, "so") == 0)
-    {
-        auto modname = g_strdup_printf ("lib%s.dylib", module_name);
-        g_free (fullpath);
-        fullpath = g_build_filename (directory, modname, NULL);
-        g_free (modname);
-    }
-    auto backend = g_module_open (fullpath, G_MODULE_BIND_LAZY);
-    g_free (fullpath);
-    if (!backend)
-    {
-        PINFO ("%s: %s\n", PACKAGE, g_module_error ());
-        return false;
-    }
-    void (*module_init_func)(void);
-    if (g_module_symbol (backend, "qof_backend_module_init",
-                         reinterpret_cast<void**>(&module_init_func)))
-        module_init_func ();
-
-    g_module_make_resident (backend);
-    c_be_registry.push_back(backend);
-    return TRUE;
-}
-
-void
-QofBackend::release_backends()
-{
-    for (auto backend : c_be_registry)
-    {
-        void (*module_finalize_func)(void);
-        if (g_module_symbol(backend, "qof_backend_module_finalize",
-                            reinterpret_cast<void**>(&module_finalize_func)))
-            module_finalize_func();
-    }
-}
-/***********************************************************************/
-QofBackendError
-qof_backend_get_error (QofBackend* qof_be)
-{
-    if (qof_be == nullptr) return ERR_BACKEND_NO_ERR;
-    return ((QofBackend*)qof_be)->get_error();
-}
-
-void
-qof_backend_set_error (QofBackend* qof_be, QofBackendError err)
-{
-    if (qof_be == nullptr) return;
-    ((QofBackend*)qof_be)->set_error(err);
-}
-
-gboolean
-qof_backend_can_rollback (QofBackend* qof_be)
-{
-    if (qof_be == nullptr) return FALSE;
-    return true;
-}
-
-void
-qof_backend_rollback_instance (QofBackend* qof_be, QofInstance* inst)
-{
-    if (qof_be == nullptr) return;
-    ((QofBackend*)qof_be)->rollback(inst);
-}
-
-gboolean
-qof_load_backend_library (const char *directory, const char* module_name)
-{
-    return QofBackend::register_backend(directory, module_name);
-}
-
-void
-qof_finalize_backend_libraries(void)
-{
-    QofBackend::release_backends();
-}
-
-/************************* END OF FILE ********************************/
diff --git a/src/engine/test-core/CMakeLists.txt b/src/engine/test-core/CMakeLists.txt
deleted file mode 100644
index c376bd4..0000000
--- a/src/engine/test-core/CMakeLists.txt
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-SET(libgncmod_test_engine_SOURCES
-  gncmod-test-engine.c test-engine-stuff.cpp
-)
-
-ADD_LIBRARY(gncmod-test-engine STATIC ${libgncmod_test_engine_SOURCES})
-
-TARGET_INCLUDE_DIRECTORIES(gncmod-test-engine PRIVATE
-  ${CMAKE_PREFIX_PATH}/include
-  ${GMODULE_INCLUDE_DIRS}
-  ${CMAKE_SOURCE_DIR}/src/gnc-module
-  ${CMAKE_BINARY_DIR}/src # for config.h
-  ${CMAKE_SOURCE_DIR}/src
-  ${CMAKE_SOURCE_DIR}/src/engine
-  ${CMAKE_SOURCE_DIR}/src/test-core
-)
-
-SET_DIST_LIST(engine_test_core_DIST CMakeLists.txt Makefile.am ${libgncmod_test_engine_SOURCES}
-        test-engine-stuff.h test-engine-strings.h)
diff --git a/src/engine/test-core/Makefile.am b/src/engine/test-core/Makefile.am
deleted file mode 100644
index 6513014..0000000
--- a/src/engine/test-core/Makefile.am
+++ /dev/null
@@ -1,26 +0,0 @@
-noinst_LTLIBRARIES=libgncmod-test-engine.la
-
-LDADD = \
-  ${top_builddir}/src/gnc-module/libgnc-module.la \
-  ../libgncmod-engine.la \
-  ${GLIB_LIBS}
-
-libgncmod_test_engine_la_SOURCES = gncmod-test-engine.c test-engine-stuff.cpp
-libgncmod_test_engine_la_LDFLAGS = -module
-libgncmod_test_engine_la_LIBADD = \
-  ${top_builddir}/src/gnc-module/libgnc-module.la \
-  ../libgncmod-engine.la \
-  ${GLIB_LIBS}
-
-noinst_HEADERS=test-engine-stuff.h test-engine-strings.h
-
-AM_CPPFLAGS = \
-  -I${top_srcdir}/src \
-  -I${top_srcdir}/src/gnc-module \
-  -I${top_srcdir}/src/test-core \
-  -I${top_srcdir}/src/engine \
-  ${GLIB_CFLAGS} \
-  ${GUILE_CFLAGS} \
-  ${BOOST_CPPFLAGS}
-
-EXTRA_DIST = CMakeLists.txt
diff --git a/src/engine/test/CMakeLists.txt b/src/engine/test/CMakeLists.txt
deleted file mode 100644
index c8cb436..0000000
--- a/src/engine/test/CMakeLists.txt
+++ /dev/null
@@ -1,286 +0,0 @@
-# Common stuff
-
-SET(ENGINE_TEST_INCLUDE_DIRS
-  ${CMAKE_SOURCE_DIR}/src/backend/xml
-  ${CMAKE_SOURCE_DIR}/src/engine
-  ${CMAKE_SOURCE_DIR}/src/engine/test-core
-  ${CMAKE_BINARY_DIR}/src # for config.h
-  ${CMAKE_SOURCE_DIR}/src/test-core  # for unittest-support.h
-  ${GLIB2_INCLUDE_DIRS}
-)
-
-SET(ENGINE_TEST_LIBS gncmod-engine gncmod-test-engine test-core ${LIBXML2_LDFLAGS} -lm)
-
-MACRO(ADD_ENGINE_TEST _TARGET _SOURCE_FILES)
-  GNC_ADD_TEST(${_TARGET} "${_SOURCE_FILES}" ENGINE_TEST_INCLUDE_DIRS ENGINE_TEST_LIBS)
-ENDMACRO()
-
-CONFIGURE_FILE(test-scm-query-import.in test-scm-query-import @ONLY)
-CONFIGURE_FILE(test-create-account.in test-create-account @ONLY)
-# Not via macro because of unique link requirements
-
-ADD_EXECUTABLE(test-link EXCLUDE_FROM_ALL test-link.c)
-TARGET_LINK_LIBRARIES(test-link gnc-core-utils)
-ADD_TEST(NAME test-link COMMAND test-link)
-ADD_DEPENDENCIES(check test-link)
-
-#################################################
-
-ADD_ENGINE_TEST(test-load-engine test-load-engine.c)
-ADD_ENGINE_TEST(test-guid test-guid.cpp)
-ADD_ENGINE_TEST(test-date test-date.cpp)
-ADD_ENGINE_TEST(test-object test-object.c)
-ADD_ENGINE_TEST(test-commodities test-commodities.cpp)
-
-SET(test_qof_SOURCES
-  test-gnc-date.c
-  test-qof.c
-  test-qofbook.c
-  test-qofinstance.cpp
-  test-qofobject.c
-  test-qof-string-cache.c
-)
-
-SET(test_engine_SOURCES
-  test-engine.c
-  test-engine-kvp-properties.c
-  test-gnc-uri-utils.c
-  utest-Account.cpp
-  utest-Budget.c
-  utest-Entry.c
-  utest-Invoice.c
-  utest-Split.cpp
-  utest-Transaction.cpp
-  utest-gnc-pricedb.c
-)
-
-# This test does not run on Win32
-IF (NOT WIN32)
-  SET(SOURCES ${test_qof_SOURCES} ${CMAKE_SOURCE_DIR}/src/test-core/unittest-support.c)
-  ADD_ENGINE_TEST(test-qof "${SOURCES}")
-  TARGET_COMPILE_DEFINITIONS(test-qof PRIVATE TESTPROG=test_qof)
-
-  SET(SOURCES ${test_engine_SOURCES} ${CMAKE_SOURCE_DIR}/src/test-core/unittest-support.c)
-  ADD_ENGINE_TEST(test-engine "${SOURCES}")
-  TARGET_COMPILE_OPTIONS(test-engine PRIVATE -Wno-write-strings)
-  TARGET_COMPILE_DEFINITIONS(test-engine PRIVATE TESTPROG=test_engine)
-ENDIF()
-
-ADD_ENGINE_TEST(test-account-object test-account-object.cpp)
-ADD_ENGINE_TEST(test-group-vs-book test-group-vs-book.cpp)
-ADD_ENGINE_TEST(test-lots test-lots.cpp)
-ADD_ENGINE_TEST(test-querynew test-querynew.c)
-ADD_ENGINE_TEST(test-query test-query.cpp)
-ADD_ENGINE_TEST(test-split-vs-account test-split-vs-account.cpp)
-ADD_ENGINE_TEST(test-transaction-reversal test-transaction-reversal.cpp)
-ADD_ENGINE_TEST(test-transaction-voiding test-transaction-voiding.cpp)
-ADD_ENGINE_TEST(test-recurrence test-recurrence.c)
-ADD_ENGINE_TEST(test-business test-business.c)
-ADD_ENGINE_TEST(test-address test-address.c)
-ADD_ENGINE_TEST(test-customer test-customer.c)
-ADD_ENGINE_TEST(test-employee test-employee.c)
-ADD_ENGINE_TEST(test-job test-job.c)
-ADD_ENGINE_TEST(test-vendor test-vendor.c)
-
-SET(test_numeric_SOURCES
-  ${CMAKE_SOURCE_DIR}/src/engine/gnc-numeric.cpp
-  ${CMAKE_SOURCE_DIR}/src/engine/gnc-rational.cpp
-  ${CMAKE_SOURCE_DIR}/src/engine/gnc-int128.cpp
-  ${CMAKE_SOURCE_DIR}/src/engine/test/test-numeric.cpp
-)
-ADD_ENGINE_TEST(test-numeric "${test_numeric_SOURCES}")
-
-SET(MODULEPATH ${CMAKE_SOURCE_DIR}/src/engine)
-SET(gtest_old_engine_LIBS
-  gncmod-engine
-  ${GLIB2_LDFLAGS}
-  ${Boost_LIBRARIES}
-  ${GTEST_LIB})
-
-SET(gtest_qof_LIBS
-  ${GLIB2_LDFLAGS}
-  ${GOBJECT_LDFLAGS}
-  ${GMODULE_LDFLAGS}
-  ${GTHREAD_LDFLAGS}
-  ${Boost_LIBRARIES}
-  ${GTEST_LIB})
-
-SET(gtest_engine_INCLUDES
-  ${MODULEPATH}
-  ${CMAKE_BINARY_DIR}/src # for config.h
-  ${CMAKE_SOURCE_DIR}/src # for platform.h
-  ${GLIB2_INCLUDE_DIRS}
-  ${GTEST_INCLUDE_DIR})
-
-SET(test_gnc_guid_SOURCES
-  ${MODULEPATH}/guid.cpp
-  test-gnc-guid.cpp
-  ${GTEST_SRC})
-GNC_ADD_TEST(test-gnc-guid "${test_gnc_guid_SOURCES}"
-  gtest_engine_INCLUDES gtest_old_engine_LIBS)
-
-SET(test_kvp_value_SOURCES
-  ${MODULEPATH}/kvp-value.cpp
-  test-kvp-value.cpp
-  test-kvp-frame.cpp
-  ${GTEST_SRC})
-GNC_ADD_TEST(test-kvp-value "${test_kvp_value_SOURCES}"
-  gtest_engine_INCLUDES gtest_old_engine_LIBS)
-
-SET(test_qofsession_SOURCES
-  ${MODULEPATH}/qofsession.cpp
-  test-qofsession.cpp
-  ${GTEST_SRC})
-GNC_ADD_TEST(test-qofsession "${test_qofsession_SOURCES}"
-  gtest_engine_INCLUDES gtest_old_engine_LIBS)
-
-SET(test_gnc_int128_SOURCES
-  ${MODULEPATH}/gnc-int128.cpp
-  gtest-gnc-int128.cpp
-  ${GTEST_SRC})
-GNC_ADD_TEST(test-gnc-int128 "${test_gnc_int128_SOURCES}"
-  gtest_engine_INCLUDES gtest_qof_LIBS)
-
-SET(test_gnc_rational_SOURCES
-  ${MODULEPATH}/gnc-rational.cpp
-  ${MODULEPATH}/gnc-numeric.cpp
-  ${MODULEPATH}/gnc-int128.cpp
-  ${MODULEPATH}/gnc-datetime.cpp
-  ${MODULEPATH}/gnc-timezone.cpp
-  ${MODULEPATH}/gnc-date.cpp
-  ${MODULEPATH}/qoflog.cpp
-  gtest-gnc-rational.cpp
-  ${GTEST_SRC})
-GNC_ADD_TEST(test-gnc-rational "${test_gnc_rational_SOURCES}"
-  gtest_engine_INCLUDES gtest_qof_LIBS)
-
-SET(test_gnc_numeric_SOURCES
-  ${MODULEPATH}/gnc-rational.cpp
-  ${MODULEPATH}/gnc-int128.cpp
-  ${MODULEPATH}/gnc-numeric.cpp
-  ${MODULEPATH}/gnc-datetime.cpp
-  ${MODULEPATH}/gnc-timezone.cpp
-  ${MODULEPATH}/gnc-date.cpp
-  ${MODULEPATH}/qoflog.cpp
-  gtest-gnc-numeric.cpp
-  ${GTEST_SRC})
-GNC_ADD_TEST(test-gnc-numeric "${test_gnc_numeric_SOURCES}"
-  gtest_engine_INCLUDES gtest_qof_LIBS)
-
-SET(test_gnc_timezone_SOURCES
-  ${MODULEPATH}/gnc-timezone.cpp
-  gtest-gnc-timezone.cpp
-  ${GTEST_SRC})
-GNC_ADD_TEST(test-gnc-timezone "${test_gnc_timezone_SOURCES}"
-  gtest_engine_INCLUDES gtest_old_engine_LIBS)
-
-SET(test_gnc_datetime_SOURCES
-  ${MODULEPATH}/gnc-datetime.cpp
-  ${MODULEPATH}/gnc-timezone.cpp
-  ${MODULEPATH}/gnc-date.cpp
-  ${MODULEPATH}/qoflog.cpp
-  gtest-gnc-datetime.cpp
-  ${GTEST_SRC})
-GNC_ADD_TEST(test-gnc-datetime "${test_gnc_datetime_SOURCES}"
-  gtest_engine_INCLUDES gtest_qof_LIBS)
-
-############################
-# This is a C test that needs GUILE environment variables set.
-# It does not pass on Win32.
-GNC_ADD_TEST_WITH_GUILE(test-scm-query test-scm-query.cpp ENGINE_TEST_INCLUDE_DIRS ENGINE_TEST_LIBS)
-############################
-
-GNC_ADD_SCHEME_TEST(scm-test-account test-account.scm)
-GNC_ADD_SCHEME_TEST(scm-test-create-account test-create-account.scm)
-GNC_ADD_SCHEME_TEST(scm-test-test-extra test-test-extras.scm)
-GNC_ADD_SCHEME_TEST(scm-test-split test-split.scm)
-# This check not run in autotools. Doesn't pass.
-#GNC_ADD_SCHEME_TEST(scm-test-scm-query-import test-scm-query-import.scm)
-
-SET(engine_test_SCHEME test-extras.scm)
-
-SET(GUILE_MODULES      "")
-SET(GUILE_LOAD_DIRS    src/app-utils src/scm)
-SET(GUILE_LIBRARY_DIRS "")
-SET(GUILE_DEPENDS      scm-app-utils scm-scm)
-
-GNC_ADD_SCHEME_TARGETS(scm-test-engine
-  "${engine_test_SCHEME}"
-  gnucash/engine/test
-  "${GUILE_MODULES}"
-  "${GUILE_LOAD_DIRS}"
-  "${GUILE_LIBRARY_DIRS}"
-  "${GUILE_DEPENDS}"
-  FALSE
-)
-
-SET(test_engine_SOURCES_DIST
-        dummy.cpp
-        gtest-gnc-int128.cpp
-        gtest-gnc-rational.cpp
-        gtest-gnc-numeric.cpp
-        gtest-gnc-timezone.cpp
-        gtest-gnc-datetime.cpp
-        gtest-import-map.cpp
-        test-account-object.cpp
-        test-address.c
-        test-business.c
-        test-commodities.cpp
-        test-customer.c
-        test-date.cpp
-        test-employee.c
-        test-engine-kvp-properties.c
-        test-engine.c
-        test-gnc-date.c
-        test-gnc-guid.cpp
-	test-gnc-uri-utils.c
-        test-group-vs-book.cpp
-        test-guid.cpp
-        test-job.c
-        test-kvp-value.cpp
-        test-kvp-frame.cpp
-        test-link.c
-        test-load-engine.c
-        test-lots.cpp
-        test-numeric.cpp
-        test-object.c
-        test-qof.c
-        test-qofbook.c
-        test-qofinstance.cpp
-        test-qofobject.c
-        test-qofsession.cpp
-        test-qof-string-cache.c
-        test-query.cpp
-        test-querynew.c
-        test-recurrence.c
-        test-scm-query.cpp
-        test-split-vs-account.cpp
-        test-transaction-reversal.cpp
-        test-transaction-voiding.cpp
-        test-vendor.c
-        utest-Account.cpp
-        utest-Budget.c
-        utest-Entry.c
-        utest-Invoice.c
-        utest-Split.cpp
-        utest-Transaction.cpp
-        utest-gnc-pricedb.c
-)
-
-SET(test_engine_SCHEME_DIST
-        test-account.scm
-        test-create-account.scm
-        test-extras.scm
-        test-scm-query-import.scm
-        test-split.scm
-        test-test-extras.scm
-)
-
-SET(test_engine_EXTRA_DIST
-        README
-        test-create-account.in
-        test-scm-query-import.in
-)
-
-SET_DIST_LIST(test_engine_DIST CMakeLists.txt Makefile.am
-        ${test_engine_SOURCES_DIST} ${test_engine_SCHEME_DIST} ${test_engine_EXTRA_DIST})
diff --git a/src/engine/test/Makefile.am b/src/engine/test/Makefile.am
deleted file mode 100644
index 1af7131..0000000
--- a/src/engine/test/Makefile.am
+++ /dev/null
@@ -1,214 +0,0 @@
-include $(top_srcdir)/test-templates/Makefile.decl
-
-MODULEPATH = src/engine
-
-AM_CPPFLAGS = \
-  -I${top_srcdir} \
-  -I${top_srcdir}/src \
-  -I${top_srcdir}/src/gnc-module \
-  -I${top_srcdir}/src/test-core \
-  -I${top_srcdir}/src/engine \
-  -I${top_srcdir}/src/engine/test-core \
-  -I${top_srcdir}/src/core-utils \
-  ${GUILE_CFLAGS} \
-  ${GLIB_CFLAGS} \
-  ${BOOST_CPPFLAGS}
-
-LDADD = \
-  ${top_builddir}/src/gnc-module/libgnc-module.la \
-  ${top_builddir}/src/test-core/libtest-core.la \
-  ../libgncmod-engine.la \
-  ../test-core/libgncmod-test-engine.la \
-  ${top_builddir}/src/core-utils/libgnc-core-utils.la \
-  ${GLIB_LIBS}
-
-test_guid_SOURCES = test-guid.cpp
-
-# these tests are ordered kind more or less in the order
-# that they should be executed, with more basic tests coming first.
-#
-TEST_GROUP_1 = \
-  test-link \
-  test-load-engine \
-  test-guid \
-  test-date \
-  test-object \
-  test-commodities \
-  test-qof \
-  test-engine
-
-TEST_GROUP_2 = \
-  test-account-object \
-  test-group-vs-book \
-  test-lots \
-  test-querynew \
-  test-query \
-  test-split-vs-account  \
-  test-transaction-reversal \
-  test-transaction-voiding \
-  test-recurrence \
-  test-scm-query \
-  test-business \
-  test-address \
-  test-customer \
-  test-employee \
-  test-job \
-  test-vendor
-
-SCM_TESTS = \
-  test-test-extras \
-  test-account \
-  test-split
-
-SCM_TEST_SRCS = $(SCM_TESTS:%=%.scm)
-
-GNC_TEST_DEPS = \
-  --gnc-module-dir ${top_builddir}/src/engine \
-  --gnc-module-dir ${top_builddir}/src/engine/test \
-  --gnc-module-dir ${top_builddir}/src/app-utils \
-  --guile-load-dir ${top_builddir}/src/gnc-module \
-  --guile-load-dir ${top_builddir}/src/engine \
-  --guile-load-dir ${top_builddir}/src/app-utils \
-  --guile-load-dir ${top_builddir}/src/core-utils \
-  --guile-load-dir ${top_builddir}/src/scm \
-  --guile-load-dir ${top_builddir}/src/engine/test \
-  --library-dir    ${top_builddir}/src/core-utils \
-  --library-dir    ${top_builddir}/src/gnc-module \
-  --library-dir    ${top_builddir}/src/engine \
-  --library-dir    ${top_builddir}/src/app-utils \
-  --library-dir    ${top_builddir}/src/backend/xml \
-  --library-dir    ${top_builddir}/src/backend/sql \
-  --library-dir    ${top_builddir}/src/engine/test
-
-test_account_object_SOURCES = test-account-object.cpp
-test_commodities_SOURCES = test-commodities.cpp
-test_date_SOURCES = test-date.cpp
-test_group_vs_book_SOURCES = test-group-vs-book.cpp
-test_lots_SOURCES = test-lots.cpp
-
-test_query_SOURCES = test-query.cpp
-test_scm_query_SOURCES = test-scm-query.cpp
-test_split_vs_account_SOURCES = test-split-vs-account.cpp
-test_transaction_reversal_SOURCES = test-transaction-reversal.cpp
-test_transaction_voiding_SOURCES = test-transaction-voiding.cpp
-
-$(SCM_TESTS): %: $(srcdir)/%.scm Makefile .scm-links
-	echo 'export GNC_BUILDDIR="${abs_top_builddir}";' > $@
-	echo 'export GNC_UNINSTALLED=yes;' >> $@
-	echo '${GUILE} --debug -l $(srcdir)/$*.scm -c "(exit (run-test))"' >> $@
-	chmod a+x $@
-
-TESTS_ENVIRONMENT = \
-  GUILE_WARN_DEPRECATED=no \
-  GUILE="${GUILE}" \
-  SRCDIR=${srcdir} \
-  GNC_BUILDDIR="${abs_top_builddir}" \
-  $(shell ${abs_top_srcdir}/src/gnc-test-env.pl --noexports ${GNC_TEST_DEPS})
-
-check_PROGRAMS = ${TEST_GROUP_1} ${TEST_GROUP_2}
-
-TESTS = ${TEST_GROUP_1} test-create-account ${TEST_GROUP_2} ${SCM_TESTS}
-
-test_link_SOURCES = test-link.c
-test_link_LDADD = ../libgncmod-engine.la \
-  ${top_builddir}/src/core-utils/libgnc-core-utils.la
-
-if WITH_GOOGLE_PROFILER
-LDADD += -lprofiler
-endif
-
-SCM_TEST_HELPERS = test-extras.scm
-
-EXTRA_DIST += \
-  test-create-account \
-  test-create-account.scm \
-  test-scm-query-import \
-  test-scm-query-import.scm \
-  $(SCM_TEST_HELPERS) \
-  $(SCM_TEST_SRCS) \
-  CMakeLists.txt
-
-TEST_PROGS += test-engine
-
-.scm-links:
-	$(RM) -rf gnucash
-	mkdir -p  gnucash/engine/test
-	( cd gnucash/engine/test; for A in $(SCM_TEST_HELPERS) ; do $(LN_S) -f $(abs_srcdir)/$$A . ; done )
-if ! OS_WIN32
-# Windows knows no "ln -s" but uses "cp": must copy every time (see bug #566567).
-	touch .scm-links
-endif
-
-noinst_PROGRAMS = ${TEST_PROGS} ${CHECK_PROGS}
-
-noinst_DATA: .scm-links
-
-test_qof_SOURCES = \
-	test-gnc-date.c \
-	test-qof.c \
-	test-qofbook.c \
-	test-qofinstance.cpp \
-	test-qofobject.c \
-	test-qof-string-cache.c
-
-test_qof_LDADD = \
-	$(LDADD)
-test_qof_CFLAGS = \
-	${DEFAULT_INCLUDES} \
-	-I${top_srcdir}/${MODULEPATH}/ \
-	-DTESTPROG=test_qof \
-	${GLIB_CFLAGS} \
-	${AM_CFLAGS}
-
-test_engine_SOURCES = \
-	test-engine.c \
-	test-gnc-uri-utils.c \
-	utest-Account.cpp \
-	utest-Budget.c \
-	utest-Entry.c \
-	utest-Invoice.c \
-	test-engine-kvp-properties.c \
-	utest-gnc-pricedb.c \
-	utest-Transaction.cpp \
-	dummy.cpp \
-	utest-Split.cpp \
-	${top_srcdir}/${MODULEPATH}/gnc-numeric.cpp
-
-test_engine_LDADD = \
-	$(LDADD)
-test_engine_CFLAGS = \
-	${DEFAULT_INCLUDES} \
-	-I${top_srcdir}/${MODULEPATH}/ \
-	-DTESTPROG=test_engine \
-	${GLIB_CFLAGS} \
-	${AM_CFLAGS}
-test_engine_CXXFLAGS = -Wno-write-strings $(AM_CXXFLAGS)
-
-test_import_map_SOURCES = \
-        gtest-import-map.cpp
-test_import_map_LDADD = \
-        ${top_builddir}/src/engine/libgncmod-engine.la \
-        ${GLIB_LIBS} \
-        ${GTEST_LIBS}
-
-if !GOOGLE_TEST_LIBS
-nodist_test_import_map_SOURCES = \
-        ${GTEST_SRC}/src/gtest_main.cc
-endif
-
-test_import_map_CPPFLAGS = \
-        -I${GTEST_HEADERS} \
-        -I${top_srcdir}/${MODULEPATH} \
-        -I${top_srcdir}/src/core-utils \
-        ${GLIB_CFLAGS}
-
-TEST_GROUP_1 += test-import-map
-
-
-CLEANFILES = .scm-links
-DISTCLEANFILES = $(SCM_TESTS)
-
-clean-local:
-	rm -f translog.*
-
-distclean-local: clean-local
diff --git a/src/engine/test/test-gnc-date.c b/src/engine/test/test-gnc-date.c
deleted file mode 100644
index fb93341..0000000
--- a/src/engine/test/test-gnc-date.c
+++ /dev/null
@@ -1,2281 +0,0 @@
-/********************************************************************
- * utest-gnc-date.c: GLib g_test test suite for gnc-date.c.         *
- * Copyright 2012 John Ralls <jralls at ceridwen.us>                   *
- *                                                                  *
- * 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, you can retrieve it from        *
- * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html            *
- * or 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 at gnu.org                   *
- ********************************************************************/
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-#include <config.h>
-#include "../../platform.h"
-#include <string.h>
-#include <sys/time.h>
-#include <glib.h>
-#include <unittest-support.h>
-/* Add specific headers for this class */
-
-#ifdef __cplusplus
-}
-#endif
-#include "../gnc-date.h"
-#include "../gnc-date-p.h"
-#include <locale.h>
-#include <glib/gprintf.h>
-#include <inttypes.h>
-#ifndef HAVE_STRPTIME
-#  include "strptime.h"
-#endif
-
-static const gchar *suitename = "/qof/gnc-date";
-static const time64 secs_per_year = INT64_C(3600) * (INT64_C(24) * INT64_C(365) + 6);
-static const time64 max_secs = (INT64_C(3600) * (INT64_C(24) * INT64_C(365) + 6)) * (INT64_C(9999) - INT64_C(1970));
-
-typedef struct
-{
-    short hours;
-    short minutes;
-} TZOffset;
-
-typedef struct
-{
-    TZOffset off_zulu;
-    TZOffset off_05w;
-    TZOffset off_0840e;
-    Timespec ts0;
-    Timespec ts1;
-    Timespec ts2;
-    Timespec ts3;
-    Timespec ts4;
-    Timespec ts5;
-} FixtureA;
-
-static int
-offset_secs (TZOffset tz)
-{
-    return 3600 * tz.hours + 60 * tz.minutes;
-}
-
-static char*
-offset_string (TZOffset tz)
-{
-    return g_strdup_printf("%+02d%02d", tz.hours, tz.minutes);
-}
-
-static void setup (FixtureA *f, gconstpointer pData)
-{
-    f->ts0 = (Timespec){gnc_time(NULL), 0};
-    f->off_zulu = (TZOffset){0, 0};
-    f->off_05w = (TZOffset){-5, 0};
-    f->off_0840e = (TZOffset){8, 40};
-    f->ts1 = (Timespec){607009407, 0}; //1989-3-27 13:43:27 Z
-    f->ts2 = (Timespec){1604748079, 0}; //2020-11-7 06:21:19 -05:00
-    f->ts3 = (Timespec){1341398864, 0}; //2012-07-04 19:27:44 +08:40
-    f->ts4 = (Timespec){-261104801, 0}; //1961-09-22 17:53:19 -05:00
-    f->ts5 = (Timespec){2873938879LL, 0}; //2061-01-25 23:21:19 -05:00
-}
-
-typedef struct
-{
-    int yr;
-    int mon;
-    int day;
-    time64 secs;
-} TimeMap;
-
-typedef struct
-{
-    TimeMap test[9];
-} FixtureB;
-
-static void
-setup_begin(FixtureB *f, gconstpointer pData)
-{
-    f->test[0] = (TimeMap){1999, 7, 21, INT64_C(932515200)};
-    f->test[1] = (TimeMap){1918, 3, 31, INT64_C(-1633305600)};
-    f->test[2] = (TimeMap){1918, 4, 1, INT64_C(-1633219200)};
-    f->test[3] = (TimeMap){2057, 11, 20, INT64_C(2773440000)};
-    f->test[4] = (TimeMap){1257, 07, 02, INT64_MAX}; /*invalid year*/
-    f->test[5] = (TimeMap){2017, 02, 29, INT64_MAX}; /*invalid day*/
-    f->test[6] = (TimeMap){2017, 02, 33, INT64_MAX}; /*invalid day*/
-    f->test[7] = (TimeMap){2017, 13, 29, INT64_MAX}; /*invalid month*/
-    f->test[8] = (TimeMap){2017, 03, 16, INT64_C(1489622400)};
-}
-
-static void
-setup_neutral(FixtureB *f, gconstpointer pData)
-{
-    f->test[0] = (TimeMap){1999, 7, 21, INT64_C(932554740)};
-    f->test[1] = (TimeMap){1918, 3, 31, INT64_C(-1633266060)};
-    f->test[2] = (TimeMap){1918, 4, 1, INT64_C(-1633179660)};
-    f->test[3] = (TimeMap){2057, 11, 20, INT64_C(2773479540)};
-    f->test[4] = (TimeMap){1257, 07, 02, INT64_MAX};
-    f->test[5] = (TimeMap){2017, 02, 29, INT64_MAX};
-    f->test[6] = (TimeMap){2017, 02, 33, INT64_MAX};
-    f->test[7] = (TimeMap){2017, 13, 29, INT64_MAX};
-    f->test[8] = (TimeMap){2017, 03, 16, INT64_C(1489661940)};
-}
-
-static void
-setup_end(FixtureB *f, gconstpointer pData)
-{
-    f->test[0] = (TimeMap){1999, 7, 21, INT64_C(932601599)};
-    f->test[1] = (TimeMap){1918, 3, 31, INT64_C(-1633219201)};
-    f->test[2] = (TimeMap){1918, 4, 1, INT64_C(-1633132801)};
-    f->test[3] = (TimeMap){2057, 11, 20, INT64_C(2773526399)};
-    f->test[4] = (TimeMap){1257, 07, 02, INT64_MAX};
-    f->test[5] = (TimeMap){2017, 02, 29, INT64_MAX};
-    f->test[6] = (TimeMap){2017, 02, 33, INT64_MAX};
-    f->test[7] = (TimeMap){2017, 13, 29, INT64_MAX};
-    f->test[8] = (TimeMap){2017, 03, 16, INT64_C(1489708799)};
-}
-
-void test_suite_gnc_date ( void );
-static GTimeZone *tz;
-#define MAXTIME INT64_C(253402214400)
-#define MINTIME INT64_C(-17987443200)
-
-/* gnc_localtime just creates a tm on the heap and calls
- * gnc_localtime_r with it, so this suffices to test both.
- */
-static void
-test_gnc_localtime (void)
-{
-    time64 secs[] = {-15767956734LL, -1123692LL, 432761LL,
-                      723349832LL, 887326459367LL,
-                      1364160236LL};
-    guint ind;
-    if (sizeof(time_t) < sizeof(time64))
-        secs[0] = -432761LL;
-
-    for (ind = 0; ind < G_N_ELEMENTS (secs); ind++)
-    {
-        struct tm* time = gnc_localtime (&secs[ind]);
-        time_t tsecs;
-        struct tm* ans;
-        if (secs[ind] > max_secs)
-        {
-            g_assert (time == NULL);
-            continue;
-        }
-        tsecs = (time_t)(secs[ind]);
-        ans = localtime(&tsecs);
-        g_assert_cmpint (time->tm_year, ==, ans->tm_year);
-        g_assert_cmpint (time->tm_mon, ==, ans->tm_mon);
-        g_assert_cmpint (time->tm_mday, ==, ans->tm_mday);
-        g_assert_cmpint (time->tm_hour, ==, ans->tm_hour);
-        g_assert_cmpint (time->tm_min, ==, ans->tm_min);
-        g_assert_cmpint (time->tm_sec, ==, ans->tm_sec);
-        g_assert_cmpint (time->tm_wday, ==, ans->tm_wday);
-        g_assert_cmpint (time->tm_yday, ==, ans->tm_yday);
-        g_assert_cmpint (time->tm_isdst, ==, ans->tm_isdst);
-#ifdef HAVE_STRUCT_TM_GMTOFF
-        g_assert_cmpint (time->tm_gmtoff, ==, ans->tm_gmtoff);
-#endif
-        gnc_tm_free (time);
-    }
-}
-
-static void
-test_gnc_gmtime (void)
-{
-    time64 secs[6] = {-15767956734LL, -1123692LL, 432761LL,
-                      723349832LL, 887326459367LL, 1175964426LL
-                     };
-    struct tm answers[6] =
-    {
-#ifdef HAVE_STRUCT_TM_GMTOFF
-        { 6, 1, 12, 2, 4, -430, 1, 121, 0, 0, NULL },
-        { 48, 51, 23, 18, 11, 69, 4, 351, 0, 0, NULL },
-        { 41, 12, 0, 6, 0, 70, 2, 5, 0, 0, NULL },
-        { 32, 30, 2, 3, 11, 92, 4, 337, 0, 0, NULL },
-        { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL },
-        { 6, 47, 16, 7, 3, 107, 6, 96, 0, 0, NULL },
-#else
-        { 6, 1, 12, 2, 4, -430, 1, 121, 0 },
-        { 48, 51, 23, 18, 11, 69, 4, 351, 0 },
-        { 41, 12, 0, 6, 0, 70, 2, 5, 0 },
-        { 32, 30, 2, 3, 11, 92, 4, 337, 0 },
-        { 0, 0, 0, 0, 0, 0, 0, 0, 0 },
-        { 6, 47, 16, 7, 3, 107, 6, 96, 0 },
-#endif
-    };
-    guint ind;
-    for (ind = 0; ind < G_N_ELEMENTS (secs); ind++)
-    {
-        struct tm* time = gnc_gmtime (&secs[ind]);
-        if ((secs[ind] > max_secs))
-        {
-            g_assert (time == NULL);
-            continue;
-        }
-
-        g_assert_cmpint (time->tm_year, ==, answers[ind].tm_year);
-        g_assert_cmpint (time->tm_mon, ==, answers[ind].tm_mon);
-        g_assert_cmpint (time->tm_mday, ==, answers[ind].tm_mday);
-        g_assert_cmpint (time->tm_hour, ==, answers[ind].tm_hour);
-        g_assert_cmpint (time->tm_min, ==, answers[ind].tm_min);
-        g_assert_cmpint (time->tm_sec, ==, answers[ind].tm_sec);
-        g_assert_cmpint (time->tm_wday, ==, answers[ind].tm_wday);
-        g_assert_cmpint (time->tm_yday, ==, answers[ind].tm_yday);
-        g_assert_cmpint (time->tm_isdst, ==, -1);
-#ifdef HAVE_STRUCT_TM_GMTOFF
-        g_assert_cmpint (time->tm_gmtoff, ==, 0);
-#endif
-        gnc_tm_free (time);
-    }
-}
-
-static void
-test_gnc_mktime (void)
-{
-    time64 ans[5] =
-        { -15752870334LL, -1123692LL, 432761LL, 723349832LL, 1175964426LL};
-
-    struct tm time[5] =
-    {
-#ifdef HAVE_STRUCT_TM_GMTOFF
-        { 6, 41, 2, 24, 9, -430, 0, 0, 1, 0, NULL },
-        { 48, 51, 23, 18, 11, 69, 0, 0, -1, 0, NULL },
-        { 41, 12, 0, 6, 0, 70, 0, 0, -1, 0, NULL },
-        { 32, 30, 2, 3, 11, 92, 0, 0, -1, 0, NULL },
-        { 6, 47, 16, 7, 3, 107, 0, 0, -1, 0, NULL },
-#else
-        { 6, 41, 2, 24, 9, -430, 0, 0, 1 },
-        { 48, 51, 23, 18, 11, 69, 0, 0, -1 },
-        { 41, 12, 0, 6, 0, 70, 0, 0, -1 },
-        { 32, 30, 2, 3, 11, 92, 0, 0, -1 },
-        { 6, 47, 16, 7, 3, 107, 0, 0, -1 },
-#endif
-    };
-    guint ind;
-    int offset = timegm(&time[4]) - mktime(&time[4]);
-
-    for (ind = 0; ind < G_N_ELEMENTS (time); ind++)
-    {
-        time64 secs = gnc_mktime (&time[ind]);
-#if !PLATFORM(WINDOWS)
-	//The timezone database uses local time for some
-	//timezones before 1900, which screws up the offset.
-	if (time[ind].tm_year < 0)
-            continue;
-#endif
-        g_assert_cmpint (secs, ==, ans[ind] - offset);
-
-    }
-}
-
-/* In addition to computing a time offset from a struct tm, mktime is
- * supposed to normalize struct tms with out-of-range values. This
- * second test exercises that facility in gnc_mktime.
- */
-static void
-test_gnc_mktime_normalization (void)
-{
-    time64 ans = 723349832LL;
-
-    struct tm normal_time =
-#ifdef HAVE_STRUCT_TM_GMTOFF
-    {
-        32, 30, 2, 3, 11, 92, 0, 0, -1, 0, NULL
-    };
-#else
-    {
-        32, 30, 2, 3, 11, 92, 0, 0, -1
-    };
-#endif
-
-    struct tm time[4] =
-    {
-#ifdef HAVE_STRUCT_TM_GMTOFF
-        { 92, -31, 27, -29, 24, 91, 0, 0, -1, 0, NULL },
-        { -28, 91, -47, 35, -2, 93, 0, 0, -1, 0, NULL },
-        { -28, 91, -47, 66, -3, 93, 0, 0, -1, 0, NULL },
-        { -28, 91, -47, 35, -26, 95, 0, 0, -1, 0, NULL },
-#else
-        { 92, -31, 27, -29, 24, 91, 0, 0, -1 },
-        { -28, 91, -47, 35, -2, 93, 0, 0, -1 },
-        { -28, 91, -47, 66, -3, 93, 0, 0, -1 },
-        { -28, 91, -47, 35, -26, 95, 0, 0, -1 },
-#endif
-    };
-    guint ind;
-    int offset = timegm(&normal_time) - mktime(&normal_time);
-    for (ind = 0; ind < G_N_ELEMENTS (time); ind++)
-    {
-        time64 secs = gnc_mktime (&time[ind]);
-
-        g_assert_cmpfloat (time[ind].tm_sec, ==, normal_time.tm_sec);
-        g_assert_cmpint (time[ind].tm_min, ==, normal_time.tm_min);
-        g_assert_cmpint (time[ind].tm_hour, ==, normal_time.tm_hour);
-        g_assert_cmpint (time[ind].tm_mday, ==, normal_time.tm_mday);
-        g_assert_cmpint (time[ind].tm_mon, ==, normal_time.tm_mon);
-        g_assert_cmpint (time[ind].tm_year, ==, normal_time.tm_year);
-        g_assert_cmpint (secs, ==, ans - offset);
-    }
-}
-
-static void
-test_gnc_ctime (void)
-{
-    time64 secs[5] = {-15767956734LL, -1123692LL, 432761LL,
-                      723349832LL, 1175964426LL
-                     };
-    guint ind;
-    for (ind = 0; ind < G_N_ELEMENTS (secs); ind++)
-    {
-	time_t time;
-	char *datestr;
-	char check_str[80];
-        if (secs[ind] < INT32_MIN)
-            continue;
-        time = (time_t)secs[ind];
-        datestr = gnc_ctime (&secs[ind]);
-	strftime (check_str, 80, "%a %b %d %H:%M:%S %Y", localtime(&time));
-        g_assert_cmpstr (datestr, ==, check_str);
-        g_free (datestr);
-    }
-}
-
-static void
-test_gnc_time (void)
-{
-    time64 secs1, secs2;
-    secs1 = gnc_time (&secs2);
-    g_assert_cmpint (secs1, ==, secs2);
-    g_assert_cmpint (secs1, ==, time(0));
-}
-
-/* gnc_difftime and gnc_tm_free are just too simple to bother testing. */
-
-/* gnc_date_dateformat_to_string
-const char *gnc_default_strftime_date_format =
-const char*
-gnc_date_dateformat_to_string(QofDateFormat format)// C: 1  Local: 0:0:0
-*/
-
-static void
-test_gnc_date_dateformat_to_string (void)
-{
-    g_assert_cmpstr (gnc_date_dateformat_to_string (QOF_DATE_FORMAT_US), ==, "us");
-    g_assert_cmpstr (gnc_date_dateformat_to_string (QOF_DATE_FORMAT_UK), ==, "uk");
-    g_assert_cmpstr (gnc_date_dateformat_to_string (QOF_DATE_FORMAT_CE), ==, "ce");
-    g_assert_cmpstr (gnc_date_dateformat_to_string (QOF_DATE_FORMAT_ISO), ==, "iso");
-    g_assert_cmpstr (gnc_date_dateformat_to_string (QOF_DATE_FORMAT_UTC), ==, "utc");
-    g_assert_cmpstr (gnc_date_dateformat_to_string (QOF_DATE_FORMAT_LOCALE), ==, "locale");
-    g_assert_cmpstr (gnc_date_dateformat_to_string (QOF_DATE_FORMAT_CUSTOM), ==, "custom");
-    g_assert_cmpstr (gnc_date_dateformat_to_string (QOF_DATE_FORMAT_UNSET), ==, "unset");
-
-}
-/* gnc_date_string_to_dateformat
-gboolean
-gnc_date_string_to_dateformat(const char* fmt_str, QofDateFormat *format)// C: 3 in 3  Local: 0:0:0
-*/
-static void
-test_gnc_date_string_to_dateformat (void)
-{
-    QofDateFormat fmt = 123;
-    g_assert (gnc_date_string_to_dateformat (NULL, &fmt));
-    g_assert_cmpint (fmt, ==, 123);
-    g_assert (!gnc_date_string_to_dateformat ("us", &fmt));
-    g_assert_cmpint (fmt, ==, QOF_DATE_FORMAT_US);
-    g_assert (!gnc_date_string_to_dateformat ("uk", &fmt));
-    g_assert_cmpint (fmt, ==, QOF_DATE_FORMAT_UK);
-    g_assert (!gnc_date_string_to_dateformat ("ce", &fmt));
-    g_assert_cmpint (fmt, ==, QOF_DATE_FORMAT_CE);
-    g_assert (!gnc_date_string_to_dateformat ("iso", &fmt));
-    g_assert_cmpint (fmt, ==, QOF_DATE_FORMAT_ISO);
-    g_assert (!gnc_date_string_to_dateformat ("utc", &fmt));
-    g_assert_cmpint (fmt, ==, QOF_DATE_FORMAT_UTC);
-    g_assert (!gnc_date_string_to_dateformat ("locale", &fmt));
-    g_assert_cmpint (fmt, ==, QOF_DATE_FORMAT_LOCALE);
-    g_assert (!gnc_date_string_to_dateformat ("custom", &fmt));
-    g_assert_cmpint (fmt, ==, QOF_DATE_FORMAT_CUSTOM);
-    g_assert (!gnc_date_string_to_dateformat ("unset", &fmt));
-    g_assert_cmpint (fmt, ==, QOF_DATE_FORMAT_UNSET);
-    fmt = 123;
-    g_assert (gnc_date_string_to_dateformat ("", &fmt));
-    g_assert_cmpint (fmt, ==, 123);
-    g_assert (gnc_date_string_to_dateformat ("foo", &fmt));
-    g_assert_cmpint (fmt, ==, 123);
-
-}
-/* gnc_date_monthformat_to_string
-const char*
-gnc_date_monthformat_to_string(GNCDateMonthFormat format)// C: 1  Local: 0:0:0
-*/
-static void
-test_gnc_date_monthformat_to_string (void)
-{
-    g_assert_cmpstr (gnc_date_monthformat_to_string (GNCDATE_MONTH_NUMBER), ==, "number");
-    g_assert_cmpstr (gnc_date_monthformat_to_string (GNCDATE_MONTH_ABBREV), ==, "abbrev");
-    g_assert_cmpstr (gnc_date_monthformat_to_string (GNCDATE_MONTH_NAME), ==, "name");
-    g_assert (gnc_date_monthformat_to_string (93) == NULL);
-}
-/* gnc_date_string_to_monthformat
-gboolean
-gnc_date_string_to_monthformat(const char *fmt_str, GNCDateMonthFormat *format)// C: 1  Local: 0:0:0
-*/
-static void
-test_gnc_date_string_to_monthformat (void)
-{
-    GNCDateMonthFormat fmt = 123;
-    g_assert (gnc_date_string_to_monthformat (NULL, &fmt));
-    g_assert_cmpint (fmt, ==, 123);
-    g_assert (!gnc_date_string_to_monthformat ("number", &fmt));
-    g_assert_cmpint (fmt, ==, GNCDATE_MONTH_NUMBER);
-    g_assert (!gnc_date_string_to_monthformat ("abbrev", &fmt));
-    g_assert_cmpint (fmt, ==, GNCDATE_MONTH_ABBREV);
-    g_assert (!gnc_date_string_to_monthformat ("name", &fmt));
-    g_assert_cmpint (fmt, ==, GNCDATE_MONTH_NAME);
-    fmt = 123;
-    g_assert (gnc_date_string_to_monthformat ("", &fmt));
-    g_assert_cmpint (fmt, ==, 123);
-    g_assert (gnc_date_string_to_monthformat ("foo", &fmt));
-    g_assert_cmpint (fmt, ==, 123);
-}
-
-static void
-test_gnc_setlocale (int category, gchar *locale)
-{
-    gchar *suffixes[] = {"utf8", "UTF-8"};
-    guint i;
-    /* Msys defines a different set of locales */
-#ifdef G_OS_WIN32
-    if (g_strcmp0 (locale, "en_US") == 0
-            && setlocale (category, "English_US"))
-        return;
-    if (g_strcmp0 (locale, "en_GB") == 0
-            && setlocale (category, "English_UK"))
-        return;
-    if (g_strcmp0 (locale, "fr_FR") == 0
-            && setlocale (category, "French_France"))
-        return;
-
-#endif
-    if (setlocale (category, locale) != NULL)
-        return;
-
-    for (i = 0; i < G_N_ELEMENTS (suffixes); i++)
-    {
-        gchar * modlocale = g_strdup_printf ("%s.%s", locale, suffixes[i]);
-        gchar *localeval = setlocale (category, modlocale);
-        g_free (modlocale);
-        if (localeval != NULL)
-            return;
-    }
-    g_fprintf (stderr, "There are some differences between distros in the way they name"
-              "locales, and this can cause trouble with the locale-based"
-              "formatting. If you get the assert in this function, run locale -a"
-              "and make sure that en_US, en_GB, and fr_FR are installed and that"
-              "if a suffix is needed it's in the suffixes array.");
-    g_assert_not_reached ();
-}
-/* timespec_normalize
-static void
-timespec_normalize(Timespec *t)// Local: 2:0:0
-*/
-static void
-test_timespec_normalize (void)
-{
-    const int offset = 4396432;
-    const int factor = 2;
-    int base = 50;
-    Timespec t = { base, factor * NANOS_PER_SECOND + offset };
-    Testfuncs *tf = gnc_date_load_funcs ();
-
-    tf->timespec_normalize (&t);
-    g_assert_cmpint (t.tv_sec, ==, base + factor);
-    g_assert_cmpint (t.tv_nsec, ==, offset);
-
-    t.tv_sec = base;
-    t.tv_nsec = - factor * NANOS_PER_SECOND - offset;
-    tf->timespec_normalize (&t);
-    g_assert_cmpint (t.tv_sec, ==, base - factor - 1);
-    g_assert_cmpint (t.tv_nsec, ==, NANOS_PER_SECOND - offset);
-
-    t.tv_sec = - base;
-    t.tv_nsec = factor * NANOS_PER_SECOND + offset;
-    tf->timespec_normalize (&t);
-    g_assert_cmpint (t.tv_sec, ==, - base + factor + 1);
-    g_assert_cmpint (t.tv_nsec, ==, - NANOS_PER_SECOND + offset);
-
-    t.tv_sec = - base;
-    t.tv_nsec = - factor * NANOS_PER_SECOND - offset;
-    tf->timespec_normalize (&t);
-    g_assert_cmpint (t.tv_sec, ==, - base - factor);
-    g_assert_cmpint (t.tv_nsec, ==, - offset);
-
-    g_slice_free (Testfuncs, tf);
-}
-
-
-/* timespec_equal
-gboolean
-timespec_equal (const Timespec *ta, const Timespec *tb)// C: 19 in 8  Local: 0:0:0
-*/
-static void
-test_timespec_equal (void)
-{
-    const int sec_per_day = 24 * 3600;
-    const int sec_per_mo = 30 * sec_per_day;
-    const time64 sec_per_yr = 365 * sec_per_day;
-    const int nsec1 = 439652, nsec2 = 132794892, nsec3 = 1132794892;
-    const time64 secs1 = 23 * sec_per_yr + 5 * sec_per_mo + 11 * sec_per_day;
-    const time64 secs2 = 21 * sec_per_yr + 11 * sec_per_mo + 19 * sec_per_day;
-    const time64 secs3 = 72 * sec_per_yr + 2 * sec_per_mo + 26 * sec_per_day;
-    Timespec ta = { secs1, nsec1 };
-    Timespec tb = { secs2, nsec2 };
-    Timespec tc = { secs1, nsec1 };
-    Timespec td = { secs3, nsec1 };
-    Timespec te = { secs1, nsec2 };
-    Timespec tf = { secs2 - 1, nsec3 }; /* When normalized, equal to tb */
-
-    g_assert (timespec_equal (&ta, &ta));
-    g_assert (timespec_equal (&ta, &tc));
-    g_assert (!timespec_equal (&ta, &tb));
-    g_assert (!timespec_equal (&ta, &td));
-    g_assert (!timespec_equal (&ta, &te));
-    g_assert (timespec_equal (&tb, &tf));
-}
-/* timespec_cmp
-gint
-timespec_cmp(const Timespec *ta, const Timespec *tb)// C: 28 in 11  Local: 0:0:0
-*/
-static void
-test_timespec_cmp (void)
-{
-    const int sec_per_day = 24 * 3600;
-    const int sec_per_mo = 30 * sec_per_day;
-    const time64 sec_per_yr = 365 * sec_per_day;
-    const int nsec1 = 439652, nsec2 = 132794892, nsec3 = 1132794892;
-    const time64 secs1 = 23 * sec_per_yr + 5 * sec_per_mo + 11 * sec_per_day;
-    const time64 secs2 = 21 * sec_per_yr + 11 * sec_per_mo + 19 * sec_per_day;
-    const time64 secs3 = 72 * sec_per_yr + 2 * sec_per_mo + 26 * sec_per_day;
-    Timespec ta = { secs1, nsec1 };
-    Timespec tb = { secs2, nsec2 };
-    Timespec tc = { secs1, nsec1 };
-    Timespec td = { secs3, nsec1 };
-    Timespec te = { secs1, nsec2 };
-    Timespec tf = { secs2 - 1, nsec3 }; /* When normalized, equal to tb */
-    Timespec tg = { -secs2, nsec2 };
-    Timespec th = { secs1, -nsec1 };
-
-    g_assert_cmpint (timespec_cmp (&ta, &ta), ==, 0);
-    g_assert_cmpint (timespec_cmp (&ta, &tc), ==, 0);
-    g_assert_cmpint (timespec_cmp (&tf, &tb), ==, 0);
-    g_assert_cmpint (timespec_cmp (&ta, &tb), ==, 1);
-    g_assert_cmpint (timespec_cmp (&te, &ta), ==, 1);
-    g_assert_cmpint (timespec_cmp (&td, &ta), ==, 1);
-    g_assert_cmpint (timespec_cmp (&ta, &te), ==, -1);
-    g_assert_cmpint (timespec_cmp (&ta, &tg), ==, 1);
-    g_assert_cmpint (timespec_cmp (&th, &ta), ==, -1);
-
-}
-/* timespec_diff
-Timespec
-timespec_diff(const Timespec *ta, const Timespec *tb)// C: 4 in 1  Local: 0:0:0
-*/
-static void
-test_timespec_diff (void)
-{
-    const gint sec_per_day = 24 * 3600;
-    const gint sec_per_mo = 30 * sec_per_day;
-    const time64 sec_per_yr = 365 * sec_per_day;
-    const time64 nsec1 = 439652, nsec2 = 132794892, nsec3 = 1132794892;
-    const time64 secs1 = 23 * sec_per_yr + 5 * sec_per_mo + 11 * sec_per_day;
-    const time64 secs2 = 21 * sec_per_yr + 11 * sec_per_mo + 19 * sec_per_day;
-    const time64 secs3 = 72 * sec_per_yr + 2 * sec_per_mo + 26 * sec_per_day;
-    Timespec ta = { secs1, nsec1 };
-    Timespec tb = { secs2, nsec2 };
-    Timespec td = { secs3, nsec1 };
-    Timespec te = { secs1, nsec2 };
-    Timespec tf = { secs2 - 1, nsec3 }; /* When normalized, equal to tb */
-    Timespec tg = { -secs2, nsec2 };
-    Timespec th = { secs1, -nsec3 };
-
-    Timespec tt = timespec_diff (&ta, &ta);
-
-    g_assert_cmpint (tt.tv_sec, ==, 0);
-    g_assert_cmpint (tt.tv_nsec, ==, 0);
-
-    tt = timespec_diff (&ta, &tb);
-    g_assert_cmpint (tt.tv_sec, ==, secs1 - secs2 - 1);
-    g_assert_cmpint (tt.tv_nsec, ==, nsec1 - nsec2 + NANOS_PER_SECOND);
-
-    tt = timespec_diff (&ta, &te);
-    g_assert_cmpint (tt.tv_sec, ==, 0);
-    g_assert_cmpint (tt.tv_nsec, ==, nsec1 - nsec2);
-
-    tt = timespec_diff (&tb, &tf);
-    g_assert_cmpint (tt.tv_sec, ==, 0);
-    g_assert_cmpint (tt.tv_nsec, ==, 0);
-
-    tt = timespec_diff (&tf, &th);
-    if (sizeof (glong) > 4)
-    {
-        glong nsec_diff_norm = 2 * nsec3 - 2 * NANOS_PER_SECOND - NANOS_PER_SECOND;
-        g_assert_cmpint (tt.tv_sec, ==, secs2 - secs1 + 2);
-        g_assert_cmpint (tt.tv_nsec, ==,  nsec_diff_norm);
-    }
-    else
-    {
-        g_assert_cmpint (tt.tv_sec, ==, secs2 - secs1 - 3);
-        g_assert_cmpint (tt.tv_nsec, <, 0); /* Overflow nanosecs */
-    }
-    tt = timespec_diff (&tg, &td);
-    g_assert_cmpint (tt.tv_sec, ==, -secs2 - secs3 + 1);
-    g_assert_cmpint (tt.tv_nsec, ==, nsec2 - nsec1 - NANOS_PER_SECOND);
-
-}
-/* timespec_abs
-Timespec
-timespec_abs(const Timespec *t)// C: 4 in 1  Local: 0:0:0
-*/
-static void
-test_timespec_abs (void)
-{
-    const int sec_per_day = 24 * 3600;
-    const int sec_per_mo = 30 * sec_per_day;
-    const int sec_per_yr = 365 * sec_per_day;
-    const int nsec1 = 439652, nsec2 = 132794892, nsec3 = 1132794892;
-    const time64 secs1 = 23 * sec_per_yr + 5 * sec_per_mo + 11 * sec_per_day;
-    const time64 secs2 = 21 * sec_per_yr + 11 * sec_per_mo + 19 * sec_per_day;
-    Timespec ta = { secs1, nsec1 };
-    Timespec tf = { secs2 - 1, nsec3 }; /* When normalized, equal to tb */
-    Timespec tg = { -secs2, nsec2 };
-    Timespec th = { secs1, -nsec1 };
-
-    Timespec tt = timespec_abs (&ta);
-    g_assert_cmpint (tt.tv_sec, ==, secs1);
-    g_assert_cmpint (tt.tv_nsec, ==, nsec1);
-
-    tt = timespec_abs (&tf);
-    g_assert_cmpint (tt.tv_sec, ==, secs2);
-    g_assert_cmpint (tt.tv_nsec, ==, nsec2);
-
-    tt = timespec_abs (&tg);
-    g_assert_cmpint (tt.tv_sec, ==, secs2 - 1);
-    g_assert_cmpint (tt.tv_nsec, ==, NANOS_PER_SECOND - nsec2);
-
-    tt = timespec_abs (&th);
-    g_assert_cmpint (tt.tv_sec, ==, secs1 - 1);
-    g_assert_cmpint (tt.tv_nsec, ==, NANOS_PER_SECOND - nsec1);
-
-}
-/* timespecCanonicalDayTime
-Timespec
-timespecCanonicalDayTime(Timespec t)// C: 12 in 5 SCM: 19 in 10 Local: 0:0:0
-*/
-static Timespec
-compute_noon_of_day (Timespec *ts)
-{
-    Timespec nt = {0, 0};
-    time_t secs = (time_t)ts->tv_sec;
-    struct tm *time = localtime(&secs);
-    time->tm_hour = 12;
-    time->tm_min = 0;
-    time->tm_sec = 0;
-    nt.tv_sec = mktime(time);
-    return nt;
-}
-
-static void
-test_timespecCanonicalDayTime (void)
-{
-    const int sec_per_day = 24 * 3600;
-    const int sec_per_mo = 30 * sec_per_day;
-    const time64 sec_per_yr = 365 * sec_per_day;
-    const time64 secs = 8 * 3600 + 43 * 60 + 11;
-    const time64 secs1 = 23 * sec_per_yr + 5 * sec_per_mo + 11 * sec_per_day + 8 * 3600 + 43 * 60 + 11;
-    const time64 secs2 = 21 * sec_per_yr + 11 * sec_per_mo + 19 * sec_per_day + 21 * 3600 + 9 * 60 + 48;
-
-    Timespec t0 = { secs, 0 };
-    Timespec ta = { secs1, 0 };
-    Timespec tb = { secs2, 0 };
-
-    Timespec n0 = compute_noon_of_day (&t0);
-    Timespec na = compute_noon_of_day (&ta);
-    Timespec nb = compute_noon_of_day (&tb);
-
-    Timespec r0 = timespecCanonicalDayTime (t0);
-    Timespec ra = timespecCanonicalDayTime (ta);
-    Timespec rb = timespecCanonicalDayTime (tb);
-
-    g_assert_cmpint (n0.tv_sec, ==, r0.tv_sec);
-    g_assert_cmpint (na.tv_sec, ==, ra.tv_sec);
-    g_assert_cmpint (nb.tv_sec, ==, rb.tv_sec);
-
-}
-
-/* gnc_date_get_last_mday
-int gnc_date_get_last_mday (int month, int year)// C: 1  Local: 1:0:0
-*/
-static void
-test_gnc_date_get_last_mday (void)
-{
-    g_assert_cmpint (gnc_date_get_last_mday (0, 1975), ==, 31);
-    g_assert_cmpint (gnc_date_get_last_mday (0, 1980), ==, 31);
-    g_assert_cmpint (gnc_date_get_last_mday (1, 1975), ==, 28);
-    g_assert_cmpint (gnc_date_get_last_mday (1, 1980), ==, 29);
-    g_assert_cmpint (gnc_date_get_last_mday (2, 1975), ==, 31);
-    g_assert_cmpint (gnc_date_get_last_mday (2, 1980), ==, 31);
-    g_assert_cmpint (gnc_date_get_last_mday (3, 1975), ==, 30);
-    g_assert_cmpint (gnc_date_get_last_mday (3, 1980), ==, 30);
-    g_assert_cmpint (gnc_date_get_last_mday (4, 1975), ==, 31);
-    g_assert_cmpint (gnc_date_get_last_mday (4, 1980), ==, 31);
-    g_assert_cmpint (gnc_date_get_last_mday (5, 1975), ==, 30);
-    g_assert_cmpint (gnc_date_get_last_mday (5, 1980), ==, 30);
-    g_assert_cmpint (gnc_date_get_last_mday (6, 1975), ==, 31);
-    g_assert_cmpint (gnc_date_get_last_mday (6, 1980), ==, 31);
-    g_assert_cmpint (gnc_date_get_last_mday (7, 1975), ==, 31);
-    g_assert_cmpint (gnc_date_get_last_mday (7, 1980), ==, 31);
-    g_assert_cmpint (gnc_date_get_last_mday (8, 1975), ==, 30);
-    g_assert_cmpint (gnc_date_get_last_mday (8, 1980), ==, 30);
-    g_assert_cmpint (gnc_date_get_last_mday (9, 1975), ==, 31);
-    g_assert_cmpint (gnc_date_get_last_mday (9, 1980), ==, 31);
-    g_assert_cmpint (gnc_date_get_last_mday (10, 1975), ==, 30);
-    g_assert_cmpint (gnc_date_get_last_mday (10, 1980), ==, 30);
-    g_assert_cmpint (gnc_date_get_last_mday (11, 1975), ==, 31);
-    g_assert_cmpint (gnc_date_get_last_mday (11, 1980), ==, 31);
-    g_assert_cmpint (gnc_date_get_last_mday (1, 2000), ==, 29);
-    g_assert_cmpint (gnc_date_get_last_mday (1, 2400), ==, 28);
-}
-/* Getter, no testing needed.
-QofDateFormat qof_date_format_get (void)// C: 5 in 3  Local: 0:0:0
-*/
-/* qof_date_format_set
-set date format to one of US, UK, CE, ISO OR UTC
-checks to make sure it's a legal value
-param QofDateFormat: enumeration indicating preferred format
-return void
-Globals: dateFormat
-void qof_date_format_set(QofDateFormat df)// C: 3 in 2  Local: 0:0:0
-*/
-static void
-test_qof_date_format_set (void)
-{
-    gchar *msg = "[qof_date_format_set()] non-existent date format set attempted. Setting ISO default";
-    gint loglevel = G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_FATAL;
-    gchar *logdomain = "qof.engine";
-    TestErrorStruct check = {loglevel, logdomain, msg, 0};
-    GLogFunc hdlr = g_log_set_default_handler ((GLogFunc)test_null_handler, &check);
-    g_test_log_set_fatal_handler ((GTestLogFatalFunc)test_checked_handler, &check);
-    qof_date_format_set ((QofDateFormat)((guint)DATE_FORMAT_LAST + 97));
-    g_assert_cmpint (qof_date_format_get (), ==,  QOF_DATE_FORMAT_ISO);
-    g_assert_cmpint (check.hits, ==,1);
-
-    qof_date_format_set (QOF_DATE_FORMAT_UK);
-    g_assert_cmpint (qof_date_format_get (), ==, QOF_DATE_FORMAT_UK);
-    g_assert_cmpint (check.hits, ==,1);
-    g_log_set_default_handler (hdlr, NULL);
-}
-/* qof_date_completion_set
-set dateCompletion to one of QOF_DATE_COMPLETION_THISYEAR (for
-completing the year to the current calendar year) or
-QOF_DATE_COMPLETION_SLIDING (for using a sliding 12-month window). The
-sliding window starts 'backmonth' months before the current month (0-11).
-checks to make sure it's a legal value
-param QofDateCompletion: indicates preferred completion method
-param int: the number of months to go back in time (0-11)
-return void
-Globals: dateCompletion dateCompletionBackMonths
-void qof_date_completion_set(QofDateCompletion dc, int backmonths)// C: 1  Local: 0:0:0
-*/
-/* static void
-test_qof_date_completion_set (void)
-{
-}*/
-/* qof_print_date_dmy_buff
-size_t
-qof_print_date_dmy_buff (char * buff, size_t len, int day, int month, int year)// C: 12 in 3  Local: 2:0:0
-*/
-
-#ifdef HAVE_LANGINFO_D_FMT
-#include <langinfo.h>
-#  define GNC_D_FMT (nl_langinfo (D_FMT))
-#  define GNC_D_T_FMT (nl_langinfo (D_T_FMT))
-#  define GNC_T_FMT (nl_langinfo (T_FMT))
-#elif defined(G_OS_WIN32)
-#  define GNC_D_FMT (qof_win32_get_time_format(QOF_WIN32_PICTURE_DATE))
-#  define GNC_T_FMT (qof_win32_get_time_format(QOF_WIN32_PICTURE_TIME))
-#  define GNC_D_T_FMT (qof_win32_get_time_format(QOF_WIN32_PICTURE_DATETIME))
-#else
-#  define GNC_D_FMT "%Y-%m-%d"
-#  define GNC_D_T_FMT "%Y-%m-%d %r"
-#  define GNC_T_FMT "%r"
-#endif
-
-static void tm_set_dmy (struct tm *tm, gint year, gint month, gint mday)
-{
-    tm->tm_year = year - 1900;
-    tm->tm_mon = month - 1;
-    tm->tm_mday = mday;
-}
-
-static void
-test_qof_print_date_dmy_buff (void)
-{
-    gchar buff[MAX_DATE_LENGTH], t_buff[MAX_DATE_LENGTH];
-    gchar *locale = g_strdup (setlocale (LC_TIME, NULL));
-    struct tm tm = { 0, 0, 0, 0, 0, 0, 0, 0, 0
-#ifdef HAVE_STRUCT_TM_GMTOFF
-        , 0, 0
-#endif
-    };
-
-    qof_date_format_set (QOF_DATE_FORMAT_UK);
-    memset ((gpointer)buff, 0, sizeof (buff));
-    g_assert_cmpint (qof_print_date_dmy_buff (buff, sizeof (buff), 23, 11, 1974), ==, strlen (buff));
-    g_assert_cmpstr (buff, ==, "23/11/1974");
-    memset ((gpointer)buff, 0, sizeof (buff));
-    g_assert_cmpint (qof_print_date_dmy_buff (buff, sizeof (buff), 2, 2, 1961), ==, strlen (buff));
-    g_assert_cmpstr (buff, ==, "02/02/1961");
-    memset ((gpointer)buff, 0, sizeof (buff));
-    g_assert_cmpint (qof_print_date_dmy_buff (buff, sizeof (buff), 16, 6, 2045), ==, strlen (buff));
-    g_assert_cmpstr (buff, ==, "16/06/2045");
-
-    qof_date_format_set (QOF_DATE_FORMAT_CE);
-    memset ((gpointer)buff, 0, sizeof (buff));
-    g_assert_cmpint (qof_print_date_dmy_buff (buff, sizeof (buff), 23, 11, 1974), ==, strlen (buff));
-    g_assert_cmpstr (buff, ==, "23.11.1974");
-    memset ((gpointer)buff, 0, sizeof (buff));
-    g_assert_cmpint (qof_print_date_dmy_buff (buff, sizeof (buff), 2, 2, 1961), ==, strlen (buff));
-    g_assert_cmpstr (buff, ==, "02.02.1961");
-    memset ((gpointer)buff, 0, sizeof (buff));
-    g_assert_cmpint (qof_print_date_dmy_buff (buff, sizeof (buff), 16, 6, 2045), ==, strlen (buff));
-    g_assert_cmpstr (buff, ==, "16.06.2045");
-
-    qof_date_format_set (QOF_DATE_FORMAT_US);
-    memset ((gpointer)buff, 0, sizeof (buff));
-    g_assert_cmpint (qof_print_date_dmy_buff (buff, sizeof (buff), 23, 11, 1974), ==, strlen (buff));
-    g_assert_cmpstr (buff, ==, "11/23/1974");
-    memset ((gpointer)buff, 0, sizeof (buff));
-    g_assert_cmpint (qof_print_date_dmy_buff (buff, sizeof (buff), 2, 2, 1961), ==, strlen (buff));
-    g_assert_cmpstr (buff, ==, "02/02/1961");
-    memset ((gpointer)buff, 0, sizeof (buff));
-    g_assert_cmpint (qof_print_date_dmy_buff (buff, sizeof (buff), 16, 6, 2045), ==, strlen (buff));
-    g_assert_cmpstr (buff, ==, "06/16/2045");
-
-    qof_date_format_set (QOF_DATE_FORMAT_ISO);
-    memset ((gpointer)buff, 0, sizeof (buff));
-    g_assert_cmpint (qof_print_date_dmy_buff (buff, sizeof (buff), 23, 11, 1974), ==, strlen (buff));
-    g_assert_cmpstr (buff, ==, "1974-11-23");
-    memset ((gpointer)buff, 0, sizeof (buff));
-    g_assert_cmpint (qof_print_date_dmy_buff (buff, sizeof (buff), 2, 2, 1961),
-                     ==, strlen (buff));
-    g_assert_cmpstr (buff, ==, "1961-02-02");
-    memset ((gpointer)buff, 0, sizeof (buff));
-    g_assert_cmpint (qof_print_date_dmy_buff (buff, sizeof (buff), 16, 6, 2045),
-                     ==, strlen (buff));
-    g_assert_cmpstr (buff, ==, "2045-06-16");
-
-    qof_date_format_set (QOF_DATE_FORMAT_LOCALE);
-    test_gnc_setlocale (LC_TIME, "en_US");
-    tm_set_dmy (&tm, 1974, 11, 23);
-    strftime(t_buff, MAX_DATE_LENGTH, GNC_D_FMT, &tm);
-    memset ((gpointer)buff, 0, sizeof (buff));
-    g_assert_cmpint (qof_print_date_dmy_buff (buff, sizeof (buff), tm.tm_mday,
-                     tm.tm_mon + 1, tm.tm_year + 1900),
-                     ==, strlen (buff));
-    g_assert_cmpstr (buff, ==, t_buff);
-
-
-    tm_set_dmy (&tm, 1961, 2, 2);
-    strftime(t_buff, MAX_DATE_LENGTH, GNC_D_FMT, &tm);
-    memset ((gpointer)buff, 0, sizeof (buff));
-    g_assert_cmpint (qof_print_date_dmy_buff (buff, sizeof (buff), tm.tm_mday,
-                     tm.tm_mon + 1, tm.tm_year + 1900),
-                     ==, strlen (buff));
-    g_assert_cmpstr (buff, ==, t_buff);
-    memset ((gpointer)buff, 0, sizeof (buff));
-    tm_set_dmy (&tm, 2045, 6, 16);
-    strftime(t_buff, MAX_DATE_LENGTH, GNC_D_FMT, &tm);
-    memset ((gpointer)buff, 0, sizeof (buff));
-    g_assert_cmpint (qof_print_date_dmy_buff (buff, sizeof (buff), tm.tm_mday,
-                     tm.tm_mon + 1, tm.tm_year + 1900),
-                     ==, strlen (buff));
-    g_assert_cmpstr (buff, ==, t_buff);
-
-    test_gnc_setlocale (LC_TIME, "en_GB");
-    tm_set_dmy (&tm, 1974, 11, 23);
-    strftime(t_buff, MAX_DATE_LENGTH, GNC_D_FMT, &tm);
-    memset ((gpointer)buff, 0, sizeof (buff));
-    g_assert_cmpint (qof_print_date_dmy_buff (buff, sizeof (buff), tm.tm_mday,
-                     tm.tm_mon + 1, tm.tm_year + 1900),
-                     ==, strlen (buff));
-    g_assert_cmpstr (buff, ==, t_buff);
-    tm_set_dmy (&tm, 1961, 2, 2);
-    strftime(t_buff, MAX_DATE_LENGTH, GNC_D_FMT, &tm);
-    memset ((gpointer)buff, 0, sizeof (buff));
-    g_assert_cmpint (qof_print_date_dmy_buff (buff, sizeof (buff), tm.tm_mday,
-                     tm.tm_mon + 1, tm.tm_year + 1900),
-                     ==, strlen (buff));
-    g_assert_cmpstr (buff, ==, t_buff);
-    memset ((gpointer)buff, 0, sizeof (buff));
-    tm_set_dmy (&tm, 2045, 6, 16);
-    strftime(t_buff, MAX_DATE_LENGTH, GNC_D_FMT, &tm);
-    memset ((gpointer)buff, 0, sizeof (buff));
-    g_assert_cmpint (qof_print_date_dmy_buff (buff, sizeof (buff), tm.tm_mday,
-                     tm.tm_mon + 1, tm.tm_year + 1900),
-                     ==, strlen (buff));
-    g_assert_cmpstr (buff, ==, t_buff);
-
-    test_gnc_setlocale (LC_TIME, "fr_FR");
-    tm_set_dmy (&tm, 1974, 11, 23);
-    strftime(t_buff, MAX_DATE_LENGTH, GNC_D_FMT, &tm);
-    memset ((gpointer)buff, 0, sizeof (buff));
-    g_assert_cmpint (qof_print_date_dmy_buff (buff, sizeof (buff), tm.tm_mday,
-                     tm.tm_mon + 1, tm.tm_year + 1900),
-                     ==, strlen (buff));
-    g_assert_cmpstr (buff, ==, t_buff);
-    tm_set_dmy (&tm, 1961, 2, 2);
-    strftime(t_buff, MAX_DATE_LENGTH, GNC_D_FMT, &tm);
-    memset ((gpointer)buff, 0, sizeof (buff));
-    g_assert_cmpint (qof_print_date_dmy_buff (buff, sizeof (buff), tm.tm_mday,
-                     tm.tm_mon + 1, tm.tm_year + 1900),
-                     ==, strlen (buff));
-    g_assert_cmpstr (buff, ==, t_buff);
-    memset ((gpointer)buff, 0, sizeof (buff));
-    tm_set_dmy (&tm, 2045, 6, 16);
-    strftime(t_buff, MAX_DATE_LENGTH, GNC_D_FMT, &tm);
-    memset ((gpointer)buff, 0, sizeof (buff));
-    g_assert_cmpint (qof_print_date_dmy_buff (buff, sizeof (buff), tm.tm_mday,
-                     tm.tm_mon + 1, tm.tm_year + 1900),
-                     ==, strlen (buff));
-    g_assert_cmpstr (buff, ==, t_buff);
-
-    setlocale (LC_TIME, locale);
-    g_free (locale);
-}
-
-/* Different distros/OSes define localization date formats. Apple, for
- * example, uses %d.%m.%Y for fr_FR and %d/%m/%Y for en_GB, while
- * Debian uses %d/%m/%Y and %d/%m/%y respectively. So to get a test
- * that works on all of them, we need to check the localized
- * strftime().
- *
- * This is a macro so that the line number in the assert message will
- * be right.
- */
-
-#define test_assert_localized_timestring(time, datestr)                 \
-    {                                                                   \
-        gchar t_buff[MAX_DATE_LENGTH];                                  \
-        struct tm *ltime = gnc_localtime ((time64 *)(&time));           \
-        strftime (t_buff, sizeof (t_buff), GNC_D_FMT, ltime);           \
-        gnc_tm_free (ltime);                                            \
-        g_assert_cmpstr (datestr, ==, t_buff);                          \
-    }
-
-
-/* qof_print_date_buff
-size_t
-qof_print_date_buff (char * buff, size_t len, time64 t)// C: 3 in 1  Local: 2:0:0
-*/
-static void
-test_qof_print_date_buff (void)
-{
-    gchar buff[MAX_DATE_LENGTH], ans[MAX_DATE_LENGTH];
-    gchar *locale = g_strdup (setlocale (LC_TIME, NULL));
-
-    time64 time1 = 154440000; //1974-11-23 12:00:00
-    time64 time2 = -281188800; //1961-02-02 12:00:00
-    time64 time3 = 2381227200LL; //2045-06-16 12:00:00
-    struct tm tm1 = {0, 0, 12, 23, 10, 74};
-    struct tm tm2 = {0, 0, 12, 2, 1, 61};
-    struct tm tm3 = {0, 0, 12, 16, 5, 145};
-
-    qof_date_format_set (QOF_DATE_FORMAT_UK);
-    memset ((gpointer)buff, 0, sizeof (buff));
-    g_assert_cmpint (qof_print_date_buff (buff, sizeof (buff), time1),
-                     ==, strlen (buff));
-    g_assert_cmpstr (buff, ==, "23/11/1974");
-    memset ((gpointer)buff, 0, sizeof (buff));
-    g_assert_cmpint (qof_print_date_buff (buff, sizeof (buff), time2),
-                     ==, strlen (buff));
-    g_assert_cmpstr (buff, ==, "02/02/1961");
-
-    memset ((gpointer)buff, 0, sizeof (buff));
-    g_assert_cmpint (qof_print_date_buff (buff, sizeof (buff), time3),
-                     ==, strlen (buff));
-    g_assert_cmpstr (buff, ==, "16/06/2045");
-
-    qof_date_format_set (QOF_DATE_FORMAT_CE);
-    memset ((gpointer)buff, 0, sizeof (buff));
-    g_assert_cmpint (qof_print_date_buff (buff, sizeof (buff), time1),
-                     ==, strlen (buff));
-    g_assert_cmpstr (buff, ==, "23.11.1974");
-    memset ((gpointer)buff, 0, sizeof (buff));
-    g_assert_cmpint (qof_print_date_buff (buff, sizeof (buff), time2),
-                     ==, strlen (buff));
-    g_assert_cmpstr (buff, ==, "02.02.1961");
-
-    memset ((gpointer)buff, 0, sizeof (buff));
-    g_assert_cmpint (qof_print_date_buff (buff, sizeof (buff), time3),
-                     ==, strlen (buff));
-    g_assert_cmpstr (buff, ==, "16.06.2045");
-
-    qof_date_format_set (QOF_DATE_FORMAT_US);
-    memset ((gpointer)buff, 0, sizeof (buff));
-    g_assert_cmpint (qof_print_date_buff (buff, sizeof (buff), time1),
-                     ==, strlen (buff));
-    g_assert_cmpstr (buff, ==, "11/23/1974");
-    memset ((gpointer)buff, 0, sizeof (buff));
-    g_assert_cmpint (qof_print_date_buff (buff, sizeof (buff), time2),
-                     ==, strlen (buff));
-    g_assert_cmpstr (buff, ==, "02/02/1961");
-
-    memset ((gpointer)buff, 0, sizeof (buff));
-    g_assert_cmpint (qof_print_date_buff (buff, sizeof (buff), time3),
-                     ==, strlen (buff));
-    g_assert_cmpstr (buff, ==, "06/16/2045");
-
-    qof_date_format_set (QOF_DATE_FORMAT_ISO);
-    memset ((gpointer)buff, 0, sizeof (buff));
-    g_assert_cmpint (qof_print_date_buff (buff, sizeof (buff), time1),
-                     ==, strlen (buff));
-    g_assert_cmpstr (buff, ==, "1974-11-23");
-    memset ((gpointer)buff, 0, sizeof (buff));
-    g_assert_cmpint (qof_print_date_buff (buff, sizeof (buff), time2),
-                     ==, strlen (buff));
-    g_assert_cmpstr (buff, ==, "1961-02-02");
-
-    memset ((gpointer)buff, 0, sizeof (buff));
-    g_assert_cmpint (qof_print_date_buff (buff, sizeof (buff), time3),
-                     ==, strlen (buff));
-    g_assert_cmpstr (buff, ==, "2045-06-16");
-
-    qof_date_format_set (QOF_DATE_FORMAT_LOCALE);
-    test_gnc_setlocale (LC_TIME, "en_US");
-    memset ((gpointer)buff, 0, sizeof (buff));
-    g_assert_cmpint (qof_print_date_buff (buff, sizeof (buff), time1),
-                     ==, strlen (buff));
-    g_assert_cmpstr (buff, ==, "11/23/1974");
-    memset ((gpointer)buff, 0, sizeof (buff));
-    g_assert_cmpint (qof_print_date_buff (buff, sizeof (buff), time2),
-                     ==, strlen (buff));
-    g_assert_cmpstr (buff, ==, "02/02/1961");
-
-    memset ((gpointer)buff, 0, sizeof (buff));
-    g_assert_cmpint (qof_print_date_buff (buff, sizeof (buff), time3),
-                     ==, strlen (buff));
-    g_assert_cmpstr (buff, ==, "06/16/2045");
-
-    test_gnc_setlocale (LC_TIME, "en_GB");
-    memset ((gpointer)buff, 0, sizeof (buff));
-    g_assert_cmpint (qof_print_date_buff (buff, sizeof (buff), time1),
-                     ==, strlen (buff));
-    strftime(ans, MAX_DATE_LENGTH, GNC_D_FMT, &tm1);
-    g_assert_cmpstr (buff, ==, ans);
-    memset ((gpointer)buff, 0, sizeof (buff));
-    g_assert_cmpint (qof_print_date_buff (buff, sizeof (buff), time2),
-                     ==, strlen (buff));
-    strftime(ans, MAX_DATE_LENGTH, GNC_D_FMT, &tm2);
-    g_assert_cmpstr (buff, ==, ans);
-    memset ((gpointer)buff, 0, sizeof (buff));
-    g_assert_cmpint (qof_print_date_buff (buff, sizeof (buff), time3),
-                     ==, strlen (buff));
-    strftime(ans, MAX_DATE_LENGTH, GNC_D_FMT, &tm3);
-    g_assert_cmpstr (buff, ==, ans);
-
-    test_gnc_setlocale (LC_TIME, "fr_FR");
-    memset ((gpointer)buff, 0, sizeof (buff));
-    g_assert_cmpint (qof_print_date_buff (buff, sizeof (buff), time1),
-                     ==, strlen (buff));
-    strftime(ans, MAX_DATE_LENGTH, GNC_D_FMT, &tm1);
-    g_assert_cmpstr (buff, ==, ans);
-    memset ((gpointer)buff, 0, sizeof (buff));
-    g_assert_cmpint (qof_print_date_buff (buff, sizeof (buff), time2),
-                     ==, strlen (buff));
-    strftime(ans, MAX_DATE_LENGTH, GNC_D_FMT, &tm2);
-    g_assert_cmpstr (buff, ==, ans);
-    memset ((gpointer)buff, 0, sizeof (buff));
-    g_assert_cmpint (qof_print_date_buff (buff, sizeof (buff), time3),
-                     ==, strlen (buff));
-    strftime(ans, MAX_DATE_LENGTH, GNC_D_FMT, &tm3);
-    g_assert_cmpstr (buff, ==, ans);
-
-    setlocale (LC_TIME, locale);
-    g_free (locale);
-}
-/* qof_print_gdate
-size_t
-qof_print_gdate( char *buf, size_t len, const GDate *gd )// C: 6 in 5  Local: 0:0:0
-*/
-static void
-test_qof_print_gdate (void)
-{
-    gchar buff[MAX_DATE_LENGTH], t_buff[MAX_DATE_LENGTH];
-    gchar *locale = g_strdup (setlocale (LC_TIME, NULL));
-    GDate *gd1 = g_date_new_dmy (23, 11, 1974);
-    GDate *gd2 = g_date_new_dmy (2, 2, 1961);
-    GDate *gd3 = g_date_new_dmy (16, 6, 2045);
-
-    qof_date_format_set (QOF_DATE_FORMAT_UK);
-    memset ((gpointer)buff, 0, sizeof (buff));
-    g_assert_cmpint (qof_print_gdate (buff, sizeof (buff), gd1),
-                     ==, strlen (buff));
-    g_assert_cmpstr (buff, ==, "23/11/1974");
-    memset ((gpointer)buff, 0, sizeof (buff));
-    g_assert_cmpint (qof_print_gdate (buff, sizeof (buff), gd2),
-                     ==, strlen (buff));
-    g_assert_cmpstr (buff, ==, "02/02/1961");
-    memset ((gpointer)buff, 0, sizeof (buff));
-    g_assert_cmpint (qof_print_gdate (buff, sizeof (buff), gd3),
-                     ==, strlen (buff));
-    g_assert_cmpstr (buff, ==, "16/06/2045");
-
-    qof_date_format_set (QOF_DATE_FORMAT_CE);
-    memset ((gpointer)buff, 0, sizeof (buff));
-    g_assert_cmpint (qof_print_gdate (buff, sizeof (buff), gd1),
-                     ==, strlen (buff));
-    g_assert_cmpstr (buff, ==, "23.11.1974");
-    memset ((gpointer)buff, 0, sizeof (buff));
-    g_assert_cmpint (qof_print_gdate (buff, sizeof (buff), gd2),
-                     ==, strlen (buff));
-    g_assert_cmpstr (buff, ==, "02.02.1961");
-    memset ((gpointer)buff, 0, sizeof (buff));
-    g_assert_cmpint (qof_print_gdate (buff, sizeof (buff), gd3),
-                     ==, strlen (buff));
-    g_assert_cmpstr (buff, ==, "16.06.2045");
-
-
-    qof_date_format_set (QOF_DATE_FORMAT_US);
-    memset ((gpointer)buff, 0, sizeof (buff));
-    g_assert_cmpint (qof_print_gdate (buff, sizeof (buff), gd1),
-                     ==, strlen (buff));
-    g_assert_cmpstr (buff, ==, "11/23/1974");
-    memset ((gpointer)buff, 0, sizeof (buff));
-    g_assert_cmpint (qof_print_gdate (buff, sizeof (buff), gd2),
-                     ==, strlen (buff));
-    g_assert_cmpstr (buff, ==, "02/02/1961");
-    memset ((gpointer)buff, 0, sizeof (buff));
-    g_assert_cmpint (qof_print_gdate (buff, sizeof (buff), gd3),
-                     ==, strlen (buff));
-    g_assert_cmpstr (buff, ==, "06/16/2045");
-
-
-    qof_date_format_set (QOF_DATE_FORMAT_ISO);
-    memset ((gpointer)buff, 0, sizeof (buff));
-    g_assert_cmpint (qof_print_gdate (buff, sizeof (buff), gd1),
-                     ==, strlen (buff));
-    g_assert_cmpstr (buff, ==, "1974-11-23");
-    memset ((gpointer)buff, 0, sizeof (buff));
-    g_assert_cmpint (qof_print_gdate (buff, sizeof (buff), gd2),
-                     ==, strlen (buff));
-    g_assert_cmpstr (buff, ==, "1961-02-02");
-    memset ((gpointer)buff, 0, sizeof (buff));
-    g_assert_cmpint (qof_print_gdate (buff, sizeof (buff), gd3),
-                     ==, strlen (buff));
-    g_assert_cmpstr (buff, ==, "2045-06-16");
-
-
-    qof_date_format_set (QOF_DATE_FORMAT_LOCALE);
-    test_gnc_setlocale (LC_TIME, "en_US");
-    memset ((gpointer)buff, 0, sizeof (buff));
-    g_assert_cmpint (qof_print_gdate (buff, sizeof (buff), gd1),
-                     ==, strlen (buff));
-    g_date_strftime (t_buff, MAX_DATE_LENGTH, GNC_D_FMT, gd1);
-    g_assert_cmpstr (buff, ==, t_buff);
-    memset ((gpointer)buff, 0, sizeof (buff));
-    g_assert_cmpint (qof_print_gdate (buff, sizeof (buff), gd2),
-                     ==, strlen (buff));
-    g_date_strftime (t_buff, MAX_DATE_LENGTH, GNC_D_FMT, gd2);
-    g_assert_cmpstr (buff, ==, t_buff);
-    memset ((gpointer)buff, 0, sizeof (buff));
-    g_assert_cmpint (qof_print_gdate (buff, sizeof (buff), gd3),
-                     ==, strlen (buff));
-    g_date_strftime (t_buff, MAX_DATE_LENGTH, GNC_D_FMT, gd3);
-    g_assert_cmpstr (buff, ==, t_buff);
-
-    test_gnc_setlocale (LC_TIME, "en_GB");
-    memset ((gpointer)buff, 0, sizeof (buff));
-    g_assert_cmpint (qof_print_gdate (buff, sizeof (buff), gd1),
-                     ==, strlen (buff));
-    g_date_strftime (t_buff, MAX_DATE_LENGTH, GNC_D_FMT, gd1);
-    g_assert_cmpstr (buff, ==, t_buff);
-    memset ((gpointer)buff, 0, sizeof (buff));
-    g_assert_cmpint (qof_print_gdate (buff, sizeof (buff), gd2),
-                     ==, strlen (buff));
-    g_date_strftime (t_buff, MAX_DATE_LENGTH, GNC_D_FMT, gd2);
-    g_assert_cmpstr (buff, ==, t_buff);
-    memset ((gpointer)buff, 0, sizeof (buff));
-    g_assert_cmpint (qof_print_gdate (buff, sizeof (buff), gd3),
-                     ==, strlen (buff));
-    g_date_strftime (t_buff, MAX_DATE_LENGTH, GNC_D_FMT, gd3);
-    g_assert_cmpstr (buff, ==, t_buff);
-
-
-    test_gnc_setlocale (LC_TIME, "fr_FR");
-    memset ((gpointer)buff, 0, sizeof (buff));
-    g_assert_cmpint (qof_print_gdate (buff, sizeof (buff), gd1),
-                     ==, strlen (buff));
-    g_date_strftime (t_buff, MAX_DATE_LENGTH, GNC_D_FMT, gd1);
-    g_assert_cmpstr (buff, ==, t_buff);
-    memset ((gpointer)buff, 0, sizeof (buff));
-    g_assert_cmpint (qof_print_gdate (buff, sizeof (buff), gd2),
-                     ==, strlen (buff));
-    g_date_strftime (t_buff, MAX_DATE_LENGTH, GNC_D_FMT, gd2);
-    g_assert_cmpstr (buff, ==, t_buff);
-    memset ((gpointer)buff, 0, sizeof (buff));
-    g_assert_cmpint (qof_print_gdate (buff, sizeof (buff), gd3),
-                     ==, strlen (buff));
-    g_date_strftime (t_buff, MAX_DATE_LENGTH, GNC_D_FMT, gd3);
-    g_assert_cmpstr (buff, ==, t_buff);
-
-    setlocale (LC_TIME, locale);
-    g_free (locale);
-    g_date_free (gd1);
-    g_date_free (gd2);
-    g_date_free (gd3);
-}
-
-#define test_assert_qof_print_date(time, datestr)  \
-    {                                              \
-        gchar *buf = qof_print_date (time);        \
-        g_assert_cmpstr (buf, ==, datestr);        \
-        g_free (buf);                              \
-    }
-
-#define test_assert_qof_print_date_outside_range(time, datestr)  \
-    {                                              \
-        gchar *buf = qof_print_date (time);        \
-        g_assert_cmpstr (buf, ==, datestr);        \
-        g_free (buf);                              \
-    }
-
-#define test_assert_localized_qof_print_date(time)           \
-    {                                                        \
-        gchar *buf = qof_print_date (time);                  \
-        test_assert_localized_timestring (time, buf);        \
-        g_free (buf);                                        \
-    }
-
-/* qof_print_date
-char *
-qof_print_date (time64 t)// C: 29 in 13  Local: 0:0:0
-*/
-static void
-test_qof_print_date (void)
-{
-    gchar *locale = g_strdup (setlocale (LC_TIME, NULL));
-    char ans[MAX_DATE_LENGTH];
-    time64 time1 = 154440000; //1974-11-23 12:00:00
-    time64 time2 = -281188800; //1961-02-02 12:00:00
-    time64 time3 = 2381227200LL; //2045-06-16 12:00:00
-    struct tm tm1 = {0, 0, 12, 23, 10, 74};
-    struct tm tm2 = {0, 0, 12, 2, 1, 61};
-    struct tm tm3 = {0, 0, 12, 16, 5, 145};
-
-    qof_date_format_set (QOF_DATE_FORMAT_UK);
-    test_assert_qof_print_date (time1, "23/11/1974");
-    test_assert_qof_print_date_outside_range (time2, "02/02/1961");
-    test_assert_qof_print_date_outside_range (time3, "16/06/2045");
-
-    qof_date_format_set (QOF_DATE_FORMAT_CE);
-    test_assert_qof_print_date (time1, "23.11.1974");
-    test_assert_qof_print_date_outside_range (time2, "02.02.1961");
-    test_assert_qof_print_date_outside_range (time3, "16.06.2045");
-
-    qof_date_format_set (QOF_DATE_FORMAT_US);
-    test_assert_qof_print_date (time1, "11/23/1974");
-    test_assert_qof_print_date_outside_range (time2, "02/02/1961");
-    test_assert_qof_print_date_outside_range (time3, "06/16/2045");
-
-    qof_date_format_set (QOF_DATE_FORMAT_ISO);
-    test_assert_qof_print_date (time1, "1974-11-23");
-    test_assert_qof_print_date_outside_range (time2, "1961-02-02");
-    test_assert_qof_print_date_outside_range (time3, "2045-06-16");
-
-    qof_date_format_set (QOF_DATE_FORMAT_LOCALE);
-    test_gnc_setlocale (LC_TIME, "en_US");
-    strftime(ans, MAX_DATE_LENGTH, GNC_D_FMT, &tm1);
-    test_assert_qof_print_date (time1,ans);
-    strftime(ans, MAX_DATE_LENGTH, GNC_D_FMT, &tm2);
-    test_assert_qof_print_date_outside_range (time2, ans);
-    strftime(ans, MAX_DATE_LENGTH, GNC_D_FMT, &tm3);
-    test_assert_qof_print_date_outside_range (time3, ans);
-
-    test_gnc_setlocale (LC_TIME, "en_GB");
-    strftime(ans, MAX_DATE_LENGTH, GNC_D_FMT, &tm1);
-    test_assert_qof_print_date (time1, ans);
-    strftime(ans, MAX_DATE_LENGTH, GNC_D_FMT, &tm2);
-    test_assert_qof_print_date_outside_range (time2, ans);
-    strftime(ans, MAX_DATE_LENGTH, GNC_D_FMT, &tm3);
-    test_assert_qof_print_date_outside_range (time3, ans);
-
-    test_gnc_setlocale (LC_TIME, "fr_FR");
-    strftime(ans, MAX_DATE_LENGTH, GNC_D_FMT, &tm1);
-    test_assert_qof_print_date (time1, ans);
-    strftime(ans, MAX_DATE_LENGTH, GNC_D_FMT, &tm2);
-    test_assert_qof_print_date_outside_range (time2, ans);
-    strftime(ans, MAX_DATE_LENGTH, GNC_D_FMT, &tm3);
-    test_assert_qof_print_date_outside_range (time3,ans);
-
-    setlocale (LC_TIME, locale);
-    g_free (locale);
-}
-/* gnc_print_date
-const char *
-gnc_print_date (Timespec ts)// C: 11 in 9 SCM: 166 in 59 Local: 0:0:0
-*/
-static void
-test_gnc_print_date (void)
-{
-    gchar t_buff[MAX_DATE_LENGTH];
-    gchar *locale = g_strdup (setlocale (LC_TIME, NULL));
-    GDate *gd1 = g_date_new_dmy (23, 11, 1974);
-    GDate *gd2 = g_date_new_dmy (2, 2, 1961);
-    GDate *gd3 = g_date_new_dmy (16, 6, 2045);
-    Timespec tm1 = gdate_to_timespec (*gd1);
-    Timespec tm2 = gdate_to_timespec (*gd2);
-    Timespec tm3 = gdate_to_timespec (*gd3);
-
-
-    qof_date_format_set (QOF_DATE_FORMAT_UK);
-    g_assert_cmpstr (gnc_print_date (tm1), ==, "23/11/1974");
-    g_assert_cmpstr (gnc_print_date (tm2), ==, "02/02/1961");
-    g_assert_cmpstr (gnc_print_date (tm3), ==, "16/06/2045");
-
-    qof_date_format_set (QOF_DATE_FORMAT_CE);
-    g_assert_cmpstr (gnc_print_date (tm1), ==, "23.11.1974");
-    g_assert_cmpstr (gnc_print_date (tm2), ==, "02.02.1961");
-    g_assert_cmpstr (gnc_print_date (tm3), ==, "16.06.2045");
-
-    qof_date_format_set (QOF_DATE_FORMAT_US);
-    g_assert_cmpstr (gnc_print_date (tm1), ==, "11/23/1974");
-    g_assert_cmpstr (gnc_print_date (tm2), ==, "02/02/1961");
-    g_assert_cmpstr (gnc_print_date (tm3), ==, "06/16/2045");
-
-    qof_date_format_set (QOF_DATE_FORMAT_ISO);
-    g_assert_cmpstr (gnc_print_date (tm1), ==, "1974-11-23");
-    g_assert_cmpstr (gnc_print_date (tm2), ==, "1961-02-02");
-    g_assert_cmpstr (gnc_print_date (tm3), ==, "2045-06-16");
-
-    qof_date_format_set (QOF_DATE_FORMAT_LOCALE);
-    test_gnc_setlocale (LC_TIME, "en_US");
-    g_date_strftime (t_buff, MAX_DATE_LENGTH, GNC_D_FMT, gd1);
-    g_assert_cmpstr (gnc_print_date (tm1), ==, t_buff);
-    g_date_strftime (t_buff, MAX_DATE_LENGTH, GNC_D_FMT, gd2);
-    g_assert_cmpstr (gnc_print_date (tm2), ==, t_buff);
-    g_date_strftime (t_buff, MAX_DATE_LENGTH, GNC_D_FMT, gd3);
-    g_assert_cmpstr (gnc_print_date (tm3), ==, t_buff);
-
-    test_gnc_setlocale (LC_TIME, "en_GB");
-    g_date_strftime (t_buff, MAX_DATE_LENGTH, GNC_D_FMT, gd1);
-    g_assert_cmpstr (gnc_print_date (tm1), ==, t_buff);
-    g_date_strftime (t_buff, MAX_DATE_LENGTH, GNC_D_FMT, gd2);
-    g_assert_cmpstr (gnc_print_date (tm2), ==, t_buff);
-    g_date_strftime (t_buff, MAX_DATE_LENGTH, GNC_D_FMT, gd3);
-    g_assert_cmpstr (gnc_print_date (tm3), ==, t_buff);
-
-    test_gnc_setlocale (LC_TIME, "fr_FR");
-    g_date_strftime (t_buff, MAX_DATE_LENGTH, GNC_D_FMT, gd1);
-    g_assert_cmpstr (gnc_print_date (tm1), ==, t_buff);
-    g_date_strftime (t_buff, MAX_DATE_LENGTH, GNC_D_FMT, gd2);
-    g_assert_cmpstr (gnc_print_date (tm2), ==, t_buff);
-    g_date_strftime (t_buff, MAX_DATE_LENGTH, GNC_D_FMT, gd3);
-    g_assert_cmpstr (gnc_print_date (tm3), ==, t_buff);
-
-    setlocale (LC_TIME, locale);
-    g_free (locale);
-    g_date_free (gd1);
-    g_date_free (gd2);
-    g_date_free (gd3);
-}
-/* floordiv
-static int
-floordiv(int a, int b)// Local: 1:0:0
-*/
-/* static void
-test_floordiv (void)
-{
-}*/
-/* qof_scan_date_internal
-qof_scan_date just does passes this through, passing the pre-set QOF_DATE_FORMAT, so we test there rather than exposing this via Testfuncs.
-qof_scan_date_internal (const char *buff, int *day, int *month, int *year,// Local: 3:0:0
-*/
-/* static void
-test_qof_scan_date_internal (void)
-{
-} */
-/* qof_scan_date
-gboolean
-qof_scan_date (const char *buff, int *day, int *month, int *year)// C: 7 in 3  Local: 0:0:0
-*/
-static void
-test_qof_scan_date (void)
-{
-    gchar *locale = g_strdup (setlocale (LC_TIME, NULL));
-    int day = 0, mo = 0, yr = 0;
-    gint year, month;
-    time64 now = gnc_time(NULL);
-    gchar buff[MAX_DATE_LENGTH];
-    struct tm tm = { 0, 0, 0, 0, 0, 0, 0, 0, 0
-#ifndef G_OS_WIN32
-        , 0, 0
-#endif
-    };
-    gnc_localtime_r(&now, &tm);
-    year = tm.tm_year + 1900;
-    month = tm.tm_mon + 1;
-
-    g_assert (!qof_scan_date (NULL, &day, &mo, &yr));
-    g_assert_cmpint (day, ==, 0);
-    g_assert_cmpint (mo, ==, 0);
-    g_assert_cmpint (yr, ==, 0);
-
-    qof_date_format_set (QOF_DATE_FORMAT_UTC);
-    g_assert (qof_scan_date ("1974-11-23", &day, &mo, &yr));
-    g_assert_cmpint (day, ==, 23);
-    g_assert_cmpint (mo, ==, 11);
-    g_assert_cmpint (yr, ==, 1974);
-
-    g_assert (qof_scan_date ("1961-2-2", &day, &mo, &yr));
-    g_assert_cmpint (day, ==, 2);
-    g_assert_cmpint (mo, ==, 2);
-    g_assert_cmpint (yr, ==, 1961);
-
-    g_assert (qof_scan_date ("2045-6-16", &day, &mo, &yr));
-    g_assert_cmpint (day, ==, 16);
-    g_assert_cmpint (mo, ==, 6);
-    g_assert_cmpint (yr, ==, 2045);
-
-    qof_date_format_set (QOF_DATE_FORMAT_US);
-    g_assert (qof_scan_date ("11/23/1974", &day, &mo, &yr));
-    g_assert_cmpint (day, ==, 23);
-    g_assert_cmpint (mo, ==, 11);
-    g_assert_cmpint (yr, ==, 1974);
-
-    g_assert (qof_scan_date ("2/2/1961", &day, &mo, &yr));
-    g_assert_cmpint (day, ==, 2);
-    g_assert_cmpint (mo, ==, 2);
-    g_assert_cmpint (yr, ==, 1961);
-
-    g_assert (qof_scan_date ("6/16/2045", &day, &mo, &yr));
-    g_assert_cmpint (day, ==, 16);
-    g_assert_cmpint (mo, ==, 6);
-    g_assert_cmpint (yr, ==, 2045);
-
-    g_assert (qof_scan_date ("11ì›”23ë…„1974", &day, &mo, &yr));
-    g_assert_cmpint (day, ==, 23);
-    g_assert_cmpint (mo, ==, 11);
-    g_assert_cmpint (yr, ==, 1974);
-
-    g_assert (qof_scan_date ("11月23年1974", &day, &mo, &yr));
-    g_assert_cmpint (day, ==, 23);
-    g_assert_cmpint (mo, ==, 11);
-    g_assert_cmpint (yr, ==, 1974);
-
-    qof_date_completion_set (QOF_DATE_COMPLETION_THISYEAR, 0);
-
-    g_assert (qof_scan_date ("11-23", &day, &mo, &yr));
-    g_assert_cmpint (day, ==, 23);
-    g_assert_cmpint (mo, ==, 11);
-    g_assert_cmpint (yr, ==, year);
-
-    g_assert (qof_scan_date ("23-11", &day, &mo, &yr));
-    g_assert_cmpint (day, ==, 23);
-    g_assert_cmpint (mo, ==, 11);
-    g_assert_cmpint (yr, ==, year);
-
-    if (month < 10) /* Sliding window won't test well after October */
-    {
-        qof_date_completion_set (QOF_DATE_COMPLETION_SLIDING, month + 1);
-
-        g_assert (qof_scan_date ("12-23", &day, &mo, &yr));
-        g_assert_cmpint (day, ==, 23);
-        g_assert_cmpint (mo, ==, 12);
-        g_assert_cmpint (yr, ==, year - 1);
-
-        qof_date_completion_set (QOF_DATE_COMPLETION_THISYEAR, 0);
-    }
-
-    qof_date_format_set (QOF_DATE_FORMAT_UK);
-    g_assert (qof_scan_date ("23/11/1974", &day, &mo, &yr));
-    g_assert_cmpint (day, ==, 23);
-    g_assert_cmpint (mo, ==, 11);
-    g_assert_cmpint (yr, ==, 1974);
-
-    g_assert (qof_scan_date ("2/2/1961", &day, &mo, &yr));
-    g_assert_cmpint (day, ==, 2);
-    g_assert_cmpint (mo, ==, 2);
-    g_assert_cmpint (yr, ==, 1961);
-
-    g_assert (qof_scan_date ("16/6/2045", &day, &mo, &yr));
-    g_assert_cmpint (day, ==, 16);
-    g_assert_cmpint (mo, ==, 6);
-    g_assert_cmpint (yr, ==, 2045);
-
-    qof_date_format_set (QOF_DATE_FORMAT_LOCALE);
-    test_gnc_setlocale (LC_TIME, "en_GB");
-    tm_set_dmy (&tm, 1974, 11, 23);
-    strftime (buff, MAX_DATE_LENGTH, GNC_D_FMT, &tm);
-    g_assert (qof_scan_date (buff, &day, &mo, &yr));
-    g_assert_cmpint (day, ==, tm.tm_mday);
-    g_assert_cmpint (mo, ==, tm.tm_mon + 1);
-    g_assert_cmpint (yr, ==, tm.tm_year + 1900);
-
-    tm_set_dmy (&tm, 1961,2, 2);
-    strftime (buff, MAX_DATE_LENGTH, GNC_D_FMT, &tm);
-    g_assert (qof_scan_date (buff, &day, &mo, &yr));
-    g_assert_cmpint (day, ==, tm.tm_mday);
-    g_assert_cmpint (mo, ==, tm.tm_mon + 1);
-    /* Some locale date formats result in a 2-digit year, which strptime
-     * interprets as being in the current century.
-     */
-    g_assert_cmpint (yr % 100, ==, tm.tm_year % 100);
-
-    tm_set_dmy (&tm, 2045, 6, 16);
-    strftime (buff, MAX_DATE_LENGTH, GNC_D_FMT, &tm);
-    g_assert (qof_scan_date (buff, &day, &mo, &yr));
-    g_assert_cmpint (day, ==, tm.tm_mday);
-    g_assert_cmpint (mo, ==, tm.tm_mon + 1);
-    g_assert_cmpint (yr, ==, tm.tm_year + 1900);
-
-    setlocale (LC_TIME, locale);
-    g_free (locale);
-}
-/* dateSeparator
-return date character
-char dateSeparator (void)// C: 1  Local: 0:0:0
-src/register/register-gnome/datecell-gnome.h
-*/
-/* static void
-test_dateSeparator (void)
-{
-}*/
-/* qof_time_format_from_utf8
-gchar *
-qof_time_format_from_utf8(const gchar *utf8_format)// C: 1  Local: 1:0:0
-*/
-/* static void
-test_qof_time_format_from_utf8 (void)
-{
-}*/
-/* qof_formatted_time_to_utf8
-gchar *
-qof_formatted_time_to_utf8(const gchar *locale_string)// C: 1  Local: 1:0:0
-*/
-/* static void
-test_qof_formatted_time_to_utf8 (void)
-{
-}*/
-/* qof_format_time
-static gchar *
-qof_format_time(const gchar *format, const struct tm *tm)// Local: 1:0:0
-*/
-/* static void
-test_qof_format_time (void)
-{
-}*/
-/* qof_strftime
-gsize
-qof_strftime(gchar *buf, gsize max, const gchar *format, const struct tm *tm)// C: 16 in 9  Local: 5:0:0
-*/
-/* static void
-test_qof_strftime (void)
-{
-}*/
-/* gnc_date_timestamp
-gchar *
-gnc_date_timestamp (void)// C: 2 in 2  Local: 0:0:0
-*/
-static void
-test_gnc_date_timestamp (void)
-{
-    time64 now = gnc_time(NULL);
-    gchar *timestr = gnc_date_timestamp ();
-    struct tm tm0, tm1;
-    gnc_localtime_r(&now, &tm0);
-    g_assert (strptime (timestr, "%Y%m%d%H%M%S", &tm1));
-    g_assert_cmpint (tm0.tm_year, ==, tm1.tm_year);
-    g_assert_cmpint (tm0.tm_mon, ==, tm1.tm_mon);
-    g_assert_cmpint (tm0.tm_mday, ==, tm1.tm_mday);
-    g_assert_cmpint (tm0.tm_hour, ==, tm1.tm_hour);
-    g_assert_cmpint (tm0.tm_min, ==, tm1.tm_min);
-    g_assert_cmpint (tm0.tm_sec, ==, tm1.tm_sec);
-
-    g_free (timestr);
-}
-/* gnc_iso8601_to_timespec_gmt
-Timespec
-gnc_iso8601_to_timespec_gmt(const char *str)// C: 6 in 3  Local: 0:0:0
-*/
-static gint
-get_nanoseconds (GDateTime *gdt)
-{
-    return g_date_time_get_microsecond (gdt) * 1000;
-}
-
-static void
-test_gnc_iso8601_to_timespec_gmt (FixtureA *f, gconstpointer pData)
-{
-    Timespec t;
-
-    t = gnc_iso8601_to_timespec_gmt (NULL);
-    g_assert_cmpint (t.tv_sec, ==, 0);
-    g_assert_cmpint (t.tv_nsec, ==, 0);
-
-    t = gnc_iso8601_to_timespec_gmt ("");
-    g_assert_cmpint (t.tv_sec, ==, 0);
-    g_assert_cmpint (t.tv_nsec, ==, 0);
-
-    t = gnc_iso8601_to_timespec_gmt ("1989-03-27 13:43:27");
-    g_assert_cmpint (t.tv_sec, ==, f->ts1.tv_sec);
-    /* MinGW has some precision issues in the last microsecond digit */
-#ifdef G_OS_WIN32
-    g_assert_cmpint (t.tv_nsec - 2000, <=, f->ts1.tv_nsec);
-    g_assert_cmpint (t.tv_nsec + 2000, >=, f->ts1.tv_nsec);
-#else
-    g_assert_cmpint (t.tv_nsec, ==, f->ts1.tv_nsec);
-#endif
-    t = gnc_iso8601_to_timespec_gmt ("2020-11-07 06:21:19 -05");
-    g_assert_cmpint (t.tv_sec, ==, f->ts2.tv_sec);
-    g_assert_cmpint (t.tv_nsec, ==, f->ts2.tv_nsec);
-
-    t = gnc_iso8601_to_timespec_gmt ("2012-07-04 19:27:44.0+08:40");
-    g_assert_cmpint (t.tv_sec, ==, f->ts3.tv_sec);
-    g_assert_cmpint (t.tv_nsec, ==, f->ts3.tv_nsec);
-
-    t = gnc_iso8601_to_timespec_gmt ("1961-09-22 17:53:19 -05");
-    g_assert_cmpint (t.tv_sec, ==, f->ts4.tv_sec);
-    g_assert_cmpint (t.tv_nsec, ==, f->ts4.tv_nsec);
-
-    t = gnc_iso8601_to_timespec_gmt ("2061-01-25 23:21:19.0 -05:00");
-    g_assert_cmpint (t.tv_sec, ==, f->ts5.tv_sec);
-    g_assert_cmpint (t.tv_nsec, ==, f->ts5.tv_nsec);
-}
-/* gnc_timespec_to_iso8601_buff
-char *
-gnc_timespec_to_iso8601_buff (Timespec ts, char * buff)// C: 18 in 7  Local: 0:0:0
-*/
-static Timespec
-g_date_time_to_timespec (GDateTime *gdt)
-{
-    Timespec t;
-    t.tv_sec = g_date_time_to_unix (gdt);
-    t.tv_nsec = g_date_time_get_microsecond (gdt) * 1000;
-    return t;
-}
-
-#define ISO8601_SIZE MAX_DATE_LENGTH + 4
-static gchar*
-format_timestring (Timespec ts, TZOffset tz)
-{
-  static const unsigned tzlen = MAX_DATE_LENGTH - 26;
-    char *fmt = "%Y-%m-%d %H:%M:%S";
-    struct tm tm;
-    char buf[MAX_DATE_LENGTH], *retval;
-    char tzbuf[tzlen];
-    memset(tzbuf, 0, sizeof(tzbuf));
-    gnc_localtime_r(&ts.tv_sec, &tm);
-#if PLATFORM(WINDOWS)
-    strftime(tzbuf, sizeof(tzbuf), "%Z", &tm);
-#else
-    strftime(tzbuf, sizeof(tzbuf), "%z", &tm);
-#endif
-    memset (buf, 0, sizeof(buf));
-    strftime(buf, sizeof(buf), fmt, &tm);
-    retval = g_strdup_printf ("%s.%06ld %s", buf, ts.tv_nsec / 1000, tzbuf);
-
-    return retval;
-}
-
-static void
-test_gnc_timespec_to_iso8601_buff (FixtureA *f, gconstpointer pData)
-{
-
-    gchar buff[ISO8601_SIZE];
-    gchar *time_str;
-    Timespec t = { 0, 0 };
-    gchar *end;
-
-    memset (buff, 0, sizeof buff);
-
-    end = gnc_timespec_to_iso8601_buff (t, NULL);
-    g_assert (end == NULL);
-
-    end = gnc_timespec_to_iso8601_buff (f->ts0, buff);
-    g_assert_cmpint (end - buff, ==, strlen (buff));
-    time_str = format_timestring (f->ts0, f->off_zulu);
-    g_assert_cmpstr (buff, ==, time_str);
-    g_free (time_str);
-
-    end = gnc_timespec_to_iso8601_buff (f->ts1, buff);
-    time_str = format_timestring (f->ts1, f->off_zulu);
-    g_assert_cmpstr (buff, ==, time_str);
-    g_free (time_str);
-
-
-    end = gnc_timespec_to_iso8601_buff (f->ts2, buff);
-    time_str = format_timestring (f->ts2, f->off_05w);
-    g_assert_cmpstr (buff, ==, time_str);
-    g_free (time_str);
-
-    end = gnc_timespec_to_iso8601_buff (f->ts3, buff);
-    time_str = format_timestring (f->ts3, f->off_0840e);
-    g_assert_cmpstr (buff, ==, time_str);
-    g_free (time_str);
-
-    end = gnc_timespec_to_iso8601_buff (f->ts4, buff);
-    time_str = format_timestring (f->ts4, f->off_05w);
-    g_assert_cmpstr (buff, ==, time_str);
-    g_free (time_str);
-
-    end = gnc_timespec_to_iso8601_buff (f->ts5, buff);
-    time_str = format_timestring (f->ts5, f->off_05w);
-    g_assert_cmpstr (buff, ==, time_str);
-    g_free (time_str);
-}
-/* gnc_timespec2dmy
-void
-gnc_timespec2dmy (Timespec t, int *day, int *month, int *year)// C: 1  Local: 0:0:0
-*/
-static void
-test_gnc_timespec2dmy (FixtureA *f, gconstpointer pData)
-{
-    struct tm tm;
-    int day, r_day, mo, r_mo, yr, r_yr;
-
-
-    gnc_timespec2dmy (f->ts0, &r_day, &r_mo, &r_yr);
-    gnc_localtime_r (&f->ts0.tv_sec, &tm);
-    g_assert_cmpint (r_day, ==, tm.tm_mday);
-    g_assert_cmpint (r_mo, ==, tm.tm_mon + 1);
-    g_assert_cmpint (r_yr, ==, tm.tm_year + 1900);
-
-    gnc_timespec2dmy (f->ts1, &r_day, &r_mo, &r_yr);
-    gnc_localtime_r (&f->ts1.tv_sec, &tm);
-    g_assert_cmpint (r_day, ==, tm.tm_mday);
-    g_assert_cmpint (r_mo, ==, tm.tm_mon + 1);
-    g_assert_cmpint (r_yr, ==, tm.tm_year + 1900);
-
-    gnc_timespec2dmy (f->ts2, &r_day, &r_mo, &r_yr);
-    gnc_localtime_r (&f->ts2.tv_sec, &tm);
-    g_assert_cmpint (r_day, ==, tm.tm_mday);
-    g_assert_cmpint (r_mo, ==, tm.tm_mon + 1);
-    g_assert_cmpint (r_yr, ==, tm.tm_year + 1900);
-
-    gnc_timespec2dmy (f->ts3, &r_day, &r_mo, &r_yr);
-    gnc_localtime_r (&f->ts3.tv_sec, &tm);
-    g_assert_cmpint (r_day, ==, tm.tm_mday);
-    g_assert_cmpint (r_mo, ==, tm.tm_mon + 1);
-    g_assert_cmpint (r_yr, ==, tm.tm_year + 1900);
-
-    gnc_timespec2dmy (f->ts4, &r_day, &r_mo, &r_yr);
-    gnc_localtime_r (&f->ts4.tv_sec, &tm);
-    g_assert_cmpint (r_day, ==, tm.tm_mday);
-    g_assert_cmpint (r_mo, ==, tm.tm_mon + 1);
-    g_assert_cmpint (r_yr, ==, tm.tm_year + 1900);
-
-    gnc_timespec2dmy (f->ts5, &r_day, &r_mo, &r_yr);
-    gnc_localtime_r (&f->ts5.tv_sec, &tm);
-    g_assert_cmpint (r_day, ==, tm.tm_mday);
-    g_assert_cmpint (r_mo, ==, tm.tm_mon + 1);
-    g_assert_cmpint (r_yr, ==, tm.tm_year + 1900);
-
-}
-/* gnc_dmy2timespec_internal
-static Timespec
-gnc_dmy2timespec_internal (int day, int month, int year, gboolean start_of_day)// Local: 2:0:0
-*/
-/* static void
-test_gnc_dmy2timespec_internal (void)
-{
-}*/
-/* gnc_dmy2timespec
-Timespec
-gnc_dmy2timespec (int day, int month, int year)// C: 8 in 5  Local: 1:0:0
-*/
-static void
-test_gnc_dmy2timespec (FixtureB *f, gconstpointer pData)
-{
-    gchar *msg1 = "[qof_dmy2timespec()] Date computation error from Y-M-D 1257-7-2: Time value is outside the supported year range.";
-    gint loglevel = G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_FATAL;
-    gchar *logdomain = "qof.engine";
-    TestErrorStruct check = {loglevel, logdomain, msg1, 0};
-    GLogFunc hdlr = g_log_set_default_handler ((GLogFunc)test_null_handler, &check);
-    g_test_log_set_fatal_handler ((GTestLogFatalFunc)test_checked_handler, &check);
-    for (int i = 0; i < sizeof(f->test)/sizeof(TimeMap); ++i)
-    {
-#ifdef HAVE_STRUCT_TM_GMTOFF
-        struct tm tm = {0, 0, 0, f->test[i].day, f->test[i].mon - 1,
-                        f->test[i].yr - 1900, 0, 0, -1, 0, NULL};
-#else
-        struct tm tm = {0, 0, 0, f->test[i].day, f->test[i].mon - 1,
-                        f->test[i].yr - 1900, 0, 0, -1};
-#endif
-        Timespec r_t = gnc_dmy2timespec (f->test[i].day, f->test[i].mon,
-                                         f->test[i].yr);
-        int offset = gnc_mktime(&tm) - gnc_timegm(&tm);
-        if (f->test[i].secs == INT64_MAX)
-            /* We use INT64_MAX as invalid timespec.secs.
-             * As we can't *add* to the max, we can ignore the tz offset in this case. */
-            g_assert_cmpint (r_t.tv_sec, ==, INT64_MAX);
-        else
-            g_assert_cmpint (r_t.tv_sec, ==, f->test[i].secs + offset);
-    }
-    g_log_set_default_handler (hdlr, 0);
-}
-/* gnc_dmy2timespec_end
-Timespec
-gnc_dmy2timespec_end (int day, int month, int year)// C: 1  Local: 0:0:0
-*/
-static void
-test_gnc_dmy2timespec_end (FixtureB *f, gconstpointer pData)
-{
-    gchar *msg1 = "[qof_dmy2timespec_end()] Date computation error from Y-M-D 1257-7-2: Time value is outside the supported year range.";
-    gint loglevel = G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_FATAL;
-    gchar *logdomain = "qof.engine";
-    TestErrorStruct check = {loglevel, logdomain, msg1, 0};
-    GLogFunc hdlr = g_log_set_default_handler ((GLogFunc)test_null_handler, &check);
-    g_test_log_set_fatal_handler ((GTestLogFatalFunc)test_checked_handler, &check);
-    for (int i = 0; i < sizeof(f->test)/sizeof(TimeMap); ++i)
-    {
-#ifdef HAVE_STRUCT_TM_GMTOFF
-        struct tm tm = {59, 59, 23, f->test[i].day, f->test[i].mon - 1,
-                        f->test[i].yr - 1900, 0, 0, -1, 0, NULL};
-#else
-        struct tm tm = {59, 59, 23, f->test[i].day, f->test[i].mon - 1,
-                        f->test[i].yr - 1900, 0, 0, -1};
-#endif
-        Timespec r_t = gnc_dmy2timespec_end (f->test[i].day, f->test[i].mon,
-                                             f->test[i].yr);
-        int offset = gnc_mktime(&tm) - gnc_timegm(&tm);
-        if (f->test[i].secs == INT64_MAX)
-            /* We use INT64_MAX as invalid timespec.secs.
-             * As we can't *add* to the max, we can ignore the tz offset in this case. */
-            g_assert_cmpint (r_t.tv_sec, ==, INT64_MAX);
-        else
-            g_assert_cmpint (r_t.tv_sec, ==, f->test[i].secs + offset);
-    }
-    g_log_set_default_handler (hdlr, 0);
-}
-
-static GDateTime*
-offset_adjust(GDateTime *gdt)
-{
-     Testfuncs *tf = gnc_date_load_funcs();
-     GTimeZone *zone = tf->timezone_new_local();
-     int interval = g_time_zone_find_interval(zone, G_TIME_TYPE_STANDARD,
-					      g_date_time_to_unix(gdt));
-     int offset = g_time_zone_get_offset(zone, interval) / 60;
-     int off_hr = (offset / 60) + (offset % 60 ? (offset < 0 ? -1 : 1) : 0);
-     int correction = off_hr < -10 ? -10 - off_hr : off_hr > 13 ? 13 - off_hr : 0;
-     GDateTime* new_gdt = g_date_time_add_hours(gdt, correction);
-     g_date_time_unref(gdt);
-     g_slice_free(Testfuncs, tf);
-     return new_gdt;
-}
-
-/*gnc_dmy2timespec_neutral*/
-static void
-test_gnc_dmy2timespec_neutral (FixtureB *f, gconstpointer pData)
-{
-    gchar *msg1 = "[qof_dmy2timespec_neutral()] Date computation error from Y-M-D 1257-7-2: Time value is outside the supported year range.";
-    gint loglevel = G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_FATAL;
-    gchar *logdomain = "qof.engine";
-    TestErrorStruct check = {loglevel, logdomain, msg1, 0};
-    GLogFunc hdlr = g_log_set_default_handler ((GLogFunc)test_null_handler, &check);
-    g_test_log_set_fatal_handler ((GTestLogFatalFunc)test_checked_handler, &check);
-    for (int i = 0; i < sizeof(f->test)/sizeof(TimeMap); ++i)
-    {
-        Timespec r_t = gnc_dmy2timespec_neutral (f->test[i].day, f->test[i].mon,
-                                             f->test[i].yr);
-
-        g_assert_cmpint (r_t.tv_sec, ==, f->test[i].secs);
-    }
-    g_log_set_default_handler (hdlr, 0);
-}
-
-/* gnc_timezone
-long int
-gnc_timezone (const struct tm *tm)// C: 5 in 2  Local: 2:0:0
-*/
-/* static void
-test_gnc_timezone (void)
-{
-}*/
-/* timespecFromTime64
-void
-timespecFromTime64( Timespec *ts, time64 t )// C: 22 in 11  Local: 0:0:0
-*/
-static void
-test_timespecFromTime64 (void)
-{
-     Timespec ts = {-9999, 0};
-     timespecFromTime64 (&ts, MINTIME - 1);
-     g_assert_cmpint (0, ==, ts.tv_sec);
-     timespecFromTime64 (&ts, MINTIME + 1);
-     g_assert_cmpint (MINTIME + 1, ==, ts.tv_sec);
-     timespecFromTime64 (&ts, MAXTIME + 1);
-     g_assert_cmpint (MAXTIME, ==, ts.tv_sec);
-     timespecFromTime64 (&ts, MAXTIME - 1);
-     g_assert_cmpint (MAXTIME - 1, ==, ts.tv_sec);
-}
-/* timespec_now
-Timespec
-timespec_now()// C: 2 in 2  Local: 0:0:0
-*/
-/* static void
-test_timespec_now (void)
-{
-}*/
-/* timespecTotime64
-time64
-timespecTotime64 (Timespec ts)// C: 10 in 6  Local: 1:0:0
-*/
-/* static void
-test_timespecTotime64 (void)
-{
-}*/
-/* timespec_to_gdate
-GDate timespec_to_gdate (Timespec ts)// C: 5 in 4  Local: 0:0:0
-*/
-static void
-test_timespec_to_gdate (FixtureA *f, gconstpointer pData)
-{
-    GDate date1, date2;
-    struct tm tm;
-
-    g_date_clear (&date2, 1);
-
-    date1 = timespec_to_gdate (f->ts0);
-    gnc_localtime_r(&f->ts0.tv_sec, &tm);
-    g_date_set_dmy (&date2, tm.tm_mday, tm.tm_mon + 1, tm.tm_year + 1900);
-    g_assert_cmpint (g_date_get_julian (&date1), ==,
-                     g_date_get_julian (&date2));
-
-    date1 = timespec_to_gdate (f->ts1);
-    gnc_localtime_r(&f->ts1.tv_sec, &tm);
-    g_date_set_dmy (&date2, tm.tm_mday, tm.tm_mon + 1, tm.tm_year + 1900);
-    g_assert_cmpint (g_date_get_julian (&date1), ==,
-                     g_date_get_julian (&date2));
-
-    date1 = timespec_to_gdate (f->ts2);
-    gnc_localtime_r(&f->ts2.tv_sec, &tm);
-    g_date_set_dmy (&date2, tm.tm_mday, tm.tm_mon + 1, tm.tm_year + 1900);
-    g_assert_cmpint (g_date_get_julian (&date1), ==,
-                     g_date_get_julian (&date2));
-
-    date1 = timespec_to_gdate (f->ts3);
-    gnc_localtime_r(&f->ts3.tv_sec, &tm);
-    g_date_set_dmy (&date2, tm.tm_mday, tm.tm_mon + 1, tm.tm_year + 1900);
-    g_assert_cmpint (g_date_get_julian (&date1), ==,
-                     g_date_get_julian (&date2));
-
-    date1 = timespec_to_gdate (f->ts4);
-    gnc_localtime_r(&f->ts4.tv_sec, &tm);
-    g_date_set_dmy (&date2, tm.tm_mday, tm.tm_mon + 1, tm.tm_year + 1900);
-    g_assert_cmpint (g_date_get_julian (&date1), ==,
-                     g_date_get_julian (&date2));
-
-    date1 = timespec_to_gdate (f->ts5);
-    gnc_localtime_r(&f->ts5.tv_sec, &tm);
-    g_date_set_dmy (&date2, tm.tm_mday, tm.tm_mon + 1, tm.tm_year + 1900);
-    g_assert_cmpint (g_date_get_julian (&date1), ==,
-                     g_date_get_julian (&date2));
-}
-
-/* gdate_to_timespec
-Timespec gdate_to_timespec (GDate d)// C: 7 in 6  Local: 0:0:0
-*/
-static void
-test_gdate_to_timespec (FixtureB *f, gconstpointer pData)
-{
-
-    gchar *msg = "g_date_set_dmy: assertion 'g_date_valid_dmy (day, m, y)' failed";
-    gint loglevel = G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_FATAL;
-    gchar *logdomain = G_LOG_DOMAIN;
-    TestErrorStruct check = {loglevel, logdomain, msg, 0};
-    GLogFunc hdlr = g_log_set_default_handler ((GLogFunc)test_null_handler, &check);
-    g_test_log_set_fatal_handler ((GTestLogFatalFunc)test_checked_handler, &check);
-    for (int i = 0; i < sizeof(f->test)/sizeof(TimeMap); ++i)
-    {
-        GDate gd, gd2;
-        Timespec r_t;
-        g_date_clear(&gd, 1);
-        g_date_clear(&gd2, 1);
-        g_date_set_dmy(&gd, f->test[i].day, f->test[i].mon, f->test[i].yr);
-        r_t = gdate_to_timespec(gd);
-        g_assert_cmpint (r_t.tv_sec, ==, f->test[i].secs);
-        if (f->test[i].secs < INT64_MAX)
-        {
-            gd2 = timespec_to_gdate(r_t);
-            g_assert (g_date_compare (&gd2, &gd) == 0);
-        }
-    }
-    g_log_set_default_handler (hdlr, 0);
-}
-/* gnc_tm_get_day_start
-static void
-gnc_tm_get_day_start (struct tm *tm, time64 time_val)// Local: 3:0:0
-*/
-/* static void
-test_gnc_tm_get_day_start (void)
-{
-}*/
-/* gnc_tm_get_day_end
-static void
-gnc_tm_get_day_end (struct tm *tm, time64 time_val)// Local: 3:0:0
-*/
-/* static void
-test_gnc_tm_get_day_end (void)
-{
-}*/
-/* gnc_time64_get_day_start
-time64
-gnc_time64_get_day_start (time64 time_val)// C: 8 in 7  Local: 0:0:0
-*/
-
-static void
-tm_day_begin(struct tm *tm)
-{
-    tm->tm_hour = 0;
-    tm->tm_min = 0;
-    tm->tm_sec = 0;
-}
-
-static void
-test_gnc_time64_get_day_start (FixtureA *f, gconstpointer pData)
-{
-    struct tm tm;
-    time64 t_time, r_time;
-
-    gnc_localtime_r(&f->ts0.tv_sec, &tm);
-    tm_day_begin(&tm);
-    t_time = gnc_mktime(&tm);
-    r_time = gnc_time64_get_day_start (f->ts0.tv_sec);
-    g_assert_cmpint (t_time, ==, r_time);
-
-    gnc_localtime_r(&f->ts1.tv_sec, &tm);
-    tm_day_begin(&tm);
-    t_time = gnc_mktime(&tm);
-    r_time = gnc_time64_get_day_start (f->ts1.tv_sec);
-    g_assert_cmpint (t_time, ==, r_time);
-
-    gnc_localtime_r(&f->ts2.tv_sec, &tm);
-    tm_day_begin(&tm);
-    t_time = gnc_mktime(&tm);
-    r_time = gnc_time64_get_day_start (f->ts2.tv_sec);
-    g_assert_cmpint (t_time, ==, r_time);
-
-    gnc_localtime_r(&f->ts3.tv_sec, &tm);
-    tm_day_begin(&tm);
-    t_time = gnc_mktime(&tm);
-    r_time = gnc_time64_get_day_start (f->ts3.tv_sec);
-    g_assert_cmpint (t_time, ==, r_time);
-
-    gnc_localtime_r(&f->ts4.tv_sec, &tm);
-    tm_day_begin(&tm);
-    t_time = gnc_mktime(&tm);
-    r_time = gnc_time64_get_day_start (f->ts4.tv_sec);
-    g_assert_cmpint (t_time, ==, r_time);
-
-    gnc_localtime_r(&f->ts5.tv_sec, &tm);
-    tm_day_begin(&tm);
-    t_time = gnc_mktime(&tm);
-    r_time = gnc_time64_get_day_start (f->ts5.tv_sec);
-    g_assert_cmpint (t_time, ==, r_time);
-
- }
-/* gnc_time64_get_day_end
-time64
-gnc_time64_get_day_end (time64 time_val)// C: 12 in 8  Local: 0:0:0
-*/
-static void
-tm_day_end(struct tm *tm)
-{
-    tm->tm_hour = 23;
-    tm->tm_min = 59;
-    tm->tm_sec = 59;
-}
-
-static void
-test_gnc_time64_get_day_end (FixtureA *f, gconstpointer pData)
-{
-    struct tm tm;
-    time64 t_time, r_time;
-
-    gnc_localtime_r(&f->ts0.tv_sec, &tm);
-    tm_day_end(&tm);
-    t_time = gnc_mktime(&tm);
-    r_time = gnc_time64_get_day_end (f->ts0.tv_sec);
-    g_assert_cmpint (t_time, ==, r_time);
-
-    gnc_localtime_r(&f->ts1.tv_sec, &tm);
-    tm_day_end(&tm);
-    t_time = gnc_mktime(&tm);
-    r_time = gnc_time64_get_day_end (f->ts1.tv_sec);
-    g_assert_cmpint (t_time, ==, r_time);
-
-    gnc_localtime_r(&f->ts2.tv_sec, &tm);
-    tm_day_end(&tm);
-    t_time = gnc_mktime(&tm);
-    r_time = gnc_time64_get_day_end (f->ts2.tv_sec);
-    g_assert_cmpint (t_time, ==, r_time);
-
-    gnc_localtime_r(&f->ts3.tv_sec, &tm);
-    tm_day_end(&tm);
-    t_time = gnc_mktime(&tm);
-    r_time = gnc_time64_get_day_end (f->ts3.tv_sec);
-    g_assert_cmpint (t_time, ==, r_time);
-
-    gnc_localtime_r(&f->ts4.tv_sec, &tm);
-    tm_day_end(&tm);
-    t_time = gnc_mktime(&tm);
-    r_time = gnc_time64_get_day_end (f->ts4.tv_sec);
-    g_assert_cmpint (t_time, ==, r_time);
-
-    gnc_localtime_r(&f->ts5.tv_sec, &tm);
-    tm_day_end(&tm);
-    t_time = gnc_mktime(&tm);
-    r_time = gnc_time64_get_day_end (f->ts5.tv_sec);
-    g_assert_cmpint (t_time, ==, r_time);
-
-}
-/* gnc_tm_get_today_start
-void
-gnc_tm_get_today_start (struct tm *tm)// C: 3 in 3  Local: 0:0:0
-*/
-/* static void
-test_gnc_tm_get_today_start (void)
-{
-}*/
-// Not Used
-/* gnc_tm_get_today_end
-void
-gnc_tm_get_today_end (struct tm *tm)// Local: 0:0:0
-*/
-/* gnc_time64_get_today_start
-time64
-gnc_time64_get_today_start (void)// C: 7 in 4  Local: 0:0:0
-*/
-/* static void
-test_gnc_time64_get_today_start (void)
-{
-}*/
-/* gnc_time64_get_today_end
-time64
-gnc_time64_get_today_end (void)// C: 8 in 5  Local: 0:0:0
-*/
-/* static void
-test_gnc_time64_get_today_end (void)
-{
-}*/
-/* gnc_dow_abbrev
-void
-gnc_dow_abbrev(gchar *buf, int buf_len, int dow)// C: 4 in 2  Local: 0:0:0
-*/
-/* static void
-test_gnc_dow_abbrev (void)
-{
-}*/
-/* timespec_boxed_copy_func
-static gpointer
-timespec_boxed_copy_func( gpointer in_timespec )// Local: 0:1:0
-*/
-/* static void
-test_timespec_boxed_copy_func (void)
-{
-}*/
-/* timespec_boxed_free_func
-static void
-timespec_boxed_free_func( gpointer in_timespec )// Local: 0:1:0
-*/
-/* static void
-test_timespec_boxed_free_func (void)
-{
-}*/
-// Not Used
-/* timespec_get_type
-GType
-timespec_get_type( void )// Local: 0:0:0
-*/
-
-
-void
-test_suite_gnc_date (void)
-{
-    tz = g_time_zone_new_local();
-    GNC_TEST_ADD_FUNC (suitename, "gnc localtime", test_gnc_localtime);
-    GNC_TEST_ADD_FUNC (suitename, "gnc gmtime", test_gnc_gmtime);
-    GNC_TEST_ADD_FUNC (suitename, "gnc mktime", test_gnc_mktime);
-    GNC_TEST_ADD_FUNC (suitename, "gnc mktime normalization", test_gnc_mktime_normalization);
-    GNC_TEST_ADD_FUNC (suitename, "gnc ctime", test_gnc_ctime);
-    GNC_TEST_ADD_FUNC (suitename, "gnc time", test_gnc_time);
-
-    GNC_TEST_ADD_FUNC (suitename, "gnc date dateformat to string", test_gnc_date_dateformat_to_string);
-    GNC_TEST_ADD_FUNC (suitename, "gnc date string to dateformat", test_gnc_date_string_to_dateformat);
-    GNC_TEST_ADD_FUNC (suitename, "gnc date monthformat to string", test_gnc_date_monthformat_to_string);
-    GNC_TEST_ADD_FUNC (suitename, "gnc date string to monthformat", test_gnc_date_string_to_monthformat);
-    GNC_TEST_ADD_FUNC (suitename, "timespec normalize", test_timespec_normalize);
-    GNC_TEST_ADD_FUNC (suitename, "timespec equal", test_timespec_equal);
-    GNC_TEST_ADD_FUNC (suitename, "timespec cmp", test_timespec_cmp);
-    GNC_TEST_ADD_FUNC (suitename, "timespec diff", test_timespec_diff);
-    GNC_TEST_ADD_FUNC (suitename, "timespec abs", test_timespec_abs);
-    GNC_TEST_ADD_FUNC (suitename, "timespecCanonicalDayTime", test_timespecCanonicalDayTime);
-    GNC_TEST_ADD_FUNC (suitename, "date get last mday", test_gnc_date_get_last_mday);
-    GNC_TEST_ADD_FUNC (suitename, "qof date format set", test_qof_date_format_set);
-// GNC_TEST_ADD_FUNC (suitename, "qof date completion set", test_qof_date_completion_set);
-    GNC_TEST_ADD_FUNC (suitename, "qof print date dmy buff", test_qof_print_date_dmy_buff);
-    GNC_TEST_ADD_FUNC (suitename, "qof print date buff", test_qof_print_date_buff);
-    GNC_TEST_ADD_FUNC (suitename, "qof print gdate", test_qof_print_gdate);
-    GNC_TEST_ADD_FUNC (suitename, "qof print date", test_qof_print_date);
-    GNC_TEST_ADD_FUNC (suitename, "gnc print date", test_gnc_print_date);
-// GNC_TEST_ADD_FUNC (suitename, "floordiv", test_floordiv);
-// GNC_TEST_ADD_FUNC (suitename, "qof scan date internal", test_qof_scan_date_internal);
-    GNC_TEST_ADD_FUNC (suitename, "qof scan date", test_qof_scan_date);
-// GNC_TEST_ADD_FUNC (suitename, "dateSeparator", test_dateSeparator);
-// GNC_TEST_ADD_FUNC (suitename, "qof time format from utf8", test_qof_time_format_from_utf8);
-// GNC_TEST_ADD_FUNC (suitename, "qof formatted time to utf8", test_qof_formatted_time_to_utf8);
-// GNC_TEST_ADD_FUNC (suitename, "qof format time", test_qof_format_time);
-// GNC_TEST_ADD_FUNC (suitename, "qof strftime", test_qof_strftime);
-    GNC_TEST_ADD_FUNC (suitename, "gnc_date_timestamp", test_gnc_date_timestamp);
-    GNC_TEST_ADD (suitename, "gnc iso8601 to timespec gmt", FixtureA, NULL, setup, test_gnc_iso8601_to_timespec_gmt, NULL);
-    GNC_TEST_ADD (suitename, "gnc timespec to iso8601 buff", FixtureA, NULL, setup, test_gnc_timespec_to_iso8601_buff, NULL);
-    GNC_TEST_ADD (suitename, "gnc timespec2dmy", FixtureA, NULL, setup, test_gnc_timespec2dmy, NULL);
-// GNC_TEST_ADD_FUNC (suitename, "gnc dmy2timespec internal", test_gnc_dmy2timespec_internal);
-
-    GNC_TEST_ADD (suitename, "gnc dmy2timespec", FixtureB, NULL, setup_begin, test_gnc_dmy2timespec, NULL);
-    GNC_TEST_ADD (suitename, "gnc dmy2timespec end", FixtureB, NULL, setup_end, test_gnc_dmy2timespec_end, NULL);
-    GNC_TEST_ADD (suitename, "gnc dmy2timespec Neutral", FixtureB, NULL, setup_neutral, test_gnc_dmy2timespec_neutral, NULL);
-// GNC_TEST_ADD_FUNC (suitename, "gnc timezone", test_gnc_timezone);
-    GNC_TEST_ADD_FUNC (suitename, "timespecFromTime64", test_timespecFromTime64);
-// GNC_TEST_ADD_FUNC (suitename, "timespec now", test_timespec_now);
-// GNC_TEST_ADD_FUNC (suitename, "timespecToTime t", test_timespecTotime64);
-    GNC_TEST_ADD (suitename, "timespec to gdate", FixtureA, NULL, setup, test_timespec_to_gdate, NULL);
-    GNC_TEST_ADD (suitename, "gdate to timespec", FixtureB, NULL, setup_neutral, test_gdate_to_timespec, NULL);
-// GNC_TEST_ADD_FUNC (suitename, "gnc tm get day start", test_gnc_tm_get_day_start);
-// GNC_TEST_ADD_FUNC (suitename, "gnc tm get day end", test_gnc_tm_get_day_end);
-    GNC_TEST_ADD (suitename, "gnc time64 get day start", FixtureA, NULL, setup, test_gnc_time64_get_day_start, NULL);
-    GNC_TEST_ADD (suitename, "gnc time64 get day end", FixtureA, NULL, setup, test_gnc_time64_get_day_end, NULL);
-// GNC_TEST_ADD_FUNC (suitename, "gnc tm get today start", test_gnc_tm_get_today_start);
-// GNC_TEST_ADD_FUNC (suitename, "gnc timet get today start", test_gnc_time64_get_today_start);
-// GNC_TEST_ADD_FUNC (suitename, "gnc timet get today end", test_gnc_time64_get_today_end);
-// GNC_TEST_ADD_FUNC (suitename, "gnc dow abbrev", test_gnc_dow_abbrev);
-// GNC_TEST_ADD_FUNC (suitename, "timespec boxed copy func", test_timespec_boxed_copy_func);
-// GNC_TEST_ADD_FUNC (suitename, "timespec boxed free func", test_timespec_boxed_free_func);
-    g_time_zone_unref(tz);
-}
diff --git a/src/gnc-module/CMakeLists.txt b/src/gnc-module/CMakeLists.txt
deleted file mode 100644
index ce06e3e..0000000
--- a/src/gnc-module/CMakeLists.txt
+++ /dev/null
@@ -1,69 +0,0 @@
-# CMakeLists.txt for src/gnc-module
-ADD_SUBDIRECTORY(test)
-
-IF (BUILDING_FROM_VCS)
-  # Command to generate the swig-gnc-module.c wrapper file
-  SET (SWIG_GNC_MODULE_C ${CMAKE_CURRENT_BINARY_DIR}/swig-gnc-module.c)
-  GNC_ADD_SWIG_COMMAND (swig-gnc-module-c ${SWIG_GNC_MODULE_C} ${CMAKE_CURRENT_SOURCE_DIR}/gnc-module.i)
-ELSE()
-  SET (SWIG_GNC_MODULE_C swig-gnc-module.c)
-ENDIF()
-
-SET (gnc_module_SOURCES gnc-module.c)
-
-# Add dependency on config.h
-SET_SOURCE_FILES_PROPERTIES (${gnc_module_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
-
-SET (gnc_module_HEADERS
-  gnc-module.h
-  gnc-module-api.h
-)
-
-ADD_LIBRARY	(gnc-module
-  ${gnc_module_SOURCES}
-  ${gnc_module_HEADERS}
-  ${SWIG_GNC_MODULE_C}
-)
-
-TARGET_LINK_LIBRARIES(gnc-module ${GUILE_LDFLAGS} ${GMODULE_LDFLAGS} ${GLIB2_LDFLAGS})
-
-TARGET_COMPILE_DEFINITIONS (gnc-module PRIVATE -DG_LOG_DOMAIN=\"gnc.module\")
-
-TARGET_INCLUDE_DIRECTORIES (gnc-module
-    PRIVATE ${GUILE_INCLUDE_DIRS}
-    PUBLIC  ${CMAKE_CURRENT_SOURCE_DIR}
-            ${CMAKE_SOURCE_DIR}/src
-            ${CMAKE_BINARY_DIR}/src # for config.h
-            ${GLIB2_INCLUDE_DIRS}
-)
-
-INSTALL(TARGETS gnc-module
-  LIBRARY DESTINATION lib
-  ARCHIVE DESTINATION lib
-  RUNTIME DESTINATION bin)
-
-INSTALL(FILES ${gnc_module_HEADERS} DESTINATION include/gnucash)
-
-# --- Compile Scheme file(s) ---
-
-SET (gnc_module_SCHEME gnc-module.scm)
-
-SET(GUILE_OUTPUT_DIR   gnucash)
-SET(GUILE_MODULES      "")
-SET(GUILE_LOAD_DIRS    "")
-SET(GUILE_LIBRARY_DIRS "")
-SET(GUILE_DEPENDS      gnc-module)
-
-GNC_ADD_SCHEME_TARGETS(scm-gnc-module
-  "${gnc_module_SCHEME}"
-  ${GUILE_OUTPUT_DIR} 
-  "${GUILE_MODULES}"
-  "${GUILE_LOAD_DIRS}"
-  "${GUILE_LIBRARY_DIRS}"
-  "${GUILE_DEPENDS}"
-  FALSE
-)
-
-SET_LOCAL_DIST(gnc_module_DIST_local CMakeLists.txt Makefile.am ${gnc_module_SOURCES} ${gnc_module_HEADERS}
-        gnc-module.i gnc-module.scm README)
-SET(gnc_module_DIST ${gnc_module_DIST_local} ${test_gnc_module_DIST} PARENT_SCOPE)
diff --git a/src/gnc-module/Makefile.am b/src/gnc-module/Makefile.am
deleted file mode 100644
index cecaed5..0000000
--- a/src/gnc-module/Makefile.am
+++ /dev/null
@@ -1,90 +0,0 @@
-# No SUBDIR variable here...
-# The 'test' subdir is added via src/Makefile to handle
-# it's dependency on src/engine
-
-AM_CPPFLAGS = \
-   -I${top_srcdir}/lib/libc \
-   -I${top_srcdir}/src \
-   -I${top_srcdir}/src/core-utils \
-   ${GLIB_CFLAGS} \
-   ${GUILE_CFLAGS}
-
-lib_LTLIBRARIES = libgnc-module.la
-
-libgnc_module_la_SOURCES = gnc-module.c swig-gnc-module.c
-
-libgnc_module_la_LIBADD = \
-  ../core-utils/libgnc-core-utils.la \
-  ${top_builddir}/lib/libc/libc-missing.la \
-  ${GLIB_LIBS} \
-  ${GUILE_LIBS}
-
-gncscmmoddir = ${GNC_SCM_INSTALL_DIR}/gnucash
-gncscmmod_DATA = gnc-module.scm
-
-gncincludedir = ${GNC_INCLUDE_DIR}
-gncinclude_HEADERS = \
-  gnc-module-api.h \
-  gnc-module.h
-
-noinst_DATA = .scm-links
-
-if BUILDING_FROM_VCS
-swig-gnc-module.c: gnc-module.i ${top_srcdir}/src/base-typemaps.i
-	$(SWIG) -guile $(SWIG_ARGS) -Linkage module \
-	-I${top_srcdir}/src -o $@ $<
-if ! OS_WIN32
-if ! SWIG_DIST_FAIL
-	if ! `grep "define scm_from_utf8_string" $@ > /dev/null 2>&1`; then \
-	  patch $@ $(top_srcdir)/src/swig-utf8.patch; \
-	fi
-endif
-endif
-endif
-
-EXTRA_DIST = \
-  ${gncscmmod_DATA} \
-  gnc-module.i \
-  CMakeLists.txt
-
-if GNUCASH_SEPARATE_BUILDDIR
-#For executing test cases
-SCM_FILE_LINKS = ${gncscmmod_DATA}
-endif
-
-.scm-links: 
-	$(RM) -rf gnucash
-	mkdir -p  gnucash
-if GNUCASH_SEPARATE_BUILDDIR
-	for X in ${SCM_FILE_LINKS} ; do \
-	  $(LN_S) -f ${srcdir}/$$X . ; \
-	done
-endif
-	( cd gnucash; for A in $(gncscmmod_DATA) ; do $(LN_S) -f ../$$A . ; done )
-if ! OS_WIN32
-# Windows knows no "ln -s" but uses "cp": must copy every time (see bug #566567).
-	touch .scm-links
-endif
-
-if GNC_HAVE_GUILE_2
-GUILE_COMPILE_ENV = \
-  --library-dir    ${top_builddir}/src/gnc-module \
-  --library-dir    ${top_builddir}/src/core-utils
-
-%.go : %.scm .scm-links $(lib_LTLIBRARIES)
-	GNC_UNINSTALLED=yes \
-	GNC_BUILDDIR=${top_builddir} \
-	$(shell ${abs_top_srcdir}/src/gnc-test-env.pl --noexports ${GUILE_COMPILE_ENV}) \
-	$(GUILD) compile -o $@ $<
-
-gncscmmodcachedir = ${pkglibdir}/scm/ccache/@GUILE_EFFECTIVE_VERSION@/gnucash
-gncscmmodcache_DATA = $(gncscmmod_DATA:.scm=.go)
-endif
-
-clean-local:
-	rm -rf gnucash
-
-CLEANFILES = .scm-links ${SCM_FILE_LINKS} ${gncscmmodcache_DATA}
-MAINTAINERCLEANFILES = swig-gnc-module.c
-
-AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.module\"
diff --git a/src/gnc-module/test/CMakeLists.txt b/src/gnc-module/test/CMakeLists.txt
deleted file mode 100644
index 522f433..0000000
--- a/src/gnc-module/test/CMakeLists.txt
+++ /dev/null
@@ -1,114 +0,0 @@
-
-ADD_SUBDIRECTORY(mod-foo)
-ADD_SUBDIRECTORY(mod-bar)
-ADD_SUBDIRECTORY(mod-baz)
-ADD_SUBDIRECTORY(misc-mods)
-
-SET(GNC_MODULE_TEST_INCLUDE_DIRS
-  ${CMAKE_BINARY_DIR}/src # for config.h
-  ${CMAKE_SOURCE_DIR}/src/gnc-module
-  ${CMAKE_SOURCE_DIR}/src/test-core
-  ${GLIB2_INCLUDE_DIRS}
-  ${GUILE_INCLUDE_DIRS}
-)
-
-SET(GNC_MODULE_TEST_LIBS gnc-module test-core)
-
-MACRO(ADD_GNC_MODULE_TEST _TARGET _SOURCE_FILES)
-  GNC_ADD_TEST(${_TARGET} "${_SOURCE_FILES}" GNC_MODULE_TEST_INCLUDE_DIRS GNC_MODULE_TEST_LIBS)
-ENDMACRO()
-
-FUNCTION(RUN_TEST_WITH_GUILE _TARGET _SOURCE_FILE)
-  GET_GUILE_ENV()
-  SET(CMAKE_COMMAND_TMP "")
-  IF (${CMAKE_VERSION} VERSION_GREATER 3.1)
-    SET(CMAKE_COMMAND_TMP ${CMAKE_COMMAND} -E env "${GUILE_ENV}")
-  ENDIF()
-  ADD_TEST(NAME ${_TARGET}
-    COMMAND ${CMAKE_COMMAND_TMP}
-      ${GUILE_EXECUTABLE} -s ${_SOURCE_FILE}
-  )
-
-  SET_TESTS_PROPERTIES(${_TARGET} PROPERTIES ENVIRONMENT "${GUILE_ENV};${ARGN}")
-ENDFUNCTION()
-
-GNC_ADD_TEST_WITH_GUILE(test-load-c test-load-c.c GNC_MODULE_TEST_INCLUDE_DIRS GNC_MODULE_TEST_LIBS)
-
-RUN_TEST_WITH_GUILE(test-load-scm ${CMAKE_CURRENT_SOURCE_DIR}/test-load-scm.in)
-
-RUN_TEST_WITH_GUILE(test-load-deps ${CMAKE_CURRENT_SOURCE_DIR}/test-load-deps.in)
-
-RUN_TEST_WITH_GUILE(test-scm-init ${CMAKE_CURRENT_SOURCE_DIR}/test-scm-init.in)
-
-RUN_TEST_WITH_GUILE(test-scm-multi ${CMAKE_CURRENT_SOURCE_DIR}/test-scm-multi.in)
-
-RUN_TEST_WITH_GUILE(test-scm-dynload ${CMAKE_CURRENT_SOURCE_DIR}/test-scm-dynload.in)
-
-GNC_ADD_TEST_WITH_GUILE(test-modsysver test-modsysver.c
-  GNC_MODULE_TEST_INCLUDE_DIRS GNC_MODULE_TEST_LIBS
-)
-GNC_ADD_TEST_WITH_GUILE(test-incompatdep test-incompatdep.c
-  GNC_MODULE_TEST_INCLUDE_DIRS GNC_MODULE_TEST_LIBS
-)
-GNC_ADD_TEST_WITH_GUILE(test-agedver test-agedver.c
-  GNC_MODULE_TEST_INCLUDE_DIRS GNC_MODULE_TEST_LIBS
-)
-
-SET(_LIBDIR ${CMAKE_BINARY_DIR}/lib)
-IF (WIN32)
-  SET(_LIBDIR ${CMAKE_BINARY_DIR}/bin)
-ENDIF()
-GNC_ADD_TEST(test-dynload test-dynload.c
-  GNC_MODULE_TEST_INCLUDE_DIRS GNC_MODULE_TEST_LIBS
-  LIBDIR=${_LIBDIR}
-)
-
-SET(GUILE ${GUILE_EXECUTABLE})
-CONFIGURE_FILE(test-gwrapped-c.in test-gwrapped-c @ONLY)
-CONFIGURE_FILE(test-scm-module.in test-scm-module @ONLY)
-CONFIGURE_FILE(test-load-deps.in test-load-deps @ONLY)
-CONFIGURE_FILE(test-load-scm.in test-load-scm @ONLY)
-CONFIGURE_FILE(test-scm-dynload.in test-scm-dynload @ONLY)
-CONFIGURE_FILE(test-scm-init.in test-scm-init @ONLY)
-CONFIGURE_FILE(test-scm-multi.in test-scm-multi @ONLY)
-
-FUNCTION(RUN_GUILE_SHELL_TEST _TARGET _SOURCE_FILE)
-  GET_GUILE_ENV()
-  SET(CMAKE_COMMAND_TMP "")
-  IF (${CMAKE_VERSION} VERSION_GREATER 3.1)
-    SET(CMAKE_COMMAND_TMP ${CMAKE_COMMAND} -E env "${GUILE_ENV}")
-  ENDIF()
-  ADD_TEST(NAME ${_TARGET}
-    COMMAND ${CMAKE_COMMAND_TMP}
-      ${SHELL} ${_SOURCE_FILE}
-  )
-  SET_TESTS_PROPERTIES(${_TARGET} PROPERTIES ENVIRONMENT "${GUILE_ENV}")
-ENDFUNCTION()
-
-RUN_GUILE_SHELL_TEST(test-gwrapped-c ${CMAKE_CURRENT_BINARY_DIR}/test-gwrapped-c)
-
-RUN_GUILE_SHELL_TEST(test-scm-module ${CMAKE_CURRENT_BINARY_DIR}/test-scm-module)
-
-SET(test_gnc_module_SOURCE_DIST
-  test-agedver.c
-  test-dynload.c
-  test-incompatdep.c
-  test-load-c.c
-  test-modsysver.c
-)
-
-SET(test_gnc_module_EXTRA_DIST
-  README
-  test-gwrapped-c.in
-  test-load-deps.in
-  test-load-scm.in
-  test-scm-dynload.in
-  test-scm-init.in
-  test-scm-module.in
-  test-scm-multi.in
-)
-
-SET_LOCAL_DIST(test_gnc_module_DIST_local CMakeLists.txt Makefile.am README ${test_gnc_module_SOURCE_DIST} ${test_gnc_module_EXTRA_DIST})
-
-SET(test_gnc_module_DIST ${test_gnc_module_DIST_local} ${misc_mods_DIST}
-                         ${mod_bar_DIST} ${mod_baz_DIST} ${mod_foo_DIST} PARENT_SCOPE)
diff --git a/src/gnc-module/test/Makefile.am b/src/gnc-module/test/Makefile.am
deleted file mode 100644
index d849762..0000000
--- a/src/gnc-module/test/Makefile.am
+++ /dev/null
@@ -1,72 +0,0 @@
-SUBDIRS = mod-foo mod-bar mod-baz misc-mods
-
-LDADD = \
-  ${top_builddir}/src/test-core/libtest-core.la \
-  ../libgnc-module.la ${GLIB_LIBS} ${GUILE_LIBS}
-
-AM_CPPFLAGS = \
-  -I${top_srcdir}/src \
-  -I${top_srcdir}/src/gnc-module \
-  -I${top_srcdir}/src/test-core \
-  -I${top_srcdir}/src/engine \
-  ${GUILE_CFLAGS} \
-  ${GLIB_CFLAGS}
-
-TESTS = \
-  test-load-c \
-  test-load-scm \
-  test-gwrapped-c \
-  test-scm-module \
-  test-scm-multi \
-  test-load-deps \
-  test-modsysver \
-  test-incompatdep \
-  test-agedver \
-  test-dynload \
-  test-scm-dynload \
-  test-scm-init
-
-GNC_TEST_DEPS = \
-  --gnc-module-dir ${top_builddir}/src/gnc-module \
-  --gnc-module-dir ${top_builddir}/src/gnc-module/test/mod-foo \
-  --gnc-module-dir ${top_builddir}/src/gnc-module/test/mod-bar \
-  --gnc-module-dir ${top_builddir}/src/gnc-module/test/mod-baz \
-  --gnc-module-dir ${top_builddir}/src/gnc-module/test/misc-mods \
-  --guile-load-dir ${top_builddir}/src/test-core \
-  --guile-load-dir ${top_builddir}/src/gnc-module \
-  --guile-load-dir ${top_srcdir}/src/gnc-module/test/mod-foo \
-  --guile-load-dir ${top_srcdir}/src/gnc-module/test/mod-baz \
-  --guile-load-dir ${top_srcdir}/src/gnc-module/test/mod-bar \
-  --library-dir    ${top_builddir}/src/core-utils \
-  --library-dir    ${top_builddir}/src/test-core \
-  --library-dir    ${top_builddir}/src/gnc-module \
-  --library-dir    ${top_builddir}/src/gnc-module/test/mod-foo \
-  --library-dir    ${top_builddir}/src/gnc-module/test/mod-bar \
-  --library-dir    ${top_builddir}/src/gnc-module/test/mod-baz
-
-TESTS_ENVIRONMENT = \
-  GUILE_WARN_DEPRECATED=no \
-  GUILE="${GUILE}" \
-  $(shell ${abs_top_srcdir}/src/gnc-test-env.pl --noexports ${GNC_TEST_DEPS})
-
-check_PROGRAMS = \
-  test-load-c \
-  test-modsysver \
-  test-incompatdep \
-  test-agedver \
-  test-dynload
-
-test_dynload_LDFLAGS = ${GUILE_LIBS}
-
-EXTRA_DIST = \
-  test-gwrapped-c \
-  test-load-deps \
-  test-load-scm \
-  test-scm-dynload \
-  test-scm-init \
-  test-scm-module \
-  test-scm-multi \
-  CMakeLists.txt
-
-foo:
-	${TESTS_ENVIRONMENT} strace -f -o xxx ./test-load-c
diff --git a/src/gnc-module/test/misc-mods/CMakeLists.txt b/src/gnc-module/test/misc-mods/CMakeLists.txt
deleted file mode 100644
index 973ee9b..0000000
--- a/src/gnc-module/test/misc-mods/CMakeLists.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-
-INCLUDE_DIRECTORIES(
-  ${CMAKE_SOURCE_DIR}/src/gnc-module
-  ${GLIB2_INCLUDE_DIRS}
-)
-
-ADD_LIBRARY(gncmod_agedver EXCLUDE_FROM_ALL agedver.c)
-TARGET_LINK_LIBRARIES(gncmod_agedver ${GLIB2_LDFLAGS})
-
-ADD_LIBRARY(gncmod_futuremodsys  EXCLUDE_FROM_ALL futuremodsys.c)
-TARGET_LINK_LIBRARIES(gncmod_futuremodsys ${GLIB2_LDFLAGS})
-
-ADD_LIBRARY(gncmod_incompatdep  EXCLUDE_FROM_ALL incompatdep.c)
-TARGET_LINK_LIBRARIES(gncmod_incompatdep gnc-module ${GLIB2_LDFLAGS})
-
-SET_DIST_LIST(misc_mods_DIST CMakeLists.txt Makefile.am agedver.c futuremodsys.c incompatdep.c)
\ No newline at end of file
diff --git a/src/gnc-module/test/misc-mods/Makefile.am b/src/gnc-module/test/misc-mods/Makefile.am
deleted file mode 100644
index 0fc3312..0000000
--- a/src/gnc-module/test/misc-mods/Makefile.am
+++ /dev/null
@@ -1,30 +0,0 @@
-AM_CPPFLAGS = \
-  -I${top_srcdir}/src \
-  -I${top_srcdir}/src/gnc-module \
-  ${GLIB_CFLAGS} \
-  ${GUILE_CFLAGS}
-
-LDADD = -L../.. -L../../.libs
-
-PWD := $(shell pwd)
-check_LTLIBRARIES=libgncmod_futuremodsys.la libgncmod_incompatdep.la libgncmod_agedver.la
-
-libgncmod_futuremodsys_la_SOURCES=futuremodsys.c
-libgncmod_futuremodsys_la_LDFLAGS=-rpath ${PWD} -avoid-version -module
-libgncmod_futuremodsys_la_LIBADD = \
-  $(GLIB_LIBS)
-
-libgncmod_incompatdep_la_SOURCES=incompatdep.c
-libgncmod_incompatdep_la_LDFLAGS=--rpath ${PWD} -avoid-version -module
-libgncmod_incompatdep_la_LIBADD = \
-  ../../libgnc-module.la \
-  $(GLIB_LIBS)
-
-libgncmod_agedver_la_SOURCES=agedver.c
-libgncmod_agedver_la_LDFLAGS=-rpath ${PWD} -avoid-version -module
-libgncmod_agedver_la_LIBADD = \
-  $(GLIB_LIBS)
-
-CLEANFILES = *.so* *.a
-
-EXTRA_DIST = CMakeLists.txt
diff --git a/src/gnc-module/test/mod-bar/CMakeLists.txt b/src/gnc-module/test/mod-bar/CMakeLists.txt
deleted file mode 100644
index 47108b6..0000000
--- a/src/gnc-module/test/mod-bar/CMakeLists.txt
+++ /dev/null
@@ -1,24 +0,0 @@
-
-IF (BUILDING_FROM_VCS)
-  SET (SWIG_BAR_C ${CMAKE_CURRENT_BINARY_DIR}/swig-bar.c)
-  GNC_ADD_SWIG_COMMAND (swig-bar-c ${SWIG_BAR_C} ${CMAKE_CURRENT_SOURCE_DIR}/bar.i bar.h)
-ELSE()
-  SET (SWIG_BAR_C ${CMAKE_CURRENT_SOURCE_DIR}/swig-bar.c)
-ENDIF()
-
-ADD_LIBRARY(bar EXCLUDE_FROM_ALL bar.c bar.h)
-ADD_LIBRARY(gncmodbar EXCLUDE_FROM_ALL gnc-mod-bar.c)
-SET_SOURCE_FILES_PROPERTIES (gnc-mod-bar.c PROPERTY OBJECT_DEPENDS ${SWIG_BAR_C})
-
-TARGET_LINK_LIBRARIES(gncmodbar bar gnc-module)
-TARGET_INCLUDE_DIRECTORIES(gncmodbar PRIVATE
-  ${CMAKE_BINARY_DIR}/src
-  ${CMAKE_CURRENT_SOURCE_DIR}
-  ${CMAKE_CURRENT_BINARY_DIR}
-  ${CMAKE_SOURCE_DIR}/src
-  ${CMAKE_SOURCE_DIR}/src/gnc-module
-  ${GLIB2_INCLUDE_DIRS}
-  ${GUILE_INCLUDE_DIRS}
-)
-
-SET_DIST_LIST(mod_bar_DIST CMakeLists.txt Makefile.am bar.c gnucash/bar.scm bar.h bar.i gnc-mod-bar.c)
\ No newline at end of file
diff --git a/src/gnc-module/test/mod-bar/Makefile.am b/src/gnc-module/test/mod-bar/Makefile.am
deleted file mode 100644
index d0e38f3..0000000
--- a/src/gnc-module/test/mod-bar/Makefile.am
+++ /dev/null
@@ -1,43 +0,0 @@
-AM_CPPFLAGS = \
-  -I${top_srcdir}/src \
-  -I${top_srcdir}/src/gnc-module \
-  ${GUILE_CFLAGS} \
-  ${GLIB_CFLAGS}
-
-PWD := $(shell pwd)
-check_LTLIBRARIES = libbar.la libgncmodbar.la
-
-libbar_la_SOURCES = bar.c
-libbar_la_LDFLAGS = -rpath ${PWD}
-
-# Make swig-bar.c for dist. It is an automatic dependency
-# of gnc-mod-bar.c
-noinst_HEADERS = \
-  bar.h \
-  swig-bar.c
-
-libgncmodbar_la_SOURCES=gnc-mod-bar.c
-libgncmodbar_la_LDFLAGS=-rpath ${PWD} -avoid-version
-libgncmodbar_la_LIBADD=libbar.la \
-  $(GUILE_LIBS) \
-  $(GLIB_LIBS)
-
-if BUILDING_FROM_VCS
-swig-bar.c: bar.i
-	$(SWIG) -guile $(SWIG_ARGS) -Linkage module -o $@ $<
-if ! OS_WIN32
-if ! SWIG_DIST_FAIL
-	if ! `grep "define scm_from_utf8_string" $@ > /dev/null 2>&1`; then \
-	  patch $@ $(top_srcdir)/src/swig-utf8.patch; \
-	fi
-endif
-endif
-endif
-
-EXTRA_DIST = \
-  bar.i \
-  gnucash/bar.scm \
-  CMakeLists.txt
-
-BUILT_SOURCES = swig-bar.c
-MAINTAINERCLEANFILES = swig-bar.c
diff --git a/src/gnc-module/test/mod-baz/CMakeLists.txt b/src/gnc-module/test/mod-baz/CMakeLists.txt
deleted file mode 100644
index 1dc2dc7..0000000
--- a/src/gnc-module/test/mod-baz/CMakeLists.txt
+++ /dev/null
@@ -1,30 +0,0 @@
-
-IF (BUILDING_FROM_VCS)
-  SET (SWIG_BAZ_C ${CMAKE_CURRENT_BINARY_DIR}/swig-baz.c)
-  GNC_ADD_SWIG_COMMAND (swig-baz-c ${SWIG_BAZ_C} ${CMAKE_CURRENT_SOURCE_DIR}/baz.i baz.h)
-ELSE()
-  SET (SWIG_BAZ_C ${CMAKE_CURRENT_SOURCE_DIR}/swig-baz.c)
-ENDIF()
-
-ADD_LIBRARY(baz EXCLUDE_FROM_ALL baz.c baz.h)
-TARGET_INCLUDE_DIRECTORIES(baz PRIVATE
-  ${CMAKE_SOURCE_DIR}/src/gnc-module/test/mod-foo
-)
-TARGET_LINK_LIBRARIES(baz foo)
-
-
-ADD_LIBRARY(gncmodbaz EXCLUDE_FROM_ALL gnc-mod-baz.c)
-SET_SOURCE_FILES_PROPERTIES (gnc-mod-baz.c PROPERTY OBJECT_DEPENDS ${SWIG_BAZ_C})
-
-TARGET_LINK_LIBRARIES(gncmodbaz baz gnc-module)
-TARGET_INCLUDE_DIRECTORIES(gncmodbaz PRIVATE
-  ${CMAKE_BINARY_DIR}/src
-  ${CMAKE_CURRENT_SOURCE_DIR}
-  ${CMAKE_CURRENT_BINARY_DIR}
-  ${CMAKE_SOURCE_DIR}/src
-  ${CMAKE_SOURCE_DIR}/src/gnc-module
-  ${GLIB2_INCLUDE_DIRS}
-  ${GUILE_INCLUDE_DIRS}
-)
-
-SET_DIST_LIST(mod_baz_DIST CMakeLists.txt Makefile.am baz.c gnucash/baz.scm baz.h baz.i gnc-mod-baz.c)
\ No newline at end of file
diff --git a/src/gnc-module/test/mod-baz/Makefile.am b/src/gnc-module/test/mod-baz/Makefile.am
deleted file mode 100644
index 853ec3e..0000000
--- a/src/gnc-module/test/mod-baz/Makefile.am
+++ /dev/null
@@ -1,47 +0,0 @@
-AM_CPPFLAGS = \
-  -I${top_srcdir}/src \
-  -I${top_srcdir}/src/gnc-module \
-  -I${top_srcdir}/src/gnc-module/test/mod-foo \
-  ${GLIB_CFLAGS} \
-  ${GUILE_CFLAGS}
-
-PWD := $(shell pwd)
-check_LTLIBRARIES = libbaz.la libgncmodbaz.la
-
-libbaz_la_SOURCES = baz.c
-libbaz_la_LDFLAGS = -rpath ${PWD}
-libbaz_la_LIBADD = ../mod-foo/libfoo.la
-
-# Make swig-baz.c for dist. It is an automatic dependency
-# of gnc-mod-baz.c
-noinst_HEADERS = \
-  baz.h \
-  swig-baz.c
-
-libgncmodbaz_la_SOURCES = gnc-mod-baz.c
-libgncmodbaz_la_LDFLAGS = -rpath ${PWD} -avoid-version
-libgncmodbaz_la_LIBADD = \
-  libbaz.la \
-  ../../libgnc-module.la \
-  $(GUILE_LIBS) \
-  $(GLIB_LIBS)
-
-if BUILDING_FROM_VCS
-swig-baz.c: baz.i
-	$(SWIG) -guile $(SWIG_ARGS) -Linkage module -o $@ $<
-if ! OS_WIN32
-if ! SWIG_DIST_FAIL
-	if ! `grep "define scm_from_utf8_string" $@ > /dev/null 2>&1`; then \
-	  patch $@ $(top_srcdir)/src/swig-utf8.patch; \
-	fi
-endif
-endif
-endif
-
-EXTRA_DIST = \
-  baz.i \
-  gnucash/baz.scm \
-  CMakeLists.txt
-
-BUILT_SOURCES = swig-baz.c
-MAINTAINERCLEANFILES = swig-baz.c
diff --git a/src/gnc-module/test/mod-foo/CMakeLists.txt b/src/gnc-module/test/mod-foo/CMakeLists.txt
deleted file mode 100644
index fcd78f8..0000000
--- a/src/gnc-module/test/mod-foo/CMakeLists.txt
+++ /dev/null
@@ -1,24 +0,0 @@
-
-IF (BUILDING_FROM_VCS)
-  SET (SWIG_FOO_C ${CMAKE_CURRENT_BINARY_DIR}/swig-foo.c)
-  GNC_ADD_SWIG_COMMAND (swig-foo-c ${SWIG_FOO_C} ${CMAKE_CURRENT_SOURCE_DIR}/foo.i foo.h)
-ELSE()
-  SET (SWIG_FOO_C ${CMAKE_CURRENT_SOURCE_DIR}/swig-foo.c)
-ENDIF()
-
-ADD_LIBRARY(foo EXCLUDE_FROM_ALL foo.c foo.h)
-ADD_LIBRARY(gncmodfoo EXCLUDE_FROM_ALL gnc-mod-foo.c)
-SET_SOURCE_FILES_PROPERTIES (gnc-mod-foo.c PROPERTY OBJECT_DEPENDS ${SWIG_FOO_C})
-
-TARGET_LINK_LIBRARIES(gncmodfoo foo gnc-module)
-TARGET_INCLUDE_DIRECTORIES(gncmodfoo PRIVATE
-  ${CMAKE_BINARY_DIR}/src
-  ${CMAKE_CURRENT_SOURCE_DIR}
-  ${CMAKE_CURRENT_BINARY_DIR}
-  ${CMAKE_SOURCE_DIR}/src
-  ${CMAKE_SOURCE_DIR}/src/gnc-module
-  ${GLIB2_INCLUDE_DIRS}
-  ${GUILE_INCLUDE_DIRS}
-)
-
-SET_DIST_LIST(mod_foo_DIST CMakeLists.txt Makefile.am foo.i gnucash/foo.scm foo.c foo.h gnc-mod-foo.c)
\ No newline at end of file
diff --git a/src/gnc-module/test/mod-foo/Makefile.am b/src/gnc-module/test/mod-foo/Makefile.am
deleted file mode 100644
index 401eb21..0000000
--- a/src/gnc-module/test/mod-foo/Makefile.am
+++ /dev/null
@@ -1,44 +0,0 @@
-AM_CPPFLAGS=\
-  -I${top_srcdir}/src \
-  -I${top_srcdir}/src/gnc-module \
-  ${GUILE_CFLAGS} \
-  ${GLIB_CFLAGS}
-
-PWD := $(shell pwd)
-check_LTLIBRARIES=libfoo.la libgncmodfoo.la
-
-libfoo_la_SOURCES = foo.c
-libfoo_la_LDFLAGS = -rpath ${PWD}
-
-# Make swig-foo.c for dist. It is an automatic dependency
-# of gnc-mod-foo.c
-noinst_HEADERS = \
-  foo.h \
-  swig-foo.c
-
-libgncmodfoo_la_SOURCES = gnc-mod-foo.c
-libgncmodfoo_la_LDFLAGS = -rpath ${PWD} -avoid-version
-libgncmodfoo_la_LIBADD = \
-  libfoo.la \
-  $(GUILE_LIBS) \
-  $(GLIB_LIBS)
-
-EXTRA_DIST = \
-  foo.i \
-  gnucash/foo.scm \
-  CMakeLists.txt
-
-if BUILDING_FROM_VCS
-swig-foo.c: foo.i
-	$(SWIG) -guile $(SWIG_ARGS) -Linkage module -o $@ $<
-if ! OS_WIN32
-if ! SWIG_DIST_FAIL
-	if ! `grep "define scm_from_utf8_string" $@ > /dev/null 2>&1`; then \
-	  patch $@ $(top_srcdir)/src/swig-utf8.patch; \
-	fi
-endif
-endif
-endif
-
-BUILT_SOURCES = swig-foo.c
-MAINTAINERCLEANFILES = swig-foo.c
diff --git a/src/gnc-module/test/test-agedver.c b/src/gnc-module/test/test-agedver.c
deleted file mode 100644
index 75a2ac2..0000000
--- a/src/gnc-module/test/test-agedver.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/********************************************************************\
- * 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 at gnu.org                   *
- *                                                                  *
-\********************************************************************/
-
-#include "config.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <libguile.h>
-
-#include "gnc-module.h"
-#include <unittest-support.h>
-
-static void
-guile_main(void *closure, int argc, char ** argv)
-{
-    GNCModule foo;
-    gchar *msg = "Module '../../../src/gnc-module/test/misc-mods/.libs/libgncmod_futuremodsys.so' requires newer module system\n";
-    gchar *logdomain = "gnc.module";
-    guint loglevel = G_LOG_LEVEL_WARNING;
-    TestErrorStruct check = { loglevel, logdomain, msg };
-    g_log_set_handler (logdomain, loglevel,
-                       (GLogFunc)test_checked_handler, &check);
-    g_test_message("  test-agedver.c:  asking for an old but supported interface ...");
-
-    gnc_module_system_init();
-
-    foo = gnc_module_load("gnucash/agedver", 5);
-
-    if (foo)
-    {
-        printf("  ok\n");
-        exit(0);
-    }
-    else
-    {
-        printf(" failed\n");
-        exit(-1);
-    }
-}
-
-int
-main(int argc, char ** argv)
-{
-    scm_boot_guile(argc, argv, guile_main, NULL);
-    return 0;
-}
diff --git a/src/gnc-module/test/test-dynload.c b/src/gnc-module/test/test-dynload.c
deleted file mode 100644
index 3185341..0000000
--- a/src/gnc-module/test/test-dynload.c
+++ /dev/null
@@ -1,112 +0,0 @@
-/*********************************************************************
- * test-dynload.c
- * test the ability to dlopen the gnc_module library and initialize
- * it via dlsym
- *********************************************************************/
-/********************************************************************\
- * 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 at gnu.org                   *
- *                                                                  *
-\********************************************************************/
-
-
-#include "config.h"
-#include <stdio.h>
-#include <gmodule.h>
-#include <libguile.h>
-#include <unittest-support.h>
-
-#include "gnc-module.h"
-
-static void
-guile_main(void *closure, int argc, char ** argv)
-{
-    GModule *gmodule;
-    gchar *msg = "Module '../../../src/gnc-module/test/misc-mods/.libs/libgncmod_futuremodsys.so' requires newer module system\n";
-    gchar *logdomain = "gnc.module";
-    gchar *modpath;
-    guint loglevel = G_LOG_LEVEL_WARNING;
-    const char *libdir = g_getenv("LIBDIR");
-    TestErrorStruct check = { loglevel, logdomain, msg };
-    g_log_set_handler (logdomain, loglevel,
-                       (GLogFunc)test_checked_handler, &check);
-
-    if (libdir == NULL)
-    {
-        libdir = "../.libs";
-    }
-
-    g_test_message("  test-dynload.c: testing dynamic linking of libgnc-module ...");
-#ifdef G_OS_WIN32
-/* MinGW builds libgnc-module-0.dll */
-    if (libdir == NULL)
-    {
-        modpath = g_module_build_path ("../.libs", "gnc-module-0");
-    }
-    else
-    {
-        modpath = g_module_build_path (libdir, "gnc-module");
-    }
-#elif defined(GNC_PLATFORM_OSX)
-/* We build libgnc-module as a shared library for testing, and on OSX
- * that means that g_module_build_path (), which uses ".so", doesn't
- * build the right path name.
- */
-    if (libdir == NULL)
-    {
-        modpath = g_build_filename ("..", ".libs", "libgnc-module.dylib", NULL);
-    }
-    else
-    {
-        modpath = g_build_filename (libdir, "libgnc-module.dylib", NULL);
-    }
-#else /* Regular Unix */
-    modpath = g_module_build_path (libdir, "gnc-module");
-#endif
-    gmodule = g_module_open(modpath, 0);
-
-    if (gmodule)
-    {
-        gpointer ptr;
-        if (g_module_symbol(gmodule, "gnc_module_system_init", &ptr))
-        {
-            void (* fn)(void) = ptr;
-            fn();
-            printf(" OK\n");
-            exit(0);
-        }
-        else
-        {
-            printf(" failed to find gnc_module_system_init\n");
-            exit(-1);
-        }
-    }
-    else
-    {
-        printf(" failed to open library.\n");
-        printf("%s\n", g_module_error());
-        exit(-1);
-    }
-}
-
-int
-main(int argc, char ** argv)
-{
-    scm_boot_guile(argc, argv, guile_main, NULL);
-    return 0;
-}
-
diff --git a/src/gnc-module/test/test-incompatdep.c b/src/gnc-module/test/test-incompatdep.c
deleted file mode 100644
index 70f9233..0000000
--- a/src/gnc-module/test/test-incompatdep.c
+++ /dev/null
@@ -1,67 +0,0 @@
-/********************************************************************\
- * 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 at gnu.org                   *
- *                                                                  *
-\********************************************************************/
-
-#include "config.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <libguile.h>
-#include <unittest-support.h>
-
-#include "gnc-module.h"
-
-static void
-guile_main(void *closure, int argc, char ** argv)
-{
-    GNCModule foo;
-    gchar *msg1 = "Module '../../../src/gnc-module/test/misc-mods/.libs/libgncmod_futuremodsys.so' requires newer module system\n";
-    gchar *msg2 = "Could not locate module gnucash/incompatdep interface v.0";
-    gchar *logdomain = "gnc.module";
-    guint loglevel = G_LOG_LEVEL_WARNING;
-    TestErrorStruct check1 = { loglevel, logdomain, msg1 };
-    TestErrorStruct check2 = { loglevel, logdomain, msg2 };
-    test_add_error (&check1);
-    test_add_error (&check2);
-    g_log_set_handler (logdomain, loglevel,
-                       (GLogFunc)test_list_handler, NULL);
-
-    g_test_message("  test-incompatdep.c:  loading a module with bad deps ...\n");
-
-    gnc_module_system_init();
-
-    foo = gnc_module_load("gnucash/incompatdep", 0);
-
-    if (!foo)
-    {
-        printf("  ok\n");
-        exit(0);
-    }
-    else
-    {
-        printf("  oops! loaded incompatible module\n");
-        exit(-1);
-    }
-}
-
-int
-main(int argc, char ** argv)
-{
-    scm_boot_guile(argc, argv, guile_main, NULL);
-    return 0;
-}
diff --git a/src/gnc-module/test/test-load-c.c b/src/gnc-module/test/test-load-c.c
deleted file mode 100644
index bc6ee97..0000000
--- a/src/gnc-module/test/test-load-c.c
+++ /dev/null
@@ -1,67 +0,0 @@
-/********************************************************************\
- * 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 at gnu.org                   *
- *                                                                  *
-\********************************************************************/
-
-#include "config.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <libguile.h>
-#include <unittest-support.h>
-
-#include "gnc-module.h"
-
-static void
-guile_main(void *closure, int argc, char ** argv)
-{
-    GNCModule foo;
-    gchar *msg = "Module '../../../src/gnc-module/test/misc-mods/.libs/libgncmod_futuremodsys.so' requires newer module system\n";
-    gchar *logdomain = "gnc.module";
-    guint loglevel = G_LOG_LEVEL_WARNING;
-    TestErrorStruct check = { loglevel, logdomain, msg };
-    g_log_set_handler (logdomain, loglevel,
-                       (GLogFunc)test_checked_handler, &check);
-
-    g_test_message("  test-load-c.c: testing module load/unload from C ... ");
-
-    gnc_module_system_init();
-
-    foo = gnc_module_load("gnucash/foo", 0);
-
-    if (!foo)
-    {
-        g_test_message("  Failed to load foo\n");
-        exit(-1);
-    }
-
-    if (!gnc_module_unload(foo))
-    {
-        g_test_message("  Failed to unload foo\n");
-        exit(-1);
-    }
-    g_test_message(" successful.\n");
-
-    exit(0);
-}
-
-int
-main(int argc, char ** argv)
-{
-    scm_boot_guile(argc, argv, guile_main, NULL);
-    return 0;
-}
diff --git a/src/gnc-module/test/test-modsysver.c b/src/gnc-module/test/test-modsysver.c
deleted file mode 100644
index 74ba9aa..0000000
--- a/src/gnc-module/test/test-modsysver.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/********************************************************************\
- * 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 at gnu.org                   *
- *                                                                  *
-\********************************************************************/
-
-#include "config.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <libguile.h>
-#include <unittest-support.h>
-
-#include "gnc-module.h"
-
-static void
-guile_main(void *closure, int argc, char ** argv)
-{
-    GNCModule foo;
-    gchar *msg1 = "Module '../../../src/gnc-module/test/misc-mods/.libs/libgncmod_futuremodsys.so' requires newer module system\n";
-    gchar *msg2 = "Could not locate module gnucash/futuremodsys interface v.0";
-    gchar *logdomain = "gnc.module";
-    guint loglevel = G_LOG_LEVEL_WARNING;
-    TestErrorStruct check1 = { loglevel, logdomain, msg1 };
-    TestErrorStruct check2 = { loglevel, logdomain, msg2 };
-    test_add_error (&check1);
-    test_add_error (&check2);
-    g_log_set_handler (logdomain, loglevel,
-                       (GLogFunc)test_list_handler, NULL);
-
-    g_test_message("  test-modsysver.c: checking for a module we shouldn't find ...\n");
-
-    gnc_module_system_init();
-
-    foo = gnc_module_load("gnucash/futuremodsys", 0);
-
-    if (!foo)
-    {
-        printf("  ok\n");
-        exit(0);
-    }
-    else
-    {
-        printf("  oops! loaded incompatible module\n");
-        exit(-1);
-    }
-    test_clear_error_list ();
-}
-
-int
-main(int argc, char ** argv)
-{
-    scm_boot_guile(argc, argv, guile_main, NULL);
-    return 0;
-}
diff --git a/src/gnome-search/Makefile.am b/src/gnome-search/Makefile.am
deleted file mode 100644
index 8056c04..0000000
--- a/src/gnome-search/Makefile.am
+++ /dev/null
@@ -1,66 +0,0 @@
-pkglib_LTLIBRARIES = libgncmod-gnome-search.la
-
-AM_CPPFLAGS = \
-  -I${top_srcdir}/src \
-  -I${top_srcdir}/src/core-utils \
-  -I${top_srcdir}/src/engine \
-  -I${top_srcdir}/src/app-utils \
-  -I${top_srcdir}/src/gnome-utils \
-  -I${top_srcdir}/src/gnc-module \
-  ${GUILE_CFLAGS} \
-  ${GTK_CFLAGS} \
-  ${GLIB_CFLAGS}
-
-libgncmod_gnome_search_la_SOURCES = \
-  gncmod-gnome-search.c \
-  gnc-general-search.c \
-  dialog-search.c \
-  search-account.c \
-  search-boolean.c \
-  search-core-type.c \
-  search-core-utils.c \
-  search-date.c \
-  search-double.c \
-  search-int64.c \
-  search-numeric.c \
-  search-reconciled.c \
-  search-string.c
-
-gncincludedir = ${GNC_INCLUDE_DIR}
-gncinclude_HEADERS = \
-  dialog-search.h \
-  gnc-general-search.h
-
-noinst_HEADERS = \
-  search-account.h \
-  search-boolean.h \
-  search-core-type.h \
-  search-core-utils.h \
-  search-date.h \
-  search-double.h \
-  search-int64.h \
-  search-numeric.h \
-  search-reconciled.h \
-  search-string.h
-
-libgncmod_gnome_search_la_LDFLAGS = -avoid-version
-
-libgncmod_gnome_search_la_LIBADD = \
-  ${top_builddir}/src/gnome-utils/libgncmod-gnome-utils.la \
-  ${top_builddir}/src/app-utils/libgncmod-app-utils.la \
-  ${top_builddir}/src/gnc-module/libgnc-module.la \
-  ${top_builddir}/src/core-utils/libgnc-core-utils.la \
-  ${top_builddir}/src/engine/libgncmod-engine.la \
-  ${GUILE_LIBS} \
-  ${GLIB_LIBS} \
-  ${REGEX_LIBS}
-
-gtkbuilderdir = $(GNC_GTKBUILDER_DIR)
-gtkbuilder_DATA = \
-  dialog-search.glade
-
-EXTRA_DIST = \
-  ${gtkbuilder_DATA} \
-  CMakeLists.txt
-
-AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.gui.search\"
diff --git a/src/gnome-utils/CMakeLists.txt b/src/gnome-utils/CMakeLists.txt
deleted file mode 100644
index fd90e00..0000000
--- a/src/gnome-utils/CMakeLists.txt
+++ /dev/null
@@ -1,277 +0,0 @@
-# Note that src/gnome-utils CANNOT depend on src/gnome!
-
-ADD_SUBDIRECTORY(gschemas)
-ADD_SUBDIRECTORY(gtkbuilder)
-ADD_SUBDIRECTORY(ui)
-ADD_SUBDIRECTORY(test)
-
-IF (BUILDING_FROM_VCS)
-  SET (SWIG_GNOME_UTILS_C ${CMAKE_CURRENT_BINARY_DIR}/swig-gnome-utils.c)
-  GNC_ADD_SWIG_COMMAND (swig-gnome-utils-c ${SWIG_GNOME_UTILS_C} ${CMAKE_CURRENT_SOURCE_DIR}/gnome-utils.i)
-ELSE()
-  SET (SWIG_GNOME_UTILS_C swig-gnome-utils.c)
-ENDIF()
-
-CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/gschemas/org.gnucash.warnings.gschema.xml.in.in
-               ${CMAKE_CURRENT_BINARY_DIR}/gschemas/org.gnucash.warnings.gschema.xml.in)
-
-SET (WARNINGS_SCHEMA gschemas/org.gnucash.warnings.gschema.xml.in)
-SET (GNC_WARNINGS_C ${CMAKE_CURRENT_BINARY_DIR}/gnc-warnings.c)
-SET (GNC_WARNINGS_H ${CMAKE_CURRENT_BINARY_DIR}/gnc-warnings.h)
-
-ADD_CUSTOM_COMMAND(
-  OUTPUT ${GNC_WARNINGS_C}
-  DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${WARNINGS_SCHEMA} make-gnc-warnings-c.xsl
-  COMMAND
-    ${LIBXSLT_XSLTPROC_EXECUTABLE} -o ${GNC_WARNINGS_C} ${CMAKE_CURRENT_SOURCE_DIR}/make-gnc-warnings-c.xsl ${CMAKE_CURRENT_BINARY_DIR}/${WARNINGS_SCHEMA}
-)
-ADD_CUSTOM_COMMAND(
-  OUTPUT ${GNC_WARNINGS_H}
-  DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${WARNINGS_SCHEMA} make-gnc-warnings-h.xsl
-  COMMAND
-    ${LIBXSLT_XSLTPROC_EXECUTABLE} -o ${GNC_WARNINGS_H} ${CMAKE_CURRENT_SOURCE_DIR}/make-gnc-warnings-h.xsl ${CMAKE_CURRENT_BINARY_DIR}/${WARNINGS_SCHEMA}
-)
-
-ADD_CUSTOM_TARGET(gnc-warnings-c DEPENDS ${GNC_WARNINGS_C})
-
-SET (gnome_utils_SOURCES
-  account-quickfill.c
-  assistant-xml-encoding.c
-  cursors.c
-  dialog-account.c
-  dialog-book-close.c
-  dialog-commodity.c
-  dialog-dup-trans.c
-  dialog-file-access.c
-  dialog-object-references.c
-  dialog-options.c
-  dialog-preferences.c
-  dialog-query-view.c
-  dialog-reset-warnings.c
-  dialog-tax-table.c
-  dialog-totd.c
-  dialog-transfer.c
-  dialog-userpass.c
-  dialog-utils.c
-  gnc-account-sel.c
-  gnc-amount-edit.c
-  gnc-autosave.c
-  gnc-cell-renderer-date.c
-  gnc-cell-renderer-popup.c
-  gnc-cell-renderer-popup-entry.c
-  gnc-combott.c
-  gnc-commodity-edit.c
-  gnc-currency-edit.c
-  gnc-date-delta.c
-  gnc-date-edit.c
-  gnc-date-format.c 
-  gnc-dense-cal.c
-  gnc-dense-cal-model.c
-  gnc-dense-cal-store.c
-  gnc-embedded-window.c
-  gnc-file.c
-  gnc-frequency.c
-  gnc-recurrence.c
-  gnc-general-select.c
-  gnc-gnome-utils.c
-  gnc-gobject-utils.c
-  gnc-gtk-utils.c
-  gnc-gui-query.c
-  gnc-icons.c
-  gnc-keyring.c
-  gnc-main-window.c
-  gnc-menu-extensions.c
-  gnc-plugin-file-history.c
-  gnc-plugin-manager.c
-  gnc-plugin-menu-additions.c
-  gnc-plugin-page.c
-  gnc-plugin.c
-  gnc-period-select.c
-  gnc-query-view.c
-  gnc-splash.c
-  gnc-sx-instance-dense-cal-adapter.c
-  gnc-sx-list-tree-model-adapter.c
-  gnc-tree-control-split-reg.c
-  gnc-tree-model.c
-  gnc-tree-model-account-types.c
-  gnc-tree-model-account.c
-  gnc-tree-model-budget.c
-  gnc-tree-model-owner.c
-  gnc-tree-model-commodity.c
-  gnc-tree-model-price.c
-  gnc-tree-model-split-reg.c
-  gnc-tree-util-split-reg.c
-  gnc-tree-view-account.c
-  gnc-tree-view-commodity.c
-  gnc-tree-view-owner.c
-  gnc-tree-view-price.c
-  gnc-tree-view-split-reg.c
-  gnc-tree-view-sx-list.c
-  gnc-tree-view.c
-  gnc-window.c
-  gncmod-gnome-utils.c
-  misc-gnome-utils.c
-  tree-view-utils.c
-  search-param.c
-  print-session.c
-  window-main-summarybar.c
-)
-
-SET(gnome_utils_noinst_HEADERS
-  dialog-tax-table.h
-  gnc-autosave.h
-  gnc-gobject-utils.h
-  gnc-gtk-utils.h
-  search-param.h
-)
-
-SET (gnome_utils_HEADERS
-  account-quickfill.h
-  assistant-xml-encoding.h
-  dialog-account.h
-  dialog-book-close.h
-  dialog-commodity.h
-  dialog-dup-trans.h
-  dialog-file-access.h
-  dialog-preferences.h
-  dialog-object-references.h
-  dialog-options.h
-  dialog-query-view.h
-  dialog-reset-warnings.h
-  dialog-totd.h
-  dialog-transfer.h
-  dialog-utils.h
-  gnc-account-sel.h
-  gnc-amount-edit.h
-  gnc-cell-renderer-date.h
-  gnc-cell-renderer-popup.h
-  gnc-cell-renderer-popup-entry.h
-  gnc-combott.h
-  gnc-commodity-edit.h
-  gnc-currency-edit.h
-  gnc-date-delta.h
-  gnc-date-edit.h
-  gnc-date-format.h
-  gnc-dense-cal.h
-  gnc-dense-cal-model.h
-  gnc-dense-cal-store.h
-  gnc-embedded-window.h
-  gnc-file.h
-  gnc-frequency.h
-  gnc-recurrence.h
-  gnc-general-select.h
-  gnc-gnome-utils.h
-  gnc-gui-query.h
-  gnc-icons.h
-  gnc-keyring.h
-  gnc-main-window.h
-  gnc-menu-extensions.h
-  gnc-plugin-file-history.h
-  gnc-plugin-manager.h
-  gnc-plugin-menu-additions.h
-  gnc-plugin-page.h
-  gnc-plugin.h
-  gnc-period-select.h
-  gnc-query-view.h
-  gnc-splash.h
-  gnc-sx-instance-dense-cal-adapter.h
-  gnc-sx-list-tree-model-adapter.h
-  gnc-tree-control-split-reg.h
-  gnc-tree-model.h
-  gnc-tree-model-account-types.h
-  gnc-tree-model-account.h
-  gnc-tree-model-budget.h
-  gnc-tree-model-owner.h
-  gnc-tree-model-commodity.h
-  gnc-tree-model-price.h
-  gnc-tree-model-split-reg.h
-  gnc-tree-util-split-reg.h
-  gnc-tree-view-account.h
-  gnc-tree-view-commodity.h
-  gnc-tree-view-owner.h
-  gnc-tree-view-price.h
-  gnc-tree-view-split-reg.h
-  gnc-tree-view-sx-list.h
-  gnc-tree-view.h
-  gnc-ui.h
-  gnc-window.h
-  misc-gnome-utils.h
-  tree-view-utils.h
-  print-session.h
-  window-main-summarybar.h
-)
-
-
-
-ADD_LIBRARY (gncmod-gnome-utils
-  ${gnome_utils_SOURCES}
-  ${gnome_utils_HEADERS}
-  ${GNC_WARNINGS_C} ${GNC_WARNINGS_H}
-  ${SWIG_GNOME_UTILS_C}
-  ${gnome_utils_noinst_HEADERS}
-)
-
-TARGET_LINK_LIBRARIES(gncmod-gnome-utils gncmod-app-utils gncmod-engine gnc-backend-xml-utils
-     ${GTK3_LDFLAGS} ${GTK_MAC_LDFLAGS})
-
-TARGET_COMPILE_DEFINITIONS(gncmod-gnome-utils PUBLIC ${GTK_MAC_CFLAGS_OTHER}
-    PRIVATE -DG_LOG_DOMAIN=\"gnc.gui\")
-
-IF (MAC_INTEGRATION)
-  TARGET_COMPILE_OPTIONS(gncmod-gnome-utils PRIVATE ${OSX_EXTRA_COMPILE_FLAGS})
-  TARGET_LINK_LIBRARIES(gncmod-gnome-utils ${OSX_EXTRA_LIBRARIES})
-ENDIF(MAC_INTEGRATION)
-
-TARGET_INCLUDE_DIRECTORIES(gncmod-gnome-utils
-    PUBLIC
-      ${GTK3_INCLUDE_DIRS}
-      ${CMAKE_CURRENT_SOURCE_DIR}
-    PRIVATE
-      ${GTK_MAC_INCLUDE_DIRS}
-      ${CMAKE_CURRENT_BINARY_DIR}
-)
-
-
-INSTALL(TARGETS gncmod-gnome-utils
-  LIBRARY DESTINATION lib/gnucash
-  ARCHIVE DESTINATION lib/gnucash
-  RUNTIME DESTINATION bin)
-
-INSTALL(FILES ${gnome_utils_HEADERS} DESTINATION include/gnucash)
-
-
-# Scheme
-
-SET(GUILE_MODULES      "")
-SET(GUILE_LOAD_DIRS    src/core-utils src/gnc-module src/scm)
-SET(GUILE_LIBRARY_DIRS src/core-utils src/gnc-module)
-SET(GUILE_DEPENDS      gncmod-gnome-utils scm-core-utils scm-gnc-module scm-scm)
-
-GNC_ADD_SCHEME_TARGETS(scm-gnome-utils-1
-  gnome-utils.scm
-  gnucash
-  "${GUILE_MODULES}"
-  "${GUILE_LOAD_DIRS}"
-  "${GUILE_LIBRARY_DIRS}"
-  "${GUILE_DEPENDS}"
-  FALSE
-)
-
-
-GNC_ADD_SCHEME_TARGETS(scm-gnome-utils-2
-  gnc-menu-extensions.scm
-  ""
-  "${GUILE_MODULES}"
-  "${GUILE_LOAD_DIRS}"
-  "${GUILE_LIBRARY_DIRS}"
-  "${GUILE_DEPENDS}"
-  FALSE
-)
-
-ADD_CUSTOM_TARGET(scm-gnome-utils ALL DEPENDS scm-gnome-utils-2 scm-gnome-utils-1)
-
-SET_LOCAL_DIST(gnome_utils_DIST_local CMakeLists.txt Makefile.am ${gnome_utils_SOURCES} ${gnome_utils_HEADERS}
-        ${gnome_utils_noinst_HEADERS} gnome-utils.scm gnome-utils.i gnc-menu-extensions.scm
-        make-gnc-warnings-c.xsl make-gnc-warnings-h.xsl)
-SET(gnome_utils_DIST ${gnome_utils_DIST_local} ${gnome_utils_gschema_DIST} ${test_gnome_utils_DIST}
-        ${gnome_utils_ui_DIST} ${gnome_utils_gtkbuilder_DIST} PARENT_SCOPE)
diff --git a/src/gnome-utils/Makefile.am b/src/gnome-utils/Makefile.am
deleted file mode 100644
index c94e88b..0000000
--- a/src/gnome-utils/Makefile.am
+++ /dev/null
@@ -1,328 +0,0 @@
-SUBDIRS = gtkbuilder gschemas . test ui
-
-pkglib_LTLIBRARIES = libgncmod-gnome-utils.la
-
-# Note that src/gnome-utils CANNOT depend on src/gnome!
-
-AM_CPPFLAGS = \
-  -I${top_srcdir}/src/core-utils \
-  -I${top_srcdir}/src/gnc-module \
-  -I${top_srcdir}/src/engine \
-  -I${top_srcdir}/src/backend/xml \
-  -I${top_srcdir}/src/app-utils \
-  -I${top_srcdir}/src \
-  -I${top_builddir}/src \
-  -I${top_builddir}/src/core-utils \
-  -I${top_srcdir}/lib/libc \
-  ${GLIB_CFLAGS} \
-  ${GTK_CFLAGS} \
-  ${GNOME_KEYRING_CFLAGS} \
-  ${LIBSECRET_CFLAGS} \
-  ${GUILE_CFLAGS} \
-  ${LIBGDA_CFLAGS} \
-  ${LIBXML2_CFLAGS} \
-  ${GTK_MAC_CFLAGS}
-
-libgncmod_gnome_utils_la_SOURCES = \
-  account-quickfill.c \
-  assistant-xml-encoding.c \
-  cursors.c \
-  dialog-account.c \
-  dialog-book-close.c \
-  dialog-commodity.c \
-  dialog-dup-trans.c \
-  dialog-file-access.c \
-  dialog-object-references.c \
-  dialog-options.c \
-  dialog-preferences.c \
-  dialog-query-view.c \
-  dialog-reset-warnings.c \
-  dialog-tax-table.c \
-  dialog-totd.c \
-  dialog-transfer.c \
-  dialog-userpass.c \
-  dialog-utils.c \
-  gnc-account-sel.c \
-  gnc-amount-edit.c \
-  gnc-autosave.c \
-  gnc-cell-renderer-date.c \
-  gnc-cell-renderer-popup.c \
-  gnc-cell-renderer-popup-entry.c \
-  gnc-combott.c \
-  gnc-commodity-edit.c \
-  gnc-currency-edit.c \
-  gnc-date-delta.c \
-  gnc-date-edit.c \
-  gnc-date-format.c \
-  gnc-dense-cal.c \
-  gnc-dense-cal-model.c \
-  gnc-dense-cal-store.c \
-  gnc-embedded-window.c \
-  gnc-file.c \
-  gnc-frequency.c \
-  gnc-recurrence.c \
-  gnc-general-select.c \
-  gnc-gnome-utils.c \
-  gnc-gobject-utils.c \
-  gnc-gtk-utils.c \
-  gnc-gui-query.c \
-  gnc-icons.c \
-  gnc-keyring.c \
-  gnc-main-window.c \
-  gnc-menu-extensions.c \
-  gnc-plugin-file-history.c \
-  gnc-plugin-manager.c \
-  gnc-plugin-menu-additions.c \
-  gnc-plugin-page.c \
-  gnc-plugin.c \
-  gnc-period-select.c \
-  gnc-query-view.c \
-  gnc-splash.c \
-  gnc-sx-instance-dense-cal-adapter.c \
-  gnc-sx-list-tree-model-adapter.c \
-  gnc-tree-control-split-reg.c \
-  gnc-tree-model.c \
-  gnc-tree-model-account-types.c \
-  gnc-tree-model-account.c \
-  gnc-tree-model-budget.c \
-  gnc-tree-model-owner.c \
-  gnc-tree-model-commodity.c \
-  gnc-tree-model-price.c \
-  gnc-tree-model-split-reg.c \
-  gnc-tree-util-split-reg.c \
-  gnc-tree-view-account.c \
-  gnc-tree-view-commodity.c \
-  gnc-tree-view-owner.c \
-  gnc-tree-view-price.c \
-  gnc-tree-view-split-reg.c \
-  gnc-tree-view-sx-list.c \
-  gnc-tree-view.c \
-  gnc-warnings.c \
-  gnc-window.c \
-  gncmod-gnome-utils.c \
-  misc-gnome-utils.c \
-  tree-view-utils.c \
-  search-param.c \
-  print-session.c \
-  swig-gnome-utils.c \
-  window-main-summarybar.c
-
-gncincludedir = ${GNC_INCLUDE_DIR}
-gncinclude_HEADERS = \
-  account-quickfill.h \
-  assistant-xml-encoding.h \
-  dialog-account.h \
-  dialog-book-close.h \
-  dialog-commodity.h \
-  dialog-dup-trans.h \
-  dialog-file-access.h \
-  dialog-preferences.h \
-  dialog-object-references.h \
-  dialog-options.h \
-  dialog-query-view.h \
-  dialog-reset-warnings.h \
-  dialog-totd.h \
-  dialog-transfer.h \
-  dialog-utils.h \
-  gnc-account-sel.h \
-  gnc-amount-edit.h \
-  gnc-cell-renderer-date.h \
-  gnc-cell-renderer-popup.h \
-  gnc-cell-renderer-popup-entry.h \
-  gnc-combott.h \
-  gnc-commodity-edit.h \
-  gnc-currency-edit.h \
-  gnc-date-delta.h \
-  gnc-date-edit.h \
-  gnc-date-format.h \
-  gnc-dense-cal.h \
-  gnc-dense-cal-model.h \
-  gnc-dense-cal-store.h \
-  gnc-embedded-window.h \
-  gnc-file.h \
-  gnc-frequency.h \
-  gnc-recurrence.h \
-  gnc-general-select.h \
-  gnc-gnome-utils.h \
-  gnc-gui-query.h \
-  gnc-icons.h \
-  gnc-keyring.h \
-  gnc-main-window.h \
-  gnc-menu-extensions.h \
-  gnc-plugin-file-history.h \
-  gnc-plugin-manager.h \
-  gnc-plugin-menu-additions.h \
-  gnc-plugin-page.h \
-  gnc-plugin.h \
-  gnc-period-select.h \
-  gnc-query-view.h \
-  gnc-splash.h \
-  gnc-sx-instance-dense-cal-adapter.h \
-  gnc-sx-list-tree-model-adapter.h \
-  gnc-tree-control-split-reg.h \
-  gnc-tree-model.h \
-  gnc-tree-model-account-types.h \
-  gnc-tree-model-account.h \
-  gnc-tree-model-budget.h \
-  gnc-tree-model-owner.h \
-  gnc-tree-model-commodity.h \
-  gnc-tree-model-price.h \
-  gnc-tree-model-split-reg.h \
-  gnc-tree-util-split-reg.h \
-  gnc-tree-view-account.h \
-  gnc-tree-view-commodity.h \
-  gnc-tree-view-owner.h \
-  gnc-tree-view-price.h \
-  gnc-tree-view-split-reg.h \
-  gnc-tree-view-sx-list.h \
-  gnc-tree-view.h \
-  gnc-ui.h \
-  gnc-window.h \
-  misc-gnome-utils.h \
-  tree-view-utils.h \
-  print-session.h \
-  window-main-summarybar.h
-
-noinst_HEADERS = \
-  dialog-tax-table.h \
-  gnc-autosave.h \
-  gnc-gobject-utils.h \
-  gnc-gtk-utils.h \
-  search-param.h
-
-libgncmod_gnome_utils_la_LDFLAGS = -avoid-version
-
-libgncmod_gnome_utils_la_LIBADD = \
-  ${top_builddir}/src/core-utils/libgnc-core-utils.la \
-  ${top_builddir}/src/gnc-module/libgnc-module.la \
-  ${top_builddir}/src/engine/libgncmod-engine.la \
-  ${top_builddir}/src/backend/xml/libgnc-backend-xml-utils.la \
-  ${top_builddir}/src/app-utils/libgncmod-app-utils.la \
-  $(top_builddir)/lib/libc/libc-missing.la \
-  ${GTK_LIBS} \
-  ${GNOME_KEYRING_LIBS} \
-  ${LIBSECRET_LIBS} \
-  ${GUILE_LIBS} \
-  ${GLIB_LIBS} \
-  ${DB_LIBS} \
-  ${REGEX_LIBS} \
-  ${LIBXML2_LIBS} \
-  ${GTK_MAC_LIBS}
-
-BUILT_SOURCES = gnc-warnings.c gnc-warnings.h
-
-gnc-warnings.c: gschemas/org.gnucash.warnings.gschema.xml.in make-gnc-warnings-c.xsl
-	$(XSLTPROC) -o $@ $(srcdir)/make-gnc-warnings-c.xsl $<
-
-gnc-warnings.h: gschemas/org.gnucash.warnings.gschema.xml.in make-gnc-warnings-h.xsl
-	$(XSLTPROC) -o $@ $(srcdir)/make-gnc-warnings-h.xsl $<
-
-if HAVE_X11_XLIB_H
-  libgncmod_gnome_utils_la_LIBADD += -lX11
-endif
-
-if BUILDING_FROM_VCS
-swig-gnome-utils.c: gnome-utils.i \
-                    ${top_srcdir}/src/base-typemaps.i
-	$(SWIG) -guile $(SWIG_ARGS) -Linkage module \
-	-I${top_srcdir}/src -o $@ $<
-if ! OS_WIN32
-if ! SWIG_DIST_FAIL
-	if ! `grep "define scm_from_utf8_string" $@ > /dev/null 2>&1`; then \
-	  patch $@ $(top_srcdir)/src/swig-utf8.patch; \
-	fi
-endif
-endif
-endif
-
-gncscmmoddir = ${GNC_SCM_INSTALL_DIR}/gnucash
-gncscmmod_DATA = gnome-utils.scm
-
-gncscmdir = ${GNC_SCM_INSTALL_DIR}
-gncscm_DATA = gnc-menu-extensions.scm
-
-EXTRA_DIST = \
-  gnome-utils.i \
-  make-gnc-warnings-c.xsl \
-  make-gnc-warnings-h.xsl \
-  ${gncscmmod_DATA} \
-  ${gncscm_DATA} \
-  CMakeLists.txt
-
-
-if GNUCASH_SEPARATE_BUILDDIR
-#For executing test cases
-SCM_FILE_LINKS = \
-  ${gncscmmod_DATA} \
-  ${gncscm_DATA}
-endif
-
-.scm-links:
-	$(RM) -rf gnucash
-	mkdir -p  gnucash
-if GNUCASH_SEPARATE_BUILDDIR
-	for X in ${SCM_FILE_LINKS} ; do \
-	  $(LN_S) -f ${srcdir}/$$X . ; \
-	done
-endif
-	( cd gnucash; for A in $(gncscmmod_DATA) ; do $(LN_S) -f ../$$A . ; done )
-if ! OS_WIN32
-# Windows knows no "ln -s" but uses "cp": must copy every time (see bug #566567).
-	touch .scm-links
-endif
-
-if GNC_HAVE_GUILE_2
-GUILE_COMPILE_ENV = \
-  --guile-load-dir ${top_builddir}/src/core-utils \
-  --guile-load-dir ${top_builddir}/src/gnc-module \
-  --guile-load-dir ${top_builddir}/src/scm \
-  --library-dir    ${top_builddir}/src/engine \
-  --library-dir    ${top_builddir}/src/core-utils \
-  --library-dir    ${top_builddir}/src/gnc-module \
-  --library-dir    ${top_builddir}/src/app-utils \
-  --library-dir    ${top_builddir}/src/backend/xml \
-  --library-dir    ${top_builddir}/src/gnome-utils
-
-%.go : %.scm .scm-links $(pkglib_LTLIBRARIES)
-	GNC_UNINSTALLED=yes \
-	GNC_BUILDDIR=${top_builddir} \
-	$(shell ${abs_top_srcdir}/src/gnc-test-env.pl --noexports ${GUILE_COMPILE_ENV}) \
-	$(GUILD) compile -o $@ $<
-
-gncscmmodcachedir = ${pkglibdir}/scm/ccache/@GUILE_EFFECTIVE_VERSION@/gnucash
-gncscmmodcache_DATA = $(gncscmmod_DATA:.scm=.go)
-
-gncscmcachedir = ${pkglibdir}/scm/ccache/@GUILE_EFFECTIVE_VERSION@
-gncscmcache_DATA = $(gncscm_DATA:.scm=.go)
-endif
-
-noinst_DATA = .scm-links
-clean-local:
-	rm -rf gnucash
-
-CLEANFILES = \
-	$(BUILT_SOURCES) \
-	.scm-links \
-	${SCM_FILE_LINKS} \
-	${gncscmcache_DATA} \
-	${gncscmmodcache_DATA}
-
-MAINTAINERCLEANFILES = swig-gnome-utils.c
-
-# We want to do this only for the Gnome help tool on Linux and MacPorts.
-if !PLATFORM_WIN32
-if !PLATFORM_OSX_QUARTZ
-#
-# I hate inconsistent standards. Autotools puts help files into
-# ${datadir}/gnome/help/${program} while the gnome2 libraries expect
-# them in ${pkgdatadir}/gnome/help/${program}.
-#
-install-data-hook:
-	$(LN_S) -f ../gnome ${DESTDIR}${pkgdatadir}
-
-uninstall-hook:
-	rm -f ${DESTDIR}${pkgdatadir}/gnome
-endif
-endif
-
-AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.gui\"
diff --git a/src/gnome-utils/dialog-book-close.c b/src/gnome-utils/dialog-book-close.c
deleted file mode 100644
index 3fe4ed8..0000000
--- a/src/gnome-utils/dialog-book-close.c
+++ /dev/null
@@ -1,394 +0,0 @@
-/********************************************************************\
- * dialog-book-close.c -- dialog for helping the user close the     *
- *                        book at the end of the year by adding     *
- *                        zero-izing splits to all Income and       *
- *                        Expense accounts                          *
- *                                                                  *
- * Copyright (C) 2007-8 Derek Atkins <derek at ihtfp.com>              *
- *                                                                  *
- * 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 at gnu.org                   *
-\********************************************************************/
-
-#include "config.h"
-
-#include <gtk/gtk.h>
-#include <glib/gi18n.h>
-
-#include "dialog-utils.h"
-#include "gnc-engine.h"
-#include "Transaction.h"
-#include "Split.h"
-#include "Account.h"
-#include "gnc-ui.h"
-#include "gnc-gui-query.h"
-#include "dialog-book-close.h"
-#include "gnc-account-sel.h"
-#include "gnc-component-manager.h"
-#include "gnc-date-edit.h"
-#include "gnc-session.h"
-#include "app-utils/gnc-ui-util.h"
-
-#define DIALOG_BOOK_CLOSE_CM_CLASS "dialog-book-close"
-
-void gnc_book_close_response_cb(GtkDialog *, gint, GtkDialog *);
-
-/* This static indicates the debugging module that this .o belongs to.  */
-static QofLogModule log_module = GNC_MOD_GUI;
-
-struct CloseBookWindow
-{
-    /* Passed in by the creator */
-    QofBook* book;
-
-    /* Parts of the dialog */
-    GtkWidget* dialog;
-    GtkWidget* close_date_widget;
-    GtkWidget* income_acct_widget;
-    GtkWidget* expense_acct_widget;
-    GtkWidget* desc_widget;
-
-    /* The final settings */
-    time64 close_date;
-    const char* desc;
-
-    /* Component registration */
-    gint component_manager_id;
-};
-
-struct CloseAccountsCB
-{
-    struct CloseBookWindow* cbw;
-    Account* base_acct;
-    GNCAccountType acct_type;
-    GHashTable* txns;
-    guint hash_size;
-};
-
-struct CACBTransactionList
-{
-    gnc_commodity* cmdty;
-    Transaction* txn;
-    gnc_numeric total;
-};
-
-static struct CACBTransactionList*
-find_or_create_txn(struct CloseAccountsCB* cacb, gnc_commodity* cmdty)
-{
-    struct CACBTransactionList* txn;
-
-    g_return_val_if_fail(cacb, NULL);
-    g_return_val_if_fail(cmdty, NULL);
-
-    txn = g_hash_table_lookup(cacb->txns, cmdty);
-    if (!txn)
-    {
-        txn = g_new0(struct CACBTransactionList, 1);
-        txn->cmdty = cmdty;
-        txn->total = gnc_numeric_zero();
-        txn->txn = xaccMallocTransaction(cacb->cbw->book);
-        xaccTransBeginEdit(txn->txn);
-        xaccTransSetDateEnteredSecs(txn->txn, gnc_time (NULL));
-
-        /* Watch out: The book-closing txn currently assume that their
-        posted-date is the end date plus 12 hours, so that the closing txn can
-        be distinguished from normal txns of the last day. This is the only
-        case within GnuCash where the PostedDate is a different time-of-day
-        that what the GDate normally says as a normalized date. */
-        xaccTransSetDatePostedSecs(txn->txn, cacb->cbw->close_date);
-
-        xaccTransSetDescription(txn->txn, cacb->cbw->desc);
-        xaccTransSetCurrency(txn->txn, cmdty);
-        xaccTransSetIsClosingTxn(txn->txn, TRUE);
-        g_hash_table_insert(cacb->txns, cmdty, txn);
-    }
-
-    return txn;
-}
-
-/* Make sure that the account is of the correct type.
- * then make sure the account has a balance as of the closing date.
- * then get the account commodity and find the appropriate
- * balancing transaction for that commodity and add this balance
- * to it.
- */
-static void close_accounts_cb(Account *a, gpointer data)
-{
-    struct CloseAccountsCB* cacb = data;
-    struct CACBTransactionList* txn;
-    gnc_commodity* acct_commodity;
-    Split* split;
-    gnc_numeric bal;
-
-    g_return_if_fail(a);
-    g_return_if_fail(cacb);
-    g_return_if_fail(cacb->cbw);
-    g_return_if_fail(cacb->txns);
-
-    if (cacb->acct_type != xaccAccountGetType(a))
-        return;
-
-    bal = xaccAccountGetBalanceAsOfDate(a, cacb->cbw->close_date + 1);
-    if (gnc_numeric_zero_p(bal))
-        return;
-
-    acct_commodity = gnc_account_or_default_currency(a, NULL);
-    g_assert(acct_commodity);
-
-    txn = find_or_create_txn(cacb, acct_commodity);
-    g_assert(txn);
-
-    split = xaccMallocSplit(cacb->cbw->book);
-    xaccSplitSetParent(split, txn->txn);
-    xaccAccountBeginEdit(a);
-    xaccAccountInsertSplit(a, split);
-    xaccSplitSetBaseValue(split, gnc_numeric_neg(bal), acct_commodity);
-    xaccAccountCommitEdit(a);
-    txn->total = gnc_numeric_add(txn->total, bal, GNC_DENOM_AUTO,
-                                 GNC_HOW_DENOM_FIXED | GNC_HOW_RND_NEVER);
-}
-
-
-static void finish_txn_cb(gnc_commodity* cmdty,
-                          struct CACBTransactionList* txn,
-                          struct CloseAccountsCB* cacb)
-{
-    Account* acc;
-    Split* split;
-
-    g_return_if_fail(cmdty);
-    g_return_if_fail(txn);
-    g_return_if_fail(cacb);
-    g_return_if_fail(cacb->hash_size);
-
-    /* If we only have one currency and the base account uses
-     * that currency, then we can use that account.  Otherwise,
-     * create a subaccount for each currency.
-     */
-    if (cacb->hash_size == 1 &&
-            gnc_commodity_equal(cmdty, xaccAccountGetCommodity(cacb->base_acct)))
-        acc = cacb->base_acct;
-    else
-    {
-        /* See if we already have an account by that name */
-        acc = gnc_account_lookup_by_name(cacb->base_acct,
-                                         gnc_commodity_get_mnemonic(cmdty));
-
-        /* If not, then create one */
-        if (!acc)
-        {
-            acc = xaccMallocAccount(cacb->cbw->book);
-            xaccAccountBeginEdit(acc);
-            xaccAccountSetType(acc, ACCT_TYPE_EQUITY);
-            xaccAccountSetName(acc, gnc_commodity_get_mnemonic(cmdty));
-            xaccAccountSetDescription(acc, gnc_commodity_get_mnemonic(cmdty));
-            xaccAccountSetCommodity(acc, cmdty);
-            gnc_account_append_child(cacb->base_acct, acc);
-            xaccAccountCommitEdit(acc);
-        }
-    }
-    /* Make sure the account exists and is of the correct commodity */
-    g_assert(acc);
-    g_assert(gnc_commodity_equal(cmdty, xaccAccountGetCommodity(acc)));
-
-    /* Create the split for the Equity account to balance out
-     * all the accounts of this.  Use the "total".
-     */
-    split = xaccMallocSplit(cacb->cbw->book);
-    xaccSplitSetParent(split, txn->txn);
-    xaccAccountBeginEdit(acc);
-    xaccAccountInsertSplit(acc, split);
-    xaccSplitSetBaseValue(split, txn->total, cmdty);
-    xaccAccountCommitEdit(acc);
-    xaccTransCommitEdit(txn->txn);
-}
-
-static void close_accounts_of_type(struct CloseBookWindow* cbw,
-                                   Account* acct,
-                                   GNCAccountType acct_type)
-{
-    struct CloseAccountsCB cacb;
-    Account* root_acct;
-
-    g_return_if_fail(cbw);
-    g_return_if_fail(acct);
-
-    cacb.cbw = cbw;
-    cacb.base_acct = acct;
-    cacb.acct_type = acct_type;
-    cacb.txns = g_hash_table_new_full(g_direct_hash,
-                                      (GEqualFunc)gnc_commodity_equal,
-                                      NULL, g_free);
-
-    /* Iterate through all accounts and set up the balancing splits */
-    root_acct = gnc_book_get_root_account(cbw->book);
-    gnc_account_foreach_descendant(root_acct, close_accounts_cb, &cacb);
-
-    /* now iterate through the transactions and handle each currency */
-    cacb.hash_size = g_hash_table_size(cacb.txns);
-    if (cacb.hash_size)
-        g_hash_table_foreach(cacb.txns, (GHFunc)finish_txn_cb, &cacb);
-
-    /* Destroy the table, freeing the used memory */
-    g_hash_table_destroy(cacb.txns);
-}
-
-static void close_handler(gpointer data)
-{
-    GtkWidget *dialog = data;
-
-    gtk_widget_destroy(dialog);
-}
-
-static void destroy_cb(GObject *object, gpointer data)
-{
-    struct CloseBookWindow *cbw;
-
-    cbw = g_object_get_data(G_OBJECT(object), "CloseBookWindow");
-
-    if (cbw->component_manager_id)
-    {
-        gnc_unregister_gui_component(cbw->component_manager_id);
-        cbw->component_manager_id = 0;
-    }
-}
-
-
-void
-gnc_book_close_response_cb(GtkDialog *dialog, gint response, GtkDialog *unused)
-{
-    struct CloseBookWindow* cbw;
-    Account* income_acct;
-    Account* expense_acct;
-
-    ENTER("dialog %p, response %d, unused %p", dialog, response, unused);
-
-    g_return_if_fail(dialog);
-
-    cbw = g_object_get_data(G_OBJECT(dialog), "CloseBookWindow");
-    g_return_if_fail(cbw);
-
-    switch (response)
-    {
-    case GTK_RESPONSE_HELP:
-        gnc_gnome_help(HF_HELP, HL_CLOSE_BOOK);
-        break;
-    case GTK_RESPONSE_OK:
-        cbw->close_date = gnc_date_edit_get_date(GNC_DATE_EDIT(cbw->close_date_widget));
-        cbw->close_date += (3600 * 12);  /* Add 12 hours to the timestamp */
-        cbw->desc = gtk_entry_get_text(GTK_ENTRY(cbw->desc_widget));
-
-        income_acct = gnc_account_sel_get_account(GNC_ACCOUNT_SEL(cbw->income_acct_widget));
-        expense_acct = gnc_account_sel_get_account(GNC_ACCOUNT_SEL(cbw->expense_acct_widget));
-
-        if (!income_acct)
-        {
-            gnc_error_dialog(cbw->dialog, "%s",
-                             _("Please select an Equity account to hold the total Period Income."));
-            break;
-        }
-
-        if (!expense_acct)
-        {
-            gnc_error_dialog(cbw->dialog, "%s",
-                             _("Please select an Equity account to hold the total Period Expense."));
-            break;
-        }
-
-        gnc_suspend_gui_refresh();
-        close_accounts_of_type(cbw, income_acct, ACCT_TYPE_INCOME);
-        close_accounts_of_type(cbw, expense_acct, ACCT_TYPE_EXPENSE);
-        gnc_resume_gui_refresh();
-
-        /* FALL THROUGH */
-    default:
-        gtk_widget_destroy(GTK_WIDGET(dialog));
-        break;
-    }
-    LEAVE("");
-}
-
-void gnc_ui_close_book (QofBook* book)
-{
-    struct CloseBookWindow *cbw;
-    GtkBuilder* builder;
-    GtkWidget* box;
-    GList* equity_list = NULL;
-
-    g_return_if_fail(book);
-
-    cbw = g_new0(struct CloseBookWindow, 1);
-    g_return_if_fail(cbw);
-    cbw->book = book;
-
-    /* Open the dialog */
-    builder = gtk_builder_new();
-    gnc_builder_add_from_file (builder, "dialog-book-close.glade", "close_book_dialog");
-    cbw->dialog = GTK_WIDGET(gtk_builder_get_object (builder,  "close_book_dialog"));
-
-    // Set the style context for this dialog so it can be easily manipulated with css
-    gnc_widget_set_style_context (GTK_WIDGET(cbw->dialog), "GncBookCloseDialog");
-
-    PINFO("Closed Book Window is %p, Dialog is %p", cbw, cbw->dialog);
-
-    /* close date */
-    box = GTK_WIDGET(gtk_builder_get_object (builder,  "date_box"));
-    cbw->close_date_widget = gnc_date_edit_new(gnc_time (NULL), FALSE, FALSE);
-    gtk_box_pack_start(GTK_BOX(box), cbw->close_date_widget, TRUE, TRUE, 0);
-
-    /* income acct */
-    equity_list = g_list_prepend(equity_list, GINT_TO_POINTER(ACCT_TYPE_EQUITY));
-    box = GTK_WIDGET(gtk_builder_get_object (builder, "income_acct_box"));
-    cbw->income_acct_widget = gnc_account_sel_new();
-    gnc_account_sel_set_acct_filters(GNC_ACCOUNT_SEL(cbw->income_acct_widget),
-                                     equity_list, NULL);
-    gnc_account_sel_set_new_account_ability(GNC_ACCOUNT_SEL(cbw->income_acct_widget), TRUE);
-    gtk_box_pack_start(GTK_BOX(box), cbw->income_acct_widget, TRUE, TRUE, 0);
-
-    /* expense acct */
-    box = GTK_WIDGET(gtk_builder_get_object (builder, "expense_acct_box"));
-    cbw->expense_acct_widget = gnc_account_sel_new();
-    gnc_account_sel_set_acct_filters(GNC_ACCOUNT_SEL(cbw->expense_acct_widget),
-                                     equity_list, NULL);
-    gnc_account_sel_set_new_account_ability(GNC_ACCOUNT_SEL(cbw->expense_acct_widget), TRUE);
-    gtk_box_pack_start(GTK_BOX(box), cbw->expense_acct_widget, TRUE, TRUE, 0);
-
-    /* desc */
-    cbw->desc_widget = GTK_WIDGET(gtk_builder_get_object (builder, "desc_entry"));
-
-    /* Autoconnect signals */
-    gtk_builder_connect_signals_full (builder, gnc_builder_connect_full_func, cbw->dialog);
-
-    /* Register dialog with component manager */
-    cbw->component_manager_id =
-        gnc_register_gui_component(DIALOG_BOOK_CLOSE_CM_CLASS, NULL, close_handler,
-                                   cbw->dialog);
-    gnc_gui_component_set_session(cbw->component_manager_id,
-                                  gnc_get_current_session());
-    g_signal_connect(cbw->dialog, "destroy", G_CALLBACK(destroy_cb), NULL);
-
-    /* Clean up the data structure when the dialog is destroyed */
-    g_object_set_data_full(G_OBJECT(cbw->dialog), "CloseBookWindow", cbw, g_free);
-
-    g_object_unref(G_OBJECT(builder));
-
-    /* Run the dialog */
-    gtk_widget_show_all(cbw->dialog);
-
-    g_list_free(equity_list);
-}
-
diff --git a/src/gnome-utils/dialog-options.h b/src/gnome-utils/dialog-options.h
deleted file mode 100644
index 2ac3a1e..0000000
--- a/src/gnome-utils/dialog-options.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/********************************************************************\
- * dialog-options.h -- GNOME option handling                        *
- * Copyright (C) 1998-2000 Linas Vepstas                            *
- *                                                                  *
- * 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 at gnu.org                   *
-\********************************************************************/
-
-#ifndef OPTIONS_DIALOG_H
-#define OPTIONS_DIALOG_H
-
-#include <libguile.h>
-#include "app-utils/option-util.h"
-#include <gtk/gtk.h>
-
-/** A simple wrapper that casts the gpointer result of
- * gnc_option_get_widget() already into a GtkWidget*. */
-GtkWidget *gnc_option_get_gtk_widget (GNCOption *option);
-
-typedef struct gnc_option_win GNCOptionWin;
-
-typedef void (* GNCOptionWinCallback)(GNCOptionWin *, gpointer data);
-
-GNCOptionWin * gnc_options_dialog_new_modal(gboolean modal, gchar *title,
-                                                const char *component_class);
-GNCOptionWin * gnc_options_dialog_new(gchar *title);
-GNCOptionWin * gnc_options_dialog_new_w_dialog(gchar *title, GtkWidget *dialog);
-void gnc_options_dialog_destroy(GNCOptionWin * win);
-void gnc_options_register_stocks (void);
-
-GtkWidget * gnc_options_dialog_widget(GNCOptionWin * win);
-GtkWidget * gnc_options_page_list(GNCOptionWin * win);
-GtkWidget * gnc_options_dialog_notebook(GNCOptionWin * win);
-
-void gnc_options_dialog_changed (GNCOptionWin *win);
-
-void gnc_option_changed_widget_cb(GtkWidget *widget, GNCOption *option);
-void gnc_option_changed_option_cb(GtkWidget *dummy, GNCOption *option);
-
-void gnc_options_dialog_set_apply_cb(GNCOptionWin * win,
-                                     GNCOptionWinCallback thunk,
-                                     gpointer cb_data);
-void gnc_options_dialog_set_help_cb(GNCOptionWin * win,
-                                    GNCOptionWinCallback thunk,
-                                    gpointer cb_data);
-void gnc_options_dialog_set_close_cb(GNCOptionWin * win,
-                                     GNCOptionWinCallback thunk,
-                                     gpointer cb_data);
-
-void gnc_options_dialog_set_global_help_cb(GNCOptionWinCallback thunk,
-        gpointer cb_data);
-
-void gnc_options_dialog_build_contents(GNCOptionWin *win,
-                                       GNCOptionDB  *odb);
-
-void gnc_options_dialog_build_contents_full(GNCOptionWin *win,
-                                            GNCOptionDB  *odb,
-                                            gboolean show_dialog);
-
-/* Both apply_cb and close_cb should be scheme functions with 0 arguments.
- * References to these functions will be held until the close_cb is called
- */
-void gnc_options_dialog_set_scm_callbacks (GNCOptionWin *win,
-        SCM apply_cb,
-        SCM close_cb);
-
-/*****************************************************************/
-/* Option Registration                                           */
-
-/* Function to set the UI widget based upon the option */
-typedef GtkWidget *
-(*GNCOptionUISetWidget) (GNCOption *option, GtkBox *page_box,
-                         char *name, char *documentation,
-                         /* Return values */
-                         GtkWidget **enclosing, gboolean *packed);
-
-/* Function to set the UI Value for a particular option */
-typedef gboolean
-(*GNCOptionUISetValue)  (GNCOption *option, gboolean use_default,
-                         GtkWidget *widget, SCM value);
-
-/* Function to get the UI Value for a particular option */
-typedef SCM
-(*GNCOptionUIGetValue)  (GNCOption *option, GtkWidget *widget);
-
-
-typedef struct gnc_option_def
-{
-    const char *         option_name;
-    GNCOptionUISetWidget set_widget;
-    GNCOptionUISetValue  set_value;
-    GNCOptionUIGetValue  get_value;
-} GNCOptionDef_t;
-
-
-/* Register a new option type in the UI */
-void gnc_options_ui_initialize (void);
-void gnc_options_ui_register_option (GNCOptionDef_t *option);
-GNCOptionDef_t * gnc_options_ui_get_option (const char *option_name);
-
-#endif /* OPTIONS_DIALOG_H */
diff --git a/src/gnome-utils/dialog-reset-warnings.c b/src/gnome-utils/dialog-reset-warnings.c
deleted file mode 100644
index 2b9252d..0000000
--- a/src/gnome-utils/dialog-reset-warnings.c
+++ /dev/null
@@ -1,426 +0,0 @@
-/***********************************************************************
- * dialog-reset-warnings.c -- "Resert Warnings" dialog                 *
- * Copyright (C) 2005 David Hampton                                    *
- * Copyright (C) 2011 Robert Fewell                                    *
- *                                                                     *
- * 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 at gnu.org                      *
- *                                                                     *
- **********************************************************************/
-
-#include "config.h"
-
-#include <glib/gi18n.h>
-#include <gtk/gtk.h>
-
-#include "dialog-utils.h"
-#include "gnc-engine.h"
-#include "gnc-prefs.h"
-#include "gnc-ui.h"
-#include "gnome-utils/gnc-warnings.h"
-#include "gnc-component-manager.h"
-#include "dialog-reset-warnings.h"
-
-/* This static indicates the debugging module that this .o belongs to.  */
-static QofLogModule log_module = GNC_MOD_PREFS;
-
-#define GNC_PREFS_GROUP                 "dialogs.reset-warnings"
-#define DIALOG_RESET_WARNINGS_CM_CLASS  "reset-warnings"
-#define TIPS_STRING                     "tips"
-
-typedef struct
-{
-    GtkWidget   *dialog;
-    GtkWidget   *perm_vbox_label;
-    GtkWidget   *perm_vbox;
-    GtkWidget   *temp_vbox_label;
-    GtkWidget   *temp_vbox;
-    GtkWidget   *buttonbox;
-    GtkWidget   *nolabel;
-    GtkWidget   *applybutton;
-} RWDialog;
-
-void gnc_reset_warnings_select_all_cb (GtkButton *button, gpointer user_data);
-void gnc_reset_warnings_unselect_all_cb (GtkButton *button, gpointer user_data);
-void gnc_reset_warnings_response_cb (GtkDialog *dialog, gint response, gpointer user_data);
-static void gnc_reset_warnings_add_section (RWDialog *rw_dialog,
-                                            const gchar *section, GtkWidget *box);
-static void gnc_reset_warnings_update_widgets (RWDialog *rw_dialog);
-
-
-/****************************************************
- *  Update the Dialog Widgets
- *  @internal
- *  @param rw_dialog structure.
- ****************************************************/
-static void
-gnc_reset_warnings_update_widgets (RWDialog *rw_dialog)
-{
-    GList *list, *tmp;
-    gboolean any = FALSE, checked = FALSE;
-
-    ENTER("rw_dialog %p", rw_dialog);
-
-    list = gtk_container_get_children(GTK_CONTAINER(rw_dialog->perm_vbox));
-    if (list)
-    {
-        gtk_widget_show_all(rw_dialog->perm_vbox_label);
-        for (tmp = list; tmp; tmp = g_list_next(tmp))
-        {
-            if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(tmp->data)))
-            {
-                checked = TRUE;
-                break;
-            }
-        }
-        g_list_free(list);
-        any = TRUE;
-    }
-    else
-    {
-        gtk_widget_hide(rw_dialog->perm_vbox_label);
-    }
-
-    list = gtk_container_get_children(GTK_CONTAINER(rw_dialog->temp_vbox));
-    if (list)
-    {
-        gtk_widget_show_all(rw_dialog->temp_vbox_label);
-        for (tmp = list; tmp; tmp = g_list_next(tmp))
-        {
-            if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(tmp->data)))
-            {
-                checked = TRUE;
-                break;
-            }
-        }
-        g_list_free(list);
-        any = TRUE;
-    }
-    else
-    {
-        gtk_widget_hide(rw_dialog->temp_vbox_label);
-    }
-
-    if (any)
-    {
-        gtk_widget_show(rw_dialog->buttonbox);
-        gtk_widget_hide(rw_dialog->nolabel);
-        gtk_widget_set_sensitive(rw_dialog->applybutton, checked);
-    }
-    else
-    {
-        gtk_widget_hide(rw_dialog->buttonbox);
-        gtk_widget_show(rw_dialog->nolabel);
-        gtk_widget_set_sensitive(rw_dialog->applybutton, FALSE);
-    }
-    LEAVE(" ");
-}
-
-
-/***************************/
-/*  Helper functions       */
-/***************************/
-static void
-gnc_reset_warnings_apply_one (GtkWidget *widget,
-                              GtkDialog *dialog)
-{
-    const gchar *pref = NULL;
-    const gchar *prefs_group = NULL;
-
-    ENTER("widget %p, dialog %p", widget, dialog);
-
-    if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)))
-    {
-        LEAVE("not active");
-        return;
-    }
-
-    pref = gtk_widget_get_name(widget);
-    prefs_group = g_object_get_data (G_OBJECT (widget), "prefs-group");
-    if (prefs_group)
-        gnc_prefs_reset (prefs_group, pref);
-    gtk_widget_destroy(widget);
-    LEAVE(" ");
-}
-
-
-static void
-gnc_reset_warnings_apply_changes (RWDialog *rw_dialog)
-{
-    ENTER("rw_dialog %p", rw_dialog);
-
-    gtk_container_foreach(GTK_CONTAINER(rw_dialog->perm_vbox),
-                          (GtkCallback)gnc_reset_warnings_apply_one,
-                          rw_dialog->dialog);
-
-    gtk_container_foreach(GTK_CONTAINER(rw_dialog->temp_vbox),
-                          (GtkCallback)gnc_reset_warnings_apply_one,
-                          rw_dialog->dialog);
-    gnc_reset_warnings_update_widgets(rw_dialog);
-    LEAVE(" ");
-}
-
-
-/***************************/
-/*    Dialog Callbacks     */
-/***************************/
-void
-gnc_reset_warnings_response_cb (GtkDialog *dialog,
-                                gint response,
-                                gpointer user_data)
-{
-    RWDialog *rw_dialog = user_data;
-
-    ENTER("dialog %p, response %d, user_data %p", dialog, response, user_data);
-
-    switch (response)
-    {
-    case GTK_RESPONSE_APPLY:
-        gnc_reset_warnings_apply_changes(rw_dialog);
-        break;
-
-    case GTK_RESPONSE_OK:
-        gnc_reset_warnings_apply_changes(rw_dialog);
-        gnc_save_window_size(GNC_PREFS_GROUP, GTK_WINDOW(rw_dialog->dialog));
-        gnc_unregister_gui_component_by_data(DIALOG_RESET_WARNINGS_CM_CLASS,
-                                             rw_dialog);
-        gtk_widget_destroy(GTK_WIDGET(rw_dialog->dialog));
-        break;
-
-    default:
-        gnc_unregister_gui_component_by_data(DIALOG_RESET_WARNINGS_CM_CLASS,
-                                             rw_dialog);
-        gtk_widget_destroy(GTK_WIDGET(rw_dialog->dialog));
-        break;
-    }
-    LEAVE("");
-}
-
-
-static void
-gnc_reset_warnings_select_common (RWDialog *rw_dialog,
-                                  gboolean selected)
-{
-    ENTER("rw_dialog %p, selected %d", rw_dialog, selected);
-
-    gtk_container_foreach(GTK_CONTAINER(rw_dialog->perm_vbox),
-                          (GtkCallback)gtk_toggle_button_set_active,
-                          GINT_TO_POINTER(selected));
-
-    gtk_container_foreach(GTK_CONTAINER(rw_dialog->temp_vbox),
-                          (GtkCallback)gtk_toggle_button_set_active,
-                          GINT_TO_POINTER(selected));
-    gnc_reset_warnings_update_widgets(rw_dialog);
-    LEAVE(" ");
-}
-
-
-void
-gnc_reset_warnings_select_all_cb (GtkButton *button,
-                                  gpointer user_data)
-{
-    RWDialog *rw_dialog = user_data;
-    gnc_reset_warnings_select_common(rw_dialog, TRUE);
-}
-
-
-void
-gnc_reset_warnings_unselect_all_cb (GtkButton *button,
-                                    gpointer user_data)
-{
-    RWDialog *rw_dialog = user_data;
-    gnc_reset_warnings_select_common(rw_dialog, FALSE);
-}
-
-
-/***********************************************************************
- *  This call back function adds a warning to the correct dialog box.
- *
- *  @internal
- *  @param rw_dialog, the data structure
- *  @param prefs_group the preference group that holds the warning status.
- *  @param warning a record with details for one warning.
- *  @param box, the required dialog box to update.
- ***********************************************************************/
-static void
-gnc_reset_warnings_add_one (RWDialog *rw_dialog, const gchar *prefs_group,
-                            const GncWarningSpec *warning, GtkWidget *box)
-{
-    GtkWidget *checkbox;
-
-    ENTER("rw_dialog %p, warning %p, box %p", rw_dialog, warning, box);
-
-    checkbox = gtk_check_button_new_with_label( _(warning->warn_desc ? warning->warn_desc : warning->warn_name));
-    if (warning->warn_long_desc)
-        gtk_widget_set_tooltip_text(checkbox, _(warning->warn_long_desc));
-
-    gtk_widget_set_name(checkbox, warning->warn_name);
-    g_object_set_data_full (G_OBJECT (checkbox), "prefs-group", g_strdup(prefs_group),
-                            (GDestroyNotify) g_free);
-    g_signal_connect_swapped(G_OBJECT(checkbox), "toggled",
-                             (GCallback)gnc_reset_warnings_update_widgets, rw_dialog);
-    gtk_box_pack_start(GTK_BOX(box), checkbox, TRUE, TRUE, 0);
-    LEAVE(" ");
-}
-
-
-/********************************************************************
- *  Add all warnings found in the given preference group
- *  to the dialog box.
- *
- *  @internal
- *  @param The reset warnings data structure
- *  @param The preference group.
- *  @param The required dialog box to update.
- ********************************************************************/
-static void
-gnc_reset_warnings_add_section (RWDialog *rw_dialog, const gchar *prefs_group, GtkWidget *box)
-{
-    const GncWarningSpec *warning = gnc_get_warnings();
-    gint i = 0;
-
-    ENTER("rw_dialog %p, section %s, box %p", rw_dialog, prefs_group, box);
-
-    for (i = 0; warning[i].warn_name; i++)
-    {
-        if (gnc_prefs_get_int(prefs_group, warning[i].warn_name) != 0)
-        {
-            gnc_reset_warnings_add_one(rw_dialog, prefs_group, &warning[i], box);
-        }
-    }
-
-    LEAVE(" ");
-}
-
-
-/***********************************************************************
- *  Raise the rw dialog to the top of the window stack.  This
- *  function is called if the user attempts to create a second rw
- *  dialog.
- *
- *  @internal
- *  @param class_name Unused.
- *  @param component_id Unused.
- *  @param user_data A pointer to the rw structure.
- *  @param iter_data Unused.
- ***********************************************************************/
-static gboolean
-show_handler (const char *class_name, gint component_id,
-              gpointer user_data, gpointer iter_data)
-{
-    RWDialog *rw_dialog = user_data;
-
-    ENTER(" ");
-    if (!rw_dialog)
-    {
-        LEAVE("no data strucure");
-        return(FALSE);
-    }
-
-    ENTER(" ");
-    gtk_window_present(GTK_WINDOW(rw_dialog->dialog));
-    LEAVE(" ");
-
-    return(TRUE);
-}
-
-
-/****************************************************
- *  Close the reset warnings dialog.
- *  @internal
- *  @param user_data A pointer to the rw structure.
- ****************************************************/
-static void
-close_handler (gpointer user_data)
-{
-    RWDialog *rw_dialog = user_data;
-
-    ENTER(" ");
-    gnc_unregister_gui_component_by_data(DIALOG_RESET_WARNINGS_CM_CLASS, rw_dialog);
-    gtk_widget_destroy(rw_dialog->dialog);
-    LEAVE(" ");
-}
-
-
-/***********************************************/
-/*     Create the Reset Warnings Dialog        */
-/***********************************************/
-void
-gnc_reset_warnings_dialog (GtkWindow *parent)
-{
-    RWDialog   *rw_dialog;
-    GtkWidget  *dialog;
-    GtkBuilder *builder;
-
-    rw_dialog = g_new0 (RWDialog, 1);
-
-    ENTER("");
-    if (gnc_forall_gui_components(DIALOG_RESET_WARNINGS_CM_CLASS,
-                                  show_handler, NULL))
-    {
-        LEAVE("existing window");
-        return;
-    }
-
-    DEBUG("Opening dialog-reset-warnings.glade:");
-    builder = gtk_builder_new();
-    gnc_builder_add_from_file (builder, "dialog-reset-warnings.glade", "reset_warnings_dialog");
-    dialog = GTK_WIDGET(gtk_builder_get_object (builder, "reset_warnings_dialog"));
-
-    // Set the style context for this dialog so it can be easily manipulated with css
-    gnc_widget_set_style_context (GTK_WIDGET(dialog), "GncResetWarningsDialog");
-
-    gtk_window_set_transient_for(GTK_WINDOW (dialog), parent);
-
-    rw_dialog->dialog = dialog;
-    PINFO("rw_dialog %p, dialog %p", rw_dialog, dialog);
-
-    /* Connect the signals */
-    gtk_builder_connect_signals_full (builder, gnc_builder_connect_full_func, rw_dialog);
-
-    DEBUG("permanent");
-    rw_dialog->perm_vbox_label = GTK_WIDGET(gtk_builder_get_object (builder, "perm_vbox_and_label"));
-    rw_dialog->perm_vbox = GTK_WIDGET(gtk_builder_get_object (builder, "perm_vbox"));
-    gnc_reset_warnings_add_section(rw_dialog, GNC_PREFS_GROUP_WARNINGS_PERM, rw_dialog->perm_vbox);
-
-    DEBUG("temporary");
-    rw_dialog->temp_vbox_label = GTK_WIDGET(gtk_builder_get_object (builder, "temp_vbox_and_label"));
-    rw_dialog->temp_vbox = GTK_WIDGET(gtk_builder_get_object (builder, "temp_vbox"));
-    gnc_reset_warnings_add_section(rw_dialog, GNC_PREFS_GROUP_WARNINGS_TEMP, rw_dialog->temp_vbox);
-
-    rw_dialog->buttonbox = GTK_WIDGET(gtk_builder_get_object (builder, "hbuttonbox"));
-
-    rw_dialog->nolabel = GTK_WIDGET(gtk_builder_get_object (builder, "no_warnings"));
-    rw_dialog->applybutton = GTK_WIDGET(gtk_builder_get_object (builder, "applybutton"));
-
-    /* Enable the proper response buttons */
-    gnc_reset_warnings_update_widgets(rw_dialog);
-
-    /* Record the pointer to the rw data structure and clean up after */
-    g_object_set_data_full(G_OBJECT(rw_dialog->dialog), "dialog-structure", rw_dialog, g_free);
-
-    gnc_restore_window_size(GNC_PREFS_GROUP, GTK_WINDOW(rw_dialog->dialog));
-
-    gnc_register_gui_component (DIALOG_RESET_WARNINGS_CM_CLASS,
-                                NULL, close_handler, rw_dialog);
-
-    gtk_widget_show(GTK_WIDGET(rw_dialog->dialog));
-
-    g_object_unref(G_OBJECT(builder));
-
-    LEAVE(" ");
-}
diff --git a/src/gnome-utils/dialog-transfer.c b/src/gnome-utils/dialog-transfer.c
deleted file mode 100644
index 59cd549..0000000
--- a/src/gnome-utils/dialog-transfer.c
+++ /dev/null
@@ -1,2499 +0,0 @@
-/********************************************************************\
- * dialog-transfer.c -- transfer dialog for GnuCash                 *
- * Copyright (C) 1999 Linas Vepstas                                 *
- * Copyright (C) 2000 Dave Peticolas                                *
- * Copyright (C) 2000 Herbert Thoma                                 *
- *                                                                  *
- * 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 at gnu.org                   *
-\********************************************************************/
-
-#include "config.h"
-
-#include <gtk/gtk.h>
-#include <gdk/gdkkeysyms.h>
-#include <glib/gi18n.h>
-
-#include "dialog-transfer.h"
-#include "dialog-utils.h"
-#include "gnc-amount-edit.h"
-#include "gnc-component-manager.h"
-#include "gnc-date-edit.h"
-#include "gnc-engine.h"
-#include "gnc-euro.h"
-#include "gnc-exp-parser.h"
-#include "gnc-prefs.h"
-#include "gnc-gui-query.h"
-#include "gnc-pricedb.h"
-#include "gnc-tree-view-account.h"
-#include "gnc-ui.h"
-#include "Transaction.h"
-#include "Account.h"
-#include <libguile.h>
-#include "swig-runtime.h"
-#include "guile-mappings.h"
-#include "engine-helpers.h"
-#include "engine-helpers-guile.h"
-#include "app-utils/QuickFill.h"
-#include <gnc-commodity.h>
-
-
-#define DIALOG_TRANSFER_CM_CLASS "dialog-transfer"
-#define GNC_PREFS_GROUP "dialogs.transfer"
-
-typedef enum
-{
-    XFER_DIALOG_FROM,
-    XFER_DIALOG_TO
-} XferDirection;
-
-
-/* This static indicates the debugging module that this .o belongs to.  */
-static QofLogModule log_module = GNC_MOD_GUI;
-
-struct _xferDialog
-{
-    GtkWidget *dialog;
-    GtkWidget *amount_edit;
-    GtkWidget *date_entry;
-    GtkWidget *num_entry;
-    GtkWidget *description_entry;
-    GtkWidget *memo_entry;
-    GtkWidget *conv_forward;
-    GtkWidget *conv_reverse;
-
-    GtkWidget *from_window;
-    GtkTreeView * from_tree_view;
-    gnc_commodity *from_commodity;
-    GtkWidget *to_window;
-    GtkTreeView *to_tree_view;
-    gnc_commodity *to_commodity;
-
-    QuickFill *qf;     /* Quickfill on transfer descriptions,
-                          defaults to matching on the "From" account. */
-
-    XferDirection quickfill;    /* direction match on the account instead. */
-
-    /* stored data for the description quickfill selection function */
-    gint desc_start_selection;
-    gint desc_end_selection;
-    guint desc_selection_source_id;
-
-    GtkWidget *transferinfo_label;
-
-    GtkWidget *from_transfer_label;
-    GtkWidget *to_transfer_label;
-
-    GtkWidget *from_currency_label;
-    GtkWidget *to_currency_label;
-
-    GtkWidget *from_show_button;
-    GtkWidget *to_show_button;
-
-    GtkWidget *curr_xfer_table;
-
-    GtkWidget *price_edit;
-    GtkWidget *to_amount_edit;
-
-    GtkWidget *price_radio;
-    GtkWidget *amount_radio;
-
-    GtkWidget *fetch_button;
-
-    QofBook *book;
-    GNCPriceDB *pricedb;
-
-    /* Where to store the "exchange_rate" at exit (in lieu of
-     * creating a transaction)
-     */
-    gnc_numeric *exch_rate;
-    PriceSource price_source;
-    const char *price_type;
-
-    /* Callback function to notify of the newly created Transaction */
-    gnc_xfer_dialog_cb transaction_cb;
-    /* , and its user_data */
-    gpointer transaction_user_data;
-};
-
-/** Structure passed to "filter tree accounts" function to provide it information */
-typedef struct
-{
-    /** Show income/expense accounts in tree */
-    gboolean show_inc_exp;
-
-    /** Show hidden accounts in tree */
-    gboolean show_hidden;
-} AccountTreeFilterInfo;
-
-static AccountTreeFilterInfo *from_info = NULL;
-static AccountTreeFilterInfo *to_info   = NULL;
-
-struct _acct_list_item
-{
-    char *acct_full_name;
-    Account *acct;
-};
-typedef struct _acct_list_item acct_list_item;
-
-
-/** Prototypes ***************************************************/
-static void gnc_xfer_update_to_amount (XferDialog *xferData);
-static void gnc_xfer_dialog_update_conv_info(XferDialog *xferData);
-
-static Account *gnc_transfer_dialog_get_selected_account (XferDialog *dialog,
-                                                          XferDirection direction);
-static void gnc_transfer_dialog_set_selected_account (XferDialog *dialog,
-                                                      Account *account,
-                                                      XferDirection direction);
-
-void gnc_xfer_description_insert_cb(GtkEditable *editable,
-                                    const gchar *insert_text,
-                                    const gint insert_text_len,
-                                    gint *start_pos,
-                                    XferDialog *xferData);
-gboolean gnc_xfer_description_key_press_cb( GtkEntry *entry,
-                                            GdkEventKey *event,
-                                            XferDialog *xferData );
-void gnc_xfer_dialog_fetch (GtkButton *button, XferDialog *xferData);
-gboolean gnc_xfer_dialog_inc_exp_filter_func (Account *account,
-                                              gpointer data);
-void price_amount_radio_toggled_cb(GtkToggleButton *togglebutton, gpointer data);
-
-void gnc_xfer_dialog_response_cb (GtkDialog *dialog, gint response, gpointer data);
-void gnc_xfer_dialog_close_cb(GtkDialog *dialog, gpointer data);
-
-/** Implementations **********************************************/
-
-static gnc_numeric
-gnc_xfer_dialog_compute_price_value (XferDialog *xferData)
-{
-    gnc_numeric from_amt, to_amt;
-    g_return_val_if_fail (xferData != NULL, gnc_numeric_error (GNC_ERROR_ARG));
-
-    from_amt = gnc_amount_edit_get_amount(GNC_AMOUNT_EDIT(xferData->amount_edit));
-    to_amt = gnc_amount_edit_get_amount(GNC_AMOUNT_EDIT(xferData->to_amount_edit));
-
-    return(gnc_numeric_div(to_amt, from_amt, GNC_DENOM_AUTO, GNC_HOW_DENOM_REDUCE));
-}
-
-/* Round a price value according to this policy:
- * If both commodities are currencies, round to a fixed denominator.
- * If only one is a currency, round to the currency's scu * a fixed factor.
- * The fixed values are defined in gnc-pricedb.h
- */
-static gnc_numeric
-round_price(gnc_commodity *from, gnc_commodity *to, gnc_numeric value)
-{
-    if (gnc_commodity_is_currency(from) && gnc_commodity_is_currency(to))
-        value = gnc_numeric_convert(value, CURRENCY_DENOM,
-                                    GNC_HOW_RND_ROUND_HALF_UP);
-    else if (gnc_commodity_is_currency(to))
-    {
-        int scu = gnc_commodity_get_fraction (to);
-        value = gnc_numeric_convert(value, scu * COMMODITY_DENOM_MULT,
-                                    GNC_HOW_RND_ROUND_HALF_UP);
-    }
-    else if (gnc_commodity_is_currency(from))
-    {
-        int scu = gnc_commodity_get_fraction (from);
-        value = gnc_numeric_convert(value, scu * COMMODITY_DENOM_MULT,
-                                    GNC_HOW_RND_ROUND_HALF_UP);
-    }
-    return value;
-}
-
-typedef enum
-{
-    SAME_DAY,
-    NEAREST,
-    LATEST
-} PriceDate;
-
-typedef struct
-{
-    GNCPrice *price;
-    GNCPriceDB *pricedb;
-    gnc_commodity *from;
-    gnc_commodity *to;
-    Timespec ts;
-    gboolean reverse;
-} PriceReq;
-
-static void
-price_request_from_xferData(PriceReq *pr, XferDialog *xd)
-{
-    g_return_if_fail (pr != NULL);
-    g_return_if_fail (xd != NULL);
-    pr->price = NULL;
-    pr->pricedb = xd->pricedb;
-    pr->from = xd->from_commodity;
-    pr->to = xd->to_commodity;
-    pr->ts = gnc_date_edit_get_date_ts (GNC_DATE_EDIT (xd->date_entry));
-    pr->reverse = FALSE;
-}
-
-static gboolean
-lookup_price(PriceReq *pr, PriceDate pd)
-{
-    GNCPrice *prc = NULL;
-    g_return_val_if_fail (pr != NULL, FALSE);
-    g_return_val_if_fail (pr->pricedb != NULL, FALSE);
-    g_return_val_if_fail (pr->from != NULL, FALSE);
-    g_return_val_if_fail (pr->to != NULL, FALSE);
-
-    pr->reverse = FALSE;
-    switch (pd)
-    {
-        default:
-        case SAME_DAY:
-            prc = gnc_pricedb_lookup_day (pr->pricedb, pr->from,
-                                          pr->to, pr->ts);
-            break;
-        case NEAREST:
-            prc = gnc_pricedb_lookup_nearest_in_time (pr->pricedb, pr->from,
-                                                      pr->to, pr->ts);
-            break;
-        case LATEST:
-            prc = gnc_pricedb_lookup_latest (pr->pricedb, pr->from, pr->to);
-            break;
-    }
-    if (gnc_commodity_equiv(gnc_price_get_currency(prc), pr->from))
-    {
-        pr->reverse = TRUE;
-        PINFO("Found reverse price: 1 %s = %f %s",
-              gnc_commodity_get_mnemonic(pr->to),
-              gnc_numeric_to_double(gnc_price_get_value(prc)),
-              gnc_commodity_get_mnemonic(pr->from));
-
-    }
-    else
-    {
-        PINFO("Found price: 1 %s = %f %s",
-              gnc_commodity_get_mnemonic(pr->from),
-              gnc_numeric_to_double(gnc_price_get_value(prc)),
-              gnc_commodity_get_mnemonic(pr->to));
-    }
-    if (!prc)
-        return FALSE;
-    pr->price = prc;
-    return TRUE;
-}
-
-/* (maybe) update the price from the pricedb. */
-static void
-gnc_xfer_dialog_update_price (XferDialog *xferData)
-{
-    PriceReq pr;
-    gnc_numeric price_value;
-
-    if (!xferData) return;
-    if (!xferData->from_commodity || ! xferData->to_commodity) return;
-    if (gnc_commodity_equal (xferData->from_commodity, xferData->to_commodity))
-        return;
-    if (!xferData->pricedb) return;
-
-    price_request_from_xferData(&pr, xferData);
-    if (!lookup_price(&pr, SAME_DAY))
-        if (!lookup_price(&pr, NEAREST))
-        return;
-
-    /* grab the price from the pricedb */
-    price_value = gnc_price_get_value (pr.price);
-    if (pr.reverse)
-        price_value = gnc_numeric_invert (price_value);
-    gnc_price_unref(pr.price);
-
-    /* and set the price entry */
-    gnc_xfer_dialog_set_price_edit(xferData, price_value);
-
-    /* And then update the to_amount */
-    gnc_xfer_update_to_amount (xferData);
-}
-
-static void
-gnc_xfer_dialog_toggle_cb(GtkToggleButton *button, gpointer data)
-{
-    AccountTreeFilterInfo* info;
-    GncTreeViewAccount* treeview = GNC_TREE_VIEW_ACCOUNT (data);
-
-    info = g_object_get_data (G_OBJECT(treeview), "filter-info");
-    if (info)
-    {
-        info->show_inc_exp = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button));
-        info->show_hidden = FALSE;
-
-        gnc_tree_view_account_refilter (treeview);
-    }
-}
-
-static gboolean
-gnc_xfer_dialog_key_press_cb (GtkWidget   *widget,
-                              GdkEventKey *event,
-                              gpointer     unused)
-{
-    GtkWidget *toplevel;
-
-    if ((event->keyval == GDK_KEY_Return) || (event->keyval == GDK_KEY_KP_Enter))
-    {
-        toplevel = gtk_widget_get_toplevel (widget);
-        if (gtk_widget_is_toplevel(toplevel) && GTK_IS_WINDOW(toplevel))
-        {
-            gtk_window_activate_default(GTK_WINDOW(toplevel));
-            return TRUE;
-        }
-    }
-    return FALSE;
-}
-
-static void
-gnc_xfer_dialog_set_price_auto (XferDialog *xferData,
-                                gboolean currency_active,
-                                const gnc_commodity *from_currency,
-                                const gnc_commodity *to_currency)
-{
-    gnc_numeric from_rate;
-    gnc_numeric to_rate;
-    gnc_numeric price_value;
-
-    if (!currency_active)
-    {
-        GtkEntry *entry;
-        gnc_xfer_dialog_set_price_edit(xferData, gnc_numeric_zero());
-        entry = GTK_ENTRY(gnc_amount_edit_gtk_entry
-                          (GNC_AMOUNT_EDIT(xferData->price_edit)));
-        gtk_entry_set_text(entry, "");
-
-        gnc_xfer_update_to_amount (xferData);
-
-        return;
-    }
-
-    if (!gnc_is_euro_currency (from_currency) ||
-        !gnc_is_euro_currency (to_currency))
-    {
-        gnc_xfer_dialog_update_price (xferData);
-        return;
-    }
-
-    from_rate = gnc_euro_currency_get_rate (from_currency);
-    to_rate = gnc_euro_currency_get_rate (to_currency);
-
-    if (gnc_numeric_zero_p (from_rate) || gnc_numeric_zero_p (to_rate))
-        gnc_xfer_dialog_update_price (xferData);
-
-    price_value = gnc_numeric_div (to_rate, from_rate, GNC_DENOM_AUTO, GNC_HOW_DENOM_REDUCE);
-
-    gnc_amount_edit_set_amount (GNC_AMOUNT_EDIT(xferData->price_edit), price_value);
-
-    gnc_xfer_update_to_amount (xferData);
-}
-
-static void
-gnc_xfer_dialog_curr_acct_activate(XferDialog *xferData)
-{
-    Account *to_account;
-    Account *from_account;
-    gboolean curr_active;
-
-    g_return_if_fail (xferData != NULL);
-    from_account =
-        gnc_transfer_dialog_get_selected_account (xferData, XFER_DIALOG_FROM);
-
-    to_account =
-        gnc_transfer_dialog_get_selected_account (xferData, XFER_DIALOG_TO);
-
-    curr_active = (xferData->exch_rate ||
-                   ((from_account != NULL) && (to_account != NULL)))
-        && !gnc_commodity_equiv(xferData->from_commodity,
-                                xferData->to_commodity);
-
-    gtk_widget_set_sensitive(xferData->curr_xfer_table, curr_active);
-    gtk_widget_set_sensitive(xferData->price_edit,
-                             curr_active && gtk_toggle_button_get_active
-                             (GTK_TOGGLE_BUTTON(xferData->price_radio)));
-    gtk_widget_set_sensitive(xferData->to_amount_edit,
-                             curr_active && gtk_toggle_button_get_active
-                             (GTK_TOGGLE_BUTTON(xferData->amount_radio)));
-    gtk_widget_set_sensitive(xferData->price_radio, curr_active);
-    gtk_widget_set_sensitive(xferData->amount_radio, curr_active);
-
-    gnc_xfer_dialog_set_price_auto (xferData, curr_active,
-                                    xferData->from_commodity, xferData->to_commodity);
-    gnc_xfer_dialog_update_conv_info(xferData);
-
-    if (!curr_active)
-    {
-        GtkEntry *entry;
-
-        gnc_amount_edit_set_amount(GNC_AMOUNT_EDIT(xferData->to_amount_edit),
-                                   gnc_numeric_zero ());
-        entry = GTK_ENTRY(gnc_amount_edit_gtk_entry
-                          (GNC_AMOUNT_EDIT(xferData->to_amount_edit)));
-        gtk_entry_set_text(entry, "");
-    }
-}
-
-
-void
-price_amount_radio_toggled_cb(GtkToggleButton *togglebutton, gpointer data)
-{
-    XferDialog *xferData = data;
-    g_return_if_fail (xferData != NULL);
-
-    gtk_widget_set_sensitive(xferData->price_edit, gtk_toggle_button_get_active
-                             (GTK_TOGGLE_BUTTON(xferData->price_radio)));
-    gtk_widget_set_sensitive(xferData->to_amount_edit,
-                             gtk_toggle_button_get_active
-                             (GTK_TOGGLE_BUTTON(xferData->amount_radio)));
-}
-
-
-/* Reload the xferDialog quickfill with the descriptions
- * from the currently selected from account.  Note that this
- * doesn't use the initial account passed into gnc_xfer_dialog,
- * because that's NULL if no account is selected in the main
- * account window tree view.
- */
-static void
-gnc_xfer_dialog_reload_quickfill( XferDialog *xferData )
-{
-    GList *splitlist, *node;
-    Split *split;
-    Transaction *trans;
-    Account *account;
-
-    account = gnc_transfer_dialog_get_selected_account (xferData, xferData->quickfill);
-
-    /* get a new QuickFill to use */
-    gnc_quickfill_destroy( xferData->qf );
-    xferData->qf = gnc_quickfill_new();
-
-    splitlist = xaccAccountGetSplitList( account );
-
-    for ( node = splitlist; node; node = node->next )
-    {
-        split = node->data;
-        trans = xaccSplitGetParent( split );
-        gnc_quickfill_insert( xferData->qf,
-                              xaccTransGetDescription (trans), QUICKFILL_LIFO);
-    }
-}
-
-
-static void
-gnc_xfer_dialog_from_tree_selection_changed_cb (GtkTreeSelection *selection,
-                                                gpointer data)
-{
-    XferDialog *xferData = data;
-    GNCPrintAmountInfo print_info;
-    gnc_commodity *commodity;
-    Account *account;
-
-    account = gnc_transfer_dialog_get_selected_account (xferData, XFER_DIALOG_FROM);
-    if (!account)
-        return;
-
-    commodity = gnc_account_or_default_currency(account, NULL);
-    gtk_label_set_text(GTK_LABEL(xferData->from_currency_label),
-                       gnc_commodity_get_printname(commodity));
-
-    xferData->from_commodity = commodity;
-
-    print_info = gnc_account_print_info (account, FALSE);
-    gnc_amount_edit_set_print_info (GNC_AMOUNT_EDIT (xferData->amount_edit),
-                                    print_info);
-    gnc_amount_edit_set_fraction (GNC_AMOUNT_EDIT (xferData->amount_edit),
-                                  xaccAccountGetCommoditySCU (account));
-
-    gnc_xfer_dialog_curr_acct_activate(xferData);
-
-    /* Reload the xferDialog quickfill if it is based on the from account */
-    if (xferData->quickfill == XFER_DIALOG_FROM)
-        gnc_xfer_dialog_reload_quickfill(xferData);
-}
-
-
-static void
-gnc_xfer_dialog_to_tree_selection_changed_cb (GtkTreeSelection *selection, gpointer data)
-{
-    XferDialog *xferData = data;
-    GNCPrintAmountInfo print_info;
-    gnc_commodity *commodity;
-    Account *account;
-
-    account = gnc_transfer_dialog_get_selected_account (xferData, XFER_DIALOG_TO);
-    if (!account)
-        return;
-
-    commodity = xaccAccountGetCommodity(account);
-    gtk_label_set_text(GTK_LABEL(xferData->to_currency_label),
-                       gnc_commodity_get_printname(commodity));
-
-    xferData->to_commodity = commodity;
-
-    print_info = gnc_account_print_info (account, FALSE);
-    gnc_amount_edit_set_print_info (GNC_AMOUNT_EDIT (xferData->to_amount_edit),
-                                    print_info);
-    gnc_amount_edit_set_fraction (GNC_AMOUNT_EDIT (xferData->to_amount_edit),
-                                  xaccAccountGetCommoditySCU (account));
-
-    gnc_xfer_dialog_curr_acct_activate(xferData);
-
-    /* Reload the xferDialog quickfill if it is based on the to account */
-    if (xferData->quickfill == XFER_DIALOG_TO)
-        gnc_xfer_dialog_reload_quickfill(xferData);
-}
-
-gboolean
-gnc_xfer_dialog_inc_exp_filter_func (Account *account,
-                                     gpointer data)
-{
-    AccountTreeFilterInfo* info;
-    GNCAccountType type;
-
-    info = (AccountTreeFilterInfo*)data;
-
-    if (!info->show_hidden && xaccAccountIsHidden(account))
-    {
-        return FALSE;
-    }
-
-    if (info->show_inc_exp)
-    {
-        return TRUE;
-    }
-
-    type = xaccAccountGetType(account);
-    return ((type != ACCT_TYPE_INCOME) && (type != ACCT_TYPE_EXPENSE));
-}
-
-static void
-gnc_xfer_dialog_fill_tree_view(XferDialog *xferData,
-                               XferDirection direction)
-{
-    GtkTreeView *tree_view;
-    const char *show_inc_exp_message = _("Show the income and expense accounts");
-    GtkWidget *scroll_win;
-    GtkWidget *button;
-    GtkTreeSelection *selection;
-    gboolean  use_accounting_labels;
-    AccountTreeFilterInfo *info;
-    GtkBuilder *builder = g_object_get_data (G_OBJECT (xferData->dialog), "builder");
-
-    g_return_if_fail (xferData != NULL);
-    use_accounting_labels = gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL,
-                                               GNC_PREF_ACCOUNTING_LABELS);
-
-    /* In "normal" mode (non accounting terms) the account where the
-     * money comes from is displayed on the left side and the account
-     * where the money gets transferred to is displayed on the right
-     * side. In accounting terms the "from" account is called the
-     * "credit" account ("Haben" in german) and the "to" account is
-     * called "debit" account ("Soll" in german). Accountants told me
-     * that they always want the credit account on the right side
-     * and the debit on the left side (like the debit and credit
-     * columns in the register window). So reverse from and to account
-     * trees when in "accountant" mode. -- Herbert Thoma, 2004-01-18
-     */
-    if (use_accounting_labels)
-    {
-        button = GTK_WIDGET(gtk_builder_get_object (builder,
-                                                    (direction == XFER_DIALOG_TO) ?
-                                                    "left_show_button" : "right_show_button"));
-        scroll_win = GTK_WIDGET(gtk_builder_get_object (builder,
-                                                        (direction == XFER_DIALOG_TO) ?
-                                                        "left_trans_window" : "right_trans_window"));
-    }
-    else
-    {
-        button = GTK_WIDGET(gtk_builder_get_object (builder,
-                                                    (direction == XFER_DIALOG_TO) ?
-                                                    "right_show_button" : "left_show_button"));
-        scroll_win = GTK_WIDGET(gtk_builder_get_object (builder,
-                                                        (direction == XFER_DIALOG_TO) ?
-                                                        "right_trans_window" : "left_trans_window"));
-    }
-
-
-    if (direction == XFER_DIALOG_TO)
-        info = to_info;
-    else
-        info = from_info;
-
-    tree_view = GTK_TREE_VIEW(gnc_tree_view_account_new(FALSE));
-    gtk_container_add(GTK_CONTAINER(scroll_win), GTK_WIDGET(tree_view));
-    info->show_inc_exp = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button));
-    info->show_hidden = FALSE;
-    gnc_tree_view_account_set_filter (GNC_TREE_VIEW_ACCOUNT (tree_view),
-                                      gnc_xfer_dialog_inc_exp_filter_func,
-                                      info,  /* user data */
-                                      NULL    /* destroy callback */);
-    g_object_set_data (G_OBJECT(tree_view), "filter-info", info);
-
-    gtk_widget_show(GTK_WIDGET(tree_view));
-    g_signal_connect (G_OBJECT (tree_view), "key-press-event",
-                      G_CALLBACK (gnc_xfer_dialog_key_press_cb), NULL);
-
-    selection = gtk_tree_view_get_selection (tree_view);
-    gtk_tree_selection_set_mode (selection, GTK_SELECTION_BROWSE);
-
-    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), FALSE);
-    gtk_widget_set_tooltip_text (button, show_inc_exp_message);
-
-    if (direction == XFER_DIALOG_TO)
-    {
-        xferData->to_tree_view = tree_view;
-        xferData->to_window = scroll_win;
-        xferData->to_show_button = GTK_WIDGET (button);
-        g_signal_connect (G_OBJECT (selection), "changed",
-                          G_CALLBACK (gnc_xfer_dialog_to_tree_selection_changed_cb), xferData);
-    }
-    else
-    {
-        xferData->from_tree_view = tree_view;
-        xferData->from_window = scroll_win;
-        xferData->from_show_button = GTK_WIDGET (button);
-        g_signal_connect (G_OBJECT (selection), "changed",
-                          G_CALLBACK (gnc_xfer_dialog_from_tree_selection_changed_cb), xferData);
-    }
-    g_signal_connect (G_OBJECT (button), "toggled",
-                      G_CALLBACK (gnc_xfer_dialog_toggle_cb), tree_view);
-}
-
-
-static void
-gnc_parse_error_dialog (XferDialog *xferData, const char *error_string)
-{
-    const char * parse_error_string;
-    g_return_if_fail (xferData != NULL);
-
-    parse_error_string = gnc_exp_parser_error_string ();
-    if (parse_error_string == NULL)
-        parse_error_string = "";
-
-    if (error_string == NULL)
-        error_string = "";
-
-    gnc_error_dialog (xferData->dialog,
-                      "%s\n\n%s: %s.",
-                      error_string, _("Error"),
-                      parse_error_string);
-}
-
-/*** Callbacks for description quickfill. ***/
-
-/* gnc_xfer_dialog_quickfill will update the fields of the dialog
- * based on the contents of the Description entry.  Returns TRUE
- * if the fields were updated, or FALSE if the fields were already
- * updated or if the Description couldn't be matched and no updates
- * were made.
- */
-static gboolean
-gnc_xfer_dialog_quickfill( XferDialog *xferData )
-{
-    const char *desc;
-    Account *match_account;  /* the matched text was from this account */
-    Split *split;            /* the split to autocomplete from */
-    Split *other = NULL;     /* the other split of the transaction */
-    Account *other_acct = NULL;   /* the Account of the other split */
-    gboolean changed = FALSE;
-
-    ENTER("xferData=%p", xferData);
-    if ( !xferData )
-    {
-        LEAVE("bad args");
-        return( FALSE );
-    }
-
-    match_account = gnc_transfer_dialog_get_selected_account (xferData, xferData->quickfill);
-
-    desc = gtk_entry_get_text( GTK_ENTRY(xferData->description_entry) );
-
-    if ( !desc || desc[0] == '\0' )  /* no description to match */
-        return( FALSE );
-
-    split = xaccAccountFindSplitByDesc( match_account, desc );
-
-    if ( !split )
-    {
-        LEAVE("split not found");
-        return( FALSE );
-    }
-    DEBUG("split=%p", split);
-
-    /* Now update any blank fields of the transfer dialog with
-     * the memo and amount from the split, and the description
-     * we were passed (assumed to match the split's transaction).
-     */
-
-    if ( gnc_numeric_zero_p(
-             gnc_amount_edit_get_amount(GNC_AMOUNT_EDIT(xferData->amount_edit))))
-    {
-        gnc_numeric amt;
-        DEBUG("updating amount");
-        amt = xaccSplitGetValue( split );
-
-        /* If we've matched a previous transfer, it will appear
-         * to be negative in the from account.
-         * Need to swap the sign in order for this value
-         * to be posted as a withdrawal from the "from" account.
-         */
-        if ( gnc_numeric_negative_p( amt ) )
-            amt = gnc_numeric_neg( amt );
-
-        gnc_amount_edit_set_amount( GNC_AMOUNT_EDIT(xferData->amount_edit), amt );
-        changed = TRUE;
-    }
-
-    if ( !g_strcmp0(gtk_entry_get_text(GTK_ENTRY(xferData->memo_entry)), "" ))
-    {
-        DEBUG("updating memo");
-        gtk_entry_set_text( GTK_ENTRY(xferData->memo_entry),
-                            xaccSplitGetMemo( split ) );
-        changed = TRUE;
-    }
-
-    /* Since we're quickfilling off of one account (either from or to)
-     * that account must be the account of the matched split.
-     * Find the other account from the other split,
-     * and select that account in the appropriate account tree.
-     */
-    if ( ( other = xaccSplitGetOtherSplit( split ) ) &&
-         ( other_acct = xaccSplitGetAccount( other ) ) )
-    {
-        GNCAccountType other_type;
-        GtkWidget *other_button;
-        XferDirection other_direction;
-
-        DEBUG("updating other split");
-        if (xferData->quickfill == XFER_DIALOG_FROM)
-        {
-            other_button = xferData->to_show_button;
-            other_direction = XFER_DIALOG_TO;
-        }
-        else
-        {
-            other_button = xferData->from_show_button;
-            other_direction = XFER_DIALOG_FROM;
-        }
-
-        other_type = xaccAccountGetType(other_acct);
-
-        /* Don't want to deactivate the button just because this
-         * isn't an income or expense account
-         */
-        if ( (other_type == ACCT_TYPE_EXPENSE) || (other_type == ACCT_TYPE_INCOME) )
-            gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(other_button), TRUE);
-
-        gnc_transfer_dialog_set_selected_account (xferData, other_acct, other_direction);
-
-        changed = TRUE;
-    }
-
-    return( changed );
-}
-
-static gboolean
-idle_select_region(gpointer data)
-{
-    XferDialog *xferData = data;
-    g_return_val_if_fail(xferData, FALSE);
-
-    gtk_editable_select_region(GTK_EDITABLE(xferData->description_entry),
-                               xferData->desc_start_selection,
-                               xferData->desc_end_selection);
-
-    xferData->desc_selection_source_id = 0;
-    return FALSE;
-}
-
-/* The insert_cb will do the insert and quickfill if possible and set the
- * cursor position accordingly.  It will not set the selection but will register
- * idle_select_region to do that once the program returns to its main loop.
- */
-void
-gnc_xfer_description_insert_cb(GtkEditable *editable,
-                               const gchar *insert_text,
-                               const gint insert_text_len,
-                               gint *start_pos,
-                               XferDialog *xferData)
-{
-    gchar *prefix, *suffix, *new_text;
-    QuickFill *match;
-    const gchar *match_str;
-    gint prefix_len, new_text_len, match_str_len;
-
-    g_return_if_fail (xferData != NULL);
-
-    if (insert_text_len <= 0)
-        return;
-
-    suffix = gtk_editable_get_chars(editable, *start_pos, -1);
-
-    /* If we are inserting in the middle, do nothing */
-    if (*suffix)
-    {
-        g_free(suffix);
-        return;
-    }
-    g_free(suffix);
-
-    prefix = gtk_editable_get_chars(editable, 0, *start_pos);
-    new_text = g_strconcat(prefix, insert_text, (gchar*) NULL);
-    prefix_len = strlen(prefix);
-    new_text_len = prefix_len + insert_text_len;
-    g_free(prefix);
-
-    if ((match = gnc_quickfill_get_string_match(xferData->qf, new_text))
-        && (match_str = gnc_quickfill_string(match))
-        && ((match_str_len = strlen(match_str)) > new_text_len))
-    {
-        g_signal_handlers_block_matched (G_OBJECT (editable),
-                                         G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, xferData);
-
-        gtk_editable_insert_text(editable,
-                                 match_str + prefix_len,
-                                 match_str_len - prefix_len,
-                                 start_pos);
-
-        g_signal_handlers_unblock_matched (G_OBJECT (editable),
-                                           G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, xferData);
-
-        /* stop the current insert */
-        g_signal_stop_emission_by_name (G_OBJECT (editable), "insert_text");
-
-        /* set the position */
-        *start_pos = g_utf8_strlen(new_text, -1);
-
-        /* select region on idle, because it would be reset once this function
-           finishes */
-        xferData->desc_start_selection = *start_pos;
-        xferData->desc_end_selection = -1;
-        xferData->desc_selection_source_id = g_idle_add(idle_select_region,
-                                                        xferData);
-    }
-    g_free(new_text);
-}
-
-gboolean
-gnc_xfer_description_key_press_cb( GtkEntry *entry,
-                                   GdkEventKey *event,
-                                   XferDialog *xferData )
-{
-    gboolean done_with_input = FALSE;
-
-    /* Most "special" keys are allowed to be handled directly by
-     * the entry's key press handler, but in some cases that doesn't
-     * seem to work right, so handle them here.
-     */
-    ENTER(" ");
-    switch ( event->keyval )
-    {
-        case GDK_KEY_Return:
-        case GDK_KEY_KP_Enter:
-            gnc_xfer_dialog_quickfill( xferData );
-            /* NOT done with input, activate the default button of the dialog. */
-            break;
-
-        case GDK_KEY_Tab:
-        case GDK_KEY_ISO_Left_Tab:
-            if ( !( event->state & GDK_SHIFT_MASK) )    /* Complete on Tab,
-                                                         * but not Shift-Tab */
-            {
-                gnc_xfer_dialog_quickfill( xferData );
-                /* NOT done with input, though, since we need to focus to the next
-                 * field.  Unselect the current field, though.
-                 */
-                gtk_editable_select_region( GTK_EDITABLE(xferData->description_entry),
-                                            0, 0 );
-            }
-            break;
-    }
-
-    LEAVE("done=%d", done_with_input);
-    return( done_with_input );
-}
-
-/*** End of quickfill-specific callbacks ***/
-
-static void
-gnc_xfer_dialog_update_conv_info (XferDialog *xferData)
-{
-    const gchar *to_mnemonic, *from_mnemonic;
-    gchar *string;
-    gnc_numeric rate;
-
-    from_mnemonic = gnc_commodity_get_mnemonic(xferData->from_commodity);
-    to_mnemonic = gnc_commodity_get_mnemonic(xferData->to_commodity);
-
-    /* On the theory that if we don't have a mnemonic then we don't
-     * have a commodity...  On Solaris this crashes without a string.
-     * So, just leave now and wait for the second initialization to
-     * occur.
-     */
-    if (!from_mnemonic || !to_mnemonic)
-        return;
-
-    rate = gnc_amount_edit_get_amount(GNC_AMOUNT_EDIT(xferData->price_edit));
-    if (gnc_numeric_zero_p(rate))
-    {
-        string = g_strdup_printf("1 %s = x %s", from_mnemonic, to_mnemonic);
-        gtk_label_set_text(GTK_LABEL(xferData->conv_forward), string);
-        g_free(string);
-
-        string = g_strdup_printf("1 %s = x %s", to_mnemonic, from_mnemonic);
-        gtk_label_set_text(GTK_LABEL(xferData->conv_reverse), string);
-        g_free(string);
-    }
-    else
-    {
-        string = g_strdup_printf("1 %s = %f %s", from_mnemonic,
-                                 gnc_numeric_to_double(rate), to_mnemonic);
-        gtk_label_set_text(GTK_LABEL(xferData->conv_forward), string);
-        g_free(string);
-
-        rate = gnc_numeric_invert(rate);
-        string = g_strdup_printf("1 %s = %f %s", to_mnemonic,
-                                 gnc_numeric_to_double(rate), from_mnemonic);
-        gtk_label_set_text(GTK_LABEL(xferData->conv_reverse), string);
-        g_free(string);
-    }
-}
-
-static gboolean
-gnc_xfer_amount_update_cb(GtkWidget *widget, GdkEventFocus *event,
-                          gpointer data)
-{
-    XferDialog * xferData = data;
-    g_return_val_if_fail (xferData != NULL, FALSE);
-
-    gnc_amount_edit_evaluate (GNC_AMOUNT_EDIT (xferData->amount_edit));
-
-    gnc_xfer_update_to_amount (xferData);
-
-    return FALSE;
-}
-
-
-static void
-gnc_xfer_update_to_amount (XferDialog *xferData)
-{
-    GNCAmountEdit *amount_edit, *price_edit, *to_amount_edit;
-    gnc_numeric price_value, to_amount;
-    Account *account;
-    int scu = 0;
-
-    g_return_if_fail(xferData);
-
-    xferData->price_source = PRICE_SOURCE_USER_PRICE;
-
-    /* Get the amount editing controls of the dialog. */
-    amount_edit     = GNC_AMOUNT_EDIT(xferData->amount_edit);
-    price_edit      = GNC_AMOUNT_EDIT(xferData->price_edit);
-    to_amount_edit  = GNC_AMOUNT_EDIT(xferData->to_amount_edit);
-
-    /* Determine the SCU (smallest commodity unit) of the "to" amount. */
-    account = gnc_transfer_dialog_get_selected_account(xferData, XFER_DIALOG_TO);
-    if (account == NULL)
-        account = gnc_transfer_dialog_get_selected_account(xferData,
-                                                           XFER_DIALOG_FROM);
-    if (account != NULL)
-        scu = xaccAccountGetCommoditySCU(account);
-    else if (xferData->to_commodity != NULL)
-        scu = gnc_commodity_get_fraction(xferData->to_commodity);
-
-    /* Determine the amount to transfer. */
-    if (!gnc_amount_edit_evaluate(price_edit) ||
-        gnc_numeric_zero_p(price_value = gnc_amount_edit_get_amount(price_edit)))
-        to_amount = gnc_numeric_zero();
-    else
-        to_amount = gnc_numeric_mul(gnc_amount_edit_get_amount(amount_edit),
-                                    price_value, scu, GNC_HOW_RND_ROUND_HALF_UP);
-
-    /* Update the dialog. */
-    gnc_amount_edit_set_amount(to_amount_edit, to_amount);
-    if (gnc_numeric_zero_p(to_amount))
-        gtk_entry_set_text(GTK_ENTRY(gnc_amount_edit_gtk_entry(to_amount_edit)),
-                           "");
-
-    gnc_xfer_dialog_update_conv_info(xferData);
-}
-
-
-static gboolean
-gnc_xfer_price_update_cb(GtkWidget *widget, GdkEventFocus *event,
-                         gpointer data)
-{
-    XferDialog *xferData = data;
-
-    gnc_xfer_update_to_amount (xferData);
-    xferData->price_type = PRICE_TYPE_TRN;
-
-
-    return FALSE;
-}
-
-static gboolean
-gnc_xfer_date_changed_cb(GtkWidget *widget, gpointer data)
-{
-    XferDialog *xferData = data;
-
-    if (xferData)
-        gnc_xfer_dialog_update_price (xferData);
-
-    return FALSE;
-}
-
-static gboolean
-gnc_xfer_to_amount_update_cb(GtkWidget *widget, GdkEventFocus *event,
-                             gpointer data)
-{
-    XferDialog *xferData = data;
-    gnc_numeric price_value;
-
-    gnc_amount_edit_evaluate (GNC_AMOUNT_EDIT (xferData->to_amount_edit));
-    price_value = gnc_xfer_dialog_compute_price_value(xferData);
-    gnc_amount_edit_set_amount(GNC_AMOUNT_EDIT(xferData->price_edit),
-                               price_value);
-    xferData->price_source = PRICE_SOURCE_XFER_DLG_VAL;
-    xferData->price_type = PRICE_TYPE_TRN;
-    gnc_xfer_dialog_update_conv_info(xferData);
-
-    return FALSE;
-}
-
-
-/********************************************************************\
- * gnc_xfer_dialog_select_from_account                              *
- *   select the from account in a xfer dialog                       *
- *                                                                  *
- * Args:   xferData - xfer dialog structure                         *
- *         account  - account to select                             *
- * Return: none                                                     *
-\********************************************************************/
-void
-gnc_xfer_dialog_select_from_account(XferDialog *xferData, Account *account)
-{
-    gnc_transfer_dialog_set_selected_account (xferData, account, XFER_DIALOG_FROM);
-}
-
-
-/********************************************************************\
- * gnc_xfer_dialog_select_to_account                                *
- *   select the to account in a xfer dialog                         *
- *                                                                  *
- * Args:   xferData - xfer dialog structure                         *
- *         account  - account to select                             *
- * Return: none                                                     *
-\********************************************************************/
-void
-gnc_xfer_dialog_select_to_account(XferDialog *xferData, Account *account)
-{
-    gnc_transfer_dialog_set_selected_account (xferData, account, XFER_DIALOG_TO);
-}
-
-void
-gnc_xfer_dialog_select_from_currency(XferDialog *xferData, gnc_commodity *cur)
-{
-    if (!xferData) return;
-    if (!cur) return;
-
-    gtk_label_set_text(GTK_LABEL(xferData->from_currency_label),
-                       gnc_commodity_get_printname(cur));
-
-    gnc_amount_edit_set_print_info(GNC_AMOUNT_EDIT(xferData->amount_edit),
-                                   gnc_commodity_print_info(cur, FALSE));
-    gnc_amount_edit_set_fraction(GNC_AMOUNT_EDIT(xferData->amount_edit),
-                                 gnc_commodity_get_fraction (cur));
-
-    xferData->from_commodity = cur;
-    gnc_xfer_dialog_curr_acct_activate(xferData);
-}
-
-void
-gnc_xfer_dialog_select_to_currency(XferDialog *xferData, gnc_commodity *cur)
-{
-    gtk_label_set_text(GTK_LABEL(xferData->to_currency_label),
-                       gnc_commodity_get_printname(cur));
-
-    gnc_amount_edit_set_print_info(GNC_AMOUNT_EDIT(xferData->to_amount_edit),
-                                   gnc_commodity_print_info(cur, FALSE));
-    gnc_amount_edit_set_fraction(GNC_AMOUNT_EDIT(xferData->to_amount_edit),
-                                 gnc_commodity_get_fraction(cur));
-
-    xferData->to_commodity = cur;
-    gnc_xfer_dialog_curr_acct_activate(xferData);
-}
-
-static void
-gnc_xfer_dialog_lock_account_tree(XferDialog *xferData,
-                                  XferDirection direction,
-                                  gboolean hide)
-{
-    GtkTreeView *tree_view;
-    GtkWidget *show_button;
-    GtkWidget *scroll_win;
-
-    if (xferData == NULL)
-        return;
-
-    switch (direction)
-    {
-        case XFER_DIALOG_FROM:
-            tree_view = xferData->from_tree_view;
-            scroll_win = xferData->from_window;
-            show_button = xferData->from_show_button;
-            break;
-        case XFER_DIALOG_TO:
-            tree_view = xferData->to_tree_view;
-            scroll_win = xferData->to_window;
-            show_button = xferData->to_show_button;
-            break;
-        default:
-            return;
-    }
-
-    gtk_widget_set_sensitive( GTK_WIDGET(tree_view), FALSE );
-    gtk_widget_set_sensitive( GTK_WIDGET(show_button), FALSE );
-
-    if (hide)
-    {
-        gtk_widget_hide( scroll_win );
-        gtk_widget_hide( GTK_WIDGET(show_button) );
-    }
-}
-
-
-/********************************************************************\
- * gnc_xfer_dialog_lock_from_account_tree                           *
- *   prevent changes to the from account tree in an xfer dialog     *
- *                                                                  *
- * Args:   xferData - xfer dialog structure                         *
- * Return: none                                                     *
-\********************************************************************/
-void
-gnc_xfer_dialog_lock_from_account_tree(XferDialog *xferData)
-{
-    gnc_xfer_dialog_lock_account_tree(xferData, XFER_DIALOG_FROM, FALSE);
-}
-
-
-/********************************************************************\
- * gnc_xfer_dialog_lock_to_account_tree                             *
- *   prevent changes to the to account tree in an xfer dialog       *
- *                                                                  *
- * Args:   xferData - xfer dialog structure                         *
- * Return: none                                                     *
-\********************************************************************/
-void
-gnc_xfer_dialog_lock_to_account_tree(XferDialog *xferData)
-{
-    gnc_xfer_dialog_lock_account_tree(xferData, XFER_DIALOG_TO, FALSE);
-}
-
-
-/********************************************************************\
- * gnc_xfer_dialog_hide_from_account_tree                           *
- *   prevent changes to the from account tree in an xfer dialog     *
- *                                                                  *
- * Args:   xferData - xfer dialog structure                         *
- * Return: none                                                     *
-\********************************************************************/
-void
-gnc_xfer_dialog_hide_from_account_tree(XferDialog *xferData)
-{
-    gnc_xfer_dialog_lock_account_tree(xferData, XFER_DIALOG_FROM, TRUE);
-}
-
-
-/********************************************************************\
- * gnc_xfer_dialog_hide_to_account_tree                             *
- *   prevent changes to the to account tree in an xfer dialog       *
- *                                                                  *
- * Args:   xferData - xfer dialog structure                         *
- * Return: none                                                     *
-\********************************************************************/
-void
-gnc_xfer_dialog_hide_to_account_tree(XferDialog *xferData)
-{
-    gnc_xfer_dialog_lock_account_tree(xferData, XFER_DIALOG_TO, TRUE);
-}
-
-
-/********************************************************************\
- * gnc_xfer_dialog_is_exchange_dialog                               *
- *   set the dialog as an "exchange-dialog", which means that the   *
- *   Transfer Information table is read-only (and the dialog        *
- *   will NOT create a transaction when it is closed)               *
- *                                                                  *
- * Args:   xferData - xfer dialog structure                         *
- *         exch_rate - place to store the exchange rate at exit     *
- * Return: none                                                     *
-\********************************************************************/
-void
-gnc_xfer_dialog_is_exchange_dialog (XferDialog *xferData,
-                                    gnc_numeric *exch_rate)
-{
-    GNCAmountEdit *gae;
-
-    g_return_if_fail(xferData);
-    ENTER("xferData=%p, exch_rate=%p (%s)", xferData, exch_rate,
-          exch_rate == NULL ? "NULL" : xaccPrintAmount(*exch_rate,
-                                                       gnc_default_print_info(FALSE)));
-
-    gtk_widget_set_sensitive (xferData->amount_edit, FALSE);
-    gtk_widget_set_sensitive (xferData->date_entry, FALSE);
-    gtk_widget_set_sensitive (xferData->num_entry, FALSE);
-    gtk_widget_set_sensitive (xferData->description_entry, FALSE);
-    gtk_widget_set_sensitive (xferData->memo_entry, FALSE);
-
-
-    gae = GNC_AMOUNT_EDIT (xferData->price_edit);
-    gtk_widget_grab_focus (gnc_amount_edit_gtk_entry (gae));
-
-    xferData->exch_rate = exch_rate;
-
-    LEAVE(" ");
-}
-
-/********************************************************************\
- * gnc_xfer_dialog_set_amount                                       *
- *   set the amount in the given xfer dialog                        *
- *                                                                  *
- * Args:   xferData - xfer dialog structure                         *
- *         amount   - the amount to set                             *
- * Return: none                                                     *
-\********************************************************************/
-void
-gnc_xfer_dialog_set_amount(XferDialog *xferData, gnc_numeric amount)
-{
-    Account * account;
-
-    if (xferData == NULL)
-        return;
-
-    account = gnc_transfer_dialog_get_selected_account (xferData,
-                                                        XFER_DIALOG_FROM);
-    if (account == NULL)
-        account = gnc_transfer_dialog_get_selected_account (xferData,
-                                                            XFER_DIALOG_TO);
-
-    gnc_amount_edit_set_amount (GNC_AMOUNT_EDIT (xferData->amount_edit), amount);
-}
-void gnc_xfer_dialog_set_amount_sensitive(XferDialog *xferData,
-                                          gboolean is_sensitive)
-{
-    g_assert(xferData);
-    gtk_widget_set_sensitive(gnc_amount_edit_gtk_entry(GNC_AMOUNT_EDIT (xferData->amount_edit)), is_sensitive);
-}
-
-static void
-gnc_xfer_dialog_set_fetch_sensitive (GtkWidget *fetch)
-{
-    if (gnc_quote_source_fq_installed ())
-    {
-        gtk_widget_set_sensitive (fetch, TRUE);
-        gtk_widget_set_tooltip_text (fetch, _("Retrieve the current online quote. This will fail if there is a manually-created price for today."));
-        return;
-    }
-    gtk_widget_set_sensitive (fetch, FALSE);
-    gtk_widget_set_tooltip_text (fetch, _("Finance::Quote must be installed to enable this button."));
-    return;
-}
-
-/********************************************************************\
- * gnc_xfer_dialog_set_description                                  *
- *   set the description in the given xfer dialog                   *
- *                                                                  *
- * Args:   xferData    - xfer dialog structure                      *
- *         description - the description to set                     *
- * Return: none                                                     *
-\********************************************************************/
-void
-gnc_xfer_dialog_set_description(XferDialog *xferData, const char *description)
-{
-    if (xferData == NULL)
-        return;
-
-    gtk_entry_set_text(GTK_ENTRY(xferData->description_entry), description);
-    gnc_quickfill_insert( xferData->qf, description, QUICKFILL_LIFO );
-}
-
-/********************************************************************\
- * gnc_xfer_dialog_set_memo                                         *
- *   set the memo in the given xfer dialog                          *
- *                                                                  *
- * Args:   xferData    - xfer dialog structure                      *
- *         memo        - the memo to set                            *
- * Return: none                                                     *
-\********************************************************************/
-void
-gnc_xfer_dialog_set_memo(XferDialog *xferData, const char *memo)
-{
-    if (xferData == NULL)
-        return;
-
-    gtk_entry_set_text(GTK_ENTRY(xferData->memo_entry), memo);
-    /* gnc_quickfill_insert( xferData->qf, memo, QUICKFILL_LIFO ); */
-}
-
-/********************************************************************\
- * gnc_xfer_dialog_set_num                                          *
- *   set the num in the given xfer dialog                           *
- *                                                                  *
- * Args:   xferData    - xfer dialog structure                      *
- *         num        - the num to set                              *
- * Return: none                                                     *
-\********************************************************************/
-void
-gnc_xfer_dialog_set_num(XferDialog *xferData, const char *num)
-{
-    if (xferData == NULL)
-        return;
-
-    gtk_entry_set_text(GTK_ENTRY(xferData->num_entry), num);
-    /* gnc_quickfill_insert( xferData->qf, num, QUICKFILL_LIFO ); */
-}
-
-/********************************************************************\
- * gnc_xfer_dialog_set_date                                         *
- *   set the date in the given xfer dialog                          *
- *                                                                  *
- * Args:   xferData    - xfer dialog structure                      *
- *         set_date    - the date to set                            *
- * Return: none                                                     *
-\********************************************************************/
-void
-gnc_xfer_dialog_set_date(XferDialog *xferData, time64 set_date)
-{
-    if (xferData == NULL)
-        return;
-
-    gnc_date_edit_set_time( GNC_DATE_EDIT(xferData->date_entry), set_date );
-}
-void gnc_xfer_dialog_set_date_sensitive(XferDialog *xferData,
-                                        gboolean is_sensitive)
-{
-    g_assert(xferData);
-    gtk_widget_set_sensitive (xferData->date_entry, is_sensitive);
-}
-
-void
-gnc_xfer_dialog_set_price_edit(XferDialog *xferData, gnc_numeric price_value)
-{
-    if (xferData == NULL)
-        return;
-
-    if (gnc_numeric_zero_p (price_value))
-        return;
-
-    gnc_amount_edit_set_amount (GNC_AMOUNT_EDIT (xferData->price_edit),
-                                price_value);
-
-    gnc_xfer_update_to_amount (xferData);
-}
-
-static gboolean
-check_accounts  (XferDialog* xferData, Account* from_account,
-                 Account* to_account)
-{
-    if ((from_account == NULL) || (to_account == NULL))
-    {
-        const char *message = _("You must specify an account to transfer from, "
-                                "or to, or both, for this transaction. "
-                                "Otherwise, it will not be recorded.");
-        gnc_error_dialog(xferData->dialog, "%s", message);
-        LEAVE("bad account");
-        return FALSE;
-    }
-
-    if (from_account == to_account)
-    {
-        const char *message = _("You can't transfer from and to the same "
-                                "account!");
-        gnc_error_dialog(xferData->dialog, "%s", message);
-        LEAVE("same account");
-        return FALSE;
-    }
-
-    if (xaccAccountGetPlaceholder(from_account) ||
-        xaccAccountGetPlaceholder(to_account))
-    {
-        const char *placeholder_format =
-            _("The account %s does not allow transactions.");
-        char *name;
-
-        if (xaccAccountGetPlaceholder(from_account))
-            name = gnc_account_get_full_name(from_account);
-        else
-            name = gnc_account_get_full_name(to_account);
-        gnc_error_dialog(xferData->dialog, placeholder_format, name);
-        g_free(name);
-        LEAVE("placeholder");
-        return FALSE;
-    }
-
-    if (!gnc_commodity_is_iso (xferData->from_commodity))
-    {
-        const char *message =
-            _("You can't transfer from a non-currency account. "
-              "Try reversing the \"from\" and \"to\" accounts "
-              "and making the \"amount\" negative.");
-        gnc_error_dialog(xferData->dialog, "%s", message);
-        LEAVE("non-currency");
-        return FALSE;
-    }
-    return TRUE;
-}
-
-static gboolean
-check_edit(XferDialog *xferData)
-{
-    if (!gnc_amount_edit_evaluate (GNC_AMOUNT_EDIT (xferData->price_edit)))
-    {
-        if (gtk_toggle_button_get_active
-            (GTK_TOGGLE_BUTTON(xferData->price_radio)))
-        {
-            gnc_parse_error_dialog (xferData, _("You must enter a valid price."));
-            LEAVE("invalid price");
-            return FALSE;
-        }
-    }
-
-    if (!gnc_amount_edit_evaluate (GNC_AMOUNT_EDIT (xferData->to_amount_edit)))
-    {
-        if (gtk_toggle_button_get_active
-            (GTK_TOGGLE_BUTTON(xferData->amount_radio)))
-        {
-            gnc_parse_error_dialog (xferData,
-                                    _("You must enter a valid `to' amount."));
-            LEAVE("invalid to amount");
-            return FALSE;
-        }
-    }
-    return TRUE;
-}
-
-static void
-create_transaction(XferDialog *xferData, Timespec *ts,
-                   Account *from_account, Account* to_account,
-                   gnc_numeric amount, gnc_numeric to_amount)
-{
-    Transaction *trans;
-    Split *from_split;
-    Split *to_split;
-    const char *string;
-    /* Create the transaction */
-    trans = xaccMallocTransaction(xferData->book);
-
-    xaccTransBeginEdit(trans);
-
-    xaccTransSetCurrency(trans, xferData->from_commodity);
-    xaccTransSetDatePostedTS(trans, ts);
-
-    /* Trans-Num or Split-Action set with gnc_set_num_action below per book
-     * option */
-
-    string = gtk_entry_get_text(GTK_ENTRY(xferData->description_entry));
-    xaccTransSetDescription(trans, string);
-
-    /* create from split */
-    from_split = xaccMallocSplit(xferData->book);
-    xaccTransAppendSplit(trans, from_split);
-
-    /* create to split */
-    to_split = xaccMallocSplit(xferData->book);
-    xaccTransAppendSplit(trans, to_split);
-
-    xaccAccountBeginEdit(from_account);
-    xaccAccountInsertSplit(from_account, from_split);
-
-    xaccAccountBeginEdit(to_account);
-    xaccAccountInsertSplit(to_account, to_split);
-
-    xaccSplitSetBaseValue(from_split, gnc_numeric_neg (amount),
-                          xferData->from_commodity);
-    xaccSplitSetBaseValue(to_split, amount, xferData->from_commodity);
-    xaccSplitSetBaseValue(to_split, to_amount, xferData->to_commodity);
-
-    /* Set the transaction number or split action field based on book option*/
-    string = gtk_entry_get_text(GTK_ENTRY(xferData->num_entry));
-    gnc_set_num_action (trans, from_split, string, NULL);
-
-    /* Set the memo fields */
-    string = gtk_entry_get_text(GTK_ENTRY(xferData->memo_entry));
-    xaccSplitSetMemo(from_split, string);
-    xaccSplitSetMemo(to_split, string);
-
-    /* finish transaction */
-    xaccTransCommitEdit(trans);
-    xaccAccountCommitEdit(from_account);
-    xaccAccountCommitEdit(to_account);
-
-    /* If there is a registered callback handler that should be
-       notified of the newly created Transaction, call it now. */
-    if (xferData->transaction_cb)
-        xferData->transaction_cb(trans, xferData->transaction_user_data);
-}
-
-static gnc_numeric
-swap_commodities(gnc_commodity **from, gnc_commodity **to, gnc_numeric value)
-{
-    gnc_commodity *tmp = *to;
-
-    *to = *from;
-    *from = tmp;
-    value = gnc_numeric_invert(value);
-    return value;
-}
-
-static void
-update_price(XferDialog *xferData, PriceReq *pr)
-{
-    gnc_commodity *from = xferData->from_commodity;
-    gnc_commodity *to = xferData->to_commodity;
-    gnc_numeric value = gnc_amount_edit_get_amount(GNC_AMOUNT_EDIT(xferData->price_edit));
-    gnc_numeric price_value = gnc_price_get_value(pr->price);
-    gnc_numeric rounded_pr_value = round_price(pr->from, pr->to, price_value);
-    gnc_numeric rounded_value;
-
-    if (gnc_price_get_source(pr->price) < xferData->price_source)
-    {
-        PINFO("Existing price is preferred, so won't supersede.");
-        gnc_price_unref (pr->price);
-        return;
-    }
-
-    if (pr->reverse)
-        value = swap_commodities(&from, &to, value);
-    /* Test the rounded values for equality to minimize price-dithering. */
-    rounded_value = round_price(from, to, value);
-    if (gnc_numeric_equal(rounded_value, rounded_pr_value))
-    {
-        PINFO("Same price for %s in %s",
-              gnc_commodity_get_mnemonic(pr->from),
-              gnc_commodity_get_mnemonic(pr->to));
-        gnc_price_unref (pr->price);
-        return;
-    }
-    gnc_price_begin_edit (pr->price);
-    gnc_price_set_time (pr->price, pr->ts);
-    gnc_price_set_typestr(pr->price, xferData->price_type);
-    gnc_price_set_value (pr->price, value);
-    gnc_price_commit_edit (pr->price);
-    PINFO("Updated price: 1 %s = %f %s",
-          gnc_commodity_get_mnemonic(pr->from),
-          gnc_numeric_to_double(gnc_price_get_value(pr->price)),
-          gnc_commodity_get_mnemonic(pr->to));
-    gnc_price_unref (pr->price);
-}
-
-static void
-new_price(XferDialog *xferData, Timespec ts)
-{
-    GNCPrice *price = NULL;
-    gnc_commodity *from = xferData->from_commodity;
-    gnc_commodity *to = xferData->to_commodity;
-    gnc_numeric value = gnc_amount_edit_get_amount(GNC_AMOUNT_EDIT(xferData->price_edit));
-
-/* We want to store currency rates such that the rate > 1 and commodity
- * prices in terms of a currency regardless of value.
- */
-    value = gnc_numeric_abs(value);
-    if (gnc_commodity_is_currency(from) && gnc_commodity_is_currency(to))
-    {
-        if (value.num < value.denom)
-            value = swap_commodities(&from, &to, value);
-    }
-    else if (gnc_commodity_is_currency(from))
-            value = swap_commodities(&from, &to, value);
-
-    value = round_price (from, to, value);
-    price = gnc_price_create (xferData->book);
-    gnc_price_begin_edit (price);
-    gnc_price_set_commodity (price, from);
-    gnc_price_set_currency (price, to);
-    gnc_price_set_time (price, ts);
-    gnc_price_set_source (price, xferData->price_source);
-    gnc_price_set_typestr (price, xferData->price_type);
-    gnc_price_set_value (price, value);
-    gnc_pricedb_add_price (xferData->pricedb, price);
-    gnc_price_commit_edit (price);
-    PINFO("Created price: 1 %s = %f %s", gnc_commodity_get_mnemonic(from),
-          gnc_numeric_to_double(value), gnc_commodity_get_mnemonic(to));
-    gnc_price_unref (price);
-}    
-
-static void
-create_price(XferDialog *xferData, Timespec ts)
-{
-    PriceReq pr;
-
-/* Bail in the unlikely event that both currencies have joined the Euro. */
-    if (gnc_is_euro_currency (xferData->from_commodity) &&
-        gnc_is_euro_currency (xferData->to_commodity))
-        return;
-
-    price_request_from_xferData(&pr, xferData);
-    if (lookup_price(&pr, SAME_DAY))
-    {
-        update_price(xferData, &pr);
-        return;
-    }
-    new_price (xferData, ts);
-}
-
-void
-gnc_xfer_dialog_response_cb (GtkDialog *dialog, gint response, gpointer data)
-{
-    XferDialog *xferData = data;
-    Account *to_account;
-    Account *from_account;
-    gnc_numeric amount, to_amount;
-    Timespec ts;
-    GDate date;
-
-    g_return_if_fail (xferData != NULL);
-    ENTER(" ");
-
-    if (response == GTK_RESPONSE_APPLY)
-    {
-        LEAVE("fetching exchange rate");
-        return;
-    }
-
-    if (response != GTK_RESPONSE_OK)
-    {
-        gnc_close_gui_component_by_data (DIALOG_TRANSFER_CM_CLASS, xferData);
-        LEAVE("cancel, etc.");
-        return;
-    }
-
-    from_account = gnc_transfer_dialog_get_selected_account (xferData, XFER_DIALOG_FROM);
-    to_account = gnc_transfer_dialog_get_selected_account (xferData, XFER_DIALOG_TO);
-
-    if (xferData->exch_rate == NULL &&
-        !check_accounts(xferData, from_account, to_account))
-        return;
-
-    if (!gnc_amount_edit_evaluate (GNC_AMOUNT_EDIT (xferData->amount_edit)))
-    {
-        gnc_parse_error_dialog (xferData, _("You must enter a valid amount."));
-        LEAVE("no amount");
-        return;
-    }
-
-    amount = gnc_amount_edit_get_amount(GNC_AMOUNT_EDIT(xferData->amount_edit));
-
-    if (gnc_numeric_zero_p (amount))
-    {
-        const char *message = _("You must enter an amount to transfer.");
-        gnc_error_dialog(xferData->dialog, "%s", message);
-        LEAVE("invalid from amount");
-        return;
-    }
-    g_date_clear (&date, 1);
-    gnc_date_edit_get_gdate (GNC_DATE_EDIT (xferData->date_entry), &date);
-    ts = gdate_to_timespec (date);
-
-    if (!gnc_commodity_equiv(xferData->from_commodity, xferData->to_commodity))
-    {
-        if (!check_edit(xferData))
-            return;
-        to_amount = gnc_amount_edit_get_amount
-            (GNC_AMOUNT_EDIT(xferData->to_amount_edit));
-    }
-    else
-        to_amount = amount;
-
-    gnc_suspend_gui_refresh ();
-
-    if (xferData->exch_rate)
-    {
-        gnc_numeric price_value;
-
-        /* If we've got the price-button set, then make sure we update the
-         * to-amount before we use it.
-         */
-        if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(xferData->price_radio)))
-            gnc_xfer_update_to_amount(xferData);
-
-        price_value = gnc_xfer_dialog_compute_price_value(xferData);
-        gnc_amount_edit_set_amount(GNC_AMOUNT_EDIT(xferData->price_edit),
-                                   price_value);
-        *(xferData->exch_rate) = gnc_numeric_abs(price_value);
-    }
-    else
-        create_transaction (xferData, &ts, from_account, to_account,
-                            amount, to_amount);
-    /* try to save this to the pricedb */
-    if (xferData->pricedb && !gnc_commodity_equal (xferData->from_commodity,
-                                                   xferData->to_commodity))
-        create_price(xferData, ts);
-    /* Refresh everything */
-    gnc_resume_gui_refresh ();
-
-    DEBUG("close component");
-    gnc_close_gui_component_by_data (DIALOG_TRANSFER_CM_CLASS, xferData);
-    LEAVE("ok");
-}
-
-void
-gnc_xfer_dialog_close_cb(GtkDialog *dialog, gpointer data)
-{
-    XferDialog * xferData = data;
-    GtkWidget *entry;
-
-    /* Notify transaction callback to unregister here */
-    if (xferData->transaction_cb)
-        xferData->transaction_cb(NULL, xferData->transaction_user_data);
-
-    entry = gnc_amount_edit_gtk_entry(GNC_AMOUNT_EDIT(xferData->amount_edit));
-    g_signal_handlers_disconnect_matched (G_OBJECT (entry), G_SIGNAL_MATCH_DATA,
-                                          0, 0, NULL, NULL, xferData);
-
-    entry = gnc_amount_edit_gtk_entry(GNC_AMOUNT_EDIT(xferData->price_edit));
-    g_signal_handlers_disconnect_matched (G_OBJECT (entry), G_SIGNAL_MATCH_DATA,
-                                          0, 0, NULL, NULL, xferData);
-
-    entry = gnc_amount_edit_gtk_entry(GNC_AMOUNT_EDIT(xferData->to_amount_edit));
-    g_signal_handlers_disconnect_matched (G_OBJECT (entry), G_SIGNAL_MATCH_DATA,
-                                          0, 0, NULL, NULL, xferData);
-
-    entry = xferData->description_entry;
-    g_signal_handlers_disconnect_matched (G_OBJECT (entry), G_SIGNAL_MATCH_DATA,
-                                          0, 0, NULL, NULL, xferData);
-
-    DEBUG("unregister component");
-    gnc_unregister_gui_component_by_data (DIALOG_TRANSFER_CM_CLASS, xferData);
-
-    gnc_quickfill_destroy (xferData->qf);
-    xferData->qf = NULL;
-
-    if (xferData->desc_selection_source_id)
-        g_source_remove (xferData->desc_selection_source_id);
-
-    g_free(xferData);
-    xferData = NULL;
-
-    DEBUG("xfer dialog destroyed");
-}
-
-
-void
-gnc_xfer_dialog_fetch (GtkButton *button, XferDialog *xferData)
-{
-    PriceReq pr;
-    SCM quotes_func;
-    SCM book_scm;
-    SCM scm_window;
-
-    g_return_if_fail (xferData);
-
-    ENTER(" ");
-
-    quotes_func = scm_c_eval_string ("gnc:book-add-quotes");
-
-    if (!scm_is_procedure (quotes_func))
-    {
-        LEAVE("quote retrieval failed");
-        return;
-    }
-
-    book_scm = gnc_book_to_scm (xferData->book);
-    if (scm_is_true (scm_not (book_scm)))
-    {
-        LEAVE("no book");
-        return;
-    }
-
-    scm_window =  SWIG_NewPointerObj(xferData->dialog,
-                                     SWIG_TypeQuery("_p_GtkWidget"), 0);
-
-    if (scm_is_true (scm_not (book_scm)))
-    {
-        LEAVE("no scm window");
-        return;
-    }
-
-    gnc_set_busy_cursor (NULL, TRUE);
-    scm_call_2 (quotes_func, scm_window, book_scm);
-    gnc_unset_busy_cursor (NULL);
-
-    /*the results should be in the price db now, but don't crash if not. */
-    price_request_from_xferData(&pr, xferData);
-    if (lookup_price(&pr, LATEST))
-    {
-        gnc_numeric price_value = gnc_price_get_value(pr.price);
-        if (pr.reverse)
-            price_value = gnc_numeric_invert(price_value);
-         gnc_xfer_dialog_set_price_edit(xferData, price_value);
-        gnc_price_unref (pr.price);
-    }
-
-    LEAVE("quote retrieved");
-
-}
-
-static void
-gnc_xfer_dialog_create(GtkWidget *parent, XferDialog *xferData)
-{
-    GtkBuilder *builder;
-    gboolean  use_accounting_labels;
-    g_return_if_fail(to_info == NULL && from_info == NULL);
-
-    use_accounting_labels = gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL,
-                                               GNC_PREF_ACCOUNTING_LABELS);
-
-    ENTER(" ");
-    builder = gtk_builder_new();
-    gnc_builder_add_from_file (builder, "dialog-transfer.glade", "transfer_dialog");
-
-    xferData->dialog = GTK_WIDGET(gtk_builder_get_object (builder, "transfer_dialog"));
-    g_object_set_data_full (G_OBJECT (xferData->dialog), "builder", builder, g_object_unref);
-
-    // Set the style context for this dialog so it can be easily manipulated with css
-    gnc_widget_set_style_context (GTK_WIDGET(xferData->dialog), "GncTransferDialog");
-
-    /* parent */
-    if (parent != NULL)
-        gtk_window_set_transient_for (GTK_WINDOW (xferData->dialog), GTK_WINDOW (parent));
-
-    /* default to quickfilling off of the "From" account. */
-    xferData->quickfill = XFER_DIALOG_FROM;
-
-    xferData->transferinfo_label = GTK_WIDGET(gtk_builder_get_object (builder, "transferinfo-label"));
-
-    xferData->fetch_button = GTK_WIDGET(gtk_builder_get_object (builder, "fetch"));
-    gnc_xfer_dialog_set_fetch_sensitive (xferData->fetch_button);
-
-    /* amount & date widgets */
-    {
-        GtkWidget *amount;
-        GtkWidget *entry;
-        GtkWidget *date;
-        GtkWidget *hbox;
-
-        amount = gnc_amount_edit_new();
-        hbox = GTK_WIDGET(gtk_builder_get_object (builder, "amount_hbox"));
-        gtk_box_pack_end(GTK_BOX(hbox), amount, TRUE, TRUE, 0);
-        gnc_amount_edit_set_evaluate_on_enter (GNC_AMOUNT_EDIT (amount), TRUE);
-        xferData->amount_edit = amount;
-
-        entry = gnc_amount_edit_gtk_entry (GNC_AMOUNT_EDIT (amount));
-        gtk_entry_set_activates_default (GTK_ENTRY(entry), TRUE);
-        g_signal_connect (G_OBJECT (entry), "focus-out-event",
-                          G_CALLBACK (gnc_xfer_amount_update_cb), xferData);
-
-        date = gnc_date_edit_new(time (NULL), FALSE, FALSE);
-        gnc_date_activates_default (GNC_DATE_EDIT(date), TRUE);
-        hbox = GTK_WIDGET(gtk_builder_get_object (builder, "date_hbox"));
-
-        gtk_box_pack_end(GTK_BOX(hbox), date, TRUE, TRUE, 0);
-        xferData->date_entry = date;
-        g_signal_connect (G_OBJECT (date), "date_changed",
-                          G_CALLBACK (gnc_xfer_date_changed_cb), xferData);
-    }
-
-    {
-        GtkWidget *entry;
-
-        entry = GTK_WIDGET(gtk_builder_get_object (builder, "num_entry"));
-        xferData->num_entry = entry;
-
-        entry = GTK_WIDGET(gtk_builder_get_object (builder, "description_entry"));
-        xferData->description_entry = entry;
-
-        entry = GTK_WIDGET(gtk_builder_get_object (builder, "memo_entry"));
-        xferData->memo_entry = entry;
-    }
-
-    /* from and to */
-    {
-        GtkWidget *label;
-        gchar *text;
-
-        to_info   = g_new0(AccountTreeFilterInfo, 1);
-        from_info = g_new0(AccountTreeFilterInfo, 1);
-
-        gnc_xfer_dialog_fill_tree_view (xferData, XFER_DIALOG_TO);
-        gnc_xfer_dialog_fill_tree_view (xferData, XFER_DIALOG_FROM);
-
-        /* Reverse from and to account trees when in "accountant" mode,
-           see comment in function gnc_xfer_dialog_fill_tree_table */
-        if (use_accounting_labels)
-        {
-            label = GTK_WIDGET(gtk_builder_get_object (builder, "right_trans_label"));
-            xferData->from_transfer_label = label;
-
-            label = GTK_WIDGET(gtk_builder_get_object (builder, "left_trans_label"));
-            xferData->to_transfer_label = label;
-
-            text = g_strconcat ("<b>", _("Credit Account"), "</b>", NULL);
-            gtk_label_set_markup (GTK_LABEL (xferData->from_transfer_label), text);
-            g_free (text);
-
-            text = g_strconcat ("<b>", _("Debit Account"), "</b>", NULL);
-            gtk_label_set_markup (GTK_LABEL (xferData->to_transfer_label), text);
-            g_free (text);
-
-            label = GTK_WIDGET(gtk_builder_get_object (builder, "right_currency_label"));
-            xferData->from_currency_label = label;
-
-            label = GTK_WIDGET(gtk_builder_get_object (builder, "left_currency_label"));
-            xferData->to_currency_label = label;
-        }
-        else
-        {
-            label = GTK_WIDGET(gtk_builder_get_object (builder, "left_trans_label"));
-            xferData->from_transfer_label = label;
-
-            label = GTK_WIDGET(gtk_builder_get_object (builder, "right_trans_label"));
-            xferData->to_transfer_label = label;
-
-            text = g_strconcat ("<b>", _("Transfer From"), "</b>", NULL);
-            gtk_label_set_markup (GTK_LABEL (xferData->from_transfer_label), text);
-            g_free (text);
-
-            text = g_strconcat ("<b>", _("Transfer To"), "</b>", NULL);
-            gtk_label_set_markup (GTK_LABEL (xferData->to_transfer_label), text);
-
-            label = GTK_WIDGET(gtk_builder_get_object (builder, "left_currency_label"));
-            xferData->from_currency_label = label;
-
-            label = GTK_WIDGET(gtk_builder_get_object (builder, "right_currency_label"));
-            xferData->to_currency_label = label;
-        }
-
-        label = GTK_WIDGET(gtk_builder_get_object (builder, "conv_forward"));
-        xferData->conv_forward = label;
-
-        label = GTK_WIDGET(gtk_builder_get_object (builder, "conv_reverse"));
-        xferData->conv_reverse = label;
-    }
-
-    /* optional intermediate currency account */
-    {
-        GtkWidget *table;
-        GtkWidget *entry;
-        GtkWidget *edit;
-        GtkWidget *hbox;
-        GtkWidget *button;
-
-        table = GTK_WIDGET(gtk_builder_get_object (builder, "curr_transfer_table"));
-        xferData->curr_xfer_table = table;
-
-        edit = gnc_amount_edit_new();
-        gnc_amount_edit_set_print_info(GNC_AMOUNT_EDIT(edit),
-                                       gnc_default_print_info (FALSE));
-        hbox = GTK_WIDGET(gtk_builder_get_object (builder, "price_hbox"));
-        gtk_box_pack_start(GTK_BOX(hbox), edit, TRUE, TRUE, 0);
-        xferData->price_edit = edit;
-        entry = gnc_amount_edit_gtk_entry (GNC_AMOUNT_EDIT (edit));
-        g_signal_connect (G_OBJECT (entry), "focus-out-event",
-                          G_CALLBACK (gnc_xfer_price_update_cb), xferData);
-        gtk_entry_set_activates_default(GTK_ENTRY (entry), TRUE);
-
-        edit = gnc_amount_edit_new();
-        hbox = GTK_WIDGET(gtk_builder_get_object (builder, "right_amount_hbox"));
-        gtk_box_pack_start(GTK_BOX(hbox), edit, TRUE, TRUE, 0);
-        xferData->to_amount_edit = edit;
-        entry = gnc_amount_edit_gtk_entry (GNC_AMOUNT_EDIT (edit));
-        g_signal_connect (G_OBJECT (entry), "focus-out-event",
-                          G_CALLBACK (gnc_xfer_to_amount_update_cb), xferData);
-        gtk_entry_set_activates_default(GTK_ENTRY(entry), TRUE);
-
-        button = GTK_WIDGET(gtk_builder_get_object (builder, "price_radio"));
-        xferData->price_radio = button;
-
-        button = GTK_WIDGET(gtk_builder_get_object (builder, "amount_radio"));
-        xferData->amount_radio = button;
-
-        if (use_accounting_labels)
-        {
-            gtk_label_set_text(GTK_LABEL(gtk_bin_get_child (GTK_BIN(xferData->amount_radio))),
-                               _("Debit Amount:"));
-        }
-        else
-        {
-            gtk_label_set_text(GTK_LABEL(gtk_bin_get_child (GTK_BIN(xferData->amount_radio))),
-                               _("To Amount:"));
-        }
-    }
-
-    gtk_builder_connect_signals(builder, xferData);
-    gnc_restore_window_size (GNC_PREFS_GROUP, GTK_WINDOW (xferData->dialog));
-    LEAVE(" ");
-}
-
-static void
-close_handler (gpointer user_data)
-{
-    XferDialog *xferData = user_data;
-    GtkWidget *dialog;
-
-    ENTER(" ");
-    dialog = GTK_WIDGET (xferData->dialog);
-
-    gnc_save_window_size (GNC_PREFS_GROUP, GTK_WINDOW (dialog));
-    gtk_widget_hide (dialog);
-    gnc_xfer_dialog_close_cb(GTK_DIALOG(dialog), xferData);
-    gtk_widget_destroy (dialog);
-    g_free (to_info);
-    to_info = NULL;
-    g_free (from_info);
-    from_info = NULL;
-    LEAVE(" ");
-}
-
-/********************************************************************\
- * gnc_xfer_dialog                                                  *
- *   opens up a window to do an automatic transfer between accounts *
- *                                                                  *
- * Args:   parent  - the parent of the window to be created         *
- *         initial - the initial account in the from/to fields      *
- * Return: XferDialog structure                                     *
-\********************************************************************/
-XferDialog *
-gnc_xfer_dialog (GtkWidget * parent, Account * initial)
-{
-    XferDialog *xferData;
-    GNCAmountEdit *gae;
-    GtkWidget *amount_entry;
-    QofBook *book = NULL;
-
-    xferData = g_new0 (XferDialog, 1);
-
-    xferData->desc_start_selection = 0;
-    xferData->desc_end_selection = 0;
-    xferData->desc_selection_source_id = 0;
-    xferData->quickfill = XFER_DIALOG_FROM;
-    xferData->transaction_cb = NULL;
-
-    if (initial)
-    {
-        book = gnc_account_get_book (initial);
-    }
-    else
-    {
-        book = gnc_get_current_book ();
-    }
-
-    xferData->book = book;
-    xferData->pricedb = gnc_pricedb_get_db (book);
-
-    gnc_xfer_dialog_create(parent, xferData);
-
-    DEBUG("register component");
-    gnc_register_gui_component (DIALOG_TRANSFER_CM_CLASS,
-                                NULL, close_handler, xferData);
-
-    gae = GNC_AMOUNT_EDIT(xferData->amount_edit);
-    amount_entry = gnc_amount_edit_gtk_entry (gae);
-
-    gtk_widget_grab_focus(amount_entry);
-
-    gnc_xfer_dialog_select_from_account(xferData, initial);
-    gnc_xfer_dialog_select_to_account(xferData, initial);
-
-    gnc_xfer_dialog_curr_acct_activate(xferData);
-
-    gtk_widget_show_all(xferData->dialog);
-
-    gnc_window_adjust_for_screen(GTK_WINDOW(xferData->dialog));
-
-    return xferData;
-}
-
-void
-gnc_xfer_dialog_close( XferDialog *xferData )
-{
-    if ( xferData )
-    {
-        DEBUG("close component");
-        gtk_dialog_response( GTK_DIALOG(xferData->dialog), GTK_RESPONSE_NONE );
-    }
-}
-
-void
-gnc_xfer_dialog_set_title( XferDialog *xferData, const gchar *title )
-{
-    if ( xferData && title )
-    {
-        gtk_window_set_title (GTK_WINDOW (xferData->dialog), title);
-    }
-}
-
-void
-gnc_xfer_dialog_set_information_label( XferDialog *xferData,
-                                       const gchar *text )
-{
-    if (xferData && text)
-    {
-        gchar *markup_text = g_strdup_printf ("<b>%s</b>", text);
-        gtk_label_set_markup (GTK_LABEL (xferData->transferinfo_label), markup_text);
-        g_free (markup_text);
-    }
-}
-
-
-static void
-gnc_xfer_dialog_set_account_label( XferDialog *xferData,
-                                   const gchar *text,
-                                   XferDirection direction )
-{
-    if (xferData && text)
-    {
-        gchar *markup_text = g_strdup_printf ("<b>%s</b>", text);
-        gtk_label_set_markup (GTK_LABEL ((direction == XFER_DIALOG_FROM ?
-                                          xferData->from_transfer_label :
-                                          xferData->to_transfer_label)),
-                              markup_text);
-        g_free (markup_text);
-    }
-}
-
-void
-gnc_xfer_dialog_set_from_account_label( XferDialog *xferData,
-                                        const gchar *label )
-{
-    gnc_xfer_dialog_set_account_label (xferData, label, XFER_DIALOG_FROM);
-}
-
-void
-gnc_xfer_dialog_set_to_account_label( XferDialog *xferData,
-                                      const gchar *label )
-{
-    gnc_xfer_dialog_set_account_label (xferData, label, XFER_DIALOG_TO);
-}
-
-void
-gnc_xfer_dialog_set_from_show_button_active( XferDialog *xferData,
-                                             gboolean set_value )
-{
-    if ( xferData && xferData->from_show_button )
-    {
-        gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(xferData->from_show_button),
-                                      set_value );
-    }
-}
-
-void
-gnc_xfer_dialog_set_to_show_button_active( XferDialog *xferData,
-                                           gboolean set_value )
-{
-    if ( xferData && xferData->to_show_button )
-    {
-        gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(xferData->to_show_button),
-                                      set_value );
-    }
-}
-
-/* Add a button with a user-specified label and "clicked" callback */
-void gnc_xfer_dialog_add_user_specified_button( XferDialog *xferData,
-                                                const gchar *label,
-                                                GCallback callback,
-                                                gpointer user_data )
-{
-    if ( xferData && label && callback )
-    {
-        GtkBuilder *builder = g_object_get_data (G_OBJECT (xferData->dialog), "builder");
-        GtkWidget *button   = gtk_button_new_with_label( label );
-        GtkWidget *box      = GTK_WIDGET(gtk_builder_get_object (builder,
-                                                                 "transfermain-vbox" ));
-        gtk_box_pack_end( GTK_BOX(box), button, FALSE, FALSE, 0 );
-        g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (callback), user_data);
-        gtk_widget_show( button );
-    }
-}
-
-void gnc_xfer_dialog_toggle_currency_table( XferDialog *xferData,
-                                            gboolean show_table )
-{
-    if (xferData && xferData->curr_xfer_table)
-    {
-        if (show_table)
-            gtk_widget_show(xferData->curr_xfer_table);
-        else
-            gtk_widget_hide(xferData->curr_xfer_table);
-    }
-}
-
-
-/* helper function */
-static gboolean
-find_xfer (gpointer find_data, gpointer user_data)
-{
-    return( find_data == user_data );
-}
-
-/* Run the dialog until the user has either successfully completed the
- * transaction (just clicking OK doesn't always count) or clicked Cancel.
- * Return TRUE if the transaction was a success, FALSE otherwise.
- */
-gboolean gnc_xfer_dialog_run_until_done( XferDialog *xferData )
-{
-    GtkDialog *dialog;
-    gint count, response;
-
-    ENTER("xferData=%p", xferData);
-    if ( xferData == NULL )
-    {
-        LEAVE("bad args");
-        return( FALSE );
-    }
-
-    dialog = GTK_DIALOG (xferData->dialog);
-
-    /*
-     * We need to call the response_cb function by hand.  Calling it
-     * automatically on a button click can destroy the window, and
-     * that's bad mojo whole gtk_dialog_run is still in control.
-     */
-    count = g_signal_handlers_disconnect_by_func(dialog,
-                                                 gnc_xfer_dialog_response_cb,
-                                                 xferData);
-    g_assert(count == 1);
-
-    while ( TRUE )
-    {
-        DEBUG("calling gtk_dialog_run");
-        response = gtk_dialog_run (dialog);
-        DEBUG("gtk_dialog_run returned %d", response);
-        gnc_xfer_dialog_response_cb (dialog, response, xferData);
-
-        if ((response != GTK_RESPONSE_OK) && (response != GTK_RESPONSE_APPLY))
-        {
-            LEAVE("not ok");
-            return FALSE;
-        }
-
-        /* See if the dialog is still there.  For various reasons, the
-         * user could have hit OK but remained in the dialog.  We don't
-         * want to return processing back to anyone else until we clear
-         * off this dialog, so if the dialog is still there we'll just
-         * run it again.
-         */
-        if ( !gnc_find_first_gui_component( DIALOG_TRANSFER_CM_CLASS,
-                                            find_xfer, xferData ) )
-        {
-            /* no more dialog, and OK was clicked, so assume it's all good */
-            LEAVE("ok");
-            return TRUE;
-        }
-
-        /* else run the dialog again */
-    }
-
-    g_assert_not_reached();
-    return FALSE; /* to satisfy static code analysis */
-}
-
-
-/* Indicate that the dialog should quickfill based on the "To" account,
- * rather than the default which is the "From" account.
- */
-
-void
-gnc_xfer_dialog_quickfill_to_account(XferDialog *xferData,
-                                     gboolean qf_to_account )
-{
-    XferDirection old = xferData->quickfill;
-
-    xferData->quickfill = qf_to_account ? XFER_DIALOG_TO : XFER_DIALOG_FROM;
-
-    /* reload the quickfill if necessary */
-    if ( old != xferData->quickfill )
-        gnc_xfer_dialog_reload_quickfill( xferData );
-}
-
-static Account *
-gnc_transfer_dialog_get_selected_account (XferDialog *dialog,
-                                          XferDirection direction)
-{
-    GtkTreeView *tree_view;
-    Account *account;
-
-    switch (direction)
-    {
-        case XFER_DIALOG_FROM:
-            tree_view = dialog->from_tree_view;
-            break;
-        case XFER_DIALOG_TO:
-            tree_view = dialog->to_tree_view;
-            break;
-        default:
-            g_assert_not_reached ();
-            return NULL;
-    }
-
-    account = gnc_tree_view_account_get_selected_account  (GNC_TREE_VIEW_ACCOUNT (tree_view));
-    return account;
-}
-
-static void
-gnc_transfer_dialog_set_selected_account (XferDialog *dialog,
-                                          Account *account,
-                                          XferDirection direction)
-{
-    GtkTreeView *tree_view;
-    GtkCheckButton *show_button;
-    GNCAccountType type;
-
-    if (account == NULL)
-        return;
-
-    switch (direction)
-    {
-        case XFER_DIALOG_FROM:
-            tree_view = dialog->from_tree_view;
-            show_button = GTK_CHECK_BUTTON (dialog->from_show_button);
-            break;
-        case XFER_DIALOG_TO:
-            tree_view = dialog->to_tree_view;
-            show_button = GTK_CHECK_BUTTON (dialog->to_show_button);
-            break;
-        default:
-            g_assert_not_reached ();
-            return;
-    }
-
-    type = xaccAccountGetType (account);
-    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (show_button),
-                                  (type == ACCT_TYPE_EXPENSE) ||
-                                  (type == ACCT_TYPE_INCOME));
-
-    gnc_tree_view_account_set_selected_account (GNC_TREE_VIEW_ACCOUNT (tree_view),
-                                                account);
-}
-
-
-void gnc_xfer_dialog_set_txn_cb(XferDialog *xferData,
-                                gnc_xfer_dialog_cb handler,
-                                gpointer user_data)
-{
-    g_assert(xferData);
-    xferData->transaction_cb = handler;
-    xferData->transaction_user_data = user_data;
-}
-
-
-
-gboolean gnc_xfer_dialog_run_exchange_dialog(
-    XferDialog *xfer, gnc_numeric *exch_rate, gnc_numeric amount,
-    Account *reg_acc, Transaction *txn, gnc_commodity *xfer_com,
-    gboolean expanded)
-{
-    gboolean swap_amounts = FALSE;
-    gnc_commodity *txn_cur = xaccTransGetCurrency(txn);
-    gnc_commodity *reg_com = xaccAccountGetCommodity(reg_acc);
-
-    g_return_val_if_fail(txn_cur, TRUE);
-
-    if (xaccTransUseTradingAccounts (txn))
-    {
-        /* If we're using commodity trading accounts then "amount" is
-           really the split's amount and it's in xfer_com commodity.
-           We need an exchange rate that will convert this amount
-           into a value in the transaction currency.  */
-        if (gnc_commodity_equal(xfer_com, txn_cur))
-        {
-            /* Transaction is in the same currency as the split, exchange
-               rate is 1. */
-            *exch_rate = gnc_numeric_create(1, 1);
-            return FALSE;
-        }
-        swap_amounts = expanded;
-    }
-
-    /* We know that "amount" is always in the reg_com currency.
-     * Unfortunately it is possible that neither xfer_com or txn_cur are
-     * the same as reg_com, in which case we need to convert to the txn
-     * currency...  Or, if the register commodity is the xfer_com, then we
-     * need to flip-flop the commodities and the exchange rates.
-     */
-
-    else if (gnc_commodity_equal(reg_com, txn_cur))
-    {
-        /* we're working in the txn currency.  Great.  Nothing to do! */
-        swap_amounts = FALSE;
-
-    }
-    else if (gnc_commodity_equal(reg_com, xfer_com))
-    {
-        /* We're working in the xfer commodity.  Great.  Just swap the
-           amounts. */
-        swap_amounts = TRUE;
-
-        /* XXX: Do we need to check for expanded v. non-expanded
-           accounts here? */
-
-    }
-    else
-    {
-        /* UGGH -- we're not in either.  That means we need to convert
-         * 'amount' from the register commodity to the txn currency.
-         */
-        gnc_numeric rate = xaccTransGetAccountConvRate(txn, reg_acc);
-
-        /* XXX: should we tell the user we've done the conversion? */
-        amount = gnc_numeric_div(amount, rate,
-                                 gnc_commodity_get_fraction(txn_cur),
-                                 GNC_HOW_DENOM_REDUCE);
-    }
-
-    /* enter the accounts */
-    if (swap_amounts)
-    {
-        gnc_xfer_dialog_select_to_currency(xfer, txn_cur);
-        gnc_xfer_dialog_select_from_currency(xfer, xfer_com);
-        if (!gnc_numeric_zero_p(*exch_rate))
-            *exch_rate = gnc_numeric_invert(*exch_rate);
-        amount = gnc_numeric_neg(amount);
-    }
-    else
-    {
-        gnc_xfer_dialog_select_to_currency(xfer, xfer_com);
-        gnc_xfer_dialog_select_from_currency(xfer, txn_cur);
-        if (xaccTransUseTradingAccounts ( txn ))
-            amount = gnc_numeric_neg(amount);
-    }
-    gnc_xfer_dialog_hide_to_account_tree(xfer);
-    gnc_xfer_dialog_hide_from_account_tree(xfer);
-
-    gnc_xfer_dialog_set_amount(xfer, amount);
-    /* Now that from amount is set, set the to amount. */
-    gnc_xfer_update_to_amount(xfer);
-
-    /*
-     * When we flip, we should tell the dialog so it can deal with the
-     * pricedb properly.
-     */
-
-    /* Set the exchange rate */
-    gnc_xfer_dialog_set_price_edit(xfer, *exch_rate);
-
-    /* and run it... */
-    if (gnc_xfer_dialog_run_until_done(xfer) == FALSE)
-        return TRUE;
-    /* If we inverted the rate for the dialog, invert it back. */
-    if (swap_amounts)
-        *exch_rate = gnc_numeric_invert(*exch_rate);
-
-    return FALSE;
-}
diff --git a/src/gnome-utils/gnc-main-window.c b/src/gnome-utils/gnc-main-window.c
deleted file mode 100644
index 20339ea..0000000
--- a/src/gnome-utils/gnc-main-window.c
+++ /dev/null
@@ -1,4839 +0,0 @@
-/*
- * gnc-main-window.c -- GtkWindow which represents the
- *	GnuCash main window.
- *
- * Copyright (C) 2003 Jan Arne Petersen <jpetersen at uni-bonn.de>
- * Copyright (C) 2003,2005,2006 David Hampton <hampton at employees.org>
- *
- * 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 at gnu.org
- */
-
-/** @addtogroup Windows
-    @{ */
-/** @addtogroup GncMainWindow Main Window functions.
-    @{ */
-/** @file gnc-main-window.c
-    @brief Functions for adding content to a window.
-    @author Copyright (C) 2003 Jan Arne Petersen <jpetersen at uni-bonn.de>
-    @author Copyright (C) 2003,2005,2006 David Hampton <hampton at employees.org>
-*/
-#include "config.h"
-
-#include <glib/gi18n.h>
-#include <gtk/gtk.h>
-#include <gdk/gdk.h>
-#include <gdk/gdkkeysyms.h>
-
-#include "gnc-plugin.h"
-#include "gnc-plugin-manager.h"
-#include "gnc-main-window.h"
-
-#include "dialog-options.h"
-#include "dialog-preferences.h"
-#include "dialog-reset-warnings.h"
-#include "dialog-transfer.h"
-#include "dialog-utils.h"
-#include "file-utils.h"
-#include "gnc-component-manager.h"
-#include "gnc-engine.h"
-#include "gnc-file.h"
-#include "gnc-filepath-utils.h"
-#include "gnc-gkeyfile-utils.h"
-#include "gnc-gnome-utils.h"
-#include "gnc-gobject-utils.h"
-#include "gnc-gui-query.h"
-#include "gnc-hooks.h"
-#include "gnc-icons.h"
-#include "gnc-session.h"
-#include "gnc-state.h"
-#include "gnc-ui.h"
-#include "gnc-ui-util.h"
-#include "gnc-uri-utils.h"
-#include "core-utils/gnc-version.h"
-#include "gnc-window.h"
-#include "gnc-prefs.h"
-#include "option-util.h"
-// +JSLED
-//#include "gnc-html.h"
-#include "gnc-autosave.h"
-#include "print-session.h"
-#ifdef MAC_INTEGRATION
-#include <gtkmacintegration/gtkosxapplication.h>
-#endif
-#ifdef HAVE_SYS_STAT_H
-# define __need_system_sys_stat_h //To block Guile-2.0's evil substitute
-# include <sys/types.h>
-# include <sys/stat.h> // for stat(2)
-#endif
-
-/** Names of signals generated by the main window. */
-enum
-{
-    PAGE_ADDED,
-    PAGE_CHANGED,
-    LAST_SIGNAL
-};
-
-/** This label is used to provide a mapping from a visible page widget
- *  back to the corresponding GncPluginPage object. */
-#define PLUGIN_PAGE_LABEL "plugin-page"
-
-#define PLUGIN_PAGE_CLOSE_BUTTON "close-button"
-#define PLUGIN_PAGE_TAB_LABEL    "label"
-
-#define GNC_PREF_SHOW_CLOSE_BUTTON    "tab-close-buttons"
-#define GNC_PREF_TAB_NEXT_RECENT      "tab-next-recent"
-#define GNC_PREF_TAB_POSITION_TOP     "tab-position-top"
-#define GNC_PREF_TAB_POSITION_BOTTOM  "tab-position-bottom"
-#define GNC_PREF_TAB_POSITION_LEFT    "tab-position-left"
-#define GNC_PREF_TAB_POSITION_RIGHT   "tab-position-right"
-#define GNC_PREF_TAB_WIDTH            "tab-width"
-#define GNC_PREF_TAB_COLOR            "show-account-color-tabs"
-#define GNC_PREF_SAVE_CLOSE_EXPIRES   "save-on-close-expires"
-#define GNC_PREF_SAVE_CLOSE_WAIT_TIME "save-on-close-wait-time"
-
-#define GNC_MAIN_WINDOW_NAME "GncMainWindow"
-
-#define DIALOG_BOOK_OPTIONS_CM_CLASS "dialog-book-options"
-
-/* Static Globals *******************************************************/
-
-/** The debugging module that this .o belongs to.  */
-static QofLogModule log_module = GNC_MOD_GUI;
-/** A pointer to the parent class of an embedded window. */
-static GObjectClass *parent_class = NULL;
-/** An identifier that indicates a "main" window. */
-static GQuark window_type = 0;
-/** A list of all extant main windows. This is for convenience as the
- *  same information can be obtained from the object tracking code. */
-static GList *active_windows = NULL;
-/** Count down timer for the save changes dialog. If the timer reaches zero
- *  any changes will be saved and the save dialog closed automatically */
-static guint secs_to_save = 0;
-#define MSG_AUTO_SAVE _("Changes will be saved automatically in %u seconds")
-
-/* Declarations *********************************************************/
-static void gnc_main_window_class_init (GncMainWindowClass *klass);
-static void gnc_main_window_init (GncMainWindow *window, GncMainWindowClass *klass);
-static void gnc_main_window_finalize (GObject *object);
-static void gnc_main_window_destroy (GtkWidget *widget);
-
-static void gnc_main_window_setup_window (GncMainWindow *window);
-static void gnc_window_main_window_init (GncWindowIface *iface);
-#ifndef MAC_INTEGRATION
-static void gnc_main_window_update_all_menu_items (void);
-#endif
-
-/* Callbacks */
-static void gnc_main_window_add_widget (GtkUIManager *merge, GtkWidget *widget, GncMainWindow *window);
-static void gnc_main_window_switch_page (GtkNotebook *notebook, gpointer *notebook_page, gint pos, GncMainWindow *window);
-static void gnc_main_window_page_reordered (GtkNotebook *notebook, GtkWidget *child, guint pos, GncMainWindow *window);
-static void gnc_main_window_plugin_added (GncPlugin *manager, GncPlugin *plugin, GncMainWindow *window);
-static void gnc_main_window_plugin_removed (GncPlugin *manager, GncPlugin *plugin, GncMainWindow *window);
-static void gnc_main_window_engine_commit_error_callback( gpointer data, QofBackendError errcode );
-
-/* Command callbacks */
-static void gnc_main_window_cmd_page_setup (GtkAction *action, GncMainWindow *window);
-static void gnc_main_window_cmd_file_properties (GtkAction *action, GncMainWindow *window);
-static void gnc_main_window_cmd_file_close (GtkAction *action, GncMainWindow *window);
-static void gnc_main_window_cmd_file_quit (GtkAction *action, GncMainWindow *window);
-static void gnc_main_window_cmd_edit_cut (GtkAction *action, GncMainWindow *window);
-static void gnc_main_window_cmd_edit_copy (GtkAction *action, GncMainWindow *window);
-static void gnc_main_window_cmd_edit_paste (GtkAction *action, GncMainWindow *window);
-static void gnc_main_window_cmd_edit_preferences (GtkAction *action, GncMainWindow *window);
-static void gnc_main_window_cmd_view_refresh (GtkAction *action, GncMainWindow *window);
-static void gnc_main_window_cmd_view_toolbar (GtkAction *action, GncMainWindow *window);
-static void gnc_main_window_cmd_view_summary (GtkAction *action, GncMainWindow *window);
-static void gnc_main_window_cmd_view_statusbar (GtkAction *action, GncMainWindow *window);
-static void gnc_main_window_cmd_actions_reset_warnings (GtkAction *action, GncMainWindow *window);
-static void gnc_main_window_cmd_actions_rename_page (GtkAction *action, GncMainWindow *window);
-static void gnc_main_window_cmd_window_new (GtkAction *action, GncMainWindow *window);
-static void gnc_main_window_cmd_window_move_page (GtkAction *action, GncMainWindow *window);
-#ifndef MAC_INTEGRATION
-static void gnc_main_window_cmd_window_raise (GtkAction *action, GtkRadioAction *current, GncMainWindow *window);
-#endif
-static void gnc_main_window_cmd_help_tutorial (GtkAction *action, GncMainWindow *window);
-static void gnc_main_window_cmd_help_contents (GtkAction *action, GncMainWindow *window);
-static void gnc_main_window_cmd_help_about (GtkAction *action, GncMainWindow *window);
-
-static void do_popup_menu(GncPluginPage *page, GdkEventButton *event);
-static gboolean gnc_main_window_popup_menu_cb (GtkWidget *widget, GncPluginPage *page);
-static GtkWidget *gnc_main_window_get_statusbar (GncWindow *window_in);
-static void statusbar_notification_lastmodified(void);
-
-#ifdef MAC_INTEGRATION
-static void gnc_quartz_shutdown(GtkosxApplication *theApp, gpointer data);
-static gboolean gnc_quartz_should_quit(GtkosxApplication *theApp, GncMainWindow *window);
-static void gnc_quartz_set_menu(GncMainWindow* window);
-#endif
-
-/** The instance private data structure for an embedded window
- *  object. */
-typedef struct GncMainWindowPrivate
-{
-    /** The dock (vbox) at the top of the window containing the
-     *  menubar and toolbar.  These items are generated by the UI
-     *  manager and stored here when the UI manager provides them
-     *  to the main window. */
-    GtkWidget *menu_dock;
-    /** The toolbar created by the UI manager.  This pointer
-     * provides easy access for showing/hiding the toolbar. */
-    GtkWidget *toolbar;
-    /** The notebook containing all the pages in this window. */
-    GtkWidget *notebook;
-    /** Show account color as background on tabs */
-    gboolean show_color_tabs;
-    /** A pointer to the status bar at the bottom edge of the
-     *  window.  This pointer provides easy access for
-     *  updating/showing/hiding the status bar. */
-    GtkWidget *statusbar;
-    /** A pointer to the progress bar at the bottom right of the
-     *  window that is contained in the status bar.  This pointer
-     *  provides easy access for updating the progressbar. */
-    GtkWidget *progressbar;
-    /** Pointer to the about dialog.  We need this so that we create
-     *  only one, can attach to its activate-link signal, and can
-     *  destroy it with the main window.
-     */
-    GtkWidget *about_dialog;
-
-    /** The group of all actions provided by the main window
-     *  itself.  This does not include any action provided by menu
-     *  or content plugins. */
-    GtkActionGroup *action_group;
-
-    /** A list of all pages that are installed in this window. */
-    GList *installed_pages;
-    /** A list of pages in order of use (most recent -> least recent) */
-    GList *usage_order;
-    /** The currently selected page. */
-    GncPluginPage *current_page;
-    /** The identifier for this window's engine event handler. */
-    gint event_handler_id;
-
-    /** A hash table of all action groups that have been installed
-     *  into this window. The keys are the name of an action
-     *  group, the values are structures of type
-     *  MergedActionEntry. */
-    GHashTable *merged_actions_table;
-} GncMainWindowPrivate;
-
-#define GNC_MAIN_WINDOW_GET_PRIVATE(o)  \
-   (G_TYPE_INSTANCE_GET_PRIVATE ((o), GNC_TYPE_MAIN_WINDOW, GncMainWindowPrivate))
-
-/** This data structure maintains information about one action groups
- *  that has been installed in this window. */
-typedef struct
-{
-    /** The merge identifier for this action group.  This number
-     *  is provided by the UI manager. */
-    guint merge_id;
-    /** The action group itself.  This contains all actions added
-     *  by a single menu or content plugin. */
-    GtkActionGroup *action_group;
-} MergedActionEntry;
-
-/** A holding place for all the signals generated by the main window
- *  code. */
-static guint main_window_signals[LAST_SIGNAL] = { 0 };
-
-
-/** An array of all of the actions provided by the main window code.
- *  This includes some placeholder actions for the menus that are
- *  visible in the menu bar but have no action associated with
- *  them. */
-static GtkActionEntry gnc_menu_actions [] =
-{
-    /* Toplevel */
-
-    { "FileAction", NULL, N_("_File"), NULL, NULL, NULL, },
-    { "EditAction", NULL, N_("_Edit"), NULL, NULL, NULL },
-    { "ViewAction", NULL, N_("_View"), NULL, NULL, NULL },
-    { "ActionsAction", NULL, N_("_Actions"), NULL, NULL, NULL },
-    { "TransactionAction", NULL, N_("Tra_nsaction"), NULL, NULL, NULL },
-    { "ReportsAction", NULL, N_("_Reports"), NULL, NULL, NULL },
-    { "ToolsAction", NULL, N_("_Tools"), NULL, NULL, NULL },
-    { "ExtensionsAction", NULL, N_("E_xtensions"), NULL, NULL, NULL },
-    { "WindowsAction", NULL, N_("_Windows"), NULL, NULL, NULL },
-    { "HelpAction", NULL, N_("_Help"), NULL, NULL, NULL },
-
-    /* File menu */
-
-    { "FileImportAction", NULL, N_("_Import"), NULL, NULL, NULL },
-    { "FileExportAction", NULL, N_("_Export"), NULL, NULL, NULL },
-    {
-        "FilePrintAction", "document-print", N_("_Print..."), "<primary>p",
-        N_("Print the currently active page"), NULL
-    },
-#ifndef GTK_STOCK_PAGE_SETUP
-#    define GTK_STOCK_PAGE_SETUP NULL
-#endif
-    {
-        "FilePageSetupAction", "document-page-setup", N_("Pa_ge Setup..."), "<primary><shift>p",
-        N_("Specify the page size and orientation for printing"),
-        G_CALLBACK (gnc_main_window_cmd_page_setup)
-    },
-    {
-        "FilePropertiesAction", "document-properties", N_("Proper_ties"), "<Alt>Return",
-        N_("Edit the properties of the current file"),
-        G_CALLBACK (gnc_main_window_cmd_file_properties)
-    },
-    {
-        "FileCloseAction", "window-close", N_("_Close"), "<primary>W",
-        N_("Close the currently active page"),
-        G_CALLBACK (gnc_main_window_cmd_file_close)
-    },
-    {
-        "FileQuitAction", "application-exit", N_("_Quit"), "<primary>Q",
-        N_("Quit this application"),
-        G_CALLBACK (gnc_main_window_cmd_file_quit)
-    },
-
-    /* Edit menu */
-
-    {
-        "EditCutAction", "edit-cut", N_("Cu_t"), "<primary>X",
-        N_("Cut the current selection and copy it to clipboard"),
-        G_CALLBACK (gnc_main_window_cmd_edit_cut)
-    },
-    {
-        "EditCopyAction", "edit-copy", N_("_Copy"), "<primary>C",
-        N_("Copy the current selection to clipboard"),
-        G_CALLBACK (gnc_main_window_cmd_edit_copy)
-    },
-    {
-        "EditPasteAction", "edit-paste", N_("_Paste"), "<primary>V",
-        N_("Paste the clipboard content at the cursor position"),
-        G_CALLBACK (gnc_main_window_cmd_edit_paste)
-    },
-    {
-        "EditPreferencesAction", "preferences-system", N_("Pr_eferences"), NULL,
-        N_("Edit the global preferences of GnuCash"),
-        G_CALLBACK (gnc_main_window_cmd_edit_preferences)
-    },
-
-    /* View menu */
-
-    {
-        "ViewSortByAction", NULL, N_("_Sort By..."), NULL,
-        N_("Select sorting criteria for this page view"), NULL
-    },
-    {
-        "ViewFilterByAction", NULL, N_("_Filter By..."), NULL,
-        N_("Select the account types that should be displayed."), NULL
-    },
-    {
-        "ViewRefreshAction", "view-refresh", N_("_Refresh"), "<primary>r",
-        N_("Refresh this window"),
-        G_CALLBACK (gnc_main_window_cmd_view_refresh)
-    },
-
-    /* Actions menu */
-
-    { "ScrubMenuAction", NULL, N_("_Check & Repair"), NULL, NULL, NULL },
-    {
-        "ActionsForgetWarningsAction", NULL, N_("Reset _Warnings..."), NULL,
-        N_("Reset the state of all warning messages so they will be shown again."),
-        G_CALLBACK (gnc_main_window_cmd_actions_reset_warnings)
-    },
-    {
-        "ActionsRenamePageAction", NULL, N_("Re_name Page"), NULL,
-        N_("Rename this page."),
-        G_CALLBACK (gnc_main_window_cmd_actions_rename_page)
-    },
-
-    /* Windows menu */
-
-    {
-        "WindowNewAction", NULL, N_("_New Window"), NULL,
-        N_("Open a new top-level GnuCash window."),
-        G_CALLBACK (gnc_main_window_cmd_window_new)
-    },
-    {
-        "WindowMovePageAction", NULL, N_("New Window with _Page"), NULL,
-        N_("Move the current page to a new top-level GnuCash window."),
-        G_CALLBACK (gnc_main_window_cmd_window_move_page)
-    },
-
-    /* Help menu */
-
-    {
-        "HelpTutorialAction", "help-browser", N_("Tutorial and Concepts _Guide"), "<primary>H",
-        N_("Open the GnuCash Tutorial"),
-        G_CALLBACK (gnc_main_window_cmd_help_tutorial)
-    },
-    {
-        "HelpContentsAction", "help-browser", N_("_Contents"), "F1",
-        N_("Open the GnuCash Help"),
-        G_CALLBACK (gnc_main_window_cmd_help_contents)
-    },
-    {
-        "HelpAboutAction", "help-about", N_("_About"), NULL,
-        N_("About GnuCash"),
-        G_CALLBACK (gnc_main_window_cmd_help_about)
-    },
-};
-/** The number of actions provided by the main window. */
-static guint gnc_menu_n_actions = G_N_ELEMENTS (gnc_menu_actions);
-
-/** An array of all of the toggle action provided by the main window
- *  code. */
-static GtkToggleActionEntry toggle_actions [] =
-{
-    {
-        "ViewToolbarAction", NULL, N_("_Toolbar"), NULL,
-        N_("Show/hide the toolbar on this window"),
-        G_CALLBACK (gnc_main_window_cmd_view_toolbar), TRUE
-    },
-    {
-        "ViewSummaryAction", NULL, N_("Su_mmary Bar"), NULL,
-        N_("Show/hide the summary bar on this window"),
-        G_CALLBACK (gnc_main_window_cmd_view_summary), TRUE
-    },
-    {
-        "ViewStatusbarAction", NULL, N_("Stat_us Bar"), NULL,
-        N_("Show/hide the status bar on this window"),
-        G_CALLBACK (gnc_main_window_cmd_view_statusbar), TRUE
-    },
-};
-/** The number of toggle actions provided by the main window. */
-static guint n_toggle_actions = G_N_ELEMENTS (toggle_actions);
-
-#ifndef MAC_INTEGRATION
-/** An array of all of the radio action provided by the main window
- *  code. */
-static GtkRadioActionEntry radio_entries [] =
-{
-    { "Window0Action", NULL, N_("Window _1"), NULL, NULL, 0 },
-    { "Window1Action", NULL, N_("Window _2"), NULL, NULL, 1 },
-    { "Window2Action", NULL, N_("Window _3"), NULL, NULL, 2 },
-    { "Window3Action", NULL, N_("Window _4"), NULL, NULL, 3 },
-    { "Window4Action", NULL, N_("Window _5"), NULL, NULL, 4 },
-    { "Window5Action", NULL, N_("Window _6"), NULL, NULL, 5 },
-    { "Window6Action", NULL, N_("Window _7"), NULL, NULL, 6 },
-    { "Window7Action", NULL, N_("Window _8"), NULL, NULL, 7 },
-    { "Window8Action", NULL, N_("Window _9"), NULL, NULL, 8 },
-    { "Window9Action", NULL, N_("Window _0"), NULL, NULL, 9 },
-};
-
-/** The number of radio actions provided by the main window. */
-static guint n_radio_entries = G_N_ELEMENTS (radio_entries);
-#endif
-
-/** These are the "important" actions provided by the main window.
- *  Their labels will appear when the toolbar is set to "Icons and
- *  important text" (e.g. GTK_TOOLBAR_BOTH_HORIZ) mode. */
-static const gchar *gnc_menu_important_actions[] =
-{
-    "FileCloseAction",
-    NULL,
-};
-
-
-/** The following are in the main window so they will always be
- *  present in the menu structure, but they are never sensitive.
- *  These actions should be overridden in child windows where they
- *  have meaning. */
-static const gchar *always_insensitive_actions[] =
-{
-    "FilePrintAction",
-    NULL
-};
-
-
-/** The following items in the main window should be made insensitive
- *  at startup time.  The sensitivity will be changed by some later
- *  event. */
-static const gchar *initially_insensitive_actions[] =
-{
-    "FileCloseAction",
-    NULL
-};
-
-
-/** The following are in the main window so they will always be
- *  present in the menu structure, but they are always hidden.
- *  These actions should be overridden in child windows where they
- *  have meaning. */
-static const gchar *always_hidden_actions[] =
-{
-    "ViewSortByAction",
-    "ViewFilterByAction",
-    NULL
-};
-
-
-/** If a page is flagged as immutable, then the following actions
- *  cannot be performed on that page. */
-static const gchar *immutable_page_actions[] =
-{
-    "FileCloseAction",
-    NULL
-};
-
-
-/** The following actions can only be performed if there are multiple
- *  pages in a window. */
-static const gchar *multiple_page_actions[] =
-{
-    "WindowMovePageAction",
-    NULL
-};
-
-
-/************************************************************
- *                                                          *
- ************************************************************/
-#define WINDOW_COUNT            "WindowCount"
-#define WINDOW_STRING           "Window %d"
-#define WINDOW_GEOMETRY         "WindowGeometry"
-#define WINDOW_POSITION         "WindowPosition"
-#define WINDOW_MAXIMIZED        "WindowMaximized"
-#define TOOLBAR_VISIBLE         "ToolbarVisible"
-#define STATUSBAR_VISIBLE       "StatusbarVisible"
-#define SUMMARYBAR_VISIBLE      "SummarybarVisible"
-#define WINDOW_FIRSTPAGE        "FirstPage"
-#define WINDOW_PAGECOUNT        "PageCount"
-#define WINDOW_PAGEORDER        "PageOrder"
-#define PAGE_TYPE               "PageType"
-#define PAGE_NAME               "PageName"
-#define PAGE_STRING             "Page %d"
-
-typedef struct
-{
-    GKeyFile *key_file;
-    const gchar *group_name;
-    gint window_num;
-    gint page_num;
-    gint page_offset;
-} GncMainWindowSaveData;
-
-
-/*  Iterator function to walk all pages in all windows, calling the
- *  specified function for each page. */
-void
-gnc_main_window_foreach_page (GncMainWindowPageFunc fn, gpointer user_data)
-{
-    GncMainWindowPrivate *priv;
-    GncMainWindow *window;
-    GncPluginPage *page;
-    GList *w, *p;
-
-    ENTER(" ");
-    for (w = active_windows; w; w = g_list_next(w))
-    {
-        window = w->data;
-        priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
-        for (p = priv->installed_pages; p; p = g_list_next(p))
-        {
-            page = p->data;
-            fn(page, user_data);
-        }
-    }
-    LEAVE(" ");
-}
-
-
-/** Restore a single page to a window.  This function calls a page
- *  specific function to create the actual page.  It then handles all
- *  the common tasks such as insuring the page is installed into a
- *  window, updating the page name, and anything else that might be
- *  common to all pages.
- *
- *  @param window The GncMainWindow where the new page will be
- *  installed.
- *
- *  @param data A data structure containing state about the
- *  window/page restoration process. */
-static void
-gnc_main_window_restore_page (GncMainWindow *window,
-                              GncMainWindowSaveData *data)
-{
-    GncMainWindowPrivate *priv;
-    GncPluginPage *page;
-    gchar *page_group, *page_type = NULL, *name = NULL;
-    const gchar *class_type;
-    GError *error = NULL;
-
-    ENTER("window %p, data %p (key file %p, window %d, page start %d, page num %d)",
-          window, data, data->key_file, data->window_num, data->page_offset,
-          data->page_num);
-
-    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
-    page_group = g_strdup_printf(PAGE_STRING,
-                                 data->page_offset + data->page_num);
-    page_type = g_key_file_get_string(data->key_file, page_group,
-                                      PAGE_TYPE, &error);
-    if (error)
-    {
-        g_warning("error reading group %s key %s: %s",
-                  page_group, PAGE_TYPE, error->message);
-        goto cleanup;
-    }
-
-    /* See if the page already exists. */
-    page = g_list_nth_data(priv->installed_pages, data->page_num);
-    if (page)
-    {
-        class_type = GNC_PLUGIN_PAGE_GET_CLASS(page)->plugin_name;
-        if (strcmp(page_type, class_type) != 0)
-        {
-            g_warning("error: page types don't match: state %s, existing page %s",
-                      page_type, class_type);
-            goto cleanup;
-        }
-    }
-    else
-    {
-        /* create and install the page */
-        page = gnc_plugin_page_recreate_page(GTK_WIDGET(window), page_type,
-                                             data->key_file, page_group);
-        if (page)
-        {
-            /* Does the page still need to be installed into the window? */
-            if (page->window == NULL)
-            {
-                gnc_plugin_page_set_use_new_window(page, FALSE);
-                gnc_main_window_open_page(window, page);
-            }
-
-            /* Restore the page name */
-            name = g_key_file_get_string(data->key_file, page_group,
-                                         PAGE_NAME, &error);
-            if (error)
-            {
-                g_warning("error reading group %s key %s: %s",
-                          page_group, PAGE_NAME, error->message);
-                /* Fall through and still show the page. */
-            }
-            else
-            {
-                DEBUG("updating page name for %p to %s.", page, name);
-                main_window_update_page_name(page, name);
-                g_free(name);
-            }
-        }
-    }
-
-    LEAVE("ok");
-cleanup:
-    if (error)
-        g_error_free(error);
-    if (page_type)
-        g_free(page_type);
-    g_free(page_group);
-}
-
-
-/** Restore all the pages in a given window.  This function restores
- *  all the window specific attributes, then calls a helper function
- *  to restore all the pages that are contained in the window.
- *
- *  @param window The GncMainWindow whose pages should be restored.
- *
- *  @param data A data structure containing state about the
- *  window/page restoration process. */
-static void
-gnc_main_window_restore_window (GncMainWindow *window, GncMainWindowSaveData *data)
-{
-    GncMainWindowPrivate *priv;
-    GtkAction *action;
-    gint *pos, *geom, *order;
-    gsize length;
-    gboolean max, visible, desired_visibility;
-    gchar *window_group;
-    gint page_start, page_count, i;
-    GError *error = NULL;
-
-    /* Setup */
-    ENTER("window %p, data %p (key file %p, window %d)",
-          window, data, data->key_file, data->window_num);
-    window_group = g_strdup_printf(WINDOW_STRING, data->window_num + 1);
-
-    /* Deal with the uncommon case that the state file defines a window
-     * but no pages. An example to get in such a situation can be found
-     * here: https://bugzilla.gnome.org/show_bug.cgi?id=436479#c3
-     * If this happens on the first window, we will open an account hierarchy
-     * to avoid confusing the user by presenting a completely empty window.
-     * If it happens on a later window, we'll just skip restoring that window.
-     */
-    if (!g_key_file_has_group (data->key_file, window_group) ||
-        !g_key_file_has_key (data->key_file, window_group, WINDOW_PAGECOUNT, &error))
-    {
-        if (window)
-        {
-            gnc_main_window_restore_default_state (window);
-            PINFO ("saved state had an empty first main window\n"
-                   "an account hierarchy page was added automatically to avoid confusion");
-        }
-        else
-            PINFO ("saved state had an empty main window, skipping restore");
-
-        goto cleanup;
-    }
-
-
-    /* Get this window's notebook info */
-    page_count = g_key_file_get_integer(data->key_file,
-                                        window_group, WINDOW_PAGECOUNT, &error);
-    if (error)
-    {
-        g_warning("error reading group %s key %s: %s",
-                  window_group, WINDOW_PAGECOUNT, error->message);
-        goto cleanup;
-    }
-    if (page_count == 0)
-    {
-        /* Should never happen, but has during alpha testing. Having this
-         * check doesn't hurt anything. */
-        goto cleanup;
-    }
-    page_start = g_key_file_get_integer(data->key_file,
-                                        window_group, WINDOW_FIRSTPAGE, &error);
-    if (error)
-    {
-        g_warning("error reading group %s key %s: %s",
-                  window_group, WINDOW_FIRSTPAGE, error->message);
-        goto cleanup;
-    }
-
-    /* Build a window if we don't already have one */
-    if (window == NULL)
-    {
-        DEBUG("Window %d doesn't exist. Creating new window.", data->window_num);
-        DEBUG("active_windows %p.", active_windows);
-        if (active_windows)
-            DEBUG("first window %p.", active_windows->data);
-        window = gnc_main_window_new();
-        gtk_widget_show(GTK_WIDGET(window));
-    }
-
-    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
-
-    /* Get the window coordinates, etc. */
-    geom = g_key_file_get_integer_list(data->key_file, window_group,
-                                       WINDOW_GEOMETRY, &length, &error);
-    if (error)
-    {
-        g_warning("error reading group %s key %s: %s",
-                  window_group, WINDOW_GEOMETRY, error->message);
-        g_error_free(error);
-        error = NULL;
-    }
-    else if (length != 2)
-    {
-        g_warning("invalid number of values for group %s key %s",
-                  window_group, WINDOW_GEOMETRY);
-    }
-    else
-    {
-        gtk_window_resize(GTK_WINDOW(window), geom[0], geom[1]);
-        DEBUG("window (%p) size %dx%d", window, geom[0], geom[1]);
-    }
-    /* keep the geometry for a test whether the windows position
-       is offscreen */
-
-    pos = g_key_file_get_integer_list(data->key_file, window_group,
-                                      WINDOW_POSITION, &length, &error);
-    if (error)
-    {
-        g_warning("error reading group %s key %s: %s",
-                  window_group, WINDOW_POSITION, error->message);
-        g_error_free(error);
-        error = NULL;
-    }
-    else if (length != 2)
-    {
-        g_warning("invalid number of values for group %s key %s",
-                  window_group, WINDOW_POSITION);
-    }
-// This does not do any thing ?
-//    else if ((pos[0] + (geom ? geom[0] : 0) < 0) ||
-//             (pos[0] > gdk_screen_width()) ||
-//             (pos[1] + (geom ? geom[1] : 0) < 0) ||
-//             (pos[1] > gdk_screen_height()))
-//    {
-//    g_debug("position %dx%d, size%dx%d is offscreen; will not move",
-//	    pos[0], pos[1], geom[0], geom[1]);
-//    }
-    else
-    {
-        gtk_window_move(GTK_WINDOW(window), pos[0], pos[1]);
-        DEBUG("window (%p) position %dx%d", window, pos[0], pos[1]);
-    }
-    if (geom)
-    {
-        g_free(geom);
-    }
-    if (pos)
-    {
-        g_free(pos);
-    }
-
-    max = g_key_file_get_boolean(data->key_file, window_group,
-                                 WINDOW_MAXIMIZED, &error);
-    if (error)
-    {
-        g_warning("error reading group %s key %s: %s",
-                  window_group, WINDOW_MAXIMIZED, error->message);
-        g_error_free(error);
-        error = NULL;
-    }
-    else if (max)
-    {
-        gtk_window_maximize(GTK_WINDOW(window));
-    }
-
-    /* Common view menu items */
-    action = gnc_main_window_find_action(window, "ViewToolbarAction");
-    visible = gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action));
-    desired_visibility = g_key_file_get_boolean(data->key_file, window_group,
-                         TOOLBAR_VISIBLE, &error);
-    if (error)
-    {
-        g_warning("error reading group %s key %s: %s",
-                  window_group, TOOLBAR_VISIBLE, error->message);
-        g_error_free(error);
-        error = NULL;
-    }
-    else if (visible != desired_visibility)
-    {
-        gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), desired_visibility);
-    }
-
-    action = gnc_main_window_find_action(window, "ViewSummaryAction");
-    visible = gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action));
-    desired_visibility = g_key_file_get_boolean(data->key_file, window_group,
-                         SUMMARYBAR_VISIBLE, &error);
-    if (error)
-    {
-        g_warning("error reading group %s key %s: %s",
-                  window_group, TOOLBAR_VISIBLE, error->message);
-        g_error_free(error);
-        error = NULL;
-    }
-    else if (visible != desired_visibility)
-    {
-        gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), desired_visibility);
-    }
-
-    action = gnc_main_window_find_action(window, "ViewStatusbarAction");
-    visible = gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action));
-    desired_visibility = g_key_file_get_boolean(data->key_file, window_group,
-                         STATUSBAR_VISIBLE, &error);
-    if (error)
-    {
-        g_warning("error reading group %s key %s: %s",
-                  window_group, TOOLBAR_VISIBLE, error->message);
-        g_error_free(error);
-        error = NULL;
-    }
-    else if (visible != desired_visibility)
-    {
-        gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), desired_visibility);
-    }
-
-    /* Now populate the window with pages. */
-    for (i = 0; i < page_count; i++)
-    {
-        data->page_offset = page_start;
-        data->page_num = i;
-        gnc_main_window_restore_page(window, data);
-
-        /* give the page a chance to display */
-        while (gtk_events_pending ())
-            gtk_main_iteration ();
-    }
-
-    /* Restore page ordering within the notebook. Use +1 notation so the
-     * numbers in the page order match the page sections, at least for
-     * the one window case. */
-    order = g_key_file_get_integer_list(data->key_file, window_group,
-                                        WINDOW_PAGEORDER, &length, &error);
-    if (error)
-    {
-        g_warning("error reading group %s key %s: %s",
-                  window_group, WINDOW_PAGEORDER, error->message);
-        g_error_free(error);
-        error = NULL;
-    }
-    else if (length != page_count)
-    {
-        g_warning("%s key %s length %" G_GSIZE_FORMAT " differs from window page count %d",
-                  window_group, WINDOW_PAGEORDER, length, page_count);
-    }
-    else
-    {
-        /* Dump any list that might exist */
-        g_list_free(priv->usage_order);
-        priv->usage_order = NULL;
-        /* Now rebuild the list from the key file. */
-        for (i = 0; i < length; i++)
-        {
-            gpointer page = g_list_nth_data(priv->installed_pages, order[i] - 1);
-            if (page)
-            {
-                priv->usage_order = g_list_append(priv->usage_order, page);
-            }
-        }
-        gtk_notebook_set_current_page (GTK_NOTEBOOK(priv->notebook),
-                                       order[0] - 1);
-    }
-    if (order)
-    {
-        g_free(order);
-    }
-
-    LEAVE("window %p", window);
-cleanup:
-    if (error)
-        g_error_free(error);
-    g_free(window_group);
-}
-
-void
-gnc_main_window_restore_all_windows(const GKeyFile *keyfile)
-{
-    gint i, window_count;
-    GError *error = NULL;
-    GncMainWindowSaveData data;
-    GncMainWindow *window;
-
-    /* We use the same struct for reading and for writing, so we cast
-       away the const. */
-    data.key_file = (GKeyFile *) keyfile;
-    window_count = g_key_file_get_integer(data.key_file, STATE_FILE_TOP,
-                                          WINDOW_COUNT, &error);
-    if (error)
-    {
-        g_warning("error reading group %s key %s: %s",
-                  STATE_FILE_TOP, WINDOW_COUNT, error->message);
-        g_error_free(error);
-        LEAVE("can't read count");
-        return;
-    }
-
-    /* Restore all state information on the open windows.  Window
-       numbers in state file are 1-based. GList indices are 0-based. */
-    gnc_set_busy_cursor (NULL, TRUE);
-    for (i = 0; i < window_count; i++)
-    {
-        data.window_num = i;
-        window = g_list_nth_data(active_windows, i);
-        gnc_main_window_restore_window(window, &data);
-    }
-    gnc_unset_busy_cursor (NULL);
-
-    statusbar_notification_lastmodified();
-}
-
-void
-gnc_main_window_restore_default_state(GncMainWindow *window)
-{
-    GtkAction *action;
-
-    /* The default state should be to have an Account Tree page open
-     * in the window. */
-    DEBUG("no saved state file");
-    if (!window)
-        window = g_list_nth_data(active_windows, 0);
-    action = gnc_main_window_find_action(window, "ViewAccountTreeAction");
-    gtk_action_activate(action);
-}
-
-/** Save the state of a single page to a disk.  This function handles
- *  all the common tasks such as saving the page type and name, and
- *  anything else that might be common to all pages.  It then calls a
- *  page specific function to save the actual page.
- *
- *  @param page The GncPluginPage whose state should be saved.
- *
- *  @param data A data structure containing state about the
- *  window/page saving process. */
-static void
-gnc_main_window_save_page (GncPluginPage *page, GncMainWindowSaveData *data)
-{
-    gchar *page_group;
-    const gchar *plugin_name, *page_name;
-
-    ENTER("page %p, data %p (key file %p, window %d, page %d)",
-          page, data, data->key_file, data->window_num, data->page_num);
-    plugin_name = gnc_plugin_page_get_plugin_name(page);
-    page_name = gnc_plugin_page_get_page_name(page);
-    if (!plugin_name || !page_name)
-    {
-        LEAVE("not saving invalid page");
-        return;
-    }
-    page_group = g_strdup_printf(PAGE_STRING, data->page_num++);
-    g_key_file_set_string(data->key_file, page_group, PAGE_TYPE, plugin_name);
-    g_key_file_set_string(data->key_file, page_group, PAGE_NAME, page_name);
-
-    gnc_plugin_page_save_page(page, data->key_file, page_group);
-    g_free(page_group);
-    LEAVE(" ");
-}
-
-
-/** Saves all the pages in a single window to a disk.  This function
- *  saves all the window specific attributes, then calls a helper
- *  function to save all the pages that are contained in the window.
- *
- *  @param window The GncMainWindow whose pages should be saved.
- *
- *  @param data A data structure containing state about the
- *  window/page saving process. */
-static void
-gnc_main_window_save_window (GncMainWindow *window, GncMainWindowSaveData *data)
-{
-    GncMainWindowPrivate *priv;
-    GtkAction *action;
-    gint i, num_pages, coords[4], *order;
-    gboolean maximized, visible;
-    gchar *window_group;
-
-    /* Setup */
-    ENTER("window %p, data %p (key file %p, window %d)",
-          window, data, data->key_file, data->window_num);
-    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
-
-    /* Check for bogus window structures. */
-    num_pages = gtk_notebook_get_n_pages(GTK_NOTEBOOK(priv->notebook));
-    if (0 == num_pages)
-    {
-        LEAVE("empty window %p", window);
-        return;
-    }
-
-    /* Save this window's notebook info */
-    window_group = g_strdup_printf(WINDOW_STRING, data->window_num++);
-    g_key_file_set_integer(data->key_file, window_group,
-                           WINDOW_PAGECOUNT, num_pages);
-    g_key_file_set_integer(data->key_file, window_group,
-                           WINDOW_FIRSTPAGE, data->page_num);
-
-    /* Save page ordering within the notebook. Use +1 notation so the
-     * numbers in the page order match the page sections, at least for
-     * the one window case. */
-    order = g_malloc(sizeof(gint) * num_pages);
-    for (i = 0; i < num_pages; i++)
-    {
-        gpointer page = g_list_nth_data(priv->usage_order, i);
-        order[i] = g_list_index(priv->installed_pages, page) + 1;
-    }
-    g_key_file_set_integer_list(data->key_file, window_group,
-                                WINDOW_PAGEORDER, order, num_pages);
-    g_free(order);
-
-    /* Save the window coordinates, etc. */
-    gtk_window_get_position(GTK_WINDOW(window), &coords[0], &coords[1]);
-    gtk_window_get_size(GTK_WINDOW(window), &coords[2], &coords[3]);
-    maximized = (gdk_window_get_state(gtk_widget_get_window ((GTK_WIDGET(window))))
-                 & GDK_WINDOW_STATE_MAXIMIZED) != 0;
-    g_key_file_set_integer_list(data->key_file, window_group,
-                                WINDOW_POSITION, &coords[0], 2);
-    g_key_file_set_integer_list(data->key_file, window_group,
-                                WINDOW_GEOMETRY, &coords[2], 2);
-    g_key_file_set_boolean(data->key_file, window_group,
-                           WINDOW_MAXIMIZED, maximized);
-    DEBUG("window (%p) position %dx%d, size %dx%d, %s", window,  coords[0], coords[1],
-          coords[2], coords[3],
-          maximized ? "maximized" : "not maximized");
-
-    /* Common view menu items */
-    action = gnc_main_window_find_action(window, "ViewToolbarAction");
-    visible = gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action));
-    g_key_file_set_boolean(data->key_file, window_group,
-                           TOOLBAR_VISIBLE, visible);
-    action = gnc_main_window_find_action(window, "ViewSummaryAction");
-    visible = gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action));
-    g_key_file_set_boolean(data->key_file, window_group,
-                           SUMMARYBAR_VISIBLE, visible);
-    action = gnc_main_window_find_action(window, "ViewStatusbarAction");
-    visible = gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action));
-    g_key_file_set_boolean(data->key_file, window_group,
-                           STATUSBAR_VISIBLE, visible);
-
-    /* Save individual pages in this window */
-    g_list_foreach(priv->installed_pages, (GFunc)gnc_main_window_save_page, data);
-
-    g_free(window_group);
-    LEAVE("window %p", window);
-}
-
-void
-gnc_main_window_save_all_windows(GKeyFile *keyfile)
-{
-    GncMainWindowSaveData data;
-
-    /* Set up the iterator data structures */
-    data.key_file = keyfile;
-    data.window_num = 1;
-    data.page_num = 1;
-
-    g_key_file_set_integer(data.key_file,
-                           STATE_FILE_TOP, WINDOW_COUNT,
-                           g_list_length(active_windows));
-    /* Dump all state information on the open windows */
-    g_list_foreach(active_windows, (GFunc)gnc_main_window_save_window, &data);
-}
-
-
-gboolean
-gnc_main_window_finish_pending (GncMainWindow *window)
-{
-    GncMainWindowPrivate *priv;
-    GList *item;
-
-    g_return_val_if_fail(GNC_IS_MAIN_WINDOW(window), TRUE);
-
-    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
-    for (item = priv->installed_pages; item; item = g_list_next(item))
-    {
-        if (!gnc_plugin_page_finish_pending(item->data))
-        {
-            return FALSE;
-        }
-    }
-    return TRUE;
-}
-
-
-gboolean
-gnc_main_window_all_finish_pending (void)
-{
-    const GList *windows, *item;
-
-    windows = gnc_gobject_tracking_get_list(GNC_MAIN_WINDOW_NAME);
-    for (item = windows; item; item = g_list_next(item))
-    {
-        if (!gnc_main_window_finish_pending(item->data))
-        {
-            return FALSE;
-        }
-    }
-    return TRUE;
-}
-
-
-/** See if the page already exists.  For each open window, look
- *  through the list of pages installed in that window and see if the
- *  specified page is there.
- *
- *  @internal
- *
- *  @param page The page to search for.
- *
- *  @return TRUE if the page is present in the window, FALSE otherwise.
- */
-static gboolean
-gnc_main_window_page_exists (GncPluginPage *page)
-{
-    GncMainWindow *window;
-    GncMainWindowPrivate *priv;
-    GList *walker;
-
-    for (walker = active_windows; walker; walker = g_list_next(walker))
-    {
-        window = walker->data;
-        priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
-        if (g_list_find(priv->installed_pages, page))
-        {
-            return TRUE;
-        }
-    }
-    return FALSE;
-}
-
-static gboolean auto_save_countdown (GtkWidget *dialog)
-{
-    GtkWidget *label;
-    gchar *timeoutstr = NULL;
-
-    /* Stop count down if user closed the dialog since the last time we were called */
-    if (!GTK_IS_DIALOG (dialog))
-        return FALSE; /* remove timer */
-
-    /* Stop count down if count down text can't be updated */
-    label = GTK_WIDGET (g_object_get_data (G_OBJECT (dialog), "count-down-label"));
-    if (!GTK_IS_LABEL (label))
-        return FALSE; /* remove timer */
-
-    secs_to_save--;
-    DEBUG ("Counting down: %d seconds", secs_to_save);
-
-    timeoutstr = g_strdup_printf (MSG_AUTO_SAVE, secs_to_save);
-    gtk_label_set_text (GTK_LABEL (label), timeoutstr);
-    g_free (timeoutstr);
-
-    /* Count down reached 0. Save and close dialog */
-    if (!secs_to_save)
-    {
-        gtk_dialog_response (GTK_DIALOG(dialog), GTK_RESPONSE_APPLY);
-        return FALSE; /* remove timer */
-    }
-
-    /* Run another cycle */
-    return TRUE;
-}
-
-
-/** This function prompts the user to save the file with a dialog that
- *  follows the HIG guidelines.
- *
- *  @internal
- *
- *  @returns This function returns TRUE if the user clicked the Cancel
- *  button.  It returns FALSE if the closing of the window should
- *  continue.
- */
-static gboolean
-gnc_main_window_prompt_for_save (GtkWidget *window)
-{
-    QofSession *session;
-    QofBook *book;
-    GtkWidget *dialog, *msg_area, *label;
-    gint response;
-    const gchar *filename, *tmp;
-    const gchar *title = _("Save changes to file %s before closing?");
-    /* This should be the same message as in gnc-file.c */
-    const gchar *message_hours =
-        _("If you don't save, changes from the past %d hours and %d minutes will be discarded.");
-    const gchar *message_days =
-        _("If you don't save, changes from the past %d days and %d hours will be discarded.");
-    time64 oldest_change;
-    gint minutes, hours, days;
-
-    session = gnc_get_current_session();
-    book = qof_session_get_book(session);
-    filename = qof_session_get_url(session);
-    if (!strlen (filename))
-        filename = _("<unknown>");
-    if ((tmp = strrchr(filename, '/')) != NULL)
-        filename = tmp + 1;
-
-    /* Remove any pending auto-save timeouts */
-    gnc_autosave_remove_timer(book);
-
-    dialog = gtk_message_dialog_new(GTK_WINDOW(window),
-                                    GTK_DIALOG_MODAL,
-                                    GTK_MESSAGE_WARNING,
-                                    GTK_BUTTONS_NONE,
-                                    title,
-                                    filename);
-    oldest_change = qof_book_get_session_dirty_time(book);
-    minutes = (gnc_time (NULL) - oldest_change) / 60 + 1;
-    hours = minutes / 60;
-    minutes = minutes % 60;
-    days = hours / 24;
-    hours = hours % 24;
-    if (days > 0)
-    {
-        gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
-                message_days, days, hours);
-    }
-    else if (hours > 0)
-    {
-        gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
-                message_hours, hours, minutes);
-    }
-    else
-    {
-        gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
-                ngettext("If you don't save, changes from the past %d minute will be discarded.",
-                         "If you don't save, changes from the past %d minutes will be discarded.",
-                         minutes), minutes);
-    }
-    gtk_dialog_add_buttons(GTK_DIALOG(dialog),
-                           _("Close _Without Saving"), GTK_RESPONSE_CLOSE,
-                           _("_Cancel"), GTK_RESPONSE_CANCEL,
-                           _("_Save"), GTK_RESPONSE_APPLY,
-                           NULL);
-    gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_APPLY);
-
-    /* If requested by the user, add a timeout to the question to save automatically
-     * if the user doesn't answer after a chosen number of seconds.
-     */
-    if (gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL, GNC_PREF_SAVE_CLOSE_EXPIRES))
-    {
-        gchar *timeoutstr = NULL;
-
-        secs_to_save = gnc_prefs_get_int (GNC_PREFS_GROUP_GENERAL, GNC_PREF_SAVE_CLOSE_WAIT_TIME);
-        timeoutstr = g_strdup_printf (MSG_AUTO_SAVE, secs_to_save);
-        label = GTK_WIDGET(gtk_label_new (timeoutstr));
-        g_free (timeoutstr);
-        gtk_widget_show (label);
-
-        msg_area = gtk_message_dialog_get_message_area (GTK_MESSAGE_DIALOG(dialog));
-        gtk_box_pack_end (GTK_BOX(msg_area), label, TRUE, TRUE, 0);
-        g_object_set (G_OBJECT (label), "xalign", 0.0, NULL);
-
-        g_object_set_data (G_OBJECT (dialog), "count-down-label", label);
-        g_timeout_add_seconds (1, (GSourceFunc)auto_save_countdown, dialog);
-    }
-
-    response = gtk_dialog_run (GTK_DIALOG (dialog));
-    gtk_widget_destroy(dialog);
-
-    switch (response)
-    {
-    case GTK_RESPONSE_APPLY:
-        gnc_file_save();
-        return FALSE;
-
-    case GTK_RESPONSE_CLOSE:
-        qof_book_mark_session_saved(book);
-        return FALSE;
-
-    default:
-        return TRUE;
-    }
-}
-
-
-static void
-gnc_main_window_add_plugin (gpointer plugin,
-                            gpointer window)
-{
-    g_return_if_fail (GNC_IS_MAIN_WINDOW (window));
-    g_return_if_fail (GNC_IS_PLUGIN (plugin));
-
-    ENTER(" ");
-    gnc_plugin_add_to_window (GNC_PLUGIN (plugin),
-                              GNC_MAIN_WINDOW (window),
-                              window_type);
-    LEAVE(" ");
-}
-
-static void
-gnc_main_window_remove_plugin (gpointer plugin,
-                               gpointer window)
-{
-    g_return_if_fail (GNC_IS_MAIN_WINDOW (window));
-    g_return_if_fail (GNC_IS_PLUGIN (plugin));
-
-    ENTER(" ");
-    gnc_plugin_remove_from_window (GNC_PLUGIN (plugin),
-                                   GNC_MAIN_WINDOW (window),
-                                   window_type);
-    LEAVE(" ");
-}
-
-
-static gboolean
-gnc_main_window_timed_quit (gpointer dummy)
-{
-    if (gnc_file_save_in_progress())
-        return TRUE;
-
-    gnc_shutdown (0);
-    return FALSE;
-}
-
-static gboolean
-gnc_main_window_quit(GncMainWindow *window)
-{
-    QofSession *session;
-    gboolean needs_save, do_shutdown;
-
-    session = gnc_get_current_session();
-    needs_save = qof_book_session_not_saved(qof_session_get_book(session)) &&
-                 !gnc_file_save_in_progress();
-    do_shutdown = !needs_save ||
-                  (needs_save && !gnc_main_window_prompt_for_save(GTK_WIDGET(window)));
-
-    if (do_shutdown)
-    {
-        g_timeout_add(250, gnc_main_window_timed_quit, NULL);
-        return TRUE;
-    }
-    return FALSE;
-}
-
-static gboolean
-gnc_main_window_delete_event (GtkWidget *window,
-                              GdkEvent *event,
-                              gpointer user_data)
-{
-    static gboolean already_dead = FALSE;
-
-    if (already_dead)
-        return TRUE;
-
-    if (!gnc_main_window_finish_pending(GNC_MAIN_WINDOW(window)))
-    {
-        /* Don't close the window. */
-        return TRUE;
-    }
-
-    if (g_list_length(active_windows) > 1)
-        return FALSE;
-
-    already_dead = gnc_main_window_quit(GNC_MAIN_WINDOW(window));
-    return TRUE;
-}
-
-
-/** This function handles any event notifications from the engine.
- *  The only event it currently cares about is the deletion of a book.
- *  When a book is deleted, it runs through all installed pages
- *  looking for pages that reference the just (about to be?) deleted
- *  book.  It closes any page it finds so there are no dangling
- *  references to the book.
- *
- *  @internal
- *
- *  @param entity     The guid the item being added, deleted, etc.
- *
- *  @param type       The type of the item being added, deleted, etc. This
- *                    function only cares about a type of GNC_ID_BOOK.
- *
- *  @param event_type The type of the event.  This function only cares
- *                    about an event type of QOF_EVENT_DESTROY.
- *
- *  @param user_data  A pointer to the window data structure.
- */
-static void
-gnc_main_window_event_handler (QofInstance *entity,  QofEventId event_type,
-                               gpointer user_data, gpointer event_data)
-{
-    GncMainWindow *window;
-    GncMainWindowPrivate *priv;
-    GncPluginPage *page;
-    GList *item, *next;
-
-    /* hard failures */
-    g_return_if_fail(GNC_IS_MAIN_WINDOW(user_data));
-
-    /* soft failures */
-    if (!QOF_CHECK_TYPE(entity, QOF_ID_BOOK))
-        return;
-    if (event_type !=  QOF_EVENT_DESTROY)
-        return;
-
-    ENTER("entity %p, event %d, window %p, event data %p",
-          entity, event_type, user_data, event_data);
-    window = GNC_MAIN_WINDOW(user_data);
-    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
-
-    /* This is not a typical list iteration.  We're removing while
-     * we iterate, so we have to cache the 'next' pointer before
-     * executing any code in the loop. */
-    for (item = priv->installed_pages; item; item = next)
-    {
-        next = g_list_next(item);
-        page = GNC_PLUGIN_PAGE(item->data);
-        if (gnc_plugin_page_has_book (page, (QofBook *)entity))
-            gnc_main_window_close_page (page);
-    }
-    LEAVE(" ");
-}
-
-
-/** Generate a title for this window based upon the Gnome Human
- *  Interface Guidelines, v2.0.  This title will be used as both the
- *  window title and the title of the "Window" menu item associated
- *  with the window.
- *
- *  As a side-effect, the save action is set sensitive iff the book
- *  is dirty, and the immutable_page_actions are set sensitive iff the page is
- *  mutable.
- *
- *  @param window The window whose title should be generated.
- *
- *  @return The title for the window.  It is the callers
- *  responsibility to free this string.
- *
- *  @internal
- */
-static gchar *
-gnc_main_window_generate_title (GncMainWindow *window)
-{
-    GncMainWindowPrivate *priv;
-    GncPluginPage *page;
-    QofBook *book;
-    gboolean immutable;
-    gchar *filename = NULL;
-    const gchar *book_id = NULL;
-    const gchar *dirty = "";
-    const gchar *readonly_text = NULL;
-    gchar *readonly;
-    gchar *title;
-
-    if (gnc_current_session_exist())
-    {
-        book_id = qof_session_get_url (gnc_get_current_session ());
-        book = gnc_get_current_book();
-        if (qof_book_session_not_saved (book))
-            dirty = "*";
-        if (qof_book_is_readonly(book))
-        {
-            /* Translators: This string is shown in the window title if this
-            document is, well, read-only. */
-            readonly_text = _("(read-only)");
-        }
-    }
-    readonly = (readonly_text != NULL)
-               ? g_strdup_printf(" %s", readonly_text)
-               : g_strdup("");
-
-    if (!book_id || g_strcmp0 (book_id, "") == 0)
-        filename = g_strdup(_("Unsaved Book"));
-    else
-    {
-        if ( gnc_uri_is_file_uri ( book_id ) )
-        {
-            /* The filename is a true file.
-             * The Gnome HIG 2.0 recommends only the file name (no path) be used. (p15) */
-            gchar *path = gnc_uri_get_path ( book_id );
-            filename = g_path_get_basename ( path );
-            g_free ( path );
-        }
-        else
-        {
-            /* The filename is composed of database connection parameters.
-             * For this we will show access_method://username@database[:port] */
-            filename = gnc_uri_normalize_uri (book_id, FALSE);
-        }
-    }
-
-    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
-    page = priv->current_page;
-    if (page)
-    {
-        /* The Gnome HIG 2.0 recommends the application name not be used. (p16)
-         * but several developers prefer to use it anyway. */
-        title = g_strdup_printf("%s%s%s - %s - GnuCash", dirty, filename, readonly,
-                                gnc_plugin_page_get_page_name(page));
-    }
-    else
-    {
-        title = g_strdup_printf("%s%s%s - GnuCash", dirty, filename, readonly);
-    }
-    /* Update the menus based upon whether this is an "immutable" page. */
-    immutable = page &&
-                g_object_get_data (G_OBJECT (page), PLUGIN_PAGE_IMMUTABLE);
-    gnc_plugin_update_actions(priv->action_group,
-                              immutable_page_actions,
-                              "sensitive", !immutable);
-    /* Trigger sensitivity updtates of other actions such as Save/Revert */
-    g_signal_emit_by_name (window, "page_changed", page);
-    g_free( filename );
-    g_free(readonly);
-
-    return title;
-}
-
-
-/** Update the title bar on the specified window.  This routine uses
- *  the gnc_main_window_generate_title() function to create the title.
- *  It is called whenever the user switched pages in a window, as the
- *  title includes the name of the current page.
- *
- *  @param window The window whose title should be updated.
- *
- *  @internal
- */
-static void
-gnc_main_window_update_title (GncMainWindow *window)
-{
-    gchar *title;
-
-    title = gnc_main_window_generate_title(window);
-    gtk_window_set_title(GTK_WINDOW(window), title);
-    g_free(title);
-}
-
-static void
-gnc_main_window_update_all_titles (void)
-{
-    g_list_foreach(active_windows,
-                   (GFunc)gnc_main_window_update_title,
-                   NULL);
-}
-
-static void
-gnc_main_window_book_dirty_cb (QofBook *book,
-                               gboolean dirty,
-                               gpointer user_data)
-{
-    gnc_main_window_update_all_titles();
-
-    /* Auto-save feature */
-    gnc_autosave_dirty_handler(book, dirty);
-}
-
-static void
-gnc_main_window_attach_to_book (QofSession *session)
-{
-    QofBook *book;
-
-    g_return_if_fail(session);
-
-    book = qof_session_get_book(session);
-    qof_book_set_dirty_cb(book, gnc_main_window_book_dirty_cb, NULL);
-    gnc_main_window_update_all_titles();
-#ifndef MAC_INTEGRATION
-    gnc_main_window_update_all_menu_items();
-#endif
-}
-
-static guint gnc_statusbar_notification_messageid = 0;
-//#define STATUSBAR_NOTIFICATION_AUTOREMOVAL
-#ifdef STATUSBAR_NOTIFICATION_AUTOREMOVAL
-/* Removes the statusbar notification again that has been pushed to the
- * statusbar by generate_statusbar_lastmodified_message. */
-static gboolean statusbar_notification_off(gpointer user_data_unused)
-{
-    GtkWidget *widget = gnc_ui_get_toplevel();
-    //g_warning("statusbar_notification_off\n");
-    if (gnc_statusbar_notification_messageid == 0)
-        return FALSE;
-
-    if (widget && GNC_IS_MAIN_WINDOW(widget))
-    {
-        GncMainWindow *mainwindow = GNC_MAIN_WINDOW(widget);
-        GtkWidget *statusbar = gnc_main_window_get_statusbar(GNC_WINDOW(mainwindow));
-        gtk_statusbar_remove(GTK_STATUSBAR(statusbar), 0, gnc_statusbar_notification_messageid);
-        gnc_statusbar_notification_messageid = 0;
-    }
-    else
-    {
-        g_warning("oops, no GncMainWindow obtained\n");
-    }
-    return FALSE; // should not be called again
-}
-#endif // STATUSBAR_NOTIFICATION_AUTOREMOVAL
-
-/* Creates a statusbar message stating the last modification time of the opened
- * data file. */
-static gchar *generate_statusbar_lastmodified_message()
-{
-    gchar *message = NULL;
-    const gchar *book_id = NULL;
-
-    if (gnc_current_session_exist())
-    {
-        book_id = qof_session_get_url (gnc_get_current_session ());
-    }
-
-    if (!strlen (book_id))
-        return NULL;
-    else
-    {
-        if ( gnc_uri_is_file_uri ( book_id ) )
-        {
-#ifdef HAVE_SYS_STAT_H
-            /* The filename is a true file. */
-            gchar *filepath = gnc_uri_get_path ( book_id );
-            gchar *filename = g_path_get_basename ( filepath );
-            {
-                // Access the mtime information through stat(2)
-                struct stat statbuf;
-                int r = stat(filepath, &statbuf);
-                if (r == 0)
-                {
-                    /* Translators: This is the date and time that is shown in
-                    the status bar after opening a file: The date and time of
-                    last modification. The string is a format string using
-                    boost::date_time's format flags, see the boost docs for an
-                    explanation of the modifiers. */
-                    char *time_string =
-			gnc_print_time64(statbuf.st_mtime,
-					 _("Last modified on %a, %b %d, %Y at %I:%M %p"));
-                    //g_warning("got time %ld, str=%s\n", mtime, time_string);
-                    /* Translators: This message appears in the status bar after opening the file. */
-                    message = g_strdup_printf(_("File %s opened. %s"),
-                                              filename, time_string);
-                    free(time_string);
-                }
-                else
-                {
-                    g_warning("Unable to read mtime for file %s\n", filepath);
-                    // message is still NULL
-                }
-            }
-            g_free(filename);
-            g_free(filepath);
-#else
-            return NULL;
-#endif
-        }
-        // If the URI is not a file but a database, we can maybe also show
-        // something useful, but I have no idea how to obtain this information.
-    }
-    return message;
-}
-
-static void
-statusbar_notification_lastmodified()
-{
-    // First look up the first GncMainWindow to set the statusbar there
-    GList *iter;
-    GtkWidget *widget = NULL;
-    for (iter = active_windows; iter && !(widget && GNC_IS_MAIN_WINDOW(widget));
-            iter = g_list_next(iter))
-    {
-        widget = iter->data;
-    }
-    if (widget && GNC_IS_MAIN_WINDOW(widget))
-    {
-        // Ok, we found a mainwindow where we can set a statusbar message
-        GncMainWindow *mainwindow = GNC_MAIN_WINDOW(widget);
-        GtkWidget *statusbar = gnc_main_window_get_statusbar(GNC_WINDOW(mainwindow));
-
-        gchar *msg = generate_statusbar_lastmodified_message();
-        if (msg)
-        {
-            gnc_statusbar_notification_messageid = gtk_statusbar_push(GTK_STATUSBAR(statusbar), 0, msg);
-        }
-        g_free(msg);
-
-#ifdef STATUSBAR_NOTIFICATION_AUTOREMOVAL
-        // Also register a timeout callback to remove that statusbar
-        // notification again after 10 seconds
-        g_timeout_add(10 * 1000, statusbar_notification_off, NULL); // maybe not needed anyway?
-#endif
-    }
-    else
-    {
-        g_warning("uh oh, no GNC_IS_MAIN_WINDOW\n");
-    }
-}
-
-
-/** This data structure is used to describe the requested state of a
- *  GtkRadioAction, and us used to pass data among several
- *  functions. */
-struct menu_update
-{
-    /** The name of the GtkRadioAction to be updated. */
-    gchar    *action_name;
-
-    /** The new label for this GtkRadioAction. */
-    gchar    *label;
-
-    /** Whether or not the GtkRadioAction should be visible. */
-    gboolean  visible;
-};
-
-#ifndef MAC_INTEGRATION
-/** Update the label on the specified GtkRadioAction in the specified
- *  window.  This action is displayed as a menu item in the "Windows"
- *  menu.  This function will end up being called whenever the front
- *  page is changed in any window, or whenever a window is added or
- *  deleted.
- *
- *  @param window The window whose menu item should be updated.
- *
- *  @param data A data structure containing the name of the
- *  GtkRadioAction, and describing the new state for this action.
- *
- *  @internal
- */
-static void
-gnc_main_window_update_one_menu_action (GncMainWindow *window,
-                                        struct menu_update *data)
-{
-    GncMainWindowPrivate *priv;
-    GtkAction* action;
-
-    ENTER("window %p, action %s, label %s, visible %d", window,
-          data->action_name, data->label, data->visible);
-    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
-    action = gtk_action_group_get_action(priv->action_group, data->action_name);
-    if (action)
-        g_object_set(G_OBJECT(action),
-                     "label", data->label,
-                     "visible", data->visible,
-                     (char *)NULL);
-    LEAVE(" ");
-}
-
-/** Update the window selection GtkRadioAction for a specific window.
- *  This is fairly simple since the windows are listed in the same
- *  order that they appear in the active_windows list, so the index
- *  from the window list is used to generate the name of the action.
- *  If the code is ever changed to allow more than ten open windows in
- *  the menu, then the actions in the menu will need to be dynamically
- *  generated/deleted and it gets harder.
- *
- *  @param window The window whose menu item should be updated.
- *
- *  @internal
- */
-static void
-gnc_main_window_update_radio_button (GncMainWindow *window)
-{
-    GncMainWindowPrivate *priv;
-    GtkAction *action, *first_action;
-    GSList *action_list;
-    gchar *action_name;
-    gint index;
-
-    ENTER("window %p", window);
-
-    /* Show the new entry in all windows. */
-    index = g_list_index(active_windows, window);
-    if (index >= n_radio_entries)
-    {
-        LEAVE("window %d, only %d actions", index, n_radio_entries);
-        return;
-    }
-
-    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
-    action_name = g_strdup_printf("Window%dAction", index);
-    action = gtk_action_group_get_action(priv->action_group, action_name);
-
-    /* Block the signal so as not to affect window ordering (top to
-     * bottom) on the screen */
-    action_list = gtk_radio_action_get_group(GTK_RADIO_ACTION(action));
-    if (action_list)
-    {
-        first_action = g_slist_last(action_list)->data;
-        g_signal_handlers_block_by_func(G_OBJECT(first_action),
-                                        G_CALLBACK(gnc_main_window_cmd_window_raise),
-                                        window);
-        DEBUG("blocked signal on %p, set %p active, window %p", first_action,
-              action, window);
-        gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), TRUE);
-        g_signal_handlers_unblock_by_func(G_OBJECT(first_action),
-                                          G_CALLBACK(gnc_main_window_cmd_window_raise),
-                                          window);
-    }
-    g_free(action_name);
-    LEAVE(" ");
-}
-
-/** In every window that the user has open, update the "Window" menu
- *  item that points to the specified window.  This keeps the "Window"
- *  menu items consistent across all open windows.  (These items
- *  cannot be shared because of the way the GtkUIManager code works.)
- *
- *  This function is called whenever the user switches pages in a
- *  window, or whenever a window is added or deleted.
- *
- *  @param window The window whose menu item should be updated in all
- *  open windows.
- *
- *  @internal
- */
-static void
-gnc_main_window_update_menu_item (GncMainWindow *window)
-{
-    struct menu_update data;
-    gchar **strings, *title, *expanded;
-    gint index;
-
-    ENTER("window %p", window);
-    index = g_list_index(active_windows, window);
-    if (index > n_radio_entries)
-    {
-        LEAVE("skip window %d (only %d entries)", index, n_radio_entries);
-        return;
-    }
-
-    /* Figure out the label name. Add the accelerator if possible. */
-    title = gnc_main_window_generate_title(window);
-    strings = g_strsplit(title, "_", 0);
-    g_free(title);
-    expanded = g_strjoinv("__", strings);
-    if (index < 10)
-    {
-        data.label = g_strdup_printf("_%d %s", (index + 1) % 10, expanded);
-        g_free(expanded);
-    }
-    else
-    {
-        data.label = expanded;
-    }
-    g_strfreev(strings);
-
-    data.visible = TRUE;
-    data.action_name = g_strdup_printf("Window%dAction", index);
-    g_list_foreach(active_windows,
-                   (GFunc)gnc_main_window_update_one_menu_action,
-                   &data);
-    g_free(data.action_name);
-    g_free(data.label);
-
-    LEAVE(" ");
-}
-#endif /* !MAC_INTEGRATION */
-
-/** Update all menu entries for all window menu items in all windows.
- *  This function is called whenever a window is added or deleted.
- *  The worst case scenario is where the user has deleted the first
- *  window, so every single visible item needs to be updated.
- *
- *  @internal
- */
-
-#ifndef MAC_INTEGRATION
-static void
-gnc_main_window_update_all_menu_items (void)
-{
-    struct menu_update data;
-    gchar *label;
-    gint i;
-
-    ENTER("");
-    /* First update the entries for all existing windows */
-    g_list_foreach(active_windows,
-                   (GFunc)gnc_main_window_update_menu_item,
-                   NULL);
-    g_list_foreach(active_windows,
-                   (GFunc)gnc_main_window_update_radio_button,
-                   NULL);
-
-    /* Now hide any entries that aren't being used. */
-    data.visible = FALSE;
-    for (i = g_list_length(active_windows); i < n_radio_entries; i++)
-    {
-        data.action_name = g_strdup_printf("Window%dAction", i);
-        label = g_strdup_printf("Window _%d", (i - 1) % 10);
-        data.label = gettext(label);
-
-        g_list_foreach(active_windows,
-                       (GFunc)gnc_main_window_update_one_menu_action,
-                       &data);
-
-        g_free(data.action_name);
-        g_free(label);
-    }
-    LEAVE(" ");
-}
-#endif /* !MAC_INTEGRATION */
-
-/** Show/hide the close box on the tab of a notebook page.  This
- *  function first checks to see if the specified page has a close
- *  box, and if so, sets its visibility to the requested state.
- *
- *  @internal
- *
- *  @param page The GncPluginPage whose notebook tab should be updated.
- *
- *  @param new_value A pointer to the boolean that indicates whether
- *  or not the close button should be visible.
- */
-static void
-gnc_main_window_update_tab_close_one_page (GncPluginPage *page,
-        gpointer user_data)
-{
-    gboolean *new_value = user_data;
-    GtkWidget * close_button;
-
-    ENTER("page %p, visible %d", page, *new_value);
-    close_button = g_object_get_data(G_OBJECT (page), PLUGIN_PAGE_CLOSE_BUTTON);
-    if (!close_button)
-    {
-        LEAVE("no close button");
-        return;
-    }
-
-    if (*new_value)
-        gtk_widget_show (close_button);
-    else
-        gtk_widget_hide (close_button);
-    LEAVE(" ");
-}
-
-
-/** Show/hide the close box on all pages in all windows.  This function
- *  calls gnc_main_window_update_tab_close() for each plugin page in the
- *  application.
- *
- *  @internal
- *
- *  @param prefs Unused.
- *
- *  @param pref Unused.
- *
- *  @param user_data Unused.
- */
-static void
-gnc_main_window_update_tab_close (gpointer prefs, gchar *pref, gpointer user_data)
-{
-    gboolean new_value;
-
-    ENTER(" ");
-    new_value = gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL, GNC_PREF_SHOW_CLOSE_BUTTON);
-    gnc_main_window_foreach_page(
-        gnc_main_window_update_tab_close_one_page,
-        &new_value);
-    LEAVE(" ");
-}
-
-
-/** Show/hide the account color on the tab of a notebook page.
- *
- *  @internal
- *
- *  @param page The GncPluginPage whose notebook tab should be updated.
- *
- *  @param user_data GncMainWindow.
- */
-static void
-gnc_main_window_update_tab_color_one_page (GncPluginPage *page,
-        gpointer user_data)
-{
-    const gchar          *color_string;
-
-    ENTER("page %p", page);
-    color_string = gnc_plugin_page_get_page_color(page);
-    main_window_update_page_color (page, color_string);
-    LEAVE(" ");
-}
-
-
-/** Show/hide the account color on tabs.
- *
- *  @internal
- *
- *  @param prefs Unused.
- *
- *  @param pref Name of the preference that was changed.
- *
- *  @param user_data GncMainWindow.
- */
-static void
-gnc_main_window_update_tab_color (gpointer gsettings, gchar *pref, gpointer user_data)
-{
-    GncMainWindowPrivate *priv;
-    GncMainWindow        *window;
-
-    ENTER(" ");
-    g_return_if_fail(GNC_IS_MAIN_WINDOW(user_data));
-    window = user_data;
-    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
-    if (g_strcmp0 (GNC_PREF_TAB_COLOR, pref) == 0)
-        priv->show_color_tabs = gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL, GNC_PREF_TAB_COLOR);
-    gnc_main_window_foreach_page (gnc_main_window_update_tab_color_one_page, window);
-    LEAVE(" ");
-}
-
-
-/** Update the width of the label in the tab of a notebook page.  This
- *  function adjusts both the width and the ellipsize mode so that the tab
- *  label looks correct.  The special check for a zero value handles the
- *  case where a user hasn't set a tab width and the preference default isn't
- *  detected.
- *
- *  @internal
- *
- *  @param page The GncPluginPage whose notebook tab should be updated.
- *
- *  @param new_value The new width of the label in the tab.
- */
-static void
-gnc_main_window_update_tab_width_one_page (GncPluginPage *page,
-        gpointer user_data)
-{
-    gint *new_value = user_data;
-    GtkWidget *label;
-    const gchar *lab_text;
-
-    ENTER("page %p, visible %d", page, *new_value);
-    label = g_object_get_data(G_OBJECT (page), PLUGIN_PAGE_TAB_LABEL);
-    if (!label)
-    {
-        LEAVE("no label");
-        return;
-    }
-
-    lab_text = gtk_label_get_text (GTK_LABEL(label));
-
-    if (*new_value != 0)
-    {
-        if (g_utf8_strlen (lab_text, -1) < *new_value)
-            gtk_label_set_width_chars (GTK_LABEL(label), strlen (lab_text));
-        else
-            gtk_label_set_width_chars (GTK_LABEL(label), *new_value);
-
-        gtk_label_set_ellipsize(GTK_LABEL(label), PANGO_ELLIPSIZE_MIDDLE);
-    }
-    else
-    {
-        gtk_label_set_width_chars (GTK_LABEL(label), 15);
-        gtk_label_set_ellipsize(GTK_LABEL(label), PANGO_ELLIPSIZE_NONE);
-    }
-    LEAVE(" ");
-}
-
-
-/** Update the tab label width in all pages in all windows.  This function
- *  calls gnc_main_window_update_tab_width() for each plugin page in the
- *  application.
- *
- *  @internal
- *
- *  @param prefs Unused.
- *
- *  @param pref Unused.
- *
- *  @param user_data Unused.
- */
-static void
-gnc_main_window_update_tab_width (gpointer prefs, gchar *pref, gpointer user_data)
-{
-    gint new_value;
-
-    ENTER(" ");
-    new_value = gnc_prefs_get_float (GNC_PREFS_GROUP_GENERAL, GNC_PREF_TAB_WIDTH);
-    gnc_main_window_foreach_page(
-        gnc_main_window_update_tab_width_one_page,
-        &new_value);
-    LEAVE(" ");
-}
-
-
-/************************************************************
- *                 Tab Label Implementation                 *
- ************************************************************/
-static gboolean
-main_window_find_tab_items (GncMainWindow *window,
-                            GncPluginPage *page,
-                            GtkWidget **label_p,
-                            GtkWidget **entry_p)
-{
-    GncMainWindowPrivate *priv;
-    GtkWidget *tab_hbox, *widget, *tab_widget;
-    GList *children, *tmp;
-
-    ENTER("window %p, page %p, label_p %p, entry_p %p",
-          window, page, label_p, entry_p);
-    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
-    *label_p = *entry_p = NULL;
-
-    if (!page->notebook_page)
-    {
-        LEAVE("invalid notebook_page");
-        return FALSE;
-    }
-
-    tab_widget = gtk_notebook_get_tab_label(GTK_NOTEBOOK(priv->notebook),
-                                           page->notebook_page);
-    if (GTK_IS_EVENT_BOX (tab_widget))
-        tab_hbox = gtk_bin_get_child(GTK_BIN(tab_widget));
-    else if (GTK_IS_BOX (tab_widget))
-        tab_hbox = tab_widget;
-    else
-    {
-        PWARN ("Unknown widget for tab label %p", tab_widget);
-        return FALSE;
-    }
-
-    children = gtk_container_get_children(GTK_CONTAINER(tab_hbox));
-    for (tmp = children; tmp; tmp = g_list_next(tmp))
-    {
-        widget = tmp->data;
-        if (GTK_IS_LABEL(widget))
-        {
-            *label_p = widget;
-        }
-        else if (GTK_IS_ENTRY(widget))
-        {
-            *entry_p = widget;
-        }
-    }
-    g_list_free(children);
-
-    LEAVE("label %p, entry %p", *label_p, *entry_p);
-    return (*label_p && *entry_p);
-}
-
-static gboolean
-main_window_find_tab_widget (GncMainWindow *window,
-                             GncPluginPage *page,
-                             GtkWidget **widget_p)
-{
-    GncMainWindowPrivate *priv;
-
-    ENTER("window %p, page %p, widget %p",
-          window, page, widget_p);
-    *widget_p = NULL;
-
-    if (!page->notebook_page)
-    {
-        LEAVE("invalid notebook_page");
-        return FALSE;
-    }
-
-    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
-    *widget_p = gtk_notebook_get_tab_label(GTK_NOTEBOOK(priv->notebook),
-                                           page->notebook_page);
-
-    LEAVE("widget %p", *widget_p);
-    return TRUE;
-}
-
-void
-main_window_update_page_name (GncPluginPage *page,
-                              const gchar *name_in)
-{
-    GncMainWindow *window;
-    GncMainWindowPrivate *priv;
-    GtkWidget *label, *entry;
-    gchar *name, *old_page_name, *old_page_long_name;
-    gint lab_width;
-
-    ENTER(" ");
-
-    if ((name_in == NULL) || (*name_in == '\0'))
-    {
-        LEAVE("no string");
-        return;
-    }
-    name = g_strstrip(g_strdup(name_in));
-
-    /* Optimization, if the name hasn't changed, don't update X. */
-    if (*name == '\0' || 0 == strcmp(name, gnc_plugin_page_get_page_name(page)))
-    {
-        g_free(name);
-        LEAVE("empty string or name unchanged");
-        return;
-    }
-
-    old_page_name = g_strdup( gnc_plugin_page_get_page_name(page));
-    old_page_long_name = g_strdup( gnc_plugin_page_get_page_long_name(page));
-
-    /* Update the plugin */
-    gnc_plugin_page_set_page_name(page, name);
-
-    /* Update the notebook tab */
-    window = GNC_MAIN_WINDOW(page->window);
-    if (!window)
-    {
-        g_free(old_page_name);
-        g_free(old_page_long_name);
-        g_free(name);
-        LEAVE("no window widget available");
-        return;
-    }
-
-    if (main_window_find_tab_items(window, page, &label, &entry))
-        gtk_label_set_text(GTK_LABEL(label), name);
-
-    /* Adjust the label width for new text */
-    lab_width = gnc_prefs_get_float (GNC_PREFS_GROUP_GENERAL, GNC_PREF_TAB_WIDTH);
-    gnc_main_window_update_tab_width_one_page (page, &lab_width);
-
-    /* Update Tooltip on notebook Tab */
-    if (old_page_long_name && old_page_name
-            && g_strrstr(old_page_long_name, old_page_name) != NULL)
-    {
-        gchar *new_page_long_name;
-        gint string_position;
-        GtkWidget *tab_widget;
-
-        string_position = strlen(old_page_long_name) - strlen(old_page_name);
-        new_page_long_name = g_strconcat(g_strndup(old_page_long_name, string_position), name, NULL);
-
-        gnc_plugin_page_set_page_long_name(page, new_page_long_name);
-
-        if (main_window_find_tab_widget(window, page, &tab_widget))
-            gtk_widget_set_tooltip_text(tab_widget, new_page_long_name);
-
-        g_free(new_page_long_name);
-    }
-
-    /* Update the notebook menu */
-    if (page->notebook_page)
-    {
-        priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
-        label = gtk_notebook_get_menu_label (GTK_NOTEBOOK(priv->notebook),
-                                             page->notebook_page);
-        gtk_label_set_text(GTK_LABEL(label), name);
-    }
-
-    /* Force an update of the window title */
-    gnc_main_window_update_title(window);
-    g_free(old_page_long_name);
-    g_free(old_page_name);
-    g_free(name);
-    LEAVE("done");
-}
-
-
-void
-main_window_update_page_color (GncPluginPage *page,
-                               const gchar *color_in)
-{
-    GncMainWindow *window;
-    GncMainWindowPrivate *priv;
-    GtkWidget *tab_widget;
-    GdkRGBA tab_color;
-    gchar *color_string = NULL;
-    gboolean want_color = FALSE;
-
-    ENTER(" ");
-    if (color_in)
-        color_string = g_strstrip(g_strdup(color_in));
-
-    if (color_string && *color_string != '\0')
-        want_color = TRUE;
-
-    /* Update the plugin */
-    window = GNC_MAIN_WINDOW(page->window);
-    if (want_color)
-        gnc_plugin_page_set_page_color(page, color_string);
-    else
-        gnc_plugin_page_set_page_color(page, NULL);
-
-    /* Update the notebook tab */
-    main_window_find_tab_widget (window, page, &tab_widget);
-    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
-
-    if (want_color && gdk_rgba_parse(&tab_color, color_string) && priv->show_color_tabs)
-    {
-        GtkCssProvider *provider = gtk_css_provider_new();
-        GtkStyleContext *stylectxt;
-        gchar *col_str, *widget_css;
-
-        if (!GTK_IS_EVENT_BOX (tab_widget))
-        {
-            GtkWidget *event_box = gtk_event_box_new ();
-            g_object_ref (tab_widget);
-            gtk_notebook_set_tab_label (GTK_NOTEBOOK(priv->notebook),
-                                        page->notebook_page, event_box);
-            gtk_container_add (GTK_CONTAINER(event_box), tab_widget);
-            g_object_unref (tab_widget);
-            tab_widget = event_box;
-        }
-
-        stylectxt = gtk_widget_get_style_context (GTK_WIDGET (tab_widget));
-        col_str = gdk_rgba_to_string (&tab_color);
-        widget_css = g_strconcat ("*{\n  background-color:", col_str, ";\n}\n", NULL);
-
-        gtk_css_provider_load_from_data (provider, widget_css, -1, NULL);
-        gtk_style_context_add_provider (stylectxt, GTK_STYLE_PROVIDER (provider),
-                                        GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
-        g_object_unref (provider);
-        g_free (col_str);
-        g_free (widget_css);
-    }
-    else
-    {
-        if (GTK_IS_EVENT_BOX (tab_widget))
-        {
-            GtkWidget *tab_hbox = gtk_bin_get_child(GTK_BIN(tab_widget));
-            g_object_ref (tab_hbox);
-            gtk_container_remove (GTK_CONTAINER(tab_widget), tab_hbox);
-            gtk_notebook_set_tab_label (GTK_NOTEBOOK(priv->notebook),
-                                        page->notebook_page, tab_hbox);
-            g_object_unref (tab_hbox);
-        }
-    }
-    g_free(color_string);
-    LEAVE("done");
-}
-
-
-static void
-gnc_main_window_tab_entry_activate (GtkWidget *entry,
-                                    GncPluginPage *page)
-{
-    GtkWidget *label, *entry2;
-
-    g_return_if_fail(GTK_IS_ENTRY(entry));
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE(page));
-
-    ENTER("");
-    if (!main_window_find_tab_items(GNC_MAIN_WINDOW(page->window),
-                                    page, &label, &entry2))
-    {
-        LEAVE("can't find required widgets");
-        return;
-    }
-
-    main_window_update_page_name(page, gtk_entry_get_text(GTK_ENTRY(entry)));
-
-    gtk_widget_hide(entry);
-    gtk_widget_show(label);
-    LEAVE("");
-}
-
-
-static gboolean
-gnc_main_window_tab_entry_editing_done (GtkWidget *entry,
-                                        GncPluginPage *page)
-{
-    ENTER("");
-    gnc_main_window_tab_entry_activate(entry, page);
-    LEAVE("");
-    return FALSE;
-}
-
-static gboolean
-gnc_main_window_tab_entry_focus_out_event (GtkWidget *entry,
-        GdkEvent *event,
-        GncPluginPage *page)
-{
-    ENTER("");
-    gtk_cell_editable_editing_done(GTK_CELL_EDITABLE(entry));
-    LEAVE("");
-    return FALSE;
-}
-
-static gboolean
-gnc_main_window_tab_entry_key_press_event (GtkWidget *entry,
-        GdkEventKey *event,
-        GncPluginPage *page)
-{
-    if (event->keyval == GDK_KEY_Escape)
-    {
-        GtkWidget *label, *entry2;
-
-        g_return_val_if_fail(GTK_IS_ENTRY(entry), FALSE);
-        g_return_val_if_fail(GNC_IS_PLUGIN_PAGE(page), FALSE);
-
-        ENTER("");
-        if (!main_window_find_tab_items(GNC_MAIN_WINDOW(page->window),
-                                        page, &label, &entry2))
-        {
-            LEAVE("can't find required widgets");
-            return FALSE;
-        }
-
-        gtk_entry_set_text(GTK_ENTRY(entry), gtk_label_get_text(GTK_LABEL(label)));
-        gtk_widget_hide(entry);
-        gtk_widget_show(label);
-        LEAVE("");
-    }
-    return FALSE;
-}
-
-/************************************************************
- *                   Widget Implementation                  *
- ************************************************************/
-
-/*  Get the type of a gnc main window.
- */
-GType
-gnc_main_window_get_type (void)
-{
-    static GType gnc_main_window_type = 0;
-
-    if (gnc_main_window_type == 0)
-    {
-        static const GTypeInfo our_info =
-        {
-            sizeof (GncMainWindowClass),
-            NULL,
-            NULL,
-            (GClassInitFunc) gnc_main_window_class_init,
-            NULL,
-            NULL,
-            sizeof (GncMainWindow),
-            0,
-            (GInstanceInitFunc) gnc_main_window_init
-        };
-
-        static const GInterfaceInfo plugin_info =
-        {
-            (GInterfaceInitFunc) gnc_window_main_window_init,
-            NULL,
-            NULL
-        };
-
-        gnc_main_window_type = g_type_register_static (GTK_TYPE_WINDOW,
-                               GNC_MAIN_WINDOW_NAME,
-                               &our_info, 0);
-        g_type_add_interface_static (gnc_main_window_type,
-                                     GNC_TYPE_WINDOW,
-                                     &plugin_info);
-    }
-
-    return gnc_main_window_type;
-}
-
-
-/** Initialize the class for a new gnucash main window.  This will set
- *  up any function pointers that override functions in the parent
- *  class, and also initialize the signals that this class of widget
- *  can generate.
- *
- *  @param klass The new class structure created by the object system.
- */
-static void
-gnc_main_window_class_init (GncMainWindowClass *klass)
-{
-    GObjectClass *object_class = G_OBJECT_CLASS (klass);
-    GtkWidgetClass *gtkwidget_class = GTK_WIDGET_CLASS(klass);
-
-    parent_class = g_type_class_peek_parent (klass);
-
-    window_type = g_quark_from_static_string ("gnc-main-window");
-
-    object_class->finalize = gnc_main_window_finalize;
-
-    /* GtkWidget signals */
-    gtkwidget_class->destroy = gnc_main_window_destroy;
-
-    g_type_class_add_private(klass, sizeof(GncMainWindowPrivate));
-
-    /**
-     * GncMainWindow::page_added:
-     * @param window: the #GncMainWindow
-     * @param page: the #GncPluginPage
-     *
-     * The "page_added" signal is emitted when a new page is added
-     * to the notebook of a GncMainWindow.  This can be used to
-     * attach a signal from the page so that menu actions can be
-     * adjusted based upon events that occur within the page
-     * (e.g. an account is selected.)
-     */
-    main_window_signals[PAGE_ADDED] =
-        g_signal_new ("page_added",
-                      G_OBJECT_CLASS_TYPE (object_class),
-                      G_SIGNAL_RUN_FIRST,
-                      G_STRUCT_OFFSET (GncMainWindowClass, page_added),
-                      NULL, NULL,
-                      g_cclosure_marshal_VOID__OBJECT,
-                      G_TYPE_NONE, 1,
-                      G_TYPE_OBJECT);
-
-    /**
-     * GncMainWindow::page_changed:
-     * @param window: the #GncMainWindow
-     * @param page: the #GncPluginPage
-     *
-     * The "page_changed" signal is emitted when a new page is
-     * selected in the notebook of a GncMainWindow.  This can be
-     * used to to adjust menu actions based upon which page is
-     * currently displayed in a window.
-     */
-    main_window_signals[PAGE_CHANGED] =
-        g_signal_new ("page_changed",
-                      G_OBJECT_CLASS_TYPE (object_class),
-                      G_SIGNAL_RUN_FIRST,
-                      G_STRUCT_OFFSET (GncMainWindowClass, page_changed),
-                      NULL, NULL,
-                      g_cclosure_marshal_VOID__OBJECT,
-                      G_TYPE_NONE, 1,
-                      G_TYPE_OBJECT);
-
-    gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL,
-                           GNC_PREF_SHOW_CLOSE_BUTTON,
-                           gnc_main_window_update_tab_close,
-                           NULL);
-    gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL,
-                           GNC_PREF_TAB_WIDTH,
-                           gnc_main_window_update_tab_width,
-                           NULL);
-
-    gnc_hook_add_dangler(HOOK_BOOK_SAVED,
-                         (GFunc)gnc_main_window_update_all_titles, NULL);
-    gnc_hook_add_dangler(HOOK_BOOK_OPENED,
-                         (GFunc)gnc_main_window_attach_to_book, NULL);
-
-}
-
-
-/** Initialize a new instance of a gnucash main window.  This function
- *  initializes the object private storage space.  It also adds the
- *  new object to a list (for memory tracking purposes).
- *
- *  @param window The new object instance created by the object system.
- *
- *  @param klass A pointer to the class data structure for this
- *  object. */
-static void
-gnc_main_window_init (GncMainWindow *window,
-                      GncMainWindowClass *klass)
-{
-    GncMainWindowPrivate *priv;
-
-    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
-    priv->merged_actions_table =
-        g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
-
-    // Set the style context for this widget so it can be easily manipulated with css
-    gnc_widget_set_style_context (GTK_WIDGET(window), "GncMainWindow");
-
-    priv->event_handler_id =
-        qof_event_register_handler(gnc_main_window_event_handler, window);
-
-    /* Get the show_color_tabs value preference */
-    priv->show_color_tabs = gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL, GNC_PREF_TAB_COLOR);
-    priv->about_dialog = NULL;
-
-    gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL,
-                           GNC_PREF_TAB_COLOR,
-                           gnc_main_window_update_tab_color,
-                           window);
-
-    gnc_main_window_setup_window (window);
-    gnc_gobject_tracking_remember(G_OBJECT(window),
-                                  G_OBJECT_CLASS(klass));
-}
-
-
-/** Finalize the GncMainWindow object.  This function is called from
- *  the G_Object level to complete the destruction of the object.  It
- *  should release any memory not previously released by the destroy
- *  function (i.e. the private data structure), then chain up to the
- *  parent's destroy function.
- *
- *  @param object The object being destroyed.
- *
- *  @internal
- */
-static void
-gnc_main_window_finalize (GObject *object)
-{
-    g_return_if_fail (object != NULL);
-    g_return_if_fail (GNC_IS_MAIN_WINDOW (object));
-
-    if (active_windows == NULL)
-    {
-        /* Oops. User killed last window and we didn't catch it. */
-        g_idle_add((GSourceFunc)gnc_shutdown, 0);
-    }
-
-    gnc_gobject_tracking_forget(object);
-    G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-
-static void
-gnc_main_window_destroy (GtkWidget *widget)
-{
-    GncMainWindow *window;
-    GncMainWindowPrivate *priv;
-    GncPluginManager *manager;
-    GList *plugins;
-
-    g_return_if_fail (widget != NULL);
-    g_return_if_fail (GNC_IS_MAIN_WINDOW (widget));
-
-    window = GNC_MAIN_WINDOW (widget);
-
-    active_windows = g_list_remove (active_windows, window);
-
-    /* Do these things once */
-    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
-    if (priv->merged_actions_table)
-    {
-
-        /* Close any pages in this window */
-        while (priv->current_page)
-            gnc_main_window_close_page(priv->current_page);
-
-        if (gnc_window_get_progressbar_window() == GNC_WINDOW(window))
-            gnc_window_set_progressbar_window(NULL);
-#ifndef MAC_INTEGRATION
-        /* Update the "Windows" menu in all other windows */
-        gnc_main_window_update_all_menu_items();
-#endif
-        gnc_prefs_remove_cb_by_func (GNC_PREFS_GROUP_GENERAL,
-                                     GNC_PREF_TAB_COLOR,
-                                     gnc_main_window_update_tab_color,
-                                     window);
-
-        qof_event_unregister_handler(priv->event_handler_id);
-        priv->event_handler_id = 0;
-
-        g_hash_table_destroy (priv->merged_actions_table);
-        priv->merged_actions_table = NULL;
-
-        /* GncPluginManager stuff */
-        manager = gnc_plugin_manager_get ();
-        plugins = gnc_plugin_manager_get_plugins (manager);
-        g_list_foreach (plugins, gnc_main_window_remove_plugin, window);
-        g_list_free (plugins);
-    }
-    if (priv->about_dialog)
-	g_object_unref (priv->about_dialog);
-    GTK_WIDGET_CLASS (parent_class)->destroy (widget);
-}
-
-
-/*  Create a new gnc main window plugin.
- */
-GncMainWindow *
-gnc_main_window_new (void)
-{
-    GncMainWindow *window;
-    GtkWidget *old_window;
-
-    window = g_object_new (GNC_TYPE_MAIN_WINDOW, NULL);
-    gtk_window_set_default_size(GTK_WINDOW(window), 800, 600);
-
-    old_window = gnc_ui_get_toplevel();
-    if (old_window)
-    {
-        gint width, height;
-        gtk_window_get_size (GTK_WINDOW (old_window), &width, &height);
-        gtk_window_resize (GTK_WINDOW (window), width, height);
-        if ((gdk_window_get_state((gtk_widget_get_window (GTK_WIDGET(old_window))))
-                & GDK_WINDOW_STATE_MAXIMIZED) != 0)
-        {
-            gtk_window_maximize (GTK_WINDOW (window));
-        }
-    }
-    active_windows = g_list_append (active_windows, window);
-    gnc_main_window_update_title(window);
-#ifdef MAC_INTEGRATION
-    gnc_quartz_set_menu(window);
-#else
-    gnc_main_window_update_all_menu_items();
-#endif
-    gnc_engine_add_commit_error_callback( gnc_main_window_engine_commit_error_callback, window );
-
-    return window;
-}
-
-/************************************************************
- *                     Utility Functions                    *
- ************************************************************/
-
-static void
-gnc_main_window_engine_commit_error_callback( gpointer data,
-        QofBackendError errcode )
-{
-    GncMainWindow* window = GNC_MAIN_WINDOW(data);
-    GtkWidget* dialog;
-    const gchar *reason = _("Unable to save to database.");
-    if ( errcode == ERR_BACKEND_READONLY )
-        reason = _("Unable to save to database: Book is marked read-only.");
-    dialog = gtk_message_dialog_new( GTK_WINDOW(window),
-                                     GTK_DIALOG_DESTROY_WITH_PARENT,
-                                     GTK_MESSAGE_ERROR,
-                                     GTK_BUTTONS_CLOSE,
-                                     "%s",
-                                     reason );
-    gtk_dialog_run(GTK_DIALOG (dialog));
-    gtk_widget_destroy(dialog);
-
-}
-
-/** Connect a GncPluginPage to the window.  This function will insert
- *  the page in to the window's notebook and its list of active pages.
- *  It will also emit the "inserted" signal on the page, and the
- *  "add_page" signal on the window.
- *
- *  @param window The window where the new page should be added.
- *
- *  @param page The GncPluginPage that should be added to the window.
- *  The visible widget for this plugin must have already been created.
- *
- *  @param tab_hbox The widget that should be added into the notebook
- *  tab for this page.  Generally this is a GtkLabel, but could also
- *  be a GtkHBox containing an icon and a label.
- *
- *  @param menu_label The widget that should be added into the
- *  notebook popup menu for this page.  This should be a GtkLabel.
- */
-static void
-gnc_main_window_connect (GncMainWindow *window,
-                         GncPluginPage *page,
-                         GtkWidget *tab_hbox,
-                         GtkWidget *menu_label)
-{
-    GncMainWindowPrivate *priv;
-    GtkNotebook *notebook;
-
-    page->window = GTK_WIDGET(window);
-    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
-    notebook = GTK_NOTEBOOK (priv->notebook);
-    priv->installed_pages = g_list_append (priv->installed_pages, page);
-    priv->usage_order = g_list_prepend (priv->usage_order, page);
-    gtk_notebook_append_page_menu (notebook, page->notebook_page,
-                                   tab_hbox, menu_label);
-    gtk_notebook_set_tab_reorderable (notebook, page->notebook_page, TRUE);
-    gnc_plugin_page_inserted (page);
-    gtk_notebook_set_current_page (notebook, -1);
-    if (GNC_PLUGIN_PAGE_GET_CLASS(page)->window_changed)
-        (GNC_PLUGIN_PAGE_GET_CLASS(page)->window_changed)(page, GTK_WIDGET(window));
-    g_signal_emit (window, main_window_signals[PAGE_ADDED], 0, page);
-
-    g_signal_connect(G_OBJECT(page->notebook_page), "popup-menu",
-                     G_CALLBACK(gnc_main_window_popup_menu_cb), page);
-    g_signal_connect_after(G_OBJECT(page->notebook_page), "button-press-event",
-                           G_CALLBACK(gnc_main_window_button_press_cb), page);
-}
-
-
-/** Disconnect a GncPluginPage page from the window.  If this page is
- *  currently foremost in the window's notebook, its user interface
- *  actions will be disconnected and the page's summarybar widget (if
- *  any) will be removed.  The page is then removed from the window's
- *  notebook and its list of active pages.
- *
- *  @param window The window the page should be removed from.
- *
- *  @param page The GncPluginPage that should be removed from the
- *  window.
- *
- *  @internal
- */
-static void
-gnc_main_window_disconnect (GncMainWindow *window,
-                            GncPluginPage *page)
-{
-    GncMainWindowPrivate *priv;
-    GtkNotebook *notebook;
-    GncPluginPage *new_page;
-    gint page_num;
-
-    /* Disconnect the callbacks */
-    g_signal_handlers_disconnect_by_func(G_OBJECT(page->notebook_page),
-                                         G_CALLBACK(gnc_main_window_popup_menu_cb), page);
-    g_signal_handlers_disconnect_by_func(G_OBJECT(page->notebook_page),
-                                         G_CALLBACK(gnc_main_window_button_press_cb), page);
-
-    /* Disconnect the page and summarybar from the window */
-    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
-    if (priv->current_page == page)
-    {
-        gnc_plugin_page_unmerge_actions (page, window->ui_merge);
-        gnc_plugin_page_unselected (page);
-        priv->current_page = NULL;
-    }
-
-    /* Remove it from the list of pages in the window */
-    priv->installed_pages = g_list_remove (priv->installed_pages, page);
-    priv->usage_order = g_list_remove (priv->usage_order, page);
-
-    /* Switch to the last recently used page */
-    notebook = GTK_NOTEBOOK (priv->notebook);
-    if (gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL, GNC_PREF_TAB_NEXT_RECENT))
-    {
-        new_page = g_list_nth_data (priv->usage_order, 0);
-        if (new_page)
-        {
-            page_num =  gtk_notebook_page_num(notebook, new_page->notebook_page);
-            gtk_notebook_set_current_page(notebook, page_num);
-            /* This may have caused WebKit to schedule  a timer interrupt which it
-               sometimes  forgets to cancel before deleting the object.  See
-               <https://bugs.webkit.org/show_bug.cgi?id=119003>.   Get around this
-               by flushing all events to get rid of the timer interrupt. */
-            while (gtk_events_pending())
-                gtk_main_iteration();
-        }
-    }
-
-    /* Remove the page from the notebook */
-    page_num =  gtk_notebook_page_num(notebook, page->notebook_page);
-    gtk_notebook_remove_page (notebook, page_num);
-
-    if ( gtk_notebook_get_current_page(notebook) == -1)
-    {
-        /* Need to synthesize a page changed signal when the last
-         * page is removed.  The notebook doesn't generate a signal
-         * for this, therefore the switch_page code in this file
-         * never gets called to generate this signal. */
-        gnc_main_window_switch_page(notebook, NULL, -1, window);
-        //g_signal_emit (window, main_window_signals[PAGE_CHANGED], 0, NULL);
-    }
-
-    gnc_plugin_page_removed (page);
-
-    gtk_ui_manager_ensure_update (window->ui_merge);
-    gnc_window_set_status (GNC_WINDOW(window), page, NULL);
-}
-
-
-/************************************************************
- *                                                          *
- ************************************************************/
-
-
-void
-gnc_main_window_display_page (GncPluginPage *page)
-{
-    GncMainWindow *window;
-    GncMainWindowPrivate *priv;
-    GtkNotebook *notebook;
-    gint page_num;
-
-    window = GNC_MAIN_WINDOW (page->window);
-    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
-    notebook = GTK_NOTEBOOK (priv->notebook);
-    page_num = gtk_notebook_page_num(notebook, page->notebook_page);
-    gtk_notebook_set_current_page (notebook, page_num);
-    gtk_window_present(GTK_WINDOW(window));
-}
-
-
-/*  Display a data plugin page in a window.  If the page already
- *  exists in any window, then that window will be brought to the
- *  front and the notebook switch to display the specified page.  If
- *  the page is new then it will be added to the specified window.  If
- *  the window is NULL, the new page will be added to the first
- *  window.
- */
-void
-gnc_main_window_open_page (GncMainWindow *window,
-                           GncPluginPage *page)
-{
-    GncMainWindowPrivate *priv;
-    GtkWidget *tab_hbox;
-    GtkWidget *label, *entry;
-    const gchar *icon, *text, *color_string, *lab_text;
-    GtkWidget *image;
-    GList *tmp;
-    gint width;
-
-    ENTER("window %p, page %p", window, page);
-    if (window)
-        g_return_if_fail (GNC_IS_MAIN_WINDOW (window));
-    g_return_if_fail (GNC_IS_PLUGIN_PAGE (page));
-    g_return_if_fail (gnc_plugin_page_has_books(page));
-
-    if (gnc_main_window_page_exists(page))
-    {
-        gnc_main_window_display_page(page);
-        return;
-    }
-
-    /* Does the page want to be in a new window? */
-    if (gnc_plugin_page_get_use_new_window(page))
-    {
-        /* See if there's a blank window. If so, use that. */
-        for (tmp = active_windows; tmp; tmp = g_list_next(tmp))
-        {
-            window = GNC_MAIN_WINDOW(tmp->data);
-            priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
-            if (priv->installed_pages == NULL)
-            {
-                break;
-            }
-        }
-        if (tmp == NULL)
-            window = gnc_main_window_new ();
-        gtk_widget_show(GTK_WIDGET(window));
-    }
-    else if ((window == NULL) && active_windows)
-    {
-        window = active_windows->data;
-    }
-
-    page->window = GTK_WIDGET(window);
-    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
-    page->notebook_page = gnc_plugin_page_create_widget (page);
-    g_object_set_data (G_OBJECT (page->notebook_page),
-                       PLUGIN_PAGE_LABEL, page);
-
-    /*
-     * The page tab.
-     */
-    width = gnc_prefs_get_float(GNC_PREFS_GROUP_GENERAL, GNC_PREF_TAB_WIDTH);
-    icon = GNC_PLUGIN_PAGE_GET_CLASS(page)->tab_icon;
-    lab_text = gnc_plugin_page_get_page_name(page);
-    label = gtk_label_new (lab_text);
-    g_object_set_data (G_OBJECT (page), PLUGIN_PAGE_TAB_LABEL, label);
-
-    if (width != 0)
-    {
-        if (g_utf8_strlen (lab_text, -1) < width)
-            gtk_label_set_width_chars (GTK_LABEL(label), strlen (lab_text));
-        else
-            gtk_label_set_width_chars (GTK_LABEL(label), width);
-
-        gtk_label_set_ellipsize(GTK_LABEL(label), PANGO_ELLIPSIZE_MIDDLE);
-    }
-    gtk_widget_show (label);
-
-    tab_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
-    gtk_box_set_homogeneous (GTK_BOX (tab_hbox), FALSE);
-    gtk_widget_show (tab_hbox);
-
-    if (icon != NULL)
-    {
-        image = gtk_image_new_from_icon_name (icon, GTK_ICON_SIZE_MENU);
-        gtk_widget_show (image);
-        gtk_box_pack_start (GTK_BOX (tab_hbox), image, FALSE, FALSE, 0);
-#if GTK_CHECK_VERSION(3,12,0)
-        gtk_widget_set_margin_start (GTK_WIDGET(image), 5);
-#else
-        gtk_widget_set_margin_left (GTK_WIDGET(image), 5);
-#endif
-        gtk_box_pack_start (GTK_BOX (tab_hbox), label, TRUE, TRUE, 0);
-    }
-    else
-        gtk_box_pack_start (GTK_BOX (tab_hbox), label, TRUE, TRUE, 0);
-
-    text = gnc_plugin_page_get_page_long_name(page);
-    if (text)
-    {
-        gtk_widget_set_tooltip_text(tab_hbox, text);
-    }
-
-    entry = gtk_entry_new();
-    gtk_widget_hide (entry);
-    gtk_box_pack_start (GTK_BOX (tab_hbox), entry, TRUE, TRUE, 0);
-    g_signal_connect(G_OBJECT(entry), "activate",
-                     G_CALLBACK(gnc_main_window_tab_entry_activate), page);
-    g_signal_connect(G_OBJECT(entry), "focus-out-event",
-                     G_CALLBACK(gnc_main_window_tab_entry_focus_out_event),
-                     page);
-    g_signal_connect(G_OBJECT(entry), "key-press-event",
-                     G_CALLBACK(gnc_main_window_tab_entry_key_press_event),
-                     page);
-    g_signal_connect(G_OBJECT(entry), "editing-done",
-                     G_CALLBACK(gnc_main_window_tab_entry_editing_done),
-                     page);
-
-    /* Add close button - Not for immutable pages */
-    if (!g_object_get_data (G_OBJECT (page), PLUGIN_PAGE_IMMUTABLE))
-    {
-        GtkWidget *close_image, *close_button;
-        GtkRequisition requisition;
-
-        close_button = gtk_button_new();
-        gtk_button_set_relief(GTK_BUTTON(close_button), GTK_RELIEF_NONE);
-        close_image = gtk_image_new_from_icon_name ("window-close", GTK_ICON_SIZE_MENU);
-        gtk_widget_show(close_image);
-        gtk_widget_get_preferred_size (close_image, &requisition, NULL);
-        gtk_widget_set_size_request(close_button, requisition.width + 4,
-                                    requisition.height + 2);
-        gtk_container_add(GTK_CONTAINER(close_button), close_image);
-        if (gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL, GNC_PREF_SHOW_CLOSE_BUTTON))
-            gtk_widget_show (close_button);
-        else
-            gtk_widget_hide (close_button);
-
-        g_signal_connect_swapped (G_OBJECT (close_button), "clicked",
-                                  G_CALLBACK(gnc_main_window_close_page), page);
-
-        gtk_box_pack_start (GTK_BOX (tab_hbox), close_button, FALSE, FALSE, 0);
-#if GTK_CHECK_VERSION(3,12,0)
-        gtk_widget_set_margin_end (GTK_WIDGET(close_button), 5);
-#else
-        gtk_widget_set_margin_right (GTK_WIDGET(close_button), 5);
-#endif
-        g_object_set_data (G_OBJECT (page), PLUGIN_PAGE_CLOSE_BUTTON, close_button);
-    }
-
-    /*
-     * The popup menu
-     */
-    label = gtk_label_new (gnc_plugin_page_get_page_name(page));
-
-    /*
-     * Now install it all in the window.
-     */
-    gnc_main_window_connect(window, page, tab_hbox, label);
-
-    color_string = gnc_plugin_page_get_page_color(page);
-    main_window_update_page_color (page, color_string);
-    LEAVE("");
-}
-
-
-/*  Remove a data plugin page from a window and display the previous
- *  page.  If the page removed was the last page in the window, and
- *  there is more than one window open, then the entire window will be
- *  destroyed.
- */
-void
-gnc_main_window_close_page (GncPluginPage *page)
-{
-    GncMainWindow *window;
-    GncMainWindowPrivate *priv;
-
-    if (!page || !page->notebook_page)
-        return;
-
-    if (!gnc_plugin_page_finish_pending(page))
-        return;
-
-    if (!GNC_IS_MAIN_WINDOW (page->window))
-        return;
-
-    window = GNC_MAIN_WINDOW (page->window);
-    if (!window)
-    {
-        g_warning("Page is not in a window.");
-        return;
-    }
-
-    gnc_main_window_disconnect(window, page);
-    gnc_plugin_page_destroy_widget (page);
-    g_object_unref(page);
-
-    /* If this isn't the last window, go ahead and destroy the window. */
-    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
-    if (priv->installed_pages == NULL)
-    {
-        if (g_list_length(active_windows) > 1)
-        {
-            gtk_widget_destroy(GTK_WIDGET(window));
-        }
-    }
-}
-
-
-/*  Retrieve a pointer to the page that is currently at the front of
- *  the specified window.  Any plugin that needs to manipulate its
- *  menus based upon the currently selected menu page should connect
- *  to the "page_changed" signal on a window.  The callback function
- *  from that signal can then call this function to obtain a pointer
- *  to the current page.
- */
-GncPluginPage *
-gnc_main_window_get_current_page (GncMainWindow *window)
-{
-    GncMainWindowPrivate *priv;
-
-    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
-    return priv->current_page;
-}
-
-
-/*  Manually add a set of actions to the specified window.  Plugins
- *  whose user interface is not hard coded (e.g. the menu-additions
- *  plugin) must create their actions at run time, then use this
- *  function to install them into the window.
- */
-void
-gnc_main_window_manual_merge_actions (GncMainWindow *window,
-                                      const gchar *group_name,
-                                      GtkActionGroup *group,
-                                      guint merge_id)
-{
-    GncMainWindowPrivate *priv;
-    MergedActionEntry *entry;
-
-    g_return_if_fail (GNC_IS_MAIN_WINDOW (window));
-    g_return_if_fail (group_name != NULL);
-    g_return_if_fail (GTK_IS_ACTION_GROUP(group));
-    g_return_if_fail (merge_id > 0);
-
-    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
-    entry = g_new0 (MergedActionEntry, 1);
-    entry->action_group = group;
-    entry->merge_id = merge_id;
-    gtk_ui_manager_ensure_update (window->ui_merge);
-    g_hash_table_insert (priv->merged_actions_table, g_strdup (group_name), entry);
-}
-
-
-/*  Add a set of actions to the specified window.  This function
- *  should not need to be called directly by plugin implementors.
- *  Correctly assigning values to the GncPluginClass fields during
- *  plugin initialization will cause this routine to be automatically
- *  called.
- */
-void
-gnc_main_window_merge_actions (GncMainWindow *window,
-                               const gchar *group_name,
-                               GtkActionEntry *actions,
-                               guint n_actions,
-                               GtkToggleActionEntry *toggle_actions,
-                               guint n_toggle_actions,
-                               const gchar *filename,
-                               gpointer user_data)
-{
-    GncMainWindowPrivate *priv;
-    GncMainWindowActionData *data;
-    MergedActionEntry *entry;
-    GError *error = NULL;
-    gchar *pathname;
-
-    g_return_if_fail (GNC_IS_MAIN_WINDOW (window));
-    g_return_if_fail (group_name != NULL);
-    g_return_if_fail (actions != NULL);
-    g_return_if_fail (n_actions > 0);
-    g_return_if_fail (filename != NULL);
-
-    pathname = gnc_filepath_locate_ui_file (filename);
-    if (pathname == NULL)
-        return;
-
-    data = g_new0 (GncMainWindowActionData, 1);
-    data->window = window;
-    data->data = user_data;
-
-    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
-    entry = g_new0 (MergedActionEntry, 1);
-    entry->action_group = gtk_action_group_new (group_name);
-    gnc_gtk_action_group_set_translation_domain (entry->action_group, GETTEXT_PACKAGE);
-    gtk_action_group_add_actions (entry->action_group, actions, n_actions, data);
-    if (toggle_actions != NULL && n_toggle_actions > 0)
-    {
-        gtk_action_group_add_toggle_actions (entry->action_group,
-                                             toggle_actions, n_toggle_actions,
-                                             data);
-    }
-    gtk_ui_manager_insert_action_group (window->ui_merge, entry->action_group, 0);
-    entry->merge_id = gtk_ui_manager_add_ui_from_file (window->ui_merge, pathname, &error);
-    g_assert(entry->merge_id || error);
-    if (entry->merge_id)
-    {
-        gtk_ui_manager_ensure_update (window->ui_merge);
-        g_hash_table_insert (priv->merged_actions_table, g_strdup (group_name), entry);
-    }
-    else
-    {
-        g_critical("Failed to load ui file.\n  Filename %s\n  Error %s",
-                   filename, error->message);
-        g_error_free(error);
-        g_free(entry);
-    }
-    g_free(pathname);
-}
-
-
-/*  Remove a set of actions from the specified window.  This function
- *  should not need to be called directly by plugin implementors.  It
- *  will automatically be called when a plugin is removed from a
- *  window.
- */
-void
-gnc_main_window_unmerge_actions (GncMainWindow *window,
-                                 const gchar *group_name)
-{
-    GncMainWindowPrivate *priv;
-    MergedActionEntry *entry;
-
-    g_return_if_fail (GNC_IS_MAIN_WINDOW (window));
-    g_return_if_fail (group_name != NULL);
-
-    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
-    if (priv->merged_actions_table == NULL)
-        return;
-    entry = g_hash_table_lookup (priv->merged_actions_table, group_name);
-
-    if (entry == NULL)
-        return;
-
-    gtk_ui_manager_remove_action_group (window->ui_merge, entry->action_group);
-    gtk_ui_manager_remove_ui (window->ui_merge, entry->merge_id);
-    gtk_ui_manager_ensure_update (window->ui_merge);
-
-    g_hash_table_remove (priv->merged_actions_table, group_name);
-}
-
-
-/*  Force a full update of the user interface for the specified
- *  window.  This can be an expensive function, but is needed because
- *  the gtk ui manager doesn't always seem to update properly when
- *  actions are changed.
- */
-void
-gnc_main_window_actions_updated (GncMainWindow *window)
-{
-    GtkActionGroup *force;
-
-    g_return_if_fail (GNC_IS_MAIN_WINDOW (window));
-
-    /* Unfortunately gtk_ui_manager_ensure_update doesn't work
-     * here.  Force a full update by adding and removing an empty
-     * action group.
-     */
-    force = gtk_action_group_new("force_update");
-    gtk_ui_manager_insert_action_group (window->ui_merge, force, 0);
-    gtk_ui_manager_ensure_update (window->ui_merge);
-    gtk_ui_manager_remove_action_group (window->ui_merge, force);
-    g_object_unref(force);
-}
-
-
-GtkAction *
-gnc_main_window_find_action (GncMainWindow *window, const gchar *name)
-{
-    GtkAction *action = NULL;
-    const GList *groups, *tmp;
-
-    groups = gtk_ui_manager_get_action_groups(window->ui_merge);
-    for (tmp = groups; tmp; tmp = g_list_next(tmp))
-    {
-        action = gtk_action_group_get_action(GTK_ACTION_GROUP(tmp->data), name);
-        if (action)
-            break;
-    }
-    return action;
-}
-
-
-/*  Retrieve a specific set of user interface actions from a window.
- *  This function can be used to get an group of action to be
- *  manipulated when the front page of a window has changed.
- */
-GtkActionGroup *
-gnc_main_window_get_action_group (GncMainWindow *window,
-                                  const gchar *group_name)
-{
-    GncMainWindowPrivate *priv;
-    MergedActionEntry *entry;
-
-    g_return_val_if_fail (GNC_IS_MAIN_WINDOW (window), NULL);
-    g_return_val_if_fail (group_name != NULL, NULL);
-
-    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
-    if (priv->merged_actions_table == NULL)
-        return NULL;
-    entry = g_hash_table_lookup (priv->merged_actions_table, group_name);
-
-    if (entry == NULL)
-        return NULL;
-
-    return entry->action_group;
-}
-
-static void
-gnc_main_window_update_tab_position (gpointer prefs, gchar *pref, gpointer user_data)
-{
-    GncMainWindow *window;
-    GtkPositionType position = GTK_POS_TOP;
-    GncMainWindowPrivate *priv;
-
-    window = GNC_MAIN_WINDOW(user_data);
-
-    ENTER ("window %p", window);
-    if (gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL, GNC_PREF_TAB_POSITION_BOTTOM))
-        position = GTK_POS_BOTTOM;
-    else if (gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL, GNC_PREF_TAB_POSITION_LEFT))
-        position = GTK_POS_LEFT;
-    else if (gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL, GNC_PREF_TAB_POSITION_RIGHT))
-        position = GTK_POS_RIGHT;
-
-    priv = GNC_MAIN_WINDOW_GET_PRIVATE (window);
-    gtk_notebook_set_tab_pos (GTK_NOTEBOOK (priv->notebook), position);
-
-    LEAVE ("");
-}
-
-/*
- * Based on code from Epiphany (src/ephy-window.c)
- */
-static void
-gnc_main_window_update_edit_actions_sensitivity (GncMainWindow *window, gboolean hide)
-{
-    GncMainWindowPrivate *priv;
-    GncPluginPage *page;
-    GtkWidget *widget = gtk_window_get_focus (GTK_WINDOW (window));
-    GtkAction *action;
-    gboolean can_copy = FALSE, can_cut = FALSE, can_paste = FALSE;
-
-    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
-    page = priv->current_page;
-    if (page && GNC_PLUGIN_PAGE_GET_CLASS(page)->update_edit_menu_actions)
-    {
-        (GNC_PLUGIN_PAGE_GET_CLASS(page)->update_edit_menu_actions)(page, hide);
-        return;
-    }
-
-    if (GTK_IS_EDITABLE (widget))
-    {
-        gboolean has_selection;
-
-        has_selection = gtk_editable_get_selection_bounds
-                        (GTK_EDITABLE (widget), NULL, NULL);
-
-        can_copy = has_selection;
-        can_cut = has_selection;
-        can_paste = TRUE;
-    }
-    else if (GTK_IS_TEXT_VIEW (widget))
-    {
-        gboolean has_selection;
-        GtkTextBuffer *text_buffer;
-
-        text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW(widget));
-        has_selection = gtk_text_buffer_get_selection_bounds
-                        (text_buffer, NULL, NULL);
-
-        can_copy = has_selection;
-        can_cut = has_selection;
-        can_paste = TRUE;
-    }
-    else
-    {
-#ifdef ORIGINAL_EPIPHANY_CODE
-        /* For now we assume all actions are possible */
-        can_copy = can_cut = can_paste = TRUE;
-#else
-        /* If its not a GtkEditable, we don't know what to do
-         * with it. */
-        can_copy = can_cut = can_paste = FALSE;
-#endif
-    }
-
-    action = gnc_main_window_find_action (window, "EditCopyAction");
-    gtk_action_set_sensitive (action, can_copy);
-    gtk_action_set_visible (action, !hide || can_copy);
-    action = gnc_main_window_find_action (window, "EditCutAction");
-    gtk_action_set_sensitive (action, can_cut);
-    gtk_action_set_visible (action, !hide || can_cut);
-    action = gnc_main_window_find_action (window, "EditPasteAction");
-    gtk_action_set_sensitive (action, can_paste);
-    gtk_action_set_visible (action,  !hide || can_paste);
-}
-
-static void
-gnc_main_window_enable_edit_actions_sensitivity (GncMainWindow *window)
-{
-    GtkAction *action;
-
-    action = gnc_main_window_find_action (window, "EditCopyAction");
-    gtk_action_set_sensitive (action, TRUE);
-    gtk_action_set_visible (action, TRUE);
-    action = gnc_main_window_find_action (window, "EditCutAction");
-    gtk_action_set_sensitive (action, TRUE);
-    gtk_action_set_visible (action, TRUE);
-    action = gnc_main_window_find_action (window, "EditPasteAction");
-    gtk_action_set_sensitive (action, TRUE);
-    gtk_action_set_visible (action, TRUE);
-}
-
-static void
-gnc_main_window_edit_menu_show_cb (GtkWidget *menu,
-                                   GncMainWindow *window)
-{
-    gnc_main_window_update_edit_actions_sensitivity (window, FALSE);
-}
-
-static void
-gnc_main_window_edit_menu_hide_cb (GtkWidget *menu,
-                                   GncMainWindow *window)
-{
-    gnc_main_window_enable_edit_actions_sensitivity (window);
-}
-
-static void
-gnc_main_window_init_menu_updaters (GncMainWindow *window)
-{
-    GtkWidget *edit_menu_item, *edit_menu;
-
-    edit_menu_item = gtk_ui_manager_get_widget
-                     (window->ui_merge, "/menubar/Edit");
-    edit_menu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (edit_menu_item));
-
-    g_signal_connect (edit_menu, "show",
-                      G_CALLBACK (gnc_main_window_edit_menu_show_cb), window);
-    g_signal_connect (edit_menu, "hide",
-                      G_CALLBACK (gnc_main_window_edit_menu_hide_cb), window);
-}
-
-/* CS: This callback functions will set the statusbar text to the
- * "tooltip" property of the currently selected GtkAction.
- *
- * This code is directly copied from gtk+/test/testmerge.c.
- * Thanks to (L)GPL! */
-typedef struct _ActionStatus ActionStatus;
-struct _ActionStatus
-{
-    GtkAction *action;
-    GtkWidget *statusbar;
-};
-
-static void
-action_status_destroy (gpointer data)
-{
-    ActionStatus *action_status = data;
-
-    g_object_unref (action_status->action);
-    g_object_unref (action_status->statusbar);
-
-    g_free (action_status);
-}
-
-static void
-set_tip (GtkWidget *widget)
-{
-    ActionStatus *data;
-    gchar *tooltip;
-
-    data = g_object_get_data (G_OBJECT (widget), "action-status");
-
-    if (data)
-    {
-        g_object_get (data->action, "tooltip", &tooltip, NULL);
-
-        gtk_statusbar_push (GTK_STATUSBAR (data->statusbar), 0,
-                            tooltip ? tooltip : "");
-
-        g_free (tooltip);
-    }
-}
-
-static void
-unset_tip (GtkWidget *widget)
-{
-    ActionStatus *data;
-
-    data = g_object_get_data (G_OBJECT (widget), "action-status");
-
-    if (data)
-        gtk_statusbar_pop (GTK_STATUSBAR (data->statusbar), 0);
-}
-
-static void
-connect_proxy (GtkUIManager *merge,
-               GtkAction    *action,
-               GtkWidget    *proxy,
-               GtkWidget    *statusbar)
-{
-    if (GTK_IS_MENU_ITEM (proxy))
-    {
-        ActionStatus *data;
-
-        data = g_object_get_data (G_OBJECT (proxy), "action-status");
-        if (data)
-        {
-            g_object_unref (data->action);
-            g_object_unref (data->statusbar);
-
-            data->action = g_object_ref (action);
-            data->statusbar = g_object_ref (statusbar);
-        }
-        else
-        {
-            data = g_new0 (ActionStatus, 1);
-
-            data->action = g_object_ref (action);
-            data->statusbar = g_object_ref (statusbar);
-
-            g_object_set_data_full (G_OBJECT (proxy), "action-status",
-                                    data, action_status_destroy);
-
-            g_signal_connect (proxy, "select",  G_CALLBACK (set_tip), NULL);
-            g_signal_connect (proxy, "deselect", G_CALLBACK (unset_tip), NULL);
-        }
-    }
-}
-/* CS: end copied code from gtk+/test/testmerge.c */
-
-static void
-gnc_main_window_window_menu (GncMainWindow *window)
-{
-    guint merge_id;
-#ifdef MAC_INTEGRATION
-    gchar *filename = gnc_filepath_locate_ui_file("gnc-windows-menu-ui-quartz.xml");
-#else
-    gchar *filename = gnc_filepath_locate_ui_file("gnc-windows-menu-ui.xml");
-    GncMainWindowPrivate *priv;
-#endif
-    GError *error = NULL;
-    g_assert(filename);
-    merge_id = gtk_ui_manager_add_ui_from_file(window->ui_merge, filename,
-               &error);
-    g_free(filename);
-    g_assert(merge_id);
-#ifndef MAC_INTEGRATION
-    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
-    gtk_action_group_add_radio_actions (priv->action_group,
-                                        radio_entries, n_radio_entries,
-                                        0,
-                                        G_CALLBACK(gnc_main_window_cmd_window_raise),
-                                        window);
-#endif
-};
-
-static void
-gnc_main_window_setup_window (GncMainWindow *window)
-{
-    GncMainWindowPrivate *priv;
-    GtkWidget *main_vbox;
-    guint merge_id;
-    GncPluginManager *manager;
-    GList *plugins;
-    GError *error = NULL;
-    gchar *filename;
-
-    ENTER(" ");
-
-    /* Catch window manager delete signal */
-    g_signal_connect (G_OBJECT (window), "delete-event",
-                      G_CALLBACK (gnc_main_window_delete_event), window);
-
-    /* Create widgets and add them to the window */
-    main_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-    gtk_box_set_homogeneous (GTK_BOX (main_vbox), FALSE);
-    gtk_widget_show (main_vbox);
-    gtk_container_add (GTK_CONTAINER (window), main_vbox);
-
-    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
-    priv->menu_dock = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-    gtk_box_set_homogeneous (GTK_BOX (priv->menu_dock), FALSE);
-    gtk_widget_show (priv->menu_dock);
-    gtk_box_pack_start (GTK_BOX (main_vbox), priv->menu_dock,
-                        FALSE, TRUE, 0);
-
-    priv->notebook = gtk_notebook_new ();
-    g_object_set(G_OBJECT(priv->notebook),
-                 "scrollable", TRUE,
-                 "enable-popup", TRUE,
-                 (char *)NULL);
-    gtk_widget_show (priv->notebook);
-    g_signal_connect (G_OBJECT (priv->notebook), "switch-page",
-                      G_CALLBACK (gnc_main_window_switch_page), window);
-    g_signal_connect (G_OBJECT (priv->notebook), "page-reordered",
-                      G_CALLBACK (gnc_main_window_page_reordered), window);
-    gtk_box_pack_start (GTK_BOX (main_vbox), priv->notebook,
-                        TRUE, TRUE, 0);
-
-    priv->statusbar = gtk_statusbar_new ();
-    gtk_widget_show (priv->statusbar);
-    gtk_box_pack_start (GTK_BOX (main_vbox), priv->statusbar,
-                        FALSE, TRUE, 0);
-
-    priv->progressbar = gtk_progress_bar_new ();
-    gtk_progress_bar_set_text(GTK_PROGRESS_BAR(priv->progressbar), " ");
-    gtk_widget_show (priv->progressbar);
-    gtk_box_pack_start (GTK_BOX (priv->statusbar), priv->progressbar,
-                        FALSE, TRUE, 0);
-    gtk_progress_bar_set_pulse_step(GTK_PROGRESS_BAR(priv->progressbar),
-                                    0.01);
-
-    window->ui_merge = gtk_ui_manager_new ();
-
-    /* Create menu and toolbar information */
-    priv->action_group = gtk_action_group_new ("MainWindowActions");
-    gnc_gtk_action_group_set_translation_domain (priv->action_group, GETTEXT_PACKAGE);
-    gtk_action_group_add_actions (priv->action_group, gnc_menu_actions,
-                                  gnc_menu_n_actions, window);
-    gtk_action_group_add_toggle_actions (priv->action_group,
-                                         toggle_actions, n_toggle_actions,
-                                         window);
-    gnc_plugin_update_actions(priv->action_group,
-                              initially_insensitive_actions,
-                              "sensitive", FALSE);
-    gnc_plugin_update_actions(priv->action_group,
-                              always_insensitive_actions,
-                              "sensitive", FALSE);
-    gnc_plugin_update_actions(priv->action_group,
-                              always_hidden_actions,
-                              "visible", FALSE);
-    gnc_plugin_set_important_actions (priv->action_group,
-                                      gnc_menu_important_actions);
-    gtk_ui_manager_insert_action_group (window->ui_merge, priv->action_group, 0);
-
-    g_signal_connect (G_OBJECT (window->ui_merge), "add_widget",
-                      G_CALLBACK (gnc_main_window_add_widget), window);
-    /* Use the "connect-proxy" signal for tooltip display in the
-       status bar */
-    g_signal_connect (G_OBJECT (window->ui_merge), "connect-proxy",
-                      G_CALLBACK (connect_proxy), priv->statusbar);
-
-    filename = gnc_filepath_locate_ui_file("gnc-main-window-ui.xml");
-
-    /* Can't do much without a ui. */
-    g_assert (filename);
-
-    merge_id = gtk_ui_manager_add_ui_from_file (window->ui_merge,
-               filename, &error);
-    g_assert(merge_id || error);
-    if (merge_id)
-    {
-        gtk_window_add_accel_group (GTK_WINDOW (window),
-                                    gtk_ui_manager_get_accel_group(window->ui_merge));
-        gtk_ui_manager_ensure_update (window->ui_merge);
-    }
-    else
-    {
-        g_critical("Failed to load ui file.\n  Filename %s\n  Error %s",
-                   filename, error->message);
-        g_error_free(error);
-        g_assert(merge_id != 0);
-    }
-    g_free(filename);
-    gnc_main_window_window_menu(window);
-    gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL,
-                           GNC_PREF_TAB_POSITION_TOP,
-                           gnc_main_window_update_tab_position,
-                           window);
-    gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL,
-                           GNC_PREF_TAB_POSITION_BOTTOM,
-                           gnc_main_window_update_tab_position,
-                           window);
-    gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL,
-                           GNC_PREF_TAB_POSITION_LEFT,
-                           gnc_main_window_update_tab_position,
-                           window);
-    gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL,
-                           GNC_PREF_TAB_POSITION_RIGHT,
-                           gnc_main_window_update_tab_position,
-                           window);
-    gnc_main_window_update_tab_position(NULL, NULL, window);
-
-    gnc_main_window_init_menu_updaters(window);
-
-    /* Testing */
-    /* Now update the "eXtensions" menu */
-    if (!gnc_prefs_is_extra_enabled())
-    {
-        GtkAction*  action;
-
-        action = gtk_action_group_get_action(priv->action_group,
-                                             "ExtensionsAction");
-        gtk_action_set_visible(action, FALSE);
-    }
-
-    /* GncPluginManager stuff */
-    manager = gnc_plugin_manager_get ();
-    plugins = gnc_plugin_manager_get_plugins (manager);
-    g_list_foreach (plugins, gnc_main_window_add_plugin, window);
-    g_list_free (plugins);
-
-    g_signal_connect (G_OBJECT (manager), "plugin-added",
-                      G_CALLBACK (gnc_main_window_plugin_added), window);
-    g_signal_connect (G_OBJECT (manager), "plugin-removed",
-                      G_CALLBACK (gnc_main_window_plugin_removed), window);
-
-    LEAVE(" ");
-}
-
-#ifdef MAC_INTEGRATION
-/* Event handlers for the shutdown process.  Gnc_quartz_shutdown is
- * connected to NSApplicationWillTerminate, the last chance to do
- * anything before quitting. The problem is that it's launched from a
- * CFRunLoop, not a g_main_loop, and if we call anything that would
- * affect the main_loop we get an assert that we're in a subidiary
- * loop.
- */
-static void
-gnc_quartz_shutdown (GtkosxApplication *theApp, gpointer data)
-{
-    /* Do Nothing. It's too late. */
-}
-/* Should quit responds to NSApplicationBlockTermination; returning
- * TRUE means "don't terminate", FALSE means "do terminate". If we
- * decide that it's OK to terminate, then we queue a gnc_shutdown for
- * the next idle time (because we're not running in the main loop) and
- * then tell the OS not to terminate. That gives the gnc_shutdown an
- * opportunity to shut down.
- */
-static gboolean
-gnc_quartz_should_quit (GtkosxApplication *theApp, GncMainWindow *window)
-{
-    QofSession *session;
-    gboolean needs_save;
-
-    if (!gnc_main_window_all_finish_pending() ||
-            gnc_file_save_in_progress())
-    {
-        return TRUE;
-    }
-    session = gnc_get_current_session();
-    needs_save = qof_book_session_not_saved(qof_session_get_book(session)) &&
-                 !gnc_file_save_in_progress();
-    if (needs_save && gnc_main_window_prompt_for_save(GTK_WIDGET(window)))
-        return TRUE;
-
-    g_timeout_add(250, gnc_main_window_timed_quit, NULL);
-    return TRUE;
-}
-
-static void
-gnc_quartz_set_menu(GncMainWindow* window)
-{
-    GtkosxApplication *theApp = g_object_new(GTKOSX_TYPE_APPLICATION, NULL);
-    GtkWidget       *menu;
-    GtkWidget       *item;
-
-    menu = gtk_ui_manager_get_widget (window->ui_merge, "/menubar");
-    if (GTK_IS_MENU_ITEM (menu))
-        menu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (menu));
-    gtk_widget_hide(menu);
-    gtkosx_application_set_menu_bar (theApp, GTK_MENU_SHELL (menu));
-
-    item = gtk_ui_manager_get_widget (window->ui_merge,
-                                      "/menubar/File/FileQuit");
-    if (GTK_IS_MENU_ITEM (item))
-        gtk_widget_hide (GTK_WIDGET (item));
-
-    item = gtk_ui_manager_get_widget (window->ui_merge,
-                                      "/menubar/Help/HelpAbout");
-    if (GTK_IS_MENU_ITEM (item))
-    {
-        gtkosx_application_insert_app_menu_item (theApp, GTK_WIDGET (item), 0);
-    }
-
-    item = gtk_ui_manager_get_widget (window->ui_merge,
-                                      "/menubar/Edit/EditPreferences");
-    if (GTK_IS_MENU_ITEM (item))
-    {
-        gtkosx_application_insert_app_menu_item (theApp,
-                gtk_separator_menu_item_new (), 1);
-        gtkosx_application_insert_app_menu_item (theApp, GTK_WIDGET (item), 2);
-    }
-
-    item = gtk_ui_manager_get_widget (window->ui_merge,
-                                      "/menubar/Help");
-    gtkosx_application_set_help_menu(theApp, GTK_MENU_ITEM(item));
-    item = gtk_ui_manager_get_widget (window->ui_merge,
-                                      "/menubar/Windows");
-    gtkosx_application_set_window_menu(theApp, GTK_MENU_ITEM(item));
-    g_signal_connect(theApp, "NSApplicationBlockTermination",
-                     G_CALLBACK(gnc_quartz_should_quit), window);
-    gtkosx_application_set_use_quartz_accelerators (theApp, FALSE);
-    g_object_unref (theApp);
-
-}
-#endif //MAC_INTEGRATION
-
-/* Callbacks */
-static void
-gnc_main_window_add_widget (GtkUIManager *merge,
-                            GtkWidget *widget,
-                            GncMainWindow *window)
-{
-    GncMainWindowPrivate *priv;
-
-    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
-    if (GTK_IS_TOOLBAR (widget))
-    {
-        priv->toolbar = widget;
-    }
-
-    gtk_box_pack_start (GTK_BOX (priv->menu_dock), widget, FALSE, FALSE, 0);
-    gtk_widget_show (widget);
-}
-
-/** Should a summary bar be visible in this window?  In order to
- *  prevent synchronization issues, the "ViewSummaryBar"
- *  GtkToggleAction is the sole source of information for whether or
- *  not any summary bar should be visible in a window.
- *
- *  @param window A pointer to the window in question.
- *
- *  @param action If known, a pointer to the "ViewSummaryBar"
- *  GtkToggleAction.  If NULL, the function will look up this action.
- *
- *  @return TRUE if the summarybar should be visible.
- */
-static gboolean
-gnc_main_window_show_summarybar (GncMainWindow *window, GtkAction *action)
-{
-    GncMainWindowPrivate *priv;
-
-    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
-    if (action == NULL)
-        action = gtk_action_group_get_action(priv->action_group,
-                                             "ViewSummaryAction");
-    if (action == NULL)
-        return TRUE;
-    return gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action));
-}
-
-/** This function is invoked when the GtkNotebook switches pages.  It
- *  is responsible for updating the rest of the window contents
- *  outside of the notebook.  I.E. Updating the user interface, the
- *  summary bar, etc.  This function also emits the "page_changed"
- *  signal from the window so that any plugin can also learn about the
- *  fact that the page has changed.
- *
- *  @internal
- */
-static void
-gnc_main_window_switch_page (GtkNotebook *notebook,
-                             gpointer *notebook_page,
-                             gint pos,
-                             GncMainWindow *window)
-{
-    GncMainWindowPrivate *priv;
-    GtkWidget *child;
-    GncPluginPage *page;
-    gboolean visible;
-
-    ENTER("Notebook %p, page, %p, index %d, window %p",
-          notebook, notebook_page, pos, window);
-    g_return_if_fail (GNC_IS_MAIN_WINDOW (window));
-
-    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
-    if (priv->current_page != NULL)
-    {
-        page = priv->current_page;
-        gnc_plugin_page_unmerge_actions (page, window->ui_merge);
-        gnc_plugin_page_unselected (page);
-    }
-
-    child = gtk_notebook_get_nth_page (notebook, pos);
-    if (child)
-    {
-        page = g_object_get_data (G_OBJECT (child), PLUGIN_PAGE_LABEL);
-    }
-    else
-    {
-        page = NULL;
-    }
-
-    priv->current_page = page;
-
-    if (page != NULL)
-    {
-        /* Update the user interface (e.g. menus and toolbars */
-        gnc_plugin_page_merge_actions (page, window->ui_merge);
-        visible = gnc_main_window_show_summarybar(window, NULL);
-        gnc_plugin_page_show_summarybar (page, visible);
-
-        /* Allow page specific actions */
-        gnc_plugin_page_selected (page);
-        gnc_window_update_status (GNC_WINDOW(window), page);
-
-        /* Update the page reference info */
-        priv->usage_order = g_list_remove (priv->usage_order, page);
-        priv->usage_order = g_list_prepend (priv->usage_order, page);
-    }
-
-    gnc_plugin_update_actions(priv->action_group,
-                              multiple_page_actions,
-                              "sensitive",
-                              g_list_length(priv->installed_pages) > 1);
-
-    gnc_main_window_update_title(window);
-#ifndef MAC_INTEGRATION
-    gnc_main_window_update_menu_item(window);
-#endif
-    g_signal_emit (window, main_window_signals[PAGE_CHANGED], 0, page);
-    LEAVE(" ");
-}
-
-/** This function is invoked when a GtkNotebook tab gets reordered by
- *  drag and drop. It adjusts the list installed_pages to reflect the new
- *  ordering so that GnuCash saves and restores the tabs correctly.
- *
- *  @internal
- */
-static void
-gnc_main_window_page_reordered (GtkNotebook *notebook,
-                                GtkWidget *child,
-                                guint pos,
-                                GncMainWindow *window)
-{
-    GncMainWindowPrivate *priv;
-    GncPluginPage *page;
-    GList *old_link;
-
-    ENTER("Notebook %p, child %p, index %d, window %p",
-          notebook, child, pos, window);
-    g_return_if_fail (GNC_IS_MAIN_WINDOW (window));
-
-    if (!child) return;
-
-    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
-
-    page = g_object_get_data (G_OBJECT (child), PLUGIN_PAGE_LABEL);
-    if (!page) return;
-
-    old_link = g_list_find (priv->installed_pages, page);
-    if (!old_link) return;
-
-    priv->installed_pages = g_list_delete_link (priv->installed_pages,
-                            old_link);
-    priv->installed_pages = g_list_insert (priv->installed_pages,
-                                           page, pos);
-
-    LEAVE(" ");
-}
-
-static void
-gnc_main_window_plugin_added (GncPlugin *manager,
-                              GncPlugin *plugin,
-                              GncMainWindow *window)
-{
-    g_return_if_fail (GNC_IS_MAIN_WINDOW (window));
-    g_return_if_fail (GNC_IS_PLUGIN (plugin));
-
-    gnc_plugin_add_to_window (plugin, window, window_type);
-}
-
-static void
-gnc_main_window_plugin_removed (GncPlugin *manager,
-                                GncPlugin *plugin,
-                                GncMainWindow *window)
-{
-    g_return_if_fail (GNC_IS_MAIN_WINDOW (window));
-    g_return_if_fail (GNC_IS_PLUGIN (plugin));
-
-    gnc_plugin_remove_from_window (plugin, window, window_type);
-}
-
-
-/* Command callbacks */
-static void
-gnc_main_window_cmd_page_setup (GtkAction *action,
-                                GncMainWindow *window)
-{
-    GtkWindow *gtk_window;
-
-    g_return_if_fail(GNC_IS_MAIN_WINDOW(window));
-
-    gtk_window = gnc_window_get_gtk_window(GNC_WINDOW(window));
-    gnc_ui_page_setup(gtk_window);
-}
-
-gboolean
-gnc_book_options_dialog_apply_helper(GNCOptionDB * options)
-{
-    QofBook *book = gnc_get_current_book ();
-    gboolean use_split_action_for_num_before =
-        qof_book_use_split_action_for_num_field (book);
-    gboolean use_book_currency_before =
-        gnc_book_use_book_currency (book);
-    gboolean use_split_action_for_num_after;
-    gboolean use_book_currency_after;
-    gboolean return_val = FALSE;
-    GList *results = NULL, *iter;
-
-    if (!options) return return_val;
-
-    results = gnc_option_db_commit (options);
-    for (iter = results; iter; iter = iter->next)
-    {
-        GtkWidget *dialog = gtk_message_dialog_new(NULL,
-                                                   0,
-                                                   GTK_MESSAGE_ERROR,
-                                                   GTK_BUTTONS_OK,
-                                                   "%s",
-                                                   (char*)iter->data);
-        gtk_dialog_run(GTK_DIALOG(dialog));
-        gtk_widget_destroy(dialog);
-        g_free (iter->data);
-    }
-    g_list_free (results);
-    qof_book_begin_edit (book);
-    qof_book_save_options (book, gnc_option_db_save, options, TRUE);
-    use_split_action_for_num_after =
-        qof_book_use_split_action_for_num_field (book);
-    use_book_currency_after = gnc_book_use_book_currency (book);
-    if (use_split_action_for_num_before != use_split_action_for_num_after)
-    {
-        gnc_book_option_num_field_source_change_cb (
-                                                use_split_action_for_num_after);
-        return_val = TRUE;
-    }
-    if (use_book_currency_before != use_book_currency_after)
-    {
-        gnc_book_option_book_currency_selected_cb (use_book_currency_after);
-        return_val = TRUE;
-    }
-    qof_book_commit_edit (book);
-    return return_val;
-}
-
-static void
-gnc_book_options_dialog_apply_cb(GNCOptionWin * optionwin,
-                                 gpointer user_data)
-{
-    GNCOptionDB * options = user_data;
-
-    if (!options) return;
-
-    if (gnc_book_options_dialog_apply_helper (options))
-        gnc_gui_refresh_all ();
-}
-
-static void
-gnc_book_options_dialog_close_cb(GNCOptionWin * optionwin,
-                                 gpointer user_data)
-{
-    GNCOptionDB * options = user_data;
-
-    gnc_options_dialog_destroy(optionwin);
-    gnc_option_db_destroy(options);
-}
-
-static gboolean
-show_handler (const char *class_name, gint component_id,
-              gpointer user_data, gpointer iter_data)
-{
-    GtkWidget *dialog;
-
-    dialog = GTK_WIDGET(user_data);
-    gtk_window_present(GTK_WINDOW(dialog));
-    return(TRUE);
-}
-
-GtkWidget *
-gnc_book_options_dialog_cb (gboolean modal, gchar *title)
-{
-    QofBook *book = gnc_get_current_book ();
-    GNCOptionDB *options;
-    GNCOptionWin *optionwin;
-
-    options = gnc_option_db_new_for_type (QOF_ID_BOOK);
-    qof_book_load_options (book, gnc_option_db_load, options);
-    gnc_option_db_clean (options);
-
-    /* Only allow one Book Options dialog if called from file->properties
-       menu */
-    if (gnc_forall_gui_components(DIALOG_BOOK_OPTIONS_CM_CLASS,
-                                  show_handler, NULL))
-    {
-        return NULL;
-    }
-    optionwin = gnc_options_dialog_new_modal (modal,
-                (title ? title : _( "Book Options")),
-                DIALOG_BOOK_OPTIONS_CM_CLASS);
-    gnc_options_dialog_build_contents (optionwin, options);
-
-    gnc_options_dialog_set_book_options_help_cb (optionwin);
-
-    gnc_options_dialog_set_apply_cb (optionwin,
-                                     gnc_book_options_dialog_apply_cb,
-                                     (gpointer)options);
-    gnc_options_dialog_set_close_cb (optionwin,
-                                     gnc_book_options_dialog_close_cb,
-                                     (gpointer)options);
-    if (modal)
-        gnc_options_dialog_set_new_book_option_values (options);
-    return gnc_options_dialog_widget (optionwin);
-}
-
-static void
-gnc_main_window_cmd_file_properties (GtkAction *action, GncMainWindow *window)
-{
-    gnc_book_options_dialog_cb (FALSE, NULL);
-}
-
-static void
-gnc_main_window_cmd_file_close (GtkAction *action, GncMainWindow *window)
-{
-    GncMainWindowPrivate *priv;
-    GncPluginPage *page;
-
-    g_return_if_fail(GNC_IS_MAIN_WINDOW(window));
-
-    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
-    page = priv->current_page;
-    gnc_main_window_close_page(page);
-}
-
-static void
-gnc_main_window_cmd_file_quit (GtkAction *action, GncMainWindow *window)
-{
-    if (!gnc_main_window_all_finish_pending())
-        return;
-
-    gnc_main_window_quit(window);
-}
-
-static void
-gnc_main_window_cmd_edit_cut (GtkAction *action, GncMainWindow *window)
-{
-    GtkWidget *widget = gtk_window_get_focus (GTK_WINDOW (window));
-    GtkTextBuffer *text_buffer;
-    GtkClipboard *clipboard;
-    gboolean editable;
-
-    if (GTK_IS_EDITABLE (widget))
-    {
-        gtk_editable_cut_clipboard (GTK_EDITABLE (widget));
-    }
-    else if (GTK_IS_TEXT_VIEW (widget))
-    {
-        text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW(widget));
-        clipboard = gtk_widget_get_clipboard (GTK_WIDGET(text_buffer),
-                                              GDK_SELECTION_CLIPBOARD);
-        editable = gtk_text_view_get_editable (GTK_TEXT_VIEW (widget));
-        gtk_text_buffer_cut_clipboard (text_buffer, clipboard, editable);
-    }
-}
-
-static void
-gnc_main_window_cmd_edit_copy (GtkAction *action, GncMainWindow *window)
-{
-    GtkWidget *widget = gtk_window_get_focus (GTK_WINDOW (window));
-    GtkTextBuffer *text_buffer;
-    GtkClipboard *clipboard;
-
-    if (GTK_IS_EDITABLE (widget))
-    {
-        gtk_editable_copy_clipboard (GTK_EDITABLE (widget));
-    }
-    else if (GTK_IS_TEXT_VIEW (widget))
-    {
-        text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW(widget));
-        clipboard = gtk_widget_get_clipboard (GTK_WIDGET(text_buffer),
-                                              GDK_SELECTION_CLIPBOARD);
-        gtk_text_buffer_copy_clipboard (text_buffer, clipboard);
-    }
-}
-
-static void
-gnc_main_window_cmd_edit_paste (GtkAction *action, GncMainWindow *window)
-{
-    GtkWidget *widget = gtk_window_get_focus (GTK_WINDOW (window));
-    GtkTextBuffer *text_buffer;
-    GtkClipboard *clipboard;
-
-    if (GTK_IS_EDITABLE (widget))
-    {
-        gtk_editable_paste_clipboard (GTK_EDITABLE (widget));
-    }
-    else if (GTK_IS_TEXT_VIEW (widget))
-    {
-        text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW(widget));
-        clipboard = gtk_widget_get_clipboard (GTK_WIDGET(text_buffer),
-                                              GDK_SELECTION_CLIPBOARD);
-        gtk_text_buffer_paste_clipboard (text_buffer, clipboard, NULL, FALSE);
-    }
-}
-
-static void
-gnc_main_window_cmd_edit_preferences (GtkAction *action, GncMainWindow *window)
-{
-    gnc_preferences_dialog ();
-}
-
-static void
-gnc_main_window_cmd_view_refresh (GtkAction *action, GncMainWindow *window)
-{
-}
-
-static void
-gnc_main_window_cmd_actions_reset_warnings (GtkAction *action, GncMainWindow *window)
-{
-    gnc_reset_warnings_dialog(GTK_WINDOW(window));
-}
-
-static void
-gnc_main_window_cmd_actions_rename_page (GtkAction *action, GncMainWindow *window)
-{
-    GncMainWindowPrivate *priv;
-    GncPluginPage *page;
-    GtkWidget *label, *entry;
-
-    ENTER(" ");
-    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
-    page = priv->current_page;
-    if (!page)
-    {
-        LEAVE("No current page");
-        return;
-    }
-
-    if (!main_window_find_tab_items(window, page, &label, &entry))
-    {
-        LEAVE("can't find required widgets");
-        return;
-    }
-
-    gtk_entry_set_text(GTK_ENTRY(entry), gtk_label_get_text(GTK_LABEL(label)));
-    gtk_editable_select_region(GTK_EDITABLE(entry), 0, -1);
-    gtk_widget_hide(label);
-    gtk_widget_show(entry);
-    gtk_widget_grab_focus(entry);
-    LEAVE("opened for editing");
-}
-
-static void
-gnc_main_window_cmd_view_toolbar (GtkAction *action, GncMainWindow *window)
-{
-    GncMainWindowPrivate *priv;
-
-    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
-    if (gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action)))
-    {
-        gtk_widget_show (priv->toolbar);
-    }
-    else
-    {
-        gtk_widget_hide (priv->toolbar);
-    }
-}
-
-static void
-gnc_main_window_cmd_view_summary (GtkAction *action, GncMainWindow *window)
-{
-    GncMainWindowPrivate *priv;
-    GList *item;
-    gboolean visible;
-
-    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
-    visible = gnc_main_window_show_summarybar(window, action);
-    for (item = priv->installed_pages; item; item = g_list_next(item))
-    {
-        gnc_plugin_page_show_summarybar(item->data, visible);
-    }
-}
-
-static void
-gnc_main_window_cmd_view_statusbar (GtkAction *action, GncMainWindow *window)
-{
-    GncMainWindowPrivate *priv;
-
-    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
-    if (gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action)))
-    {
-        gtk_widget_show (priv->statusbar);
-    }
-    else
-    {
-        gtk_widget_hide (priv->statusbar);
-    }
-}
-
-static void
-gnc_main_window_cmd_window_new (GtkAction *action, GncMainWindow *window)
-{
-    GncMainWindow *new_window;
-
-    /* Create the new window */
-    ENTER(" ");
-    new_window = gnc_main_window_new ();
-    gtk_widget_show(GTK_WIDGET(new_window));
-    LEAVE(" ");
-}
-
-static void
-gnc_main_window_cmd_window_move_page (GtkAction *action, GncMainWindow *window)
-{
-    GncMainWindowPrivate *priv;
-    GncMainWindow *new_window;
-    GncPluginPage *page;
-    GtkNotebook *notebook;
-    GtkWidget *tab_widget, *menu_widget;
-
-    ENTER("action %p,window %p", action, window);
-
-    /* Setup */
-    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
-    page = priv->current_page;
-    if (!page)
-    {
-        LEAVE("invalid page");
-        return;
-    }
-    if (!page->notebook_page)
-    {
-        LEAVE("invalid notebook_page");
-        return;
-    }
-
-    notebook = GTK_NOTEBOOK (priv->notebook);
-    tab_widget = gtk_notebook_get_tab_label (notebook, page->notebook_page);
-    menu_widget = gtk_notebook_get_menu_label (notebook, page->notebook_page);
-
-    /* Ref the page components, then remove it from its old window */
-    g_object_ref(page);
-    g_object_ref(tab_widget);
-    g_object_ref(menu_widget);
-    g_object_ref(page->notebook_page);
-    gnc_main_window_disconnect(window, page);
-
-    /* Create the new window */
-    new_window = gnc_main_window_new ();
-    gtk_widget_show(GTK_WIDGET(new_window));
-
-    /* Now add the page to the new window */
-    gnc_main_window_connect (new_window, page, tab_widget, menu_widget);
-
-    /* Unref the page components now that we're done */
-    g_object_unref(page->notebook_page);
-    g_object_unref(menu_widget);
-    g_object_unref(tab_widget);
-    g_object_unref(page);
-
-    /* just a little debugging. :-) */
-    DEBUG("Moved page %p from window %p to new window %p",
-          page, window, new_window);
-    DEBUG("Old window current is %p, new window current is %p",
-          priv->current_page, priv->current_page);
-
-    LEAVE("page moved");
-}
-
-#ifndef MAC_INTEGRATION
-static void
-gnc_main_window_cmd_window_raise (GtkAction *action,
-                                  GtkRadioAction *current,
-                                  GncMainWindow *old_window)
-{
-    GncMainWindow *new_window;
-    gint value;
-
-    g_return_if_fail(GTK_IS_ACTION(action));
-    g_return_if_fail(GTK_IS_RADIO_ACTION(current));
-    g_return_if_fail(GNC_IS_MAIN_WINDOW(old_window));
-
-    ENTER("action %p, current %p, window %p", action, current, old_window);
-    value = gtk_radio_action_get_current_value(current);
-    new_window = g_list_nth_data(active_windows, value);
-    gtk_window_present(GTK_WINDOW(new_window));
-    /* revert the change in the radio group
-     * impossible while handling "changed" (G_SIGNAL_NO_RECURSE) */
-    g_idle_add((GSourceFunc)gnc_main_window_update_radio_button, old_window);
-    LEAVE(" ");
-}
-#endif /* !MAC_INTEGRATION */
-
-static void
-gnc_main_window_cmd_help_tutorial (GtkAction *action, GncMainWindow *window)
-{
-    gnc_gnome_help (HF_GUIDE, NULL);
-}
-
-static void
-gnc_main_window_cmd_help_contents (GtkAction *action, GncMainWindow *window)
-{
-    gnc_gnome_help (HF_HELP, NULL);
-}
-
-/** This is a helper function to find a data file and suck it into
- *  memory.
- *
- *  @param partial The name of the file relative to the gnucash
- *  specific shared data directory.
- *
- *  @return The text of the file or NULL. The caller is responsible
- *  for freeing this string.
- */
-static gchar *
-get_file (const gchar *partial)
-{
-    gchar *filename, *text = NULL;
-    gsize length;
-
-    filename = gnc_filepath_locate_doc_file(partial);
-    if (filename && g_file_get_contents(filename, &text, &length, NULL))
-    {
-	if (length)
-	{
-	    g_free(filename);
-	    return text;
-	}
-        g_free(text);
-    }
-    g_free (filename);
-    return NULL;
-}
-
-
-/** This is a helper function to find a data file, suck it into
- *  memory, and split it into an array of strings.
- *
- *  @param partial The name of the file relative to the gnucash
- *  specific shared data directory.
- *
- *  @return The text of the file as an array of strings, or NULL. The
- *  caller is responsible for freeing all the strings and the array.
- */
-static gchar **
-get_file_strsplit (const gchar *partial)
-{
-    gchar *text, **lines;
-
-    text = get_file(partial);
-    if (!text)
-        return NULL;
-
-    lines = g_strsplit_set(text, "\r\n", -1);
-    g_free(text);
-    return lines;
-}
-/** URL activation callback.
- *  Use our own function to activate the URL in the users browser
- *  instead of gtk_show_uri(), which requires gvfs.
- *  Signature described in gtk docs at GtkAboutDialog activate-link signal.
- */
-
-static gboolean
-url_signal_cb (GtkAboutDialog *dialog, gchar *uri, gpointer data)
-{
-    gnc_launch_assoc (uri);
-    return TRUE;
-}
-
-/** Create and display the "about" dialog for gnucash.
- *
- *  @param action The GtkAction for the "about" menu item.
- *
- *  @param window The main window whose menu item was activated.
- */
-static void
-gnc_main_window_cmd_help_about (GtkAction *action, GncMainWindow *window)
-{
-    GncMainWindowPrivate *priv;
-
-    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
-
-    if (priv->about_dialog == NULL)
-    {
-	const gchar *fixed_message = _("The GnuCash personal finance manager. "
-                                   "The GNU way to manage your money!");
-	const gchar *copyright = _("© 1997-2017 Contributors");
-	gchar **authors = get_file_strsplit("AUTHORS");
-	gchar **documenters = get_file_strsplit("DOCUMENTERS");
-	gchar *license = get_file("LICENSE");
-	gchar *message;
-        GtkIconTheme *icon_theme = gtk_icon_theme_get_default ();
-	GdkPixbuf *logo = gtk_icon_theme_load_icon (icon_theme,
-                                                    GNC_ICON_APP,
-                                                    48,
-                                                    GTK_ICON_LOOKUP_USE_BUILTIN,
-                                                    NULL);
-
-
-#ifdef GNUCASH_SCM
-    /* Development version */
-    /* Translators: 1st %s is a fixed message, which is translated independently;
-                    2nd %s is the scm type (svn/svk/git/bzr);
-                    3rd %s is the scm revision number;
-                    4th %s is the build date */
-	message = g_strdup_printf(_("%s\nThis copy was built from %s rev %s on %s."),
-				  fixed_message, GNUCASH_SCM, GNUCASH_SCM_REV,
-				  GNUCASH_BUILD_DATE);
-#else
-    /* Translators: 1st %s is a fixed message, which is translated independently;
-                    2nd %s is the scm (svn/svk/git/bzr) revision number;
-                    3rd %s is the build date */
-	message = g_strdup_printf(_("%s\nThis copy was built from rev %s on %s."),
-				  fixed_message, GNUCASH_SCM_REV,
-				  GNUCASH_BUILD_DATE);
-#endif
-	priv->about_dialog = gtk_about_dialog_new ();
-	g_object_set (priv->about_dialog,
-		      "authors", authors,
-		      "documenters", documenters,
-		      "comments", message,
-		      "copyright", copyright,
-		      "license", license,
-		      "logo", logo,
-		      "name", "GnuCash",
-     /* Translators: the following string will be shown in Help->About->Credits
-      * Enter your name or that of your team and an email contact for feedback.
-      * The string can have multiple rows, so you can also add a list of
-      * contributors. */
-		      "translator-credits", _("translator_credits"),
-		      "version", VERSION,
-		      "website", "http://www.gnucash.org",
-		      NULL);
-
-	g_free(message);
-	if (license)     g_free(license);
-	if (documenters) g_strfreev(documenters);
-	if (authors)     g_strfreev(authors);
-	g_object_unref (logo);
-	g_signal_connect (priv->about_dialog, "activate-link",
-			  G_CALLBACK (url_signal_cb), NULL);
-	g_signal_connect (priv->about_dialog, "response",
-			  G_CALLBACK (gtk_widget_hide), NULL);
-
-        /* Set dialog to resize. */
-        gtk_window_set_resizable(GTK_WINDOW(priv->about_dialog), TRUE);
-
-	gtk_window_set_transient_for (GTK_WINDOW (priv->about_dialog),
-				      GTK_WINDOW (window));
-    }
-    gtk_dialog_run (GTK_DIALOG (priv->about_dialog));
-}
-
-
-/************************************************************
- *                                                          *
- ************************************************************/
-
-void
-gnc_main_window_show_all_windows(void)
-{
-    GList *window_iter;
-#ifdef MAC_INTEGRATION
-    GtkosxApplication *theApp = g_object_new(GTKOSX_TYPE_APPLICATION, NULL);
-#endif
-    for (window_iter = active_windows; window_iter != NULL; window_iter = window_iter->next)
-    {
-        gtk_widget_show(GTK_WIDGET(window_iter->data));
-    }
-#ifdef MAC_INTEGRATION
-    g_signal_connect(theApp, "NSApplicationWillTerminate",
-                     G_CALLBACK(gnc_quartz_shutdown), NULL);
-    gtkosx_application_ready(theApp);
-    g_object_unref (theApp);
-#endif
-}
-
-/** Get a pointer to the first active top level window or NULL
- *  if there is none.
- *
- *  @return A pointer to a GtkWindow object. */
-GtkWidget *
-gnc_ui_get_toplevel (void)
-{
-    GList *window;
-
-    for (window = active_windows; window; window = window->next)
-        if (gtk_window_is_active (GTK_WINDOW (window->data)))
-            return window->data;
-
-    return NULL;
-}
-
-
-/** Retrieve the gtk window associated with a main window object.
- *  This function is called via a vector off a generic window
- *  interface.
- *
- *  @param window A pointer to a generic window. */
-static GtkWindow *
-gnc_main_window_get_gtk_window (GncWindow *window)
-{
-    g_return_val_if_fail (GNC_IS_MAIN_WINDOW (window), NULL);
-    return GTK_WINDOW(window);
-}
-
-
-/** Retrieve the status bar associated with a main window object.
- *  This function is called via a vector off a generic window
- *  interface.
- *
- *  @param window_in A pointer to a generic window. */
-static GtkWidget *
-gnc_main_window_get_statusbar (GncWindow *window_in)
-{
-    GncMainWindowPrivate *priv;
-    GncMainWindow *window;
-
-    g_return_val_if_fail (GNC_IS_MAIN_WINDOW (window_in), NULL);
-
-    window = GNC_MAIN_WINDOW(window_in);
-    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
-    return priv->statusbar;
-}
-
-
-/** Retrieve the progress bar associated with a main window object.
- *  This function is called via a vector off a generic window
- *  interface.
- *
- *  @param window_in A pointer to a generic window. */
-static GtkWidget *
-gnc_main_window_get_progressbar (GncWindow *window_in)
-{
-    GncMainWindowPrivate *priv;
-    GncMainWindow *window;
-
-    g_return_val_if_fail (GNC_IS_MAIN_WINDOW (window_in), NULL);
-
-    window = GNC_MAIN_WINDOW(window_in);
-    priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
-    return priv->progressbar;
-}
-
-
-static void
-gnc_main_window_all_ui_set_sensitive (GncWindow *unused, gboolean sensitive)
-{
-    GncMainWindow *window;
-    GncMainWindowPrivate *priv;
-    GList *groupp, *groups, *winp, *tmp;
-    GtkWidget *close_button;
-
-    for (winp = active_windows; winp; winp = g_list_next(winp))
-    {
-        window = winp->data;
-        priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
-
-        groups = gtk_ui_manager_get_action_groups(window->ui_merge);
-        for (groupp = groups; groupp; groupp = g_list_next(groupp))
-        {
-            gtk_action_group_set_sensitive(GTK_ACTION_GROUP(groupp->data), sensitive);
-        }
-
-        for (tmp = priv->installed_pages; tmp; tmp = g_list_next(tmp))
-        {
-            close_button = g_object_get_data(tmp->data, PLUGIN_PAGE_CLOSE_BUTTON);
-            if (!close_button)
-                continue;
-            gtk_widget_set_sensitive (close_button, sensitive);
-        }
-    }
-}
-
-
-/** Initialize the generic window interface for a main window.
- *
- *  @param iface A pointer to the interface data structure to
- *  populate. */
-static void
-gnc_window_main_window_init (GncWindowIface *iface)
-{
-    iface->get_gtk_window  = gnc_main_window_get_gtk_window;
-    iface->get_statusbar   = gnc_main_window_get_statusbar;
-    iface->get_progressbar = gnc_main_window_get_progressbar;
-    iface->ui_set_sensitive = gnc_main_window_all_ui_set_sensitive;
-}
-
-
-/*  Set the window where all progressbar updates should occur.  This
- *  is a wrapper around the gnc_window_set_progressbar_window()
- *  function.
- */
-void
-gnc_main_window_set_progressbar_window (GncMainWindow *window)
-{
-    GncWindow *gncwin;
-    gncwin = GNC_WINDOW(window);
-    gnc_window_set_progressbar_window(gncwin);
-}
-
-
-/** Popup a contextual menu.  This function ends up being called when
- *  the user right-clicks in the context of a window, or uses the
- *  keyboard context-menu request key combination (Shift-F10 by
- *  default).
- *
- *  @param page This is the GncPluginPage corresponding to the visible
- *  page.
- *
- *  @param event The event parameter passed to the "button-press"
- *  callback.  May be null if there was no event (aka keyboard
- *  request).
- */
-static void
-do_popup_menu(GncPluginPage *page, GdkEventButton *event)
-{
-    GtkUIManager *ui_merge;
-    GtkWidget *menu;
-    int button, event_time;
-
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE(page));
-
-    ENTER("page %p, event %p", page, event);
-    ui_merge = gnc_plugin_page_get_ui_merge(page);
-    if (ui_merge == NULL)
-    {
-        LEAVE("no ui merge");
-        return;
-    }
-
-    menu = gtk_ui_manager_get_widget(ui_merge, "/MainPopup");
-    if (!menu)
-    {
-        LEAVE("no menu");
-        return;
-    }
-
-    if (event)
-    {
-        button = event->button;
-        event_time = event->time;
-    }
-    else
-    {
-        button = 0;
-        event_time = gtk_get_current_event_time ();
-    }
-#if GTK_CHECK_VERSION(3,22,0)
-    gtk_menu_popup_at_pointer (GTK_MENU(menu), (GdkEvent *) event);
-#else
-    gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, button, event_time);
-#endif
-    LEAVE(" ");
-}
-
-
-/** Callback function invoked when the user requests that Gnucash
- *  popup the contextual menu via the keyboard context-menu request
- *  key combination (Shift-F10 by default).
- *
- *  @param page This is the GncPluginPage corresponding to the visible
- *  page.
- *
- *  @param widget Whatever widget had focus when the user issued the
- *  keyboard context-menu request.
- *
- *  @return Always returns TRUE to indicate that the menu request was
- *  handled.
- */
-static gboolean
-gnc_main_window_popup_menu_cb (GtkWidget *widget,
-                               GncPluginPage *page)
-{
-    ENTER("widget %p, page %p", widget, page);
-    do_popup_menu(page, NULL);
-    LEAVE(" ");
-    return TRUE;
-}
-
-
-/*  Callback function invoked when the user clicks in the content of
- *  any Gnucash window.  If this was a "right-click" then Gnucash will
- *  popup the contextual menu.
- */
-gboolean
-gnc_main_window_button_press_cb (GtkWidget *whatever,
-                                 GdkEventButton *event,
-                                 GncPluginPage *page)
-{
-    g_return_val_if_fail(GNC_IS_PLUGIN_PAGE(page), FALSE);
-
-    ENTER("widget %p, event %p, page %p", whatever, event, page);
-    /* Ignore double-clicks and triple-clicks */
-    if (event->button == 3 && event->type == GDK_BUTTON_PRESS)
-    {
-        do_popup_menu(page, event);
-        LEAVE("menu shown");
-        return TRUE;
-    }
-
-    LEAVE("other click");
-    return FALSE;
-}
-
-
-/* CS: Code copied from gtk/gtkactiongroup.c */
-static gchar *
-dgettext_swapped (const gchar *msgid,
-                  const gchar *domainname)
-{
-    /* CS: Pass this through dgettext if and only if msgid is
-       nonempty. */
-    return (msgid && *msgid) ? dgettext (domainname, msgid) : (gchar*) msgid;
-}
-
-/*
- * This is copied into GnuCash from Gtk in order to fix problems when
- * empty msgids were passed through gettext().
- *
- * See http://bugzilla.gnome.org/show_bug.cgi?id=326200 . If that bug
- * is fixed in the gtk that we can rely open, then
- * gnc_gtk_action_group_set_translation_domain can be replaced by
- * gtk_action_group_set_translation_domain again.
- */
-void
-gnc_gtk_action_group_set_translation_domain (GtkActionGroup *action_group,
-        const gchar    *domain)
-{
-    g_return_if_fail (GTK_IS_ACTION_GROUP (action_group));
-
-    gtk_action_group_set_translate_func (action_group,
-                                         (GtkTranslateFunc)dgettext_swapped,
-                                         g_strdup (domain),
-                                         g_free);
-}
-/* CS: End of code copied from gtk/gtkactiongroup.c */
-
-void
-gnc_main_window_all_action_set_sensitive (const gchar *action_name,
-        gboolean sensitive)
-{
-    GList *tmp;
-    GtkAction *action;
-
-    for (tmp = active_windows; tmp; tmp = g_list_next(tmp))
-    {
-        action = gnc_main_window_find_action (tmp->data, action_name);
-        gtk_action_set_sensitive (action, sensitive);
-    }
-}
-
-GtkUIManager *gnc_main_window_get_uimanager (GncMainWindow *window)
-{
-    g_assert(window);
-    return window->ui_merge;
-}
-
-/** @} */
-/** @} */
diff --git a/src/gnome-utils/gnc-splash.c b/src/gnome-utils/gnc-splash.c
deleted file mode 100644
index 7720633..0000000
--- a/src/gnome-utils/gnc-splash.c
+++ /dev/null
@@ -1,209 +0,0 @@
-/********************************************************************\
- * gnc-splash.c -- splash screen for GnuCash                        *
- * Copyright (C) 2001 Gnumatic, 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 at gnu.org                   *
-\********************************************************************/
-
-#include "config.h"
-
-#include <gtk/gtk.h>
-#include <glib/gi18n.h>
-
-#include "gnc-gnome-utils.h"
-#include "gnc-splash.h"
-#include "core-utils/gnc-version.h"
-#include "gnc-prefs.h"
-#include "dialog-utils.h"
-
-#define MARKUP_STRING "<span size='small'>%s</span>"
-#define GNC_PREF_SHOW_SPLASH "show-splash-screen"
-
-static GtkWidget * splash = NULL;
-static GtkWidget * progress = NULL;
-static GtkWidget * progress_bar = NULL;
-
-static void
-splash_destroy_cb (GtkWidget *object, gpointer user_data)
-{
-    splash = NULL;
-}
-
-static gboolean
-button_press_cb(GtkWidget *widget, GdkEventButton *event, gpointer unused)
-{
-    gnc_destroy_splash_screen();
-    return TRUE;
-}
-
-void
-gnc_show_splash_screen (void)
-{
-    GtkWidget *pixmap;
-    GtkWidget *frame;
-    GtkWidget *vbox;
-    GtkWidget *hbox;
-    GtkWidget *version;
-    GtkWidget *separator;
-    gchar *ver_string, *markup;
-
-    if (splash) return;
-    if (!gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL, GNC_PREF_SHOW_SPLASH)) return;
-
-    splash = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-    gtk_window_set_decorated(GTK_WINDOW (splash), FALSE);
-    gtk_window_set_skip_taskbar_hint (GTK_WINDOW (splash), TRUE);
-
-    // Set the style context for this dialog so it can be easily manipulated with css
-    gnc_widget_set_style_context (GTK_WIDGET(splash), "GncSplash");
-
-    g_signal_connect (splash, "destroy",
-                      G_CALLBACK (splash_destroy_cb), NULL);
-
-    gtk_window_set_title (GTK_WINDOW (splash), "GnuCash");
-    gtk_window_set_position (GTK_WINDOW (splash), GTK_WIN_POS_CENTER);
-    gtk_window_set_type_hint (GTK_WINDOW (splash), GDK_WINDOW_TYPE_HINT_DIALOG);
-
-    pixmap = gnc_gnome_get_pixmap ("gnucash_splash.png");
-
-    if (!pixmap)
-    {
-        g_warning ("can't find splash pixmap");
-        gtk_widget_destroy (splash);
-        return;
-    }
-
-    frame = gtk_frame_new (NULL);
-    vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
-    gtk_box_set_homogeneous (GTK_BOX (vbox), FALSE);
-    hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 3);
-    gtk_box_set_homogeneous (GTK_BOX (hbox), FALSE);
-#ifdef GNUCASH_SCM
-    /* Development version */
-    /* Translators: 1st %s is the GnuCash version (eg 2.4.11);
-                    2nd %s is the scm type (svn/svk/git/bzr);
-                    3rd %s is the scm revision number;
-                    4th %s is the build date */
-    ver_string = g_strdup_printf(_("Version: GnuCash-%s %s (rev %s built %s)"),
-                                 VERSION, GNUCASH_SCM, GNUCASH_SCM_REV,
-                                 GNUCASH_BUILD_DATE);
-#else
-    /* Dist Tarball */
-    /* Translators: 1st %s is the GnuCash version (eg 2.4.11);
-                    2nd %s is the scm (svn/svk/git/bzr) revision number;
-                    3rd %s is the build date */
-    ver_string = g_strdup_printf(_("Version: GnuCash-%s (rev %s built %s)"),
-                                 VERSION, GNUCASH_SCM_REV, GNUCASH_BUILD_DATE);
-#endif
-
-    version = gtk_label_new(NULL);
-    markup = g_markup_printf_escaped(MARKUP_STRING, ver_string);
-    gtk_label_set_markup(GTK_LABEL(version), markup);
-    g_free(markup);
-    g_free(ver_string);
-    separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
-
-    progress = gtk_label_new(NULL);
-    /* the set_max_width avoids "bumping" of the splash screen
-       if a long string is given in gnc_update_splash_screen();
-       presumably it would be better to inhibit size change of the
-       top level container, but I don't know how to do this */
-    gtk_label_set_max_width_chars(GTK_LABEL(progress), 34);
-    markup = g_markup_printf_escaped(MARKUP_STRING, _("Loading..."));
-    gtk_label_set_markup(GTK_LABEL(progress), markup);
-    g_free(markup);
-
-    progress_bar = gtk_progress_bar_new ();
-
-    gtk_container_add (GTK_CONTAINER (frame), pixmap);
-    gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
-    gtk_box_pack_start (GTK_BOX (vbox), version, FALSE, FALSE, 0);
-    gtk_box_pack_start (GTK_BOX (vbox), separator, FALSE, FALSE, 0);
-    gtk_box_pack_start (GTK_BOX (hbox), progress, TRUE, TRUE, 0);
-    gtk_box_pack_start (GTK_BOX (hbox), progress_bar, FALSE, FALSE, 0);
-    gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
-    gtk_container_add (GTK_CONTAINER (splash), vbox);
-
-    gtk_widget_add_events(splash, GDK_BUTTON_PRESS_MASK);
-    g_signal_connect(splash, "button_press_event",
-                     G_CALLBACK(button_press_cb), NULL);
-
-    gtk_window_set_auto_startup_notification (FALSE);
-    gtk_widget_show_all (splash);
-    gtk_window_set_auto_startup_notification (TRUE);
-
-    /* make sure splash is up */
-    while (gtk_events_pending ())
-        gtk_main_iteration ();
-}
-
-void
-gnc_destroy_splash_screen (void)
-{
-    if (splash)
-    {
-        gtk_widget_destroy (splash);
-        progress = NULL;
-        progress_bar = NULL;
-        splash = NULL;
-    }
-}
-
-void
-gnc_update_splash_screen (const gchar *string, double percentage)
-{
-    gchar *markup;
-
-    if (progress)
-    {
-        if (string && strcmp(string, ""))
-        {
-            markup = g_markup_printf_escaped(MARKUP_STRING, string);
-            gtk_label_set_markup (GTK_LABEL(progress), markup);
-            g_free (markup);
-
-            /* make sure new text is up */
-            while (gtk_events_pending ())
-                gtk_main_iteration ();
-        }
-    }
-
-    if (progress_bar)
-    {
-        if (percentage < 0)
-        {
-            gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progress_bar), 0.0);
-        }
-        else
-        {
-            if (percentage <= 100)
-            {
-                gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progress_bar),
-                                              percentage / 100);
-            }
-            else
-            {
-                gtk_progress_bar_pulse(GTK_PROGRESS_BAR(progress_bar));
-            }
-        }
-
-        /* make sure new status bar is up */
-        while (gtk_events_pending ())
-            gtk_main_iteration ();
-    }
-}
diff --git a/src/gnome-utils/gnc-tree-control-split-reg.c b/src/gnome-utils/gnc-tree-control-split-reg.c
deleted file mode 100644
index 728f8ca..0000000
--- a/src/gnome-utils/gnc-tree-control-split-reg.c
+++ /dev/null
@@ -1,2173 +0,0 @@
-/********************************************************************\
- * gnc-tree-control-split-reg.c -- GtkTreeView implementation       *
- *                     to display registers in a GtkTreeView.       *
- *                                                                  *
- * Copyright (C) 2006-2007 Chris Shoemaker <c.shoemaker at cox.net>    *
- * Copyright (C) 2012 Robert Fewell                                 *
- *                                                                  *
- * 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 at gnu.org                   *
- *                                                                  *
-\********************************************************************/
-
-#include "config.h"
-
-#include <gtk/gtk.h>
-#include <glib/gi18n.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "gnc-tree-control-split-reg.h"
-#include "gnc-tree-model-split-reg.h"
-#include "gnc-tree-util-split-reg.h"
-#include "gnc-tree-view-split-reg.h"
-#include "gnc-component-manager.h"
-#include "gnc-ui.h"
-#include "gnc-prefs.h"
-#include "gnc-gdate-utils.h"
-#include "gnome-utils/gnc-warnings.h"
-#include "dialog-utils.h"
-#include "dialog-dup-trans.h"
-#include "dialog-account.h"
-
-#include "Transaction.h"
-#include "engine-helpers.h"
-#include "gnc-event.h"
-#include "Scrub.h"
-
-/** Static Globals *******************************************************/
-static QofLogModule log_module = GNC_MOD_LEDGER;
-
-/*****************************************************************************/
-/*****************************************************************************/
-
-/* Read only dialog */
-static gboolean
-gtc_sr_is_trans_readonly_and_warn (GncTreeViewSplitReg *view, Transaction *trans)
-{
-    GncTreeModelSplitReg *model;
-    GtkWidget *window;
-    GtkWidget *dialog;
-    const gchar *reason;
-    const gchar *title = _("Cannot modify or delete this transaction.");
-    const gchar *message_reason =
-        _("This transaction is marked read-only with the comment: '%s'");
-
-    if (!trans) return FALSE;
-
-    window = gnc_tree_view_split_reg_get_parent (view);
-    model = gnc_tree_view_split_reg_get_model_from_view (view);
-
-    if (xaccTransIsReadonlyByPostedDate (trans))
-    {
-        dialog = gtk_message_dialog_new (GTK_WINDOW (window),
-                                        0,
-                                        GTK_MESSAGE_ERROR,
-                                        GTK_BUTTONS_OK,
-                                        "%s", title);
-        gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
-                "%s", _("The date of this transaction is older than the \"Read-Only Threshold\" set for this book. "
-                        "This setting can be changed in File -> Properties -> Accounts."));
-        gtk_dialog_run (GTK_DIALOG (dialog));
-        gtk_widget_destroy (dialog);
-        return TRUE;
-    }
-
-    reason = xaccTransGetReadOnly (trans);
-    if (reason)
-    {
-        dialog = gtk_message_dialog_new (GTK_WINDOW (window),
-                                        0,
-                                        GTK_MESSAGE_ERROR,
-                                        GTK_BUTTONS_OK,
-                                        "%s", title);
-        gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
-                message_reason, reason);
-        gtk_dialog_run (GTK_DIALOG (dialog));
-        gtk_widget_destroy (dialog);
-        return TRUE;
-    }
-
-    if (gnc_tree_model_split_reg_get_read_only (model, trans))
-    {
-        dialog = gtk_message_dialog_new (GTK_WINDOW (window),
-                                        0,
-                                        GTK_MESSAGE_ERROR,
-                                        GTK_BUTTONS_OK,
-                                        "%s", title);
-        gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
-                "%s", _("You can not change this transaction, the Book or Register is set to Read Only."));
-        gtk_dialog_run (GTK_DIALOG (dialog));
-        gtk_widget_destroy (dialog);
-        return TRUE;
-    }
-    return FALSE;
-}
-
-
-/* Transaction is being edited dialog */
-#define gtc_sr_trans_open_and_warn gnc_tree_control_split_reg_trans_open_and_warn
-gboolean
-gnc_tree_control_split_reg_trans_open_and_warn (GncTreeViewSplitReg *view, Transaction *trans)
-{
-    Transaction *dirty_trans;
-    GtkWidget *window;
-    GtkWidget *dialog;
-    gint response;
-    const char *title = _("Save Transaction before proceeding?");
-    const char *message =
-            _("The current transaction has been changed. Would you like to "
-              "record the changes before proceeding, or cancel?");
-
-    window = gnc_tree_view_split_reg_get_parent (view);
-    dirty_trans = gnc_tree_view_split_reg_get_dirty_trans (view);
-
-    if (trans == dirty_trans)
-    {
-        dialog = gtk_message_dialog_new (GTK_WINDOW (window),
-                                        GTK_DIALOG_DESTROY_WITH_PARENT,
-                                        GTK_MESSAGE_QUESTION,
-                                        GTK_BUTTONS_CANCEL,
-                                        "%s", title);
-        gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
-                "%s", message);
-        gtk_dialog_add_button (GTK_DIALOG (dialog),
-                              _("_Record"), GTK_RESPONSE_ACCEPT);
-        response = gnc_dialog_run (GTK_DIALOG (dialog), GNC_PREF_WARN_REG_TRANS_MOD);
-        gtk_widget_destroy (dialog);
-
-        if (response != GTK_RESPONSE_ACCEPT)
-            return TRUE;
-
-        xaccTransCommitEdit (trans);
-        gnc_tree_view_split_reg_set_dirty_trans (view, NULL);
-
-        return FALSE;
-    }
-    else
-        return FALSE;
-}
-
-
-#define gtc_sr_trans_test_for_edit gnc_tree_control_split_reg_trans_test_for_edit
-gboolean
-gtc_sr_trans_test_for_edit (GncTreeViewSplitReg *view, Transaction *trans)
-{
-    GtkWidget *window;
-    Transaction *dirty_trans;
-
-    /* Make sure we have stopped editing */
-    gnc_tree_view_split_reg_finish_edit (view);
-
-    window = gnc_tree_view_split_reg_get_parent (view);
-
-    /* Get dirty_trans */
-    dirty_trans = gnc_tree_view_split_reg_get_dirty_trans (view);
-
-    /* We are being edited in a different register */
-    if (xaccTransIsOpen (trans) && (dirty_trans != trans))
-    {
-        gnc_error_dialog (window, "%s",
-                         _("This transaction is being edited in a different register."));
-        return TRUE;
-    }
-    return FALSE;
-}
-
-/*****************************************************************************/
-/*****************************************************************************/
-
-gboolean
-gnc_tree_control_split_reg_balance_trans (GncTreeViewSplitReg *view, Transaction *trans)
-{
-    GncTreeModelSplitReg *model;
-    GtkWidget *window;
-    int choice;
-    int default_value;
-    Account *default_account;
-    Account *other_account;
-    Account *root;
-    GList *radio_list = NULL;
-    const char *title   = _("Rebalance Transaction");
-    const char *message = _("The current transaction is not balanced.");
-    Split *split;
-    Split *other_split;
-    gboolean two_accounts;
-    gboolean multi_currency;
-
-
-    if (xaccTransIsBalanced (trans))
-        return FALSE;
-
-    window = gnc_tree_view_split_reg_get_parent (view);
-    model = gnc_tree_view_split_reg_get_model_from_view (view);
-
-    if (xaccTransUseTradingAccounts (trans))
-    {
-        MonetaryList *imbal_list;
-        gnc_monetary *imbal_mon;
-        imbal_list = xaccTransGetImbalance (trans);
-
-        /* See if the imbalance is only in the transaction's currency */
-        if (!imbal_list)
-            /* Value imbalance, but not commodity imbalance.  This shouldn't
-               be something that scrubbing can cause to happen.  Perhaps someone
-               entered invalid splits.  */
-            multi_currency = TRUE;
-        else
-        {
-            imbal_mon = imbal_list->data;
-            if (!imbal_list->next &&
-                    gnc_commodity_equiv(gnc_monetary_commodity(*imbal_mon),
-                                        xaccTransGetCurrency(trans)))
-                multi_currency = FALSE;
-            else
-                multi_currency = TRUE;
-        }
-
-        /* We're done with the imbalance list, the real work will be done
-           by xaccTransScrubImbalance which will get it again. */
-        gnc_monetary_list_free(imbal_list);
-    }
-    else
-        multi_currency = FALSE;
-
-    split = xaccTransGetSplit (trans, 0);
-    other_split = xaccSplitGetOtherSplit (split);
-
-    if (other_split == NULL)
-    {
-        /* Attempt to handle the inverted many-to-one mapping */
-        split = xaccTransGetSplit (trans, 1);
-        if (split) other_split = xaccSplitGetOtherSplit (split);
-        else split = xaccTransGetSplit (trans, 0);
-    }
-    if (other_split == NULL || multi_currency)
-    {
-        two_accounts = FALSE;
-        other_account = NULL;
-    }
-    else
-    {
-        two_accounts = TRUE;
-        other_account = xaccSplitGetAccount (other_split);
-    }
-
-    default_account = gnc_tree_model_split_reg_get_anchor (model);
-
-    /* If the two pointers are the same, the account from other_split
-     * is actually the default account. We must make other_account
-     * the account from split instead.   */
-
-    if (default_account == other_account)
-        other_account = xaccSplitGetAccount (split);
-
-    /*  If the two pointers are still the same, we have two splits, but
-     *  they both refer to the same account. While non-sensical, we don't
-     *  object.   */
-
-    if (default_account == other_account)
-        two_accounts = FALSE;
-
-    radio_list = g_list_append (radio_list,
-                                _("Balance it _manually"));
-    radio_list = g_list_append (radio_list,
-                                _("Let GnuCash _add an adjusting split"));
-
-    if (model->type < NUM_SINGLE_REGISTER_TYPES2 && !multi_currency)
-    {
-        radio_list = g_list_append (radio_list,
-                                    _("Adjust current account _split total"));
-
-        default_value = 2;
-        if (two_accounts)
-        {
-            radio_list = g_list_append (radio_list,
-                                        _("Adjust _other account split total"));
-            default_value = 3;
-        }
-    }
-    else
-        default_value = 0;
-
-    choice = gnc_choose_radio_option_dialog
-             (window,
-              title,
-              message,
-              _("_Rebalance"),
-              default_value,
-              radio_list);
-
-    g_list_free (radio_list);
-
-    root = gnc_account_get_root(default_account);
-    switch (choice)
-    {
-    default:
-    case 0:
-        return TRUE;
-        break;
-
-    case 1:
-        xaccTransScrubImbalance (trans, root, NULL);
-        break;
-
-    case 2:
-        xaccTransScrubImbalance (trans, root, default_account);
-        break;
-
-    case 3:
-        xaccTransScrubImbalance (trans, root, other_account);
-        break;
-    }
-    return FALSE;
-}
-
-
-/* Cancel the edit and Rollback */
-void
-gnc_tree_control_split_reg_cancel_edit (GncTreeViewSplitReg *view, gboolean reg_closing)
-{
-    /* Make sure we have stopped editing */
-    gnc_tree_view_split_reg_finish_edit (view);
-
-    gnc_tree_view_split_reg_cancel_edit (view, reg_closing);
-}
-
-
-/* Amend the Exchange Rate of the transaction */
-void
-gnc_tree_control_split_reg_exchange_rate (GncTreeViewSplitReg *view)
-{
-    GncTreeModelSplitReg *model;
-    GtkWidget *window;
-    Account *anchor;
-    Transaction *trans;
-    Split *split = NULL;
-    Split *osplit = NULL;
-    gnc_numeric value;
-    gboolean expanded;
-    gint depth;
-    gint num_splits;
-    const char *message;
-    gnc_commodity *txn_com;
-
-    model = gnc_tree_view_split_reg_get_model_from_view (view);
-
-    trans = gnc_tree_view_split_reg_get_current_trans (view);
-    expanded = gnc_tree_view_split_reg_trans_expanded (view, NULL);
-    depth = gnc_tree_view_reg_get_selected_row_depth (view);
-    num_splits = xaccTransCountSplits (trans);
-    anchor = gnc_tree_model_split_reg_get_anchor (model);
-    txn_com = xaccTransGetCurrency (trans);
-
-    if (trans == NULL)
-        return;
-
-    /* See if we were asked to change a blank trans. */
-    if (trans == gnc_tree_control_split_reg_get_blank_trans (view))
-        return;
-
-    /* Test for read only */
-    if (gtc_sr_is_trans_readonly_and_warn (view, trans))
-        return;
-
-    /* See if we are being edited in another register */
-    if (gtc_sr_trans_test_for_edit (view, trans))
-        return;
-
-    /* Make sure we ask to commit any changes before we proceed */
-    if (gtc_sr_trans_open_and_warn (view, trans))
-        return;
-
-    if (num_splits < 2)
-        return;
-
-    window = gnc_tree_view_split_reg_get_parent (view);
-
-    /* Make sure we NEED this for this type of register */
-    if (!gnc_tree_util_split_reg_has_rate (view))
-    {
-        message = _("This register does not support editing exchange rates.");
-        gnc_error_dialog(window, "%s", message);
-        return;
-    }
-
-    /* If the anchor commodity is not a currency, cancel */
-    if (anchor && !gnc_commodity_is_currency (xaccAccountGetCommodity (anchor)))
-    {
-        message = _("This register does not support editing exchange rates.");
-        gnc_error_dialog (window, "%s", message);
-        return;
-    }
-
-    /* If we're not expanded AND number of splits greater than two, nothing to do */
-    if ((gnc_tree_util_split_reg_is_multi (xaccTransGetSplit (trans, 0))) && !expanded)
-    {
-        message = _("You need to expand the transaction in order to modify its "
-                    "exchange rates.");
-        gnc_error_dialog (window, "%s", message);
-        return;
-    }
-
-    if (!gnc_tree_util_split_reg_is_multi (xaccTransGetSplit (trans, 0)) && anchor != NULL && !expanded)
-    {
-        split = gnc_tree_control_split_reg_get_current_trans_split (view);
-
-        if (xaccAccountGetType (xaccSplitGetAccount (split)) == ACCT_TYPE_TRADING) // trading split
-            return;
-
-        osplit = xaccSplitGetOtherSplit (split);
-
-        value = xaccSplitGetValue (split);
-
-        gnc_tree_view_split_reg_set_dirty_trans (view, trans);
-        xaccTransBeginEdit (trans);
-
-        if (txn_com == xaccAccountGetCommodity (xaccSplitGetAccount(split)))
-           gnc_tree_util_split_reg_set_value_for (view, trans, osplit, gnc_numeric_neg (value), TRUE);
-        else
-           gnc_tree_util_split_reg_set_value_for (view, trans, split, value, TRUE);
-
-        xaccTransCommitEdit (trans);
-        gnc_tree_view_split_reg_set_dirty_trans (view, NULL);
-    }
-
-    if (num_splits > 1 && expanded && depth == 3)
-    {
-        split = gnc_tree_view_split_reg_get_current_split (view);
-
-        if (xaccAccountGetType (xaccSplitGetAccount (split)) == ACCT_TYPE_TRADING) // trading split
-            return;
-
-        value = xaccSplitGetValue (split);
-
-        if (txn_com == xaccAccountGetCommodity (xaccSplitGetAccount(split)))
-        {
-            message = _("The two currencies involved equal each other.");
-            gnc_error_dialog (window, "%s", message);
-            return;
-        }
-        else
-        {
-            gnc_tree_view_split_reg_set_dirty_trans (view, trans);
-            xaccTransBeginEdit (trans);
-
-            gnc_tree_util_split_reg_set_value_for (view, trans, split, value, TRUE);
-
-            xaccTransCommitEdit (trans);
-            gnc_tree_view_split_reg_set_dirty_trans (view, NULL);
-        }
-    }
-}
-
-
-/* Void current transaction */
-void
-gnc_tree_control_split_reg_void_current_trans (GncTreeViewSplitReg *view, const char *reason)
-{
-    Transaction *trans;
-    Split *blank_split;
-    Split *split;
-
-    if (!view) return;
-
-    blank_split = gnc_tree_control_split_reg_get_blank_split (view);
-
-    /* get the current split */
-    split = gnc_tree_view_split_reg_get_current_split (view);
-    if (split == NULL)
-        return;
-
-    /* Bail if trying to void the blank split. */
-    if (split == blank_split)
-        return;
-
-    /* already voided. */
-    if (xaccSplitGetReconcile (split) == VREC)
-        return;
-
-    trans = xaccSplitGetParent (split);
-
-    if (trans == NULL)
-        return;
-
-    /* See if we were asked to change a blank trans. */
-    if (trans == gnc_tree_control_split_reg_get_blank_trans (view))
-        return;
-
-    /* Test for read only */
-    if (gtc_sr_is_trans_readonly_and_warn (view, trans))
-        return;
-
-    /* See if we are being edited in another register */
-    if (gtc_sr_trans_test_for_edit (view, trans))
-        return;
-
-    /* Make sure we ask to commit any changes before we proceed */
-    if (gtc_sr_trans_open_and_warn (view, trans))
-        return;
-
-    gnc_tree_view_split_reg_set_dirty_trans (view, trans);
-
-    xaccTransVoid (trans, reason);
-
-    if (xaccTransIsOpen (trans))
-    {
-        PERR("We should not be voiding an open transaction.");
-        xaccTransCommitEdit (trans);
-    }
-    gnc_tree_view_split_reg_set_dirty_trans (view, NULL);
-}
-
-
-/* Unvoid current transaction */
-void
-gnc_tree_control_split_reg_unvoid_current_trans (GncTreeViewSplitReg *view)
-{
-    Transaction *trans;
-    Split *blank_split;
-    Split *split;
-
-    if (!view) return;
-
-    blank_split = gnc_tree_control_split_reg_get_blank_split (view);
-
-    /* get the current split based on cursor position */
-    split = gnc_tree_view_split_reg_get_current_split (view);
-    if (split == NULL)
-        return;
-
-    /* Bail if trying to unvoid the blank split. */
-    if (split == blank_split)
-        return;
-
-    /* not voided. */
-    if (xaccSplitGetReconcile (split) != VREC)
-        return;
-
-    trans = xaccSplitGetParent (split);
-
-    if (trans == NULL)
-        return;
-
-    /* See if we were asked to change a blank trans. */
-    if (trans == gnc_tree_control_split_reg_get_blank_trans (view))
-        return;
-
-    gnc_tree_view_split_reg_set_dirty_trans (view, trans);
-
-    xaccTransUnvoid (trans);
-
-    gnc_tree_view_split_reg_set_dirty_trans (view, NULL);
-}
-
-
-/* Jump to the Blank transaction */
-gboolean
-gnc_tree_control_split_reg_jump_to_blank (GncTreeViewSplitReg *view)
-{
-    GncTreeModelSplitReg *model;
-    GtkTreePath *mpath, *spath;
-    Transaction *btrans;
-
-    model = gnc_tree_view_split_reg_get_model_from_view (view);
-
-    btrans = gnc_tree_model_split_get_blank_trans (model);
-
-    model->current_trans = btrans;
-
-    if (!gnc_tree_model_split_reg_trans_is_in_view (model, btrans))
-        g_signal_emit_by_name (model, "refresh_trans");
-    else
-    {
-        mpath = gnc_tree_model_split_reg_get_path_to_split_and_trans (model, NULL, btrans);
-
-        spath = gnc_tree_view_split_reg_get_sort_path_from_model_path (view, mpath);
-
-        /* Set cursor to new spath */
-        gtk_tree_view_set_cursor (GTK_TREE_VIEW (view), spath, NULL, FALSE);
-
-        gtk_tree_path_free (spath);
-        gtk_tree_path_free (mpath);
-
-        /* scroll when view idle */
-        g_idle_add ((GSourceFunc)gnc_tree_view_split_reg_scroll_to_cell, view );
-    }
-    return FALSE;
-}
-
-
-/* Jump to transaction or split */
-void
-gnc_tree_control_split_reg_jump_to (GncTreeViewSplitReg *view, Transaction *trans, Split *split, gboolean amount)
-{
-    GncTreeModelSplitReg *model;
-    GtkTreePath *mpath, *spath;
-
-    model = gnc_tree_view_split_reg_get_model_from_view (view);
-
-    if (split)
-        trans = NULL;
-
-    mpath = gnc_tree_model_split_reg_get_path_to_split_and_trans (model, split, trans);
-
-    spath = gnc_tree_view_split_reg_get_sort_path_from_model_path (view, mpath);
-
-    if (split)
-        gnc_tree_view_split_reg_expand_trans (view, xaccSplitGetParent (split));
-
-    /* Set cursor to new spath, if amount, cursor is set to correct column ready for editing */
-    if (amount)
-    {
-        GtkCellRenderer *cr0;
-        GList *renderers;
-        GList *columns;
-        GList  *column;
-        gint i;
-
-        columns = gtk_tree_view_get_columns (GTK_TREE_VIEW (view));
-
-        for (column = columns, i = 1; column; column = g_list_next (column), i++)
-        {
-            GtkTreeViewColumn *tvc;
-            ViewCol viewcol;
-
-            tvc = column->data;
-
-            // Get the first renderer, it has the view-column value.
-            renderers = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (tvc));
-            cr0 = g_list_nth_data (renderers, 0);
-            g_list_free (renderers);
-
-            viewcol = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (cr0), "view_column"));
-
-            if (viewcol == COL_DEBIT && gnc_numeric_positive_p (xaccSplitGetAmount (split)))
-                gtk_tree_view_set_cursor (GTK_TREE_VIEW (view), spath, tvc, TRUE);
-
-            if (viewcol == COL_CREDIT && gnc_numeric_negative_p (xaccSplitGetAmount (split)))
-                gtk_tree_view_set_cursor (GTK_TREE_VIEW (view), spath, tvc, TRUE);
-        }
-        g_list_free (columns);
-    }
-    else
-        gtk_tree_view_set_cursor (GTK_TREE_VIEW (view), spath, NULL, FALSE);
-
-    /* Scroll to cell, mid view */
-    gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (view), spath, NULL, TRUE, 0.5, 0.0);
-
-    gtk_tree_path_free (spath);
-    gtk_tree_path_free (mpath);
-}
-
-
-/* Returns the Blank Transaction */
-Transaction *
-gnc_tree_control_split_reg_get_blank_trans (GncTreeViewSplitReg *view)
-{
-    GncTreeModelSplitReg *model;
-
-    model = gnc_tree_view_split_reg_get_model_from_view (view);
-
-    return gnc_tree_model_split_get_blank_trans (model);
-}
-
-
-/* Return the Split for the current Transaction */
-Split *
-gnc_tree_control_split_reg_get_current_trans_split (GncTreeViewSplitReg *view)
-{
-    GncTreeModelSplitReg *model;
-    GtkTreePath *mpath;
-    GtkTreeIter m_iter;
-    Split *split = NULL;
-    Transaction *trans = NULL;
-    Account *anchor;
-    gboolean is_trow1, is_trow2, is_split, is_blank;
-
-    model = gnc_tree_view_split_reg_get_model_from_view (view);
-
-    mpath = gnc_tree_view_split_reg_get_current_path (view);
-
-    gtk_tree_model_get_iter (GTK_TREE_MODEL (model), &m_iter, mpath);
-
-    gnc_tree_model_split_reg_get_split_and_trans (
-            GNC_TREE_MODEL_SPLIT_REG (model), &m_iter, &is_trow1, &is_trow2, &is_split, &is_blank, &split, &trans);
-
-    anchor = gnc_tree_model_split_reg_get_anchor (model);
-
-    split = gnc_tree_model_split_reg_trans_get_split_equal_to_ancestor (trans, anchor);
-
-    gtk_tree_path_free (mpath);
-
-    return split;
-}
-
-
-/* Returns the Blank Split */
-Split *
-gnc_tree_control_split_reg_get_blank_split (GncTreeViewSplitReg *view)
-{
-    GncTreeModelSplitReg *model;
-
-    model = gnc_tree_view_split_reg_get_model_from_view (view);
-
-    return gnc_tree_model_split_get_blank_split (model);
-}
-
-
-/* Move to the relative transaction */
-void
-gnc_tree_control_split_reg_goto_rel_trans_row (GncTreeViewSplitReg *view, gint relative)
-{
-    GncTreeModelSplitReg *model;
-    GtkTreePath *mpath, *spath;
-    GtkTreePath  *new_mpath, *new_spath;
-    gint *indices, sort_direction;
-    gchar *sstring;
-
-    ENTER("Move relative, view is %p, relative is %d", view, relative);
-
-//FIXME Do we need to do some checks on relative maybe  -1,0,1 ??
-
-    model = gnc_tree_view_split_reg_get_model_from_view (view);
-
-    mpath = gnc_tree_view_split_reg_get_current_path (view);
-
-    spath = gnc_tree_view_split_reg_get_sort_path_from_model_path (view, mpath);
-
-    indices = gtk_tree_path_get_indices (spath);
-
-    if (model->sort_direction == GTK_SORT_DESCENDING)
-        sort_direction = -1;
-    else
-        sort_direction = 1;
-
-    new_spath = gtk_tree_path_new_from_indices (indices[0] + (relative * sort_direction), -1);
-
-    // if relative == 0 we block all selection changes
-    gnc_tree_view_split_reg_block_selection (view, TRUE);
-    gtk_tree_selection_unselect_path (gtk_tree_view_get_selection (GTK_TREE_VIEW (view)), spath);
-
-    if (relative != 0)
-        gnc_tree_view_split_reg_block_selection (view, FALSE);
-
-    /* Set cursor to new spath */
-    gtk_tree_view_set_cursor (GTK_TREE_VIEW (view), new_spath, NULL, FALSE);
-
-    if (relative == 0)
-    {
-        gnc_tree_view_split_reg_block_selection (view, FALSE);
-
-        /* Get the new model path we are pointing at */
-        new_mpath = gnc_tree_view_split_reg_get_model_path_from_sort_path (view, new_spath);
-
-        /* As we are not emitting selection change, we need to save the current path ref */
-        gnc_tree_view_split_reg_set_current_path (view, new_mpath);
-        gtk_tree_path_free (new_mpath);
-    }
-
-    sstring = gtk_tree_path_to_string (new_spath);
-    LEAVE("new_spath is %s", sstring);
-    g_free (sstring);
-
-    gtk_tree_path_free (new_spath);
-    gtk_tree_path_free (mpath);
-    gtk_tree_path_free (spath);
-}
-
-
-/* Enter the transaction */
-void
-gnc_tree_control_split_reg_enter (GncTreeViewSplitReg *view)
-{
-    GncTreeModelSplitReg *model;
-    Transaction *btrans, *ctrans;
-    gboolean goto_blank = FALSE;
-    gboolean next_trans = TRUE;
-
-    model = gnc_tree_view_split_reg_get_model_from_view (view);
-
-    goto_blank = gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL_REGISTER,
-                                     GNC_PREF_ENTER_MOVES_TO_END);
-
-    ENTER("view=%p, goto_blank = %s", view, goto_blank ? "TRUE" : "FALSE");
-
-    btrans = gnc_tree_model_split_get_blank_trans (model);
-
-    ctrans = gnc_tree_view_split_reg_get_current_trans (view);
-
-    /* Are we on the blank transaction */
-    if (btrans == ctrans)
-        next_trans = FALSE;
-
-    /* First record the transaction */
-    if (gnc_tree_view_split_reg_enter (view))
-    {
-        /* Now move. */
-        if (goto_blank)
-            gnc_tree_control_split_reg_jump_to_blank (view);
-        else if (next_trans)
-            gnc_tree_control_split_reg_goto_rel_trans_row (view, 1);
-    }
-    LEAVE(" ");
-}
-
-
-/* Reinit the transaction */
-void
-gnc_tree_control_split_reg_reinit (GncTreeViewSplitReg *view, gpointer data)
-{
-    Transaction *trans;
-    GtkWidget *dialog, *window;
-    gint response;
-    const gchar *warning;
-
-    const char *title = _("Remove the splits from this transaction?");
-    const char *recn_warn = _("This transaction contains reconciled splits. "
-                              "Modifying it is not a good idea because that will "
-                              "cause your reconciled balance to be off.");
-
-    trans = gnc_tree_view_split_reg_get_current_trans (view);
-
-    if (trans == NULL)
-        return;
-
-    /* See if we were asked to change a blank trans. */
-    if (trans == gnc_tree_control_split_reg_get_blank_trans (view))
-        return;
-
-    /* Test for read only */
-    if (gtc_sr_is_trans_readonly_and_warn (view, trans))
-        return;
-
-    /* See if we are being edited in another register */
-    if (gtc_sr_trans_test_for_edit (view, trans))
-        return;
-
-    /* Make sure we ask to commit any changes before we proceed */
-    if (gtc_sr_trans_open_and_warn (view, trans))
-        return;
-
-    window = gnc_tree_view_split_reg_get_parent (view);
-
-    dialog = gtk_message_dialog_new (GTK_WINDOW (window),
-                                    GTK_DIALOG_DESTROY_WITH_PARENT,
-                                    GTK_MESSAGE_WARNING,
-                                    GTK_BUTTONS_NONE,
-                                    "%s", title);
-
-    if (xaccTransHasReconciledSplits (trans))
-    {
-        gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
-                "%s", recn_warn);
-        warning = GNC_PREF_WARN_REG_SPLIT_DEL_ALL_RECD;
-    }
-    else
-    {
-        warning = GNC_PREF_WARN_REG_SPLIT_DEL_ALL;
-    }
-
-    gtk_dialog_add_button (GTK_DIALOG (dialog),
-                          _("_Cancel"), GTK_RESPONSE_CANCEL);
-    gnc_gtk_dialog_add_button(dialog, _("_Remove Splits"),
-                              "edit-delete", GTK_RESPONSE_ACCEPT);
-    response = gnc_dialog_run (GTK_DIALOG(dialog), warning);
-    gtk_widget_destroy (dialog);
-    if (response != GTK_RESPONSE_ACCEPT)
-        return;
-
-    gnc_tree_view_split_reg_reinit_trans (view);
-}
-
-
-/* Delete the currently selected item */
-void
-gnc_tree_control_split_reg_delete (GncTreeViewSplitReg *view, gpointer data)
-{
-    GncTreeModelSplitReg *model;
-    Account *anchor;
-    RowDepth depth;
-    Transaction *trans;
-    Split *split;
-    GtkWidget *dialog, *window;
-    gint response;
-    const gchar *warning;
-
-    /* get the current split based on cursor position */
-    split = gnc_tree_view_split_reg_get_current_split (view);
-    if (split == NULL)
-    {
-        split = gnc_tree_control_split_reg_get_current_trans_split (view);
-        if (split == NULL)
-        {
-            LEAVE("split is NULL");
-            return;
-        }
-    }
-
-    model = gnc_tree_view_split_reg_get_model_from_view (view);
-
-    anchor = gnc_tree_model_split_reg_get_anchor (model);
-
-    trans = xaccSplitGetParent (split);
-
-    if (trans == NULL)
-        return;
-
-    /* Test for read only */
-    if (gtc_sr_is_trans_readonly_and_warn (view, trans))
-        return;
-
-    /* See if we are being edited in another register */
-    if (gtc_sr_trans_test_for_edit (view, trans))
-        return;
-
-    depth = gnc_tree_view_reg_get_selected_row_depth (view);
-
-    /* Deleting the blank split just cancels */
-    {
-        Split *blank_split = gnc_tree_control_split_reg_get_blank_split (view);
-
-        if (split == blank_split)
-            return;
-    }
-
-    /* Deleting the blank trans just cancels */
-    {
-        Transaction *blank_trans = gnc_tree_control_split_reg_get_blank_trans (view);
-
-        if (trans == blank_trans)
-            return;
-    }
-
-    window = gnc_tree_view_split_reg_get_parent (view);
-
-    /* On a split cursor, just delete the one split. */
-    if (depth == SPLIT3)
-    {
-        const char *format = _("Delete the split '%s' from the transaction '%s'?");
-        const char *recn_warn = _("You would be deleting a reconciled split! "
-                                  "This is not a good idea as it will cause your "
-                                  "reconciled balance to be off.");
-        const char *anchor_error = _("You cannot delete this split.");
-        const char *anchor_split = _("This is the split anchoring this transaction "
-                                     "to the register. You may not delete it from "
-                                     "this register window. You may delete the "
-                                     "entire transaction from this window, or you "
-                                     "may navigate to a register that shows "
-                                     "another side of this same transaction and "
-                                     "delete the split from that register.");
-        char *buf = NULL;
-        const char *memo;
-        const char *desc;
-        char recn;
-        if ((split == gnc_tree_control_split_reg_get_current_trans_split (view)) ||
-            (split == gnc_tree_model_split_reg_trans_get_split_equal_to_ancestor (trans, anchor)))
-        {
-            dialog = gtk_message_dialog_new (GTK_WINDOW (window),
-                                            GTK_DIALOG_MODAL
-                                            | GTK_DIALOG_DESTROY_WITH_PARENT,
-                                            GTK_MESSAGE_ERROR,
-                                            GTK_BUTTONS_OK,
-                                            "%s", anchor_error);
-            gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
-                    "%s", anchor_split);
-            gtk_dialog_run (GTK_DIALOG (dialog));
-            gtk_widget_destroy (dialog);
-            return;
-        }
-
-        memo = xaccSplitGetMemo (split);
-        memo = (memo && *memo) ? memo : _("(no memo)");
-
-        desc = xaccTransGetDescription (trans);
-        desc = (desc && *desc) ? desc : _("(no description)");
-
-        /* ask for user confirmation before performing permanent damage */
-        buf = g_strdup_printf (format, memo, desc);
-        dialog = gtk_message_dialog_new (GTK_WINDOW (window),
-                                        GTK_DIALOG_MODAL
-                                        | GTK_DIALOG_DESTROY_WITH_PARENT,
-                                        GTK_MESSAGE_QUESTION,
-                                        GTK_BUTTONS_NONE,
-                                        "%s", buf);
-        g_free(buf);
-        recn = xaccSplitGetReconcile (split);
-        if (recn == YREC || recn == FREC)
-        {
-            gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
-                    "%s", recn_warn);
-            warning = GNC_PREF_WARN_REG_SPLIT_DEL_RECD;
-        }
-        else
-        {
-            warning = GNC_PREF_WARN_REG_SPLIT_DEL;
-        }
-
-        gtk_dialog_add_button (GTK_DIALOG (dialog),
-                              _("_Cancel"), GTK_RESPONSE_CANCEL);
-        gnc_gtk_dialog_add_button (dialog, _("_Delete Split"),
-                                  "edit-delete", GTK_RESPONSE_ACCEPT);
-        response = gnc_dialog_run (GTK_DIALOG (dialog), warning);
-        gtk_widget_destroy (dialog);
-        if (response != GTK_RESPONSE_ACCEPT)
-            return;
-
-        gnc_tree_view_split_reg_delete_current_split (view);
-        return;
-    }
-
-    g_return_if_fail (depth == TRANS1 || depth == TRANS2);
-
-    /* On a transaction cursor with 2 or fewer splits in single or double
-     * mode, we just delete the whole transaction, kerblooie */
-    {
-        const char *title = _("Delete the current transaction?");
-        const char *recn_warn = _("You would be deleting a transaction "
-                                  "with reconciled splits! "
-                                  "This is not a good idea as it will cause your "
-                                  "reconciled balance to be off.");
-
-        dialog = gtk_message_dialog_new (GTK_WINDOW (window),
-                                        GTK_DIALOG_MODAL
-                                        | GTK_DIALOG_DESTROY_WITH_PARENT,
-                                        GTK_MESSAGE_WARNING,
-                                        GTK_BUTTONS_NONE,
-                                        "%s", title);
-        if (xaccTransHasReconciledSplits (trans))
-        {
-            gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
-                    "%s", recn_warn);
-            warning = GNC_PREF_WARN_REG_TRANS_DEL_RECD;
-        }
-        else
-        {
-            warning = GNC_PREF_WARN_REG_TRANS_DEL;
-        }
-        gtk_dialog_add_button (GTK_DIALOG (dialog),
-                              _("_Cancel"), GTK_RESPONSE_CANCEL);
-        gnc_gtk_dialog_add_button (dialog, _("_Delete Transaction"),
-                                  "edit-delete", GTK_RESPONSE_ACCEPT);
-        response =  gnc_dialog_run (GTK_DIALOG (dialog), warning);
-        gtk_widget_destroy (dialog);
-        if (response != GTK_RESPONSE_ACCEPT)
-            return;
-
-        gnc_tree_view_split_reg_delete_current_trans (view);
-        return;
-    }
-}
-
-
-/* Add Reverse Transaction */
-void
-gnc_tree_control_split_reg_reverse_current (GncTreeViewSplitReg *view)
-{
-    GtkWidget *window;
-    Transaction *trans = NULL, *new_trans = NULL;
-    GList *snode = NULL;
-
-    ENTER(" ");
-
-    trans = gnc_tree_view_split_reg_get_current_trans (view);
-
-    if (trans == NULL)
-    {
-        LEAVE("Trans is Null");
-        return;
-    }
-
-    /* See if we were asked to reverse a blank trans. */
-    if (trans == gnc_tree_control_split_reg_get_blank_trans (view))
-    {
-        LEAVE("Skip blank trans");
-        return;
-    }
-
-    /* Test for read only */
-    if (gtc_sr_is_trans_readonly_and_warn (view, trans))
-    {
-        LEAVE("Read only");
-        return;
-    }
-
-    /* See if we are being edited in another register */
-    if (gtc_sr_trans_test_for_edit (view, trans))
-    {
-        LEAVE("Open in different register");
-        return;
-    }
-
-    window = gnc_tree_view_split_reg_get_parent (view);
-
-    if (xaccTransGetReversedBy (trans))
-    {
-        gnc_error_dialog (window, "%s",
-                         _("A reversing entry has already been created for this transaction."));
-        LEAVE("Already have reversing transaction");
-        return;
-    }
-
-    /* Make sure we ask to commit any changes before we add reverse transaction */
-    if (gtc_sr_trans_open_and_warn (view, trans))
-    {
-        LEAVE("save cancelled");
-        return;
-    }
-
-    /* Create reverse transaction */
-    new_trans = xaccTransReverse (trans);
-
-    xaccTransBeginEdit (new_trans);
-
-    /* Clear transaction level info */
-    xaccTransSetDatePostedSecsNormalized (new_trans, gnc_time (NULL));
-    xaccTransSetDateEnteredSecs (new_trans, gnc_time (NULL));
-
-    xaccTransCommitEdit (new_trans);
-
-    // We need to loop through the splits and send an event to update the register.
-    for (snode = xaccTransGetSplitList (new_trans); snode; snode = snode->next)
-    {
-        if (xaccTransStillHasSplit (new_trans, snode->data))
-        {
-           /* Send an event based on the split account */
-           qof_event_gen (QOF_INSTANCE (xaccSplitGetAccount(snode->data)), GNC_EVENT_ITEM_ADDED, snode->data);
-        }
-    }
-
-    /* give gtk+ a chance to handle pending events */
-    while (gtk_events_pending ())
-        gtk_main_iteration ();
-
-    /* Now jump to new trans */
-    gnc_tree_control_split_reg_jump_to (view, NULL, xaccTransGetSplit (new_trans, 0), FALSE);
-
-    LEAVE("Reverse transaction created");
-}
-
-
-/* Duplicate the current selection */
-gboolean
-gnc_tree_control_split_reg_duplicate_current (GncTreeViewSplitReg *view)
-{
-    GncTreeModelSplitReg *model;
-    GtkWidget *window;
-    RowDepth depth;
-    Transaction *trans;
-    Split *blank_split;
-    Split *split, *trans_split;
-    gboolean use_split_action_for_num_field = FALSE;
-
-    ENTER("");
-
-    model = gnc_tree_view_split_reg_get_model_from_view (view);
-
-    blank_split = gnc_tree_control_split_reg_get_blank_split (view);
-    split = gnc_tree_view_split_reg_get_current_split (view);
-    trans_split = gnc_tree_control_split_reg_get_current_trans_split (view);
-
-
-    depth = gnc_tree_view_reg_get_selected_row_depth (view);
-
-    use_split_action_for_num_field = qof_book_use_split_action_for_num_field (gnc_get_current_book());
-
-    trans = gnc_tree_view_split_reg_get_current_trans (view);
-
-    /* This shouldn't happen, but be paranoid. */
-    if (trans == NULL)
-        return FALSE;
-
-    /* See if we were asked to change a blank trans. */
-    if (trans == gnc_tree_control_split_reg_get_blank_trans (view))
-    {
-        LEAVE("Skip blank trans");
-        return FALSE;
-    }
-
-    /* See if we were asked to change a blank split. */
-    if (split == blank_split)
-    {
-        LEAVE("Skip blank split");
-        return FALSE;
-    }
-
-    /* Test for read only */
-    if (gtc_sr_is_trans_readonly_and_warn (view, trans))
-    {
-        LEAVE("Read only");
-        return FALSE;
-    }
-
-    /* See if we are being edited in another register */
-    if (gtc_sr_trans_test_for_edit (view, trans))
-    {
-        LEAVE("Open in different register");
-        return FALSE;
-    }
-
-    /* Make sure we ask to commit any changes before we proceed */
-    if (gtc_sr_trans_open_and_warn (view, trans))
-    {
-        LEAVE("save cancelled");
-        return FALSE;
-    }
-
-    window = gnc_tree_view_split_reg_get_parent (view);
-
-    /* Ok, we are now ready to make the copy. */
-    if (depth == SPLIT3)
-    {
-        Split *new_split;
-        gboolean new_act_num = FALSE;
-        char *out_num;
-        time64 date;
-
-        /* We are on a split in an expanded transaction.
-         * Just copy the split and add it to the transaction.
-         * However, if the split-action field is being used as the register 
-         * number, and the action field is a number, request a new value or
-         * cancel. Need to get next number and update account last num from
-         * split account not register account, which may be the same or not */
-
-        if (split != trans_split)
-        {
-            if (use_split_action_for_num_field && gnc_strisnum (gnc_get_num_action (NULL, split)))
-            {
-                Account *account = xaccSplitGetAccount (split);
-                const char* title = _("New Split Information");
-                const char *in_num = NULL;
-                date = time (0);
-
-                if (account)
-                    in_num = xaccAccountGetLastNum (account);
-                else
-                    in_num = gnc_get_num_action (NULL, split);
-
-                if (!gnc_dup_trans_dialog (window, title, FALSE,
-                                           &date, in_num, &out_num, NULL, NULL))
-                {
-                    LEAVE("dup cancelled");
-                    return FALSE;
-                }
-                new_act_num = TRUE;
-            }
-
-            new_split = xaccMallocSplit (gnc_get_current_book ());
-
-            // Remove the blank split
-            gnc_tree_model_split_reg_set_blank_split_parent (model, trans, TRUE);
-
-            if (!xaccTransIsOpen (trans))
-                xaccTransBeginEdit (trans);
-            gnc_tree_view_split_reg_set_dirty_trans (view, trans);
-
-            xaccSplitCopyOnto (split, new_split);
-            xaccSplitSetParent (new_split, trans);
-
-            // Add the blank split
-            gnc_tree_model_split_reg_set_blank_split_parent (model, trans, FALSE);
-
-            if (new_act_num) /* if new number supplied by user dialog */
-                gnc_set_num_action (NULL, new_split, out_num, NULL);
-
-            if (new_act_num && gnc_strisnum (out_num))
-            {
-                Account *account = xaccSplitGetAccount (new_split);
-
-                /* If current register is for account, set last num */
-                if (account == gnc_tree_model_split_reg_get_anchor (model))
-                    xaccAccountSetLastNum (account, out_num);
-            }
-            if (new_act_num)
-                g_free (out_num);
-        }
-        else
-        {
-            gnc_error_dialog (window, "%s",
-                         _("This is the split anchoring this transaction to the register."
-                           " You can not duplicate it from this register window."));
-            LEAVE("split anchoring this transaction");
-            return FALSE;
-        }
-    }
-    else
-    {
-        Transaction *new_trans;
-        int trans_split_index;
-        const char *in_num = NULL;
-        const char *in_tnum = NULL;
-        char *out_num;
-        char *out_tnum;
-        time64 date;
-        gboolean use_autoreadonly = qof_book_uses_autoreadonly (gnc_get_current_book());
-
-        /* We are on a transaction row. Copy the whole transaction. */
-
-        date = time (0);
-        if (gnc_strisnum (gnc_get_num_action (trans, trans_split)))
-        {
-            Account *account = gnc_tree_model_split_reg_get_anchor (model);
-
-            if (account)
-                in_num = xaccAccountGetLastNum (account);
-            else
-                in_num = gnc_get_num_action (trans, trans_split);
-        }
-
-        in_tnum = (use_split_action_for_num_field
-                                        ? gnc_get_num_action (trans, NULL)
-                                        : NULL);
-
-        if (!gnc_dup_trans_dialog (window, NULL, TRUE,
-                                   &date, in_num, &out_num, in_tnum, &out_tnum))
-        {
-            LEAVE("dup cancelled");
-            return FALSE;
-        }
-
-        if (use_autoreadonly)
-        {
-            GDate d;
-            GDate *readonly_threshold = qof_book_get_autoreadonly_gdate (gnc_get_current_book());
-            gnc_gdate_set_time64 (&d, date);
-            if (g_date_compare (&d, readonly_threshold) < 0)
-            {
-                GtkWidget *dialog = gtk_message_dialog_new (GTK_WINDOW (window),
-                                    0,
-                                    GTK_MESSAGE_ERROR,
-                                    GTK_BUTTONS_OK,
-                                    "%s", _("Cannot store a transaction at this date"));
-                gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
-                        "%s", _("The entered date of the duplicated transaction is older than the \"Read-Only Threshold\" set for this book. "
-                                "This setting can be changed in File -> Properties -> Accounts."));
-                gtk_dialog_run (GTK_DIALOG (dialog));
-                gtk_widget_destroy (dialog);
-
-                g_date_free (readonly_threshold);
-                LEAVE("entered date older than read-only threshold");
-                return FALSE;
-            }
-            g_date_free (readonly_threshold);
-        }
-
-        trans_split_index = xaccTransGetSplitIndex (trans, trans_split);
-
-        new_trans = xaccMallocTransaction (gnc_get_current_book ());
-
-        xaccTransBeginEdit (new_trans);
-
-        xaccTransCopyOnto (trans, new_trans);
-
-        xaccTransSetDatePostedSecsNormalized (new_trans, date);
-
-        /* We also must set a new DateEntered on the new entry
-         * because otherwise the ordering is not deterministic */
-        xaccTransSetDateEnteredSecs(new_trans, gnc_time(NULL));
-
-        /* set per book option */
-        gnc_set_num_action (new_trans, NULL, out_num, out_tnum);
-
-        if (gnc_strisnum (out_num))
-        {
-            Account *account = gnc_tree_model_split_reg_get_anchor (model);
-
-            /* If current register is for account, set last num */
-            if (account)
-                xaccAccountSetLastNum (account, out_num);
-        }
-
-        if (use_split_action_for_num_field)
-        {
-            /* find split in new_trans that equals trans_split and set
-             * split_action to out_num */
-            gnc_set_num_action (NULL,
-                                xaccTransGetSplit (new_trans, trans_split_index),
-                                out_num, NULL);
-            /* note that if the transaction has multiple splits to the register
-             * account, only the anchor split will be set with user input. The
-             * user will have to adjust other splits manually. */
-        }
-
-        xaccTransCommitEdit (new_trans);
-
-        if (out_num != NULL)
-           g_free (out_num);
-
-        if (use_split_action_for_num_field && out_tnum != NULL)
-            g_free (out_tnum);
-    }
-    LEAVE(" ");
-    return TRUE;
-}
-
-
-static gboolean gtcsr_move_current_entry_updown(GncTreeViewSplitReg *view,
-                                                gboolean move_up, gboolean really_do_it)
-{
-    GncTreeModelSplitReg *model;
-    GtkTreePath *mpath = NULL, *spath = NULL, *spath_target = NULL, *mpath_target = NULL;
-    GtkTreeIter m_iter, m_iter_target;
-    gboolean resultvalue = FALSE;
-    g_return_val_if_fail(view, FALSE);
-
-    ENTER("");
-
-    // The allocated memory references will all be cleaned up in the
-    // updown_finish: label.
-
-    model = gnc_tree_view_split_reg_get_model_from_view (view);
-    g_return_val_if_fail(model, FALSE);
-
-    if (model->sort_col != COL_DATE)
-    {
-        LEAVE("Not sorted by date - no up/down move available");
-        return FALSE;
-    }
-
-    mpath = gnc_tree_view_split_reg_get_current_path (view);
-    if (!mpath)
-    {
-        LEAVE("No current path available - probably on the blank split.");
-        goto updown_finish;
-    }
-
-    spath = gnc_tree_view_split_reg_get_sort_path_from_model_path (view, mpath);
-    g_return_val_if_fail(spath, FALSE);
-
-    spath_target = gtk_tree_path_copy(spath);
-    if (move_up)
-    {
-        gboolean move_was_made = gtk_tree_path_prev(spath_target);
-        if (!move_was_made)
-        {
-            LEAVE("huh, no path_prev() possible");
-            goto updown_finish;
-        }
-    }
-    else
-    {
-        gtk_tree_path_next(spath_target);
-        // The path_next() function does not give a return value, see
-        // https://mail.gnome.org/archives/gtk-list/2010-January/msg00171.html
-    }
-
-    if (gtk_tree_path_compare(spath, spath_target) == 0)
-    {
-        LEAVE("oops, paths are equal");
-        goto updown_finish;
-    }
-
-    mpath_target = gnc_tree_view_split_reg_get_model_path_from_sort_path (view, spath_target);
-    if (!mpath_target)
-    {
-        LEAVE("no path to target row");
-        goto updown_finish;
-    }
-
-    if (!gtk_tree_model_get_iter (GTK_TREE_MODEL (model), &m_iter, mpath))
-    {
-        LEAVE("No iter for current row");
-        goto updown_finish;
-    }
-    if (!gtk_tree_model_get_iter (GTK_TREE_MODEL (model), &m_iter_target, mpath_target))
-    {
-        LEAVE("No iter for target row");
-        goto updown_finish;
-    }
-
-    {
-        gboolean is_blank, is_blank_target;
-        Split *current_split, *target_split;
-        Transaction *current_trans, *target_trans;
-        gnc_tree_model_split_reg_get_split_and_trans (GNC_TREE_MODEL_SPLIT_REG (model), &m_iter,
-                                                      NULL, NULL, NULL, &is_blank,
-                                                      &current_split, &current_trans);
-        gnc_tree_model_split_reg_get_split_and_trans (GNC_TREE_MODEL_SPLIT_REG (model), &m_iter_target,
-                                                      NULL, NULL, NULL, &is_blank_target,
-                                                      &target_split, &target_trans);
-        if (is_blank || is_blank_target)
-        {
-            LEAVE("blank split involved, ignored.");
-            goto updown_finish;
-        }
-        if (xaccTransEqual(current_trans, target_trans, TRUE, FALSE, FALSE, FALSE))
-        {
-            LEAVE("two times the same txn, ignored.");
-            goto updown_finish;
-        }
-        if (xaccTransGetIsClosingTxn(current_trans)
-                || xaccTransGetIsClosingTxn(target_trans))
-        {
-            LEAVE("One of the txn is book-closing - no re-ordering allowed.");
-            goto updown_finish;
-        }
-
-        /* Only continue if both have the same date and num, because the
-         * "standard ordering" is tied to the date anyway. */
-        {
-            Timespec t1, t2;
-            GDate d1 = xaccTransGetDatePostedGDate(current_trans),
-                  d2 = xaccTransGetDatePostedGDate(target_trans);
-            if (g_date_compare(&d1, &d2) != 0)
-            {
-                LEAVE("unequal DatePosted, ignoring");
-                goto updown_finish;
-            }
-            if (g_strcmp0(xaccTransGetNum(current_trans),
-                          xaccTransGetNum(target_trans)) != 0)
-            {
-                LEAVE("unequal Num, ignoring");
-                goto updown_finish;
-            }
-
-            /* Special treatment if the equality doesn't hold if we access the
-            dates as timespec. See the comment in gncEntrySetDateGDate() for the
-            reason: Some code used the timespec at noon for the EntryDate, other
-            code used the timespec at the start of day. */
-            t1 = xaccTransRetDatePostedTS(current_trans);
-            t2 = xaccTransRetDatePostedTS(target_trans);
-            if (really_do_it && !timespec_equal(&t1, &t2))
-            {
-                /* Timespecs are not equal, even though the GDates were equal? Then
-                we set the GDates again. This will force the timespecs to be equal
-                as well. */
-                xaccTransSetDatePostedGDate(current_trans, d1);
-                xaccTransSetDatePostedGDate(target_trans, d2);
-            }
-        }
-
-        // Check whether any of the two splits are frozen
-        if (xaccSplitGetReconcile(current_split) == FREC
-                || xaccSplitGetReconcile(target_split) == FREC)
-        {
-            LEAVE("either current or target split is frozen. No modification allowed.");
-            goto updown_finish;
-        }
-
-        // If really_do_it is FALSE, we are only in query mode and shouldn't
-        // modify anything. But if it is TRUE, please go ahead and do the move.
-        if (really_do_it)
-        {
-            // Check whether any of the two splits are reconciled
-            if (xaccSplitGetReconcile(current_split) == YREC
-                    && !gnc_tree_control_split_reg_recn_test(view, spath))
-            {
-                LEAVE("current split is reconciled and user chose not to modify it");
-                goto updown_finish;
-            }
-            if (xaccSplitGetReconcile(target_split) == YREC
-                    && !gnc_tree_control_split_reg_recn_test(view, spath_target))
-            {
-                LEAVE("target split is reconciled and user chose not to modify it");
-                goto updown_finish;
-            }
-
-            PINFO("Ok, about to switch ordering for current desc='%s' target desc='%s'",
-                  xaccTransGetDescription(current_trans),
-                  xaccTransGetDescription(target_trans));
-
-            gnc_suspend_gui_refresh ();
-
-            /* Swap the date-entered of both entries. That's already
-             * sufficient! */
-            {
-                Timespec time_current = xaccTransRetDateEnteredTS(current_trans);
-                Timespec time_target = xaccTransRetDateEnteredTS(target_trans);
-
-                /* Special treatment for identical times (potentially caused
-                 * by the "duplicate entry" command) */
-                if (timespec_equal(&time_current, &time_target))
-                {
-                    g_warning("Surprise - both DateEntered are equal.");
-                    /* We just increment the DateEntered of the previously
-                     * lower of the two by one second. This might still cause
-                     * issues if multiple entries had this problem, but
-                     * whatever. */
-                    if (move_up)
-                        time_current.tv_sec++;
-                    else
-                        time_target.tv_sec++;
-                }
-
-                /* Write the new DateEntered. */
-                xaccTransSetDateEnteredTS(current_trans, &time_target);
-                xaccTransSetDateEnteredTS(target_trans, &time_current);
-
-                /* FIXME: Do we need to notify anyone about the changed ordering? */
-            }
-
-            gnc_resume_gui_refresh ();
-
-            LEAVE("two txn switched, done.");
-        }
-        resultvalue = TRUE;
-        goto updown_finish;
-    }
-updown_finish:
-    // memory cleanup
-    //gtk_tree_path_free (mpath); // Should this be freed??
-    gtk_tree_path_free(spath);
-    gtk_tree_path_free(spath_target);
-    gtk_tree_path_free(mpath_target);
-    return resultvalue;
-}
-
-gboolean gnc_tree_control_split_reg_move_current_entry_updown (GncTreeViewSplitReg *view,
-                                                            gboolean move_up)
-{
-    return gtcsr_move_current_entry_updown(view, move_up, TRUE);
-}
-
-gboolean gnc_tree_control_split_reg_is_current_movable_updown (GncTreeViewSplitReg *view,
-                                                               gboolean move_up)
-{
-    return gtcsr_move_current_entry_updown(view, move_up, FALSE);
-}
-
-
-/* Save any open edited transactions on closing register */
-gboolean
-gnc_tree_control_split_reg_save (GncTreeViewSplitReg *view, gboolean reg_closing)
-{
-    Transaction *dirty_trans;
-    Transaction *blank_trans;
-    Transaction *trans;
-//    Split *split;
-//    Split *current_trans_split;
-
-    ENTER("view=%p, reg_closing=%s", view, reg_closing ? "TRUE" : "FALSE");
-
-    if (!view)
-    {
-        LEAVE("no view");
-        return FALSE;
-    }
-
-    /* Make sure we have stopped editing */
-    gnc_tree_view_split_reg_finish_edit (view);
-
-    if (reg_closing)
-        view->reg_closing = TRUE;
-
-    dirty_trans = gnc_tree_view_split_reg_get_dirty_trans (view);
-    blank_trans = gnc_tree_control_split_reg_get_blank_trans (view);
-
-    /* get the handle to the current split and transaction */
-//    split = gnc_tree_view_split_reg_get_current_split (view);
-    trans = gnc_tree_view_split_reg_get_current_trans (view);
-
-//    current_trans_split = gnc_tree_control_split_reg_get_current_trans_split (view);
-
-    if (trans == NULL)
-    {
-        LEAVE("no transaction");
-        return FALSE;
-    }
-
-    if (!xaccTransIsOpen (trans))
-    {
-        LEAVE("transaction not open");
-        return FALSE;
-    }
-
-    if (trans == dirty_trans )
-    {
-        if (trans != blank_trans)
-        {
-           /* Existing Transaction, we are going to commit. */
-
-            PINFO("committing trans (%p)", trans);
-            xaccTransCommitEdit (trans);
-            gnc_tree_view_split_reg_set_dirty_trans (view, NULL);
-
-            LEAVE("Existing Transaction committed");
-            return TRUE;
-        }
-        else
-        {
-           /* Blank Transaction, we are going to commit. */
-
-            PINFO("start committing blank trans (%p)", trans);
-//FIXME More stuff ?
-
-            if (xaccTransCountSplits (trans) == 0)
-            {
-                GtkWidget *dialog, *window;
-                gint response;
-                /* Translators: This message will be presented when a user *
-                 * attempts to record a transaction without splits        */
-                const char *title = _("Not enough information for Blank Transaction?");
-                const char *message =
-                    _("The blank transaction does not have enough information to save it. Would you like to "
-                      "return to the transaction to update, or cancel the save?");
-                window = gnc_tree_view_split_reg_get_parent (view);
-                dialog = gtk_message_dialog_new (GTK_WINDOW (window),
-                                        GTK_DIALOG_DESTROY_WITH_PARENT,
-                                        GTK_MESSAGE_QUESTION,
-                                        GTK_BUTTONS_CANCEL,
-                                        "%s", title);
-                gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
-                        "%s", message);
-                gtk_dialog_add_button (GTK_DIALOG (dialog),
-                              _("_Return"), GTK_RESPONSE_ACCEPT);
-
-                gtk_widget_grab_focus (gtk_dialog_get_widget_for_response (GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT));
-
-                response = gtk_dialog_run (GTK_DIALOG (dialog));
-//                response = gnc_dialog_run (GTK_DIALOG (dialog), "transaction_incomplete");
-                gtk_widget_destroy (dialog);
-
-                if (response != GTK_RESPONSE_ACCEPT)
-                {
-                    LEAVE("save cancelled");
-                    return TRUE;
-                }
-                LEAVE("return to transaction");
-                return FALSE;
-            }
-
-            xaccTransCommitEdit (trans);
-            gnc_tree_view_split_reg_set_dirty_trans (view, NULL);
-
-            LEAVE("Blank Transaction committed");
-            return TRUE;
-        }
-    }
-
-    LEAVE(" ");
-    return TRUE;
-}
-
-
-/* Allow the reconcile flag to be changed */
-gboolean
-gnc_tree_control_split_reg_recn_change (GncTreeViewSplitReg *view, GtkTreePath *spath)
-{
-    GtkWidget *dialog, *window;
-    GncTreeModelSplitReg *model;
-    GtkTreePath *mpath;
-    GtkTreeIter m_iter;
-    Split *split = NULL;
-    Transaction *trans = NULL;
-    gboolean is_trow1, is_trow2, is_split, is_blank;
-    Account *anchor;
-    char rec;
-    const gchar *title = _("Mark split as unreconciled?");
-    const gchar *message =
-        _("You are about to mark a reconciled split as unreconciled. Doing "
-          "so might make future reconciliation difficult! Continue "
-          "with this change?");
-    gint response;
-
-    ENTER(" ");
-
-    model = gnc_tree_view_split_reg_get_model_from_view (view);
-
-    anchor = gnc_tree_model_split_reg_get_anchor (model);
-
-    mpath = gnc_tree_view_split_reg_get_model_path_from_sort_path (view, spath);
-
-    if (!gtk_tree_model_get_iter (GTK_TREE_MODEL (model), &m_iter, mpath))
-    {
-        gtk_tree_path_free (mpath);
-        return FALSE;
-    }
-
-    gnc_tree_model_split_reg_get_split_and_trans (GNC_TREE_MODEL_SPLIT_REG (model), &m_iter,
-                                 &is_trow1, &is_trow2, &is_split, &is_blank, &split, &trans);
-
-    if (is_trow1 || is_trow2)
-        split = xaccTransFindSplitByAccount (trans, anchor);
-
-    rec = xaccSplitGetReconcile (split);
-
-    if (rec != YREC)
-    {
-        gtk_tree_path_free (mpath);
-        LEAVE("Not reconciled");
-        return TRUE;
-    }
-
-    /* Does the user want to be warned? */
-    window = gnc_tree_view_split_reg_get_parent (view);
-    dialog =
-        gtk_message_dialog_new (GTK_WINDOW (window),
-                               GTK_DIALOG_DESTROY_WITH_PARENT,
-                               GTK_MESSAGE_WARNING,
-                               GTK_BUTTONS_CANCEL,
-                               "%s", title);
-    gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
-            "%s", message);
-    gtk_dialog_add_button (GTK_DIALOG (dialog), _("_Unreconcile"),
-                          GTK_RESPONSE_YES);
-    response = gnc_dialog_run (GTK_DIALOG (dialog), GNC_PREF_WARN_REG_RECD_SPLIT_UNREC);
-    gtk_widget_destroy (dialog);
-
-    if (response == GTK_RESPONSE_YES)
-    {
-        char rec = 'n';
-        trans = xaccSplitGetParent (split);
-
-        gnc_tree_view_split_reg_set_dirty_trans (view, trans);
-        if (!xaccTransIsOpen (trans))
-            xaccTransBeginEdit (trans);
-
-        xaccSplitSetReconcile (split, rec);
-
-        gtk_tree_path_free (mpath);
-        LEAVE("mark split unreconciled");
-        return TRUE;
-    }
-    gtk_tree_path_free (mpath);
-    LEAVE("Canceled split unreconciled");
-    return FALSE;
-}
-
-
-/* Test for splits being reconciled and decide to allow changes */
-gboolean
-gnc_tree_control_split_reg_recn_test (GncTreeViewSplitReg *view, GtkTreePath *spath)
-{
-    GncTreeModelSplitReg *model;
-    GtkTreePath *mpath;
-    GtkTreeIter m_iter;
-    Split *split = NULL;
-    Transaction *trans = NULL;
-    gboolean is_trow1, is_trow2, is_split, is_blank;
-    Account *anchor;
-    char recn;
-
-    ENTER(" ");
-
-    /* This assumes we reset the flag whenever we change splits. */
-    if (view->change_allowed)
-    {
-        LEAVE("change allowed is set");
-        return TRUE;
-    }
-
-    model = gnc_tree_view_split_reg_get_model_from_view (view);
-
-    anchor = gnc_tree_model_split_reg_get_anchor (model);
-
-    mpath = gnc_tree_view_split_reg_get_model_path_from_sort_path (view, spath);
-
-    if (!gtk_tree_model_get_iter (GTK_TREE_MODEL (model), &m_iter, mpath))
-    {
-        gtk_tree_path_free (mpath);
-        LEAVE("No path");
-        return TRUE;
-    }
-
-    gnc_tree_model_split_reg_get_split_and_trans (GNC_TREE_MODEL_SPLIT_REG (model), &m_iter,
-                                 &is_trow1, &is_trow2, &is_split, &is_blank, &split, &trans);
-
-    if (is_trow1 || is_trow2)
-        split = xaccTransFindSplitByAccount (trans, anchor);
-
-    if (!split)
-    {
-        gtk_tree_path_free (mpath);
-        LEAVE("No split");
-        return TRUE;
-    }
-
-    recn = xaccSplitGetReconcile (split);
-
-    if (recn == YREC || xaccTransHasReconciledSplits (trans))
-    {
-        GtkWidget *dialog, *window;
-        gint response;
-        const gchar *title;
-        const gchar *message;
-
-        if(recn == YREC)
-        {
-            title = _("Change reconciled split?");
-            message =
-             _("You are about to change a reconciled split. Doing so might make "
-               "future reconciliation difficult! Continue with this change?");
-        }
-        else
-        {
-            title = _("Change split linked to a reconciled split?");
-            message =
-            _("You are about to change a split that is linked to a reconciled split. "
-              "Doing so might make future reconciliation difficult! Continue with this change?");
-        }
-
-        /* Does the user want to be warned? */
-        window = gnc_tree_view_split_reg_get_parent (view);
-        dialog =
-            gtk_message_dialog_new (GTK_WINDOW (window),
-                                   GTK_DIALOG_DESTROY_WITH_PARENT,
-                                   GTK_MESSAGE_WARNING,
-                                   GTK_BUTTONS_CANCEL,
-                                   "%s", title);
-        gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
-                "%s", message);
-        gtk_dialog_add_button (GTK_DIALOG (dialog), _("Chan_ge Split"),
-                              GTK_RESPONSE_YES);
-        response = gnc_dialog_run (GTK_DIALOG (dialog), GNC_PREF_WARN_REG_RECD_SPLIT_MOD);
-        gtk_widget_destroy (dialog);
-
-        if (response != GTK_RESPONSE_YES)
-        {
-            gtk_tree_path_free (mpath);
-            LEAVE("cancel reconciled split");
-            return FALSE;
-        }
-    }
-    view->change_allowed = TRUE;
-    gtk_tree_path_free (mpath);
-    LEAVE(" ");
-    return TRUE;
-}
-
-
-/* Return the account for name given or create it */ 
-Account *
-gnc_tree_control_split_reg_get_account_by_name (GncTreeViewSplitReg *view, const char *name)
-{
-    GtkWidget *window;
-    const char *placeholder = _("The account %s does not allow transactions.");
-    const char *missing = _("The account %s does not exist. "
-                            "Would you like to create it?");
-    Account *account;
-
-    if (!name || (strlen(name) == 0))
-        return NULL;
-
-    /* Find the account */
-    if (gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL_REGISTER, GNC_PREF_SHOW_LEAF_ACCT_NAMES))
-        account = gnc_account_lookup_by_name (gnc_get_current_root_account(), name);
-    else
-        account = gnc_account_lookup_by_full_name (gnc_get_current_root_account(), name);
-
-    if (!account)
-        account = gnc_account_lookup_by_code (gnc_get_current_root_account(), name);
-
-    window = gnc_tree_view_split_reg_get_parent (view);
-
-    if (!account)
-    {
-        /* Ask if they want to create a new one. */
-        if (!gnc_verify_dialog (window, TRUE, missing, name))
-            return NULL;
-
-        /* User said yes, they want to create a new account. */
-        account = gnc_ui_new_accounts_from_name_window (name);
-        if (!account)
-            return NULL;
-    }
-    /* Now have the account. */
-
-    /* See if the account (either old or new) is a placeholder. */
-    if (xaccAccountGetPlaceholder (account))
-        gnc_error_dialog (window, placeholder, name);
-
-    /* Be seeing you. */
-    return account;
-}
-
-/*****************************************************************************
- *                         ClipBoard Functions                               *
- *****************************************************************************/
-static Transaction *clipboard_trans = NULL;
-/* Must never dereference. */
-static const Account *clipboard_acct = NULL;
-
-
-/* Return the split account for which ancestor is it's parent */
-static Account *
-gtc_sr_get_account_for_trans_ancestor (const Transaction *trans, const Account *ancestor)
-{
-    GList *node;
-
-    for (node = xaccTransGetSplitList (trans); node; node = node->next)
-    {
-        Split *split = node->data;
-        Account *split_acc = xaccSplitGetAccount (split);
-
-        if (!xaccTransStillHasSplit (trans, split))
-            continue;
-
-        if (ancestor == split_acc)
-            return split_acc;
-
-        if (ancestor && xaccAccountHasAncestor (split_acc, ancestor))
-            return split_acc;
-    }
-    return NULL;
-}
-
-
-void
-gnc_tree_control_split_reg_cut_trans (GncTreeViewSplitReg *view)
-{
-    GncTreeModelSplitReg *model;
-    Transaction *from_trans;
-    Account *anchor;
-
-    g_return_if_fail (GNC_IS_TREE_VIEW_SPLIT_REG (view));
-
-    model = gnc_tree_view_split_reg_get_model_from_view (view);
-
-    anchor = gnc_tree_model_split_reg_get_anchor (model);
-
-    from_trans = gnc_tree_view_split_reg_get_current_trans (view);
-    if (!from_trans)
-        return;
-
-    /* Test for read only */
-    if (gtc_sr_is_trans_readonly_and_warn (view, from_trans))
-        return;
-
-    if (!xaccTransIsOpen (clipboard_trans))
-        xaccTransBeginEdit (clipboard_trans);
-    if (clipboard_trans)
-        xaccTransDestroy (clipboard_trans);
-
-    clipboard_trans = xaccTransCopyToClipBoard (from_trans);
-    clipboard_acct = gtc_sr_get_account_for_trans_ancestor (from_trans, anchor);
-
-    gnc_tree_view_split_reg_delete_current_trans (view);
-}
-
-
-void
-gnc_tree_control_split_reg_copy_trans (GncTreeViewSplitReg *view)
-{
-    GncTreeModelSplitReg *model;
-    Transaction *from_trans;
-    Account *anchor;
-
-    g_return_if_fail (GNC_IS_TREE_VIEW_SPLIT_REG (view));
-
-    model = gnc_tree_view_split_reg_get_model_from_view (view);
-
-    from_trans = gnc_tree_view_split_reg_get_current_trans (view);
-    if (!from_trans)
-        return;
-
-    anchor = gnc_tree_model_split_reg_get_anchor (model);
-
-    clipboard_acct = gtc_sr_get_account_for_trans_ancestor (from_trans, anchor);
-
-    if (!xaccTransIsOpen (clipboard_trans))
-        xaccTransBeginEdit (clipboard_trans);
-    if (clipboard_trans)
-        xaccTransDestroy (clipboard_trans);
-
-    clipboard_trans = xaccTransCopyToClipBoard (from_trans);
-}
-
-void
-gnc_tree_control_split_reg_paste_trans (GncTreeViewSplitReg *view)
-{
-    GncTreeModelSplitReg *model;
-    Account *anchor_acct;
-    Transaction *to_trans;
-
-    g_return_if_fail (GNC_IS_TREE_VIEW_SPLIT_REG (view));
-
-    model = gnc_tree_view_split_reg_get_model_from_view (view);
-    anchor_acct = gnc_tree_model_split_reg_get_anchor (model);
-
-    to_trans = gnc_tree_view_split_reg_get_current_trans (view);
-    if (!to_trans || !clipboard_trans)
-        return;
-
-    /* See if we are being edited in another register */
-    if (gtc_sr_trans_test_for_edit (view, to_trans))
-        return;
-
-    /* Test for read only */
-    if (gtc_sr_is_trans_readonly_and_warn (view, to_trans))
-        return;
-
-    //FIXME You can not paste from gl to a register, is this too simplistic
-    if (clipboard_acct == NULL && anchor_acct != NULL)
-    {
-        GtkWidget *window;
-
-        window = gnc_tree_view_split_reg_get_parent (view);
-        gnc_error_dialog (window, "%s",
-                         _("You can not paste from the general journal to a register."));
-        return;
-    }
-
-    gnc_tree_view_split_reg_set_dirty_trans (view, to_trans);
-    if (!xaccTransIsOpen (to_trans))
-        xaccTransBeginEdit (to_trans);
-
-    // Remove the blank split
-    gnc_tree_model_split_reg_set_blank_split_parent (model, to_trans, TRUE);
-
-    xaccTransCopyFromClipBoard (clipboard_trans, to_trans, clipboard_acct, anchor_acct, FALSE);
-
-    // Add the blank split back
-    gnc_tree_model_split_reg_set_blank_split_parent (model, to_trans, FALSE);
-
-    // Refresh the view
-    g_signal_emit_by_name (model, "refresh_trans", NULL);
-}
-
-void
-gnc_tree_control_auto_complete (GncTreeViewSplitReg *view, Transaction *trans,  const gchar *new_text)
-{
-    GncTreeModelSplitReg *model;
-    Transaction          *btrans;
-    GtkListStore         *desc_list;
-    GtkTreeIter           iter;
-    gboolean              valid;
-
-    g_return_if_fail (GNC_IS_TREE_VIEW_SPLIT_REG (view));
-    DEBUG("auto_complete - trans %p and description '%s'", trans, new_text);
-
-    model = gnc_tree_view_split_reg_get_model_from_view (view);
-
-    btrans = gnc_tree_model_split_get_blank_trans (model);
-
-    // if we are not looking at the blank trans, return.
-    if (trans != btrans)
-       return;
-
-    desc_list = gnc_tree_model_split_reg_get_description_list (model);
-
-    valid = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (desc_list), &iter);
-    while (valid)
-    {
-        Transaction *trans_from;
-        gchar *text;
-        // Walk through the list, reading each row
-        gtk_tree_model_get (GTK_TREE_MODEL (desc_list), &iter, 0, &text, 1, &trans_from, -1);
-
-        if (g_strcmp0 (text, new_text) == 0)
-        {
-            xaccTransCopyOnto (trans_from, trans);
-            g_free (text);
-            break;
-        }
-        g_free (text);
-
-        valid = gtk_tree_model_iter_next (GTK_TREE_MODEL (desc_list), &iter);
-    }
-}
-
diff --git a/src/gnome-utils/gnc-tree-view-split-reg.c b/src/gnome-utils/gnc-tree-view-split-reg.c
deleted file mode 100644
index 432970c..0000000
--- a/src/gnome-utils/gnc-tree-view-split-reg.c
+++ /dev/null
@@ -1,6421 +0,0 @@
-/********************************************************************\
- * gnc-tree-view-split-reg.c -- GtkTreeView implementation to       *
- *                     display registers   in a GtkTreeView.        *
- *                                                                  *
- * Copyright (C) 2006-2007 Chris Shoemaker <c.shoemaker at cox.net>    *
- * Copyright (C) 2012 Robert Fewell                                 *
- *                                                                  *
- * 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 at gnu.org                   *
- *                                                                  *
-\********************************************************************/
-
-#include "config.h"
-
-#include <gtk/gtk.h>
-#include <glib/gi18n.h>
-#include <stdlib.h>
-#include <string.h>
-#include <gdk/gdkkeysyms.h>
-
-#include "gnc-tree-view.h"
-#include "gnc-tree-view-split-reg.h"
-#include "gnc-tree-model-split-reg.h"
-#include "gnc-tree-control-split-reg.h"
-#include "gnc-tree-util-split-reg.h"
-#include "gnc-ui.h"
-#include "gnome-utils/gnc-warnings.h"
-#include "dialog-utils.h"
-#include "gnc-prefs.h"
-#include "Transaction.h"
-#include "engine-helpers.h"
-#include "Scrub.h"
-#include "gnc-exp-parser.h"
-#include "SchedXaction.h"
-
-#include "gnc-amount-edit.h"
-
-
-/* Signal codes */
-enum
-{
-    UPDATE_SIGNAL,
-    HELP_SIGNAL,
-    LAST_SIGNAL
-};
-
-typedef enum {
-    RESET,  //0
-    ACCEPT, //1
-    DISCARD,//2
-    CANCEL  //3
-}TransConfirm;
-
-
-/** Static Globals *******************************************************/
-static QofLogModule log_module = GNC_MOD_LEDGER;
-
-static void gnc_tree_view_split_reg_class_init (GncTreeViewSplitRegClass *klass);
-static void gnc_tree_view_split_reg_init (GncTreeViewSplitReg *view);
-static void gnc_tree_view_split_reg_dispose (GObject *object);
-static void gnc_tree_view_split_reg_finalize (GObject *object);
-
-static guint gnc_tree_view_split_reg_signals[LAST_SIGNAL] = {0};
-
-static void gnc_tree_view_split_reg_pref_changed (gpointer prefs, gchar *pref, gpointer user_data);
-
-static void gtv_sr_cdf0 (GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTreeModel *s_model,
-				GtkTreeIter *s_iter, gpointer user_data);
-
-static void gtv_sr_cdf1 (GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTreeModel *s_model,
-				GtkTreeIter *s_iter, gpointer user_data);
-
-static void gtv_sr_control_cdf0 (GtkTreeViewColumn *col, GtkCellRenderer *renderer,
-                                 GtkTreeModel *s_model, GtkTreeIter *s_iter, gpointer user_data);
-
-static void gtv_sr_titles (GncTreeViewSplitReg *view, RowDepth depth);
-
-static void gtv_sr_edited_cb (GtkCellRendererText *cell, const gchar *path_string,
-				const gchar *new_text, gpointer user_data);
-
-static void gtv_sr_edited_normal_cb (GtkCellRendererText *cell, const gchar *path_string,
-                                const gchar *new_text, gpointer user_data);
-
-static void gtv_sr_edited_template_cb (GtkCellRendererText *cell, const gchar *path_string,
-                                const gchar *new_text, gpointer user_data);
-
-//static void start_edit (GtkCellRenderer *cr, GtkCellEditable *editable,
-//				const gchar *path, gpointer user_data); //FIXME This may not be needed
-
-static void gtv_sr_begin_edit (GncTreeViewSplitReg *view, Transaction *trans);
-
-static void gtv_sr_finish_edit (GncTreeViewSplitReg *view);
-
-static void gtv_sr_editable_start_editing_cb (GtkCellRenderer *cr, GtkCellEditable *editable,
-				const gchar *path, gpointer user_data);
-
-static void gtv_sr_editing_canceled_cb (GtkCellRenderer *cr, gpointer user_data);
-
-//static void gtv_sr_match_selected_cb (GtkEntryCompletion *widget, GtkTreeModel *model,
-//                        GtkTreeIter *iter, gpointer user_data); //FIXME This may not be needed
-
-//static void gtv_sr_changed_cb (GtkCellRendererCombo *widget, gchar *path_string,
-//                        GtkTreeIter *iter, gpointer user_data); //FIXME This may not be needed
-
-static void gtv_sr_selection_move_delete_cb (GncTreeModelSplitReg *model, gpointer item, gpointer user_data);
-
-static gboolean gtv_sr_key_press_cb (GtkWidget *widget, GdkEventKey *event, gpointer user_data);
-
-static gboolean gtv_sr_ed_key_press_cb (GtkWidget *widget, GdkEventKey *event, gpointer user_data);
-
-static gboolean gtv_sr_button_cb (GtkWidget *widget, GdkEventButton *event, gpointer user_data);
-
-static gboolean gtv_sr_focus_out_cb (GtkWidget *widget, GdkEventFocus *event, gpointer user_data);
-
-static void gtv_sr_motion_cb (GtkTreeSelection *sel, gpointer user_data);
-
-static void gtv_sr_refresh_view_cb (GncTreeModelSplitReg *model, gpointer user_data);
-
-static gboolean gtv_sr_transaction_changed_confirm (GncTreeViewSplitReg *view, Transaction *new_trans);
-
-
-typedef struct {
-    ViewCol viewcol;
-    gint modelcol;
-    gchar *title;
-    gchar *pref_name;
-    gchar *sizer;
-    int visibility_model_col;
-    int always_visible_col;
-    void (*edited_cb)(GtkCellRendererText *, const gchar *,
-                      const gchar *, gpointer);
-    void (*editing_started_cb)(GtkCellRenderer *, GtkCellEditable *,
-                               const gchar *, gpointer);
-    GtkTreeIterCompareFunc sort_fn;
-} ColDef;
-
-
-static ColDef all_tree_view_split_reg_columns[] = {
-    {COL_DATE, GNC_TREE_MODEL_SPLIT_REG_COL_DATE,
-     "Date", "date", "00/00/0000",
-     GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS, 1,
-     gtv_sr_edited_cb, gtv_sr_editable_start_editing_cb,
-     gnc_tree_model_split_reg_sort_iter_compare_func},
-
-    {COL_DUEDATE, -1,
-     "Due Date", "duedate", "00/00/0000",
-     GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS, 1,
-     gtv_sr_edited_cb, gtv_sr_editable_start_editing_cb, NULL},
-
-    {COL_NUMACT, GNC_TREE_MODEL_SPLIT_REG_COL_NUMACT,
-     "Num / Act / Act", "numact", "0000",
-     GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS, 0,
-     gtv_sr_edited_cb, gtv_sr_editable_start_editing_cb,
-     gnc_tree_model_split_reg_sort_iter_compare_func},
-
-    {COL_DESCNOTES, GNC_TREE_MODEL_SPLIT_REG_COL_DESCNOTES,
-     "Description / Notes / Memo", "descnotes", "xxxxxxxxxxxxxxxxxxx",
-     GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS, 1,
-     gtv_sr_edited_cb, gtv_sr_editable_start_editing_cb,
-     gnc_tree_model_split_reg_sort_iter_compare_func},
-
-    {COL_TRANSFERVOID, -1,
-     "Transfer / Void", "transfervoid", "xxxxxxxxxxxxxxxxxxx",
-     GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS, 1,
-     gtv_sr_edited_cb, gtv_sr_editable_start_editing_cb, NULL},
-
-    {COL_RECN, GNC_TREE_MODEL_SPLIT_REG_COL_RECN,
-     "R", "recn", "xx",
-     GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS, 0,
-     gtv_sr_edited_cb, gtv_sr_editable_start_editing_cb,
-     gnc_tree_model_split_reg_sort_iter_compare_func},
-
-    {COL_TYPE, -1,
-     "Type", "type", "xx",
-     GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS, 0,
-     gtv_sr_edited_cb, gtv_sr_editable_start_editing_cb, NULL},
-
-    {COL_VALUE, -1,
-     "Value", "value", "00000",
-     GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS, 0,
-     gtv_sr_edited_cb, gtv_sr_editable_start_editing_cb, NULL},
-
-    {COL_AMOUNT, -1,
-     "Amount", "amount", "00000",
-     GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS, 0,
-     gtv_sr_edited_cb, gtv_sr_editable_start_editing_cb, NULL},
-
-    {COL_AMTVAL, -1,
-     "Amount / Value", "amtval", "00000",
-     GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS, 1,
-     gtv_sr_edited_cb, gtv_sr_editable_start_editing_cb, NULL},
-
-    {COL_RATE, -1,
-     "Rate", "rate", "00000",
-     GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS, 0,
-     gtv_sr_edited_cb, gtv_sr_editable_start_editing_cb, NULL},
-
-    {COL_PRICE, -1,
-     "Price", "price", "00000",
-     GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS, 1,
-     gtv_sr_edited_cb, gtv_sr_editable_start_editing_cb, NULL},
-
-    {COL_DEBIT, GNC_TREE_MODEL_SPLIT_REG_COL_DEBIT,
-     "Debit", "debit", "00000",
-     GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS, 1,
-     gtv_sr_edited_cb, gtv_sr_editable_start_editing_cb,
-     gnc_tree_model_split_reg_sort_iter_compare_func},
-
-    {COL_CREDIT, GNC_TREE_MODEL_SPLIT_REG_COL_CREDIT,
-     "Credit", "credit", "00000",
-     GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS, 1,
-     gtv_sr_edited_cb, gtv_sr_editable_start_editing_cb,
-     gnc_tree_model_split_reg_sort_iter_compare_func},
-
-    {COL_BALANCE, -1,
-     "Balance", "balance", "00000",
-     GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS, 0,
-     NULL, NULL, NULL},
-
-    {COL_STATUS, -1,
-     " ", "status", "x",
-     GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS, 1,
-     NULL, NULL, NULL},
-
-    {COL_COMM, -1,
-     "Commodity", "commodity", "xxxxxxxx",
-     GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS, 0,
-     NULL, NULL, NULL},
-};
-
-
-struct GncTreeViewSplitRegPrivate
-{
-    gboolean             disposed;
-  
-    Account             *anchor;              // The register default Account
-    gnc_commodity       *reg_comm;            // The register commodity (which may be a non-currency)
-    gnc_commodity       *reg_currency;        // The currency for txns in this register (guaranteed to be a currency)
-
-    Transaction         *current_trans;       // The current highlighted transaction
-    Split               *current_split;       // The current highlighted split
-    RowDepth             current_depth;       // The current depth 1=TROW1, 2=TROW2, 3=SPLIT3
-    GtkTreeRowReference *current_ref;         // The current model path reference
-
-    Transaction         *dirty_trans;         // Set when transaction is changed
-    TransConfirm         trans_confirm;       // This is the return value for gtv_sr_transaction_changed_confirm
-
-    GtkCellRenderer     *temp_cr;             // Pointer to Temp Cell Renderer
-    gulong               fo_handler_id;       // Focus out callback id
-
-    gboolean             acct_short_names;    // Use account short names
-    gboolean             double_line;         // Use double line mode
-    gboolean             expanded;            // Are we expanded to splits
-    gboolean             auto_complete;       // Whether auto complete has run
-    gboolean             negative_in_red;     // Display negative numbers in red
-    gboolean             use_horizontal_lines;// Draw horizontal lines
-    gboolean             use_vertical_lines;  // Draw vertical lines
-
-    gboolean             show_calendar_buttons;        // Show the calendar buttons
-    gboolean             show_extra_dates_on_selection;// Show the above on the selected transaction
-    gboolean             selection_to_blank_on_expand; // Move the selection to the blank split on expand
-
-    gint                 key_length;                   // The number of characters before auto complete starts.
-    gint                 single_button_press;          // Capture single button press.
-
-    gchar               *transfer_string;              // The transfer account string.
-    gboolean             stop_cell_move;               // Stops the cursor moving to a different cell.
-
-};
-
-/* Define some cell colors */
-#define PINKCELL "#F8BEC6"
-#define REDCELL "#F34943"
-#define BLUECELL "#1D80DF"
-#define BLACKCELL "#CBCBD2"
-#define YELLOWCELL "#FFEF98"
-#define ORANGECELL "#F39536"
-
-
-#define GNC_PREF_SHOW_EXTRA_DATES        "show-extra-dates"
-#define GNC_PREF_SHOW_EXTRA_DATES_ON_SEL "show-extra-dates-on-selection"
-#define GNC_PREF_SHOW_CAL_BUTTONS        "show-calendar-buttons"
-#define GNC_PREF_SEL_TO_BLANK_ON_EXPAND  "selection-to-blank-on-expand"
-#define GNC_PREF_KEY_LENGTH              "key-length"
-
-/* This could be a preference setting, show currency / commodity symbols */
-#define SHOW_SYMBOL FALSE
-
-#define GNC_TREE_VIEW_SPLIT_REG_GET_PRIVATE(o)  \
-   (G_TYPE_INSTANCE_GET_PRIVATE ((o), GNC_TYPE_TREE_VIEW_SPLIT_REG, GncTreeViewSplitRegPrivate))
-
-static GObjectClass *parent_class = NULL;
-
-GType
-gnc_tree_view_split_reg_get_type(void)
-{
-    static GType gnc_tree_view_split_reg_type = 0;
-
-    if (gnc_tree_view_split_reg_type == 0)
-    {
-        static const GTypeInfo our_info =
-        {
-            sizeof (GncTreeViewSplitRegClass),
-            NULL,
-            NULL,
-            (GClassInitFunc) gnc_tree_view_split_reg_class_init,
-            NULL,
-            NULL,
-            sizeof (GncTreeViewSplitReg),
-            0,
-            (GInstanceInitFunc) gnc_tree_view_split_reg_init
-        };
-
-        gnc_tree_view_split_reg_type = g_type_register_static (GNC_TYPE_TREE_VIEW,
-                                     "GncTreeViewSplitReg",
-                                     &our_info, 0);
-    }
-    return gnc_tree_view_split_reg_type;
-}
-
-
-static void
-gnc_tree_view_split_reg_class_init (GncTreeViewSplitRegClass *klass)
-{
-    GObjectClass *o_class;
-
-    parent_class = g_type_class_peek_parent (klass);
-
-    o_class = G_OBJECT_CLASS (klass);
-
-    o_class->dispose =  gnc_tree_view_split_reg_dispose;
-    o_class->finalize = gnc_tree_view_split_reg_finalize;
-
-    g_type_class_add_private (klass, sizeof(GncTreeViewSplitRegPrivate));
-
-    gnc_tree_view_split_reg_signals[UPDATE_SIGNAL] =
-        g_signal_new("update_signal",
-                     G_TYPE_FROM_CLASS (o_class),
-                     G_SIGNAL_RUN_LAST,
-                     G_STRUCT_OFFSET (GncTreeViewSplitRegClass, update_signal),
-                     NULL, NULL,
-                     g_cclosure_marshal_VOID__VOID,
-                     G_TYPE_NONE, 0);
-
-    gnc_tree_view_split_reg_signals[HELP_SIGNAL] =
-        g_signal_new("help_signal",
-                     G_TYPE_FROM_CLASS (o_class),
-                     G_SIGNAL_RUN_LAST,
-                     G_STRUCT_OFFSET (GncTreeViewSplitRegClass, help_signal),
-                     NULL, NULL,
-                     g_cclosure_marshal_VOID__VOID,
-                     G_TYPE_NONE, 0);
-
-    klass->update_signal = NULL;
-    klass->help_signal = NULL;
-}
-
-/*****************************************************************************/
-
-/* Return the tree model from the tree view */
-GncTreeModelSplitReg *
-gnc_tree_view_split_reg_get_model_from_view (GncTreeViewSplitReg *view)
-{
-    GtkTreeModelSort *s_model = GTK_TREE_MODEL_SORT (gtk_tree_view_get_model (GTK_TREE_VIEW (view)));
-    return GNC_TREE_MODEL_SPLIT_REG (gtk_tree_model_sort_get_model (GTK_TREE_MODEL_SORT (s_model)));
-}
-
-/* Get the model iter from the view path string */
-static gboolean
-gtv_sr_get_model_iter_from_view_string (GncTreeViewSplitReg *view,
-                                const gchar *path_string, GtkTreeIter *m_iter)
-{
-    GtkTreeModel *s_model;
-    GtkTreeIter s_iter;
-
-    s_model = gtk_tree_view_get_model (GTK_TREE_VIEW (view));
-
-    if (!gtk_tree_model_get_iter_from_string (s_model, &s_iter, path_string))
-    {
-        m_iter = NULL;
-        return FALSE;
-    }
-    gtk_tree_model_sort_convert_iter_to_child_iter (GTK_TREE_MODEL_SORT (s_model), m_iter, &s_iter);
-    return TRUE;
-}
-
-/* Get the model iter from the selection */
-static gboolean
-gtv_sr_get_model_iter_from_selection (GncTreeViewSplitReg *view,
-                              GtkTreeSelection *sel, GtkTreeIter *m_iter)
-{
-    GtkTreeModel *s_model;
-    GtkTreeIter s_iter;
-
-    if (gtk_tree_selection_get_selected (sel, &s_model, &s_iter))
-    {
-        gtk_tree_model_sort_convert_iter_to_child_iter (GTK_TREE_MODEL_SORT (s_model), m_iter, &s_iter);
-        return TRUE;
-    }
-    return FALSE;
-}
-
-/* Get sort model path from the model path
- *
- * Return A newly allocated GtkTreePath, or NULL */
-GtkTreePath *
-gnc_tree_view_split_reg_get_sort_path_from_model_path (GncTreeViewSplitReg *view, GtkTreePath *mpath)
-{
-    GtkTreeModel *s_model;
-    GtkTreePath *spath;
-
-    g_return_val_if_fail (mpath, NULL);
-    s_model = gtk_tree_view_get_model (GTK_TREE_VIEW (view));
-    spath = gtk_tree_model_sort_convert_child_path_to_path (GTK_TREE_MODEL_SORT (s_model), mpath);
-    if (!spath)
-    {
-        /* No parent path available */
-        return NULL;
-    }
-    return spath;
-}
-
-/* Get model path from the sort model path
- *
- * Return A newly allocated GtkTreePath, or NULL. */
-GtkTreePath *
-gnc_tree_view_split_reg_get_model_path_from_sort_path (GncTreeViewSplitReg *view, GtkTreePath *spath)
-{
-    GtkTreeModel *s_model;
-    GtkTreePath *mpath;
-
-    g_return_val_if_fail (spath, NULL);
-    s_model = gtk_tree_view_get_model (GTK_TREE_VIEW (view));
-    mpath = gtk_tree_model_sort_convert_path_to_child_path (GTK_TREE_MODEL_SORT (s_model), spath);
-    if (!mpath)
-    {
-        /* No child path available */
-        return NULL;
-    }
-    return mpath;
-}
-
-/*****************************************************************************/
-
-static void
-gnc_tree_view_split_reg_init (GncTreeViewSplitReg *view)
-{
-    view->priv = g_new0 (GncTreeViewSplitRegPrivate, 1);
-
-    view->priv->current_trans = NULL;
-    view->priv->current_split = NULL;
-    view->priv->current_depth = 0;
-    view->reg_closing = FALSE;
-    view->priv->fo_handler_id = 0;
-    view->priv->auto_complete = FALSE;
-    view->priv->trans_confirm = RESET;
-    view->priv->single_button_press = 0;
-
-    view->priv->transfer_string = g_strdup ("Dummy");
-    view->priv->stop_cell_move = FALSE;
-
-    view->priv->show_calendar_buttons = gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL_REGISTER, GNC_PREF_SHOW_CAL_BUTTONS);
-    view->show_extra_dates = gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL_REGISTER, GNC_PREF_SHOW_EXTRA_DATES);
-    view->priv->show_extra_dates_on_selection = gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL_REGISTER, GNC_PREF_SHOW_EXTRA_DATES_ON_SEL);
-    view->priv->selection_to_blank_on_expand = gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL_REGISTER, GNC_PREF_SEL_TO_BLANK_ON_EXPAND);
-    view->priv->key_length = gnc_prefs_get_float (GNC_PREFS_GROUP_GENERAL_REGISTER, GNC_PREF_KEY_LENGTH);
-
-    view->priv->acct_short_names = gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL_REGISTER, GNC_PREF_SHOW_LEAF_ACCT_NAMES);
-    view->priv->negative_in_red = gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL, GNC_PREF_NEGATIVE_IN_RED);
-    view->priv->use_horizontal_lines = gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL_REGISTER,
-                                                           GNC_PREF_DRAW_HOR_LINES);
-
-    view->priv->use_vertical_lines = gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL_REGISTER,
-                                                         GNC_PREF_DRAW_VERT_LINES);
-
-    gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL_REGISTER,
-                           GNC_PREF_DRAW_HOR_LINES,
-                           gnc_tree_view_split_reg_pref_changed,
-                           view);
-    gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL_REGISTER,
-                           GNC_PREF_DRAW_VERT_LINES,
-                           gnc_tree_view_split_reg_pref_changed,
-                           view);
-}
-
-
-static void
-gnc_tree_view_split_reg_dispose (GObject *object)
-{
-    GncTreeViewSplitReg *view;
-    GncTreeViewSplitRegPrivate *priv;
-
-    gnc_leave_return_if_fail (object != NULL);
-    gnc_leave_return_if_fail (GNC_IS_TREE_VIEW_SPLIT_REG (object));
-
-    view = GNC_TREE_VIEW_SPLIT_REG (object);
-    priv = GNC_TREE_VIEW_SPLIT_REG_GET_PRIVATE (view);
-
-    if (priv->disposed)
-        return;
-
-    ENTER("split reg view %p", object);
-
-    priv->disposed = TRUE;
-
-    if(view->priv->current_ref != NULL)
-    {
-        gtk_tree_row_reference_free (view->priv->current_ref);
-        view->priv->current_ref = NULL;
-    }
-
-    if (view->help_text)
-        g_free (view->help_text);
-
-    if (view->priv->transfer_string)
-        g_free (view->priv->transfer_string);
-
-    gnc_prefs_remove_cb_by_func (GNC_PREFS_GROUP_GENERAL_REGISTER,
-                                 GNC_PREF_DRAW_HOR_LINES,
-                                 gnc_tree_view_split_reg_pref_changed,
-                                 view);
-    gnc_prefs_remove_cb_by_func (GNC_PREFS_GROUP_GENERAL_REGISTER,
-                                 GNC_PREF_DRAW_VERT_LINES,
-                                 gnc_tree_view_split_reg_pref_changed,
-                                 view);
-
-    if (G_OBJECT_CLASS (parent_class)->dispose)
-        (* G_OBJECT_CLASS (parent_class)->dispose) (object);
-
-    LEAVE(" ");
-}
-
-
-static void
-gnc_tree_view_split_reg_finalize (GObject *object)
-{
-    gnc_leave_return_if_fail(object != NULL);
-    gnc_leave_return_if_fail(GNC_IS_TREE_VIEW_SPLIT_REG (object));
-
-    ENTER("split reg view %p", object);
-
-    if (G_OBJECT_CLASS(parent_class)->finalize)
-        (* G_OBJECT_CLASS(parent_class)->finalize) (object);
-
-    LEAVE(" ");
-}
-
-
-/* Update internal settings based on preferences */
-void
-gnc_tree_view_split_reg_refresh_from_prefs (GncTreeViewSplitReg *view)
-{
-    GncTreeModelSplitReg *model;
-
-    model = gnc_tree_view_split_reg_get_model_from_view (view);
-
-    model->use_theme_colors = gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL_REGISTER,
-                                                 GNC_PREF_USE_THEME_COLORS);
-    model->use_accounting_labels = gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL,
-                                                       GNC_PREF_ACCOUNTING_LABELS);
-
-    model->alt_colors_by_txn = gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL_REGISTER,
-                                                   GNC_PREF_ALT_COLOR_BY_TRANS);
-
-    view->priv->negative_in_red = gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL,
-                                                      GNC_PREF_NEGATIVE_IN_RED);
-}
-
-
-static void
-gnc_tree_view_split_reg_pref_changed (gpointer prefs, gchar *pref, gpointer user_data)
-{
-    GncTreeViewSplitReg *view = user_data;
-
-    g_return_if_fail (pref);
-
-    if (view == NULL)
-        return;
-
-    if (g_str_has_suffix (pref, GNC_PREF_DRAW_HOR_LINES) || g_str_has_suffix (pref, GNC_PREF_DRAW_VERT_LINES))
-    {
-        view->priv->use_horizontal_lines = gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL_REGISTER,
-                                                               GNC_PREF_DRAW_HOR_LINES);
-
-        view->priv->use_vertical_lines = gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL_REGISTER,
-                                                             GNC_PREF_DRAW_VERT_LINES);
-
-        if (view->priv->use_horizontal_lines)
-        {
-            if (view->priv->use_vertical_lines)
-                gtk_tree_view_set_grid_lines (GTK_TREE_VIEW (view), GTK_TREE_VIEW_GRID_LINES_BOTH);
-            else
-                gtk_tree_view_set_grid_lines (GTK_TREE_VIEW (view), GTK_TREE_VIEW_GRID_LINES_HORIZONTAL);
-        }
-        else if (view->priv->use_vertical_lines)
-            gtk_tree_view_set_grid_lines (GTK_TREE_VIEW (view), GTK_TREE_VIEW_GRID_LINES_VERTICAL);
-        else
-            gtk_tree_view_set_grid_lines (GTK_TREE_VIEW (view), GTK_TREE_VIEW_GRID_LINES_NONE);
-    }
-    else
-    {
-        g_warning("gnc_tree_view_split_reg_pref_changed: Unknown preference %s", pref);
-    }
-}
-
-
-/* Define which columns are in which views */
-static ViewCol *
-gnc_tree_view_split_reg_get_colummn_list (GncTreeModelSplitReg *model)
-{
-    DEBUG("Model-type is %d", model->type);
-
-    switch (model->type)
-    {
-    case BANK_REGISTER2:
-    case CASH_REGISTER2:
-    case ASSET_REGISTER2:
-    case CREDIT_REGISTER2:
-    case LIABILITY_REGISTER2:
-    case INCOME_REGISTER2:
-    case EXPENSE_REGISTER2:
-    case EQUITY_REGISTER2:
-    case TRADING_REGISTER2:
-    case INCOME_LEDGER2:
-        {
-        static ViewCol col_list[] = {
-        COL_DATE, COL_NUMACT, COL_DESCNOTES, COL_TRANSFERVOID, COL_RECN,
-        COL_STATUS, COL_DEBIT, COL_CREDIT, COL_BALANCE, -1};
-        return col_list;
-        }
-        break;
-
-    case GENERAL_JOURNAL2:
-        {
-        static ViewCol col_list[] = {
-        COL_DATE, COL_NUMACT, COL_DESCNOTES, COL_TRANSFERVOID, COL_RECN,
-        COL_STATUS, COL_COMM, COL_VALUE, COL_RATE, COL_AMOUNT, COL_DEBIT, COL_CREDIT, -1};
-        return col_list;
-        }
-        break;
-
-    case STOCK_REGISTER2:
-    case CURRENCY_REGISTER2:
-        {
-        static ViewCol col_list[] = {
-        COL_DATE, COL_NUMACT, COL_DESCNOTES, COL_TRANSFERVOID, COL_RECN,
-        COL_STATUS, COL_AMTVAL, COL_PRICE, COL_DEBIT, COL_CREDIT, COL_BALANCE, -1};
-        return col_list;
-        }
-        break;
-
-    case RECEIVABLE_REGISTER2:
-    case PAYABLE_REGISTER2:
-        {
-        static ViewCol col_list[] = {
-        COL_DATE, COL_TYPE, COL_DUEDATE, COL_NUMACT, COL_DESCNOTES, COL_TRANSFERVOID,
-        COL_STATUS, COL_DEBIT, COL_CREDIT, COL_BALANCE, -1};
-        return col_list;
-        }
-
-     case PORTFOLIO_LEDGER2:
-        {
-        static ViewCol col_list[] = {
-        COL_DATE, COL_NUMACT, COL_DESCNOTES, COL_TRANSFERVOID, COL_RECN,
-        COL_STATUS, COL_AMOUNT, COL_PRICE, COL_DEBIT, COL_CREDIT, -1};
-        return col_list;
-        }
-
-    case SEARCH_LEDGER2:
-        {
-        static ViewCol col_list[] = {
-        COL_DATE, COL_NUMACT, COL_DESCNOTES, COL_TRANSFERVOID, COL_RECN,
-        COL_STATUS, COL_DEBIT, COL_CREDIT, -1};
-        return col_list;
-        }
-        break;
-
-    default:
-        {
-        static ViewCol col_list[] = {
-        COL_DATE, COL_NUMACT, COL_DESCNOTES, COL_TRANSFERVOID, COL_RECN,
-	COL_STATUS,
-        COL_VALUE, COL_AMOUNT, COL_RATE, COL_PRICE, COL_DEBIT, COL_CREDIT,
-        COL_BALANCE, -1};
-        return col_list;
-        }
-    }
-}
-
-
-/* Creates a treeview with the list of fields */
-static GncTreeViewSplitReg *
-gnc_tree_view_split_reg_set_cols (GncTreeViewSplitReg *view,
-				  GncTreeModelSplitReg *model,
-				  ViewCol col_list[])
-{
-    int i = 0;
-
-    while (col_list && col_list[i] != -1) {
-        GList *renderers;
-        GtkCellRenderer *cr0;
-        GtkCellRenderer *cr1;
-        GtkTreeViewColumn *col;
-        ColDef def;
-
-        int j, ncol = G_N_ELEMENTS (all_tree_view_split_reg_columns);
-
-        for (j = 0; j < ncol; j++) {
-            if (col_list[i] == all_tree_view_split_reg_columns[j].viewcol) {
-                def = all_tree_view_split_reg_columns[j];
-                break;
-            }
-        }
-        if (j == ncol) {
-            PERR("Failed to find column definition.");
-            i++;
-            continue;
-        }
-        if (col_list[i] == COL_TRANSFERVOID) {
-
-            col = gnc_tree_view_add_combo_column (
-                GNC_TREE_VIEW (view), def.title, def.pref_name, def.sizer,
-                def.modelcol, def.visibility_model_col,
-                GTK_TREE_MODEL (gnc_tree_model_split_reg_get_acct_list (model)), 0, def.sort_fn);
-
-        } else if (col_list[i] == COL_DATE) {
-            col = gnc_tree_view_add_date_column (
-                GNC_TREE_VIEW (view), def.title, def.pref_name, NULL, def.sizer,
-                def.modelcol, def.visibility_model_col, def.sort_fn);
-
-        } else if (col_list[i] == COL_NUMACT) { 
-            col = gnc_tree_view_add_combo_column (
-                GNC_TREE_VIEW (view), def.title, def.pref_name, def.sizer,
-                def.modelcol, def.visibility_model_col,
-                GTK_TREE_MODEL (gnc_tree_model_split_reg_get_action_list (model)), 0, def.sort_fn);
-
-            // Here we are adding a second renderer, we will use the model to switch between the
-            // two by hiding one so we endup with rows of text or combo renderers.
-            cr1 = gtk_cell_renderer_text_new ();
-            gtk_tree_view_column_pack_start (col, cr1, TRUE);
-            gtk_tree_view_column_add_attribute (col, cr1, "visible", GNC_TREE_MODEL_SPLIT_REG_COL_NUM_VIS);
-
-            // Set all the same properties as the first renderer.
-            g_object_set (cr1, "xalign", 1.0, NULL);
-            g_object_set_data (G_OBJECT(cr1), "model_column", GINT_TO_POINTER (def.modelcol));
-            g_object_set_data (G_OBJECT(cr1), "column_name", GINT_TO_POINTER (def.pref_name));
-            g_signal_connect (G_OBJECT(cr1), "editing-started", (GCallback) def.editing_started_cb, view);
-            g_signal_connect (G_OBJECT(cr1), "editing-canceled", G_CALLBACK (gtv_sr_editing_canceled_cb), view);
-            g_object_set (G_OBJECT (cr1), "editable", TRUE, NULL);
-            g_signal_connect (G_OBJECT (cr1), "edited", (GCallback) def.edited_cb, view);
-            g_object_set_data (G_OBJECT (cr1), "view_column", GINT_TO_POINTER (def.viewcol));
-            gtk_tree_view_column_set_cell_data_func (col, cr1, gtv_sr_cdf1, view, NULL);
-
-        } else { 
-            col = gnc_tree_view_add_text_column (
-                GNC_TREE_VIEW (view), def.title, def.pref_name, NULL, def.sizer,
-                def.modelcol, def.visibility_model_col, def.sort_fn);
-        } 
-
-        g_object_set_data (G_OBJECT (col), DEFAULT_VISIBLE, GINT_TO_POINTER (1));
-        g_object_set_data (G_OBJECT (col), ALWAYS_VISIBLE, GINT_TO_POINTER (def.always_visible_col));
-
-        // Set the properties for the first renderer.
-        renderers = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (col));
-        cr0 = g_list_nth_data (renderers, 0);
-        g_list_free (renderers);
-
-        /* Setup cell background color and default alignment */
-        g_object_set (cr0, "xalign", 1.0, NULL);
-
-        if (col_list[i] == COL_NUMACT)
-            gtk_tree_view_column_add_attribute (col, cr0, "visible", GNC_TREE_MODEL_SPLIT_REG_COL_ACT_VIS);
-
-        /* Add the full title for status column to the object for menu creation */
-        if (col_list[i] == COL_STATUS)
-            g_object_set_data_full (G_OBJECT(col), REAL_TITLE, g_strdup (_("Status Bar")), g_free);
-
-        /* This sets the background of the treeview control columns */
-        gnc_tree_view_set_control_column_background (GNC_TREE_VIEW (view), 0, gtv_sr_control_cdf0);
-
-        if (def.editing_started_cb)
-        {
-            //Store the position of the column in the model
-            g_object_set_data (G_OBJECT (cr0), "model_column", GINT_TO_POINTER (def.modelcol));
-            g_object_set_data (G_OBJECT (cr0), "column_name", GINT_TO_POINTER (def.pref_name));
-            g_signal_connect (G_OBJECT (cr0), "editing-started", (GCallback) def.editing_started_cb, view);
-        }
-
-        // Connect editing-canceled signal so that edit-cancelled can be set appropriately
-        g_signal_connect (G_OBJECT (cr0), "editing-canceled", G_CALLBACK (gtv_sr_editing_canceled_cb), view);
-
-        gtk_tree_view_column_set_sizing (col, GTK_TREE_VIEW_COLUMN_FIXED);
-
-//        gtk_tree_view_column_set_min_width (col, -1);
-
-        // Set Columns to be resizable default.
-        g_object_set (G_OBJECT (col), "resizable", TRUE, NULL);
-
-        // Allow the columns to be reorderable.
-        g_object_set (G_OBJECT (col), "reorderable", TRUE, NULL);
-
-        if (def.edited_cb)
-        {
-            g_object_set (G_OBJECT (cr0), "editable", TRUE, NULL);
-            g_signal_connect (G_OBJECT (cr0), "edited", (GCallback) def.edited_cb, view);
-        }
-
-        g_object_set_data (G_OBJECT (cr0), "view_column", GINT_TO_POINTER (def.viewcol));
-        gtk_tree_view_column_set_cell_data_func (col, cr0, gtv_sr_cdf0, view, NULL);
-
-        i++;
-    }
-    gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW (view)), GTK_SELECTION_BROWSE);
-
-    g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (view)), "changed", G_CALLBACK (gtv_sr_motion_cb), view);
-
-    //Add a data-edited property to keep track of transaction edits.
-    g_object_set_data (G_OBJECT (view), "data-edited", GINT_TO_POINTER (FALSE));
-
-    // This is used to move the selected item if the selected transaction is deleted.
-    g_signal_connect (G_OBJECT (model), "selection_move_delete", G_CALLBACK (gtv_sr_selection_move_delete_cb), view);
-
-    // This will refresh the view.
-    g_signal_connect (G_OBJECT (model), "refresh_view", G_CALLBACK (gtv_sr_refresh_view_cb), view);
-
-    // This is for key navigation, tabbing...
-    g_signal_connect (G_OBJECT (view), "key-press-event", G_CALLBACK (gtv_sr_key_press_cb), NULL);
-
-    // This is for mouse buttons...
-    g_signal_connect (G_OBJECT (view), "button_press_event", G_CALLBACK (gtv_sr_button_cb), NULL);
-
-    return view;
-}
-
-
-/* Set up the view */
-gboolean
-gnc_tree_view_split_reg_set_format (GncTreeViewSplitReg *view)
-{
-    GncTreeViewSplitRegPrivate *priv;
-    GncTreeModelSplitReg *model;
-    GtkTreePath *mpath, *spath;
-    gint total_num = 0;
-
-    ENTER(" #### Set View Format #### ");
-
-    model = gnc_tree_view_split_reg_get_model_from_view (view);
-
-    priv = view->priv;
-
-    total_num = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (model), NULL);
-
-    mpath = gtk_tree_row_reference_get_path (view->priv->current_ref);
-
-    spath = gnc_tree_view_split_reg_get_sort_path_from_model_path (view, mpath);
-
-    priv->expanded = FALSE;
-
-    {
-        if (model->style == REG2_STYLE_JOURNAL)
-        {
-            gtk_tree_view_expand_all (GTK_TREE_VIEW (view));
-
-            priv->expanded = TRUE;
-
-            gtk_tree_path_free (mpath);
-            gtk_tree_path_free (spath);
-
-            /* This updates the plugin page gui */
-            gnc_tree_view_split_reg_call_uiupdate_cb (view);
-
-            LEAVE("#### Journal format ####");
-            return (FALSE);
-        }
-
-        if (!model->use_double_line)
-        {
-            gtk_tree_view_collapse_all (GTK_TREE_VIEW (view));
-
-            priv->expanded = FALSE;
-
-            LEAVE("#### Single line foramt ####");
-        }
-
-        if (model->use_double_line)
-        {
-            gint index = 0;
-            GtkTreePath *path;
-
-            path = gtk_tree_path_new_first ();
-            while (index < total_num)
-            {
-                gtk_tree_view_expand_to_path (GTK_TREE_VIEW (view), path);
-                gtk_tree_path_down (path);
-                gtk_tree_view_collapse_row (GTK_TREE_VIEW (view), path);
-                gtk_tree_path_up (path);
-                gtk_tree_path_next (path); //Next Transaction
-                index = index + 1;
-            }
-            gtk_tree_path_free (path);
-            LEAVE("#### Double line format ####");
-        }
-
-        /* This expands to split from top level auto.. */
-        if ((model->style == REG2_STYLE_AUTO_LEDGER) || (model->style == REG2_STYLE_JOURNAL))
-        {
-            gtk_tree_view_expand_row (GTK_TREE_VIEW (view), spath, TRUE);
-
-            priv->expanded = TRUE;
-            LEAVE("#### Auto expand line format ####");
-        }
-    }
-
-    gtk_tree_path_free (mpath);
-    gtk_tree_path_free (spath);
-
-    /* This updates the plugin page gui */
-    gnc_tree_view_split_reg_call_uiupdate_cb (view);
-
-    return (FALSE);
-}
-
-
-/* Set up the view for this transaction, used in transaction discard and cancel */
-static gboolean
-gnc_tree_view_split_reg_format_trans (GncTreeViewSplitReg *view, Transaction *trans)
-{
-    GncTreeViewSplitRegPrivate *priv;
-    GncTreeModelSplitReg *model;
-    GtkTreePath *mpath, *spath;
-
-    ENTER(" ");
-
-    model = gnc_tree_view_split_reg_get_model_from_view (view);
-
-    priv = view->priv;
-
-    mpath = gnc_tree_model_split_reg_get_path_to_split_and_trans (model, NULL, trans);
-
-    spath = gnc_tree_view_split_reg_get_sort_path_from_model_path (view, mpath);
-
-    if ((!model->use_double_line) && (model->style != REG2_STYLE_JOURNAL))
-    {
-        gtk_tree_view_collapse_row (GTK_TREE_VIEW (view), spath);
-        priv->expanded = FALSE;
-        LEAVE("#### Single line transaction foramt ####");
-    }
-
-    if ((model->use_double_line) && (model->style != REG2_STYLE_JOURNAL))
-    {
-        gtk_tree_view_expand_to_path (GTK_TREE_VIEW (view), spath);
-        gtk_tree_path_down (spath);
-        gtk_tree_view_collapse_row (GTK_TREE_VIEW (view), spath);
-        gtk_tree_path_up (spath);
-        priv->expanded = FALSE;
-        LEAVE("#### Double line transaction format ####");
-    }
-
-    /* This expands to split from top level auto.. */
-    if ((model->style == REG2_STYLE_AUTO_LEDGER) || (model->style == REG2_STYLE_JOURNAL))
-    {
-        gtk_tree_view_expand_row (GTK_TREE_VIEW (view), spath, TRUE);
-        priv->expanded = TRUE;
-        LEAVE("#### Auto expand line transaction format ####");
-    }
-
-    gtk_tree_path_free (mpath);
-    gtk_tree_path_free (spath);
-
-    /* This updates the plugin page gui */
-    gnc_tree_view_split_reg_call_uiupdate_cb (view);
-
-    return (FALSE);
-}
-
-
-/* Callback to update the view after transactions are added or deleted */
-static void
-gtv_sr_refresh_view_cb (GncTreeModelSplitReg *model, gpointer user_data)
-{
-    GncTreeViewSplitReg *view = user_data;
-
-    gnc_tree_view_split_reg_set_format (view);
-}
-
-
-/* Create a tree view from a given model */
-GncTreeViewSplitReg*
-gnc_tree_view_split_reg_new_with_model (GncTreeModelSplitReg *model)
-{
-    GtkTreeModel        *s_model;
-    GncTreeViewSplitReg *view;
-    GtkTreeSelection    *selection;
-
-    view = g_object_new (gnc_tree_view_split_reg_get_type(), NULL);
-    g_object_set (view, "name", "split_reg_tree", NULL);
-
-    view->priv->anchor = gnc_tree_model_split_reg_get_anchor (model);
-    view->priv->reg_comm = xaccAccountGetCommodity (view->priv->anchor);
-    view->priv->reg_currency = gnc_account_or_default_currency (view->priv->anchor, NULL);
-    g_assert (view->priv->reg_currency);
-    g_assert (gnc_commodity_is_currency (view->priv->reg_currency));
-    view->help_text = g_strdup ("Help Text");
-
-    /* Set the grid lines to be solid */
-    gnc_widget_set_style_context (GTK_WIDGET(view), "treeview_grid_lines");
-
-    /* TreeView Grid lines */
-    if (view->priv->use_horizontal_lines)
-    {
-        if (view->priv->use_vertical_lines)
-            gtk_tree_view_set_grid_lines (GTK_TREE_VIEW (view), GTK_TREE_VIEW_GRID_LINES_BOTH);
-        else
-            gtk_tree_view_set_grid_lines (GTK_TREE_VIEW (view), GTK_TREE_VIEW_GRID_LINES_HORIZONTAL);
-    }
-    else if (view->priv->use_vertical_lines)
-            gtk_tree_view_set_grid_lines (GTK_TREE_VIEW (view), GTK_TREE_VIEW_GRID_LINES_VERTICAL);
-    else
-        gtk_tree_view_set_grid_lines (GTK_TREE_VIEW (view), GTK_TREE_VIEW_GRID_LINES_NONE);
-
-    // Set the view to fixed height mode...
-//    gtk_tree_view_set_fixed_height_mode (GTK_TREE_VIEW (view), TRUE);
-
-    /* Expanders off */
-    gtk_tree_view_set_show_expanders (GTK_TREE_VIEW (view), FALSE);
-
-    /* Tree Selection */
-    selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (view));
-
-    gtk_tree_selection_unselect_all (selection);
-
-    // Setup the sort model
-    s_model = gtk_tree_model_sort_new_with_model (GTK_TREE_MODEL (model));
-
-    PINFO("#### After Models are Setup ####");
-
-    /* Set the user_data for the sort callback */
-    gnc_tree_view_set_sort_user_data (GNC_TREE_VIEW (view), s_model);
-
-    /* Set up the columns */
-    gnc_tree_view_split_reg_set_cols (view, model, gnc_tree_view_split_reg_get_colummn_list (model));
-
-    PINFO("#### Before View connected to Model ####");
-
-    // Connect model to tree view
-    gtk_tree_view_set_model (GTK_TREE_VIEW (view), s_model);
-    g_object_unref (G_OBJECT (s_model));
-
-    PINFO("#### After View connected to Model ####");
-
-    // Default the sorting to date.
-    gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (s_model),
-                                          GNC_TREE_MODEL_SPLIT_REG_COL_DATE,
-                                          GTK_SORT_ASCENDING);
-
-    PINFO("#### After Set Default Sort Column ####");
-
-    return view;
-}
-
-
-/* This allows the blocking / unblocking of selection */
-void
-gnc_tree_view_split_reg_block_selection (GncTreeViewSplitReg *view, gboolean block)
-{
-    if (block)
-        g_signal_handlers_block_by_func (gtk_tree_view_get_selection (GTK_TREE_VIEW (view)), gtv_sr_motion_cb, view);
-    else
-        g_signal_handlers_unblock_by_func (gtk_tree_view_get_selection (GTK_TREE_VIEW (view)), gtv_sr_motion_cb, view);
-}
-
-
-/* Set the default selection path */
-void
-gnc_tree_view_split_reg_default_selection (GncTreeViewSplitReg *view)
-{
-    GncTreeModelSplitReg *model;
-    GtkTreePath *new_mpath, *mpath, *spath;
-    gint *indices;
-
-    ENTER("#### Default Selection ####");
-
-    model = gnc_tree_view_split_reg_get_model_from_view (view);
-
-    /* Do we have a current transaction set on the model, use it */
-    if (model->current_trans != NULL)
-        view->priv->current_trans = model->current_trans;
-
-    /* Set the default start position to end of list */
-    if (view->priv->current_trans == NULL)
-    {
-        Transaction *btrans;
-
-        btrans = gnc_tree_control_split_reg_get_blank_trans (view);
-        mpath = gnc_tree_model_split_reg_get_path_to_split_and_trans (model, NULL, btrans);
-        view->priv->current_trans = btrans;
-    }
-    else
-        mpath = gnc_tree_model_split_reg_get_path_to_split_and_trans (model, view->priv->current_split, view->priv->current_trans);
-
-    indices = gtk_tree_path_get_indices (mpath);
-
-    if (view->priv->current_depth == 2)
-        new_mpath = gtk_tree_path_new_from_indices (indices[0], indices[1], -1);
-    else
-        new_mpath = gtk_tree_path_new_from_indices (indices[0], -1);
-
-    spath = gnc_tree_view_split_reg_get_sort_path_from_model_path (view, new_mpath);
-
-    {
-        gchar *mstring, *sstring, *tstring;
-        mstring = gtk_tree_path_to_string (mpath);
-        sstring = gtk_tree_path_to_string (spath);
-        tstring = gtk_tree_path_to_string (new_mpath);
-        DEBUG("default_selection mpath is %s, spath is %s, new path is %s", mstring, sstring, tstring);
-        g_free (mstring);
-        g_free (sstring);
-        g_free (tstring);
-    }
-
-    if (view->priv->current_ref != NULL)
-    {
-        gtk_tree_row_reference_free (view->priv->current_ref);
-        view->priv->current_ref = NULL;
-    }
-    view->priv->current_ref = gtk_tree_row_reference_new (GTK_TREE_MODEL (model), new_mpath);
-
-    /* Update the titles */
-    gtv_sr_titles (view, view->priv->current_depth);
-
-    /* Make sure blank split is on current transaction */
-    gnc_tree_model_split_reg_set_blank_split_parent (model, view->priv->current_trans, FALSE);
-
-    PINFO("#### Default Selection - After Titles ####");
-
-    /* Set the view format */
-    gnc_tree_view_split_reg_set_format (view);
-
-    PINFO("#### Default Selection - After View Format ####");
-
-    /* scroll window to show selection */
-    gnc_tree_view_split_reg_scroll_to_cell (view);
-
-    /* Set cursor to new spath */
-    gtk_tree_view_set_cursor (GTK_TREE_VIEW (view), spath, NULL, FALSE);
-
-    gtk_tree_path_free (mpath);
-    gtk_tree_path_free (spath);
-    gtk_tree_path_free (new_mpath);
-
-    LEAVE("#### Leave Default Selection ####");
-}
-
-/*###########################################################################*/
-
-/* Sets read only flag */
-void
-gnc_tree_view_split_reg_set_read_only (GncTreeViewSplitReg *view, gboolean read_only)
-{
-    GncTreeModelSplitReg *model;
-
-    model = gnc_tree_view_split_reg_get_model_from_view (view);
-
-    model->read_only = read_only;
-}
-
-
-/* Return the register commodity */
-gnc_commodity *
-gnc_tree_view_split_reg_get_reg_commodity (GncTreeViewSplitReg *view)
-{
-    return view->priv->reg_comm;
-}
-
-
-/* Returns a Split that matches the current Account */
-static Split *
-gtv_sr_get_this_split (GncTreeViewSplitReg *view, Transaction *trans)
-{
-    GncTreeModelSplitReg *model;
-    int i;
-    Split *split = NULL;
-    Account *anchor;
-
-    model = gnc_tree_view_split_reg_get_model_from_view (view);
-
-    anchor = gnc_tree_model_split_reg_get_anchor (model);
-
-    if (xaccTransCountSplits (trans) == 0) // this may be a blank or a reinit trans.
-    {
-        if (gnc_tree_model_split_reg_is_blank_split_parent (model, trans))
-            return gnc_tree_model_split_get_blank_split (model);
-    }
-
-    for (i = 0; (split = xaccTransGetSplit (trans, i)); i++) {
-        if (anchor == xaccSplitGetAccount (split))
-            return split;
-    }
-    return NULL;
-}
-
-
-/* The returned Splits may be newly created and not yet belong to trans. */
-static gboolean
-gtv_sr_get_split_pair (GncTreeViewSplitReg *view, Transaction *trans, Split **osplit, Split **split)
-{
-    GncTreeModelSplitReg *model;
-    QofBook       *book;
-
-    gint count = xaccTransCountSplits (trans);
-    Account *anchor = view->priv->anchor;
-
-    book = gnc_get_current_book();
-
-    model = gnc_tree_view_split_reg_get_model_from_view (view);
-
-    if (count == 0) // blank trans
-    {
-        *split = gnc_tree_model_split_get_blank_split (model);
-        xaccSplitSetAccount (*split, anchor);
-        xaccSplitSetParent (*split, trans);
-        *osplit = xaccMallocSplit (book);
-        xaccSplitSetParent (*osplit, trans);
-    }
-    else
-    {
-        int i;
-        Split *s, *first_split;
-
-        first_split = xaccTransGetSplit (trans, 0);
-
-        if (gnc_tree_util_split_reg_is_multi (first_split)) // multi trans
-            return FALSE;
-        else // two split trans
-        {
-            for (i = 0; (s = xaccTransGetSplit (trans, i)); i++)
-            {
-                if (anchor == xaccSplitGetAccount (s))
-                {
-                    *split = s;
-                    break;
-                }
-            }
-            g_assert (*split);
-            *osplit = xaccSplitGetOtherSplit(*split);
-            g_assert (*osplit);
-        }
-    }
-    DEBUG("gtv_sr_get_split_pair return - trans is %p, osplit is %p and split %p is set to anchor %p", trans, *osplit, *split, anchor);
-    return TRUE;
-}
-
-
-/* Does this transaction have any Imbalance splits */
-static gboolean
-gtv_sr_get_imbalance (Transaction *trans)
-{
-    int i;
-    Split *split = NULL;
-    const gchar *acc_name;
-    const gchar *prefix = _("Imbalance"); 
-
-    for (i = 0; (split = xaccTransGetSplit (trans, i)); i++)
-    {
-        if (xaccSplitGetAccount (split) != NULL)
-        {
-            acc_name = xaccAccountGetName (xaccSplitGetAccount (split));
-
-            if (g_str_has_prefix (acc_name, prefix))
-                return TRUE;
-        }
-    }
-    return FALSE;
-}
-
-
-/* Only allow changes to values if we have valid split accounts */
-static gboolean
-gtv_sr_have_account (GncTreeViewSplitReg *view, RowDepth depth, gboolean expanded, gboolean is_template, Transaction *trans, Split *split)
-{
-    gboolean gtv_sr_have_account = FALSE;
-
-    DEBUG("gtv_sr_have_account trans %p, split %p, expanded %d, depth %d", trans, split, expanded, depth);
-
-    if ((depth == TRANS1) && !expanded && !gnc_tree_util_split_reg_is_multi (split)) // normal trans
-    {
-        if (xaccSplitGetAccount (xaccSplitGetOtherSplit (split)) != NULL)
-            gtv_sr_have_account = TRUE;
-    }
-
-    if ((depth == SPLIT3) && (xaccTransCountSplits (trans) == 0)) // blank trans, blank split
-        gtv_sr_have_account = TRUE;
-
-    if (depth == SPLIT3)
-    {
-        if (!is_template) // Are we using a template
-        {
-            Account *acc = xaccSplitGetAccount (split);
-            if (acc != NULL)
-            {
-                if (xaccAccountGetType (acc) != ACCT_TYPE_TRADING)
-                    gtv_sr_have_account = TRUE; // normal split
-                else
-                    gtv_sr_have_account = FALSE; // trading split
-            }
-         }
-         else
-         {
-             if (gnc_tree_util_split_reg_template_get_transfer_entry (split) != NULL)
-                 gtv_sr_have_account = TRUE;
-         }
-    }
-    return gtv_sr_have_account;
-}
-
-/*###########################################################################*/
-
-/* This cellDataFunc is to set the cell-background property of the control columns. */
-static void
-gtv_sr_control_cdf0 (GtkTreeViewColumn *col, GtkCellRenderer *cell, GtkTreeModel *s_model,
-    GtkTreeIter *s_iter, gpointer user_data)
-{
-    GncTreeViewSplitReg *view = GNC_TREE_VIEW_SPLIT_REG (user_data);
-    GncTreeModelSplitReg *model;
-    GtkTreeIter m_iter;
-    GtkTreePath *mpath;
-    Transaction *trans;
-    Split *split;
-    gboolean is_split, is_blank, is_trow1, is_trow2;
-    const gchar *row_color;
-
-    gint *indices;
-
-    ENTER("");
-
-    model = gnc_tree_view_split_reg_get_model_from_view (view);
-
-    gtk_tree_model_sort_convert_iter_to_child_iter (GTK_TREE_MODEL_SORT (s_model), &m_iter, s_iter);
-
-    g_return_if_fail (gnc_tree_model_split_reg_get_split_and_trans (
-                         GNC_TREE_MODEL_SPLIT_REG (model), &m_iter,
-                          &is_trow1, &is_trow2, &is_split, &is_blank,
-                          &split, &trans));
-
-    mpath = gtk_tree_model_get_path (GTK_TREE_MODEL (model), &m_iter);
-
-    indices = gtk_tree_path_get_indices (mpath);
-
-    row_color = gnc_tree_model_split_reg_get_row_color (model, is_trow1, is_trow2, is_split, indices[0]);
-
-    gtk_tree_path_free (mpath);
-
-    /* Set the background color / this works for sorting and deleting transactions */
-    g_object_set (cell, "cell-background", row_color, (gchar*)NULL);
-
-    LEAVE("");
-}
-
-
-/* Instead of setting a different cellDataFunc for each column, we just
-   collect everything here for the first cell renderer. */
-static void
-gtv_sr_cdf0 (GtkTreeViewColumn *col, GtkCellRenderer *cell, GtkTreeModel *s_model,
-    GtkTreeIter *s_iter, gpointer user_data)
-{
-    GncTreeViewSplitReg *view = GNC_TREE_VIEW_SPLIT_REG (user_data);
-    GncTreeModelSplitReg *model;
-    GtkTreeIter m_iter;
-    GtkTreePath *spath;
-    ViewCol viewcol;
-    Transaction *trans;
-    Split *split;
-    gboolean is_split, is_blank, is_trow1, is_trow2;
-    gboolean editable = FALSE, expanded = FALSE;
-    gboolean read_only = FALSE;
-    gboolean open_edited = FALSE;
-    gboolean is_template = FALSE;
-    gboolean negative_in_red = FALSE;
-    gboolean show_extra_dates = FALSE;
-    gnc_numeric num = gnc_numeric_zero();
-    const gchar *s = "";
-    const gchar *row_color;
-    RowDepth depth;
-    gint *indices;
-    Account *anchor = view->priv->anchor;
-    char type;
-
-    ENTER("");
-
-    model = gnc_tree_view_split_reg_get_model_from_view (view);
-
-    gtk_tree_model_sort_convert_iter_to_child_iter (GTK_TREE_MODEL_SORT (s_model), &m_iter, s_iter);
-
-    viewcol = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (cell), "view_column"));
-
-    g_return_if_fail (gnc_tree_model_split_reg_get_split_and_trans (
-                         GNC_TREE_MODEL_SPLIT_REG (model), &m_iter,
-                          &is_trow1, &is_trow2, &is_split, &is_blank,
-                          &split, &trans));
-
-    spath = gtk_tree_model_get_path (GTK_TREE_MODEL (s_model), s_iter);
-
-    depth = gtk_tree_path_get_depth (spath);
-
-    indices = gtk_tree_path_get_indices (spath);
-
-    row_color = gnc_tree_model_split_reg_get_row_color (model, is_trow1, is_trow2, is_split, indices[0]);
-
-    /* Lets see if the splits are expanded */
-    if (is_trow1 || is_trow2) // transaction
-    {
-        if (is_trow1)
-            gtk_tree_path_down (spath); /* Move the path down to trow2 */
-        expanded = gtk_tree_view_row_expanded (GTK_TREE_VIEW (view), spath);
-    }
-    else
-        expanded = TRUE; // splits are always expanded
-
-    gtk_tree_path_free (spath);
-
-    /* Set the background color / this works for sorting and deleting of transactions */
-    g_object_set (cell, "cell-background", row_color, (gchar*)NULL);
-
-    /* Get the read only model setting */
-    gtk_tree_model_get (GTK_TREE_MODEL (model), &m_iter, GNC_TREE_MODEL_SPLIT_REG_COL_RO, &read_only, -1);
-
-    /* Are we being edited in other register */
-    if (xaccTransIsOpen (trans) && (view->priv->dirty_trans != trans))
-    {
-        read_only = TRUE;
-        open_edited = TRUE;
-    }
-
-    /* Test for a transaction type of invoice, always read only */
-    type = xaccTransGetTxnType (trans);
-    if (model->type == RECEIVABLE_REGISTER2 || model->type == PAYABLE_REGISTER2)
-    {
-        if (((type == TXN_TYPE_INVOICE) || (type == TXN_TYPE_NONE)) && (view->priv->dirty_trans != trans) && !is_blank)
-            read_only = TRUE;
-    }
-
-    /* Is this a template */
-    is_template = gnc_tree_model_split_reg_get_template (model);
-
-    /* Show negative numbers in red */
-    negative_in_red = view->priv->negative_in_red;
-
-    switch (viewcol) {
-    case COL_DATE:
-        /* Column is DATE */
-        if (is_split)
-            g_object_set (cell, "cell-background", "white", (gchar*)NULL);
-
-        // Show the extra dates for selected transaction
-        if ((view->priv->current_trans == trans) && view->priv->show_extra_dates_on_selection)
-            show_extra_dates = TRUE;
-
-        // Show the extra dates always
-        if (view->show_extra_dates == TRUE)
-            show_extra_dates = TRUE;
-
-        if (is_trow1) {
-            Timespec ts = {0,0};
-            xaccTransGetDatePostedTS (trans, &ts);
-            //If the time returned by xaccTransGetDatePostedTS is 0 then assume it
-            //is a new transaction and set the time to current time to show current
-            //date on new transactions
-            if (ts.tv_sec == 0)
-            {
-                ts.tv_sec = gnc_time (NULL);
-                //xaccTransSetDatePostedSecs (trans, ts.tv_sec);
-            }//if
-            s = gnc_print_date (ts);
-            editable = TRUE;
-        }
-        else if (is_trow2 && show_extra_dates) {
-            Timespec ts = {0,0};
-
-            g_object_set (cell, "cell-background", YELLOWCELL, (gchar*)NULL);
-
-            xaccTransGetDateEnteredTS (trans, &ts);
-            //If the time returned by xaccTransGetDateEnteredTS is 0 then assume it
-            //is a new transaction and set the time to current time to show current
-            //date on new transactions
-            if (ts.tv_sec == 0)
-            {
-                ts.tv_sec = gnc_time (NULL);
-                //xaccTransSetDateEnteredSecs (trans, ts.tv_sec);
-            }//if
-            s = gnc_print_date (ts);
-            editable = FALSE;
-        }
-        else if (is_split && show_extra_dates) {
-            Timespec ts = {0,0};
-
-            if (xaccSplitGetReconcile (split) == YREC)
-            {
-                xaccSplitGetDateReconciledTS (split, &ts);
-                //If the time returned by xaccTransGetDateEnteredTS is 0 then assume it
-                //is a new transaction and set the time to current time to show current
-                //date on new transactions
-                if (ts.tv_sec == 0)
-                {
-                    ts.tv_sec = gnc_time (NULL);
-                    //xaccSplitSetDateReconciledTS (split, ts.tv_sec);
-                }//if
-                s = gnc_print_date (ts);
-            }
-            else
-                s = "";
-            editable = FALSE;
-        }
-        else {
-            s = "";
-            editable = FALSE;
-        }
-
-        /* Is this a template */
-        if (is_template && is_trow1)
-        {
-            s =  _(" Scheduled ");
-            editable = FALSE;
-        }
-        else if (is_template && is_trow2 && show_extra_dates)
-        {
-            s = "";
-            editable = FALSE;
-        }
-        else if (is_template && is_split && show_extra_dates)
-        {
-            s = "";
-            editable = FALSE;
-        }
-
-        editable = (read_only == TRUE) ? FALSE : editable;
-
-        /* This will remove the calander buttons if FALSE */
-        g_object_set (cell, "use_buttons", view->priv->show_calendar_buttons, NULL );
-        g_object_set (cell, "text", s, "editable", editable, NULL);
-        break;
-
-    case COL_DUEDATE:
-        /* Column is DUE DATE */
-        if (is_split)
-            g_object_set (cell, "cell-background", "white", (gchar*)NULL);
-
-        if (is_trow1) {
-            Timespec ts = {0,0};
-
-            /* Only print the due date for invoice transactions */
-            if (type == TXN_TYPE_INVOICE)
-            {
-                xaccTransGetDateDueTS (trans, &ts);
-                s = gnc_print_date (ts);
-                editable = FALSE;
-            }
-            else {
-                s = "";
-                editable = FALSE;
-            }
-        }
-        editable = (read_only == TRUE) ? FALSE : editable;
-
-        g_object_set (cell, "text", s, "editable", editable, NULL);
-        break;
-
-    case COL_NUMACT:
-        /* Column is NUM / ACT but relates to ACT */
-        /* Override default alignment */
-        g_object_set (cell, "xalign", 0.0, NULL );
-
-        editable = TRUE;
-
-        if (is_trow1)
-            /* Get per book option */
-            s = gnc_get_num_action (trans, gtv_sr_get_this_split (view, trans));
-
-        else if (is_trow2 && expanded)
-        {
-            /* Get per book option */
-            if (qof_book_use_split_action_for_num_field (gnc_get_current_book()))
-                s = gnc_get_action_num (trans, gtv_sr_get_this_split (view, trans));
-            else
-                s = "";
-            editable = FALSE;
-        }
-        else if (is_trow2 && !expanded)
-        {
-            /* Get per book option */
-            if (gtv_sr_get_this_split (view, trans) != NULL) // Blank split of blank trans is not child of trans yet.
-               s = gnc_get_action_num (trans, gtv_sr_get_this_split (view, trans));
-            else
-               s = "";
-        }
-        else if (is_split)
-            /* Get split-action with gnc_get_num_action which is the same as
-             * xaccSplitGetAction with these arguments */
-            s = gnc_get_num_action (NULL, split);
-
-        editable = (read_only == TRUE) ? FALSE : editable;
-
-        g_object_set (cell, "text", s, "editable", editable, NULL);
-        break;
-
-    case COL_DESCNOTES:
-        /* Column is DESCRIPTION / NOTES */
-        /* Override default alignment */
-        g_object_set( cell, "xalign", 0.0, NULL );
-        if (is_trow1)
-            s =  xaccTransGetDescription (trans);
-        else if (is_trow2)
-            s =  xaccTransGetNotes (trans);
-        else if (is_split)
-            s = xaccSplitGetMemo (split);
-        editable = TRUE;
-
-        editable = (read_only == TRUE) ? FALSE : editable;
-
-        g_object_set (cell, "text", s, "editable", editable, NULL);
-        break;
-
-    case COL_TRANSFERVOID:
-        /* Column is TRANSFER / VOID */
-        /* Not sure if this will stay here, this sets the combo column
-           0 for short account names, 1 for long */
-        if (view->priv->acct_short_names)
-            g_object_set (G_OBJECT (cell), "text-column", 0, NULL );
-        else
-            g_object_set (G_OBJECT (cell), "text-column", 1, NULL );
-
-        {
-            gchar *string = NULL;
-
-            if (is_trow1)
-            {
-                if (expanded)
-                {
-                    string = g_strdup (" "); /* blank-out if splits are visible */
-                    editable = FALSE;
-                }
-                else
-                {
-                    gboolean is_multi;
-                    string = g_strdup (gnc_tree_util_split_reg_get_transfer_entry (gtv_sr_get_this_split (view, trans), &is_multi));
-
-                    editable = anchor && !expanded && !is_multi;
-                }
-            }
-            if (is_trow2)
-            {
-                string = g_strdup (xaccTransGetVoidReason (trans)); // This is the Void Reason
-                editable = FALSE;
-            }
-            if (is_split)
-            {
-                if (!is_template) // Are we using a template
-                {
-                    Account *acct = xaccSplitGetAccount (split);
-
-                    // This will be all but the General Journal which has anchor == NULL
-                    if ((xaccTransCountSplits (trans) == 0) && (anchor != NULL)) // First split on blank transaction
-                        acct = anchor;
-
-                    if (acct != NULL)
-                    {
-                        if (view->priv->acct_short_names)
-                            string = g_strdup (xaccAccountGetName (acct));
-                        else
-                            string = gnc_account_get_full_name (acct);
-
-                    }
-                    else
-                        string = g_strdup (" ");
-
-                    if (anchor == acct && model->type != GENERAL_JOURNAL2 && model->type != SEARCH_LEDGER2)
-                        editable = FALSE;
-                    else
-                        editable = TRUE;
-                }
-                else
-                {
-                    string = g_strdup (gnc_tree_util_split_reg_template_get_transfer_entry (split));
-                    editable = TRUE;
-                }
-            }
-            editable = (read_only == TRUE) ? FALSE : editable;
-
-            g_object_set (cell, "text", string, "editable", editable, NULL);
-            g_free (string);
-        }
-        break;
-
-    case COL_RECN:
-        /* Column is RECN */
-        /* Override default alignment */
-        g_object_set( cell, "xalign", 0.5, NULL );
-        editable = FALSE;
-        s = "";
-        if (is_trow1 && !expanded)
-        {
-            Split *this_split;
-            char rec;
-
-            this_split = gtv_sr_get_this_split (view, trans);
-
-            if (this_split != NULL) // this could be a blank trans
-            {
-                rec = xaccSplitGetReconcile (this_split);
-                if (rec == VREC || rec == FREC)
-                    editable = FALSE;
-                else
-                    editable = TRUE;
-
-                if (rec != ' ')
-                    s = gnc_get_reconcile_str (rec);
-                else
-                    s = gnc_get_reconcile_str (NREC);
-            }
-        }
-
-        if (is_split)
-        {
-            char rec = xaccSplitGetReconcile (split);
-            if (rec == VREC || rec == FREC)
-                editable = FALSE;
-            else
-                editable = TRUE;
-
-            if (rec != ' ')
-                s = gnc_get_reconcile_str (rec);
-            else
-                s = gnc_get_reconcile_str (NREC);
-        }
-
-        editable = (read_only == TRUE) ? FALSE : editable;
-
-        g_object_set (cell, "text", s, "editable", editable, NULL);
-        break;
-
-    case COL_TYPE:
-        /* Column is TYPE */
-        /* Override default alignment */
-        g_object_set( cell, "xalign", 0.5, NULL );
-        if (is_split)
-            g_object_set (cell, "cell-background", "white", (gchar*)NULL);
-
-        if (is_trow1) {
-            static char ss[2];
-            if (type == TXN_TYPE_NONE)
-                type = '?';
-
-            ss[0] = type;
-            ss[1] = '\0';
-            editable = TRUE;
-            g_object_set (cell, "text", ss, NULL);
-        }
-        else
-        {
-            s = "";
-            editable = FALSE;
-            g_object_set (cell, "text", s, NULL);
-        }
-
-        editable = (read_only == TRUE) ? FALSE : editable;
-
-        g_object_set (cell, "editable", editable, NULL);
-        break;
-
-    case COL_VALUE:
-        /* Column is VALUE */
-        if (is_split)
-        {
-            num = xaccSplitGetValue (split);
-            s = xaccPrintAmount (num, gnc_commodity_print_info (xaccTransGetCurrency (trans), SHOW_SYMBOL));
-            editable = FALSE;
-
-            if (gtv_sr_get_imbalance (trans))
-                g_object_set (cell, "cell-background", PINKCELL, (gchar*)NULL);
-        }
-        else
-        {
-            s = "";
-            editable = FALSE;
-        }
-
-        editable = (read_only == TRUE) ? FALSE : editable;
-
-        // Display negative numbers in red if requested in preferences
-        if (gnc_numeric_negative_p (num) && negative_in_red)
-            g_object_set (cell, "foreground", "red", (gchar*)NULL);
-        else
-            g_object_set (cell, "foreground", NULL, (gchar*)NULL);
-
-        g_object_set (cell, "text", s, "editable", editable, NULL);
-        break;
-
-    case COL_RATE:
-        /* Column is RATE */
-        if ((is_trow1)||(is_trow2))
-        {
-            s = "";
-            editable = FALSE;
-        }
-        else
-        {
-            GNCPrintAmountInfo print_info;
-
-            print_info = gnc_default_price_print_info();
-            print_info.min_decimal_places = 2;
-
-            num = gnc_numeric_convert (gnc_tree_util_get_rate_for (view, trans, split, is_blank), 1000000, GNC_HOW_RND_ROUND_HALF_UP);
-
-            if (gnc_numeric_check (num) == GNC_ERROR_OK)
-                s = xaccPrintAmount (num, print_info);
-            else
-                s = "";
-
-            editable = FALSE;
-
-            if (gtv_sr_get_imbalance (trans))
-                g_object_set (cell, "cell-background", PINKCELL, (gchar*)NULL);
-        }
-
-        editable = (read_only == TRUE) ? FALSE : editable;
-
-        g_object_set (cell, "text", s, "editable", editable, NULL);
-        break;
-
-    case COL_AMOUNT:
-        /* Column is AMOUNT */
-        if (is_split && (anchor == NULL))
-        {
-            num = xaccSplitGetAmount (split);
-            s = xaccPrintAmount (num, gnc_account_print_info (xaccSplitGetAccount (split), SHOW_SYMBOL));
-            editable = FALSE;
-
-            if (gtv_sr_get_imbalance (trans))
-                g_object_set (cell, "cell-background", PINKCELL, (gchar*)NULL);
-        }
-        else if (is_split && (anchor))
-        {
-            gnc_commodity *split_comm;
-            split_comm = xaccAccountGetCommodity (xaccSplitGetAccount (split));
-
-            if (!gnc_commodity_is_currency (split_comm) || (is_blank))
-            {
-                num = xaccSplitGetAmount (split);
-                s = xaccPrintAmount (num, gnc_account_print_info (xaccSplitGetAccount (split), SHOW_SYMBOL));
-                editable = TRUE;
-            }
-
-            if (gtv_sr_get_imbalance (trans))
-                g_object_set (cell, "cell-background", PINKCELL, (gchar*)NULL);
-        }
-        else
-        {
-            s = "";
-            editable = FALSE;
-        }
-
-        editable = (read_only == TRUE) ? FALSE : editable;
-
-        // Display negative numbers in red if requested in preferences
-        if (gnc_numeric_negative_p (num) && negative_in_red)
-            g_object_set (cell, "foreground", "red", (gchar*)NULL);
-        else
-            g_object_set (cell, "foreground", NULL, (gchar*)NULL);
-
-        g_object_set (cell, "text", s, "editable", editable, NULL);
-        break;
-
-    case COL_AMTVAL:
-        /* Column is AMOUNT / VALUE */
-        if (is_trow2)
-        {
-            s = "";
-            editable = FALSE;
-        }
-        else if (is_trow1) // Value
-        {
-            if (anchor)
-            {
-                Split *this_split;
-
-                this_split = gtv_sr_get_this_split (view, trans);
-
-                num = xaccTransGetAccountValue (trans, anchor);
-
-                editable = !expanded && !gnc_tree_util_split_reg_is_multi (this_split);
-
-                if (expanded)
-                    s = "";
-                else
-                    s = xaccPrintAmount (num, gnc_commodity_print_info (xaccTransGetCurrency (trans), SHOW_SYMBOL));
-            }
-            else
-            {
-                s = "";
-                editable = FALSE;
-            }
-        }
-
-        if (is_split) // Amount
-        {
-            if (anchor == NULL)
-            {
-                num = xaccSplitGetAmount (split);
-                s = xaccPrintAmount (num, gnc_account_print_info (xaccSplitGetAccount (split), SHOW_SYMBOL));
-                editable = TRUE;
-            }
-            else if (anchor)
-            {
-                gnc_commodity *split_comm;
-                split_comm = xaccAccountGetCommodity (xaccSplitGetAccount (split));
-
-                if (!gnc_commodity_is_currency (split_comm) || (is_blank))
-                {
-                    num = xaccSplitGetAmount (split);
-                    s = xaccPrintAmount (num, gnc_account_print_info (xaccSplitGetAccount (split), SHOW_SYMBOL));
-                    editable = TRUE;
-                }
-            }
-            else
-            {
-                s = "";
-                editable = FALSE;
-            }
-
-            if (gtv_sr_get_imbalance (trans))
-                g_object_set (cell, "cell-background", PINKCELL, (gchar*)NULL);
-        }
-
-        /* Only allow changes to entries if we have a valid split accounts */
-        editable = gtv_sr_have_account (view, depth, expanded, is_template, trans, split);
-
-        editable = (read_only == TRUE) ? FALSE : editable;
-
-        // Display negative numbers in red if requested in preferences
-        if (gnc_numeric_negative_p (num) && negative_in_red)
-            g_object_set (cell, "foreground", "red", (gchar*)NULL);
-        else
-            g_object_set (cell, "foreground", NULL, (gchar*)NULL);
-
-        g_object_set (cell, "text", s, "editable", editable, NULL);
-        break;
-
-    case COL_PRICE:
-        /* Column is PRICE */
-        if (is_trow2)
-        {
-            s = "";
-            editable = FALSE;
-        }
-        else if (is_trow1)
-        {
-            if (expanded)
-            {
-                s = "";
-                editable = FALSE;
-            }
-            else
-            {
-                if (anchor)
-                {
-                    Split *this_split;
-
-                    this_split = gtv_sr_get_this_split (view, trans);
-                    if (this_split != NULL) // this could be a blank split
-                    {
-                        if (gnc_tree_util_split_reg_is_multi (this_split))
-                            num = gnc_numeric_zero();
-                        else
-                            num = xaccSplitGetSharePrice (this_split);
-
-                        editable = !expanded && !gnc_tree_util_split_reg_is_multi (this_split);
-
-                        if (gnc_numeric_check (num) == GNC_ERROR_OK)
-                        {
-                            s = xaccPrintAmount (num, gnc_split_amount_print_info (split, SHOW_SYMBOL));
-                        }
-                        else
-                        {
-                            s = "";
-                            editable = FALSE;
-                        }
-                    }
-                    else
-                    {
-                        s = "";
-                        editable = FALSE;
-                    }
-                }
-            }
-        }
-
-        if (is_split)
-        {
-            gnc_commodity *split_comm;
-            split_comm = xaccAccountGetCommodity (xaccSplitGetAccount (split));
-
-            if (!gnc_commodity_is_currency (split_comm) || (is_blank))
-            {
-                num = xaccSplitGetSharePrice (split);
-
-                if (gnc_numeric_check (num) == GNC_ERROR_OK)
-                {
-                    s = xaccPrintAmount (num, gnc_split_amount_print_info (split, SHOW_SYMBOL));
-                    editable = TRUE;
-                }
-                else
-                {
-                    s = "";
-                    editable = FALSE;
-                }
-            }
-            else
-            {
-                s = "";
-                editable = FALSE;
-            }
-
-            if (gtv_sr_get_imbalance (trans))
-                g_object_set(cell, "cell-background", PINKCELL, (gchar*)NULL);
-        }
-
-        /* Only allow changes to entries if we have a valid split accounts */
-        editable = gtv_sr_have_account (view, depth, expanded, is_template, trans, split);
-
-        editable = (read_only == TRUE) ? FALSE : editable;
-
-        g_object_set (cell, "text", s, "editable", editable, NULL);
-        break;
-
-    case COL_DEBIT:
-    case COL_CREDIT:
-        /* Column is CREDIT and DEBIT */
-        {
-            if (!is_template) // Is this a template
-            {
-                GNCPrintAmountInfo print_info;
-                print_info = gnc_account_print_info (anchor, SHOW_SYMBOL);
-
-                if (is_split)
-                {
-                    if (!gnc_tree_util_split_reg_get_debcred_entry (view, trans, split, is_blank, &num, &print_info))
-                        num = gnc_numeric_zero();
-
-                    editable = TRUE;
-                    if (gtv_sr_get_imbalance (trans))
-                        g_object_set (cell, "cell-background", PINKCELL, (gchar*)NULL);
-                }
-                else if (is_trow1)
-                {
-                    if (anchor)
-                    {
-                         editable = !expanded && !gnc_tree_util_split_reg_is_multi (gtv_sr_get_this_split (view, trans));
-                         num = xaccTransGetAccountAmount (trans, anchor);
-                    }
-                    else
-                    {
-                        editable = FALSE;
-                        num = gnc_numeric_zero();
-                    }
-                }
-                else if (is_trow2)
-                {
-                    editable = FALSE;
-                    num = gnc_numeric_zero();
-                }
-
-                if ((gnc_numeric_check(num) != GNC_ERROR_OK) ||
-                     gnc_numeric_zero_p(num) ||
-                    (gnc_numeric_negative_p(num) && viewcol == COL_DEBIT) ||
-                    (gnc_numeric_positive_p(num) && viewcol == COL_CREDIT))
-                {
-                    s = "";
-                }
-                else
-                {
-                    if ((is_trow1 || is_trow2) && expanded)
-                        s = "";
-                    else
-                        s = xaccPrintAmount (gnc_numeric_abs (num), print_info);
-                }
-            }
-            else
-            {
-                editable = TRUE;
-
-                if (is_trow1 || is_trow2)
-                {
-                    s = "";
-                    editable = FALSE;
-                }
-                else if (is_split && viewcol == COL_DEBIT)
-                    s = gnc_tree_util_split_reg_template_get_fdebt_entry (split);
-                else
-                    s = gnc_tree_util_split_reg_template_get_fcred_entry (split);
-            }
-
-            /* Only allow changes to entries if we have a valid split accounts */
-            editable = gtv_sr_have_account (view, depth, expanded, is_template, trans, split);
-        }
-
-        editable = (read_only == TRUE) ? FALSE : editable;
-
-        g_object_set (cell, "text", s, "editable", editable, NULL);
-        break;
-
-    case COL_BALANCE:
-        /* Column is BALANCE */
-        if (is_split)
-            g_object_set(cell, "cell-background", "white", (gchar*)NULL);
-
-        if (is_trow1 && anchor) {
-            num = xaccTransGetAccountBalance (trans, anchor);
-            if (gnc_reverse_balance (anchor))
-                num = gnc_numeric_neg (num);
-            s = xaccPrintAmount (num, gnc_account_print_info(anchor, FALSE));
-
-            // Display negative numbers in red if requested in preferences
-            if (gnc_numeric_negative_p (num) && negative_in_red)
-                g_object_set (cell, "foreground", "red", (gchar*)NULL);
-            else
-                g_object_set (cell, "foreground", NULL, (gchar*)NULL);
-        } else {
-            s = "";
-        }
-        g_object_set (cell, "text", s, "editable", FALSE, NULL);
-        break;
-
-    case COL_STATUS:
-        /* Column is STATUS */
-        if (read_only && !open_edited)
-            g_object_set(cell, "cell-background", REDCELL, (gchar*)NULL);
-        else if (read_only && open_edited)
-            g_object_set(cell, "cell-background", ORANGECELL, (gchar*)NULL);
-        else if (xaccTransInFutureByPostedDate (trans))
-            g_object_set(cell, "cell-background", BLUECELL, (gchar*)NULL);
-        else
-            g_object_set(cell, "cell-background", BLACKCELL, (gchar*)NULL);
-        break;
-
-    case COL_COMM:
-        /* Column COMMODITY */
-        {
-            gchar *string = NULL;
-            if (is_split)
-            {
-                gnc_commodity *split_com, *txn_com;
-
-                split_com = xaccAccountGetCommodity (xaccSplitGetAccount(split));
-                txn_com = xaccTransGetCurrency (trans);
-                if (split_com == txn_com)
-                   string = g_strconcat (gnc_commodity_get_printname (split_com), "*", NULL);
-                else
-                   string = g_strdup (gnc_commodity_get_printname (split_com));
-            }
-            else
-                string = g_strdup ("");
-
-            g_object_set (cell, "text", string, "editable", FALSE, NULL);
-            g_free (string);
-        }
-        break;
-
-    default:
-        break;
-    }
-    LEAVE("");
-}
-
-
-/* Instead of setting a different cellDataFunc for each column, we just
-   collect everything here for the second cell renderer. */
-static void
-gtv_sr_cdf1 (GtkTreeViewColumn *col, GtkCellRenderer *cell, GtkTreeModel *s_model,
-    GtkTreeIter *s_iter, gpointer user_data)
-{
-    GncTreeViewSplitReg *view = GNC_TREE_VIEW_SPLIT_REG (user_data);
-    GncTreeModelSplitReg *model;
-    GtkTreeIter m_iter;
-    GtkTreePath *spath;
-    ViewCol viewcol;
-    Transaction *trans;
-    Split *split;
-    gboolean is_split, is_blank, is_trow1, is_trow2;
-    gboolean editable = FALSE, expanded = FALSE;
-    gboolean read_only = FALSE;
-//    gboolean open_edited = FALSE;
-    const gchar *s = "";
-    const gchar *row_color;
-//    RowDepth depth;
-    gint *indices;
-//    Account *anchor = view->priv->anchor;
-    char type;
-
-    ENTER("");
-
-    model = gnc_tree_view_split_reg_get_model_from_view (view);
-
-    gtk_tree_model_sort_convert_iter_to_child_iter (GTK_TREE_MODEL_SORT (s_model), &m_iter, s_iter);
-
-    viewcol = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (cell), "view_column"));
-
-    g_return_if_fail (gnc_tree_model_split_reg_get_split_and_trans (
-                         GNC_TREE_MODEL_SPLIT_REG (model), &m_iter,
-                          &is_trow1, &is_trow2, &is_split, &is_blank,
-                          &split, &trans));
-
-    spath = gtk_tree_model_get_path (GTK_TREE_MODEL (s_model), s_iter);
-
-//    depth = gtk_tree_path_get_depth (spath);
-
-    indices = gtk_tree_path_get_indices (spath);
-
-    row_color = gnc_tree_model_split_reg_get_row_color (model, is_trow1, is_trow2, is_split, indices[0]);
-
-    /* Lets see if the splits are expanded */
-    if (is_trow1 || is_trow2) // transaction
-    {
-        if (is_trow1)
-            gtk_tree_path_down (spath); /* Move the path down to trow2 */
-        expanded = gtk_tree_view_row_expanded (GTK_TREE_VIEW (view), spath);
-    }
-    else
-        expanded = TRUE; // splits are always expanded
-
-    gtk_tree_path_free (spath);
-
-    /* Set the background color / this works for sorting and deleting of transactions */
-    g_object_set (cell, "cell-background", row_color, (gchar*)NULL);
-
-    /* Get the read only model setting */
-    gtk_tree_model_get (GTK_TREE_MODEL (model), &m_iter, GNC_TREE_MODEL_SPLIT_REG_COL_RO, &read_only, -1);
-
-    /* Are we being edited in other register */
-    if (xaccTransIsOpen (trans) && (view->priv->dirty_trans != trans))
-    {
-        read_only = TRUE;
-//        open_edited = TRUE;
-    }
-
-    /* Test for a transaction type of invoice, always read only */
-    type = xaccTransGetTxnType (trans);
-    if (model->type == RECEIVABLE_REGISTER2 || model->type == PAYABLE_REGISTER2)
-    {
-        if (((type == TXN_TYPE_INVOICE) || (type == TXN_TYPE_NONE)) && (view->priv->dirty_trans != trans) && !is_blank)
-            read_only = TRUE;
-    }
-
-    switch (viewcol) {
-    case COL_DATE:
-        /* Column is DATE */
-        break;
-
-    case COL_DUEDATE:
-        /* Column is DUE DATE */
-        break;
-
-    case COL_NUMACT:
-        /* Column is NUM / ACT  but relates to NUM */
-        /* Override default alignment */
-        g_object_set (cell, "xalign", 0.0, NULL );
-
-        editable = TRUE;
-
-        if (is_trow1)
-        {
-            /* Get per book option */
-            s = gnc_get_num_action (trans, gtv_sr_get_this_split (view, trans));
-        }
-        else if (is_trow2 && expanded)
-        {
-            /* Get per book option */
-            if (qof_book_use_split_action_for_num_field (gnc_get_current_book()))
-                s = gnc_get_action_num (trans, gtv_sr_get_this_split (view, trans));
-            else
-                s = "";
-            editable = FALSE;
-        }
-        else if (is_trow2 && !expanded)
-        {
-            /* Get per book option */
-            if (qof_book_use_split_action_for_num_field (gnc_get_current_book()))
-            {
-               if (gtv_sr_get_this_split (view, trans) != NULL) // Blank split of blank trans is not child of trans yet.
-                   s = gnc_get_action_num (trans, gtv_sr_get_this_split (view, trans));
-               else
-                   s = "";
-            }
-            else
-            {
-                s = "XY";
-            }
-        }
-        else if (is_split)
-        {
-            s = "XZ";
-        }
-
-        editable = (read_only == TRUE) ? FALSE : editable;
-
-        g_object_set (cell, "text", s, "editable", editable, NULL);
-        break;
-
-    case COL_DESCNOTES:
-        /* Column is DESCRIPTION / NOTES */
-        break;
-
-    case COL_TRANSFERVOID:
-        /* Column is TRANSFER / VOID */
-        break;
-
-    case COL_RECN:
-        /* Column is RECN */
-        break;
-
-    case COL_TYPE:
-        /* Column is TYPE */
-        break;
-
-    case COL_VALUE:
-        /* Column is VALUE */
-        break;
-
-    case COL_RATE:
-        /* Column is RATE */
-        break;
-
-    case COL_AMOUNT:
-        /* Column is AMOUNT */
-        break;
-
-    case COL_AMTVAL:
-        /* Column is AMOUNT / VALUE */
-        break;
-
-    case COL_PRICE:
-        /* Column is PRICE */
-        break;
-
-    case COL_DEBIT:
-    case COL_CREDIT:
-        /* Column is CREDIT and DEBIT */
-        break;
-
-    case COL_BALANCE:
-        /* Column is BALANCE */
-        break;
-
-    case COL_STATUS:
-        /* Column is STATUS */
-        break;
-
-    case COL_COMM:
-        /* Column COMMODITY */
-        break;
-
-    default:
-        break;
-    }
-    LEAVE("");
-}
-
-
-/*###########################################################################*/
-
-/* Returns TRUE if dialog was canceled or discarded.
-   Does nothing if 'new_trans' is the dirty trans. */
-static gboolean
-gtv_sr_transaction_changed_confirm (GncTreeViewSplitReg *view,
-                            Transaction *new_trans)
-{
-    GtkWidget            *dialog, *window;
-    GncTreeModelSplitReg *model;
-    Split                *split;
-    gint response;
-    const char *title = _("Save the changed transaction?");
-    const char *message = _(
-        "The current transaction has changed. Would you like to "
-        "record the changes, or discard the changes?");
-
-    // Look for dirty_trans not being new_trans.
-    if (!view->priv->dirty_trans || view->priv->dirty_trans == new_trans)
-        return FALSE;
-
-    model = gnc_tree_view_split_reg_get_model_from_view (view);
-
-    // If using trading accounts, lets scrub them to make them work.
-    if (xaccTransUseTradingAccounts (view->priv->dirty_trans))
-    {
-        Account *default_account = gnc_tree_model_split_reg_get_anchor (model);
-        if (default_account != NULL)
-            xaccTransScrubImbalance (view->priv->dirty_trans, gnc_account_get_root(default_account), NULL);
-        else
-        {
-            Account *root = gnc_book_get_root_account (gnc_get_current_book());
-            xaccTransScrubImbalance (view->priv->dirty_trans, root, NULL);
-        }
-    }
-
-    // Test if the transaction is balanced.
-    if (gnc_tree_control_split_reg_balance_trans (view, view->priv->dirty_trans))
-    {
-        view->priv->trans_confirm = CANCEL;
-        return TRUE;
-    }
-
-    window = gnc_tree_view_split_reg_get_parent (view);
-    dialog = gtk_message_dialog_new (GTK_WINDOW (window),
-                                    GTK_DIALOG_DESTROY_WITH_PARENT,
-                                    GTK_MESSAGE_QUESTION,
-                                    GTK_BUTTONS_NONE,
-                                    "%s", title);
-    gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
-                                             "%s", message);
-
-    gtk_dialog_add_buttons (GTK_DIALOG(dialog),_("_Discard Changes"), GTK_RESPONSE_REJECT,
-                            _("_Cancel"), GTK_RESPONSE_CANCEL,
-                            _("_Record Changes"), GTK_RESPONSE_ACCEPT, NULL);
-
-    response = gnc_dialog_run (GTK_DIALOG (dialog), GNC_PREF_WARN_REG_TRANS_MOD);
-    gtk_widget_destroy (dialog);
-
-    switch (response)
-    {
-    case GTK_RESPONSE_ACCEPT:
-        g_object_set_data (G_OBJECT (view), "data-edited", GINT_TO_POINTER (FALSE));
-        xaccTransCommitEdit (view->priv->dirty_trans);
-        split = gnc_tree_model_split_get_blank_split (model);
-        xaccSplitReinit (split); // Clear the blank split
-        view->priv->dirty_trans = NULL;
-        view->change_allowed = FALSE;
-        view->priv->auto_complete = FALSE;
-        view->priv->trans_confirm = ACCEPT;
-        return FALSE;
-        break;
-
-    case GTK_RESPONSE_REJECT:
-        if (view->priv->dirty_trans && xaccTransIsOpen (view->priv->dirty_trans))
-        {
-            // Move selection to trans - selection is blocked
-            gnc_tree_control_split_reg_goto_rel_trans_row (view, 0);
-
-            g_object_set_data (G_OBJECT (view), "data-edited", GINT_TO_POINTER (FALSE));
-            xaccTransRollbackEdit (view->priv->dirty_trans);
-            split = gnc_tree_model_split_get_blank_split (model);
-            xaccSplitReinit (split); // Clear the blank split
-            view->change_allowed = FALSE;
-            view->priv->auto_complete = FALSE;
-            view->priv->trans_confirm = DISCARD;
-        }
-        return TRUE;
-        break;
-
-    case GTK_RESPONSE_CANCEL:
-        view->priv->trans_confirm = CANCEL;
-        return TRUE;
-        break;
-
-    default:
-        return FALSE;
-    }
-    return FALSE;
-}
-
-
-/*###########################################################################
-             vvvvv    edit function call backs      vvvvvv
-#############################################################################*/
-#ifdef skip
-static void
-start_edit (GtkCellRenderer *cr, GtkCellEditable *editable,
-           const gchar *path_string, gpointer user_data)
-{
-//    GncTreeViewSplitReg *view = GNC_TREE_VIEW_SPLIT_REG (user_data);
-//    GncTreeModelSplitReg *model;
-    GtkTreePath         *path;
-//g_print("\n\nstart_edit\n");
-/*FIXME Not sure if this is required, leave for now ? */
-
-//    model = gnc_tree_view_split_reg_get_model_from_view (view);
-
-    gtv_sr_editable_start_editing_cb (cr, editable, path_string, user_data);
-/*    g_signal_connect(G_OBJECT(editable), "editing-done", (GCallback) editing_done_cb, view); */
-
-//FIXME this could be the sort path instead of model path / check !!
-    path = gtk_tree_path_new_from_string (path_string);
-
-//FIXME stuff here...
-
-    gtk_tree_path_free (path);
-
-    return;
-}
-#endif
-
-/* Open Transaction for editing */
-static void
-gtv_sr_begin_edit (GncTreeViewSplitReg *view, Transaction *trans)
-{
-    ENTER("gtv_sr_begin_edit trans %p", trans);
-
-    if (trans != view->priv->dirty_trans)
-    {
-        Timespec ts = {0,0};
-        xaccTransGetDatePostedTS (trans, &ts);
-
-        if (!xaccTransIsOpen (trans))
-            xaccTransBeginEdit (trans);
-        view->priv->dirty_trans = trans;
-
-        if (ts.tv_sec == 0)
-        {
-            //If the time returned by xaccTransGetDatePostedTS is 0 then assume it
-            //is a new transaction and set the time to current time to show current
-            //date on new transactions
-
-            ts.tv_sec = gnc_time (NULL);
-            xaccTransSetDatePostedSecs (trans, ts.tv_sec);
-        }
-    }
-    LEAVE(" ");
-}
-
-
-/* Call back to remove date widget */
-static void
-gtv_sr_remove_edit_date (GtkCellEditable *ce, gpointer user_data)
-{
-    GncTreeViewSplitReg *view = GNC_TREE_VIEW_SPLIT_REG (user_data);
-    GncPopupEntry *popup_entry;
-    const gchar *new_string; 
-    const gchar *current_string;
-    GDate date;
-    gchar *date_string;
-
-    ENTER("remove edit date and temp cell rend %p", view->priv->temp_cr);
-
-    if (view->priv->temp_cr != NULL)
-    {
-        // These strings are used to determine if cell data was altered so that keynav works better
-        popup_entry = GNC_POPUP_ENTRY (g_object_get_data (G_OBJECT (view->priv->temp_cr), "cell-editable"));
-
-        new_string = gtk_entry_get_text (GTK_ENTRY (popup_entry->entry));
-
-        current_string = g_object_get_data (G_OBJECT (view->priv->temp_cr), "current-string");
-
-        DEBUG("New string is %s and Current_string is %s", new_string, current_string);
-
-        // If editing wasn't canceled and strings don't match then cell data was edited
-        if (!GPOINTER_TO_INT (g_object_get_data (G_OBJECT (view->priv->temp_cr), "edit-canceled"))
-             && g_ascii_strcasecmp (new_string, current_string))
-        {
-            g_object_set_data (G_OBJECT (view), "data-edited", GINT_TO_POINTER (TRUE));
-        }
-
-        /* Lets update the help text */
-        gnc_tree_util_split_reg_parse_date (&date, new_string);
-        date_string = gnc_tree_util_split_reg_get_date_help (&date);
-
-        if (view->help_text)
-            g_free (view->help_text);
-        view->help_text = g_strdup (date_string);
-
-        g_signal_emit_by_name (view, "help_signal", NULL);
-        g_free (date_string);
-
-        g_object_set_data (G_OBJECT (view->priv->temp_cr), "cell-editable", NULL);
-        view->priv->temp_cr = NULL;
-        view->editing_now = FALSE;
-    }
-    LEAVE(" ");
-}
-
-
-/* Call back to remove combo widget */
-static void
-gtv_sr_remove_edit_combo (GtkCellEditable *ce, gpointer user_data)
-{
-    GncTreeViewSplitReg *view = GNC_TREE_VIEW_SPLIT_REG (user_data);
-    GtkEntry *entry; 
-    const gchar *new_string; 
-    const gchar *current_string;
-
-    ENTER("remove edit combo and temp cell rend %p", view->priv->temp_cr);
-
-    if (view->priv->temp_cr != NULL)
-    {
-        // These strings are used to determine if cell data was altered so that keynav works better
-        entry = GTK_ENTRY (gtk_bin_get_child (GTK_BIN (g_object_get_data (G_OBJECT (view->priv->temp_cr), "cell-editable"))));
-
-        new_string = gtk_entry_get_text (GTK_ENTRY (entry));
-
-        current_string = g_object_get_data (G_OBJECT (view->priv->temp_cr), "current-string");
-
-        DEBUG("New string is %s and Current_string is %s", new_string, current_string);
-
-        // If editing wasn't canceled and strings don't match then cell data was edited
-        if (!GPOINTER_TO_INT (g_object_get_data (G_OBJECT (view->priv->temp_cr), "edit-canceled"))
-             && g_ascii_strcasecmp (new_string, current_string))
-        {
-            g_object_set_data (G_OBJECT (view), "data-edited", GINT_TO_POINTER (TRUE));
-        }
-
-        g_object_set_data (G_OBJECT (view->priv->temp_cr), "cell-editable", NULL);
-        view->priv->temp_cr = NULL;
-        view->editing_now = FALSE;
-    }
-    LEAVE(" ");
-}
-
-
-/* Call back to remove entry widget */
-static void
-gtv_sr_remove_edit_entry (GtkCellEditable *ce, gpointer user_data)
-{
-    GncTreeViewSplitReg *view = GNC_TREE_VIEW_SPLIT_REG (user_data);
-    const gchar *new_string; 
-    const gchar *current_string; 
-
-    ENTER("remove edit entry and temp cell rend %p", view->priv->temp_cr);
-
-    if (view->priv->temp_cr != NULL)
-    {
-        // These strings are used to determine if cell data was altered so that keynav works better
-        new_string = gtk_entry_get_text (GTK_ENTRY (g_object_get_data (G_OBJECT (view->priv->temp_cr), "cell-editable")));
-
-        current_string = g_object_get_data (G_OBJECT (view->priv->temp_cr), "current-string");
-
-        DEBUG("New string is %s and Current_string is %s", new_string, current_string);
-
-        // If editing wasn't canceled and strings don't match then cell data was edited
-        if (!GPOINTER_TO_INT (g_object_get_data (G_OBJECT (view->priv->temp_cr), "edit-canceled"))
-             && g_ascii_strcasecmp (new_string, current_string))
-        {
-            g_object_set_data (G_OBJECT (view), "data-edited", GINT_TO_POINTER (TRUE));
-        }
-        if (g_object_get_data (G_OBJECT (view->priv->temp_cr), "current-flag") != NULL) // flag
-            g_object_set_data (G_OBJECT (view->priv->temp_cr), "current-flag", NULL);
-
-        g_object_set_data (G_OBJECT (view->priv->temp_cr), "cell-editable", NULL);
-        view->priv->temp_cr = NULL;
-        view->editing_now = FALSE;
-    }
-    LEAVE(" ");
-}
-
-
-/* Explain: GtkEntry has a cursor that blinks upon
-   g_timeout_dispatch(). It complains if it blinks after the GtkEntry
-   loses focus. So, we can't pop up any dialogs while the blinking
-   cursor is around. The solution is to force the editing to be
-   finished before raising the dialog. That finalizes the
-   gtkcelleditable. */
-static void
-gtv_sr_finish_edit (GncTreeViewSplitReg *view)
-{
-    GtkCellEditable *ce;
-
-    if (view->priv->temp_cr == NULL)
-        return;
-
-    DEBUG("gtv_sr_finish_edit temp_cr is %p", view->priv->temp_cr);
-
-    if ((ce = GTK_CELL_EDITABLE (g_object_get_data (G_OBJECT (view->priv->temp_cr), "cell-editable"))))
-    {
-        DEBUG("gtv_sr_finish_edit - editing_done");
-        gtk_cell_editable_editing_done (ce);
-        gtk_cell_editable_remove_widget (ce);
-    }
-}
-
-#ifdef skip
-//FIXME Not used yet
-/* This is used in g_idle_add to finish an edit */
-static gboolean
-gtv_sr_idle_finish_edit (GncTreeViewSplitReg *view)
-{
-   gtv_sr_finish_edit (view);
-   return FALSE;
-}
-
-
-/* This is used in g_idle_add to cancel an edit */
-static gboolean
-gtv_sr_idle_cancel_edit (GtkCellRenderer *cr)
-{
-    GtkCellEditable *ce;
-
-    gtk_cell_renderer_stop_editing (cr, TRUE);
-
-    ce = GTK_CELL_EDITABLE (g_object_get_data (G_OBJECT (cr), "cell-editable"));
-    gtk_cell_editable_editing_done (ce);
-    gtk_cell_editable_remove_widget (ce);
-
-   return FALSE;
-}
-#endif
-
-/* This is used in g_idle_add to repopulate the transfer cell */
-static gboolean
-gtv_sr_idle_transfer (GncTreeViewSplitReg *view)
-{
-    GtkTreePath *spath;
-    GList *columns;
-    GList  *column;
-    gint i;
-
-    spath = gnc_tree_view_split_reg_get_current_path (view);
-    columns = gtk_tree_view_get_columns (GTK_TREE_VIEW (view));
-
-    for (column = columns, i = 1; column; column = g_list_next (column), i++)
-    {
-        GList *renderers;
-        GtkCellRenderer *cr0;
-        GtkTreeViewColumn *tvc;
-        ViewCol viewcol;
-
-        tvc = column->data;
-
-        // Get the first renderer, it has the view-column value.
-        renderers = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (tvc));
-        cr0 = g_list_nth_data (renderers, 0);
-        g_list_free (renderers);
-
-        viewcol = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (cr0), "view_column"));
-
-        if (viewcol == COL_TRANSFERVOID)
-            gtk_tree_view_set_cursor (GTK_TREE_VIEW (view), spath, tvc, TRUE);
-    }
-    g_list_free (columns);
-    gtk_tree_path_free (spath);
-    return FALSE;
-}
-
-/*###########################################################################*/
-
-/* Set the column titles based on register type and depth */
-static void
-gtv_sr_titles (GncTreeViewSplitReg *view, RowDepth depth)
-{
-    GncTreeModelSplitReg *model;
-    GtkCellRenderer *cr0;
-    GList *renderers;
-    GList *columns;
-    GList  *column;
-    gint i;
-    gboolean is_template;
-
-    model = gnc_tree_view_split_reg_get_model_from_view (view);
-    ENTER("title depth is %d and sort_depth %d, sort_col is %d", depth, model->sort_depth, model->sort_col);
-
-    columns = gtk_tree_view_get_columns (GTK_TREE_VIEW (view));
-
-    is_template = gnc_tree_model_split_reg_get_template (model);
-
-    for (column = columns, i = 1; column; column = g_list_next (column), i++)
-    {
-        GtkTreeViewColumn *tvc;
-        ViewCol viewcol;
-
-        tvc = column->data;
-
-        // Get the first renderer, it has the view-column value.
-        renderers = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (tvc));
-        cr0 = g_list_nth_data (renderers, 0);
-        g_list_free (renderers);
-
-        viewcol = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (cr0), "view_column"));
-
-        DEBUG("viewcol is %d", viewcol);
-
-        switch (viewcol)
-        {
-        case COL_DATE:
-            switch (model->type)
-            {
-            default: //FIXME These if statements may not be required
-                /* Display arrows if we are sorting on this row */
-                if (model->sort_depth == depth && model->sort_col == viewcol)
-                    gtk_tree_view_column_set_sort_indicator (tvc, TRUE);
-                else
-                    gtk_tree_view_column_set_sort_indicator (tvc, FALSE);
-
-                if (depth == TRANS1)
-                    gtk_tree_view_column_set_title (tvc, _("Date Posted"));
-                else if (depth == TRANS2)
-                    gtk_tree_view_column_set_title (tvc, _("Date Entered"));
-                else if (depth == SPLIT3)
-                    gtk_tree_view_column_set_title (tvc, _("Date Reconciled"));
-                else
-                    gtk_tree_view_column_set_title (tvc, _("Date Posted / Entered / Reconciled"));
-                break;
-            }
-            break;
-
-        case COL_DUEDATE:
-            switch (model->type)
-            {
-            default: //FIXME These if statements may not be required
-                if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
-                    gtk_tree_view_column_set_title (tvc, _("Due Date"));
-                break;
-            }
-            break;
-
-        case COL_NUMACT:
-            switch (model->type)
-            {
-            case RECEIVABLE_REGISTER2:
-            case PAYABLE_REGISTER2:
-                if (depth == TRANS1)
-                    gtk_tree_view_column_set_title (tvc, _("Reference"));
-                else if (depth == TRANS2)
-                    gtk_tree_view_column_set_title (tvc, _("Action"));
-                else if (depth == SPLIT3)
-                    gtk_tree_view_column_set_title (tvc, _("Action"));
-                else
-                    gtk_tree_view_column_set_title (tvc, _("Reference / Action"));
-                break;
-
-
-            default:
-                /* Display arrows if we are sorting on this row */
-                if (model->sort_depth == depth && model->sort_col == viewcol)
-                    gtk_tree_view_column_set_sort_indicator (tvc, TRUE);
-                else
-                    gtk_tree_view_column_set_sort_indicator (tvc, FALSE);
-
-                if (depth == TRANS1)
-                    gtk_tree_view_column_set_title (tvc, _("Number"));
-                else if (depth == TRANS2 && (qof_book_use_split_action_for_num_field (gnc_get_current_book())))
-                    gtk_tree_view_column_set_title (tvc, _("T-Number"));
-                else if (depth == TRANS2 && (!qof_book_use_split_action_for_num_field (gnc_get_current_book())))
-                    gtk_tree_view_column_set_title (tvc, _("Action"));
-                else if (depth == SPLIT3)
-                    gtk_tree_view_column_set_title (tvc, _("Action"));
-                else
-                    gtk_tree_view_column_set_title (tvc, _("Number / Action"));
-                break;
-            }
-            break;
-
-        case COL_DESCNOTES:
-            switch (model->type)
-            {
-            case RECEIVABLE_REGISTER2:
-                if (depth == TRANS1)
-                    gtk_tree_view_column_set_title (tvc, _("Customer"));
-                else if (depth == TRANS2)
-                    gtk_tree_view_column_set_title (tvc, _("Memo"));
-                else if (depth == SPLIT3)
-                    gtk_tree_view_column_set_title (tvc, _("Memo"));
-                else
-                    gtk_tree_view_column_set_title (tvc, _("Customer / Memo"));
-                break;
-
-            case PAYABLE_REGISTER2:
-                if (depth == TRANS1)
-                    gtk_tree_view_column_set_title (tvc, _("Vendor"));
-                else if (depth == TRANS2)
-                    gtk_tree_view_column_set_title (tvc, _("Memo"));
-                else if (depth == SPLIT3)
-                    gtk_tree_view_column_set_title (tvc, _("Memo"));
-                else
-                    gtk_tree_view_column_set_title (tvc, _("Vendor / Memo"));
-                break;
-
-
-            default:
-                /* Display arrows if we are sorting on this row */
-                if (model->sort_depth == depth && model->sort_col == viewcol)
-                    gtk_tree_view_column_set_sort_indicator (tvc, TRUE);
-                else
-                    gtk_tree_view_column_set_sort_indicator (tvc, FALSE);
-
-                if (depth == TRANS1)
-                    gtk_tree_view_column_set_title (tvc, _("Description"));
-                else if (depth == TRANS2)
-                    gtk_tree_view_column_set_title (tvc, _("Notes"));
-                else if (depth == SPLIT3)
-                    gtk_tree_view_column_set_title (tvc, _("Memo"));
-                else
-                    gtk_tree_view_column_set_title (tvc, _("Description / Notes / Memo"));
-                break;
-            }
-            break;
-
-        case COL_TRANSFERVOID:
-            switch (model->type)
-            {
-            case RECEIVABLE_REGISTER2:
-            case PAYABLE_REGISTER2:
-                if (depth == TRANS1)
-                    gtk_tree_view_column_set_title (tvc, _("Accounts"));
-                else if (depth == TRANS2)
-                    gtk_tree_view_column_set_title (tvc, _("Accounts"));
-                else if (depth == SPLIT3)
-                    gtk_tree_view_column_set_title (tvc, _("Accounts"));
-                else
-                    gtk_tree_view_column_set_title (tvc, _("Accounts"));
-                break;
-
-            default:
-                /* Display arrows if we are sorting on this row */
-                if (model->sort_depth == depth && model->sort_col == viewcol)
-                    gtk_tree_view_column_set_sort_indicator (tvc, TRUE);
-                else
-                    gtk_tree_view_column_set_sort_indicator (tvc, FALSE);
-
-                if (depth == TRANS1)
-                    gtk_tree_view_column_set_title (tvc, _("Accounts"));
-                else if (depth == TRANS2)
-                    gtk_tree_view_column_set_title (tvc, _("Void Reason"));
-                else if (depth == SPLIT3)
-                    gtk_tree_view_column_set_title (tvc, _("Accounts"));
-                else
-                    gtk_tree_view_column_set_title (tvc, _("Accounts / Void Reason"));
-                break;
-            }
-            break;
-
-        case COL_RECN:
-            switch (model->type)
-            {
-            default: //FIXME These if statements may not be required
-                if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
-                    gtk_tree_view_column_set_title (tvc, _("R"));
-                break;
-            }
-            break;
-
-        case COL_TYPE:
-            switch (model->type)
-            {
-            default: //FIXME These if statements may not be required
-                if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
-                    gtk_tree_view_column_set_title (tvc, _("Type"));
-                break;
-            }
-            break;
-
-        case COL_VALUE:
-            switch (model->type)
-            {
-            default: //FIXME These if statements may not be required
-                if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
-                    gtk_tree_view_column_set_title (tvc, _("Value"));
-                break;
-            }
-            break;
-
-        case COL_AMOUNT:
-            switch (model->type)
-            {
-            default: //FIXME These if statements may not be required
-                if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
-                    gtk_tree_view_column_set_title (tvc, _("Amount"));
-                break;
-            }
-            break;
-
-        case COL_AMTVAL:
-            switch (model->type)
-            {
-            default:
-                if (depth == TRANS1 || depth == TRANS2)
-                    gtk_tree_view_column_set_title (tvc, _("Value"));
-                else if (depth == SPLIT3)
-                    gtk_tree_view_column_set_title (tvc, _("Amount"));
-                else
-                    gtk_tree_view_column_set_title (tvc, _("Amount / Value"));
-                break;
-            }
-            break;
-
-        case COL_COMM:
-            switch (model->type)
-            {
-            default: //FIXME These if statements may not be required
-                if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
-                    gtk_tree_view_column_set_title (tvc, _("Commodity"));
-                break;
-            }
-            break;
-
-        case COL_RATE:
-            switch (model->type)
-            {
-            default: //FIXME These if statements may not be required
-                if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
-                    gtk_tree_view_column_set_title (tvc, _("Rate"));
-                break;
-            }
-            break;
-
-        case COL_PRICE:
-            switch (model->type)
-            {
-            default: //FIXME These if statements may not be required
-                if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
-                    gtk_tree_view_column_set_title (tvc, _("Price"));
-                break;
-            }
-            break;
-
-        case COL_CREDIT:
-            if(!(model->use_accounting_labels))
-            {
-                switch (model->type)
-                {
-                case BANK_REGISTER2: //FIXME These if statements may not be required
-                if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
-                        gtk_tree_view_column_set_title (tvc, _("Withdrawal"));
-                    break;
-
-                case CASH_REGISTER2:
-                if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
-                        gtk_tree_view_column_set_title (tvc, _("Spend"));
-                    break;
-
-                case ASSET_REGISTER2:
-                if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
-                        gtk_tree_view_column_set_title (tvc, _("Decrease"));
-                    break;
-
-                case LIABILITY_REGISTER2:
-                case EQUITY_REGISTER2:
-                case TRADING_REGISTER2:
-                if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
-                        gtk_tree_view_column_set_title (tvc, _("Increase"));
-                    break;
-
-                case CREDIT_REGISTER2:
-                if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
-                        gtk_tree_view_column_set_title (tvc, _("Charge"));
-                    break;
-
-                case INCOME_REGISTER2:
-                case INCOME_LEDGER2:
-                if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
-                        gtk_tree_view_column_set_title (tvc, _("Income"));
-                    break;
-
-                case EXPENSE_REGISTER2:
-                if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
-                        gtk_tree_view_column_set_title (tvc, _("Rebate"));
-                    break;
-
-                case STOCK_REGISTER2:
-                case CURRENCY_REGISTER2:
-                case PORTFOLIO_LEDGER2:
-                if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
-                        gtk_tree_view_column_set_title (tvc, _("Sell"));
-                    break;
-
-                case RECEIVABLE_REGISTER2:
-                if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
-                        gtk_tree_view_column_set_title (tvc, _("Payment"));
-                    break;
-
-                case PAYABLE_REGISTER2:
-                if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
-                        gtk_tree_view_column_set_title (tvc, _("Bill"));
-                    break;
-
-                case GENERAL_JOURNAL2:
-                if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
-                        gtk_tree_view_column_set_title (tvc, _("Funds Out"));
-                    break;
-
-                case SEARCH_LEDGER2:
-                if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
-                {
-                    if (!is_template)
-                        gtk_tree_view_column_set_title (tvc, _("Funds Out"));
-                    else
-                        gtk_tree_view_column_set_title (tvc, _("Credit Formula"));
-                }
-                    break;
-
-                default:
-                    if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
-                        gtk_tree_view_column_set_title (tvc, _("Credit"));
-                    break;
-                }
-            }
-            else
-                gtk_tree_view_column_set_title (tvc, _("Credit"));
-            break;
-
-        case COL_DEBIT:
-            if(!(model->use_accounting_labels))
-            {
-                switch (model->type)
-                {
-                case BANK_REGISTER2: //FIXME These if statements may not be required
-                if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
-                        gtk_tree_view_column_set_title (tvc, _("Deposit"));
-                    break;
-
-                case CASH_REGISTER2:
-                if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
-                        gtk_tree_view_column_set_title (tvc, _("Receive"));
-                    break;
-
-                case ASSET_REGISTER2:
-                if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
-                        gtk_tree_view_column_set_title (tvc, _("Increase"));
-                    break;
-
-                case LIABILITY_REGISTER2:
-                case EQUITY_REGISTER2:
-                case TRADING_REGISTER2:
-                if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
-                        gtk_tree_view_column_set_title (tvc, _("Decrease"));
-                    break;
-
-                case INCOME_REGISTER2:
-                case INCOME_LEDGER2:
-                if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
-                        gtk_tree_view_column_set_title (tvc, _("Charge"));
-                    break;
-
-                case EXPENSE_REGISTER2:
-                if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
-                        gtk_tree_view_column_set_title (tvc, _("Expense"));
-                    break;
-
-                case STOCK_REGISTER2:
-                case CURRENCY_REGISTER2:
-                case PORTFOLIO_LEDGER2:
-                if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
-                        gtk_tree_view_column_set_title (tvc, _("Buy"));
-                    break;
-
-                case RECEIVABLE_REGISTER2:
-                if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
-                        gtk_tree_view_column_set_title (tvc, _("Invoice"));
-                    break;
-
-                case CREDIT_REGISTER2:
-                case PAYABLE_REGISTER2:
-                if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
-                        gtk_tree_view_column_set_title (tvc, _("Payment"));
-                    break;
-
-                case GENERAL_JOURNAL2:
-                if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
-                        gtk_tree_view_column_set_title (tvc, _("Funds In"));
-                    break;
-
-                case SEARCH_LEDGER2:
-                if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
-                {
-                    if (!is_template)
-                        gtk_tree_view_column_set_title (tvc, _("Funds In"));
-                    else
-                        gtk_tree_view_column_set_title (tvc, _("Debit Formula"));
-                }
-                    break;
-
-                default:
-                if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
-                        gtk_tree_view_column_set_title (tvc, _("Debit"));
-                    break;
-                }
-            }
-            else
-                gtk_tree_view_column_set_title (tvc, _("Debit"));
-            break;
-
-        case COL_BALANCE:
-            switch (model->type)
-            {
-            default: //FIXME These if statements may not be required
-                if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
-                    gtk_tree_view_column_set_title (tvc, _("Balance"));
-                break;
-            }
-            break;
-
-        default:
-            break;
-        }
-    }
-    LEAVE(" ");
-    g_list_free (columns);
-}
-
-
-/* Update the help text */
-static void
-gtv_sr_help (GncTreeViewSplitReg *view, GtkCellRenderer *cr, ViewCol viewcol, RowDepth depth)
-{
-    GncTreeModelSplitReg *model;
-    gchar *help = NULL;
-    const gchar *current_string;
-
-    ENTER("Help Viewcol is %d and depth is %d", viewcol, depth);
-
-    model = gnc_tree_view_split_reg_get_model_from_view (view);
-
-    switch (viewcol)
-    {
-    case COL_DATE:
-        switch (model->type)
-        {
-        default: //FIXME These if statements may not be required
-            if (depth == TRANS1)
-            {
-                GDate date;
-
-                current_string = g_object_get_data (G_OBJECT (cr), "current-string");
-                g_date_set_parse (&date, current_string);
-                help = gnc_tree_util_split_reg_get_date_help (&date);
-            }
-            else
-                help = g_strdup (" ");
-            break;
-        }
-        break;
-
-    case COL_DUEDATE:
-        switch (model->type)
-        {
-        default: //FIXME These if statements may not be required
-            if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
-                help = g_strdup (_("Enter Due Date"));
-            break;
-        }
-        break;
-
-    case COL_NUMACT:
-        switch (model->type)
-        {
-        case RECEIVABLE_REGISTER2:
-        case PAYABLE_REGISTER2:
-            if (depth == TRANS1)
-                help = g_strdup (_("Enter the transaction reference, such as the invoice or check number"));
-            else if (depth == TRANS2 || depth == SPLIT3)
-                help = g_strdup (_("Enter the type of transaction, or choose one from the list"));
-            break;
-
-        default:
-            if (depth == TRANS1)
-                help = g_strdup (_("Enter the transaction number, such as the check number"));
-            else if (depth == TRANS2 || depth == SPLIT3)
-                help = g_strdup (_("Enter the type of transaction, or choose one from the list"));
-            break;
-        }
-        break;
-
-    case COL_DESCNOTES:
-        switch (model->type)
-        {
-        case RECEIVABLE_REGISTER2:
-            if (depth == TRANS1)
-                help = g_strdup (_("Enter the name of the Customer"));
-            else if (depth == TRANS2)
-                help = g_strdup (_("Enter notes for the transaction"));
-            else if (depth == SPLIT3)
-                help = g_strdup (_("Enter a description of the split"));
-            break;
-
-        case PAYABLE_REGISTER2:
-            if (depth == TRANS1)
-                help = g_strdup (_("Enter the name of the Vendor"));
-            else if (depth == TRANS2)
-                help = g_strdup (_("Enter notes for the transaction"));
-            else if (depth == SPLIT3)
-                help = g_strdup (_("Enter a description of the split"));
-            break;
-
-        default:
-            if (depth == TRANS1)
-                help = g_strdup (_("Enter a description of the transaction"));
-            else if (depth == TRANS2)
-                help = g_strdup (_("Enter notes for the transaction"));
-            else if (depth == SPLIT3)
-                help = g_strdup (_("Enter a description of the split"));
-            break;
-        }
-        break;
-
-    case COL_TRANSFERVOID:
-        switch (model->type)
-        {
-        default:
-            if (depth == TRANS1)
-                help = g_strdup (_("Enter the account to transfer from, or choose one from the list"));
-            else if (depth == TRANS2)
-                help = g_strdup (_("Reason the transaction was voided"));
-            else if (depth == SPLIT3)
-                help = g_strdup (_("Enter the account to transfer from, or choose one from the list"));
-            break;
-        }
-        break;
-
-    case COL_RECN:
-        switch (model->type)
-        {
-        default: //FIXME These if statements may not be required
-            if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
-                help = g_strdup (_("Enter the reconcile type"));
-            break;
-        }
-        break;
-
-    case COL_TYPE:
-        switch (model->type)
-        {
-        default: //FIXME These if statements may not be required
-            if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
-                help = g_strdup (_("Enter the type of transaction"));
-            break;
-        }
-        break;
-
-    case COL_VALUE:
-        switch (model->type)
-        {
-        default: //FIXME These if statements may not be required
-            if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
-                help = g_strdup (_("Enter the value of shares bought or sold"));
-            break;
-        }
-        break;
-
-    case COL_AMOUNT:
-        switch (model->type)
-        {
-        default: //FIXME These if statements may not be required
-            if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
-                help = g_strdup (_("Enter the number of shares bought or sold"));
-            break;
-        }
-        break;
-
-    case COL_AMTVAL:
-        switch (model->type)
-        {
-        default:
-            if ((depth == TRANS1) || (depth == TRANS2))
-                help = g_strdup (_("Enter the value of shares bought or sold"));
-            else if (depth == SPLIT3)
-                help = g_strdup (_("Enter the number of shares bought or sold"));
-            break;
-        }
-        break;
-
-    case COL_COMM:
-        switch (model->type)
-        {
-        default: //FIXME These if statements may not be required
-            if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
-                help = g_strdup (_("* Indicates the transaction Commodity."));
-            break;
-        }
-        break;
-
-    case COL_RATE:
-        switch (model->type)
-        {
-        default: //FIXME These if statements may not be required
-            if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
-                help = g_strdup (_("Enter the rate"));
-            break;
-        }
-        break;
-
-    case COL_PRICE:
-        switch (model->type)
-        {
-        default: //FIXME These if statements may not be required
-            if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
-                help = g_strdup (_("Enter the effective share price"));
-            break;
-        }
-        break;
-
-    case COL_CREDIT:
-        switch (model->type)
-        {
-        default: //FIXME These if statements may not be required
-            if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
-                help = g_strdup (_("Enter credit formula for real transaction"));
-            break;
-        }
-        break;
-
-    case COL_DEBIT:
-        switch (model->type)
-        {
-        default: //FIXME These if statements may not be required
-            if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
-                help = g_strdup (_("Enter debit formula for real transaction"));
-            break;
-        }
-        break;
-
-    default:
-            help = g_strdup (" ");
-        break;
-    }
-
-    LEAVE("Help text is - %s", help);
-    if (view->help_text)
-        g_free (view->help_text);
-    view->help_text = g_strdup (help);
-    g_free (help);
-    g_signal_emit_by_name (view, "help_signal", NULL);
-}
-
-/*###########################################################################*/
-
-/* Move the selection to the blank split when expanded */
-static gboolean
-gtv_sr_selection_to_blank (GncTreeViewSplitReg *view)
-{
-    GncTreeModelSplitReg *model;
-    GtkTreePath *bpath, *spath;
-    Split *bsplit;
-
-    /* give gtk+ a chance to handle pending events */
-    while (gtk_events_pending ())
-        gtk_main_iteration ();
-
-    /* Make sure we have expanded splits */
-    if (view->priv->expanded == FALSE)
-        return FALSE;
-
-    model = gnc_tree_view_split_reg_get_model_from_view (view);
-
-    bsplit = gnc_tree_model_split_get_blank_split (model);
-    bpath =  gnc_tree_model_split_reg_get_path_to_split_and_trans (model, bsplit, NULL);
-
-    spath = gnc_tree_view_split_reg_get_sort_path_from_model_path (view, bpath);
-
-    /* Set cursor to new spath */
-    gtk_tree_view_set_cursor (GTK_TREE_VIEW (view), spath, NULL, FALSE);
-
-    gtk_tree_path_free (bpath);
-    gtk_tree_path_free (spath);
-
-    return FALSE;
-}
-
-
-/* Call back for when a change to a Transaction requires the selection to get out of the way */
-static void
-gtv_sr_selection_move_delete_cb (GncTreeModelSplitReg *model, gpointer item, gpointer user_data)
-{
-    GncTreeViewSplitReg *view = user_data;
-    Transaction *trans = item;
-
-    DEBUG("gtv_sr_selection_move_delete_cb view %p model %p trans %p", view, model, trans);
-
-    DEBUG("gtv_sr_selection_move_delete_cb current_trans %p trans %p", view->priv->current_trans, trans);
-
-    /* if same, lets get out of the way, so move */
-    if (trans == view->priv->current_trans)
-        gnc_tree_control_split_reg_goto_rel_trans_row (view, 1);
-
-}
-
-
-/* Call back for focus out event so we can finish edit */
-static gboolean
-gtv_sr_focus_out_cb (GtkWidget *widget, GdkEventFocus *event, gpointer user_data)
-{
-    GncTreeViewSplitReg *view = GNC_TREE_VIEW_SPLIT_REG (user_data);
-
-    gnc_tree_view_split_reg_finish_edit (view);
-
-    return FALSE;
-}
-
-
-/* Reconcile column tests */
-static gboolean
-gtv_sr_recn_tests (GncTreeViewSplitReg *view, GtkTreeViewColumn *column, GtkTreePath *spath)
-{
-    GtkCellRenderer *cr0;
-    GList *renderers;
-    ViewCol viewcol;
-
-    ENTER(" ");
-
-    // Get the first renderer, it has the view-column value.
-    renderers = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (column));
-    cr0 = g_list_nth_data (renderers, 0);
-    g_list_free (renderers);
-
-    viewcol = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (cr0), "view_column"));
-
-    /* Test for change of RECN COLUMN setting from reconciled */
-    if (viewcol == COL_RECN)
-    {
-        /* Are we trying to change the reconcile setting */
-        if (!gnc_tree_control_split_reg_recn_change (view, spath))
-        {
-            LEAVE("Not allowed to change reconciled transaction");
-            return TRUE;
-        }
-    }
-
-    /* Ask, are we allowed to change reconciled values other than 'description / notes / memo'
-       which we can change always */
-    if (viewcol != COL_DESCNOTES && viewcol != COL_RECN)
-    {
-        if (!gnc_tree_control_split_reg_recn_test (view, spath))
-        {
-            LEAVE("Not allowed to edit reconciled transaction");
-            return TRUE;
-        }
-    }
-    LEAVE(" ");
-    return FALSE;
-}
-
-
-/* Test to see if we need to do a move */
-static void
-gtv_split_reg_test_for_move (GncTreeModelSplitReg *model, GtkTreePath *spath)
-{
-    gint num_of_trans, trans_pos;
-    gint *indices;
-
-    indices = gtk_tree_path_get_indices (spath);
-    num_of_trans = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (model), NULL);
-
-    trans_pos = indices[0];
-
-    if (trans_pos < num_of_trans*1/3)
-        gnc_tree_model_split_reg_move (model, VIEW_UP);
-
-    if (trans_pos > num_of_trans*2/3)
-        gnc_tree_model_split_reg_move (model, VIEW_DOWN);
-}
-
-/*###########################################################################*/
-
-/* This is the callback for the mouse click */
-static gboolean
-gtv_sr_button_cb (GtkWidget *widget, GdkEventButton *event, gpointer user_data)
-{
-    GncTreeViewSplitReg  *view = GNC_TREE_VIEW_SPLIT_REG (widget);
-    GncTreeModelSplitReg *model;
-    GtkTreePath *mpath, *spath;
-    GtkTreeViewColumn    *col;
-    GtkTreeIter m_iter;
-    Split *split = NULL;
-    Split *rotate_split = NULL;
-    Transaction *trans = NULL;
-    gboolean is_trow1, is_trow2, is_split, is_blank;
-
-    model = gnc_tree_view_split_reg_get_model_from_view (view);
-
-    /* This is for a single click */
-    if (event->button == 1 && event->type == GDK_BUTTON_PRESS)
-    {
-        GdkWindow *window = gtk_tree_view_get_bin_window (GTK_TREE_VIEW (view));
-
-        if (event->window != window)
-            return FALSE;
-
-        // Make sure we have stopped editing.
-        gnc_tree_view_split_reg_finish_edit (view);
-
-        // This prevents the cell changing.
-        if (view->priv->stop_cell_move == TRUE)
-            return TRUE;
-
-        /* Get tree path for row that was clicked, true if row exists */
-        if (gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (view), (gint) event->x, (gint) event->y,
-                                             &spath, &col, NULL, NULL))
-        {
-            DEBUG("event->x is %d and event->y is %d", (gint)event->x, (gint)event->y);
-
-            mpath = gnc_tree_view_split_reg_get_model_path_from_sort_path (view, spath);
-
-            /* This is to block the single click on a double click */
-            if (view->priv->single_button_press > 0)
-            {
-                view->priv->single_button_press = view->priv->single_button_press -1;
-                return TRUE;
-            }
-
-            if (gtk_tree_model_get_iter (GTK_TREE_MODEL (model), &m_iter, mpath))
-            {
-                gchar *mstring, *sstring;
-                mstring = gtk_tree_path_to_string (mpath);
-                sstring = gtk_tree_path_to_string (spath);
-                DEBUG("Mouse Button Press - mpath is %s, spath is %s", mstring, sstring);
-                g_free (mstring);
-                g_free (sstring);
-
-                // Reset the transaction confirm flag.
-                view->priv->trans_confirm = RESET;
-
-                gnc_tree_model_split_reg_get_split_and_trans (
-                       GNC_TREE_MODEL_SPLIT_REG (model), &m_iter, &is_trow1, &is_trow2, &is_split, &is_blank, &split, &trans);
-
-                // Ask for confirmation if data has been edited, gtv_sr_transaction_changed_confirm return TRUE if canceled
-                if (GPOINTER_TO_INT (g_object_get_data (G_OBJECT (view), "data-edited")) && gtv_sr_transaction_changed_confirm (view, trans))
-                {
-                    DEBUG("MB - Restore position - Cancel / Discard");
-
-                    /* Restore position - Cancel / Discard */
-                    if (view->priv->trans_confirm == CANCEL)
-                    {
-                        DEBUG("MB - Cancel");
-
-                        // Expand trans on split-trans (We only expand on cancel and more than two splits)
-                        if ((xaccTransCountSplits (view->priv->dirty_trans) > 2) && view->priv->dirty_trans != NULL)
-                        {
-                            // Jump to the first split of dirty_trans.
-                            gnc_tree_control_split_reg_jump_to (view, NULL, xaccTransGetSplit (view->priv->dirty_trans, 0), FALSE);
-                        }
-                        else
-                            // Jump to the dirty_trans.
-                            gnc_tree_control_split_reg_jump_to (view, view->priv->dirty_trans, NULL, FALSE);
-
-                        gtk_tree_path_free (spath);
-                        gtk_tree_path_free (mpath);
-                        return TRUE;
-                    }
-
-                    if (view->priv->trans_confirm == DISCARD)
-                    {
-                        DEBUG("MB - Discard");
-                        view->priv->dirty_trans = NULL;
-                    }
-                }
-                /* Skip */
-
-                /* Test for change of transaction */
-                if (view->priv->current_trans != trans)
-                    /* Reset allow changes for reconciled transactions */
-                    view->change_allowed = FALSE;
-
-                // Reconcile tests
-                if (gtv_sr_recn_tests (view, col, spath))
-                {
-                    gtk_tree_path_free (spath);
-                    gtk_tree_path_free (mpath);
-                    return TRUE;
-                }
-
-                // Get the right split for rotate test
-                if (is_split)
-                    rotate_split = split;
-                else
-                    rotate_split = gtv_sr_get_this_split (view, trans);
-
-                /* Set cursor to column */
-                if (!gnc_tree_util_split_reg_rotate (view, col, trans, rotate_split))
-                    gtk_tree_view_set_cursor (GTK_TREE_VIEW (view), spath, col, TRUE);
-                else
-                    gtk_tree_view_set_cursor (GTK_TREE_VIEW (view), spath, col, FALSE);
-
-                /* Test to see if we need to do a move */
-                gtv_split_reg_test_for_move (model, spath);
-
-                gtk_tree_path_free (spath);
-                gtk_tree_path_free (mpath);
-                return TRUE;
-            }
-            gtk_tree_path_free (spath);
-            gtk_tree_path_free (mpath);
-        }
-    }
-
-    /* This is for a double click */
-    if (event->button == 1 && event->type == GDK_2BUTTON_PRESS)
-    {
-        GdkWindow *window = gtk_tree_view_get_bin_window (GTK_TREE_VIEW (view));
-
-        if (event->window != window)
-            return FALSE;
-
-        /* this works on non editable cells like void, balance */
-        if (model->style != REG2_STYLE_JOURNAL)
-        {
-            /* This is to block the single click on a double click */
-            view->priv->single_button_press = 1;
-
-            if (view->priv->expanded)
-                gnc_tree_view_split_reg_collapse_trans (view, NULL);
-            else
-                gnc_tree_view_split_reg_expand_trans (view, NULL);
-
-            /* This updates the plugin page gui */
-            gnc_tree_view_split_reg_call_uiupdate_cb(view);
-        }
-        return TRUE;
-    }
-    return FALSE;
-}
-
-
-static gboolean
-gtv_sr_transaction_changed (GncTreeViewSplitReg *view)
-{
-    GncTreeModelSplitReg *model;
-    GtkTreeViewColumn *col;
-    GtkTreePath *spath;
-
-    model = gnc_tree_view_split_reg_get_model_from_view (view);
-
-    // spath is where we are...
-    gtk_tree_view_get_cursor (GTK_TREE_VIEW (view), &spath, &col);
-
-    if (!spath)
-        return FALSE;
-
-    if (gtv_sr_recn_tests (view, col, spath))
-    {
-        gtk_tree_path_free (spath);
-        return FALSE;
-    }
-    gtk_tree_path_free (spath);
-
-    // Reset the transaction confirm flag.
-    view->priv->trans_confirm = RESET;
-
-    //Ask for confirmation if data has been edited, gtv_sr_transaction_changed_confirm return TRUE if canceled
-    if (GPOINTER_TO_INT (g_object_get_data (G_OBJECT (view), "data-edited")) && gtv_sr_transaction_changed_confirm (view, NULL))
-    {
-        /* Restore position - Cancel / Discard */
-        DEBUG("KB - Restore position - Cancel / Discard");
-
-        if (view->priv->trans_confirm == CANCEL)
-        {
-            DEBUG("KB - Cancel");
-
-            // Expand trans on split-trans (We only expand on cancel)
-            if ((xaccTransCountSplits (view->priv->dirty_trans) > 2) && view->priv->dirty_trans != NULL)
-            {
-                // Jump to the first split of dirty_trans.
-                gnc_tree_control_split_reg_jump_to (view, NULL, xaccTransGetSplit (view->priv->dirty_trans, 0), FALSE);
-            }
-            else
-                // Jump to the dirty_trans.
-                gnc_tree_control_split_reg_jump_to (view, view->priv->dirty_trans, NULL, FALSE);
-
-            return TRUE;
-        }
-
-        if (view->priv->trans_confirm == DISCARD)
-        {
-            DEBUG("KB - Discard");
-
-            gnc_tree_view_split_reg_block_selection (view, TRUE);
-
-            // Check to see if dirty_trans expanded, collapse it.
-            if (gnc_tree_view_split_reg_trans_expanded (view, view->priv->dirty_trans))
-                gnc_tree_view_split_reg_collapse_trans (view, view->priv->dirty_trans);
-
-            gnc_tree_view_split_reg_block_selection (view, FALSE);
-
-            /* Remove the blank split and re-add - done so we keep it last in list */
-            gnc_tree_model_split_reg_set_blank_split_parent (model, view->priv->dirty_trans, TRUE);
-            gnc_tree_model_split_reg_set_blank_split_parent (model, view->priv->dirty_trans, FALSE);
-
-            // Set the transaction to show correct view
-            gnc_tree_view_split_reg_format_trans (view, view->priv->dirty_trans);
-            view->priv->dirty_trans = NULL;
-        }
-    }
-    return FALSE;
-}
-
-
-/* Return whether the cell is in editing mode */
-static gboolean
-gtv_sr_get_editing (GtkTreeViewColumn *col)
-{
-    GtkCellRenderer *cr0 = NULL, *cr1 = NULL;
-    GList *renderers;
-    gboolean cell_editing0 = FALSE;
-    gboolean cell_editing1 = FALSE;
-    gboolean editing = FALSE;
-
-    renderers = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (col));
-    cr0 = g_list_nth_data (renderers, 0); // We always have one renderer
-    if (g_list_length (renderers) == 2)
-        cr1 = g_list_nth_data (renderers, 1); // There is only one column with two renderers
-    g_list_free (renderers);
-
-    if (gtk_cell_renderer_get_visible (cr0))
-        g_object_get (G_OBJECT (cr0), "editing", &cell_editing0, NULL);
-
-    if (cr1 && gtk_cell_renderer_get_visible (cr1))
-        g_object_get (G_OBJECT (cr1), "editing", &cell_editing1, NULL);
-
-    if (cell_editing0 || cell_editing1)
-        editing = TRUE;
-
-    DEBUG("editing is %d for column title %s", editing, gtk_tree_view_column_get_title (col));
-
-    return editing;
-}
-
-
-/* For handling keynav */
-static gboolean
-gtv_sr_key_press_cb (GtkWidget *widget, GdkEventKey *event, gpointer user_data)
-{
-    GncTreeViewSplitReg *view = GNC_TREE_VIEW_SPLIT_REG (widget);
-    GncTreeModelSplitReg *model;
-    GtkTreeViewColumn *col;
-    GtkTreePath *spath, *start_spath;
-    GtkTreePath *start_path, *end_path;
-    gboolean editing = FALSE;
-    gboolean step_off = FALSE;
-    gboolean trans_changed = FALSE;
-    gint *start_indices;
-    gint *next_indices;
-    Transaction *btrans, *ctrans, *hetrans;
-    gboolean goto_blank = FALSE;
-    gboolean next_trans = TRUE;
-
-    // spath is where we are, before key press...
-    gtk_tree_view_get_cursor (GTK_TREE_VIEW (view), &spath, &col);
-
-    if (event->type != GDK_KEY_PRESS)
-    {
-        if (spath)
-            gtk_tree_path_free (spath);
-        return FALSE;
-    }
-
-    switch (event->keyval)
-    {
-    case GDK_KEY_plus:
-    case GDK_KEY_minus:
-    case GDK_KEY_KP_Add:
-    case GDK_KEY_KP_Subtract:
-
-        if (!spath)
-            return TRUE;
-
-        gtk_tree_path_free (spath);
-        return TRUE; //FIXME I may use these to expand / collapse to splits later...
-        break;
-
-    case GDK_KEY_Up:
-    case GDK_KEY_Down:
-
-        model = gnc_tree_view_split_reg_get_model_from_view (view);
-
-        if (event->keyval == GDK_KEY_Up)
-        {
-            gnc_tree_model_split_reg_move (model, VIEW_UP);
-        }
-        else
-            gnc_tree_model_split_reg_move (model, VIEW_DOWN);
-
-        return FALSE;
-        break;
-
-    case GDK_KEY_Page_Up:
-    case GDK_KEY_Page_Down:
-
-        model = gnc_tree_view_split_reg_get_model_from_view (view);
-
-        if (gtk_tree_view_get_visible_range (GTK_TREE_VIEW (view), &start_path, &end_path))
-        {
-            if (event->keyval == GDK_KEY_Page_Up)
-            {
-                GtkTreePath *new_start_path;
-                gint *start_indices, *end_indices;
-                gint new_start;
-                gint num_of_trans;
-
-                start_indices = gtk_tree_path_get_indices (start_path);
-                end_indices = gtk_tree_path_get_indices (end_path);
-                num_of_trans = end_indices[0] - start_indices[0];
-
-                new_start = start_indices[0] - num_of_trans + 2;
-
-                if (new_start < 0)
-                    new_start = 0;
-
-                new_start_path = gtk_tree_path_new_from_indices (new_start, -1);
-
-                /* Scroll to cell, top of view */
-                gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (view), new_start_path, NULL, TRUE, 0.0, 0.0);
-
-                /* Set cursor to new top row */
-                gtk_tree_view_set_cursor (GTK_TREE_VIEW (view), new_start_path, col, FALSE);
-
-                gtk_tree_path_free (new_start_path);
-
-                gnc_tree_model_split_reg_move (model, VIEW_UP);
-            }
-            else
-            {
-                GtkTreePath *new_end_path;
-                gint *start_indices, *end_indices;
-                gint new_end;
-                gint num_of_trans, total_num;
-
-                start_indices = gtk_tree_path_get_indices (start_path);
-                end_indices = gtk_tree_path_get_indices (end_path);
-                num_of_trans = end_indices[0] - start_indices[0];
-
-                total_num = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (model), NULL);
-
-                new_end = end_indices[0] + num_of_trans - 1;
-
-                if (new_end > (total_num - 1))
-                    new_end = total_num -1;
-
-                new_end_path = gtk_tree_path_new_from_indices (new_end, -1);
-
-                /* Scroll to cell, bottom of view */
-                if (model->use_double_line == TRUE)
-                {
-                    gtk_tree_path_down (new_end_path);
-                    gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (view), new_end_path, NULL, TRUE, 1.0, 0.0);
-                    gtk_tree_path_up (new_end_path);
-                }
-                else
-                    gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (view), new_end_path, NULL, TRUE, 1.0, 0.0);
-
-                /* Set cursor to new bottom row */
-                gtk_tree_view_set_cursor (GTK_TREE_VIEW (view), new_end_path, col, FALSE);
-
-                gtk_tree_path_free (new_end_path);
-
-                gnc_tree_model_split_reg_move (model, VIEW_DOWN);
-            }
-            gtk_tree_path_free (start_path);
-            gtk_tree_path_free (end_path);
-        }
-        return TRUE;
-        break;
-
-    case GDK_KEY_Home:
-    case GDK_KEY_End:
-
-        model = gnc_tree_view_split_reg_get_model_from_view (view);
-
-        if (event->keyval == GDK_KEY_Home)
-            hetrans = gnc_tree_model_split_reg_get_first_trans (model);
-        else
-            hetrans = gnc_tree_model_split_get_blank_trans (model);
-
-        model->current_trans = hetrans;
-
-        if (!gnc_tree_model_split_reg_trans_is_in_view (model, hetrans))
-            g_signal_emit_by_name (model, "refresh_trans");
-        else
-            gnc_tree_control_split_reg_jump_to (view, hetrans, NULL, FALSE);
-
-        return TRUE;
-        break;
-
-    case GDK_KEY_Return:
-    case GDK_KEY_space:
-
-        if (!spath)
-            return TRUE;
-
-        // Do the reconcile tests.
-        if (!gtv_sr_recn_tests (view, col, spath))
-        {
-            /* Set cursor to new column, open for editing */
-            gtk_tree_view_set_cursor (GTK_TREE_VIEW (view), spath, col, TRUE);
-        }
-
-        gtk_tree_path_free (spath);
-        return TRUE;
-        break;
-
-    case GDK_KEY_KP_Enter:
-
-        if (!spath)
-            return TRUE;
-
-        goto_blank = gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL_REGISTER,
-                                         GNC_PREF_ENTER_MOVES_TO_END);
-
-        model = gnc_tree_view_split_reg_get_model_from_view (view);
-        btrans = gnc_tree_model_split_get_blank_trans (model);
-        ctrans = gnc_tree_view_split_reg_get_current_trans (view);
-
-        /* Are we on the blank transaction */
-        if (btrans == ctrans)
-            next_trans = FALSE;
-
-        /* First record the transaction */
-        if (gnc_tree_view_split_reg_enter (view))
-        {
-            /* Now move. */
-            if (goto_blank)
-                g_idle_add ((GSourceFunc)gnc_tree_control_split_reg_jump_to_blank, view);
-            else if (next_trans)
-                gnc_tree_control_split_reg_goto_rel_trans_row (view, 1);
-        }
-        return TRUE;
-        break;
-
-    case GDK_KEY_Tab:
-    case GDK_KEY_ISO_Left_Tab:
-    case GDK_KEY_KP_Tab:
-
-        if (!spath)
-            return TRUE;
-
-        // Bypass Auto-complete
-        if (event->state & GDK_CONTROL_MASK)
-            view->priv->auto_complete = TRUE;
-
-        // Make sure we have stopped editing.
-        gnc_tree_view_split_reg_finish_edit (view);
-
-        // This prevents the cell changing.
-        if (view->priv->stop_cell_move == TRUE)
-        {
-            gtk_tree_path_free (spath);
-            return TRUE;
-        }
-
-        while (!editing && !step_off) // lets step over non editable columns
-        {
-            // Create a copy of the path we started with.
-            start_spath = gtk_tree_path_copy (spath);
-            start_indices = gtk_tree_path_get_indices (start_spath);
-
-            {
-                gchar *string = gtk_tree_path_to_string (start_spath);
-                DEBUG("Column title is %s and start path is %s", gtk_tree_view_column_get_title (col), string);
-                g_free (string);
-            }
-
-            model = gnc_tree_view_split_reg_get_model_from_view (view);
-
-            /* Step to the next column, we may wrap */
-            gnc_tree_view_keynav (GNC_TREE_VIEW (view), &col, spath, event); // returns path and column
-
-            {
-                gchar *string = gtk_tree_path_to_string (spath);
-                DEBUG("Column title is %s and spath is %s", gtk_tree_view_column_get_title (col), string);
-                g_free (string);
-            }
-
-            // Have we changed transactions
-            next_indices = gtk_tree_path_get_indices (spath);
-            if (start_indices[0] != next_indices[0])
-            {
-                 if (view->priv->dirty_trans != NULL) // from a dirty trans
-                    trans_changed = TRUE;
-
-                 /* Reset allow changes for reconciled transctions */
-                 view->change_allowed = FALSE;
-            }
-
-            // Do the reconcile tests.
-            if (gnc_tree_view_path_is_valid (GNC_TREE_VIEW (view), spath))
-            {
-                if (gtv_sr_recn_tests (view, col, spath))
-                {
-                    gtk_tree_path_free (start_spath);
-                    gtk_tree_path_free (spath);
-                    return TRUE;
-                }
-            }
-
-            // Have we stepped off the end
-            if (!spath || !gnc_tree_view_path_is_valid (GNC_TREE_VIEW (view), spath) || trans_changed) // We have stepped off the end / or changed trans
-            {
-                // Test for transaction changed.
-                if (gtv_sr_transaction_changed (view))
-                {
-                    gtk_tree_path_free (spath);
-                    return TRUE;
-                }
-                step_off = TRUE;
-            }
-            // This stops the cell activation on discard
-            if (view->priv->trans_confirm != DISCARD)
-            {
-                // Set cursor to new column, open for editing
-                gtk_tree_view_set_cursor (GTK_TREE_VIEW (view), spath, col, TRUE);
-            }
-            // Is this an editable cell ?
-            editing = gtv_sr_get_editing (col);
-        }
-        gtk_tree_path_free (start_spath);
-        gtk_tree_path_free (spath);
-        return TRUE;
-        break;
-
-    default:
-        gtk_tree_path_free (spath);
-	return FALSE;
-    }
-}
-
-
-/*###########################################################################*/
-
-/* Callback for selection move */
-static void
-gtv_sr_motion_cb (GtkTreeSelection *sel, gpointer user_data)
-{
-    GncTreeViewSplitReg *view = GNC_TREE_VIEW_SPLIT_REG (user_data);
-    GncTreeModelSplitReg *model;
-    GtkTreePath *mpath, *spath;
-    Split *split = NULL;
-    Transaction *trans = NULL;
-    Transaction *old_trans;
-    gboolean is_trow1, is_trow2, is_split, is_blank;
-    RowDepth depth = 0;
-    GtkTreeIter m_iter;
-    gint *indices;
-
-    model = gnc_tree_view_split_reg_get_model_from_view (view);
-
-    ENTER("View is %p and Model is %p", view, model);
-
-    DEBUG("Current trans %p, Split %p, Depth %d and Dirty Trans %p", view->priv->current_trans, view->priv->current_split,
-                                                                     view->priv->current_depth, view->priv->dirty_trans);
-
-    /* Reset help text */
-    if (view->help_text)
-        g_free (view->help_text);
-    view->help_text = g_strdup (" ");
-    g_signal_emit_by_name (view, "help_signal", NULL);
-
-    if (gtv_sr_get_model_iter_from_selection (view, sel, &m_iter))
-    {
-        gchar *mstring, *sstring;
-
-        mpath = gtk_tree_model_get_path (GTK_TREE_MODEL (model), &m_iter);
-        spath = gnc_tree_view_split_reg_get_sort_path_from_model_path (view, mpath);
-
-        mstring = gtk_tree_path_to_string (mpath);
-        sstring = gtk_tree_path_to_string (spath);
-        DEBUG("Valid Selection - mpath is %s, spath is %s", mstring, sstring);
-        g_free (mstring);
-        g_free (sstring);
-
-        /* save the current path */
-        gnc_tree_view_split_reg_set_current_path (view, mpath);
-
-        /* Use depth to determine if it is a split or transaction */
-        depth = gtk_tree_path_get_depth (mpath);
-
-        gtk_tree_path_free (mpath);
-
-        gnc_tree_model_split_reg_get_split_and_trans (
-                GNC_TREE_MODEL_SPLIT_REG (model), &m_iter, &is_trow1, &is_trow2, &is_split, &is_blank, &split, &trans);
-
-        DEBUG("Get model trans %p, split %p, is_split %d, is_blank %d\n", trans, split, is_split, is_blank);
-
-        /* Update the titles if depth changes, we change rows */
-        if (depth != view->priv->current_depth)
-            gtv_sr_titles (view, depth);
-
-        /* Move the blank split */ 
-        gnc_tree_model_split_reg_set_blank_split_parent (model, trans, FALSE);
-
-        /* Save trans / split / depth to the current values */
-        old_trans = view->priv->current_trans;
-        view->priv->current_trans = trans;
-        view->priv->current_split = split;
-        view->priv->current_depth = depth;
-
-        DEBUG("Current trans %p, split %p, depth %d and old_trans %p", view->priv->current_trans, view->priv->current_split,
-                                                                     view->priv->current_depth, old_trans);
-
-        /* Save trans and current row to model */
-        model->current_trans = trans;
-        indices = gtk_tree_path_get_indices (spath);
-        model->current_row = indices[0];
-        gnc_tree_model_split_reg_sync_scrollbar (model);
-
-        /* Test for change of transaction and old transaction equals a dirty transaction */
-        if ((trans != old_trans) && (old_trans == view->priv->dirty_trans))
-        {
-            if (gtv_sr_transaction_changed (view))
-            {
-                gtk_tree_path_free (spath);
-                LEAVE("Leave Transaction Changed");
-                return;
-            }
-        }
-        if (view->priv->trans_confirm == CANCEL)
-        {
-            gtk_tree_path_free (spath);
-            LEAVE("Leave Transaction Changed - Cancel");
-            return;
-        }
-
-        /* Auto expand transaction and collapse previous transaction */
-        if (old_trans != trans)
-        {
-            if (model->style != REG2_STYLE_JOURNAL)
-            {
-                gnc_tree_view_split_reg_block_selection (view, TRUE);
-
-                if (gnc_tree_view_split_reg_trans_expanded (view, old_trans))
-                    gnc_tree_view_split_reg_collapse_trans (view, old_trans);
-
-                gnc_tree_view_split_reg_block_selection (view, FALSE);
-            }
-            else
-                gnc_tree_view_split_reg_expand_trans (view, NULL);
-
-            if (model->style == REG2_STYLE_AUTO_LEDGER)
-            {
-                gtk_tree_view_expand_row (GTK_TREE_VIEW (view), spath, TRUE);
-
-                view->priv->expanded = TRUE;
-
-                if (view->priv->selection_to_blank_on_expand)
-                    gtv_sr_selection_to_blank (view);
-            }
-        }
-        gtk_tree_path_free (spath);
-
-        // Check to see if current trans is expanded and remember
-        if (gnc_tree_view_split_reg_trans_expanded (view, trans))
-            view->priv->expanded = TRUE;
-        else
-            view->priv->expanded = FALSE;
-    }
-    else
-    {
-        DEBUG("Not Valid Selection");
-        /* We do not have a valid iter */
-        gtv_sr_titles (view, 0);
-
-        /* Move the blank split to the last transaction */ 
-        gnc_tree_model_split_reg_set_blank_split_parent (model, NULL, FALSE);
-
-        /* Set the default selection start position */
-        gnc_tree_view_split_reg_default_selection (view);
-    }
-
-    /* This updates the plugin page gui */
-    gnc_tree_view_split_reg_call_uiupdate_cb (view);
-
-    LEAVE(" ");
-}
-
-/*###########################################################################*/
-
-/* Connected to "edited" from cellrenderer. For reference, see
-   split-register-model-save.c */
-static void
-gtv_sr_edited_cb (GtkCellRendererText *cell, const gchar *path_string,
-               const gchar *new_text, gpointer user_data)
-{
-    GncTreeViewSplitReg  *view = GNC_TREE_VIEW_SPLIT_REG (user_data);
-    GncTreeModelSplitReg *model;
-    GtkCellEditable      *editable;
-
-    editable = g_object_get_data (G_OBJECT (cell), "cell-editable");
-
-    DEBUG("cell is %p editable pointer is %p and id %lu", cell, editable, view->priv->fo_handler_id);
-
-    /* Remove the focus out cb if one exists */
-    if (view->priv->fo_handler_id != 0)
-    {
-        if (g_signal_handler_is_connected (G_OBJECT (editable), view->priv->fo_handler_id))
-            g_signal_handler_disconnect (G_OBJECT (editable), view->priv->fo_handler_id);
-    }
-    view->priv->fo_handler_id = 0;
-
-    /* Make sure we set focus to the tree view after cell editing */
-    gtk_widget_grab_focus (GTK_WIDGET (view));
-
-    if (g_strcmp0 (g_object_get_data (G_OBJECT (cell), "current-string"), new_text) == 0) // No change, return
-    {
-        if (view->priv->stop_cell_move == FALSE)
-            return;
-    }
-
-    model = gnc_tree_view_split_reg_get_model_from_view (view);
-    g_return_if_fail (model);
-
-    /* Are we using a template or not */
-    if (!gnc_tree_model_split_reg_get_template (model))
-        gtv_sr_edited_normal_cb (cell, path_string, new_text, view);
-    else
-        gtv_sr_edited_template_cb (cell, path_string, new_text, view);
-}
-
-
-/* This is used for the normal registers */
-static void
-gtv_sr_edited_normal_cb (GtkCellRendererText *cell, const gchar *path_string,
-               const gchar *new_text, gpointer user_data)
-{
-    GncTreeViewSplitReg  *view = GNC_TREE_VIEW_SPLIT_REG (user_data);
-    GncTreeModelSplitReg *model;
-    GtkCellEditable      *editable;
-    GtkTreeIter           m_iter;
-    Split                *split;
-    Transaction          *trans;
-    gboolean              is_trow1, is_trow2, is_split, is_blank;
-    ViewCol               viewcol;
-    char                 *error_loc = NULL;
-    Account              *anchor = view->priv->anchor;
-
-    editable = g_object_get_data (G_OBJECT (cell), "cell-editable");
-
-    DEBUG("cell is %p editable pointer is %p", cell, editable);
-
-    g_return_if_fail (gtv_sr_get_model_iter_from_view_string (view, path_string, &m_iter));
-
-    viewcol = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (cell), "view_column"));
-
-    model = gnc_tree_view_split_reg_get_model_from_view (view);
-    g_return_if_fail (model);
-
-    gnc_tree_model_split_reg_get_split_and_trans (
-        model, &m_iter, &is_trow1, &is_trow2, &is_split, &is_blank, &split, &trans);
-
-    switch (viewcol) {
-    case COL_DATE:
-        /* Column is DATE */
-        if (is_trow1)
-        {
-            GDate parsed_date;
-            gnc_tree_util_split_reg_parse_date (&parsed_date, new_text);
-            if (g_date_valid (&parsed_date))
-            {
-                gtv_sr_begin_edit (view, trans);
-                xaccTransSetDate (trans, g_date_get_day (&parsed_date), g_date_get_month (&parsed_date), g_date_get_year (&parsed_date));
-            }
-            else
-            {
-                // We should never get here
-                PERR("invalid date '%s'", new_text);
-            }
-        }
-        break;
-
-    case COL_NUMACT:
-        /* Column is NUM / ACT */
-        gtv_sr_begin_edit (view, trans);
-        if (is_trow1)
-        {
-            /* set per book option */
-            gnc_set_num_action (trans, gtv_sr_get_this_split (view, trans),
-                                                                new_text, NULL);
-
-            if (!qof_book_use_split_action_for_num_field (gnc_get_current_book()))
-            {
-                // Set the last number value for this account.
-                if (gnc_strisnum (new_text) && anchor != NULL)
-                    xaccAccountSetLastNum (anchor, new_text);
-            }
-        }
-        if (is_trow2)
-        {
-            /* set per book option */
-            gnc_set_num_action (trans, gtv_sr_get_this_split (view, trans),
-                                                                NULL, new_text);
-
-            if (qof_book_use_split_action_for_num_field (gnc_get_current_book()))
-            {
-                // Set the last number value for this account.
-                if (gnc_strisnum (new_text) && anchor != NULL)
-                    xaccAccountSetLastNum (anchor, new_text);
-            }
-        }
-        if (is_split)
-        {
-            /* Set split-action with gnc_set_num_action which is the same as
-             * xaccSplitSetAction with these arguments */
-            gnc_set_num_action (NULL, split, NULL, new_text);
-        }
-        break;
-
-    case COL_DESCNOTES:
-        /* Column is DESCRIPTION / NOTES / MEMO */
-        gtv_sr_begin_edit (view, trans);
-        if (is_trow1)
-        {
-            xaccTransSetDescription (trans, new_text);
-            // This will potentially fill in the rest of the transaction.
-            if (view->priv->auto_complete == FALSE)
-            {
-                gnc_tree_control_auto_complete (view, trans, new_text);
-                view->priv->auto_complete = TRUE;
-            }
-        }
-        if (is_trow2)
-            xaccTransSetNotes (trans, new_text);
-
-        if (is_split)
-            xaccSplitSetMemo (split, new_text);
-
-        break;
-
-    case COL_RECN:
-        /* Column is RECONCILE */
-        gtv_sr_begin_edit (view, trans);
-        {
-            char rec = 'n';
-
-            if (new_text != NULL)
-            {
-                const gchar *cflag = gnc_get_reconcile_str (CREC);
-                const gchar *nflag = gnc_get_reconcile_str (NREC);
-                const char recn_flags[] = {NREC, CREC, 0}; // List of reconciled flags
-                const gchar *flags;
-                gchar *this_flag;
-                gint index = 0;
-
-                flags = g_strconcat (nflag, cflag, NULL); // List of translated strings.
-
-                /* Find the current flag in the list of flags */
-                this_flag = strstr (flags, new_text);
-
-                if (this_flag != NULL)
-                {
-                    index = this_flag - flags;
-                    rec = recn_flags[index];
-                }
-            }
-            if (is_trow1) 
-                xaccSplitSetReconcile (gtv_sr_get_this_split (view, trans), rec);
-            if (is_split)
-                xaccSplitSetReconcile (split, rec);
-        }
-        break;
-
-    case COL_TYPE:
-        /* Column is TYPE */
-        gtv_sr_begin_edit (view, trans);
-        {
-            char type = TXN_TYPE_NONE;
-            if (new_text != NULL)
-                type = new_text[0];
-
-            if (is_trow1)
-                xaccTransSetTxnType (trans, type);
-        }
-        break;
-
-    case COL_TRANSFERVOID:
-    case COL_AMTVAL:
-    case COL_AMOUNT:
-    case COL_PRICE:
-    case COL_DEBIT:
-    case COL_CREDIT:
-        {
-            Account       *acct, *old_acct;
-            gnc_numeric    input;
-            Split         *osplit = NULL;
-            gboolean       valid_input = FALSE;
-            gboolean       force = FALSE;
-            gboolean       input_used = FALSE;
-
-            gtv_sr_begin_edit (view, trans);
-
-            /* Get the split pair if anchored to a register */
-            if (!is_split && anchor)
-            {
-                if (!gtv_sr_get_split_pair (view, trans, &osplit, &split))
-                {
-                    DEBUG("couldn't get split pair");
-                    break;
-                }
-            }
-
-            /* Setup the account field */
-            if (viewcol == COL_TRANSFERVOID)
-            {
-                view->priv->stop_cell_move = FALSE;
-                acct = gnc_tree_control_split_reg_get_account_by_name (view, new_text);
-                if (acct == NULL)
-                {
-                    DEBUG("Account is NULL");
-                    xaccSplitReinit(split);
-                    if (osplit)
-                        xaccSplitDestroy (osplit);
-
-                    g_free (view->priv->transfer_string);
-                    view->priv->transfer_string = g_strdup (new_text);
-                    view->priv->stop_cell_move = TRUE;
-
-                    /* this will populate cell with original value */
-                    g_idle_add ((GSourceFunc) gtv_sr_idle_transfer, view);
-                    break;
-                }
-
-                if (acct != NULL && is_split)
-                {
-                    old_acct = xaccSplitGetAccount (split);
-                    xaccSplitSetAccount (split, acct);
-                    if (!gnc_commodity_equiv (xaccAccountGetCommodity (old_acct), xaccAccountGetCommodity (acct)))
-                        force = TRUE;
-                }
-                else
-                {
-                    old_acct = xaccSplitGetAccount (osplit);
-                    xaccSplitSetAccount (osplit, acct);
-                    if (!gnc_commodity_equiv (xaccAccountGetCommodity (old_acct), xaccAccountGetCommodity (acct)))
-                        force = TRUE;
-                }
-            }
-            else
-            {
-                if (!gnc_exp_parser_parse (new_text, &input, &error_loc))
-                    break;
-                else
-                    valid_input = TRUE;
-            }
-
-            /* Get the account for this split */
-            acct = xaccSplitGetAccount (split);
-            if (!acct)
-            {
-                if (anchor)
-                {
-                    xaccSplitSetAccount (split, anchor);
-                    acct = xaccSplitGetAccount (split);
-                }
-                else
-                {
-                    break; //Well, what else is there to do?
-                }
-            }
-
-            /* Set the transaction currency if not set */
-            if (!xaccTransGetCurrency (trans))
-            {
-                // set transaction currency to that of register (which is guaranteed to be a currency)
-                xaccTransSetCurrency (trans, view->priv->reg_currency);
-
-                // We are on General ledger
-                if (!anchor)
-                {
-                    xaccTransSetCurrency (trans, gnc_account_or_default_currency (xaccSplitGetAccount (split), NULL));
-                }
-            }
-
-            // No need to check for a non-currency register because that's what
-            // was already checked when reg_currency was stored.
-
-            /* This computes the value if we just commit the split after entering account */
-            if (!valid_input)
-                input = gnc_tree_util_split_reg_get_value_for (view, trans, split, is_blank);
-
-            // Negate the input if COL_CREDIT
-            if (viewcol == COL_CREDIT)
-                input = gnc_numeric_neg (input);
-
-            // Set the split parent trans
-            xaccSplitSetParent (split, trans);
-
-            // If we are at trasaction level, column is value, split level is amount
-            if (viewcol == COL_AMTVAL)
-            {
-                gnc_tree_util_set_number_for_input (view, trans, split, input, COL_AMTVAL);
-                input_used = TRUE;
-            }
-
-            // The price of stock / shares, editable only when expanded and sub_account
-            if (viewcol == COL_AMOUNT)
-            {
-                gnc_tree_util_set_number_for_input (view, trans, split, input, COL_AMTVAL);
-                input_used = TRUE;
-            }
-
-            // The price of stock / shares
-            if (viewcol == COL_PRICE)
-            {
-                gnc_tree_util_set_number_for_input (view, trans, split, input, COL_PRICE);
-                input_used = TRUE;
-            }
-
-            // Check if this is a stock / share amount
-            if (viewcol == COL_CREDIT || viewcol == COL_DEBIT)
-            {
-                if (!gnc_commodity_is_currency (xaccAccountGetCommodity (acct)))
-                {
-                    gnc_tree_util_set_number_for_input (view, trans, split, input, viewcol);
-                    input_used = TRUE;
-                }
-            }
-
-            // This is used in transaction mode, two splits
-            if (input_used == FALSE)
-            {
-                if (gnc_commodity_is_currency (xaccAccountGetCommodity (acct)))
-                    gnc_tree_util_split_reg_set_value_for (view, trans, split, input, force);
-                else
-                    gnc_tree_util_set_value_for_amount (view, trans, split, input);
-            }
-
-            // If this is the blank split, promote it.
-            if (is_blank)
-            {
-                /*FIXME May be this should be a signal - Promote the blank split to a real split */
-                g_idle_add ((GSourceFunc) gnc_tree_model_split_reg_commit_blank_split, gnc_tree_view_split_reg_get_model_from_view (view));
-
-                /* scroll when view idle */
-                g_idle_add ((GSourceFunc) gnc_tree_view_split_reg_scroll_to_cell, view);
-            }
-
-            // In transaction mode, two splits only, set up the other split.
-            if (osplit)
-            {
-                xaccSplitSetParent (osplit, trans);
-
-                if (gnc_commodity_is_currency (xaccAccountGetCommodity (acct)))
-                    gnc_tree_util_split_reg_set_value_for (view, trans, osplit, gnc_numeric_neg (input), force);
-                else
-                    gnc_tree_util_set_value_for_amount (view, trans, osplit, gnc_numeric_neg (xaccSplitGetValue (split)));
-            }
-        }
-        break;
-
-    default:
-        //g_assert_not_reached();
-        break;
-    }
-}
-
-
-/* This is used for the template registers */
-static void
-gtv_sr_edited_template_cb (GtkCellRendererText *cell, const gchar *path_string,
-               const gchar *new_text, gpointer user_data)
-{
-    GncTreeViewSplitReg  *view = GNC_TREE_VIEW_SPLIT_REG (user_data);
-    GncTreeModelSplitReg *model;
-    GtkCellEditable      *editable;
-    GtkTreeIter           m_iter;
-    Split                *split;
-    Transaction          *trans;
-    gboolean              is_trow1, is_trow2, is_split, is_blank;
-    ViewCol               viewcol;
-    Account              *anchor = view->priv->anchor;
-
-    editable = g_object_get_data (G_OBJECT (cell), "cell-editable");
-
-    DEBUG("cell is %p editable pointer is %p", cell, editable);
-
-    g_return_if_fail (gtv_sr_get_model_iter_from_view_string (view, path_string, &m_iter));
-
-    viewcol = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (cell), "view_column"));
-
-    model = gnc_tree_view_split_reg_get_model_from_view (view);
-    g_return_if_fail (model);
-
-    gnc_tree_model_split_reg_get_split_and_trans (
-        model, &m_iter, &is_trow1, &is_trow2, &is_split, &is_blank, &split, &trans);
-
-    switch (viewcol) {
-    case COL_NUMACT:
-        /* Column is NUM / ACT */
-        gtv_sr_begin_edit (view, trans);
-        if (is_trow1)
-        {
-            /* set per book option */
-            gnc_set_num_action (trans, gtv_sr_get_this_split (view, trans),
-                                                                new_text, NULL);
-
-            if (!qof_book_use_split_action_for_num_field (gnc_get_current_book()))
-            {
-                // Set the last number value for this account.
-                if (gnc_strisnum (new_text) && anchor != NULL)
-                    xaccAccountSetLastNum (anchor, new_text);
-            }
-        }
-        if (is_trow2)
-        {
-            /* set per book option */
-            gnc_set_num_action (trans, gtv_sr_get_this_split (view, trans),
-                                                                NULL, new_text);
-
-            if (qof_book_use_split_action_for_num_field (gnc_get_current_book()))
-            {
-                // Set the last number value for this account.
-                if (gnc_strisnum (new_text) && anchor != NULL)
-                    xaccAccountSetLastNum (anchor, new_text);
-            }
-        }
-        if (is_split)
-        {
-            /* Set split-action with gnc_set_num_action which is the same as
-             * xaccSplitSetAction with these arguments */
-            gnc_set_num_action (NULL, split, NULL, new_text);
-        }
-        break;
-
-    case COL_DESCNOTES:
-        /* Column is DESCRIPTION / NOTES / MEMO */
-        gtv_sr_begin_edit (view, trans);
-        if (is_trow1)
-        {
-            xaccTransSetDescription (trans, new_text);
-            // This will potentially fill in the rest of the transaction.
-            if (view->priv->auto_complete == FALSE)
-            {
-                gnc_tree_control_auto_complete (view, trans, new_text);
-                view->priv->auto_complete = TRUE;
-            }
-        }
-        if (is_trow2)
-            xaccTransSetNotes (trans, new_text);
-
-        if (is_split)
-            xaccSplitSetMemo (split, new_text);
-
-        break;
-
-    case COL_RECN:
-        /* Column is RECONCILE */
-        gtv_sr_begin_edit (view, trans);
-        {
-            char rec = 'n';
-
-            if (new_text != NULL)
-            {
-                const gchar *cflag = gnc_get_reconcile_str (CREC);
-                const gchar *nflag = gnc_get_reconcile_str (NREC);
-                const char recn_flags[] = {NREC, CREC, 0}; // List of reconciled flags
-                const gchar *flags;
-                gchar *this_flag;
-                gint index = 0;
-
-                flags = g_strconcat (nflag, cflag, NULL); // List of translated strings.
-
-                /* Find the current flag in the list of flags */
-                this_flag = strstr (flags, new_text);
-
-                if (this_flag != NULL)
-                {
-                    index = this_flag - flags;
-                    rec = recn_flags[index];
-                }
-            }
-            if (is_trow1)
-                xaccSplitSetReconcile (gtv_sr_get_this_split (view, trans), rec);
-            if (is_split)
-                xaccSplitSetReconcile (split, rec);
-        }
-        break;
-
-    case COL_TRANSFERVOID:
-    case COL_DEBIT:
-    case COL_CREDIT:
-        {
-            gtv_sr_begin_edit (view, trans);
-
-            /* Setup the account field */
-            if (viewcol == COL_TRANSFERVOID)
-            {
-                Account *template_acc;
-		Account *acct;
-                const GncGUID *acctGUID;
-
-                /* save the account GncGUID into the kvp_data. */
-                view->priv->stop_cell_move = FALSE;
-                acct = gnc_tree_control_split_reg_get_account_by_name (view, new_text);
-                if (acct == NULL)
-                {
-                    DEBUG("Template Account is NULL");
-
-                    g_free (view->priv->transfer_string);
-                    view->priv->transfer_string = g_strdup (new_text);
-                    view->priv->stop_cell_move = TRUE;
-
-                    /* this will populate cell with original value */
-                    g_idle_add ((GSourceFunc) gtv_sr_idle_transfer, view);
-                    break;
-                }
-
-                acctGUID = xaccAccountGetGUID (acct);
-		qof_instance_set (QOF_INSTANCE (split),
-				  "sx-account", acctGUID,
-				  NULL);
-
-                template_acc = gnc_tree_model_split_reg_get_template_account (model);
-
-                /* set the actual account to the fake account for these templates */
-                xaccAccountInsertSplit (template_acc, split);
-            }
-
-            /* Set the transaction currency if not set */
-            if (!xaccTransGetCurrency (trans))
-            {
-                xaccTransSetCurrency (trans, gnc_account_or_default_currency (xaccSplitGetAccount (split), NULL));
-            }
-
-            // No need to check for a non-currency register because that's what
-            // was already checked when reg_currency was stored.
-
-            /* Setup the debit and credit fields */
-            if (viewcol == COL_DEBIT)
-            {
-                char *error_loc;
-                gnc_numeric new_value;
-                gboolean parse_result;
-
-                /* Setup the debit formula */
-
-                /* If the value can be parsed into a numeric result, store that
-                 * numeric value additionally. See above comment.*/
-                parse_result = gnc_exp_parser_parse_separate_vars (new_text, &new_value, &error_loc, NULL);
-                if (!parse_result)
-                {
-                    new_value = gnc_numeric_zero();
-                }
-		qof_instance_set (QOF_INSTANCE (split),
-				  "sx-debit-formula", new_text,
-				  "sx-debit-numeric", &new_value,
-				  "sx-credit-formula", NULL,
-				  "sx-credit-numeric", NULL,
-				  NULL);
-            }
-
-            /* Setup the debit and credit fields */
-            if (viewcol == COL_CREDIT)
-            {
-                char *error_loc;
-                gnc_numeric new_value;
-                gboolean parse_result;
-
-               /* If the value can be parsed into a numeric result (without any
-                 * further variable definitions), store that numeric value
-                 * additionally in the kvp. Otherwise store a zero numeric
-                 * there.*/
-                parse_result = gnc_exp_parser_parse_separate_vars (new_text, &new_value, &error_loc, NULL);
-                if (!parse_result)
-                {
-                    new_value = gnc_numeric_zero();
-                }
-		qof_instance_set (QOF_INSTANCE (split),
-				  "sx-credit-formula", new_text,
-				  "sx-credit-numeric", &new_value,
-				  "sx-debit-formula", NULL,
-				  "sx-debit-numeric", NULL,
-				  NULL);
-            }
-            /* set the amount to an innocuous value */
-            xaccSplitSetValue (split, gnc_numeric_create (0, 1));
-
-            // Set the split parent trans
-            xaccSplitSetParent (split, trans);
-
-            // If this is the blank split, promote it.
-            if (is_blank)
-            {
-                /*FIXME May be this should be a signal - Promote the blank split to a real split */
-                g_idle_add ((GSourceFunc) gnc_tree_model_split_reg_commit_blank_split, gnc_tree_view_split_reg_get_model_from_view (view));
-
-                /* scroll when view idle */
-                g_idle_add ((GSourceFunc) gnc_tree_view_split_reg_scroll_to_cell, view);
-            }
-        }
-        break;
-
-    default:
-        //g_assert_not_reached();
-        break;
-    }
-}
-
-/*###########################################################################*/
-
-/* Parses the string value and returns true if it is a
- * number. In that case, *num is set to the value parsed. */
-static gboolean
-gtv_sr_parse_num (const char *string, long int *num)
-{
-    long int number;
-
-    if (string == NULL)
-        return FALSE;
-
-    if (!gnc_strisnum (string))
-        return FALSE;
-
-    number = strtol (string, NULL, 10);
-
-    if ((number == LONG_MIN) || (number == LONG_MAX))
-        return FALSE;
-
-    if (num != NULL)
-        *num = number;
-
-    return TRUE;
-}
-
-/* Callback for Number Accelerator key */
-static void
-gtv_sr_num_cb (GtkEntry    *entry,
-                          const gchar *text,
-                          gint         length,
-                          gint        *position,
-                          gpointer     user_data)
-{
-    GtkEditable *editable = GTK_EDITABLE (entry);
-    GncTreeViewSplitReg *view = GNC_TREE_VIEW_SPLIT_REG (user_data);
-    GncTreeModelSplitReg *model;
-    RowDepth depth;
-    Account *account;
-    gchar *entered_string;
-    gchar *leave_string = NULL;
-
-    gboolean accel = FALSE;
-    gboolean is_num;
-    long int number = 0;
-    gunichar uc;
-
-    model = gnc_tree_view_split_reg_get_model_from_view (view);
-
-    account = gnc_tree_model_split_reg_get_anchor (model);
-
-    depth = gnc_tree_view_reg_get_selected_row_depth (view);
-
-    // This only works on the number field.
-    if ((depth == TRANS2 || depth == SPLIT3))
-        return;
-
-    // Get entered string
-    entered_string = gtk_editable_get_chars (editable, 0, -1);
-
-    // Test for number and return it.
-    is_num = gtv_sr_parse_num (entered_string, &number);
-
-    if (is_num && (number < 0))
-        is_num = FALSE;
-
-    // Test for accelerator keys.
-    uc = g_utf8_get_char (text);
-    switch (uc)
-    {
-    case '+':
-    case '=':
-        number++;
-        accel = TRUE;
-        break;
-
-    case '_':
-    case '-':
-        number--;
-        accel = TRUE;
-        break;
-
-    case '}':
-    case ']':
-        number += 10;
-        accel = TRUE;
-        break;
-
-    case '{':
-    case '[':
-        number -= 10;
-        accel = TRUE;
-        break;
-    }
-
-    if (number < 0)
-        number = 0;
-
-    /* If there is already a non-number there, don't accelerate. */
-    if (accel && !is_num && (g_strcmp0 (entered_string, "") != 0))
-        accel = FALSE;
-
-    // See if entered string is empty, try and get the last number.
-    if (accel && (g_strcmp0 (entered_string, "") == 0))
-    {
-        if (account != NULL)
-        {
-            if (gtv_sr_parse_num (xaccAccountGetLastNum (account), &number))
-                number = number + 1;
-            else
-                number = 1;
-        }
-        else
-            number = 1;
-
-        is_num = TRUE;
-    }
-
-    if (!accel)
-    {
-        leave_string = g_strconcat (entered_string, text, NULL);
-    }
-
-    if (accel && is_num)
-    {
-        char buff[128];
-
-        strcpy (buff, "");
-        snprintf (buff, sizeof(buff), "%ld", number);
-
-        if (g_strcmp0 (buff, "") == 0)
-            leave_string = "";
-        else
-            leave_string = g_strdup (buff);
-    }
-
-    g_signal_handlers_block_by_func (editable, (gpointer) gtv_sr_num_cb, user_data);
-
-    gtk_editable_delete_text (editable, 0, -1);
-    gtk_editable_set_position (editable, 0);
-
-    if (leave_string != NULL)
-        gtk_editable_insert_text (editable, leave_string, -1, position);
-
-    g_signal_handlers_unblock_by_func (editable, (gpointer) gtv_sr_num_cb, user_data);
-
-    g_signal_stop_emission_by_name (editable, "insert_text");
-
-    if (leave_string)
-        g_free (leave_string);
-
-    g_free (entered_string);
-}
-
-
-/* Callback for Account separator key */
-static void
-gtv_sr_acct_cb (GtkEntry    *entry,
-                          const gchar *text,
-                          gint         length,
-                          gint        *position,
-                          gpointer     user_data)
-{
-    GtkEditable *editable = GTK_EDITABLE (entry);
-    GncTreeViewSplitReg *view = GNC_TREE_VIEW_SPLIT_REG (user_data);
-    GtkEntryCompletion *completion;
-    GtkTreeModel *model;
-    GtkTreeIter  iter;
-
-    const gchar *sep_char;
-    gchar       *entered_string;
-    gchar       *acct_string = NULL;
-
-    gint         num_of_items = 0;
-    gboolean     valid;
-    gboolean     all_the_same = TRUE;
-
-    sep_char = gnc_get_account_separator_string ();
-
-    if (g_strcmp0 (text, sep_char) == 0)
-        entered_string = g_strconcat (gtk_editable_get_chars (editable, 0, -1), NULL);
-    else
-        entered_string = g_strconcat (gtk_editable_get_chars (editable, 0, -1), text, NULL);
-
-    // Get the completion and model
-    completion = gtk_entry_get_completion (entry);
-    model = gtk_entry_completion_get_model (completion);
-
-    // Get the first item in the list
-    valid = gtk_tree_model_get_iter_first (model, &iter);
-    while (valid)
-    {
-        gchar *item, *item_string, *l_item, *l_entered_string, *l_acct_string;
-
-        // Walk through the list, reading each row
-        if (view->priv->acct_short_names)
-            gtk_tree_model_get (model, &iter, 0, &item, -1);
-        else
-            gtk_tree_model_get (model, &iter, 1, &item, -1);
-
-        item_string = g_strconcat (item, sep_char, NULL);
-
-        l_item = g_utf8_strdown (item_string, -1);
-        l_entered_string = g_utf8_strdown (entered_string, -1);
-
-        if (g_str_has_prefix (l_item, l_entered_string))
-        {
-            if (num_of_items == 0)
-                acct_string = g_strdup (item);
-            else
-            {
-                l_acct_string = g_utf8_strdown (acct_string, -1);
-                if (!g_str_has_prefix (g_utf8_strdown (l_item, -1), l_acct_string))
-                    all_the_same = FALSE;
-                g_free (l_acct_string);
-            }
-            num_of_items = num_of_items + 1;
-        }
-        g_free (item);
-        g_free (item_string);
-        g_free (l_item);
-        g_free (l_entered_string);
-        valid = gtk_tree_model_iter_next (model, &iter);
-    }
-
-    g_signal_handlers_block_by_func (editable, (gpointer) gtv_sr_acct_cb, user_data);
-
-    gtk_editable_delete_text (editable, 0, -1);
-    gtk_editable_set_position (editable, 0);
-
-    if (num_of_items == 0)
-        gtk_editable_insert_text (editable, entered_string, -1, position);
-    else
-    {
-        if (num_of_items == 1)
-            gtk_editable_insert_text (editable, acct_string, -1, position);
-        else
-        {
-            if (all_the_same)
-            {
-                if (g_strcmp0 (text, sep_char) == 0)
-                    gtk_editable_insert_text (editable, g_strconcat (acct_string, sep_char, NULL), -1, position);
-                else
-                    gtk_editable_insert_text (editable, entered_string, -1, position);
-            }
-            else
-               gtk_editable_insert_text (editable, entered_string, -1, position);
-        }
-    }
-    g_signal_handlers_unblock_by_func (editable, (gpointer) gtv_sr_acct_cb, user_data);
-
-    g_signal_stop_emission_by_name (editable, "insert_text");
-    g_free (acct_string);
-    g_free (entered_string);
-}
-
-
-/* Callback for changing reconcile setting with space bar */
-static void
-gtv_sr_recn_cb (GtkEntry    *entry,
-                          const gchar *text,
-                          gint         length,
-                          gint        *position,
-                          gpointer     user_data)
-{
-    GtkEditable *editable = GTK_EDITABLE (entry);
-    GncTreeViewSplitReg *view = GNC_TREE_VIEW_SPLIT_REG (user_data);
-
-    const gchar *cflag = gnc_get_reconcile_str (CREC);
-    const gchar *nflag = gnc_get_reconcile_str (NREC);
-
-    const gchar *flags;
-    gchar *this_flag;
-    gchar *result;
-    static char ss[2];
-    gint index = 0;
-
-    result = g_ascii_strdown (text, length);
-
-    if (g_object_get_data (G_OBJECT (view->priv->temp_cr), "current-flag") != NULL)
-        index = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (view->priv->temp_cr), "current-flag"));
-    else
-    {
-        if (g_strcmp0 (g_object_get_data (G_OBJECT (view->priv->temp_cr), "current-string"), nflag) == 0)
-            index = 0;
-    }
-
-    flags = g_strconcat (nflag, cflag, NULL);
-
-    /* So we can test for space */
-    ss[0] = ' ';
-    ss[1] = '\0';
-
-    /* Find the entered text in the list of flags */
-    this_flag = strstr (flags, text);
-
-    if (this_flag == NULL || *this_flag == '\0')
-    {
-        if (g_strcmp0 (text, ss) == 0)  // test for space
-        {
-            /* In the list, choose the next item in the list
-               (wrapping around as necessary). */
-
-            if (flags[index + 1] != '\0')
-                index = index + 1;
-            else
-                index = 0;
-
-            g_free (result);
-            result = g_strdup_printf("%c", flags[index]);
-        }
-        else
-        {
-            /* If it's not there (or the list is empty) use default_flag */
-            g_free (result);
-            result = g_strdup (gnc_get_reconcile_str (NREC));
-        }
-    }
-    else
-    {
-        g_free (result);
-        result = g_strdup (text);
-    }
-
-    /* save the index in the cellrenderer */
-    g_object_set_data (G_OBJECT (view->priv->temp_cr), "current-flag", GINT_TO_POINTER (index));
-
-    g_signal_handlers_block_by_func (editable, (gpointer) gtv_sr_recn_cb, user_data);
-
-    gtk_editable_delete_text (editable, 0, -1);
-    gtk_editable_insert_text (editable, result, length, position);
-
-    g_signal_handlers_unblock_by_func (editable, (gpointer) gtv_sr_recn_cb, user_data);
-
-    g_signal_stop_emission_by_name (editable, "insert_text");
-
-    g_free (result);
-}
-
-
-/* Callback for changing type setting with space bar */
-static void
-gtv_sr_type_cb (GtkEntry    *entry,
-                          const gchar *text,
-                          gint         length,
-                          gint        *position,
-                          gpointer     user_data)
-{
-    GtkEditable *editable = GTK_EDITABLE (entry);
-    GncTreeViewSplitReg *view = GNC_TREE_VIEW_SPLIT_REG (user_data);
-    const gchar *flags;
-    const char type_flags[] = {TXN_TYPE_INVOICE, TXN_TYPE_PAYMENT, 0};
-    gchar *this_flag;
-    gchar *result;
-    static char ss[2];
-    gint index = 0;
-
-    flags = type_flags;
-
-    result = g_ascii_strup (text, length);
-
-    if (g_object_get_data (G_OBJECT (view->priv->temp_cr), "current-flag") != NULL)
-        index = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (view->priv->temp_cr), "current-flag"));
-    else
-    {
-        if (g_strcmp0 (g_object_get_data (G_OBJECT (view->priv->temp_cr), "current-string"), "I") == 0)
-            index = 0;
-    }
-
-    /* So we can test for space */
-    ss[0] = ' ';
-    ss[1] = '\0';
-
-    /* Find the entered text in the list of flags */
-    this_flag = strstr (flags, text);
-
-    if (this_flag == NULL || *this_flag == '\0')
-    {
-        if (g_strcmp0 (text, ss) == 0)  // test for space
-        {
-            /* In the list, choose the next item in the list
-               (wrapping around as necessary). */
-
-            if (flags[index + 1] != '\0')
-                index = index + 1;
-            else
-                index = 0;
-
-            g_free (result);
-            result = g_strdup_printf("%c", flags[index]);
-        }
-        else
-        {
-            /* If it's not there (or the list is empty) use default_flag */
-            g_free (result);
-            result  = NULL;
-        }
-    }
-    else
-    {
-        g_free (result);
-        result = g_strdup (text);
-    }
-
-    /* save the index in the cellrenderer */
-    g_object_set_data (G_OBJECT (view->priv->temp_cr), "current-flag", GINT_TO_POINTER (index));
-
-    g_signal_handlers_block_by_func (editable, (gpointer) gtv_sr_type_cb, user_data);
-
-    gtk_editable_delete_text (editable, 0, -1);
-    gtk_editable_insert_text (editable, result, length, position);
-
-    g_signal_handlers_unblock_by_func (editable, (gpointer) gtv_sr_type_cb, user_data);
-
-    g_signal_stop_emission_by_name (editable, "insert_text");
-
-    g_free (result);
-}
-
-
-/* For handling keynav */
-static gboolean
-gtv_sr_ed_key_press_cb (GtkWidget *widget, GdkEventKey *event, gpointer user_data)
-{
-    GncTreeViewSplitReg *view = GNC_TREE_VIEW_SPLIT_REG (user_data);
-    GncTreeModelSplitReg *model;
-    GtkTreeViewColumn *col;
-    GtkTreePath *spath;
-    gboolean goto_blank = FALSE;
-    gboolean next_trans = TRUE;
-    Transaction *btrans, *ctrans;
-    gint depth;
-    gboolean auto_popped = FALSE;
-
-    // spath is where we are, before key press...
-    gtk_tree_view_get_cursor (GTK_TREE_VIEW (view), &spath, &col);
-
-    if (event->type != GDK_KEY_PRESS)
-    {
-        if (spath)
-            gtk_tree_path_free (spath);
-        return FALSE;
-    }
-
-    switch (event->keyval)
-    {
-
-    case GDK_KEY_Up:
-    case GDK_KEY_Down:
-
-        if (!spath)
-            return TRUE;
-
-        // This is to test for the auto completion popup window
-        {
-            GtkWidget *toplevel;
-            GtkWindowGroup *window_group;
-            GList *win_list;
-
-            toplevel = gtk_widget_get_toplevel (widget);
-            if (GTK_IS_WINDOW (toplevel))
-            {
-                window_group = gtk_window_get_group (GTK_WINDOW (toplevel));
-                win_list = gtk_window_group_list_windows (window_group);
-                if (g_list_length (win_list) == 1 && gtk_widget_get_visible (GTK_WIDGET (win_list->data)))
-                    auto_popped = TRUE;
-
-            g_list_free (win_list);
-            }
-        }
-
-        // Auto complete window popped
-        if (auto_popped == TRUE)
-        {
-            gtk_tree_path_free (spath);
-            return FALSE;
-        }
-
-        model = gnc_tree_view_split_reg_get_model_from_view (view);
-
-        // Make sure we have stopped editing.
-        gnc_tree_view_split_reg_finish_edit (view);
-
-        // This stops the cell changing.
-        if (view->priv->stop_cell_move == TRUE)
-        {
-            gtk_tree_path_free (spath);
-            return TRUE;
-        }
-
-        depth = gtk_tree_path_get_depth (spath);
-        if (event->keyval == GDK_KEY_Up)
-        {
-            if (depth == 1)
-            {
-                if (gtk_tree_path_prev (spath))
-                {
-                    if (gtk_tree_view_row_expanded (GTK_TREE_VIEW (view), spath))
-                    {
-                        gtk_tree_path_down (spath);
-
-                        if (gtk_tree_view_row_expanded (GTK_TREE_VIEW (view), spath) && model->type == GENERAL_JOURNAL2)
-                        {
-                            gtk_tree_path_down (spath);
-
-                            while (gnc_tree_view_path_is_valid (GNC_TREE_VIEW (view), spath))
-                            {
-                                gtk_tree_path_next (spath);
-                            }
-                            gtk_tree_path_prev (spath);
-                        }
-                    }
-                }
-            }
-            else if (!gtk_tree_path_prev (spath) && depth > 1)
-            {
-                gtk_tree_path_up (spath);
-            }
-        }
-        else if (gtk_tree_view_row_expanded (GTK_TREE_VIEW (view), spath))
-        {
-            gtk_tree_path_down (spath);
-        }
-        else
-        {
-            gtk_tree_path_next (spath);
-            if (!gnc_tree_view_path_is_valid (GNC_TREE_VIEW (view), spath) && depth > 2)
-            {
-                gtk_tree_path_prev (spath);
-                gtk_tree_path_up (spath);
-                gtk_tree_path_next (spath);
-            }
-            if (!gnc_tree_view_path_is_valid (GNC_TREE_VIEW (view), spath) && depth > 1)
-            {
-                gtk_tree_path_prev (spath);
-                gtk_tree_path_up (spath);
-                gtk_tree_path_next (spath);
-            }
-        }
-
-        /* Set cursor to new column, open for editing */
-        gtk_tree_view_set_cursor (GTK_TREE_VIEW (view), spath, col, TRUE);
-
-        if (event->keyval == GDK_KEY_Up)
-        {
-            gnc_tree_model_split_reg_move (model, VIEW_UP);
-        }
-        else
-            gnc_tree_model_split_reg_move (model, VIEW_DOWN);
-
-        return TRUE;
-        break;
-
-    case GDK_KEY_Return:
-
-        if (!spath)
-            return TRUE;
-
-        // This stops the cell changing.
-        if (view->priv->stop_cell_move == TRUE)
-        {
-            gtk_tree_path_free (spath);
-            return TRUE;
-        }
-
-        // Do sums if we have ctrl key
-        if (event->state & GDK_CONTROL_MASK)
-        {
-            // Make sure we have stopped editing.
-            gnc_tree_view_split_reg_finish_edit (view);
-
-            /* Set cursor to the column, open for editing */
-            gtk_tree_view_set_cursor (GTK_TREE_VIEW (view), spath, col, TRUE);
-            gtk_tree_path_free (spath);
-            return TRUE;
-        }
-        return FALSE;
-        break;
-
-    case GDK_KEY_KP_Enter:
-
-        if (!spath)
-            return TRUE;
-
-        // This stops the cell changing.
-        if (view->priv->stop_cell_move == TRUE)
-        {
-            gtk_tree_path_free (spath);
-            return TRUE;
-        }
-
-        goto_blank = gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL_REGISTER,
-                                         GNC_PREF_ENTER_MOVES_TO_END);
-
-        model = gnc_tree_view_split_reg_get_model_from_view (view);
-        btrans = gnc_tree_model_split_get_blank_trans (model);
-        ctrans = gnc_tree_view_split_reg_get_current_trans (view);
-
-        /* Are we on the blank transaction */
-        if (btrans == ctrans)
-            next_trans = FALSE;
-
-        /* First record the transaction */
-        if (gnc_tree_view_split_reg_enter (view))
-        {
-            /* Now move. */
-            if (goto_blank)
-                g_idle_add ((GSourceFunc)gnc_tree_control_split_reg_jump_to_blank, view);
-            else if (next_trans)
-                gnc_tree_control_split_reg_goto_rel_trans_row (view, 1);
-        }
-        return TRUE;
-        break;
-
-    default:
-        gtk_tree_path_free (spath);
-	return FALSE;
-    }
-}
-
-/*###########################################################################*/
-
-/* The main Start Editing Call back for the TEXT columns */
-static void
-gtv_sr_editable_start_editing_cb (GtkCellRenderer *cr, GtkCellEditable *editable,
-                              const gchar *path_string, gpointer user_data)
-{
-    GncTreeViewSplitReg  *view = GNC_TREE_VIEW_SPLIT_REG (user_data);
-    GncTreeModelSplitReg *model;
-    GtkTreePath          *spath;
-    GtkEntry             *entry = NULL;
-    ViewCol               viewcol;
-    RowDepth              depth;
-    gint                 *indices;
-
-    GtkListStore *description_list;
-    GtkListStore *memo_list;
-    GtkListStore *notes_list;
-    GtkListStore *account_list;
-
-    GtkEntryCompletion *completion = gtk_entry_completion_new();
-
-    ENTER("gtv_sr_editable_start_editing_cb Path string is '%s'", path_string);
-
-    model = gnc_tree_view_split_reg_get_model_from_view (view);
-
-    /* Description / Notes / Memo / Accounts Completion Lists */
-    description_list = gnc_tree_model_split_reg_get_description_list (model);
-    notes_list = gnc_tree_model_split_reg_get_notes_list (model);
-    memo_list = gnc_tree_model_split_reg_get_memo_list (model);
-    account_list = gnc_tree_model_split_reg_get_acct_list (model);
-
-    // Use depth to determine if it is a split or transaction
-    spath = gtk_tree_path_new_from_string (path_string);
-    depth = gtk_tree_path_get_depth (spath);
-    indices = gtk_tree_path_get_indices (spath);
-
-    viewcol = GPOINTER_TO_INT (g_object_get_data (G_OBJECT(cr), "view_column"));
-
-    DEBUG("editable Depth is %u and ViewCol is %d", depth, viewcol);
-
-    g_object_set_data (G_OBJECT (cr), "cell-editable", editable);
-
-    // This is for key navigation...
-    g_signal_connect (G_OBJECT (editable), "key-press-event", G_CALLBACK (gtv_sr_ed_key_press_cb), view);
-
-    /* DATE COLUMN */
-    if (viewcol == COL_DATE)
-    {
-        entry = GTK_ENTRY (GNC_POPUP_ENTRY (editable)->entry);
-
-        //Copy the string in the GtkEntry for later comparison
-        g_object_set_data_full (G_OBJECT (cr), "current-string", g_strdup (gtk_entry_get_text (entry)), g_free);
-
-        g_signal_connect (G_OBJECT (editable), "remove-widget", (GCallback) gtv_sr_remove_edit_date, view);
-
-        DEBUG("Current String date is '%s'", gtk_entry_get_text (entry));
-    }
-
-    /* TRANSFER / VOID COLUMN */
-    else if (viewcol == COL_TRANSFERVOID)
-    {
-        entry = GTK_ENTRY (gtk_bin_get_child (GTK_BIN (editable)));
-
-        // This is for key navigation...
-        g_signal_connect (G_OBJECT (entry), "key-press-event", G_CALLBACK (gtv_sr_ed_key_press_cb), view);
-
-        {
-            GtkEditable *editable = GTK_EDITABLE (entry);
-
-            if (view->priv->stop_cell_move == TRUE)
-            {
-                gint textPosition = 0;
-                gtk_editable_insert_text (GTK_EDITABLE (editable), view->priv->transfer_string, -1, &textPosition);
-                gtk_editable_set_position (GTK_EDITABLE (editable), -1);
-            }
-        }
-
-        // Update the Account list combo.
-        gnc_tree_model_split_reg_update_account_list (model);
-
-        gtk_entry_set_completion (entry, completion);
-        gtk_entry_completion_set_model (completion, GTK_TREE_MODEL (account_list));
-
-        /* This sets which text column to use, 0 for short names, 1 for long */
-        if (view->priv->acct_short_names)
-            gtk_entry_completion_set_text_column (completion, 0);
-        else
-            gtk_entry_completion_set_text_column (completion, 1);
-
-        gtk_entry_completion_set_popup_completion (completion, TRUE);
-        gtk_entry_completion_set_inline_selection (completion, TRUE);
-        gtk_entry_completion_set_popup_set_width (completion, FALSE);
-        gtk_entry_completion_set_minimum_key_length (completion, 1);
-//??        g_signal_connect(G_OBJECT(completion), "match-selected", (GCallback) gtv_sr_match_selected_cb, view);
-        g_object_unref (completion);
-
-        //Copy the string in the GtkEntry for later comparison
-        g_object_set_data_full (G_OBJECT (cr), "current-string", g_strdup (gtk_entry_get_text (entry)), g_free);
-
-        g_signal_connect (G_OBJECT (entry), "insert_text", (GCallback) gtv_sr_acct_cb, view);
-
-//??        g_signal_connect (G_OBJECT (cr), "changed", (GCallback) gtv_sr_changed_cb, view);
-        g_signal_connect (G_OBJECT (editable), "remove-widget", (GCallback) gtv_sr_remove_edit_combo, view);
-
-        DEBUG("Current String tv is '%s'", gtk_entry_get_text (entry));
-    }
-
-    /* NUMBER / ACTION COLUMN */
-    else if (viewcol == COL_NUMACT)
-    {
-        if ((depth == TRANS1) || ((depth == TRANS2) && (qof_book_use_split_action_for_num_field (gnc_get_current_book()))))
-        {
-            entry = GTK_ENTRY (editable);
-
-            //Copy the string in the GtkEntry for later comparison
-            g_object_set_data_full (G_OBJECT (cr), "current-string", g_strdup (gtk_entry_get_text (entry)), g_free);
-
-            g_signal_connect (G_OBJECT (GTK_ENTRY (entry)), "insert_text", (GCallback) gtv_sr_num_cb, view);
-
-            view->priv->fo_handler_id = g_signal_connect (G_OBJECT (editable), "focus-out-event", (GCallback) gtv_sr_focus_out_cb, view);
-
-            g_signal_connect (G_OBJECT (editable), "remove-widget", (GCallback) gtv_sr_remove_edit_entry, view);
-
-//??        g_signal_connect (G_OBJECT (cr), "changed", (GCallback)gtv_sr_changed_cb, view);
-            DEBUG("Current String num is '%s'", gtk_entry_get_text (entry));
-        }
-
-        if ((depth == SPLIT3) || ((depth == TRANS2) && (!qof_book_use_split_action_for_num_field (gnc_get_current_book()))))
-        {
-            gnc_tree_model_split_reg_update_action_list (model);
-
-            entry = GTK_ENTRY (gtk_bin_get_child (GTK_BIN (editable)));
-
-            //Copy the string in the GtkEntry for later comparison
-            g_object_set_data_full (G_OBJECT (cr), "current-string", g_strdup (gtk_entry_get_text (entry)), g_free);
-
-//??          g_signal_connect (G_OBJECT (cr), "changed", (GCallback) gtv_sr_changed_cb, view);
-            g_signal_connect (G_OBJECT (editable), "remove-widget", (GCallback) gtv_sr_remove_edit_combo, view);
-
-            DEBUG("Current String action is '%s'", gtk_entry_get_text (entry));
-        }
-    }
-
-    /* DESCRIPTION / NOTES / MEMO COLUMN */
-    else if (viewcol == COL_DESCNOTES)
-    {
-        entry = GTK_ENTRY (editable);
-
-        // Update the auto completion lists.
-        gnc_tree_model_split_reg_update_completion (model);
-
-        //Data used for completion is set based on if editing split or not
-        if (depth == TRANS1)
-        {
-            gtk_entry_set_completion (entry, completion);
-            gtk_entry_completion_set_model (completion, GTK_TREE_MODEL (description_list));
-            gtk_entry_completion_set_text_column (completion, 0);
-        }
-        else if (depth == TRANS2)
-        {
-            gtk_entry_set_completion (entry, completion);
-            gtk_entry_completion_set_model (completion, GTK_TREE_MODEL (notes_list));
-            gtk_entry_completion_set_text_column (completion, 0);
-        }
-        else if (depth == SPLIT3)
-        {
-            gtk_entry_set_completion (entry, completion);
-            gtk_entry_completion_set_model (completion, GTK_TREE_MODEL (memo_list));
-            gtk_entry_completion_set_text_column (completion, 0);
-        }
-
-        //To emit "match-selected" signal we need to have a list of matches to
-        //select from instead of using inline autocompletion
-        gtk_entry_completion_set_popup_completion (completion, TRUE);
-        gtk_entry_completion_set_inline_selection (completion, TRUE);
-        gtk_entry_completion_set_minimum_key_length (completion, view->priv->key_length);
-//??        g_signal_connect (G_OBJECT (completion), "match-selected", (GCallback) gtv_sr_match_selected_cb, view);
-
-        g_object_unref (completion);
-
-        //Copy the string in the GtkEntry for later comparison
-        g_object_set_data_full (G_OBJECT (cr), "current-string", g_strdup (gtk_entry_get_text (entry)), g_free);
-
-        view->priv->fo_handler_id = g_signal_connect (G_OBJECT (editable), "focus-out-event", (GCallback) gtv_sr_focus_out_cb, view);
-
-        g_signal_connect (G_OBJECT (editable), "remove-widget", (GCallback) gtv_sr_remove_edit_entry, view);
-
-        DEBUG("Current String dnm is '%s'", gtk_entry_get_text (entry));
-    }
-
-    /* RECN COLUMN */
-    else if (viewcol == COL_RECN)
-    {
-        entry = GTK_ENTRY (editable);
-
-        //Copy the string in the GtkEntry for later comparison
-        g_object_set_data_full (G_OBJECT (cr), "current-string", g_strdup (gtk_entry_get_text (entry)), g_free);
-
-        g_signal_connect (G_OBJECT (GTK_ENTRY (editable)), "insert_text", (GCallback)gtv_sr_recn_cb, view);
-
-        view->priv->fo_handler_id = g_signal_connect (G_OBJECT (editable), "focus-out-event", (GCallback) gtv_sr_focus_out_cb, view);
-
-        g_signal_connect (G_OBJECT (editable), "remove-widget", (GCallback) gtv_sr_remove_edit_entry, view);
-
-//??        g_signal_connect (G_OBJECT (cr), "changed", (GCallback) gtv_sr_changed_cb, view);
-        DEBUG("Current String recn is '%s'", gtk_entry_get_text (entry));
-    }
-
-    /* TYPE COLUMN */
-    else if (viewcol == COL_TYPE)
-    {
-        entry = GTK_ENTRY (editable);
-
-        //Copy the string in the GtkEntry for later comparison
-        g_object_set_data_full (G_OBJECT (cr), "current-string", g_strdup (gtk_entry_get_text (entry)), g_free);
-
-        g_signal_connect (G_OBJECT (GTK_ENTRY (editable)), "insert_text", (GCallback)gtv_sr_type_cb, view);
-
-        view->priv->fo_handler_id = g_signal_connect (G_OBJECT (editable), "focus-out-event", (GCallback) gtv_sr_focus_out_cb, view);
-
-        g_signal_connect (G_OBJECT (editable), "remove-widget", (GCallback) gtv_sr_remove_edit_entry, view);
-
-//??        g_signal_connect (G_OBJECT (cr), "changed", (GCallback) gtv_sr_changed_cb, view);
-        DEBUG("Current String type is '%s'", gtk_entry_get_text (entry));
-    }
-
-    /* THE REST OF THE COLUMNS */
-    else
-    {
-        entry = GTK_ENTRY (editable);
-
-        //Copy the string in the GtkEntry for later comparison
-        g_object_set_data_full (G_OBJECT (cr), "current-string", g_strdup (gtk_entry_get_text (entry)), g_free);
-
-        view->priv->fo_handler_id = g_signal_connect (G_OBJECT (editable), "focus-out-event", (GCallback) gtv_sr_focus_out_cb, view);
-
-        g_signal_connect (G_OBJECT (editable), "remove-widget", (GCallback) gtv_sr_remove_edit_entry, view);
-
-//??        g_signal_connect (G_OBJECT (cr), "changed", (GCallback)gtv_sr_changed_cb, view);
-        DEBUG("Current String rest is '%s'", gtk_entry_get_text (entry));
-    }
-
-    /* Lets change the background of the entry widgets */
-    {
-        GdkRGBA      color;
-        const gchar *row_color;
-        gboolean     is_trow1 = FALSE;
-        gboolean     is_trow2 = FALSE;
-        gboolean     is_split = FALSE;
-
-        if (depth == TRANS1)
-            is_trow1 = TRUE;
-        if (depth == TRANS2)
-            is_trow2 = TRUE;
-        if (depth == SPLIT3)
-            is_split = TRUE;
-
-        row_color = gnc_tree_model_split_reg_get_row_color (model, is_trow1, is_trow2, is_split, indices[0]);
-
-        if (gdk_rgba_parse (&color, row_color))
-        {
-            if (entry != NULL)
-            {
-                GtkStyleContext *stylectxt = gtk_widget_get_style_context (GTK_WIDGET (entry));
-                GtkCssProvider *provider = gtk_css_provider_new();
-                gchar *col_str = gdk_rgba_to_string (&color);
-                gchar *widget_css = g_strconcat ("*{\n  background-color:", col_str, ";\n}\n", NULL);
-
-                gtk_css_provider_load_from_data (provider, widget_css, -1, NULL);
-                gtk_style_context_add_provider (stylectxt, GTK_STYLE_PROVIDER (provider),
-                                                GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
-                g_object_unref (provider);
-                g_free (col_str);
-                g_free (widget_css);
-            }
-        }
-    }
-
-    gtv_sr_help (view, cr, viewcol, depth);
-    gtk_tree_path_free (spath);
-
-    view->priv->temp_cr = cr;
-    view->editing_now = TRUE;
-
-    DEBUG("Temp Cell Rend %p", view->priv->temp_cr);
-
-    //Add edit-canceled property to cr so we can distinguish between
-    //cancelled and actual changes
-    g_object_set_data (G_OBJECT (cr), "edit-canceled", GINT_TO_POINTER (FALSE));
-    LEAVE(" ");
-}
-
-#ifdef skip
-// Handle the "match-selected" signal
-static void
-gtv_sr_match_selected_cb (GtkEntryCompletion *widget, GtkTreeModel *model,
-                        GtkTreeIter *iter, gpointer user_data)
-{
-//    GncTreeViewSplitReg *view = GNC_TREE_VIEW_SPLIT_REG (user_data);
-
-//FIXME g_print("gtv_sr_match_selected_cb\n\n");
-
-/* Not sure what I am going to put in here yet if anything */
-}
-#endif
-
-#ifdef skip
-// Handle the "changed" signal
-static void
-gtv_sr_changed_cb (GtkCellRendererCombo *widget, gchar *path_string,
-                        GtkTreeIter *iter, gpointer user_data)
-{
-//    GncTreeViewSplitReg *view = GNC_TREE_VIEW_SPLIT_REG (user_data);
-
-//FIXME g_print("gtv_sr_changed_cb path string is '%s'\n\n", path_string);
-
-/* Not sure what I am going to put in here yet if anything */
-
-}
-#endif
-
-// Handle the "editing-canceled" signal
-static void
-gtv_sr_editing_canceled_cb (GtkCellRenderer *cr, gpointer user_data)
-{
-    GncTreeViewSplitReg *view = GNC_TREE_VIEW_SPLIT_REG (user_data);
-
-    if (GPOINTER_TO_INT (g_object_get_data (G_OBJECT (view), "data-edited")) == FALSE) // Not edited, reset edit path
-    {
-        view->priv->dirty_trans = NULL;
-    }
-
-    /* Reset stop_cell_move */
-    if (view->priv->stop_cell_move == TRUE)
-    {
-        view->priv->stop_cell_move = FALSE;
-
-        /* this will populate cell with original value */
-        g_idle_add ((GSourceFunc) gtv_sr_idle_transfer, view);
-    }
-
-    /* Reset Help text */
-    if (view->help_text)
-        g_free (view->help_text);
-    view->help_text = g_strdup (" ");
-    g_signal_emit_by_name (view, "help_signal", NULL);
-
-    //Set edit-canceled property
-    g_object_set_data (G_OBJECT (cr), "edit-canceled", GINT_TO_POINTER (TRUE));	
-}
-
-/*####################################################################
-          ^^^^   gtv function call backs    ^^^^
-#####################################################################*/
-
-/* Scroll the view to show selected row based on sort direction */
-gboolean
-gnc_tree_view_split_reg_scroll_to_cell (GncTreeViewSplitReg *view)
-{
-    GncTreeModelSplitReg *model;
-    GtkTreePath *mpath, *spath;
-
-    PINFO("#### Start Scroll to Cell ####");
-
-    model = gnc_tree_view_split_reg_get_model_from_view (view);
-
-    mpath = gnc_tree_view_split_reg_get_current_path (view);
-    spath = gnc_tree_view_split_reg_get_sort_path_from_model_path (view, mpath);
-
-    if (model->sort_direction == GTK_SORT_DESCENDING)
-    {
-        gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (view), spath, NULL, TRUE, 0.5, 0.0); //0.0
-    }
-    else
-    {
-        if (model->use_double_line)
-        {
-            gtk_tree_path_down (spath); // move to the second row of transaction
-            gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (view), spath, NULL, TRUE, 1.0, 0.0); //1.0
-        }
-        else
-        {
-            gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (view), spath, NULL, TRUE, 1.0, 0.0); //1.0
-        }
-    }
-
-    gtk_tree_path_free (mpath);
-    gtk_tree_path_free (spath);
-
-    PINFO("#### End Scroll to Cell ####");
-
-    return (FALSE);
-}
-
-
-/* Scroll the view to show the blank split with least movement */
-gboolean
-gnc_tree_view_split_reg_scroll_to_bsplit (GncTreeViewSplitReg *view)
-{
-    GncTreeModelSplitReg *model;
-    GtkTreePath *bsplit_mpath, *bsplit_spath;
-    Split *bsplit;
-
-    model = gnc_tree_view_split_reg_get_model_from_view (view);
-
-    /* Get the blank split spath */
-    bsplit = gnc_tree_model_split_get_blank_split (model);
-    bsplit_mpath = gnc_tree_model_split_reg_get_path_to_split_and_trans (model, bsplit, NULL);
-    bsplit_spath = gnc_tree_view_split_reg_get_sort_path_from_model_path (view, bsplit_mpath);
-
-    gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (view), bsplit_spath, NULL, FALSE, 1.0, 0.0);
-
-    gtk_tree_path_free (bsplit_mpath);
-    gtk_tree_path_free (bsplit_spath);
-    return (FALSE);
-}
-
-
-/* Returns the Transaction at the current selected position */
-Transaction *
-gnc_tree_view_split_reg_get_current_trans (GncTreeViewSplitReg *view)
-{
-    return view->priv->current_trans;
-}
-
-
-/* Returns the Split at the current selected position or NULL */
-Split *
-gnc_tree_view_split_reg_get_current_split (GncTreeViewSplitReg *view)
-{
-    return view->priv->current_split;
-}
-
-
-/* Returns the depth of the selected row */
-RowDepth
-gnc_tree_view_reg_get_selected_row_depth (GncTreeViewSplitReg *view)
-{
-    return view->priv->current_depth;
-}
-
-
-/* Returns the dirty_trans or NULL */
-Transaction *
-gnc_tree_view_split_reg_get_dirty_trans (GncTreeViewSplitReg *view)
-{
-    return view->priv->dirty_trans;
-}
-
-
-/* Sets dirty_trans to trans or NULL to clear */
-void
-gnc_tree_view_split_reg_set_dirty_trans (GncTreeViewSplitReg *view, Transaction *trans)
-{
-    if (trans == NULL)
-    {
-        g_object_set_data (G_OBJECT (view), "data-edited", GINT_TO_POINTER (FALSE));
-        view->priv->dirty_trans = NULL;
-    }
-    else
-    {
-        g_object_set_data (G_OBJECT (view), "data-edited", GINT_TO_POINTER (TRUE));
-        view->priv->dirty_trans = trans;
-    }
-}
-
-
-/* Returns the current path, or NULL if the current path is the blank split. */
-GtkTreePath *
-gnc_tree_view_split_reg_get_current_path (GncTreeViewSplitReg *view)
-{
-    if (!view->priv->current_ref)
-        return NULL;
-    return gtk_tree_row_reference_get_path (view->priv->current_ref);
-}
-
-
-/* Sets the current path reference to path */
-void
-gnc_tree_view_split_reg_set_current_path (GncTreeViewSplitReg *view, GtkTreePath *mpath)
-{
-    GncTreeModelSplitReg *model;
-
-    model = gnc_tree_view_split_reg_get_model_from_view (view);
-
-    if (view->priv->current_ref != NULL)
-    {
-        gtk_tree_row_reference_free (view->priv->current_ref);
-        view->priv->current_ref = NULL;
-    }
-    view->priv->current_ref = gtk_tree_row_reference_new (GTK_TREE_MODEL (model), mpath);
-}
-
-
-/* Reinit transaction / delete the splits */
-void
-gnc_tree_view_split_reg_reinit_trans (GncTreeViewSplitReg *view)
-{
-    Transaction           *trans;
-    RowDepth               depth;
-
-    /* Make sure we have stopped editing */
-    gnc_tree_view_split_reg_finish_edit (view);
-
-    trans = view->priv->current_trans;
-
-    // Lets get out of the way, move selection to trans - selection is blocked
-    gnc_tree_control_split_reg_goto_rel_trans_row (view, 0);
-
-    depth = view->priv->current_depth;
-
-    if (trans && (depth != SPLIT3))
-    {
-        Split *s;
-        int i = 0;
-
-        if (!xaccTransIsOpen (trans))
-            xaccTransBeginEdit (trans);
-
-        gnc_tree_view_split_reg_set_dirty_trans (view, trans);
-
-        while ((s = xaccTransGetSplit (trans, i)) != NULL)
-        {
-            if (xaccTransGetRateForCommodity (trans, view->priv->reg_comm, s, NULL))
-                xaccSplitDestroy (s);
-            else i++;
-        }
-    }
-}
-
-
-/* Delete the current split */
-void
-gnc_tree_view_split_reg_delete_current_split (GncTreeViewSplitReg *view)
-{
-    Transaction           *trans;
-    Split                 *split;
-
-    /* Make sure we have stopped editing */
-    gnc_tree_view_split_reg_finish_edit (view);
-
-    trans = view->priv->current_trans;
-    split = view->priv->current_split;
-
-    if (!xaccTransIsOpen (trans))
-        xaccTransBeginEdit (trans);
-
-    gnc_tree_view_split_reg_set_dirty_trans (view, trans);
-
-    // Lets get out of the way, move selection to trans - selection is blocked
-    gnc_tree_control_split_reg_goto_rel_trans_row (view, 0);
-
-    xaccSplitDestroy (split);
-}
-
-
-/* Delete the current transaction */
-void
-gnc_tree_view_split_reg_delete_current_trans (GncTreeViewSplitReg *view)
-{
-    Transaction           *trans;
-
-    /* We do not use the normal confirmation with this one as we have
-       all ready asked the user to confirm delete */
-
-    /* Make sure we have stopped editing */
-    gnc_tree_view_split_reg_finish_edit (view);
-
-    trans = view->priv->current_trans;
-
-    /* We need to go back one to select the next transaction */
-    gnc_tree_control_split_reg_goto_rel_trans_row (view, 1);
-
-    if (!xaccTransIsOpen (trans))
-        xaccTransBeginEdit (trans);
-    gnc_tree_view_split_reg_set_dirty_trans (view, trans);
-
-    xaccTransDestroy (trans);
-    xaccTransCommitEdit (trans);
-
-    gnc_tree_view_split_reg_set_dirty_trans (view, NULL);
-}
-
-
-/* Record changes */
-gboolean
-gnc_tree_view_split_reg_enter (GncTreeViewSplitReg *view)
-{
-    /* Make sure we have stopped editing */
-    gnc_tree_view_split_reg_finish_edit (view);
-
-    // Test for transaction changed
-    if (gtv_sr_transaction_changed (view))
-        return FALSE;
-
-    // Return FALSE on discard
-    if (view->priv->trans_confirm == DISCARD)
-        return FALSE;
-
-    return TRUE;
-}
-
-
-/* Cancel the edit and rollback changes */
-void
-gnc_tree_view_split_reg_cancel_edit (GncTreeViewSplitReg *view, gboolean reg_closing)
-{
-    GncTreeModelSplitReg *model;
-    Transaction          *trans = view->priv->dirty_trans;
-    Split                *split;
-
-    ENTER("gnc_tree_view_split_reg_cancel_edit view is %p and reg_closing is %d", view, reg_closing);
-
-    model = gnc_tree_view_split_reg_get_model_from_view (view);
-
-    if (trans && xaccTransIsOpen (trans))
-    {
-        // Move selection to trans - selection is blocked
-        gnc_tree_control_split_reg_goto_rel_trans_row (view, 0);
-
-        // Remove the split before rollback.
-        gnc_tree_model_split_reg_set_blank_split_parent (model, trans, TRUE);
-
-        g_object_set_data (G_OBJECT (view), "data-edited", GINT_TO_POINTER (FALSE));
-        xaccTransRollbackEdit (view->priv->dirty_trans);
-
-        // Add the split after rollback so it is last in list.
-        gnc_tree_model_split_reg_set_blank_split_parent (model, trans, FALSE);
-
-        // Set the transaction to show correct view
-        gnc_tree_view_split_reg_format_trans (view, view->priv->dirty_trans);
-
-        gnc_tree_view_split_reg_set_dirty_trans (view, NULL);
-
-        split = gnc_tree_model_split_get_blank_split (model);
-        xaccSplitReinit (split); // Clear the blank split
-    }
-    /* Reset allow changes for reconciled transctions */
-    view->change_allowed = FALSE;
-
-    view->priv->auto_complete = FALSE; // reset auto_complete has run flag
-
-    /* This updates the plugin page gui */
-    gnc_tree_view_split_reg_call_uiupdate_cb(view);
-
-    LEAVE(" ");
-}
-
-
-/* Make sure we have stopped editing */
-void
-gnc_tree_view_split_reg_finish_edit (GncTreeViewSplitReg *view)
-{
-    gtv_sr_finish_edit (view);
-
-    /* give gtk+ a chance to handle pending events */
-    while (gtk_events_pending ())
-       gtk_main_iteration ();
-}
-
-
-/* Returns whether the splits are revealed for the transaction or current position
-   if transaction is NULL */
-gboolean
-gnc_tree_view_split_reg_trans_expanded (GncTreeViewSplitReg *view, Transaction *trans)
-{
-    GncTreeModelSplitReg *model;
-    GtkTreePath *mpath, *spath;
-    gboolean expanded;
-
-    /* if trans is NULL use priv->expanded */
-    if (trans == NULL)
-        expanded = view->priv->expanded;
-    else
-    {
-        model = gnc_tree_view_split_reg_get_model_from_view (view);
-
-        mpath = gnc_tree_model_split_reg_get_path_to_split_and_trans (model, NULL, trans);
-
-        spath = gnc_tree_view_split_reg_get_sort_path_from_model_path (view, mpath);
-
-        gtk_tree_path_down (spath); /* Move the path down to trow2 */
-
-        expanded = gtk_tree_view_row_expanded (GTK_TREE_VIEW (view), spath);
-
-        gtk_tree_path_free (mpath);
-        gtk_tree_path_free (spath);
-    }
-    return expanded;
-}
-
-
-/* Collapse the transaction, if trans is NULL, use current_ref */
-void
-gnc_tree_view_split_reg_collapse_trans (GncTreeViewSplitReg *view, Transaction *trans)
-{
-    GncTreeModelSplitReg *model;
-    GtkTreePath *temp_spath, *mpath, *spath;
-    GtkTreeIter m_iter;
-    gint *indices;
-    RowDepth depth;
-
-    ENTER("gnc_tree_view_split_reg_collapse_trans and trans is %p", trans);
-
-    model = gnc_tree_view_split_reg_get_model_from_view (view);
-
-    /* Make sure we have stopped editing */
-    gnc_tree_view_split_reg_finish_edit (view);
-
-    /* if trans is NULL use current_ref */
-    if (trans == NULL)
-        mpath = gtk_tree_row_reference_get_path (view->priv->current_ref);
-    else
-        mpath = gnc_tree_model_split_reg_get_path_to_split_and_trans (model, NULL, trans);
-
-    spath = gnc_tree_view_split_reg_get_sort_path_from_model_path (view, mpath);
-
-    /* Collapse the view back to the transaction */
-    indices = gtk_tree_path_get_indices (spath);
-    depth = gtk_tree_path_get_depth (spath);
-
-    if (model->use_double_line)
-        temp_spath = gtk_tree_path_new_from_indices (indices[0], 0, -1);
-    else
-        temp_spath = gtk_tree_path_new_from_indices (indices[0], -1);
-
-    /* if trans is NULL, collapse and update current_ref */
-    if (trans == NULL)
-    {
-        GtkTreePath *temp_mpath;
-
-        gnc_tree_view_split_reg_block_selection (view, TRUE);
-
-        /* Change the selection to last available row of transaction - double */
-        if ((model->use_double_line) && (depth == SPLIT3))
-            gtk_tree_selection_select_path (gtk_tree_view_get_selection (GTK_TREE_VIEW (view)), temp_spath);
-
-        /* Change the selection to last available row of transaction - single */
-        if ((!model->use_double_line) && (depth != TRANS1))
-            gtk_tree_selection_select_path (gtk_tree_view_get_selection (GTK_TREE_VIEW (view)), temp_spath);
-
-        gtk_tree_view_collapse_row (GTK_TREE_VIEW (view), temp_spath);
-
-        /* Get the selection */
-        if (gtv_sr_get_model_iter_from_selection (view, gtk_tree_view_get_selection (GTK_TREE_VIEW (view)), &m_iter))
-        {
-            temp_mpath = gtk_tree_model_get_path (GTK_TREE_MODEL (model), &m_iter);
-
-            /* Update the tree view titles */
-            gtv_sr_titles (view, gtk_tree_path_get_depth (temp_mpath));
-
-            /* Save the new model path to path ref */
-            gnc_tree_view_split_reg_set_current_path (view, temp_mpath);
-
-            gtk_tree_path_free (temp_mpath);
-        }
-        gnc_tree_view_split_reg_block_selection (view, FALSE);
-    }
-    else
-        gtk_tree_view_collapse_row (GTK_TREE_VIEW (view), temp_spath);
-
-    gtk_tree_path_free (temp_spath);
-    gtk_tree_path_free (mpath);
-    gtk_tree_path_free (spath);
-
-    view->priv->expanded = FALSE;
-
-    /* This updates the plugin page gui */
-    gnc_tree_view_split_reg_call_uiupdate_cb(view);
-
-    LEAVE(" ");
-}
-
-
-/* Expands the transaction or the current transaction if NULL */
-void
-gnc_tree_view_split_reg_expand_trans (GncTreeViewSplitReg *view, Transaction *trans)
-{
-    GncTreeModelSplitReg *model;
-    GtkTreePath *mpath, *spath;
-    GtkTreePath *start_path, *end_path;
-    gint *indices_spath;
-    gint num_splits;
-
-    ENTER("gnc_tree_view_split_reg_expand_trans and trans is %p", trans);
-
-    model = gnc_tree_view_split_reg_get_model_from_view (view);
-
-    /* Make sure we have stopped editing */
-    gnc_tree_view_split_reg_finish_edit (view);
-
-    if (trans == NULL)
-        mpath = gtk_tree_row_reference_get_path (view->priv->current_ref);
-    else
-        mpath = gnc_tree_model_split_reg_get_path_to_split_and_trans (model, NULL, trans);
-
-    spath = gnc_tree_view_split_reg_get_sort_path_from_model_path (view, mpath);
-
-    gtk_tree_view_expand_row (GTK_TREE_VIEW (view), spath, TRUE);
-
-    view->priv->expanded = TRUE;
-
-    if (view->priv->selection_to_blank_on_expand && (model->style != REG2_STYLE_JOURNAL))
-        gtv_sr_selection_to_blank (view);
-
-    /* Get spath indices and the number of splits */
-    indices_spath = gtk_tree_path_get_indices (spath);
-    num_splits = xaccTransCountSplits (view->priv->current_trans);
-
-    if (gtk_tree_view_get_visible_range (GTK_TREE_VIEW (view), &start_path, &end_path))
-    {
-//        gint *indices_start;
-        gint *indices_end;
-        gint lines = 0;
-
-        /* The first and last visible path */
-//        indices_start = gtk_tree_path_get_indices (start_path);
-        indices_end = gtk_tree_path_get_indices (end_path);
-
-        if (model->use_double_line)
-            lines = (indices_end[0] - indices_spath[0])*2;
-        else
-            lines = indices_end[0] - indices_spath[0];
-
-        if ((num_splits + 1) > lines)
-        {
-            /* scroll window to show selection when view is idle */
-            g_idle_add ((GSourceFunc) gnc_tree_view_split_reg_scroll_to_bsplit, view );
-        }
-        gtk_tree_path_free (start_path);
-        gtk_tree_path_free (end_path);
-    }
-    gtk_tree_path_free (mpath);
-    gtk_tree_path_free (spath);
-
-    /* This updates the plugin page gui */
-    gnc_tree_view_split_reg_call_uiupdate_cb(view);
-
-    LEAVE(" ");
-}
-
-
-/* Return the credit and debit titles of those columns */
-const char *
-gnc_tree_view_split_reg_get_credit_debit_string (GncTreeViewSplitReg *view, gboolean credit)
-{
-    GtkCellRenderer *cr0;
-    GList *renderers;
-    GList *columns;
-    GList  *column;
-    gint i;
-    const char *title = NULL;
-
-    columns = gtk_tree_view_get_columns (GTK_TREE_VIEW (view));
-
-    for ( column = columns, i = 1; column; column = g_list_next (column), i++)
-    {
-        GtkTreeViewColumn *tvc;
-        ViewCol viewcol;
-
-        tvc = column->data;
-
-        // Get the first renderer, it has the view-column value.
-        renderers = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (tvc));
-        cr0 = g_list_nth_data (renderers, 0);
-        g_list_free (renderers);
-
-        viewcol = GPOINTER_TO_INT (g_object_get_data (G_OBJECT(cr0), "view_column"));
-
-        DEBUG("viewcol is %d", viewcol);
-
-        if (viewcol == COL_CREDIT && credit)
-            title = gtk_tree_view_column_get_title (tvc);
-
-        if (viewcol == COL_DEBIT && !credit)
-            title = gtk_tree_view_column_get_title (tvc);
-    }
-    g_list_free (columns);
-    return title;
-}
-
-
-/* Returns the parent Window */
-GtkWidget *
-gnc_tree_view_split_reg_get_parent (GncTreeViewSplitReg *view)
-{
-    GncTreeModelSplitReg *model;
-    model = gnc_tree_view_split_reg_get_model_from_view (view);
-    return gnc_tree_model_split_reg_get_parent (model);
-}
-
-
-/* This sets up the page gui update from the tree view motion callback */
-void
-gnc_tree_view_split_reg_set_uiupdate_cb (GncTreeViewSplitReg *view, GFunc cb, gpointer cb_data)
-{
-    view->uiupdate_cb = cb;
-    view->uiupdate_cb_data = cb_data;
-}
-
-/** Call the moved_cb callback that is used to update the page ui, if it is
-set. If it is not set, this function does nothing.
-
-\return FALSE so that this function can be used in g_idle_add() */
-gboolean gnc_tree_view_split_reg_call_uiupdate_cb(GncTreeViewSplitReg *view)
-{
-    g_assert(view);
-    if (view->uiupdate_cb)
-        (view->uiupdate_cb)(view, view->uiupdate_cb_data);
-    return FALSE;
-}
-
diff --git a/src/gnome-utils/test/CMakeLists.txt b/src/gnome-utils/test/CMakeLists.txt
deleted file mode 100644
index 4244d10..0000000
--- a/src/gnome-utils/test/CMakeLists.txt
+++ /dev/null
@@ -1,35 +0,0 @@
-
-SET(GNOME_UTILS_TEST_INCLUDE_DIRS
-  ${CMAKE_SOURCE_DIR}/src/gnc-module
-  ${GLIB2_INCLUDE_DIRS}
-  ${GUILE_INCLUDE_DIRS}
-)
-SET(GNOME_UTILS_TEST_LIBS gnc-module test-core)
-
-GNC_ADD_TEST_WITH_GUILE(test-link-module-gnome-utils test-link-module.c
-  GNOME_UTILS_TEST_INCLUDE_DIRS GNOME_UTILS_TEST_LIBS
-)
-
-
-SET(GNOME_UTILS_GUI_TEST_INCLUDE_DIRS
-  ${GNOME_UTILS_TEST_INCLUDE_DIRS}
-  ${CMAKE_BINARY_DIR}/src
-  ${CMAKE_SOURCE_DIR}/src/gnome-utils
-  ${CMAKE_SOURCE_DIR}/src/engine
-  ${GTK3_INCLUDE_DIRS}
-)
-SET(GNOME_UTILS_GUI_TEST_LIBS
-  ${GNOME_UTILS_TEST_LIBS}
-  gncmod-gnome-utils
-)
-#This is a GUI test
-#GNC_ADD_TEST(test-gnc-recurrence test-gnc-recurrence.c
-#  GNOME_UTILS_GUI_TEST_INCLUDE_DIRS
-#  GNOME_UTILS_GUI_TEST_LIBS
-#
-
-GNC_ADD_SCHEME_TEST(test-load-module-gnome-utils test-load-module.in)
-
-CONFIGURE_FILE(test-load-module.in test-load-module @ONLY)
-
-SET_DIST_LIST(test_gnome_utils_DIST CMakeLists.txt Makefile.am test-gnc-recurrence.c test-link-module.c test-load-module.in)
diff --git a/src/gnome-utils/test/Makefile.am b/src/gnome-utils/test/Makefile.am
deleted file mode 100644
index d7a34c3..0000000
--- a/src/gnome-utils/test/Makefile.am
+++ /dev/null
@@ -1,75 +0,0 @@
-TESTS =  \
-  test-link-module test-load-module
-
-# The following tests are nice, but have absolutely no place in an
-# automated testing system.
-#
-TESTS_GUI = test-gnc-recurrence
-
-##lib_LTLIBRARIES = libgncgnome.la
-
-GNC_TEST_DEPS = --gnc-module-dir ${top_builddir}/src/engine \
-  --gnc-module-dir ${top_builddir}/src/app-utils \
-  --gnc-module-dir ${top_builddir}/src/gnome-utils \
-  --guile-load-dir ${top_builddir}/src/gnc-module \
-  --guile-load-dir ${top_builddir}/src/scm \
-  --guile-load-dir ${top_builddir}/src/engine \
-  --guile-load-dir ${top_builddir}/src/core-utils \
-  --guile-load-dir ${top_builddir}/src/app-utils \
-  --guile-load-dir ${top_builddir}/src/gnome-utils \
-  --library-dir    ${top_builddir}/src/gnome-utils \
-  --library-dir    ${top_builddir}/src/core-utils \
-  --library-dir    ${top_builddir}/src/gnc-module \
-  --library-dir    ${top_builddir}/src/engine \
-  --library-dir    ${top_builddir}/src/backend/xml \
-  --library-dir    ${top_builddir}/src/backend/sql \
-  --library-dir    ${top_builddir}/src/app-utils
-
-
-TESTS_ENVIRONMENT = \
-  GUILE_WARN_DEPRECATED=no \
-  GUILE="${GUILE}" \
-  SRCDIR=${srcdir} \
-  GNC_BUILDDIR="${abs_top_builddir}" \
-  $(shell ${abs_top_srcdir}/src/gnc-test-env.pl --noexports ${GNC_TEST_DEPS})
-
-check_PROGRAMS = \
-  test-link-module test-gnc-recurrence
-
-AM_CPPFLAGS = \
-  -I${top_srcdir}/src \
-  -I${top_srcdir}/src/engine \
-  -I${top_srcdir}/src/engine/test-core \
-  -I${top_srcdir}/src/gnome-utils \
-  -I${top_srcdir}/src/gnc-module \
-  -I${top_srcdir}/src/app-utils \
-  -I${top_srcdir}/src/test-core \
-  ${GLIB_CFLAGS} \
-  ${GTK_CFLAGS} \
-  ${GUILE_CFLAGS}
-
-LDADD = \
-  ${GNOME_LIBS} \
-  ${top_builddir}/src/app-utils/libgncmod-app-utils.la \
-  ${top_builddir}/src/gnome-utils/libgncmod-gnome-utils.la \
-  ${top_builddir}/src/engine/libgncmod-engine.la \
-  ${top_builddir}/src/engine/test-core/libgncmod-test-engine.la \
-  ${top_builddir}/src/test-core/libtest-core.la
-
-test_gnc_recurrence_SOURCES=test-gnc-recurrence.c
-test_gnc_recurrence_LDADD = \
-  ${GTK_LIBS} \
-  ${LDADD}
-
-test_link_module_SOURCES=test-link-module.c
-test_link_module_LDADD = \
-  ${GUILE_LIBS} \
-  ${GLIB_LIBS} \
-  ${top_builddir}/src/gnc-module/libgnc-module.la
-
-EXTRA_DIST = \
-  test-load-module \
-  CMakeLists.txt
-
-testit:
-	libtool --mode execute gdb test-link-module
diff --git a/src/gnome/CMakeLists.txt b/src/gnome/CMakeLists.txt
deleted file mode 100644
index b8fc331..0000000
--- a/src/gnome/CMakeLists.txt
+++ /dev/null
@@ -1,203 +0,0 @@
-
-ADD_SUBDIRECTORY(gschemas)
-ADD_SUBDIRECTORY(gtkbuilder)
-ADD_SUBDIRECTORY(ui)
-
-SET (gnc_gnome_noinst_HEADERS
-  assistant-acct-period.h
-  assistant-hierarchy.h
-  assistant-loan.h
-  assistant-stock-split.h
-  business-options-gnome.h
-  business-urls.h
-  business-gnome-utils.h
-  dialog-billterms.h
-  dialog-choose-owner.h
-  dialog-customer.h
-  dialog-date-close.h
-  dialog-employee.h
-  dialog-fincalc.h
-  dialog-find-account.h
-  dialog-find-transactions.h
-  dialog-find-transactions2.h
-  dialog-imap-editor.h
-  dialog-invoice.h
-  dialog-job.h
-  dialog-lot-viewer.h
-  dialog-new-user.h
-  dialog-order.h
-  dialog-payment.h
-  dialog-print-check.h
-  dialog-progress.h
-  dialog-sx-editor.h
-  dialog-sx-editor2.h
-  dialog-sx-from-trans.h
-  dialog-sx-since-last-run.h
-  dialog-trans-assoc.h
-  dialog-vendor.h
-  gnc-budget-view.h
-  gnc-plugin-account-tree.h
-  gnc-plugin-basic-commands.h
-  gnc-plugin-budget.h
-  gnc-plugin-business.h
-  gnc-plugin-register.h
-  gnc-plugin-register2.h
-  gnc-plugin-page-account-tree.h
-  gnc-plugin-page-budget.h
-  gnc-plugin-page-invoice.h
-  gnc-plugin-page-owner-tree.h
-  gnc-plugin-page-sx-list.h
-  gnc-plugin-page-register.h
-  gnc-plugin-page-register2.h
-  gnc-split-reg.h
-  gnc-split-reg2.h
-  reconcile-view.h
-  search-owner.h
-  top-level.h
-  window-reconcile.h
-  window-reconcile2.h
-  window-autoclear.h
-)
-
-IF (BUILDING_FROM_VCS)
-  SET (SWIG_GNOME_C ${CMAKE_CURRENT_BINARY_DIR}/swig-gnome.c)
-  GNC_ADD_SWIG_COMMAND (swig-gnome-c ${SWIG_GNOME_C} ${CMAKE_CURRENT_SOURCE_DIR}/gnome.i ${gnc_gnome_HEADERS})
-ELSE()
-  SET (SWIG_GNOME_C swig-gnome.c)
-ENDIF()
-
-SET (gnc_gnome_SOURCES 
-
-  assistant-acct-period.c
-  assistant-hierarchy.c
-  assistant-loan.c
-  assistant-stock-split.c
-  business-options-gnome.c
-  business-urls.c
-  business-gnome-utils.c
-  dialog-billterms.c
-  dialog-choose-owner.c
-  dialog-commodities.c
-  dialog-customer.c
-  dialog-date-close.c
-  dialog-employee.c
-  dialog-fincalc.c
-  dialog-find-account.c
-  dialog-find-transactions.c
-  dialog-find-transactions2.c
-  dialog-imap-editor.c
-  dialog-invoice.c
-  dialog-job.c
-  dialog-lot-viewer.c
-  dialog-new-user.c
-  dialog-order.c
-  dialog-payment.c
-  dialog-price-editor.c
-  dialog-price-edit-db.c
-  dialog-print-check.c
-  dialog-progress.c
-  dialog-sx-editor.c
-  dialog-sx-editor2.c
-  dialog-sx-from-trans.c
-  dialog-sx-since-last-run.c
-  dialog-tax-info.c
-  dialog-trans-assoc.c
-  dialog-vendor.c
-  gnc-budget-view.c
-  gnc-plugin-account-tree.c
-  gnc-plugin-basic-commands.c
-  gnc-plugin-budget.c
-  gnc-plugin-business.c
-  gnc-plugin-register.c
-  gnc-plugin-register2.c
-  gnc-plugin-page-account-tree.c
-  gnc-plugin-page-budget.c
-  gnc-plugin-page-invoice.c
-  gnc-plugin-page-owner-tree.c
-  gnc-plugin-page-sx-list.c
-  gnc-plugin-page-register.c
-  gnc-plugin-page-register2.c
-  gnc-split-reg.c
-  gnc-split-reg2.c
-  reconcile-view.c
-  search-owner.c
-  top-level.c
-  window-reconcile.c
-  window-reconcile2.c
-  window-autoclear.c
-)  
-
-SET_SOURCE_FILES_PROPERTIES (${gnc_gnome_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
-SET_SOURCE_FILES_PROPERTIES (business-options-gnome.c PROPERTIES OBJECT_DEPENDS ${SWIG_RUNTIME_H})
-
-IF (WIN32)
-  SET (gnc_gnome_SOURCES ${gnc_gnome_SOURCES} ${CMAKE_SOURCE_DIR}/lib/libc/strfmon.c)
-ENDIF(WIN32)
-
-ADD_LIBRARY (gnc-gnome ${gnc_gnome_SOURCES} ${gnc_gnome_noinst_HEADERS} ${SWIG_GNOME_C})
-TARGET_LINK_LIBRARIES(gnc-gnome gncmod-gnome-search gncmod-ledger-core gncmod-report-gnome gncmod-report-system
-    gncmod-register-gnome gncmod-register-core gncmod-gnome-utils gncmod-engine ${GTK3_LDFLAGS} ${GTK_MAC_LDFLAGS})
-
-TARGET_COMPILE_DEFINITIONS (gnc-gnome PRIVATE -DG_LOG_DOMAIN=\"gnc.gui\" ${GTK_MAC_CFLAGS_OTHER})
-
-TARGET_INCLUDE_DIRECTORIES(gnc-gnome
-  PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
-  PRIVATE ${CMAKE_SOURCE_DIR}/src/app-utils/calculation ${GTK_MAC_INCLUDE_DIRS}
-)
-
-
-IF (MAC_INTEGRATION)
-  TARGET_COMPILE_OPTIONS(gnc-gnome PRIVATE ${OSX_EXTRA_COMPILE_FLAGS})
-  TARGET_LINK_LIBRARIES(gnc-gnome ${OSX_EXTRA_LIBRARIES})
-ENDIF(MAC_INTEGRATION)
-
-
-INSTALL(TARGETS gnc-gnome
-  LIBRARY DESTINATION lib
-  ARCHIVE DESTINATION lib
-  RUNTIME DESTINATION bin)
-
-# No headers to install
-
-# FIXME: where does LC_ALL=C come from?
-
-SET(CMAKE_COMMAND_TMP "")
-IF (${CMAKE_VERSION} VERSION_GREATER 3.1)
-  SET(CMAKE_COMMAND_TMP ${CMAKE_COMMAND} -E env)
-ENDIF()
-
-ADD_CUSTOM_COMMAND(
-    OUTPUT gnucash.appdata.xml
-    COMMAND ${CMAKE_COMMAND_TMP}
-      LC_ALL=C
-      ${PERL_EXECUTABLE} ${INTLTOOL_MERGE} -x -u -c ${CMAKE_SOURCE_DIR}/po/.intltool-merge-cache ${CMAKE_SOURCE_DIR}/po
-        ${CMAKE_CURRENT_SOURCE_DIR}/gnucash.appdata.xml.in gnucash.appdata.xml
-    MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/gnucash.appdata.xml.in
-)
-
-ADD_CUSTOM_TARGET(gnucash-appdata ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/gnucash.appdata.xml)
-
-INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/gnucash.appdata.xml DESTINATION share/appdata)
-
-#=======
-
-CONFIGURE_FILE(gnucash.desktop.in.in gnucash.desktop.in)
-
-
-ADD_CUSTOM_COMMAND(
-    OUTPUT gnucash.desktop
-    COMMAND ${CMAKE_COMMAND_TMP}
-      LC_ALL=C
-      ${PERL_EXECUTABLE} ${INTLTOOL_MERGE} -d -u -c ${CMAKE_SOURCE_DIR}/po/.intltool-merge-cache ${CMAKE_SOURCE_DIR}/po
-        gnucash.desktop.in gnucash.desktop
-    MAIN_DEPENDENCY gnucash.desktop.in
-)
-
-ADD_CUSTOM_TARGET(gnucash-desktop ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/gnucash.desktop)
-
-INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/gnucash.desktop DESTINATION share/applications)
-
-SET_LOCAL_DIST(gnome_DIST_local
-        CMakeLists.txt Makefile.am gnome.i gnucash.appdata.xml.in gnucash.desktop.in.in
-        ${gnc_gnome_noinst_HEADERS} ${gnc_gnome_SOURCES})
-SET(gnome_DIST ${gnome_DIST_local} ${gnome_ui_DIST} ${gnome_gschema_DIST} ${gnome_gtkbuilder_DIST} PARENT_SCOPE)
diff --git a/src/gnome/Makefile.am b/src/gnome/Makefile.am
deleted file mode 100644
index 1aa5de1..0000000
--- a/src/gnome/Makefile.am
+++ /dev/null
@@ -1,201 +0,0 @@
-SUBDIRS = gtkbuilder gschemas ui
-
-lib_LTLIBRARIES = libgnc-gnome.la
-
-libgnc_gnome_la_LIBADD = \
-  ${top_builddir}/src/register/ledger-core/libgncmod-ledger-core.la \
-  ${top_builddir}/src/register/register-gnome/libgncmod-register-gnome.la \
-  ${top_builddir}/src/register/register-core/libgncmod-register-core.la \
-  ${top_builddir}/src/report/report-gnome/libgncmod-report-gnome.la \
-  ${top_builddir}/src/report/report-system/libgncmod-report-system.la \
-  ${top_builddir}/src/gnome-search/libgncmod-gnome-search.la \
-  ${top_builddir}/src/gnome-utils/libgncmod-gnome-utils.la \
-  ${top_builddir}/src/backend/xml/libgnc-backend-xml-utils.la \
-  ${top_builddir}/src/app-utils/libgncmod-app-utils.la \
-  ${top_builddir}/src/html/libgncmod-html.la \
-  ${top_builddir}/src/engine/libgncmod-engine.la \
-  ${top_builddir}/src/core-utils/libgnc-core-utils.la \
-  ${LIBXML2_LIBS} \
-  ${GUILE_LIBS} \
-  ${GTK_LIBS} \
-  ${GLIB_LIBS}
-
-libgnc_gnome_la_SOURCES = \
-  swig-gnome.c \
-  assistant-acct-period.c \
-  assistant-hierarchy.c \
-  assistant-loan.c \
-  assistant-stock-split.c \
-  business-options-gnome.c \
-  business-urls.c \
-  business-gnome-utils.c \
-  dialog-billterms.c \
-  dialog-choose-owner.c \
-  dialog-commodities.c \
-  dialog-customer.c \
-  dialog-date-close.c \
-  dialog-employee.c \
-  dialog-fincalc.c \
-  dialog-find-account.c \
-  dialog-find-transactions.c \
-  dialog-find-transactions2.c \
-  dialog-imap-editor.c \
-  dialog-invoice.c \
-  dialog-job.c \
-  dialog-lot-viewer.c \
-  dialog-new-user.c \
-  dialog-order.c \
-  dialog-payment.c \
-  dialog-price-editor.c \
-  dialog-price-edit-db.c \
-  dialog-print-check.c \
-  dialog-progress.c \
-  dialog-sx-editor.c \
-  dialog-sx-editor2.c \
-  dialog-sx-from-trans.c \
-  dialog-sx-since-last-run.c \
-  dialog-tax-info.c \
-  dialog-trans-assoc.c \
-  dialog-vendor.c \
-  gnc-budget-view.c \
-  gnc-plugin-account-tree.c \
-  gnc-plugin-basic-commands.c \
-  gnc-plugin-budget.c \
-  gnc-plugin-business.c \
-  gnc-plugin-page-account-tree.c \
-  gnc-plugin-page-budget.c \
-  gnc-plugin-page-invoice.c \
-  gnc-plugin-page-owner-tree.c \
-  gnc-plugin-page-sx-list.c \
-  gnc-plugin-page-register.c \
-  gnc-plugin-page-register2.c \
-  gnc-plugin-register.c \
-  gnc-plugin-register2.c \
-  gnc-split-reg.c \
-  gnc-split-reg2.c \
-  reconcile-view.c \
-  search-owner.c \
-  top-level.c \
-  window-reconcile.c \
-  window-reconcile2.c \
-  window-autoclear.c
-
-gnomeappdir = ${datadir}/applications
-
-gnomeapp_in_files = gnucash.desktop.in
-gnomeapp_DATA = $(gnomeapp_in_files:.desktop.in=.desktop)
- at INTLTOOL_DESKTOP_RULE@
-
-appicondir = $(datadir)/pixmaps
-
-appdatadir = $(datadir)/appdata
-appdata_in_files = gnucash.appdata.xml.in
-appdata_DATA = $(appdata_in_files:.xml.in=.xml)
- at INTLTOOL_XML_RULE@
-
-noinst_HEADERS = \
-  assistant-acct-period.h \
-  assistant-hierarchy.h \
-  assistant-loan.h \
-  assistant-stock-split.h \
-  business-options-gnome.h \
-  business-urls.h \
-  business-gnome-utils.h \
-  dialog-billterms.h \
-  dialog-choose-owner.h \
-  dialog-customer.h \
-  dialog-date-close.h \
-  dialog-employee.h \
-  dialog-fincalc.h \
-  dialog-find-account.h \
-  dialog-find-transactions.h \
-  dialog-find-transactions2.h \
-  dialog-imap-editor.h \
-  dialog-invoice.h \
-  dialog-job.h \
-  dialog-lot-viewer.h \
-  dialog-new-user.h \
-  dialog-order.h \
-  dialog-payment.h \
-  dialog-print-check.h \
-  dialog-progress.h \
-  dialog-sx-editor.h \
-  dialog-sx-editor2.h \
-  dialog-sx-from-trans.h \
-  dialog-sx-since-last-run.h \
-  dialog-trans-assoc.h \
-  dialog-vendor.h \
-  gnc-budget-view.h \
-  gnc-plugin-account-tree.h \
-  gnc-plugin-basic-commands.h \
-  gnc-plugin-budget.h \
-  gnc-plugin-business.h \
-  gnc-plugin-page-account-tree.h \
-  gnc-plugin-page-budget.h \
-  gnc-plugin-page-invoice.h \
-  gnc-plugin-page-owner-tree.h \
-  gnc-plugin-page-sx-list.h \
-  gnc-plugin-page-register.h \
-  gnc-plugin-page-register2.h \
-  gnc-plugin-register.h \
-  gnc-plugin-register2.h \
-  gnc-split-reg.h \
-  gnc-split-reg2.h \
-  reconcile-view.h \
-  search-owner.h \
-  top-level.h \
-  window-reconcile.h \
-  window-reconcile2.h \
-  window-autoclear.h
-
-if BUILDING_FROM_VCS
-swig-gnome.c: gnome.i dialog-progress.h ${top_srcdir}/src/base-typemaps.i
-	$(SWIG) -guile $(SWIG_ARGS) -Linkage module \
-	-I${top_srcdir}/src -o $@ $<
-if ! OS_WIN32
-if ! SWIG_DIST_FAIL
-	if ! `grep "define scm_from_utf8_string" $@ > /dev/null 2>&1`; then \
-	  patch $@ $(top_srcdir)/src/swig-utf8.patch; \
-	fi
-endif
-endif
-endif
-
-EXTRA_DIST = \
-  gnome.i \
-  $(gnomeapp_in_files) \
-  $(appdata_in_files) \
-  CMakeLists.txt
-
-AM_CPPFLAGS = \
-  -I${top_srcdir}/src \
-  -I${top_builddir}/src \
-  -I${top_srcdir}/src/core-utils \
-  -I${top_srcdir}/src/engine \
-  -I${top_srcdir}/src/app-utils \
-  -I${top_srcdir}/src/app-utils/calculation \
-  -I${top_srcdir}/src/backend/xml \
-  -I${top_srcdir}/src/gnome-utils \
-  -I${top_srcdir}/src/gnome-search \
-  -I${top_srcdir}/src/html \
-  -I${top_srcdir}/src/register/ledger-core \
-  -I${top_srcdir}/src/register/register-core \
-  -I${top_srcdir}/src/register/register-gnome \
-  -I${top_srcdir}/src/report/report-system \
-  -I${top_srcdir}/src/report/report-gnome \
-  -I${top_srcdir}/lib/libc \
-  ${LIBXML2_CFLAGS} \
-  ${GUILE_CFLAGS} \
-  ${GTK_CFLAGS} \
-  $(GLIB_CFLAGS) \
-  ${GTK_MAC_CFLAGS}
-
-# We build this in an earlier directory.
-
-# The line below breaks automake 1.5.  
-##OMIT_DEPENDENCIES = gnc-dir.h
-
-CLEANFILES = gnucash.desktop gnucash.appdata.xml
-MAINTAINERCLEANFILES = swig-gnome.c
-
-AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.gui\"
diff --git a/src/gnome/dialog-commodities.c b/src/gnome/dialog-commodities.c
deleted file mode 100644
index b317f3b..0000000
--- a/src/gnome/dialog-commodities.c
+++ /dev/null
@@ -1,431 +0,0 @@
-/********************************************************************\
- * dialog-commodities.c -- commodities dialog                       *
- * Copyright (C) 2001 Gnumatic, Inc.                                *
- * Author: Dave Peticolas <dave at krondo.com>                         *
- * Copyright (C) 2003,2005 David Hampton                            *
- *                                                                  *
- * 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 at gnu.org                   *
-\********************************************************************/
-
-#include "config.h"
-
-#include <gtk/gtk.h>
-#include <glib/gi18n.h>
-
-#include "dialog-commodity.h"
-#include "dialog-utils.h"
-#include "gnc-commodity.h"
-#include "gnc-component-manager.h"
-#include "qof.h"
-#include "gnc-tree-view-commodity.h"
-#include "gnc-prefs.h"
-#include "gnc-ui.h"
-#include "gnc-ui-util.h"
-#include "gnc-gnome-utils.h"
-#include "gnc-session.h"
-#include "gnome-utils/gnc-warnings.h"
-
-
-#define DIALOG_COMMODITIES_CM_CLASS "dialog-commodities"
-#define STATE_SECTION "dialogs/edit_commodities"
-#define GNC_PREFS_GROUP   "dialogs.commodities"
-#define GNC_PREF_INCL_ISO "include-iso"
-
-/* This static indicates the debugging module that this .o belongs to.  */
-/* static short module = MOD_GUI; */
-
-typedef struct
-{
-    GtkWidget * dialog;
-    QofSession *session;
-    QofBook *book;
-
-    GncTreeViewCommodity * commodity_tree;
-    GtkWidget * edit_button;
-    GtkWidget * remove_button;
-    gboolean    show_currencies;
-
-    gboolean is_new;
-} CommoditiesDialog;
-
-
-void gnc_commodities_window_destroy_cb (GtkWidget *object, CommoditiesDialog *cd);
-void gnc_commodities_dialog_response (GtkDialog *dialog, gint response, CommoditiesDialog *cd);
-void gnc_commodities_show_currencies_toggled (GtkToggleButton *toggle, CommoditiesDialog *cd);
-
-
-
-void
-gnc_commodities_window_destroy_cb (GtkWidget *object,   CommoditiesDialog *cd)
-{
-    gnc_unregister_gui_component_by_data (DIALOG_COMMODITIES_CM_CLASS, cd);
-
-    g_free (cd);
-}
-
-static void
-edit_clicked (CommoditiesDialog *cd)
-{
-    gnc_commodity *commodity;
-
-    commodity = gnc_tree_view_commodity_get_selected_commodity (cd->commodity_tree);
-    if (commodity == NULL)
-        return;
-
-    if (gnc_ui_edit_commodity_modal (commodity, cd->dialog))
-        gnc_gui_refresh_all ();
-}
-
-static void
-row_activated_cb (GtkTreeView *view, GtkTreePath *path,
-                  GtkTreeViewColumn *column, CommoditiesDialog *cd)
-{
-    GtkTreeModel *model;
-    GtkTreeIter iter;
-
-    g_return_if_fail(view);
-
-    model = gtk_tree_view_get_model(view);
-    if (gtk_tree_model_get_iter(model, &iter, path))
-    {
-        if (gtk_tree_model_iter_has_child(model, &iter))
-        {
-            /* There are children, so it's not a commodity.
-             * Just expand or collapse the row. */
-            if (gtk_tree_view_row_expanded(view, path))
-                gtk_tree_view_collapse_row(view, path);
-            else
-                gtk_tree_view_expand_row(view, path, FALSE);
-        }
-        else
-            /* It's a commodity, so click the Edit button. */
-            edit_clicked(cd);
-    }
-}
-
-static void
-remove_clicked (CommoditiesDialog *cd)
-{
-    GNCPriceDB *pdb;
-    GList *node;
-    GList *prices;
-    GList *accounts;
-    gboolean can_delete;
-    gnc_commodity *commodity;
-    GtkWidget *dialog;
-    const gchar *message, *warning;
-    gint response;
-
-    commodity = gnc_tree_view_commodity_get_selected_commodity (cd->commodity_tree);
-    if (commodity == NULL)
-        return;
-
-    accounts = gnc_account_get_descendants (gnc_book_get_root_account(cd->book));
-    can_delete = TRUE;
-
-    for (node = accounts; node; node = node->next)
-    {
-        Account *account = node->data;
-
-        if (commodity == xaccAccountGetCommodity (account))
-        {
-            can_delete = FALSE;
-            break;
-        }
-    }
-
-    /* FIXME check for transaction references */
-
-    if (!can_delete)
-    {
-        const char *message = _("That commodity is currently used by "
-                                "at least one of your accounts. You may "
-                                "not delete it.");
-
-        gnc_warning_dialog (cd->dialog, "%s", message);
-        g_list_free (accounts);
-        return;
-    }
-    g_list_free (accounts);
-
-    pdb = gnc_pricedb_get_db (cd->book);
-    prices = gnc_pricedb_get_prices(pdb, commodity, NULL);
-    if (prices)
-    {
-        message = _("This commodity has price quotes. Are "
-                    "you sure you want to delete the selected "
-                    "commodity and its price quotes?");
-        warning = GNC_PREF_WARN_PRICE_COMM_DEL_QUOTES;
-    }
-    else
-    {
-        message = _("Are you sure you want to delete the "
-                    "selected commodity?");
-        warning = GNC_PREF_WARN_PRICE_COMM_DEL;
-    }
-
-    dialog = gtk_message_dialog_new(GTK_WINDOW(cd->dialog),
-                                    GTK_DIALOG_DESTROY_WITH_PARENT,
-                                    GTK_MESSAGE_QUESTION,
-                                    GTK_BUTTONS_NONE,
-                                    "%s", _("Delete commodity?"));
-    gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
-            "%s", message);
-    gtk_dialog_add_buttons(GTK_DIALOG(dialog),
-                           _("_Cancel"), GTK_RESPONSE_CANCEL,
-                           _("_Delete"), GTK_RESPONSE_OK,
-                           (gchar *)NULL);
-    response = gnc_dialog_run(GTK_DIALOG(dialog), warning);
-    gtk_widget_destroy(dialog);
-
-    if (response == GTK_RESPONSE_OK)
-    {
-        gnc_commodity_table *ct;
-
-        ct = gnc_commodity_table_get_table (cd->book);
-        for (node = prices; node; node = node->next)
-            gnc_pricedb_remove_price(pdb, node->data);
-
-        gnc_commodity_table_remove (ct, commodity);
-        gnc_commodity_destroy (commodity);
-        commodity = NULL;
-    }
-
-    gnc_price_list_destroy(prices);
-    gnc_gui_refresh_all ();
-}
-
-static void
-add_clicked (CommoditiesDialog *cd)
-{
-    gnc_commodity *commodity;
-    const char *name_space;
-
-    commodity = gnc_tree_view_commodity_get_selected_commodity (cd->commodity_tree);
-    if (commodity)
-        name_space = gnc_commodity_get_namespace (commodity);
-    else
-        name_space = NULL;
-
-    commodity = gnc_ui_new_commodity_modal (name_space, cd->dialog);
-}
-
-void
-gnc_commodities_dialog_response (GtkDialog *dialog,
-                                 gint response,
-                                 CommoditiesDialog *cd)
-{
-    switch (response)
-    {
-    case GNC_RESPONSE_NEW:
-        add_clicked (cd);
-        return;
-
-    case GNC_RESPONSE_DELETE:
-        remove_clicked (cd);
-        return;
-
-    case GNC_RESPONSE_EDIT:
-        edit_clicked (cd);
-        return;
-
-    case GTK_RESPONSE_CLOSE:
-    default:
-        gnc_close_gui_component_by_data (DIALOG_COMMODITIES_CM_CLASS, cd);
-        return;
-    }
-}
-
-static void
-gnc_commodities_dialog_selection_changed (GtkTreeSelection *selection,
-        CommoditiesDialog *cd)
-{
-    gboolean remove_ok;
-    gnc_commodity *commodity;
-
-    commodity = gnc_tree_view_commodity_get_selected_commodity (cd->commodity_tree);
-    remove_ok = commodity && !gnc_commodity_is_iso(commodity);
-    gtk_widget_set_sensitive (cd->edit_button, commodity != NULL);
-    gtk_widget_set_sensitive (cd->remove_button, remove_ok);
-}
-
-void
-gnc_commodities_show_currencies_toggled (GtkToggleButton *toggle,
-        CommoditiesDialog *cd)
-{
-
-    cd->show_currencies = gtk_toggle_button_get_active (toggle);
-    gnc_tree_view_commodity_refilter (cd->commodity_tree);
-}
-
-static gboolean
-gnc_commodities_dialog_filter_ns_func (gnc_commodity_namespace *name_space,
-                                       gpointer data)
-{
-    CommoditiesDialog *cd = data;
-    const gchar *name;
-    GList *list;
-
-    /* Never show the template list */
-    name = gnc_commodity_namespace_get_name (name_space);
-    if (g_strcmp0 (name, GNC_COMMODITY_NS_TEMPLATE) == 0)
-        return FALSE;
-
-    /* Check whether or not to show commodities */
-    if (!cd->show_currencies && gnc_commodity_namespace_is_iso(name))
-        return FALSE;
-
-    /* Show any other namespace that has commodities */
-    list = gnc_commodity_namespace_get_commodity_list(name_space);
-    return (list != NULL);
-}
-
-static gboolean
-gnc_commodities_dialog_filter_cm_func (gnc_commodity *commodity,
-                                       gpointer data)
-{
-    CommoditiesDialog *cd = data;
-
-    if (cd->show_currencies)
-        return TRUE;
-    return !gnc_commodity_is_iso(commodity);
-}
-
-static void
-gnc_commodities_dialog_create (GtkWidget * parent, CommoditiesDialog *cd)
-{
-    GtkWidget *button;
-    GtkWidget *scrolled_window;
-    GtkBuilder *builder;
-    GtkTreeView *view;
-    GtkTreeSelection *selection;
-
-    builder = gtk_builder_new();
-    gnc_builder_add_from_file (builder, "dialog-commodities.glade", "securities_dialog");
-
-    cd->dialog = GTK_WIDGET(gtk_builder_get_object (builder, "securities_dialog"));
-    cd->session = gnc_get_current_session();
-    cd->book = qof_session_get_book(cd->session);
-    cd->show_currencies = gnc_prefs_get_bool(GNC_PREFS_GROUP, GNC_PREF_INCL_ISO);
-
-    // Set the style context for this dialog so it can be easily manipulated with css
-    gnc_widget_set_style_context (GTK_WIDGET(cd->dialog), "GncCommoditiesDialog");
-
-    gtk_builder_connect_signals(builder, cd);
-
-    /* parent */
-    if (parent != NULL)
-        gtk_window_set_transient_for (GTK_WINDOW (cd->dialog), GTK_WINDOW (parent));
-
-    /* buttons */
-    cd->remove_button = GTK_WIDGET(gtk_builder_get_object (builder, "remove_button"));
-    cd->edit_button = GTK_WIDGET(gtk_builder_get_object (builder, "edit_button"));
-
-    /* commodity tree */
-
-    scrolled_window = GTK_WIDGET(gtk_builder_get_object (builder, "commodity_list_window"));
-    view = gnc_tree_view_commodity_new(cd->book,
-                                       "state-section", STATE_SECTION,
-                                       "show-column-menu", TRUE,
-                                       NULL);
-    cd->commodity_tree = GNC_TREE_VIEW_COMMODITY(view);
-    gtk_container_add (GTK_CONTAINER (scrolled_window), GTK_WIDGET(view));
-    gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(cd->commodity_tree), TRUE);
-    gnc_tree_view_commodity_set_filter (cd->commodity_tree,
-                                        gnc_commodities_dialog_filter_ns_func,
-                                        gnc_commodities_dialog_filter_cm_func,
-                                        cd, NULL);
-    selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (view));
-    g_signal_connect (G_OBJECT (selection), "changed",
-                      G_CALLBACK (gnc_commodities_dialog_selection_changed), cd);
-
-    g_signal_connect (G_OBJECT (cd->commodity_tree), "row-activated",
-                      G_CALLBACK (row_activated_cb), cd);
-
-    /* Show currency button */
-    button = GTK_WIDGET(gtk_builder_get_object (builder, "show_currencies_button"));
-    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(button), cd->show_currencies);
-
-    g_object_unref(G_OBJECT(builder));
-    gnc_restore_window_size (GNC_PREFS_GROUP, GTK_WINDOW(cd->dialog));
-}
-
-static void
-close_handler (gpointer user_data)
-{
-    CommoditiesDialog *cd = user_data;
-
-    gnc_save_window_size(GNC_PREFS_GROUP, GTK_WINDOW(cd->dialog));
-
-    gnc_prefs_set_bool(GNC_PREFS_GROUP, GNC_PREF_INCL_ISO, cd->show_currencies);
-
-    gtk_widget_destroy(cd->dialog);
-}
-
-static void
-refresh_handler (GHashTable *changes, gpointer user_data)
-{
-    CommoditiesDialog *cd = user_data;
-
-    g_return_if_fail(cd != NULL);
-
-    gnc_tree_view_commodity_refilter (cd->commodity_tree);
-}
-
-static gboolean
-show_handler (const char *klass, gint component_id,
-              gpointer user_data, gpointer iter_data)
-{
-    CommoditiesDialog *cd = user_data;
-
-    if (!cd)
-        return(FALSE);
-    gtk_window_present (GTK_WINDOW(cd->dialog));
-    return(TRUE);
-}
-
-/********************************************************************\
- * gnc_commodities_dialog                                           *
- *   opens up a window to edit price information                    *
- *                                                                  *
- * Args:   parent  - the parent of the window to be created         *
- * Return: nothing                                                  *
-\********************************************************************/
-void
-gnc_commodities_dialog (GtkWidget * parent)
-{
-    CommoditiesDialog *cd;
-    gint component_id;
-
-    if (gnc_forall_gui_components (DIALOG_COMMODITIES_CM_CLASS,
-                                   show_handler, NULL))
-        return;
-
-    cd = g_new0 (CommoditiesDialog, 1);
-
-    gnc_commodities_dialog_create (parent, cd);
-
-    component_id = gnc_register_gui_component (DIALOG_COMMODITIES_CM_CLASS,
-                   refresh_handler, close_handler,
-                   cd);
-    gnc_gui_component_set_session (component_id, cd->session);
-
-    gtk_widget_grab_focus (GTK_WIDGET(cd->commodity_tree));
-
-    gtk_widget_show (cd->dialog);
-}
diff --git a/src/gnome/dialog-customer.c b/src/gnome/dialog-customer.c
deleted file mode 100644
index 5009241..0000000
--- a/src/gnome/dialog-customer.c
+++ /dev/null
@@ -1,1347 +0,0 @@
-/*
- * dialog-customer.c -- Dialog for Customer entry
- * Copyright (C) 2001 Derek Atkins
- * Author: Derek Atkins <warlord at MIT.EDU>
- *
- * 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 at gnu.org
- */
-
-#include "config.h"
-
-#include <gtk/gtk.h>
-#include <glib/gi18n.h>
-#include <gdk/gdkkeysyms.h>
-
-#include "dialog-utils.h"
-#include "gnc-amount-edit.h"
-#include "gnc-currency-edit.h"
-#include "gnc-component-manager.h"
-#include "gnc-ui.h"
-#include "gnc-gui-query.h"
-#include "gnc-ui-util.h"
-#include "qof.h"
-
-#include "dialog-search.h"
-#include "search-param.h"
-#include "app-utils/QuickFill.h"
-#include "app-utils/gnc-addr-quickfill.h"
-
-#include "gncAddress.h"
-#include "gncCustomer.h"
-#include "gncCustomerP.h"
-
-#include "business-gnome-utils.h"
-#include "dialog-customer.h"
-#include "dialog-job.h"
-#include "dialog-order.h"
-#include "dialog-invoice.h"
-#include "dialog-payment.h"
-
-#define DIALOG_NEW_CUSTOMER_CM_CLASS "dialog-new-customer"
-#define DIALOG_EDIT_CUSTOMER_CM_CLASS "dialog-edit-customer"
-
-#define GNC_PREFS_GROUP_SEARCH "dialogs.business.customer-search"
-
-void gnc_customer_taxtable_check_cb (GtkToggleButton *togglebutton,
-                                     gpointer user_data);
-
-void gnc_customer_window_ok_cb (GtkWidget *widget, gpointer data);
-void gnc_customer_window_cancel_cb (GtkWidget *widget, gpointer data);
-void gnc_customer_window_help_cb (GtkWidget *widget, gpointer data);
-void gnc_customer_window_destroy_cb (GtkWidget *widget, gpointer data);
-void gnc_customer_name_changed_cb (GtkWidget *widget, gpointer data);
-void gnc_customer_terms_changed_cb (GtkWidget *widget, gpointer data);
-void gnc_customer_taxincluded_changed_cb (GtkWidget *widget, gpointer data);
-void gnc_customer_taxtable_changed_cb (GtkWidget *widget, gpointer data);
-void gnc_customer_addr2_insert_cb(GtkEditable *editable,
-                                  gchar *new_text, gint new_text_length,
-                                  gint *position, gpointer user_data);
-void gnc_customer_addr3_insert_cb(GtkEditable *editable,
-                                  gchar *new_text, gint new_text_length,
-                                  gint *position, gpointer user_data);
-void gnc_customer_addr4_insert_cb(GtkEditable *editable,
-                                  gchar *new_text, gint new_text_length,
-                                  gint *position, gpointer user_data);
-void gnc_customer_shipaddr2_insert_cb(GtkEditable *editable,
-                                      gchar *new_text, gint new_text_length,
-                                      gint *position, gpointer user_data);
-void gnc_customer_shipaddr3_insert_cb(GtkEditable *editable,
-                                      gchar *new_text, gint new_text_length,
-                                      gint *position, gpointer user_data);
-void gnc_customer_shipaddr4_insert_cb(GtkEditable *editable,
-                                      gchar *new_text, gint new_text_length,
-                                      gint *position, gpointer user_data);
-gboolean
-gnc_customer_addr2_key_press_cb( GtkEntry *entry, GdkEventKey *event,
-                                 gpointer user_data );
-gboolean
-gnc_customer_addr3_key_press_cb( GtkEntry *entry, GdkEventKey *event,
-                                 gpointer user_data );
-gboolean
-gnc_customer_addr4_key_press_cb( GtkEntry *entry, GdkEventKey *event,
-                                 gpointer user_data );
-gboolean
-gnc_customer_shipaddr2_key_press_cb( GtkEntry *entry, GdkEventKey *event,
-                                     gpointer user_data );
-gboolean
-gnc_customer_shipaddr3_key_press_cb( GtkEntry *entry, GdkEventKey *event,
-                                     gpointer user_data );
-gboolean
-gnc_customer_shipaddr4_key_press_cb( GtkEntry *entry, GdkEventKey *event,
-                                     gpointer user_data );
-
-#define ADDR_QUICKFILL "GncAddress-Quickfill"
-
-typedef enum
-{
-    NEW_CUSTOMER,
-    EDIT_CUSTOMER
-} CustomerDialogType;
-
-struct _customer_select_window
-{
-    QofBook *	book;
-    QofQuery *	q;
-};
-
-struct _customer_window
-{
-    GtkWidget *	dialog;
-
-    GtkWidget *	id_entry;
-    GtkWidget *	company_entry;
-
-    GtkWidget *	name_entry;
-    GtkWidget *	addr1_entry;
-    GtkWidget *	addr2_entry;
-    GtkWidget *	addr3_entry;
-    GtkWidget *	addr4_entry;
-    GtkWidget *	phone_entry;
-    GtkWidget *	fax_entry;
-    GtkWidget *	email_entry;
-
-    GtkWidget *	shipname_entry;
-    GtkWidget *	shipaddr1_entry;
-    GtkWidget *	shipaddr2_entry;
-    GtkWidget *	shipaddr3_entry;
-    GtkWidget *	shipaddr4_entry;
-    GtkWidget *	shipphone_entry;
-    GtkWidget *	shipfax_entry;
-    GtkWidget *	shipemail_entry;
-
-    GtkWidget *	currency_edit;
-    GtkWidget *	terms_menu;
-    GtkWidget *	discount_amount;
-    GtkWidget *	credit_amount;
-
-    GtkWidget *	active_check;
-    GtkWidget *	taxincluded_menu;
-    GtkWidget *	notes_text;
-
-    GtkWidget *	taxtable_check;
-    GtkWidget *	taxtable_menu;
-
-    GncTaxIncluded taxincluded;
-    GncBillTerm *	terms;
-    CustomerDialogType	dialog_type;
-    GncGUID		customer_guid;
-    gint		component_id;
-    QofBook *	book;
-    GncCustomer *	created_customer;
-
-    GncTaxTable *	taxtable;
-
-    /* stored data for the description quickfill selection function */
-    QuickFill *addr2_quickfill;
-    QuickFill *addr3_quickfill;
-    QuickFill *addr4_quickfill;
-    gint addrX_start_selection;
-    gint addrX_end_selection;
-    guint addrX_selection_source_id;
-};
-
-void
-gnc_customer_taxtable_check_cb (GtkToggleButton *togglebutton,
-                                gpointer user_data)
-{
-    CustomerWindow *cw = user_data;
-
-    if (gtk_toggle_button_get_active (togglebutton))
-        gtk_widget_set_sensitive (cw->taxtable_menu, TRUE);
-    else
-        gtk_widget_set_sensitive (cw->taxtable_menu, FALSE);
-}
-
-static GncCustomer *
-cw_get_customer (CustomerWindow *cw)
-{
-    if (!cw)
-        return NULL;
-
-    return gncCustomerLookup (cw->book, &cw->customer_guid);
-}
-
-static void gnc_ui_to_customer (CustomerWindow *cw, GncCustomer *cust)
-{
-    GtkTextBuffer* text_buffer;
-    GtkTextIter start, end;
-    gchar *text;
-    GncAddress *addr, *shipaddr;
-
-    addr = gncCustomerGetAddr (cust);
-    shipaddr = gncCustomerGetShipAddr (cust);
-
-    gnc_suspend_gui_refresh ();
-
-    gncCustomerBeginEdit (cust);
-
-    if (cw->dialog_type == NEW_CUSTOMER)
-        qof_event_gen(QOF_INSTANCE(cust), QOF_EVENT_ADD, NULL);
-
-    gncCustomerSetID (cust, gtk_editable_get_chars
-                      (GTK_EDITABLE (cw->id_entry), 0, -1));
-    gncCustomerSetName (cust, gtk_editable_get_chars
-                        (GTK_EDITABLE (cw->company_entry), 0, -1));
-
-    gncAddressSetName (addr, gtk_editable_get_chars
-                       (GTK_EDITABLE (cw->name_entry), 0, -1));
-    gncAddressSetAddr1 (addr, gtk_editable_get_chars
-                        (GTK_EDITABLE (cw->addr1_entry), 0, -1));
-    gncAddressSetAddr2 (addr, gtk_editable_get_chars
-                        (GTK_EDITABLE (cw->addr2_entry), 0, -1));
-    gncAddressSetAddr3 (addr, gtk_editable_get_chars
-                        (GTK_EDITABLE (cw->addr3_entry), 0, -1));
-    gncAddressSetAddr4 (addr, gtk_editable_get_chars
-                        (GTK_EDITABLE (cw->addr4_entry), 0, -1));
-    gncAddressSetPhone (addr, gtk_editable_get_chars
-                        (GTK_EDITABLE (cw->phone_entry), 0, -1));
-    gncAddressSetFax (addr, gtk_editable_get_chars
-                      (GTK_EDITABLE (cw->fax_entry), 0, -1));
-    gncAddressSetEmail (addr, gtk_editable_get_chars
-                        (GTK_EDITABLE (cw->email_entry), 0, -1));
-
-    gncAddressSetName (shipaddr, gtk_editable_get_chars
-                       (GTK_EDITABLE (cw->shipname_entry), 0, -1));
-    gncAddressSetAddr1 (shipaddr, gtk_editable_get_chars
-                        (GTK_EDITABLE (cw->shipaddr1_entry), 0, -1));
-    gncAddressSetAddr2 (shipaddr, gtk_editable_get_chars
-                        (GTK_EDITABLE (cw->shipaddr2_entry), 0, -1));
-    gncAddressSetAddr3 (shipaddr, gtk_editable_get_chars
-                        (GTK_EDITABLE (cw->shipaddr3_entry), 0, -1));
-    gncAddressSetAddr4 (shipaddr, gtk_editable_get_chars
-                        (GTK_EDITABLE (cw->shipaddr4_entry), 0, -1));
-    gncAddressSetPhone (shipaddr, gtk_editable_get_chars
-                        (GTK_EDITABLE (cw->shipphone_entry), 0, -1));
-    gncAddressSetFax (shipaddr, gtk_editable_get_chars
-                      (GTK_EDITABLE (cw->shipfax_entry), 0, -1));
-    gncAddressSetEmail (shipaddr, gtk_editable_get_chars
-                        (GTK_EDITABLE (cw->shipemail_entry), 0, -1));
-
-    gncCustomerSetActive (cust, gtk_toggle_button_get_active
-                          (GTK_TOGGLE_BUTTON (cw->active_check)));
-    gncCustomerSetTaxIncluded (cust, cw->taxincluded);
-
-    text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW(cw->notes_text));
-    gtk_text_buffer_get_bounds (text_buffer, &start, &end);
-    text = gtk_text_buffer_get_text (text_buffer, &start, &end, FALSE);
-    gncCustomerSetNotes (cust, text);
-
-    /* Parse and set the currency, terms, discount, and credit amounts */
-    gncCustomerSetCurrency (cust,
-                            gnc_currency_edit_get_currency (GNC_CURRENCY_EDIT
-                                    (cw->currency_edit)));
-    gncCustomerSetTerms (cust, cw->terms);
-    gncCustomerSetDiscount (cust, gnc_amount_edit_get_amount
-                            (GNC_AMOUNT_EDIT (cw->discount_amount)));
-    gncCustomerSetCredit (cust, gnc_amount_edit_get_amount
-                          (GNC_AMOUNT_EDIT (cw->credit_amount)));
-
-    gncCustomerSetTaxTableOverride
-    (cust, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (cw->taxtable_check)));
-    gncCustomerSetTaxTable (cust, cw->taxtable);
-
-    gncCustomerCommitEdit (cust);
-    gnc_resume_gui_refresh ();
-}
-
-static gboolean check_edit_amount (GtkWidget *dialog, GtkWidget *amount,
-                                   gnc_numeric *min, gnc_numeric *max,
-                                   const char * error_message)
-{
-    if (!gnc_amount_edit_evaluate (GNC_AMOUNT_EDIT (amount)))
-    {
-        if (error_message)
-            gnc_error_dialog (dialog, "%s", error_message);
-        return TRUE;
-    }
-    /* We've got a valid-looking number; check mix/max */
-    if (min || max)
-    {
-        gnc_numeric val = gnc_amount_edit_get_amount (GNC_AMOUNT_EDIT (amount));
-        if ((min && gnc_numeric_compare (*min, val) > 0) ||
-                (max && gnc_numeric_compare (val, *max) > 0))
-        {
-            if (error_message)
-                gnc_error_dialog (dialog, "%s", error_message);
-            return TRUE;
-        }
-    }
-    return FALSE;
-}
-
-static gboolean check_entry_nonempty (GtkWidget *dialog, GtkWidget *entry,
-                                      const char * error_message)
-{
-    const char *res = gtk_entry_get_text (GTK_ENTRY (entry));
-    if (g_strcmp0 (res, "") == 0)
-    {
-        if (error_message)
-            gnc_error_dialog (dialog, "%s", error_message);
-        return TRUE;
-    }
-    return FALSE;
-}
-
-void
-gnc_customer_window_ok_cb (GtkWidget *widget, gpointer data)
-{
-    CustomerWindow *cw = data;
-    gnc_numeric min, max;
-    gchar *string;
-
-    /* Check for valid company name */
-    if (check_entry_nonempty (cw->dialog, cw->company_entry,
-                              _("You must enter a company name. "
-                                "If this customer is an individual (and not a company) "
-                                "you should enter the same value for:\nIdentification "
-                                "- Company Name, and\nPayment Address - Name.")))
-        return;
-
-    /* Make sure we have an address */
-    if (check_entry_nonempty (cw->dialog, cw->addr1_entry, NULL) &&
-            check_entry_nonempty (cw->dialog, cw->addr2_entry, NULL) &&
-            check_entry_nonempty (cw->dialog, cw->addr3_entry, NULL) &&
-            check_entry_nonempty (cw->dialog, cw->addr4_entry, NULL))
-    {
-        const char *msg = _("You must enter a billing address.");
-        gnc_error_dialog (cw->dialog, "%s", msg);
-        return;
-    }
-
-    /* Verify terms, discount, and credit are valid (or empty) */
-    min = gnc_numeric_zero ();
-    max = gnc_numeric_create (100, 1);
-
-    if (check_edit_amount (cw->dialog, cw->discount_amount, &min, &max,
-                           _("Discount percentage must be between 0-100 "
-                             "or you must leave it blank.")))
-        return;
-
-    if (check_edit_amount (cw->dialog, cw->credit_amount, &min, NULL,
-                           _("Credit must be a positive amount or "
-                             "you must leave it blank.")))
-        return;
-
-    /* Set the customer id if one has not been chosen */
-    if (g_strcmp0 (gtk_entry_get_text (GTK_ENTRY (cw->id_entry)), "") == 0)
-    {
-        string = gncCustomerNextID (cw->book);
-        gtk_entry_set_text (GTK_ENTRY (cw->id_entry), string);
-        g_free(string);
-    }
-
-    /* Now save it off */
-    {
-        GncCustomer *customer = cw_get_customer (cw);
-        if (customer)
-        {
-            gnc_ui_to_customer (cw, customer);
-        }
-        cw->created_customer = customer;
-        cw->customer_guid = *guid_null ();
-    }
-
-    gnc_close_gui_component (cw->component_id);
-}
-
-void
-gnc_customer_window_cancel_cb (GtkWidget *widget, gpointer data)
-{
-    CustomerWindow *cw = data;
-
-    gnc_close_gui_component (cw->component_id);
-}
-
-void
-gnc_customer_window_help_cb (GtkWidget *widget, gpointer data)
-{
-    gnc_gnome_help(HF_HELP, HL_USAGE_CUSTOMER);
-}
-
-void
-gnc_customer_window_destroy_cb (GtkWidget *widget, gpointer data)
-{
-    CustomerWindow *cw = data;
-    GncCustomer *customer = cw_get_customer (cw);
-
-    gnc_suspend_gui_refresh ();
-
-    if (cw->dialog_type == NEW_CUSTOMER && customer != NULL)
-    {
-        gncCustomerBeginEdit (customer);
-        gncCustomerDestroy (customer);
-        cw->customer_guid = *guid_null ();
-    }
-
-    if (cw->addrX_selection_source_id)
-        g_source_remove (cw->addrX_selection_source_id);
-
-    gnc_unregister_gui_component (cw->component_id);
-    gnc_resume_gui_refresh ();
-
-    g_free (cw);
-}
-
-void
-gnc_customer_name_changed_cb (GtkWidget *widget, gpointer data)
-{
-    CustomerWindow *cw = data;
-    char *fullname, *title;
-    const char *id,  *name;
-
-    if (!cw)
-        return;
-
-    name = gtk_entry_get_text (GTK_ENTRY (cw->company_entry));
-    if (!name || *name == '\0')
-        name = _("<No name>");
-
-    id = gtk_entry_get_text (GTK_ENTRY (cw->id_entry));
-
-    fullname = g_strconcat (name, " (", id, ")", (char *)NULL);
-
-    if (cw->dialog_type == EDIT_CUSTOMER)
-        title = g_strconcat (_("Edit Customer"), " - ", fullname, (char *)NULL);
-    else
-        title = g_strconcat (_("New Customer"), " - ", fullname, (char *)NULL);
-
-    gtk_window_set_title (GTK_WINDOW (cw->dialog), title);
-
-    g_free (fullname);
-    g_free (title);
-}
-
-void
-gnc_customer_terms_changed_cb (GtkWidget *widget, gpointer data)
-{
-    GtkComboBox *cbox = GTK_COMBO_BOX (widget);
-    CustomerWindow *cw = data;
-
-    if (!cw) return;
-    if (!cbox) return;
-
-    cw->terms = gnc_simple_combo_get_value (cbox);
-}
-
-void
-gnc_customer_taxincluded_changed_cb (GtkWidget *widget, gpointer data)
-{
-    GtkComboBox *cbox = GTK_COMBO_BOX (widget);
-    CustomerWindow *cw = data;
-
-    if (!cw) return;
-    if (!cbox) return;
-
-    cw->taxincluded = GPOINTER_TO_INT (gnc_simple_combo_get_value (cbox));
-}
-
-void
-gnc_customer_taxtable_changed_cb (GtkWidget *widget, gpointer data)
-{
-    GtkComboBox *cbox = GTK_COMBO_BOX (widget);
-    CustomerWindow *cw = data;
-
-    if (!cw) return;
-    if (!cbox) return;
-
-    cw->taxtable = gnc_simple_combo_get_value (cbox);
-}
-
-static void
-gnc_customer_window_close_handler (gpointer user_data)
-{
-    CustomerWindow *cw = user_data;
-
-    gtk_widget_destroy (cw->dialog);
-    // cw has already been freed by this point.
-    // cw->dialog = NULL;
-}
-
-static void
-gnc_customer_window_refresh_handler (GHashTable *changes, gpointer user_data)
-{
-    CustomerWindow *cw = user_data;
-    const EventInfo *info;
-    GncCustomer *customer = cw_get_customer (cw);
-
-    /* If there isn't a customer behind us, close down */
-    if (!customer)
-    {
-        gnc_close_gui_component (cw->component_id);
-        return;
-    }
-
-    /* Next, close if this is a destroy event */
-    if (changes)
-    {
-        info = gnc_gui_get_entity_events (changes, &cw->customer_guid);
-        if (info && (info->event_mask & QOF_EVENT_DESTROY))
-        {
-            gnc_close_gui_component (cw->component_id);
-            return;
-        }
-    }
-}
-
-static gboolean
-find_handler (gpointer find_data, gpointer user_data)
-{
-    const GncGUID *customer_guid = find_data;
-    CustomerWindow *cw = user_data;
-
-    return(cw && guid_equal(&cw->customer_guid, customer_guid));
-}
-
-static CustomerWindow *
-gnc_customer_new_window (QofBook *bookp, GncCustomer *cust)
-{
-    CustomerWindow *cw;
-    GtkBuilder *builder;
-    GtkWidget *hbox, *edit;
-    gnc_commodity *currency;
-    GNCPrintAmountInfo print_info;
-
-    /*
-     * Find an existing window for this customer.  If found, bring it to
-     * the front.
-     */
-    if (cust)
-    {
-        GncGUID customer_guid;
-
-        customer_guid = *gncCustomerGetGUID(cust);
-        cw = gnc_find_first_gui_component (DIALOG_EDIT_CUSTOMER_CM_CLASS,
-                                           find_handler, &customer_guid);
-        if (cw)
-        {
-            gtk_window_present (GTK_WINDOW(cw->dialog));
-            return(cw);
-        }
-    }
-
-    /* Find the default currency */
-    if (cust)
-        currency = gncCustomerGetCurrency (cust);
-    else
-        currency = gnc_default_currency ();
-
-    /*
-     * No existing customer window found.  Build a new one.
-     */
-    cw = g_new0 (CustomerWindow, 1);
-
-    cw->book = bookp;
-
-    /* Find the dialog */
-    builder = gtk_builder_new();
-    gnc_builder_add_from_file (builder, "dialog-customer.glade", "terms_store");
-    gnc_builder_add_from_file (builder, "dialog-customer.glade", "tax_included_store");
-    gnc_builder_add_from_file (builder, "dialog-customer.glade", "taxtable_store");
-    gnc_builder_add_from_file (builder, "dialog-customer.glade", "customer_dialog");
-    cw->dialog = GTK_WIDGET (gtk_builder_get_object (builder, "customer_dialog"));
-
-    // Set the style context for this dialog so it can be easily manipulated with css
-    gnc_widget_set_style_context (GTK_WIDGET(cw->dialog), "GncCustomerDialog");
-
-    g_object_set_data (G_OBJECT (cw->dialog), "dialog_info", cw);
-
-    /* Get entry points */
-    cw->id_entry = GTK_WIDGET (gtk_builder_get_object (builder, "id_entry"));
-    cw->company_entry = GTK_WIDGET (gtk_builder_get_object (builder, "company_entry"));
-
-    cw->name_entry = GTK_WIDGET (gtk_builder_get_object (builder, "name_entry"));
-    cw->addr1_entry = GTK_WIDGET (gtk_builder_get_object (builder, "addr1_entry"));
-    cw->addr2_entry = GTK_WIDGET (gtk_builder_get_object (builder, "addr2_entry"));
-    cw->addr3_entry = GTK_WIDGET (gtk_builder_get_object (builder, "addr3_entry"));
-    cw->addr4_entry = GTK_WIDGET (gtk_builder_get_object (builder, "addr4_entry"));
-    cw->phone_entry = GTK_WIDGET (gtk_builder_get_object (builder, "phone_entry"));
-    cw->fax_entry = GTK_WIDGET (gtk_builder_get_object (builder, "fax_entry"));
-    cw->email_entry = GTK_WIDGET (gtk_builder_get_object (builder, "email_entry"));
-
-    cw->shipname_entry = GTK_WIDGET (gtk_builder_get_object (builder, "shipname_entry"));
-    cw->shipaddr1_entry = GTK_WIDGET (gtk_builder_get_object (builder, "shipaddr1_entry"));
-    cw->shipaddr2_entry = GTK_WIDGET (gtk_builder_get_object (builder, "shipaddr2_entry"));
-    cw->shipaddr3_entry = GTK_WIDGET (gtk_builder_get_object (builder, "shipaddr3_entry"));
-    cw->shipaddr4_entry = GTK_WIDGET (gtk_builder_get_object (builder, "shipaddr4_entry"));
-    cw->shipphone_entry = GTK_WIDGET (gtk_builder_get_object (builder, "shipphone_entry"));
-    cw->shipfax_entry = GTK_WIDGET (gtk_builder_get_object (builder, "shipfax_entry"));
-    cw->shipemail_entry = GTK_WIDGET (gtk_builder_get_object (builder, "shipemail_entry"));
-
-    cw->active_check = GTK_WIDGET (gtk_builder_get_object (builder, "active_check"));
-    cw->taxincluded_menu = GTK_WIDGET (gtk_builder_get_object (builder, "tax_included_menu"));
-    cw->notes_text = GTK_WIDGET (gtk_builder_get_object (builder, "notes_text"));
-
-    cw->terms_menu = GTK_WIDGET (gtk_builder_get_object (builder, "terms_menu"));
-
-    cw->taxtable_check = GTK_WIDGET (gtk_builder_get_object (builder, "taxtable_button"));
-    cw->taxtable_menu = GTK_WIDGET (gtk_builder_get_object (builder, "taxtable_menu"));
-
-    /* Currency */
-    edit = gnc_currency_edit_new();
-    gnc_currency_edit_set_currency (GNC_CURRENCY_EDIT(edit), currency);
-    cw->currency_edit = edit;
-
-    hbox = GTK_WIDGET (gtk_builder_get_object (builder, "currency_box"));
-    gtk_box_pack_start (GTK_BOX (hbox), edit, TRUE, TRUE, 0);
-
-    /* DISCOUNT: Percentage Value */
-    edit = gnc_amount_edit_new();
-    gnc_amount_edit_set_evaluate_on_enter (GNC_AMOUNT_EDIT (edit), TRUE);
-    print_info = gnc_integral_print_info ();
-    print_info.max_decimal_places = 5;
-    gnc_amount_edit_set_print_info (GNC_AMOUNT_EDIT (edit), print_info);
-    gnc_amount_edit_set_fraction (GNC_AMOUNT_EDIT (edit), 100000);
-    cw->discount_amount = edit;
-    gtk_widget_show (edit);
-
-    hbox = GTK_WIDGET (gtk_builder_get_object (builder, "discount_box"));
-    gtk_box_pack_start (GTK_BOX (hbox), edit, TRUE, TRUE, 0);
-
-    /* CREDIT: Monetary Value */
-    edit = gnc_amount_edit_new();
-    print_info = gnc_commodity_print_info (currency, FALSE);
-    gnc_amount_edit_set_evaluate_on_enter (GNC_AMOUNT_EDIT (edit), TRUE);
-    gnc_amount_edit_set_print_info (GNC_AMOUNT_EDIT (edit), print_info);
-    gnc_amount_edit_set_fraction (GNC_AMOUNT_EDIT (edit),
-                                  gnc_commodity_get_fraction (currency));
-    cw->credit_amount = edit;
-    gtk_widget_show (edit);
-
-    hbox = GTK_WIDGET (gtk_builder_get_object (builder, "credit_box"));
-    gtk_box_pack_start (GTK_BOX (hbox), edit, TRUE, TRUE, 0);
-
-    /* Setup signals */
-    gtk_builder_connect_signals_full( builder,
-                                      gnc_builder_connect_full_func,
-                                      cw);
-
-    /* Setup initial values */
-    if (cust != NULL)
-    {
-        GtkTextBuffer* text_buffer;
-        GncAddress *addr, *shipaddr;
-        const char *string;
-
-        cw->dialog_type = EDIT_CUSTOMER;
-        cw->customer_guid = *gncCustomerGetGUID (cust);
-
-        addr = gncCustomerGetAddr (cust);
-        shipaddr = gncCustomerGetShipAddr (cust);
-
-        gtk_entry_set_text (GTK_ENTRY (cw->id_entry), gncCustomerGetID (cust));
-        gtk_entry_set_text (GTK_ENTRY (cw->company_entry), gncCustomerGetName (cust));
-
-        /* Setup Address */
-        gtk_entry_set_text (GTK_ENTRY (cw->name_entry), gncAddressGetName (addr));
-        gtk_entry_set_text (GTK_ENTRY (cw->addr1_entry), gncAddressGetAddr1 (addr));
-        gtk_entry_set_text (GTK_ENTRY (cw->addr2_entry), gncAddressGetAddr2 (addr));
-        gtk_entry_set_text (GTK_ENTRY (cw->addr3_entry), gncAddressGetAddr3 (addr));
-        gtk_entry_set_text (GTK_ENTRY (cw->addr4_entry), gncAddressGetAddr4 (addr));
-        gtk_entry_set_text (GTK_ENTRY (cw->phone_entry), gncAddressGetPhone (addr));
-        gtk_entry_set_text (GTK_ENTRY (cw->fax_entry), gncAddressGetFax (addr));
-        gtk_entry_set_text (GTK_ENTRY (cw->email_entry), gncAddressGetEmail (addr));
-
-        /* Setup Ship-to Address */
-        gtk_entry_set_text (GTK_ENTRY (cw->shipname_entry), gncAddressGetName (shipaddr));
-        gtk_entry_set_text (GTK_ENTRY (cw->shipaddr1_entry), gncAddressGetAddr1 (shipaddr));
-        gtk_entry_set_text (GTK_ENTRY (cw->shipaddr2_entry), gncAddressGetAddr2 (shipaddr));
-        gtk_entry_set_text (GTK_ENTRY (cw->shipaddr3_entry), gncAddressGetAddr3 (shipaddr));
-        gtk_entry_set_text (GTK_ENTRY (cw->shipaddr4_entry), gncAddressGetAddr4 (shipaddr));
-        gtk_entry_set_text (GTK_ENTRY (cw->shipphone_entry), gncAddressGetPhone (shipaddr));
-        gtk_entry_set_text (GTK_ENTRY (cw->shipfax_entry), gncAddressGetFax (shipaddr));
-        gtk_entry_set_text (GTK_ENTRY (cw->shipemail_entry), gncAddressGetEmail (shipaddr));
-
-        /* Set toggle buttons */
-        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (cw->active_check),
-                                      gncCustomerGetActive (cust));
-
-        string = gncCustomerGetNotes (cust);
-        text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW(cw->notes_text));
-        gtk_text_buffer_set_text (text_buffer, string, -1);
-
-        cw->component_id =
-            gnc_register_gui_component (DIALOG_EDIT_CUSTOMER_CM_CLASS,
-                                        gnc_customer_window_refresh_handler,
-                                        gnc_customer_window_close_handler,
-                                        cw);
-        cw->terms = gncCustomerGetTerms (cust);
-
-    }
-    else
-    {
-        cust = gncCustomerCreate (bookp);
-        cw->customer_guid = *gncCustomerGetGUID (cust);
-
-        cw->dialog_type = NEW_CUSTOMER;
-        cw->component_id =
-            gnc_register_gui_component (DIALOG_NEW_CUSTOMER_CM_CLASS,
-                                        gnc_customer_window_refresh_handler,
-                                        gnc_customer_window_close_handler,
-                                        cw);
-
-        /* XXX: get the global-default terms */
-        cw->terms = NULL;
-    }
-
-    /* I know that cust exists here -- either passed in or just created */
-
-    cw->taxincluded = gncCustomerGetTaxIncluded (cust);
-    gnc_taxincluded_combo (GTK_COMBO_BOX(cw->taxincluded_menu), cw->taxincluded);
-    gnc_billterms_combo (GTK_COMBO_BOX(cw->terms_menu), bookp, TRUE, cw->terms);
-
-    cw->taxtable = gncCustomerGetTaxTable (cust);
-    gnc_taxtables_combo (GTK_COMBO_BOX(cw->taxtable_menu), bookp, TRUE, cw->taxtable);
-    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (cw->taxtable_check),
-                                  gncCustomerGetTaxTableOverride (cust));
-    gnc_customer_taxtable_check_cb (GTK_TOGGLE_BUTTON (cw->taxtable_check), cw);
-
-    /* Set up the addr line quickfill */
-    cw->addr2_quickfill = gnc_get_shared_address_addr2_quickfill(cw->book, ADDR_QUICKFILL);
-    cw->addr3_quickfill = gnc_get_shared_address_addr3_quickfill(cw->book, ADDR_QUICKFILL);
-    cw->addr4_quickfill = gnc_get_shared_address_addr4_quickfill(cw->book, ADDR_QUICKFILL);
-
-    /* Set the Discount, and Credit amounts */
-    gnc_amount_edit_set_amount (GNC_AMOUNT_EDIT (cw->discount_amount),
-                                gncCustomerGetDiscount (cust));
-    gnc_amount_edit_set_amount (GNC_AMOUNT_EDIT (cw->credit_amount),
-                                gncCustomerGetCredit (cust));
-
-    gnc_gui_component_watch_entity_type (cw->component_id,
-                                         GNC_CUSTOMER_MODULE_NAME,
-                                         QOF_EVENT_MODIFY | QOF_EVENT_DESTROY);
-
-    gtk_widget_show_all (cw->dialog);
-    g_object_unref(G_OBJECT(builder));
-
-    return cw;
-}
-
-CustomerWindow *
-gnc_ui_customer_edit (GncCustomer *cust)
-{
-    CustomerWindow *cw;
-
-    if (!cust) return NULL;
-
-    cw = gnc_customer_new_window (gncCustomerGetBook(cust), cust);
-
-    return cw;
-}
-
-CustomerWindow *
-gnc_ui_customer_new (QofBook *bookp)
-{
-    CustomerWindow *cw;
-
-    /* Make sure required options exist */
-    if (!bookp) return NULL;
-
-    cw = gnc_customer_new_window (bookp, NULL);
-
-    return cw;
-}
-
-/* Functions for customer selection widgets */
-
-static void
-invoice_customer_cb (gpointer *cust_p, gpointer user_data)
-{
-    struct _customer_select_window *sw = user_data;
-    GncOwner owner;
-    GncCustomer *cust;
-
-    g_return_if_fail (cust_p && user_data);
-
-    cust = *cust_p;
-
-    if (!cust)
-        return;
-
-    gncOwnerInitCustomer (&owner, cust);
-    gnc_invoice_search (NULL, &owner, sw->book);
-    return;
-}
-
-static void
-order_customer_cb (gpointer *cust_p, gpointer user_data)
-{
-    struct _customer_select_window *sw = user_data;
-    GncOwner owner;
-    GncCustomer *cust;
-
-    g_return_if_fail (cust_p && user_data);
-
-    cust = *cust_p;
-
-    if (!cust)
-        return;
-
-    gncOwnerInitCustomer (&owner, cust);
-    gnc_order_search (NULL, &owner, sw->book);
-    return;
-}
-
-static void
-jobs_customer_cb (gpointer *cust_p, gpointer user_data)
-{
-    struct _customer_select_window *sw = user_data;
-    GncOwner owner;
-    GncCustomer *cust;
-
-    g_return_if_fail (cust_p && user_data);
-
-    cust = *cust_p;
-
-    if (!cust)
-        return;
-
-    gncOwnerInitCustomer (&owner, cust);
-    gnc_job_search (NULL, &owner, sw->book);
-    return;
-}
-
-static void
-payment_customer_cb (gpointer *cust_p, gpointer user_data)
-{
-    struct _customer_select_window *sw = user_data;
-    GncOwner owner;
-    GncCustomer *cust;
-
-    g_return_if_fail (cust_p && user_data);
-
-    cust = *cust_p;
-
-    if (!cust)
-        return;
-
-    gncOwnerInitCustomer (&owner, cust);
-    gnc_ui_payment_new (&owner, sw->book);
-    return;
-}
-
-static void
-edit_customer_cb (gpointer *cust_p, gpointer user_data)
-{
-    GncCustomer *cust;
-
-    g_return_if_fail (cust_p);
-    cust = *cust_p;
-
-    if (!cust)
-        return;
-
-    gnc_ui_customer_edit (cust);
-
-    return;
-}
-
-static gpointer
-new_customer_cb (gpointer user_data)
-{
-    struct _customer_select_window *sw = user_data;
-    CustomerWindow *cw;
-
-    g_return_val_if_fail (sw, NULL);
-
-    cw = gnc_ui_customer_new (sw->book);
-    return cw_get_customer (cw);
-}
-
-static void
-free_userdata_cb (gpointer user_data)
-{
-    struct _customer_select_window *sw = user_data;
-
-    g_return_if_fail (sw);
-
-    qof_query_destroy (sw->q);
-    g_free (sw);
-}
-
-GNCSearchWindow *
-gnc_customer_search (GncCustomer *start, QofBook *book)
-{
-    QofQuery *q, *q2 = NULL;
-    QofIdType type = GNC_CUSTOMER_MODULE_NAME;
-    struct _customer_select_window *sw;
-    static GList *params = NULL;
-    static GList *columns = NULL;
-    static GNCSearchCallbackButton buttons[] =
-    {
-        { N_("View/Edit Customer"), edit_customer_cb, NULL, TRUE},
-        { N_("Customer's Jobs"), jobs_customer_cb, NULL, TRUE},
-        //    { N_("Customer's Orders"), order_customer_cb, NULL, TRUE},
-        { N_("Customer's Invoices"), invoice_customer_cb, NULL, TRUE},
-        { N_("Process Payment"), payment_customer_cb, NULL, FALSE},
-        { NULL },
-    };
-    (void)order_customer_cb;
-
-    g_return_val_if_fail (book, NULL);
-
-    /* Build parameter list in reverse order */
-    if (params == NULL)
-    {
-        params = gnc_search_param_prepend (params, _("Shipping Contact"), NULL, type,
-                                           CUSTOMER_SHIPADDR, ADDRESS_NAME, NULL);
-        params = gnc_search_param_prepend (params, _("Billing Contact"), NULL, type,
-                                           CUSTOMER_ADDR, ADDRESS_NAME, NULL);
-        params = gnc_search_param_prepend (params, _("Customer ID"), NULL, type,
-                                           CUSTOMER_ID, NULL);
-        params = gnc_search_param_prepend (params, _("Company Name"), NULL, type,
-                                           CUSTOMER_NAME, NULL);
-    }
-
-    /* Build the column list in reverse order */
-    if (columns == NULL)
-    {
-        columns = gnc_search_param_prepend (columns, _("Contact"), NULL, type,
-                                            CUSTOMER_ADDR, ADDRESS_NAME, NULL);
-        columns = gnc_search_param_prepend (columns, _("Company"), NULL, type,
-                                            CUSTOMER_NAME, NULL);
-        columns = gnc_search_param_prepend (columns, _("ID #"), NULL, type,
-                                            CUSTOMER_ID, NULL);
-    }
-
-    /* Build the queries */
-    q = qof_query_create_for (type);
-    qof_query_set_book (q, book);
-
-#if 0
-    if (start)
-    {
-        q2 = qof_query_copy (q);
-        qof_query_add_guid_match (q2, g_slist_prepend (NULL, QOF_PARAM_GUID),
-                                  gncCustomerGetGUID (start), QOF_QUERY_AND);
-    }
-#endif
-
-    /* launch select dialog and return the result */
-    sw = g_new0 (struct _customer_select_window, 1);
-
-    sw->book = book;
-    sw->q = q;
-
-    return gnc_search_dialog_create (type, _("Find Customer"),
-                                     params, columns, q, q2, buttons, NULL,
-                                     new_customer_cb, sw, free_userdata_cb,
-                                     GNC_PREFS_GROUP_SEARCH, NULL,
-                                     "GncFindCustomerDialog");
-}
-
-GNCSearchWindow *
-gnc_customer_search_select (gpointer start, gpointer book)
-{
-    if (!book) return NULL;
-
-    return gnc_customer_search (start, book);
-}
-
-GNCSearchWindow *
-gnc_customer_search_edit (gpointer start, gpointer book)
-{
-    if (start)
-        gnc_ui_customer_edit (start);
-
-    return NULL;
-}
-
-static gboolean
-idle_select_region_addr2(gpointer user_data)
-{
-    CustomerWindow *wdata = user_data;
-    g_return_val_if_fail(user_data, FALSE);
-
-    /* g_warning("Selection start=%d end=%d",wdata->addrX_start_selection, wdata->addrX_end_selection); */
-
-    gtk_editable_select_region(GTK_EDITABLE(wdata->addr2_entry),
-                               wdata->addrX_start_selection,
-                               wdata->addrX_end_selection);
-
-    wdata->addrX_selection_source_id = 0;
-    return FALSE;
-}
-
-static gboolean
-idle_select_region_addr3(gpointer user_data)
-{
-    CustomerWindow *wdata = user_data;
-    g_return_val_if_fail(user_data, FALSE);
-
-    gtk_editable_select_region(GTK_EDITABLE(wdata->addr3_entry),
-                               wdata->addrX_start_selection,
-                               wdata->addrX_end_selection);
-
-    wdata->addrX_selection_source_id = 0;
-    return FALSE;
-}
-static gboolean
-idle_select_region_addr4(gpointer user_data)
-{
-    CustomerWindow *wdata = user_data;
-    g_return_val_if_fail(user_data, FALSE);
-
-    gtk_editable_select_region(GTK_EDITABLE(wdata->addr4_entry),
-                               wdata->addrX_start_selection,
-                               wdata->addrX_end_selection);
-    wdata->addrX_selection_source_id = 0;
-    return FALSE;
-}
-
-static gboolean
-idle_select_region_shipaddr2(gpointer user_data)
-{
-    CustomerWindow *wdata = user_data;
-    g_return_val_if_fail(user_data, FALSE);
-
-    gtk_editable_select_region(GTK_EDITABLE(wdata->shipaddr2_entry),
-                               wdata->addrX_start_selection,
-                               wdata->addrX_end_selection);
-
-    wdata->addrX_selection_source_id = 0;
-    return FALSE;
-}
-
-static gboolean
-idle_select_region_shipaddr3(gpointer user_data)
-{
-    CustomerWindow *wdata = user_data;
-    g_return_val_if_fail(user_data, FALSE);
-
-    gtk_editable_select_region(GTK_EDITABLE(wdata->shipaddr3_entry),
-                               wdata->addrX_start_selection,
-                               wdata->addrX_end_selection);
-
-    wdata->addrX_selection_source_id = 0;
-    return FALSE;
-}
-static gboolean
-idle_select_region_shipaddr4(gpointer user_data)
-{
-    CustomerWindow *wdata = user_data;
-    g_return_val_if_fail(user_data, FALSE);
-
-    gtk_editable_select_region(GTK_EDITABLE(wdata->shipaddr4_entry),
-                               wdata->addrX_start_selection,
-                               wdata->addrX_end_selection);
-    wdata->addrX_selection_source_id = 0;
-    return FALSE;
-}
-
-/* Implementation of the steps common to all address lines. Returns
- * TRUE if anything was inserted by quickfill, otherwise FALSE. */
-static gboolean
-gnc_customer_addr_common_insert_cb(GtkEditable *editable,
-                                   gchar *new_text, gint new_text_length,
-                                   gint *position, gpointer user_data, QuickFill *qf)
-{
-    CustomerWindow *wdata = user_data;
-    gchar *concatenated_text;
-    QuickFill *match;
-    gint prefix_len, concatenated_text_len;
-
-    if (new_text_length <= 0)
-        return FALSE;
-
-    /*g_warning("In gnc_customer_addr_common_insert_cb");*/
-
-    {
-        gchar *suffix = gtk_editable_get_chars(editable, *position, -1);
-        /* If we are inserting in the middle, do nothing */
-        if (*suffix)
-        {
-            g_free(suffix);
-            return FALSE;
-        }
-        g_free(suffix);
-    }
-
-    {
-        gchar *prefix = gtk_editable_get_chars(editable, 0, *position);
-        prefix_len = strlen(prefix);
-        concatenated_text = g_strconcat(prefix, new_text, (gchar*) NULL);
-        concatenated_text_len = prefix_len + new_text_length;
-        g_free(prefix);
-    }
-
-    match = gnc_quickfill_get_string_match(qf, concatenated_text);
-    g_free(concatenated_text);
-    if (match)
-    {
-        const char* match_str = gnc_quickfill_string(match);
-        if (match_str)
-        {
-            gint match_str_len = strlen(match_str);
-            if (match_str_len > concatenated_text_len)
-            {
-                /* g_warning("Got match \"%s\" match_str_len=%d new_text=%s position=%d prefix_len=%d", match_str, match_str_len, new_text, *position, prefix_len); */
-
-                g_signal_handlers_block_matched (G_OBJECT (editable),
-                                                 G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, user_data);
-
-                gtk_editable_insert_text(editable,
-                                         match_str + prefix_len,
-                                         match_str_len - prefix_len,
-                                         position);
-
-                g_signal_handlers_unblock_matched (G_OBJECT (editable),
-                                                   G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, user_data);
-
-                /* stop the current insert */
-                g_signal_stop_emission_by_name (G_OBJECT (editable), "insert_text");
-
-                /* set the position */
-                *position = concatenated_text_len;
-
-                /* select region on idle, because it would be reset once this function
-                   finishes */
-                wdata->addrX_start_selection = *position;
-                wdata->addrX_end_selection = -1;
-
-                return TRUE;
-            }
-        }
-    }
-    return FALSE;
-}
-
-void gnc_customer_addr2_insert_cb(GtkEditable *editable,
-                                  gchar *new_text, gint new_text_length,
-                                  gint *position, gpointer user_data)
-{
-    CustomerWindow *wdata = user_data;
-    gboolean r;
-
-    /* The handling common to all address lines is done in this other
-     * function. */
-    r = gnc_customer_addr_common_insert_cb(editable, new_text, new_text_length,
-                                           position, user_data, wdata->addr2_quickfill);
-
-    /* Did we insert something? Then set up the correct idle handler */
-    if (r)
-    {
-        /* select region on idle, because it would be reset once this function
-           finishes */
-        wdata->addrX_selection_source_id = g_idle_add(idle_select_region_addr2,
-                                           user_data);
-    }
-}
-
-void gnc_customer_addr3_insert_cb(GtkEditable *editable,
-                                  gchar *new_text, gint new_text_length,
-                                  gint *position, gpointer user_data)
-{
-    CustomerWindow *wdata = user_data;
-    gboolean r;
-
-    /* The handling common to all address lines is done in this other
-     * function. */
-    r = gnc_customer_addr_common_insert_cb(editable, new_text, new_text_length,
-                                           position, user_data, wdata->addr3_quickfill);
-
-    /* Did we insert something? Then set up the correct idle handler */
-    if (r)
-    {
-        wdata->addrX_selection_source_id = g_idle_add(idle_select_region_addr3,
-                                           user_data);
-    }
-}
-
-void gnc_customer_addr4_insert_cb(GtkEditable *editable,
-                                  gchar *new_text, gint new_text_length,
-                                  gint *position, gpointer user_data)
-{
-    CustomerWindow *wdata = user_data;
-    gboolean r;
-
-    /* The handling common to all address lines is done in this other
-     * function. */
-    r = gnc_customer_addr_common_insert_cb(editable, new_text, new_text_length,
-                                           position, user_data, wdata->addr4_quickfill);
-
-    /* Did we insert something? Then set up the correct idle handler */
-    if (r)
-    {
-        wdata->addrX_selection_source_id = g_idle_add(idle_select_region_addr4,
-                                           user_data);
-    }
-}
-
-void gnc_customer_shipaddr2_insert_cb(GtkEditable *editable,
-                                      gchar *new_text, gint new_text_length,
-                                      gint *position, gpointer user_data)
-{
-    CustomerWindow *wdata = user_data;
-    gboolean r;
-
-    /* The handling common to all address lines is done in this other
-     * function. */
-    r = gnc_customer_addr_common_insert_cb(editable, new_text, new_text_length,
-                                           position, user_data, wdata->addr2_quickfill);
-
-    /* Did we insert something? Then set up the correct idle handler */
-    if (r)
-    {
-        wdata->addrX_selection_source_id = g_idle_add(idle_select_region_shipaddr2,
-                                           user_data);
-    }
-}
-
-void gnc_customer_shipaddr3_insert_cb(GtkEditable *editable,
-                                      gchar *new_text, gint new_text_length,
-                                      gint *position, gpointer user_data)
-{
-    CustomerWindow *wdata = user_data;
-    gboolean r;
-
-    /* The handling common to all address lines is done in this other
-     * function. */
-    r = gnc_customer_addr_common_insert_cb(editable, new_text, new_text_length,
-                                           position, user_data, wdata->addr3_quickfill);
-
-    /* Did we insert something? Then set up the correct idle handler */
-    if (r)
-    {
-        wdata->addrX_selection_source_id = g_idle_add(idle_select_region_shipaddr3,
-                                           user_data);
-    }
-}
-
-void gnc_customer_shipaddr4_insert_cb(GtkEditable *editable,
-                                      gchar *new_text, gint new_text_length,
-                                      gint *position, gpointer user_data)
-{
-    CustomerWindow *wdata = user_data;
-    gboolean r;
-
-    /* The handling common to all address lines is done in this other
-     * function. */
-    r = gnc_customer_addr_common_insert_cb(editable, new_text, new_text_length,
-                                           position, user_data, wdata->addr4_quickfill);
-
-    /* Did we insert something? Then set up the correct idle handler */
-    if (r)
-    {
-        wdata->addrX_selection_source_id = g_idle_add(idle_select_region_shipaddr4,
-                                           user_data);
-    }
-}
-
-static gboolean
-gnc_customer_common_key_press_cb( GtkEntry *entry,
-                                  GdkEventKey *event,
-                                  gpointer user_data, GtkWidget* editable )
-{
-    gboolean done_with_input = FALSE;
-
-    /* Most "special" keys are allowed to be handled directly by
-     * the entry's key press handler, but in some cases that doesn't
-     * seem to work right, so handle them here.
-     */
-    switch ( event->keyval )
-    {
-    case GDK_KEY_Tab:
-    case GDK_KEY_ISO_Left_Tab:
-        if ( !( event->state & GDK_SHIFT_MASK) )    /* Complete on Tab,
-                                                  * but not Shift-Tab */
-        {
-            /* NOT done with input, though, since we need to focus to the next
-             * field.  Unselect the current field, though.
-             */
-            gtk_editable_select_region( GTK_EDITABLE(editable),
-                                        0, 0 );
-        }
-        break;
-    }
-
-    return( done_with_input );
-}
-gboolean
-gnc_customer_addr2_key_press_cb( GtkEntry *entry,
-                                 GdkEventKey *event,
-                                 gpointer user_data )
-{
-    CustomerWindow *wdata = user_data;
-    return gnc_customer_common_key_press_cb(entry, event, user_data,
-                                            wdata->addr2_entry);
-}
-gboolean
-gnc_customer_addr3_key_press_cb( GtkEntry *entry,
-                                 GdkEventKey *event,
-                                 gpointer user_data )
-{
-    CustomerWindow *wdata = user_data;
-    return gnc_customer_common_key_press_cb(entry, event, user_data,
-                                            wdata->addr3_entry);
-}
-gboolean
-gnc_customer_addr4_key_press_cb( GtkEntry *entry,
-                                 GdkEventKey *event,
-                                 gpointer user_data )
-{
-    CustomerWindow *wdata = user_data;
-    return gnc_customer_common_key_press_cb(entry, event, user_data,
-                                            wdata->addr4_entry);
-}
-gboolean
-gnc_customer_shipaddr2_key_press_cb( GtkEntry *entry,
-                                     GdkEventKey *event,
-                                     gpointer user_data )
-{
-    CustomerWindow *wdata = user_data;
-    return gnc_customer_common_key_press_cb(entry, event, user_data,
-                                            wdata->shipaddr2_entry);
-}
-gboolean
-gnc_customer_shipaddr3_key_press_cb( GtkEntry *entry,
-                                     GdkEventKey *event,
-                                     gpointer user_data )
-{
-    CustomerWindow *wdata = user_data;
-    return gnc_customer_common_key_press_cb(entry, event, user_data,
-                                            wdata->shipaddr3_entry);
-}
-gboolean
-gnc_customer_shipaddr4_key_press_cb( GtkEntry *entry,
-                                     GdkEventKey *event,
-                                     gpointer user_data )
-{
-    CustomerWindow *wdata = user_data;
-    return gnc_customer_common_key_press_cb(entry, event, user_data,
-                                            wdata->shipaddr4_entry);
-}
diff --git a/src/gnome/dialog-new-user.c b/src/gnome/dialog-new-user.c
deleted file mode 100644
index 52075ce..0000000
--- a/src/gnome/dialog-new-user.c
+++ /dev/null
@@ -1,163 +0,0 @@
-/********************************************************************\
- * dialog-new-user.c -- new user dialog for GnuCash                 *
- * Copyright (C) 2001 Dave Peticolas <dave at krondo.com>              *
- *                                                                  *
- * 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 at gnu.org                   *
-\********************************************************************/
-
-#include "config.h"
-
-#include <gtk/gtk.h>
-#include <glib/gi18n.h>
-
-#include "dialog-new-user.h"
-#include "dialog-utils.h"
-#include "dialog-file-access.h"
-#include "assistant-hierarchy.h"
-#include "gnc-engine.h"
-#include "gnc-hooks.h"
-#include "gnc-ui.h"
-#include "gnc-file.h"
-#include "gnc-prefs.h"
-#include "gnc-main-window.h"
-#include "gnc-plugin-page-account-tree.h"
-#include "gnc-session.h"
-#include "app-utils/gnc-ui-util.h" // for gnc_get_current_book
-
-/* This static indicates the debugging module that this .o belongs to.  */
-static QofLogModule log_module = GNC_MOD_GUI;
-
-/* function to open a qif import assistant */
-static void (*qifImportAssistantFcn)(void) = NULL;
-
-static void gnc_ui_new_user_cancel_dialog (void);
-
-void
-gnc_new_user_dialog_register_qif_assistant (void (*cb_fcn)(void))
-{
-    g_return_if_fail (qifImportAssistantFcn == NULL);
-    qifImportAssistantFcn = cb_fcn;
-}
-
-void
-gnc_set_first_startup (gboolean first_startup)
-{
-    gnc_prefs_set_bool (GNC_PREFS_GROUP_NEW_USER, GNC_PREF_FIRST_STARTUP, first_startup);
-}
-
-static void
-after_hierarchy_assistant(void)
-{
-    gncp_new_user_finish ();
-    gnc_set_first_startup (FALSE);
-
-    qof_book_mark_session_dirty(gnc_get_current_book());
-    gnc_ui_file_access_for_save_as();
-}
-
-void
-gnc_ui_new_user_dialog (void)
-{
-    GtkWidget *dialog;
-    GtkWidget *new_accounts_button;
-    GtkWidget *import_qif_button;
-    GtkWidget *tutorial_button;
-    GtkBuilder  *builder;
-    gint result;
-
-    ENTER(" ");
-    builder = gtk_builder_new();
-    gnc_builder_add_from_file (builder, "dialog-new-user.glade", "new_user_dialog");
-
-    dialog = GTK_WIDGET(gtk_builder_get_object (builder, "new_user_dialog"));
-
-    // Set the style context for this dialog so it can be easily manipulated with css
-    gnc_widget_set_style_context (GTK_WIDGET(dialog), "GncNewUserDialog");
-
-    new_accounts_button = GTK_WIDGET(gtk_builder_get_object (builder, "new_accounts_button"));
-    import_qif_button = GTK_WIDGET(gtk_builder_get_object (builder, "import_qif_button"));
-    tutorial_button = GTK_WIDGET(gtk_builder_get_object (builder, "tutorial_button"));
-
-    /* Set the sensitivity of the qif-import button based on the availability
-     * of the qif-import assistant.
-     */
-    gtk_widget_set_sensitive (import_qif_button, (qifImportAssistantFcn != NULL));
-
-    result = gtk_dialog_run (GTK_DIALOG (dialog));
-    switch (result)
-    {
-    case GTK_RESPONSE_CANCEL:
-    case GTK_RESPONSE_DELETE_EVENT:
-        gnc_ui_new_user_cancel_dialog ();
-        break;
-    case GTK_RESPONSE_OK:
-        if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (new_accounts_button)))
-        {
-            gnc_ui_hierarchy_assistant_with_callback(TRUE, after_hierarchy_assistant);
-        }
-        else if ((qifImportAssistantFcn != NULL)
-                 && gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (import_qif_button)))
-        {
-            qifImportAssistantFcn();
-            gncp_new_user_finish ();
-        }
-        else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (tutorial_button)))
-        {
-            gnc_gnome_help (HF_GUIDE, NULL);
-            gncp_new_user_finish ();
-        }
-        break;
-    default:
-        g_print ("DEBUG: Response: %d", result);
-        g_assert_not_reached ();
-        break;
-    }
-
-    g_object_unref(G_OBJECT(builder));
-    gtk_widget_destroy (dialog);
-    LEAVE(" ");
-}
-
-static void
-gnc_ui_new_user_cancel_dialog (void)
-{
-    GtkWidget *dialog;
-    GtkBuilder  *builder;
-    gint result;
-    gboolean keepshowing;
-
-    builder = gtk_builder_new();
-    gnc_builder_add_from_file (builder, "dialog-new-user.glade", "new_user_cancel_dialog");
-
-    dialog = GTK_WIDGET(gtk_builder_get_object (builder, "new_user_cancel_dialog"));
-
-    result = gtk_dialog_run (GTK_DIALOG (dialog));
-    keepshowing = (result == GTK_RESPONSE_YES);
-
-    gnc_set_first_startup (keepshowing);
-    gncp_new_user_finish ();
-
-    g_object_unref(G_OBJECT(builder));
-    gtk_widget_destroy(dialog);
-}
-
-void
-gncp_new_user_finish (void)
-{
-    gnc_hook_run(HOOK_BOOK_OPENED, gnc_get_current_session());
-}
diff --git a/src/gnome/dialog-order.c b/src/gnome/dialog-order.c
deleted file mode 100644
index 099b3ef..0000000
--- a/src/gnome/dialog-order.c
+++ /dev/null
@@ -1,986 +0,0 @@
-/*
- * dialog-order.c -- Dialog for Order entry
- * Copyright (C) 2001,2002 Derek Atkins
- * Author: Derek Atkins <warlord at MIT.EDU>
- *
- * 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 at gnu.org
- */
-
-#include "config.h"
-
-#include <gtk/gtk.h>
-#include <glib/gi18n.h>
-
-#include "dialog-utils.h"
-#include "gnc-component-manager.h"
-#include "gnc-date-edit.h"
-#include "gnc-ui.h"
-#include "gnc-gui-query.h"
-#include "gnc-ui-util.h"
-#include "qof.h"
-#include "gnucash-register.h"
-#include "gnucash-sheet.h"
-#include "dialog-search.h"
-#include "search-param.h"
-
-#include "gncOrder.h"
-#include "gncOrderP.h"
-
-#include "gncEntryLedger.h"
-
-#include "dialog-order.h"
-#include "dialog-invoice.h"
-#include "business-gnome-utils.h"
-#include "dialog-date-close.h"
-#include "gnome-search/gnc-general-search.h"
-
-#define DIALOG_NEW_ORDER_CM_CLASS "dialog-new-order"
-#define DIALOG_EDIT_ORDER_CM_CLASS "dialog-edit-order"
-#define DIALOG_VIEW_ORDER_CM_CLASS "dialog-view-order"
-
-#define GNC_PREFS_GROUP_SEARCH "dialogs.business.order-search"
-
-void gnc_order_window_ok_cb (GtkWidget *widget, gpointer data);
-void gnc_order_window_cancel_cb (GtkWidget *widget, gpointer data);
-void gnc_order_window_help_cb (GtkWidget *widget, gpointer data);
-void gnc_order_window_invoice_cb (GtkWidget *widget, gpointer data);
-void gnc_order_window_close_order_cb (GtkWidget *widget, gpointer data);
-void gnc_order_window_destroy_cb (GtkWidget *widget, gpointer data);
-
-typedef enum
-{
-    NEW_ORDER,
-    EDIT_ORDER,
-    VIEW_ORDER
-} OrderDialogType;
-
-struct _order_select_window
-{
-    QofBook *	book;
-    GncOwner *	owner;
-    QofQuery *	q;
-    GncOwner	owner_def;
-};
-
-struct _order_window
-{
-    GtkWidget *	dialog;
-
-    GtkWidget *	id_entry;
-    GtkWidget *	ref_entry;
-    GtkWidget *	notes_text;
-    GtkWidget *	opened_date;
-    GtkWidget *	closed_date;
-    GtkWidget *	active_check;
-
-    GtkWidget * cd_label;
-    GtkWidget * hide1;
-    GtkWidget * hide2;
-    GtkWidget * close_order_button;
-
-    GtkWidget *	owner_box;
-    GtkWidget *	owner_label;
-    GtkWidget *	owner_choice;
-
-    GnucashRegister *	reg;
-    GncEntryLedger *	ledger;
-
-    OrderDialogType	dialog_type;
-    GncGUID		order_guid;
-    gint		component_id;
-    QofBook *	book;
-    GncOrder *	created_order;
-    GncOwner	owner;
-
-};
-
-static void gnc_order_update_window (OrderWindow *ow);
-
-static GncOrder *
-ow_get_order (OrderWindow *ow)
-{
-    if (!ow)
-        return NULL;
-
-    return gncOrderLookup (ow->book, &ow->order_guid);
-}
-
-static void gnc_ui_to_order (OrderWindow *ow, GncOrder *order)
-{
-    GtkTextBuffer* text_buffer;
-    GtkTextIter start, end;
-    gchar *text;
-    Timespec ts;
-
-    /* Do nothing if this is view only */
-    if (ow->dialog_type == VIEW_ORDER)
-        return;
-
-    gnc_suspend_gui_refresh ();
-    gncOrderBeginEdit (order);
-
-    gncOrderSetID (order, gtk_editable_get_chars
-                   (GTK_EDITABLE (ow->id_entry), 0, -1));
-
-    text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW(ow->notes_text));
-    gtk_text_buffer_get_bounds (text_buffer, &start, &end);
-    text = gtk_text_buffer_get_text (text_buffer, &start, &end, FALSE);
-    gncOrderSetNotes (order, text);
-
-    gncOrderSetReference (order, gtk_editable_get_chars
-                          (GTK_EDITABLE (ow->ref_entry), 0, -1));
-
-    ts = gnc_date_edit_get_date_ts (GNC_DATE_EDIT (ow->opened_date));
-    gncOrderSetDateOpened (order, ts);
-
-    if (ow->active_check)
-        gncOrderSetActive (order, gtk_toggle_button_get_active
-                           (GTK_TOGGLE_BUTTON (ow->active_check)));
-
-    gnc_owner_get_owner (ow->owner_choice, &(ow->owner));
-    gncOrderSetOwner (order, &(ow->owner));
-
-    gncOrderCommitEdit (order);
-    gnc_resume_gui_refresh ();
-}
-
-static gboolean
-gnc_order_window_verify_ok (OrderWindow *ow)
-{
-    const char *res;
-
-    /* Check the ID */
-    res = gtk_entry_get_text (GTK_ENTRY (ow->id_entry));
-    if (g_strcmp0 (res, "") == 0)
-    {
-        gnc_error_dialog (ow->dialog, "%s",
-                          _("The Order must be given an ID."));
-        return FALSE;
-    }
-
-    /* Check the Owner */
-    gnc_owner_get_owner (ow->owner_choice, &(ow->owner));
-    res = gncOwnerGetName (&(ow->owner));
-    if (res == NULL || g_strcmp0 (res, "") == 0)
-    {
-        gnc_error_dialog (ow->dialog, "%s",
-                          _("You need to supply Billing Information."));
-        return FALSE;
-    }
-
-    return TRUE;
-}
-
-static gboolean
-gnc_order_window_ok_save (OrderWindow *ow)
-{
-    if (!gnc_entry_ledger_check_close (ow->dialog, ow->ledger))
-        return FALSE;
-
-    if (!gnc_order_window_verify_ok (ow))
-        return FALSE;
-
-    /* Now save it off */
-    {
-        GncOrder *order = ow_get_order (ow);
-        if (order)
-        {
-            gnc_ui_to_order (ow, order);
-
-        }
-        ow->created_order = order;
-    }
-    return TRUE;
-}
-
-void
-gnc_order_window_ok_cb (GtkWidget *widget, gpointer data)
-{
-    OrderWindow *ow = data;
-
-    if (!gnc_order_window_ok_save (ow))
-        return;
-
-    /* Ok, we don't need this anymore */
-    ow->order_guid = *guid_null ();
-
-    gnc_close_gui_component (ow->component_id);
-}
-
-void
-gnc_order_window_cancel_cb (GtkWidget *widget, gpointer data)
-{
-    OrderWindow *ow = data;
-
-    gnc_close_gui_component (ow->component_id);
-}
-
-void
-gnc_order_window_help_cb (GtkWidget *widget, gpointer data)
-{
-    gnc_gnome_help(HF_HELP, HL_USAGE_BILL);
-}
-
-void
-gnc_order_window_invoice_cb (GtkWidget *widget, gpointer data)
-{
-    OrderWindow *ow = data;
-
-    /* make sure we're ok */
-    if (!gnc_order_window_verify_ok (ow))
-        return;
-
-    /* Ok, go make an invoice */
-    gnc_invoice_search (NULL, &(ow->owner), ow->book);
-
-    /* refresh the window */
-    gnc_order_update_window (ow);
-}
-
-void
-gnc_order_window_close_order_cb (GtkWidget *widget, gpointer data)
-{
-    OrderWindow *ow = data;
-    GncOrder *order;
-    GList *entries;
-    char *message, *label;
-    gboolean non_inv = FALSE;
-    Timespec ts;
-
-    /* Make sure the order is ok */
-    if (!gnc_order_window_verify_ok (ow))
-        return;
-
-    /* Make sure the order exists */
-    order = ow_get_order (ow);
-    if (!order)
-        return;
-
-    /* Check that there is at least one Entry */
-    if (gncOrderGetEntries (order) == NULL)
-    {
-        gnc_error_dialog (ow->dialog, "%s",
-                          _("The Order must have at least one Entry."));
-        return;
-    }
-
-    /* Make sure we can close the order. Are there any uninvoiced entries? */
-    entries = gncOrderGetEntries (order);
-    for ( ; entries ; entries = entries->next)
-    {
-        GncEntry *entry = entries->data;
-        if (gncEntryGetInvoice (entry) == NULL)
-        {
-            non_inv = TRUE;
-            break;
-        }
-    }
-
-    if (non_inv)
-    {
-        /* Damn; yes.  Well, ask the user to make sure they REALLY want to
-         * close this order!
-         */
-
-        message = _("This order contains entries that have not been invoiced. "
-                    "Are you sure you want to close it out before "
-                    "you invoice all the entries?");
-
-        if (gnc_verify_dialog (ow->dialog, FALSE, "%s", message) == FALSE)
-            return;
-    }
-
-    /* Ok, we can close this.  Ask for verification and set the closed date */
-    message = _("Do you really want to close the order?");
-    label = _("Close Date");
-
-    timespecFromTime64 (&ts, gnc_time (NULL));
-    if (!gnc_dialog_date_close_parented (ow->dialog, message, label, TRUE, &ts))
-        return;
-
-    gncOrderSetDateClosed (order, ts);
-
-    /* save it off */
-    gnc_order_window_ok_save (ow);
-
-    /* Reset the type; change to read-only */
-    ow->dialog_type = VIEW_ORDER;
-    gnc_entry_ledger_set_readonly (ow->ledger, TRUE);
-
-    /* And redisplay the window */
-    gnc_order_update_window (ow);
-}
-
-void
-gnc_order_window_destroy_cb (GtkWidget *widget, gpointer data)
-{
-    OrderWindow *ow = data;
-    GncOrder *order = ow_get_order (ow);
-
-    gnc_suspend_gui_refresh ();
-
-    if (ow->dialog_type == NEW_ORDER && order != NULL)
-    {
-        gncOrderBeginEdit (order);
-        gncOrderDestroy (order);
-        ow->order_guid = *guid_null ();
-    }
-
-    if (ow->ledger)
-        gnc_entry_ledger_destroy (ow->ledger);
-    gnc_unregister_gui_component (ow->component_id);
-    gnc_resume_gui_refresh ();
-
-    g_free (ow);
-}
-
-static int
-gnc_order_owner_changed_cb (GtkWidget *widget, gpointer data)
-{
-    OrderWindow *ow = data;
-    GncOrder *order;
-
-    if (!ow)
-        return FALSE;
-
-    if (ow->dialog_type == VIEW_ORDER)
-        return FALSE;
-
-    gnc_owner_get_owner (ow->owner_choice, &(ow->owner));
-
-    /* Set the Order's owner now! */
-    order = ow_get_order (ow);
-    gncOrderSetOwner (order, &(ow->owner));
-
-    if (ow->dialog_type == EDIT_ORDER)
-        return FALSE;
-
-    /* Only set the reference during the New Job dialog */
-    switch (gncOwnerGetType (&(ow->owner)))
-    {
-    case GNC_OWNER_JOB:
-    {
-        char const *msg = gncJobGetReference (gncOwnerGetJob (&(ow->owner)));
-        gtk_entry_set_text (GTK_ENTRY (ow->ref_entry), msg ? msg : "");
-        break;
-    }
-    default:
-        gtk_entry_set_text (GTK_ENTRY (ow->ref_entry), "");
-        break;
-    }
-
-    return FALSE;
-}
-
-static void
-gnc_order_window_close_handler (gpointer user_data)
-{
-    OrderWindow *ow = user_data;
-
-    gtk_widget_destroy (ow->dialog);
-}
-
-static void
-gnc_order_window_refresh_handler (GHashTable *changes, gpointer user_data)
-{
-    OrderWindow *ow = user_data;
-    const EventInfo *info;
-    GncOrder *order = ow_get_order (ow);
-
-    /* If there isn't a order behind us, close down */
-    if (!order)
-    {
-        gnc_close_gui_component (ow->component_id);
-        return;
-    }
-
-    /* Next, close if this is a destroy event */
-    if (changes)
-    {
-        info = gnc_gui_get_entity_events (changes, &ow->order_guid);
-        if (info && (info->event_mask & QOF_EVENT_DESTROY))
-        {
-            gnc_close_gui_component (ow->component_id);
-            return;
-        }
-    }
-}
-
-static void
-gnc_order_update_window (OrderWindow *ow)
-{
-    GncOrder *order;
-    GncOwner *owner;
-    gboolean hide_cd = FALSE;
-
-    order = ow_get_order (ow);
-    owner = gncOrderGetOwner (order);
-
-    if (ow->owner_choice)
-    {
-        gtk_container_remove (GTK_CONTAINER (ow->owner_box), ow->owner_choice);
-        gtk_widget_destroy (ow->owner_choice);
-    }
-
-    switch (ow->dialog_type)
-    {
-    case VIEW_ORDER:
-    case EDIT_ORDER:
-        ow->owner_choice =
-            gnc_owner_edit_create (ow->owner_label, ow->owner_box, ow->book,
-                                   owner);
-        break;
-    case NEW_ORDER:
-        ow->owner_choice =
-            gnc_owner_select_create (ow->owner_label, ow->owner_box, ow->book,
-                                     owner);
-        break;
-    }
-
-    g_signal_connect (ow->owner_choice, "changed",
-                      G_CALLBACK (gnc_order_owner_changed_cb),
-                      ow);
-
-    gtk_widget_show_all (ow->dialog);
-
-    {
-        GtkTextBuffer* text_buffer;
-        const char *string;
-        Timespec ts, ts_zero = {0, 0};
-
-        gtk_entry_set_text (GTK_ENTRY (ow->ref_entry),
-                            gncOrderGetReference (order));
-
-        string = gncOrderGetNotes (order);
-        text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW(ow->notes_text));
-        gtk_text_buffer_set_text (text_buffer, string, -1);
-
-        ts = gncOrderGetDateOpened (order);
-        if (timespec_equal (&ts, &ts_zero))
-        {
-            gnc_date_edit_set_time (GNC_DATE_EDIT (ow->opened_date),
-                                    gnc_time (NULL));
-        }
-        else
-        {
-            gnc_date_edit_set_time_ts (GNC_DATE_EDIT (ow->opened_date), ts);
-        }
-
-        /* If this is a "New Order Window" we can stop here! */
-        if (ow->dialog_type == NEW_ORDER)
-            return;
-
-        ts = gncOrderGetDateClosed (order);
-        if (timespec_equal (&ts, &ts_zero))
-        {
-            gnc_date_edit_set_time (GNC_DATE_EDIT (ow->closed_date),
-                                    gnc_time (NULL));
-            hide_cd = TRUE;
-        }
-        else
-        {
-            gnc_date_edit_set_time_ts (GNC_DATE_EDIT (ow->closed_date), ts);
-        }
-
-        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ow->active_check),
-                                      gncOrderGetActive (order));
-
-    }
-
-    gnc_gui_component_watch_entity_type (ow->component_id,
-                                         GNC_ORDER_MODULE_NAME,
-                                         QOF_EVENT_MODIFY | QOF_EVENT_DESTROY);
-
-    gnc_table_refresh_gui (gnc_entry_ledger_get_table (ow->ledger), TRUE);
-
-    if (hide_cd)
-    {
-        gtk_widget_hide (ow->closed_date);
-        gtk_widget_hide (ow->cd_label);
-        gtk_widget_hide (ow->hide1);
-        gtk_widget_hide (ow->hide2);
-    }
-
-    if (ow->dialog_type == VIEW_ORDER)
-    {
-        /* Setup viewer for read-only access */
-        gtk_widget_set_sensitive (ow->id_entry, FALSE);
-        gtk_widget_set_sensitive (ow->opened_date, FALSE);
-        gtk_widget_set_sensitive (ow->closed_date, FALSE);
-        gtk_widget_set_sensitive (ow->notes_text, FALSE); /* XXX: Should notes remain writable? */
-
-        /* Hide the 'close order' button */
-        gtk_widget_hide (ow->close_order_button);
-    }
-}
-
-static gboolean
-find_handler (gpointer find_data, gpointer user_data)
-{
-    const GncGUID *order_guid = find_data;
-    OrderWindow *ow = user_data;
-
-    return(ow && guid_equal(&ow->order_guid, order_guid));
-}
-
-static OrderWindow *
-gnc_order_new_window (QofBook *bookp, OrderDialogType type,
-                      GncOrder *order, GncOwner *owner)
-{
-    OrderWindow *ow;
-    GtkBuilder *builder;
-    GtkWidget *vbox, *regWidget, *hbox, *date;
-    GncEntryLedger *entry_ledger = NULL;
-    const char * class_name;
-
-    switch (type)
-    {
-    case EDIT_ORDER:
-        class_name = DIALOG_EDIT_ORDER_CM_CLASS;
-        break;
-    case VIEW_ORDER:
-    default:
-        class_name = DIALOG_VIEW_ORDER_CM_CLASS;
-        break;
-    }
-
-    /*
-     * Find an existing window for this order.  If found, bring it to
-     * the front.
-     */
-    if (order)
-    {
-        GncGUID order_guid;
-
-        order_guid = *gncOrderGetGUID(order);
-        ow = gnc_find_first_gui_component (class_name, find_handler,
-                                           &order_guid);
-        if (ow)
-        {
-            gtk_window_present (GTK_WINDOW(ow->dialog));
-            return(ow);
-        }
-    }
-
-    /*
-     * No existing order window found.  Build a new one.
-     */
-    ow = g_new0 (OrderWindow, 1);
-    ow->book = bookp;
-    ow->dialog_type = type;
-
-    /* Save this for later */
-    gncOwnerCopy (owner, &(ow->owner));
-
-    /* Find the dialog */
-    builder = gtk_builder_new();
-    gnc_builder_add_from_file (builder, "dialog-order.glade", "order_entry_dialog");
-    ow->dialog = GTK_WIDGET(gtk_builder_get_object (builder, "order_entry_dialog"));
-
-    // Set the style context for this dialog so it can be easily manipulated with css
-    gnc_widget_set_style_context (GTK_WIDGET(ow->dialog), "GncOrderDialog");
-
-    /* Grab the widgets */
-    ow->id_entry = GTK_WIDGET(gtk_builder_get_object (builder, "id_entry"));
-    ow->ref_entry = GTK_WIDGET(gtk_builder_get_object (builder, "ref_entry"));
-    ow->notes_text = GTK_WIDGET(gtk_builder_get_object (builder, "notes_text"));
-    ow->active_check = GTK_WIDGET(gtk_builder_get_object (builder, "active_check"));
-    ow->owner_box = GTK_WIDGET(gtk_builder_get_object (builder, "owner_hbox"));
-    ow->owner_label = GTK_WIDGET(gtk_builder_get_object (builder, "owner_label"));
-
-    ow->cd_label = GTK_WIDGET(gtk_builder_get_object (builder, "cd_label"));
-    ow->hide1 = GTK_WIDGET(gtk_builder_get_object (builder, "hide1"));
-    ow->hide2 = GTK_WIDGET(gtk_builder_get_object (builder, "hide2"));
-    ow->close_order_button = GTK_WIDGET(gtk_builder_get_object (builder, "close_order_button"));
-
-
-    /* Setup Date Widgets */
-    hbox = GTK_WIDGET(gtk_builder_get_object (builder, "opened_date_hbox"));
-    date = gnc_date_edit_new (time (NULL), FALSE, FALSE);
-    gtk_box_pack_start (GTK_BOX (hbox), date, TRUE, TRUE, 0);
-    gtk_widget_show (date);
-    ow->opened_date = date;
-
-    hbox = GTK_WIDGET(gtk_builder_get_object (builder, "closed_date_hbox"));
-    date = gnc_date_edit_new (time (NULL), FALSE, FALSE);
-    gtk_box_pack_start (GTK_BOX (hbox), date, TRUE, TRUE, 0);
-    gtk_widget_show (date);
-    ow->closed_date = date;
-
-    /* Build the ledger */
-    switch (type)
-    {
-    case EDIT_ORDER:
-        entry_ledger = gnc_entry_ledger_new (ow->book, GNCENTRY_ORDER_ENTRY);
-        break;
-    case VIEW_ORDER:
-    default:
-        entry_ledger = gnc_entry_ledger_new (ow->book, GNCENTRY_ORDER_VIEWER);
-        break;
-    }
-
-    /* Save the entry ledger for later */
-    ow->ledger = entry_ledger;
-
-    /* Set the order for the entry_ledger */
-    gnc_entry_ledger_set_default_order (entry_ledger, order);
-
-    /* Set watches on entries */
-    //  entries = gncOrderGetEntries (order);
-    //  gnc_entry_ledger_load (entry_ledger, entries);
-
-    /* Watch the order of operations, here... */
-    regWidget = gnucash_register_new (gnc_entry_ledger_get_table (entry_ledger),
-                                      NULL);
-    ow->reg = GNUCASH_REGISTER (regWidget);
-    gnucash_sheet_set_window (gnucash_register_get_sheet (ow->reg), ow->dialog);
-    gnc_entry_ledger_set_parent (entry_ledger, ow->dialog);
-
-    vbox = GTK_WIDGET(gtk_builder_get_object (builder, "ledger_vbox"));
-    // gtk_box_pack_start (GTK_BOX(vbox), toolbar, FALSE, FALSE, 2);
-    gtk_box_pack_start (GTK_BOX(vbox), regWidget, TRUE, TRUE, 2);
-
-    /* Setup signals */
-    gtk_builder_connect_signals_full (builder, gnc_builder_connect_full_func, ow);
-
-    /* Setup initial values */
-    ow->order_guid = *gncOrderGetGUID (order);
-
-    gtk_entry_set_text (GTK_ENTRY (ow->id_entry), gncOrderGetID (order));
-
-    ow->component_id =
-        gnc_register_gui_component (class_name,
-                                    gnc_order_window_refresh_handler,
-                                    gnc_order_window_close_handler,
-                                    ow);
-
-    gnc_table_realize_gui (gnc_entry_ledger_get_table (entry_ledger));
-
-    /* Now fill in a lot of the pieces and display properly */
-    gnc_order_update_window (ow);
-
-    /* Maybe set the reference */
-    gnc_order_owner_changed_cb (ow->owner_choice, ow);
-
-    g_object_unref(G_OBJECT(builder));
-
-    return ow;
-}
-
-static OrderWindow *
-gnc_order_window_new_order (QofBook *bookp, GncOwner *owner)
-{
-    OrderWindow *ow;
-    GtkBuilder *builder;
-    GncOrder *order;
-    gchar *string;
-    GtkWidget *hbox, *date;
-
-    ow = g_new0 (OrderWindow, 1);
-    ow->book = bookp;
-    ow->dialog_type = NEW_ORDER;
-
-    order = gncOrderCreate (bookp);
-    gncOrderSetOwner (order, owner);
-
-    /* Save this for later */
-    gncOwnerCopy (owner, &(ow->owner));
-
-    /* Find the dialog */
-    builder = gtk_builder_new();
-    gnc_builder_add_from_file (builder, "dialog-order.glade", "new_order_dialog");
-
-    ow->dialog = GTK_WIDGET(gtk_builder_get_object (builder, "new_order_dialog"));
-
-    // Set the style context for this dialog so it can be easily manipulated with css
-    gnc_widget_set_style_context (GTK_WIDGET(ow->dialog), "GncOrderDialog");
-
-    g_object_set_data (G_OBJECT (ow->dialog), "dialog_info", ow);
-
-    /* Grab the widgets */
-    ow->id_entry = GTK_WIDGET(gtk_builder_get_object (builder, "entry_id"));
-    ow->ref_entry = GTK_WIDGET(gtk_builder_get_object (builder, "entry_ref"));
-    ow->notes_text = GTK_WIDGET(gtk_builder_get_object (builder, "text_notes"));
-    ow->owner_box = GTK_WIDGET(gtk_builder_get_object (builder, "bill_owner_hbox"));
-    ow->owner_label = GTK_WIDGET(gtk_builder_get_object (builder, "bill_owner_label"));
-
-    /* Setup date Widget */
-    hbox = GTK_WIDGET(gtk_builder_get_object (builder, "date_opened_hbox"));
-    date = gnc_date_edit_new (time (NULL), FALSE, FALSE);
-    gtk_box_pack_start (GTK_BOX (hbox), date, TRUE, TRUE, 0);
-    gtk_widget_show (date);
-    ow->opened_date = date;
-
-    /* Setup signals */
-    gtk_builder_connect_signals_full (builder, gnc_builder_connect_full_func, ow);
-
-    /* Setup initial values */
-    ow->order_guid = *gncOrderGetGUID (order);
-    string = gncOrderNextID(bookp);
-    gtk_entry_set_text (GTK_ENTRY (ow->id_entry), string);
-    g_free(string);
-
-    ow->component_id =
-        gnc_register_gui_component (DIALOG_NEW_ORDER_CM_CLASS,
-                                    gnc_order_window_refresh_handler,
-                                    gnc_order_window_close_handler,
-                                    ow);
-
-    /* Now fill in a lot of the pieces and display properly */
-    gnc_order_update_window (ow);
-
-    // The customer choice widget should have keyboard focus
-    if (GNC_IS_GENERAL_SEARCH(ow->owner_choice))
-    {
-        gnc_general_search_grab_focus(GNC_GENERAL_SEARCH(ow->owner_choice));
-    }
-
-    /* Maybe set the reference */
-    gnc_order_owner_changed_cb (ow->owner_choice, ow);
-
-    g_object_unref(G_OBJECT(builder));
-
-    return ow;
-}
-
-OrderWindow *
-gnc_ui_order_edit (GncOrder *order)
-{
-    OrderWindow *ow;
-    OrderDialogType type;
-
-    if (!order) return NULL;
-
-    type = EDIT_ORDER;
-    {
-        Timespec ts = gncOrderGetDateClosed (order);
-        if (ts.tv_sec || ts.tv_nsec)
-            type = VIEW_ORDER;
-    }
-
-    ow = gnc_order_new_window (gncOrderGetBook(order), type, order,
-                               gncOrderGetOwner (order));
-
-    return ow;
-}
-
-OrderWindow *
-gnc_ui_order_new (GncOwner *ownerp, QofBook *bookp)
-{
-    OrderWindow *ow;
-    GncOwner owner;
-
-    if (ownerp)
-    {
-        switch (gncOwnerGetType (ownerp))
-        {
-        case GNC_OWNER_CUSTOMER:
-        case GNC_OWNER_VENDOR:
-        case GNC_OWNER_JOB:
-            gncOwnerCopy (ownerp, &owner);
-            break;
-        default:
-            g_warning ("Cannot deal with unknown Owner types");
-            /* XXX: popup a warning? */
-            return NULL;
-        }
-    }
-    else
-        gncOwnerInitJob (&owner, NULL); /* XXX: pass in the owner type? */
-
-    /* Make sure required options exist */
-    if (!bookp) return NULL;
-
-    ow = gnc_order_window_new_order (bookp, &owner);
-
-    return ow;
-}
-
-/* Functions for order selection widgets */
-
-static void
-edit_order_cb (gpointer *order_p, gpointer user_data)
-{
-    GncOrder *order;
-
-    g_return_if_fail (order_p && user_data);
-
-    order = *order_p;
-
-    if (order)
-        gnc_ui_order_edit (order);
-
-    return;
-}
-
-static gpointer
-new_order_cb (gpointer user_data)
-{
-    struct _order_select_window *sw = user_data;
-    OrderWindow *ow;
-
-    g_return_val_if_fail (user_data, NULL);
-
-    ow = gnc_ui_order_new (sw->owner, sw->book);
-    return ow_get_order (ow);
-}
-
-static void
-free_order_cb (gpointer user_data)
-{
-    struct _order_select_window *sw = user_data;
-
-    g_return_if_fail (sw);
-
-    qof_query_destroy (sw->q);
-    g_free (sw);
-}
-
-GNCSearchWindow *
-gnc_order_search (GncOrder *start, GncOwner *owner, QofBook *book)
-{
-    QofIdType type = GNC_ORDER_MODULE_NAME;
-    struct _order_select_window *sw;
-    QofQuery *q, *q2 = NULL;
-    static GList *params = NULL;
-    static GList *columns = NULL;
-    static GNCSearchCallbackButton buttons[] =
-    {
-        { N_("View/Edit Order"), edit_order_cb, NULL, TRUE},
-        { NULL },
-    };
-
-    g_return_val_if_fail (book, NULL);
-
-    /* Build parameter list in reverse order */
-    if (params == NULL)
-    {
-        params = gnc_search_param_prepend (params, _("Order Notes"), NULL, type,
-                                           ORDER_NOTES, NULL);
-        params = gnc_search_param_prepend (params, _("Date Closed"), NULL, type,
-                                           ORDER_CLOSED, NULL);
-        params = gnc_search_param_prepend (params, _("Is Closed?"), NULL, type,
-                                           ORDER_IS_CLOSED, NULL);
-        params = gnc_search_param_prepend (params, _("Date Opened"), NULL, type,
-                                           ORDER_OPENED, NULL);
-        params = gnc_search_param_prepend (params, _("Owner Name "), NULL, type,
-                                           ORDER_OWNER, OWNER_NAME, NULL);
-        params = gnc_search_param_prepend (params, _("Order ID"), NULL, type,
-                                           ORDER_ID, NULL);
-    }
-
-    /* Build the column list in reverse order */
-    if (columns == NULL)
-    {
-        columns = gnc_search_param_prepend (columns, _("Billing ID"), NULL, type,
-                                            ORDER_REFERENCE, NULL);
-        columns = gnc_search_param_prepend (columns, _("Company"), NULL, type,
-                                            ORDER_OWNER, OWNER_PARENT,
-                                            OWNER_NAME, NULL);
-        columns = gnc_search_param_prepend (columns, _("Closed"), NULL, type,
-                                            ORDER_CLOSED, NULL);
-        columns = gnc_search_param_prepend (columns, _("Opened"), NULL, type,
-                                            ORDER_OPENED, NULL);
-        columns = gnc_search_param_prepend (columns, _("Num"), NULL, type,
-                                            ORDER_ID, NULL);
-    }
-
-    /* Build the queries */
-    q = qof_query_create_for (type);
-    qof_query_set_book (q, book);
-
-    /* If owner is supplied, limit all searches to orders who's owner
-     * (or parent) is the supplied owner!
-     */
-    if (owner && gncOwnerGetGUID (owner))
-    {
-        QofQuery *tmp, *q3;
-
-        q3 = qof_query_create_for (type);
-        qof_query_add_guid_match (q3, g_slist_prepend
-                                  (g_slist_prepend (NULL, QOF_PARAM_GUID),
-                                   ORDER_OWNER),
-                                  gncOwnerGetGUID (owner), QOF_QUERY_OR);
-        qof_query_add_guid_match (q3, g_slist_prepend
-                                  (g_slist_prepend (NULL, OWNER_PARENTG),
-                                   ORDER_OWNER),
-                                  gncOwnerGetGUID (owner), QOF_QUERY_OR);
-
-        tmp = qof_query_merge (q, q3, QOF_QUERY_AND);
-        qof_query_destroy (q);
-        qof_query_destroy (q3);
-        q = tmp;
-        q2 = qof_query_copy (q);
-    }
-
-#if 0
-    if (start)
-    {
-        if (q2 == NULL)
-            q2 = qof_query_copy (q);
-
-        qof_query_add_guid_match (q2, g_slist_prepend (NULL, QOF_PARAM_GUID),
-                                  gncOrderGetGUID (start), QOF_QUERY_AND);
-    }
-#endif
-
-    /* launch select dialog and return the result */
-    sw = g_new0 (struct _order_select_window, 1);
-
-    if (owner)
-    {
-        gncOwnerCopy (owner, &(sw->owner_def));
-        sw->owner = &(sw->owner_def);
-    }
-    sw->book = book;
-    sw->q = q;
-
-    return gnc_search_dialog_create (type, _("Find Order"),
-                                     params, columns, q, q2,
-                                     buttons, NULL, new_order_cb,
-                                     sw, free_order_cb, GNC_PREFS_GROUP_SEARCH,
-                                     NULL, "GncFindOrderDialog");
-}
-
-GNCSearchWindow *
-gnc_order_search_select (gpointer start, gpointer book)
-{
-    GncOrder *o = start;
-    GncOwner owner, *ownerp;
-
-    if (!book) return NULL;
-
-    if (o)
-    {
-        ownerp = gncOrderGetOwner (o);
-        gncOwnerCopy (ownerp, &owner);
-    }
-    else
-        gncOwnerInitCustomer (&owner, NULL); /* XXX */
-
-    return gnc_order_search (start, NULL, book);
-}
-
-GNCSearchWindow *
-gnc_order_search_edit (gpointer start, gpointer book)
-{
-    if (start)
-        gnc_ui_order_edit (start);
-
-    return NULL;
-}
diff --git a/src/gnome/dialog-payment.c b/src/gnome/dialog-payment.c
deleted file mode 100644
index c05ed3d..0000000
--- a/src/gnome/dialog-payment.c
+++ /dev/null
@@ -1,1256 +0,0 @@
-/*
- * dialog-payment.c -- Dialog for payment entry
- * Copyright (C) 2002,2006 Derek Atkins
- * Author: Derek Atkins <warlord at MIT.EDU>
- * Copyright (c) 2006 David Hampton <hampton at employees.org>
- *
- * 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 at gnu.org
- */
-
-#include "config.h"
-
-#include <gtk/gtk.h>
-#include <glib/gi18n.h>
-
-#include "dialog-utils.h"
-#include "gnc-component-manager.h"
-#include "gnc-ui.h"
-#include "gnc-gui-query.h"
-#include "gnc-ui-util.h"
-#include "qof.h"
-#include "gnc-date.h"
-#include "gnc-date-edit.h"
-#include "gnc-amount-edit.h"
-#include "gnc-gtk-utils.h"
-#include "gnc-prefs.h"
-#include "gnc-tree-view-account.h"
-#include "tree-view-utils.h"
-#include "Transaction.h"
-#include "Account.h"
-#include "gncOwner.h"
-#include "engine-helpers.h"
-
-#include "gncInvoice.h"
-
-#include "dialog-payment.h"
-#include "business-gnome-utils.h"
-
-#include "dialog-transfer.h"
-#include "dialog-print-check.h"
-#include "gnome-search/gnc-general-search.h"
-
-#define DIALOG_PAYMENT_CUSTOMER_CM_CLASS "customer-payment-dialog"
-#define DIALOG_PAYMENT_VENDOR_CM_CLASS "vendor-payment-dialog"
-
-struct _payment_window
-{
-    GtkWidget   * dialog;
-
-    GtkWidget   * payment_warning;
-    GtkWidget   * ok_button;
-    GtkWidget   * num_entry;
-    GtkWidget   * memo_entry;
-    GtkWidget   * post_combo;
-    GtkWidget   * owner_choice;
-    GtkWidget   * amount_debit_edit;
-    GtkWidget   * amount_credit_edit;
-    GtkWidget   * date_edit;
-    GtkWidget   * acct_tree;
-    GtkWidget   * docs_list_tree_view;
-    GtkWidget   * commodity_label;
-    GtkWidget   * print_check;
-
-    gint          component_id;
-    QofBook     * book;
-    GncOwner      owner;
-    GncInvoice  * invoice;
-    Account     * post_acct;
-    Account     * xfer_acct;
-    gnc_numeric   amount_tot;
-    GList       * acct_types;
-    GList       * acct_commodities;
-
-    Transaction * pre_existing_txn;
-    gboolean      print_check_state;
-};
-
-void gnc_ui_payment_window_set_num (PaymentWindow *pw, const char* num)
-{
-    g_assert(pw);
-    gtk_entry_set_text(GTK_ENTRY (pw->num_entry), num);
-}
-void gnc_ui_payment_window_set_memo (PaymentWindow *pw, const char* memo)
-{
-    g_assert(pw);
-    gtk_entry_set_text(GTK_ENTRY (pw->memo_entry), memo);
-}
-void gnc_ui_payment_window_set_date (PaymentWindow *pw, const GDate *date)
-{
-    g_assert(pw);
-    g_assert(date);
-    gnc_date_edit_set_gdate (GNC_DATE_EDIT (pw->date_edit), date);
-}
-void gnc_ui_payment_window_set_amount (PaymentWindow *pw, gnc_numeric amount)
-{
-    g_assert(pw);
-
-    /* Debits are negative, credits are positive */
-    if (gnc_numeric_positive_p (amount))
-    {
-        gnc_amount_edit_set_amount (GNC_AMOUNT_EDIT(pw->amount_credit_edit),
-                                    amount);
-        gnc_amount_edit_set_amount (GNC_AMOUNT_EDIT(pw->amount_debit_edit),
-                                    gnc_numeric_zero ());
-    }
-    else
-    {
-        gnc_amount_edit_set_amount (GNC_AMOUNT_EDIT(pw->amount_debit_edit),
-                                    gnc_numeric_neg (amount));
-        gnc_amount_edit_set_amount (GNC_AMOUNT_EDIT(pw->amount_credit_edit),
-                                    gnc_numeric_zero ());
-    }
-
-}
-
-static void gnc_ui_payment_window_set_commodity (PaymentWindow *pw, const Account* account)
-{
-    gchar *comm_string;
-    gnc_commodity *comm;
-
-    g_assert(pw);
-    g_assert(account);
-
-    comm = xaccAccountGetCommodity (account);
-    comm_string = g_strconcat ("(", gnc_commodity_get_nice_symbol (comm), ")", NULL);
-    gtk_label_set_text (GTK_LABEL(pw->commodity_label), comm_string);
-    g_free (comm_string);
-}
-
-void gnc_ui_payment_window_set_postaccount (PaymentWindow *pw, const Account* account)
-{
-    g_assert(pw);
-    g_assert(account);
-    {
-        gchar *acct_string = gnc_account_get_full_name (account);
-        gnc_cbwe_set_by_string(GTK_COMBO_BOX(pw->post_combo), acct_string);
-        g_free(acct_string);
-    }
-
-    gnc_ui_payment_window_set_commodity (pw, account);
-}
-
-void gnc_ui_payment_window_set_xferaccount (PaymentWindow *pw, const Account* account)
-{
-    g_assert(pw);
-    g_assert(account);
-    gnc_tree_view_account_set_selected_account(GNC_TREE_VIEW_ACCOUNT(pw->acct_tree),
-            (Account*)account);
-}
-
-static gboolean gnc_payment_dialog_has_pre_existing_txn(const PaymentWindow* pw)
-{
-    return pw->pre_existing_txn != NULL;
-}
-int  gnc_payment_dialog_post_to_changed_cb (GtkWidget *widget, gpointer data);
-void gnc_payment_dialog_document_selection_changed_cb (GtkWidget *widget, gpointer data);
-void gnc_payment_dialog_xfer_acct_changed_cb (GtkWidget *widget, gpointer data);
-void gnc_payment_ok_cb (GtkWidget *widget, gpointer data);
-void gnc_payment_cancel_cb (GtkWidget *widget, gpointer data);
-void gnc_payment_window_destroy_cb (GtkWidget *widget, gpointer data);
-void gnc_payment_acct_tree_row_activated_cb (GtkWidget *widget, GtkTreePath *path,
-        GtkTreeViewColumn *column, PaymentWindow *pw);
-void gnc_payment_leave_amount_cb (GtkWidget *widget, GdkEventFocus *event,
-                                  PaymentWindow *pw);
-void gnc_payment_window_fill_docs_list (PaymentWindow *pw);
-
-
-static void
-gnc_payment_window_refresh_handler (GHashTable *changes, gpointer data)
-{
-    PaymentWindow *pw = data;
-
-    gnc_payment_window_fill_docs_list (pw);
-    pw->post_acct = gnc_account_select_combo_fill (pw->post_combo, pw->book, pw->acct_types, pw->acct_commodities);
-}
-
-static gboolean
-gnc_payment_window_check_payment (PaymentWindow *pw)
-{
-    const char *conflict_msg = NULL;
-    gnc_numeric amount_deb, amount_cred;
-    gboolean enable_xfer_acct = TRUE;
-
-    if (!pw)
-        return FALSE;
-
-    /* Verify the "post" account */
-    if (!pw->post_acct)
-    {
-        conflict_msg = _("You must enter a valid account name for posting.");
-        goto update_cleanup;
-    }
-
-    /* Verify the user has selected an owner */
-    gnc_owner_get_owner (pw->owner_choice, &(pw->owner));
-    if (!gncOwnerIsValid(&pw->owner))
-    {
-        conflict_msg = _("You must select a company for payment processing.");
-        goto update_cleanup;
-    }
-
-    /* Test the total amount */
-    amount_deb  = gnc_amount_edit_get_amount (GNC_AMOUNT_EDIT (pw->amount_debit_edit));
-    amount_cred = gnc_amount_edit_get_amount (GNC_AMOUNT_EDIT (pw->amount_credit_edit));
-    pw->amount_tot = gnc_numeric_sub (amount_cred, amount_deb,
-                                      gnc_commodity_get_fraction (xaccAccountGetCommodity (pw->post_acct)),
-                                      GNC_HOW_RND_ROUND_HALF_UP);
-
-    if (gnc_numeric_check (pw->amount_tot) || gnc_numeric_zero_p (pw->amount_tot))
-    {
-        enable_xfer_acct = FALSE;
-    }
-    else
-    {
-        /* Verify the user has selected a transfer account */
-        pw->xfer_acct = gnc_tree_view_account_get_selected_account (GNC_TREE_VIEW_ACCOUNT(pw->acct_tree));
-        if (!pw->xfer_acct)
-        {
-            conflict_msg = _("You must select a transfer account from the account tree.");
-        }
-    }
-
-update_cleanup:
-    gtk_widget_set_sensitive (pw->acct_tree, enable_xfer_acct);
-
-    /* Disable "Print Check" widget if amount is zero but save current
-       state to restore when the widget is re-enabled */
-    if (gtk_widget_is_sensitive (pw->print_check))
-        pw->print_check_state = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(pw->print_check));
-    if (!enable_xfer_acct)
-        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(pw->print_check), FALSE);
-    gtk_widget_set_sensitive (pw->print_check, enable_xfer_acct);
-    if (gtk_widget_is_sensitive (pw->print_check))
-        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(pw->print_check), pw->print_check_state);
-
-    /* Check if there are issues preventing a successful payment */
-    gtk_widget_set_tooltip_text (pw->payment_warning, conflict_msg);
-    if (conflict_msg)
-    {
-        gtk_widget_show (pw->payment_warning);
-        gtk_widget_set_sensitive (pw->ok_button, FALSE);
-        return FALSE;
-    }
-    else
-    {
-        gtk_widget_hide (pw->payment_warning);
-        gtk_widget_set_sensitive (pw->ok_button, TRUE);
-    }
-
-    return TRUE;
-}
-
-static void
-gnc_payment_window_close_handler (gpointer data)
-{
-    PaymentWindow *pw = data;
-
-    if (pw)
-        gtk_widget_destroy (pw->dialog);
-}
-
-static void
-calculate_selected_total_helper (GtkTreeModel *model,
-                                 GtkTreePath *path,
-                                 GtkTreeIter *iter,
-                                 gpointer data)
-{
-    gnc_numeric *subtotal = (gnc_numeric*) data;
-    gnc_numeric cur_val;
-    GValue value = { 0 };
-    GNCLot *lot;
-    Account *acct;
-    gnc_commodity *currency;
-
-    gtk_tree_model_get_value (model, iter, 5, &value);
-    lot = (GNCLot *) g_value_get_pointer (&value);
-    g_value_unset (&value);
-
-    /* Find the amount's currency to determine the required precision */
-    acct = gnc_lot_get_account (lot);
-    currency = xaccAccountGetCommodity (acct);
-
-    cur_val = gnc_lot_get_balance (lot);
-    *subtotal = gnc_numeric_add (*subtotal, cur_val,
-                                 gnc_commodity_get_fraction (currency), GNC_HOW_RND_ROUND_HALF_UP);
-}
-
-static gnc_numeric
-gnc_payment_dialog_calculate_selected_total (PaymentWindow *pw)
-{
-    GtkTreeSelection *selection;
-    gnc_numeric val = gnc_numeric_zero();
-
-    if (!pw->docs_list_tree_view || !GTK_IS_TREE_VIEW(pw->docs_list_tree_view))
-        return gnc_numeric_zero();
-
-    /* Figure out if anything is set in the current list */
-    selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(pw->docs_list_tree_view));
-
-    gtk_tree_selection_selected_foreach (selection,
-                                         calculate_selected_total_helper,
-                                         (gpointer) &val);
-
-    return val;
-}
-
-static void
-gnc_payment_dialog_document_selection_changed (PaymentWindow *pw)
-{
-    gnc_numeric val;
-
-    /* Don't change the amount based on the selected documents
-     * in case this payment is from a pre-existing txn
-     */
-    if (gnc_payment_dialog_has_pre_existing_txn (pw))
-        return;
-
-    /* Set the payment amount in the dialog */
-    val = gnc_payment_dialog_calculate_selected_total (pw);
-    gnc_ui_payment_window_set_amount(pw, val);
-}
-
-static void
-gnc_payment_dialog_highlight_document (PaymentWindow *pw)
-{
-    if (pw->invoice)
-    {
-        GtkTreeIter iter;
-        GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(pw->docs_list_tree_view));
-        GtkTreeSelection *selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(pw->docs_list_tree_view));
-        gtk_tree_selection_unselect_all (selection);
-
-        if (gtk_tree_model_get_iter_first (model, &iter))
-        {
-            do
-            {
-                GValue value = { 0 };
-                GNCLot *lot;
-                GncInvoice *invoice;
-
-                gtk_tree_model_get_value (model, &iter, 5, &value);
-                lot = (GNCLot *) g_value_get_pointer (&value);
-                g_value_unset (&value);
-
-                if (!lot)
-                    continue; /* Lot has been deleted behind our back... */
-
-                invoice = gncInvoiceGetInvoiceFromLot (lot);
-                if (!invoice)
-                    continue;
-
-                if (pw->invoice == invoice)
-                {
-                    gtk_tree_selection_select_iter (selection, &iter);
-                    gnc_payment_dialog_document_selection_changed (pw);
-                }
-            }
-            while (gtk_tree_model_iter_next (model, &iter));
-        }
-    }
-}
-
-void
-gnc_payment_window_fill_docs_list (PaymentWindow *pw)
-{
-    GtkListStore *store;
-    GtkTreeSelection *selection;
-    GList *list = NULL, *node;
-
-    g_return_if_fail (pw->docs_list_tree_view && GTK_IS_TREE_VIEW(pw->docs_list_tree_view));
-
-    /* Get a list of open lots for this owner and post account */
-    if (pw->owner.owner.undefined)
-        list = xaccAccountFindOpenLots (pw->post_acct, gncOwnerLotMatchOwnerFunc,
-                                        &pw->owner, NULL);
-
-    /* Clear the existing list */
-    selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(pw->docs_list_tree_view));
-    gtk_tree_selection_unselect_all (selection);
-    store = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(pw->docs_list_tree_view)));
-    gtk_list_store_clear(store);
-
-    /* Add the documents and overpayments to the tree view */
-    for (node = list; node; node = node->next)
-    {
-        GNCLot *lot = node->data;
-        time64 doc_date_time = 0;
-        const gchar *doc_type_str = NULL;
-        const gchar *doc_id_str   = NULL;
-        const gchar *doc_deb_str  = NULL;
-        const gchar *doc_cred_str = NULL;
-        GtkTreeIter iter;
-        Timespec doc_date;
-        GncInvoice *document;
-        gnc_numeric value = gnc_numeric_zero();
-        gnc_numeric debit = gnc_numeric_zero();
-        gnc_numeric credit = gnc_numeric_zero();
-
-        /* Find the lot's document if it exists,
-         * it could also be a prepayment lot. */
-        document = gncInvoiceGetInvoiceFromLot (lot);
-
-        /* Find the document's date or pre-payment date */
-        if (document)
-            doc_date = gncInvoiceGetDatePosted (document);
-        else
-        {
-            /* Calculate the payment date based on the lot splits */
-            Transaction *trans = xaccSplitGetParent (gnc_lot_get_latest_split (lot));
-            if (trans)
-                doc_date = xaccTransRetDatePostedTS (trans);
-            else
-                continue; /* No valid split in this lot, skip it */
-        }
-        doc_date_time = timespecToTime64 (doc_date);
-
-        /* Find the document type. No type means pre-payment in this case */
-        if (document)
-        {
-            doc_type_str = gncInvoiceGetTypeString (document);
-        }
-        else
-            doc_type_str = _("Pre-Payment");
-
-        /* Find the document id. Empty for pre-payments. */
-        if (document)
-        {
-            doc_id_str = gncInvoiceGetID (document);
-        }
-
-        /* Find the debit/credit amount.
-         * Invoices/vendor credit notes are debit (increasing the balance)
-         * Customer credit notes/bills are credit (decreasing the balance)
-         * Pre-payments are debit or credit depending on their sign
-         */
-        value = gnc_lot_get_balance (lot);
-
-        if (gnc_numeric_positive_p (value))
-            debit = value;
-        else
-            credit = gnc_numeric_neg (value);
-
-        /* Only display non-zero debits/credits */
-        if (!gnc_numeric_zero_p (debit))
-            doc_deb_str = xaccPrintAmount (debit, gnc_default_print_info (FALSE));
-        if (!gnc_numeric_zero_p (credit))
-            doc_cred_str = xaccPrintAmount (credit, gnc_default_print_info (FALSE));
-
-        gtk_list_store_append (store, &iter);
-        gtk_list_store_set (store, &iter,
-                            0, doc_date_time,
-                            1, doc_id_str,
-                            2, doc_type_str,
-                            3, doc_deb_str,
-                            4, doc_cred_str,
-                            5, (gpointer)lot,
-                            -1);
-
-    }
-
-    g_list_free (list);
-
-    /* Highlight the preset invoice if it's in the new list */
-    gnc_payment_dialog_highlight_document (pw);
-}
-
-static void
-gnc_payment_dialog_owner_changed (PaymentWindow *pw)
-{
-    Account *last_acct = NULL;
-    GncGUID *guid = NULL;
-    GncOwner *owner = &pw->owner;
-
-    /* If the owner changed, the initial invoice is no longer valid */
-    pw->invoice = NULL;
-
-    /* Now handle the account tree */
-    if (gncOwnerIsValid(owner))
-        qof_instance_get (qofOwnerGetOwner (owner),
-                          "payment-last-account", &guid,
-                          NULL);
-
-    /* refresh the post and acc available accounts, but cleanup first */
-    if (pw->acct_types)
-    {
-        g_list_free(pw->acct_types);
-        pw->acct_types = NULL;
-    }
-
-    if (pw->acct_commodities)
-    {
-        g_list_free(pw->acct_commodities);
-        pw->acct_commodities = NULL;
-    }
-
-    pw->acct_types = gncOwnerGetAccountTypesList(owner);
-    if (gncOwnerIsValid(owner))
-        pw->acct_commodities = gncOwnerGetCommoditiesList (owner);
-    pw->post_acct = gnc_account_select_combo_fill (pw->post_combo, pw->book, pw->acct_types, pw->acct_commodities);
-
-    if (pw->post_acct)
-        gnc_ui_payment_window_set_commodity (pw, pw->post_acct);
-
-
-    /* Update list of documents and pre-payments */
-    gnc_payment_window_fill_docs_list (pw);
-
-    if (guid)
-    {
-        last_acct = xaccAccountLookup(guid, pw->book);
-    }
-
-    /* Set the last-used transfer account, but only if we didn't
-     * create this dialog from a pre-existing transaction. */
-    if (last_acct && !gnc_payment_dialog_has_pre_existing_txn(pw))
-    {
-        gnc_tree_view_account_set_selected_account(GNC_TREE_VIEW_ACCOUNT(pw->acct_tree),
-                last_acct);
-    }
-}
-
-static void
-gnc_payment_dialog_post_to_changed (PaymentWindow *pw)
-{
-    gnc_payment_window_fill_docs_list (pw);
-}
-
-static void
-gnc_payment_dialog_remember_account (PaymentWindow *pw, Account *acc)
-{
-     QofInstance *owner = qofOwnerGetOwner (&pw->owner);
-    const GncGUID *guid;
-
-    if (!acc) return;
-
-    guid = xaccAccountGetGUID(acc);
-    qof_begin_edit (owner);
-    qof_instance_set (owner,
-		      "payment-last-account", guid,
-		      NULL);
-    qof_commit_edit (owner);
-}
-
-
-static void
-gnc_payment_set_owner (PaymentWindow *pw, GncOwner *owner)
-{
-    gnc_owner_set_owner (pw->owner_choice, owner);
-    gnc_payment_dialog_owner_changed(pw);
-}
-
-static int
-gnc_payment_dialog_owner_changed_cb (GtkWidget *widget, gpointer data)
-{
-    PaymentWindow *pw = data;
-    GncOwner owner;
-
-    if (!pw) return FALSE;
-
-    gncOwnerCopy (&(pw->owner), &owner);
-    gnc_owner_get_owner (pw->owner_choice, &owner);
-
-    /* If this owner really changed, then reset ourselves */
-    if (!gncOwnerEqual (&owner, &(pw->owner)))
-    {
-        gncOwnerCopy (&owner, &(pw->owner));
-        gnc_payment_dialog_owner_changed(pw);
-    }
-
-    /* Reflect if the payment could complete now */
-    gnc_payment_window_check_payment (pw);
-
-    return FALSE;
-}
-
-void
-gnc_payment_dialog_document_selection_changed_cb (GtkWidget *widget, gpointer data)
-{
-    PaymentWindow *pw = data;
-
-    if (!pw) return;
-
-    gnc_payment_dialog_document_selection_changed (pw);
-
-    /* Reflect if the payment could complete now */
-    gnc_payment_window_check_payment (pw);
-}
-
-void
-gnc_payment_dialog_xfer_acct_changed_cb (GtkWidget *widget, gpointer data)
-{
-    PaymentWindow *pw = data;
-
-    if (!pw) return;
-
-    /* Reflect if the payment could complete now */
-    gnc_payment_window_check_payment (pw);
-}
-
-int
-gnc_payment_dialog_post_to_changed_cb (GtkWidget *widget, gpointer data)
-{
-    PaymentWindow *pw = data;
-    Account *post_acct;
-
-    if (!pw) return FALSE;
-
-    post_acct = gnc_account_select_combo_get_active (pw->post_combo);
-
-    /* If this invoice really changed, then reset ourselves */
-    if (post_acct != pw->post_acct)
-    {
-        pw->post_acct = post_acct;
-        gnc_payment_dialog_post_to_changed(pw);
-    }
-    else
-        gnc_payment_dialog_highlight_document (pw);
-
-    /* Reflect if the payment could complete now */
-    gnc_payment_window_check_payment (pw);
-
-    return FALSE;
-}
-
-/*
- * This helper function is called once for each row in the tree view
- * that is currently selected.  Its task is to add the corresponding
- * lot to the end of a glist.
- */
-static void
-get_selected_lots (GtkTreeModel *model,
-                   GtkTreePath *path,
-                   GtkTreeIter *iter,
-                   gpointer data)
-{
-    GList **return_list = data;
-    GNCLot *lot;
-    GValue value = { 0 };
-
-    gtk_tree_model_get_value (model, iter, 5, &value);
-    lot = (GNCLot *) g_value_get_pointer (&value);
-    g_value_unset (&value);
-
-    if (lot)
-        *return_list = g_list_insert_sorted (*return_list, lot, (GCompareFunc)gncOwnerLotsSortFunc);
-}
-
-void
-gnc_payment_ok_cb (GtkWidget *widget, gpointer data)
-{
-    PaymentWindow *pw = data;
-    const char *text = NULL;
-
-    if (!pw)
-        return;
-
-    /* The gnc_payment_window_check_payment function
-     * ensures we have valid owner, post account, transfer account
-     * and amount so we can proceed with the payment.
-     * Note: make sure it's called before all entry points to this function !
-     */
-
-    /* We're on our way out, stop watching for object changes that could
-     * trigger a gui refresh. Without this the gui suspend/resume
-     * pair could still trigger a gui update on the payment dialog
-     * before we close it. This is undesired because the lots may be in
-     * an inconsistent state until after all events are handled. So
-     * the gui refresh may result in a crash.
-     * See https://bugzilla.gnome.org/show_bug.cgi?id=740471
-     */
-    gnc_gui_component_clear_watches (pw->component_id);
-
-    gnc_suspend_gui_refresh ();
-    {
-        const char *memo, *num;
-        GDate date;
-        Timespec ts;
-        gnc_numeric exch = gnc_numeric_create(1, 1); //default to "one to one" rate
-        GList *selected_lots = NULL;
-        GtkTreeSelection *selection;
-        gboolean auto_pay;
-
-        /* Obtain all our ancillary information */
-        memo = gtk_entry_get_text (GTK_ENTRY (pw->memo_entry));
-        num = gtk_entry_get_text (GTK_ENTRY (pw->num_entry));
-        g_date_clear (&date, 1);
-        gnc_date_edit_get_gdate (GNC_DATE_EDIT (pw->date_edit), &date);
-        ts = gdate_to_timespec (date);
-
-        /* Obtain the list of selected lots (documents/payments) from the dialog */
-        selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(pw->docs_list_tree_view));
-        gtk_tree_selection_selected_foreach (selection, get_selected_lots, &selected_lots);
-
-        /* When the payment amount is 0, the selected documents cancel each other out
-         * so no money is actually transferred.
-         * For non-zero payments money will be transferred between the post account
-         * and the transfer account. In that case if these two accounts don't have
-         * the same currency the user is asked to enter the exchange rate.
-         */
-        if (!gnc_numeric_zero_p (pw->amount_tot) &&
-            !gnc_commodity_equal(xaccAccountGetCommodity(pw->xfer_acct), xaccAccountGetCommodity(pw->post_acct)))
-        {
-            XferDialog* xfer;
-
-            text = _("The transfer and post accounts are associated with different currencies. Please specify the conversion rate.");
-
-            xfer = gnc_xfer_dialog(pw->dialog, pw->post_acct);
-            gnc_info_dialog(pw->dialog, "%s", text);
-
-            gnc_xfer_dialog_select_to_account(xfer, pw->xfer_acct);
-            gnc_xfer_dialog_set_amount(xfer, pw->amount_tot);
-
-            /* All we want is the exchange rate so prevent the user from thinking
-               it makes sense to mess with other stuff */
-            gnc_xfer_dialog_set_from_show_button_active(xfer, FALSE);
-            gnc_xfer_dialog_set_to_show_button_active(xfer, FALSE);
-            gnc_xfer_dialog_hide_from_account_tree(xfer);
-            gnc_xfer_dialog_hide_to_account_tree(xfer);
-            gnc_xfer_dialog_is_exchange_dialog(xfer, &exch);
-            gnc_xfer_dialog_run_until_done(xfer);
-        }
-
-        /* Perform the payment */
-        if (gncOwnerGetType (&(pw->owner)) == GNC_OWNER_CUSTOMER)
-            auto_pay = gnc_prefs_get_bool (GNC_PREFS_GROUP_INVOICE, GNC_PREF_AUTO_PAY);
-        else
-            auto_pay = gnc_prefs_get_bool (GNC_PREFS_GROUP_BILL, GNC_PREF_AUTO_PAY);
-
-        gncOwnerApplyPayment (&pw->owner, &(pw->pre_existing_txn), selected_lots,
-                              pw->post_acct, pw->xfer_acct, pw->amount_tot, exch,
-                              ts, memo, num, auto_pay);
-    }
-    gnc_resume_gui_refresh ();
-
-    /* Save the transfer account, xfer_acct */
-    gnc_payment_dialog_remember_account(pw, pw->xfer_acct);
-
-    if (gtk_widget_is_sensitive (pw->print_check) &&
-        gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(pw->print_check)))
-    {
-        Split *split = xaccTransFindSplitByAccount (pw->pre_existing_txn, pw->xfer_acct);
-        GList *splits = NULL;
-        splits = g_list_append(splits, split);
-        gnc_ui_print_check_dialog_create(NULL, splits);
-    }
-
-    gnc_ui_payment_window_destroy (pw);
-}
-
-void
-gnc_payment_cancel_cb (GtkWidget *widget, gpointer data)
-{
-    PaymentWindow *pw = data;
-    gnc_ui_payment_window_destroy (pw);
-}
-
-void
-gnc_payment_window_destroy_cb (GtkWidget *widget, gpointer data)
-{
-    PaymentWindow *pw = data;
-
-    if (!pw) return;
-
-    gnc_unregister_gui_component (pw->component_id);
-
-    g_list_free (pw->acct_types);
-    g_list_free (pw->acct_commodities);
-    g_free (pw);
-}
-
-void
-gnc_payment_acct_tree_row_activated_cb (GtkWidget *widget, GtkTreePath *path,
-                                        GtkTreeViewColumn *column, PaymentWindow *pw)
-{
-    GtkTreeView *view;
-    GtkTreeModel *model;
-    GtkTreeIter iter;
-
-    g_return_if_fail(widget);
-    view = GTK_TREE_VIEW(widget);
-
-    model = gtk_tree_view_get_model(view);
-    if (gtk_tree_model_get_iter(model, &iter, path))
-    {
-        if (gtk_tree_model_iter_has_child(model, &iter))
-        {
-            /* There are children,
-             * just expand or collapse the row. */
-            if (gtk_tree_view_row_expanded(view, path))
-                gtk_tree_view_collapse_row(view, path);
-            else
-                gtk_tree_view_expand_row(view, path, FALSE);
-        }
-        else if (gnc_payment_window_check_payment (pw))
-            /* It's an account without any children
-             * If all conditions for a valid payment are met click the Ok button. */
-            gnc_payment_ok_cb(widget, pw);
-    }
-}
-
-void
-gnc_payment_leave_amount_cb (GtkWidget *widget, GdkEventFocus *event,
-                             PaymentWindow *pw)
-{
-    gnc_numeric amount_deb, amount_cred, amount_tot;
-
-    if (! pw->amount_credit_edit || ! pw->amount_debit_edit)
-        return;
-
-    /* If both credit and debit amount are entered, simplify it to either one */
-    amount_deb  = gnc_amount_edit_get_amount (GNC_AMOUNT_EDIT (pw->amount_debit_edit));
-    amount_cred = gnc_amount_edit_get_amount (GNC_AMOUNT_EDIT (pw->amount_credit_edit));
-    amount_tot = gnc_numeric_sub (amount_cred, amount_deb,
-                                  gnc_commodity_get_fraction (xaccAccountGetCommodity (pw->post_acct)),
-                                  GNC_HOW_RND_ROUND_HALF_UP);
-
-    gnc_ui_payment_window_set_amount (pw, amount_tot);
-
-    /* Reflect if the payment could complete now */
-    gnc_payment_window_check_payment (pw);
-}
-
-/* Select the list of accoutns to show in the tree */
-static void
-gnc_payment_set_account_types (GncTreeViewAccount *tree)
-{
-    AccountViewInfo avi;
-    int i;
-
-    gnc_tree_view_account_get_view_info (tree, &avi);
-
-    for (i = 0; i < NUM_ACCOUNT_TYPES; i++)
-        avi.include_type[i] = gncBusinessIsPaymentAcctType (i);
-
-    gnc_tree_view_account_set_view_info (tree, &avi);
-}
-
-static gboolean
-find_handler (gpointer find_data, gpointer user_data)
-{
-    PaymentWindow *pw = user_data;
-
-    return (pw != NULL);
-}
-
-static void print_date (GtkTreeViewColumn *tree_column,
-                        GtkCellRenderer *cell,
-                        GtkTreeModel *tree_model,
-                        GtkTreeIter *iter,
-                        gpointer data)
-{
-    GValue value = { 0 };
-    time64 doc_date_time;
-    gchar *doc_date_str;
-
-    g_return_if_fail (cell && iter && tree_model);
-
-
-    gtk_tree_model_get_value (tree_model, iter, 0, &value);
-    doc_date_time = (time64) g_value_get_int64 (&value);
-    g_value_unset (&value);
-    doc_date_str = qof_print_date (doc_date_time);
-    g_object_set (G_OBJECT (cell), "text", doc_date_str, NULL);
-    g_free (doc_date_str);
-}
-
-static PaymentWindow *
-new_payment_window (GncOwner *owner, QofBook *book, GncInvoice *invoice)
-{
-    PaymentWindow *pw;
-    GtkBuilder *builder;
-    GtkWidget *box, *label, *credit_box, *debit_box;
-    GtkTreeSelection *selection;
-    GtkTreeViewColumn *column;
-    GtkCellRenderer *renderer;
-    char * cm_class = (gncOwnerGetType (owner) == GNC_OWNER_CUSTOMER ?
-                       DIALOG_PAYMENT_CUSTOMER_CM_CLASS :
-                       DIALOG_PAYMENT_VENDOR_CM_CLASS);
-
-    /*
-     * Find an existing payment window.  If found, bring it to
-     * the front.  If we have an actual owner, then set it in
-     * the window.
-     */
-
-    pw = gnc_find_first_gui_component (cm_class, find_handler, NULL);
-    if (pw)
-    {
-        if (gncOwnerIsValid(owner))
-            gnc_payment_set_owner (pw, owner);
-
-        // Reset the setting about the pre-existing TXN
-        pw->pre_existing_txn = NULL;
-
-        gtk_window_present (GTK_WINDOW(pw->dialog));
-        return(pw);
-    }
-
-    /* Ok, we need a new window */
-
-    pw = g_new0 (PaymentWindow, 1);
-    pw->book = book;
-    gncOwnerCopy (owner, &(pw->owner));
-
-    /* Compute the post-to account types */
-    pw->acct_types = gncOwnerGetAccountTypesList (owner);
-
-    if (gncOwnerIsValid(owner))
-        pw->acct_commodities = gncOwnerGetCommoditiesList (owner);
-
-    /* Open and read the Glade File */
-    builder = gtk_builder_new();
-    gnc_builder_add_from_file (builder, "dialog-payment.glade", "docs_list_hor_adj");
-    gnc_builder_add_from_file (builder, "dialog-payment.glade", "docs_list_vert_adj");
-    gnc_builder_add_from_file (builder, "dialog-payment.glade", "docs_list_model");
-    gnc_builder_add_from_file (builder, "dialog-payment.glade", "post_combo_model");
-    gnc_builder_add_from_file (builder, "dialog-payment.glade", "payment_dialog");
-    pw->dialog = GTK_WIDGET (gtk_builder_get_object (builder, "payment_dialog"));
-
-    // Set the style context for this dialog so it can be easily manipulated with css
-    gnc_widget_set_style_context (GTK_WIDGET(pw->dialog), "GncPaymentDialog");
-
-    /* Grab the widgets and build the dialog */
-    pw->payment_warning = GTK_WIDGET (gtk_builder_get_object (builder, "payment_warning"));
-    pw->ok_button = GTK_WIDGET (gtk_builder_get_object (builder, "okbutton"));
-    pw->num_entry = GTK_WIDGET (gtk_builder_get_object (builder, "num_entry"));
-    pw->memo_entry = GTK_WIDGET (gtk_builder_get_object (builder, "memo_entry"));
-    pw->commodity_label = GTK_WIDGET (gtk_builder_get_object (builder, "commodity_label"));
-    pw->post_combo = GTK_WIDGET (gtk_builder_get_object (builder, "post_combo"));
-    gtk_combo_box_set_entry_text_column( GTK_COMBO_BOX( pw->post_combo ), 0 );
-    gnc_cbwe_require_list_item(GTK_COMBO_BOX(pw->post_combo));
-
-    label = GTK_WIDGET (gtk_builder_get_object (builder, "owner_label"));
-    box = GTK_WIDGET (gtk_builder_get_object (builder, "owner_box"));
-    pw->owner_choice = gnc_owner_select_create (label, box, book, owner);
-
-    /* Some terminology:
-     * Invoices are paid, credit notes are refunded.
-     * A customer payment is a credit action, paying a vendor is debit
-     *
-     * So depending on the owner the payment amount should be considered
-     * credit (customer) or debit (vendor/employee) and refunds should be
-     * considered debit (customer) or credit (vendor/employee).
-     * For visual consistency, the dialog box will always show a payment and
-     * a refund field. Internally they are treated as credit or debit depending
-     * on the owner type.
-     */
-    if (gncOwnerGetType (owner) == GNC_OWNER_CUSTOMER)
-    {
-        debit_box = GTK_WIDGET (gtk_builder_get_object (builder, "amount_refund_box"));
-        credit_box = GTK_WIDGET (gtk_builder_get_object (builder, "amount_payment_box"));
-    }
-    else
-    {
-        debit_box = GTK_WIDGET (gtk_builder_get_object (builder, "amount_payment_box"));
-        credit_box = GTK_WIDGET (gtk_builder_get_object (builder, "amount_refund_box"));
-    }
-
-    pw->amount_debit_edit = gnc_amount_edit_new ();
-    gtk_box_pack_start (GTK_BOX (debit_box), pw->amount_debit_edit, TRUE, TRUE, 0);
-    gnc_amount_edit_set_evaluate_on_enter (GNC_AMOUNT_EDIT (pw->amount_debit_edit),
-                                           TRUE);
-    gnc_amount_edit_set_amount (GNC_AMOUNT_EDIT (pw->amount_debit_edit), gnc_numeric_zero());
-    g_signal_connect(G_OBJECT(gnc_amount_edit_gtk_entry(GNC_AMOUNT_EDIT(pw->amount_debit_edit))),
-                     "focus-out-event",
-                     G_CALLBACK(gnc_payment_leave_amount_cb), pw);
-
-    pw->amount_credit_edit = gnc_amount_edit_new ();
-    gtk_box_pack_start (GTK_BOX (credit_box), pw->amount_credit_edit, TRUE, TRUE, 0);
-    gnc_amount_edit_set_evaluate_on_enter (GNC_AMOUNT_EDIT (pw->amount_credit_edit),
-                                           TRUE);
-    gnc_amount_edit_set_amount (GNC_AMOUNT_EDIT (pw->amount_credit_edit), gnc_numeric_zero());
-    g_signal_connect(G_OBJECT(gnc_amount_edit_gtk_entry(GNC_AMOUNT_EDIT(pw->amount_credit_edit))),
-                     "focus-out-event",
-                     G_CALLBACK(gnc_payment_leave_amount_cb), pw);
-
-    box = GTK_WIDGET (gtk_builder_get_object (builder, "date_box"));
-    pw->date_edit = gnc_date_edit_new (time(NULL), FALSE, FALSE);
-    gtk_box_pack_start (GTK_BOX (box), pw->date_edit, TRUE, TRUE, 0);
-    pw->print_check = GTK_WIDGET (gtk_builder_get_object (builder, "print_check"));
-
-    pw->docs_list_tree_view = GTK_WIDGET (gtk_builder_get_object (builder, "docs_list_tree_view"));
-    selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(pw->docs_list_tree_view));
-    gtk_tree_selection_set_mode (selection, GTK_SELECTION_MULTIPLE);
-
-    // Set grid lines option to preference
-    gtk_tree_view_set_grid_lines (GTK_TREE_VIEW(pw->docs_list_tree_view), gnc_tree_view_get_grid_lines_pref ());
-
-    /* Configure date column */
-    renderer = gtk_cell_renderer_text_new ();
-    column = gtk_tree_view_get_column (GTK_TREE_VIEW (pw->docs_list_tree_view), 0);
-    gtk_tree_view_column_pack_start (column, renderer, TRUE);
-    tree_view_column_set_default_width (GTK_TREE_VIEW (pw->docs_list_tree_view),
-                                        column, "31-12-2013");
-    gtk_tree_view_column_set_cell_data_func (column, renderer,
-                                             (GtkTreeCellDataFunc) print_date,
-                                             NULL, NULL);
-
-    /* Configure document number column */
-    column = gtk_tree_view_get_column (GTK_TREE_VIEW (pw->docs_list_tree_view), 1);
-    tree_view_column_set_default_width (GTK_TREE_VIEW (pw->docs_list_tree_view),
-                                        column, "INV2013-016");
-
-    /* Configure document type column */
-    column = gtk_tree_view_get_column (GTK_TREE_VIEW (pw->docs_list_tree_view), 2);
-    tree_view_column_set_default_width (GTK_TREE_VIEW (pw->docs_list_tree_view),
-                                        column, _("Credit Note"));
-
-    /* Configure debit column */
-    column = gtk_tree_view_get_column (GTK_TREE_VIEW (pw->docs_list_tree_view), 3);
-    tree_view_column_set_default_width (GTK_TREE_VIEW (pw->docs_list_tree_view),
-                                        column, "11,999.00");
-
-    /* Configure credit column */
-    column = gtk_tree_view_get_column (GTK_TREE_VIEW (pw->docs_list_tree_view), 4);
-    tree_view_column_set_default_width (GTK_TREE_VIEW (pw->docs_list_tree_view),
-                                        column, "11,999.00");
-
-    gtk_tree_sortable_set_sort_column_id (
-        GTK_TREE_SORTABLE (gtk_tree_view_get_model (GTK_TREE_VIEW (pw->docs_list_tree_view))),
-        0, GTK_SORT_ASCENDING);
-
-
-    box = GTK_WIDGET (gtk_builder_get_object (builder, "acct_window"));
-    pw->acct_tree = GTK_WIDGET(gnc_tree_view_account_new (FALSE));
-    gtk_container_add (GTK_CONTAINER (box), pw->acct_tree);
-    gtk_tree_view_set_headers_visible (GTK_TREE_VIEW(pw->acct_tree), FALSE);
-    gnc_payment_set_account_types (GNC_TREE_VIEW_ACCOUNT (pw->acct_tree));
-
-    /* Set the dialog for the 'new' owner.
-     * Note that this also sets the post account tree. */
-    gnc_payment_dialog_owner_changed(pw);
-
-    /* Set the dialog for the 'new' invoice */
-    pw->invoice = invoice;
-    if (invoice)
-    {
-        Account *postacct = gncInvoiceGetPostedAcc (invoice);
-        if (postacct)
-        {
-            gchar *acct_string = gnc_account_get_full_name (postacct);
-            gnc_cbwe_set_by_string(GTK_COMBO_BOX(pw->post_combo), acct_string);
-            gnc_payment_dialog_post_to_changed_cb (pw->post_combo, pw);
-            g_free(acct_string);
-        }
-    }
-
-    /* Setup signals */
-    gtk_builder_connect_signals_full( builder,
-                                      gnc_builder_connect_full_func,
-                                      pw);
-
-    g_signal_connect (G_OBJECT (pw->owner_choice), "changed",
-                      G_CALLBACK (gnc_payment_dialog_owner_changed_cb), pw);
-
-    g_signal_connect (G_OBJECT (pw->acct_tree), "row-activated",
-                      G_CALLBACK (gnc_payment_acct_tree_row_activated_cb), pw);
-
-    selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(pw->acct_tree));
-    g_signal_connect (G_OBJECT (selection), "changed",
-                      G_CALLBACK (gnc_payment_dialog_xfer_acct_changed_cb), pw);
-
-
-    /* Register with the component manager */
-    pw->component_id =
-        gnc_register_gui_component (cm_class,
-                                    gnc_payment_window_refresh_handler,
-                                    gnc_payment_window_close_handler,
-                                    pw);
-
-    /* Watch for any new or changed accounts */
-    gnc_gui_component_watch_entity_type (pw->component_id,
-                                         GNC_ID_ACCOUNT,
-                                         QOF_EVENT_CREATE | QOF_EVENT_MODIFY |
-                                         QOF_EVENT_DESTROY);
-
-    /* Show it all */
-    gtk_widget_show_all (pw->dialog);
-    g_object_unref(G_OBJECT(builder));
-
-    // The customer choice widget should have keyboard focus
-    if (GNC_IS_GENERAL_SEARCH(pw->owner_choice))
-    {
-        gnc_general_search_grab_focus(GNC_GENERAL_SEARCH(pw->owner_choice));
-    }
-
-    /* Reflect if the payment could complete now */
-    gnc_payment_window_check_payment (pw);
-
-    /* Warn the user if they have no valid post-to accounts */
-    {
-        const gchar *text;
-        const char *acct_type;
-
-        text = gtk_entry_get_text(GTK_ENTRY (gtk_bin_get_child(GTK_BIN (GTK_COMBO_BOX(pw->post_combo)))));
-
-        if (!text || g_strcmp0 (text, "") == 0)
-        {
-
-            /* The code below assumes there will only be one account type.
-             * Let's assert this to protect from potential future changes. */
-            g_assert (g_list_length (pw->acct_types) == 1);
-            acct_type = xaccAccountGetTypeStr(GPOINTER_TO_INT(pw->acct_types->data));
-            gnc_warning_dialog(pw->dialog,
-                               _("You have no valid \"Post To\" accounts. "
-                                 "Please create an account of type \"%s\" "
-                                 "before you continue to process this payment. "
-                                 "Perhaps you want to create an Invoice or "
-                                 "Bill first?"),
-                               acct_type);
-        }
-    }
-
-    return pw;
-}
-
-
-void
-gnc_ui_payment_window_destroy (PaymentWindow *pw)
-{
-    if (!pw) return;
-    gnc_close_gui_component (pw->component_id);
-}
-
-PaymentWindow *
-gnc_ui_payment_new_with_invoice (const GncOwner *owner, QofBook *book,
-                                 GncInvoice *invoice)
-{
-    GncOwner owner_def;
-
-    if (!book) return NULL;
-    if (owner)
-    {
-        /* Figure out the company */
-        gncOwnerCopy (gncOwnerGetEndOwner (owner), &owner_def);
-    }
-    else
-    {
-        gncOwnerInitCustomer (&owner_def, NULL);
-    }
-
-    return new_payment_window (&owner_def, book, invoice);
-}
-
-PaymentWindow *
-gnc_ui_payment_new (GncOwner *owner, QofBook *book)
-{
-    return gnc_ui_payment_new_with_invoice (owner, book, NULL);
-}
-
-// ///////////////
-
-gboolean gnc_ui_payment_is_customer_payment(const Transaction *txn)
-{
-    gboolean result = TRUE;
-    Split *assetaccount_split, *aparaccount_split;
-    gnc_numeric amount;
-
-    if (!txn)
-        return result;
-
-    if (!xaccTransGetSplitList(txn))
-        return result;
-
-    /* First test if one split is in an A/R or A/P account.
-     * That will give us the best Customer vs Vendor/Employee distinction */
-    aparaccount_split = xaccTransGetFirstAPARAcctSplit(txn);
-    if (aparaccount_split)
-    {
-        if (xaccAccountGetType (xaccSplitGetAccount (aparaccount_split)) == ACCT_TYPE_RECEIVABLE)
-            return TRUE;  // Type is Customer
-        else if (xaccAccountGetType (xaccSplitGetAccount (aparaccount_split)) == ACCT_TYPE_PAYABLE)
-            return FALSE; // Type is Vendor/Employee, there's not enough information to refine more
-    }
-
-    /* For the lack of an A/R or A/P account we'll assume positive changes to an
-     * Asset/Liability or Equity account are Customer payments the others will be
-     * considered Vendor payments */
-    assetaccount_split = xaccTransGetFirstPaymentAcctSplit(txn);
-    if (!assetaccount_split)
-    {
-        /* Transaction isn't valid for a payment, just return the default
-         * Calling code will have to handle this situation properly */
-        g_message("No asset splits in txn \"%s\"; cannot use this for assigning a payment.",
-                  xaccTransGetDescription(txn));
-        return result;
-    }
-
-    assetaccount_split = xaccTransGetFirstPaymentAcctSplit(txn);
-    amount = xaccSplitGetValue(assetaccount_split);
-    result = gnc_numeric_positive_p(amount); // positive amounts == customer
-    //g_message("Amount=%s", gnc_numeric_to_string(amount));
-    return result;
-}
-
-// ///////////////
-
-PaymentWindow * gnc_ui_payment_new_with_txn (GncOwner *owner, Transaction *txn)
-{
-    Split *assetaccount_split;
-    Split *postaccount_split;
-    gnc_numeric amount;
-    PaymentWindow *pw;
-
-    if (!txn)
-        return NULL;
-
-    // We require the txn to have one split in an Asset account.
-
-    if (!xaccTransGetSplitList(txn))
-        return NULL;
-    assetaccount_split = xaccTransGetFirstPaymentAcctSplit(txn);
-    if (!assetaccount_split)
-    {
-        g_message("No asset splits in txn \"%s\"; cannot use this for assigning a payment.",
-                  xaccTransGetDescription(txn));
-        return NULL;
-    }
-
-    postaccount_split = xaccTransGetFirstAPARAcctSplit(txn); // watch out: Might be NULL
-    amount = xaccSplitGetValue(assetaccount_split);
-
-    pw = gnc_ui_payment_new(owner,
-                            qof_instance_get_book(QOF_INSTANCE(txn)));
-    g_assert(assetaccount_split); // we can rely on this because of the check above
-    g_debug("Amount=%s", gnc_numeric_to_string(amount));
-
-    // Fill in the values from the given txn
-    pw->pre_existing_txn = txn;
-    gnc_ui_payment_window_set_num(pw, gnc_get_num_action(txn, assetaccount_split));
-    gnc_ui_payment_window_set_memo(pw, xaccTransGetDescription(txn));
-    {
-        GDate txn_date = xaccTransGetDatePostedGDate (txn);
-        gnc_ui_payment_window_set_date(pw, &txn_date);
-    }
-    gnc_ui_payment_window_set_amount(pw, amount);
-    gnc_ui_payment_window_set_xferaccount(pw, xaccSplitGetAccount(assetaccount_split));
-    if (postaccount_split)
-        gnc_ui_payment_window_set_postaccount(pw, xaccSplitGetAccount(postaccount_split));
-
-    return pw;
-}
diff --git a/src/gnome/dialog-price-edit-db.c b/src/gnome/dialog-price-edit-db.c
deleted file mode 100644
index 0cb8cf5..0000000
--- a/src/gnome/dialog-price-edit-db.c
+++ /dev/null
@@ -1,568 +0,0 @@
-/********************************************************************\
- * dialog-price-editor.c -- price selector dialog                   *
- * Copyright (C) 2001 Gnumatic, Inc.                                *
- * Author: Dave Peticolas <dave at krondo.com>                         *
- * Copyright (C) 2003,2005 David Hampton                            *
- * Copyright (C) 2011 Robert Fewell                                 *
- *                                                                  *
- * 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 at gnu.org                   *
-\********************************************************************/
-
-#include "config.h"
-
-#include <gtk/gtk.h>
-#include <glib/gi18n.h>
-#include <libguile.h>
-#include "guile-mappings.h"
-#include <time.h>
-
-#include "dialog-utils.h"
-#include "gnc-amount-edit.h"
-#include "gnc-commodity-edit.h"
-#include "gnc-general-select.h"
-#include "gnc-component-manager.h"
-#include "gnc-currency-edit.h"
-#include "gnc-date-edit.h"
-#include "gnc-engine.h"
-#include "gnc-gui-query.h"
-#include "gnc-pricedb.h"
-#include "gnc-session.h"
-#include "gnc-tree-view-price.h"
-#include "gnc-ui.h"
-#include "gnc-ui-util.h"
-#include "gnome-utils/gnc-warnings.h"
-#include "guile-util.h"
-#include "engine-helpers-guile.h"
-#include "swig-runtime.h"
-
-
-#define DIALOG_PRICE_DB_CM_CLASS "dialog-price-edit-db"
-#define STATE_SECTION "dialogs/edit_prices"
-#define GNC_PREFS_GROUP "dialogs.pricedb-editor"
-
-/* This static indicates the debugging module that this .o belongs to.  */
-static QofLogModule log_module = GNC_MOD_GUI;
-
-
-void gnc_prices_dialog_window_destroy_cb (GtkWidget *object, gpointer data);
-void gnc_prices_dialog_close_cb (GtkDialog *dialog, gpointer data);
-void gnc_prices_dialog_response (GtkDialog *dialog, gint response_id, gpointer data);
-void gnc_prices_dialog_edit_clicked (GtkWidget *widget, gpointer data);
-void gnc_prices_dialog_remove_clicked (GtkWidget *widget, gpointer data);
-void gnc_prices_dialog_remove_old_clicked (GtkWidget *widget, gpointer data);
-void gnc_prices_dialog_add_clicked (GtkWidget *widget, gpointer data);
-void gnc_prices_dialog_get_quotes_clicked (GtkWidget *widget, gpointer data);
-
-
-typedef struct
-{
-    GtkWidget * dialog;
-    QofSession *session;
-    QofBook *book;
-    GNCPriceDB *price_db;
-
-    GncTreeViewPrice * price_tree;
-
-    GtkWidget * edit_button;
-    GtkWidget * remove_button;
-} PricesDialog;
-
-
-void
-gnc_prices_dialog_window_destroy_cb (GtkWidget *object, gpointer data)
-{
-    PricesDialog *pdb_dialog = data;
-
-    ENTER(" ");
-    gnc_unregister_gui_component_by_data (DIALOG_PRICE_DB_CM_CLASS, pdb_dialog);
-
-    if (pdb_dialog->dialog)
-    {
-        gtk_widget_destroy(pdb_dialog->dialog);
-        pdb_dialog->dialog = NULL;
-    }
-
-    g_free (pdb_dialog);
-    LEAVE(" ");
-}
-
-
-void
-gnc_prices_dialog_close_cb (GtkDialog *dialog, gpointer data)
-{
-    PricesDialog *pdb_dialog = data;
-
-    ENTER(" ");
-    gnc_close_gui_component_by_data (DIALOG_PRICE_DB_CM_CLASS, pdb_dialog);
-    LEAVE(" ");
-}
-
-
-void
-gnc_prices_dialog_response (GtkDialog *dialog, gint response_id, gpointer data)
-{
-    PricesDialog *pdb_dialog = data;
-
-    ENTER(" ");
-    gnc_close_gui_component_by_data (DIALOG_PRICE_DB_CM_CLASS, pdb_dialog);
-    LEAVE(" ");
-}
-
-
-void
-gnc_prices_dialog_edit_clicked (GtkWidget *widget, gpointer data)
-{
-    PricesDialog *pdb_dialog = data;
-    GList *price_list;
-
-    ENTER(" ");
-    price_list = gnc_tree_view_price_get_selected_prices(pdb_dialog->price_tree);
-    if (!price_list)
-    {
-        LEAVE("no price selected");
-        return;
-    }
-    if (g_list_next(price_list))
-    {
-        g_list_free(price_list);
-        LEAVE("too many prices selected");
-        return;
-    }
-
-    gnc_price_edit_dialog (pdb_dialog->dialog, pdb_dialog->session,
-                           price_list->data, GNC_PRICE_EDIT);
-    g_list_free(price_list);
-    LEAVE(" ");
-}
-
-
-static void
-remove_helper(GNCPrice *price, GNCPriceDB *pdb)
-{
-    gnc_pricedb_remove_price (pdb, price);
-}
-
-
-void
-gnc_prices_dialog_remove_clicked (GtkWidget *widget, gpointer data)
-{
-    PricesDialog *pdb_dialog = data;
-    GList *price_list;
-    gint length, response;
-    GtkWidget *dialog;
-
-    ENTER(" ");
-    price_list = gnc_tree_view_price_get_selected_prices(pdb_dialog->price_tree);
-    if (!price_list)
-    {
-        LEAVE("no price selected");
-        return;
-    }
-
-    length = g_list_length(price_list);
-    if (length > 1)
-    {
-        gchar *message;
-
-        message = g_strdup_printf
-                  (/* Translators: %d is the number of prices. This
-	  is a ngettext(3) message. */
-                      ngettext("Are you sure you want to delete the selected price?",
-                               "Are you sure you want to delete the %d selected prices?",
-                               length),
-                      length);
-        dialog = gtk_message_dialog_new(GTK_WINDOW(pdb_dialog->dialog),
-                                        GTK_DIALOG_DESTROY_WITH_PARENT,
-                                        GTK_MESSAGE_QUESTION,
-                                        GTK_BUTTONS_NONE,
-                                        "%s", _("Delete prices?"));
-        gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
-                "%s", message);
-        g_free(message);
-        gtk_dialog_add_buttons(GTK_DIALOG(dialog),
-                               _("_Cancel"), GTK_RESPONSE_CANCEL,
-                               _("_Delete"), GTK_RESPONSE_YES,
-                               (gchar *)NULL);
-        gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_YES);
-        response = gnc_dialog_run(GTK_DIALOG(dialog), GNC_PREF_WARN_PRICE_QUOTES_DEL);
-        gtk_widget_destroy(dialog);
-    }
-    else
-    {
-        response = GTK_RESPONSE_YES;
-    }
-
-    if (response == GTK_RESPONSE_YES)
-    {
-        g_list_foreach(price_list, (GFunc)remove_helper, pdb_dialog->price_db);
-    }
-    g_list_free(price_list);
-    LEAVE(" ");
-}
-
-
-void
-gnc_prices_dialog_remove_old_clicked (GtkWidget *widget, gpointer data)
-{
-    PricesDialog *pdb_dialog = data;
-    GtkBuilder *builder;
-    GtkWidget *dialog, *button, *date, *label, *box;
-    gint result;
-    gboolean delete_user, delete_last;
-
-    ENTER(" ");
-    builder = gtk_builder_new();
-    gnc_builder_add_from_file (builder, "dialog-price.glade", "deletion_date_dialog");
-
-    dialog = GTK_WIDGET(gtk_builder_get_object (builder, "deletion_date_dialog"));
-
-    box = GTK_WIDGET(gtk_builder_get_object (builder, "date_hbox"));
-    date = gnc_date_edit_new (time (NULL), FALSE, FALSE);
-
-    gtk_box_pack_start (GTK_BOX (box), date, TRUE, TRUE, 0);
-    gtk_widget_show (date);
-    gtk_entry_set_activates_default(GTK_ENTRY(GNC_DATE_EDIT(date)->date_entry), TRUE);
-    label = GTK_WIDGET(gtk_builder_get_object (builder, "date_label"));
-    gnc_date_make_mnemonic_target (GNC_DATE_EDIT(date), label);
-
-    gtk_builder_connect_signals_full (builder, gnc_builder_connect_full_func, pdb_dialog);
-
-    gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (pdb_dialog->dialog));
-
-    result = gtk_dialog_run (GTK_DIALOG (dialog));
-    if (result == GTK_RESPONSE_OK)
-    {
-        Timespec ts;
-
-        DEBUG("deleting prices");
-        ts.tv_sec = gnc_date_edit_get_date (GNC_DATE_EDIT (date));
-        ts.tv_nsec = 0;
-
-        button = GTK_WIDGET(gtk_builder_get_object (builder, "delete_manual"));
-        delete_user = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button));
-        button = GTK_WIDGET(gtk_builder_get_object (builder, "delete_last"));
-        delete_last = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button));
-
-        gnc_pricedb_remove_old_prices(pdb_dialog->price_db, ts,
-                                      delete_user, delete_last);
-    }
-
-    gtk_widget_destroy(dialog);
-    LEAVE(" ");
-}
-
-
-void
-gnc_prices_dialog_add_clicked (GtkWidget *widget, gpointer data)
-{
-    PricesDialog *pdb_dialog = data;
-    GNCPrice *price = NULL;
-    GList *price_list;
-
-    ENTER(" ");
-    price_list = gnc_tree_view_price_get_selected_prices(pdb_dialog->price_tree);
-    if (price_list)
-    {
-        price = price_list->data;
-        g_list_free(price_list);
-    }
-    gnc_price_edit_dialog (pdb_dialog->dialog, pdb_dialog->session,
-                           price, GNC_PRICE_NEW);
-    LEAVE(" ");
-}
-
-
-void
-gnc_prices_dialog_get_quotes_clicked (GtkWidget *widget, gpointer data)
-{
-    PricesDialog *pdb_dialog = data;
-    SCM quotes_func;
-    SCM book_scm;
-    SCM scm_window;
-
-    ENTER(" ");
-    quotes_func = scm_c_eval_string ("gnc:book-add-quotes");
-    if (!scm_is_procedure (quotes_func))
-    {
-        LEAVE(" no procedure");
-        return;
-    }
-
-    book_scm = gnc_book_to_scm (pdb_dialog->book);
-    if (scm_is_true (scm_not (book_scm)))
-    {
-        LEAVE("no book");
-        return;
-    }
-
-    scm_window =  SWIG_NewPointerObj(pdb_dialog->dialog,
-                                     SWIG_TypeQuery("_p_GtkWidget"), 0);
-
-    gnc_set_busy_cursor (NULL, TRUE);
-    scm_call_2 (quotes_func, scm_window, book_scm);
-    gnc_unset_busy_cursor (NULL);
-
-    /* Without this, the summary bar on the accounts tab
-     * won't reflect the new prices (bug #522095). */
-    gnc_gui_refresh_all ();
-
-    LEAVE(" ");
-}
-
-
-static void
-gnc_prices_dialog_selection_changed (GtkTreeSelection *treeselection,
-                                     gpointer data)
-{
-    PricesDialog *pdb_dialog = data;
-    GList *price_list;
-    gint length;
-
-    ENTER(" ");
-    price_list = gnc_tree_view_price_get_selected_prices(pdb_dialog->price_tree);
-    length = g_list_length(price_list);
-
-    gtk_widget_set_sensitive (pdb_dialog->edit_button,
-                              length == 1);
-    gtk_widget_set_sensitive (pdb_dialog->remove_button,
-                              length >= 1);
-    LEAVE("%d prices selected", length);
-}
-
-
-static gboolean
-gnc_price_dialog_filter_ns_func (gnc_commodity_namespace *name_space,
-                                 gpointer data)
-{
-    PricesDialog *pdb_dialog = data;
-    const gchar *name;
-    static GList *cm_list;
-    GList *item;
-
-    /* Never show the template list */
-    name = gnc_commodity_namespace_get_name (name_space);
-    if (g_strcmp0 (name, GNC_COMMODITY_NS_TEMPLATE) == 0)
-        return FALSE;
-
-    /* See if this namespace has commodities */
-    cm_list = gnc_commodity_namespace_get_commodity_list(name_space);
-    for (item = cm_list; item; item = g_list_next(item))
-    {
-
-        /* For each commodity, see if there are prices */
-        if (gnc_pricedb_has_prices(pdb_dialog->price_db, item->data, NULL))
-        {
-            return TRUE;
-        }
-    }
-
-    //  printf("Namespace %s not visible\n", name);
-    return FALSE;
-}
-
-
-static gboolean
-gnc_price_dialog_filter_cm_func (gnc_commodity *commodity,
-                                 gpointer data)
-{
-    PricesDialog *pdb_dialog = data;
-
-    /* Show any commodity that has prices */
-    return gnc_pricedb_has_prices(pdb_dialog->price_db, commodity, NULL);
-}
-
-
-static void
-row_activated_cb (GtkTreeView *view, GtkTreePath *path,
-                  GtkTreeViewColumn *column, gpointer data)
-{
-    GtkTreeModel *model;
-    GtkTreeIter iter;
-
-    g_return_if_fail(view);
-
-    model = gtk_tree_view_get_model(view);
-    if (gtk_tree_model_get_iter(model, &iter, path))
-    {
-        if (gtk_tree_model_iter_has_child(model, &iter))
-        {
-            /* There are children, so it's not a price.
-             * Just expand or collapse the row. */
-            if (gtk_tree_view_row_expanded(view, path))
-                gtk_tree_view_collapse_row(view, path);
-            else
-                gtk_tree_view_expand_row(view, path, FALSE);
-        }
-        else
-            /* It's a price, so click the Edit button. */
-            gnc_prices_dialog_edit_clicked(GTK_WIDGET(view), data);
-    }
-}
-
-
-static void
-gnc_prices_dialog_create (GtkWidget * parent, PricesDialog *pdb_dialog)
-{
-    GtkWidget *dialog, *scrolled_window;
-    GtkBuilder *builder;
-    GtkTreeView *view;
-    GtkTreeSelection *selection;
-
-    ENTER(" ");
-    builder = gtk_builder_new();
-    gnc_builder_add_from_file (builder, "dialog-price.glade", "prices_dialog");
-
-    dialog = GTK_WIDGET(gtk_builder_get_object (builder, "prices_dialog"));
-    pdb_dialog->dialog = dialog;
-
-    // Set the style context for this dialog so it can be easily manipulated with css
-    gnc_widget_set_style_context (GTK_WIDGET(dialog), "GncPriceEditDialog");
-
-    pdb_dialog->session = gnc_get_current_session();
-    pdb_dialog->book = qof_session_get_book(pdb_dialog->session);
-    pdb_dialog->price_db = gnc_pricedb_get_db(pdb_dialog->book);
-
-    /* parent */
-    if (parent != NULL)
-        gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (parent));
-
-    /* default to 'close' button */
-    gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_CLOSE);
-
-    /* price tree */
-    scrolled_window = GTK_WIDGET(gtk_builder_get_object (builder, "price_list_window"));
-    view = gnc_tree_view_price_new(pdb_dialog->book,
-                                   "state-section", STATE_SECTION,
-                                   "show-column-menu", TRUE,
-                                   NULL);
-    pdb_dialog->price_tree = GNC_TREE_VIEW_PRICE(view);
-    gtk_container_add (GTK_CONTAINER (scrolled_window), GTK_WIDGET(view));
-    gnc_tree_view_price_set_filter (pdb_dialog->price_tree,
-                                    gnc_price_dialog_filter_ns_func,
-                                    gnc_price_dialog_filter_cm_func,
-                                    NULL,
-                                    pdb_dialog, NULL);
-
-    selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (view));
-    gtk_tree_selection_set_mode(selection, GTK_SELECTION_MULTIPLE);
-    g_signal_connect (G_OBJECT (selection), "changed",
-                      G_CALLBACK (gnc_prices_dialog_selection_changed), pdb_dialog);
-
-    g_signal_connect (G_OBJECT (view), "row-activated",
-                      G_CALLBACK (row_activated_cb), pdb_dialog);
-
-    /* buttons */
-    {
-        GtkWidget *button;
-
-        button = GTK_WIDGET(gtk_builder_get_object (builder, "edit_button"));
-        pdb_dialog->edit_button = button;
-
-        button = GTK_WIDGET(gtk_builder_get_object (builder, "remove_button"));
-        pdb_dialog->remove_button = button;
-
-        if (!gnc_quote_source_fq_installed())
-        {
-            button = GTK_WIDGET(gtk_builder_get_object (builder, "get_quotes_button"));
-            gtk_widget_set_sensitive(button, FALSE);
-        }
-    }
-
-    gtk_builder_connect_signals_full (builder, gnc_builder_connect_full_func, pdb_dialog);
-
-    g_object_unref(G_OBJECT(builder));
-
-    gnc_restore_window_size(GNC_PREFS_GROUP, GTK_WINDOW(pdb_dialog->dialog));
-    LEAVE(" ");
-}
-
-
-static void
-close_handler (gpointer user_data)
-{
-    PricesDialog *pdb_dialog = user_data;
-
-    ENTER(" ");
-    gnc_save_window_size(GNC_PREFS_GROUP, GTK_WINDOW(pdb_dialog->dialog));
-
-    gtk_widget_destroy (GTK_WIDGET (pdb_dialog->dialog));
-    LEAVE(" ");
-}
-
-
-static void
-refresh_handler (GHashTable *changes, gpointer user_data)
-{
-    ENTER(" ");
-    LEAVE(" ");
-}
-
-
-static gboolean
-show_handler (const char *klass, gint component_id,
-              gpointer user_data, gpointer iter_data)
-{
-    PricesDialog *pdb_dialog = user_data;
-
-    ENTER(" ");
-    if (!pdb_dialog)
-    {
-        LEAVE("no data strucure");
-        return(FALSE);
-    }
-
-    gtk_window_present (GTK_WINDOW(pdb_dialog->dialog));
-    LEAVE(" ");
-    return(TRUE);
-}
-
-
-/********************************************************************\
- * gnc_prices_dialog                                                *
- *   opens up a window showing all price information                *
- *                                                                  *
- * Args:   parent  - the parent of the window to be created         *
- * Return: nothing                                                  *
-\********************************************************************/
-void
-gnc_prices_dialog (GtkWidget * parent)
-{
-    PricesDialog *pdb_dialog;
-    gint component_id;
-
-    ENTER(" ");
-    if (gnc_forall_gui_components (DIALOG_PRICE_DB_CM_CLASS, show_handler, NULL))
-    {
-        LEAVE("existing dialog raised");
-        return;
-    }
-
-    pdb_dialog = g_new0 (PricesDialog, 1);
-
-    gnc_prices_dialog_create (parent, pdb_dialog);
-
-    component_id = gnc_register_gui_component (DIALOG_PRICE_DB_CM_CLASS,
-                   refresh_handler, close_handler,
-                   pdb_dialog);
-    gnc_gui_component_set_session (component_id, pdb_dialog->session);
-
-    gtk_widget_grab_focus (GTK_WIDGET(pdb_dialog->price_tree));
-
-    gtk_widget_show (pdb_dialog->dialog);
-    LEAVE(" ");
-}
diff --git a/src/gnome/gnc-plugin-business.c b/src/gnome/gnc-plugin-business.c
deleted file mode 100644
index 5bcc5a6..0000000
--- a/src/gnome/gnc-plugin-business.c
+++ /dev/null
@@ -1,1108 +0,0 @@
-/*
- * gnc-plugin-business.c --
- *
- * Author: Jan Arne Petersen <jpetersen at uni-bonn.de>
- * Copyright (C) 2003 Jan Arne Petersen
- * Copyright (C) 2005 David Hampton <hampton at employees.org>
- *
- * 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 at gnu.org
- */
-
-#include "config.h"
-
-#include <gtk/gtk.h>
-#include <glib/gi18n.h>
-#include <string.h>
-
-#include "dialog-billterms.h"
-#include "dialog-customer.h"
-#include "dialog-employee.h"
-#include "dialog-invoice.h"
-#include "dialog-job.h"
-#include "dialog-payment.h"
-#include "dialog-tax-table.h"
-#include "dialog-vendor.h"
-#include "business-gnome-utils.h"
-#include "gnc-plugin-business.h"
-#include "gnc-plugin-page-invoice.h"
-#include "gnc-plugin-page-owner-tree.h"
-#include "gncOwner.h"
-#include "gnc-ui-util.h"
-#include "gnc-date.h"
-#include "gnc-file.h"
-#include "guile-mappings.h"
-#include "gnc-session.h"
-#include "gnome-utils/gnc-icons.h" /* for GNC_ICON_INVOICE_NEW */
-
-#include "gnc-prefs.h"
-#include "gnome-utils/gnc-main-window.h"
-
-#include "gnc-plugin-page-register.h"
-
-/* This static indicates the debugging module that this .o belongs to.  */
-G_GNUC_UNUSED static QofLogModule log_module = G_LOG_DOMAIN;
-
-/* g_object functions */
-static void gnc_plugin_business_class_init (GncPluginBusinessClass *klass);
-static void gnc_plugin_business_init (GncPluginBusiness *plugin);
-static void gnc_plugin_business_finalize (GObject *object);
-static void gnc_plugin_business_add_to_window (GncPlugin *plugin,
-        GncMainWindow *window,
-        GQuark type);
-
-/* Command callbacks */
-static void gnc_plugin_business_cmd_customer_page            (GtkAction *action,
-        GncMainWindowActionData *data);
-static void gnc_plugin_business_cmd_customer_new_customer    (GtkAction *action,
-        GncMainWindowActionData *data);
-static void gnc_plugin_business_cmd_customer_find_customer   (GtkAction *action,
-        GncMainWindowActionData *data);
-static void gnc_plugin_business_cmd_customer_new_invoice     (GtkAction *action,
-        GncMainWindowActionData *data);
-static void gnc_plugin_business_cmd_customer_find_invoice    (GtkAction *action,
-        GncMainWindowActionData *data);
-static void gnc_plugin_business_cmd_customer_new_job         (GtkAction *action,
-        GncMainWindowActionData *data);
-static void gnc_plugin_business_cmd_customer_find_job        (GtkAction *action,
-        GncMainWindowActionData *data);
-static void gnc_plugin_business_cmd_customer_process_payment (GtkAction *action,
-        GncMainWindowActionData *data);
-
-static void gnc_plugin_business_cmd_vendor_page            (GtkAction *action,
-        GncMainWindowActionData *data);
-static void gnc_plugin_business_cmd_vendor_new_vendor      (GtkAction *action,
-        GncMainWindowActionData *data);
-static void gnc_plugin_business_cmd_vendor_find_vendor     (GtkAction *action,
-        GncMainWindowActionData *data);
-static void gnc_plugin_business_cmd_vendor_new_bill        (GtkAction *action,
-        GncMainWindowActionData *data);
-static void gnc_plugin_business_cmd_vendor_find_bill       (GtkAction *action,
-        GncMainWindowActionData *data);
-static void gnc_plugin_business_cmd_vendor_new_job         (GtkAction *action,
-        GncMainWindowActionData *data);
-static void gnc_plugin_business_cmd_vendor_find_job        (GtkAction *action,
-        GncMainWindowActionData *data);
-static void gnc_plugin_business_cmd_vendor_process_payment (GtkAction *action,
-        GncMainWindowActionData *data);
-
-static void gnc_plugin_business_cmd_employee_page                 (GtkAction *action,
-        GncMainWindowActionData *data);
-static void gnc_plugin_business_cmd_employee_new_employee         (GtkAction *action,
-        GncMainWindowActionData *data);
-static void gnc_plugin_business_cmd_employee_find_employee        (GtkAction *action,
-        GncMainWindowActionData *data);
-static void gnc_plugin_business_cmd_employee_new_expense_voucher  (GtkAction *action,
-        GncMainWindowActionData *data);
-static void gnc_plugin_business_cmd_employee_find_expense_voucher (GtkAction *action,
-        GncMainWindowActionData *data);
-static void gnc_plugin_business_cmd_employee_process_payment      (GtkAction *action,
-        GncMainWindowActionData *data);
-
-static void gnc_plugin_business_cmd_tax_tables         (GtkAction *action,
-        GncMainWindowActionData *data);
-static void gnc_plugin_business_cmd_billing_terms      (GtkAction *action,
-        GncMainWindowActionData *data);
-static void gnc_plugin_business_cmd_bills_due_reminder (GtkAction *action,
-        GncMainWindowActionData *data);
-static void gnc_plugin_business_cmd_invoices_due_reminder (GtkAction *action,
-        GncMainWindowActionData *data);
-
-static void gnc_plugin_business_cmd_test_search (GtkAction *action,
-        GncMainWindowActionData *data);
-
-static void gnc_plugin_business_cmd_test_init_data (GtkAction *action,
-        GncMainWindowActionData *data);
-
-static void gnc_plugin_business_cmd_assign_payment (GtkAction *action,
-        GncMainWindowActionData *data);
-static void update_inactive_actions(GncPluginPage *page);
-
-#define PLUGIN_ACTIONS_NAME "gnc-plugin-business-actions"
-#define PLUGIN_UI_FILENAME  "gnc-plugin-business-ui.xml"
-
-#define GNC_PREF_EXTRA_TOOLBUTTONS "enable-toolbuttons"
-#define GNC_PREF_INV_PRINT_RPT     "invoice-printreport"
-
-/** This variable maintains a pointer to the last window where a
- *  Business command was executed.  It is used to determine where new
- *  invoices will be placed.  This is a HACK done instead of trudging
- *  through several layers of dialog (search dialog, new invoice
- *  dialog) forcing them to track the original parent window.
- */
-static GncMainWindow *last_window = NULL;
-
-static GtkActionEntry gnc_plugin_actions [] =
-{
-    /* Toplevel */
-    { "BusinessAction", NULL, N_("_Business"), NULL, NULL, NULL },
-
-    /* Customer submenu */
-    { "CustomerMenuAction", NULL, N_("_Customer"), NULL, NULL, NULL },
-    {
-        "CustomerOverviewPageAction", NULL, N_("Customers Overview"), NULL,
-        N_("Open a Customer overview page"),
-        G_CALLBACK (gnc_plugin_business_cmd_customer_page)
-    },
-    {
-        "CustomerNewCustomerOpenAction", NULL, N_("_New Customer..."), NULL,
-        N_("Open the New Customer dialog"),
-        G_CALLBACK (gnc_plugin_business_cmd_customer_new_customer)
-    },
-    {
-        "CustomerFindCustomerOpenAction", NULL, N_("_Find Customer..."), NULL,
-        N_("Open the Find Customer dialog"),
-        G_CALLBACK (gnc_plugin_business_cmd_customer_find_customer)
-    },
-    {
-        "CustomerNewInvoiceOpenAction", NULL, N_("New _Invoice..."), NULL,
-        N_("Open the New Invoice dialog"),
-        G_CALLBACK (gnc_plugin_business_cmd_customer_new_invoice)
-    },
-    {
-        "CustomerFindInvoiceOpenAction", NULL, N_("Find In_voice..."), NULL,
-        N_("Open the Find Invoice dialog"),
-        G_CALLBACK (gnc_plugin_business_cmd_customer_find_invoice)
-    },
-    {
-        "CustomerNewJobOpenAction", NULL, N_("New _Job..."), NULL,
-        N_("Open the New Job dialog"),
-        G_CALLBACK (gnc_plugin_business_cmd_customer_new_job)
-    },
-    {
-        "CustomerFindJobOpenAction", NULL, N_("Find Jo_b..."), NULL,
-        N_("Open the Find Job dialog"),
-        G_CALLBACK (gnc_plugin_business_cmd_customer_find_job)
-    },
-    {
-        "CustomerProcessPaymentAction", NULL, N_("_Process Payment..."), NULL,
-        N_("Open the Process Payment dialog"),
-        G_CALLBACK (gnc_plugin_business_cmd_customer_process_payment)
-    },
-
-    /* Vendor submenu */
-    {
-        "VendorOverviewPageAction", NULL, N_("Vendors Overview"), NULL,
-        N_("Open a Vendor overview page"),
-        G_CALLBACK (gnc_plugin_business_cmd_vendor_page)
-    },
-    { "VendorMenuAction", NULL, N_("_Vendor"), NULL, NULL, NULL },
-    {
-        "VendorNewVendorOpenAction", NULL, N_("_New Vendor..."), NULL,
-        N_("Open the New Vendor dialog"),
-        G_CALLBACK (gnc_plugin_business_cmd_vendor_new_vendor)
-    },
-    {
-        "VendorFindVendorOpenAction", NULL, N_("_Find Vendor..."), NULL,
-        N_("Open the Find Vendor dialog"),
-        G_CALLBACK (gnc_plugin_business_cmd_vendor_find_vendor)
-    },
-    {
-        "VendorNewBillOpenAction", NULL, N_("New _Bill..."), NULL,
-        N_("Open the New Bill dialog"),
-        G_CALLBACK (gnc_plugin_business_cmd_vendor_new_bill)
-    },
-    {
-        "VendorFindBillOpenAction", NULL, N_("Find Bi_ll..."), NULL,
-        N_("Open the Find Bill dialog"),
-        G_CALLBACK (gnc_plugin_business_cmd_vendor_find_bill)
-    },
-    {
-        "VendorNewJobOpenAction", NULL, N_("New _Job..."), NULL,
-        N_("Open the New Job dialog"),
-        G_CALLBACK (gnc_plugin_business_cmd_vendor_new_job)
-    },
-    {
-        "VendorFindJobOpenAction", NULL, N_("Find Jo_b..."), NULL,
-        N_("Open the Find Job dialog"),
-        G_CALLBACK (gnc_plugin_business_cmd_vendor_find_job)
-    },
-    {
-        "VendorProcessPaymentAction", NULL, N_("_Process Payment..."), NULL,
-        N_("Open the Process Payment dialog"),
-        G_CALLBACK (gnc_plugin_business_cmd_vendor_process_payment)
-    },
-
-    /* Employee submenu */
-    {
-        "EmployeeOverviewPageAction", NULL, N_("Employees Overview"), NULL,
-        N_("Open a Employee overview page"),
-        G_CALLBACK (gnc_plugin_business_cmd_employee_page)
-    },
-    { "EmployeeMenuAction", NULL, N_("_Employee"), NULL, NULL, NULL },
-    {
-        "EmployeeNewEmployeeOpenAction", NULL, N_("_New Employee..."), NULL,
-        N_("Open the New Employee dialog"),
-        G_CALLBACK (gnc_plugin_business_cmd_employee_new_employee)
-    },
-    {
-        "EmployeeFindEmployeeOpenAction", NULL, N_("_Find Employee..."), NULL,
-        N_("Open the Find Employee dialog"),
-        G_CALLBACK (gnc_plugin_business_cmd_employee_find_employee)
-    },
-    {
-        "EmployeeNewExpenseVoucherOpenAction", NULL, N_("New _Expense Voucher..."), NULL,
-        N_("Open the New Expense Voucher dialog"),
-        G_CALLBACK (gnc_plugin_business_cmd_employee_new_expense_voucher)
-    },
-    {
-        "EmployeeFindExpenseVoucherOpenAction", NULL, N_("Find Expense _Voucher..."), NULL,
-        N_("Open the Find Expense Voucher dialog"),
-        G_CALLBACK (gnc_plugin_business_cmd_employee_find_expense_voucher)
-    },
-    {
-        "EmployeeProcessPaymentAction", NULL, N_("_Process Payment..."), NULL,
-        N_("Open the Process Payment dialog"),
-        G_CALLBACK (gnc_plugin_business_cmd_employee_process_payment)
-    },
-
-    /* Other menu items */
-    {
-        "TaxTablesOpenAction", NULL, N_("Sales _Tax Table"), NULL,
-        N_("View and edit the list of Sales Tax Tables (GST/VAT)"),
-        G_CALLBACK (gnc_plugin_business_cmd_tax_tables)
-    },
-    {
-        "BillingTermsOpenAction", NULL, N_("_Billing Terms Editor"), NULL,
-        N_("View and edit the list of Billing Terms"),
-        G_CALLBACK (gnc_plugin_business_cmd_billing_terms)
-    },
-    {
-        "BillsDueReminderOpenAction", NULL, N_("Bills _Due Reminder"), NULL,
-        N_("Open the Bills Due Reminder dialog"),
-        G_CALLBACK (gnc_plugin_business_cmd_bills_due_reminder)
-    },
-    {
-        "InvoicesDueReminderOpenAction", NULL, N_("Invoices _Due Reminder"), NULL,
-        N_("Open the Invoices Due Reminder dialog"),
-        G_CALLBACK (gnc_plugin_business_cmd_invoices_due_reminder)
-    },
-    { "ExportMenuAction", NULL, N_("E_xport"), NULL, NULL, NULL },
-
-    /* Extensions Menu */
-    { "BusinessTestAction", NULL, N_("_Business"), NULL, NULL, NULL },
-    {
-        "BusinessTestSearchAction", NULL, N_("Test Search Dialog"), NULL,
-        N_("Test Search Dialog"),
-        G_CALLBACK (gnc_plugin_business_cmd_test_search)
-    },
-    {
-        "BusinessTestInitDataAction", NULL, N_("Initialize Test Data"), NULL,
-        N_("Initialize Test Data"),
-        G_CALLBACK (gnc_plugin_business_cmd_test_init_data)
-    },
-
-    /* Toolbar */
-    {
-        "ToolbarNewInvoiceAction", GNC_ICON_INVOICE_NEW, N_("New _Invoice..."), NULL,
-        N_("Open the New Invoice dialog"),
-        G_CALLBACK (gnc_plugin_business_cmd_customer_new_invoice)
-    },
-
-    /* Register popup menu */
-    {
-        "RegisterAssignPayment", NULL, N_("Assign as payment..."), NULL,
-        N_("Assign the selected transaction as payment"),
-        G_CALLBACK (gnc_plugin_business_cmd_assign_payment)
-    },
-};
-static guint gnc_plugin_n_actions = G_N_ELEMENTS (gnc_plugin_actions);
-
-
-/************************************************************
- *              Plugin Function Implementation              *
- ************************************************************/
-
-typedef struct GncPluginBusinessPrivate
-{
-    GncOwner *last_customer;
-    GncOwner *last_vendor;
-    GncOwner *last_employee;
-} GncPluginBusinessPrivate;
-
-#define GNC_PLUGIN_BUSINESS_GET_PRIVATE(o)  \
-   (G_TYPE_INSTANCE_GET_PRIVATE ((o), GNC_TYPE_PLUGIN_BUSINESS, GncPluginBusinessPrivate))
-
-static GObjectClass *parent_class = NULL;
-
-GType
-gnc_plugin_business_get_type (void)
-{
-    static GType gnc_plugin_business_type = 0;
-
-    if (gnc_plugin_business_type == 0)
-    {
-        static const GTypeInfo our_info =
-        {
-            sizeof (GncPluginBusinessClass),
-            NULL,		/* base_init */
-            NULL,		/* base_finalize */
-            (GClassInitFunc) gnc_plugin_business_class_init,
-            NULL,		/* class_finalize */
-            NULL,		/* class_data */
-            sizeof (GncPluginBusiness),
-            0,		/* n_preallocs */
-            (GInstanceInitFunc) gnc_plugin_business_init
-        };
-
-        gnc_plugin_business_type = g_type_register_static (GNC_TYPE_PLUGIN,
-                                   "GncPluginBusiness",
-                                   &our_info, 0);
-    }
-
-    return gnc_plugin_business_type;
-}
-
-GncPlugin *
-gnc_plugin_business_new (void)
-{
-    GncPluginBusiness *plugin;
-
-    /* Reference the invoice page plugin to ensure it exists in
-     * the gtk type system. */
-    GNC_TYPE_PLUGIN_PAGE_INVOICE;
-    GNC_TYPE_PLUGIN_PAGE_OWNER_TREE;
-
-    plugin = g_object_new (GNC_TYPE_PLUGIN_BUSINESS,
-                           (char *)NULL);
-
-    return GNC_PLUGIN (plugin);
-}
-
-static void
-gnc_plugin_business_class_init (GncPluginBusinessClass *klass)
-{
-    GObjectClass *object_class = G_OBJECT_CLASS (klass);
-    GncPluginClass *plugin_class = GNC_PLUGIN_CLASS (klass);
-
-    parent_class = g_type_class_peek_parent (klass);
-
-    object_class->finalize = gnc_plugin_business_finalize;
-
-    /* plugin info */
-    plugin_class->plugin_name  = GNC_PLUGIN_BUSINESS_NAME;
-
-    /* function overrides */
-    plugin_class->add_to_window = gnc_plugin_business_add_to_window;
-
-    /* widget addition/removal */
-    plugin_class->actions_name = PLUGIN_ACTIONS_NAME;
-    plugin_class->actions      = gnc_plugin_actions;
-    plugin_class->n_actions    = gnc_plugin_n_actions;
-    plugin_class->ui_filename  = PLUGIN_UI_FILENAME;
-
-    g_type_class_add_private(klass, sizeof(GncPluginBusinessPrivate));
-}
-
-static void
-gnc_plugin_business_init (GncPluginBusiness *plugin)
-{
-    GncPluginBusinessPrivate *priv;
-
-    priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
-    priv->last_customer = gncOwnerNew ();
-    gncOwnerInitCustomer (priv->last_customer, NULL);
-
-    priv->last_vendor = gncOwnerNew ();
-    gncOwnerInitVendor (priv->last_vendor, NULL);
-
-    priv->last_employee = gncOwnerNew ();
-    gncOwnerInitEmployee (priv->last_employee, NULL);
-}
-
-static void
-gnc_plugin_business_finalize (GObject *object)
-{
-    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (object));
-
-    G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-/************************************************************
- *                     Helper Functions                     *
- ************************************************************/
-
-GncMainWindow*
-gnc_plugin_business_get_window()
-{
-    return last_window;
-}
-
-/************************************************************
- *                    Command Callbacks                     *
- ************************************************************/
-
-static void
-gnc_plugin_business_cmd_customer_page (GtkAction *action,
-                                       GncMainWindowActionData *mw)
-{
-    GncPluginPage *page;
-
-    g_return_if_fail (mw != NULL);
-    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
-
-    page = gnc_plugin_page_owner_tree_new (GNC_OWNER_CUSTOMER);
-    gnc_main_window_open_page (mw->window, page);
-}
-
-static void
-gnc_plugin_business_cmd_customer_new_customer (GtkAction *action,
-        GncMainWindowActionData *mw)
-{
-    g_return_if_fail (mw != NULL);
-    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
-
-    gnc_ui_customer_new (gnc_get_current_book());
-}
-
-static void
-gnc_plugin_business_cmd_customer_find_customer (GtkAction *action,
-        GncMainWindowActionData *mw)
-{
-    GncPluginBusiness *plugin;
-    GncPluginBusinessPrivate *priv;
-    GncCustomer*customer;
-
-    g_return_if_fail (mw != NULL);
-    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
-
-    plugin = GNC_PLUGIN_BUSINESS (mw->data);
-    priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
-    customer = gncOwnerGetCustomer (priv->last_customer);
-    gnc_customer_search (customer, gnc_get_current_book());
-}
-
-static void
-gnc_plugin_business_cmd_customer_new_invoice (GtkAction *action,
-        GncMainWindowActionData *mw)
-{
-    GncPluginBusiness *plugin;
-    GncPluginBusinessPrivate *priv;
-
-    g_return_if_fail (mw != NULL);
-    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
-
-    plugin = GNC_PLUGIN_BUSINESS (mw->data);
-    priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
-    last_window = mw->window;
-    gnc_ui_invoice_new (priv->last_customer, gnc_get_current_book());
-}
-
-static void
-gnc_plugin_business_cmd_customer_find_invoice (GtkAction *action,
-        GncMainWindowActionData *mw)
-{
-    GncPluginBusiness *plugin;
-    GncPluginBusinessPrivate *priv;
-
-    g_return_if_fail (mw != NULL);
-    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
-
-    plugin = GNC_PLUGIN_BUSINESS (mw->data);
-    priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
-    last_window = mw->window;
-    gnc_invoice_search (NULL, priv->last_customer, gnc_get_current_book());
-}
-
-static void
-gnc_plugin_business_cmd_customer_new_job (GtkAction *action,
-        GncMainWindowActionData *mw)
-{
-    GncPluginBusiness *plugin;
-    GncPluginBusinessPrivate *priv;
-
-    g_return_if_fail (mw != NULL);
-    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
-
-    plugin = GNC_PLUGIN_BUSINESS (mw->data);
-    priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
-    gnc_ui_job_new (priv->last_customer, gnc_get_current_book());
-}
-
-static void
-gnc_plugin_business_cmd_customer_find_job (GtkAction *action,
-        GncMainWindowActionData *mw)
-{
-    GncPluginBusiness *plugin;
-    GncPluginBusinessPrivate *priv;
-
-    g_return_if_fail (mw != NULL);
-    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
-
-    plugin = GNC_PLUGIN_BUSINESS (mw->data);
-    priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
-    gnc_job_search (NULL, priv->last_customer, gnc_get_current_book());
-}
-
-static void
-gnc_plugin_business_cmd_customer_process_payment (GtkAction *action,
-        GncMainWindowActionData *mw)
-{
-    GncPluginBusiness *plugin;
-    GncPluginBusinessPrivate *priv;
-
-    g_return_if_fail (mw != NULL);
-    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
-
-    plugin = GNC_PLUGIN_BUSINESS (mw->data);
-    priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
-    gnc_ui_payment_new (priv->last_customer, gnc_get_current_book());
-}
-
-static void
-gnc_plugin_business_cmd_vendor_page (GtkAction *action,
-                                     GncMainWindowActionData *mw)
-{
-    GncPluginPage *page;
-
-    g_return_if_fail (mw != NULL);
-    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
-
-    page = gnc_plugin_page_owner_tree_new (GNC_OWNER_VENDOR);
-    gnc_main_window_open_page (mw->window, page);
-}
-
-static void
-gnc_plugin_business_cmd_vendor_new_vendor (GtkAction *action,
-        GncMainWindowActionData *mw)
-{
-    g_return_if_fail (mw != NULL);
-    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
-
-    gnc_ui_vendor_new (gnc_get_current_book());
-}
-
-static void
-gnc_plugin_business_cmd_vendor_find_vendor (GtkAction *action,
-        GncMainWindowActionData *mw)
-{
-    GncPluginBusiness *plugin;
-    GncPluginBusinessPrivate *priv;
-    GncVendor *vendor;
-
-    g_return_if_fail (mw != NULL);
-    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
-
-    plugin = GNC_PLUGIN_BUSINESS (mw->data);
-    priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
-    vendor = gncOwnerGetVendor (priv->last_vendor);
-    gnc_vendor_search (vendor, gnc_get_current_book());
-}
-
-static void
-gnc_plugin_business_cmd_vendor_new_bill (GtkAction *action,
-        GncMainWindowActionData *mw)
-{
-    GncPluginBusiness *plugin;
-    GncPluginBusinessPrivate *priv;
-
-    g_return_if_fail (mw != NULL);
-    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
-
-    plugin = GNC_PLUGIN_BUSINESS (mw->data);
-    priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
-    last_window = mw->window;
-    gnc_ui_invoice_new (priv->last_vendor, gnc_get_current_book());
-}
-
-static void
-gnc_plugin_business_cmd_vendor_find_bill (GtkAction *action,
-        GncMainWindowActionData *mw)
-{
-    GncPluginBusiness *plugin;
-    GncPluginBusinessPrivate *priv;
-
-    g_return_if_fail (mw != NULL);
-    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
-
-    plugin = GNC_PLUGIN_BUSINESS (mw->data);
-    priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
-    last_window = mw->window;
-    gnc_invoice_search (NULL, priv->last_vendor, gnc_get_current_book());
-}
-
-static void
-gnc_plugin_business_cmd_vendor_new_job (GtkAction *action,
-                                        GncMainWindowActionData *mw)
-{
-    GncPluginBusiness *plugin;
-    GncPluginBusinessPrivate *priv;
-
-    g_return_if_fail (mw != NULL);
-    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
-
-    plugin = GNC_PLUGIN_BUSINESS (mw->data);
-    priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
-    gnc_ui_job_new (priv->last_vendor, gnc_get_current_book());
-}
-
-static void
-gnc_plugin_business_cmd_vendor_find_job (GtkAction *action,
-        GncMainWindowActionData *mw)
-{
-    GncPluginBusiness *plugin;
-    GncPluginBusinessPrivate *priv;
-
-    g_return_if_fail (mw != NULL);
-    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
-
-    plugin = GNC_PLUGIN_BUSINESS (mw->data);
-    priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
-    gnc_job_search (NULL, priv->last_vendor, gnc_get_current_book());
-}
-
-static void
-gnc_plugin_business_cmd_vendor_process_payment (GtkAction *action,
-        GncMainWindowActionData *mw)
-{
-    GncPluginBusiness *plugin;
-    GncPluginBusinessPrivate *priv;
-
-    g_return_if_fail (mw != NULL);
-    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
-
-    plugin = GNC_PLUGIN_BUSINESS (mw->data);
-    priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
-    gnc_ui_payment_new (priv->last_vendor, gnc_get_current_book());
-}
-
-static void
-gnc_plugin_business_cmd_employee_page (GtkAction *action,
-                                       GncMainWindowActionData *mw)
-{
-    GncPluginPage *page;
-
-    g_return_if_fail (mw != NULL);
-    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
-
-    page = gnc_plugin_page_owner_tree_new (GNC_OWNER_EMPLOYEE);
-    gnc_main_window_open_page (mw->window, page);
-}
-
-static void
-gnc_plugin_business_cmd_employee_new_employee (GtkAction *action,
-        GncMainWindowActionData *mw)
-{
-    g_return_if_fail (mw != NULL);
-    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
-
-    gnc_ui_employee_new (gnc_get_current_book());
-}
-
-static void
-gnc_plugin_business_cmd_employee_find_employee (GtkAction *action,
-        GncMainWindowActionData *mw)
-{
-    GncPluginBusiness *plugin;
-    GncPluginBusinessPrivate *priv;
-    GncEmployee *employee;
-
-    g_return_if_fail (mw != NULL);
-    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
-
-    plugin = GNC_PLUGIN_BUSINESS (mw->data);
-    priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
-    employee = gncOwnerGetEmployee (priv->last_employee);
-    gnc_employee_search (employee, gnc_get_current_book());
-}
-
-static void
-gnc_plugin_business_cmd_employee_new_expense_voucher (GtkAction *action,
-        GncMainWindowActionData *mw)
-{
-    GncPluginBusiness *plugin;
-    GncPluginBusinessPrivate *priv;
-
-    g_return_if_fail (mw != NULL);
-    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
-
-    plugin = GNC_PLUGIN_BUSINESS (mw->data);
-    priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
-    last_window = mw->window;
-    gnc_ui_invoice_new (priv->last_employee, gnc_get_current_book());
-}
-
-static void
-gnc_plugin_business_cmd_employee_find_expense_voucher (GtkAction *action,
-        GncMainWindowActionData *mw)
-{
-    GncPluginBusiness *plugin;
-    GncPluginBusinessPrivate *priv;
-
-    g_return_if_fail (mw != NULL);
-    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
-
-    plugin = GNC_PLUGIN_BUSINESS (mw->data);
-    priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
-    last_window = mw->window;
-    gnc_invoice_search (NULL, priv->last_employee, gnc_get_current_book());
-}
-
-static void
-gnc_plugin_business_cmd_employee_process_payment (GtkAction *action,
-        GncMainWindowActionData *mw)
-{
-    GncPluginBusiness *plugin;
-    GncPluginBusinessPrivate *priv;
-
-    g_return_if_fail (mw != NULL);
-    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
-
-    plugin = GNC_PLUGIN_BUSINESS (mw->data);
-    priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
-    gnc_ui_payment_new (priv->last_employee, gnc_get_current_book());
-}
-
-static void
-gnc_plugin_business_cmd_tax_tables (GtkAction *action,
-                                    GncMainWindowActionData *mw)
-{
-    g_return_if_fail (mw != NULL);
-    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
-
-    gnc_ui_tax_table_window_new (gnc_get_current_book());
-}
-
-static void
-gnc_plugin_business_cmd_billing_terms (GtkAction *action,
-                                       GncMainWindowActionData *mw)
-{
-    g_return_if_fail (mw != NULL);
-    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
-
-    gnc_ui_billterms_window_new (gnc_get_current_book());
-}
-
-
-static void
-gnc_plugin_business_cmd_bills_due_reminder (GtkAction *action,
-        GncMainWindowActionData *mw)
-{
-    g_return_if_fail (mw != NULL);
-    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
-
-    gnc_invoice_remind_bills_due();
-}
-
-
-static void
-gnc_plugin_business_cmd_invoices_due_reminder (GtkAction *action,
-        GncMainWindowActionData *mw)
-{
-    g_return_if_fail (mw != NULL);
-    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
-
-    gnc_invoice_remind_invoices_due();
-}
-
-static void
-gnc_plugin_business_cmd_test_search (GtkAction *action,
-                                     GncMainWindowActionData *data)
-{
-    gnc_search_dialog_test();
-}
-
-static void gnc_business_assign_payment (GtkWidget *parent,
-        Transaction *trans,
-        GncOwner *owner)
-{
-    g_return_if_fail(trans);
-
-    // Do nothing if we don't have more than one split (e.g. in the empty line at the end of the register)
-    if (xaccTransCountSplits(trans) <= 1)
-        return;
-
-    //g_message("Creating payment dialog with trans %p", trans);
-    gnc_ui_payment_new_with_txn(owner, trans);
-}
-
-static void gnc_plugin_business_cmd_assign_payment (GtkAction *action,
-        GncMainWindowActionData *mw)
-{
-    GncPluginBusiness *plugin_business;
-    GncPluginBusinessPrivate *plugin_business_priv;
-    GncPluginPage *plugin_page;
-    GNCSplitReg *gsr;
-    SplitRegister *reg;
-    Split *split;
-    Transaction *trans;
-    gboolean have_owner;
-    GncOwner owner;
-    GncOwner *owner_p;
-
-    g_return_if_fail (mw != NULL);
-    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
-
-    plugin_page = gnc_main_window_get_current_page(mw->window);
-
-    // We continue only if the current page is a plugin page and more
-    // specifically a register plugin page
-    if (!GNC_IS_PLUGIN_PAGE(plugin_page)
-            || !GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page))
-        return;
-
-    gsr = gnc_plugin_page_register_get_gsr(plugin_page);
-    g_return_if_fail(gsr);
-
-    reg = gnc_ledger_display_get_split_register( gsr->ledger );
-    g_return_if_fail(reg);
-
-    split = gnc_split_register_get_current_split(reg);
-    g_return_if_fail(split);
-
-    trans = xaccSplitGetParent(split);
-    g_return_if_fail(trans);
-
-    plugin_business = GNC_PLUGIN_BUSINESS (mw->data);
-    plugin_business_priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin_business);
-
-    have_owner = gncOwnerGetOwnerFromTxn (trans, &owner);
-    if (have_owner)
-        owner_p = &owner;
-    else if (gnc_ui_payment_is_customer_payment(trans))
-        owner_p = plugin_business_priv->last_customer;
-    else
-        owner_p = plugin_business_priv->last_vendor;
-
-    gnc_business_assign_payment (gnc_plugin_page_get_window(plugin_page),
-                                 trans, owner_p);
-}
-
-static const gchar *register_txn_actions[] =
-{
-    "RegisterAssignPayment",
-    NULL
-};
-
-static void
-gnc_plugin_business_update_menus (GncPluginPage *plugin_page)
-{
-    GncMainWindow  *window;
-    GtkActionGroup *action_group;
-    gboolean is_txn_register;
-
-    // We continue only if the current page is a plugin page
-    if (!plugin_page || !GNC_IS_PLUGIN_PAGE(plugin_page))
-        return;
-
-    is_txn_register = GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page);
-    window = GNC_MAIN_WINDOW(plugin_page->window);
-    g_return_if_fail(GNC_IS_MAIN_WINDOW(window));
-    action_group = gnc_main_window_get_action_group(window, PLUGIN_ACTIONS_NAME);
-    g_return_if_fail(GTK_IS_ACTION_GROUP(action_group));
-
-    // Change visibility and also sensitivity according to whether we are in a txn register
-    gnc_plugin_update_actions (action_group, register_txn_actions,
-                               "sensitive", is_txn_register);
-    gnc_plugin_update_actions (action_group, register_txn_actions,
-                               "visible", is_txn_register);
-}
-
-
-static void gnc_plugin_business_main_window_page_changed(GncMainWindow *window,
-        GncPluginPage *page,
-        gpointer user_data)
-{
-    gnc_plugin_business_update_menus(page);
-    update_inactive_actions(page);
-}
-
-static void
-gnc_plugin_business_cmd_test_init_data (GtkAction *action,
-                                        GncMainWindowActionData *data)
-{
-    QofBook *book		= gnc_get_current_book();
-    GncCustomer *customer	= gncCustomerCreate(book);
-    GncAddress *address	= gncCustomerGetAddr(customer);
-    GncInvoice *invoice	= gncInvoiceCreate(book);
-    GncOwner *owner		= gncOwnerNew();
-    GncJob *job		= gncJobCreate(book);
-    Account *root		= gnc_book_get_root_account(book);
-    Account *inc_acct	= xaccMallocAccount(book);
-    Account *bank_acct	= xaccMallocAccount(book);
-    Account *tax_acct	= xaccMallocAccount(book);
-    Account *ar_acct	= xaccMallocAccount(book);
-    Timespec now;
-
-    // Create Customer
-    gncCustomerSetID(customer, "000001");
-    gncCustomerSetName(customer, "Test Customer");
-    gncCustomerSetCurrency(customer, gnc_default_currency());
-    gncAddressSetName(address, "Contact Person");
-    gncAddressSetAddr1(address, "20 Customer Lane");
-    gncAddressSetAddr2(address, "Customer M/S");
-    gncAddressSetAddr3(address, "Addr3, XXX  12345");
-
-    // Create the Owner
-    gncOwnerInitCustomer(owner, customer);
-
-    // Create the Invoice
-    timespecFromTime64(&now, time(NULL));
-    gncInvoiceSetID(invoice, "000012");
-    gncInvoiceSetOwner(invoice, owner);
-    gncInvoiceSetDateOpened(invoice, now);
-    gncInvoiceSetCurrency(invoice, gnc_default_currency());
-
-    // Create the Job
-    gncJobSetID(job, "000025");
-    gncJobSetName(job, "Test Job");
-    gncJobSetReference(job, "Customer's ref#");
-    gncJobSetOwner(job, owner);
-
-    // MODIFY THE OWNER
-    gncOwnerInitJob(owner, job);
-
-    // Create the A/R account
-    xaccAccountSetType(ar_acct, ACCT_TYPE_RECEIVABLE);
-    xaccAccountSetName(ar_acct, "A/R");
-    xaccAccountSetCommodity(ar_acct, gnc_default_currency());
-    gnc_account_append_child(root, ar_acct);
-
-    // Create the Income account
-    xaccAccountSetType(inc_acct, ACCT_TYPE_INCOME);
-    xaccAccountSetName(inc_acct, "Income");
-    xaccAccountSetCommodity(inc_acct, gnc_default_currency());
-    gnc_account_append_child(root, inc_acct);
-
-    // Create the Bank account
-    xaccAccountSetType(bank_acct, ACCT_TYPE_BANK);
-    xaccAccountSetName(bank_acct, "Bank");
-    xaccAccountSetCommodity(bank_acct, gnc_default_currency());
-    gnc_account_append_child(root, bank_acct);
-
-    // Create the Tax account
-    xaccAccountSetType(tax_acct, ACCT_TYPE_LIABILITY);
-    xaccAccountSetName(tax_acct, "Tax-Holding");
-    xaccAccountSetCommodity(tax_acct, gnc_default_currency());
-    gnc_account_append_child(root, tax_acct);
-
-    // Launch the invoice editor
-    gnc_ui_invoice_edit(invoice);
-}
-
-/* This is the list of actions which are switched inactive in a read-only book. */
-static const gchar* readonly_inactive_actions[] =
-{
-    "CustomerNewCustomerOpenAction",
-    "CustomerNewInvoiceOpenAction",
-    "CustomerNewInvoiceOpenAction",
-    "CustomerNewJobOpenAction",
-    "CustomerProcessPaymentAction",
-    "VendorNewVendorOpenAction",
-    "VendorNewBillOpenAction",
-    "VendorNewJobOpenAction",
-    "VendorProcessPaymentAction",
-    "EmployeeNewEmployeeOpenAction",
-    "EmployeeNewExpenseVoucherOpenAction",
-    "EmployeeProcessPaymentAction",
-    "ToolbarNewInvoiceAction",
-    "RegisterAssignPayment",
-    NULL
-};
-
-static void update_inactive_actions(GncPluginPage *plugin_page)
-{
-    GncMainWindow  *window;
-    GtkActionGroup *action_group;
-
-    // We are readonly - so we have to switch particular actions to inactive.
-    gboolean is_readwrite = !qof_book_is_readonly(gnc_get_current_book());
-
-    // We continue only if the current page is a plugin page
-    if (!plugin_page || !GNC_IS_PLUGIN_PAGE(plugin_page))
-        return;
-
-    window = GNC_MAIN_WINDOW(plugin_page->window);
-    g_return_if_fail(GNC_IS_MAIN_WINDOW(window));
-    action_group = gnc_main_window_get_action_group(window, PLUGIN_ACTIONS_NAME);
-    g_return_if_fail(GTK_IS_ACTION_GROUP(action_group));
-
-    /* Set the action's sensitivity */
-    gnc_plugin_update_actions (action_group, readonly_inactive_actions,
-                               "sensitive", is_readwrite);
-}
-
-/* This is the list of actions which are switched invisible or visible
- * depending on the preference "extra_toolbuttons". */
-static const char* extra_toolbar_actions[] =
-{
-    "ToolbarNewInvoiceAction",
-    NULL
-};
-
-/* Bind the visibility of the extra toolbar buttons to the
- * enable_toolbuttons preference. */
-static void bind_toolbuttons_visibility (GncMainWindow *mainwindow)
-{
-    GtkActionGroup *action_group;
-    const char **iter;
-
-    g_return_if_fail(mainwindow);
-    g_return_if_fail(GNC_IS_MAIN_WINDOW(mainwindow));
-
-    /* Get the action group */
-    action_group =
-        gnc_main_window_get_action_group(mainwindow, PLUGIN_ACTIONS_NAME);
-    g_assert(action_group);
-
-    for (iter = extra_toolbar_actions; *iter; ++iter)
-    {
-        /* Set the action's visibility */
-        GtkAction *action = gtk_action_group_get_action (action_group, *iter);
-        gnc_prefs_bind (GNC_PREFS_GROUP_INVOICE, GNC_PREF_EXTRA_TOOLBUTTONS, G_OBJECT (action), "visible");
-    }
-}
-
-/**
- * Called when this plugin is added to a main window.  Connect a few callbacks
- * here to track page changes.
- *
- * Update the toolbar button visibility each time our plugin is added
- * to a new GncMainWindow. */
-static void gnc_plugin_business_add_to_window (GncPlugin *plugin,
-        GncMainWindow *mainwindow,
-        GQuark type)
-{
-    bind_toolbuttons_visibility (mainwindow);
-
-    g_signal_connect(mainwindow, "page_changed",
-                     G_CALLBACK(gnc_plugin_business_main_window_page_changed),
-                     plugin);
-}
-
-static const char* invoice_printreport_values[] =
-{
-    /* The list below are the guids of reports that can
-     * be used to print an invoice.
-     * Important: this list must be kept in sync with the one at the end
-     * of business-prefs.glade
-     */
-    "5123a759ceb9483abf2182d01c140e8d", // "Printable Invoice"
-    "0769e242be474010b4acf264a5512e6e", // "Tax Invoice"
-    "67112f318bef4fc496bdc27d106bbda4", // "Easy Invoice"
-    "3ce293441e894423a2425d7a22dd1ac6", // "Fancy Invoice"
-    NULL
-};
-
-const char *gnc_plugin_business_get_invoice_printreport(void)
-{
-    int value = gnc_prefs_get_int (GNC_PREFS_GROUP_INVOICE, GNC_PREF_INV_PRINT_RPT);
-    if (value >= 0 && value < 4)
-        return invoice_printreport_values[value];
-    else
-        return NULL;
-}
diff --git a/src/gnome/gnc-plugin-page-register.c b/src/gnome/gnc-plugin-page-register.c
deleted file mode 100644
index 461b942..0000000
--- a/src/gnome/gnc-plugin-page-register.c
+++ /dev/null
@@ -1,4192 +0,0 @@
-/**********************************************************************
- * gnc-plugin-page-register.c -- register page functions              *
- *                                                                    *
- * Copyright (C) 2003 Jan Arne Petersen <jpetersen at uni-bonn.de>       *
- * Copyright (C) 2003,2005,2006 David Hampton <hampton at employees.org> *
- * Copyright (C) 2011, Robert Fewell                                  *
- *                                                                    *
- * 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 at gnu.org                     *
- **********************************************************************/
-
-/** @addtogroup ContentPlugins
-    @{ */
-/** @addtogroup RegisterPlugin Register Page
-    @{ */
-/** @file gnc-plugin-page-register.c
-    @brief  Functions providing a register page for the GnuCash UI
-    @author Copyright (C) 2003 Jan Arne Petersen <jpetersen at uni-bonn.de>
-    @author Copyright (C) 2003,2005 David Hampton <hampton at employees.org>
-*/
-
-#include "config.h"
-
-#include <libguile.h>
-#include "guile-mappings.h"
-#include <gtk/gtk.h>
-#include <glib/gi18n.h>
-#include "swig-runtime.h"
-
-#include "gnc-plugin-page-register.h"
-/*################## Added for Reg2 #################*/
-#include "gnc-plugin-page-register2.h"
-/*################## Added for Reg2 #################*/
-#include "gnc-plugin-register.h"
-#include "gnc-plugin-menu-additions.h"
-#include "gnc-plugin-page-report.h"
-
-#include "dialog-account.h"
-#include "dialog-find-account.h"
-#include "dialog-find-transactions.h"
-#include "dialog-print-check.h"
-#include "dialog-transfer.h"
-#include "dialog-utils.h"
-#include "assistant-stock-split.h"
-#include "gnc-component-manager.h"
-#include "gnc-date.h"
-#include "gnc-date-edit.h"
-#include "gnc-engine.h"
-#include "gnc-event.h"
-#include "gnc-gnome-utils.h"
-#include "gnc-gobject-utils.h"
-#include "gnc-gui-query.h"
-#include "gnc-icons.h"
-#include "gnc-split-reg.h"
-#include "gnc-prefs.h"
-#include "gnc-ui-util.h"
-#include "gnc-window.h"
-#include "gnc-main-window.h"
-#include "gnc-session.h"
-#include "gnome-utils/gnc-warnings.h"
-#include "gnucash-sheet.h"
-#include "dialog-lot-viewer.h"
-#include "Scrub.h"
-#include "ScrubBusiness.h"
-#include "qof.h"
-#include "window-reconcile.h"
-#include "window-autoclear.h"
-#include "window-report.h"
-#include "engine-helpers.h"
-#include "qofbookslots.h"
-
-/* This static indicates the debugging module that this .o belongs to.  */
-static QofLogModule log_module = GNC_MOD_GUI;
-
-#define DEFAULT_LINES_AMOUNT         50
-
-static void gnc_plugin_page_register_class_init (GncPluginPageRegisterClass *klass);
-static void gnc_plugin_page_register_init (GncPluginPageRegister *plugin_page);
-static void gnc_plugin_page_register_finalize (GObject *object);
-
-/* static Account *gnc_plugin_page_register_get_current_account (GncPluginPageRegister *page); */
-
-static GtkWidget *gnc_plugin_page_register_create_widget (GncPluginPage *plugin_page);
-static void gnc_plugin_page_register_destroy_widget (GncPluginPage *plugin_page);
-static void gnc_plugin_page_register_window_changed (GncPluginPage *plugin_page, GtkWidget *window);
-static void gnc_plugin_page_register_save_page (GncPluginPage *plugin_page, GKeyFile *file, const gchar *group);
-static GncPluginPage *gnc_plugin_page_register_recreate_page (GtkWidget *window, GKeyFile *file, const gchar *group);
-static void gnc_plugin_page_register_update_edit_menu (GncPluginPage *page, gboolean hide);
-static gboolean gnc_plugin_page_register_finish_pending (GncPluginPage *page);
-
-static gchar *gnc_plugin_page_register_get_tab_name (GncPluginPage *plugin_page);
-static gchar *gnc_plugin_page_register_get_tab_color (GncPluginPage *plugin_page);
-static gchar *gnc_plugin_page_register_get_long_name (GncPluginPage *plugin_page);
-
-static void gnc_plugin_page_register_summarybar_position_changed(gpointer prefs, gchar* pref, gpointer user_data);
-
-/* Callbacks for the "Sort By" dialog */
-void gnc_plugin_page_register_sort_button_cb(GtkToggleButton *button, GncPluginPageRegister *page);
-void gnc_plugin_page_register_sort_response_cb(GtkDialog *dialog, gint response, GncPluginPageRegister *plugin_page);
-void gnc_plugin_page_register_sort_order_save_cb(GtkToggleButton *button, GncPluginPageRegister *page);
-void gnc_plugin_page_register_sort_order_reverse_cb(GtkToggleButton *button, GncPluginPageRegister *page);
-
-static gchar *gnc_plugin_page_register_get_sort_order (GncPluginPage *plugin_page);
-void gnc_plugin_page_register_set_sort_order (GncPluginPage *plugin_page, const gchar *sort_order);
-static gboolean gnc_plugin_page_register_get_sort_reversed (GncPluginPage *plugin_page);
-void gnc_plugin_page_register_set_sort_reversed (GncPluginPage *plugin_page, gboolean reverse_order);
-
-/* Callbacks for the "Filter By" dialog */
-void gnc_plugin_page_register_filter_select_range_cb(GtkRadioButton *button, GncPluginPageRegister *page);
-void gnc_plugin_page_register_filter_start_cb(GtkWidget *radio, GncPluginPageRegister *page);
-void gnc_plugin_page_register_filter_end_cb(GtkWidget *radio, GncPluginPageRegister *page);
-void gnc_plugin_page_register_filter_response_cb(GtkDialog *dialog, gint response, GncPluginPageRegister *plugin_page);
-void gnc_plugin_page_register_filter_status_all_cb(GtkButton *button, GncPluginPageRegister *plugin_page);
-void gnc_plugin_page_register_filter_status_one_cb(GtkToggleButton *button, GncPluginPageRegister *page);
-void gnc_plugin_page_register_filter_save_cb(GtkToggleButton *button, GncPluginPageRegister *page);
-
-static time64 gnc_plugin_page_register_filter_dmy2time (char *date_string);
-static gchar *gnc_plugin_page_register_filter_time2dmy (time64 raw_time);
-static gchar *gnc_plugin_page_register_get_filter (GncPluginPage *plugin_page);
-void gnc_plugin_page_register_set_filter (GncPluginPage *plugin_page, const gchar *filter);
-
-static void gnc_ppr_update_status_query (GncPluginPageRegister *page);
-static void gnc_ppr_update_date_query (GncPluginPageRegister *page);
-
-/* Command callbacks */
-static void gnc_plugin_page_register_cmd_print_check (GtkAction *action, GncPluginPageRegister *plugin_page);
-static void gnc_plugin_page_register_cmd_cut (GtkAction *action, GncPluginPageRegister *plugin_page);
-static void gnc_plugin_page_register_cmd_copy (GtkAction *action, GncPluginPageRegister *plugin_page);
-static void gnc_plugin_page_register_cmd_paste (GtkAction *action, GncPluginPageRegister *plugin_page);
-static void gnc_plugin_page_register_cmd_edit_account (GtkAction *action, GncPluginPageRegister *plugin_page);
-static void gnc_plugin_page_register_cmd_find_account (GtkAction *action, GncPluginPageRegister *plugin_page);
-static void gnc_plugin_page_register_cmd_find_transactions (GtkAction *action, GncPluginPageRegister *plugin_page);
-static void gnc_plugin_page_register_cmd_cut_transaction (GtkAction *action, GncPluginPageRegister *plugin_page);
-static void gnc_plugin_page_register_cmd_copy_transaction (GtkAction *action, GncPluginPageRegister *plugin_page);
-static void gnc_plugin_page_register_cmd_paste_transaction (GtkAction *action, GncPluginPageRegister *plugin_page);
-static void gnc_plugin_page_register_cmd_void_transaction (GtkAction *action, GncPluginPageRegister *plugin_page);
-static void gnc_plugin_page_register_cmd_unvoid_transaction (GtkAction *action, GncPluginPageRegister *plugin_page);
-static void gnc_plugin_page_register_cmd_reverse_transaction (GtkAction *action, GncPluginPageRegister *plugin_page);
-static void gnc_plugin_page_register_cmd_view_sort_by (GtkAction *action, GncPluginPageRegister *plugin_page);
-static void gnc_plugin_page_register_cmd_view_filter_by (GtkAction *action, GncPluginPageRegister *plugin_page);
-static void gnc_plugin_page_register_cmd_style_changed (GtkAction *action, GtkRadioAction *current, GncPluginPageRegister *plugin_page);
-static void gnc_plugin_page_register_cmd_style_double_line (GtkToggleAction *action, GncPluginPageRegister *plugin_page);
-
-static void gnc_plugin_page_register_cmd_reconcile (GtkAction *action, GncPluginPageRegister *plugin_page);
-static void gnc_plugin_page_register_cmd_autoclear (GtkAction *action, GncPluginPageRegister *plugin_page);
-static void gnc_plugin_page_register_cmd_transfer (GtkAction *action, GncPluginPageRegister *plugin_page);
-static void gnc_plugin_page_register_cmd_stock_split (GtkAction *action, GncPluginPageRegister *plugin_page);
-static void gnc_plugin_page_register_cmd_lots (GtkAction *action, GncPluginPageRegister *plugin_page);
-static void gnc_plugin_page_register_cmd_enter_transaction (GtkAction *action, GncPluginPageRegister *plugin_page);
-static void gnc_plugin_page_register_cmd_cancel_transaction (GtkAction *action, GncPluginPageRegister *plugin_page);
-static void gnc_plugin_page_register_cmd_delete_transaction (GtkAction *action, GncPluginPageRegister *plugin_page);
-static void gnc_plugin_page_register_cmd_blank_transaction (GtkAction *action, GncPluginPageRegister *plugin_page);
-static void gnc_plugin_page_register_cmd_duplicate_transaction (GtkAction *action, GncPluginPageRegister *plugin_page);
-static void gnc_plugin_page_register_cmd_reinitialize_transaction (GtkAction *action, GncPluginPageRegister *plugin_page);
-static void gnc_plugin_page_register_cmd_expand_transaction (GtkToggleAction *action, GncPluginPageRegister *plugin_page);
-static void gnc_plugin_page_register_cmd_exchange_rate (GtkAction *action, GncPluginPageRegister *plugin_page);
-static void gnc_plugin_page_register_cmd_jump (GtkAction *action, GncPluginPageRegister *plugin_page);
-static void gnc_plugin_page_register_cmd_schedule (GtkAction *action, GncPluginPageRegister *plugin_page);
-static void gnc_plugin_page_register_cmd_scrub_all (GtkAction *action, GncPluginPageRegister *plugin_page);
-static void gnc_plugin_page_register_cmd_scrub_current (GtkAction *action, GncPluginPageRegister *plugin_page);
-static void gnc_plugin_page_register_cmd_account_report (GtkAction *action, GncPluginPageRegister *plugin_page);
-static void gnc_plugin_page_register_cmd_transaction_report (GtkAction *action, GncPluginPageRegister *plugin_page);
-static void gnc_plugin_page_register_cmd_associate_file_transaction (GtkAction *action, GncPluginPageRegister *plugin_page);
-static void gnc_plugin_page_register_cmd_associate_location_transaction (GtkAction *action, GncPluginPageRegister *plugin_page);
-static void gnc_plugin_page_register_cmd_execassociated_transaction (GtkAction *action, GncPluginPageRegister *plugin_page);
-
-static void gnc_plugin_page_help_changed_cb( GNCSplitReg *gsr, GncPluginPageRegister *register_page );
-static void gnc_plugin_page_register_refresh_cb (GHashTable *changes, gpointer user_data);
-static void gnc_plugin_page_register_close_cb (gpointer user_data);
-
-static void gnc_plugin_page_register_ui_update (gpointer various, GncPluginPageRegister *page);
-static void gppr_account_destroy_cb (Account *account);
-static void gnc_plugin_page_register_event_handler (QofInstance *entity,
-        QofEventId event_type,
-        GncPluginPageRegister *page,
-        GncEventData *ed);
-
-/************************************************************/
-/*                          Actions                         */
-/************************************************************/
-
-#define CUT_TRANSACTION_LABEL            N_("Cu_t Transaction")
-#define COPY_TRANSACTION_LABEL           N_("_Copy Transaction")
-#define PASTE_TRANSACTION_LABEL          N_("_Paste Transaction")
-#define DUPLICATE_TRANSACTION_LABEL      N_("Dup_licate Transaction")
-#define DELETE_TRANSACTION_LABEL         N_("_Delete Transaction")
-#define ASSOCIATE_TRANSACTION_FILE_LABEL      N_("_Associate File with Transaction")
-#define ASSOCIATE_TRANSACTION_LOCATION_LABEL  N_("_Associate Location with Transaction")
-#define EXECASSOCIATED_TRANSACTION_LABEL N_("_Open Associated File/Location")
-#define CUT_SPLIT_LABEL                  N_("Cu_t Split")
-#define COPY_SPLIT_LABEL                 N_("_Copy Split")
-#define PASTE_SPLIT_LABEL                N_("_Paste Split")
-#define DUPLICATE_SPLIT_LABEL            N_("Dup_licate Split")
-#define DELETE_SPLIT_LABEL               N_("_Delete Split")
-#define CUT_TRANSACTION_TIP              N_("Cut the selected transaction into clipboard")
-#define COPY_TRANSACTION_TIP             N_("Copy the selected transaction into clipboard")
-#define PASTE_TRANSACTION_TIP            N_("Paste the transaction from the clipboard")
-#define DUPLICATE_TRANSACTION_TIP        N_("Make a copy of the current transaction")
-#define DELETE_TRANSACTION_TIP           N_("Delete the current transaction")
-#define ASSOCIATE_TRANSACTION_FILE_TIP   N_("Associate a file with the current transaction")
-#define ASSOCIATE_TRANSACTION_LOCATION_TIP    N_("Associate a location with the current transaction")
-#define EXECASSOCIATED_TRANSACTION_TIP   N_("Open the associated file or location with the current transaction")
-#define CUT_SPLIT_TIP                    N_("Cut the selected split into clipboard")
-#define COPY_SPLIT_TIP                   N_("Copy the selected split into clipboard")
-#define PASTE_SPLIT_TIP                  N_("Paste the split from the clipboard")
-#define DUPLICATE_SPLIT_TIP              N_("Make a copy of the current split")
-#define DELETE_SPLIT_TIP                 N_("Delete the current split")
-
-static GtkActionEntry gnc_plugin_page_register_actions [] =
-{
-    /* File menu */
-
-    {
-        "FilePrintAction", "document-print", N_("_Print Checks..."), "<primary>p", NULL,
-        G_CALLBACK (gnc_plugin_page_register_cmd_print_check)
-    },
-
-    /* Edit menu */
-
-    {
-        "EditCutAction", "edit-cut", N_("Cu_t"), "<primary>X",
-        N_("Cut the current selection and copy it to clipboard"),
-        G_CALLBACK (gnc_plugin_page_register_cmd_cut)
-    },
-    {
-        "EditCopyAction", "edit-copy", N_("_Copy"), "<primary>C",
-        N_("Copy the current selection to clipboard"),
-        G_CALLBACK (gnc_plugin_page_register_cmd_copy)
-    },
-    {
-        "EditPasteAction", "edit-paste", N_("_Paste"), "<primary>V",
-        N_("Paste the clipboard content at the cursor position"),
-        G_CALLBACK (gnc_plugin_page_register_cmd_paste)
-    },
-    {
-        "EditEditAccountAction", GNC_ICON_EDIT_ACCOUNT, N_("Edit _Account"), "<primary>e",
-        N_("Edit the selected account"),
-        G_CALLBACK (gnc_plugin_page_register_cmd_edit_account)
-    },
-    {
-        "EditFindAccountAction", "edit-find", N_("F_ind Account"), "<primary>i",
-        N_("Find an account"),
-        G_CALLBACK (gnc_plugin_page_register_cmd_find_account)
-    },
-    {
-        "EditFindTransactionsAction", "edit-find", N_("_Find..."), "<primary>f",
-        N_("Find transactions with a search"),
-        G_CALLBACK (gnc_plugin_page_register_cmd_find_transactions)
-    },
-
-    /* Transaction menu */
-
-    {
-        "CutTransactionAction", "edit-cut", CUT_TRANSACTION_LABEL, "",
-        CUT_TRANSACTION_TIP,
-        G_CALLBACK (gnc_plugin_page_register_cmd_cut_transaction)
-    },
-    {
-        "CopyTransactionAction", "edit-copy", COPY_TRANSACTION_LABEL, "",
-        COPY_TRANSACTION_TIP,
-        G_CALLBACK (gnc_plugin_page_register_cmd_copy_transaction)
-    },
-    {
-        "PasteTransactionAction", "edit-paste", PASTE_TRANSACTION_LABEL, "",
-        PASTE_TRANSACTION_TIP,
-        G_CALLBACK (gnc_plugin_page_register_cmd_paste_transaction)
-    },
-    {
-        "DuplicateTransactionAction", "edit-copy", DUPLICATE_TRANSACTION_LABEL, "",
-        DUPLICATE_TRANSACTION_TIP,
-        G_CALLBACK (gnc_plugin_page_register_cmd_duplicate_transaction)
-    },
-    {
-        "DeleteTransactionAction", "edit-delete", DELETE_TRANSACTION_LABEL, NULL,
-        DELETE_TRANSACTION_TIP,
-        G_CALLBACK (gnc_plugin_page_register_cmd_delete_transaction)
-    },
-    {
-        "RemoveTransactionSplitsAction", "edit-clear", N_("Remo_ve Other Splits"), NULL,
-        N_("Remove all splits in the current transaction"),
-        G_CALLBACK (gnc_plugin_page_register_cmd_reinitialize_transaction)
-    },
-    {
-        "RecordTransactionAction", "list-add", N_("_Enter Transaction"), NULL,
-        N_("Record the current transaction"),
-        G_CALLBACK (gnc_plugin_page_register_cmd_enter_transaction)
-    },
-    {
-        "CancelTransactionAction", "process-stop", N_("Ca_ncel Transaction"), NULL,
-        N_("Cancel the current transaction"),
-        G_CALLBACK (gnc_plugin_page_register_cmd_cancel_transaction)
-    },
-    {
-        "VoidTransactionAction", NULL, N_("_Void Transaction"), NULL, NULL,
-        G_CALLBACK (gnc_plugin_page_register_cmd_void_transaction)
-    },
-    {
-        "UnvoidTransactionAction", NULL, N_("_Unvoid Transaction"), NULL, NULL,
-        G_CALLBACK (gnc_plugin_page_register_cmd_unvoid_transaction)
-    },
-    {
-        "ReverseTransactionAction", NULL, N_("Add _Reversing Transaction"), NULL, NULL,
-        G_CALLBACK (gnc_plugin_page_register_cmd_reverse_transaction)
-    },
-    {
-        "AssociateTransactionFileAction", NULL, ASSOCIATE_TRANSACTION_FILE_LABEL, NULL,
-        ASSOCIATE_TRANSACTION_FILE_TIP,
-        G_CALLBACK (gnc_plugin_page_register_cmd_associate_file_transaction)
-    },
-    {
-        "AssociateTransactionLocationAction", NULL, ASSOCIATE_TRANSACTION_LOCATION_LABEL, NULL,
-        ASSOCIATE_TRANSACTION_LOCATION_TIP,
-        G_CALLBACK (gnc_plugin_page_register_cmd_associate_location_transaction)
-    },
-    {
-        "ExecAssociatedTransactionAction", NULL, EXECASSOCIATED_TRANSACTION_LABEL, NULL,
-        EXECASSOCIATED_TRANSACTION_TIP,
-        G_CALLBACK (gnc_plugin_page_register_cmd_execassociated_transaction)
-    },
-
-    /* View menu */
-
-    {
-        "ViewSortByAction", NULL, N_("_Sort By..."), NULL, NULL,
-        G_CALLBACK (gnc_plugin_page_register_cmd_view_sort_by)
-    },
-    {
-        "ViewFilterByAction", NULL, N_("_Filter By..."), NULL, NULL,
-        G_CALLBACK (gnc_plugin_page_register_cmd_view_filter_by)
-    },
-
-    /* Actions menu */
-
-    {
-        "ActionsTransferAction", GNC_ICON_TRANSFER, N_("_Transfer..."), "<primary>t",
-        N_("Transfer funds from one account to another"),
-        G_CALLBACK (gnc_plugin_page_register_cmd_transfer)
-    },
-    {
-        "ActionsReconcileAction", "edit-select-all", N_("_Reconcile..."), NULL,
-        N_("Reconcile the selected account"),
-        G_CALLBACK (gnc_plugin_page_register_cmd_reconcile)
-    },
-    {
-        "ActionsAutoClearAction", "edit-select-all", N_("_Auto-clear..."), NULL,
-        N_("Automatically clear individual transactions, so as to reach a certain cleared amount"),
-        G_CALLBACK (gnc_plugin_page_register_cmd_autoclear)
-    },
-    {
-        "ActionsStockSplitAction", NULL, N_("Stoc_k Split..."), NULL,
-        N_("Record a stock split or a stock merger"),
-        G_CALLBACK (gnc_plugin_page_register_cmd_stock_split)
-    },
-    {
-        "ActionsLotsAction", NULL, N_("View _Lots..."), NULL,
-        N_("Bring up the lot viewer/editor window"),
-        G_CALLBACK (gnc_plugin_page_register_cmd_lots)
-    },
-    {
-        "BlankTransactionAction", "go-bottom", N_("_Blank Transaction"), "<primary>Page_Down",
-        N_("Move to the blank transaction at the bottom of the register"),
-        G_CALLBACK (gnc_plugin_page_register_cmd_blank_transaction)
-    },
-    {
-        "EditExchangeRateAction", NULL, N_("Edit E_xchange Rate"), NULL,
-        N_("Edit the exchange rate for the current transaction"),
-        G_CALLBACK (gnc_plugin_page_register_cmd_exchange_rate)
-    },
-    {
-        "JumpTransactionAction", GNC_ICON_JUMP_TO, N_("_Jump"), NULL,
-        N_("Jump to the corresponding transaction in the other account"),
-        G_CALLBACK (gnc_plugin_page_register_cmd_jump)
-    },
-    {
-        "ScheduleTransactionAction", GNC_ICON_SCHEDULE, N_("Sche_dule..."), NULL,
-        N_("Create a Scheduled Transaction with the current transaction as a template"),
-        G_CALLBACK (gnc_plugin_page_register_cmd_schedule)
-    },
-    {
-        "ScrubAllAction", NULL, N_("_All transactions"), NULL, NULL,
-        G_CALLBACK (gnc_plugin_page_register_cmd_scrub_all)
-    },
-    {
-        "ScrubCurrentAction", NULL, N_("_This transaction"), NULL, NULL,
-        G_CALLBACK (gnc_plugin_page_register_cmd_scrub_current)
-    },
-
-    /* Reports menu */
-
-    {
-        "ReportsAccountReportAction", NULL, N_("Account Report"), NULL,
-        N_("Open a register report for this Account"),
-        G_CALLBACK (gnc_plugin_page_register_cmd_account_report)
-    },
-    {
-        "ReportsAcctTransReportAction", NULL, N_("Account Report - Single Transaction"), NULL,
-        N_("Open a register report for the selected Transaction"),
-        G_CALLBACK (gnc_plugin_page_register_cmd_transaction_report)
-    },
-};
-
-static guint gnc_plugin_page_register_n_actions = G_N_ELEMENTS (gnc_plugin_page_register_actions);
-
-static GtkToggleActionEntry toggle_entries[] =
-{
-    {
-        "ViewStyleDoubleLineAction", NULL, N_("_Double Line"), NULL,
-        N_("Show two lines of information for each transaction"),
-        G_CALLBACK (gnc_plugin_page_register_cmd_style_double_line), FALSE
-    },
-
-    {
-        "SplitTransactionAction", GNC_ICON_SPLIT_TRANS, N_("S_plit Transaction"), NULL,
-        N_("Show all splits in the current transaction"),
-        G_CALLBACK (gnc_plugin_page_register_cmd_expand_transaction), FALSE
-    },
-};
-
-static guint n_toggle_entries = G_N_ELEMENTS (toggle_entries);
-
-static GtkRadioActionEntry radio_entries_2 [] =
-{
-    /* Translators: This is a menu item in the View menu */
-    {
-        "ViewStyleBasicAction", NULL, N_("_Basic Ledger"), NULL,
-        N_("Show transactions on one or two lines"), REG_STYLE_LEDGER
-    },
-    /* Translators: This is a menu item in the View menu */
-    {
-        "ViewStyleAutoSplitAction", NULL, N_("_Auto-Split Ledger"), NULL,
-        N_("Show transactions on one or two lines and expand the current transaction"), REG_STYLE_AUTO_LEDGER
-    },
-    /* Translators: This is a menu item in the View menu */
-    {
-        "ViewStyleJournalAction", NULL, N_("Transaction _Journal"), NULL,
-        N_("Show expanded transactions with all splits"), REG_STYLE_JOURNAL
-    }
-};
-
-static guint n_radio_entries_2 = G_N_ELEMENTS (radio_entries_2);
-
-/** These are the "important" actions provided by the register page.
- *  Their labels will appear when the toolbar is set to "Icons and
- *  important text" (e.g. GTK_TOOLBAR_BOTH_HORIZ) mode. */
-static const gchar *important_actions[] =
-{
-    "SplitTransactionAction",
-    NULL,
-};
-
-/** Actions that require an account to be selected before they are
- *  enabled. */
-static const gchar *actions_requiring_account[] =
-{
-    "EditEditAccountAction",
-    "ActionsReconcileAction",
-    "ActionsAutoClearAction",
-    "ActionsLotsAction",
-    NULL
-};
-
-/** View Style actions */
-static const gchar *view_style_actions[] =
-{
-    "ViewStyleBasicAction",
-    "ViewStyleAutoSplitAction",
-    "ViewStyleJournalAction",
-    NULL
-};
-
-/** Short labels for use on the toolbar buttons. */
-static action_toolbar_labels toolbar_labels[] =
-{
-    { "ActionsTransferAction", 	            N_("Transfer") },
-    { "RecordTransactionAction", 	        N_("Enter") },
-    { "CancelTransactionAction", 	        N_("Cancel") },
-    { "DeleteTransactionAction", 	        N_("Delete") },
-	{ "DuplicateTransactionAction",         N_("Duplicate") },
-    { "SplitTransactionAction",             N_("Split") },
-    { "ScheduleTransactionAction",          N_("Schedule") },
-    { "BlankTransactionAction",             N_("Blank") },
-    { "ActionsReconcileAction",             N_("Reconcile") },
-    { "ActionsAutoClearAction",             N_("Auto-clear") },
-    { "AssociateTransactionFileAction",     N_("Associate File") },
-    { "AssociateTransactionLocationAction", N_("Associate Location") },
-    { "ExecAssociatedTransactionAction",    N_("Open File/Location") },
-    { NULL, NULL },
-};
-
-struct status_action
-{
-    const char *action_name;
-    int value;
-    GtkWidget *widget;
-};
-
-static struct status_action status_actions[] =
-{
-    { "filter_status_reconciled",   CLEARED_RECONCILED, NULL },
-    { "filter_status_cleared",      CLEARED_CLEARED, NULL },
-    { "filter_status_voided",       CLEARED_VOIDED, NULL },
-    { "filter_status_frozen",       CLEARED_FROZEN, NULL },
-    { "filter_status_unreconciled", CLEARED_NO, NULL },
-    { NULL, 0, NULL },
-};
-
-#define CLEARED_VALUE "cleared_value"
-#define DEFAULT_FILTER "0x001f"
-#define DEFAULT_SORT_ORDER "BY_STANDARD"
-
-/************************************************************/
-/*                      Data Structures                     */
-/************************************************************/
-
-typedef struct GncPluginPageRegisterPrivate
-{
-    GNCLedgerDisplay *ledger;
-    GNCSplitReg *gsr;
-
-    GtkWidget *widget;
-
-    gint event_handler_id;
-    gint component_manager_id;
-    GncGUID key;  /* The guid of the Account we're watching */
-
-    gint lines_default;
-    gboolean read_only;
-
-    struct
-    {
-        GtkWidget *dialog;
-        GtkWidget *num_radio;
-        GtkWidget *act_radio;
-        SortType original_sort_type;
-        gboolean original_save_order;
-        gboolean save_order;
-        gboolean reverse_order;
-        gboolean original_reverse_order;
-    } sd;
-
-    struct
-    {
-        GtkWidget *dialog;
-        GtkWidget *table;
-        GtkWidget *start_date_choose;
-        GtkWidget *start_date_today;
-        GtkWidget *start_date;
-        GtkWidget *end_date_choose;
-        GtkWidget *end_date_today;
-        GtkWidget *end_date;
-        cleared_match_t original_cleared_match;
-        cleared_match_t cleared_match;
-        time64 original_start_time;
-        time64 original_end_time;
-        time64 start_time;
-        time64 end_time;
-        gboolean original_save_filter;
-        gboolean save_filter;
-    } fd;
-} GncPluginPageRegisterPrivate;
-
-#define GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(o)  \
-   (G_TYPE_INSTANCE_GET_PRIVATE ((o), GNC_TYPE_PLUGIN_PAGE_REGISTER, GncPluginPageRegisterPrivate))
-
-static GObjectClass *parent_class = NULL;
-
-/************************************************************/
-/*                      Implementation                      */
-/************************************************************/
-
-GType
-gnc_plugin_page_register_get_type (void)
-{
-    static GType gnc_plugin_page_register_type = 0;
-
-    if (gnc_plugin_page_register_type == 0)
-    {
-        static const GTypeInfo our_info =
-        {
-            sizeof (GncPluginPageRegisterClass),
-            NULL,
-            NULL,
-            (GClassInitFunc) gnc_plugin_page_register_class_init,
-            NULL,
-            NULL,
-            sizeof (GncPluginPageRegister),
-            0,
-            (GInstanceInitFunc) gnc_plugin_page_register_init
-        };
-
-        gnc_plugin_page_register_type = g_type_register_static (GNC_TYPE_PLUGIN_PAGE,
-                                        GNC_PLUGIN_PAGE_REGISTER_NAME,
-                                        &our_info, 0);
-    }
-
-    return gnc_plugin_page_register_type;
-}
-
-static GncPluginPage *
-gnc_plugin_page_register_new_common (GNCLedgerDisplay *ledger)
-{
-    GncPluginPageRegister *register_page;
-    GncPluginPageRegisterPrivate *priv;
-    GncPluginPage *plugin_page;
-    GNCSplitReg *gsr;
-    const GList *item;
-    GList *book_list;
-    gchar *label;
-    gchar *label_color;
-    QofQuery *q;
-
-    /* Is there an existing page? */
-    gsr = gnc_ledger_display_get_user_data (ledger);
-    if (gsr)
-    {
-        item = gnc_gobject_tracking_get_list(GNC_PLUGIN_PAGE_REGISTER_NAME);
-        for ( ; item; item = g_list_next(item))
-        {
-            register_page = (GncPluginPageRegister *)item->data;
-            priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(register_page);
-            if (priv->gsr == gsr)
-                return GNC_PLUGIN_PAGE(register_page);
-        }
-    }
-
-    register_page = g_object_new (GNC_TYPE_PLUGIN_PAGE_REGISTER, NULL);
-    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(register_page);
-    priv->ledger = ledger;
-    priv->key = *guid_null();
-
-    plugin_page = GNC_PLUGIN_PAGE(register_page);
-    label = gnc_plugin_page_register_get_tab_name(plugin_page);
-    gnc_plugin_page_set_page_name(plugin_page, label);
-    g_free(label);
-
-    label_color = gnc_plugin_page_register_get_tab_color(plugin_page);
-    gnc_plugin_page_set_page_color(plugin_page, label_color);
-    g_free(label_color);
-
-    label = gnc_plugin_page_register_get_long_name(plugin_page);
-    gnc_plugin_page_set_page_long_name(plugin_page, label);
-    g_free(label);
-
-    q = gnc_ledger_display_get_query (ledger);
-    book_list = qof_query_get_books (q);
-    for (item = book_list; item; item = g_list_next(item))
-        gnc_plugin_page_add_book (plugin_page, (QofBook *)item->data);
-    // Do not free the list. It is owned by the query.
-
-    priv->component_manager_id = 0;
-    return plugin_page;
-}
-
-GncPluginPage *
-gnc_plugin_page_register_new (Account *account, gboolean subaccounts)
-{
-    GNCLedgerDisplay *ledger;
-    GncPluginPage *page;
-    GncPluginPageRegisterPrivate *priv;
-
-/*################## Added for Reg2 #################*/
-    const GList *item;
-    GncPluginPageRegister2  *new_register_page;
-/*################## Added for Reg2 #################*/
-
-    ENTER("account=%p, subaccounts=%s", account,
-          subaccounts ? "TRUE" : "FALSE");
-
-/*################## Added for Reg2 #################*/
-    // We test for the new register being open here, ie matching account guids
-    item = gnc_gobject_tracking_get_list (GNC_PLUGIN_PAGE_REGISTER2_NAME);
-    for ( ; item; item = g_list_next (item))
-    {
-        Account *new_account;
-        new_register_page = (GncPluginPageRegister2 *)item->data;
-        new_account = gnc_plugin_page_register2_get_account (new_register_page);
-
-        if (guid_equal (xaccAccountGetGUID (account), xaccAccountGetGUID (new_account)))
-        {
-            gnc_error_dialog (NULL, "%s",
-                         _("You have tried to open an account in the old register while it is open in the new register."));
-            return NULL;
-        }
-    }
-/*################## Added for Reg2 #################*/
-
-    if (subaccounts)
-        ledger = gnc_ledger_display_subaccounts (account);
-    else
-        ledger = gnc_ledger_display_simple (account);
-
-    page = gnc_plugin_page_register_new_common(ledger);
-    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
-    priv->key = *xaccAccountGetGUID(account);
-
-    LEAVE("%p", page);
-    return page;
-}
-
-GncPluginPage *
-gnc_plugin_page_register_new_gl (void)
-{
-    GNCLedgerDisplay *ledger;
-
-    ledger = gnc_ledger_display_gl ();
-    return gnc_plugin_page_register_new_common(ledger);
-}
-
-GncPluginPage *
-gnc_plugin_page_register_new_ledger (GNCLedgerDisplay *ledger)
-{
-    return gnc_plugin_page_register_new_common(ledger);
-}
-
-static void
-gnc_plugin_page_register_class_init (GncPluginPageRegisterClass *klass)
-{
-    GObjectClass *object_class = G_OBJECT_CLASS (klass);
-    GncPluginPageClass *gnc_plugin_class = GNC_PLUGIN_PAGE_CLASS(klass);
-
-    parent_class = g_type_class_peek_parent (klass);
-
-    object_class->finalize = gnc_plugin_page_register_finalize;
-
-    gnc_plugin_class->tab_icon        = GNC_ICON_ACCOUNT;
-    gnc_plugin_class->plugin_name     = GNC_PLUGIN_PAGE_REGISTER_NAME;
-    gnc_plugin_class->create_widget   = gnc_plugin_page_register_create_widget;
-    gnc_plugin_class->destroy_widget  = gnc_plugin_page_register_destroy_widget;
-    gnc_plugin_class->window_changed  = gnc_plugin_page_register_window_changed;
-    gnc_plugin_class->save_page       = gnc_plugin_page_register_save_page;
-    gnc_plugin_class->recreate_page   = gnc_plugin_page_register_recreate_page;
-    gnc_plugin_class->update_edit_menu_actions = gnc_plugin_page_register_update_edit_menu;
-    gnc_plugin_class->finish_pending  = gnc_plugin_page_register_finish_pending;
-
-    g_type_class_add_private(klass, sizeof(GncPluginPageRegisterPrivate));
-
-    gnc_ui_register_account_destroy_callback (gppr_account_destroy_cb);
-}
-
-static void
-gnc_plugin_page_register_init (GncPluginPageRegister *plugin_page)
-{
-    GncPluginPageRegisterPrivate *priv;
-    GncPluginPage *parent;
-    GtkActionGroup *action_group;
-    gboolean use_new;
-
-    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
-
-    /* Init parent declared variables */
-    parent = GNC_PLUGIN_PAGE(plugin_page);
-    use_new = gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL_REGISTER, GNC_PREF_USE_NEW);
-    g_object_set(G_OBJECT(plugin_page),
-                 "page-name",      _("General Journal"),
-                 "page-uri",       "default:",
-                 "ui-description", "gnc-plugin-page-register-ui.xml",
-                 "use-new-window", use_new,
-                 NULL);
-
-    /* Create menu and toolbar information */
-    action_group =
-        gnc_plugin_page_create_action_group(parent,
-                                            "GncPluginPageRegisterActions");
-    gtk_action_group_add_actions (action_group, gnc_plugin_page_register_actions,
-                                  gnc_plugin_page_register_n_actions, plugin_page);
-    gtk_action_group_add_toggle_actions (action_group,
-                                         toggle_entries, n_toggle_entries,
-                                         plugin_page);
-    gtk_action_group_add_radio_actions (action_group,
-                                        radio_entries_2, n_radio_entries_2,
-                                        REG_STYLE_LEDGER,
-                                        G_CALLBACK(gnc_plugin_page_register_cmd_style_changed),
-                                        plugin_page);
-
-    gnc_plugin_init_short_names (action_group, toolbar_labels);
-    gnc_plugin_set_important_actions (action_group, important_actions);
-
-    priv->lines_default     = DEFAULT_LINES_AMOUNT;
-    priv->read_only         = FALSE;
-    priv->fd.cleared_match  = CLEARED_ALL;
-}
-
-static void
-gnc_plugin_page_register_finalize (GObject *object)
-{
-    g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (object));
-
-    ENTER("object %p", object);
-
-    G_OBJECT_CLASS (parent_class)->finalize (object);
-    LEAVE(" ");
-}
-
-Account *
-gnc_plugin_page_register_get_account (GncPluginPageRegister *page)
-{
-    GncPluginPageRegisterPrivate *priv;
-    GNCLedgerDisplayType ledger_type;
-    Account *leader;
-
-    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
-    ledger_type = gnc_ledger_display_type (priv->ledger);
-    leader = gnc_ledger_display_leader (priv->ledger);
-
-    if ((ledger_type == LD_SINGLE) || (ledger_type == LD_SUBACCOUNT))
-        return leader;
-    return NULL;
-}
-
-/* This is the list of actions which are switched inactive in a read-only book. */
-static const char* readonly_inactive_actions[] =
-{
-    "EditCutAction",
-    "EditPasteAction",
-    "CutTransactionAction",
-    "PasteTransactionAction",
-    "DuplicateTransactionAction",
-    "DeleteTransactionAction",
-    "RemoveTransactionSplitsAction",
-    "RecordTransactionAction",
-    "CancelTransactionAction",
-    "UnvoidTransactionAction",
-    "VoidTransactionAction",
-    "ReverseTransactionAction",
-    "ActionsTransferAction",
-    "ActionsReconcileAction",
-    "ActionsStockSplitAction",
-    "ScheduleTransactionAction",
-    "ScrubAllAction",
-    "ScrubCurrentAction",
-    "AssociateTransactionFileAction",
-    "AssociateTransactionLocationAction",
-    NULL
-};
-
-/* This is the list of actions whose text needs to be changed based on whether */
-/* the current cursor class is transaction or split. */
-static const char* tran_vs_split_actions[] =
-{
-    "CutTransactionAction",
-    "CopyTransactionAction",
-    "PasteTransactionAction",
-    "DuplicateTransactionAction",
-    "DeleteTransactionAction",
-    NULL
-};
-
-/* This is the list of labels for when the current cursor class is transaction. */
-static const char* tran_action_labels[] =
-{
-    CUT_TRANSACTION_LABEL,
-    COPY_TRANSACTION_LABEL,
-    PASTE_TRANSACTION_LABEL,
-    DUPLICATE_TRANSACTION_LABEL,
-    DELETE_TRANSACTION_LABEL,
-    ASSOCIATE_TRANSACTION_FILE_LABEL,
-    ASSOCIATE_TRANSACTION_LOCATION_LABEL,
-    EXECASSOCIATED_TRANSACTION_LABEL,
-    NULL
-};
-
-/* This is the list of tooltips for when the current cursor class is transaction. */
-static const char* tran_action_tips[] =
-{
-    CUT_TRANSACTION_TIP,
-    COPY_TRANSACTION_TIP,
-    PASTE_TRANSACTION_TIP,
-    DUPLICATE_TRANSACTION_TIP,
-    DELETE_TRANSACTION_TIP,
-    ASSOCIATE_TRANSACTION_FILE_TIP,
-    ASSOCIATE_TRANSACTION_LOCATION_TIP,
-    EXECASSOCIATED_TRANSACTION_TIP,
-    NULL
-};
-
-/* This is the list of labels for when the current cursor class is split. */
-static const char* split_action_labels[] =
-{
-    CUT_SPLIT_LABEL,
-    COPY_SPLIT_LABEL,
-    PASTE_SPLIT_LABEL,
-    DUPLICATE_SPLIT_LABEL,
-    DELETE_SPLIT_LABEL,
-    NULL
-};
-
-/* This is the list of tooltips for when the current cursor class is split. */
-static const char* split_action_tips[] =
-{
-    CUT_SPLIT_TIP,
-    COPY_SPLIT_TIP,
-    PASTE_SPLIT_TIP,
-    DUPLICATE_SPLIT_TIP,
-    DELETE_SPLIT_TIP,
-    NULL
-};
-
-static void
-gnc_plugin_page_register_ui_update (gpointer various, GncPluginPageRegister *page)
-{
-    GncPluginPageRegisterPrivate *priv;
-    SplitRegister *reg;
-    GtkAction *action;
-    gboolean expanded, voided;
-    Transaction *trans;
-    const char *uri;
-
-    /* Set 'Split Transaction' */
-    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
-    reg = gnc_ledger_display_get_split_register(priv->ledger);
-    expanded = gnc_split_register_current_trans_expanded(reg);
-    action = gnc_plugin_page_get_action (GNC_PLUGIN_PAGE(page),
-                                         "SplitTransactionAction");
-    gtk_action_set_sensitive (action, reg->style == REG_STYLE_LEDGER);
-    g_signal_handlers_block_by_func
-    (action, gnc_plugin_page_register_cmd_expand_transaction, page);
-    gtk_toggle_action_set_active (GTK_TOGGLE_ACTION(action), expanded);
-    g_signal_handlers_unblock_by_func
-    (action, gnc_plugin_page_register_cmd_expand_transaction, page);
-
-    /* Set 'Void' and 'Unvoid' */
-    trans = gnc_split_register_get_current_trans(reg);
-    voided = xaccTransHasSplitsInState(trans, VREC);
-    action = gnc_plugin_page_get_action (GNC_PLUGIN_PAGE(page),
-                                         "VoidTransactionAction");
-    gtk_action_set_sensitive (GTK_ACTION(action), !voided);
-
-    action = gnc_plugin_page_get_action (GNC_PLUGIN_PAGE(page),
-                                         "UnvoidTransactionAction");
-    gtk_action_set_sensitive (GTK_ACTION(action), voided);
-
-    /* Set 'ExecAssociated' */
-    uri = xaccTransGetAssociation(trans);
-    action = gnc_plugin_page_get_action (GNC_PLUGIN_PAGE(page),
-                                         "ExecAssociatedTransactionAction");
-    if (g_strcmp0 (uri, "") != 0 && g_strcmp0 (uri, NULL) != 0)
-        gtk_action_set_sensitive (GTK_ACTION(action), TRUE);
-    else
-        gtk_action_set_sensitive (GTK_ACTION(action), FALSE);
-
-    /* If we are in a readonly book, make any modifying action inactive */
-    if (qof_book_is_readonly(gnc_get_current_book()))
-    {
-        const char **iter;
-        for (iter = readonly_inactive_actions; *iter; ++iter)
-        {
-            /* Set the action's sensitivity */
-            GtkAction *action = gnc_plugin_page_get_action (GNC_PLUGIN_PAGE(page), *iter);
-            gtk_action_set_sensitive(action, FALSE);
-        }
-    }
-
-    /* Modifying action descriptions based on cursor class */
-    {
-        const char **iter, **label_iter, **tooltip_iter;
-        gboolean curr_label_trans = FALSE;
-        CursorClass cursor_class = gnc_split_register_get_current_cursor_class (reg);
-        iter = tran_vs_split_actions;
-        action = gnc_plugin_page_get_action (GNC_PLUGIN_PAGE(page), *iter);
-        label_iter = tran_action_labels;
-        if (g_strcmp0 (gtk_action_get_label(action), _(*label_iter)) == 0)
-            curr_label_trans = TRUE;
-        if ((cursor_class == CURSOR_CLASS_SPLIT) && curr_label_trans)
-        {
-            label_iter = split_action_labels;
-            tooltip_iter = split_action_tips;
-            for (iter = tran_vs_split_actions; *iter; ++iter)
-            {
-                /* Adjust the action's label and tooltip */
-                action = gnc_plugin_page_get_action (GNC_PLUGIN_PAGE(page), *iter);
-                gtk_action_set_label(action, _(*label_iter));
-                gtk_action_set_tooltip(action, _(*tooltip_iter));
-                ++label_iter;
-                ++tooltip_iter;
-            }
-        }
-        else if ((cursor_class == CURSOR_CLASS_TRANS) && !curr_label_trans)
-        {
-            label_iter = tran_action_labels;
-            tooltip_iter = tran_action_tips;
-            for (iter = tran_vs_split_actions; *iter; ++iter)
-            {
-                /* Adjust the action's label and tooltip */
-                action = gnc_plugin_page_get_action (GNC_PLUGIN_PAGE(page), *iter);
-                gtk_action_set_label(action, _(*label_iter));
-                gtk_action_set_tooltip(action, _(*tooltip_iter));
-                ++label_iter;
-                ++tooltip_iter;
-            }
-        }
-    }
-}
-
-static void
-gnc_plugin_page_register_ui_initial_state (GncPluginPageRegister *page)
-{
-    GncPluginPageRegisterPrivate *priv ;
-    GtkActionGroup *action_group;
-    GtkAction *action;
-    Account *account;
-    SplitRegister *reg;
-    GNCLedgerDisplayType ledger_type;
-    int i;
-    gboolean is_readwrite = !qof_book_is_readonly(gnc_get_current_book());
-
-    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
-    account = gnc_plugin_page_register_get_account (page);
-    action_group = gnc_plugin_page_get_action_group(GNC_PLUGIN_PAGE(page));
-    gnc_plugin_update_actions(action_group, actions_requiring_account,
-                              "sensitive", is_readwrite && account != NULL);
-
-    /* Set "style" radio button */
-    ledger_type = gnc_ledger_display_type(priv->ledger);
-    gnc_plugin_update_actions(action_group, view_style_actions,
-                              "sensitive", ledger_type == LD_SINGLE);
-
-    reg = gnc_ledger_display_get_split_register(priv->ledger);
-    for (i = n_radio_entries_2 - 1; i > 0; i--)
-    {
-        DEBUG(" index %d: comparing %x to %x", i, radio_entries_2[i].value,
-              reg->style);
-        if (radio_entries_2[i].value == reg->style)
-        {
-            DEBUG("match");
-            break;
-        }
-    }
-
-    /* Either a match was found, or fell out with i = 0 */
-    action = gtk_action_group_get_action(action_group, radio_entries_2[i].name);
-    g_signal_handlers_block_by_func(action, gnc_plugin_page_register_cmd_style_changed, page);
-    gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), TRUE);
-    g_signal_handlers_unblock_by_func(action, gnc_plugin_page_register_cmd_style_changed, page);
-
-    /* Set "double line" toggle button */
-    action = gtk_action_group_get_action (action_group,
-                                          "ViewStyleDoubleLineAction");
-    g_signal_handlers_block_by_func(action, gnc_plugin_page_register_cmd_style_double_line, page);
-    gtk_toggle_action_set_active (GTK_TOGGLE_ACTION(action), reg->use_double_line);
-    g_signal_handlers_unblock_by_func(action, gnc_plugin_page_register_cmd_style_double_line, page);
-}
-
-/* Virtual Functions */
-
-static GtkWidget *
-gnc_plugin_page_register_create_widget (GncPluginPage *plugin_page)
-{
-    GncPluginPageRegister *page;
-    GncPluginPageRegisterPrivate *priv;
-    GNCLedgerDisplayType ledger_type;
-    GncWindow *gnc_window;
-    guint numRows;
-    GtkWidget *gsr;
-    SplitRegister *reg;
-    Account *acct;
-    gchar **filter;
-    gchar *order;
-    int filter_changed = 0;
-
-    ENTER("page %p", plugin_page);
-    page = GNC_PLUGIN_PAGE_REGISTER (plugin_page);
-    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
-
-    if (priv->widget != NULL)
-    {
-        LEAVE("existing widget %p", priv->widget);
-        return priv->widget;
-    }
-
-    priv->widget = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-    gtk_box_set_homogeneous (GTK_BOX (priv->widget), FALSE);
-    gtk_widget_show (priv->widget);
-
-    // Set the style context for this page so it can be easily manipulated with css
-    gnc_widget_set_style_context (GTK_WIDGET(priv->widget), "GncRegisterPage");
-
-    numRows = priv->lines_default;
-    numRows = MIN(numRows, DEFAULT_LINES_AMOUNT);
-
-    gnc_window = GNC_WINDOW(GNC_PLUGIN_PAGE(page)->window);
-    gsr = gnc_split_reg_new(priv->ledger,
-                            gnc_window_get_gtk_window(gnc_window),
-                            numRows, priv->read_only);
-    priv->gsr = (GNCSplitReg *)gsr;
-    gtk_widget_show (gsr);
-    gtk_box_pack_start (GTK_BOX (priv->widget), gsr, TRUE, TRUE, 0);
-
-    g_signal_connect (G_OBJECT (gsr), "help-changed",
-                      G_CALLBACK ( gnc_plugin_page_help_changed_cb ),
-                      page );
-
-    reg = gnc_ledger_display_get_split_register(priv->ledger);
-    gnc_split_register_config(reg, reg->type, reg->style,
-                              reg->use_double_line);
-    gnc_ledger_display_refresh(priv->ledger);
-
-    gnc_plugin_page_register_ui_initial_state (page);
-    gnc_plugin_page_register_ui_update (NULL, page);
-
-    ledger_type = gnc_ledger_display_type (priv->ledger);
-
-    if (ledger_type == LD_SINGLE || ledger_type == LD_SUBACCOUNT)
-    {
-        /* Set the sort order for the split register and status of save order button */
-        priv->sd.save_order = FALSE;
-        order = gnc_plugin_page_register_get_sort_order(plugin_page);
-
-        PINFO("Loaded Sort order is %s", order);
-
-        gnc_split_reg_set_sort_type(priv->gsr, SortTypefromString(order));
-
-        if (order && (g_strcmp0 (order, DEFAULT_SORT_ORDER) != 0))
-            priv->sd.save_order = TRUE;
-
-        priv->sd.original_save_order = priv->sd.save_order;
-        g_free(order);
-
-        priv->sd.reverse_order = gnc_plugin_page_register_get_sort_reversed(plugin_page);
-        gnc_split_reg_set_sort_reversed(priv->gsr, priv->sd.reverse_order);
-        if (priv->sd.reverse_order)
-            priv->sd.save_order = TRUE;
-
-        priv->sd.original_reverse_order = priv->sd.reverse_order;
-
-        /* Set the filter for the split register and status of save filter button */
-        priv->fd.save_filter = FALSE;
-
-        filter = g_strsplit(gnc_plugin_page_register_get_filter(plugin_page), ",", -1);
-
-        PINFO("Loaded Filter Status is %s", filter[0]);
-
-        priv->fd.cleared_match = (gint)g_ascii_strtoll( filter[0], NULL, 16 );
-
-        if (filter[0] && (g_strcmp0 (filter[0], DEFAULT_FILTER) != 0))
-            filter_changed = filter_changed + 1;
-
-        if (filter[1] && (g_strcmp0 (filter[1], "0") != 0 ))
-        {
-            PINFO("Loaded Filter Start Date is %s", filter[1]);
-
-            priv->fd.start_time = gnc_plugin_page_register_filter_dmy2time (filter[1] );
-            priv->fd.start_time = gnc_time64_get_day_start(priv->fd.start_time);
-            filter_changed = filter_changed + 1;
-
-            if (filter[2] && (g_strcmp0 (filter[2], "0") != 0 ))
-            {
-                PINFO("Loaded Filter End Date is %s", filter[2]);
-
-                priv->fd.end_time = gnc_plugin_page_register_filter_dmy2time (filter[2] );
-                priv->fd.end_time = gnc_time64_get_day_end(priv->fd.end_time);
-                filter_changed = filter_changed + 1;
-            }
-        }
-
-        if (filter_changed != 0)
-            priv->fd.save_filter = TRUE;
-
-        priv->fd.original_save_filter = priv->fd.save_filter;
-        g_strfreev(filter);
-
-        /* Update Query with Filter Status and Dates */
-        gnc_ppr_update_status_query (page);
-        gnc_ppr_update_date_query(page);
-    }
-
-    plugin_page->summarybar = gsr_create_summary_bar(priv->gsr);
-    if (plugin_page->summarybar)
-    {
-        gtk_widget_show_all(plugin_page->summarybar);
-        gtk_box_pack_start(GTK_BOX (priv->widget), plugin_page->summarybar,
-                           FALSE, FALSE, 0);
-
-        gnc_plugin_page_register_summarybar_position_changed (NULL, NULL, page);
-        gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL,
-                               GNC_PREF_SUMMARYBAR_POSITION_TOP,
-                               gnc_plugin_page_register_summarybar_position_changed,
-                               page);
-        gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL,
-                               GNC_PREF_SUMMARYBAR_POSITION_BOTTOM,
-                               gnc_plugin_page_register_summarybar_position_changed,
-                               page);
-    }
-
-    priv->event_handler_id = qof_event_register_handler
-                             ((QofEventHandler)gnc_plugin_page_register_event_handler, page);
-    priv->component_manager_id =
-        gnc_register_gui_component(GNC_PLUGIN_PAGE_REGISTER_NAME,
-                                   gnc_plugin_page_register_refresh_cb,
-                                   gnc_plugin_page_register_close_cb,
-                                   page);
-    gnc_gui_component_set_session (priv->component_manager_id,
-                                   gnc_get_current_session());
-    acct = gnc_plugin_page_register_get_account(page);
-    if (acct)
-        gnc_gui_component_watch_entity (
-            priv->component_manager_id, xaccAccountGetGUID(acct),
-            QOF_EVENT_DESTROY | QOF_EVENT_MODIFY);
-
-    gnc_split_reg_set_moved_cb
-    (priv->gsr, (GFunc)gnc_plugin_page_register_ui_update, page);
-
-    /* DRH - Probably lots of other stuff from regWindowLedger should end up here. */
-    LEAVE(" ");
-    return priv->widget;
-}
-
-static void
-gnc_plugin_page_register_destroy_widget (GncPluginPage *plugin_page)
-{
-    GncPluginPageRegister *page;
-    GncPluginPageRegisterPrivate *priv;
-
-    ENTER("page %p", plugin_page);
-    page = GNC_PLUGIN_PAGE_REGISTER (plugin_page);
-    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
-
-    gnc_prefs_remove_cb_by_func (GNC_PREFS_GROUP_GENERAL,
-                                 GNC_PREF_SUMMARYBAR_POSITION_TOP,
-                                 gnc_plugin_page_register_summarybar_position_changed,
-                                 page);
-    gnc_prefs_remove_cb_by_func (GNC_PREFS_GROUP_GENERAL,
-                                 GNC_PREF_SUMMARYBAR_POSITION_BOTTOM,
-                                 gnc_plugin_page_register_summarybar_position_changed,
-                                 page);
-    if (priv->widget == NULL)
-        return;
-
-    if (priv->component_manager_id)
-    {
-        gnc_unregister_gui_component(priv->component_manager_id);
-        priv->component_manager_id = 0;
-    }
-
-    if (priv->event_handler_id)
-    {
-        qof_event_unregister_handler(priv->event_handler_id);
-        priv->event_handler_id = 0;
-    }
-
-    if (priv->sd.dialog)
-    {
-        gtk_widget_destroy(priv->sd.dialog);
-        memset(&priv->sd, 0, sizeof(priv->sd));
-    }
-
-    if (priv->fd.dialog)
-    {
-        gtk_widget_destroy(priv->fd.dialog);
-        memset(&priv->fd, 0, sizeof(priv->fd));
-    }
-
-    gtk_widget_hide(priv->widget);
-    gnc_ledger_display_close (priv->ledger);
-    priv->ledger = NULL;
-    LEAVE(" ");
-}
-
-static void
-gnc_plugin_page_register_window_changed (GncPluginPage *plugin_page,
-        GtkWidget *window)
-{
-    GncPluginPageRegister *page;
-    GncPluginPageRegisterPrivate *priv;
-
-    g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (plugin_page));
-
-    page = GNC_PLUGIN_PAGE_REGISTER(plugin_page);
-    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
-    priv->gsr->window =
-        GTK_WIDGET(gnc_window_get_gtk_window(GNC_WINDOW(window)));
-}
-
-static const gchar *style_names[] =
-{
-    "Ledger",
-    "Auto Ledger",
-    "Journal",
-    NULL
-};
-
-#define KEY_REGISTER_TYPE       "RegisterType"
-#define KEY_ACCOUNT_NAME        "AccountName"
-#define KEY_REGISTER_STYLE      "RegisterStyle"
-#define KEY_DOUBLE_LINE         "DoubleLineMode"
-
-#define LABEL_ACCOUNT		"Account"
-#define LABEL_SUBACCOUNT	"SubAccount"
-#define LABEL_GL		"GL"
-#define LABEL_SEARCH		"Search"
-
-
-/** Save enough information about this register page that it can be
- *  recreated next time the user starts gnucash.
- *
- *  @param plugin_page The page to save.
- *
- *  @param key_file A pointer to the GKeyFile data structure where the
- *  page information should be written.
- *
- *  @param group_name The group name to use when saving data. */
-static void
-gnc_plugin_page_register_save_page (GncPluginPage *plugin_page,
-                                    GKeyFile *key_file,
-                                    const gchar *group_name)
-{
-    GncPluginPageRegister *page;
-    GncPluginPageRegisterPrivate *priv;
-    GNCLedgerDisplayType ledger_type;
-    SplitRegister *reg;
-    Account *leader;
-
-    g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page));
-    g_return_if_fail (key_file != NULL);
-    g_return_if_fail (group_name != NULL);
-
-    ENTER("page %p, key_file %p, group_name %s", plugin_page, key_file,
-          group_name);
-
-    page = GNC_PLUGIN_PAGE_REGISTER(plugin_page);
-    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
-
-    reg = gnc_ledger_display_get_split_register(priv->ledger);
-    ledger_type = gnc_ledger_display_type(priv->ledger);
-    if (ledger_type > LD_GL)
-    {
-        LEAVE("Unsupported ledger type");
-        return;
-    }
-    if ((ledger_type == LD_SINGLE) || (ledger_type == LD_SUBACCOUNT))
-    {
-        const gchar *label;
-        gchar* name;
-        label = (ledger_type == LD_SINGLE) ? LABEL_ACCOUNT : LABEL_SUBACCOUNT;
-        leader = gnc_ledger_display_leader(priv->ledger);
-        g_key_file_set_string(key_file, group_name, KEY_REGISTER_TYPE, label);
-        name = gnc_account_get_full_name(leader);
-        g_key_file_set_string(key_file, group_name, KEY_ACCOUNT_NAME, name);
-        g_free(name);
-    }
-    else if (reg->type == GENERAL_JOURNAL)
-    {
-        g_key_file_set_string(key_file, group_name, KEY_REGISTER_TYPE,
-                              LABEL_GL);
-    }
-    else if (reg->type == SEARCH_LEDGER)
-    {
-        g_key_file_set_string(key_file, group_name, KEY_REGISTER_TYPE,
-                              LABEL_SEARCH);
-    }
-    else
-    {
-        LEAVE("Unsupported register type");
-        return;
-    }
-
-    g_key_file_set_string(key_file, group_name, KEY_REGISTER_STYLE,
-                          style_names[reg->style]);
-    g_key_file_set_boolean(key_file, group_name, KEY_DOUBLE_LINE,
-                           reg->use_double_line);
-
-    LEAVE(" ");
-}
-
-
-/** Read and restore the edit menu settings on the specified register
- *  page.  This function will restore the register style (ledger, auto
- *  ledger, journal) and whether or not the register is in double line
- *  mode.  It should eventually restore the "filter by" and "sort by
- *  settings.
- *
- *  @param page The register being restored.
- *
- *  @param key_file A pointer to the GKeyFile data structure where the
- *  page information should be read.
- *
- *  @param group_name The group name to use when restoring data. */
-static void
-gnc_plugin_page_register_restore_edit_menu (GncPluginPage *page,
-        GKeyFile *key_file,
-        const gchar *group_name)
-{
-    GtkAction *action;
-    GError *error = NULL;
-    gchar *style_name;
-    gint i;
-    gboolean use_double_line;
-
-    ENTER(" ");
-
-    /* Convert the style name to an index */
-    style_name = g_key_file_get_string(key_file, group_name,
-                                       KEY_REGISTER_STYLE, &error);
-    for (i = 0 ; style_names[i]; i++)
-    {
-        if (g_ascii_strcasecmp(style_name, style_names[i]) == 0)
-        {
-            DEBUG("Found match for style name: %s", style_name);
-            break;
-        }
-    }
-    g_free(style_name);
-
-    /* Update the style menu action for this page */
-    if (i <= REG_STYLE_JOURNAL)
-    {
-        DEBUG("Setting style: %d", i);
-        action = gnc_plugin_page_get_action(page, radio_entries_2[i].name);
-        gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), TRUE);
-    }
-
-    /* Update the  double line action on this page */
-    use_double_line =
-        g_key_file_get_boolean(key_file, group_name, KEY_DOUBLE_LINE, &error);
-    DEBUG("Setting double_line_mode: %d", use_double_line);
-    action = gnc_plugin_page_get_action(page, "ViewStyleDoubleLineAction");
-    gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), use_double_line);
-
-    LEAVE(" ");
-}
-
-
-/** Create a new register page based on the information saved during a
- *  previous instantiation of gnucash.
- *
- *  @param window The window where this page should be installed.
- *
- *  @param key_file A pointer to the GKeyFile data structure where the
- *  page information should be read.
- *
- *  @param group_name The group name to use when restoring data. */
-static GncPluginPage *
-gnc_plugin_page_register_recreate_page (GtkWidget *window,
-                                        GKeyFile *key_file,
-                                        const gchar *group_name)
-{
-    GncPluginPage *page;
-    GError *error = NULL;
-    gchar *reg_type, *acct_name;
-    Account *account;
-    QofBook *book;
-    gboolean include_subs;
-
-    g_return_val_if_fail(key_file, NULL);
-    g_return_val_if_fail(group_name, NULL);
-    ENTER("key_file %p, group_name %s", key_file, group_name);
-
-    /* Create the new page. */
-    reg_type = g_key_file_get_string(key_file, group_name,
-                                     KEY_REGISTER_TYPE, &error);
-    DEBUG("Page type: %s", reg_type);
-    if ((g_ascii_strcasecmp(reg_type, LABEL_ACCOUNT) == 0) ||
-            (g_ascii_strcasecmp(reg_type, LABEL_SUBACCOUNT) == 0))
-    {
-        include_subs = (g_ascii_strcasecmp(reg_type, LABEL_SUBACCOUNT) == 0);
-        DEBUG("Include subs: %d", include_subs);
-        acct_name = g_key_file_get_string(key_file, group_name,
-                                          KEY_ACCOUNT_NAME, &error);
-        book = qof_session_get_book(gnc_get_current_session());
-        account = gnc_account_lookup_by_full_name(gnc_book_get_root_account(book),
-                  acct_name);
-        g_free(acct_name);
-        if (account == NULL)
-        {
-            LEAVE("Bad account name");
-            g_free(reg_type);
-            return NULL;
-        }
-        page = gnc_plugin_page_register_new (account, include_subs);
-    }
-    else if (g_ascii_strcasecmp(reg_type, LABEL_GL) == 0)
-    {
-        page = gnc_plugin_page_register_new_gl();
-    }
-    else
-    {
-        LEAVE("Bad ledger type");
-        g_free(reg_type);
-        return NULL;
-    }
-    g_free(reg_type);
-
-    /* Recreate page in given window */
-    gnc_plugin_page_set_use_new_window(page, FALSE);
-
-    /* Install it now so we can them manipulate the created widget */
-    gnc_main_window_open_page(GNC_MAIN_WINDOW(window), page);
-
-    /* Now update the page to the last state it was in */
-    gnc_plugin_page_register_restore_edit_menu(page, key_file, group_name);
-    LEAVE(" ");
-    return page;
-}
-
-
-/*
- * Based on code from Epiphany (src/ephy-window.c)
- */
-static void
-gnc_plugin_page_register_update_edit_menu (GncPluginPage *page, gboolean hide)
-{
-    GncPluginPageRegisterPrivate *priv;
-    GncPluginPageRegister *reg_page;
-    GtkAction *action;
-    gboolean can_copy = FALSE, can_cut = FALSE, can_paste = FALSE;
-    gboolean has_selection;
-    gboolean is_readwrite = !qof_book_is_readonly(gnc_get_current_book());
-
-    reg_page = GNC_PLUGIN_PAGE_REGISTER(page);
-    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(reg_page);
-    has_selection = gnucash_register_has_selection (priv->gsr->reg);
-
-    can_copy = has_selection;
-    can_cut = is_readwrite && has_selection;
-    can_paste = is_readwrite;
-
-    action = gnc_plugin_page_get_action (page, "EditCopyAction");
-    gtk_action_set_sensitive (action, can_copy);
-    gtk_action_set_visible (action, !hide || can_copy);
-    action = gnc_plugin_page_get_action (page, "EditCutAction");
-    gtk_action_set_sensitive (action, can_cut);
-    gtk_action_set_visible (action, !hide || can_cut);
-    action = gnc_plugin_page_get_action (page, "EditPasteAction");
-    gtk_action_set_sensitive (action, can_paste);
-    gtk_action_set_visible (action,  !hide || can_paste);
-}
-
-
-static gboolean
-gnc_plugin_page_register_finish_pending (GncPluginPage *page)
-{
-    GncPluginPageRegisterPrivate *priv;
-    GncPluginPageRegister *reg_page;
-    SplitRegister *reg;
-    GtkWidget *dialog, *window;
-    const gchar *name;
-    gint response;
-
-    reg_page = GNC_PLUGIN_PAGE_REGISTER(page);
-    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(reg_page);
-    reg = gnc_ledger_display_get_split_register(priv->ledger);
-
-    if (!reg || !gnc_split_register_changed(reg))
-        return TRUE;
-
-    name = gnc_plugin_page_register_get_tab_name(page);
-    window = gnc_plugin_page_get_window(page);
-    dialog = gtk_message_dialog_new(GTK_WINDOW(window),
-                                    GTK_DIALOG_DESTROY_WITH_PARENT,
-                                    GTK_MESSAGE_WARNING,
-                                    GTK_BUTTONS_NONE,
-                                    /* Translators: %s is the name
-                                       of the tab page */
-                                    _("Save changes to %s?"), name);
-    gtk_message_dialog_format_secondary_text
-    (GTK_MESSAGE_DIALOG(dialog),
-     "%s",
-     _("This register has pending changes to a transaction. "
-       "Would you like to save the changes to this transaction, "
-       "discard the transaction, or cancel the operation?"));
-    gnc_gtk_dialog_add_button(dialog, _("_Discard Transaction"),
-                              "edit-delete", GTK_RESPONSE_REJECT);
-    gtk_dialog_add_button(GTK_DIALOG(dialog),
-                          _("_Cancel"), GTK_RESPONSE_CANCEL);
-    gnc_gtk_dialog_add_button(dialog, _("_Save Transaction"),
-                              "document-save", GTK_RESPONSE_ACCEPT);
-
-    response = gtk_dialog_run(GTK_DIALOG(dialog));
-    gtk_widget_destroy(dialog);
-
-    switch (response)
-    {
-    case GTK_RESPONSE_ACCEPT:
-        gnc_split_register_save(reg, TRUE);
-        return TRUE;
-
-    case GTK_RESPONSE_REJECT:
-        gnc_split_register_cancel_cursor_trans_changes(reg);
-        gnc_split_register_save (reg, TRUE);
-        return TRUE;
-
-    default:
-        return FALSE;
-    }
-}
-
-
-static gchar *
-gnc_plugin_page_register_get_tab_name (GncPluginPage *plugin_page)
-{
-    GncPluginPageRegisterPrivate *priv;
-    GNCLedgerDisplayType ledger_type;
-    GNCLedgerDisplay *ld;
-    SplitRegister *reg;
-    Account *leader;
-
-    g_return_val_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (plugin_page), _("unknown"));
-
-    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
-    ld = priv->ledger;
-    reg = gnc_ledger_display_get_split_register (ld);
-    ledger_type = gnc_ledger_display_type (ld);
-    leader = gnc_ledger_display_leader (ld);
-
-    switch (ledger_type)
-    {
-    case LD_SINGLE:
-        return g_strdup(xaccAccountGetName (leader));
-
-    case LD_SUBACCOUNT:
-        return g_strdup_printf("%s+", xaccAccountGetName (leader));
-
-    case LD_GL:
-        switch (reg->type)
-        {
-        case GENERAL_JOURNAL:
-        case INCOME_LEDGER:
-            return g_strdup(_("General Journal"));
-        case PORTFOLIO_LEDGER:
-            return g_strdup(_("Portfolio"));
-        case SEARCH_LEDGER:
-            return g_strdup(_("Search Results"));
-        default:
-            break;
-        }
-        break;
-
-    default:
-        break;
-    }
-
-    return g_strdup(_("unknown"));
-}
-
-static gchar *
-gnc_plugin_page_register_get_tab_color (GncPluginPage *plugin_page)
-{
-    GncPluginPageRegisterPrivate *priv;
-    GNCLedgerDisplayType ledger_type;
-    GNCLedgerDisplay *ld;
-    Account *leader;
-    const char* color;
-
-    g_return_val_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (plugin_page), _("unknown"));
-
-    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
-    ld = priv->ledger;
-    ledger_type = gnc_ledger_display_type (ld);
-    leader = gnc_ledger_display_leader (ld);
-    color = NULL;
-
-    if ((ledger_type == LD_SINGLE) || (ledger_type == LD_SUBACCOUNT))
-        color = xaccAccountGetColor (leader);
-
-    return g_strdup(color ? color : "Not Set");
-}
-
-static gchar *
-gnc_plugin_page_register_get_filter (GncPluginPage *plugin_page)
-{
-    GncPluginPageRegisterPrivate *priv;
-    GNCLedgerDisplayType ledger_type;
-    GNCLedgerDisplay *ld;
-    Account *leader;
-    const char* filter;
-
-    g_return_val_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (plugin_page), _("unknown"));
-
-    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
-    ld = priv->ledger;
-    ledger_type = gnc_ledger_display_type (ld);
-    leader = gnc_ledger_display_leader (ld);
-    filter = NULL;
-
-    if ((ledger_type == LD_SINGLE) || (ledger_type == LD_SUBACCOUNT))
-        filter = xaccAccountGetFilter (leader);
-
-    return filter ? g_strdup(filter) : g_strdup_printf("%s,%s,%s", DEFAULT_FILTER, "0", "0");
-}
-
-void
-gnc_plugin_page_register_set_filter (GncPluginPage *plugin_page, const gchar *filter )
-{
-    GncPluginPageRegisterPrivate *priv;
-    GNCLedgerDisplay *ld;
-    Account *leader;
-    gchar *default_filter;
-
-    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
-    ld = priv->ledger;
-    leader = gnc_ledger_display_leader (ld);
-
-    if (leader != NULL)
-    {
-        default_filter = g_strdup_printf("%s,%s,%s", DEFAULT_FILTER, "0", "0");
-
-        if (!filter || (g_strcmp0 (filter, default_filter) == 0))
-            xaccAccountSetFilter (leader, NULL);
-        else
-            xaccAccountSetFilter (leader, filter);
-
-        g_free (default_filter);
-    }
-
-    return;
-}
-
-static gchar *
-gnc_plugin_page_register_get_sort_order (GncPluginPage *plugin_page)
-{
-    GncPluginPageRegisterPrivate *priv;
-    GNCLedgerDisplayType ledger_type;
-    GNCLedgerDisplay *ld;
-    Account *leader;
-    const char* sort_order;
-
-    g_return_val_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (plugin_page), _("unknown"));
-
-    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
-    ld = priv->ledger;
-    ledger_type = gnc_ledger_display_type (ld);
-    leader = gnc_ledger_display_leader (ld);
-    sort_order = NULL;
-
-    if ((ledger_type == LD_SINGLE) || (ledger_type == LD_SUBACCOUNT))
-        sort_order = xaccAccountGetSortOrder (leader);
-
-    return g_strdup(sort_order ? sort_order : DEFAULT_SORT_ORDER);
-}
-
-void
-gnc_plugin_page_register_set_sort_order (GncPluginPage *plugin_page, const gchar *sort_order )
-{
-    GncPluginPageRegisterPrivate *priv;
-    GNCLedgerDisplay *ld;
-    Account *leader;
-
-    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
-    ld = priv->ledger;
-    leader = gnc_ledger_display_leader (ld);
-
-    if (leader != NULL)
-    {
-        if (!sort_order || (g_strcmp0 (sort_order, DEFAULT_SORT_ORDER) == 0))
-            xaccAccountSetSortOrder (leader, NULL);
-        else
-            xaccAccountSetSortOrder (leader, sort_order);
-    }
-
-    return;
-}
-
-static gboolean
-gnc_plugin_page_register_get_sort_reversed (GncPluginPage *plugin_page)
-{
-    GncPluginPageRegisterPrivate *priv;
-    GNCLedgerDisplayType ledger_type;
-    GNCLedgerDisplay *ld;
-    Account *leader;
-    gboolean sort_reversed = FALSE;
-
-    g_return_val_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (plugin_page), FALSE);
-
-    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
-    ld = priv->ledger;
-    ledger_type = gnc_ledger_display_type (ld);
-    leader = gnc_ledger_display_leader (ld);
-
-    if ((ledger_type == LD_SINGLE) || (ledger_type == LD_SUBACCOUNT))
-        sort_reversed = xaccAccountGetSortReversed (leader);
-
-    return sort_reversed;
-}
-
-void
-gnc_plugin_page_register_set_sort_reversed (GncPluginPage *plugin_page, gboolean reverse_order)
-{
-    GncPluginPageRegisterPrivate *priv;
-    GNCLedgerDisplay *ld;
-    Account *leader;
-
-    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
-    ld = priv->ledger;
-    leader = gnc_ledger_display_leader (ld);
-
-    if (leader != NULL)
-        xaccAccountSetSortReversed (leader, reverse_order);
-
-    return;
-}
-
-static gchar *
-gnc_plugin_page_register_get_long_name (GncPluginPage *plugin_page)
-{
-    GncPluginPageRegisterPrivate *priv;
-    GNCLedgerDisplayType ledger_type;
-    GNCLedgerDisplay *ld;
-    Account *leader;
-
-    g_return_val_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (plugin_page), _("unknown"));
-
-    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
-    ld = priv->ledger;
-    ledger_type = gnc_ledger_display_type (ld);
-    leader = gnc_ledger_display_leader (ld);
-
-    switch (ledger_type)
-    {
-    case LD_SINGLE:
-        return gnc_account_get_full_name (leader);
-
-    case LD_SUBACCOUNT:
-    {
-        gchar *account_full_name = gnc_account_get_full_name (leader);
-        gchar *return_string = g_strdup_printf("%s+", account_full_name);
-        g_free ((gpointer *) account_full_name);
-        return return_string;
-    }
-
-    default:
-        break;
-    }
-
-    return NULL;
-}
-
-static void
-gnc_plugin_page_register_summarybar_position_changed (gpointer prefs, gchar* pref, gpointer user_data)
-{
-    GncPluginPage *plugin_page;
-    GncPluginPageRegister *page;
-    GncPluginPageRegisterPrivate *priv;
-    GtkPositionType position = GTK_POS_BOTTOM;
-
-    g_return_if_fail (user_data != NULL);
-
-    if (!GNC_IS_PLUGIN_PAGE (user_data))
-        return;
-
-    plugin_page = GNC_PLUGIN_PAGE (user_data);
-    page = GNC_PLUGIN_PAGE_REGISTER (user_data);
-    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
-
-    if (priv == NULL)
-       return;
-
-    if (gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL, GNC_PREF_SUMMARYBAR_POSITION_TOP))
-        position = GTK_POS_TOP;
-
-    gtk_box_reorder_child (GTK_BOX (priv->widget),
-                          plugin_page->summarybar,
-                          (position == GTK_POS_TOP ? 0 : -1) );
-}
-
-/** This function is called to get the query associated with this
- *  plugin page.
- *
- *  @param page A pointer to the GncPluginPage.
- */
-Query *
-gnc_plugin_page_register_get_query (GncPluginPage *plugin_page)
-{
-    GncPluginPageRegister *page;
-    GncPluginPageRegisterPrivate *priv;
-
-    g_return_val_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page), NULL);
-
-    page = GNC_PLUGIN_PAGE_REGISTER (plugin_page);
-    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
-    return gnc_ledger_display_get_query (priv->ledger);
-}
-
-/************************************************************/
-/*                     "Sort By" Dialog                     */
-/************************************************************/
-
-/** This function is called whenever the number source book options is changed
- *  to adjust the displayed labels. Since the book option change may change the
- *  query sort, the gnc_split_reg_set_sort_type_force function is called to
- *  ensure the page is refreshed.
- *
- *  @param new_val A pointer to the boolean for the new value of the book option.
- *
- *  @param page A pointer to the GncPluginPageRegister that is
- *  associated with this sort order dialog.
- */
-static void
-gnc_plugin_page_register_sort_book_option_changed (gpointer new_val,
-                                                    gpointer user_data)
-{
-    GncPluginPageRegisterPrivate *priv;
-    GncPluginPageRegister *page = user_data;
-    gboolean *new_data = (gboolean*)new_val;
-
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
-
-    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
-    if (*new_data)
-    {
-        gtk_button_set_label(GTK_BUTTON (priv->sd.num_radio), _("Transaction Number"));
-        gtk_button_set_label(GTK_BUTTON (priv->sd.act_radio), _("Number/Action"));
-    }
-    else
-    {
-        gtk_button_set_label(GTK_BUTTON (priv->sd.num_radio), _("Number"));
-        gtk_button_set_label(GTK_BUTTON (priv->sd.act_radio), _("Action"));
-    }
-    gnc_split_reg_set_sort_type_force (priv->gsr, priv->gsr->sort_type, TRUE);
-}
-
-/** This function is called when the "Sort By..." dialog is closed.
- *  If the dialog was closed by any method other than clicking the OK
- *  button, the original sorting order will be restored.
- *
- *  @param dialog A pointer to the dialog box.
- *
- *  @param response A numerical value indicating why the dialog box was closed.
- *
- *  @param page A pointer to the GncPluginPageRegister associated with
- *  this dialog box.
- */
-void
-gnc_plugin_page_register_sort_response_cb (GtkDialog *dialog,
-        gint response,
-        GncPluginPageRegister *page)
-{
-    GncPluginPageRegisterPrivate *priv;
-    GncPluginPage *plugin_page;
-    SortType type;
-    const gchar *order;
-
-    g_return_if_fail(GTK_IS_DIALOG(dialog));
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
-
-    ENTER(" ");
-    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
-    plugin_page = GNC_PLUGIN_PAGE(page);
-
-    if (response != GTK_RESPONSE_OK)
-    {
-        /* Restore the original sort order */
-        gnc_split_reg_set_sort_reversed(priv->gsr, priv->sd.original_reverse_order);
-        priv->sd.reverse_order = priv->sd.original_reverse_order;
-        gnc_split_reg_set_sort_type(priv->gsr, priv->sd.original_sort_type);
-        priv->sd.save_order = priv->sd.original_save_order;
-    }
-    else
-    {
-        priv->sd.original_save_order = priv->sd.save_order;
-
-        if (priv->sd.save_order)
-        {
-            type = gnc_split_reg_get_sort_type(priv->gsr);
-            order = SortTypeasString(type);
-            gnc_plugin_page_register_set_sort_order (plugin_page, order);
-            gnc_plugin_page_register_set_sort_reversed (plugin_page, priv->sd.reverse_order);
-        }
-    }
-    gnc_book_option_remove_cb(OPTION_NAME_NUM_FIELD_SOURCE,
-                                gnc_plugin_page_register_sort_book_option_changed,
-                                page);
-    priv->sd.dialog = NULL;
-    priv->sd.num_radio = NULL;
-    priv->sd.act_radio = NULL;
-    gtk_widget_destroy(GTK_WIDGET(dialog));
-    LEAVE(" ");
-}
-
-
-/** This function is called when a radio button in the "Sort By..."
- *  dialog is clicked.
- *
- *  @param button The button that was toggled.
- *
- *  @param page A pointer to the GncPluginPageRegister associated with
- *  this dialog box.
- */
-void
-gnc_plugin_page_register_sort_button_cb (GtkToggleButton *button,
-        GncPluginPageRegister *page)
-{
-    GncPluginPageRegisterPrivate *priv;
-    const gchar *name;
-    SortType type;
-
-    g_return_if_fail(GTK_IS_TOGGLE_BUTTON(button));
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
-
-    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
-    name = gtk_buildable_get_name(GTK_BUILDABLE(button));
-    ENTER("button %s(%p), page %p", name, button, page);
-    type = SortTypefromString(name);
-    gnc_split_reg_set_sort_type(priv->gsr, type);
-    LEAVE(" ");
-}
-
-
-/** This function is called whenever the save sort order is checked
- *  or unchecked which allows saving of the sort order.
- *
- *  @param button The toggle button that was changed.
- *
- *  @param page A pointer to the GncPluginPageRegister that is
- *  associated with this sort order dialog.
- */
-void
-gnc_plugin_page_register_sort_order_save_cb (GtkToggleButton *button,
-        GncPluginPageRegister *page)
-{
-    GncPluginPageRegisterPrivate *priv;
-
-    g_return_if_fail(GTK_IS_CHECK_BUTTON(button));
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
-
-    ENTER("Save toggle button (%p), plugin_page %p", button, page);
-
-    /* Compute the new save sort order */
-    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
-
-    if (gtk_toggle_button_get_active(button))
-        priv->sd.save_order = TRUE;
-    else
-        priv->sd.save_order = FALSE;
-    LEAVE(" ");
-}
-
-/** This function is called whenever the reverse sort order is checked
- *  or unchecked which allows reversing of the sort order.
- *
- *  @param button The toggle button that was changed.
- *
- *  @param page A pointer to the GncPluginPageRegister that is
- *  associated with this sort order dialog.
- */
-void
-gnc_plugin_page_register_sort_order_reverse_cb (GtkToggleButton *button,
-        GncPluginPageRegister *page)
-
-{
-    GncPluginPageRegisterPrivate *priv;
-
-    g_return_if_fail(GTK_IS_CHECK_BUTTON(button));
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
-
-    ENTER("Reverse toggle button (%p), plugin_page %p", button, page);
-
-    /* Compute the new save sort order */
-    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
-
-    priv->sd.reverse_order = gtk_toggle_button_get_active(button);
-    gnc_split_reg_set_sort_reversed(priv->gsr, priv->sd.reverse_order);
-    LEAVE(" ");
-}
-
-/************************************************************/
-/*                    "Filter By" Dialog                    */
-/************************************************************/
-
-/** This function updates the "cleared match" term of the register
- *  query.  It unconditionally removes any old "cleared match" query
- *  term, then adds back a new query term if needed.  There seems to
- *  be a bug in the current g2 register code such that when the number
- *  of entries in the register doesn't fill up the window, the blank
- *  space at the end of the window isn't correctly redrawn.  This
- *  function works around that problem, but a root cause analysis
- *  should probably be done.
- *
- *  @param page A pointer to the GncPluginPageRegister that is
- *  associated with this filter dialog.
- */
-static void
-gnc_ppr_update_status_query (GncPluginPageRegister *page)
-{
-    GncPluginPageRegisterPrivate *priv;
-    GSList *param_list;
-    Query *query;
-
-    ENTER(" ");
-    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
-    query = gnc_ledger_display_get_query( priv->ledger );
-    if (!query)
-    {
-        LEAVE("no query found");
-        return;
-    }
-
-    /* Remove the old status match */
-    param_list = qof_query_build_param_list (SPLIT_RECONCILE, NULL);
-    if (param_list)
-    {
-        qof_query_purge_terms (query, param_list);
-        g_slist_free(param_list);
-    }
-
-    /* Install the new status match */
-    if (priv->fd.cleared_match != CLEARED_ALL)
-        xaccQueryAddClearedMatch(query, priv->fd.cleared_match, QOF_QUERY_AND);
-
-    gnc_ledger_display_refresh (priv->ledger);
-    LEAVE(" ");
-}
-
-
-/** This function updates the "date posted" term of the register
- *  query.  It unconditionally removes any old "date posted" query
- *  term, then adds back a new query term if needed.  There seems to
- *  be a bug in the current g2 register code such that when the number
- *  of entries in the register doesn't fill up the window, the blank
- *  space at the end of the window isn't correctly redrawn.  This
- *  function works around that problem, but a root cause analysis
- *  should probably be done.
- *
- *  @param page A pointer to the GncPluginPageRegister that is
- *  associated with this filter dialog.
- */
-static void
-gnc_ppr_update_date_query (GncPluginPageRegister *page)
-{
-    GncPluginPageRegisterPrivate *priv;
-    GSList *param_list;
-    Query *query;
-
-    ENTER(" ");
-    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
-    if (!priv->ledger)
-    {
-        LEAVE("no ledger");
-        return;
-    }
-
-    query = gnc_ledger_display_get_query( priv->ledger );
-    if (!query)
-    {
-        LEAVE("no query");
-        return;
-    }
-
-    /* Delete any existing old date spec. */
-    param_list = qof_query_build_param_list(SPLIT_TRANS, TRANS_DATE_POSTED, NULL);
-    if (param_list)
-    {
-        qof_query_purge_terms (query, param_list);
-        g_slist_free(param_list);
-    }
-
-    if (priv->fd.start_time || priv->fd.end_time)
-    {
-        /* Build a new spec */
-        xaccQueryAddDateMatchTT(query,
-                                priv->fd.start_time != 0, priv->fd.start_time,
-                                priv->fd.end_time != 0,   priv->fd.end_time,
-                                QOF_QUERY_AND);
-    }
-
-    gnc_ledger_display_refresh (priv->ledger);
-    LEAVE(" ");
-}
-
-
-/* This function converts a time64 value date to a string */
-static gchar *
-gnc_plugin_page_register_filter_time2dmy ( time64 raw_time)
-{
-    struct tm * timeinfo;
-    gchar date_string[11];
-
-    timeinfo = gnc_localtime (&raw_time);
-    strftime (date_string, 11, "%d-%m-%Y", timeinfo);
-    PINFO("Date string is %s", date_string);
-    gnc_tm_free (timeinfo);
-
-    return g_strdup(date_string);
-}
-
-
-/* This function converts a string date to a time64 value */
-static time64
-gnc_plugin_page_register_filter_dmy2time (char *date_string)
-{
-    struct tm when;
-
-    PINFO("Date string is %s", date_string);
-    memset (&when, 0, sizeof (when));
-
-    sscanf (date_string, "%d-%d-%d", &when.tm_mday,
-	    &when.tm_mon, &when.tm_year);
-
-    when.tm_mon -= 1;
-    when.tm_year -= 1900;
-
-    return gnc_mktime (&when);
-}
-
-
-/** This function is called whenever one of the status entries is
- *  checked or unchecked.  It updates the status value maintained for
- *  the filter dialog, and calls another function to do the work of
- *  applying the change to the register itself.
- *
- *  @param button The toggle button that was changed.
- *
- *  @param page A pointer to the GncPluginPageRegister that is
- *  associated with this filter dialog.
- */
-void
-gnc_plugin_page_register_filter_status_one_cb (GtkToggleButton *button,
-        GncPluginPageRegister *page)
-{
-    GncPluginPageRegisterPrivate *priv;
-    const gchar *name;
-    gint i, value;
-
-    g_return_if_fail(GTK_IS_CHECK_BUTTON(button));
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
-
-    name = gtk_buildable_get_name(GTK_BUILDABLE(button));
-    ENTER("toggle button %s (%p), plugin_page %p", name, button, page);
-
-    /* Determine what status bit to change */
-    value = CLEARED_NONE;
-    for (i = 0; status_actions[i].action_name; i++)
-    {
-        if (g_strcmp0(name, status_actions[i].action_name) == 0)
-        {
-            value = status_actions[i].value;
-            break;
-        }
-    }
-
-    /* Compute the new match status */
-    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
-    if (gtk_toggle_button_get_active(button))
-        priv->fd.cleared_match |= value;
-    else
-        priv->fd.cleared_match &= ~value;
-    gnc_ppr_update_status_query(page);
-    LEAVE(" ");
-}
-
-
-/** This function is called whenever the "select all" status button is
- *  clicked.  It updates all of the checkbox widgets, then updates the
- *  query on the register.
- *
- *  @param button The button that was clicked.
- *
- *  @param page A pointer to the GncPluginPageRegister that is
- *  associated with this filter dialog.
- */
-void
-gnc_plugin_page_register_filter_status_all_cb (GtkButton *button,
-        GncPluginPageRegister *page)
-{
-    GncPluginPageRegisterPrivate *priv;
-    GtkWidget *widget;
-    gint i;
-
-    g_return_if_fail(GTK_IS_BUTTON(button));
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
-
-    ENTER("(button %p, page %p)", button, page);
-
-    /* Turn on all the check menu items */
-    for (i = 0; status_actions[i].action_name; i++)
-    {
-        widget = status_actions[i].widget;
-        g_signal_handlers_block_by_func(widget, gnc_plugin_page_register_filter_status_one_cb, page);
-        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(widget), TRUE);
-        g_signal_handlers_unblock_by_func(widget, gnc_plugin_page_register_filter_status_one_cb, page);
-    }
-
-    /* Set the requested status */
-    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
-    priv->fd.cleared_match = CLEARED_ALL;
-    gnc_ppr_update_status_query(page);
-    LEAVE(" ");
-}
-
-
-/** This function computes the starting and ending times for the
- *  filter by examining the dialog widgets to see which ones are
- *  selected, and will pull times out of the data entry boxes if
- *  necessary.  This function must exist to handle the case where the
- *  "show all" button was Selected, and the user clicks on the "select
- *  range" button.  Since it exists, it make sense for the rest of the
- *  callbacks to take advantage of it.
- *
- *  @param page A pointer to the GncPluginPageRegister that is
- *  associated with this filter dialog.
- */
-static void
-get_filter_times(GncPluginPageRegister *page)
-{
-    GncPluginPageRegisterPrivate *priv;
-    time64 time_val;
-
-    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
-    if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->fd.start_date_choose)))
-    {
-        time_val = gnc_date_edit_get_date(GNC_DATE_EDIT(priv->fd.start_date));
-        time_val = gnc_time64_get_day_start(time_val);
-        priv->fd.start_time = time_val;
-    }
-    else
-    {
-        if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->fd.start_date_today)))
-        {
-            priv->fd.start_time = gnc_time64_get_today_start();
-        }
-        else
-        {
-            priv->fd.start_time = 0;
-        }
-    }
-
-    if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->fd.end_date_choose)))
-    {
-        time_val = gnc_date_edit_get_date(GNC_DATE_EDIT(priv->fd.end_date));
-        time_val = gnc_time64_get_day_end(time_val);
-        priv->fd.end_time = time_val;
-    }
-    else
-    {
-        if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->fd.start_date_today)))
-        {
-            priv->fd.end_time = gnc_time64_get_today_end();
-        }
-        else
-        {
-            priv->fd.end_time = 0;
-        }
-    }
-}
-
-
-/** This function is called when the "select range" radio button
- *  changes state.  Since there are only two choices in this radio
- *  group, this one signal can be used to handle all cases.  This
- *  function is responsible for setting the sensitivity of the table
- *  of widgets underneath the "select range" choice, and updating the
- *  time limitation on the register query.  This is handled by a
- *  helper function when the radio button is selected (as potentially
- *  all the widgets in the table need to be inspected), and is trivial
- *  for the other case.
- *
- *  @param button A pointer to the "select range" radio button.
- *
- *  @param page A pointer to the GncPluginPageRegister that is
- *  associated with this filter dialog.
- */
-void
-gnc_plugin_page_register_filter_select_range_cb (GtkRadioButton *button,
-        GncPluginPageRegister *page)
-{
-    GncPluginPageRegisterPrivate *priv;
-    gboolean active;
-
-    g_return_if_fail(GTK_IS_RADIO_BUTTON(button));
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
-
-    ENTER("(button %p, page %p)", button, page);
-    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
-    active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button));
-    gtk_widget_set_sensitive(priv->fd.table, active);
-    if (active)
-    {
-        get_filter_times(page);
-    }
-    else
-    {
-        priv->fd.start_time = 0;
-        priv->fd.end_time = 0;
-    }
-    gnc_ppr_update_date_query(page);
-    LEAVE(" ");
-}
-
-
-/** This function is called when one of the start date entry widgets
- *  is updated.  It simply calls common routines to determine the
- *  start/end times and update the register query.
- *
- *  @param unused A pointer to a GncDateEntry widgets, but it could be
- *  any widget.
- *
- *  @param page A pointer to the GncPluginPageRegister that is
- *  associated with this filter dialog.
- */
-static void
-gnc_plugin_page_register_filter_gde_changed_cb (GtkWidget *unused,
-        GncPluginPageRegister *page)
-{
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
-
-    ENTER("(widget %s(%p), page %p)", gtk_buildable_get_name(GTK_BUILDABLE(unused)), unused, page);
-    get_filter_times(page);
-    gnc_ppr_update_date_query(page);
-    LEAVE(" ");
-}
-
-
-/** This function is called when one of the start date radio buttons
- *  is selected.  It updates the sensitivity of the date entry widget,
- *  then calls a common routine to determine the start/end times and
- *  update the register query.
- *
- *  *Note: This function is actually called twice for each new radio
- *  button selection.  The first time call is to uncheck the old
- *  button, and the second time to check the new button.  This does
- *  make a kind of sense, as radio buttons are nothing more than
- *  linked toggle buttons where only one can be active.
- *
- *  @param radio The button whose state is changing.  This will be
- *  the previously selected button the first of the pair of calls to
- *  this function, and will be the newly selected button the second
- *  time.
- *
- *  @param page A pointer to the GncPluginPageRegister that is
- *  associated with this filter dialog.
- */
-void
-gnc_plugin_page_register_filter_start_cb (GtkWidget *radio,
-        GncPluginPageRegister *page)
-{
-    GncPluginPageRegisterPrivate *priv;
-    const gchar *name;
-    gboolean active;
-
-    g_return_if_fail(GTK_IS_RADIO_BUTTON(radio));
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
-
-    ENTER("(radio %s(%p), page %p)", gtk_buildable_get_name(GTK_BUILDABLE(radio)), radio, page);
-    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
-    if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(radio)))
-    {
-        LEAVE("1st callback of pair. Defer to 2nd callback.");
-        return;
-    }
-
-    name = gtk_buildable_get_name(GTK_BUILDABLE(radio));
-    active = ( g_strcmp0(name, g_strdup("start_date_choose")) == 0 ? 1 : 0 );
-    gtk_widget_set_sensitive(priv->fd.start_date, active);
-    get_filter_times(page);
-    gnc_ppr_update_date_query(page);
-    LEAVE(" ");
-}
-
-
-/** This function is called when one of the end date radio buttons is
- *  selected.  It updates the sensitivity of the date entry widget,
- *  then calls a common routine to determine the start/end times and
- *  update the register query.
- *
- *  *Note: This function is actually called twice for each new radio
- *  button selection.  The first time call is to uncheck the old
- *  button, and the second time to check the new button.  This does
- *  make a kind of sense, as radio buttons are nothing more than
- *  linked toggle buttons where only one can be active.
- *
- *  @param radio The button whose state is changing.  This will be
- *  the previously selected button the first of the pair of calls to
- *  this function, and will be the newly selected button the second
- *  time.
- *
- *  @param page A pointer to the GncPluginPageRegister that is
- *  associated with this filter dialog.
- */
-void
-gnc_plugin_page_register_filter_end_cb (GtkWidget *radio,
-                                        GncPluginPageRegister *page)
-{
-    GncPluginPageRegisterPrivate *priv;
-    const gchar *name;
-    gboolean active;
-
-    g_return_if_fail(GTK_IS_RADIO_BUTTON(radio));
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
-
-    ENTER("(radio %s(%p), page %p)", gtk_buildable_get_name(GTK_BUILDABLE(radio)), radio, page);
-    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
-    if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(radio)))
-    {
-        LEAVE("1st callback of pair. Defer to 2nd callback.");
-        return;
-    }
-
-    name = gtk_buildable_get_name(GTK_BUILDABLE(radio));
-    active = ( g_strcmp0(name, g_strdup("end_date_choose")) == 0 ? 1 : 0 );
-    gtk_widget_set_sensitive(priv->fd.end_date, active);
-    get_filter_times(page);
-    gnc_ppr_update_date_query(page);
-    LEAVE(" ");
-}
-
-
-/** This function is called whenever the save status is checked
- *  or unchecked. It will allow saving of the filter if required.
- *
- *  @param button The toggle button that was changed.
- *
- *  @param page A pointer to the GncPluginPageRegister that is
- *  associated with this filter dialog.
- */
-void
-gnc_plugin_page_register_filter_save_cb (GtkToggleButton *button,
-        GncPluginPageRegister *page)
-{
-    GncPluginPageRegisterPrivate *priv;
-
-    g_return_if_fail(GTK_IS_CHECK_BUTTON(button));
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
-
-    ENTER("Save toggle button (%p), plugin_page %p", button, page);
-
-    /* Compute the new save filter status */
-    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
-    if (gtk_toggle_button_get_active(button))
-        priv->fd.save_filter = TRUE;
-    else
-        priv->fd.save_filter = FALSE;
-    LEAVE(" ");
-}
-
-
-/** This function is called when the "Filter By..." dialog is closed.
- *  If the dialog was closed by any method other than clicking the OK
- *  button, the original sorting order will be restored.
- *
- *  @param dialog A pointer to the dialog box.
- *
- *  @param response A numerical value indicating why the dialog box was closed.
- *
- *  @param page A pointer to the GncPluginPageRegister associated with
- *  this dialog box.
- */
-void
-gnc_plugin_page_register_filter_response_cb (GtkDialog *dialog,
-        gint response,
-        GncPluginPageRegister *page)
-{
-    GncPluginPageRegisterPrivate *priv;
-    GncPluginPage *plugin_page;
-
-    g_return_if_fail(GTK_IS_DIALOG(dialog));
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
-
-    ENTER(" ");
-    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
-    plugin_page = GNC_PLUGIN_PAGE(page);
-
-    if (response != GTK_RESPONSE_OK)
-    {
-        /* Remove the old status match */
-        priv->fd.cleared_match = priv->fd.original_cleared_match;
-        gnc_ppr_update_status_query(page);
-        priv->fd.start_time = priv->fd.original_start_time;
-        priv->fd.end_time = priv->fd.original_end_time;
-        priv->fd.save_filter = priv->fd.original_save_filter;
-        gnc_ppr_update_date_query(page);
-    }
-    else
-    {
-        priv->fd.original_save_filter = priv->fd.save_filter;
-
-        if (priv->fd.save_filter)
-        {
-            gchar* filter;
-            filter = g_strdup_printf("0x%04x", priv->fd.cleared_match);
-
-            if ( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->fd.start_date_choose)) && priv->fd.start_time != 0 )
-            {
-                gchar *timeval = gnc_plugin_page_register_filter_time2dmy(priv->fd.start_time);
-                filter = g_strconcat ( filter, ",", timeval, NULL);
-                g_free (timeval);
-            }
-            else
-                filter = g_strconcat ( filter, ",0", NULL);
-
-            if ( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->fd.end_date_choose)) && priv->fd.end_time != 0 )
-            {
-                gchar *timeval = gnc_plugin_page_register_filter_time2dmy(priv->fd.end_time);
-                filter = g_strconcat ( filter, ",", timeval, NULL);
-                g_free (timeval);
-            }
-            else
-                filter = g_strconcat ( filter, ",0", NULL);
-
-            PINFO("The filter to save is %s", filter);
-
-            gnc_plugin_page_register_set_filter (plugin_page, filter);
-            g_free (filter);
-        }
-    }
-    priv->fd.dialog = NULL;
-    gtk_widget_destroy(GTK_WIDGET(dialog));
-    LEAVE(" ");
-}
-
-
-/************************************************************/
-/*                  Report Helper Functions                 */
-/************************************************************/
-
-static char *
-gnc_reg_get_name (GNCLedgerDisplay *ledger, gboolean for_window)
-{
-    Account *leader;
-    SplitRegister *reg;
-    gchar *account_name;
-    gchar *reg_name;
-    gchar *name;
-    GNCLedgerDisplayType ledger_type;
-
-    if (ledger == NULL)
-        return NULL;
-
-    reg = gnc_ledger_display_get_split_register (ledger);
-    ledger_type = gnc_ledger_display_type (ledger);
-
-    switch (reg->type)
-    {
-    case GENERAL_JOURNAL:
-    case INCOME_LEDGER:
-        if (for_window)
-            reg_name = _("General Journal");
-        else
-            reg_name = _("Transaction Report");
-        break;
-    case PORTFOLIO_LEDGER:
-        if (for_window)
-            reg_name = _("Portfolio");
-        else
-            reg_name = _("Portfolio Report");
-        break;
-    case SEARCH_LEDGER:
-        if (for_window)
-            reg_name = _("Search Results");
-        else
-            reg_name = _("Search Results Report");
-        break;
-    default:
-        if (for_window)
-            reg_name = _("Register");
-        else
-            reg_name = _("Transaction Report");
-        break;
-    }
-
-    leader = gnc_ledger_display_leader (ledger);
-
-    if ((leader != NULL) && (ledger_type != LD_GL))
-    {
-        account_name = gnc_account_get_full_name (leader);
-
-        if (ledger_type == LD_SINGLE)
-        {
-            name = g_strconcat (account_name, " - ", reg_name, NULL);
-        }
-        else
-        {
-            name = g_strconcat (account_name, " ", _("and subaccounts"), " - ", reg_name, NULL);
-        }
-        g_free(account_name);
-    }
-    else
-        name = g_strdup (reg_name);
-
-    return name;
-}
-
-static int
-report_helper (GNCLedgerDisplay *ledger, Split *split, Query *query)
-{
-    SplitRegister *reg = gnc_ledger_display_get_split_register (ledger);
-    Account *account;
-    char *str;
-    const char *tmp;
-    swig_type_info * qtype;
-    SCM args;
-    SCM func;
-    SCM arg;
-
-    args = SCM_EOL;
-
-    func = scm_c_eval_string ("gnc:register-report-create");
-    g_return_val_if_fail (scm_is_procedure (func), -1);
-
-    tmp = gnc_split_register_get_credit_string (reg);
-    arg = scm_from_utf8_string (tmp ? tmp : _("Credit"));
-    args = scm_cons (arg, args);
-
-    tmp = gnc_split_register_get_debit_string (reg);
-    arg = scm_from_utf8_string (tmp ? tmp : _("Debit"));
-    args = scm_cons (arg, args);
-
-    str = gnc_reg_get_name (ledger, FALSE);
-    arg = scm_from_utf8_string (str ? str : "");
-    args = scm_cons (arg, args);
-    g_free (str);
-
-    arg = SCM_BOOL (reg->use_double_line);
-    args = scm_cons (arg, args);
-
-    arg = SCM_BOOL (reg->type == GENERAL_JOURNAL || reg->type == INCOME_LEDGER
-                                                || reg->type == SEARCH_LEDGER);
-    args = scm_cons (arg, args);
-
-    arg = SCM_BOOL (reg->style == REG_STYLE_JOURNAL);
-    args = scm_cons (arg, args);
-
-    if (!query)
-    {
-        query = gnc_ledger_display_get_query (ledger);
-        g_return_val_if_fail (query != NULL, -1);
-    }
-
-    qtype = SWIG_TypeQuery ("_p__QofQuery");
-    g_return_val_if_fail (qtype, -1);
-
-    arg = SWIG_NewPointerObj (query, qtype, 0);
-    args = scm_cons (arg, args);
-    g_return_val_if_fail (arg != SCM_UNDEFINED, -1);
-
-
-    if (split)
-    {
-        qtype = SWIG_TypeQuery ("_p_Split");
-        g_return_val_if_fail (qtype, -1);
-        arg = SWIG_NewPointerObj (split, qtype, 0);
-    }
-    else
-    {
-        arg = SCM_BOOL_F;
-    }
-    args = scm_cons (arg, args);
-    g_return_val_if_fail (arg != SCM_UNDEFINED, -1);
-
-
-    qtype = SWIG_TypeQuery ("_p_Account");
-    g_return_val_if_fail (qtype, -1);
-
-    account = gnc_ledger_display_leader (ledger);
-    arg = SWIG_NewPointerObj (account, qtype, 0);
-    args = scm_cons (arg, args);
-    g_return_val_if_fail (arg != SCM_UNDEFINED, -1);
-
-
-    /* Apply the function to the args */
-    arg = scm_apply (func, args, SCM_EOL);
-    g_return_val_if_fail (scm_is_exact (arg), -1);
-
-    return scm_to_int (arg);
-}
-
-/************************************************************/
-/*                     Command callbacks                    */
-/************************************************************/
-
-static void
-gnc_plugin_page_register_cmd_print_check (GtkAction *action,
-        GncPluginPageRegister *plugin_page)
-{
-    GncPluginPageRegisterPrivate *priv;
-    SplitRegister * reg;
-    Split         * split;
-    Transaction   * trans;
-    GList         * splits = NULL, *item;
-    GNCLedgerDisplayType ledger_type;
-    Account       * account;
-    GtkWidget     * window;
-
-    ENTER("(action %p, plugin_page %p)", action, plugin_page);
-
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page));
-
-    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
-    reg = gnc_ledger_display_get_split_register (priv->ledger);
-    ledger_type = gnc_ledger_display_type(priv->ledger);
-    window = gnc_plugin_page_get_window(GNC_PLUGIN_PAGE(plugin_page));
-    if (ledger_type == LD_SINGLE || ledger_type == LD_SUBACCOUNT)
-    {
-        account  = gnc_plugin_page_register_get_account (plugin_page);
-        split    = gnc_split_register_get_current_split(reg);
-        trans    = xaccSplitGetParent(split);
-
-        if (split && trans)
-        {
-            if (xaccSplitGetAccount(split) == account)
-            {
-                splits = g_list_append(splits, split);
-                gnc_ui_print_check_dialog_create(window, splits);
-                g_list_free(splits);
-            }
-            else
-            {
-                /* This split is not for the account shown in this register.  Get the
-                   split that anchors the transaction to the registor */
-                split = gnc_split_register_get_current_trans_split(reg, NULL);
-                if (split)
-                {
-                    splits = g_list_append(splits, split);
-                    gnc_ui_print_check_dialog_create(window, splits);
-                    g_list_free(splits);
-                }
-            }
-        }
-    }
-    else if (ledger_type == LD_GL && reg->type == SEARCH_LEDGER)
-    {
-        Account *common_acct = NULL;
-        splits = qof_query_run(gnc_ledger_display_get_query(priv->ledger));
-        /* Make sure each split is from the same account */
-        for (item = splits; item; item = g_list_next(item))
-        {
-            split = (Split *) item->data;
-            if (common_acct == NULL)
-            {
-                common_acct = xaccSplitGetAccount(split);
-            }
-            else
-            {
-                if (xaccSplitGetAccount(split) != common_acct)
-                {
-                    GtkWidget *dialog;
-                    gint response;
-                    const gchar *title = _("Print checks from multiple accounts?");
-                    const gchar *message =
-                        _("This search result contains splits from more than one account. "
-                          "Do you want to print the checks even though they are not all "
-                          "from the same account?");
-                    dialog = gtk_message_dialog_new(GTK_WINDOW(window),
-                                                    GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                    GTK_MESSAGE_WARNING,
-                                                    GTK_BUTTONS_CANCEL,
-                                                    "%s", title);
-                    gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
-                            "%s", message);
-                    gtk_dialog_add_button(GTK_DIALOG(dialog), _("_Print checks"),
-                                          GTK_RESPONSE_YES);
-                    response = gnc_dialog_run(GTK_DIALOG(dialog),
-                                              GNC_PREF_WARN_CHECKPRINTING_MULTI_ACCT);
-                    gtk_widget_destroy(dialog);
-                    if (response != GTK_RESPONSE_YES)
-                    {
-                        LEAVE("Multiple accounts");
-                        return;
-                    }
-                    break;
-                }
-            }
-        }
-        gnc_ui_print_check_dialog_create(window, splits);
-    }
-    else
-    {
-        gnc_error_dialog(window, "%s",
-                         _("You can only print checks from a bank account register or search results."));
-        LEAVE("Unsupported ledger type");
-        return;
-    }
-    LEAVE(" ");
-}
-
-
-static void
-gnc_plugin_page_register_cmd_cut (GtkAction *action,
-                                  GncPluginPageRegister *page)
-{
-    GncPluginPageRegisterPrivate *priv;
-
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
-
-    ENTER("(action %p, page %p)", action, page);
-    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
-    gnucash_register_cut_clipboard(priv->gsr->reg);
-    LEAVE("");
-}
-
-
-static void
-gnc_plugin_page_register_cmd_copy (GtkAction *action,
-                                   GncPluginPageRegister *page)
-{
-    GncPluginPageRegisterPrivate *priv;
-
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
-
-    ENTER("(action %p, page %p)", action, page);
-    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
-    gnucash_register_copy_clipboard(priv->gsr->reg);
-    LEAVE("");
-}
-
-
-static void
-gnc_plugin_page_register_cmd_paste (GtkAction *action,
-                                    GncPluginPageRegister *page)
-{
-    GncPluginPageRegisterPrivate *priv;
-
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
-
-    ENTER("(action %p, page %p)", action, page);
-    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
-    gnucash_register_paste_clipboard(priv->gsr->reg);
-    LEAVE("");
-}
-
-
-static void
-gnc_plugin_page_register_cmd_edit_account (GtkAction *action,
-        GncPluginPageRegister *page)
-{
-    Account *account;
-
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
-
-    ENTER("(action %p, page %p)", action, page);
-    account = gnc_plugin_page_register_get_account (page);
-    if (account)
-        gnc_ui_edit_account_window (account);
-    LEAVE(" ");
-}
-
-
-static void
-gnc_plugin_page_register_cmd_find_account (GtkAction *action,
-        GncPluginPageRegister *page)
-{
-    GtkWidget *window;
-
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
-
-    window = gnc_plugin_page_get_window (GNC_PLUGIN_PAGE(page));
-
-    gnc_find_account_dialog (window, NULL);
-}
-
-
-
-static void
-gnc_plugin_page_register_cmd_find_transactions (GtkAction *action,
-        GncPluginPageRegister *page)
-{
-    GncPluginPageRegisterPrivate *priv;
-
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
-
-    ENTER("(action %p, page %p)", action, page);
-    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
-    gnc_ui_find_transactions_dialog_create(priv->ledger);
-    LEAVE(" ");
-}
-
-
-static void
-gnc_plugin_page_register_cmd_cut_transaction (GtkAction *action,
-        GncPluginPageRegister *page)
-{
-    GncPluginPageRegisterPrivate *priv;
-    SplitRegister *reg;
-
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
-
-    ENTER("(action %p, page %p)", action, page);
-    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
-    reg = gnc_ledger_display_get_split_register(priv->ledger);
-    gnc_split_register_cut_current(reg);
-    LEAVE(" ");
-}
-
-
-static void
-gnc_plugin_page_register_cmd_copy_transaction (GtkAction *action,
-        GncPluginPageRegister *page)
-{
-    GncPluginPageRegisterPrivate *priv;
-    SplitRegister *reg;
-
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
-
-    ENTER("(action %p, page %p)", action, page);
-    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
-    reg = gnc_ledger_display_get_split_register(priv->ledger);
-    gnc_split_register_copy_current(reg);
-    LEAVE(" ");
-}
-
-
-static void
-gnc_plugin_page_register_cmd_paste_transaction (GtkAction *action,
-        GncPluginPageRegister *page)
-{
-    GncPluginPageRegisterPrivate *priv;
-    SplitRegister *reg;
-
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
-
-    ENTER("(action %p, page %p)", action, page);
-    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
-    reg = gnc_ledger_display_get_split_register(priv->ledger);
-    gnc_split_register_paste_current(reg);
-    LEAVE(" ");
-}
-
-
-static void
-gnc_plugin_page_register_cmd_void_transaction (GtkAction *action,
-        GncPluginPageRegister *page)
-{
-    GncPluginPageRegisterPrivate *priv;
-    GtkWidget *dialog, *entry;
-    SplitRegister *reg;
-    Transaction *trans;
-    GtkBuilder *builder;
-    const char *reason;
-    gint result;
-
-    ENTER("(action %p, page %p)", action, page);
-
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
-
-    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
-    reg = gnc_ledger_display_get_split_register(priv->ledger);
-    trans = gnc_split_register_get_current_trans(reg);
-    if (trans == NULL)
-        return;
-    if (xaccTransHasSplitsInState(trans, VREC))
-        return;
-    if (xaccTransHasReconciledSplits(trans) || xaccTransHasSplitsInState(trans, CREC))
-    {
-        gnc_error_dialog(NULL, "%s", _("You cannot void a transaction with reconciled or cleared splits."));
-        return;
-    }
-    reason = xaccTransGetReadOnly (trans);
-    if (reason)
-    {
-        gnc_error_dialog(NULL, _("This transaction is marked read-only with the comment: '%s'"), reason);
-        return;
-    }
-
-    if (!gnc_plugin_page_register_finish_pending(GNC_PLUGIN_PAGE(page)))
-        return;
-
-    builder = gtk_builder_new();
-    gnc_builder_add_from_file  (builder , "gnc-plugin-page-register.glade", "void_transaction_dialog");
-    dialog = GTK_WIDGET(gtk_builder_get_object (builder, "void_transaction_dialog"));
-    entry = GTK_WIDGET(gtk_builder_get_object (builder, "reason"));
-
-    result = gtk_dialog_run(GTK_DIALOG(dialog));
-    if (result == GTK_RESPONSE_OK)
-    {
-        reason = gtk_entry_get_text(GTK_ENTRY(entry));
-        if (reason == NULL)
-            reason = "";
-        gnc_split_register_void_current_trans(reg, reason);
-    }
-
-    /* All done. Get rid of it. */
-    gtk_widget_destroy(dialog);
-    g_object_unref(G_OBJECT(builder));
-}
-
-
-static void
-gnc_plugin_page_register_cmd_unvoid_transaction (GtkAction *action,
-        GncPluginPageRegister *page)
-{
-    GncPluginPageRegisterPrivate *priv;
-    SplitRegister *reg;
-    Transaction *trans;
-
-    ENTER("(action %p, page %p)", action, page);
-
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
-
-    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
-    reg = gnc_ledger_display_get_split_register(priv->ledger);
-    trans = gnc_split_register_get_current_trans(reg);
-    if (!xaccTransHasSplitsInState(trans, VREC))
-        return;
-    gnc_split_register_unvoid_current_trans(reg);
-    LEAVE(" ");
-}
-
-
-static void
-gnc_plugin_page_register_cmd_reverse_transaction (GtkAction *action,
-        GncPluginPageRegister *page)
-{
-    GncPluginPageRegisterPrivate *priv;
-    SplitRegister *reg;
-    GNCSplitReg *gsr;
-    Transaction *trans, *new_trans;
-
-    ENTER("(action %p, page %p)", action, page);
-
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
-
-    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
-    reg = gnc_ledger_display_get_split_register(priv->ledger);
-    trans = gnc_split_register_get_current_trans(reg);
-    if (trans == NULL)
-        return;
-
-    if (xaccTransGetReversedBy(trans))
-    {
-        gnc_error_dialog(gnc_plugin_page_get_window(GNC_PLUGIN_PAGE(page)), "%s",
-                         _("A reversing entry has already been created for this transaction."));
-        return;
-    }
-
-    qof_event_suspend();
-    new_trans = xaccTransReverse(trans);
-
-    /* Clear transaction level info */
-    xaccTransSetDatePostedSecsNormalized (new_trans, gnc_time (NULL));
-    xaccTransSetDateEnteredSecs (new_trans, gnc_time (NULL));
-
-    qof_event_resume();
-
-    /* Now jump to new trans */
-    gsr = gnc_plugin_page_register_get_gsr(GNC_PLUGIN_PAGE(page));
-    gnc_split_reg_jump_to_split(gsr, xaccTransGetSplit(new_trans, 0));
-    LEAVE(" ");
-}
-
-static void
-gnc_plugin_page_register_cmd_view_sort_by (GtkAction *action,
-        GncPluginPageRegister *page)
-{
-    GncPluginPageRegisterPrivate *priv;
-    SplitRegister *reg;
-    GtkWidget *dialog, *button;
-    GtkBuilder *builder;
-    SortType sort;
-    const gchar *name;
-    gchar *title;
-
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
-    ENTER("(action %p, page %p)", action, page);
-
-    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
-    if (priv->sd.dialog)
-    {
-        gtk_window_present(GTK_WINDOW(priv->sd.dialog));
-        LEAVE("existing dialog");
-        return;
-    }
-
-    /* Create the dialog */
-
-    builder = gtk_builder_new();
-    gnc_builder_add_from_file  (builder, "gnc-plugin-page-register.glade", "sort_by_dialog");
-    dialog = GTK_WIDGET(gtk_builder_get_object (builder, "sort_by_dialog"));
-    priv->sd.dialog = dialog;
-    gtk_window_set_transient_for(GTK_WINDOW(dialog),
-                                 gnc_window_get_gtk_window(GNC_WINDOW(GNC_PLUGIN_PAGE(page)->window)));
-    /* Translations: The %s is the name of the plugin page */
-    title = g_strdup_printf(_("Sort %s by..."),
-                            gnc_plugin_page_get_page_name(GNC_PLUGIN_PAGE(page)));
-    gtk_window_set_title(GTK_WINDOW(dialog), title);
-    g_free(title);
-
-    /* Set the button for the current sort order */
-    sort = gnc_split_reg_get_sort_type(priv->gsr);
-    name = SortTypeasString(sort);
-    button = GTK_WIDGET(gtk_builder_get_object (builder, name));
-    DEBUG("current sort %d, button %s(%p)", sort, name, button);
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE);
-    priv->sd.original_sort_type = sort;
-
-    button = GTK_WIDGET(gtk_builder_get_object (builder, "sort_save"));
-    if (priv->sd.save_order == TRUE)
-        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE);
-
-    /* Set the button for the current reverse_order order */
-    button = GTK_WIDGET(gtk_builder_get_object (builder, "sort_reverse"));
-    if(priv->sd.reverse_order == TRUE)
-       gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE);
-    priv->sd.original_reverse_order = priv->sd.reverse_order;
-
-    priv->sd.num_radio = GTK_WIDGET(gtk_builder_get_object (builder, "BY_NUM"));
-    priv->sd.act_radio = GTK_WIDGET(gtk_builder_get_object (builder, "BY_ACTION"));
-    /* Adjust labels related to Num/Action radio buttons based on book option */
-    reg = gnc_ledger_display_get_split_register(priv->ledger);
-    if (reg && !reg->use_tran_num_for_num_field)
-    {
-        gtk_button_set_label(GTK_BUTTON (priv->sd.num_radio), _("Transaction Number"));
-        gtk_button_set_label(GTK_BUTTON (priv->sd.act_radio), _("Number/Action"));
-    }
-    gnc_book_option_register_cb(OPTION_NAME_NUM_FIELD_SOURCE,
-                                gnc_plugin_page_register_sort_book_option_changed,
-                                page);
-
-     /* Wire it up */
-    gtk_builder_connect_signals_full (builder, gnc_builder_connect_full_func, page);
-
-    /* Show it */
-    gtk_widget_show(dialog);
-    g_object_unref(G_OBJECT(builder));
-    LEAVE(" ");
-}
-
-static void
-gnc_plugin_page_register_cmd_view_filter_by (GtkAction *action,
-        GncPluginPageRegister *page)
-{
-    GncPluginPageRegisterPrivate *priv;
-    GtkWidget *dialog, *toggle, *button, *table, *hbox;
-    time64 start_time, end_time, time_val;
-    GtkBuilder *builder;
-    gboolean sensitive, value;
-    Query *query;
-    gchar *title;
-    int i;
-
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
-    ENTER("(action %p, page %p)", action, page);
-
-    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
-    if (priv->fd.dialog)
-    {
-        gtk_window_present(GTK_WINDOW(priv->fd.dialog));
-        LEAVE("existing dialog");
-        return;
-    }
-
-    /* Create the dialog */
-    builder = gtk_builder_new();
-    gnc_builder_add_from_file (builder, "gnc-plugin-page-register.glade", "filter_by_dialog");
-    dialog = GTK_WIDGET(gtk_builder_get_object (builder, "filter_by_dialog"));
-    priv->fd.dialog = dialog;
-    gtk_window_set_transient_for(GTK_WINDOW(dialog),
-                                 gnc_window_get_gtk_window(GNC_WINDOW(GNC_PLUGIN_PAGE(page)->window)));
-
-    /* Translators: The %s is the name of the plugin page */
-    title = g_strdup_printf(_("Filter %s by..."),
-                            gnc_plugin_page_get_page_name(GNC_PLUGIN_PAGE(page)));
-    gtk_window_set_title(GTK_WINDOW(dialog), title);
-    g_free(title);
-
-    /* Set the check buttons for the current status */
-    for (i = 0; status_actions[i].action_name; i++)
-    {
-        toggle = GTK_WIDGET(gtk_builder_get_object (builder, status_actions[i].action_name));
-        value = priv->fd.cleared_match & status_actions[i].value;
-        status_actions[i].widget = toggle;
-        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), value);
-    }
-    priv->fd.original_cleared_match = priv->fd.cleared_match;
-
-    button = GTK_WIDGET(gtk_builder_get_object (builder, "filter_save"));
-    if (priv->fd.save_filter == TRUE)
-        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE);
-
-
-    /* Set the date info */
-    button = GTK_WIDGET(gtk_builder_get_object (builder, "filter_show_range"));
-    query = gnc_ledger_display_get_query (priv->ledger);
-    xaccQueryGetDateMatchTT(query, &start_time, &end_time);
-    priv->fd.original_start_time = start_time;
-    priv->fd.start_time = start_time;
-    priv->fd.original_end_time = end_time;
-    priv->fd.end_time = end_time;
-
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), start_time || end_time);
-    table = GTK_WIDGET(gtk_builder_get_object (builder, "select_range_table"));
-    priv->fd.table = table;
-    gtk_widget_set_sensitive(GTK_WIDGET(table), start_time || end_time);
-
-    priv->fd.start_date_choose = GTK_WIDGET(gtk_builder_get_object (builder, "start_date_choose"));
-    priv->fd.start_date_today = GTK_WIDGET(gtk_builder_get_object (builder, "start_date_today"));
-    priv->fd.end_date_choose = GTK_WIDGET(gtk_builder_get_object (builder, "end_date_choose"));
-    priv->fd.end_date_today = GTK_WIDGET(gtk_builder_get_object (builder, "end_date_today"));
-
-    {
-        /* Start date info */
-        if (start_time == 0)
-        {
-            button = GTK_WIDGET(gtk_builder_get_object (builder, "start_date_earliest"));
-            time_val = xaccQueryGetEarliestDateFound (query);
-            sensitive = FALSE;
-        }
-        else
-        {
-            time_val = start_time;
-            if ((start_time >= gnc_time64_get_today_start()) &&
-                    (start_time <= gnc_time64_get_today_end()))
-            {
-                button = priv->fd.start_date_today;
-                sensitive = FALSE;
-            }
-            else
-            {
-                button = priv->fd.start_date_choose;
-                sensitive = TRUE;
-            }
-        }
-        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE);
-        priv->fd.start_date = gnc_date_edit_new (gnc_time (NULL), FALSE, FALSE);
-        hbox = GTK_WIDGET(gtk_builder_get_object (builder, "start_date_hbox"));
-        gtk_box_pack_start (GTK_BOX (hbox), priv->fd.start_date, TRUE, TRUE, 0);
-        gtk_widget_show (priv->fd.start_date);
-        gtk_widget_set_sensitive(GTK_WIDGET(priv->fd.start_date), sensitive);
-        gnc_date_edit_set_time (GNC_DATE_EDIT(priv->fd.start_date), time_val);
-        g_signal_connect (G_OBJECT (priv->fd.start_date), "date-changed",
-                          G_CALLBACK (gnc_plugin_page_register_filter_gde_changed_cb),
-                          page);
-    }
-
-    {
-        /* End date info */
-        if (end_time == 0)
-        {
-            button = GTK_WIDGET(gtk_builder_get_object (builder, "end_date_latest"));
-            time_val = xaccQueryGetLatestDateFound (query);
-            sensitive = FALSE;
-        }
-        else
-        {
-            time_val = end_time;
-            if ((end_time >= gnc_time64_get_today_start()) &&
-                    (end_time <= gnc_time64_get_today_end()))
-            {
-                button = priv->fd.end_date_today;
-                sensitive = FALSE;
-            }
-            else
-            {
-                button = priv->fd.end_date_choose;
-                sensitive = TRUE;
-            }
-        }
-        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE);
-        priv->fd.end_date = gnc_date_edit_new (gnc_time (NULL), FALSE, FALSE);
-        hbox = GTK_WIDGET(gtk_builder_get_object (builder, "end_date_hbox"));
-        gtk_box_pack_start (GTK_BOX (hbox), priv->fd.end_date, TRUE, TRUE, 0);
-        gtk_widget_show (priv->fd.end_date);
-        gtk_widget_set_sensitive(GTK_WIDGET(priv->fd.end_date), sensitive);
-        gnc_date_edit_set_time (GNC_DATE_EDIT(priv->fd.end_date), time_val);
-        g_signal_connect (G_OBJECT (priv->fd.end_date), "date-changed",
-                          G_CALLBACK (gnc_plugin_page_register_filter_gde_changed_cb),
-                          page);
-    }
-
-    /* Wire it up */
-    gtk_builder_connect_signals_full (builder, gnc_builder_connect_full_func, page);
-
-    /* Show it */
-    gtk_widget_show_all(dialog);
-    g_object_unref(G_OBJECT(builder));
-    LEAVE(" ");
-}
-
-static void
-gnc_plugin_page_register_cmd_style_changed (GtkAction *action,
-        GtkRadioAction *current,
-        GncPluginPageRegister *plugin_page)
-{
-    GncPluginPageRegisterPrivate *priv;
-    SplitRegisterStyle value;
-
-    ENTER("(action %p, radio action %p, plugin_page %p)",
-          action, current, plugin_page);
-
-    g_return_if_fail(GTK_IS_ACTION(action));
-    g_return_if_fail(GTK_IS_RADIO_ACTION(current));
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page));
-
-    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
-    value = gtk_radio_action_get_current_value(current);
-    gnc_split_reg_change_style(priv->gsr, value);
-
-    gnc_plugin_page_register_ui_update (NULL, plugin_page);
-    LEAVE(" ");
-}
-
-static void
-gnc_plugin_page_register_cmd_style_double_line (GtkToggleAction *action,
-        GncPluginPageRegister *plugin_page)
-{
-    GncPluginPageRegisterPrivate *priv;
-    SplitRegister *reg;
-    gboolean use_double_line;
-
-    ENTER("(action %p, plugin_page %p)", action, plugin_page);
-
-    g_return_if_fail(GTK_IS_ACTION(action));
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page));
-
-    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
-    reg = gnc_ledger_display_get_split_register (priv->ledger);
-
-    use_double_line =  gtk_toggle_action_get_active (action);
-    if (use_double_line != reg->use_double_line)
-    {
-        gnc_split_register_config(reg, reg->type, reg->style, use_double_line);
-        gnc_ledger_display_refresh(priv->ledger);
-    }
-    LEAVE(" ");
-}
-
-static void
-gnc_plugin_page_register_cmd_transfer (GtkAction *action,
-                                       GncPluginPageRegister *page)
-{
-    Account *account;
-    GncWindow *gnc_window;
-    GtkWidget *window;
-
-    ENTER("(action %p, plugin_page %p)", action, page);
-
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
-
-    account = gnc_plugin_page_register_get_account (page);
-    gnc_window = GNC_WINDOW(GNC_PLUGIN_PAGE (page)->window);
-    window = GTK_WIDGET(gnc_window_get_gtk_window(gnc_window));
-    gnc_xfer_dialog (window, account);
-    LEAVE(" ");
-}
-
-static void
-gnc_plugin_page_register_cmd_reconcile (GtkAction *action,
-                                        GncPluginPageRegister *page)
-{
-    Account *account;
-    GtkWindow *window;
-    RecnWindow * recnData;
-
-    ENTER("(action %p, plugin_page %p)", action, page);
-
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
-
-    account = gnc_plugin_page_register_get_account (page);
-
-    window = gnc_window_get_gtk_window(GNC_WINDOW(GNC_PLUGIN_PAGE (page)->window));
-    recnData = recnWindow (GTK_WIDGET(window), account);
-    gnc_ui_reconcile_window_raise (recnData);
-    LEAVE(" ");
-}
-
-static void
-gnc_plugin_page_register_cmd_autoclear (GtkAction *action,
-                                        GncPluginPageRegister *page)
-{
-    Account *account;
-    GtkWindow *window;
-    AutoClearWindow * autoClearData;
-
-    ENTER("(action %p, plugin_page %p)", action, page);
-
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
-
-    account = gnc_plugin_page_register_get_account (page);
-
-    window = gnc_window_get_gtk_window(GNC_WINDOW(GNC_PLUGIN_PAGE (page)->window));
-    autoClearData = autoClearWindow (GTK_WIDGET(window), account);
-    gnc_ui_autoclear_window_raise (autoClearData);
-    LEAVE(" ");
-}
-
-static void
-gnc_plugin_page_register_cmd_stock_split (GtkAction *action,
-        GncPluginPageRegister *page)
-{
-    Account *account;
-
-    ENTER("(action %p, plugin_page %p)", action, page);
-
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
-
-    account = gnc_plugin_page_register_get_account (page);
-    gnc_stock_split_dialog (NULL, account);
-    LEAVE(" ");
-}
-
-static void
-gnc_plugin_page_register_cmd_lots (GtkAction *action,
-                                   GncPluginPageRegister *page)
-{
-    Account *account;
-
-    ENTER("(action %p, plugin_page %p)", action, page);
-
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
-
-    account = gnc_plugin_page_register_get_account (page);
-    gnc_lot_viewer_dialog (account);
-    LEAVE(" ");
-}
-
-static void
-gnc_plugin_page_register_cmd_enter_transaction (GtkAction *action,
-        GncPluginPageRegister *plugin_page)
-{
-    GncPluginPageRegisterPrivate *priv;
-
-    ENTER("(action %p, plugin_page %p)", action, plugin_page);
-
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page));
-
-    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
-    gnc_split_reg_enter(priv->gsr, FALSE);
-    LEAVE(" ");
-}
-
-static void
-gnc_plugin_page_register_cmd_cancel_transaction (GtkAction *action,
-        GncPluginPageRegister *plugin_page)
-{
-    GncPluginPageRegisterPrivate *priv;
-
-    ENTER("(action %p, plugin_page %p)", action, plugin_page);
-
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page));
-
-    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
-    gnc_split_register_cancel_cursor_trans_changes
-    (gnc_ledger_display_get_split_register(priv->ledger));
-    LEAVE(" ");
-}
-
-static void
-gnc_plugin_page_register_cmd_delete_transaction (GtkAction *action,
-        GncPluginPageRegister *plugin_page)
-{
-    GncPluginPageRegisterPrivate *priv;
-
-    ENTER("(action %p, plugin_page %p)", action, plugin_page);
-
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page));
-
-    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
-    gsr_default_delete_handler(priv->gsr, NULL);
-    LEAVE(" ");
-
-}
-
-static void
-gnc_plugin_page_register_cmd_associate_file_transaction (GtkAction *action,
-        GncPluginPageRegister *plugin_page)
-{
-    GncPluginPageRegisterPrivate *priv;
-
-    ENTER("(action %p, plugin_page %p)", action, plugin_page);
-
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page));
-
-    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
-    gsr_default_associate_handler (priv->gsr, TRUE);
-    gnc_plugin_page_register_ui_update (NULL, plugin_page);
-    LEAVE(" ");
-}
-
-static void
-gnc_plugin_page_register_cmd_associate_location_transaction (GtkAction *action,
-        GncPluginPageRegister *plugin_page)
-{
-    GncPluginPageRegisterPrivate *priv;
-
-    ENTER("(action %p, plugin_page %p)", action, plugin_page);
-
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page));
-
-    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
-    gsr_default_associate_handler (priv->gsr, FALSE);
-    gnc_plugin_page_register_ui_update (NULL, plugin_page);
-    LEAVE(" ");
-}
-
-static void
-gnc_plugin_page_register_cmd_execassociated_transaction (GtkAction *action,
-        GncPluginPageRegister *plugin_page)
-{
-    GncPluginPageRegisterPrivate *priv;
-
-    ENTER("(action %p, plugin_page %p)", action, plugin_page);
-
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page));
-
-    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
-    gsr_default_execassociated_handler(priv->gsr, NULL);
-    LEAVE(" ");
-
-}
-
-static void
-gnc_plugin_page_register_cmd_blank_transaction (GtkAction *action,
-        GncPluginPageRegister *plugin_page)
-{
-    GncPluginPageRegisterPrivate *priv;
-    SplitRegister *reg;
-
-    ENTER("(action %p, plugin_page %p)", action, plugin_page);
-
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page));
-
-    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
-    reg = gnc_ledger_display_get_split_register (priv->ledger);
-
-    if (gnc_split_register_save (reg, TRUE))
-        gnc_split_register_redraw (reg);
-
-    gnc_split_reg_jump_to_blank (priv->gsr);
-    LEAVE(" ");
-}
-
-static void
-gnc_plugin_page_register_cmd_duplicate_transaction (GtkAction *action,
-        GncPluginPageRegister *plugin_page)
-{
-    GncPluginPageRegisterPrivate *priv;
-
-    ENTER("(action %p, plugin_page %p)", action, plugin_page);
-
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page));
-
-    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
-    gnc_split_register_duplicate_current
-    (gnc_ledger_display_get_split_register(priv->ledger));
-    LEAVE(" ");
-}
-
-static void
-gnc_plugin_page_register_cmd_reinitialize_transaction (GtkAction *action,
-        GncPluginPageRegister *plugin_page)
-{
-    GncPluginPageRegisterPrivate *priv;
-
-    ENTER("(action %p, plugin_page %p)", action, plugin_page);
-
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page));
-
-    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
-    gsr_default_reinit_handler(priv->gsr, NULL);
-    LEAVE(" ");
-}
-
-static void
-gnc_plugin_page_register_cmd_expand_transaction (GtkToggleAction *action,
-        GncPluginPageRegister *plugin_page)
-{
-    GncPluginPageRegisterPrivate *priv;
-    SplitRegister *reg;
-    gboolean expand;
-
-    ENTER("(action %p, plugin_page %p)", action, plugin_page);
-
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page));
-
-    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
-    reg = gnc_ledger_display_get_split_register (priv->ledger);
-    expand = gtk_toggle_action_get_active (action);
-    gnc_split_register_expand_current_trans (reg, expand);
-    LEAVE(" ");
-}
-
-/** Callback for "Edit Exchange Rate" menu item.
- */
-static void
-gnc_plugin_page_register_cmd_exchange_rate (GtkAction *action,
-        GncPluginPageRegister *plugin_page)
-{
-    GncPluginPageRegisterPrivate *priv;
-    SplitRegister *reg;
-
-    ENTER("(action %p, plugin_page %p)", action, plugin_page);
-
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page));
-
-    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
-    reg = gnc_ledger_display_get_split_register (priv->ledger);
-
-    /* XXX Ignore the return value -- we don't care if this succeeds */
-    (void)gnc_split_register_handle_exchange (reg, TRUE);
-    LEAVE(" ");
-}
-
-static void
-gnc_plugin_page_register_cmd_jump (GtkAction *action,
-                                   GncPluginPageRegister *plugin_page)
-{
-    GncPluginPageRegisterPrivate *priv;
-    GncPluginPage *new_page;
-    GtkWidget *window;
-    GNCSplitReg *gsr;
-    SplitRegister *reg;
-    Account *account;
-    Account *leader;
-    Split *split;
-
-    ENTER("(action %p, plugin_page %p)", action, plugin_page);
-
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page));
-
-    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
-    window = GNC_PLUGIN_PAGE (plugin_page)->window;
-    if (window == NULL)
-    {
-        LEAVE("no window");
-        return;
-    }
-
-    reg = gnc_ledger_display_get_split_register (priv->ledger);
-    split = gnc_split_register_get_current_split (reg);
-    if (split == NULL)
-    {
-        LEAVE("no split (1)");
-        return;
-    }
-
-    account = xaccSplitGetAccount (split);
-    if (account == NULL)
-    {
-        LEAVE("no account");
-        return;
-    }
-
-    leader = gnc_ledger_display_leader (priv->ledger);
-    if (account == leader)
-    {
-        split = xaccSplitGetOtherSplit (split);
-        if (split == NULL)
-        {
-            LEAVE("no split (2)");
-            return;
-        }
-
-        account = xaccSplitGetAccount (split);
-        if (account == NULL)
-        {
-            LEAVE("no account (2)");
-            return;
-        }
-
-        if (account == leader)
-        {
-            LEAVE("register open for account");
-            return;
-        }
-    }
-
-    new_page = gnc_plugin_page_register_new (account, FALSE);
-    if (new_page == NULL)
-    {
-        LEAVE("couldn't create new page");
-        return;
-    }
-
-    gnc_main_window_open_page (GNC_MAIN_WINDOW(window), new_page);
-    gsr = gnc_plugin_page_register_get_gsr (new_page);
-    gnc_split_reg_jump_to_split(gsr, split);
-    LEAVE(" ");
-}
-
-static void
-gnc_plugin_page_register_cmd_schedule (GtkAction *action,
-                                       GncPluginPageRegister *plugin_page)
-{
-    GncPluginPageRegisterPrivate *priv;
-
-    ENTER("(action %p, plugin_page %p)", action, plugin_page);
-
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page));
-
-    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
-    gsr_default_schedule_handler(priv->gsr, NULL);
-    LEAVE(" ");
-}
-
-static void
-gnc_plugin_page_register_cmd_scrub_current (GtkAction *action,
-        GncPluginPageRegister *plugin_page)
-{
-    GncPluginPageRegisterPrivate *priv;
-    Query *query;
-    Account *root;
-    Transaction *trans;
-    Split *split;
-    GNCLot *lot;
-    SplitRegister *reg;
-
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page));
-
-    ENTER("(action %p, plugin_page %p)", action, plugin_page);
-
-    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
-    query = gnc_ledger_display_get_query( priv->ledger );
-    if (query == NULL)
-    {
-        LEAVE("no query found");
-        return;
-    }
-
-    reg = gnc_ledger_display_get_split_register(priv->ledger);
-    trans = gnc_split_register_get_current_trans(reg);
-    if (trans == NULL)
-    {
-        LEAVE("no trans found");
-        return;
-    }
-
-    gnc_suspend_gui_refresh();
-    root = gnc_get_current_root_account();
-    xaccTransScrubOrphans(trans);
-    xaccTransScrubImbalance(trans, root, NULL);
-
-    split = gnc_split_register_get_current_split (reg);
-    lot = xaccSplitGetLot (split);
-    if (lot && xaccAccountIsAPARType (xaccAccountGetType (xaccSplitGetAccount (split))))
-    {
-        gncScrubBusinessLot (lot);
-        gncScrubBusinessSplit (split);
-    }
-    gnc_resume_gui_refresh();
-    LEAVE(" ");
-}
-
-static void
-gnc_plugin_page_register_cmd_scrub_all (GtkAction *action,
-                                        GncPluginPageRegister *plugin_page)
-{
-    GncPluginPageRegisterPrivate *priv;
-    Query *query;
-    Account *root;
-    GncWindow *window;
-    GList *node, *splits;
-    gint split_count = 0, curr_split_no = 0;
-    const char *message = _( "Checking splits in current register: %u of %u");
-
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page));
-
-    ENTER("(action %p, plugin_page %p)", action, plugin_page);
-
-    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
-    query = gnc_ledger_display_get_query( priv->ledger );
-    if (!query)
-    {
-        LEAVE("no query found");
-        return;
-    }
-
-    gnc_suspend_gui_refresh();
-    window = GNC_WINDOW(GNC_PLUGIN_PAGE (plugin_page)->window);
-    gnc_window_set_progressbar_window (window);
-
-    root = gnc_get_current_root_account();
-
-    splits = qof_query_run(query);
-    split_count = g_list_length (splits);
-    for (node = splits; node; node = node->next)
-    {
-        GNCLot *lot;
-        Split *split = node->data;
-        Transaction *trans = xaccSplitGetParent(split);
-
-        if (!split) continue;
-
-        PINFO("Start processing split %d of %d",
-              curr_split_no + 1, split_count);
-
-        if (curr_split_no % 100 == 0)
-        {
-            char *progress_msg = g_strdup_printf (message, curr_split_no, split_count);
-            gnc_window_show_progress (progress_msg, (100 * curr_split_no) / split_count);
-            g_free (progress_msg);
-        }
-
-        xaccTransScrubOrphans(trans);
-        xaccTransScrubImbalance(trans, root, NULL);
-
-        lot = xaccSplitGetLot (split);
-        if (lot && xaccAccountIsAPARType (xaccAccountGetType (xaccSplitGetAccount (split))))
-        {
-            gncScrubBusinessLot (lot);
-            gncScrubBusinessSplit (split);
-        }
-
-        PINFO("Finished processing split %d of %d",
-              curr_split_no + 1, split_count);
-        curr_split_no++;
-    }
-
-    gnc_window_show_progress (NULL, -1.0);
-    gnc_resume_gui_refresh();
-    LEAVE(" ");
-}
-
-static void
-gnc_plugin_page_register_cmd_account_report (GtkAction *action,
-        GncPluginPageRegister *plugin_page)
-{
-    GncPluginPageRegisterPrivate *priv;
-    GncMainWindow *window;
-    int id;
-
-    ENTER("(action %p, plugin_page %p)", action, plugin_page);
-
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page));
-
-    window = GNC_MAIN_WINDOW(GNC_PLUGIN_PAGE(plugin_page)->window);
-    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
-    id = report_helper (priv->ledger, NULL, NULL);
-    if (id >= 0)
-        gnc_main_window_open_report(id, window);
-    LEAVE(" ");
-}
-
-static void
-gnc_plugin_page_register_cmd_transaction_report (GtkAction *action,
-        GncPluginPageRegister *plugin_page)
-{
-    GncPluginPageRegisterPrivate *priv;
-    GncMainWindow *window;
-    SplitRegister *reg;
-    Split *split;
-    Query *query;
-    int id;
-
-
-    ENTER("(action %p, plugin_page %p)", action, plugin_page);
-
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page));
-
-    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
-    reg = gnc_ledger_display_get_split_register (priv->ledger);
-
-    split = gnc_split_register_get_current_split (reg);
-    if (!split)
-        return;
-
-    query = qof_query_create_for(GNC_ID_SPLIT);
-
-    qof_query_set_book (query, gnc_get_current_book ());
-
-    xaccQueryAddGUIDMatch (query, xaccSplitGetGUID (split),
-                           GNC_ID_SPLIT, QOF_QUERY_AND);
-
-    window = GNC_MAIN_WINDOW(GNC_PLUGIN_PAGE(plugin_page)->window);
-    id = report_helper (priv->ledger, split, query);
-    if (id >= 0)
-        gnc_main_window_open_report(id, window);
-    LEAVE(" ");
-}
-
-/************************************************************/
-/*                    Auxiliary functions                   */
-/************************************************************/
-
-void
-gnc_plugin_page_register_set_options (GncPluginPage *plugin_page,
-                                      gint lines_default,
-                                      gboolean read_only)
-{
-    GncPluginPageRegister *page;
-    GncPluginPageRegisterPrivate *priv;
-
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page));
-
-    page = GNC_PLUGIN_PAGE_REGISTER (plugin_page);
-    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
-    priv->lines_default     = lines_default;
-    priv->read_only         = read_only;
-}
-
-GNCSplitReg *
-gnc_plugin_page_register_get_gsr (GncPluginPage *plugin_page)
-{
-    GncPluginPageRegister *page;
-    GncPluginPageRegisterPrivate *priv;
-
-    g_return_val_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page), NULL);
-
-    page = GNC_PLUGIN_PAGE_REGISTER (plugin_page);
-    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
-
-    return priv->gsr;
-}
-
-static void
-gnc_plugin_page_help_changed_cb (GNCSplitReg *gsr, GncPluginPageRegister *register_page)
-{
-    GncPluginPageRegisterPrivate *priv;
-    SplitRegister *reg;
-    GncWindow *window;
-    char *help;
-
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(register_page));
-
-    window = GNC_WINDOW(GNC_PLUGIN_PAGE(register_page)->window);
-    if (!window)
-    {
-        // This routine can be called before the page is added to a
-        // window.
-        return;
-    }
-
-    /* Get the text from the ledger */
-    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(register_page);
-    reg = gnc_ledger_display_get_split_register(priv->ledger);
-    help = gnc_table_get_help(reg->table);
-    gnc_window_set_status(window, GNC_PLUGIN_PAGE(register_page), help);
-    g_free(help);
-}
-
-static void
-gnc_plugin_page_register_refresh_cb (GHashTable *changes, gpointer user_data)
-{
-    GncPluginPageRegister *page = user_data;
-    GncPluginPageRegisterPrivate *priv;
-
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
-    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
-
-    if (changes)
-    {
-        const EventInfo* ei;
-        ei = gnc_gui_get_entity_events(changes, &priv->key);
-        if (ei)
-        {
-            if (ei->event_mask & QOF_EVENT_DESTROY)
-            {
-                gnc_main_window_close_page(GNC_PLUGIN_PAGE(page));
-                return;
-            }
-            if (ei->event_mask & QOF_EVENT_MODIFY)
-            {
-            }
-        }
-    }
-    else
-    {
-        /* forced updates */
-        gnucash_register_refresh_from_prefs(priv->gsr->reg);
-        gtk_widget_queue_draw(priv->widget);
-    }
-
-    gnc_plugin_page_register_ui_update(NULL, page);
-}
-
-static void
-gnc_plugin_page_register_close_cb (gpointer user_data)
-{
-    GncPluginPage *plugin_page = GNC_PLUGIN_PAGE(user_data);
-    gnc_main_window_close_page (plugin_page);
-}
-
-/** This function is called when an account has been edited and an
- *  "extreme" change has been made to it.  (E.G. Changing from a
- *  credit card account to an expense account.  This rouine is
- *  responsible for finding all open registers containing the account
- *  and closing them.
- *
- *  @param account A pointer to the account that was changed.
- */
-static void
-gppr_account_destroy_cb (Account *account)
-{
-    GncPluginPageRegister *page;
-    GncPluginPageRegisterPrivate *priv;
-    GNCLedgerDisplayType ledger_type;
-    const GncGUID *acct_guid;
-    const GList *citem;
-    GList *item, *kill = NULL;
-
-    acct_guid = xaccAccountGetGUID(account);
-
-    /* Find all windows that need to be killed.  Don't kill them yet, as
-     * that would affect the list being walked.*/
-    citem = gnc_gobject_tracking_get_list(GNC_PLUGIN_PAGE_REGISTER_NAME);
-    for ( ; citem; citem = g_list_next(citem))
-    {
-        page = (GncPluginPageRegister *)citem->data;
-        priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
-        ledger_type = gnc_ledger_display_type (priv->ledger);
-        if (ledger_type == LD_GL)
-        {
-            kill = g_list_append(kill, page);
-            /* kill it */
-        }
-        else if ((ledger_type == LD_SINGLE) || (ledger_type == LD_SUBACCOUNT))
-        {
-            if (guid_compare(acct_guid, &priv->key) == 0)
-            {
-                kill = g_list_append(kill, page);
-            }
-        }
-    }
-
-    /* Now kill them. */
-    for (item = kill; item; item = g_list_next(item))
-    {
-        page = (GncPluginPageRegister *)item->data;
-        gnc_main_window_close_page(GNC_PLUGIN_PAGE(page));
-    }
-}
-
-/** This function is the handler for all event messages from the
- *  engine.  Its purpose is to update the register page any time
- *  an account or transaction is changed.
- *
- *  @internal
- *
- *  @param entity A pointer to the affected item.
- *
- *  @param event_type The type of the affected item.
- *
- *  @param page A pointer to the register page.
- *
- *  @param ed
- */
-static void
-gnc_plugin_page_register_event_handler (QofInstance *entity,
-                                        QofEventId event_type,
-                                        GncPluginPageRegister *page,
-                                        GncEventData *ed)
-{
-    Transaction *trans;
-    QofBook *book;
-    GncPluginPage *visible_page;
-    GtkWidget *window;
-    gchar *label, *color;
-
-    g_return_if_fail(page);	/* Required */
-    if (!GNC_IS_TRANS(entity) && !GNC_IS_ACCOUNT(entity))
-        return;
-
-    ENTER("entity %p of type %d, page %p, event data %p",
-          entity, event_type, page, ed);
-
-    window = gnc_plugin_page_get_window(GNC_PLUGIN_PAGE(page));
-
-    if (GNC_IS_ACCOUNT(entity))
-    {
-        if (GNC_IS_MAIN_WINDOW(window))
-        {
-            label = gnc_plugin_page_register_get_tab_name(GNC_PLUGIN_PAGE(page));
-            main_window_update_page_name(GNC_PLUGIN_PAGE(page), label);
-            color = gnc_plugin_page_register_get_tab_color(GNC_PLUGIN_PAGE(page));
-            main_window_update_page_color(GNC_PLUGIN_PAGE(page), color);
-            g_free(color);
-            g_free(label);
-        }
-        LEAVE("tab name updated");
-        return;
-    }
-
-    if (!(event_type & (QOF_EVENT_MODIFY | QOF_EVENT_DESTROY)))
-    {
-        LEAVE("not a modify");
-        return;
-    }
-    trans = GNC_TRANS(entity);
-    book = qof_instance_get_book(QOF_INSTANCE(trans));
-    if (!gnc_plugin_page_has_book(GNC_PLUGIN_PAGE(page), book))
-    {
-        LEAVE("not in this book");
-        return;
-    }
-
-    if (GNC_IS_MAIN_WINDOW(window))
-    {
-        visible_page = gnc_main_window_get_current_page(GNC_MAIN_WINDOW(window));
-        if (visible_page != GNC_PLUGIN_PAGE(page))
-        {
-            LEAVE("page not visible");
-            return;
-        }
-    }
-
-    gnc_plugin_page_register_ui_update(NULL, page);
-    LEAVE(" ");
-    return;
-}
-
-
-/** @} */
-/** @} */
diff --git a/src/gnome/gnc-plugin-page-register2.c b/src/gnome/gnc-plugin-page-register2.c
deleted file mode 100644
index cfb2dfa..0000000
--- a/src/gnome/gnc-plugin-page-register2.c
+++ /dev/null
@@ -1,4082 +0,0 @@
-/**********************************************************************
- * gnc-plugin-page-register2.c -- register page functions             *
- *                                                                    *
- * Copyright (C) 2003 Jan Arne Petersen <jpetersen at uni-bonn.de>       *
- * Copyright (C) 2003,2005,2006 David Hampton <hampton at employees.org> *
- * Copyright (C) 2011, Robert Fewell                                  *
- *                                                                    *
- * 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 at gnu.org                     *
- **********************************************************************/
-
-/** @addtogroup ContentPlugins
-    @{ */
-/** @addtogroup RegisterPlugin Register Page
-    @{ */
-/** @file gnc-plugin-page-register.c
-    @brief  Functions providing a register page for the GnuCash UI
-    @author Copyright (C) 2003 Jan Arne Petersen <jpetersen at uni-bonn.de>
-    @author Copyright (C) 2003,2005 David Hampton <hampton at employees.org>
-*/
-
-#include "config.h"
-
-#include <libguile.h>
-#include "guile-mappings.h"
-#include <gtk/gtk.h>
-#include <glib/gi18n.h>
-#include "swig-runtime.h"
-
-#include "gnc-plugin-page-register2.h"
-/*################## Added for Reg2 #################*/
-#include "gnc-plugin-page-register.h"
-/*################## Added for Reg2 #################*/
-#include "gnc-plugin-register2.h"
-#include "gnc-plugin-menu-additions.h"
-#include "gnc-plugin-page-report.h"
-
-#include "gnc-tree-view.h"
-#include "gnc-tree-view-split-reg.h"
-#include "gnc-tree-model-split-reg.h"
-#include "gnc-tree-control-split-reg.h"
-
-#include "dialog-account.h"
-#include "dialog-find-account.h"
-#include "dialog-find-transactions2.h"
-#include "dialog-print-check.h"
-#include "dialog-transfer.h"
-#include "dialog-utils.h"
-#include "SX-book.h"
-#include "dialog-sx-editor.h"
-/*################## Added for Reg2 #################*/
-#include "dialog-sx-editor2.h"
-/*################## Added for Reg2 #################*/
-#include "dialog-sx-from-trans.h"
-#include "assistant-stock-split.h"
-#include "gnc-component-manager.h"
-#include "gnc-date.h"
-#include "gnc-date-edit.h"
-#include "gnc-engine.h"
-#include "gnc-event.h"
-#include "gnc-gnome-utils.h"
-#include "gnc-gobject-utils.h"
-#include "gnc-gui-query.h"
-#include "gnc-icons.h"
-#include "gnc-prefs.h"
-#include "gnc-split-reg2.h"
-#include "gnc-ui-util.h"
-#include "gnc-window.h"
-#include "gnc-main-window.h"
-#include "gnc-session.h"
-#include "gnome-utils/gnc-warnings.h"
-#include "dialog-lot-viewer.h"
-#include "Scrub.h"
-#include "qof.h"
-#include "window-reconcile2.h"
-#include "window-autoclear.h"
-#include "window-report.h"
-
-/* This static indicates the debugging module that this .o belongs to.  */
-static QofLogModule log_module = GNC_MOD_GUI;
-
-#define DEFAULT_LINES_AMOUNT         50
-
-static void gnc_plugin_page_register2_class_init (GncPluginPageRegister2Class *klass);
-static void gnc_plugin_page_register2_init (GncPluginPageRegister2 *plugin_page);
-static void gnc_plugin_page_register2_finalize (GObject *object);
-
-static GtkWidget *gnc_plugin_page_register2_create_widget (GncPluginPage *plugin_page);
-static void gnc_plugin_page_register2_destroy_widget (GncPluginPage *plugin_page);
-static void gnc_plugin_page_register2_window_changed (GncPluginPage *plugin_page, GtkWidget *window);
-static void gnc_plugin_page_register2_save_page (GncPluginPage *plugin_page, GKeyFile *file, const gchar *group);
-static GncPluginPage *gnc_plugin_page_register2_recreate_page (GtkWidget *window, GKeyFile *file, const gchar *group);
-static void gnc_plugin_page_register2_update_edit_menu (GncPluginPage *page, gboolean hide);
-static gboolean gnc_plugin_page_register2_finish_pending (GncPluginPage *page);
-
-static gboolean gnc_plugin_page_register2_button_press_cb (GtkWidget *widget, GdkEventButton *event, GncPluginPage *page);
-
-static gchar *gnc_plugin_page_register2_get_tab_name (GncPluginPage *plugin_page);
-static gchar *gnc_plugin_page_register2_get_tab_color (GncPluginPage *plugin_page);
-static gchar *gnc_plugin_page_register2_get_long_name (GncPluginPage *plugin_page);
-
-static void gnc_plugin_page_register2_summarybar_position_changed (gpointer prefs, gchar* pref, gpointer user_data);
-
-/* Callbacks for the "Filter By" dialog */
-void gnc_plugin_page_register2_filter_select_range_cb (GtkRadioButton *button, GncPluginPageRegister2 *page);
-void gnc_plugin_page_register2_filter_start_cb (GtkWidget *radio, GncPluginPageRegister2 *page);
-void gnc_plugin_page_register2_filter_end_cb (GtkWidget *radio, GncPluginPageRegister2 *page);
-void gnc_plugin_page_register2_filter_response_cb (GtkDialog *dialog, gint response, GncPluginPageRegister2 *plugin_page);
-void gnc_plugin_page_register2_filter_status_all_cb (GtkButton *button, GncPluginPageRegister2 *plugin_page);
-void gnc_plugin_page_register2_filter_status_one_cb (GtkToggleButton *button, GncPluginPageRegister2 *page);
-void gnc_plugin_page_register2_filter_save_cb (GtkToggleButton *button, GncPluginPageRegister2 *page);
-
-static time64 gnc_plugin_page_register2_filter_dmy2time (char *date_string);
-static gchar *gnc_plugin_page_register2_filter_time2dmy (time64 raw_time);
-static gchar *gnc_plugin_page_register2_get_filter (GncPluginPage *plugin_page);
-void gnc_plugin_page_register2_set_filter (GncPluginPage *plugin_page, const gchar *filter);
-
-static void gnc_ppr_update_status_query (GncPluginPageRegister2 *page, gboolean refresh_page); 
-static void gnc_ppr_update_date_query (GncPluginPageRegister2 *page, gboolean refresh_page); 
-
-/* Command callbacks */
-static void gnc_plugin_page_register2_cmd_print_check (GtkAction *action, GncPluginPageRegister2 *plugin_page);
-static void gnc_plugin_page_register2_cmd_cut (GtkAction *action, GncPluginPageRegister2 *plugin_page);
-static void gnc_plugin_page_register2_cmd_copy (GtkAction *action, GncPluginPageRegister2 *plugin_page);
-static void gnc_plugin_page_register2_cmd_paste (GtkAction *action, GncPluginPageRegister2 *plugin_page);
-static void gnc_plugin_page_register2_cmd_edit_account (GtkAction *action, GncPluginPageRegister2 *plugin_page);
-static void gnc_plugin_page_register2_cmd_find_account (GtkAction *action, GncPluginPageRegister2 *plugin_page);
-static void gnc_plugin_page_register2_cmd_find_transactions (GtkAction *action, GncPluginPageRegister2 *plugin_page);
-static void gnc_plugin_page_register2_cmd_cut_transaction (GtkAction *action, GncPluginPageRegister2 *plugin_page);
-static void gnc_plugin_page_register2_cmd_copy_transaction (GtkAction *action, GncPluginPageRegister2 *plugin_page);
-static void gnc_plugin_page_register2_cmd_paste_transaction (GtkAction *action, GncPluginPageRegister2 *plugin_page);
-static void gnc_plugin_page_register2_cmd_void_transaction (GtkAction *action, GncPluginPageRegister2 *plugin_page);
-static void gnc_plugin_page_register2_cmd_unvoid_transaction (GtkAction *action, GncPluginPageRegister2 *plugin_page);
-static void gnc_plugin_page_register2_cmd_reverse_transaction (GtkAction *action, GncPluginPageRegister2 *plugin_page);
-static void gnc_plugin_page_register2_cmd_reload (GtkAction *action, GncPluginPageRegister2 *plugin_page);
-static void gnc_plugin_page_register2_cmd_view_filter_by (GtkAction *action, GncPluginPageRegister2 *plugin_page);
-static void gnc_plugin_page_register2_cmd_style_changed (GtkAction *action, GtkRadioAction *current, GncPluginPageRegister2 *plugin_page);
-static void gnc_plugin_page_register2_cmd_style_double_line (GtkToggleAction *action, GncPluginPageRegister2 *plugin_page);
-static void gnc_plugin_page_register2_cmd_style_extra_dates (GtkToggleAction *action, GncPluginPageRegister2 *plugin_page);
-
-static void gnc_plugin_page_register2_cmd_reconcile (GtkAction *action, GncPluginPageRegister2 *plugin_page);
-static void gnc_plugin_page_register2_cmd_autoclear (GtkAction *action, GncPluginPageRegister2 *plugin_page);
-static void gnc_plugin_page_register2_cmd_transfer (GtkAction *action, GncPluginPageRegister2 *plugin_page);
-static void gnc_plugin_page_register2_cmd_stock_split (GtkAction *action, GncPluginPageRegister2 *plugin_page);
-static void gnc_plugin_page_register2_cmd_lots (GtkAction *action, GncPluginPageRegister2 *plugin_page);
-static void gnc_plugin_page_register2_cmd_enter_transaction (GtkAction *action, GncPluginPageRegister2 *plugin_page);
-static void gnc_plugin_page_register2_cmd_cancel_transaction (GtkAction *action, GncPluginPageRegister2 *plugin_page);
-static void gnc_plugin_page_register2_cmd_delete_transaction (GtkAction *action, GncPluginPageRegister2 *plugin_page);
-static void gnc_plugin_page_register2_cmd_blank_transaction (GtkAction *action, GncPluginPageRegister2 *plugin_page);
-static void gnc_plugin_page_register2_cmd_duplicate_transaction (GtkAction *action, GncPluginPageRegister2 *plugin_page);
-static void gnc_plugin_page_register2_cmd_reinitialize_transaction (GtkAction *action, GncPluginPageRegister2 *plugin_page);
-static void gnc_plugin_page_register2_cmd_expand_transaction (GtkToggleAction *action, GncPluginPageRegister2 *plugin_page);
-static void gnc_plugin_page_register2_cmd_exchange_rate (GtkAction *action, GncPluginPageRegister2 *plugin_page);
-static void gnc_plugin_page_register2_cmd_jump (GtkAction *action, GncPluginPageRegister2 *plugin_page);
-static void gnc_plugin_page_register2_cmd_schedule (GtkAction *action, GncPluginPageRegister2 *plugin_page);
-static void gnc_plugin_page_register2_cmd_scrub_all (GtkAction *action, GncPluginPageRegister2 *plugin_page);
-static void gnc_plugin_page_register2_cmd_scrub_current (GtkAction *action, GncPluginPageRegister2 *plugin_page);
-static void gnc_plugin_page_register2_cmd_account_report (GtkAction *action, GncPluginPageRegister2 *plugin_page);
-static void gnc_plugin_page_register2_cmd_transaction_report (GtkAction *action, GncPluginPageRegister2 *plugin_page);
-static void gnc_plugin_page_register2_cmd_entryUp (GtkAction *action, GncPluginPageRegister2 *plugin_page);
-static void gnc_plugin_page_register2_cmd_entryDown (GtkAction *action, GncPluginPageRegister2 *plugin_page);
-
-static void gnc_plugin_page_help_changed_cb (GNCSplitReg2 *gsr, GncPluginPageRegister2 *register_page );
-static void gnc_plugin_page_register2_refresh_cb (GHashTable *changes, gpointer user_data);
-static void gnc_plugin_page_register2_close_cb (gpointer user_data);
-
-static void gnc_plugin_page_register2_ui_update (gpointer various, GncPluginPageRegister2 *page);
-static void gppr_account_destroy_cb (Account *account);
-static void gnc_plugin_page_register2_event_handler (QofInstance *entity,
-        QofEventId event_type,
-        GncPluginPageRegister2 *page,
-        GncEventData *ed);
-
-/************************************************************/
-/*                          Actions                         */
-/************************************************************/
-
-#define CUT_TRANSACTION_LABEL         N_("Cu_t Transaction")
-#define COPY_TRANSACTION_LABEL        N_("_Copy Transaction")
-#define PASTE_TRANSACTION_LABEL       N_("_Paste Transaction")
-#define DUPLICATE_TRANSACTION_LABEL   N_("Dup_licate Transaction")
-#define DELETE_TRANSACTION_LABEL      N_("_Delete Transaction")
-#define CUT_SPLIT_LABEL               N_("Cu_t Split")
-#define COPY_SPLIT_LABEL              N_("_Copy Split")
-#define PASTE_SPLIT_LABEL             N_("_Paste Split")
-#define DUPLICATE_SPLIT_LABEL         N_("Dup_licate Split")
-#define DELETE_SPLIT_LABEL            N_("_Delete Split")
-#define CUT_TRANSACTION_TIP           N_("Cut the selected transaction into clipboard")
-#define COPY_TRANSACTION_TIP          N_("Copy the selected transaction into clipboard")
-#define PASTE_TRANSACTION_TIP         N_("Paste the transaction from the clipboard")
-#define DUPLICATE_TRANSACTION_TIP     N_("Make a copy of the current transaction")
-#define DELETE_TRANSACTION_TIP        N_("Delete the current transaction")
-#define CUT_SPLIT_TIP                 N_("Cut the selected split into clipboard")
-#define COPY_SPLIT_TIP                N_("Copy the selected split into clipboard")
-#define PASTE_SPLIT_TIP               N_("Paste the split from the clipboard")
-#define DUPLICATE_SPLIT_TIP           N_("Make a copy of the current split")
-#define DELETE_SPLIT_TIP              N_("Delete the current split")
-
-#define TRANSACTION_UP_ACTION "TransactionUpAction"
-#define TRANSACTION_DOWN_ACTION "TransactionDownAction"
-
-static GtkActionEntry gnc_plugin_page_register2_actions [] =
-{
-    /* File menu */
-
-    {
-        "FilePrintAction", "document-print", N_("_Print Checks..."), "<primary>p", NULL,
-        G_CALLBACK (gnc_plugin_page_register2_cmd_print_check)
-    },
-
-    /* Edit menu */
-
-    {
-        "EditCutAction", "edit-cut", N_("Cu_t"), "<primary>X",
-        N_("Cut the current selection and copy it to clipboard"),
-        G_CALLBACK (gnc_plugin_page_register2_cmd_cut)
-    },
-    {
-        "EditCopyAction", "edit-copy", N_("_Copy"), "<primary>C",
-        N_("Copy the current selection to clipboard"),
-        G_CALLBACK (gnc_plugin_page_register2_cmd_copy)
-    },
-    {
-        "EditPasteAction", "edit-paste", N_("_Paste"), "<primary>V",
-        N_("Paste the clipboard content at the cursor position"),
-        G_CALLBACK (gnc_plugin_page_register2_cmd_paste)
-    },
-    {
-        "EditEditAccountAction", GNC_ICON_EDIT_ACCOUNT, N_("Edit _Account"), "<primary>e",
-        N_("Edit the selected account"),
-        G_CALLBACK (gnc_plugin_page_register2_cmd_edit_account)
-    },
-    {
-        "EditFindAccountAction", "edit-find", N_("F_ind Account"), "<primary>i",
-        N_("Find an account"),
-        G_CALLBACK (gnc_plugin_page_register2_cmd_find_account)
-    },
-    {
-        "EditFindTransactionsAction", "edit-find", N_("_Find..."), "<primary>f",
-        N_("Find transactions with a search"),
-        G_CALLBACK (gnc_plugin_page_register2_cmd_find_transactions)
-    },
-
-    /* Transaction menu */
-
-    {
-        "CutTransactionAction", "edit-cut", CUT_TRANSACTION_LABEL, "",
-        CUT_TRANSACTION_TIP,
-        G_CALLBACK (gnc_plugin_page_register2_cmd_cut_transaction)
-    },
-    {
-        "CopyTransactionAction", "edit-copy", COPY_TRANSACTION_LABEL, "",
-        COPY_TRANSACTION_TIP,
-        G_CALLBACK (gnc_plugin_page_register2_cmd_copy_transaction)
-    },
-    {
-        "PasteTransactionAction", "edit-paste", PASTE_TRANSACTION_LABEL, "",
-        PASTE_TRANSACTION_TIP,
-        G_CALLBACK (gnc_plugin_page_register2_cmd_paste_transaction)
-    },
-    {
-        "DuplicateTransactionAction", "edit-copy", DUPLICATE_TRANSACTION_LABEL, "",
-        DUPLICATE_TRANSACTION_TIP,
-        G_CALLBACK (gnc_plugin_page_register2_cmd_duplicate_transaction)
-    },
-    {
-        "DeleteTransactionAction", "edit-delete", DELETE_TRANSACTION_LABEL, NULL,
-        DELETE_TRANSACTION_TIP,
-        G_CALLBACK (gnc_plugin_page_register2_cmd_delete_transaction)
-    },
-    {
-        "RemoveTransactionSplitsAction", "edit-clear", N_("Remo_ve All Splits"), NULL,
-        N_("Remove all splits in the current transaction"),
-        G_CALLBACK (gnc_plugin_page_register2_cmd_reinitialize_transaction)
-    },
-    {
-        "RecordTransactionAction", "list-add", N_("_Enter Transaction"), NULL,
-        N_("Record the current transaction"),
-        G_CALLBACK (gnc_plugin_page_register2_cmd_enter_transaction)
-    },
-    {
-        "CancelTransactionAction", "process-stop", N_("Ca_ncel Transaction"), NULL,
-        N_("Cancel the current transaction"),
-        G_CALLBACK (gnc_plugin_page_register2_cmd_cancel_transaction)
-    },
-    {
-        "VoidTransactionAction", NULL, N_("_Void Transaction"), NULL, NULL,
-        G_CALLBACK (gnc_plugin_page_register2_cmd_void_transaction)
-    },
-    {
-        "UnvoidTransactionAction", NULL, N_("_Unvoid Transaction"), NULL, NULL,
-        G_CALLBACK (gnc_plugin_page_register2_cmd_unvoid_transaction)
-    },
-    {
-        "ReverseTransactionAction", NULL, N_("Add _Reversing Transaction"), NULL, NULL,
-        G_CALLBACK (gnc_plugin_page_register2_cmd_reverse_transaction)
-    },
-    {
-        TRANSACTION_UP_ACTION, "go-up", N_("Move Transaction _Up"), NULL,
-        N_("Move the current transaction one row upwards. Only available if the date and number of both rows are identical and the register window is sorted by date."),
-        G_CALLBACK (gnc_plugin_page_register2_cmd_entryUp)
-    },
-    {
-        TRANSACTION_DOWN_ACTION, "go-down", N_("Move Transaction Do_wn"), NULL,
-        N_("Move the current transaction one row downwards. Only available if the date and number of both rows are identical and the register window is sorted by date."),
-        G_CALLBACK (gnc_plugin_page_register2_cmd_entryDown)
-    },
-
-    /* View menu */
-
-    {
-        "ViewFilterByAction", NULL, N_("_Filter By..."), NULL, NULL,
-        G_CALLBACK (gnc_plugin_page_register2_cmd_view_filter_by)
-    },
-    {
-        "ViewRefreshAction", "view-refresh", N_("_Refresh"), "<primary>r",
-        N_("Refresh this window"),
-        G_CALLBACK (gnc_plugin_page_register2_cmd_reload)
-    },
-
-    /* Actions menu */
-
-    {
-        "ActionsTransferAction", GNC_ICON_TRANSFER, N_("_Transfer..."), "<primary>t",
-        N_("Transfer funds from one account to another"),
-        G_CALLBACK (gnc_plugin_page_register2_cmd_transfer)
-    },
-    {
-        "ActionsReconcileAction", "edit-select-all", N_("_Reconcile..."), NULL,
-        N_("Reconcile the selected account"),
-        G_CALLBACK (gnc_plugin_page_register2_cmd_reconcile)
-    },
-    {
-        "ActionsAutoClearAction", "edit-select-all", N_("_Auto-clear..."), NULL,
-        N_("Automatically clear individual transactions, so as to reach a certain cleared amount"),
-        G_CALLBACK (gnc_plugin_page_register2_cmd_autoclear)
-    },
-    {
-        "ActionsStockSplitAction", NULL, N_("Stoc_k Split..."), NULL,
-        N_("Record a stock split or a stock merger"),
-        G_CALLBACK (gnc_plugin_page_register2_cmd_stock_split)
-    },
-    {
-        "ActionsLotsAction", NULL, N_("View _Lots..."), NULL,
-        N_("Bring up the lot viewer/editor window"),
-        G_CALLBACK (gnc_plugin_page_register2_cmd_lots)
-    },
-    {
-        "BlankTransactionAction", "go-bottom", N_("_Blank Transaction"), "<primary>Page_Down",
-        N_("Move to the blank transaction at the bottom of the register"),
-        G_CALLBACK (gnc_plugin_page_register2_cmd_blank_transaction)
-    },
-    {
-        "EditExchangeRateAction", NULL, N_("Edit E_xchange Rate"), NULL,
-        N_("Edit the exchange rate for the current transaction"),
-        G_CALLBACK (gnc_plugin_page_register2_cmd_exchange_rate)
-    },
-    {
-        "JumpTransactionAction", GNC_ICON_JUMP_TO, N_("_Jump"), NULL,
-        N_("Jump to the corresponding transaction in the other account"),
-        G_CALLBACK (gnc_plugin_page_register2_cmd_jump)
-    },
-    {
-        "ScheduleTransactionAction", GNC_ICON_SCHEDULE, N_("Sche_dule..."), NULL,
-        N_("Create a Scheduled Transaction with the current transaction as a template"),
-        G_CALLBACK (gnc_plugin_page_register2_cmd_schedule)
-    },
-    {
-        "ScrubAllAction", NULL, N_("_All transactions"), NULL, NULL,
-        G_CALLBACK (gnc_plugin_page_register2_cmd_scrub_all)
-    },
-    {
-        "ScrubCurrentAction", NULL, N_("_This transaction"), NULL, NULL,
-        G_CALLBACK (gnc_plugin_page_register2_cmd_scrub_current)
-    },
-
-    /* Reports menu */
-
-    {
-        "ReportsAccountReportAction", NULL, N_("Account Report"), NULL,
-        N_("Open a register report for this Account"),
-        G_CALLBACK (gnc_plugin_page_register2_cmd_account_report)
-    },
-    {
-        "ReportsAcctTransReportAction", NULL, N_("Account Report - Single Transaction"), NULL,
-        N_("Open a register report for the selected Transaction"),
-        G_CALLBACK (gnc_plugin_page_register2_cmd_transaction_report)
-    },
-};
-
-static guint gnc_plugin_page_register2_n_actions = G_N_ELEMENTS (gnc_plugin_page_register2_actions);
-
-static GtkToggleActionEntry toggle_entries[] =
-{
-    {
-        "ViewStyleDoubleLineAction", NULL, N_("_Double Line"), NULL,
-        N_("Show two lines of information for each transaction"),
-        G_CALLBACK (gnc_plugin_page_register2_cmd_style_double_line), FALSE
-    },
-
-    {
-        "ViewStyleExtraDatesAction", NULL, N_("Show _Extra Dates"), NULL,
-        N_("Show entered and reconciled dates"),
-        G_CALLBACK (gnc_plugin_page_register2_cmd_style_extra_dates), FALSE
-    },
-
-    {
-        "SplitTransactionAction", GNC_ICON_SPLIT_TRANS, N_("S_plit Transaction"), NULL,
-        N_("Show all splits in the current transaction"),
-        G_CALLBACK (gnc_plugin_page_register2_cmd_expand_transaction), FALSE
-    },
-};
-
-static guint n_toggle_entries = G_N_ELEMENTS (toggle_entries);
-
-static GtkRadioActionEntry radio_entries_2 [] =
-{
-    /* Translators: This is a menu item in the View menu */
-    {
-        "ViewStyleBasicAction", NULL, N_("_Basic Ledger"), NULL,
-        N_("Show transactions on one or two lines"), REG2_STYLE_LEDGER
-    },
-    /* Translators: This is a menu item in the View menu */
-    {
-        "ViewStyleAutoSplitAction", NULL, N_("_Auto-Split Ledger"), NULL,
-        N_("Show transactions on one or two lines and expand the current transaction"), REG2_STYLE_AUTO_LEDGER
-    },
-    /* Translators: This is a menu item in the View menu */
-    {
-        "ViewStyleJournalAction", NULL, N_("Transaction _Journal"), NULL,
-        N_("Show expanded transactions with all splits"), REG2_STYLE_JOURNAL
-    }
-};
-
-static guint n_radio_entries_2 = G_N_ELEMENTS (radio_entries_2);
-
-/** These are the "important" actions provided by the register page.
- *  Their labels will appear when the toolbar is set to "Icons and
- *  important text" (e.g. GTK_TOOLBAR_BOTH_HORIZ) mode. */
-static const gchar *important_actions[] =
-{
-    "SplitTransactionAction",
-    NULL,
-};
-
-/** Actions that require an account to be selected before they are
- *  enabled. */
-static const gchar *actions_requiring_account[] =
-{
-    "EditEditAccountAction",
-    "ActionsReconcileAction",
-    "ActionsAutoClearAction",
-    "ActionsLotsAction",
-    NULL
-};
-
-/** View Style actions */
-static const gchar *view_style_actions[] =
-{
-    "ViewStyleBasicAction",
-    "ViewStyleAutoSplitAction",
-    "ViewStyleJournalAction",
-    NULL
-};
-
-/** Short labels for use on the toolbar buttons. */
-static action_toolbar_labels toolbar_labels[] =
-{
-    { "ActionsTransferAction", 	  N_("Transfer") },
-    { "RecordTransactionAction", 	  N_("Enter") },
-    { "CancelTransactionAction", 	  N_("Cancel") },
-    { "DeleteTransactionAction", 	  N_("Delete") },
-    { "DuplicateTransactionAction", N_("Duplicate") },
-    { "SplitTransactionAction",     N_("Split") },
-    { "ScheduleTransactionAction",  N_("Schedule") },
-    { "BlankTransactionAction",     N_("Blank") },
-    { "ActionsReconcileAction",     N_("Reconcile") },
-    { "ActionsAutoClearAction",     N_("Auto-clear") },
-    { TRANSACTION_UP_ACTION, N_("Up") },
-    { TRANSACTION_DOWN_ACTION, N_("Down") },
-    { NULL, NULL },
-};
-
-struct status_action
-{
-    const char *action_name;
-    int value;
-    GtkWidget *widget;
-};
-
-static struct status_action status_actions[] =
-{
-    { "filter_status_reconciled",   CLEARED_RECONCILED, NULL },
-    { "filter_status_cleared",      CLEARED_CLEARED, NULL },
-    { "filter_status_voided",       CLEARED_VOIDED, NULL },
-    { "filter_status_frozen",       CLEARED_FROZEN, NULL },
-    { "filter_status_unreconciled", CLEARED_NO, NULL },
-    { NULL, 0, NULL },
-};
-
-#define CLEARED_VALUE "cleared_value"
-#define DEFAULT_FILTER "0x001f"
-
-/************************************************************/
-/*                      Data Structures                     */
-/************************************************************/
-
-typedef struct GncPluginPageRegister2Private
-{
-    GtkWidget *widget;
-
-    GNCLedgerDisplay2 *ledger;
-    GNCSplitReg2 *gsr;
-
-    gint event_handler_id;
-    gint component_manager_id;
-    GncGUID key;  /* The guid of the Account we're watching */
-
-    gint lines_default;
-    gboolean read_only;
-
-    struct
-    {
-        GtkWidget *dialog;
-        GtkWidget *table;
-        GtkWidget *start_date_choose;
-        GtkWidget *start_date_today;
-        GtkWidget *start_date;
-        GtkWidget *end_date_choose;
-        GtkWidget *end_date_today;
-        GtkWidget *end_date;
-        cleared_match_t original_cleared_match;
-        cleared_match_t cleared_match;
-        time64 original_start_time;
-        time64 original_end_time;
-        time64 start_time;
-        time64 end_time;
-        gboolean original_save_filter;
-        gboolean save_filter;
-    } fd;
-} GncPluginPageRegister2Private;
-
-#define GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(o)  \
-   (G_TYPE_INSTANCE_GET_PRIVATE ((o), GNC_TYPE_PLUGIN_PAGE_REGISTER2, GncPluginPageRegister2Private))
-
-static GObjectClass *parent_class = NULL;
-
-/************************************************************/
-/*                      Implementation                      */
-/************************************************************/
-
-GType
-gnc_plugin_page_register2_get_type (void)
-{
-    static GType gnc_plugin_page_register2_type = 0;
-
-    if (gnc_plugin_page_register2_type == 0)
-    {
-        static const GTypeInfo our_info =
-        {
-            sizeof (GncPluginPageRegister2Class),
-            NULL,
-            NULL,
-            (GClassInitFunc) gnc_plugin_page_register2_class_init,
-            NULL,
-            NULL,
-            sizeof (GncPluginPageRegister2),
-            0,
-            (GInstanceInitFunc) gnc_plugin_page_register2_init
-        };
-
-        gnc_plugin_page_register2_type = g_type_register_static (GNC_TYPE_PLUGIN_PAGE,
-                                        GNC_PLUGIN_PAGE_REGISTER2_NAME,
-                                        &our_info, 0);
-    }
-
-    return gnc_plugin_page_register2_type;
-}
-
-/*#################################################################################*/
-/*#################################################################################*/
-static GncPluginPage *
-gnc_plugin_page_register2_new_common (GNCLedgerDisplay2 *ledger)
-{
-    GncPluginPageRegister2 *register_page;
-    GncPluginPageRegister2Private *priv;
-    GncPluginPage *plugin_page;
-
-    GNCSplitReg2 *gsr;
-
-    const GList *item;
-    GList *book_list;
-    gchar *label;
-    gchar *label_color;
-    QofQuery *q;
-
-    /* Is there an existing page? */
-    gsr = gnc_ledger_display2_get_user_data (ledger);
-    if (gsr)
-    {
-        item = gnc_gobject_tracking_get_list (GNC_PLUGIN_PAGE_REGISTER2_NAME);
-        for ( ; item; item = g_list_next (item))
-        {
-            register_page = (GncPluginPageRegister2 *)item->data;
-            priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (register_page);
-            if (priv->gsr == gsr)
-                return GNC_PLUGIN_PAGE (register_page);
-        }
-    }
-
-    register_page = g_object_new (GNC_TYPE_PLUGIN_PAGE_REGISTER2, NULL);
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (register_page);
-    priv->ledger = ledger;
-    priv->key = *guid_null();
-
-    plugin_page = GNC_PLUGIN_PAGE (register_page);
-    label = gnc_plugin_page_register2_get_tab_name (plugin_page);
-    gnc_plugin_page_set_page_name (plugin_page, label);
-    g_free (label);
-
-    label_color = gnc_plugin_page_register2_get_tab_color (plugin_page);
-    gnc_plugin_page_set_page_color (plugin_page, label_color);
-    g_free (label_color);
-
-    label = gnc_plugin_page_register2_get_long_name (plugin_page);
-    gnc_plugin_page_set_page_long_name (plugin_page, label);
-    g_free (label);
-
-    q = gnc_ledger_display2_get_query (ledger);
-    book_list = qof_query_get_books (q);
-    for (item = book_list; item; item = g_list_next (item))
-        gnc_plugin_page_add_book (plugin_page, (QofBook *)item->data);
-    // Do not free the list. It is owned by the query.
-
-    priv->component_manager_id = 0;
-    return plugin_page;
-}
-
-/*#################################################################################*/
-
-GncPluginPage *
-gnc_plugin_page_register2_new (Account *account, gboolean subaccounts)
-{
-    GNCLedgerDisplay2 *ledger;
-    GncPluginPage *page;
-    GncPluginPageRegister2Private *priv;
-
-/*################## Added for Reg2 #################*/
-    const GList *item;
-    GncPluginPageRegister  *old_register_page;
-/*################## Added for Reg2 #################*/
-
-    ENTER("account=%p, subaccounts=%s", account,
-          subaccounts ? "TRUE" : "FALSE");
-
-/*################## Added for Reg2 #################*/
-    // We test for the old register being open here, ie matching account guids
-    item = gnc_gobject_tracking_get_list (GNC_PLUGIN_PAGE_REGISTER_NAME);
-    for ( ; item; item = g_list_next (item))
-    {
-        Account *old_account;
-        old_register_page = (GncPluginPageRegister *)item->data;
-        old_account = gnc_plugin_page_register_get_account (old_register_page);
-
-        if (guid_equal (xaccAccountGetGUID (account), xaccAccountGetGUID (old_account)))
-        {
-            gnc_error_dialog (NULL, "%s",
-                         _("You have tried to open an account in the new register while it is open in the old register."));
-            return NULL;
-        }
-    }
-/*################## Added for Reg2 #################*/
-
-    if (subaccounts)
-        ledger = gnc_ledger_display2_subaccounts (account);
-    else
-        ledger = gnc_ledger_display2_simple (account);
-
-    page = gnc_plugin_page_register2_new_common (ledger);
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (page);
-    priv->key = *xaccAccountGetGUID (account);
-
-    LEAVE("%p", page);
-    return page;
-}
-
-GncPluginPage *
-gnc_plugin_page_register2_new_gl (void)
-{
-    GNCLedgerDisplay2 *ledger;
-
-    ledger = gnc_ledger_display2_gl ();
-    return gnc_plugin_page_register2_new_common (ledger);
-}
-
-GncPluginPage *
-gnc_plugin_page_register2_new_ledger (GNCLedgerDisplay2 *ledger)
-{
-    return gnc_plugin_page_register2_new_common (ledger);
-}
-
-static void
-gnc_plugin_page_register2_class_init (GncPluginPageRegister2Class *klass)
-{
-    GObjectClass *object_class = G_OBJECT_CLASS (klass);
-    GncPluginPageClass *gnc_plugin_class = GNC_PLUGIN_PAGE_CLASS(klass);
-
-    parent_class = g_type_class_peek_parent (klass);
-
-    object_class->finalize = gnc_plugin_page_register2_finalize;
-
-    gnc_plugin_class->tab_icon        = GNC_ICON_ACCOUNT;
-    gnc_plugin_class->plugin_name     = GNC_PLUGIN_PAGE_REGISTER2_NAME;
-    gnc_plugin_class->create_widget   = gnc_plugin_page_register2_create_widget;
-    gnc_plugin_class->destroy_widget  = gnc_plugin_page_register2_destroy_widget;
-    gnc_plugin_class->window_changed  = gnc_plugin_page_register2_window_changed;
-    gnc_plugin_class->save_page       = gnc_plugin_page_register2_save_page;
-    gnc_plugin_class->recreate_page   = gnc_plugin_page_register2_recreate_page;
-    gnc_plugin_class->update_edit_menu_actions = gnc_plugin_page_register2_update_edit_menu;
-    gnc_plugin_class->finish_pending  = gnc_plugin_page_register2_finish_pending;
-
-    g_type_class_add_private(klass, sizeof(GncPluginPageRegister2Private));
-
-    gnc_ui_register_account_destroy_callback (gppr_account_destroy_cb);
-}
-
-static void
-gnc_plugin_page_register2_init (GncPluginPageRegister2 *plugin_page)
-{
-    GncPluginPageRegister2Private *priv;
-    GncPluginPage *parent;
-    GtkActionGroup *action_group;
-    gboolean use_new;
-
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(plugin_page);
-
-    /* Init parent declared variables */
-    parent = GNC_PLUGIN_PAGE(plugin_page);
-    use_new = gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL_REGISTER, GNC_PREF_USE_NEW);
-    g_object_set(G_OBJECT(plugin_page),
-                 "page-name",      _("General Journal2"),
-                 "page-uri",       "default:",
-                 "ui-description", "gnc-plugin-page-register2-ui.xml",
-                 "use-new-window", use_new,
-                 NULL);
-
-    /* Create menu and toolbar information */
-    action_group =
-        gnc_plugin_page_create_action_group(parent,
-                                            "GncPluginPageRegister2Actions");
-    gtk_action_group_add_actions (action_group, gnc_plugin_page_register2_actions,
-                                  gnc_plugin_page_register2_n_actions, plugin_page);
-    gtk_action_group_add_toggle_actions (action_group,
-                                         toggle_entries, n_toggle_entries,
-                                         plugin_page);
-    gtk_action_group_add_radio_actions (action_group,
-                                        radio_entries_2, n_radio_entries_2,
-                                        REG2_STYLE_LEDGER,
-                                        G_CALLBACK(gnc_plugin_page_register2_cmd_style_changed),
-                                        plugin_page);
-
-    gnc_plugin_init_short_names (action_group, toolbar_labels);
-    gnc_plugin_set_important_actions (action_group, important_actions);
-
-    priv->lines_default     = DEFAULT_LINES_AMOUNT;
-    priv->read_only         = FALSE;
-    priv->fd.cleared_match  = CLEARED_ALL;
-}
-
-static void
-gnc_plugin_page_register2_finalize (GObject *object)
-{
-    GncPluginPageRegister2 *page;
-
-    ENTER("object %p", object);
-    page = GNC_PLUGIN_PAGE_REGISTER2 (object);
-
-    g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (page));
-
-    G_OBJECT_CLASS (parent_class)->finalize (object);
-    LEAVE(" ");
-}
-
-Account *
-gnc_plugin_page_register2_get_account (GncPluginPageRegister2 *page)
-{
-    GncPluginPageRegister2Private *priv;
-    GNCLedgerDisplay2Type ledger_type;
-    Account *leader;
-
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(page);
-    ledger_type = gnc_ledger_display2_type (priv->ledger);
-    leader = gnc_ledger_display2_leader (priv->ledger);
-
-    if ((ledger_type == LD2_SINGLE) || (ledger_type == LD2_SUBACCOUNT))
-        return leader;
-    return NULL;
-}
-
-/* This is the list of actions which are switched inactive in a read-only book. */
-static const char* readonly_inactive_actions[] =
-{
-    "EditCutAction",
-    "EditPasteAction",
-    "CutTransactionAction",
-    "PasteTransactionAction",
-    TRANSACTION_UP_ACTION,
-    TRANSACTION_DOWN_ACTION,
-    "DuplicateTransactionAction",
-    "DeleteTransactionAction",
-    "RemoveTransactionSplitsAction",
-    "RecordTransactionAction",
-    "CancelTransactionAction",
-    "UnvoidTransactionAction",
-    "VoidTransactionAction",
-    "ReverseTransactionAction",
-    "ActionsTransferAction",
-    "ActionsReconcileAction",
-    "ActionsStockSplitAction",
-    "ScheduleTransactionAction",
-    "ScrubAllAction",
-    "ScrubCurrentAction",
-    NULL
-};
-
-/* This is the list of actions whose text needs to be changed based on whether */
-/* the current cursor class is transaction or split. */
-static const char* tran_vs_split_actions[] =
-{
-    "CutTransactionAction",
-    "CopyTransactionAction",
-    "PasteTransactionAction",
-    "DuplicateTransactionAction",
-    "DeleteTransactionAction",
-    NULL
-};
-
-/* This is the list of labels for when the current cursor class is transaction. */
-static const char* tran_action_labels[] =
-{
-    CUT_TRANSACTION_LABEL,
-    COPY_TRANSACTION_LABEL,
-    PASTE_TRANSACTION_LABEL,
-    DUPLICATE_TRANSACTION_LABEL,
-    DELETE_TRANSACTION_LABEL,
-    NULL
-};
-
-/* This is the list of tooltips for when the current cursor class is transaction. */
-static const char* tran_action_tips[] =
-{
-    CUT_TRANSACTION_TIP,
-    COPY_TRANSACTION_TIP,
-    PASTE_TRANSACTION_TIP,
-    DUPLICATE_TRANSACTION_TIP,
-    DELETE_TRANSACTION_TIP,
-    NULL
-};
-
-/* This is the list of labels for when the current cursor class is split. */
-static const char* split_action_labels[] =
-{
-    CUT_SPLIT_LABEL,
-    COPY_SPLIT_LABEL,
-    PASTE_SPLIT_LABEL,
-    DUPLICATE_SPLIT_LABEL,
-    DELETE_SPLIT_LABEL,
-    NULL
-};
-
-/* This is the list of tooltips for when the current cursor class is split. */
-static const char* split_action_tips[] =
-{
-    CUT_SPLIT_TIP,
-    COPY_SPLIT_TIP,
-    PASTE_SPLIT_TIP,
-    DUPLICATE_SPLIT_TIP,
-    DELETE_SPLIT_TIP,
-    NULL
-};
-
-static void
-gnc_plugin_page_register2_ui_update (gpointer various, GncPluginPageRegister2 *page) // this works
-{
-    GncPluginPageRegister2Private *priv;
-    GncTreeViewSplitReg *view;
-    GncTreeModelSplitReg *model;
-    GtkAction *action;
-    gboolean expanded, voided;
-    Transaction *trans;
-
-    /* Set 'Split Transaction' */
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (page);
-    g_return_if_fail(priv);
-    model = gnc_ledger_display2_get_split_model_register (priv->ledger);
-    view = gnc_ledger_display2_get_split_view_register (priv->ledger);
-    g_return_if_fail(model);
-    g_return_if_fail(view);
-
-    expanded = gnc_tree_view_split_reg_trans_expanded (view, NULL);
-    action = gnc_plugin_page_get_action (GNC_PLUGIN_PAGE (page),
-                                         "SplitTransactionAction");
-    gtk_action_set_sensitive (action, model->style == REG2_STYLE_LEDGER);
-    g_signal_handlers_block_by_func
-    (action, gnc_plugin_page_register2_cmd_expand_transaction, page);
-    gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), expanded);
-    g_signal_handlers_unblock_by_func
-    (action, gnc_plugin_page_register2_cmd_expand_transaction, page);
-
-    /* Set 'Void' and 'Unvoid' */
-    trans = gnc_tree_view_split_reg_get_current_trans (view);
-    voided = xaccTransHasSplitsInState (trans, VREC); 
-
-    action = gnc_plugin_page_get_action (GNC_PLUGIN_PAGE (page),
-                                         "VoidTransactionAction");
-    gtk_action_set_sensitive (GTK_ACTION (action), !voided);
-
-    action = gnc_plugin_page_get_action (GNC_PLUGIN_PAGE (page),
-                                         "UnvoidTransactionAction");
-    gtk_action_set_sensitive (GTK_ACTION (action), voided);
-
-    /* Modify the activeness of the up/down arrows */
-    {
-        GtkAction *action = gnc_plugin_page_get_action (GNC_PLUGIN_PAGE (page), TRANSACTION_UP_ACTION);
-        gtk_action_set_sensitive(action,
-                                 gnc_tree_control_split_reg_is_current_movable_updown(view, TRUE));
-        action = gnc_plugin_page_get_action (GNC_PLUGIN_PAGE (page), TRANSACTION_DOWN_ACTION);
-        gtk_action_set_sensitive(action,
-                                 gnc_tree_control_split_reg_is_current_movable_updown(view, FALSE));
-    }
-
-    /* If we are in a readonly book, make any modifying action inactive */
-    if (qof_book_is_readonly(gnc_get_current_book ()))
-    {
-        const char **iter;
-        for (iter = readonly_inactive_actions; *iter; ++iter)
-        {
-            /* Set the action's sensitivity */
-            GtkAction *action = gnc_plugin_page_get_action (GNC_PLUGIN_PAGE (page), *iter);
-            gtk_action_set_sensitive (action, FALSE);
-        }
-    }
-
-    /* Modifying action descriptions based on row depth */
-    {
-        RowDepth depth;
-        const char **iter, **label_iter, **tooltip_iter;
-        gboolean curr_label_trans = FALSE;
-        depth = gnc_tree_view_reg_get_selected_row_depth (view);
-        iter = tran_vs_split_actions;
-        action = gnc_plugin_page_get_action (GNC_PLUGIN_PAGE (page), *iter);
-        label_iter = tran_action_labels;
-        if (g_strcmp0 (gtk_action_get_label (action), _(*label_iter)) == 0)
-            curr_label_trans = TRUE;
-        if ((depth == SPLIT3) && curr_label_trans)
-        {
-            label_iter = split_action_labels;
-            tooltip_iter = split_action_tips;
-            for (iter = tran_vs_split_actions; *iter; ++iter)
-            {
-                /* Adjust the action's label and tooltip */
-                action = gnc_plugin_page_get_action (GNC_PLUGIN_PAGE (page), *iter);
-                gtk_action_set_label (action, _(*label_iter));
-                gtk_action_set_tooltip (action, _(*tooltip_iter));
-                ++label_iter;
-                ++tooltip_iter;
-            }
-        }
-        else if ((depth == TRANS1 || depth == TRANS2) && !curr_label_trans)
-        {
-            label_iter = tran_action_labels;
-            tooltip_iter = tran_action_tips;
-            for (iter = tran_vs_split_actions; *iter; ++iter)
-            {
-                /* Adjust the action's label and tooltip */
-                action = gnc_plugin_page_get_action (GNC_PLUGIN_PAGE (page), *iter);
-                gtk_action_set_label (action, _(*label_iter));
-                gtk_action_set_tooltip (action, _(*tooltip_iter));
-                ++label_iter;
-                ++tooltip_iter;
-            }
-        }
-    }
-}
-
-static void
-gnc_plugin_page_register2_ui_initial_state (GncPluginPageRegister2 *page) // this works
-{
-    GncPluginPageRegister2Private *priv ;
-    GtkActionGroup *action_group;
-    GtkAction *action;
-    Account *account;
-    GncTreeViewSplitReg *view;
-    GncTreeModelSplitReg *model;
-    GNCLedgerDisplay2Type ledger_type;
-    int i;
-    gboolean is_readwrite = !qof_book_is_readonly (gnc_get_current_book());
-
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (page);
-    account = gnc_plugin_page_register2_get_account (page);
-    action_group = gnc_plugin_page_get_action_group (GNC_PLUGIN_PAGE (page));
-    gnc_plugin_update_actions(action_group, actions_requiring_account,
-                              "sensitive", is_readwrite && account != NULL);
-
-    /* Set "style" radio button */
-    ledger_type = gnc_ledger_display2_type (priv->ledger);
-    gnc_plugin_update_actions (action_group, view_style_actions,
-                              "sensitive", ledger_type == LD2_SINGLE);
-
-    model = gnc_ledger_display2_get_split_model_register (priv->ledger);
-    for (i = n_radio_entries_2 - 1; i > 0; i--)
-    {
-        DEBUG(" index %d: comparing %x to %x", i, radio_entries_2[i].value,
-              model->style);
-        if (radio_entries_2[i].value == model->style)
-        {
-            DEBUG("match");
-            break;
-        }
-    }
-
-    /* Either a match was found, or fell out with i = 0 */
-    action = gtk_action_group_get_action (action_group, radio_entries_2[i].name);
-    g_signal_handlers_block_by_func (action, gnc_plugin_page_register2_cmd_style_changed, page);
-    gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), TRUE);
-    g_signal_handlers_unblock_by_func (action, gnc_plugin_page_register2_cmd_style_changed, page);
-
-    view = gnc_split_reg2_get_register (priv->gsr);
-
-    /* Set "double line" toggle button */
-    action = gtk_action_group_get_action (action_group, "ViewStyleDoubleLineAction");
-    g_signal_handlers_block_by_func (action, gnc_plugin_page_register2_cmd_style_double_line, page);
-    gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), model->use_double_line);
-    g_signal_handlers_unblock_by_func (action, gnc_plugin_page_register2_cmd_style_double_line, page);
-
-    /* Set "extra dates" toggle button */
-    action = gtk_action_group_get_action (action_group, "ViewStyleExtraDatesAction");
-    g_signal_handlers_block_by_func (action, gnc_plugin_page_register2_cmd_style_extra_dates, page);
-    gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), view->show_extra_dates);
-    g_signal_handlers_unblock_by_func (action, gnc_plugin_page_register2_cmd_style_extra_dates, page);
-}
-
-
-/*#################################################################################*/
-/*#################################################################################*/
-/* Virtual Functions */
-
-static GtkWidget *
-gnc_plugin_page_register2_create_widget (GncPluginPage *plugin_page)
-{
-    GncPluginPageRegister2 *page;
-    GncPluginPageRegister2Private *priv;
-    GNCLedgerDisplay2Type ledger_type;
-    GncWindow *gnc_window;
-    guint numRows;
-    GtkWidget *gsr;
-
-    GncTreeViewSplitReg *view;
-    GncTreeModelSplitReg *model;
-    Account *acct;
-    gchar **filter;
-    int filter_changed = 0;
-
-    ENTER("page %p", plugin_page);
-    page = GNC_PLUGIN_PAGE_REGISTER2 (plugin_page);
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (page);
-    if (priv->widget != NULL)
-    {
-        LEAVE("existing widget %p", priv->widget);
-        return priv->widget;
-    }
-
-    priv->widget = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-    gtk_box_set_homogeneous (GTK_BOX (priv->widget), FALSE);
-    gtk_widget_show (priv->widget);
-
-    // Set the style context for this page so it can be easily manipulated with css
-    gnc_widget_set_style_context (GTK_WIDGET(priv->widget), "GncRegisterPage");
-
-    numRows = priv->lines_default;
-    numRows = MIN (numRows, DEFAULT_LINES_AMOUNT);
-
-    gnc_window = GNC_WINDOW (GNC_PLUGIN_PAGE (page)->window);
-
-    gsr = gnc_split_reg2_new (priv->ledger,
-                            gnc_window_get_gtk_window (gnc_window),
-                            numRows, priv->read_only);
-    priv->gsr = (GNCSplitReg2 *)gsr;
-    gtk_widget_show (gsr);
-
-    gtk_box_pack_start (GTK_BOX (priv->widget), gsr, TRUE, TRUE, 0);
-
-    g_signal_connect (G_OBJECT (gsr), "help-changed",
-                      G_CALLBACK (gnc_plugin_page_help_changed_cb),
-                      page );
-
-    view = gnc_split_reg2_get_register (priv->gsr);
-
-    // Callback for right mouse events
-    g_signal_connect (G_OBJECT (GTK_TREE_VIEW (view)), "button-press-event",
-                      G_CALLBACK (gnc_plugin_page_register2_button_press_cb), page);
-
-    model = gnc_ledger_display2_get_split_model_register (priv->ledger);
-
-    gnc_tree_model_split_reg_config (model, model->type, model->style, model->use_double_line);
-
-    gnc_plugin_page_register2_ui_initial_state (page);
-    gnc_plugin_page_register2_ui_update (NULL, page);
-
-    ledger_type = gnc_ledger_display2_type (priv->ledger);
-
-    if (ledger_type == LD2_SINGLE || ledger_type == LD2_SUBACCOUNT || ledger_type == LD2_GL)
-    {
-        /* Set the filter for the split register and status of save filter button */
-        priv->fd.save_filter = FALSE;
-
-        filter = g_strsplit(gnc_plugin_page_register2_get_filter (plugin_page), ",", -1);
-
-        PINFO("Loaded Filter Status is %s", filter[0]);
-
-        priv->fd.cleared_match = (gint)g_ascii_strtoll (filter[0], NULL, 16 );
-
-        if (filter[0] && (g_strcmp0 (filter[0], DEFAULT_FILTER) != 0))
-            filter_changed = filter_changed + 1;
-
-        if (filter[1] && (g_strcmp0 (filter[1], "0") != 0 ))
-        {
-            PINFO("Loaded Filter Start Date is %s", filter[1]);
-
-            priv->fd.start_time = gnc_plugin_page_register2_filter_dmy2time (filter[1]);
-            priv->fd.start_time = gnc_time64_get_day_start (priv->fd.start_time);
-            filter_changed = filter_changed + 1;
-
-            if (filter[2] && (g_strcmp0 (filter[2], "0") != 0 ))
-            {
-                PINFO("Loaded Filter End Date is %s", filter[2]);
-
-                priv->fd.end_time = gnc_plugin_page_register2_filter_dmy2time (filter[2]);
-                priv->fd.end_time = gnc_time64_get_day_end (priv->fd.end_time);
-                filter_changed = filter_changed + 1;
-            }
-        }
-
-        if (filter_changed != 0)
-            priv->fd.save_filter = TRUE;
-
-        priv->fd.original_save_filter = priv->fd.save_filter;
-        g_strfreev (filter);
-
-        /* Update Query with Filter Status and Dates */
-        gnc_ppr_update_status_query (page, FALSE);
-        gnc_ppr_update_date_query (page, FALSE);
-    }
-
-//FIXME may change, can we load filter at same time of sort so we do one querry on load
-    gnc_ledger_display2_refresh (priv->ledger);
-
-    /* This sets the default selection on load, not required for templates */
-    if (!gnc_tree_model_split_reg_get_template (model))
-       gnc_tree_view_split_reg_default_selection (view);
-
-    plugin_page->summarybar = gnc_split_reg2_create_summary_bar (priv->gsr);
-    if (plugin_page->summarybar)
-    {
-        gtk_widget_show_all (plugin_page->summarybar);
-        gtk_box_pack_start (GTK_BOX (priv->widget), plugin_page->summarybar,
-                           FALSE, FALSE, 0);
-        gnc_plugin_page_register2_summarybar_position_changed (NULL, NULL, page);
-        gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL,
-                               GNC_PREF_SUMMARYBAR_POSITION_TOP,
-                               gnc_plugin_page_register2_summarybar_position_changed,
-                               page);
-        gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL,
-                               GNC_PREF_SUMMARYBAR_POSITION_BOTTOM,
-                               gnc_plugin_page_register2_summarybar_position_changed,
-                               page);
-    }
-
-    priv->event_handler_id = qof_event_register_handler
-                             ((QofEventHandler)gnc_plugin_page_register2_event_handler, page);
-    priv->component_manager_id =
-        gnc_register_gui_component (GNC_PLUGIN_PAGE_REGISTER2_NAME,
-                                   gnc_plugin_page_register2_refresh_cb,
-                                   gnc_plugin_page_register2_close_cb,
-                                   page);
-    gnc_gui_component_set_session (priv->component_manager_id,
-                                   gnc_get_current_session());
-    acct = gnc_plugin_page_register2_get_account (page);
-    if (acct)
-        gnc_gui_component_watch_entity (
-            priv->component_manager_id, xaccAccountGetGUID (acct),
-            QOF_EVENT_DESTROY | QOF_EVENT_MODIFY);
-
-    /* This allows the plugin page to be updated from the view */
-    gnc_split_reg2_set_moved_cb
-    (priv->gsr, (GFunc)gnc_plugin_page_register2_ui_update, page);
-
-    LEAVE(" ");
-    return priv->widget;
-}
-
-/*#################################################################################*/
-
-/** This button press handler calls the common button press handler
- *  for all pages.  The GtkTreeView eats all button presses and
- *  doesn't pass them up the widget tree, even when doesn't do
- *  anything with them.  The only way to get access to the button
- *  presses in an account tree page is here on the tree view widget.
- *  Button presses on all other pages are caught by the signal
- *  registered in gnc-main-window.c. */
-static gboolean
-gnc_plugin_page_register2_button_press_cb (GtkWidget *widget,
-        GdkEventButton *event,
-        GncPluginPage *page)
-{
-
-    g_return_val_if_fail(GNC_IS_PLUGIN_PAGE(page), FALSE);
-
-    ENTER("widget %p, event %p, page %p", widget, event, page);
-    gnc_main_window_button_press_cb (widget, event, page);
-    LEAVE(" ");
-
-    /* Always return FALSE.  This will let the tree view callback run as
-     * well which will select the item under the cursor.  By the time
-     * the user sees the menu both callbacks will have run and the menu
-     * actions will operate on the just-selected account. */
-    return FALSE;
-}
-
-static void
-gnc_plugin_page_register2_destroy_widget (GncPluginPage *plugin_page)
-{
-    GncPluginPageRegister2 *page;
-    GncPluginPageRegister2Private *priv;
-
-    ENTER("page %p", plugin_page);
-    page = GNC_PLUGIN_PAGE_REGISTER2 (plugin_page);
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(plugin_page);
-
-    gnc_prefs_remove_cb_by_func (GNC_PREFS_GROUP_GENERAL,
-                                 GNC_PREF_SUMMARYBAR_POSITION_TOP,
-                                 gnc_plugin_page_register2_summarybar_position_changed,
-                                 page);
-    gnc_prefs_remove_cb_by_func (GNC_PREFS_GROUP_GENERAL,
-                                 GNC_PREF_SUMMARYBAR_POSITION_BOTTOM,
-                                 gnc_plugin_page_register2_summarybar_position_changed,
-                                 page);
-
-    if (priv->widget == NULL)
-    {
-        LEAVE(" ");
-        return;
-    }
-
-    if (priv->component_manager_id)
-    {
-        gnc_unregister_gui_component (priv->component_manager_id);
-        priv->component_manager_id = 0;
-    }
-
-    if (priv->event_handler_id)
-    {
-        qof_event_unregister_handler (priv->event_handler_id);
-        priv->event_handler_id = 0;
-    }
-
-    if (priv->fd.dialog)
-    {
-        gtk_widget_destroy (priv->fd.dialog);
-        memset(&priv->fd, 0, sizeof(priv->fd));
-    }
-
-    gtk_widget_hide (priv->widget);
-
-    if (priv->ledger)
-    {
-        gnc_ledger_display2_close (priv->ledger);
-        priv->ledger = NULL;
-    }
-
-    if (priv->widget)
-    {
-        g_object_unref (G_OBJECT(priv->widget));
-        priv->widget = NULL;
-    }
-    LEAVE(" ");
-}
-
-static void
-gnc_plugin_page_register2_window_changed (GncPluginPage *plugin_page,
-        GtkWidget *window) // this works
-{
-    GncPluginPageRegister2 *page;
-    GncPluginPageRegister2Private *priv;
-
-    g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (plugin_page));
-
-    page = GNC_PLUGIN_PAGE_REGISTER2 (plugin_page);
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (page);
-
-    priv->gsr->window =
-        GTK_WIDGET(gnc_window_get_gtk_window (GNC_WINDOW (window)));
-}
-
-static const gchar *style_names[] =
-{
-    "Ledger",
-    "Auto Ledger",
-    "Journal",
-    NULL
-};
-
-#define KEY_REGISTER_TYPE       "RegisterType"
-#define KEY_ACCOUNT_NAME        "AccountName"
-#define KEY_REGISTER_STYLE      "RegisterStyle"
-#define KEY_DOUBLE_LINE         "DoubleLineMode"
-#define KEY_EXTRA_DATES         "ExtraDatesMode"
-
-#define LABEL_ACCOUNT		"Account"
-#define LABEL_SUBACCOUNT	"SubAccount"
-#define LABEL_GL		"GL"
-#define LABEL_SEARCH		"Search"
-
-#define SPLIT_REGISTER_GUID "SplitRegister GUID"
-
-/** Save enough information about this register page that it can be
- *  recreated next time the user starts gnucash.
- *
- *  @param plugin_page The page to save.
- *
- *  @param key_file A pointer to the GKeyFile data structure where the
- *  page information should be written. gnc_plugin_page_register2_save_page
- *
- *  @param group_name The group name to use when saving data. */
-static void
-gnc_plugin_page_register2_save_page (GncPluginPage *plugin_page,
-                                    GKeyFile *key_file,
-                                    const gchar *group_name)
-{
-    GncPluginPageRegister2 *page;
-    GncPluginPageRegister2Private *priv;
-    GNCLedgerDisplay2Type ledger_type;
-    GncTreeViewSplitReg *view;
-    GncTreeModelSplitReg *model;
-    Account *leader;
-
-    g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (plugin_page));
-    g_return_if_fail (key_file != NULL);
-    g_return_if_fail (group_name != NULL);
-
-    ENTER("page %p, key_file %p, group_name %s", plugin_page, key_file,
-          group_name);
-
-    page = GNC_PLUGIN_PAGE_REGISTER2 (plugin_page);
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (page);
-
-    view = gnc_ledger_display2_get_split_view_register (priv->ledger);
-    model = gnc_ledger_display2_get_split_model_register (priv->ledger);
-    ledger_type = gnc_ledger_display2_type (priv->ledger);
-    if (ledger_type > LD2_GL)
-    {
-        LEAVE("Unsupported ledger type");
-        return;
-    }
-    if ((ledger_type == LD2_SINGLE) || (ledger_type == LD2_SUBACCOUNT))
-    {
-        const gchar *label;
-        gchar* name;
-        label = (ledger_type == LD2_SINGLE) ? LABEL_ACCOUNT : LABEL_SUBACCOUNT;
-        leader = gnc_ledger_display2_leader (priv->ledger);
-        g_key_file_set_string (key_file, group_name, KEY_REGISTER_TYPE, label);
-        name = gnc_account_get_full_name (leader);
-        g_key_file_set_string (key_file, group_name, KEY_ACCOUNT_NAME, name);
-        g_free (name);
-    }
-    else if (model->type == GENERAL_JOURNAL2)
-    {
-        g_key_file_set_string (key_file, group_name, KEY_REGISTER_TYPE,
-                              LABEL_GL);
-    }
-    else if (model->type == SEARCH_LEDGER2)
-    {
-        g_key_file_set_string (key_file, group_name, KEY_REGISTER_TYPE,
-                              LABEL_SEARCH);
-    }
-    else
-    {
-        LEAVE("Unsupported register type");
-        return;
-    }
-
-    g_key_file_set_string (key_file, group_name, KEY_REGISTER_STYLE, style_names[model->style]);
-    g_key_file_set_boolean (key_file, group_name, KEY_DOUBLE_LINE, model->use_double_line);
-    g_key_file_set_boolean (key_file, group_name, KEY_EXTRA_DATES, view->show_extra_dates);
-
-    LEAVE(" ");
-}
-
-/** Read and restore the edit menu settings on the specified register
- *  page. This function will restore the register style (ledger, auto
- *  ledger, journal) and whether or not the register is in double line
- *  mode. It should eventually restore the "filter by" and "sort by"
- *  mode.
- *
- *  @param page The register being restored.
- *
- *  @param key_file A pointer to the GKeyFile data structure where the
- *  page information should be read.
- *
- *  @param group_name The group name to use when restoring data. */
-static void
-gnc_plugin_page_register2_restore_edit_menu (GncPluginPage *page,
-        GKeyFile *key_file,
-        const gchar *group_name)
-{
-    GtkAction *action;
-    GError *error = NULL;
-    gchar *style_name;
-    gint i;
-    gboolean use_double_line;
-    gboolean show_extra_dates;
-
-    ENTER(" ");
-
-    /* Convert the style name to an index */
-    style_name = g_key_file_get_string (key_file, group_name,
-                                       KEY_REGISTER_STYLE, &error);
-    for (i = 0 ; style_names[i]; i++)
-    {
-        if (g_ascii_strcasecmp (style_name, style_names[i]) == 0)
-        {
-            DEBUG("Found match for style name: %s", style_name);
-            break;
-        }
-    }
-    g_free (style_name);
-
-    /* Update the style menu action for this page */
-    if (i <= REG2_STYLE_JOURNAL)
-    {
-        DEBUG("Setting style: %d", i);
-        action = gnc_plugin_page_get_action (page, radio_entries_2[i].name);
-        gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), TRUE);
-    }
-
-    /* Update the double line action on this page */
-    use_double_line =
-        g_key_file_get_boolean (key_file, group_name, KEY_DOUBLE_LINE, &error);
-    DEBUG("Setting double_line_mode: %d", use_double_line);
-    action = gnc_plugin_page_get_action (page, "ViewStyleDoubleLineAction");
-    gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), use_double_line);
-
-    /* Update the extra dates action on this page */
-    show_extra_dates =
-        g_key_file_get_boolean (key_file, group_name, KEY_EXTRA_DATES, &error);
-    DEBUG("Setting extra_dates_mode: %d", show_extra_dates);
-    action = gnc_plugin_page_get_action (page, "ViewStyleExtraDatesAction");
-    gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), show_extra_dates);
-    LEAVE(" ");
-}
-
-/** Create a new register page based on the information saved during a
- *  previous instantiation of gnucash.
- *
- *  @param window The window where this page should be installed.
- *
- *  @param key_file A pointer to the GKeyFile data structure where the
- *  page information should be read.
- *
- *  @param group_name The group name to use when restoring data. */
-static GncPluginPage *
-gnc_plugin_page_register2_recreate_page (GtkWidget *window,
-                                        GKeyFile *key_file,
-                                        const gchar *group_name)
-{
-    GncPluginPage *page;
-    GError *error = NULL;
-    gchar *reg_type, *acct_name;
-    Account *account;
-    QofBook *book;
-    gboolean include_subs;
-
-    g_return_val_if_fail (key_file, NULL);
-    g_return_val_if_fail (group_name, NULL);
-    ENTER("key_file %p, group_name %s", key_file, group_name);
-
-    /* Create the new page. */
-    reg_type = g_key_file_get_string (key_file, group_name,
-                                     KEY_REGISTER_TYPE, &error);
-    DEBUG("Page type: %s", reg_type);
-    if ((g_ascii_strcasecmp (reg_type, LABEL_ACCOUNT) == 0) ||
-            (g_ascii_strcasecmp (reg_type, LABEL_SUBACCOUNT) == 0))
-    {
-        include_subs = (g_ascii_strcasecmp(reg_type, LABEL_SUBACCOUNT) == 0);
-        DEBUG("Include subs: %d", include_subs);
-        acct_name = g_key_file_get_string (key_file, group_name,
-                                          KEY_ACCOUNT_NAME, &error);
-        book = qof_session_get_book (gnc_get_current_session());
-        account = gnc_account_lookup_by_full_name (gnc_book_get_root_account(book),
-                  acct_name);
-        g_free (acct_name);
-        if (account == NULL)
-        {
-            LEAVE("Bad account name");
-            g_free (reg_type);
-            return NULL;
-        }
-        page = gnc_plugin_page_register2_new (account, include_subs);
-    }
-    else if (g_ascii_strcasecmp (reg_type, LABEL_GL) == 0)
-    {
-        page = gnc_plugin_page_register2_new_gl ();
-    }
-    else
-    {
-        LEAVE("Bad ledger type");
-        g_free (reg_type);
-        return NULL;
-    }
-    g_free (reg_type);
-
-    /* Recreate page in given window */
-    gnc_plugin_page_set_use_new_window (page, FALSE);
-
-    /* Install it now so we can them manipulate the created widget */
-    gnc_main_window_open_page (GNC_MAIN_WINDOW (window), page);
-
-    /* Now update the page to the last state it was in */
-    gnc_plugin_page_register2_restore_edit_menu (page, key_file, group_name);
-    LEAVE(" ");
-    return page;
-}
-
-
-/*
- * Based on code from Epiphany (src/ephy-window.c)
- */
-static void
-gnc_plugin_page_register2_update_edit_menu (GncPluginPage *page, gboolean hide) //this works
-{
-    GncPluginPageRegister2Private *priv;
-    GncPluginPageRegister2 *reg_page;
-    GncTreeViewSplitReg *view;
-    GtkAction *action;
-    gboolean can_copy = FALSE, can_cut = FALSE, can_paste = FALSE;
-    gboolean has_selection;
-    gboolean is_readwrite = !qof_book_is_readonly (gnc_get_current_book());
-    reg_page = GNC_PLUGIN_PAGE_REGISTER2 (page);
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (reg_page);
-    view = gnc_ledger_display2_get_split_view_register (priv->ledger);
-
-    // This is set while we are editing a cell
-    if (view->editing_now)
-        has_selection = TRUE;
-    else
-        has_selection = FALSE;
-
-    can_copy = has_selection;
-    can_cut = is_readwrite && has_selection;
-    can_paste = is_readwrite;
-
-    action = gnc_plugin_page_get_action (page, "EditCopyAction");
-    gtk_action_set_sensitive (action, can_copy);
-    gtk_action_set_visible (action, !hide || can_copy);
-    action = gnc_plugin_page_get_action (page, "EditCutAction");
-    gtk_action_set_sensitive (action, can_cut);
-    gtk_action_set_visible (action, !hide || can_cut);
-    action = gnc_plugin_page_get_action (page, "EditPasteAction");
-    gtk_action_set_sensitive (action, can_paste);
-    gtk_action_set_visible (action,  !hide || can_paste);
-}
-
-static gboolean
-gnc_plugin_page_register2_finish_pending (GncPluginPage *page) //this works
-{
-    GncPluginPageRegister2Private *priv;
-    GncPluginPageRegister2 *reg_page;
-    GncTreeViewSplitReg *view;
-    GtkWidget *dialog, *window;
-    const gchar *name;
-    gint response;
-
-    reg_page = GNC_PLUGIN_PAGE_REGISTER2 (page);
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (reg_page);
-    view = gnc_ledger_display2_get_split_view_register (priv->ledger);
-
-    /* Make sure we have stopped editing */
-    gnc_tree_view_split_reg_finish_edit (view);
-
-    if (!view || (gnc_tree_view_split_reg_get_dirty_trans (view) == NULL))
-        return TRUE;
-
-    name = gnc_plugin_page_register2_get_tab_name (page);
-    window = gnc_plugin_page_get_window (page);
-    dialog = gtk_message_dialog_new (GTK_WINDOW (window),
-                                    GTK_DIALOG_DESTROY_WITH_PARENT,
-                                    GTK_MESSAGE_WARNING,
-                                    GTK_BUTTONS_NONE,
-                                    /* Translators: %s is the name
-                                       of the tab page */
-                                    _("Save changes to %s?"), name);
-    gtk_message_dialog_format_secondary_text
-    (GTK_MESSAGE_DIALOG (dialog),
-     "%s",
-     _("This register has pending changes to a transaction. "
-       "Would you like to save the changes to this transaction, "
-       "discard the transaction, or cancel the operation?"));
-    gnc_gtk_dialog_add_button (dialog, _("_Discard Transaction"),
-                              "edit-delete", GTK_RESPONSE_REJECT);
-    gtk_dialog_add_button (GTK_DIALOG (dialog),
-                          _("_Cancel"), GTK_RESPONSE_CANCEL);
-    gnc_gtk_dialog_add_button (dialog, _("_Save Transaction"),
-                              "document-save", GTK_RESPONSE_ACCEPT);
-
-    response = gtk_dialog_run (GTK_DIALOG (dialog));
-    gtk_widget_destroy (dialog);
-
-    switch (response)
-    {
-    case GTK_RESPONSE_ACCEPT:
-        return (gnc_tree_control_split_reg_save (view, TRUE));
-
-    case GTK_RESPONSE_REJECT:
-        gnc_tree_control_split_reg_cancel_edit (view, TRUE);
-        return TRUE;
-
-    default:
-        return FALSE;
-    }
-}
-
-static gchar *
-gnc_plugin_page_register2_get_tab_name (GncPluginPage *plugin_page)
-{
-    GncPluginPageRegister2Private *priv;
-    GNCLedgerDisplay2Type ledger_type;
-    GNCLedgerDisplay2 *ld;
-    GncTreeModelSplitReg *model;
-    Account *leader;
-
-    g_return_val_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (plugin_page), _("unknown"));
-
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(plugin_page);
-    ld = priv->ledger;
-    model = gnc_ledger_display2_get_split_model_register(ld);
-    ledger_type = gnc_ledger_display2_type (ld);
-    leader = gnc_ledger_display2_leader (ld);
-
-    switch (ledger_type)
-    {
-    case LD2_SINGLE:
-        return g_strdup(xaccAccountGetName (leader));
-
-    case LD2_SUBACCOUNT:
-        return g_strdup_printf("%s+", xaccAccountGetName (leader));
-
-    case LD2_GL:
-        switch (model->type)
-        {
-        case GENERAL_JOURNAL:
-        case INCOME_LEDGER:
-            return g_strdup(_("General Journal"));
-        case PORTFOLIO_LEDGER:
-            return g_strdup(_("Portfolio"));
-        case SEARCH_LEDGER:
-            return g_strdup(_("Search Results"));
-        default:
-            break;
-        }
-        break;
-
-    default:
-        break;
-    }
-
-    return g_strdup(_("unknown"));
-}
-
-static gchar *
-gnc_plugin_page_register2_get_tab_color (GncPluginPage *plugin_page)
-{
-    GncPluginPageRegister2Private *priv;
-    GNCLedgerDisplay2Type ledger_type;
-    GNCLedgerDisplay2 *ld;
-    Account *leader;
-    const char* color;
-
-    g_return_val_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (plugin_page), _("unknown"));
-
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(plugin_page);
-    ld = priv->ledger;
-    ledger_type = gnc_ledger_display2_type (ld);
-    leader = gnc_ledger_display2_leader (ld);
-    color = NULL;
-
-    if ((ledger_type == LD2_SINGLE) || (ledger_type == LD2_SUBACCOUNT))
-        color = xaccAccountGetColor (leader);
-
-    return g_strdup(color ? color : "Not Set");
-}
-
-static gchar *
-gnc_plugin_page_register2_get_filter (GncPluginPage *plugin_page)
-{
-    GncPluginPageRegister2Private *priv;
-    GNCLedgerDisplay2Type ledger_type;
-    GNCLedgerDisplay2 *ld;
-    Account *leader;
-    const char* filter;
-
-    g_return_val_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (plugin_page), _("unknown"));
-
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(plugin_page);
-    ld = priv->ledger;
-    ledger_type = gnc_ledger_display2_type (ld);
-    leader = gnc_ledger_display2_leader (ld);
-    filter = NULL;
-
-    if ((ledger_type == LD2_SINGLE) || (ledger_type == LD2_SUBACCOUNT))
-        filter = xaccAccountGetFilter (leader);
-
-    return filter ? g_strdup(filter) : g_strdup_printf("%s,%s,%s", DEFAULT_FILTER, "0", "0");
-}
-
-void
-gnc_plugin_page_register2_set_filter (GncPluginPage *plugin_page, const gchar *filter )
-{
-    GncPluginPageRegister2Private *priv;
-    GNCLedgerDisplay2 *ld;
-    Account *leader;
-    gchar *default_filter;
-
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(plugin_page);
-    ld = priv->ledger;
-    leader = gnc_ledger_display2_leader (ld);
-
-    if (leader != NULL)
-    {
-        default_filter = g_strdup_printf("%s,%s,%s", DEFAULT_FILTER, "0", "0");
-
-        if (!filter || (g_strcmp0 (filter, default_filter) == 0))
-            xaccAccountSetFilter (leader, NULL);
-        else
-            xaccAccountSetFilter (leader, filter);
-
-        g_free (default_filter);
-    }
-    return;
-}
-
-static gchar *
-gnc_plugin_page_register2_get_long_name (GncPluginPage *plugin_page)
-{
-    GncPluginPageRegister2Private *priv;
-    GNCLedgerDisplay2Type ledger_type;
-    GNCLedgerDisplay2 *ld;
-    Account *leader;
-
-    g_return_val_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (plugin_page), _("unknown"));
-
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (plugin_page);
-    ld = priv->ledger;
-    ledger_type = gnc_ledger_display2_type (ld);
-    leader = gnc_ledger_display2_leader (ld);
-
-    switch (ledger_type)
-    {
-    case LD2_SINGLE:
-        return gnc_account_get_full_name (leader);
-
-    case LD2_SUBACCOUNT:
-    {
-        gchar *account_full_name = gnc_account_get_full_name (leader);
-        gchar *return_string = g_strdup_printf ("%s+", account_full_name);
-        g_free ((gpointer *) account_full_name);
-        return return_string;
-    }
-
-    default:
-        break;
-    }
-
-    return NULL;
-}
-
-static void
-gnc_plugin_page_register2_summarybar_position_changed (gpointer prefs, gchar* pref, gpointer user_data)
-{
-    GncPluginPage *plugin_page;
-    GncPluginPageRegister2 *page;
-    GncPluginPageRegister2Private *priv;
-    GtkPositionType position = GTK_POS_BOTTOM;
-
-    g_return_if_fail (user_data != NULL);
-
-    if (!GNC_IS_PLUGIN_PAGE (user_data))
-        return;
-
-    plugin_page = GNC_PLUGIN_PAGE (user_data);
-    page = GNC_PLUGIN_PAGE_REGISTER2 (user_data);
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (page);
-
-    if (priv == NULL)
-       return;
-
-    if (gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL, GNC_PREF_SUMMARYBAR_POSITION_TOP))
-        position = GTK_POS_TOP;
-
-    gtk_box_reorder_child (GTK_BOX (priv->widget),
-                          plugin_page->summarybar,
-                          (position == GTK_POS_TOP ? 0 : -1) );
-}
-
-/** This function is called to get the query associated with this
- *  plugin page.
- *
- *  @param page A pointer to the GncPluginPage.
- */
-Query *
-gnc_plugin_page_register2_get_query (GncPluginPage *plugin_page)
-{
-    GncPluginPageRegister2 *page;
-    GncPluginPageRegister2Private *priv;
-
-    g_return_val_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2(plugin_page), NULL);
-
-    page = GNC_PLUGIN_PAGE_REGISTER2 (plugin_page);
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(page);
-    return gnc_ledger_display2_get_query (priv->ledger);
-}
-
-/*#################################################################################*/
-/*#################################################################################*/
-
-/************************************************************/
-/*                    "Filter By" Dialog                    */
-/************************************************************/
-
-/** This function updates the "cleared match" term of the register
- *  query.  It unconditionally removes any old "cleared match" query
- *  term, then adds back a new query term if needed.  There seems to
- *  be a bug in the current g2 register code such that when the number
- *  of entries in the register doesn't fill up the window, the blank
- *  space at the end of the window isn't correctly redrawn.  This
- *  function works around that problem, but a root cause analysis
- *  should probably be done.
- *
- *  @param page A pointer to the GncPluginPageRegister2 that is
- *  associated with this filter dialog.
- */
-static void
-gnc_ppr_update_status_query (GncPluginPageRegister2 *page, gboolean refresh_page)
-{
-    GncPluginPageRegister2Private *priv;
-    GSList *param_list;
-    Query *query;
-
-    ENTER(" ");
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (page);
-    query = gnc_ledger_display2_get_query (priv->ledger );
-    if (!query)
-    {
-        LEAVE("no query found");
-        return;
-    }
-
-    /* Remove the old status match */
-    param_list = qof_query_build_param_list (SPLIT_RECONCILE, NULL);
-    if (param_list)
-    {
-        qof_query_purge_terms (query, param_list);
-        g_slist_free(param_list);
-    }
-
-    /* Install the new status match */
-    if (priv->fd.cleared_match != CLEARED_ALL)
-        xaccQueryAddClearedMatch(query, priv->fd.cleared_match, QOF_QUERY_AND);
-
-    if (refresh_page)
-        gnc_ledger_display2_refresh (priv->ledger);
-    LEAVE(" ");
-}
-
-/** This function updates the "date posted" term of the register
- *  query.  It unconditionally removes any old "date posted" query
- *  term, then adds back a new query term if needed.  There seems to
- *  be a bug in the current g2 register code such that when the number
- *  of entries in the register doesn't fill up the window, the blank
- *  space at the end of the window isn't correctly redrawn.  This
- *  function works around that problem, but a root cause analysis
- *  should probably be done.
- *
- *  @param page A pointer to the GncPluginPageRegister2 that is
- *  associated with this filter dialog.
- */
-static void
-gnc_ppr_update_date_query (GncPluginPageRegister2 *page, gboolean refresh_page)
-{
-    GncPluginPageRegister2Private *priv;
-    GSList *param_list;
-    Query *query;
-
-    ENTER(" ");
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (page);
-    if (!priv->ledger)
-    {
-        LEAVE("no ledger");
-        return;
-    }
-
-    query = gnc_ledger_display2_get_query (priv->ledger);
-    if (!query)
-    {
-        LEAVE("no query");
-        return;
-    }
-
-    /* Delete any existing old date spec. */
-    param_list = qof_query_build_param_list (SPLIT_TRANS, TRANS_DATE_POSTED, NULL);
-    if (param_list)
-    {
-        qof_query_purge_terms (query, param_list);
-        g_slist_free(param_list);
-    }
-
-    if (priv->fd.start_time || priv->fd.end_time)
-    {
-        /* Build a new spec */
-        xaccQueryAddDateMatchTT (query,
-                                priv->fd.start_time != 0, priv->fd.start_time,
-                                priv->fd.end_time != 0,   priv->fd.end_time,
-                                QOF_QUERY_AND);
-    }
-
-    if (refresh_page)
-        gnc_ledger_display2_refresh (priv->ledger);
-    LEAVE(" ");
-}
-
-/* This function converts a time64 value date to a string */
-static gchar *
-gnc_plugin_page_register2_filter_time2dmy (time64 raw_time)
-{
-    struct tm * timeinfo;
-    gchar date_string[11];
-
-    timeinfo = gnc_localtime (&raw_time);
-    strftime (date_string, 11, "%d-%m-%Y", timeinfo);
-    PINFO("Date string is %s", date_string);
-
-    gnc_tm_free (timeinfo);
-    return g_strdup (date_string);
-}
-
-/* This function converts a string date to a time64 value */
-static time64
-gnc_plugin_page_register2_filter_dmy2time (char *date_string)
-{
-    struct tm when;
-
-    PINFO("Date string is %s", date_string);
-    memset (&when, 0, sizeof (when));
-    sscanf (date_string, "%d-%d-%d", &when.tm_mday,
-	   &when.tm_mon, &when.tm_year);
-
-    when.tm_year -= 1900;
-    when.tm_mon -=  1;
-
-    return gnc_mktime (&when);
-}
-
-/** This function is called whenever one of the status entries is
- *  checked or unchecked.  It updates the status value maintained for
- *  the filter dialog, and calls another function to do the work of
- *  applying the change to the register itself.
- *
- *  @param button The toggle button that was changed.
- *
- *  @param page A pointer to the GncPluginPageRegister2 that is
- *  associated with this filter dialog.
- */
-void
-gnc_plugin_page_register2_filter_status_one_cb (GtkToggleButton *button,
-        GncPluginPageRegister2 *page)
-{
-    GncPluginPageRegister2Private *priv;
-    const gchar *name;
-    gint i, value;
-
-    g_return_if_fail (GTK_IS_CHECK_BUTTON (button));
-    g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (page));
-
-    name = gtk_buildable_get_name (GTK_BUILDABLE (button));
-    ENTER("toggle button %s (%p), plugin_page %p", name, button, page);
-
-    /* Determine what status bit to change */
-    value = CLEARED_NONE;
-    for (i = 0; status_actions[i].action_name; i++)
-    {
-        if (g_strcmp0 (name, status_actions[i].action_name) == 0)
-        {
-            value = status_actions[i].value;
-            break;
-        }
-    }
-
-    /* Compute the new match status */
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (page);
-    if (gtk_toggle_button_get_active (button))
-        priv->fd.cleared_match |= value;
-    else
-        priv->fd.cleared_match &= ~value;
-    gnc_ppr_update_status_query (page, TRUE);
-    LEAVE(" ");
-}
-
-/** This function is called whenever the "select all" status button is
- *  clicked. It updates all of the checkbox widgets, then updates the
- *  query on the register.
- *
- *  @param button The button that was clicked.
- *
- *  @param page A pointer to the GncPluginPageRegister2 that is
- *  associated with this filter dialog.
- */
-void
-gnc_plugin_page_register2_filter_status_all_cb (GtkButton *button,
-        GncPluginPageRegister2 *page)
-{
-    GncPluginPageRegister2Private *priv;
-    GtkWidget *widget;
-    gint i;
-
-    g_return_if_fail (GTK_IS_BUTTON (button));
-    g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (page));
-
-    ENTER("(button %p, page %p)", button, page);
-
-    /* Turn on all the check menu items */
-    for (i = 0; status_actions[i].action_name; i++)
-    {
-        widget = status_actions[i].widget;
-        g_signal_handlers_block_by_func (widget, gnc_plugin_page_register2_filter_status_one_cb, page);
-        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
-        g_signal_handlers_unblock_by_func (widget, gnc_plugin_page_register2_filter_status_one_cb, page);
-    }
-
-    /* Set the requested status */
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (page);
-    priv->fd.cleared_match = CLEARED_ALL;
-    gnc_ppr_update_status_query (page, TRUE);
-    LEAVE(" ");
-}
-
-/** This function computes the starting and ending times for the
- *  filter by examining the dialog widgets to see which ones are
- *  selected, and will pull times out of the data entry boxes if
- *  necessary. This function must exist to handle the case where the
- *  "show all" button was Selected, and the user clicks on the "select
- *  range" button. Since it exists, it make sense for the rest of the
- *  callbacks to take advantage of it.
- *
- *  @param page A pointer to the GncPluginPageRegister2 that is
- *  associated with this filter dialog.
- */
-static void
-get_filter_times (GncPluginPageRegister2 *page)
-{
-    GncPluginPageRegister2Private *priv;
-    time64 time_val;
-
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (page);
-    if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->fd.start_date_choose)))
-    {
-        time_val = gnc_date_edit_get_date (GNC_DATE_EDIT (priv->fd.start_date));
-        time_val = gnc_time64_get_day_start (time_val);
-        priv->fd.start_time = time_val;
-    }
-    else
-    {
-        if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->fd.start_date_today)))
-        {
-            priv->fd.start_time = gnc_time64_get_today_start();
-        }
-        else
-        {
-            priv->fd.start_time = 0;
-        }
-    }
-
-    if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->fd.end_date_choose)))
-    {
-        time_val = gnc_date_edit_get_date (GNC_DATE_EDIT (priv->fd.end_date));
-        time_val = gnc_time64_get_day_end (time_val);
-        priv->fd.end_time = time_val;
-    }
-    else
-    {
-        if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->fd.start_date_today)))
-        {
-            priv->fd.end_time = gnc_time64_get_today_end();
-        }
-        else
-        {
-            priv->fd.end_time = 0;
-        }
-    }
-}
-
-/** This function is called when the "select range" radio button
- *  changes state. Since there are only two choices in this radio
- *  group, this one signal can be used to handle all cases. This
- *  function is responsible for setting the sensitivity of the table
- *  of widgets underneath the "select range" choice, and updating the
- *  time limitation on the register query. This is handled by a
- *  helper function when the radio button is selected (as potentially
- *  all the widgets in the table need to be inspected), and is trivial
- *  for the other case.
- *
- *  @param button A pointer to the "select range" radio button.
- *
- *  @param page A pointer to the GncPluginPageRegister2 that is
- *  associated with this filter dialog.
- */
-void
-gnc_plugin_page_register2_filter_select_range_cb (GtkRadioButton *button,
-        GncPluginPageRegister2 *page)
-{
-    GncPluginPageRegister2Private *priv;
-    gboolean active;
-
-    g_return_if_fail (GTK_IS_RADIO_BUTTON (button));
-    g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (page));
-
-    ENTER("(button %p, page %p)", button, page);
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (page);
-    active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
-    gtk_widget_set_sensitive (priv->fd.table, active);
-    if (active)
-    {
-        get_filter_times (page);
-    }
-    else
-    {
-        priv->fd.start_time = 0;
-        priv->fd.end_time = 0;
-    }
-    gnc_ppr_update_date_query (page, TRUE);
-    LEAVE(" ");
-}
-
-/** This function is called when one of the start date entry widgets
- *  is updated. It simply calls common routines to determine the
- *  start/end times and update the register filter.
- *
- *  @param unused A pointer to a GncDateEntry widgets, but it could be
- *  any widget.
- *
- *  @param page A pointer to the GncPluginPageRegister2 that is
- *  associated with this filter dialog.
- */
-static void
-gnc_plugin_page_register2_filter_gde_changed_cb (GtkWidget *unused,
-        GncPluginPageRegister2 *page)
-{
-    g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (page));
-
-    ENTER("(widget %s(%p), page %p)", gtk_buildable_get_name (GTK_BUILDABLE (unused)), unused, page);
-    get_filter_times (page);
-    gnc_ppr_update_date_query (page, TRUE);
-    LEAVE(" ");
-}
-
-/** This function is called when one of the start date radio buttons
- *  is selected. It updates the sensitivity of the date entry widget,
- *  then calls a common routine to determine the start/end times and
- *  update the register query.
- *
- *  *Note: This function is actually called twice for each new radio
- *  button selection. The first time call is to uncheck the old
- *  button, and the second time to check the new button. This does
- *  make a kind of sense, as radio buttons are nothing more than
- *  linked toggle buttons where only one can be active.
- *
- *  @param radio The button whose state is changing. This will be
- *  the previously selected button the first of the pair of calls to
- *  this function, and will be the newly selected button the second
- *  time.
- *
- *  @param page A pointer to the GncPluginPageRegister2 that is
- *  associated with this filter dialog.
- */
-void
-gnc_plugin_page_register2_filter_start_cb (GtkWidget *radio,
-        GncPluginPageRegister2 *page)
-{
-    GncPluginPageRegister2Private *priv;
-    const gchar *name;
-    gboolean active;
-
-    g_return_if_fail (GTK_IS_RADIO_BUTTON (radio));
-    g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (page));
-
-    ENTER("(radio %s(%p), page %p)", gtk_buildable_get_name (GTK_BUILDABLE (radio)), radio, page);
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (page);
-    if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (radio)))
-    {
-        LEAVE("1st callback of pair. Defer to 2nd callback.");
-        return;
-    }
-
-    name = gtk_buildable_get_name (GTK_BUILDABLE (radio));
-    active = (g_strcmp0 (name, g_strdup ("start_date_choose")) == 0 ? 1 : 0 );
-    gtk_widget_set_sensitive (priv->fd.start_date, active);
-    get_filter_times (page);
-    gnc_ppr_update_date_query (page, TRUE);
-    LEAVE(" ");
-}
-
-/** This function is called when one of the end date radio buttons is
- *  selected. It updates the sensitivity of the date entry widget,
- *  then calls a common routine to determine the start/end times and
- *  update the register query.
- *
- *  *Note: This function is actually called twice for each new radio
- *  button selection. The first time call is to uncheck the old
- *  button, and the second time to check the new button. This does
- *  make a kind of sense, as radio buttons are nothing more than
- *  linked toggle buttons where only one can be active.
- *
- *  @param radio The button whose state is changing. This will be
- *  the previously selected button the first of the pair of calls to
- *  this function, and will be the newly selected button the second
- *  time.
- *
- *  @param page A pointer to the GncPluginPageRegister2 that is
- *  associated with this filter dialog.
- */
-void
-gnc_plugin_page_register2_filter_end_cb (GtkWidget *radio,
-                                        GncPluginPageRegister2 *page)
-{
-    GncPluginPageRegister2Private *priv;
-    const gchar *name;
-    gboolean active;
-
-    g_return_if_fail (GTK_IS_RADIO_BUTTON (radio));
-    g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (page));
-
-    ENTER("(radio %s(%p), page %p)", gtk_buildable_get_name (GTK_BUILDABLE (radio)), radio, page);
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (page);
-    if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (radio)))
-    {
-        LEAVE("1st callback of pair. Defer to 2nd callback.");
-        return;
-    }
-
-    name = gtk_buildable_get_name (GTK_BUILDABLE (radio));
-    active = (g_strcmp0 (name, g_strdup ("end_date_choose")) == 0 ? 1 : 0 );
-    gtk_widget_set_sensitive (priv->fd.end_date, active);
-    get_filter_times (page);
-    gnc_ppr_update_date_query (page, TRUE);
-    LEAVE(" ");
-}
-
-/** This function is called whenever the save status is checked
- *  or unchecked. It will allow saving of the filter if required.
- *
- *  @param button The toggle button that was changed.
- *
- *  @param page A pointer to the GncPluginPageRegister2 that is
- *  associated with this filter dialog.
- */
-void
-gnc_plugin_page_register2_filter_save_cb (GtkToggleButton *button,
-        GncPluginPageRegister2 *page)
-{
-    GncPluginPageRegister2Private *priv;
-
-    g_return_if_fail (GTK_IS_CHECK_BUTTON (button));
-    g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (page));
-
-    ENTER("Save toggle button (%p), plugin_page %p", button, page);
-
-    /* Compute the new save filter status */
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (page);
-    if (gtk_toggle_button_get_active (button))
-        priv->fd.save_filter = TRUE;
-    else
-        priv->fd.save_filter = FALSE;
-    LEAVE(" ");
-}
-
-/** This function is called when the "Filter By..." dialog is closed.
- *  If the dialog was closed by any method other than clicking the OK
- *  button, the original filter will be restored.
- *
- *  @param dialog A pointer to the dialog box.
- *
- *  @param response A numerical value indicating why the dialog box was closed.
- *
- *  @param page A pointer to the GncPluginPageRegister2 associated with
- *  this dialog box.
- */
-void
-gnc_plugin_page_register2_filter_response_cb (GtkDialog *dialog,
-        gint response,
-        GncPluginPageRegister2 *page)
-{
-    GncPluginPageRegister2Private *priv;
-    GncPluginPage *plugin_page;
-
-    g_return_if_fail (GTK_IS_DIALOG (dialog));
-    g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (page));
-
-    ENTER(" ");
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (page);
-    plugin_page = GNC_PLUGIN_PAGE (page);
-
-    if (response != GTK_RESPONSE_OK)
-    {
-        /* Remove the old status match */
-        priv->fd.cleared_match = priv->fd.original_cleared_match;
-        gnc_ppr_update_status_query (page, FALSE);
-        priv->fd.start_time = priv->fd.original_start_time;
-        priv->fd.end_time = priv->fd.original_end_time;
-        priv->fd.save_filter = priv->fd.original_save_filter;
-        gnc_ppr_update_date_query (page, FALSE);
-        gnc_ledger_display2_refresh (priv->ledger);
-    }
-    else
-    {
-        priv->fd.original_save_filter = priv->fd.save_filter;
-
-        if (priv->fd.save_filter)
-        {
-            gchar* filter;
-            filter = g_strdup_printf ("0x%04x", priv->fd.cleared_match);
-
-            if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->fd.start_date_choose)) && priv->fd.start_time != 0 )
-            {
-                gchar *timeval = gnc_plugin_page_register2_filter_time2dmy (priv->fd.start_time);
-                filter = g_strconcat (filter, ",", timeval, NULL);
-                g_free (timeval);
-            }
-            else
-                filter = g_strconcat (filter, ",0", NULL);
-
-            if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->fd.end_date_choose)) && priv->fd.end_time != 0 )
-            {
-                gchar *timeval = gnc_plugin_page_register2_filter_time2dmy (priv->fd.end_time);
-                filter = g_strconcat (filter, ",", timeval, NULL);
-                g_free (timeval);
-            }
-            else
-                filter = g_strconcat (filter, ",0", NULL);
-
-            PINFO("The filter to save is %s", filter);
-
-            gnc_plugin_page_register2_set_filter (plugin_page, filter);
-            g_free (filter);
-        }
-    }
-    priv->fd.dialog = NULL;
-    gtk_widget_destroy (GTK_WIDGET (dialog));
-    LEAVE(" ");
-}
-
-/*#################################################################################*/
-/*#################################################################################*/
-
-/************************************************************/
-/*                  Report Helper Functions                 */
-/************************************************************/
-
-static char *
-gnc_reg_get_name (GNCLedgerDisplay2 *ledger, gboolean for_window) // this works
-{
-    Account *leader;
-    GncTreeModelSplitReg *model;
-    gchar *account_name;
-    gchar *reg_name;
-    gchar *name;
-    GNCLedgerDisplay2Type ledger_type;
-
-    if (ledger == NULL)
-        return NULL;
-
-    model = gnc_ledger_display2_get_split_model_register (ledger);
-    ledger_type = gnc_ledger_display2_type (ledger);
-
-    switch (model->type)
-    {
-    case GENERAL_JOURNAL:
-    case INCOME_LEDGER:
-        if (for_window)
-            reg_name = _("General Journal");
-        else
-            reg_name = _("General Journal Report");
-        break;
-    case PORTFOLIO_LEDGER:
-        if (for_window)
-            reg_name = _("Portfolio");
-        else
-            reg_name = _("Portfolio Report");
-        break;
-    case SEARCH_LEDGER:
-        if (for_window)
-            reg_name = _("Search Results");
-        else
-            reg_name = _("Search Results Report");
-        break;
-    default:
-        if (for_window)
-            reg_name = _("Register");
-        else
-            reg_name = _("Register Report");
-        break;
-    }
-
-    leader = gnc_ledger_display2_leader (ledger);
-
-    if ((leader != NULL) && (ledger_type != LD2_GL))
-    {
-        account_name = gnc_account_get_full_name (leader);
-
-        if (ledger_type == LD2_SINGLE)
-        {
-            name = g_strconcat (account_name, " - ", reg_name, NULL);
-        }
-        else
-        {
-            name = g_strconcat (account_name, " ", _("and subaccounts"), " - ", reg_name, NULL);
-        }
-        g_free (account_name);
-    }
-    else
-        name = g_strdup (reg_name);
-
-    return name;
-}
-
-static int
-report_helper (GNCLedgerDisplay2 *ledger, Split *split, Query *query) //this works
-{
-    GncTreeViewSplitReg *view;
-    GncTreeModelSplitReg *model;
-    Account *account;
-    char *str;
-    const char *tmp;
-    swig_type_info * qtype;
-    SCM args;
-    SCM func;
-    SCM arg;
-
-    args = SCM_EOL;
-
-    view = gnc_ledger_display2_get_split_view_register (ledger);
-    model = gnc_ledger_display2_get_split_model_register (ledger);
-
-    func = scm_c_eval_string ("gnc:register-report-create");
-    g_return_val_if_fail (scm_is_procedure (func), -1);
-    tmp = gnc_tree_view_split_reg_get_credit_debit_string (view, TRUE);
-
-    arg = scm_from_utf8_string (tmp ? tmp : _("Credit"));
-    args = scm_cons (arg, args);
-    tmp = gnc_tree_view_split_reg_get_credit_debit_string (view, FALSE);
-    arg = scm_from_utf8_string (tmp ? tmp : _("Debit"));
-    args = scm_cons (arg, args);
-
-    str = gnc_reg_get_name (ledger, FALSE);
-    arg = scm_from_utf8_string (str ? str : "");
-    args = scm_cons (arg, args);
-    g_free (str);
-
-    arg = SCM_BOOL (model->use_double_line);
-    args = scm_cons (arg, args);
-
-    arg = SCM_BOOL (model->type == GENERAL_JOURNAL2 || model->type == INCOME_LEDGER2
-                                                   || model->type == SEARCH_LEDGER2);
-    args = scm_cons (arg, args);
-
-    arg = SCM_BOOL (model->style == REG2_STYLE_JOURNAL);
-    args = scm_cons (arg, args);
-
-    if (!query)
-    {
-        query = gnc_ledger_display2_get_query (ledger);
-        g_return_val_if_fail (query != NULL, -1);
-    }
-
-    qtype = SWIG_TypeQuery ("_p__QofQuery");
-    g_return_val_if_fail (qtype, -1);
-
-    arg = SWIG_NewPointerObj (query, qtype, 0);
-    args = scm_cons (arg, args);
-    g_return_val_if_fail (arg != SCM_UNDEFINED, -1);
-
-
-    if (split)
-    {
-        qtype = SWIG_TypeQuery ("_p_Split");
-        g_return_val_if_fail (qtype, -1);
-        arg = SWIG_NewPointerObj (split, qtype, 0);
-    }
-    else
-    {
-        arg = SCM_BOOL_F;
-    }
-    args = scm_cons (arg, args);
-    g_return_val_if_fail (arg != SCM_UNDEFINED, -1);
-
-
-    qtype = SWIG_TypeQuery ("_p_Account");
-    g_return_val_if_fail (qtype, -1);
-
-    account = gnc_ledger_display2_leader (ledger);
-    arg = SWIG_NewPointerObj (account, qtype, 0);
-    args = scm_cons (arg, args);
-    g_return_val_if_fail (arg != SCM_UNDEFINED, -1);
-
-
-    /* Apply the function to the args */
-    arg = scm_apply (func, args, SCM_EOL);
-    g_return_val_if_fail (scm_is_exact (arg), -1);
-
-    return scm_to_int (arg);
-}
-
-/*#################################################################################*/
-/*#################################################################################*/
-
-/************************************************************/
-/*                     Command callbacks                    */
-/************************************************************/
-
-static void
-gnc_plugin_page_register2_cmd_print_check (GtkAction *action,
-        GncPluginPageRegister2 *plugin_page) // this works
-{
-    GncPluginPageRegister2Private *priv;
-    GncTreeViewSplitReg *view;
-    GncTreeModelSplitReg *model;
-    Split         * split;
-    Transaction   * trans;
-    GList         * splits = NULL, *item;
-    GNCLedgerDisplay2Type ledger_type;
-    Account       * account;
-    GtkWidget     * window;
-
-    ENTER("(action %p, plugin_page %p)", action, plugin_page);
-
-    g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (plugin_page));
-
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (plugin_page);
-    view = gnc_ledger_display2_get_split_view_register (priv->ledger);
-    model = gnc_ledger_display2_get_split_model_register (priv->ledger);
-    ledger_type = gnc_ledger_display2_type (priv->ledger);
-    window = gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (plugin_page));
-
-    if (ledger_type == LD2_SINGLE || ledger_type == LD2_SUBACCOUNT)
-    {
-        account  = gnc_plugin_page_register2_get_account (plugin_page);
-        split = gnc_tree_view_split_reg_get_current_split (view);
-        trans = xaccSplitGetParent (split);
-
-        if (trans == NULL)
-        {
-            LEAVE("trans is NULL");
-            return;
-        }
-
-        /* See if we were asked to print a blank trans. */
-        if (trans == gnc_tree_control_split_reg_get_blank_trans (view))
-        {
-            LEAVE("Asked to print a blank trans");
-            return;
-        }
-
-        /* See if we are being edited in another register */
-        if (gnc_tree_control_split_reg_trans_test_for_edit (view, trans))
-        {
-            LEAVE("trans being edited in another register");
-            return;
-        }
-
-        /* Make sure we ask to commit any changes before we proceed */
-        if (gnc_tree_control_split_reg_trans_open_and_warn (view, trans))
-        {
-            LEAVE("trans being edited");
-            return;
-        }
-
-        if (split && trans)
-        {
-            if (xaccSplitGetAccount(split) == account)
-            {
-                splits = g_list_append(splits, split);
-                gnc_ui_print_check_dialog_create (window, splits);
-                g_list_free(splits);
-            }
-            else
-            {
-                /* This split is not for the account shown in this register.  Get the
-                   split for that account and use it. */
-                split = gnc_tree_model_split_reg_trans_get_split_equal_to_ancestor(trans, account);
-                if (split)
-                {
-                    splits = g_list_append(splits, split);
-                    gnc_ui_print_check_dialog_create (window, splits);
-                    g_list_free(splits);
-                }
-            }           
-        }
-    }
-    else if (ledger_type == LD2_GL && model->type == SEARCH_LEDGER2)
-    {
-        Account *common_acct = NULL;
-        splits = qof_query_run (gnc_ledger_display2_get_query (priv->ledger));
-        /* Make sure each split is from the same account */
-        for (item = splits; item; item = g_list_next (item))
-        {
-            split = (Split *) item->data;
-            if (common_acct == NULL)
-            {
-                common_acct = xaccSplitGetAccount (split);
-            }
-            else
-            {
-                if (xaccSplitGetAccount (split) != common_acct)
-                {
-                    GtkWidget *dialog;
-                    gint response;
-                    const gchar *title = _("Print checks from multiple accounts?");
-                    const gchar *message =
-                        _("This search result contains splits from more than one account. "
-                          "Do you want to print the checks even though they are not all "
-                          "from the same account?");
-                    dialog = gtk_message_dialog_new (GTK_WINDOW (window),
-                                                    GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                    GTK_MESSAGE_WARNING,
-                                                    GTK_BUTTONS_CANCEL,
-                                                    "%s", title);
-                    gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
-                            "%s", message);
-                    gtk_dialog_add_button (GTK_DIALOG (dialog), _("_Print checks"),
-                                          GTK_RESPONSE_YES);
-                    response = gnc_dialog_run (GTK_DIALOG (dialog),
-                                               GNC_PREF_WARN_CHECKPRINTING_MULTI_ACCT);
-                    gtk_widget_destroy (dialog);
-                    if (response != GTK_RESPONSE_YES)
-                    {
-                        LEAVE("Multiple accounts");
-                        return;
-                    }
-                    break;
-                }
-            }
-        }
-        gnc_ui_print_check_dialog_create (window, splits);
-    }
-    else
-    {
-        gnc_error_dialog (window, "%s",
-                         _("You can only print checks from a bank account register or search results."));
-        LEAVE("Unsupported ledger type");
-        return;
-    }
-    LEAVE(" ");
-}
-
-static void
-gnc_plugin_page_register2_cmd_cut (GtkAction *action,
-                                  GncPluginPageRegister2 *page) //this works
-{
-    GtkWidget *window, *widget;
-
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2 (page));
-
-    ENTER("(action %p, page %p)", action, page);
-
-    window = gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (page));
-    widget = gtk_window_get_focus (GTK_WINDOW (window));
-
-    DEBUG("(widget name is %s)", gtk_widget_get_name (widget));
-
-    if (GTK_IS_ENTRY(widget))
-        g_signal_emit_by_name(widget, "cut-clipboard", NULL);
-
-    LEAVE("");
-}
-
-static void
-gnc_plugin_page_register2_cmd_copy (GtkAction *action,
-                                   GncPluginPageRegister2 *page) //this works
-{
-    GtkWidget *window, *widget;
-
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2 (page));
-
-    ENTER("(action %p, page %p)", action, page);
-
-    window = gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (page));
-    widget = gtk_window_get_focus (GTK_WINDOW (window));
-
-    DEBUG("(widget name is %s)", gtk_widget_get_name (widget));
-
-    if (GTK_IS_ENTRY(widget))
-        g_signal_emit_by_name (widget, "copy-clipboard", NULL);
-
-    LEAVE("");
-}
-
-static void
-gnc_plugin_page_register2_cmd_paste (GtkAction *action,
-                                    GncPluginPageRegister2 *page) //this works
-{
-    GtkWidget *window, *widget;
-
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2 (page));
-
-    ENTER("(action %p, page %p)", action, page);
-
-    window = gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (page));
-    widget = gtk_window_get_focus (GTK_WINDOW (window));
-
-    DEBUG("(widget name is %s)", gtk_widget_get_name (widget));
-
-    if (GTK_IS_ENTRY(widget))
-        g_signal_emit_by_name (widget, "paste-clipboard", NULL);
-
-    LEAVE("");
-}
-
-static void
-gnc_plugin_page_register2_cmd_edit_account (GtkAction *action,
-        GncPluginPageRegister2 *page) //this works
-{
-    Account *account;
-
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2(page));
-
-    ENTER("(action %p, page %p)", action, page);
-    account = gnc_plugin_page_register2_get_account (page);
-    if (account)
-        gnc_ui_edit_account_window (account);
-    LEAVE(" ");
-}
-
-static void
-gnc_plugin_page_register2_cmd_find_account (GtkAction *action,
-        GncPluginPageRegister2 *page)
-{
-    GtkWidget *window;
-
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2(page));
-
-    window = gnc_plugin_page_get_window (GNC_PLUGIN_PAGE(page));
-
-    gnc_find_account_dialog (window, NULL);
-}
-
-static void
-gnc_plugin_page_register2_cmd_find_transactions (GtkAction *action,
-        GncPluginPageRegister2 *page) // this works
-{
-    GncPluginPageRegister2Private *priv;
-
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2(page));
-
-    ENTER("(action %p, page %p)", action, page);
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(page);
-
-    gnc_ui_find_transactions_dialog_create2 (priv->ledger);
-    LEAVE(" ");
-}
-
-static void
-gnc_plugin_page_register2_cmd_cut_transaction (GtkAction *action,
-        GncPluginPageRegister2 *page) // this works
-{
-    GncPluginPageRegister2Private *priv;
-    GncTreeViewSplitReg *view;
-
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2(page));
-
-    ENTER("(action %p, page %p)", action, page);
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(page);
-    view = gnc_ledger_display2_get_split_view_register (priv->ledger);
-    gnc_tree_control_split_reg_cut_trans (view);
-
-    LEAVE(" ");
-}
-
-static void
-gnc_plugin_page_register2_cmd_copy_transaction (GtkAction *action,
-        GncPluginPageRegister2 *page) // this works
-{
-    GncPluginPageRegister2Private *priv;
-    GncTreeViewSplitReg *view;
-
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2(page));
-
-    ENTER("(action %p, page %p)", action, page);
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(page);
-    view = gnc_ledger_display2_get_split_view_register (priv->ledger);
-    gnc_tree_control_split_reg_copy_trans (view);
-    LEAVE(" ");
-}
-
-static void
-gnc_plugin_page_register2_cmd_paste_transaction (GtkAction *action,
-        GncPluginPageRegister2 *page) //this works
-{
-    GncPluginPageRegister2Private *priv;
-    GncTreeViewSplitReg *view;
-
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2(page));
-
-    ENTER("(action %p, page %p)", action, page);
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(page);
-    view = gnc_ledger_display2_get_split_view_register (priv->ledger);
-    gnc_tree_control_split_reg_paste_trans (view);
-    LEAVE(" ");
-}
-
-static void
-gnc_plugin_page_register2_cmd_void_transaction (GtkAction *action,
-        GncPluginPageRegister2 *page) //this works
-{
-    GncPluginPageRegister2Private *priv;
-    GtkWidget *dialog, *entry;
-    GncTreeViewSplitReg *view;
-    Transaction *trans;
-    GtkBuilder *builder;
-    const char *reason;
-    gint result;
-
-    ENTER("(action %p, page %p)", action, page);
-
-    g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (page));
-
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (page);
-    view = gnc_ledger_display2_get_split_view_register (priv->ledger);
-    trans = gnc_tree_view_split_reg_get_current_trans (view);
-    if (trans == NULL)
-    {
-        LEAVE("trans is NULL");
-        return;
-    }
-    if (xaccTransHasSplitsInState (trans, VREC))
-    {
-        LEAVE("trans has split in VREC state");
-        return;
-    }
-    if (xaccTransHasReconciledSplits (trans) || xaccTransHasSplitsInState (trans, CREC))
-    {
-        gnc_error_dialog (NULL, "%s", _("You cannot void a transaction with reconciled or cleared splits."));
-        LEAVE("trans with reconciled splits");
-        return;
-    }
-
-    if (!gnc_plugin_page_register2_finish_pending (GNC_PLUGIN_PAGE (page)))
-    {
-        LEAVE("finish pending");
-        return;
-    }
-
-    builder = gtk_builder_new();
-    gnc_builder_add_from_file  (builder , "gnc-plugin-page-register2.glade", "void_transaction_dialog");
-    dialog = GTK_WIDGET (gtk_builder_get_object (builder, "void_transaction_dialog"));
-    entry = GTK_WIDGET (gtk_builder_get_object (builder, "reason"));
-
-    result = gtk_dialog_run (GTK_DIALOG (dialog));
-    if (result == GTK_RESPONSE_OK)
-    {
-        reason = gtk_entry_get_text (GTK_ENTRY (entry));
-        if (reason == NULL)
-            reason = "";
-        gnc_tree_control_split_reg_void_current_trans (view, reason);
-    }
-
-    /* All done. Get rid of it. */
-    gtk_widget_destroy (dialog);
-    g_object_unref (G_OBJECT(builder));
-    LEAVE(" ");
-}
-
-static void
-gnc_plugin_page_register2_cmd_unvoid_transaction (GtkAction *action,
-        GncPluginPageRegister2 *page) //this works
-{
-    GncPluginPageRegister2Private *priv;
-    GncTreeViewSplitReg *view;
-    Transaction *trans;
-
-    ENTER("(action %p, page %p)", action, page);
-
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2 (page));
-
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (page);
-    view = gnc_ledger_display2_get_split_view_register (priv->ledger);
-    trans = gnc_tree_view_split_reg_get_current_trans (view);
-    if (!xaccTransHasSplitsInState (trans, VREC))
-    {
-        LEAVE("trans has split in VREC state");
-        return;
-    }
-    gnc_tree_control_split_reg_unvoid_current_trans (view);
-    LEAVE(" ");
-}
-
-static void
-gnc_plugin_page_register2_cmd_reverse_transaction (GtkAction *action,
-        GncPluginPageRegister2 *page) //this works
-{
-    GncPluginPageRegister2Private *priv;
-    GncTreeViewSplitReg *view;
-
-    ENTER("(action %p, page %p)", action, page);
-
-    g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (page));
-
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (page);
-    view = gnc_ledger_display2_get_split_view_register (priv->ledger);
-
-    gnc_tree_control_split_reg_reverse_current (view);
-    LEAVE(" ");
-}
-
-static void
-gnc_plugin_page_register2_cmd_entryUp (GtkAction *action,
-                                       GncPluginPageRegister2 *plugin_page)
-{
-    GncPluginPageRegister2Private *priv;
-    GncTreeViewSplitReg *view;
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2(plugin_page));
-
-    ENTER("(action %p, plugin_page %p)", action, plugin_page);
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(plugin_page);
-    view = gnc_ledger_display2_get_split_view_register (priv->ledger);
-    g_return_if_fail(view);
-    gnc_tree_control_split_reg_move_current_entry_updown(view, TRUE);
-    LEAVE(" ");
-}
-
-static void
-gnc_plugin_page_register2_cmd_entryDown (GtkAction *action,
-                                         GncPluginPageRegister2 *plugin_page)
-{
-    GncPluginPageRegister2Private *priv;
-    GncTreeViewSplitReg *view;
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2(plugin_page));
-
-    ENTER("(action %p, plugin_page %p)", action, plugin_page);
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(plugin_page);
-    view = gnc_ledger_display2_get_split_view_register (priv->ledger);
-    g_return_if_fail(view);
-    gnc_tree_control_split_reg_move_current_entry_updown(view, FALSE);
-    LEAVE(" ");
-}
-
-
-/*#################################################################################*/
-/*#################################################################################*/
-
-static void
-gnc_plugin_page_register2_cmd_view_filter_by (GtkAction *action,
-        GncPluginPageRegister2 *page) //this works
-{
-    GncPluginPageRegister2Private *priv;
-    GNCLedgerDisplay2Type ledger_type;
-    GtkWidget *dialog, *toggle, *button, *table, *hbox;
-    time64 start_time, end_time, time_val;
-    GtkBuilder *builder;
-    gboolean sensitive, value;
-    Query *query;
-    gchar *title;
-    int i;
-
-    g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (page));
-    ENTER("(action %p, page %p)", action, page);
-
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (page);
-    if (priv->fd.dialog)
-    {
-        gtk_window_present (GTK_WINDOW (priv->fd.dialog));
-        LEAVE("existing dialog");
-        return;
-    }
-
-    /* Create the dialog */
-    builder = gtk_builder_new();
-    gnc_builder_add_from_file (builder, "gnc-plugin-page-register2.glade", "filter_by_dialog");
-    dialog = GTK_WIDGET (gtk_builder_get_object (builder, "filter_by_dialog"));
-    priv->fd.dialog = dialog;
-    gtk_window_set_transient_for (GTK_WINDOW (dialog),
-                                 gnc_window_get_gtk_window (GNC_WINDOW (GNC_PLUGIN_PAGE (page)->window)));
-
-    /* Translators: The %s is the name of the plugin page */
-    title = g_strdup_printf (_("Filter %s by..."),
-                            gnc_plugin_page_get_page_name (GNC_PLUGIN_PAGE (page)));
-    gtk_window_set_title (GTK_WINDOW (dialog), title);
-    g_free(title);
-
-    /* Set the check buttons for the current status */
-    for (i = 0; status_actions[i].action_name; i++)
-    {
-        toggle = GTK_WIDGET (gtk_builder_get_object (builder, status_actions[i].action_name));
-        value = priv->fd.cleared_match & status_actions[i].value;
-        status_actions[i].widget = toggle;
-        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), value);
-    }
-    priv->fd.original_cleared_match = priv->fd.cleared_match;
-
-    button = GTK_WIDGET (gtk_builder_get_object (builder, "filter_save"));
-    if (priv->fd.save_filter == TRUE)
-        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
-
-    // General Journals can not save filters so disable button.
-    ledger_type = gnc_ledger_display2_type (priv->ledger);
-    if (ledger_type == LD2_GL)
-       gtk_widget_set_sensitive (GTK_WIDGET (button), FALSE);
-
-    /* Set the date info */
-    button = GTK_WIDGET (gtk_builder_get_object (builder, "filter_show_range"));
-    query = gnc_ledger_display2_get_query (priv->ledger);
-    xaccQueryGetDateMatchTT (query, &start_time, &end_time);
-    priv->fd.original_start_time = start_time;
-    priv->fd.start_time = start_time;
-    priv->fd.original_end_time = end_time;
-    priv->fd.end_time = end_time;
-
-    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), start_time || end_time);
-    table = GTK_WIDGET (gtk_builder_get_object (builder, "select_range_table"));
-    priv->fd.table = table;
-    gtk_widget_set_sensitive (GTK_WIDGET (table), start_time || end_time);
-
-    priv->fd.start_date_choose = GTK_WIDGET (gtk_builder_get_object (builder, "start_date_choose"));
-    priv->fd.start_date_today = GTK_WIDGET (gtk_builder_get_object (builder, "start_date_today"));
-    priv->fd.end_date_choose = GTK_WIDGET (gtk_builder_get_object (builder, "end_date_choose"));
-    priv->fd.end_date_today = GTK_WIDGET (gtk_builder_get_object (builder, "end_date_today"));
-
-    {
-        /* Start date info */
-        if (start_time == 0)
-        {
-            button = GTK_WIDGET (gtk_builder_get_object (builder, "start_date_earliest"));
-            time_val = xaccQueryGetEarliestDateFound (query);
-            sensitive = FALSE;
-        }
-        else
-        {
-            time_val = start_time;
-            if ((start_time >= gnc_time64_get_today_start()) &&
-                    (start_time <= gnc_time64_get_today_end()))
-            {
-                button = priv->fd.start_date_today;
-                sensitive = FALSE;
-            }
-            else
-            {
-                button = priv->fd.start_date_choose;
-                sensitive = TRUE;
-            }
-        }
-        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
-        priv->fd.start_date = gnc_date_edit_new (gnc_time (NULL), FALSE, FALSE);
-        hbox = GTK_WIDGET (gtk_builder_get_object (builder, "start_date_hbox"));
-        gtk_box_pack_start (GTK_BOX (hbox), priv->fd.start_date, TRUE, TRUE, 0);
-        gtk_widget_show (priv->fd.start_date);
-        gtk_widget_set_sensitive (GTK_WIDGET (priv->fd.start_date), sensitive);
-        gnc_date_edit_set_time (GNC_DATE_EDIT (priv->fd.start_date), time_val);
-        g_signal_connect (G_OBJECT (priv->fd.start_date), "date-changed",
-                          G_CALLBACK (gnc_plugin_page_register2_filter_gde_changed_cb),
-                          page);
-    }
-
-    {
-        /* End date info */
-        if (end_time == 0)
-        {
-            button = GTK_WIDGET (gtk_builder_get_object (builder, "end_date_latest"));
-            time_val = xaccQueryGetLatestDateFound (query);
-            sensitive = FALSE;
-        }
-        else
-        {
-            time_val = end_time;
-            if ((end_time >= gnc_time64_get_today_start()) &&
-                    (end_time <= gnc_time64_get_today_end()))
-            {
-                button = priv->fd.end_date_today;
-                sensitive = FALSE;
-            }
-            else
-            {
-                button = priv->fd.end_date_choose;
-                sensitive = TRUE;
-            }
-        }
-        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
-        priv->fd.end_date = gnc_date_edit_new (gnc_time (NULL), FALSE, FALSE);
-        hbox = GTK_WIDGET (gtk_builder_get_object (builder, "end_date_hbox"));
-        gtk_box_pack_start (GTK_BOX (hbox), priv->fd.end_date, TRUE, TRUE, 0);
-        gtk_widget_show (priv->fd.end_date);
-        gtk_widget_set_sensitive (GTK_WIDGET (priv->fd.end_date), sensitive);
-        gnc_date_edit_set_time (GNC_DATE_EDIT (priv->fd.end_date), time_val);
-        g_signal_connect (G_OBJECT (priv->fd.end_date), "date-changed",
-                          G_CALLBACK (gnc_plugin_page_register2_filter_gde_changed_cb),
-                          page);
-    }
-
-    /* Wire it up */
-    gtk_builder_connect_signals_full (builder, gnc_builder_connect_full_func, page);
-
-    /* Show it */
-    gtk_widget_show_all (dialog);
-    g_object_unref (G_OBJECT (builder));
-    LEAVE(" ");
-}
-
-
-static void
-gnc_plugin_page_register2_cmd_reload (GtkAction *action, GncPluginPageRegister2 *plugin_page) //this works
-{
-    GncPluginPageRegister2Private *priv;
-    GncTreeViewSplitReg *view;
-
-    Transaction *trans;
-
-    ENTER("(action %p, page %p)", action, plugin_page);
-
-    g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (plugin_page));
-
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (plugin_page);
-
-    view = gnc_ledger_display2_get_split_view_register (priv->ledger);
-
-    trans = gnc_tree_view_split_reg_get_current_trans (view);
-
-    /* Make sure we ask to commit any changes before we proceed */
-    if (gnc_tree_control_split_reg_trans_open_and_warn (view, trans))
-    {
-        LEAVE("trans being edited");
-        return;
-    }
-
-    /* give gtk+ a chance to handle pending events */
-    while (gtk_events_pending ())
-        gtk_main_iteration ();
-
-    gnc_ledger_display2_refresh (priv->ledger);
-
-    LEAVE(" ");
-}
-
-/*#################################################################################*/
-/*#################################################################################*/
-
-static void
-gnc_plugin_page_register2_cmd_style_changed (GtkAction *action,
-        GtkRadioAction *current,
-        GncPluginPageRegister2 *plugin_page) //this works
-{
-    GncPluginPageRegister2Private *priv;
-    SplitRegisterStyle2 value;
-
-    ENTER("(action %p, radio action %p, plugin_page %p)",
-          action, current, plugin_page);
-
-    g_return_if_fail (GTK_IS_ACTION (action));
-    g_return_if_fail (GTK_IS_RADIO_ACTION (current));
-    g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (plugin_page));
-
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (plugin_page);
-    value = gtk_radio_action_get_current_value (current);
-    gnc_split_reg2_change_style (priv->gsr, value);
-
-    gnc_plugin_page_register2_ui_update (NULL, plugin_page);
-    LEAVE(" ");
-}
-
-static void
-gnc_plugin_page_register2_cmd_style_double_line (GtkToggleAction *action,
-        GncPluginPageRegister2 *plugin_page) // this works
-{
-    GncPluginPageRegister2Private *priv;
-    GncTreeModelSplitReg *model;
-    GncTreeViewSplitReg *view;
-    gboolean use_double_line;
-
-    ENTER("(action %p, plugin_page %p)", action, plugin_page);
-
-    g_return_if_fail (GTK_IS_ACTION (action));
-    g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (plugin_page));
-
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (plugin_page);
-    model = gnc_ledger_display2_get_split_model_register (priv->ledger);
-
-    view = gnc_ledger_display2_get_split_view_register (priv->ledger);
-
-    use_double_line = gtk_toggle_action_get_active (action);
-    if (use_double_line != model->use_double_line)
-    {
-        gnc_tree_model_split_reg_config (model, model->type, model->style, use_double_line);
-
-        // This will re-display the view.
-        gnc_tree_view_split_reg_set_format (view);
-        gnc_ledger_display2_refresh (priv->ledger);
-    }
-    LEAVE(" ");
-}
-
-static void
-gnc_plugin_page_register2_cmd_style_extra_dates (GtkToggleAction *action,
-        GncPluginPageRegister2 *plugin_page) // this works
-{
-    GncPluginPageRegister2Private *priv;
-    GncTreeViewSplitReg *view;
-    gboolean show_extra_dates;
-
-    ENTER("(action %p, plugin_page %p)", action, plugin_page);
-
-    g_return_if_fail (GTK_IS_ACTION (action));
-    g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (plugin_page));
-
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (plugin_page);
-
-    view = gnc_ledger_display2_get_split_view_register (priv->ledger);
-
-    show_extra_dates = gtk_toggle_action_get_active (action);
-    if (show_extra_dates != view->show_extra_dates)
-    {
-        view->show_extra_dates = show_extra_dates;
-        gnc_ledger_display2_refresh (priv->ledger);
-    }
-    LEAVE(" ");
-}
-
-static void
-gnc_plugin_page_register2_cmd_transfer (GtkAction *action,
-                                       GncPluginPageRegister2 *page) //this works
-{
-    Account *account;
-    GncWindow *gnc_window;
-    GtkWidget *window;
-
-    ENTER("(action %p, plugin_page %p)", action, page);
-
-    g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (page));
-
-    account = gnc_plugin_page_register2_get_account (page);
-    gnc_window = GNC_WINDOW (GNC_PLUGIN_PAGE (page)->window);
-    window = GTK_WIDGET (gnc_window_get_gtk_window (gnc_window));
-    gnc_xfer_dialog (window, account);
-    LEAVE(" ");
-}
-
-static void
-gnc_plugin_page_register2_cmd_reconcile (GtkAction *action,
-                                        GncPluginPageRegister2 *page) // this works
-{
-    GncPluginPageRegister2Private *priv;
-    GncTreeViewSplitReg *view;
-    Account *account;
-    Transaction *trans;
-    GtkWindow *window;
-    RecnWindow2 * recnData;
-
-    ENTER("(action %p, plugin_page %p)", action, page);
-
-    g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (page));
-
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (page);
-    view = gnc_ledger_display2_get_split_view_register (priv->ledger);
-
-    account = gnc_plugin_page_register2_get_account (page);
-
-    trans = gnc_tree_view_split_reg_get_current_trans (view);
-
-    /* Make sure we ask to commit any changes before we proceed */
-    if (gnc_tree_control_split_reg_trans_open_and_warn (view, trans))
-    {
-        LEAVE("trans being edited");
-        return;
-    }
-
-    window = gnc_window_get_gtk_window (GNC_WINDOW (GNC_PLUGIN_PAGE (page)->window));
-    recnData = recnWindow2 (GTK_WIDGET (window), account);
-    gnc_ui_reconcile_window2_raise (recnData);
-    LEAVE(" ");
-}
-
-static void
-gnc_plugin_page_register2_cmd_autoclear (GtkAction *action,
-                                        GncPluginPageRegister2 *page)
-{
-    Account *account;
-    GtkWindow *window;
-    AutoClearWindow * autoClearData;
-
-    ENTER("(action %p, plugin_page %p)", action, page);
-
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2(page));
-
-    account = gnc_plugin_page_register2_get_account (page);
-
-    window = gnc_window_get_gtk_window(GNC_WINDOW(GNC_PLUGIN_PAGE (page)->window));
-    autoClearData = autoClearWindow (GTK_WIDGET(window), account);
-    gnc_ui_autoclear_window_raise (autoClearData);
-    LEAVE(" ");
-}
-
-static void
-gnc_plugin_page_register2_cmd_stock_split (GtkAction *action,
-        GncPluginPageRegister2 *page) // this works
-{
-    Account *account;
-
-    ENTER("(action %p, plugin_page %p)", action, page);
-
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2(page));
-
-    account = gnc_plugin_page_register2_get_account (page);
-    gnc_stock_split_dialog (NULL, account);
-    LEAVE(" ");
-}
-
-static void
-gnc_plugin_page_register2_cmd_lots (GtkAction *action,
-                                   GncPluginPageRegister2 *page) // this works
-{
-    Account *account;
-
-    ENTER("(action %p, plugin_page %p)", action, page);
-
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2(page));
-
-    account = gnc_plugin_page_register2_get_account (page);
-    gnc_lot_viewer_dialog (account);
-    LEAVE(" ");
-}
-
-static void
-gnc_plugin_page_register2_cmd_enter_transaction (GtkAction *action,
-        GncPluginPageRegister2 *plugin_page) //this works
-{
-    GncPluginPageRegister2Private *priv;
-    GncTreeViewSplitReg *view;
-
-    ENTER("(action %p, plugin_page %p)", action, plugin_page);
-
-    g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (plugin_page));
-
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (plugin_page);
-    view = gnc_ledger_display2_get_split_view_register (priv->ledger);
-    gnc_tree_control_split_reg_enter (view);
-    LEAVE(" ");
-}
-
-static void
-gnc_plugin_page_register2_cmd_cancel_transaction (GtkAction *action,
-        GncPluginPageRegister2 *plugin_page) //this works
-{
-    GncPluginPageRegister2Private *priv;
-    GncTreeViewSplitReg *view;
-
-    ENTER("(action %p, plugin_page %p)", action, plugin_page);
-
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2 (plugin_page));
-
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (plugin_page);
-    view = gnc_ledger_display2_get_split_view_register (priv->ledger);
-    gnc_tree_control_split_reg_cancel_edit (view, FALSE);
-    LEAVE(" ");
-}
-
-static void
-gnc_plugin_page_register2_cmd_delete_transaction (GtkAction *action,
-        GncPluginPageRegister2 *plugin_page) //this works
-{
-    GncPluginPageRegister2Private *priv;
-    GncTreeViewSplitReg *view;
-
-    ENTER("(action %p, plugin_page %p)", action, plugin_page);
-
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2 (plugin_page));
-
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (plugin_page);
-    view = gnc_ledger_display2_get_split_view_register (priv->ledger);
-    gnc_tree_control_split_reg_delete (view, NULL);
-    LEAVE(" ");
-
-}
-
-static void
-gnc_plugin_page_register2_cmd_blank_transaction (GtkAction *action,
-        GncPluginPageRegister2 *plugin_page) //this works
-{
-    GncPluginPageRegister2Private *priv;
-    GncTreeViewSplitReg *view;
-
-    ENTER("(action %p, plugin_page %p)", action, plugin_page);
-
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2 (plugin_page));
-
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (plugin_page);
-    view = gnc_ledger_display2_get_split_view_register (priv->ledger);
-    gnc_tree_control_split_reg_jump_to_blank (view);
-    LEAVE(" ");
-}
-
-static void
-gnc_plugin_page_register2_cmd_duplicate_transaction (GtkAction *action,
-        GncPluginPageRegister2 *plugin_page) //this works
-{
-    GncPluginPageRegister2Private *priv;
-    GncTreeViewSplitReg *view;
-
-    ENTER("(action %p, plugin_page %p)", action, plugin_page);
-
-    g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (plugin_page));
-
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (plugin_page);
-    view = gnc_ledger_display2_get_split_view_register (priv->ledger);
-    gnc_tree_control_split_reg_duplicate_current (view);
-    LEAVE(" ");
-}
-
-static void
-gnc_plugin_page_register2_cmd_reinitialize_transaction (GtkAction *action,
-        GncPluginPageRegister2 *plugin_page) //this works
-{
-    GncPluginPageRegister2Private *priv;
-    GncTreeViewSplitReg *view;
-
-    ENTER("(action %p, plugin_page %p)", action, plugin_page);
-
-    g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (plugin_page));
-
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (plugin_page);
-    view = gnc_ledger_display2_get_split_view_register (priv->ledger);
-    gnc_tree_control_split_reg_reinit (view, NULL);
-    LEAVE(" ");
-}
-
-static void
-gnc_plugin_page_register2_cmd_expand_transaction (GtkToggleAction *action,
-        GncPluginPageRegister2 *plugin_page) // this works
-{
-    GncPluginPageRegister2Private *priv;
-    GncTreeViewSplitReg *view;
-    gboolean expand;
-
-    ENTER("(action %p, plugin_page %p)", action, plugin_page);
-
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2 (plugin_page));
-
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (plugin_page);
-    view = gnc_ledger_display2_get_split_view_register (priv->ledger);
-    expand = gtk_toggle_action_get_active (action);
-    if (expand)
-        gnc_tree_view_split_reg_expand_trans (view, NULL);
-    else
-        gnc_tree_view_split_reg_collapse_trans (view, NULL);
-    LEAVE(" ");
-}
-
-static void
-gnc_plugin_page_register2_cmd_exchange_rate (GtkAction *action,
-        GncPluginPageRegister2 *plugin_page) //this works
-{
-    GncPluginPageRegister2Private *priv;
-    GncTreeViewSplitReg *view;
-
-    ENTER("(action %p, plugin_page %p)", action, plugin_page);
-
-    g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (plugin_page));
-
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (plugin_page);
-    view = gnc_ledger_display2_get_split_view_register (priv->ledger);
-    gnc_tree_control_split_reg_exchange_rate (view);
-    LEAVE(" ");
-}
-
-static void
-gnc_plugin_page_register2_cmd_jump (GtkAction *action,
-        GncPluginPageRegister2 *plugin_page) //this works
-{
-    GncPluginPageRegister2Private *priv;
-    GncPluginPage *new_page;
-    GtkWidget *window;
-    GNCLedgerDisplay2 *ld;
-    GncTreeViewSplitReg *view, *new_view;
-    GncTreeModelSplitReg *new_model;
-    Account *account;
-    Account *leader;
-    Split *split;
-    RowDepth depth;
-
-    ENTER("(action %p, plugin_page %p)", action, plugin_page);
-
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2 (plugin_page));
-
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (plugin_page);
-    window = GNC_PLUGIN_PAGE (plugin_page)->window;
-    if (window == NULL)
-    {
-        LEAVE("no window");
-        return;
-    }
-
-    view = gnc_ledger_display2_get_split_view_register (priv->ledger);
-    split = gnc_tree_view_split_reg_get_current_split (view);
-    if (split == NULL)
-    {
-        split = gnc_tree_control_split_reg_get_current_trans_split (view);
-        if (split == NULL)
-        {
-            LEAVE("split is NULL");
-            return;
-        }
-    }
-
-    if (!gnc_tree_view_split_reg_trans_expanded (view, NULL))
-    {
-        Transaction *trans = xaccSplitGetParent (split);
-        if (xaccTransCountSplits (trans) > 2)
-        {
-            LEAVE("more than 2 splits");
-            return;
-        }
-    }
-
-    depth = gnc_tree_view_reg_get_selected_row_depth (view);
-    if (gnc_tree_view_split_reg_trans_expanded (view, NULL) && depth != SPLIT3)
-    {
-        LEAVE("expanded but no split selected");
-        return;
-    }
-
-    account = xaccSplitGetAccount (split);
-    if (account == NULL)
-    {
-        LEAVE("account is NULL");
-        return;
-    }
-
-    leader = gnc_ledger_display2_leader (priv->ledger);
-    if (account == leader)
-    {
-        split = xaccSplitGetOtherSplit (split);
-        if (split == NULL)
-        {
-            LEAVE("no other split");
-            return;
-        }
-
-        account = xaccSplitGetAccount (split);
-        if (account == NULL)
-        {
-            LEAVE("no other account");
-            return;
-        }
-
-        if (account == leader)
-        {
-            LEAVE("register open for account");
-            return;
-        }
-    }
-
-    new_page = gnc_plugin_page_register2_new (account, FALSE);
-    if (new_page == NULL)
-    {
-        LEAVE("couldn't create new page");
-        return;
-    }
-
-    gnc_main_window_open_page (GNC_MAIN_WINDOW (window), new_page);
-
-    ld = gnc_plugin_page_register2_get_ledger (new_page);
-    new_view = gnc_ledger_display2_get_split_view_register (ld);
-    new_model = gnc_ledger_display2_get_split_model_register (ld);
-
-    new_model->current_trans = xaccSplitGetParent (split);
-
-    if (!gnc_tree_model_split_reg_trans_is_in_view (new_model, xaccSplitGetParent (split)))
-        g_signal_emit_by_name (new_model, "refresh_trans");
-
-    gnc_tree_control_split_reg_jump_to (new_view, NULL, split, FALSE);
-    LEAVE(" ");
-}
-
-
-/**
- * Schedules the current transaction for recurring-entry.
- * If the selected transaction was created from a scheduled transaction,
- * opens the editor for that Scheduled Transaction.
- **/
-static void
-gnc_plugin_page_register2_cmd_schedule (GtkAction *action,
-                                       GncPluginPageRegister2 *plugin_page) // this works
-{
-    GncPluginPageRegister2Private *priv;
-    GncTreeViewSplitReg *view;
-    Transaction *trans;
-
-    ENTER("(action %p, plugin_page %p)", action, plugin_page);
-
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2(plugin_page));
-
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(plugin_page);
-    view = gnc_ledger_display2_get_split_view_register (priv->ledger);
-
-    trans = gnc_tree_view_split_reg_get_current_trans (view);
-
-    if (trans == NULL)
-    {
-        LEAVE("trans is NULL");
-        return;
-    }
-
-    /* See if we were asked to schedule a blank trans. */
-    if (trans == gnc_tree_control_split_reg_get_blank_trans (view))
-    {
-        LEAVE("Asked to schedule a blank trans");
-        return;
-    }
-
-    /* See if we are being edited in another register */
-    if (gnc_tree_control_split_reg_trans_test_for_edit (view, trans))
-    {
-        LEAVE("trans being edited in another register");
-        return;
-    }
-
-    /* Make sure we ask to commit any changes before we proceed */
-    if (gnc_tree_control_split_reg_trans_open_and_warn (view, trans))
-    {
-        LEAVE("trans being edited");
-        return;
-    }
-
-    /* If the transaction has a sched-xact KVP frame, then go to the editor
-     * for the existing SX; otherwise, do the sx-from-trans dialog. */
-    {
-	GncGUID *fromSXId = NULL;
-	SchedXaction *theSX = NULL;
-	GList *sxElts;
-	qof_instance_get (QOF_INSTANCE (trans),
-			  "from-sched-xaction", &fromSXId,
-			  NULL);
-
-	/* Get the correct SX */
-	for ( sxElts = gnc_book_get_schedxactions (gnc_get_current_book())->sx_list;
-	      (!theSX) && sxElts;
-	      sxElts = sxElts->next )
-	{
-	    SchedXaction *sx = (SchedXaction*)sxElts->data;
-	    theSX =
-		((guid_equal (xaccSchedXactionGetGUID (sx), fromSXId))
-		 ? sx : NULL);
-	}
-
-	if (theSX)
-	{
-	    gnc_ui_scheduled_xaction_editor_dialog_create2 (theSX, FALSE);
-	    LEAVE(" ");
-	    return;
-	}
-    }
-    gnc_sx_create_from_trans (trans);
-    LEAVE(" ");
-}
-
-static void
-gnc_plugin_page_register2_cmd_scrub_current (GtkAction *action,
-        GncPluginPageRegister2 *plugin_page) // this works
-{
-    GncPluginPageRegister2Private *priv;
-    GncTreeViewSplitReg *view;
-    Query *query;
-    Account *root;
-    Transaction *trans;
-
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2 (plugin_page));
-
-    ENTER("(action %p, plugin_page %p)", action, plugin_page);
-
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (plugin_page);
-    query = gnc_ledger_display2_get_query (priv->ledger);
-    if (query == NULL)
-    {
-        LEAVE("no query found");
-        return;
-    }
-
-    view = gnc_ledger_display2_get_split_view_register (priv->ledger);
-    trans = gnc_tree_view_split_reg_get_current_trans (view);
-    if (trans == NULL)
-    {
-        LEAVE("no trans found");
-        return;
-    }
-
-    gnc_suspend_gui_refresh();
-    root = gnc_get_current_root_account ();
-    xaccTransScrubOrphans (trans);
-    xaccTransScrubImbalance (trans, root, NULL);
-    gnc_resume_gui_refresh ();
-    LEAVE(" ");
-}
-
-static void
-gnc_plugin_page_register2_cmd_scrub_all (GtkAction *action,
-                                        GncPluginPageRegister2 *plugin_page) // this works
-{
-    GncPluginPageRegister2Private *priv;
-    Query *query;
-    Account *root;
-    Transaction *trans;
-    Split *split;
-    GList *node;
-
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2(plugin_page));
-
-    ENTER("(action %p, plugin_page %p)", action, plugin_page);
-
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(plugin_page);
-    query = gnc_ledger_display2_get_query( priv->ledger );
-    if (!query)
-    {
-        LEAVE("no query found");
-        return;
-    }
-
-    gnc_suspend_gui_refresh();
-    root = gnc_get_current_root_account();
-
-    for (node = qof_query_run(query); node; node = node->next)
-    {
-        split = node->data;
-        trans = xaccSplitGetParent(split);
-
-        xaccTransScrubOrphans(trans);
-        xaccTransScrubImbalance(trans, root, NULL);
-    }
-
-    gnc_resume_gui_refresh();
-    LEAVE(" ");
-}
-
-static void
-gnc_plugin_page_register2_cmd_account_report (GtkAction *action,
-        GncPluginPageRegister2 *plugin_page) // this works
-{
-    GncPluginPageRegister2Private *priv;
-    GncMainWindow *window;
-    int id;
-
-    ENTER("(action %p, plugin_page %p)", action, plugin_page);
-
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2(plugin_page));
-
-    window = GNC_MAIN_WINDOW(GNC_PLUGIN_PAGE(plugin_page)->window);
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(plugin_page);
-    id = report_helper (priv->ledger, NULL, NULL);
-    if (id >= 0)
-        gnc_main_window_open_report(id, window);
-    LEAVE(" ");
-}
-
-static void
-gnc_plugin_page_register2_cmd_transaction_report (GtkAction *action,
-        GncPluginPageRegister2 *plugin_page) // this works
-{
-    GncPluginPageRegister2Private *priv;
-    GncMainWindow *window;
-    GncTreeViewSplitReg *view;
-    Split *split;
-    Query *query;
-    int id;
-
-    ENTER("(action %p, plugin_page %p)", action, plugin_page);
-
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2 (plugin_page));
-
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (plugin_page);
-    view = gnc_ledger_display2_get_split_view_register (priv->ledger);
-
-    split = gnc_tree_view_split_reg_get_current_split (view);
-    if (!split)
-    {
-        LEAVE("split is NULL");
-        return;
-    }
-
-    query = qof_query_create_for(GNC_ID_SPLIT);
-
-    qof_query_set_book (query, gnc_get_current_book ());
-
-    xaccQueryAddGUIDMatch (query, xaccSplitGetGUID (split),
-                           GNC_ID_SPLIT, QOF_QUERY_AND);
-
-    window = GNC_MAIN_WINDOW(GNC_PLUGIN_PAGE(plugin_page)->window);
-    id = report_helper (priv->ledger, split, query);
-    if (id >= 0)
-        gnc_main_window_open_report(id, window);
-    LEAVE(" ");
-}
-
-/*#################################################################################*/
-/*#################################################################################*/
-
-/************************************************************/
-/*                    Auxiliary functions                   */
-/************************************************************/
-
-void
-gnc_plugin_page_register2_set_options (GncPluginPage *plugin_page,
-                                      gint lines_default,
-                                      gboolean read_only)
-{
-    GncPluginPageRegister2 *page;
-    GncPluginPageRegister2Private *priv;
-
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2(plugin_page));
-
-    page = GNC_PLUGIN_PAGE_REGISTER2 (plugin_page);
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(page);
-    priv->lines_default     = lines_default;
-    priv->read_only         = read_only;
-}
-
-GNCSplitReg2 *
-gnc_plugin_page_register2_get_gsr (GncPluginPage *plugin_page)
-{
-    GncPluginPageRegister2 *page;
-    GncPluginPageRegister2Private *priv;
-
-    g_return_val_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2(plugin_page), NULL);
-
-    page = GNC_PLUGIN_PAGE_REGISTER2 (plugin_page);
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(page);
-
-    return priv->gsr;
-}
-
-
-GNCLedgerDisplay2 *
-gnc_plugin_page_register2_get_ledger (GncPluginPage *plugin_page)
-{
-    GncPluginPageRegister2 *page;
-    GncPluginPageRegister2Private *priv;
-
-    g_return_val_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2(plugin_page), NULL);
-
-    page = GNC_PLUGIN_PAGE_REGISTER2 (plugin_page);
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(page);
-
-    return priv->ledger;
-}
-static void
-gnc_plugin_page_help_changed_cb (GNCSplitReg2 *gsr, GncPluginPageRegister2 *register_page) //this works
-{
-    GncPluginPageRegister2Private *priv;
-    GncTreeViewSplitReg *view;
-    GncWindow *window;
-    char *help;
-
-    g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (register_page));
-
-    window = GNC_WINDOW (GNC_PLUGIN_PAGE (register_page)->window);
-    if (!window)
-    {
-        // This routine can be called before the page is added to a
-        // window.
-        return;
-    }
-    /* Get the text from the view */
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (register_page);
-    view = gnc_ledger_display2_get_split_view_register (priv->ledger);
-    help = g_strdup (view->help_text);
-    gnc_window_set_status (window, GNC_PLUGIN_PAGE (register_page), help);
-    g_free (help);
-}
-
-static void
-gnc_plugin_page_register2_refresh_cb (GHashTable *changes, gpointer user_data) //this works
-{
-    GncPluginPageRegister2 *page = user_data;
-    GncPluginPageRegister2Private *priv;
-    GncTreeViewSplitReg *view;
-
-    g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (page));
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (page);
-    view = gnc_ledger_display2_get_split_view_register (priv->ledger);
-
-    if (changes)
-    {
-        const EventInfo* ei;
-
-        ei = gnc_gui_get_entity_events (changes, &priv->key);
-        if (ei)
-        {
-            if (ei->event_mask & QOF_EVENT_DESTROY)
-            {
-                /* Account has been deleted, close plugin page
-                 * but prevent that action from writing state information
-                 * for this deleted account
-                 */
-                g_object_set (G_OBJECT (view), "state-section", NULL, NULL);
-                gnc_main_window_close_page (GNC_PLUGIN_PAGE (page));
-                return;
-            }
-            if (ei->event_mask & QOF_EVENT_MODIFY)
-            {
-            }
-        }
-    }
-    else
-    {
-        /* Force updates */
-        gnc_tree_view_split_reg_refresh_from_prefs (view);
-    }
-    gnc_plugin_page_register2_ui_update (NULL, page);
-}
-
-static void
-gnc_plugin_page_register2_close_cb (gpointer user_data)
-{
-    GncPluginPage *plugin_page = GNC_PLUGIN_PAGE(user_data);
-    gnc_main_window_close_page (plugin_page);
-}
-
-/** This function is called when an account has been edited and an
- *  "extreme" change has been made to it.  (E.G. Changing from a
- *  credit card account to an expense account.  This rouine is
- *  responsible for finding all open registers containing the account
- *  and closing them.
- *
- *  @param account A pointer to the account that was changed.
- */
-static void
-gppr_account_destroy_cb (Account *account)
-{
-    GncPluginPageRegister2 *page;
-    GncPluginPageRegister2Private *priv;
-    GNCLedgerDisplay2Type ledger_type;
-    const GncGUID *acct_guid;
-    const GList *citem;
-    GList *item, *kill = NULL;
-
-    acct_guid = xaccAccountGetGUID(account);
-
-    /* Find all windows that need to be killed.  Don't kill them yet, as
-     * that would affect the list being walked.*/
-    citem = gnc_gobject_tracking_get_list(GNC_PLUGIN_PAGE_REGISTER2_NAME);
-    for ( ; citem; citem = g_list_next(citem))
-    {
-        page = (GncPluginPageRegister2 *)citem->data;
-        priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(page);
-        ledger_type = gnc_ledger_display2_type (priv->ledger);
-        if (ledger_type == LD2_GL)
-        {
-            kill = g_list_append(kill, page);
-            /* kill it */
-        }
-        else if ((ledger_type == LD2_SINGLE) || (ledger_type == LD2_SUBACCOUNT))
-        {
-            if (guid_compare(acct_guid, &priv->key) == 0)
-            {
-                kill = g_list_append(kill, page);
-            }
-        }
-    }
-
-    /* Now kill them. */
-    for (item = kill; item; item = g_list_next(item))
-    {
-        page = (GncPluginPageRegister2 *)item->data;
-        gnc_main_window_close_page(GNC_PLUGIN_PAGE(page));
-    }
-}
-
-/** This function is the handler for all event messages from the
- *  engine.  Its purpose is to update the register page any time
- *  an account or transaction is changed.
- *
- *  @internal
- *
- *  @param entity A pointer to the affected item.
- *
- *  @param event_type The type of the affected item.
- *
- *  @param page A pointer to the register page.
- *
- *  @param ed
- */
-static void
-gnc_plugin_page_register2_event_handler (QofInstance *entity,
-                                        QofEventId event_type,
-                                        GncPluginPageRegister2 *page,
-                                        GncEventData *ed)
-{
-    Transaction *trans;
-    QofBook *book;
-    GncPluginPage *visible_page;
-    GtkWidget *window;
-    gchar *label, *color;
-
-    g_return_if_fail(page);	/* Required */
-    if (!GNC_IS_TRANS(entity) && !GNC_IS_ACCOUNT(entity))
-        return;
-
-    ENTER("entity %p of type %d, page %p, event data %p",
-          entity, event_type, page, ed);
-
-    window = gnc_plugin_page_get_window(GNC_PLUGIN_PAGE(page));
-
-    if (GNC_IS_ACCOUNT(entity))
-    {
-        if (GNC_IS_MAIN_WINDOW(window))
-        {
-            label = gnc_plugin_page_register2_get_tab_name(GNC_PLUGIN_PAGE(page));
-            main_window_update_page_name(GNC_PLUGIN_PAGE(page), label);
-            color = gnc_plugin_page_register2_get_tab_color(GNC_PLUGIN_PAGE(page));
-            main_window_update_page_color(GNC_PLUGIN_PAGE(page), color);
-            g_free(color);
-            g_free(label);
-        }
-        LEAVE("tab name updated");
-        return;
-    }
-
-    if (!(event_type & (QOF_EVENT_MODIFY | QOF_EVENT_DESTROY)))
-    {
-        LEAVE("not a modify");
-        return;
-    }
-    trans = GNC_TRANS(entity);
-    book = qof_instance_get_book(QOF_INSTANCE(trans));
-    if (!gnc_plugin_page_has_book(GNC_PLUGIN_PAGE(page), book))
-    {
-        LEAVE("not in this book");
-        return;
-    }
-
-    if (GNC_IS_MAIN_WINDOW(window))
-    {
-        visible_page = gnc_main_window_get_current_page(GNC_MAIN_WINDOW(window));
-        if (visible_page != GNC_PLUGIN_PAGE(page))
-        {
-            LEAVE("page not visible");
-            return;
-        }
-    }
-
-    gnc_plugin_page_register2_ui_update(NULL, page);
-    LEAVE(" ");
-    return;
-}
-
-
-/** @} */
-/** @} */
diff --git a/src/gnome/gnc-split-reg.c b/src/gnome/gnc-split-reg.c
deleted file mode 100644
index 45602ff..0000000
--- a/src/gnome/gnc-split-reg.c
+++ /dev/null
@@ -1,2258 +0,0 @@
-/********************************************************************\
- * gnc-split-reg.c -- A widget for the common register look-n-feel. *
- * Copyright (C) 1997 Robin D. Clark                                *
- * Copyright (C) 1997-1998 Linas Vepstas <linas at linas.org>          *
- * Copyright (C) 1998 Rob Browning <rlb at cs.utexas.edu>              *
- * Copyright (C) 1999-2000 Dave Peticolas <dave at krondo.com>         *
- * Copyright (C) 2001 Gnumatic, Inc.                                *
- * Copyright (C) 2002,2006 Joshua Sled <jsled at asynchronous.org>     *
- *                                                                  *
- * 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 at gnu.org                   *
-\********************************************************************/
-
-#include "config.h"
-
-#include <gtk/gtk.h>
-#include <glib/gi18n.h>
-#include <time.h>
-
-#include "gnc-split-reg.h"
-
-#include "Account.h"
-#include "qof.h"
-#include "SX-book.h"
-#include "dialog-account.h"
-#include "dialog-sx-editor.h"
-#include "dialog-sx-from-trans.h"
-#include "gnc-component-manager.h"
-#include "gnc-date-edit.h"
-#include "gnc-engine.h"
-#include "gnc-euro.h"
-#include "gnc-prefs.h"
-#include "gnc-gui-query.h"
-#include "gnc-gnome-utils.h"
-#include "gnc-ledger-display.h"
-#include "gnc-pricedb.h"
-#include "gnc-ui-util.h"
-#include "gnc-ui.h"
-#include "gnome-utils/gnc-warnings.h"
-#include "gnucash-sheet.h"
-#include "gnucash-register.h"
-#include "table-allgui.h"
-
-#include "dialog-utils.h"
-
-// static QofLogModule log_module = GNC_MOD_SX;
-static QofLogModule log_module = GNC_MOD_GUI;
-
-#define STATE_SECTION_REG_PREFIX "Register"
-
-/***** PROTOTYPES ***************************************************/
-void gnc_split_reg_raise( GNCSplitReg *gsr );
-
-static GtkWidget* add_summary_label( GtkWidget *summarybar,
-                                     const char *label_str );
-
-static void gnc_split_reg_determine_read_only( GNCSplitReg *gsr );
-
-static GNCPlaceholderType gnc_split_reg_get_placeholder( GNCSplitReg *gsr );
-static GtkWidget *gnc_split_reg_get_parent( GNCLedgerDisplay *ledger );
-
-static void gsr_create_table( GNCSplitReg *gsr );
-static void gsr_setup_table( GNCSplitReg *gsr );
-static void gsr_setup_status_widgets( GNCSplitReg *gsr );
-
-static void gsr_update_summary_label( GtkWidget *label,
-                                      xaccGetBalanceFn getter,
-                                      Account *leader,
-                                      GNCPrintAmountInfo print_info,
-                                      gnc_commodity *cmdty,
-                                      gboolean reverse,
-                                      gboolean euroFlag );
-
-static void gsr_redraw_all_cb (GnucashRegister *g_reg, gpointer data);
-
-static void gnc_split_reg_ld_destroy( GNCLedgerDisplay *ledger );
-
-static Transaction* create_balancing_transaction(QofBook *book, Account *account,
-        time64 statement_date, gnc_numeric balancing_amount);
-
-void gsr_default_enter_handler    ( GNCSplitReg *w, gpointer ud );
-void gsr_default_cancel_handler   ( GNCSplitReg *w, gpointer ud );
-void gsr_default_delete_handler   ( GNCSplitReg *w, gpointer ud );
-void gsr_default_reinit_handler   ( GNCSplitReg *w, gpointer ud );
-void gsr_default_dup_handler      ( GNCSplitReg *w, gpointer ud );
-void gsr_default_schedule_handler ( GNCSplitReg *w, gpointer ud );
-void gsr_default_expand_handler   ( GNCSplitReg *w, gpointer ud );
-void gsr_default_blank_handler    ( GNCSplitReg *w, gpointer ud );
-void gsr_default_jump_handler     ( GNCSplitReg *w, gpointer ud );
-void gsr_default_cut_handler      ( GNCSplitReg *w, gpointer ud );
-void gsr_default_cut_txn_handler  ( GNCSplitReg *w, gpointer ud );
-void gsr_default_copy_handler     ( GNCSplitReg *w, gpointer ud );
-void gsr_default_copy_txn_handler ( GNCSplitReg *w, gpointer ud );
-void gsr_default_paste_handler    ( GNCSplitReg *w, gpointer ud );
-void gsr_default_paste_txn_handler( GNCSplitReg *w, gpointer ud );
-void gsr_default_void_txn_handler ( GNCSplitReg *w, gpointer ud );
-void gsr_default_unvoid_txn_handler ( GNCSplitReg *w, gpointer ud );
-void gsr_default_reverse_txn_handler ( GNCSplitReg *w, gpointer ud );
-void gsr_default_associate_handler ( GNCSplitReg *w, gboolean uri_is_file );
-void gsr_default_execassociated_handler ( GNCSplitReg *w, gpointer ud );
-
-static void gsr_emit_simple_signal( GNCSplitReg *gsr, const char *sigName );
-static void gsr_emit_help_changed( GnucashRegister *reg, gpointer user_data );
-static void gsr_emit_include_date_signal( GNCSplitReg *gsr, time64 date );
-
-void gnc_split_reg_cut_cb(GtkWidget *w, gpointer data);
-void gnc_split_reg_copy_cb(GtkWidget *w, gpointer data);
-void gnc_split_reg_paste_cb(GtkWidget *w, gpointer data);
-
-void gnc_split_reg_cut_trans_cb(GtkWidget *w, gpointer data);
-void gnc_split_reg_copy_trans_cb(GtkWidget *w, gpointer data);
-void gnc_split_reg_paste_trans_cb(GtkWidget *w, gpointer data);
-void gnc_split_reg_void_trans_cb(GtkWidget *w, gpointer data);
-void gnc_split_reg_unvoid_trans_cb(GtkWidget *w, gpointer data);
-void gnc_split_reg_reverse_trans_cb(GtkWidget *w, gpointer data);
-
-void gnc_split_reg_record_cb (GnucashRegister *reg, gpointer data);
-void gnc_split_reg_reinitialize_trans_cb(GtkWidget *w, gpointer data);
-void gnc_split_reg_delete_trans_cb(GtkWidget *w, gpointer data);
-void gnc_split_reg_duplicate_trans_cb(GtkWidget *w, gpointer data);
-void gnc_split_reg_recur_cb(GtkWidget *w, gpointer data);
-void gnc_split_reg_record_trans_cb(GtkWidget *w, gpointer data);
-void gnc_split_reg_cancel_trans_cb(GtkWidget *w, gpointer data);
-
-void gnc_split_reg_expand_trans_menu_cb(GtkWidget *widget, gpointer data);
-void gnc_split_reg_expand_trans_toolbar_cb(GtkWidget *widget, gpointer data);
-void gnc_split_reg_new_trans_cb(GtkWidget *widget, gpointer data);
-void gnc_split_reg_jump_cb(GtkWidget *widget, gpointer data);
-
-void gnc_split_reg_style_ledger_cb (GtkWidget *w, gpointer data);
-void gnc_split_reg_style_auto_ledger_cb (GtkWidget *w, gpointer data);
-void gnc_split_reg_style_journal_cb (GtkWidget *w, gpointer data);
-void gnc_split_reg_double_line_cb (GtkWidget *w, gpointer data);
-
-void gnc_split_reg_sort_standard_cb (GtkWidget *w, gpointer data);
-void gnc_split_reg_sort_date_cb (GtkWidget *w, gpointer data);
-void gnc_split_reg_sort_date_entered_cb (GtkWidget *w, gpointer data);
-void gnc_split_reg_sort_date_reconciled_cb (GtkWidget *w, gpointer data);
-void gnc_split_reg_sort_num_cb (GtkWidget *w, gpointer data);
-void gnc_split_reg_sort_amount_cb (GtkWidget *w, gpointer data);
-void gnc_split_reg_sort_memo_cb (GtkWidget *w, gpointer data);
-void gnc_split_reg_sort_desc_cb (GtkWidget *w, gpointer data);
-void gnc_split_reg_sort_action_cb (GtkWidget *w, gpointer data);
-void gnc_split_reg_sort_notes_cb (GtkWidget *w, gpointer data);
-
-
-void gnc_split_reg_destroy_cb(GtkWidget *widget, gpointer data);
-void gnc_split_reg_size_allocate( GtkWidget *widget,
-                                  GtkAllocation *allocation,
-                                  gpointer user_data );
-
-
-static void gnc_split_reg_class_init( GNCSplitRegClass *klass );
-static void gnc_split_reg_init( GNCSplitReg *gsr );
-static void gnc_split_reg_init2( GNCSplitReg *gsr );
-
-FROM_STRING_FUNC(SortType, ENUM_LIST_SORTTYPE)
-AS_STRING_FUNC(SortType, ENUM_LIST_SORTTYPE)
-
-GType
-gnc_split_reg_get_type( void )
-{
-    static GType gnc_split_reg_type = 0;
-
-    if (!gnc_split_reg_type)
-    {
-        GTypeInfo type_info =
-        {
-            sizeof(GNCSplitRegClass),      /* class_size */
-            NULL,   			/* base_init */
-            NULL,				/* base_finalize */
-            (GClassInitFunc)gnc_split_reg_class_init,
-            NULL,				/* class_finalize */
-            NULL,				/* class_data */
-            sizeof(GNCSplitReg),		/* */
-            0,				/* n_preallocs */
-            (GInstanceInitFunc)gnc_split_reg_init,
-        };
-
-        gnc_split_reg_type = g_type_register_static( GTK_TYPE_BOX,
-                             "GNCSplitReg",
-                             &type_info, 0 );
-    }
-
-    return gnc_split_reg_type;
-}
-
-/* SIGNALS */
-enum gnc_split_reg_signal_enum
-{
-    ENTER_ENT_SIGNAL,
-    CANCEL_ENT_SIGNAL,
-    DELETE_ENT_SIGNAL,
-    REINIT_ENT_SIGNAL,
-    DUP_ENT_SIGNAL,
-    SCHEDULE_ENT_SIGNAL,
-    EXPAND_ENT_SIGNAL,
-    BLANK_SIGNAL,
-    JUMP_SIGNAL,
-    CUT_SIGNAL,
-    CUT_TXN_SIGNAL,
-    COPY_SIGNAL,
-    COPY_TXN_SIGNAL,
-    PASTE_SIGNAL,
-    PASTE_TXN_SIGNAL,
-    VOID_TXN_SIGNAL,
-    UNVOID_TXN_SIGNAL,
-    REVERSE_TXN_SIGNAL,
-    HELP_CHANGED_SIGNAL,
-    INCLUDE_DATE_SIGNAL,
-    LAST_SIGNAL
-};
-
-static guint gnc_split_reg_signals[LAST_SIGNAL] = { 0 };
-
-static void
-gnc_split_reg_class_init( GNCSplitRegClass *klass )
-{
-    int i;
-    GObjectClass *object_class;
-    static struct similar_signal_info
-    {
-        enum gnc_split_reg_signal_enum s;
-        const char *signal_name;
-        guint defaultOffset;
-    } signals[] =
-    {
-        { ENTER_ENT_SIGNAL,    "enter_ent",    G_STRUCT_OFFSET( GNCSplitRegClass, enter_ent_cb ) },
-        { CANCEL_ENT_SIGNAL,   "cancel_ent",   G_STRUCT_OFFSET( GNCSplitRegClass, cancel_ent_cb ) },
-        { DELETE_ENT_SIGNAL,   "delete_ent",   G_STRUCT_OFFSET( GNCSplitRegClass, delete_ent_cb ) },
-        { REINIT_ENT_SIGNAL,   "reinit_ent",   G_STRUCT_OFFSET( GNCSplitRegClass, reinit_ent_cb ) },
-        { DUP_ENT_SIGNAL,      "dup_ent",      G_STRUCT_OFFSET( GNCSplitRegClass, dup_ent_cb ) },
-        { SCHEDULE_ENT_SIGNAL, "schedule_ent", G_STRUCT_OFFSET( GNCSplitRegClass, schedule_ent_cb ) },
-        { EXPAND_ENT_SIGNAL,   "expand_ent",   G_STRUCT_OFFSET( GNCSplitRegClass, expand_ent_cb ) },
-        { BLANK_SIGNAL,        "blank",        G_STRUCT_OFFSET( GNCSplitRegClass, blank_cb ) },
-        { JUMP_SIGNAL,         "jump",         G_STRUCT_OFFSET( GNCSplitRegClass, jump_cb ) },
-        { CUT_SIGNAL,          "cut",          G_STRUCT_OFFSET( GNCSplitRegClass, cut_cb ) },
-        { CUT_TXN_SIGNAL,      "cut_txn",      G_STRUCT_OFFSET( GNCSplitRegClass, cut_txn_cb ) },
-        { COPY_SIGNAL,         "copy",         G_STRUCT_OFFSET( GNCSplitRegClass, copy_cb ) },
-        { COPY_TXN_SIGNAL,     "copy_txn",     G_STRUCT_OFFSET( GNCSplitRegClass, copy_txn_cb ) },
-        { PASTE_SIGNAL,        "paste",        G_STRUCT_OFFSET( GNCSplitRegClass, paste_cb ) },
-        { PASTE_TXN_SIGNAL,    "paste_txn",    G_STRUCT_OFFSET( GNCSplitRegClass, paste_txn_cb ) },
-        { VOID_TXN_SIGNAL,     "void_txn",     G_STRUCT_OFFSET( GNCSplitRegClass, void_txn_cb ) },
-        { UNVOID_TXN_SIGNAL,   "unvoid_txn",   G_STRUCT_OFFSET( GNCSplitRegClass, unvoid_txn_cb ) },
-        { REVERSE_TXN_SIGNAL,  "reverse_txn",  G_STRUCT_OFFSET( GNCSplitRegClass, reverse_txn_cb ) },
-        { HELP_CHANGED_SIGNAL, "help-changed", G_STRUCT_OFFSET( GNCSplitRegClass, help_changed_cb ) },
-        { INCLUDE_DATE_SIGNAL, "include-date", G_STRUCT_OFFSET( GNCSplitRegClass, include_date_cb ) },
-        { LAST_SIGNAL, NULL, 0 }
-    };
-
-    object_class = (GObjectClass*) klass;
-
-    for ( i = 0; signals[i].s != INCLUDE_DATE_SIGNAL; i++ )
-    {
-        gnc_split_reg_signals[ signals[i].s ] =
-            g_signal_new( signals[i].signal_name,
-                          G_TYPE_FROM_CLASS(object_class),
-                          G_SIGNAL_RUN_LAST,
-                          signals[i].defaultOffset,
-                          NULL, NULL,
-                          g_cclosure_marshal_VOID__VOID,
-                          G_TYPE_NONE, 0 );
-    }
-    /* Setup the non-default-marshalled signals; 'i' is still valid, here. */
-    /* "include-date" */
-    gnc_split_reg_signals[ INCLUDE_DATE_SIGNAL ] =
-        g_signal_new( "include-date",
-                      G_TYPE_FROM_CLASS(object_class),
-                      G_SIGNAL_RUN_LAST,
-                      signals[i++].defaultOffset,
-                      NULL, NULL,
-                      g_cclosure_marshal_VOID__INT, /* time64 == int */
-                      G_TYPE_NONE, 1, G_TYPE_INT );
-
-    g_assert( i == LAST_SIGNAL );
-
-    /* Setup the default handlers. */
-    klass->enter_ent_cb    = gsr_default_enter_handler;
-    klass->cancel_ent_cb   = gsr_default_cancel_handler;
-    klass->delete_ent_cb   = gsr_default_delete_handler;
-    klass->reinit_ent_cb   = gsr_default_reinit_handler;
-    klass->dup_ent_cb      = gsr_default_dup_handler;
-    klass->schedule_ent_cb = gsr_default_schedule_handler;
-    klass->expand_ent_cb   = gsr_default_expand_handler;
-    klass->blank_cb        = gsr_default_blank_handler;
-    klass->jump_cb         = gsr_default_jump_handler;
-    klass->cut_cb          = gsr_default_cut_handler;
-    klass->cut_txn_cb      = gsr_default_cut_txn_handler;
-    klass->copy_cb         = gsr_default_copy_handler;
-    klass->copy_txn_cb     = gsr_default_copy_txn_handler;
-    klass->paste_cb        = gsr_default_paste_handler;
-    klass->paste_txn_cb    = gsr_default_paste_txn_handler;
-    klass->void_txn_cb     = gsr_default_void_txn_handler;
-    klass->unvoid_txn_cb   = gsr_default_unvoid_txn_handler;
-    klass->reverse_txn_cb  = gsr_default_reverse_txn_handler;
-
-    klass->help_changed_cb = NULL;
-    klass->include_date_cb = NULL;
-}
-
-GtkWidget*
-gnc_split_reg_new( GNCLedgerDisplay *ld,
-                   GtkWindow *parent,
-                   gint numberOfLines,
-                   gboolean read_only )
-{
-    GNCSplitReg *gsrToRet;
-
-    ENTER("ld=%p, parent=%p, numberOfLines=%d, read_only=%s",
-          ld, parent, numberOfLines, read_only ? "TRUE" : "FALSE");
-
-    gsrToRet = g_object_new( gnc_split_reg_get_type(), NULL );
-
-    gsrToRet->numRows        = numberOfLines;
-    gsrToRet->read_only      = read_only;
-
-    gsrToRet->ledger = ld;
-    gsrToRet->window = GTK_WIDGET(parent);
-
-    gnc_split_reg_init2( gsrToRet );
-
-    LEAVE("%p", gsrToRet);
-    return GTK_WIDGET( gsrToRet );
-}
-
-static void
-gnc_split_reg_init( GNCSplitReg *gsr )
-{
-    gtk_orientable_set_orientation (GTK_ORIENTABLE(gsr), GTK_ORIENTATION_VERTICAL);
-
-    gsr->sort_type = BY_STANDARD;
-    gsr->width = -1;
-    gsr->height = -1;
-    gsr->numRows = 10;
-    gsr->read_only = FALSE;
-
-    g_signal_connect( gsr, "destroy",
-                      G_CALLBACK (gnc_split_reg_destroy_cb), gsr );
-}
-
-static void
-gnc_split_reg_init2( GNCSplitReg *gsr )
-{
-    if ( !gsr ) return;
-
-    gnc_split_reg_determine_read_only( gsr );
-
-    gsr_setup_status_widgets( gsr );
-    /* ordering is important here... setup_status before create_table */
-    gsr_create_table( gsr );
-    gsr_setup_table( gsr );
-}
-
-static
-void
-gsr_setup_table( GNCSplitReg *gsr )
-{
-    SplitRegister *sr;
-
-    ENTER("gsr=%p", gsr);
-
-    sr = gnc_ledger_display_get_split_register( gsr->ledger );
-    gnc_split_register_show_present_divider( sr, TRUE );
-    /* events should be sufficient to redraw this */
-    /* gnc_ledger_display_refresh( gsr->ledger ); */
-
-    LEAVE(" ");
-}
-
-static
-void
-gsr_create_table( GNCSplitReg *gsr )
-{
-    GtkWidget *register_widget = NULL;
-    SplitRegister *sr = NULL;
-
-    Account * account = gnc_ledger_display_leader(gsr->ledger);
-    const GncGUID * guid = xaccAccountGetGUID(account);
-    gchar guidstr[GUID_ENCODING_LENGTH+1];
-    gchar *state_section = NULL;
-    guid_to_string_buff(guid, guidstr);
-    state_section = g_strconcat (STATE_SECTION_REG_PREFIX, " ", guidstr, NULL);
-
-    ENTER("gsr=%p", gsr);
-
-    gnc_ledger_display_set_user_data( gsr->ledger, (gpointer)gsr );
-    gnc_ledger_display_set_handlers( gsr->ledger,
-                                     gnc_split_reg_ld_destroy,
-                                     gnc_split_reg_get_parent );
-
-    /* FIXME: We'd really rather pass this down... */
-    sr = gnc_ledger_display_get_split_register( gsr->ledger );
-    register_widget = gnucash_register_new( sr->table, state_section );
-    gsr->reg = GNUCASH_REGISTER( register_widget );
-    g_free (state_section);
-    gtk_box_pack_start (GTK_BOX (gsr), GTK_WIDGET(gsr->reg), TRUE, TRUE, 0);
-    gnucash_sheet_set_window (gnucash_register_get_sheet (gsr->reg), gsr->window);
-    gtk_widget_show ( GTK_WIDGET(gsr->reg) );
-    g_signal_connect (gsr->reg, "activate_cursor",
-                      G_CALLBACK(gnc_split_reg_record_cb), gsr);
-    g_signal_connect (gsr->reg, "redraw_all",
-                      G_CALLBACK(gsr_redraw_all_cb), gsr);
-    g_signal_connect (gsr->reg, "redraw_help",
-                      G_CALLBACK(gsr_emit_help_changed), gsr);
-
-    LEAVE(" ");
-}
-
-static
-void
-gsr_setup_status_widgets( GNCSplitReg *gsr )
-{
-    SplitRegister *sr;
-    gboolean use_double_line;
-
-    sr = gnc_ledger_display_get_split_register( gsr->ledger );
-    use_double_line = gnc_ledger_display_default_double_line( gsr->ledger );
-
-    /* be sure to initialize the gui elements associated with the cursor */
-    gnc_split_register_config( sr, sr->type, sr->style, use_double_line );
-}
-
-void
-gnc_split_reg_destroy_cb(GtkWidget *widget, gpointer data)
-{
-}
-
-/**
- * Raise an existing register window to the front.
- **/
-void
-gnc_split_reg_raise( GNCSplitReg *gsr )
-{
-    if (gsr == NULL)
-        return;
-
-    if (gsr->window == NULL)
-        return;
-
-    gtk_window_present( GTK_WINDOW(gsr->window) );
-}
-
-
-/**
- * Duplicate-code reduction function; retreives, formats and updates the
- * GtkLabel with the given amount.
- **/
-static
-void
-gsr_update_summary_label( GtkWidget *label,
-                          xaccGetBalanceFn getter,
-                          Account *leader,
-                          GNCPrintAmountInfo print_info,
-                          gnc_commodity *cmdty,
-                          gboolean reverse,
-                          gboolean euroFlag )
-{
-    gnc_numeric amount;
-    char string[256];
-
-    if ( label == NULL )
-        return;
-
-    amount = (*getter)( leader );
-
-    if ( reverse )
-    {
-        amount = gnc_numeric_neg( amount );
-    }
-
-    xaccSPrintAmount( string, amount, print_info );
-
-    if ( euroFlag )
-    {
-        strcat( string, " / " );
-        xaccSPrintAmount( string + strlen( string ),
-                          gnc_convert_to_euro( cmdty, amount ),
-                          gnc_commodity_print_info( gnc_get_euro(), TRUE ) );
-    }
-
-    gnc_set_label_color( label, amount );
-    gtk_label_set_text( GTK_LABEL(label), string );
-}
-
-static
-void
-gsr_redraw_all_cb (GnucashRegister *g_reg, gpointer data)
-{
-    GNCSplitReg *gsr = data;
-    gnc_commodity * commodity;
-    GNCPrintAmountInfo print_info;
-    gnc_numeric amount;
-    Account *leader;
-    gboolean reverse;
-    gboolean euro;
-
-    if ( gsr->summarybar == NULL )
-        return;
-
-    leader = gnc_ledger_display_leader( gsr->ledger );
-
-    commodity = xaccAccountGetCommodity( leader );
-
-    /* no EURO converson, if account is already EURO or no EURO currency */
-    if (commodity != NULL)
-        euro = (gnc_is_euro_currency( commodity ) &&
-                (strncasecmp(gnc_commodity_get_mnemonic(commodity), "EUR", 3)));
-    else
-        euro = FALSE;
-
-    print_info = gnc_account_print_info( leader, TRUE );
-    reverse = gnc_reverse_balance( leader );
-
-    gsr_update_summary_label( gsr->balance_label,
-                              xaccAccountGetPresentBalance,
-                              leader, print_info, commodity, reverse, euro );
-    gsr_update_summary_label( gsr->cleared_label,
-                              xaccAccountGetClearedBalance,
-                              leader, print_info, commodity, reverse, euro );
-    gsr_update_summary_label( gsr->reconciled_label,
-                              xaccAccountGetReconciledBalance,
-                              leader, print_info, commodity, reverse, euro );
-    gsr_update_summary_label( gsr->future_label,
-                              xaccAccountGetBalance,
-                              leader, print_info, commodity, reverse, euro );
-    gsr_update_summary_label( gsr->projectedminimum_label,
-                              xaccAccountGetProjectedMinimumBalance,
-                              leader, print_info, commodity, reverse, euro );
-    if (gsr->shares_label == NULL && gsr->value_label == NULL)
-        return;
-    amount = xaccAccountGetBalance( leader );
-    if (reverse)
-        amount = gnc_numeric_neg( amount );
-
-   /* Print the summary share amount */
-    if (gsr->shares_label != NULL)
-    {
-        char string[256];
-        print_info = gnc_account_print_info( leader, TRUE );
-        xaccSPrintAmount( string, amount, print_info );
-        gnc_set_label_color( gsr->shares_label, amount );
-        gtk_label_set_text( GTK_LABEL(gsr->shares_label), string );
-    }
-
-    /* Print the summary share value */
-    if (gsr->value_label != NULL)
-    {
-        char string[256];
-        QofBook *book = gnc_account_get_book (leader);
-        GNCPriceDB *pricedb = gnc_pricedb_get_db (book);
-        gnc_commodity *currency = gnc_default_currency ();
-        print_info = gnc_commodity_print_info (currency, TRUE);
-        xaccSPrintAmount (string, amount, print_info);
-        gnc_set_label_color (gsr->value_label, amount);
-        gtk_label_set_text (GTK_LABEL (gsr->value_label), string);
-
-    }
-}
-
-static void
-gnc_split_reg_ld_destroy( GNCLedgerDisplay *ledger )
-{
-    GNCSplitReg *gsr = gnc_ledger_display_get_user_data( ledger );
-
-    Account * account = gnc_ledger_display_leader(ledger);
-    const GncGUID * guid = xaccAccountGetGUID(account);
-    gchar guidstr[GUID_ENCODING_LENGTH+1];
-    gchar *state_section;
-
-    guid_to_string_buff(guid, guidstr);
-
-    state_section = g_strconcat (STATE_SECTION_REG_PREFIX, " ", guidstr, NULL);
-
-    if (gsr)
-    {
-        SplitRegister *reg;
-
-        reg = gnc_ledger_display_get_split_register (ledger);
-
-        if (reg && reg->table)
-            gnc_table_save_state (reg->table, state_section);
-
-        /*
-         * Don't destroy the window here any more.  The register no longer
-         * owns it.
-         */
-    }
-    g_free (state_section);
-    gnc_ledger_display_set_user_data (ledger, NULL);
-}
-
-void
-gsr_default_cut_handler( GNCSplitReg *gsr, gpointer data )
-{
-    gnucash_register_cut_clipboard( gsr->reg );
-}
-
-/**
- * Cut the selection to the clipboard.  This refers to the Split.
- **/
-void
-gnc_split_reg_cut_cb (GtkWidget *w, gpointer data)
-{
-    GNCSplitReg *gsr = data;
-    gsr_emit_simple_signal( gsr, "cut" );
-}
-
-void
-gsr_default_copy_handler( GNCSplitReg *gsr, gpointer data )
-{
-    gnucash_register_copy_clipboard( gsr->reg );
-}
-
-/**
- * Copy the selection to the clipboard.  This refers to the Split.
- **/
-void
-gnc_split_reg_copy_cb (GtkWidget *w, gpointer data)
-{
-    GNCSplitReg *gsr = data;
-    gsr_emit_simple_signal( gsr, "copy" );
-}
-
-void
-gsr_default_paste_handler( GNCSplitReg *gsr, gpointer data )
-{
-    gnucash_register_paste_clipboard( gsr->reg );
-}
-
-/**
- * Paste the clipboard to the selection.  This refers to the Split.
- **/
-void
-gnc_split_reg_paste_cb (GtkWidget *w, gpointer data)
-{
-    GNCSplitReg *gsr = data;
-    gsr_emit_simple_signal( gsr, "paste" );
-}
-
-void
-gsr_default_cut_txn_handler( GNCSplitReg *gsr, gpointer data )
-{
-    gnc_split_register_cut_current
-    (gnc_ledger_display_get_split_register( gsr->ledger ));
-}
-
-/**
- * Cut the current transaction  to the clipboard.
- **/
-void
-gnc_split_reg_cut_trans_cb (GtkWidget *w, gpointer data)
-{
-    GNCSplitReg *gsr = data;
-    gsr_emit_simple_signal( gsr, "cut_txn" );
-}
-
-void
-gsr_default_copy_txn_handler( GNCSplitReg *gsr, gpointer data )
-{
-    gnc_split_register_copy_current
-    (gnc_ledger_display_get_split_register( gsr->ledger ));
-}
-
-/**
- * Copy the current transaction to the clipboard.
- **/
-void
-gnc_split_reg_copy_trans_cb(GtkWidget *w, gpointer data)
-{
-    GNCSplitReg *gsr = data;
-    gsr_emit_simple_signal( gsr, "copy_txn" );
-}
-
-void
-gsr_default_paste_txn_handler( GNCSplitReg *gsr, gpointer data )
-{
-    gnc_split_register_paste_current
-    (gnc_ledger_display_get_split_register( gsr->ledger ));
-}
-
-/**
- * Paste the transaction clipboard to the selection.
- **/
-void
-gnc_split_reg_paste_trans_cb (GtkWidget *w, gpointer data)
-{
-    GNCSplitReg *gsr = data;
-    gsr_emit_simple_signal( gsr, "paste_txn" );
-}
-
-/********************************************************************\
- * gnc_split_reg_void_trans_cb                                      *
- *                                                                  *
- * Args:   widget - the widget that called us                       *
- *         data   - the data struct for this register               *
- * Return: none                                                     *
-\********************************************************************/
-void
-gsr_default_void_txn_handler (GNCSplitReg *gsr, gpointer data)
-{
-    // Override this function.
-}
-
-void
-gnc_split_reg_void_trans_cb (GtkWidget *w, gpointer data)
-{
-    GNCSplitReg *gsr = data;
-    gsr_emit_simple_signal( gsr, "void_txn" );
-}
-
-/********************************************************************\
- * gnc_split_reg_unvoid_trans_cb                                      *
- *                                                                  *
- * Args:   widget - the widget that called us                       *
- *         data   - the data struct for this register               *
- * Return: none                                                     *
-\********************************************************************/
-void
-gsr_default_unvoid_txn_handler (GNCSplitReg *gsr, gpointer data)
-{
-    // Override this function.
-}
-
-void
-gnc_split_reg_unvoid_trans_cb (GtkWidget *w, gpointer data)
-{
-    GNCSplitReg *gsr = data;
-    gsr_emit_simple_signal( gsr, "unvoid_txn" );
-}
-
-/********************************************************************\
- * gnc_split_reg_reverse_trans_cb                                   *
- *                                                                  *
- * Args:   widget - the widget that called us                       *
- *         data   - the data struct for this register               *
- * Return: none                                                     *
-\********************************************************************/
-void
-gsr_default_reverse_txn_handler (GNCSplitReg *gsr, gpointer data)
-{
-    SplitRegister *reg;
-    Transaction *trans, *new_trans;
-
-    reg = gnc_ledger_display_get_split_register( gsr->ledger );
-    trans = gnc_split_register_get_current_trans (reg);
-    if (trans == NULL)
-        return;
-
-    if (xaccTransGetReversedBy(trans))
-    {
-        gnc_error_dialog(gsr->window, "%s",
-                         _("A reversing entry has already been created for this transaction."));
-        return;
-    }
-
-    new_trans = xaccTransReverse(trans);
-
-    /* Clear transaction level info */
-    xaccTransSetDatePostedSecsNormalized(new_trans, gnc_time (NULL));
-    xaccTransSetDateEnteredSecs(new_trans, gnc_time (NULL));
-
-    /* Now jump to new trans */
-    gnc_split_reg_jump_to_split(gsr, xaccTransGetSplit(new_trans, 0));
-}
-
-void
-gnc_split_reg_reverse_trans_cb (GtkWidget *w, gpointer data)
-{
-    GNCSplitReg *gsr = data;
-    gsr_emit_simple_signal( gsr, "reverse_txn" );
-}
-
-
-static gboolean
-is_trans_readonly_and_warn (const Transaction *trans)
-{
-    GtkWidget *dialog;
-    const gchar *reason;
-    const gchar *title = _("Cannot modify or delete this transaction.");
-    const gchar *message =
-        _("This transaction is marked read-only with the comment: '%s'");
-
-    if (!trans) return FALSE;
-
-    if (xaccTransIsReadonlyByPostedDate (trans))
-    {
-        dialog = gtk_message_dialog_new(NULL,
-                                        0,
-                                        GTK_MESSAGE_ERROR,
-                                        GTK_BUTTONS_OK,
-                                        "%s", title);
-        gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
-                "%s", _("The date of this transaction is older than the \"Read-Only Threshold\" set for this book. "
-                        "This setting can be changed in File -> Properties -> Accounts."));
-        gtk_dialog_run(GTK_DIALOG(dialog));
-        gtk_widget_destroy(dialog);
-        return TRUE;
-    }
-
-    reason = xaccTransGetReadOnly (trans);
-    if (reason)
-    {
-        dialog = gtk_message_dialog_new(NULL,
-                                        0,
-                                        GTK_MESSAGE_ERROR,
-                                        GTK_BUTTONS_OK,
-                                        "%s", title);
-        gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
-                message, reason);
-        gtk_dialog_run(GTK_DIALOG(dialog));
-        gtk_widget_destroy(dialog);
-        return TRUE;
-    }
-    return FALSE;
-}
-
-
-void
-gsr_default_reinit_handler( GNCSplitReg *gsr, gpointer data )
-{
-    VirtualCellLocation vcell_loc;
-    SplitRegister *reg;
-    Transaction *trans;
-    Split *split;
-    GtkWidget *dialog;
-    gint response;
-    const gchar *warning;
-
-    const char *title = _("Remove the splits from this transaction?");
-    const char *recn_warn = _("This transaction contains reconciled splits. "
-                              "Modifying it is not a good idea because that will "
-                              "cause your reconciled balance to be off.");
-
-    reg = gnc_ledger_display_get_split_register( gsr->ledger );
-
-    trans = gnc_split_register_get_current_trans (reg);
-    if (is_trans_readonly_and_warn(trans))
-        return;
-    dialog = gtk_message_dialog_new(GTK_WINDOW(gsr->window),
-                                    GTK_DIALOG_DESTROY_WITH_PARENT,
-                                    GTK_MESSAGE_WARNING,
-                                    GTK_BUTTONS_NONE,
-                                    "%s", title);
-    if (xaccTransHasReconciledSplits (trans))
-    {
-        gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
-                "%s", recn_warn);
-        warning = GNC_PREF_WARN_REG_SPLIT_DEL_ALL_RECD;
-    }
-    else
-    {
-        warning = GNC_PREF_WARN_REG_SPLIT_DEL_ALL;
-    }
-
-    gtk_dialog_add_button(GTK_DIALOG(dialog),
-                          _("_Cancel"), GTK_RESPONSE_CANCEL);
-    gnc_gtk_dialog_add_button(dialog, _("_Remove Splits"),
-                              "edit-delete", GTK_RESPONSE_ACCEPT);
-    response = gnc_dialog_run(GTK_DIALOG(dialog), warning);
-    gtk_widget_destroy (dialog);
-    if (response != GTK_RESPONSE_ACCEPT)
-        return;
-
-    /*
-     * Find the "transaction" split for the current transaction. This is
-     * the split that appears at the top of the transaction in the
-     * register.
-     */
-    split = gnc_split_register_get_current_split (reg);
-    if (!gnc_split_register_get_split_virt_loc(reg, split, &vcell_loc))
-        return;
-    split = gnc_split_register_get_current_trans_split (reg, &vcell_loc);
-    gnc_split_register_empty_current_trans_except_split (reg, split);
-}
-
-/**
- * "Reinitializes" the current transaction.
- **/
-void
-gnc_split_reg_reinitialize_trans_cb(GtkWidget *widget, gpointer data)
-{
-    GNCSplitReg *gsr = data;
-    gsr_emit_simple_signal( gsr, "reinit_ent" );
-}
-
-static void
-gsr_default_associate_handler_file (GNCSplitReg *gsr, Transaction *trans, gboolean have_uri)
-{
-    GtkWidget *dialog;
-    gint       response;
-    gboolean   valid_path_head = FALSE;
-    gchar     *path_head = gnc_prefs_get_string (GNC_PREFS_GROUP_GENERAL, "assoc-head");
-
-    dialog = gtk_file_chooser_dialog_new (_("Associate File with Transaction"),
-                                     GTK_WINDOW(gsr->window),
-                                     GTK_FILE_CHOOSER_ACTION_OPEN,
-                                     _("_Remove"), GTK_RESPONSE_REJECT,
-                                     _("_Cancel"), GTK_RESPONSE_CANCEL,
-                                     _("_OK"), GTK_RESPONSE_ACCEPT,
-                                     NULL);
-
-    gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER(dialog), FALSE);
-
-    if ((path_head != NULL) && (g_strcmp0 (path_head, "") != 0)) // not default entry
-        valid_path_head = TRUE;
-
-    if (have_uri)
-    {
-        gchar *new_uri;
-        gchar *uri_label;
-        gchar *filename;
-
-        const gchar *uri = xaccTransGetAssociation (trans);
-
-        if (valid_path_head && g_str_has_prefix (uri,"file:/") && !g_str_has_prefix (uri,"file://")) 
-        {
-            const gchar *part = uri + strlen ("file:");
-            new_uri = g_strconcat (path_head, part, NULL);
-        }
-        else
-            new_uri = g_strdup (uri);
-
-        filename = g_uri_unescape_string (new_uri, NULL);
-        uri_label = g_strconcat (_("Existing Association is "), filename, NULL);
-        gtk_file_chooser_set_extra_widget (GTK_FILE_CHOOSER(dialog), gtk_label_new (uri_label));
-        gtk_file_chooser_set_uri (GTK_FILE_CHOOSER(dialog), new_uri);
-
-        g_free (uri_label);
-        g_free (new_uri);
-        g_free (filename);
-    }
-    response = gtk_dialog_run (GTK_DIALOG (dialog));
-
-    if (response == GTK_RESPONSE_REJECT)
-        xaccTransSetAssociation (trans, "");
-
-    if (response == GTK_RESPONSE_ACCEPT)
-    {
-	gchar *dialog_uri = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (dialog));
-
-        PINFO("Dialog File URI: %s\n", dialog_uri);
-
-        if (valid_path_head && g_str_has_prefix (dialog_uri, path_head))
-        {
-            gchar *part = dialog_uri + strlen (path_head);
-            gchar *new_uri = g_strconcat ("file:", part, NULL);
-            xaccTransSetAssociation (trans, new_uri);
-            g_free (new_uri);
-        }
-        else
-            xaccTransSetAssociation (trans, dialog_uri);
-
-        g_free (dialog_uri);
-    }
-    g_free (path_head);
-    gtk_widget_destroy (dialog);
-}
-
-static void
-gsr_default_associate_handler_location (GNCSplitReg *gsr, Transaction *trans, gboolean have_uri)
-{
-    GtkWidget *dialog, *entry, *label, *content_area;
-    gint response;
-
-    dialog = gtk_dialog_new_with_buttons (_("Associate Location with Transaction"),
-                                     GTK_WINDOW(gsr->window),
-                                     GTK_DIALOG_MODAL,
-                                     _("_Remove"), GTK_RESPONSE_REJECT,
-                                     _("_Cancel"), GTK_RESPONSE_CANCEL,
-                                     _("_OK"), GTK_RESPONSE_ACCEPT,
-                                     NULL);
-
-    content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
-
-    // add the entry text
-    entry = gtk_entry_new ();
-    gtk_entry_set_width_chars (GTK_ENTRY (entry), 80);
-    gtk_entry_set_activates_default (GTK_ENTRY (entry), TRUE);
-
-    // add a label and set entry text if required
-    if (have_uri)
-    {
-        label = gtk_label_new (_("Amend URL:"));
-        gtk_entry_set_text (GTK_ENTRY (entry), xaccTransGetAssociation (trans));
-    }
-    else
-        label = gtk_label_new (_("Enter URL:"));
-
-    // pack label and entry to content area
-    gnc_label_set_alignment (label, 0.0, 0.5);
-    gtk_container_add (GTK_CONTAINER (content_area), label);
-    gtk_container_add (GTK_CONTAINER (content_area), entry);
-
-    // set spacings
-    gtk_container_set_border_width (GTK_CONTAINER (dialog), 12);
-
-    // set the default response
-    gtk_dialog_set_default_response (GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT);
-
-    gtk_widget_show_all (dialog);
-
-    // run the dialog
-    response = gtk_dialog_run (GTK_DIALOG (dialog));
-
-    if (response == GTK_RESPONSE_REJECT)
-        xaccTransSetAssociation (trans, "");
-
-    if (response == GTK_RESPONSE_ACCEPT)
-    {
-        const gchar *dialog_uri = gtk_entry_get_text (GTK_ENTRY (entry));
-        DEBUG("Location URI: %s\n", dialog_uri);
-        xaccTransSetAssociation (trans, dialog_uri);
-    }
-    gtk_widget_destroy (dialog);
-}
-
-/**
- * Associates a URI with the current transaction.
- **/
-void
-gsr_default_associate_handler (GNCSplitReg *gsr, gboolean uri_is_file)
-{
-    SplitRegister *reg = gnc_ledger_display_get_split_register (gsr->ledger);
-    Split *split = gnc_split_register_get_current_split (reg);
-    Transaction *trans;
-    CursorClass cursor_class;
-    const gchar *uri;
-    gboolean have_uri = FALSE;
-
-    /* get the current split based on cursor position */
-    if (split == NULL)
-    {
-        gnc_split_register_cancel_cursor_split_changes (reg);
-        return;
-    }
-
-    trans = xaccSplitGetParent (split);
-    cursor_class = gnc_split_register_get_current_cursor_class (reg);
-
-    if (cursor_class == CURSOR_CLASS_NONE)
-        return;
-
-    if (is_trans_readonly_and_warn (trans))
-        return;
-
-    // get the existing uri
-    uri = xaccTransGetAssociation (trans);
-
-    // Check for uri is empty or NULL
-    if (g_strcmp0 (uri, "") != 0 && g_strcmp0 (uri, NULL) != 0)
-    {
-        have_uri = TRUE;
-
-        if (g_str_has_prefix (uri, "file:")) // use the correct dialog
-            uri_is_file = TRUE;
-        else
-            uri_is_file = FALSE;
-    }
-
-    if (uri_is_file == TRUE)
-        gsr_default_associate_handler_file (gsr, trans, have_uri);
-    else
-        gsr_default_associate_handler_location (gsr, trans, have_uri);
-}
-
-/**
- * Executes the associated link with the current transaction.
- **/
-void
-gsr_default_execassociated_handler (GNCSplitReg *gsr, gpointer data)
-{
-    CursorClass cursor_class;
-    SplitRegister *reg = gnc_ledger_display_get_split_register (gsr->ledger);
-    Transaction *trans;
-    Split *split = gnc_split_register_get_current_split (reg);
-    const char *uri;
-    const char *run_uri;
-    gchar *uri_scheme;
-
-    /* get the current split based on cursor position */
-    if (split == NULL)
-    {
-        gnc_split_register_cancel_cursor_split_changes (reg);
-        return;
-    }
-
-    trans = xaccSplitGetParent (split);
-    cursor_class = gnc_split_register_get_current_cursor_class (reg);
-
-    if (cursor_class == CURSOR_CLASS_NONE)
-        return;
-
-#ifdef DUMP_FUNCTIONS
-    if (qof_log_check (log_module, QOF_LOG_DEBUG))
-        xaccTransDump (trans, "ExecAssociated");
-#endif
-
-    uri = xaccTransGetAssociation (trans);
-
-    if (g_strcmp0 (uri, "") == 0 && g_strcmp0 (uri, NULL) == 0)
-        gnc_error_dialog (NULL, "%s", _("This transaction is not associated with a URI."));
-    else
-    {
-        if (g_str_has_prefix (uri,"file:/") && !g_str_has_prefix (uri,"file://")) // Check for relative path
-        {
-            gchar *path_head = gnc_prefs_get_string (GNC_PREFS_GROUP_GENERAL, "assoc-head");
-
-            if ((path_head != NULL) && (g_strcmp0 (path_head, "") != 0)) // not default entry
-            {
-                const gchar *part = uri + strlen ("file:");
-                run_uri = g_strconcat (path_head, part, NULL);
-            }
-            else
-                run_uri = g_strdup (uri);
-        }
-        else
-            run_uri = g_strdup (uri);
-
-        uri_scheme = g_uri_parse_scheme (run_uri);
-
-        if (uri_scheme != NULL) // make sure we have a scheme entry
-        {
-            gnc_launch_assoc (run_uri);
-            g_free (uri_scheme);
-        }
-        else
-            gnc_error_dialog (NULL, "%s", _("This transaction is not associated with a valid URI."));
-    }
-    return;
-}
-
-void
-gsr_default_delete_handler( GNCSplitReg *gsr, gpointer data )
-{
-    CursorClass cursor_class;
-    SplitRegister *reg;
-    Transaction *trans;
-    Split *split;
-    GtkWidget *dialog;
-    gint response;
-    const gchar *warning;
-
-    reg = gnc_ledger_display_get_split_register( gsr->ledger );
-
-    /* get the current split based on cursor position */
-    split = gnc_split_register_get_current_split(reg);
-    if (split == NULL)
-    {
-        gnc_split_register_cancel_cursor_split_changes (reg);
-        return;
-    }
-
-    trans = xaccSplitGetParent(split);
-    cursor_class = gnc_split_register_get_current_cursor_class (reg);
-
-    /* Deleting the blank split just cancels */
-    {
-        Split *blank_split = gnc_split_register_get_blank_split (reg);
-
-        if (split == blank_split)
-        {
-            gnc_split_register_cancel_cursor_trans_changes (reg);
-            return;
-        }
-    }
-
-    if (cursor_class == CURSOR_CLASS_NONE)
-        return;
-
-    if (is_trans_readonly_and_warn(trans))
-        return;
-
-    /* On a split cursor, just delete the one split. */
-    if (cursor_class == CURSOR_CLASS_SPLIT)
-    {
-        const char *format = _("Delete the split '%s' from the transaction '%s'?");
-        const char *recn_warn = _("You would be deleting a reconciled split! "
-                                  "This is not a good idea as it will cause your "
-                                  "reconciled balance to be off.");
-        const char *anchor_error = _("You cannot delete this split.");
-        const char *anchor_split = _("This is the split anchoring this transaction "
-                                     "to the register. You may not delete it from "
-                                     "this register window. You may delete the "
-                                     "entire transaction from this window, or you "
-                                     "may navigate to a register that shows "
-                                     "another side of this same transaction and "
-                                     "delete the split from that register.");
-        char *buf = NULL;
-        const char *memo;
-        const char *desc;
-        char recn;
-
-        if (split == gnc_split_register_get_current_trans_split (reg, NULL))
-        {
-            dialog = gtk_message_dialog_new(GTK_WINDOW(gsr->window),
-                                            GTK_DIALOG_MODAL
-                                            | GTK_DIALOG_DESTROY_WITH_PARENT,
-                                            GTK_MESSAGE_ERROR,
-                                            GTK_BUTTONS_OK,
-                                            "%s", anchor_error);
-            gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
-                    "%s", anchor_split);
-            gtk_dialog_run(GTK_DIALOG(dialog));
-            gtk_widget_destroy (dialog);
-            return;
-        }
-
-        memo = xaccSplitGetMemo (split);
-        memo = (memo && *memo) ? memo : _("(no memo)");
-
-        desc = xaccTransGetDescription (trans);
-        desc = (desc && *desc) ? desc : _("(no description)");
-
-        /* ask for user confirmation before performing permanent damage */
-        buf = g_strdup_printf (format, memo, desc);
-        dialog = gtk_message_dialog_new(GTK_WINDOW(gsr->window),
-                                        GTK_DIALOG_MODAL
-                                        | GTK_DIALOG_DESTROY_WITH_PARENT,
-                                        GTK_MESSAGE_QUESTION,
-                                        GTK_BUTTONS_NONE,
-                                        "%s", buf);
-        g_free(buf);
-        recn = xaccSplitGetReconcile (split);
-        if (recn == YREC || recn == FREC)
-        {
-            gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
-                    "%s", recn_warn);
-            warning = GNC_PREF_WARN_REG_SPLIT_DEL_RECD;
-        }
-        else
-        {
-            warning = GNC_PREF_WARN_REG_SPLIT_DEL;
-        }
-
-        gtk_dialog_add_button(GTK_DIALOG(dialog),
-                              _("_Cancel"), GTK_RESPONSE_CANCEL);
-        gnc_gtk_dialog_add_button(dialog, _("_Delete Split"),
-                                  "edit-delete", GTK_RESPONSE_ACCEPT);
-        response = gnc_dialog_run(GTK_DIALOG(dialog), warning);
-        gtk_widget_destroy (dialog);
-        if (response != GTK_RESPONSE_ACCEPT)
-            return;
-
-        gnc_split_register_delete_current_split (reg);
-        return;
-    }
-
-    g_return_if_fail(cursor_class == CURSOR_CLASS_TRANS);
-
-    /* On a transaction cursor with 2 or fewer splits in single or double
-     * mode, we just delete the whole transaction, kerblooie */
-    {
-        const char *title = _("Delete the current transaction?");
-        const char *recn_warn = _("You would be deleting a transaction "
-                                  "with reconciled splits! "
-                                  "This is not a good idea as it will cause your "
-                                  "reconciled balance to be off.");
-
-        dialog = gtk_message_dialog_new(GTK_WINDOW(gsr->window),
-                                        GTK_DIALOG_MODAL
-                                        | GTK_DIALOG_DESTROY_WITH_PARENT,
-                                        GTK_MESSAGE_WARNING,
-                                        GTK_BUTTONS_NONE,
-                                        "%s", title);
-        if (xaccTransHasReconciledSplits (trans))
-        {
-            gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
-                    "%s", recn_warn);
-            warning = GNC_PREF_WARN_REG_TRANS_DEL_RECD;
-        }
-        else
-        {
-            warning = GNC_PREF_WARN_REG_TRANS_DEL;
-        }
-        gtk_dialog_add_button(GTK_DIALOG(dialog),
-                              _("_Cancel"), GTK_RESPONSE_CANCEL);
-        gnc_gtk_dialog_add_button(dialog, _("_Delete Transaction"),
-                                  "edit-delete", GTK_RESPONSE_ACCEPT);
-        response =  gnc_dialog_run(GTK_DIALOG(dialog), warning);
-        gtk_widget_destroy (dialog);
-        if (response != GTK_RESPONSE_ACCEPT)
-            return;
-
-        gnc_split_register_delete_current_trans (reg);
-        return;
-    }
-}
-
-/**
- * Deletes the current transaction.
- **/
-void
-gnc_split_reg_delete_trans_cb(GtkWidget *widget, gpointer data)
-{
-    GNCSplitReg *gsr = data;
-    gsr_emit_simple_signal( gsr, "delete_ent" );
-}
-
-void
-gsr_default_dup_handler( GNCSplitReg *gsr, gpointer data )
-{
-    gnc_split_register_duplicate_current
-    (gnc_ledger_display_get_split_register( gsr->ledger ));
-}
-
-/**
- * Duplicates the current transaction in the register.
- **/
-void
-gnc_split_reg_duplicate_trans_cb(GtkWidget *w, gpointer data)
-{
-    GNCSplitReg *gsr = data;
-    gsr_emit_simple_signal( gsr, "dup_ent" );
-}
-
-/**
- * Schedules the current transaction for recurring-entry.
- * If the selected transaction was created from a scheduled transaction,
- * opens the editor for that Scheduled Transaction.
- **/
-void
-gsr_default_schedule_handler( GNCSplitReg *gsr, gpointer data )
-{
-    SplitRegister *reg = gnc_ledger_display_get_split_register( gsr->ledger );
-    Transaction *pending_trans = gnc_split_register_get_current_trans (reg);
-
-    /* If the transaction has a sched-xact KVP frame, then go to the editor
-     * for the existing SX; otherwise, do the sx-from-trans dialog. */
-    {
-	GncGUID *fromSXId = NULL;
-	SchedXaction *theSX = NULL;
-	GList *sxElts;
-	qof_instance_get (QOF_INSTANCE (pending_trans),
-			  "from-sched-xaction", &fromSXId,
-			  NULL);
-
-	/* Get the correct SX */
-	for ( sxElts = gnc_book_get_schedxactions (gnc_get_current_book())->sx_list;
-	      (!theSX) && sxElts;
-	      sxElts = sxElts->next )
-	{
-	    SchedXaction *sx = (SchedXaction*)sxElts->data;
-	    theSX =
-		((guid_equal (xaccSchedXactionGetGUID (sx), fromSXId))
-		 ? sx : NULL);
-	}
-
-	if ( theSX )
-	{
-	    gnc_ui_scheduled_xaction_editor_dialog_create(theSX, FALSE);
-	    return;
-	}
-    }
-
-    gnc_sx_create_from_trans(pending_trans);
-}
-
-void
-gnc_split_reg_recur_cb(GtkWidget *w, gpointer data)
-{
-    GNCSplitReg *gsr = data;
-    gsr_emit_simple_signal( gsr, "schedule_ent" );
-}
-
-/**
- * Records into the books the currently-selected transaction.
- **/
-void
-gnc_split_reg_record_trans_cb (GtkWidget *w, gpointer data)
-{
-    GNCSplitReg *gsr = data;
-    gsr_emit_simple_signal( gsr, "enter_ent" );
-}
-
-void
-gsr_default_cancel_handler( GNCSplitReg *gsr, gpointer data )
-{
-    gnc_split_register_cancel_cursor_trans_changes
-    (gnc_ledger_display_get_split_register( gsr->ledger ));
-}
-
-/**
- * Cancels the edits of the currently-selected transaction.
- **/
-void
-gnc_split_reg_cancel_trans_cb(GtkWidget *w, gpointer data)
-{
-    GNCSplitReg *gsr = data;
-    gsr_emit_simple_signal( gsr, "cancel_ent" );
-}
-
-void
-gsr_default_expand_handler( GNCSplitReg *gsr, gpointer data )
-{
-    gint activeCount;
-    gboolean expand;
-    SplitRegister *reg;
-
-    if (!gsr)
-        return;
-
-    reg = gnc_ledger_display_get_split_register (gsr->ledger);
-
-    /* These should all be in agreement. */
-    activeCount =
-        ( ( gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM(gsr->split_menu_check)) ? 1 : -1 )
-          + ( gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM(gsr->split_popup_check)) ? 1 : -1 )
-          + ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(gsr->split_button) )
-              ? 1 : -1 ) );
-
-    /* If activeCount > 0, then there's more active than inactive; otherwise,
-     * more inactive than active.  Both determine which state the user is
-     * attempting to get to. */
-    expand = ( activeCount < 0 );
-
-    /* The ledger's invocation of 'redraw_all' will force the agreement in the
-     * other split state widgets, so we neglect doing it here.  */
-    gnc_split_register_expand_current_trans (reg, expand);
-}
-
-void
-gnc_split_reg_expand_trans_menu_cb (GtkWidget *widget, gpointer data)
-{
-    GNCSplitReg *gsr = data;
-    gsr_emit_simple_signal( gsr, "expand_ent" );
-}
-
-void
-gnc_split_reg_expand_trans_toolbar_cb (GtkWidget *widget, gpointer data)
-{
-    GNCSplitReg *gsr = data;
-    gsr_emit_simple_signal( gsr, "expand_ent" );
-}
-
-/**
- * move the cursor to the split, if present in register
-**/
-void
-gnc_split_reg_jump_to_split(GNCSplitReg *gsr, Split *split)
-{
-    Transaction *trans;
-    VirtualCellLocation vcell_loc;
-    SplitRegister *reg;
-
-    if (!gsr) return;
-
-    trans = xaccSplitGetParent(split);
-
-    gsr_emit_include_date_signal( gsr, xaccTransGetDate(trans) );
-
-    reg = gnc_ledger_display_get_split_register( gsr->ledger );
-
-    if (gnc_split_register_get_split_virt_loc(reg, split, &vcell_loc))
-        gnucash_register_goto_virt_cell( gsr->reg, vcell_loc );
-
-    gnc_ledger_display_refresh( gsr->ledger );
-}
-
-
-/**
- * Move the cursor to the split in the non-blank amount column.
- **/
-void
-gnc_split_reg_jump_to_split_amount(GNCSplitReg *gsr, Split *split)
-{
-    VirtualLocation virt_loc;
-    SplitRegister *reg;
-    Transaction *trans;
-
-    if (!gsr) return;
-
-    trans = xaccSplitGetParent(split);
-    gsr_emit_include_date_signal( gsr, xaccTransGetDate(trans) );
-
-    reg = gnc_ledger_display_get_split_register (gsr->ledger);
-
-    if (gnc_split_register_get_split_amount_virt_loc (reg, split, &virt_loc))
-        gnucash_register_goto_virt_loc (gsr->reg, virt_loc);
-
-    gnc_ledger_display_refresh (gsr->ledger);
-}
-
-void
-gnc_split_reg_jump_to_blank (GNCSplitReg *gsr)
-{
-    SplitRegister *reg = gnc_ledger_display_get_split_register (gsr->ledger);
-    VirtualCellLocation vcell_loc;
-    Split *blank;
-
-    ENTER("gsr=%p", gsr);
-
-    blank = gnc_split_register_get_blank_split (reg);
-    if (blank == NULL)
-    {
-        LEAVE("no blank split");
-        return;
-    }
-
-    if (gnc_split_register_get_split_virt_loc (reg, blank, &vcell_loc))
-        gnucash_register_goto_virt_cell (gsr->reg, vcell_loc);
-
-    gnc_ledger_display_refresh (gsr->ledger);
-    LEAVE(" ");
-}
-
-void
-gnc_split_reg_balancing_entry(GNCSplitReg *gsr, Account *account,
-                              time64 statement_date, gnc_numeric balancing_amount)
-{
-
-    Transaction *transaction;
-    Split *split;
-
-    // create transaction
-    transaction = create_balancing_transaction(gnc_get_current_book(),
-                  account, statement_date, balancing_amount);
-
-    // jump to transaction
-    split = xaccTransFindSplitByAccount(transaction, account);
-    if (split == NULL)
-    {
-        // default behaviour: jump to blank split
-        g_warning("create_balancing_transaction failed");
-        gnc_split_reg_jump_to_blank(gsr);
-    }
-    else
-    {
-        // goto balancing transaction
-        gnc_split_reg_jump_to_split(gsr, split );
-    }
-}
-
-static Transaction*
-create_balancing_transaction(QofBook *book, Account *account,
-                             time64 statement_date, gnc_numeric balancing_amount)
-{
-
-    Transaction *trans;
-    Split *split;
-
-    if (!account)
-        return NULL;
-    if (gnc_numeric_zero_p(balancing_amount))
-        return NULL;
-
-    xaccAccountBeginEdit(account);
-
-    trans = xaccMallocTransaction(book);
-
-    xaccTransBeginEdit(trans);
-
-    // fill Transaction
-    xaccTransSetCurrency(trans, gnc_account_or_default_currency(account, NULL));
-    xaccTransSetDatePostedSecsNormalized(trans, statement_date);
-    xaccTransSetDescription(trans, _("Balancing entry from reconciliation"));
-    /* We also must set a new DateEntered on the new entry
-     * because otherwise the ordering is not deterministic */
-    xaccTransSetDateEnteredSecs(trans, gnc_time(NULL));
-
-    // 1. Split
-    split = xaccMallocSplit(book);
-    xaccTransAppendSplit(trans, split);
-    xaccAccountInsertSplit(account, split);
-    xaccSplitSetAmount(split, balancing_amount);
-    xaccSplitSetValue(split, balancing_amount);
-
-    // 2. Split (no account is defined: split goes to orphan account)
-    split = xaccMallocSplit(book);
-    xaccTransAppendSplit(trans, split);
-
-    balancing_amount = gnc_numeric_neg(balancing_amount);
-    xaccSplitSetAmount(split, balancing_amount);
-    xaccSplitSetValue(split, balancing_amount);
-
-    xaccTransCommitEdit(trans);
-    xaccAccountCommitEdit(account);
-    return trans;
-}
-
-void
-gsr_default_blank_handler( GNCSplitReg *gsr, gpointer data )
-{
-    SplitRegister *reg;
-
-    ENTER("gsr=%p, gpointer=%p", gsr, data);
-
-    reg = gnc_ledger_display_get_split_register (gsr->ledger);
-
-    if (gnc_split_register_save (reg, TRUE))
-        gnc_split_register_redraw (reg);
-
-    gnc_split_reg_jump_to_blank (gsr);
-    LEAVE(" ");
-}
-
-void
-gnc_split_reg_new_trans_cb (GtkWidget *widget, gpointer data)
-{
-    GNCSplitReg *gsr = data;
-    gsr_emit_simple_signal( gsr, "blank" );
-}
-
-void
-gsr_default_jump_handler( GNCSplitReg *gsr, gpointer data )
-{
-    g_assert_not_reached();
-}
-
-void
-gnc_split_reg_jump_cb( GtkWidget *widget, gpointer data )
-{
-    GNCSplitReg *gsr = data;
-    gsr_emit_simple_signal( gsr, "jump" );
-}
-
-void
-gnc_split_reg_change_style (GNCSplitReg *gsr, SplitRegisterStyle style)
-{
-    SplitRegister *reg = gnc_ledger_display_get_split_register (gsr->ledger);
-
-    if (style == reg->style)
-        return;
-
-    gnc_split_register_config (reg, reg->type, style, reg->use_double_line);
-    gnc_ledger_display_refresh (gsr->ledger);
-}
-
-void
-gnc_split_reg_style_ledger_cb (GtkWidget *w, gpointer data)
-{
-    GNCSplitReg *gsr = data;
-
-    if (!gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM(w)))
-        return;
-
-    gnc_split_reg_change_style (gsr, REG_STYLE_LEDGER);
-}
-
-void
-gnc_split_reg_style_auto_ledger_cb (GtkWidget *w, gpointer data)
-{
-    GNCSplitReg *gsr = data;
-
-    if (!gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM(w)))
-        return;
-
-    gnc_split_reg_change_style (gsr, REG_STYLE_AUTO_LEDGER);
-}
-
-void
-gnc_split_reg_style_journal_cb (GtkWidget *w, gpointer data)
-{
-    GNCSplitReg *gsr = data;
-
-    if (!gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM(w)))
-        return;
-
-    gnc_split_reg_change_style (gsr, REG_STYLE_JOURNAL);
-}
-
-void
-gnc_split_reg_double_line_cb (GtkWidget *w, gpointer data)
-{
-    GNCSplitReg *gsr = data;
-    SplitRegister *reg = gnc_ledger_display_get_split_register (gsr->ledger);
-    gboolean use_double_line;
-
-    use_double_line = gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM(w));
-    if ( use_double_line == reg->use_double_line )
-        return;
-
-    gnc_split_register_config( reg, reg->type, reg->style, use_double_line );
-    gnc_ledger_display_refresh( gsr->ledger );
-}
-
-static void
-gnc_split_reg_sort_force( GNCSplitReg *gsr, SortType sort_code, gboolean force )
-{
-    Query *query = gnc_ledger_display_get_query( gsr->ledger );
-    gboolean show_present_divider = FALSE;
-    GSList *p1 = NULL, *p2 = NULL, *p3 = NULL, *standard;
-    SplitRegister *reg;
-
-    if ((gsr->sort_type == sort_code) && !force)
-        return;
-
-    standard = g_slist_prepend( NULL, QUERY_DEFAULT_SORT );
-
-    switch (sort_code)
-    {
-    case BY_STANDARD:
-        p1 = standard;
-        show_present_divider = TRUE;
-        break;
-    case BY_DATE:
-        p1 = g_slist_prepend (p1, TRANS_DATE_POSTED);
-        p1 = g_slist_prepend (p1, SPLIT_TRANS);
-        p2 = standard;
-        show_present_divider = TRUE;
-        break;
-    case BY_DATE_ENTERED:
-        p1 = g_slist_prepend (p1, TRANS_DATE_ENTERED);
-        p1 = g_slist_prepend (p1, SPLIT_TRANS);
-        p2 = standard;
-        break;
-    case BY_DATE_RECONCILED:
-        p1 = g_slist_prepend (p1, SPLIT_RECONCILE);
-        p2 = g_slist_prepend (p2, SPLIT_DATE_RECONCILED);
-        p3 = standard;
-        break;
-    case BY_NUM:
-        p1 = g_slist_prepend (p1, TRANS_NUM);
-        p1 = g_slist_prepend (p1, SPLIT_TRANS);
-        p2 = standard;
-        break;
-    case BY_AMOUNT:
-        p1 = g_slist_prepend (p1, SPLIT_VALUE);
-        p2 = standard;
-        break;
-    case BY_MEMO:
-        p1 = g_slist_prepend (p1, SPLIT_MEMO);
-        p2 = standard;
-        break;
-    case BY_DESC:
-        p1 = g_slist_prepend (p1, TRANS_DESCRIPTION);
-        p1 = g_slist_prepend (p1, SPLIT_TRANS);
-        p2 = standard;
-        break;
-    case BY_ACTION:
-        p1 = g_slist_prepend (p1, SPLIT_ACTION);
-        p2 = standard;
-        break;
-    case BY_NOTES:
-        p1 = g_slist_prepend (p1, TRANS_NOTES);
-        p1 = g_slist_prepend (p1, SPLIT_TRANS);
-        p2 = standard;
-        break;
-    default:
-        g_slist_free (standard);
-        g_return_if_fail (FALSE);
-        break;
-    }
-
-    qof_query_set_sort_order( query, p1, p2, p3 );
-    reg = gnc_ledger_display_get_split_register( gsr->ledger );
-    gnc_split_register_show_present_divider( reg, show_present_divider );
-    gsr->sort_type = sort_code;
-    gnc_ledger_display_refresh( gsr->ledger );
-}
-
-static void
-gnc_split_reg_sort( GNCSplitReg *gsr, SortType sort_code )
-{
-    gnc_split_reg_sort_force( gsr, sort_code, FALSE );
-}
-
-void
-gnc_split_reg_sort_standard_cb(GtkWidget *w, gpointer data)
-{
-    GNCSplitReg *gsr = data;
-    gnc_split_reg_sort(gsr, BY_STANDARD);
-}
-
-void
-gnc_split_reg_sort_date_cb(GtkWidget *w, gpointer data)
-{
-    GNCSplitReg *gsr = data;
-    gnc_split_reg_sort(gsr, BY_DATE);
-}
-
-void
-gnc_split_reg_sort_date_entered_cb(GtkWidget *w, gpointer data)
-{
-    GNCSplitReg *gsr = data;
-    gnc_split_reg_sort(gsr, BY_DATE_ENTERED);
-}
-
-void
-gnc_split_reg_sort_date_reconciled_cb(GtkWidget *w, gpointer data)
-{
-    GNCSplitReg *gsr = data;
-    gnc_split_reg_sort(gsr, BY_DATE_RECONCILED);
-}
-
-void
-gnc_split_reg_sort_num_cb(GtkWidget *w, gpointer data)
-{
-    GNCSplitReg *gsr = data;
-    gnc_split_reg_sort(gsr, BY_NUM);
-}
-
-void
-gnc_split_reg_sort_amount_cb(GtkWidget *w, gpointer data)
-{
-    GNCSplitReg *gsr = data;
-    gnc_split_reg_sort(gsr, BY_AMOUNT);
-}
-
-void
-gnc_split_reg_sort_memo_cb(GtkWidget *w, gpointer data)
-{
-    GNCSplitReg *gsr = data;
-    gnc_split_reg_sort(gsr, BY_MEMO);
-}
-
-void
-gnc_split_reg_sort_desc_cb(GtkWidget *w, gpointer data)
-{
-    GNCSplitReg *gsr = data;
-    gnc_split_reg_sort(gsr, BY_DESC);
-}
-
-void
-gnc_split_reg_sort_action_cb(GtkWidget *w, gpointer data)
-{
-    GNCSplitReg *gsr = data;
-    gnc_split_reg_sort(gsr, BY_ACTION);
-}
-
-void
-gnc_split_reg_sort_notes_cb(GtkWidget *w, gpointer data)
-{
-    GNCSplitReg *gsr = data;
-    gnc_split_reg_sort(gsr, BY_NOTES);
-}
-
-
-void
-gnc_split_reg_set_sort_reversed(GNCSplitReg *gsr, gboolean rev)
-{
-  /* Note: sort_reversed is the boolean opposite of sort_increasing
-   *       so when rev == true, we're sorting decreasing
-   *       In other words, qof_query_set_sort_increasing should
-   *       always use the inverse of rev.
-   */
-  Query *query = gnc_ledger_display_get_query( gsr->ledger );
-  qof_query_set_sort_increasing (query, !rev, !rev, !rev);
-  gnc_ledger_display_refresh( gsr->ledger );
-}
-
-static void
-gnc_split_reg_record (GNCSplitReg *gsr)
-{
-    SplitRegister *reg;
-    Transaction *trans;
-
-    ENTER("gsr=%p", gsr);
-
-    reg = gnc_ledger_display_get_split_register (gsr->ledger);
-    trans = gnc_split_register_get_current_trans (reg);
-
-    if (!gnc_split_register_save (reg, TRUE))
-    {
-        LEAVE("no save");
-        return;
-    }
-
-    gsr_emit_include_date_signal( gsr, xaccTransGetDate(trans) );
-
-    /* Explicit redraw shouldn't be needed,
-     * since gui_refresh events should handle this. */
-    /* gnc_split_register_redraw (reg); */
-    LEAVE(" ");
-}
-
-static gboolean
-gnc_split_reg_match_trans_row( VirtualLocation virt_loc,
-                               gpointer user_data )
-{
-    GNCSplitReg *gsr = user_data;
-    CursorClass cursor_class;
-    SplitRegister *sr;
-
-    sr = gnc_ledger_display_get_split_register (gsr->ledger);
-    cursor_class = gnc_split_register_get_cursor_class (sr, virt_loc.vcell_loc);
-
-    return (cursor_class == CURSOR_CLASS_TRANS);
-}
-
-static void
-gnc_split_reg_goto_next_trans_row (GNCSplitReg *gsr)
-{
-    ENTER("gsr=%p", gsr);
-    gnucash_register_goto_next_matching_row( gsr->reg,
-            gnc_split_reg_match_trans_row,
-            gsr );
-    LEAVE(" ");
-}
-
-void
-gnc_split_reg_enter( GNCSplitReg *gsr, gboolean next_transaction )
-{
-    SplitRegister *sr = gnc_ledger_display_get_split_register( gsr->ledger );
-    gboolean goto_blank;
-
-    ENTER("gsr=%p, next_transaction=%s", gsr, next_transaction ? "TRUE" : "FALSE");
-
-    goto_blank = gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL_REGISTER,
-                                    GNC_PREF_ENTER_MOVES_TO_END);
-
-    /* If we are in single or double line mode and we hit enter
-     * on the blank split, go to the blank split instead of the
-     * next row. This prevents the cursor from jumping around
-     * when you are entering transactions. */
-    if ( !goto_blank && !next_transaction )
-    {
-        SplitRegisterStyle style = sr->style;
-
-        if (style == REG_STYLE_LEDGER)
-        {
-            Split *blank_split;
-
-            blank_split = gnc_split_register_get_blank_split(sr);
-            if (blank_split != NULL)
-            {
-                Split *current_split;
-
-                current_split = gnc_split_register_get_current_split(sr);
-
-                if (blank_split == current_split)
-                    goto_blank = TRUE;
-            }
-        }
-    }
-
-    /* First record the transaction. This will perform a refresh. */
-    gnc_split_reg_record( gsr );
-
-    if (!goto_blank && next_transaction)
-        gnc_split_register_expand_current_trans (sr, FALSE);
-
-    /* Now move. */
-    if (goto_blank)
-        gnc_split_reg_jump_to_blank( gsr );
-    else if (next_transaction)
-        gnc_split_reg_goto_next_trans_row( gsr );
-    else
-        gnucash_register_goto_next_virt_row( gsr->reg );
-    LEAVE(" ");
-}
-
-void
-gsr_default_enter_handler( GNCSplitReg *gsr, gpointer data )
-{
-    gnc_split_reg_enter( gsr, FALSE );
-}
-
-void
-gnc_split_reg_record_cb (GnucashRegister *reg, gpointer data)
-{
-    gsr_emit_simple_signal( (GNCSplitReg*)data, "enter_ent" );
-}
-
-void
-gnc_split_reg_size_allocate (GtkWidget *widget,
-                             GtkAllocation *allocation,
-                             gpointer user_data)
-{
-    GNCSplitReg *gsr = user_data;
-    gsr->width = allocation->width;
-    gtk_window_set_default_size( GTK_WINDOW(gsr->window), gsr->width, 0 );
-}
-
-static
-GtkWidget*
-add_summary_label (GtkWidget *summarybar, const char *label_str)
-{
-    GtkWidget *hbox;
-    GtkWidget *label;
-
-    hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
-    gtk_box_set_homogeneous (GTK_BOX (hbox), FALSE);
-    gtk_box_pack_start( GTK_BOX(summarybar), hbox, FALSE, FALSE, 5 );
-
-    label = gtk_label_new( label_str );
-    gnc_label_set_alignment(label, 1.0, 0.5 );
-    gtk_box_pack_start( GTK_BOX(hbox), label, FALSE, FALSE, 0 );
-
-    label = gtk_label_new( "" );
-    gnc_label_set_alignment(label, 1.0, 0.5 );
-    gtk_box_pack_start( GTK_BOX(hbox), label, FALSE, FALSE, 0 );
-
-    return label;
-}
-
-GtkWidget *
-gsr_create_summary_bar( GNCSplitReg *gsr )
-{
-    GtkWidget *summarybar;
-
-    gsr->cleared_label    = NULL;
-    gsr->balance_label    = NULL;
-    gsr->reconciled_label = NULL;
-    gsr->future_label     = NULL;
-    gsr->projectedminimum_label  = NULL;
-    gsr->shares_label     = NULL;
-    gsr->value_label      = NULL;
-
-    if ( gnc_ledger_display_type(gsr->ledger) >= LD_SUBACCOUNT )
-    {
-        gsr->summarybar = NULL;
-        return NULL;
-    }
-
-    summarybar = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
-    gtk_box_set_homogeneous (GTK_BOX (summarybar), FALSE);
-
-    if (!xaccAccountIsPriced(gnc_ledger_display_leader(gsr->ledger)))
-    {
-        gsr->balance_label    = add_summary_label (summarybar, _("Present:"));
-        gsr->future_label     = add_summary_label (summarybar, _("Future:"));
-        gsr->cleared_label    = add_summary_label (summarybar, _("Cleared:"));
-        gsr->reconciled_label = add_summary_label (summarybar, _("Reconciled:"));
-        gsr->projectedminimum_label  = add_summary_label (summarybar, _("Projected Minimum:"));
-    }
-    else
-    {
-        gsr->shares_label     = add_summary_label (summarybar, _("Shares:"));
-        gsr->value_label      = add_summary_label (summarybar, _("Current Value:"));
-    }
-
-    gsr->summarybar = summarybar;
-
-    /* Force the first update */
-    gsr_redraw_all_cb(NULL, gsr);
-    return gsr->summarybar;
-}
-
-/**
- * Opens up a register window for a group of Accounts.
- * @param gsr the register window instance
- * @return A GNCPlaceholderType indicating presence and type of placeholder
- * accounts
- **/
-static
-GNCPlaceholderType
-gnc_split_reg_get_placeholder( GNCSplitReg *gsr )
-{
-    Account *leader;
-    SplitRegister *reg;
-    gboolean single_account;
-
-    if (gsr == NULL)
-        return PLACEHOLDER_NONE;
-
-    reg = gnc_ledger_display_get_split_register( gsr->ledger );
-
-    switch (reg->type)
-    {
-    case GENERAL_JOURNAL:
-    case INCOME_LEDGER:
-    case PORTFOLIO_LEDGER:
-    case SEARCH_LEDGER:
-        single_account = FALSE;
-        break;
-    default:
-        single_account = TRUE;
-        break;
-    }
-
-    leader = gnc_ledger_display_leader( gsr->ledger );
-
-    if (leader == NULL)
-        return PLACEHOLDER_NONE;
-    if (single_account)
-    {
-        if (xaccAccountGetPlaceholder( leader ))
-            return PLACEHOLDER_THIS;
-        return PLACEHOLDER_NONE;
-    }
-    return xaccAccountGetDescendantPlaceholder( leader );
-}
-
-/**
- * @see gtk_callback_bug_workaround
- **/
-typedef struct dialog_args
-{
-    GNCSplitReg *gsr;
-    gchar *string;
-} dialog_args;
-
-/**
- * Gtk has occasional problems with performing function as part of a
- * callback.  This routine gets called via a timer callback to get it out of
- * the data path with the problem.
- **/
-static
-gboolean
-gtk_callback_bug_workaround (gpointer argp)
-{
-    dialog_args *args = argp;
-    const gchar *read_only = _("This account register is read-only.");
-    GtkWidget *dialog;
-
-    dialog = gtk_message_dialog_new(GTK_WINDOW(args->gsr->window),
-                                    GTK_DIALOG_DESTROY_WITH_PARENT,
-                                    GTK_MESSAGE_WARNING,
-                                    GTK_BUTTONS_CLOSE,
-                                    "%s", read_only);
-    gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
-            "%s", args->string);
-    gnc_dialog_run(GTK_DIALOG(dialog), GNC_PREF_WARN_REG_IS_READ_ONLY);
-    gtk_widget_destroy(dialog);
-    g_free(args);
-    return FALSE;
-}
-
-/**
- * Determines whether this register window should be read-only.
- **/
-static
-void
-gnc_split_reg_determine_read_only( GNCSplitReg *gsr )
-{
-    dialog_args *args = g_malloc(sizeof(dialog_args));
-    SplitRegister *reg;
-
-    if (qof_book_is_readonly(gnc_get_current_book()))
-    {
-        /* Is the book read-only? Then for sure also make this register
-        read-only. */
-        gsr->read_only = TRUE;
-    }
-
-    if ( !gsr->read_only )
-    {
-
-        switch (gnc_split_reg_get_placeholder(gsr))
-        {
-        case PLACEHOLDER_NONE:
-            /* stay as false. */
-            return;
-
-        case PLACEHOLDER_THIS:
-            args->string = _("This account may not be edited. If you want "
-                             "to edit transactions in this register, please "
-                             "open the account options and turn off the "
-                             "placeholder checkbox.");
-            break;
-
-        default:
-            args->string = _("One of the sub-accounts selected may not be "
-                             "edited. If you want to edit transactions in "
-                             "this register, please open the sub-account "
-                             "options and turn off the placeholder checkbox. "
-                             "You may also open an individual account instead "
-                             "of a set of accounts.");
-            break;
-        }
-        gsr->read_only = TRUE;
-        /* Put up a warning dialog */
-        args->gsr = gsr;
-        g_timeout_add (250, gtk_callback_bug_workaround, args); /* 0.25 seconds */
-    }
-
-    /* Make the contents immutable */
-    reg = gnc_ledger_display_get_split_register( gsr->ledger );
-    gnc_split_register_set_read_only( reg, TRUE );
-
-}
-
-static
-GtkWidget *
-gnc_split_reg_get_parent( GNCLedgerDisplay *ledger )
-{
-    GNCSplitReg *gsr =
-        GNC_SPLIT_REG(gnc_ledger_display_get_user_data( ledger ));
-
-    if (gsr == NULL)
-        return NULL;
-
-    return gsr->window;
-}
-
-static
-void
-gsr_emit_help_changed( GnucashRegister *reg, gpointer user_data )
-{
-    gsr_emit_simple_signal( (GNCSplitReg*)user_data, "help-changed" );
-}
-
-static
-void
-gsr_emit_include_date_signal( GNCSplitReg *gsr, time64 date )
-{
-    g_signal_emit_by_name( gsr, "include-date", date, NULL );
-}
-
-static
-void
-gsr_emit_simple_signal( GNCSplitReg *gsr, const char *sigName )
-{
-    g_signal_emit_by_name( gsr, sigName, NULL );
-}
-
-GnucashRegister*
-gnc_split_reg_get_register( GNCSplitReg *gsr )
-{
-    if ( !gsr )
-        return NULL;
-
-    return gsr->reg;
-}
-
-SortType
-gnc_split_reg_get_sort_type( GNCSplitReg *gsr )
-{
-    g_assert( gsr );
-    return gsr->sort_type;
-}
-
-void
-gnc_split_reg_set_sort_type( GNCSplitReg *gsr, SortType t )
-{
-    gnc_split_reg_sort( gsr, t );
-}
-
-void
-gnc_split_reg_set_sort_type_force( GNCSplitReg *gsr, SortType t, gboolean force )
-{
-    gnc_split_reg_sort_force( gsr, t, force );
-}
-
-
-GtkWidget*
-gnc_split_reg_get_summarybar( GNCSplitReg *gsr )
-{
-    if ( !gsr ) return NULL;
-    return gsr->summarybar;
-}
-
-gboolean
-gnc_split_reg_get_read_only( GNCSplitReg *gsr )
-{
-    g_assert( gsr );
-    return gsr->read_only;
-}
-
-void
-gnc_split_reg_set_moved_cb( GNCSplitReg *gsr, GFunc cb, gpointer cb_data )
-{
-    gnucash_register_set_moved_cb (gsr->reg, cb, cb_data);
-}
diff --git a/src/gnome/gnc-split-reg2.c b/src/gnome/gnc-split-reg2.c
deleted file mode 100644
index 3e63338..0000000
--- a/src/gnome/gnc-split-reg2.c
+++ /dev/null
@@ -1,1112 +0,0 @@
-/********************************************************************\
- * gnc-split-reg2.c -- A widget for the common register look-n-feel *
- * Copyright (C) 1997 Robin D. Clark                                *
- * Copyright (C) 1997-1998 Linas Vepstas <linas at linas.org>          *
- * Copyright (C) 1998 Rob Browning <rlb at cs.utexas.edu>              *
- * Copyright (C) 1999-2000 Dave Peticolas <dave at krondo.com>         *
- * Copyright (C) 2001 Gnumatic, Inc.                                *
- * Copyright (C) 2002,2006 Joshua Sled <jsled at asynchronous.org>     *
- * Copyright (C) 2012 Robert Fewell                                 *
- *                                                                  *
- * 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 at gnu.org                   *
-\********************************************************************/
-
-#include "config.h"
-
-#include <gtk/gtk.h>
-#include <glib.h>
-#include <glib/gi18n.h>
-
-#include "gnc-split-reg2.h"
-#include "gnc-tree-view-split-reg.h"
-#include "gnc-tree-control-split-reg.h"
-#include "gnc-ledger-display2.h"
-
-#include "gnc-euro.h"
-#include "gnc-state.h"
-#include "gnome-utils/gnc-warnings.h"
-#include "dialog-utils.h"
-
-#define STATE_SECTION_REG_PREFIX "Register"
-#define STATE_SECTION_GEN_JOURNAL "General Journal"
-
-static QofLogModule log_module = GNC_MOD_GUI;
-
-/***** PROTOTYPES ***************************************************/
-void gnc_split_reg2_raise (GNCSplitReg2 *gsr);
-
-static GtkWidget* add_summary_label (GtkWidget *summarybar,
-                                     const char *label_str);
-
-static void gnc_split_reg2_determine_read_only (GNCSplitReg2 *gsr);
-
-static void gnc_split_reg2_determine_account_pr (GNCSplitReg2 *gsr);
-
-static GNCPlaceholderType gnc_split_reg2_get_placeholder (GNCSplitReg2 *gsr);
-static GtkWidget *gnc_split_reg2_get_parent (GNCLedgerDisplay2 *ledger);
-
-static void gsr2_create_table (GNCSplitReg2 *gsr);
-static void gsr2_setup_table (GNCSplitReg2 *gsr);
-
-static void gsr2_setup_status_widgets (GNCSplitReg2 *gsr);
-
-static void gsr2_update_summary_label (GtkWidget *label,
-                                      xaccGetBalanceFn getter,
-                                      Account *leader,
-                                      GNCPrintAmountInfo print_info,
-                                      gnc_commodity *cmdty,
-                                      gboolean reverse,
-                                      gboolean euroFlag );
-
-static void gsr2_redraw_all_cb (GncTreeViewSplitReg *view, gpointer data);
-
-static void gnc_split_reg2_ld_destroy (GNCLedgerDisplay2 *ledger);
-
-static Transaction* gsr2_create_balancing_transaction (QofBook *book, Account *account,
-        time64 statement_date, gnc_numeric balancing_amount);
-
-static void gsr2_emit_simple_signal (GNCSplitReg2 *gsr, const char *sigName);
-static void gsr2_emit_help_changed (GncTreeViewSplitReg *view, gpointer user_data);
-static void gsr2_scroll_value_changed_cb (GtkAdjustment *adj, gpointer user_data);
-static gboolean gsr2_scroll_button_event_cb (GtkWidget *widget, GdkEventButton *event, gpointer user_data);
-static void gsr2_scroll_sync_cb (GncTreeModelSplitReg *model, gpointer user_data);
-
-void gnc_split_reg2_style_ledger_cb (GtkWidget *w, gpointer data);
-void gnc_split_reg2_style_auto_ledger_cb (GtkWidget *w, gpointer data);
-void gnc_split_reg2_style_journal_cb (GtkWidget *w, gpointer data);
-void gnc_split_reg2_double_line_cb (GtkWidget *w, gpointer data);
-
-void gnc_split_reg2_destroy_cb (GtkWidget *widget, gpointer data);
-
-static void gnc_split_reg2_class_init (GNCSplitReg2Class *klass);
-static void gnc_split_reg2_init (GNCSplitReg2 *gsr);
-static void gnc_split_reg2_init2 (GNCSplitReg2 *gsr);
-
-static void gnc_split_reg2_sort_changed_cb (GtkTreeSortable *sortable, gpointer user_data);
-
-
-GType
-gnc_split_reg2_get_type (void)
-{
-    static GType gnc_split_reg2_type = 0;
-
-    if (!gnc_split_reg2_type)
-    {
-        GTypeInfo type_info =
-        {
-            sizeof(GNCSplitReg2Class),          /* class_size */
-            NULL,   			        /* base_init */
-            NULL,				/* base_finalize */
-            (GClassInitFunc)gnc_split_reg2_class_init,
-            NULL,				/* class_finalize */
-            NULL,				/* class_data */
-            sizeof(GNCSplitReg2),		/* */
-            0,				        /* n_preallocs */
-            (GInstanceInitFunc)gnc_split_reg2_init,
-        };
-
-        gnc_split_reg2_type = g_type_register_static (GTK_TYPE_BOX,
-                             "GNCSplitReg2",
-                             &type_info, 0 );
-    }
-
-    return gnc_split_reg2_type;
-}
-
-/* SIGNALS */
-enum
-{
-    HELP_CHANGED,
-    LAST_SIGNAL
-};
-
-static guint gnc_split_reg2_signals[LAST_SIGNAL] = { 0 };
-
-static void
-gnc_split_reg2_class_init (GNCSplitReg2Class *klass)
-{
-    GObjectClass *object_class;
-
-    object_class = (GObjectClass*) klass;
-
-    gnc_split_reg2_signals[HELP_CHANGED] =
-        g_signal_new("help-changed",
-                     G_TYPE_FROM_CLASS (object_class),
-                     G_SIGNAL_RUN_LAST,
-                     G_STRUCT_OFFSET (GNCSplitReg2Class, help_changed),
-                     NULL, NULL,
-                     g_cclosure_marshal_VOID__VOID,
-                     G_TYPE_NONE, 0);
-
-    /* Setup the default handlers. */
-    klass->help_changed = NULL;
-
-}
-
-GtkWidget*
-gnc_split_reg2_new (GNCLedgerDisplay2 *ld,
-                   GtkWindow *parent,
-                   gint numberOfLines,
-                   gboolean read_only )
-{
-    GNCSplitReg2 *gsrToRet;
-
-    ENTER("ld=%p, parent=%p, numberOfLines=%d, read_only=%s",
-          ld, parent, numberOfLines, read_only ? "TRUE" : "FALSE");
-
-    gsrToRet = g_object_new (gnc_split_reg2_get_type(), NULL);
-
-    gsrToRet->numRows = numberOfLines;
-    gsrToRet->read_only = read_only;
-
-    gsrToRet->ledger = ld;
-    gsrToRet->window = GTK_WIDGET (parent);
-
-    gnc_split_reg2_init2 (gsrToRet);
-
-    LEAVE("%p", gsrToRet);
-    return GTK_WIDGET (gsrToRet);
-}
-
-static void
-gnc_split_reg2_init (GNCSplitReg2 *gsr)
-{
-    gtk_orientable_set_orientation (GTK_ORIENTABLE(gsr), GTK_ORIENTATION_VERTICAL);
-
-    gsr->numRows = 10;
-    gsr->read_only = FALSE;
-
-    g_signal_connect (gsr, "destroy",
-                      G_CALLBACK (gnc_split_reg2_destroy_cb), gsr );
-}
-
-static void
-gnc_split_reg2_init2 (GNCSplitReg2 *gsr)
-{
-    if (!gsr) return;
-
-    gnc_split_reg2_determine_read_only (gsr);
-
-    gnc_split_reg2_determine_account_pr (gsr);
-
-    gsr2_setup_status_widgets (gsr);
-    /* ordering is important here... setup_status before create_table */
-
-    gsr2_create_table (gsr);
-    gsr2_setup_table (gsr);
-
-}
-
-static
-void
-gsr2_setup_table (GNCSplitReg2 *gsr)
-{
-//    GncTreeModelSplitReg *model;
-
-    ENTER("gsr=%p", gsr);
-
-// This dose not do any thing
-//    model = gnc_ledger_display2_get_split_model_register (gsr->ledger);
-
-    LEAVE(" ");
-}
-
-static
-void
-gsr2_create_table (GNCSplitReg2 *gsr)
-{
-    GncTreeViewSplitReg *view;
-    GncTreeModelSplitReg *model;
-    GtkTreeModel *s_model;
-    GtkWidget *scrolled_window;
-    GtkTreeViewColumn *col;
-    GNCLedgerDisplay2Type ledger_type;
-    GtkWidget *hbox;
-    gdouble num_of_trans;
-
-    gchar *state_section;
-    GKeyFile *state_file = gnc_state_get_current();
-    const GncGUID * guid;
-    Account * account;
-
-    account = gnc_ledger_display2_leader (gsr->ledger);
-    guid = xaccAccountGetGUID (account);
-
-    ENTER("create table gsr=%p", gsr);
-
-    gnc_ledger_display2_set_user_data (gsr->ledger, (gpointer)gsr);
-    gnc_ledger_display2_set_handlers (gsr->ledger,
-                                     gnc_split_reg2_ld_destroy,
-                                     gnc_split_reg2_get_parent);
-
-    model = gnc_ledger_display2_get_split_model_register (gsr->ledger);
-    view = gnc_tree_view_split_reg_new_with_model (model);
-    g_object_unref (G_OBJECT (model));
-
-    /* State_section is used to store per register state: column widths, sort order,... */
-    ledger_type = gnc_ledger_display2_type (gsr->ledger);
-    if (ledger_type == LD2_GL && model->type == GENERAL_JOURNAL2)
-        state_section = g_strdup (STATE_SECTION_GEN_JOURNAL);
-    else if (ledger_type == LD2_SUBACCOUNT)
-    {
-        gchar guidstr[GUID_ENCODING_LENGTH+1];
-        guid_to_string_buff (guid, guidstr);
-        state_section = g_strconcat (STATE_SECTION_REG_PREFIX, " ", guidstr, " w/subaccounts", NULL);
-    }
-    else
-    {
-        gchar guidstr[GUID_ENCODING_LENGTH+1];
-        guid_to_string_buff (guid, guidstr);
-        state_section = g_strconcat (STATE_SECTION_REG_PREFIX, " ", guidstr, NULL);
-    }
-    g_object_set (G_OBJECT (view), "state-section", state_section,
-                 "show-column-menu", FALSE, NULL);
-
-    // Create a hbox for treeview and scrollbar.
-    hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
-    gtk_box_set_homogeneous (GTK_BOX (hbox), FALSE);
-    gtk_widget_show (hbox);
-
-    scrolled_window = gtk_scrolled_window_new (NULL, NULL);
-    gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
-                                   GTK_POLICY_AUTOMATIC,
-                                   GTK_POLICY_AUTOMATIC);
-
-    gtk_widget_show (scrolled_window);
-
-    gtk_box_pack_start (GTK_BOX (gsr), hbox, TRUE, TRUE, 0);
-
-    num_of_trans = model->number_of_trans_in_full_tlist - 1;
-
-    gsr->scroll_adj = GTK_ADJUSTMENT (gtk_adjustment_new (model->position_of_trans_in_full_tlist, 0.0, num_of_trans + 10, 1.0, 10.0, 10.0));
-
-    gsr->scroll_bar = gtk_scrollbar_new (GTK_ORIENTATION_VERTICAL, GTK_ADJUSTMENT (gsr->scroll_adj));
-    gtk_widget_show (gsr->scroll_bar);
-
-    gtk_box_pack_start (GTK_BOX (hbox), gsr->scroll_bar, FALSE, FALSE, 2);
-    gtk_box_pack_start (GTK_BOX (hbox), scrolled_window, TRUE, TRUE, 0);
-
-    gnc_ledger_display2_set_split_view_register (gsr->ledger, view);
-
-    /* Synchronize model state with view state
-     * (needed to properly set up the internal query) */
-
-    /* Restore the sort depth from saved state */
-    model->sort_depth = g_key_file_get_integer (state_file, state_section, "sort_depth", NULL);
-    g_free(state_section);
-
-    s_model = gtk_tree_view_get_model(GTK_TREE_VIEW(view));
-    if (s_model)
-    {
-        gint sort_col;
-        GtkSortType   type;
-
-        if (gtk_tree_sortable_get_sort_column_id (GTK_TREE_SORTABLE (s_model), &sort_col, &type))
-        {
-            model->sort_col = sort_col;
-            model->sort_direction = type;
-        }
-    }
-
-    gnc_tree_view_configure_columns (GNC_TREE_VIEW (view));
-
-    if (ledger_type == LD2_GL && model->type == GENERAL_JOURNAL2)
-        gnc_tree_view_set_show_column_menu (GNC_TREE_VIEW (view), TRUE);
-    else
-        gnc_tree_view_set_show_column_menu (GNC_TREE_VIEW (view), FALSE);
-
-    /* This column gets all the free space */
-    gnc_tree_view_expand_columns (GNC_TREE_VIEW (view), "descnotes", NULL);
-
-    /* This sets the status color column, 4 is the minimum */
-    col = gnc_tree_view_find_column_by_name (GNC_TREE_VIEW (view), "status");
-    if (col != NULL)
-        g_object_set (G_OBJECT(col),
-                     "resizable", FALSE,
-                     "sizing", GTK_TREE_VIEW_COLUMN_FIXED,
-                     "fixed-width", 4,
-                      NULL);
-
-    gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (view), TRUE);
-    gtk_widget_show (GTK_WIDGET (view));
-
-    gtk_container_add (GTK_CONTAINER (scrolled_window), GTK_WIDGET (view));
-    gtk_widget_show (GTK_WIDGET (gsr));
-
-    /* Should this be read only */
-    gnc_tree_view_split_reg_set_read_only (view, gsr->read_only);
-
-    /* This tells the ledger that we have a valid tree view */
-    gnc_ledger_display2_set_split_view_refresh (gsr->ledger, TRUE);
-
-    /* This triggers the update of the summary bar */
-    g_signal_connect_after (model, "refresh_status_bar",
-                      G_CALLBACK (gsr2_redraw_all_cb), gsr); //this works
-
-    // This will keep scrollbar in sync.
-    g_signal_connect (model, "scroll_sync",
-                      G_CALLBACK (gsr2_scroll_sync_cb), gsr);
-
-    /* This triggers the update of the help text */
-    g_signal_connect (view, "help_signal",
-                      G_CALLBACK (gsr2_emit_help_changed), gsr); // this works
-
-    gsr2_scroll_value_changed_cb (GTK_ADJUSTMENT (gsr->scroll_adj), gsr);
-
-    /* This triggers the tooltip to change when scrolling */
-    g_signal_connect (gsr->scroll_adj, "value-changed",
-                      G_CALLBACK (gsr2_scroll_value_changed_cb), gsr); // this works
-
-    /* This triggers the model update when mouse button released */
-    g_signal_connect (gsr->scroll_bar, "button-release-event",
-                      G_CALLBACK (gsr2_scroll_button_event_cb), gsr);
-
-    // Connect a call back to update the sort settings.
-    g_signal_connect (GTK_TREE_SORTABLE (s_model), "sort-column-changed",
-          G_CALLBACK (gnc_split_reg2_sort_changed_cb), gsr);
-
-    LEAVE(" ");
-}
-
-static
-void
-gsr2_setup_status_widgets (GNCSplitReg2 *gsr)
-{
-    GncTreeModelSplitReg *model;
-    gboolean use_double_line;
-
-    model = gnc_ledger_display2_get_split_model_register (gsr->ledger);
-    use_double_line = gnc_ledger_display2_default_double_line (gsr->ledger);
-
-    /* be sure to initialize the gui elements */
-    gnc_tree_model_split_reg_config (model, model->type, model->style, use_double_line);
-}
-
-void
-gnc_split_reg2_destroy_cb (GtkWidget *widget, gpointer data)
-{
-}
-
-/**
- * Jump to split.
- **/
-void
-gnc_split_reg2_jump_to_split (GNCSplitReg2 *gsr, Split *split)
-{
-    GncTreeViewSplitReg *view;
-
-    if (gsr == NULL)
-        return;
-
-    if (split == NULL)
-        return;
-
-    view = gnc_ledger_display2_get_split_view_register (gsr->ledger);
-
-    gnc_tree_control_split_reg_jump_to (view, NULL, split, FALSE);
-}
-
-
-/**
- * Move the cursor to the split in the non-blank amount column.
- **/
-void
-gnc_split_reg2_jump_to_split_amount (GNCSplitReg2 *gsr, Split *split)
-{
-    GncTreeViewSplitReg *view;
-
-    if (gsr == NULL)
-        return;
-
-    if (split == NULL)
-        return;
-
-    view = gnc_ledger_display2_get_split_view_register (gsr->ledger);
-
-    gnc_tree_control_split_reg_jump_to (view, NULL, split, TRUE);
-}
-
-/**
- * Raise an existing register window to the front.
- **/
-void
-gnc_split_reg2_raise (GNCSplitReg2 *gsr)
-{
-    if (gsr == NULL)
-        return;
-
-    if (gsr->window == NULL)
-        return;
-
-    gtk_window_present (GTK_WINDOW (gsr->window));
-}
-
-
-/**
- * Duplicate-code reduction function; retreives, formats and updates the
- * GtkLabel with the given amount.
- **/
-static
-void
-gsr2_update_summary_label (GtkWidget *label,
-                          xaccGetBalanceFn getter,
-                          Account *leader,
-                          GNCPrintAmountInfo print_info,
-                          gnc_commodity *cmdty,
-                          gboolean reverse,
-                          gboolean euroFlag)
-{
-    gnc_numeric amount;
-    char string[256];
-
-    if ( label == NULL )
-        return;
-
-    amount = (*getter)( leader );
-
-    if ( reverse )
-    {
-        amount = gnc_numeric_neg( amount );
-    }
-
-    xaccSPrintAmount( string, amount, print_info );
-
-    if ( euroFlag )
-    {
-        strcat( string, " / " );
-        xaccSPrintAmount( string + strlen( string ),
-                          gnc_convert_to_euro( cmdty, amount ),
-                          gnc_commodity_print_info( gnc_get_euro(), TRUE ) );
-    }
-
-    gnc_set_label_color( label, amount );
-    gtk_label_set_text( GTK_LABEL(label), string );
-}
-
-static
-void
-gsr2_redraw_all_cb (GncTreeViewSplitReg *view, gpointer user_data)
-{
-    GNCSplitReg2 *gsr = user_data;
-    gnc_commodity * commodity;
-    GNCPrintAmountInfo print_info;
-    gnc_numeric amount;
-    Account *leader;
-    gboolean reverse;
-    gboolean euro;
-
-    if ( gsr->summarybar == NULL )
-        return;
-
-    leader = gnc_ledger_display2_leader( gsr->ledger );
-
-    commodity = xaccAccountGetCommodity( leader );
-
-    /* no EURO converson, if account is already EURO or no EURO currency */
-    if (commodity != NULL)
-        euro = (gnc_is_euro_currency( commodity ) &&
-                (strncasecmp(gnc_commodity_get_mnemonic(commodity), "EUR", 3)));
-    else
-        euro = FALSE;
-
-    print_info = gnc_account_print_info( leader, TRUE );
-    reverse = gnc_reverse_balance( leader );
-
-    gsr2_update_summary_label( gsr->balance_label,
-                              xaccAccountGetPresentBalance,
-                              leader, print_info, commodity, reverse, euro );
-    gsr2_update_summary_label( gsr->cleared_label,
-                              xaccAccountGetClearedBalance,
-                              leader, print_info, commodity, reverse, euro );
-    gsr2_update_summary_label( gsr->reconciled_label,
-                              xaccAccountGetReconciledBalance,
-                              leader, print_info, commodity, reverse, euro );
-    gsr2_update_summary_label( gsr->future_label,
-                              xaccAccountGetBalance,
-                              leader, print_info, commodity, reverse, euro );
-    gsr2_update_summary_label( gsr->projectedminimum_label,
-                              xaccAccountGetProjectedMinimumBalance,
-                              leader, print_info, commodity, reverse, euro );
-
-   /* Print the summary share amount */
-    if (gsr->shares_label != NULL)
-    {
-        char string[256];
-        print_info = gnc_account_print_info( leader, TRUE );
-        amount = xaccAccountGetBalance( leader );
-        if ( reverse )
-            amount = gnc_numeric_neg( amount );
-        xaccSPrintAmount( string, amount, print_info );
-        gnc_set_label_color( gsr->shares_label, amount );
-        gtk_label_set_text( GTK_LABEL(gsr->shares_label), string );
-    }
-
-    /* Print the summary share value */
-    if (gsr->value_label != NULL)
-    {
-        char string[256];
-        QofBook *book = gnc_account_get_book (leader);
-        GNCPriceDB *pricedb = gnc_pricedb_get_db (book);
-        gnc_commodity *commodity = xaccAccountGetCommodity (leader);
-        gnc_commodity *currency = gnc_default_currency ();
-        print_info = gnc_commodity_print_info (currency, TRUE);
-        xaccSPrintAmount (string, amount, print_info);
-        gnc_set_label_color (gsr->value_label, amount);
-        gtk_label_set_text (GTK_LABEL (gsr->value_label), string);
-
-    }
-}
-
-
-static void
-gnc_split_reg2_ld_destroy (GNCLedgerDisplay2 *ledger)
-{
-    gnc_ledger_display2_set_user_data (ledger, NULL);
-}
-
-
-/* ########################### Handlers ############################### */
-
-void
-gnc_split_reg2_balancing_entry (GNCSplitReg2 *gsr, Account *account,
-                              time64 statement_date, gnc_numeric balancing_amount) // this works
-{
-    GncTreeViewSplitReg *view;
-    Transaction *transaction;
-    Split *split;
-
-    view = gnc_ledger_display2_get_split_view_register (gsr->ledger);
-
-    // create transaction
-    transaction = gsr2_create_balancing_transaction (gnc_get_current_book(),
-                  account, statement_date, balancing_amount);
-
-    // jump to transaction
-    split = xaccTransFindSplitByAccount (transaction, account);
-    if (split == NULL)
-    {
-        // default behaviour: jump to blank split
-        g_warning("gsr2_create_balancing_transaction failed");
-        gnc_tree_control_split_reg_jump_to_blank (view);
-    }
-    else
-    {
-        // goto balancing transaction
-        gnc_tree_control_split_reg_jump_to (view, NULL, split, FALSE);
-    }
-}
-
-static Transaction*
-gsr2_create_balancing_transaction (QofBook *book, Account *account,
-                             time64 statement_date, gnc_numeric balancing_amount)
-{
-    Transaction *trans;
-    Split *split;
-
-    if (!account)
-        return NULL;
-    if (gnc_numeric_zero_p (balancing_amount))
-        return NULL;
-
-    xaccAccountBeginEdit (account);
-
-    trans = xaccMallocTransaction (book);
-
-    xaccTransBeginEdit (trans);
-
-    // fill Transaction
-    xaccTransSetCurrency (trans, gnc_account_or_default_currency (account, NULL));
-    xaccTransSetDatePostedSecsNormalized (trans, statement_date);
-    xaccTransSetDescription (trans, _("Balancing entry from reconciliation"));
-
-    // 1. Split
-    split = xaccMallocSplit (book);
-    xaccTransAppendSplit (trans, split);
-    xaccAccountInsertSplit  (account, split);
-    xaccSplitSetAmount (split, balancing_amount);
-    xaccSplitSetValue (split, balancing_amount);
-
-    // 2. Split (no account is defined: split goes to orphan account)
-    split = xaccMallocSplit (book);
-    xaccTransAppendSplit (trans, split);
-
-    balancing_amount = gnc_numeric_neg (balancing_amount);
-    xaccSplitSetAmount (split, balancing_amount);
-    xaccSplitSetValue (split, balancing_amount);
-
-    xaccTransCommitEdit (trans);
-    xaccAccountCommitEdit (account);
-    return trans;
-}
-
-
-/* Sort changed callback */
-static void
-gnc_split_reg2_sort_changed_cb (GtkTreeSortable *sortable, gpointer user_data)
-{
-    GNCSplitReg2 *gsr = user_data;
-    GncTreeViewSplitReg *view;
-    GncTreeModelSplitReg *model;
-    GtkSortType   type;
-    gint          sortcol;
-    gint          sort_depth;
-    const gchar  *state_section;
-    GKeyFile *state_file = gnc_state_get_current();
-
-    gtk_tree_sortable_get_sort_column_id (sortable, &sortcol, &type);
-    ENTER("sortcol is %d", sortcol);
-
-    view = gnc_ledger_display2_get_split_view_register (gsr->ledger);
-    model = gnc_ledger_display2_get_split_model_register (gsr->ledger);
-
-    sort_depth = gnc_tree_view_reg_get_selected_row_depth (view);
-    if (sort_depth != 0)
-        model->sort_depth = sort_depth;
-
-    model->sort_col = sortcol;
-    model->sort_direction = type;
-
-    /* Save the sort depth state */
-    state_section = gnc_tree_view_get_state_section (GNC_TREE_VIEW (view));
-    g_key_file_set_integer (state_file, state_section, "sort_depth", model->sort_depth);
-
-    LEAVE("m_sort_col %d, m_sort_direction is %d  m_sort_depth is %d", model->sort_col, model->sort_direction, model->sort_depth);
-
-    if (sortcol != -1)
-        gnc_ledger_display2_refresh (gsr->ledger);
-}
-/* ############################## End Handlers ############################ */
-
-void
-gnc_split_reg2_change_style (GNCSplitReg2 *gsr, SplitRegisterStyle2 style)
-{
-    GncTreeModelSplitReg *model = gnc_ledger_display2_get_split_model_register (gsr->ledger);
-
-    if (style == model->style)
-        return;
-
-    gnc_tree_model_split_reg_config (model, model->type, style, model->use_double_line);
-
-    // This will re-display the view.
-    gnc_tree_view_split_reg_set_format (gnc_ledger_display2_get_split_view_register (gsr->ledger));
-}
-
-void
-gnc_split_reg2_style_ledger_cb (GtkWidget *w, gpointer data)
-{
-    GNCSplitReg2 *gsr = data;
-
-    if (!gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (w)))
-        return;
-
-    gnc_split_reg2_change_style (gsr, REG2_STYLE_LEDGER);
-}
-
-void
-gnc_split_reg2_style_auto_ledger_cb (GtkWidget *w, gpointer data)
-{
-    GNCSplitReg2 *gsr = data;
-
-    if (!gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (w)))
-        return;
-
-    gnc_split_reg2_change_style (gsr, REG2_STYLE_AUTO_LEDGER);
-}
-
-void
-gnc_split_reg2_style_journal_cb (GtkWidget *w, gpointer data)
-{
-    GNCSplitReg2 *gsr = data;
-
-    if (!gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (w)))
-        return;
-
-    gnc_split_reg2_change_style (gsr, REG2_STYLE_JOURNAL);
-}
-
-void
-gnc_split_reg2_double_line_cb (GtkWidget *w, gpointer data)
-{
-    GNCSplitReg2 *gsr = data;
-    GncTreeModelSplitReg *model = gnc_ledger_display2_get_split_model_register (gsr->ledger);
-    gboolean use_double_line;
-
-    use_double_line = gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (w));
-    if (use_double_line == model->use_double_line)
-        return;
-
-    gnc_tree_model_split_reg_config (model, model->type, model->style, use_double_line);
-
-    // This will re-display the view.
-    gnc_tree_view_split_reg_set_format (gnc_ledger_display2_get_split_view_register (gsr->ledger));
-}
-
-static
-GtkWidget*
-add_summary_label (GtkWidget *summarybar, const char *label_str)
-{
-    GtkWidget *hbox;
-    GtkWidget *label;
-
-    hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
-    gtk_box_set_homogeneous (GTK_BOX (hbox), FALSE);
-    gtk_box_pack_start (GTK_BOX (summarybar), hbox, FALSE, FALSE, 5);
-
-    label = gtk_label_new (label_str);
-    gnc_label_set_alignment (label, 1.0, 0.5);
-    gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
-
-    label = gtk_label_new ("");
-    gnc_label_set_alignment (label, 1.0, 0.5);
-    gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
-
-    return label;
-}
-
-GtkWidget *
-gnc_split_reg2_create_summary_bar (GNCSplitReg2 *gsr)
-{
-    GtkWidget *summarybar;
-
-    gsr->cleared_label    = NULL;
-    gsr->balance_label    = NULL;
-    gsr->reconciled_label = NULL;
-    gsr->future_label     = NULL;
-    gsr->projectedminimum_label = NULL;
-    gsr->shares_label     = NULL;
-    gsr->value_label      = NULL;
-
-    if (gnc_ledger_display2_type (gsr->ledger) >= LD2_SUBACCOUNT)
-    {
-        gsr->summarybar = NULL;
-        return NULL;
-    }
-
-    summarybar = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
-    gtk_box_set_homogeneous (GTK_BOX (summarybar), FALSE);
-
-    if (!xaccAccountIsPriced(gnc_ledger_display2_leader(gsr->ledger)))
-    {
-        gsr->balance_label    = add_summary_label (summarybar, _("Present:"));
-        gsr->future_label     = add_summary_label (summarybar, _("Future:"));
-        gsr->cleared_label    = add_summary_label (summarybar, _("Cleared:"));
-        gsr->reconciled_label = add_summary_label (summarybar, _("Reconciled:"));
-        gsr->projectedminimum_label  = add_summary_label (summarybar, _("Projected Minimum:"));
-    }
-    else
-    {
-        gsr->shares_label     = add_summary_label (summarybar, _("Shares:"));
-        gsr->value_label      = add_summary_label (summarybar, _("Current Value:"));
-    }
-
-    gsr->summarybar = summarybar;
-
-    /* Force the first update */
-    gsr2_redraw_all_cb (NULL, gsr);
-    return gsr->summarybar;
-}
-
-/**
- * Opens up a register window for a group of Accounts.
- * @param gsr the register window instance
- * @return A GNCPlaceholderType indicating presence and type of placeholder
- * accounts
- **/
-static
-GNCPlaceholderType
-gnc_split_reg2_get_placeholder (GNCSplitReg2 *gsr)
-{
-    Account *leader;
-    GncTreeModelSplitReg *model;
-    gboolean single_account;
-
-    if (gsr == NULL)
-        return PLACEHOLDER_NONE;
-
-    model = gnc_ledger_display2_get_split_model_register (gsr->ledger);
-
-    switch (model->type)
-    {
-    case GENERAL_JOURNAL2:
-    case INCOME_LEDGER2:
-    case PORTFOLIO_LEDGER2:
-    case SEARCH_LEDGER2:
-        single_account = FALSE;
-        break;
-    default:
-        single_account = TRUE;
-        break;
-    }
-
-    leader = gnc_ledger_display2_leader (gsr->ledger);
-
-    if (leader == NULL)
-        return PLACEHOLDER_NONE;
-    if (single_account)
-    {
-        if (xaccAccountGetPlaceholder (leader))
-            return PLACEHOLDER_THIS;
-        return PLACEHOLDER_NONE;
-    }
-    return xaccAccountGetDescendantPlaceholder (leader);
-}
-
-
-
-/**
- * @see gtk_callback_bug_workaround
- **/
-typedef struct dialog_args
-{
-    GNCSplitReg2 *gsr;
-    gchar *string;
-} dialog_args;
-
-
-/* This Register is an Account Payable / Receivable one */
-static
-gboolean
-gsr2_determine_account_pr_dialog (gpointer argp)
-{
-    dialog_args *args = argp;
-    GtkWidget *dialog;
-
-    const char *title = _("Account Payable / Receivable Register");
-    const char *message =
-            _("The register displayed is for Account Payable or Account Receivable. "
-              "Changing the entries may cause harm, please use the business "
-              "options to change the entries.");
-
-    dialog = gtk_message_dialog_new (GTK_WINDOW (args->gsr->window),
-                                     GTK_DIALOG_DESTROY_WITH_PARENT,
-                                     GTK_MESSAGE_WARNING,
-                                     GTK_BUTTONS_CLOSE,
-                                     "%s", title);
-    gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
-                                              "%s", message);
-
-    gnc_dialog_run (GTK_DIALOG (dialog), GNC_PREF_WARN_REG_IS_ACCT_PAY_REC);
-    gtk_widget_destroy (dialog);
-    g_free (args);
-    return FALSE;
-}
-
-
-/* This Register is an Account Payable / Receivable one */
-static void
-gnc_split_reg2_determine_account_pr (GNCSplitReg2 *gsr)
-{
-    dialog_args *args = g_malloc (sizeof (dialog_args));
-    GncTreeModelSplitReg *model;
-
-    model = gnc_ledger_display2_get_split_model_register (gsr->ledger);
-
-    if (model->type != PAYABLE_REGISTER2 && model->type != RECEIVABLE_REGISTER2)
-        return;
-
-    /* Put up a warning dialog */
-    args->gsr = gsr;
-    g_timeout_add (250, gsr2_determine_account_pr_dialog, args); /* 0.25 seconds */
-}
-
-
-/**
- * Gtk has occasional problems with performing function as part of a
- * callback.  This routine gets called via a timer callback to get it out of
- * the data path with the problem.
- **/
-static
-gboolean
-gtk_callback_bug_workaround (gpointer argp)
-{
-    dialog_args *args = argp;
-    const gchar *read_only = _("This account register is read-only.");
-    GtkWidget *dialog;
-
-    dialog = gtk_message_dialog_new (GTK_WINDOW(args->gsr->window),
-                                    GTK_DIALOG_DESTROY_WITH_PARENT,
-                                    GTK_MESSAGE_WARNING,
-                                    GTK_BUTTONS_CLOSE,
-                                    "%s", read_only);
-    gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
-            "%s", args->string);
-    gnc_dialog_run (GTK_DIALOG (dialog), GNC_PREF_WARN_REG_IS_READ_ONLY);
-    gtk_widget_destroy (dialog);
-    g_free (args);
-    return FALSE;
-}
-
-/**
- * Determines whether this register window should be read-only.
- **/
-static
-void
-gnc_split_reg2_determine_read_only (GNCSplitReg2 *gsr) //this works
-{
-    dialog_args *args = g_malloc (sizeof (dialog_args));
-
-    if (qof_book_is_readonly (gnc_get_current_book()))
-    {
-        /* Is the book read-only? Then for sure also make this register
-        read-only. */
-        gsr->read_only = TRUE;
-    }
-
-    if (!gsr->read_only)
-    {
-
-        switch (gnc_split_reg2_get_placeholder (gsr))
-        {
-        case PLACEHOLDER_NONE:
-            /* stay as false. */
-            return;
-
-        case PLACEHOLDER_THIS:
-            args->string = _("This account may not be edited. If you want "
-                             "to edit transactions in this register, please "
-                             "open the account options and turn off the "
-                             "placeholder checkbox.");
-            break;
-
-        default:
-            args->string = _("One of the sub-accounts selected may not be "
-                             "edited. If you want to edit transactions in "
-                             "this register, please open the sub-account "
-                             "options and turn off the placeholder checkbox. "
-                             "You may also open an individual account instead "
-                             "of a set of accounts.");
-            break;
-        }
-        gsr->read_only = TRUE;
-        /* Put up a warning dialog */
-        args->gsr = gsr;
-        g_timeout_add (250, gtk_callback_bug_workaround, args); /* 0.25 seconds */
-    }
-}
-
-static
-GtkWidget *
-gnc_split_reg2_get_parent (GNCLedgerDisplay2 *ledger)
-{
-    GNCSplitReg2 *gsr =
-        GNC_SPLIT_REG2 (gnc_ledger_display2_get_user_data (ledger));
-
-    if (gsr == NULL)
-        return NULL;
-
-    return gsr->window;
-}
-
-static void
-gsr2_emit_help_changed (GncTreeViewSplitReg *view, gpointer user_data)
-{
-    gsr2_emit_simple_signal ((GNCSplitReg2*)user_data, "help-changed" );
-}
-
-/* Callback to keep vertical scroll bar in sync */
-static void
-gsr2_scroll_sync_cb (GncTreeModelSplitReg *model, gpointer user_data)
-{
-    GNCSplitReg2 *gsr = user_data;
-    gint trans_position;
-
-    trans_position = model->position_of_trans_in_full_tlist;
-
-    gtk_adjustment_set_value (gsr->scroll_adj, trans_position);
-
-    gtk_adjustment_set_upper (gsr->scroll_adj, model->number_of_trans_in_full_tlist + 9);
-}
-
-static void
-gsr2_scroll_value_changed_cb (GtkAdjustment *adj, gpointer user_data)
-{
-    GNCSplitReg2 *gsr = user_data;
-    GncTreeModelSplitReg *model;
-    gchar *text;
-    gint  trans_position;
-
-    model = gnc_ledger_display2_get_split_model_register (gsr->ledger);
-
-    trans_position = gtk_adjustment_get_value (adj);
-
-    text = gnc_tree_model_split_reg_get_tooltip (model, trans_position);
-
-    g_object_set (gtk_widget_get_settings (gsr->scroll_bar), "gtk-tooltip-timeout", 2, NULL);
-
-    gtk_widget_set_tooltip_text (gsr->scroll_bar, text);
-
-    g_free (text);
-}
-
-static
-gboolean
-gsr2_scroll_button_event_cb (GtkWidget *widget, GdkEventButton *event, gpointer user_data)
-{
-    GNCSplitReg2 *gsr = user_data;
-    GncTreeModelSplitReg *model;
-    gint trans_position;
-
-    model = gnc_ledger_display2_get_split_model_register (gsr->ledger);
-
-    trans_position = gtk_adjustment_get_value (gsr->scroll_adj);
-
-    gnc_tree_model_split_reg_set_current_trans_by_position (model, trans_position);
-
-//FIXME should we store what it was...
-    g_object_set (gtk_widget_get_settings (gsr->scroll_bar), "gtk-tooltip-timeout", 500, NULL);
-
-    g_signal_emit_by_name (model, "refresh_trans");
-
-    return FALSE;
-}
-
-static
-void
-gsr2_emit_simple_signal (GNCSplitReg2 *gsr, const char *sigName)
-{
-    g_signal_emit_by_name( gsr, sigName, NULL );
-}
-
-GncTreeViewSplitReg *
-gnc_split_reg2_get_register (GNCSplitReg2 *gsr )
-{
-    if ( !gsr )
-        return NULL;
-
-    return gnc_ledger_display2_get_split_view_register (gsr->ledger);
-}
-
-GtkWidget*
-gnc_split_reg2_get_summarybar (GNCSplitReg2 *gsr)
-{
-    if (!gsr) return NULL;
-    return gsr->summarybar;
-}
-
-gboolean
-gnc_split_reg2_get_read_only (GNCSplitReg2 *gsr)
-{
-    g_assert (gsr);
-    return gsr->read_only;
-}
-
-void
-gnc_split_reg2_set_moved_cb (GNCSplitReg2 *gsr, GFunc cb, gpointer cb_data ) //this works
-{
-    gnc_tree_view_split_reg_set_uiupdate_cb (gnc_ledger_display2_get_split_view_register (gsr->ledger), cb, cb_data);
-}
diff --git a/src/html/Makefile.am b/src/html/Makefile.am
deleted file mode 100644
index 2826b43..0000000
--- a/src/html/Makefile.am
+++ /dev/null
@@ -1,95 +0,0 @@
-#SUBDIRS = . test
-SUBDIRS = .
-
-pkglib_LTLIBRARIES = libgncmod-html.la
-
-AM_CPPFLAGS = \
-  -I${top_srcdir}/src/core-utils \
-  -I${top_srcdir}/src/gnc-module \
-  -I${top_srcdir}/src/engine \
-  -I${top_srcdir}/src/gnome-utils \
-  -I${top_srcdir}/src/app-utils \
-  -I${top_srcdir}/src \
-  -I${top_builddir}/src \
-  -I${top_srcdir}/lib/libc \
-  ${GLIB_CFLAGS} \
-  ${GUILE_CFLAGS} \
-  ${GTK_CFLAGS} \
-  ${GNOME_CFLAGS} \
-  ${WEBKIT_CFLAGS}
-
-libgncmod_html_la_SOURCES = \
-  gncmod-html.c \
-  gnc-html.c \
-  gnc-html-history.c \
-  gnc-html-factory.c \
-  gnc-html-webkit2.c \
-  swig-gnc-html.c
-
-gncincludedir = ${GNC_INCLUDE_DIR}
-gncinclude_HEADERS = \
-  gnc-html-history.h \
-  gnc-html.h \
-  gnc-html-p.h \
-  gnc-html-factory.h \
-  gnc-html-webkit2.h \
-  gnc-html-extras.h \
-  gnc-html-webkit-p.h
-
-libgncmod_html_la_LDFLAGS = -avoid-version
-
-libgncmod_html_la_LIBADD = \
-  ${top_builddir}/src/core-utils/libgnc-core-utils.la \
-  ${top_builddir}/src/gnc-module/libgnc-module.la \
-  ${top_builddir}/src/engine/libgncmod-engine.la \
-  ${top_builddir}/src/gnome-utils/libgncmod-gnome-utils.la \
-  ${top_builddir}/src/app-utils/libgncmod-app-utils.la \
-  $(top_builddir)/lib/libc/libc-missing.la \
-  ${WEBKIT_LIBS} \
-  ${GTK_LIBS} \
-  ${GLIB_LIBS} \
-  ${DB_LIBS} \
-  ${GUILE_LIBS} \
-  ${REGEX_LIBS}
-
-if BUILDING_FROM_VCS
-swig-gnc-html.c: gnc-html.i gnc-html.h \
-                    ${top_srcdir}/src/base-typemaps.i
-	$(SWIG) -guile $(SWIG_ARGS) -Linkage module \
-	-I${top_srcdir}/src -o $@ $<
-if ! OS_WIN32
-if ! SWIG_DIST_FAIL
-	if ! `grep "define scm_from_utf8_string" $@ > /dev/null 2>&1`; then \
-	  patch $@ $(top_srcdir)/src/swig-utf8.patch; \
-	fi
-endif
-endif
-endif
-
-EXTRA_DIST = \
-  gnc-html.i \
-  CMakeLists.txt \
-  gnc-html-webkit.h \
-  gnc-html-webkit1.h \
-  gnc-html-webkit1.c
-
-CLEANFILES = $(BUILT_SOURCES) gnucash
-MAINTAINERCLEANFILES = swig-gnc-html.c
-
-# We do this only for the gnome help tool on Linux and MacPorts.
-if !PLATFORM_WIN32
-if !PLATFORM_OSX_QUARTZ
-#
-# I hate inconsistent standards. Autotools puts help files into
-# ${datadir}/gnome/help/${program} while the gnome2 libraries expect
-# them in ${pkgdatadir}/gnome/help/${program}.
-#
-install-data-hook:
-	$(LN_S) -f ../gnome ${DESTDIR}${pkgdatadir}
-
-uninstall-hook:
-	rm -f ${DESTDIR}${pkgdatadir}/gnome
-endif
-endif
-
-AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.html\"
diff --git a/src/import-export/CMakeLists.txt b/src/import-export/CMakeLists.txt
deleted file mode 100644
index 904183e..0000000
--- a/src/import-export/CMakeLists.txt
+++ /dev/null
@@ -1,86 +0,0 @@
-# CMakeLists.txt for src/import-export
-
-ADD_SUBDIRECTORY(test)
-
-# ############################################################
-ADD_SUBDIRECTORY(aqb)
-ADD_SUBDIRECTORY(csv-exp)
-ADD_SUBDIRECTORY(csv-imp)
-ADD_SUBDIRECTORY(gschemas)
-ADD_SUBDIRECTORY(log-replay)
-ADD_SUBDIRECTORY(ofx)
-ADD_SUBDIRECTORY(qif)
-ADD_SUBDIRECTORY(qif-imp)
-
-
-SET (generic_import_SOURCES
-  import-account-matcher.c
-  import-commodity-matcher.c
-  import-backend.c
-  import-format-dialog.c
-  import-match-picker.c
-  import-parse.c
-  import-utilities.c
-  import-settings.c
-  import-main-matcher.c
-  import-pending-matches.c
-  gncmod-generic-import.c
-)
-
-# Add dependency on config.h
-SET_SOURCE_FILES_PROPERTIES (${generic_import_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
-
-SET (generic_import_HEADERS
-  import-parse.h
-)
-
-SET (generic_import_noinst_HEADERS
-  import-account-matcher.h
-  import-backend.h
-  import-commodity-matcher.h
-  import-main-matcher.h
-  import-match-picker.h
-  import-pending-matches.h
-  import-settings.h
-  import-utilities.h
-)
-
-ADD_LIBRARY (gncmod-generic-import
-  ${generic_import_SOURCES}
-  ${generic_import_HEADERS}
-  ${generic_import_noinst_HEADERS}
-)
-
-TARGET_LINK_LIBRARIES(gncmod-generic-import gncmod-gnome-utils gncmod-engine ${GTK3_LDFLAGS} ${GLIB2_LDFLAGS})
-
-TARGET_COMPILE_DEFINITIONS (gncmod-generic-import PRIVATE -DG_LOG_DOMAIN=\"gnc.import\")
-
-TARGET_INCLUDE_DIRECTORIES(gncmod-generic-import PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
-
-
-INSTALL(TARGETS gncmod-generic-import
-  LIBRARY DESTINATION lib/gnucash
-  ARCHIVE DESTINATION lib/gnucash
-  RUNTIME DESTINATION bin
-)
-
-INSTALL(FILES ${generic_import_HEADERS} DESTINATION include/gnucash)
-
-SET(generic_import_GLADE dialog-import.glade)
-
-INSTALL(FILES ${generic_import_GLADE} DESTINATION share/gnucash/gtkbuilder)
-
-
-FILE(COPY ${generic_import_GLADE} DESTINATION ${DATADIR_BUILD}/gnucash/gtkbuilder)
-
-SET(generic_import_EXTRA_DIST generic-import-design.txt)
-
-SET_LOCAL_DIST(import_export_DIST_local CMakeLists.txt Makefile.am ${generic_import_SOURCES}
-        ${generic_import_HEADERS} ${generic_import_GLADE} ${generic_import_noinst_HEADERS}
-        ${generic_import_EXTRA_DIST})
-
-SET(import_export_DIST ${import_export_DIST_local} ${aqbanking_DIST}
-        ${csv_export_DIST} ${csv_import_DIST}
-        ${generic_import_gschema_DIST} ${log_report_DIST} ${ofx_DIST} ${qif_DIST} ${qif_import_DIST}
-        ${test_generic_import_DIST}
-        PARENT_SCOPE)
diff --git a/src/import-export/Makefile.am b/src/import-export/Makefile.am
deleted file mode 100644
index b276d0a..0000000
--- a/src/import-export/Makefile.am
+++ /dev/null
@@ -1,69 +0,0 @@
-if WITH_OFX
-    OFX_DIR=ofx
-endif
-if WITH_AQBANKING
-    AQBANKING_DIR=aqb
-endif
-SUBDIRS = . gschemas qif qif-imp \
-	${OFX_DIR} ${AQBANKING_DIR} log-replay test csv-imp csv-exp
-
-pkglib_LTLIBRARIES=libgncmod-generic-import.la
-
-libgncmod_generic_import_la_SOURCES = \
-	import-account-matcher.c \
-	import-commodity-matcher.c \
-	import-backend.c \
-	import-format-dialog.c \
-	import-match-picker.c \
-	import-parse.c \
-	import-utilities.c \
-	import-settings.c \
-	import-main-matcher.c \
-	import-pending-matches.c \
-	gncmod-generic-import.c
-
-gncincludedir = ${GNC_INCLUDE_DIR}
-gncinclude_HEADERS = \
-  import-parse.h
-
-noinst_HEADERS = \
-  import-account-matcher.h \
-  import-backend.h \
-  import-commodity-matcher.h \
-  import-main-matcher.h \
-  import-match-picker.h \
-  import-settings.h \
-  import-pending-matches.h \
-  import-utilities.h
-
-libgncmod_generic_import_la_LDFLAGS = -avoid-version
-
-libgncmod_generic_import_la_LIBADD = \
-  ${top_builddir}/src/gnome-utils/libgncmod-gnome-utils.la \
-  ${top_builddir}/src/app-utils/libgncmod-app-utils.la \
-  ${top_builddir}/src/engine/libgncmod-engine.la \
-  ${top_builddir}/src/core-utils/libgnc-core-utils.la \
-  ${top_builddir}/src/gnc-module/libgnc-module.la \
-  ${REGEX_LIBS} \
-  ${GLIB_LIBS}
-
-gtkbuilderdir = ${GNC_GTKBUILDER_DIR}
-gtkbuilder_DATA = dialog-import.glade
-
-AM_CPPFLAGS = \
-  -I${top_srcdir}/src \
-  -I${top_srcdir}/src/core-utils \
-  -I${top_srcdir}/src/engine \
-  -I${top_srcdir}/src/gnc-module \
-  -I${top_srcdir}/src/app-utils \
-  -I${top_srcdir}/src/gnome \
-  -I${top_srcdir}/src/gnome-utils \
-  ${GTK_CFLAGS} \
-  ${GLIB_CFLAGS}
-
-EXTRA_DIST = \
-  $(gtkbuilder_DATA) \
-  generic-import-design.txt \
-  CMakeLists.txt
-
-AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.i-e\"
diff --git a/src/import-export/aqb/CMakeLists.txt b/src/import-export/aqb/CMakeLists.txt
deleted file mode 100644
index 1355444..0000000
--- a/src/import-export/aqb/CMakeLists.txt
+++ /dev/null
@@ -1,91 +0,0 @@
-# CMakeLists.txt for src/import-export/aqbanking
-
-ADD_SUBDIRECTORY(gschemas)
-ADD_SUBDIRECTORY(test)
-
-SET (aqbanking_SOURCES
-  dialog-ab-trans.c
-  dialog-ab-daterange.c
-  assistant-ab-initial.c
-  gnc-ab-getbalance.c
-  gnc-ab-gettrans.c
-  gnc-ab-kvp.c
-  gnc-ab-transfer.c
-  gnc-ab-utils.c
-  gnc-file-aqb-import.c
-  gnc-gwen-gui.c
-  gnc-plugin-aqbanking.c
-  gncmod-aqbanking.c
-)
-
-# Add dependency on config.h
-SET_SOURCE_FILES_PROPERTIES (${aqbanking_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
-
-SET (aqbanking_noinst_HEADERS
-  dialog-ab-trans.h
-  dialog-ab-daterange.h
-  assistant-ab-initial.h
-  gnc-ab-getbalance.h
-  gnc-ab-gettrans.h
-  gnc-ab-kvp.h
-  gnc-ab-transfer.h
-  gnc-ab-utils.h
-  gnc-file-aqb-import.h
-  gnc-gwen-gui.h
-  gnc-plugin-aqbanking.h
-)
-
-SET(aqbanking_GLADE assistant-ab-initial.glade dialog-ab.glade dialog-ab-pref.glade)
-
-SET(aqbanking_UI gnc-plugin-aqbanking-ui.xml)
-
-IF(WITH_AQBANKING)
-  ADD_LIBRARY (gncmod-aqbanking
-    ${aqbanking_SOURCES}
-    ${aqbanking_noinst_HEADERS}
-  )
-
-  SET(AQB_EXPORT_SYMBOLS "")
-  IF (WIN32)
-    SET(AQB_EXPORT_SYMBOLS "-Wl,--export-all-symbols")
-  ENDIF()
-  SET(AQB_LIBSTDCXX "")
-  IF (MINGW)
-    SET(AQB_LIBSTDCXX "-lstdc++")
-  ENDIF()
-
-  TARGET_LINK_LIBRARIES(gncmod-aqbanking gnc-gnome gncmod-gnome-utils
-         gncmod-generic-import gncmod-register-core
-         gncmod-register-gnome gncmod-ledger-core gncmod-engine
-         ${AQB_EXPORT_SYMBOLS} ${AQBANKING_LDFLAGS}
-         ${GWENHYWFAR_LDFLAGS} ${GWENGUI_GTK2_LDFLAGS}
-         ${GNOME_LDFLAGS} ${KTOBLZCHECK_LDFLAGS} ${AQB_LIBSTDCXX})
-
-  TARGET_COMPILE_DEFINITIONS(gncmod-aqbanking PRIVATE -DG_LOG_DOMAIN=\"gnc.import.aqbanking\")
-
-  TARGET_INCLUDE_DIRECTORIES(gncmod-aqbanking PRIVATE ${AQBANKING_INCLUDE_DIRS}
-         ${GWENHYWFAR_INCLUDE_DIRS} ${KTOBLZCHECK_INCLUDE_DIRS})
-
-  INSTALL(TARGETS gncmod-aqbanking
-    LIBRARY DESTINATION lib/gnucash
-    ARCHIVE DESTINATION lib/gnucash
-    RUNTIME DESTINATION bin)
-
-# No headers to install
-
-
-  INSTALL(FILES ${aqbanking_GLADE} DESTINATION share/gnucash/gtkbuilder)
-
-  INSTALL(FILES ${aqbanking_UI} DESTINATION share/gnucash/ui)
-
-  FILE(COPY ${aqbanking_UI}
-    DESTINATION ${DATADIR_BUILD}/gnucash/ui)
-  FILE(COPY ${aqbanking_GLADE}
-    DESTINATION ${DATADIR_BUILD}/gnucash/gtkbuilder)
-ENDIF(WITH_AQBANKING)
-
-SET_LOCAL_DIST(aqbanking_DIST_local CMakeLists.txt Makefile.am migratable-prefs-aqbanking.xml
-        ${aqbanking_SOURCES} ${aqbanking_noinst_HEADERS} ${aqbanking_EXTRA_DIST}
-        ${aqbanking_GLADE} ${aqbanking_UI})
-
-SET(aqbanking_DIST ${aqbanking_DIST_local} ${aqbanking_gschema_DIST} ${test_aqb_DIST} PARENT_SCOPE)
diff --git a/src/import-export/aqb/Makefile.am b/src/import-export/aqb/Makefile.am
deleted file mode 100644
index 7ee956a..0000000
--- a/src/import-export/aqb/Makefile.am
+++ /dev/null
@@ -1,81 +0,0 @@
-SUBDIRS = . gschemas test
-
-pkglib_LTLIBRARIES = libgncmod-aqbanking.la
-
-libgncmod_aqbanking_la_SOURCES = \
-  dialog-ab-trans.c \
-  dialog-ab-daterange.c \
-  assistant-ab-initial.c \
-  gnc-ab-getbalance.c \
-  gnc-ab-gettrans.c \
-  gnc-ab-kvp.c \
-  gnc-ab-transfer.c \
-  gnc-ab-utils.c \
-  gnc-file-aqb-import.c \
-  gnc-gwen-gui.c \
-  gnc-plugin-aqbanking.c \
-  gncmod-aqbanking.c
-
-noinst_HEADERS = \
-  dialog-ab-trans.h \
-  dialog-ab-daterange.h \
-  assistant-ab-initial.h \
-  gnc-ab-getbalance.h \
-  gnc-ab-gettrans.h \
-  gnc-ab-kvp.h \
-  gnc-ab-transfer.h \
-  gnc-ab-utils.h \
-  gnc-file-aqb-import.h \
-  gnc-gwen-gui.h \
-  gnc-plugin-aqbanking.h
-
-libgncmod_aqbanking_la_LDFLAGS = -avoid-version
-if OS_WIN32
-libgncmod_aqbanking_la_LDFLAGS += -export-symbols-regex .*
-endif
-libgncmod_aqbanking_la_LIBADD = \
-  ${top_builddir}/src/import-export/libgncmod-generic-import.la \
-  ${top_builddir}/src/gnome/libgnc-gnome.la \
-  ${top_builddir}/src/gnome-utils/libgncmod-gnome-utils.la \
-  ${top_builddir}/src/app-utils/libgncmod-app-utils.la \
-  ${top_builddir}/src/engine/libgncmod-engine.la \
-  ${top_builddir}/src/core-utils/libgnc-core-utils.la \
-  ${top_builddir}/src/gnc-module/libgnc-module.la \
-  ${GTK_LIBS} \
-  ${GLIB_LIBS} \
-  ${GWENGUI_GTK2_LIBS} \
-  ${AQBANKING_LIBS}
-
-AM_CPPFLAGS = \
-  -I${top_srcdir}/src \
-  -I${top_srcdir}/src/import-export \
-  -I${top_srcdir}/src/gnome \
-  -I${top_srcdir}/src/register/ledger-core \
-  -I${top_srcdir}/src/register/register-gnome \
-  -I${top_srcdir}/src/register/register-core \
-  -I${top_srcdir}/src/gnome-utils \
-  -I${top_srcdir}/src/app-utils \
-  -I${top_srcdir}/src/engine \
-  -I${top_srcdir}/src/core-utils \
-  -I${top_srcdir}/src/gnc-module \
-  ${GTK_CFLAGS} \
-  ${GLIB_CFLAGS} \
-  ${AQBANKING_CFLAGS}
-
-uidir = $(GNC_UI_DIR)
-ui_DATA = \
-  gnc-plugin-aqbanking-ui.xml
-
-gtkbuilderdir = $(GNC_GTKBUILDER_DIR)
-gtkbuilder_DATA = \
-  assistant-ab-initial.glade \
-  dialog-ab.glade \
-  dialog-ab-pref.glade
-
-EXTRA_DIST = \
-    ${ui_DATA} \
-    ${gtkbuilder_DATA} \
-    migratable-prefs-aqbanking.xml \
-    CMakeLists.txt
-
-AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.import.aqbanking\"
diff --git a/src/import-export/aqb/test/CMakeLists.txt b/src/import-export/aqb/test/CMakeLists.txt
deleted file mode 100644
index 2fd2379..0000000
--- a/src/import-export/aqb/test/CMakeLists.txt
+++ /dev/null
@@ -1,36 +0,0 @@
-set(test_aqb_SOURCES test-aqb.c test-kvp.c)
-
-set(test_aqb_INCLUDE_DIRS
-  ${CMAKE_BINARY_DIR}/src
-  ${CMAKE_SOURCE_DIR}/src/import-export/aqb
-  ${CMAKE_SOURCE_DIR}/src
-  ${CMAKE_SOURCE_DIR}/src/import-export
-  ${CMAKE_SOURCE_DIR}/src/gnome
-  ${CMAKE_SOURCE_DIR}/src/register/ledger-core
-  ${CMAKE_SOURCE_DIR}/src/register/regiser-gnome
-  ${CMAKE_SOURCE_DIR}/src/register/regitser-core
-  ${CMAKE_SOURCE_DIR}/src/gnome-utils
-  ${CMAKE_SOURCE_DIR}/src/app-utils
-  ${CMAKE_SOURCE_DIR}/src/engine
-  ${CMAKE_SOURCE_DIR}/src/core-utils
-  ${CMAKE_SOURCE_DIR}/src/gnc-module
-  ${GLIB2_INCLUDE_DIRS}
-  ${GTK_INCLUDE_DIRS}
-  ${AQBANKING_INCLUDE_DIRS}
-)
-
-set(test_aqb_LIBS
-  gncmod-aqbanking gncmod-generic-import gnc-gnome gncmod-gnome-utils
-  gncmod-ledger-core gncmod-report-gnome gncmod-app-utils
-  gncmod-backend-xml-utils gncmod-engine gnc-core-utils gnc-module
-  ${GLIB2_LDFLAGS}
-)
-
-SET_DIST_LIST(test_aqb_DIST ${test_aqb_SOURCES} file-book.gnucash
-  file-book-hbcislot.gnucash CMakeLists.txt Makefile.am)
-IF(WITH_AQBANKING)
-  GNC_ADD_TEST(test-aqb
-    "${test_aqb_SOURCES}"
-    test_aqb_INCLUDE_DIRS
-    test_aqb_LIBS SRCDIR=${CMAKE_CURRENT_SOURCE_DIR})
- ENDIF()
diff --git a/src/import-export/aqb/test/Makefile.am b/src/import-export/aqb/test/Makefile.am
deleted file mode 100644
index e2abe12..0000000
--- a/src/import-export/aqb/test/Makefile.am
+++ /dev/null
@@ -1,72 +0,0 @@
-# A template Makefile.am for GLib g_test-based test directories.
-# Copyright 2011 John Ralls <jralls at ceridwen.us>
-
-include $(top_srcdir)/test-templates/Makefile.decl
-
-
-#You will only need one of these: It points to the module directory
-#after $(top_srcdir) or ${top_builddir}:
-MODULEPATH = src/import-export/aqb
-
-#The test program. You'll need to add to this if you have more than one module above.
-
-check_PROGRAMS = test-aqb
-
-TESTS = ${check_PROGRAMS}
-
-test_aqbdir = ${top_srcdir}/${MODULEPATH}/test
-
-#Program files for tests go here. It's probably best to have one for
-#each file in the parent directory. Include
-#test_foo_support.c if you have one and aren't building the
-#support library.
-test_aqb_SOURCES = \
-  test-aqb.c \
-  test-kvp.c
-
-test_aqb_HEADERSS =
-
-#The tests might require more libraries, but try to keep them
-#as independent as possible.
-test_aqb_LDADD = \
-  ${top_builddir}/${MODULEPATH}/libgncmod-aqbanking.la \
-  ${top_builddir}/src/import-export/libgncmod-generic-import.la \
-  ${top_builddir}/src/gnome/libgnc-gnome.la \
-  ${top_builddir}/src/gnome-utils/libgncmod-gnome-utils.la \
-  ${top_builddir}/src/register/ledger-core/libgncmod-ledger-core.la \
-  ${top_builddir}/src/report/report-gnome/libgncmod-report-gnome.la \
-  ${top_builddir}/src/app-utils/libgncmod-app-utils.la \
-  ${top_builddir}/src/backend/xml/libgnc-backend-xml-utils.la \
-  ${top_builddir}/src/engine/libgncmod-engine.la \
-  ${top_builddir}/src/core-utils/libgnc-core-utils.la \
-  ${top_builddir}/src/gnc-module/libgnc-module.la \
-  ${GLIB_LIBS}
-
-test_aqb_CFLAGS = \
-	-DTESTPROG=test_aqb \
-	${DEFAULT_INCLUDES} \
-	-I$(top_srcdir)/${MODULEPATH}/ \
-  -I${top_srcdir}/src \
-  -I${top_srcdir}/src/import-export \
-  -I${top_srcdir}/src/gnome \
-  -I${top_srcdir}/src/register/ledger-core \
-  -I${top_srcdir}/src/register/register-gnome \
-  -I${top_srcdir}/src/register/register-core \
-  -I${top_srcdir}/src/gnome-utils \
-  -I${top_srcdir}/src/app-utils \
-  -I${top_srcdir}/src/engine \
-  -I${top_srcdir}/src/core-utils \
-  -I${top_srcdir}/src/gnc-module \
-  ${GTK_CFLAGS} \
-  ${GLIB_CFLAGS} \
-  ${AQBANKING_CFLAGS}
-
-  TESTS_ENVIRONMENT = \
-  GNC_BUILDDIR=${abs_top_builddir} \
-  SRCDIR=${srcdir} \
-  G_DEBUG=
-
-EXTRA_DIST += \
-  file-book-hbcislot.gnucash \
-  file-book.gnucash \
-  CMakeLists.txt
diff --git a/src/import-export/aqb/test/test-aqb.c b/src/import-export/aqb/test/test-aqb.c
deleted file mode 100644
index 95c8860..0000000
--- a/src/import-export/aqb/test/test-aqb.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/********************************************************************
- * testmain.c: GLib g_test test execution file.			    *
- * Copyright 2011 John Ralls <jralls at ceridwen.us>		    *
- *                                                                  *
- * 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 at gnu.org                   *
-\********************************************************************/
-
-
-/* This is a template test program. Copy it to the test sudirectory and rename it test_modulename.c. (Use the same modulename that you gave Makefile.am in the same directory.
-Write and link other test files */
-#include <glib.h>
-#include "config.h"
-#include <qof.h>
-#include "backend/xml/gnc-backend-xml.h"
-#include "gnc-module/gnc-module.h"
-#include "engine/gnc-engine.h"
-#include <engine/TransLog.h>
-
-extern void test_qofsession_aqb_kvp( void );
-
-int
-main (int   argc,
-      char *argv[])
-{
-    g_setenv ("GNC_UNINSTALLED", "1", TRUE);
-    qof_init(); 			/* Initialize the GObject system */
-    qof_log_init_filename_special("stderr"); /* Init the log system */
-    g_test_init ( &argc, &argv, NULL ); 	/* initialize test program */
-    qof_log_set_level("gnc", (QofLogLevel)G_LOG_LEVEL_DEBUG);
-    g_test_bug_base("https://bugzilla.gnome.org/show_bug.cgi?id="); /* init the bugzilla URL */
-    /* Disable the transaction log */
-    xaccLogDisable();
-
-    gnc_module_system_init();
-    gnc_engine_init(argc, argv);
-
-    /* Add test functions and suites. See
-     * http://library.gnome.org/devel/glib/stable/glib-Testing.html for
-     * details. Unfortunately, GLib-Testing doesn't provide the automatic
-     * registration features of more sophisticated frameworks. */
-    g_test_add_func ("/src/import-export/aqb/kvp", test_qofsession_aqb_kvp);
-
-    return g_test_run();
-}
-
-
diff --git a/src/import-export/aqb/test/test-kvp.c b/src/import-export/aqb/test/test-kvp.c
deleted file mode 100644
index db1fd55..0000000
--- a/src/import-export/aqb/test/test-kvp.c
+++ /dev/null
@@ -1,209 +0,0 @@
-/********************************************************************
- * test_submodule.c: Example GLib g_test test suite.		    *
- * Copyright 2011 John Ralls <jralls at ceridwen.us>		    *
- *                                                                  *
- * 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 at gnu.org                   *
-\********************************************************************/
-
-#include <config.h>
-#include <glib.h>
-
-// for the gnc_ab_get_book_template_list() et al. functions
-#include "import-export/aqb/gnc-ab-kvp.h"
-#include <gnc-aqbanking-templates.h>
-#include <qofinstance-p.h>
-#include "engine/gnc-hooks.h"
-
-void test_qofsession_aqb_kvp (void);
-
-static char* get_filepath(const char* filename)
-{
-    char *result;
-
-    const char *srcdir = g_getenv("SRCDIR");
-    if (!srcdir)
-    {
-        g_test_message("No env variable SRCDIR exists, assuming \".\"\n");
-        srcdir = ".";
-    }
-
-    result = g_strdup_printf("%s/%s", srcdir, filename);
-
-    g_test_message("Using file path %s\n", result);
-
-    // Test whether the file really exists
-    g_assert(g_file_test(result, G_FILE_TEST_EXISTS));
-
-    return result;
-}
-
-void
-test_qofsession_aqb_kvp( void )
-{
-    /* load the accounts from the users datafile */
-    /* but first, check to make sure we've got a session going. */
-    QofBackendError io_err;
-    char *file1 = get_filepath("file-book.gnucash");
-    char *file2 = get_filepath("file-book-hbcislot.gnucash");
-
-    if (1)
-    {
-        // A file with no content at all, but a valid XML file
-        QofSession *new_session = qof_session_new ();
-        char *newfile = g_strdup_printf("file://%s", file1);
-
-        qof_session_begin (new_session, newfile, TRUE, FALSE, FALSE);
-        io_err = qof_session_get_error (new_session);
-        //printf("io_err1 = %d\n", io_err);
-        g_assert(io_err != ERR_BACKEND_NO_HANDLER); // Do not have no handler
-
-        g_assert(io_err != ERR_BACKEND_NO_SUCH_DB); // DB must exist
-        g_assert(io_err != ERR_BACKEND_LOCKED);
-        g_assert(io_err == 0);
-
-        qof_session_load (new_session, NULL);
-        io_err = qof_session_get_error (new_session);
-        //printf("io_err2 = %d\n", io_err);
-        g_assert(io_err == 0);
-
-        g_free(newfile);
-        g_free(file1);
-
-        gnc_hook_run(HOOK_BOOK_CLOSED, new_session);
-        //qof_session_destroy(new_session); // tries to delete the LCK file but it wasn't created in the first place
-    }
-
-    if (1)
-    {
-        // A file with no content except for the book_template_list kvp
-        // slot
-        QofSession *new_session = qof_session_new ();
-        char *newfile = g_strdup_printf("file://%s", file2);
-
-        qof_session_begin (new_session, newfile, TRUE, FALSE, FALSE);
-        io_err = qof_session_get_error (new_session);
-        //printf("io_err1 = %d\n", io_err);
-        g_assert(io_err != ERR_BACKEND_NO_HANDLER); // Do not have no handler
-
-        g_assert(io_err != ERR_BACKEND_NO_SUCH_DB); // DB must exist
-        g_assert(io_err != ERR_BACKEND_LOCKED);
-        g_assert(io_err == 0);
-
-        qof_session_load (new_session, NULL);
-        io_err = qof_session_get_error (new_session);
-        //printf("io_err2 = %d\n", io_err);
-        g_assert(io_err == 0);
-
-        {
-            GList *templ_list;
-            GncABTransTempl *templ;
-            QofBook *book = qof_session_get_book(new_session);
-            const char* ORIGINAL_NAME = "Some Name";
-            const char* CHANGED_NAME = "Some Changed Name";
-
-            templ_list = gnc_ab_trans_templ_list_new_from_book (book);
-            g_assert_cmpint(g_list_length(templ_list), ==, 1);
-
-            templ = templ_list->data;
-	    //Raise the edit level so that we can check that it's marked dirty.
-	    qof_instance_increase_editlevel(QOF_INSTANCE(book));
-	    g_assert_cmpstr(gnc_ab_trans_templ_get_name(templ), ==, ORIGINAL_NAME); // ok, name from file is here
-
-            // Now we change the name into something else and verify it can be saved
-            gnc_ab_trans_templ_set_name(templ, CHANGED_NAME);
-            {
-                g_assert(!qof_instance_get_dirty(QOF_INSTANCE(book))); // not yet dirty
-
-                // Here we save the changed kvp
-                gnc_ab_set_book_template_list(book, templ_list);
-                g_assert(qof_instance_get_dirty(QOF_INSTANCE(book))); // yup, now dirty
-                gnc_ab_trans_templ_list_free(templ_list);
-            }
-
-            {
-                templ_list = gnc_ab_trans_templ_list_new_from_book (book);
-                g_assert_cmpint(g_list_length(templ_list), ==, 1);
-
-                templ = templ_list->data;
-                g_assert_cmpstr(gnc_ab_trans_templ_get_name(templ), ==, CHANGED_NAME); // ok, the change has been saved!
-                gnc_ab_trans_templ_list_free(templ_list);
-            }
-        }
-
-        {
-            // Check the kvp slots of a aqbanking-enabled account
-            QofBook *book = qof_session_get_book(new_session);
-            Account* account = gnc_book_get_root_account(book);
-            GDate retrieved_date, original_date;
-            gchar buff[MAX_DATE_LENGTH];
-
-            g_assert(account);
-
-            // The interesting test case here: Can we read the correct date
-            // from the xml file?
-            if (1)
-            {
-                Timespec retrieved_ts = gnc_ab_get_account_trans_retrieval(account);
-                g_test_message("retrieved_ts=%s\n", gnc_print_date(retrieved_ts));
-                //printf("Time=%s\n", gnc_print_date(retrieved_ts));
-
-                retrieved_date = timespec_to_gdate(retrieved_ts);
-                g_date_set_dmy(&original_date, 29, 8, 2014);
-
-                g_assert_cmpint(g_date_compare(&retrieved_date, &original_date), ==, 0);
-            }
-
-            // A lower-level test here: Can we write and read again the
-            // trans_retrieval date? This wouldn't need this particular
-            // Account, just a general Account object.
-            if (0)
-            {
-                Timespec original_ts = timespec_now(), retrieved_ts;
-
-                // Check whether the "ab-trans-retrieval" property of Account
-                // is written and read again correctly.
-                gnc_ab_set_account_trans_retrieval(account, original_ts);
-                retrieved_ts = gnc_ab_get_account_trans_retrieval(account);
-
-//                printf("original_ts=%s = %d  retrieved_ts=%s = %d\n",
-//                       gnc_print_date(original_ts), original_ts.tv_sec,
-//                       gnc_print_date(retrieved_ts), retrieved_ts.tv_sec);
-
-                original_date = timespec_to_gdate(original_ts);
-                retrieved_date = timespec_to_gdate(retrieved_ts);
-
-                qof_print_gdate (buff, sizeof (buff), &original_date);
-                //printf("original_date=%s\n", buff);
-                qof_print_gdate (buff, sizeof (buff), &retrieved_date);
-                //printf("retrieved_date=%s\n", buff);
-
-                // Is the retrieved date identical to the one written
-                g_assert_cmpint(g_date_compare(&retrieved_date, &original_date), ==, 0);
-            }
-
-        }
-
-        g_free(newfile);
-        g_free(file2);
-
-        gnc_hook_run(HOOK_BOOK_CLOSED, new_session);
-        //qof_session_destroy(new_session); // tries to delete the LCK file but it wasn't created in the first place
-    }
-
-
-}
diff --git a/src/import-export/csv-exp/Makefile.am b/src/import-export/csv-exp/Makefile.am
deleted file mode 100644
index b3177da..0000000
--- a/src/import-export/csv-exp/Makefile.am
+++ /dev/null
@@ -1,60 +0,0 @@
-SUBDIRS = . gschemas
-
-pkglib_LTLIBRARIES=libgncmod-csv-export.la
-
-libgncmod_csv_export_la_SOURCES = \
-  gncmod-csv-export.c \
-  gnc-plugin-csv-export.c \
-  assistant-csv-export.c \
-  csv-tree-export.c \
-  csv-transactions-export.c
-
-noinst_HEADERS = \
-  gnc-plugin-csv-export.h \
-  assistant-csv-export.h \
-  csv-tree-export.h \
-  csv-transactions-export.h
-
-libgncmod_csv_export_la_LDFLAGS = -avoid-version
-
-libgncmod_csv_export_la_LIBADD = \
-  ${top_builddir}/src/import-export/libgncmod-generic-import.la \
-  ${top_builddir}/src/gnome-utils/libgncmod-gnome-utils.la \
-  ${top_builddir}/src/app-utils/libgncmod-app-utils.la \
-  ${top_builddir}/src/gnome/libgnc-gnome.la \
-  ${top_builddir}/src/engine/libgncmod-engine.la \
-  ${top_builddir}/src/core-utils/libgnc-core-utils.la \
-  ${top_builddir}/src/gnc-module/libgnc-module.la \
-  ${top_builddir}/lib/libc/libc-missing.la \
-  ${GTK_LIBS} \
-  ${GLIB_LIBS}
-
-AM_CPPFLAGS = \
-  -I${top_srcdir}/src \
-  -I${top_srcdir}/src/core-utils \
-  -I${top_srcdir}/src/engine \
-  -I${top_srcdir}/src/gnc-module \
-  -I${top_srcdir}/src/app-utils \
-  -I${top_srcdir}/src/gnome \
-  -I${top_srcdir}/src/gnome-utils \
-  -I${top_srcdir}/src/register/ledger-core \
-  -I${top_srcdir}/src/register/register-core \
-  -I${top_srcdir}/src/register/register-gnome \
-  -I${top_srcdir}/src/import-export \
-  -I${top_srcdir}/lib/libc \
-  -I${top_srcdir}/lib \
-  ${GUILE_CFLAGS} \
-  ${GLIB_CFLAGS} \
-  $(GTK_CFLAGS)
-
-uidir = $(GNC_UI_DIR)
-ui_DATA = \
-	gnc-plugin-csv-export-ui.xml
-
-gtkbuilderdir = ${GNC_GTKBUILDER_DIR}
-gtkbuilder_DATA = \
-	assistant-csv-export.glade
-
-EXTRA_DIST = $(ui_DATA) $(gtkbuilder_DATA) CMakeLists.txt
-
-AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.export.csv\"
diff --git a/src/import-export/csv-imp/Makefile.am b/src/import-export/csv-imp/Makefile.am
deleted file mode 100644
index d57ccbd..0000000
--- a/src/import-export/csv-imp/Makefile.am
+++ /dev/null
@@ -1,83 +0,0 @@
-SUBDIRS = . gschemas test
-
-pkglib_LTLIBRARIES=libgncmod-csv-import.la
-
-libgncmod_csv_import_la_SOURCES = \
-  gncmod-csv-import.c \
-  assistant-csv-account-import.c \
-  assistant-csv-trans-import.cpp \
-  gnc-plugin-csv-import.c \
-  csv-account-import.c \
-  gnc-csv-account-map.c \
-  gnc-csv-tokenizer.cpp \
-  gnc-csv-gnumeric-popup.c \
-  gnc-dummy-tokenizer.cpp \
-  gnc-fw-tokenizer.cpp \
-  gnc-tokenizer.cpp \
-  gnc-tx-import.cpp \
-  gnc-trans-props.cpp \
-  gnc-csv-trans-settings.cpp
-
-noinst_HEADERS = \
-  assistant-csv-account-import.h \
-  assistant-csv-trans-import.h \
-  gnc-plugin-csv-import.h \
-  csv-account-import.h \
-  gnc-csv-account-map.h \
-  gnc-csv-tokenizer.hpp \
-  gnc-csv-gnumeric-popup.h \
-  gnc-dummy-tokenizer.hpp \
-  gnc-fw-tokenizer.hpp \
-  gnc-tokenizer.hpp \
-  gnc-tx-import.hpp \
-  gnc-trans-props.hpp \
-  gnc-csv-trans-settings.hpp
-
-libgncmod_csv_import_la_LDFLAGS = -avoid-version
-
-libgncmod_csv_import_la_LIBADD = \
-  ${top_builddir}/src/import-export/libgncmod-generic-import.la \
-  ${top_builddir}/src/gnome-utils/libgncmod-gnome-utils.la \
-  ${top_builddir}/src/app-utils/libgncmod-app-utils.la \
-  ${top_builddir}/src/engine/libgncmod-engine.la \
-  ${top_builddir}/src/core-utils/libgnc-core-utils.la \
-  ${top_builddir}/src/gnc-module/libgnc-module.la \
-  ${top_builddir}/lib/goffice/libgnc-goffice.la \
-  ${top_builddir}/lib/libc/libc-missing.la \
-  ${GLIB_LIBS} \
-  ${GTK_LIBS} \
-  ${ICU4C_I18N_LIBS} \
-  ${BOOST_LDFLAGS} \
-  -lboost_regex \
-  -lboost_locale
-
-AM_CPPFLAGS = \
-  -I${top_srcdir}/src \
-  -I${top_srcdir}/src/core-utils \
-  -I${top_srcdir}/src/engine \
-  -I${top_srcdir}/src/gnc-module \
-  -I${top_srcdir}/src/app-utils \
-  -I${top_srcdir}/src/gnome \
-  -I${top_srcdir}/src/gnome-utils \
-  -I${top_srcdir}/src/import-export \
-  -I${top_srcdir}/lib/libc \
-  -I${top_srcdir}/lib/goffice \
-  -I${top_srcdir}/lib \
-  ${GUILE_CFLAGS} \
-  ${GLIB_CFLAGS} \
-  ${GTK_CFLAGS} \
-  ${ICU4C_I18N_CFLAGS} \
-  ${BOOST_CPPFLAGS}
-
-uidir = $(GNC_UI_DIR)
-ui_DATA = \
-	gnc-plugin-csv-import-ui.xml
-
-gtkbuilderdir = ${GNC_GTKBUILDER_DIR}
-gtkbuilder_DATA = \
-	assistant-csv-account-import.glade \
-	assistant-csv-trans-import.glade
-
-EXTRA_DIST = $(ui_DATA) $(gtkbuilder_DATA) CMakeLists.txt
-
-AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.import.csv\"
diff --git a/src/import-export/csv-imp/test/CMakeLists.txt b/src/import-export/csv-imp/test/CMakeLists.txt
deleted file mode 100644
index 66bd440..0000000
--- a/src/import-export/csv-imp/test/CMakeLists.txt
+++ /dev/null
@@ -1,37 +0,0 @@
-
-SET(CSV_IMP_TEST_INCLUDE_DIRS
-  ${CMAKE_BINARY_DIR}/src # for config.h
-  ${CMAKE_SOURCE_DIR}/src
-  ${CMAKE_SOURCE_DIR}/src/engine
-  ${CMAKE_SOURCE_DIR}/src/test-core
-  ${CMAKE_SOURCE_DIR}/lib
-  ${GLIB2_INCLUDE_DIRS}
-)
-SET(CSV_IMP_TEST_LIBS gncmod-csv-import gncmod-engine test-core)
-
-# This test does not run in Win32
-IF (NOT WIN32)
-  SET(MODULEPATH ${CMAKE_SOURCE_DIR}/src/import-export/csv-imp)
-  SET(gtest_csv_imp_LIBS gncmod-csv-import ${GLIB2_LDFLAGS} ${GTEST_LIB})
-  SET(gtest_csv_imp_INCLUDES
-    ${MODULEPATH}
-    ${CSV_IMP_TEST_INCLUDE_DIRS}
-    ${GTEST_INCLUDE_DIR})
-
-  SET(test_tokenizer_SOURCES
-    test-tokenizer.cpp
-    ${GTEST_SRC})
-  GNC_ADD_TEST(test-tokenizer "${test_tokenizer_SOURCES}"
-    gtest_csv_imp_INCLUDES gtest_csv_imp_LIBS
-    SRCDIR=${CMAKE_SOURCE_DIR}/src/import-export/csv-imp/test)
-
-  SET(test_tx_import_SOURCES
-    test-tx-import.cpp
-    ${GTEST_SRC})
-  GNC_ADD_TEST(test-tx_import "${test_tx_import_SOURCES}"
-    gtest_csv_imp_INCLUDES gtest_csv_imp_LIBS)
-ENDIF()
-
-SET_DIST_LIST(test_csv_import_DIST CMakeLists.txt Makefile.am
-    test-tx-import.cpp test-tokenizer.cpp
-    sample1.csv ${test_csv_imp_SOURCES})
diff --git a/src/import-export/csv-imp/test/Makefile.am b/src/import-export/csv-imp/test/Makefile.am
deleted file mode 100644
index 8ae7d61..0000000
--- a/src/import-export/csv-imp/test/Makefile.am
+++ /dev/null
@@ -1,118 +0,0 @@
-# A template Makefile.am for GLib g_test-based test directories.
-# Copyright 2011 John Ralls <jralls at ceridwen.us>
-
-include $(top_srcdir)/test-templates/Makefile.decl
-
-
-#You will only need one of these: It points to the module directory
-#after $(top_srcdir) or ${top_builddir}:
-MODULEPATH = src/import-export/csv-imp
-
-#The test program. You'll need to add to this if you have more than one module above.
-
-check_PROGRAMS = test-tokenizer \
-                 test-tx-import
-
-TESTS = ${check_PROGRAMS}
-
-#Program files for tests go here. It's probably best to have one for
-#each file in the parent directory. Include
-#test_foo_support.c if you have one and aren't building the
-#support library.
-test_tokenizer_SOURCES = \
-    test-tokenizer.cpp
-
-test_tx_import_SOURCES = \
-    test-tx-import.cpp
-
-if !GOOGLE_TEST_LIBS
-nodist_test_tokenizer_SOURCES = \
-        ${GTEST_SRC}/src/gtest_main.cc
-
-nodist_test_tx_import_SOURCES = \
-        ${GTEST_SRC}/src/gtest_main.cc
-endif
-
-IMP_TEST_CPPFLAGS =  \
-	${DEFAULT_INCLUDES} \
-	-I$(top_srcdir)/${MODULEPATH}/ \
-  -I${top_srcdir}/src/test-core \
-  -I${top_srcdir}/src \
-  -I${top_srcdir}/src/import-export \
-  -I${top_srcdir}/src/gnome \
-  -I${top_srcdir}/src/register/ledger-core \
-  -I${top_srcdir}/src/register/register-gnome \
-  -I${top_srcdir}/src/register/register-core \
-  -I${top_srcdir}/src/gnome-utils \
-  -I${top_srcdir}/src/app-utils \
-  -I${top_srcdir}/src/engine \
-  -I${top_srcdir}/src/core-utils \
-  -I${top_srcdir}/src/gnc-module \
-  -I${top_srcdir}/lib/libc \
-  -I${top_srcdir}/lib \
-  ${GTK_CFLAGS} \
-  ${GLIB_CFLAGS} \
-  $(BOOST_CPPFLAGS)
-
-test_tokenizer_CPPFLAGS = \
-  -I$(GTEST_HEADERS) \
-  $(IMP_TEST_CPPFLAGS)
-
-test_tx_import_CPPFLAGS = \
-  -I$(GTEST_HEADERS) \
-  $(IMP_TEST_CPPFLAGS)
-
-#The tests might require more libraries, but try to keep them
-#as independent as possible.
-IMP_TEST_LDFLAGS = \
-  ${top_builddir}/${MODULEPATH}/libgncmod-csv-import.la \
-  ${top_builddir}/src/import-export/libgncmod-generic-import.la \
-  ${top_builddir}/src/gnome/libgnc-gnome.la \
-  ${top_builddir}/src/gnome-utils/libgncmod-gnome-utils.la \
-  ${top_builddir}/src/register/ledger-core/libgncmod-ledger-core.la \
-  ${top_builddir}/src/report/report-gnome/libgncmod-report-gnome.la \
-  ${top_builddir}/src/app-utils/libgncmod-app-utils.la \
-  ${top_builddir}/src/backend/xml/libgnc-backend-xml-utils.la \
-  ${top_builddir}/src/engine/libgncmod-engine.la \
-  ${top_builddir}/src/core-utils/libgnc-core-utils.la \
-  ${top_builddir}/src/gnc-module/libgnc-module.la \
-  ${GLIB_LIBS} \
-  $(BOOST_LDFLAGS)
-
-test_tokenizer_LDADD = \
-  ${IMP_TEST_LDFLAGS} \
-  $(GTEST_LIBS)
-
-test_tx_import_LDADD = \
-  ${IMP_TEST_LDFLAGS} \
-  $(GTEST_LIBS)
-
-GNC_TEST_DEPS = \
---library-dir    ${top_builddir}/${MODULEPATH} \
---library-dir    ${top_builddir}/src/import-export \
---library-dir    ${top_builddir}/src/gnome \
---library-dir    ${top_builddir}/src/gnome-utils \
---library-dir    ${top_builddir}/src/gnome-search \
---library-dir    ${top_builddir}/src/register/ledger-core \
---library-dir    ${top_builddir}/src/register/register-core \
---library-dir    ${top_builddir}/src/register/register-gnome \
---library-dir    ${top_builddir}/src/report/report-system \
---library-dir    ${top_builddir}/src/report/report-gnome \
---library-dir    ${top_builddir}/src/html \
---library-dir    ${top_builddir}/src/app-utils \
---library-dir    ${top_builddir}/src/backend/xml \
---library-dir    ${top_builddir}/src/engine \
---library-dir    ${top_builddir}/src/core-utils \
---library-dir    ${top_builddir}/src/gnc-module
-
-TESTS_ENVIRONMENT = \
-  SRCDIR=${srcdir} \
-  G_DEBUG= \
-  $(shell ${abs_top_srcdir}/src/gnc-test-env.pl --noexports ${GNC_TEST_DEPS})
-
-EXTRA_DIST += \
-  sample1.csv \
-  CMakeLists.txt
-
-
-AM_CPPFLAGS = -DG_LOG_DOMAIN=\"gnc.import.csv\"
diff --git a/src/import-export/import-main-matcher.c b/src/import-export/import-main-matcher.c
deleted file mode 100644
index 15472db..0000000
--- a/src/import-export/import-main-matcher.c
+++ /dev/null
@@ -1,916 +0,0 @@
-/********************************************************************\
- * import-main-matcher.c - Transaction matcher main window          *
- *                                                                  *
- * Copyright (C) 2002 Benoit Grégoire <bock at step.polymtl.ca>        *
- * Copyright (C) 2002 Christian Stimming                            *
- * Copyright (c) 2006 David Hampton <hampton at employees.org>         *
- * Copyright (C) 2012 Robert Fewell                                 *
- *                                                                  *
- * 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 at gnu.org                   *
-\********************************************************************/
-/** @addtogroup Import_Export
-    @{ */
-/** @internal
-    @file import-main-matcher.c
-    @brief Transaction matcher main window
-    @author Copyright (C) 2002 Benoit Grégoire
-    @author Christian Stimming
-    @author Copyright (c) 2006 David Hampton <hampton at employees.org>
-*/
-#include "config.h"
-
-#include <gtk/gtk.h>
-#include <glib/gi18n.h>
-
-#include "import-main-matcher.h"
-
-#include "dialog-utils.h"
-#include "gnc-ui.h"
-#include "gnc-ui-util.h"
-#include "gnc-engine.h"
-#include "import-settings.h"
-#include "import-match-picker.h"
-#include "import-backend.h"
-#include "import-account-matcher.h"
-#include "import-pending-matches.h"
-#include "app-utils/gnc-component-manager.h"
-#include "guid.h"
-
-#define GNC_PREFS_GROUP "dialogs.import.generic.transaction-list"
-
-struct _main_matcher_info
-{
-    GtkWidget *dialog;
-    GtkWidget *assistant;
-    GtkTreeView *view;
-    GNCImportSettings *user_settings;
-    int selected_row;
-    GNCTransactionProcessedCB transaction_processed_cb;
-    gpointer user_data;
-    GNCImportPendingMatches *pending_matches;
-};
-
-enum downloaded_cols
-{
-    DOWNLOADED_COL_DATE = 0,
-    DOWNLOADED_COL_ACCOUNT,
-    DOWNLOADED_COL_AMOUNT,
-    DOWNLOADED_COL_DESCRIPTION,
-    DOWNLOADED_COL_MEMO,
-    DOWNLOADED_COL_ACTION_ADD,
-    DOWNLOADED_COL_ACTION_CLEAR,
-    DOWNLOADED_COL_ACTION_UPDATE,
-    DOWNLOADED_COL_ACTION_INFO,
-    DOWNLOADED_COL_ACTION_PIXBUF,
-    DOWNLOADED_COL_DATA,
-    DOWNLOADED_COL_COLOR,
-    NUM_DOWNLOADED_COLS
-};
-
-#define COLOR_RED    "brown1"
-#define COLOR_YELLOW "gold"
-#define COLOR_GREEN  "DarkSeaGreen1"
-
-static QofLogModule log_module = GNC_MOD_IMPORT;
-
-void on_matcher_ok_clicked (GtkButton *button, GNCImportMainMatcher *info);
-void on_matcher_cancel_clicked (GtkButton *button, gpointer user_data);
-void on_matcher_help_clicked (GtkButton *button, gpointer user_data);
-void on_matcher_help_close_clicked (GtkButton *button, gpointer user_data);
-
-/* Local prototypes */
-static void
-refresh_model_row(GNCImportMainMatcher *gui, GtkTreeModel *model,
-                  GtkTreeIter *iter, GNCImportTransInfo *info);
-
-void gnc_gen_trans_list_delete (GNCImportMainMatcher *info)
-{
-    GtkTreeModel *model;
-    GtkTreeIter iter;
-    GNCImportTransInfo *trans_info;
-
-    if (info == NULL)
-        return;
-
-    model = gtk_tree_view_get_model(info->view);
-    if (gtk_tree_model_get_iter_first(model, &iter))
-    {
-        do
-        {
-            gtk_tree_model_get(model, &iter,
-                               DOWNLOADED_COL_DATA, &trans_info,
-                               -1);
-
-            if (info->transaction_processed_cb)
-            {
-                info->transaction_processed_cb(trans_info,
-                                               FALSE,
-                                               info->user_data);
-            }
-
-            gnc_import_TransInfo_delete(trans_info);
-        }
-        while (gtk_tree_model_iter_next (model, &iter));
-    }
-
-
-    if (!(info->dialog == NULL))
-    {
-        gnc_save_window_size(GNC_PREFS_GROUP, GTK_WINDOW(info->dialog));
-        gnc_import_Settings_delete (info->user_settings);
-        gtk_widget_destroy (GTK_WIDGET (info->dialog));
-    }
-    else
-        gnc_import_Settings_delete (info->user_settings);
-    g_free (info);
-}
-
-void
-on_matcher_ok_clicked (GtkButton *button,
-                       GNCImportMainMatcher *info)
-{
-    GtkTreeModel *model;
-    GtkTreeIter iter;
-    GNCImportTransInfo *trans_info;
-
-    g_assert (info);
-
-    /*   DEBUG ("Begin") */
-
-    model = gtk_tree_view_get_model(info->view);
-    if (!gtk_tree_model_get_iter_first(model, &iter))
-        return;
-
-    /* Don't run any queries and/or split sorts while processing the matcher
-    results. */
-    gnc_suspend_gui_refresh();
-
-    do
-    {
-        gtk_tree_model_get(model, &iter,
-                           DOWNLOADED_COL_DATA, &trans_info,
-                           -1);
-
-        if (gnc_import_process_trans_item(NULL, trans_info))
-        {
-            if (info->transaction_processed_cb)
-            {
-                info->transaction_processed_cb(trans_info,
-                                               TRUE,
-                                               info->user_data);
-            }
-        }
-    }
-    while (gtk_tree_model_iter_next (model, &iter));
-
-    /* Allow GUI refresh again. */
-    gnc_resume_gui_refresh();
-
-    gnc_gen_trans_list_delete (info);
-    /* DEBUG ("End") */
-}
-
-void
-on_matcher_cancel_clicked (GtkButton *button, gpointer user_data)
-{
-    GNCImportMainMatcher *info = user_data;
-    gnc_gen_trans_list_delete (info);
-}
-
-void
-on_matcher_help_close_clicked (GtkButton *button, gpointer user_data)
-{
-    GtkWidget *help_dialog = user_data;
-
-    gtk_widget_destroy(help_dialog);
-}
-
-void
-on_matcher_help_clicked (GtkButton *button, gpointer user_data)
-{
-    GNCImportMainMatcher *info = user_data;
-    GtkBuilder *builder;
-    GtkWidget *help_dialog, *box;
-
-    builder = gtk_builder_new();
-    gnc_builder_add_from_file (builder, "dialog-import.glade", "textbuffer2");
-    gnc_builder_add_from_file (builder, "dialog-import.glade", "textbuffer3");
-    gnc_builder_add_from_file (builder, "dialog-import.glade", "textbuffer4");
-    gnc_builder_add_from_file (builder, "dialog-import.glade", "textbuffer5");
-    gnc_builder_add_from_file (builder, "dialog-import.glade", "matcher_help_dialog");
-
-    box = GTK_WIDGET(gtk_builder_get_object (builder, "red"));
-    gnc_widget_set_style_context (GTK_WIDGET(box), "color_back_red");
-
-    box = GTK_WIDGET(gtk_builder_get_object (builder, "yellow"));
-    gnc_widget_set_style_context (GTK_WIDGET(box), "color_back_yellow");
-
-    box = GTK_WIDGET(gtk_builder_get_object (builder, "green"));
-    gnc_widget_set_style_context (GTK_WIDGET(box), "color_back_green");
-
-    help_dialog = GTK_WIDGET(gtk_builder_get_object (builder, "matcher_help_dialog"));
-    gtk_window_set_transient_for(GTK_WINDOW(help_dialog),
-                                 GTK_WINDOW(info->dialog));
-
-    /* Connect the signals */
-    gtk_builder_connect_signals_full (builder, gnc_builder_connect_full_func, help_dialog);
-
-    g_object_unref(G_OBJECT(builder));
-
-    gtk_widget_show(help_dialog);
-}
-
-static void
-run_account_picker_dialog (GNCImportMainMatcher *info,
-                           GtkTreeModel *model,
-                           GtkTreeIter *iter,
-                           GNCImportTransInfo *trans_info)
-{
-    Account *old_acc, *new_acc;
-    gboolean ok_pressed;
-    g_assert (trans_info);
-    old_acc = gnc_import_TransInfo_get_destacc (trans_info);
-    new_acc = gnc_import_select_account(info->dialog,
-                                        NULL,
-                                        TRUE,
-                                        _("Destination account for the auto-balance split."),
-                                        xaccTransGetCurrency(gnc_import_TransInfo_get_trans(trans_info)),
-                                        ACCT_TYPE_NONE,
-                                        old_acc,
-                                        &ok_pressed);
-    if (ok_pressed)
-        gnc_import_TransInfo_set_destacc (trans_info, new_acc, TRUE);
-}
-
-static void
-run_match_dialog (GNCImportMainMatcher *info,
-                  GNCImportTransInfo *trans_info)
-{
-    gnc_import_match_picker_run_and_close (trans_info, info->pending_matches);
-}
-
-static void
-gnc_gen_trans_add_toggled_cb (GtkCellRendererToggle *cell_renderer,
-                              gchar                 *path,
-                              GNCImportMainMatcher  *gui)
-{
-    GtkTreeModel *model;
-    GtkTreeIter iter;
-    GNCImportTransInfo *trans_info;
-
-    model = gtk_tree_view_get_model(gui->view);
-    if (!gtk_tree_model_get_iter_from_string(model, &iter, path))
-        return;
-    gtk_tree_model_get(model, &iter, DOWNLOADED_COL_DATA, &trans_info, -1);
-
-    if ( gnc_import_TransInfo_get_action(trans_info) == GNCImport_ADD
-            && gnc_import_Settings_get_action_skip_enabled (gui->user_settings) == TRUE)
-    {
-        gnc_import_TransInfo_set_action(trans_info, GNCImport_SKIP);
-    }
-    else
-    {
-        gnc_import_TransInfo_set_action(trans_info, GNCImport_ADD);
-    }
-    refresh_model_row(gui, model, &iter, trans_info);
-}
-
-static void
-gnc_gen_trans_clear_toggled_cb (GtkCellRendererToggle *cell_renderer,
-                                gchar                 *path,
-                                GNCImportMainMatcher  *gui)
-{
-    GtkTreeModel *model;
-    GtkTreeIter iter;
-    GNCImportTransInfo *trans_info;
-
-    model = gtk_tree_view_get_model(gui->view);
-    if (!gtk_tree_model_get_iter_from_string(model, &iter, path))
-        return;
-    gtk_tree_model_get(model, &iter, DOWNLOADED_COL_DATA, &trans_info, -1);
-
-    if ( gnc_import_TransInfo_get_action(trans_info) == GNCImport_CLEAR
-            && gnc_import_Settings_get_action_skip_enabled (gui->user_settings) == TRUE)
-    {
-        gnc_import_TransInfo_set_action(trans_info, GNCImport_SKIP);
-    }
-    else
-    {
-        gnc_import_TransInfo_set_action(trans_info, GNCImport_CLEAR);
-    }
-    refresh_model_row(gui, model, &iter, trans_info);
-}
-
-static void
-gnc_gen_trans_update_toggled_cb (GtkCellRendererToggle *cell_renderer,
-                                 gchar                 *path,
-                                 GNCImportMainMatcher  *gui)
-{
-    GtkTreeModel *model;
-    GtkTreeIter iter;
-    GNCImportTransInfo *trans_info;
-
-    model = gtk_tree_view_get_model(gui->view);
-    if (!gtk_tree_model_get_iter_from_string(model, &iter, path))
-        return;
-    gtk_tree_model_get(model, &iter, DOWNLOADED_COL_DATA, &trans_info, -1);
-
-    if ( gnc_import_TransInfo_get_action(trans_info) == GNCImport_UPDATE
-            && gnc_import_Settings_get_action_skip_enabled (gui->user_settings) == TRUE)
-    {
-        gnc_import_TransInfo_set_action(trans_info, GNCImport_SKIP);
-    }
-    else
-    {
-        gnc_import_TransInfo_set_action(trans_info, GNCImport_UPDATE);
-    }
-    refresh_model_row(gui, model, &iter, trans_info);
-}
-
-static void
-gnc_gen_trans_row_activated_cb (GtkTreeView           *view,
-                                GtkTreePath           *path,
-                                GtkTreeViewColumn     *column,
-                                GNCImportMainMatcher  *gui)
-{
-    GtkTreeModel *model;
-    GtkTreeIter iter;
-    GNCImportTransInfo *trans_info;
-
-    model = gtk_tree_view_get_model(gui->view);
-    if (!gtk_tree_model_get_iter(model, &iter, path))
-        return;
-    gtk_tree_model_get(model, &iter, DOWNLOADED_COL_DATA, &trans_info, -1);
-
-    switch (gnc_import_TransInfo_get_action (trans_info))
-    {
-    case GNCImport_ADD:
-        if (gnc_import_TransInfo_is_balanced(trans_info) == FALSE)
-        {
-            run_account_picker_dialog (gui, model, &iter, trans_info);
-        }
-        break;
-    case GNCImport_CLEAR:
-    case GNCImport_UPDATE:
-        run_match_dialog (gui, trans_info);
-        break;
-    case GNCImport_SKIP:
-        /*The information displayed is only informative, until you select an action*/
-        break;
-    default:
-        PERR("I don't know what to do! (Yet...)");
-        break;
-    }
-    refresh_model_row(gui, model, &iter, trans_info);
-}
-
-static void
-gnc_gen_trans_row_changed_cb (GtkTreeSelection *selection,
-                              GNCImportMainMatcher *gui)
-{
-    GtkTreeModel *model;
-    GtkTreeIter iter;
-
-    if (!gtk_tree_selection_get_selected(selection, &model, &iter))
-        return;
-    gtk_tree_selection_unselect_iter(selection, &iter);
-}
-
-static GtkTreeViewColumn *
-add_text_column(GtkTreeView *view, const gchar *title, int col_num)
-{
-    GtkCellRenderer *renderer;
-    GtkTreeViewColumn *column;
-
-    renderer = gtk_cell_renderer_text_new();
-    g_object_set(G_OBJECT(renderer),
-                 "foreground", "black",
-                 "foreground-set", TRUE,
-                 NULL);
-    column = gtk_tree_view_column_new_with_attributes
-             (title, renderer,
-              "text", col_num,
-              "background", DOWNLOADED_COL_COLOR,
-              NULL);
-    gtk_tree_view_column_set_sort_column_id(column, col_num);
-    g_object_set(G_OBJECT(column),
-                 "reorderable", TRUE,
-                 "resizable", TRUE,
-                 NULL);
-    gtk_tree_view_append_column(view, column);
-    return column;
-}
-
-static GtkTreeViewColumn *
-add_toggle_column(GtkTreeView *view, const gchar *title, int col_num,
-                  GCallback cb_fn, gpointer cb_arg)
-{
-    GtkCellRenderer *renderer;
-    GtkTreeViewColumn *column;
-
-    renderer = gtk_cell_renderer_toggle_new();
-    column = gtk_tree_view_column_new_with_attributes
-             (title, renderer,
-              "active", col_num,
-              "cell-background", DOWNLOADED_COL_COLOR,
-              NULL);
-    gtk_tree_view_column_set_sort_column_id(column, col_num);
-    g_object_set(G_OBJECT(column),
-                 "reorderable", TRUE,
-                 NULL);
-    g_signal_connect(renderer, "toggled", cb_fn, cb_arg);
-    gtk_tree_view_append_column(view, column);
-    return column;
-}
-
-static void
-gnc_gen_trans_init_view (GNCImportMainMatcher *info,
-                         gboolean show_account,
-                         gboolean show_update)
-{
-    GtkTreeView *view;
-    GtkListStore *store;
-    GtkCellRenderer *renderer;
-    GtkTreeViewColumn *column;
-    GtkTreeSelection *selection;
-
-    view = info->view;
-    store = gtk_list_store_new(NUM_DOWNLOADED_COLS,
-                               G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
-                               G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN,
-                               G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_STRING,
-                               GDK_TYPE_PIXBUF, G_TYPE_POINTER, G_TYPE_STRING);
-    gtk_tree_view_set_model(view, GTK_TREE_MODEL(store));
-    g_object_unref(store);
-
-    /* Add the columns */
-    add_text_column(view, _("Date"), DOWNLOADED_COL_DATE);
-    column = add_text_column(view, _("Account"), DOWNLOADED_COL_ACCOUNT);
-    gtk_tree_view_column_set_visible(column, show_account);
-    add_text_column(view, _("Amount"), DOWNLOADED_COL_AMOUNT);
-    add_text_column(view, _("Description"), DOWNLOADED_COL_DESCRIPTION);
-    add_text_column(view, _("Memo"), DOWNLOADED_COL_MEMO);
-    add_toggle_column(view, _("A"), DOWNLOADED_COL_ACTION_ADD,
-                      G_CALLBACK(gnc_gen_trans_add_toggled_cb), info);
-    column = add_toggle_column(view, _("U+R"), DOWNLOADED_COL_ACTION_UPDATE,
-                               G_CALLBACK(gnc_gen_trans_update_toggled_cb), info);
-    gtk_tree_view_column_set_visible(column, show_update);
-    add_toggle_column(view, _("R"), DOWNLOADED_COL_ACTION_CLEAR,
-                      G_CALLBACK(gnc_gen_trans_clear_toggled_cb), info);
-
-    /* The last column has multiple renderers */
-    renderer = gtk_cell_renderer_pixbuf_new();
-    g_object_set(renderer, "xalign", 0.0, NULL);
-    column = gtk_tree_view_column_new_with_attributes(_("Info"), renderer,
-             "pixbuf", DOWNLOADED_COL_ACTION_PIXBUF,
-             "cell-background", DOWNLOADED_COL_COLOR,
-             NULL);
-    renderer = gtk_cell_renderer_text_new();
-    g_object_set(G_OBJECT(renderer),
-                 "foreground", "black",
-                 "foreground-set", TRUE,
-                 NULL);
-    gtk_tree_view_column_pack_start(column, renderer, TRUE);
-    gtk_tree_view_column_set_attributes(column, renderer,
-                                        "text", DOWNLOADED_COL_ACTION_INFO,
-                                        "background", DOWNLOADED_COL_COLOR,
-                                        NULL);
-    gtk_tree_view_column_set_sort_column_id(column, DOWNLOADED_COL_ACTION_INFO);
-    g_object_set(G_OBJECT(column),
-                 "reorderable", TRUE,
-                 "resizable", TRUE,
-                 NULL);
-    gtk_tree_view_append_column(info->view, column);
-
-
-    selection = gtk_tree_view_get_selection(info->view);
-    g_signal_connect(info->view, "row-activated",
-                     G_CALLBACK(gnc_gen_trans_row_activated_cb), info);
-    g_signal_connect(selection, "changed",
-                     G_CALLBACK(gnc_gen_trans_row_changed_cb), info);
-}
-
-GNCImportMainMatcher *gnc_gen_trans_list_new (GtkWidget *parent,
-        const gchar* heading,
-        gboolean all_from_same_account,
-        gint match_date_hardlimit)
-{
-    GNCImportMainMatcher *info;
-    GtkBuilder *builder;
-    GtkWidget *heading_label;
-    GtkWidget *box, *pbox;
-    gboolean show_update;
-
-    info = g_new0 (GNCImportMainMatcher, 1);
-    info->pending_matches = gnc_import_PendingMatches_new();
-
-    /* Initialize user Settings. */
-    info->user_settings = gnc_import_Settings_new ();
-    gnc_import_Settings_set_match_date_hardlimit (info->user_settings, match_date_hardlimit);
-
-    /* Initialize the GtkDialog. */
-    builder = gtk_builder_new();
-    gnc_builder_add_from_file (builder, "dialog-import.glade", "transaction_matcher_dialog");
-    gnc_builder_add_from_file (builder, "dialog-import.glade", "transaction_matcher_content");
-    info->dialog = GTK_WIDGET(gtk_builder_get_object (builder, "transaction_matcher_dialog"));
-    g_assert (info->dialog != NULL);
-
-    /* Pack the content into the dialog vbox */
-    pbox = GTK_WIDGET(gtk_builder_get_object (builder, "transaction_matcher_vbox"));
-    box = GTK_WIDGET(gtk_builder_get_object (builder, "transaction_matcher_content"));
-    gtk_box_pack_start( GTK_BOX(pbox), box, TRUE, TRUE, 0);
-
-    /* Get the view */
-    info->view = GTK_TREE_VIEW(gtk_builder_get_object (builder, "downloaded_view"));
-    g_assert (info->view != NULL);
-
-    show_update = gnc_import_Settings_get_action_update_enabled(info->user_settings);
-    gnc_gen_trans_init_view(info, all_from_same_account, show_update);
-    heading_label = GTK_WIDGET(gtk_builder_get_object (builder, "heading_label"));
-    g_assert (heading_label != NULL);
-
-    /* if (parent)
-      gtk_window_set_transient_for (GTK_WINDOW (info->dialog),
-    			  GTK_WINDOW (parent));*/
-
-    if (heading)
-        gtk_label_set_text (GTK_LABEL (heading_label), heading);
-
-    gnc_restore_window_size(GNC_PREFS_GROUP, GTK_WINDOW(info->dialog));
-    gtk_widget_show_all (GTK_WIDGET (info->dialog));
-
-    info->transaction_processed_cb = NULL;
-
-    /* Connect the signals */
-    gtk_builder_connect_signals_full (builder, gnc_builder_connect_full_func, info);
-
-    g_object_unref(G_OBJECT(builder));
-
-    return info;
-}
-
-/*****************************************************************
- *                 Assistant routines Start                      *
- *****************************************************************/
-
-GNCImportMainMatcher * gnc_gen_trans_assist_new (GtkWidget *parent,
-        const gchar* heading,
-        gboolean all_from_same_account,
-        gint match_date_hardlimit)
-{
-    GNCImportMainMatcher *info;
-    GtkBuilder *builder;
-    GtkWidget *heading_label;
-    GtkWidget *box;
-    gboolean show_update;
-
-    info = g_new0 (GNCImportMainMatcher, 1);
-    info->pending_matches = gnc_import_PendingMatches_new();
-
-    /* Initialize user Settings. */
-    info->user_settings = gnc_import_Settings_new ();
-    gnc_import_Settings_set_match_date_hardlimit (info->user_settings, match_date_hardlimit);
-
-    /* load the interface */
-    builder = gtk_builder_new();
-    gnc_builder_add_from_file (builder, "dialog-import.glade", "transaction_matcher_content");
-    if (builder == NULL)
-    {
-        PERR("Error opening the glade builder interface");
-    }
-    /* Pack content into Assistant page widget */
-    box = GTK_WIDGET(gtk_builder_get_object (builder, "transaction_matcher_content"));
-    gtk_box_pack_start( GTK_BOX(parent), box, TRUE, TRUE, 6);
-
-    /* Get the view */
-    info->view = GTK_TREE_VIEW(gtk_builder_get_object (builder, "downloaded_view"));
-    g_assert (info->view != NULL);
-
-    show_update = gnc_import_Settings_get_action_update_enabled(info->user_settings);
-    gnc_gen_trans_init_view(info, all_from_same_account, show_update);
-    heading_label = GTK_WIDGET(gtk_builder_get_object (builder, "heading_label"));
-    g_assert (heading_label != NULL);
-
-    if (heading)
-        gtk_label_set_text (GTK_LABEL (heading_label), heading);
-
-    info->transaction_processed_cb = NULL;
-
-    /* Connect the signals */
-    gtk_builder_connect_signals_full (builder, gnc_builder_connect_full_func, info);
-
-    g_object_unref(G_OBJECT(builder));
-
-    return info;
-}
-
-void gnc_gen_trans_assist_start (GNCImportMainMatcher *info)
-{
-    on_matcher_ok_clicked (NULL, info);
-}
-
-/*****************************************************************
- *                   Assistant routines End                      *
- *****************************************************************/
-
-void gnc_gen_trans_list_add_tp_cb(GNCImportMainMatcher *info,
-                                  GNCTransactionProcessedCB trans_processed_cb,
-                                  gpointer user_data)
-{
-    info->user_data = user_data;
-    info->transaction_processed_cb = trans_processed_cb;
-}
-
-gboolean gnc_gen_trans_list_run (GNCImportMainMatcher *info)
-{
-    gboolean result;
-
-    /* DEBUG("Begin"); */
-    result = gtk_dialog_run (GTK_DIALOG (info->dialog));
-    /* DEBUG("Result was %d", result); */
-
-    /* No destroying here since the dialog was already destroyed through
-       the ok_clicked handlers. */
-
-    return result;
-}
-
-static void
-refresh_model_row (GNCImportMainMatcher *gui,
-                   GtkTreeModel *model,
-                   GtkTreeIter *iter,
-                   GNCImportTransInfo *info)
-{
-    GtkListStore *store;
-    GtkTreeSelection *selection;
-    gchar *tmp, *imbalance, *text, *color;
-    const gchar *ro_text;
-    Split *split;
-    g_assert (gui);
-    g_assert (model);
-    g_assert (info);
-    /*DEBUG("Begin");*/
-
-    store = GTK_LIST_STORE(model);
-    gtk_list_store_set(store, iter, DOWNLOADED_COL_DATA, info, -1);
-
-    /*Account:*/
-    split = gnc_import_TransInfo_get_fsplit (info);
-    g_assert(split); // Must not be NULL
-    ro_text = xaccAccountGetName(xaccSplitGetAccount(split));
-    gtk_list_store_set(store, iter, DOWNLOADED_COL_ACCOUNT, ro_text, -1);
-
-    /*Date*/
-    text = qof_print_date ( xaccTransGetDate( gnc_import_TransInfo_get_trans(info) ) );
-    gtk_list_store_set(store, iter, DOWNLOADED_COL_DATE, text, -1);
-    g_free(text);
-
-    /*Amount*/
-    ro_text = xaccPrintAmount
-              (xaccSplitGetAmount (split),
-               gnc_split_amount_print_info(split, TRUE)
-              );
-    gtk_list_store_set(store, iter, DOWNLOADED_COL_AMOUNT, ro_text, -1);
-
-    /*Description*/
-    ro_text = xaccTransGetDescription(gnc_import_TransInfo_get_trans(info) );
-    gtk_list_store_set(store, iter, DOWNLOADED_COL_DESCRIPTION, ro_text, -1);
-
-    /*Memo*/
-    ro_text = xaccSplitGetMemo(split);
-    gtk_list_store_set(store, iter, DOWNLOADED_COL_MEMO, ro_text, -1);
-
-    /*Actions*/
-
-    /* Action information */
-    ro_text = text = color = NULL;
-    switch (gnc_import_TransInfo_get_action(info))
-    {
-    case GNCImport_ADD:
-        if (gnc_import_TransInfo_is_balanced(info) == TRUE)
-        {
-            ro_text = _("New, already balanced");
-            color = COLOR_GREEN;
-        }
-        else
-        {
-            /* Assume that importers won't create transactions in two or more
-               currencies so we can use xaccTransGetImbalanceValue */
-            imbalance =
-                g_strdup
-                (xaccPrintAmount
-                 (gnc_numeric_neg(xaccTransGetImbalanceValue
-                                  (gnc_import_TransInfo_get_trans(info) )),
-                  gnc_commodity_print_info
-                  (xaccTransGetCurrency(gnc_import_TransInfo_get_trans (info)),
-                   TRUE) ));
-            if (gnc_import_TransInfo_get_destacc (info) != NULL)
-            {
-                color = COLOR_GREEN;
-                tmp = gnc_account_get_full_name
-                      (gnc_import_TransInfo_get_destacc (info));
-                if (gnc_import_TransInfo_get_destacc_selected_manually(info)
-                        == TRUE)
-                {
-                    text =
-                        /* Translators: %1$s is the amount to be
-                           transferred. %2$s is the destination account. */
-                        g_strdup_printf(_("New, transfer %s to (manual) \"%s\""),
-                                        imbalance, tmp);
-                }
-                else
-                {
-                    text =
-                        /* Translators: %1$s is the amount to be
-                           transferred. %2$s is the destination account. */
-                        g_strdup_printf(_("New, transfer %s to (auto) \"%s\""),
-                                        imbalance, tmp);
-                }
-                g_free (tmp);
-
-            }
-            else
-            {
-                color = COLOR_YELLOW;
-                text =
-                    /* Translators: %s is the amount to be transferred. */
-                    g_strdup_printf(_("New, UNBALANCED (need acct to transfer %s)!"),
-                                    imbalance);
-            }
-            g_free (imbalance);
-        }
-        break;
-    case GNCImport_CLEAR:
-        if (gnc_import_TransInfo_get_selected_match(info))
-        {
-            color = COLOR_GREEN;
-            if (gnc_import_TransInfo_get_match_selected_manually(info) == TRUE)
-            {
-                ro_text = _("Reconcile (manual) match");
-            }
-            else
-            {
-                ro_text = _("Reconcile (auto) match");
-            }
-        }
-        else
-        {
-            color = COLOR_RED;
-            ro_text = _("Match missing!");
-        }
-        break;
-    case GNCImport_UPDATE:
-        if (gnc_import_TransInfo_get_selected_match(info))
-        {
-            color = COLOR_GREEN;
-            if (gnc_import_TransInfo_get_match_selected_manually(info) == TRUE)
-            {
-                ro_text = _("Update and reconcile (manual) match");
-            }
-            else
-            {
-                ro_text = _("Update and reconcile (auto) match");
-            }
-        }
-        else
-        {
-            color = COLOR_RED;
-            ro_text = _("Match missing!");
-        }
-        break;
-    case GNCImport_SKIP:
-        color = COLOR_RED;
-        ro_text = _("Do not import (no action selected)");
-        break;
-    default:
-        color = "white";
-        ro_text = "WRITEME, this is an unknown action";
-        break;
-    }
-
-    gtk_list_store_set(store, iter,
-                       DOWNLOADED_COL_COLOR, color,
-                       DOWNLOADED_COL_ACTION_INFO, ro_text ? ro_text : text,
-                       -1);
-    if (text)
-        g_free(text);
-
-    /* Set the pixmaps */
-    gtk_list_store_set(store, iter,
-                       DOWNLOADED_COL_ACTION_ADD,
-                       gnc_import_TransInfo_get_action(info) == GNCImport_ADD,
-                       -1);
-    if (gnc_import_TransInfo_get_action(info) == GNCImport_SKIP)
-    {
-        /*Show the best match's confidence pixmap in the info column*/
-        gtk_list_store_set(store, iter,
-                           DOWNLOADED_COL_ACTION_PIXBUF,
-                           gen_probability_pixbuf( gnc_import_MatchInfo_get_probability
-                                   ( gnc_import_TransInfo_get_selected_match (info)),
-                                   gui->user_settings,
-                                   GTK_WIDGET(gui->view)),
-                           -1);
-    }
-
-    gtk_list_store_set(store, iter,
-                       DOWNLOADED_COL_ACTION_CLEAR,
-                       gnc_import_TransInfo_get_action(info) == GNCImport_CLEAR,
-                       -1);
-    if (gnc_import_TransInfo_get_action(info) == GNCImport_CLEAR)
-    {
-        /*Show the best match's confidence pixmap in the info column*/
-        gtk_list_store_set(store, iter,
-                           DOWNLOADED_COL_ACTION_PIXBUF,
-                           gen_probability_pixbuf( gnc_import_MatchInfo_get_probability
-                                   ( gnc_import_TransInfo_get_selected_match (info)),
-                                   gui->user_settings,
-                                   GTK_WIDGET(gui->view)),
-                           -1);
-    }
-
-    gtk_list_store_set(store, iter,
-                       DOWNLOADED_COL_ACTION_UPDATE,
-                       gnc_import_TransInfo_get_action(info) == GNCImport_UPDATE,
-                       -1);
-    if (gnc_import_TransInfo_get_action(info) == GNCImport_UPDATE)
-    {
-        /*Show the best match's confidence pixmap in the info column*/
-        gtk_list_store_set(store, iter,
-                           DOWNLOADED_COL_ACTION_PIXBUF,
-                           gen_probability_pixbuf( gnc_import_MatchInfo_get_probability
-                                   ( gnc_import_TransInfo_get_selected_match (info)),
-                                   gui->user_settings,
-                                   GTK_WIDGET(gui->view)),
-                           -1);
-    }
-
-    selection = gtk_tree_view_get_selection(gui->view);
-    gtk_tree_selection_unselect_all(selection);
-}
-
-void gnc_gen_trans_list_add_trans(GNCImportMainMatcher *gui, Transaction *trans)
-{
-    gnc_gen_trans_list_add_trans_with_ref_id(gui, trans, 0);
-    return;
-}/* end gnc_import_add_trans() */
-
-void gnc_gen_trans_list_add_trans_with_ref_id(GNCImportMainMatcher *gui, Transaction *trans, guint32 ref_id)
-{
-    GNCImportTransInfo * transaction_info = NULL;
-    GtkTreeModel *model;
-    GtkTreeIter iter;
-    GNCImportMatchInfo *selected_match;
-    gboolean match_selected_manually;
-    g_assert (gui);
-    g_assert (trans);
-
-
-    if (gnc_import_exists_online_id (trans))
-        return;
-    else
-    {
-        transaction_info = gnc_import_TransInfo_new(trans, NULL);
-        gnc_import_TransInfo_set_ref_id(transaction_info, ref_id);
-
-        gnc_import_TransInfo_init_matches(transaction_info,
-                                          gui->user_settings);
-
-        selected_match =
-            gnc_import_TransInfo_get_selected_match(transaction_info);
-        match_selected_manually =
-            gnc_import_TransInfo_get_match_selected_manually(transaction_info);
-
-        if (selected_match)
-            gnc_import_PendingMatches_add_match(gui->pending_matches,
-                                                selected_match,
-                                                match_selected_manually);
-
-        model = gtk_tree_view_get_model(gui->view);
-        gtk_list_store_append(GTK_LIST_STORE(model), &iter);
-        refresh_model_row (gui, model, &iter, transaction_info);
-    }
-    return;
-}/* end gnc_import_add_trans_with_ref_id() */
-
-GtkWidget *gnc_gen_trans_list_widget (GNCImportMainMatcher *info)
-{
-    g_assert(info);
-    return info->dialog;
-}
-
-/** @} */
diff --git a/src/import-export/log-replay/Makefile.am b/src/import-export/log-replay/Makefile.am
deleted file mode 100644
index 048b7eb..0000000
--- a/src/import-export/log-replay/Makefile.am
+++ /dev/null
@@ -1,43 +0,0 @@
-SUBDIRS = .
-
-pkglib_LTLIBRARIES=libgncmod-log-replay.la
-
-libgncmod_log_replay_la_SOURCES = \
-  gnc-log-replay.c \
-  gnc-plugin-log-replay.c \
-  gncmod-log-replay.c
-
-noinst_HEADERS = \
-  gnc-log-replay.h \
-  gnc-plugin-log-replay.h
-
-libgncmod_log_replay_la_LDFLAGS = -avoid-version
-
-libgncmod_log_replay_la_LIBADD = \
-  ${top_builddir}/src/gnome-utils/libgncmod-gnome-utils.la \
-  ${top_builddir}/src/app-utils/libgncmod-app-utils.la \
-  ${top_builddir}/src/engine/libgncmod-engine.la \
-  ${top_builddir}/src/core-utils/libgnc-core-utils.la \
-  ${top_builddir}/src/gnc-module/libgnc-module.la \
-  ${GTK_LIBS} \
-  ${GLIB_LIBS}
-
-AM_CPPFLAGS = \
-  -I${top_srcdir}/src \
-  -I${top_srcdir}/src/core-utils \
-  -I${top_srcdir}/src/engine \
-  -I${top_srcdir}/src/gnc-module \
-  -I${top_srcdir}/src/app-utils \
-  -I${top_srcdir}/src/gnome \
-  -I${top_srcdir}/src/gnome-utils \
-  -I${top_srcdir}/src/import-export \
-  ${GTK_CFLAGS} \
-  ${GLIB_CFLAGS}
-
-uidir = $(GNC_UI_DIR)
-dist_ui_DATA = \
-	gnc-plugin-log-replay-ui.xml
-
-AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.import.log-replay\"
-
-EXTRA_DIST = CMakeLists.txt
diff --git a/src/import-export/ofx/Makefile.am b/src/import-export/ofx/Makefile.am
deleted file mode 100644
index 8a6533e..0000000
--- a/src/import-export/ofx/Makefile.am
+++ /dev/null
@@ -1,47 +0,0 @@
-SUBDIRS = . gschemas test
-
-pkglib_LTLIBRARIES=libgncmod-ofx.la
-
-libgncmod_ofx_la_SOURCES = \
-  gnc-ofx-import.c \
-  gnc-ofx-kvp.c \
-  gncmod-ofx-import.c \
-  gnc-plugin-ofx.c
-
-noinst_HEADERS = \
-  gnc-ofx-import.h \
-  gnc-ofx-kvp.h \
-  gnc-plugin-ofx.h
-
-libgncmod_ofx_la_LDFLAGS = -avoid-version
-
-libgncmod_ofx_la_LIBADD = \
-  ${top_builddir}/src/import-export/libgncmod-generic-import.la \
-  ${top_builddir}/src/gnome-utils/libgncmod-gnome-utils.la \
-  ${top_builddir}/src/app-utils/libgncmod-app-utils.la \
-  ${top_builddir}/src/engine/libgncmod-engine.la \
-  ${top_builddir}/src/core-utils/libgnc-core-utils.la \
-  ${top_builddir}/src/gnc-module/libgnc-module.la \
-  ${GLIB_LIBS} \
-  ${LIBOFX_LIBS}
-
-AM_CPPFLAGS = \
-  -I${top_srcdir}/src \
-  -I${top_srcdir}/src/core-utils \
-  -I${top_srcdir}/src/engine \
-  -I${top_srcdir}/src/gnc-module \
-  -I${top_srcdir}/src/app-utils \
-  -I${top_srcdir}/src/gnome \
-  -I${top_srcdir}/src/gnome-utils \
-  -I${top_srcdir}/src/import-export \
-  ${GTK_CFLAGS} \
-  ${GLIB_CFLAGS} \
-  ${LIBOFX_CFLAGS} 
-
-uidir = $(GNC_UI_DIR)
-ui_DATA = \
-	gnc-plugin-ofx-ui.xml
-
-EXTRA_DIST = $(ui_DATA) migratable-prefs-ofx.xml CMakeLists.txt
-
-AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.import.ofx\"
diff --git a/src/import-export/ofx/gnc-ofx-import.c b/src/import-export/ofx/gnc-ofx-import.c
deleted file mode 100644
index 08fc2b9..0000000
--- a/src/import-export/ofx/gnc-ofx-import.c
+++ /dev/null
@@ -1,1051 +0,0 @@
-/*******************************************************************\
- * 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 at gnu.org                   *
-\********************************************************************/
-/** @addtogroup Import_Export
-    @{ */
-/** @internal
-     @file gnc-ofx-import.c
-     @brief Ofx import module code
-     @author Copyright (c) 2002 Benoit Grégoire <bock at step.polymtl.ca>
- */
-#include "config.h"
-
-#include <gtk/gtk.h>
-#include <glib/gi18n.h>
-#include <stdio.h>
-#include <string.h>
-#include <sys/time.h>
-#include <math.h>
-
-#include <libofx/libofx.h>
-#include "import-account-matcher.h"
-#include "import-commodity-matcher.h"
-#include "import-utilities.h"
-#include "import-main-matcher.h"
-
-#include "Account.h"
-#include "Transaction.h"
-#include "engine-helpers.h"
-#include "gnc-ofx-import.h"
-#include "gnc-file.h"
-#include "gnc-engine.h"
-#include "gnc-ui-util.h"
-#include "gnc-glib-utils.h"
-#include "gnc-prefs.h"
-#include "gnome-utils/gnc-ui.h"
-#include "gnome-utils/dialog-account.h"
-#include "dialog-utils.h"
-
-#include "gnc-ofx-kvp.h"
-
-#define GNC_PREFS_GROUP "dialogs.import.ofx"
-#define GNC_PREF_AUTO_COMMODITY "auto-create-commodity"
-
-static QofLogModule log_module = GNC_MOD_IMPORT;
-
-/********************************************************************\
- * gnc_file_ofx_import
- * Entry point
-\********************************************************************/
-
-/* CS: Store the reference to the created importer gui so that the
-   ofx_proc_transaction_cb can use it. */
-GNCImportMainMatcher *gnc_ofx_importer_gui = NULL;
-static gboolean auto_create_commodity = FALSE;
-static Account *ofx_parent_account = NULL;
-
-GList *ofx_created_commodites = NULL;
-
-/*
-int ofx_proc_status_cb(struct OfxStatusData data)
-{
-  return 0;
-}
-*/
-
-int ofx_proc_security_cb(const struct OfxSecurityData data, void * security_user_data);
-int ofx_proc_transaction_cb(struct OfxTransactionData data, void * transaction_user_data);
-int ofx_proc_account_cb(struct OfxAccountData data, void * account_user_data);
-static double ofx_get_investment_amount(const struct OfxTransactionData* data);
-
-static const gchar *gnc_ofx_ttype_to_string(TransactionType t)
-{
-    switch (t)
-    {
-    case OFX_CREDIT:
-        return "Generic credit";
-    case OFX_DEBIT:
-        return "Generic debit";
-    case OFX_INT:
-        return "Interest earned or paid (Note: Depends on signage of amount)";
-    case OFX_DIV:
-        return "Dividend";
-    case OFX_FEE:
-        return "FI fee";
-    case OFX_SRVCHG:
-        return "Service charge";
-    case OFX_DEP:
-        return "Deposit";
-    case OFX_ATM:
-        return "ATM debit or credit (Note: Depends on signage of amount)";
-    case OFX_POS:
-        return "Point of sale debit or credit (Note: Depends on signage of amount)";
-    case OFX_XFER:
-        return "Transfer";
-    case OFX_CHECK:
-        return "Check";
-    case OFX_PAYMENT:
-        return "Electronic payment";
-    case OFX_CASH:
-        return "Cash withdrawal";
-    case OFX_DIRECTDEP:
-        return "Direct deposit";
-    case OFX_DIRECTDEBIT:
-        return "Merchant initiated debit";
-    case OFX_REPEATPMT:
-        return "Repeating payment/standing order";
-    case OFX_OTHER:
-        return "Other";
-    default:
-        return "Unknown transaction type";
-    }
-}
-
-static const gchar *gnc_ofx_invttype_to_str(InvTransactionType t)
-{
-    switch (t)
-    {
-    case OFX_BUYDEBT:
-        return "BUYDEBT (Buy debt security)";
-    case OFX_BUYMF:
-        return "BUYMF (Buy mutual fund)";
-    case OFX_BUYOPT:
-        return "BUYOPT (Buy option)";
-    case OFX_BUYOTHER:
-        return "BUYOTHER (Buy other security type)";
-    case OFX_BUYSTOCK:
-        return "BUYSTOCK (Buy stock))";
-    case OFX_CLOSUREOPT:
-        return "CLOSUREOPT (Close a position for an option)";
-    case OFX_INCOME:
-        return "INCOME (Investment income is realized as cash into the investment account)";
-    case OFX_INVEXPENSE:
-        return "INVEXPENSE (Misc investment expense that is associated with a specific security)";
-    case OFX_JRNLFUND:
-        return "JRNLFUND (Journaling cash holdings between subaccounts within the same investment account)";
-    case OFX_MARGININTEREST:
-        return "MARGININTEREST (Margin interest expense)";
-    case OFX_REINVEST:
-        return "REINVEST (Reinvestment of income)";
-    case OFX_RETOFCAP:
-        return "RETOFCAP (Return of capital)";
-    case OFX_SELLDEBT:
-        return "SELLDEBT (Sell debt security.  Used when debt is sold, called, or reached maturity)";
-    case OFX_SELLMF:
-        return "SELLMF (Sell mutual fund)";
-    case OFX_SELLOPT:
-        return "SELLOPT (Sell option)";
-    case OFX_SELLOTHER:
-        return "SELLOTHER (Sell other type of security)";
-    case OFX_SELLSTOCK:
-        return "SELLSTOCK (Sell stock)";
-    case OFX_SPLIT:
-        return "SPLIT (Stock or mutial fund split)";
-    case OFX_TRANSFER:
-        return "TRANSFER (Transfer holdings in and out of the investment account)";
-    default:
-        return "ERROR, this investment transaction type is unknown.  This is a bug in ofxdump";
-    }
-
-}
-
-static gchar*
-sanitize_string (gchar* str)
-{
-    gchar *inval;
-    const int length = -1; /*Assumes str is null-terminated */
-    while (!g_utf8_validate (str, length, (const gchar **)(&inval)))
-	*inval = '@';
-    return str;
-}
-
-int ofx_proc_security_cb(const struct OfxSecurityData data, void * security_user_data)
-{
-    char* cusip = NULL;
-    char* default_fullname = NULL;
-    char* default_mnemonic = NULL;
-
-    if (data.unique_id_valid)
-    {
-        cusip = gnc_utf8_strip_invalid_strdup (data.unique_id);
-    }
-    if (data.secname_valid)
-    {
-        default_fullname = gnc_utf8_strip_invalid_strdup (data.secname);
-    }
-    if (data.ticker_valid)
-    {
-        default_mnemonic = gnc_utf8_strip_invalid_strdup (data.ticker);
-    }
-
-    if (auto_create_commodity)
-    {
-        gnc_commodity *commodity =
-            gnc_import_select_commodity(cusip,
-                                        FALSE,
-                                        default_fullname,
-                                        default_mnemonic);
-
-        if (!commodity)
-        {
-            QofBook *book = gnc_get_current_book();
-            gnc_quote_source *source;
-            gint source_selection = 0; // FIXME: This is just a wild guess
-            char *commodity_namespace = NULL;
-            int fraction = 1;
-
-            if (data.unique_id_type_valid)
-            {
-                commodity_namespace = gnc_utf8_strip_invalid_strdup (data.unique_id_type);
-            }
-
-            g_warning("Creating a new commodity, cusip=%s", cusip);
-            /* Create the new commodity */
-            commodity = gnc_commodity_new(book,
-                                          default_fullname,
-                                          commodity_namespace,
-                                          default_mnemonic,
-                                          cusip,
-                                          fraction);
-
-            /* Also set a single quote source */
-            gnc_commodity_begin_edit(commodity);
-            gnc_commodity_user_set_quote_flag (commodity, TRUE);
-            source = gnc_quote_source_lookup_by_ti (SOURCE_SINGLE, source_selection);
-            gnc_commodity_set_quote_source(commodity, source);
-            gnc_commodity_commit_edit(commodity);
-
-            /* Remember the commodity */
-            gnc_commodity_table_insert(gnc_get_current_commodities(), commodity);
-
-            /* Remember this new commodity for us as well */
-            ofx_created_commodites = g_list_prepend(ofx_created_commodites, commodity);
-	    g_free (commodity_namespace);
-
-        }
-    }
-    else
-    {
-        gnc_import_select_commodity(cusip,
-                                    TRUE,
-                                    default_fullname,
-                                    default_mnemonic);
-    }
-
-    g_free (cusip);
-    g_free (default_mnemonic);
-    g_free (default_fullname);
-    return 0;
-}
-
-static void gnc_ofx_set_split_memo(const struct OfxTransactionData* data, Split *split)
-{
-    g_assert(data);
-    g_assert(split);
-    /* Also put the ofx transaction name in
-     * the splits memo field, or ofx memo if
-     * name is unavailable */
-    if (data->name_valid)
-    {
-        xaccSplitSetMemo(split, data->name);
-    }
-    else if (data->memo_valid)
-    {
-        xaccSplitSetMemo(split, data->memo);
-    }
-}
-static gnc_numeric gnc_ofx_numeric_from_double(double value, const gnc_commodity *commodity)
-{
-    return double_to_gnc_numeric (value,
-                                  gnc_commodity_get_fraction(commodity),
-                                  GNC_HOW_RND_ROUND_HALF_UP);
-}
-static gnc_numeric gnc_ofx_numeric_from_double_txn(double value, const Transaction* txn)
-{
-    return gnc_ofx_numeric_from_double(value, xaccTransGetCurrency(txn));
-}
-
-/* Opens the dialog to create a new account with given name, commodity, parent, type.
- * Returns the new account, or NULL if it couldn't be created.. */
-static Account *gnc_ofx_new_account(const char* name,
-                                    const gnc_commodity * account_commodity,
-                                    Account *parent_account,
-                                    GNCAccountType new_account_default_type)
-{
-    Account *result;
-    GList * valid_types = NULL;
-
-    g_assert(name);
-    g_assert(account_commodity);
-    g_assert(parent_account);
-
-    if (new_account_default_type != ACCT_TYPE_NONE)
-    {
-        // Passing the types as gpointer
-        valid_types =
-            g_list_prepend(valid_types,
-                           GINT_TO_POINTER(new_account_default_type));
-        if (!xaccAccountTypesCompatible(xaccAccountGetType(parent_account), new_account_default_type))
-        {
-            // Need to add the parent's account type
-            valid_types =
-                g_list_prepend(valid_types,
-                               GINT_TO_POINTER(xaccAccountGetType(parent_account)));
-        }
-    }
-    result = gnc_ui_new_accounts_from_name_with_defaults (name,
-             valid_types,
-             account_commodity,
-             parent_account);
-    g_list_free(valid_types);
-    return result;
-}
-/* LibOFX has a daylight time handling bug,
- * https://sourceforge.net/p/libofx/bugs/39/, which causes it to adjust the
- * timestamp for daylight time even when daylight time is not in
- * effect. HAVE_OFX_BUG_39 reflects the result of checking for this bug during
- * configuration, and fix_ofx_bug_39() corrects for it.
- */
-static time64
-fix_ofx_bug_39 (time64 t)
-{
-#if HAVE_OFX_BUG_39
-    struct tm stm;
-    gnc_localtime_r(&t, &stm);
-    if (daylight && !stm.tm_isdst)
-        t += 3600;
-#endif
-    return t;
-}
-
-int ofx_proc_transaction_cb(struct OfxTransactionData data, void * transaction_user_data)
-{
-    char dest_string[255];
-    time64 current_time = gnc_time (NULL);
-    Account *account;
-    Account *investment_account = NULL;
-    Account *income_account = NULL;
-    gchar *investment_account_text, *investment_account_onlineid;
-    gnc_commodity *currency = NULL;
-    gnc_commodity *investment_commodity = NULL;
-    gnc_numeric gnc_amount, gnc_units;
-    QofBook *book;
-    Transaction *transaction;
-    Split *split;
-    gchar *notes, *tmp;
-
-    g_assert(gnc_ofx_importer_gui);
-
-    if (!data.account_id_valid)
-    {
-        PERR("account ID for this transaction is unavailable!");
-        return 0;
-    }
-    else
-	gnc_utf8_strip_invalid (data.account_id);
-
-    account = gnc_import_select_account(gnc_gen_trans_list_widget(gnc_ofx_importer_gui),
-                                        data.account_id,
-					0, NULL, NULL, ACCT_TYPE_NONE,
-					NULL, NULL);
-    if (account == NULL)
-    {
-        PERR("Unable to find account for id %s", data.account_id);
-        return 0;
-    }
-    /***** Validate the input strings to ensure utf8 *****/
-    if (data.name_valid)
-        gnc_utf8_strip_invalid(data.name);
-    if (data.memo_valid)
-        gnc_utf8_strip_invalid(data.memo);
-    if (data.check_number_valid)
-        gnc_utf8_strip_invalid(data.check_number);
-    if (data.reference_number_valid)
-        gnc_utf8_strip_invalid(data.reference_number);
-
-    /***** Create the transaction and setup transaction data *******/
-    book = gnc_account_get_book(account);
-    transaction = xaccMallocTransaction(book);
-    xaccTransBeginEdit(transaction);
-
-    /* Note: Unfortunately libofx <= 0.9.5 will not report a missing
-     * date field as an invalid one. Instead, it will report it as
-     * valid and return a completely bogus date. Starting with
-     * libofx-0.9.6 (not yet released as of 2012-09-09), it will still
-     * be reported as valid but at least the date integer itself is
-     * just plain zero. */
-    if (data.date_posted_valid && (data.date_posted != 0))
-    {
-        /* The hopeful case: We have a posted_date */
-        data.date_posted = fix_ofx_bug_39 (data.date_posted);
-        xaccTransSetDatePostedSecsNormalized(transaction, data.date_posted);
-    }
-    else if (data.date_initiated_valid && (data.date_initiated != 0))
-    {
-        /* No posted date? Maybe we have an initiated_date */
-        data.date_initiated = fix_ofx_bug_39 (data.date_initiated);
-        xaccTransSetDatePostedSecsNormalized(transaction, data.date_initiated);
-    }
-    else
-    {
-        /* Uh no, no valid date. As a workaround use today's date */
-        xaccTransSetDatePostedSecsNormalized(transaction, current_time);
-    }
-
-    xaccTransSetDateEnteredSecs(transaction, current_time);
-
-    /* Put transaction name in Description, or memo if name unavailable */
-    if (data.name_valid)
-    {
-        xaccTransSetDescription(transaction, data.name);
-    }
-    else if (data.memo_valid)
-    {
-        xaccTransSetDescription(transaction, data.memo);
-    }
-
-    /* Put everything else in the Notes field */
-    notes = g_strdup_printf("OFX ext. info: ");
-
-    if (data.transactiontype_valid)
-    {
-        tmp = notes;
-        notes = g_strdup_printf("%s%s%s", tmp, "|Trans type:",
-                                gnc_ofx_ttype_to_string(data.transactiontype));
-        g_free(tmp);
-    }
-
-    if (data.invtransactiontype_valid)
-    {
-        tmp = notes;
-        notes = g_strdup_printf("%s%s%s", tmp, "|Investment Trans type:",
-                                gnc_ofx_invttype_to_str(data.invtransactiontype));
-        g_free(tmp);
-    }
-    if (data.memo_valid && data.name_valid) /* Copy only if memo wasn't put in Description */
-    {
-        tmp = notes;
-        notes = g_strdup_printf("%s%s%s", tmp, "|Memo:", data.memo);
-        g_free(tmp);
-    }
-    if (data.date_funds_available_valid)
-    {
-        Timespec ts;
-        timespecFromTime64(&ts, data.date_funds_available);
-        gnc_timespec_to_iso8601_buff (ts, dest_string);
-        tmp = notes;
-        notes = g_strdup_printf("%s%s%s", tmp,
-				"|Date funds available:", dest_string);
-        g_free(tmp);
-    }
-    if (data.server_transaction_id_valid)
-    {
-        tmp = notes;
-        notes = g_strdup_printf("%s%s%s", tmp,
-				"|Server trans ID (conf. number):",
-				sanitize_string (data.server_transaction_id));
-        g_free(tmp);
-    }
-    if (data.standard_industrial_code_valid)
-    {
-        tmp = notes;
-        notes = g_strdup_printf("%s%s%ld", tmp,
-				"|Standard Industrial Code:",
-                                data.standard_industrial_code);
-        g_free(tmp);
-
-    }
-    if (data.payee_id_valid)
-    {
-        tmp = notes;
-        notes = g_strdup_printf("%s%s%s", tmp, "|Payee ID:",
-				sanitize_string (data.payee_id));
-        g_free(tmp);
-    }
-
-    //PERR("WRITEME: GnuCash ofx_proc_transaction():Add PAYEE and ADRESS here once supported by libofx! Notes=%s\n", notes);
-
-    /* Ideally, gnucash should process the corrected transactions */
-    if (data.fi_id_corrected_valid)
-    {
-        PERR("WRITEME: GnuCash ofx_proc_transaction(): WARNING: This transaction corrected a previous transaction, but we created a new one instead!\n");
-        tmp = notes;
-        notes = g_strdup_printf("%s%s%s%s", tmp,
-				"|This corrects transaction #",
-				sanitize_string (data.fi_id_corrected),
-				"but GnuCash didn't process the correction!");
-        g_free(tmp);
-    }
-    xaccTransSetNotes(transaction, notes);
-    g_free(notes);
-
-    if (data.account_ptr && data.account_ptr->currency_valid)
-    {
-        DEBUG("Currency from libofx: %s", data.account_ptr->currency);
-        currency = gnc_commodity_table_lookup( gnc_get_current_commodities (),
-                                               GNC_COMMODITY_NS_CURRENCY,
-                                               data.account_ptr->currency);
-    }
-    else
-    {
-        DEBUG("Currency from libofx unavailable, defaulting to account's default");
-        currency = xaccAccountGetCommodity(account);
-    }
-
-    xaccTransSetCurrency(transaction, currency);
-    if (data.amount_valid)
-    {
-        if (!data.invtransactiontype_valid)
-        {
-            /***** Process a normal transaction ******/
-            DEBUG("Adding split; Ordinary banking transaction, money flows from or into the source account");
-            split = xaccMallocSplit(book);
-            xaccTransAppendSplit(transaction, split);
-            xaccAccountInsertSplit(account, split);
-
-            gnc_amount = gnc_ofx_numeric_from_double_txn(data.amount, transaction);
-            xaccSplitSetBaseValue(split, gnc_amount, xaccTransGetCurrency(transaction));
-
-            /* set tran-num and/or split-action per book option */
-            if (data.check_number_valid)
-            {
-                gnc_set_num_action(transaction, split, data.check_number, NULL);
-            }
-            else if (data.reference_number_valid)
-            {
-                gnc_set_num_action(transaction, split, data.reference_number, NULL);
-            }
-            /* Also put the ofx transaction's memo in the
-             * split's memo field */
-            if (data.memo_valid)
-            {
-                xaccSplitSetMemo(split, data.memo);
-            }
-            if (data.fi_id_valid)
-            {
-                gnc_import_set_split_online_id(split,
-					       sanitize_string (data.fi_id));
-            }
-        }
-
-        else if (data.unique_id_valid
-                 && data.security_data_valid
-                 && data.security_data_ptr != NULL
-                 && data.security_data_ptr->secname_valid)
-        {
-            gboolean choosing_account = TRUE;
-	    gnc_utf8_strip_invalid (data.unique_id);
-            /********* Process an investment transaction **********/
-            /* Note that the ACCT_TYPE_STOCK account type
-               should be replaced with something derived from
-               data.invtranstype*/
-
-            // We have an investment transaction. First select the correct commodity.
-            investment_commodity = gnc_import_select_commodity(data.unique_id,
-                                   FALSE,
-                                   NULL,
-                                   NULL);
-            if (investment_commodity != NULL)
-            {
-                // As we now have the commodity, select the account with that commodity.
-
-                investment_account_text = g_strdup_printf( /* This string is a default account
-                                                              name. It MUST NOT contain the
-                                                              character ':' anywhere in it or
-                                                              in any translations.  */
-                                         _("Stock account for security \"%s\""),
-                             sanitize_string (data.security_data_ptr->secname));
-
-                investment_account_onlineid = g_strdup_printf( "%s%s",
-							       data.account_id,
-							       data.unique_id);
-                investment_account = gnc_import_select_account(NULL,
-                                     investment_account_onlineid,
-                                     1,
-                                     investment_account_text,
-                                     investment_commodity,
-                                     ACCT_TYPE_STOCK,
-                                     NULL,
-                                     NULL);
-
-                // but use it only if that's really the right commodity
-                if (investment_account
-                        && xaccAccountGetCommodity(investment_account) != investment_commodity)
-                    investment_account = NULL;
-
-                // Loop until we either have an account, or the user pressed Cancel
-                while (!investment_account && choosing_account)
-                {
-                    // No account with correct commodity automatically found.
-
-                    // But are we in auto-create mode and already know a parent?
-                    if (auto_create_commodity && ofx_parent_account)
-                    {
-                        // Yes, so use that as parent when auto-creating the new account below.
-                        investment_account = ofx_parent_account;
-                    }
-                    else
-                    {
-                        // Let the user choose an account
-                        investment_account = gnc_import_select_account(
-                                                 gnc_gen_trans_list_widget(gnc_ofx_importer_gui),
-                                                 data.unique_id,
-                                                 TRUE,
-                                                 investment_account_text,
-                                                 investment_commodity,
-                                                 ACCT_TYPE_STOCK,
-                                                 NULL,
-                                                 &choosing_account);
-                    }
-                    // Does the chosen account have the right commodity?
-                    if (investment_account && xaccAccountGetCommodity(investment_account) != investment_commodity)
-                    {
-                        if (auto_create_commodity
-                                && xaccAccountTypesCompatible(xaccAccountGetType(investment_account),
-                                                              ACCT_TYPE_STOCK))
-                        {
-                            // The user chose an account, but it does
-                            // not have the right commodity. Also,
-                            // auto-creation is on. Hence, we create a
-                            // new child account of the selected one,
-                            // and this one will have the right
-                            // commodity.
-                            Account *parent_account = investment_account;
-                            investment_account =
-                                gnc_ofx_new_account(investment_account_text,
-                                                    investment_commodity,
-                                                    parent_account,
-                                                    ACCT_TYPE_STOCK);
-                            if (investment_account)
-                            {
-                                gnc_import_set_acc_online_id(investment_account, data.unique_id);
-                                choosing_account = FALSE;
-                                ofx_parent_account = parent_account;
-                            }
-                            else
-                            {
-                                ofx_parent_account = NULL;
-                            }
-                        }
-                        else
-                        {
-                            // No account with matching commodity. Ask the user
-                            // whether to continue or abort.
-                            choosing_account =
-                                gnc_verify_dialog(
-                                    gnc_gen_trans_list_widget(gnc_ofx_importer_gui), TRUE,
-                                    "The chosen account \"%s\" does not have the correct "
-                                    "currency/security \"%s\" (it has \"%s\" instead). "
-                                    "This account cannot be used. "
-                                    "Do you want to choose again?",
-                                    xaccAccountGetName(investment_account),
-                                    gnc_commodity_get_fullname(investment_commodity),
-                                    gnc_commodity_get_fullname(xaccAccountGetCommodity(investment_account)));
-                            // We must also delete the online_id that was set in gnc_import_select_account()
-                            gnc_import_set_acc_online_id(investment_account, "");
-                            investment_account = NULL;
-                        }
-                    }
-                }
-                if (!investment_account)
-                {
-                    PERR("No investment account found for text: %s\n", investment_account_text);
-                }
-                g_free (investment_account_text);
-                g_free (investment_account_onlineid);
-                investment_account_text = NULL;
-
-                if (investment_account != NULL &&
-                        data.unitprice_valid &&
-                        data.units_valid &&
-                        ( data.invtransactiontype != OFX_INCOME ) )
-                {
-                    DEBUG("Adding investment split; Money flows from or into the stock account");
-                    split = xaccMallocSplit(book);
-                    xaccTransAppendSplit(transaction, split);
-                    xaccAccountInsertSplit(investment_account, split);
-
-                    gnc_amount = gnc_ofx_numeric_from_double_txn (ofx_get_investment_amount(&data),
-                                 transaction);
-                    gnc_units = gnc_ofx_numeric_from_double (data.units, investment_commodity);
-                    xaccSplitSetAmount(split, gnc_units);
-                    xaccSplitSetValue(split, gnc_amount);
-
-                    /* set tran-num and/or split-action per book option */
-                    if (data.check_number_valid)
-                    {
-                        gnc_set_num_action(transaction, split, data.check_number, NULL);
-                    }
-                    else if (data.reference_number_valid)
-                    {
-                        gnc_set_num_action(transaction, split,
-                                           data.reference_number, NULL);
-                    }
-                    if (data.security_data_ptr->memo_valid)
-                    {
-                        xaccSplitSetMemo(split,
-                                sanitize_string (data.security_data_ptr->memo));
-                    }
-                    if (data.fi_id_valid)
-                    {
-                        gnc_import_set_split_online_id(split,
-                                                 sanitize_string (data.fi_id));
-                    }
-                }
-                else
-                {
-                    if (investment_account)
-                        PERR("The investment account, units or unitprice was not found for the investment transaction");
-                }
-            }
-            else
-            {
-                PERR("Commodity not found for the investment transaction");
-            }
-
-            if (data.invtransactiontype_valid && investment_account)
-            {
-                if (data.invtransactiontype == OFX_REINVEST
-                        || data.invtransactiontype == OFX_INCOME)
-                {
-                    DEBUG("Now let's find an account for the destination split");
-
-                    income_account = gnc_ofx_kvp_get_assoc_account(investment_account);
-
-                    if (income_account == NULL)
-                    {
-                        DEBUG("Couldn't find an associated income account");
-                        investment_account_text = g_strdup_printf( /* This string is a default account
-                                                                      name. It MUST NOT contain the
-                                                                      character ':' anywhere in it or
-                                                                      in any translations.  */
-                                                      _("Income account for security \"%s\""),
-                                                      sanitize_string (data.security_data_ptr->secname));
-                        income_account = gnc_import_select_account(
-                                             gnc_gen_trans_list_widget(gnc_ofx_importer_gui),
-                                             NULL,
-                                             1,
-                                             investment_account_text,
-                                             currency,
-                                             ACCT_TYPE_INCOME,
-                                             NULL,
-                                             NULL);
-                        if (income_account != NULL)
-                        {
-                            gnc_ofx_kvp_set_assoc_account(investment_account,
-                                                          income_account);
-                            DEBUG("KVP written");
-                        }
-
-                    }
-                    else
-                    {
-                        DEBUG("Found at least one associated income account");
-                    }
-                }
-                if (income_account != NULL &&
-                        data.invtransactiontype == OFX_REINVEST)
-                {
-                    DEBUG("Adding investment split; Money flows from the income account");
-                    split = xaccMallocSplit(book);
-                    xaccTransAppendSplit(transaction, split);
-                    xaccAccountInsertSplit(income_account, split);
-
-                    gnc_amount = gnc_ofx_numeric_from_double_txn (data.amount, transaction);
-                    xaccSplitSetBaseValue(split, gnc_amount, xaccTransGetCurrency(transaction));
-
-                    // Set split memo from ofx transaction name or memo
-                    gnc_ofx_set_split_memo(&data, split);
-                }
-                if (income_account != NULL &&
-                        data.invtransactiontype == OFX_INCOME)
-                {
-                    DEBUG("Adding investment split; Money flows from the income account");
-                    split = xaccMallocSplit(book);
-                    xaccTransAppendSplit(transaction, split);
-                    xaccAccountInsertSplit(income_account, split);
-
-                    gnc_amount = gnc_ofx_numeric_from_double_txn (-data.amount,/*OFX_INCOME amounts come in as positive numbers*/
-                                 transaction);
-                    xaccSplitSetBaseValue(split, gnc_amount, xaccTransGetCurrency(transaction));
-
-                    // Set split memo from ofx transaction name or memo
-                    gnc_ofx_set_split_memo(&data, split);
-                }
-            }
-
-            if (data.invtransactiontype_valid
-                    && data.invtransactiontype != OFX_REINVEST)
-            {
-                DEBUG("Adding investment split; Money flows from or to the cash account");
-                split = xaccMallocSplit(book);
-                xaccTransAppendSplit(transaction, split);
-                xaccAccountInsertSplit(account, split);
-
-                gnc_amount = gnc_ofx_numeric_from_double_txn(
-                                 -ofx_get_investment_amount(&data), transaction);
-                xaccSplitSetBaseValue(split, gnc_amount,
-                                      xaccTransGetCurrency(transaction));
-
-                // Set split memo from ofx transaction name or memo
-                gnc_ofx_set_split_memo(&data, split);
-            }
-        }
-
-        /* Send transaction to importer GUI. */
-        if (xaccTransCountSplits(transaction) > 0)
-        {
-            DEBUG("%d splits sent to the importer gui", xaccTransCountSplits(transaction));
-            gnc_gen_trans_list_add_trans (gnc_ofx_importer_gui, transaction);
-        }
-        else
-        {
-            PERR("No splits in transaction (missing account?), ignoring.");
-            xaccTransDestroy(transaction);
-            xaccTransCommitEdit(transaction);
-        }
-    }
-    else
-    {
-        PERR("The transaction doesn't have a valid amount");
-        xaccTransDestroy(transaction);
-        xaccTransCommitEdit(transaction);
-    }
-
-    return 0;
-}//end ofx_proc_transaction()
-
-/*
-int ofx_proc_statement_cb(struct OfxStatementData data, void * statement_user_data)
-{
-  return 0;
-}//end ofx_proc_statement()
-*/
-
-int ofx_proc_account_cb(struct OfxAccountData data, void * account_user_data)
-{
-    gnc_commodity_table * commodity_table;
-    gnc_commodity * default_commodity;
-    GNCAccountType default_type = ACCT_TYPE_NONE;
-    gchar * account_description;
-    /* In order to trigger a book options display on the creation of a new book,
-     * we need to detect when we are dealing with a new book. */
-    gboolean new_book = gnc_is_new_book();
-
-    const gchar * account_type_name = _("Unknown OFX account");
-
-    if (data.account_id_valid)
-    {
-        commodity_table = gnc_get_current_commodities ();
-        if (data.currency_valid)
-        {
-            DEBUG("Currency from libofx: %s", data.currency);
-            default_commodity = gnc_commodity_table_lookup(commodity_table,
-                                GNC_COMMODITY_NS_CURRENCY,
-                                data.currency);
-        }
-        else
-        {
-            default_commodity = NULL;
-        }
-
-        if (data.account_type_valid)
-        {
-            switch (data.account_type)
-            {
-            case OFX_CHECKING :
-                default_type = ACCT_TYPE_BANK;
-                account_type_name = _("Unknown OFX checking account");
-                break;
-            case OFX_SAVINGS :
-                default_type = ACCT_TYPE_BANK;
-                account_type_name = _("Unknown OFX savings account");
-                break;
-            case OFX_MONEYMRKT :
-                default_type = ACCT_TYPE_MONEYMRKT;
-                account_type_name = _("Unknown OFX money market account");
-                break;
-            case OFX_CREDITLINE :
-                default_type = ACCT_TYPE_CREDITLINE;
-                account_type_name = _("Unknown OFX credit line account");
-                break;
-            case OFX_CMA :
-                default_type = ACCT_TYPE_NONE;
-                account_type_name = _("Unknown OFX CMA account");
-                break;
-            case OFX_CREDITCARD :
-                default_type = ACCT_TYPE_CREDIT;
-                account_type_name = _("Unknown OFX credit card account");
-                break;
-            case OFX_INVESTMENT :
-                default_type = ACCT_TYPE_BANK;
-                account_type_name = _("Unknown OFX investment account");
-                break;
-            default:
-                PERR("WRITEME: ofx_proc_account() This is an unknown account type!");
-                break;
-            }
-        }
-
-        /* If the OFX importer was started in Gnucash in a 'new_book' situation,
-         * as described above, the first time the 'ofx_proc_account_cb' function
-         * is called a book is created. (This happens after the 'new_book' flag
-         * is set in 'gnc_get_current_commodities', called above.) So, before
-         * calling 'gnc_import_select_account', allow the user to set book
-         * options. */
-        if (new_book)
-            new_book = gnc_new_book_option_display(gnc_ui_get_toplevel());
-
-        gnc_utf8_strip_invalid(data.account_name);
-        gnc_utf8_strip_invalid(data.account_id);
-        account_description = g_strdup_printf( /* This string is a default account
-                                                  name. It MUST NOT contain the
-                                                  character ':' anywhere in it or
-                                                  in any translation.  */
-                                  "%s \"%s\"",
-                                  account_type_name,
-                                  data.account_name);
-        gnc_import_select_account(NULL, data.account_id, 1,
-                                  account_description, default_commodity,
-                                  default_type, NULL, NULL);
-        g_free(account_description);
-    }
-    else
-    {
-        PERR("account online ID not available");
-    }
-
-    return 0;
-}
-
-double ofx_get_investment_amount(const struct OfxTransactionData* data)
-{
-    g_assert(data);
-    switch (data->invtransactiontype)
-    {
-    case OFX_BUYDEBT:
-    case OFX_BUYMF:
-    case OFX_BUYOPT:
-    case OFX_BUYOTHER:
-    case OFX_BUYSTOCK:
-        return fabs(data->amount);
-    case OFX_SELLDEBT:
-    case OFX_SELLMF:
-    case OFX_SELLOPT:
-    case OFX_SELLOTHER:
-    case OFX_SELLSTOCK:
-        return -1 * fabs(data->amount);
-    default:
-        return -1 * data->amount;
-    }
-}
-
-void gnc_file_ofx_import (void)
-{
-    extern int ofx_PARSER_msg;
-    extern int ofx_DEBUG_msg;
-    extern int ofx_WARNING_msg;
-    extern int ofx_ERROR_msg;
-    extern int ofx_INFO_msg;
-    extern int ofx_STATUS_msg;
-    char *selected_filename;
-    char *default_dir;
-    LibofxContextPtr libofx_context = libofx_get_new_context();
-
-    ofx_PARSER_msg = false;
-    ofx_DEBUG_msg = false;
-    ofx_WARNING_msg = true;
-    ofx_ERROR_msg = true;
-    ofx_INFO_msg = true;
-    ofx_STATUS_msg = false;
-
-    DEBUG("gnc_file_ofx_import(): Begin...\n");
-
-    default_dir = gnc_get_default_directory(GNC_PREFS_GROUP);
-    selected_filename = gnc_file_dialog(_("Select an OFX/QFX file to process"),
-                                        NULL,
-                                        default_dir,
-                                        GNC_FILE_DIALOG_IMPORT);
-    g_free(default_dir);
-
-    if (selected_filename != NULL)
-    {
-#ifdef G_OS_WIN32
-        gchar *conv_name;
-#endif
-
-        /* Remember the directory as the default. */
-        default_dir = g_path_get_dirname(selected_filename);
-        gnc_set_default_directory(GNC_PREFS_GROUP, default_dir);
-        g_free(default_dir);
-
-        /*strncpy(file,selected_filename, 255);*/
-        DEBUG("Filename found: %s", selected_filename);
-
-        /* Create the Generic transaction importer GUI. */
-        gnc_ofx_importer_gui = gnc_gen_trans_list_new(NULL, NULL, FALSE, 42);
-
-        /* Look up the needed preferences */
-        auto_create_commodity =
-            gnc_prefs_get_bool (GNC_PREFS_GROUP_IMPORT, GNC_PREF_AUTO_COMMODITY);
-
-        /* Initialize libofx */
-
-        /*ofx_set_statement_cb(libofx_context, ofx_proc_statement_cb, 0);*/
-        ofx_set_account_cb(libofx_context, ofx_proc_account_cb, 0);
-        ofx_set_transaction_cb(libofx_context, ofx_proc_transaction_cb, 0);
-        ofx_set_security_cb(libofx_context, ofx_proc_security_cb, 0);
-        /*ofx_set_status_cb(libofx_context, ofx_proc_status_cb, 0);*/
-
-#ifdef G_OS_WIN32
-        conv_name = g_win32_locale_filename_from_utf8(selected_filename);
-        g_free(selected_filename);
-        selected_filename = conv_name;
-#endif
-
-        DEBUG("Opening selected file");
-        libofx_proc_file(libofx_context, selected_filename, AUTODETECT);
-        g_free(selected_filename);
-    }
-
-    if (ofx_created_commodites)
-    {
-        /* FIXME: Present some result window about the newly created
-         * commodities */
-        g_warning("Created %d new commodities during import", g_list_length(ofx_created_commodites));
-        g_list_free(ofx_created_commodites);
-        ofx_created_commodites = NULL;
-    }
-    else
-    {
-        //g_warning("No new commodities created");
-    }
-}
-
-
-/** @} */
diff --git a/src/import-export/ofx/gnc-ofx-kvp.h b/src/import-export/ofx/gnc-ofx-kvp.h
deleted file mode 100644
index cc41f6f..0000000
--- a/src/import-export/ofx/gnc-ofx-kvp.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************\
- * 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 at gnu.org                   *
-\********************************************************************/
-/*
- * gnc-ofx-kvp.h
- *
- *  Created on: 13.03.2011
- *      Author: cs
- */
-
-#ifndef GNC_OFX_KVP_H_
-#define GNC_OFX_KVP_H_
-
-#include <glib.h>
-#include <engine/Account.h>
-
-Account *gnc_ofx_kvp_get_assoc_account(const Account* investment_account);
-
-void gnc_ofx_kvp_set_assoc_account(Account* investment_account,
-                                   const Account *associated_income_accout);
-
-
-#endif /* GNC_OFX_CONVERSIONS_H_ */
diff --git a/src/import-export/ofx/test/Makefile.am b/src/import-export/ofx/test/Makefile.am
deleted file mode 100644
index 0306c97..0000000
--- a/src/import-export/ofx/test/Makefile.am
+++ /dev/null
@@ -1,13 +0,0 @@
-TESTS=test-link
-
-AM_CPPFLAGS=${LIBOFX_CFLAGS}
-check_PROGRAMS=test-link
-
-test_link_SOURCES=test-link.c
-test_link_LDADD=\
-	$(top_builddir)/src/engine/libgncmod-engine.la \
-	$(top_builddir)/src/app-utils/libgncmod-app-utils.la \
-	${top_builddir}/src/gnome-utils/libgncmod-gnome-utils.la \
-	../libgncmod-ofx.la
-
-EXTRA_DIST = CMakeLists.txt
diff --git a/src/import-export/qif-imp/CMakeLists.txt b/src/import-export/qif-imp/CMakeLists.txt
deleted file mode 100644
index 6c348e4..0000000
--- a/src/import-export/qif-imp/CMakeLists.txt
+++ /dev/null
@@ -1,93 +0,0 @@
-# CMakeLists.txt for src/import_export/qif-imp
-
-ADD_SUBDIRECTORY(gschemas)
-ADD_SUBDIRECTORY(test)
-
-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
-SET_SOURCE_FILES_PROPERTIES (${qif_import_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
-
-SET (qif_import_noinst_HEADERS
-    dialog-account-picker.h
-    assistant-qif-import.h
-    gnc-plugin-qif-import.h
-)
-
-ADD_LIBRARY	(gncmod-qif-import ${qif_import_SOURCES} ${qif_import_noinst_HEADERS})
-
-TARGET_LINK_LIBRARIES(gncmod-qif-import gncmod-app-utils gncmod-gnome-utils gnc-gnome)
-
-TARGET_COMPILE_DEFINITIONS(gncmod-qif-import PRIVATE -DG_LOG_DOMAIN=\"gnc.import.qif.import\")
-
-INSTALL(TARGETS gncmod-qif-import
-  LIBRARY DESTINATION lib/gnucash
-  ARCHIVE DESTINATION lib/gnucash
-  RUNTIME DESTINATION bin)
-# No headers to install.
-
-
-# Scheme
-
-SET (qif_import_SCHEME
-  qif-dialog-utils.scm
-  qif-file.scm
-  qif-guess-map.scm
-  qif-merge-groups.scm
-  qif-objects.scm
-  qif-parse.scm
-  qif-to-gnc.scm
-  qif-utils.scm
-  qif-import.scm # yes, included in both SETs
-)
-
-SET(qif_import_SCHEME_2
-  qif-import.scm
-)
-
-SET(GUILE_MODULES      "")
-SET(GUILE_LOAD_DIRS    src/core-utils src/gnc-module src/scm)
-SET(GUILE_LIBRARY_DIRS src/core-utils src/gnc-module src/gnome)
-SET(GUILE_DEPENDS      gncmod-qif-import scm-core-utils scm-gnc-module scm-scm)
-
-GNC_ADD_SCHEME_TARGETS(scm-qif-import-2
-  "${qif_import_SCHEME_2}"
-  "gnucash/import-export"
-  "${GUILE_MODULES}"
-  "${GUILE_LOAD_DIRS}"
-  "${GUILE_LIBRARY_DIRS}"
-  "${GUILE_DEPENDS}"
-  FALSE
-)
-
-GNC_ADD_SCHEME_TARGETS(scm-qif-import
-  "${qif_import_SCHEME}"
-  "qif-import"
-  "${GUILE_MODULES}"
-  "${GUILE_LOAD_DIRS}"
-  "${GUILE_LIBRARY_DIRS}"
-  "${GUILE_DEPENDS}"
-  FALSE
-)
-
-SET(qif_import_GLADE assistant-qif-import.glade dialog-account-picker.glade)
-
-INSTALL(FILES ${qif_import_GLADE} DESTINATION share/gnucash/gtkbuilder)
-
-SET(qif_import_UI gnc-plugin-qif-import-ui.xml)
-
-INSTALL(FILES ${qif_import_UI} DESTINATION share/gnucash/ui)
-
-FILE(COPY ${qif_import_UI}
-  DESTINATION ${DATADIR_BUILD}/gnucash/ui)
-FILE(COPY ${qif_import_GLADE}
-  DESTINATION ${DATADIR_BUILD}/gnucash/gtkbuilder)
-
-SET_LOCAL_DIST(qif_import_DIST_local CMakeLists.txt Makefile.am file-format.txt ${qif_import_SOURCES} ${qif_import_noinst_HEADERS}
-        ${qif_import_SCHEME} ${qif_import_SCHEME_2} ${qif_import_GLADE} ${qif_import_UI})
-SET(qif_import_DIST ${qif_import_DIST_local} ${test_qif_import_DIST} ${qif_import_gschema_DIST} PARENT_SCOPE)
diff --git a/src/import-export/qif-imp/Makefile.am b/src/import-export/qif-imp/Makefile.am
deleted file mode 100644
index 96b29c0..0000000
--- a/src/import-export/qif-imp/Makefile.am
+++ /dev/null
@@ -1,142 +0,0 @@
-SUBDIRS = . test gschemas
-
-pkglib_LTLIBRARIES=libgncmod-qif-import.la
-
-libgncmod_qif_import_la_SOURCES = \
-  dialog-account-picker.c \
-  assistant-qif-import.c \
-  gnc-plugin-qif-import.c \
-  gncmod-qif-import.c
-
-noinst_HEADERS = \
-  dialog-account-picker.h \
-  assistant-qif-import.h \
-  gnc-plugin-qif-import.h
-
-libgncmod_qif_import_la_LDFLAGS = -avoid-version
-
-libgncmod_qif_import_la_LIBADD = \
-  ${top_builddir}/src/import-export/libgncmod-generic-import.la \
-  ${top_builddir}/src/gnome/libgnc-gnome.la \
-  ${top_builddir}/src/gnome-utils/libgncmod-gnome-utils.la \
-  ${top_builddir}/src/app-utils/libgncmod-app-utils.la \
-  ${top_builddir}/src/core-utils/libgnc-core-utils.la \
-  ${top_builddir}/src/engine/libgncmod-engine.la \
-  ${top_builddir}/src/gnc-module/libgnc-module.la \
-  ${GUILE_LIBS} \
-  ${GLIB_LIBS}
-
-
-gncscmmoddir = ${GNC_SCM_INSTALL_DIR}/gnucash/import-export
-gncscmmod_DATA = qif-import.scm 
-
-gncscmdir = ${GNC_SCM_INSTALL_DIR}/qif-import
-
-gncscm_DATA = \
-  qif-dialog-utils.scm \
-  qif-file.scm \
-  qif-guess-map.scm \
-  qif-import.scm \
-  qif-merge-groups.scm \
-  qif-objects.scm \
-  qif-parse.scm \
-  qif-to-gnc.scm \
-  qif-utils.scm
-
-gtkbuilderdir = ${GNC_GTKBUILDER_DIR}
-gtkbuilder_DATA = \
-   dialog-account-picker.glade \
-   assistant-qif-import.glade
-
-AM_CPPFLAGS = \
-  -I${top_srcdir}/src \
-  -I${top_builddir}/src \
-  -I${top_srcdir}/src/core-utils \
-  -I${top_srcdir}/src/engine \
-  -I${top_srcdir}/src/gnc-module \
-  -I${top_srcdir}/src/app-utils \
-  -I${top_srcdir}/src/gnome \
-  -I${top_srcdir}/src/gnome-utils \
-  -I${top_srcdir}/src/import-export \
-  ${GUILE_CFLAGS} \
-  ${GLIB_CFLAGS} \
-  ${GTK_CFLAGS}
-
-uidir = $(GNC_UI_DIR)
-ui_DATA = \
-	gnc-plugin-qif-import-ui.xml
-
-EXTRA_DIST = \
-  ${gncscm_DATA} \
-  ${gtkbuilder_DATA} \
-  file-format.txt \
-  $(ui_DATA) \
-  CMakeLists.txt
-
-CLEANFILES =
-
-if GNUCASH_SEPARATE_BUILDDIR
-SCM_FILE_LINKS = \
-  ${gncscm_DATA}
-endif
-
-noinst_DATA = .scm-links
-
-.scm-links: 
-	$(RM) -rf gnucash
-	mkdir -p  gnucash qif-import
-	mkdir -p  gnucash/import-export
-if GNUCASH_SEPARATE_BUILDDIR
-	for X in ${SCM_FILE_LINKS} ; do \
-	  $(LN_S) -f ${srcdir}/$$X . ; \
-	done
-endif
-	( cd gnucash/import-export; for A in $(gncscmmod_DATA) ; do $(LN_S) -f ../../$$A . ; done )
-	( cd qif-import; for A in $(gncscm_DATA) ; do $(LN_S) -f ../$$A . ; done )
-if ! OS_WIN32
-# Windows knows no "ln -s" but uses "cp": must copy every time (see bug #566567).
-	touch .scm-links
-endif
-
-if GNC_HAVE_GUILE_2
-GUILE_COMPILE_ENV = \
-  --guile-load-dir ${top_builddir}/src/core-utils \
-  --guile-load-dir ${top_builddir}/src/gnc-module \
-  --guile-load-dir ${top_builddir}/src/scm \
-  --library-dir    ${top_builddir}/src/engine \
-  --library-dir    ${top_builddir}/src/core-utils \
-  --library-dir    ${top_builddir}/src/app-utils \
-  --library-dir    ${top_builddir}/src/gnome \
-  --library-dir    ${top_builddir}/src/gnc-module \
-  --library-dir    ${top_builddir}/src/gnome-utils \
-  --library-dir    ${top_builddir}/src/backend/xml \
-  --library-dir    ${top_builddir}/src/backend/sql \
-  --library-dir    ${top_builddir}/src/html \
-  --library-dir    ${top_builddir}/src/report/report-system \
-  --library-dir    ${top_builddir}/src/report/report-gnome \
-  --library-dir    ${top_builddir}/src/register/register-gnome \
-  --library-dir    ${top_builddir}/src/register/register-core \
-  --library-dir    ${top_builddir}/src/register/ledger-core \
-  --library-dir    ${top_builddir}/src/gnome-search
-
-
-%.go : %.scm .scm-links $(pkglib_LTLIBRARIES)
-	GNC_UNINSTALLED=yes \
-	GNC_BUILDDIR=${top_builddir} \
-	$(shell ${abs_top_srcdir}/src/gnc-test-env.pl --noexports ${GUILE_COMPILE_ENV}) \
-	$(GUILD) compile -o $@ $<
-
-gncscmmodcachedir = ${pkglibdir}/scm/ccache/@GUILE_EFFECTIVE_VERSION@/gnucash/import-export
-gncscmmodcache_DATA = $(gncscmmod_DATA:.scm=.go)
-
-gncscmcachedir = ${pkglibdir}/scm/ccache/@GUILE_EFFECTIVE_VERSION@/qif-import
-gncscmcache_DATA = $(gncscm_DATA:.scm=.go)
-endif
-
-clean-local:
-	$(RM) -rf gnucash qif-import
-
-CLEANFILES += .scm-links ${gncscmmodcache_DATA} ${gncscmcache_DATA}
-DISTCLEANFILES = ${SCM_FILE_LINKS}
-
-AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.import.qif.import\"
diff --git a/src/import-export/qif-imp/test/Makefile.am b/src/import-export/qif-imp/test/Makefile.am
deleted file mode 100644
index 202b6cb..0000000
--- a/src/import-export/qif-imp/test/Makefile.am
+++ /dev/null
@@ -1,17 +0,0 @@
-TESTS=test-link
-
-check_PROGRAMS=test-link
-
-test_link_SOURCES = \
-  test-link.c
-
-test_link_LDADD=../libgncmod-qif-import.la \
-  ${top_builddir}/src/register/ledger-core/libgncmod-ledger-core.la \
-  ${top_builddir}/src/core-utils/libgnc-core-utils.la \
-  ${top_builddir}/src/gnome/libgnc-gnome.la \
-  ${top_builddir}/src/engine/libgncmod-engine.la \
-  ${top_builddir}/src/gnome-utils/libgncmod-gnome-utils.la \
-  ${top_builddir}/src/app-utils/libgncmod-app-utils.la \
-  ${LIBXML2_LIBS}
-
-EXTRA_DIST = CMakeLists.txt
diff --git a/src/import-export/qif/Makefile.am b/src/import-export/qif/Makefile.am
deleted file mode 100644
index 88c7280..0000000
--- a/src/import-export/qif/Makefile.am
+++ /dev/null
@@ -1,39 +0,0 @@
-#SUBDIRS = . test
-DIST_SUBDIRS = test
-
-pkglib_LTLIBRARIES=libgncmod-qif.la
-
-libgncmod_qif_la_SOURCES = \
-  qif-context.c \
-  qif-defaults.c \
-  qif-file.c \
-  qif-objects.c \
-  qif-parse.c
-
-noinst_HEADERS = \
-  qif-file.h \
-  qif-defaults.h \
-  qif-import-p.h \
-  qif-import.h \
-  qif-objects.h \
-  qif-objects-p.h \
-  qif-parse.h
-
-libgncmod_qif_la_LIBADD = \
-  ${top_builddir}/src/import-export/libgncmod-generic-import.la \
-  ${top_builddir}/src/engine/libgncmod-engine.la \
-  ${REGEX_LIBS} \
-  ${GLIB_LIBS}
-
-AM_CPPFLAGS = \
-  -I${top_srcdir}/src \
-  -I${top_srcdir}/src/engine \
-  -I${top_srcdir}/src/gnc-module \
-  -I${top_srcdir}/src/app-utils \
-  -I${top_srcdir}/src/import-export \
-  ${GLIB_CFLAGS} \
-  ${GUILE_CFLAGS}
-
-AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.import.qif\"
-
-EXTRA_DIST = CMakeLists.txt
diff --git a/src/import-export/qif/test/CMakeLists.txt b/src/import-export/qif/test/CMakeLists.txt
deleted file mode 100644
index eb4d2b4..0000000
--- a/src/import-export/qif/test/CMakeLists.txt
+++ /dev/null
@@ -1,18 +0,0 @@
-
-SET(QIF_TEST_INCLUDE_DIRS
-  ${CMAKE_BINARY_DIR}/src
-  ${CMAKE_SOURCE_DIR}/src/import-export/qif
-  ${CMAKE_SOURCE_DIR}/src/engine
-  ${CMAKE_SOURCE_DIR}/src/test-core
-  ${GLIB2_INCLUDE_DIRS}
-)
-SET(QIF_TEST_LIBS gncmod-qif test-core)
-
-IF (FALSE)
-  # Tests for this directory are not run.
-  GNC_ADD_TEST(test-link-qif test-link.c QIF_TEST_INCLUDE_DIRS QIF_TEST_LIBS)
-  GNC_ADD_TEST(test-qif test-qif.c QIF_TEST_INCLUDE_DIRS QIF_TEST_LIBS
-    GNC_TEST_FILES=${CMAKE_CURRENT_SOURCE_DIR}/test-files)
-ENDIF()
-
-SET_DIST_LIST(test_qif_DIST CMakeLists.txt Makefile.am test-link.c test-qif.c test-files/test-1-bank-txn.qif)
diff --git a/src/import-export/qif/test/Makefile.am b/src/import-export/qif/test/Makefile.am
deleted file mode 100644
index befbc4a..0000000
--- a/src/import-export/qif/test/Makefile.am
+++ /dev/null
@@ -1,49 +0,0 @@
-AM_CPPFLAGS = \
-  -I${top_srcdir}/src \
-  -I${top_srcdir}/src/gnc-module \
-  -I${top_srcdir}/src/test-core \
-  -I${top_srcdir}/src/engine \
-  -I${top_srcdir}/src/app-utils \
-  -I${top_srcdir}/src/import-export \
-  -I${top_srcdir}/src/import-export/qif \
-  ${GUILE_CFLAGS} \
-  ${GLIB_CFLAGS}
-
-LDADD = \
-  ${top_builddir}/src/gnc-module/libgnc-module.la \
-  ${top_builddir}/src/test-core/libtest-core.la \
-  ../../libgncmod-generic-import.la \
-  ../libgncmod-qif.la \
-  ${GLIB_LIBS}
-
-TESTS = \
-  test-link \
-  test-qif
-
-GNC_TEST_DEPS = --gnc-module-dir ${top_builddir}/src/core-utils \
-  --gnc-module-dir ${top_builddir}/src/gnc-module \
-  --gnc-module-dir ${top_builddir}/src/engine \
-  --gnc-module-dir ${top_builddir}/src/app-utils \
-  --gnc-module-dir ${top_builddir}/src/import-export \
-  --gnc-module-dir ${top_builddir}/src/import-export/qif \
-  --gnc-module-dir ${top_builddir}/src/gnome-utils \
-  --gnc-module-dir ${top_srcdir}/src/gnc-module \
-  --gnc-module-dir ${top_srcdir}/src/engine \
-  --gnc-module-dir ${top_srcdir}/src/app-utils \
-  --gnc-module-dir ${top_srcdir}/src/gnome-utils \
-  --gnc-module-dir ${top_builddir}/src/gnome-utils \
-  --gnc-module-dir ${top_builddir}/src/gnome \
-  --guile-load-dir ${top_srcdir}/src/scm \
-  --guile-load-dir ${top_srcdir}/src/import-export \
-  --guile-load-dir ${top_srcdir}/src/import-export/qif
-
-TESTS_ENVIRONMENT = \
-  GNC_TEST_FILES=${srcdir}/test-files \
-  $(shell ${abs_top_srcdir}/src/gnc-test-env.pl --noexports ${GNC_TEST_DEPS})
-
-check_PROGRAMS = \
-  test-link \
-  test-qif
-
-EXTRA_DIST = \
-  test-files/test-1-bank-txn.qif CMakeLists.txt
diff --git a/src/import-export/test/CMakeLists.txt b/src/import-export/test/CMakeLists.txt
deleted file mode 100644
index 12a9ade..0000000
--- a/src/import-export/test/CMakeLists.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-SET(GENERIC_IMPORT_TEST_INCLUDE_DIRS
-  ${CMAKE_BINARY_DIR}/src # for config.h
-  ${CMAKE_SOURCE_DIR}/src/gnc-module
-  ${CMAKE_SOURCE_DIR}/src/import-export
-  ${CMAKE_SOURCE_DIR}/src/test-core
-  ${CMAKE_SOURCE_DIR}/src/engine
-  ${CMAKE_SOURCE_DIR}/src/engine/test-core
-  ${GLIB2_INCLUDE_DIRS}
-  ${GUILE_INCLUDE_DIRS}
-)
-
-SET(GENERIC_IMPORT_TEST_LIBS gncmod-generic-import gncmod-test-engine test-core)
-
-GNC_ADD_TEST_WITH_GUILE(test-import-parse test-import-parse.c
-  GENERIC_IMPORT_TEST_INCLUDE_DIRS GENERIC_IMPORT_TEST_LIBS
-)
-GNC_ADD_TEST(test-link-generic-import test-link.c
-  GENERIC_IMPORT_TEST_INCLUDE_DIRS GENERIC_IMPORT_TEST_LIBS
-)
-GNC_ADD_TEST(test-import-pending-matches test-import-pending-matches.c
-  GENERIC_IMPORT_TEST_INCLUDE_DIRS GENERIC_IMPORT_TEST_LIBS
-)
-SET_DIST_LIST(test_generic_import_DIST CMakeLists.txt Makefile.am
-        test-link.c test-import-parse.c test-import-pending-matches.c)
diff --git a/src/import-export/test/Makefile.am b/src/import-export/test/Makefile.am
deleted file mode 100644
index 196731e..0000000
--- a/src/import-export/test/Makefile.am
+++ /dev/null
@@ -1,78 +0,0 @@
-include $(top_srcdir)/test-templates/Makefile.decl
-
-AM_CPPFLAGS = \
-  -I${top_srcdir}/src \
-  -I${top_srcdir}/src/gnc-module \
-  -I${top_srcdir}/src/test-core \
-  -I${top_srcdir}/src/engine \
-  -I${top_srcdir}/src/app-utils \
-  -I${top_srcdir}/src/import-export \
-  -I${top_srcdir}/src/engine/test-core \
-  ${GTK_CFLAGS} \
-  ${GUILE_CFLAGS} \
-  ${GLIB_CFLAGS}
-
-LDADD = \
-  ${top_builddir}/src/core-utils/libgnc-core-utils.la \
-  ${top_builddir}/src/gnc-module/libgnc-module.la \
-  ${top_builddir}/src/test-core/libtest-core.la \
-  ../libgncmod-generic-import.la \
-  $(top_builddir)/src/app-utils/libgncmod-app-utils.la \
-  ${top_builddir}/src/gnome-utils/libgncmod-gnome-utils.la \
-  ${top_builddir}/src/engine/libgncmod-engine.la \
-  ${GLIB_LIBS} \
-  ${GUILE_LIBS}
-
-TESTS = \
-  test-link \
-  test-import-parse
-
-GNC_TEST_DEPS = --gnc-module-dir ${top_builddir}/src/engine \
-  --gnc-module-dir ${top_builddir}/src/app-utils \
-  --gnc-module-dir ${top_builddir}/src/gnome-utils \
-  --gnc-module-dir ${top_builddir}/src/import-export \
-  --guile-load-dir ${top_builddir}/src/gnc-module \
-  --guile-load-dir ${top_builddir}/src/scm \
-  --guile-load-dir ${top_builddir}/src/engine \
-  --guile-load-dir ${top_builddir}/src/core-utils \
-  --guile-load-dir ${top_builddir}/src/app-utils \
-  --guile-load-dir ${top_builddir}/src/gnome-utils \
-\
-  --library-dir    ${top_builddir}/src/core-utils \
-  --library-dir    ${top_builddir}/src/app-utils \
-  --library-dir    ${top_builddir}/src/gnome-utils \
-  --library-dir    ${top_builddir}/src/engine \
-  --library-dir    ${top_builddir}/src/backend/xml \
-  --library-dir    ${top_builddir}/src/backend/sql  \
-  --library-dir    ${top_builddir}/src/gnc-module
-
-TESTS_ENVIRONMENT = \
-  GUILE_WARN_DEPRECATED=no \
-  GNC_BUILDDIR="${abs_top_builddir}" \
-  $(shell ${abs_top_srcdir}/src/gnc-test-env.pl --noexports ${GNC_TEST_DEPS})
-
-check_PROGRAMS = \
-  test-link \
-  test-import-parse
-
-TEST_PROGS += test-import-pending-matches
-
-noinst_PROGRAMS = $(TEST_PROGS) $(check_PROGRAMS)
-
-test_import_pending_matches_SOURCES = test-import-pending-matches.c
-
-test_import_pending_matches_LDADD = \
-  ${top_builddir}/src/engine/libgncmod-engine.la \
-  ../libgncmod-generic-import.la \
-  ${top_builddir}/src/engine/test-core/libgncmod-test-engine.la \
-  ${top_builddir}/src/test-core/libtest-core.la \
-  ${GLIB_LIBS}
-
-test_import_pending_matches_CFLAGS = $(AM_CPPFLAGS)
-
-clean-local:
-	rm -f translog.*
-
-distclean-local: clean-local
-
-EXTRA_DIST += CMakeLists.txt
diff --git a/src/optional/CMakeLists.txt b/src/optional/CMakeLists.txt
deleted file mode 100644
index 320b387..0000000
--- a/src/optional/CMakeLists.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-ADD_SUBDIRECTORY(python-bindings)
-
-SET_LOCAL_DIST(optional_DIST_local CMakeLists.txt Makefile.am)
-SET(optional_DIST ${optional_DIST_local} ${python_bindings_DIST} PARENT_SCOPE)
diff --git a/src/optional/Makefile.am b/src/optional/Makefile.am
deleted file mode 100644
index 73573b1..0000000
--- a/src/optional/Makefile.am
+++ /dev/null
@@ -1,6 +0,0 @@
-if WITH_PYTHON
-    PYTHON_BINDINGS_DIR = python-bindings
-endif
-SUBDIRS = ${PYTHON_BINDINGS_DIR}
-
-EXTRA_DIST = CMakeLists.txt
diff --git a/src/optional/python-bindings/CMakeLists.txt b/src/optional/python-bindings/CMakeLists.txt
deleted file mode 100644
index 8aed964..0000000
--- a/src/optional/python-bindings/CMakeLists.txt
+++ /dev/null
@@ -1,118 +0,0 @@
-ADD_SUBDIRECTORY(example_scripts)
-ADD_SUBDIRECTORY(tests)
-
-IF (BUILDING_FROM_VCS)
-  SET(SWIG_FILES ${CMAKE_CURRENT_SOURCE_DIR}/gnucash_core.i ${CMAKE_CURRENT_SOURCE_DIR}/timespec.i)
-  SET(GNUCASH_CORE_C_INCLUDES
-    ${CMAKE_BINARY_DIR}/src/config.h
-    ${CMAKE_SOURCE_DIR}/src/engine/qofsession.h
-    ${CMAKE_SOURCE_DIR}/src/engine/qofbook.h
-    ${CMAKE_SOURCE_DIR}/src/engine/qofbackend.h
-    ${CMAKE_SOURCE_DIR}/src/engine/qoflog.h
-    ${CMAKE_SOURCE_DIR}/src/engine/qofutil.h
-    ${CMAKE_SOURCE_DIR}/src/engine/qofid.h
-    ${CMAKE_SOURCE_DIR}/src/engine/guid.h
-    ${CMAKE_SOURCE_DIR}/src/gnc-module/gnc-module.h
-    ${CMAKE_SOURCE_DIR}/src/engine/gnc-engine.h
-    ${CMAKE_SOURCE_DIR}/src/engine/Transaction.h
-    ${CMAKE_SOURCE_DIR}/src/engine/Split.h
-    ${CMAKE_SOURCE_DIR}/src/engine/Account.h
-    ${CMAKE_SOURCE_DIR}/src/engine/gnc-commodity.h
-    ${CMAKE_SOURCE_DIR}/src/engine/gnc-lot.h
-    ${CMAKE_SOURCE_DIR}/src/engine/gnc-numeric.h
-    ${CMAKE_SOURCE_DIR}/src/engine/gncCustomer.h
-    ${CMAKE_SOURCE_DIR}/src/engine/gncEmployee.h
-    ${CMAKE_SOURCE_DIR}/src/engine/gncVendor.h
-    ${CMAKE_SOURCE_DIR}/src/engine/gncAddress.h
-    ${CMAKE_SOURCE_DIR}/src/engine/gncBillTerm.h
-    ${CMAKE_SOURCE_DIR}/src/engine/gncOwner.h
-    ${CMAKE_SOURCE_DIR}/src/engine/gncInvoice.h
-    ${CMAKE_SOURCE_DIR}/src/engine/gncJob.h
-    ${CMAKE_SOURCE_DIR}/src/engine/gncEntry.h
-    ${CMAKE_SOURCE_DIR}/src/engine/gncTaxTable.h
-    ${CMAKE_SOURCE_DIR}/src/engine/gncIDSearch.h
-    ${CMAKE_SOURCE_DIR}/src/engine/gnc-pricedb.h
-    ${CMAKE_SOURCE_DIR}/src/app-utils/gnc-prefs-utils.h
-  )
-
-  SET (SWIG_GNUCASH_CORE_C ${CMAKE_CURRENT_BINARY_DIR}/gnucash_core.c)
-
-  GNC_ADD_SWIG_PYTHON_COMMAND (swig-gnucash-core ${SWIG_GNUCASH_CORE_C}
-    ${SWIG_FILES}
-    ${CMAKE_SOURCE_DIR}/src/base-typemaps.i
-    ${CMAKE_SOURCE_DIR}/src/engine/engine-common.i
-    ${GNUCASH_CORE_C_INCLUDES}
-  )
-ELSE()
-  SET (SWIG_GNUCASH_CORE_C gnucash_core.c)
-ENDIF()
-
-IF(WITH_PYTHON)
-
-  SET(gnucash_core_c_INCLUDE_DIRS
-    ${CMAKE_SOURCE_DIR}/src
-    ${CMAKE_SOURCE_DIR}/src/engine
-    ${CMAKE_SOURCE_DIR}/src/gnome-utils
-    ${CMAKE_SOURCE_DIR}/src/app-utils
-    ${CMAKE_SOURCE_DIR}/src/gnc-module
-    ${CMAKE_SOURCE_DIR}/src/gnome
-    ${CMAKE_SOURCE_DIR}/src/core-utils
-    ${CMAKE_SOURCE_DIR}/src/gnc-module
-    ${GLIB_INCLUDE_DIRS}
-    ${PYTHON_INCLUDE_DIRS}
-  )
-
-  ADD_LIBRARY(gnucash_core_c MODULE ${SWIG_GNUCASH_CORE_C})
-  TARGET_INCLUDE_DIRECTORIES(gnucash_core_c PRIVATE ${gnucash_core_c_INCLUDE_DIRS})
-
-  TARGET_LINK_LIBRARIES(gnucash_core_c gncmod-app-utils gncmod-engine gnc-module ${GLIB_LIBS} ${PYTHON_LIBRARIES})
-  SET_TARGET_PROPERTIES(gnucash_core_c PROPERTIES PREFIX "_")
-  TARGET_COMPILE_OPTIONS(gnucash_core_c PRIVATE -Wno-implicit -Wno-missing-prototypes -Wno-declaration-after-statement -Wno-missing-declarations)
-
-  ADD_EXECUTABLE(sqlite3test EXCLUDE_FROM_ALL sqlite3test.c ${SWIG_GNUCASH_CORE_C})
-  TARGET_LINK_LIBRARIES(sqlite3test gncmod-app-utils gncmod-engine gnc-module ${GLIB_LIBS} ${PYTHON_LIBRARIES})
-  TARGET_INCLUDE_DIRECTORIES(sqlite3test PRIVATE ${gnucash_core_c_INCLUDE_DIRS})
-  TARGET_COMPILE_OPTIONS(sqlite3test PRIVATE -Wno-implicit -Wno-missing-prototypes -Wno-declaration-after-statement -Wno-missing-declarations)
-
-  ADD_TEST(NAME sqlite3test COMMAND sqlite3test)
-  ADD_DEPENDENCIES(check sqlite3test)
-
-
-  # Determine where to install the python libraries.
-  EXECUTE_PROCESS(
-    COMMAND ${PYTHON_EXECUTABLE} -c "import sysconfig; print sysconfig.get_path('platlib', vars = { 'platbase' : '${CMAKE_INSTALL_PREFIX}' }  )"
-    RESULT_VARIABLE PYTHON_SYSCONFIG_RESULT
-    OUTPUT_VARIABLE PYTHON_SYSCONFIG_OUTPUT
-    ERROR_VARIABLE PYTHON_SYSCONFIG_ERROR
-    OUTPUT_STRIP_TRAILING_WHITESPACE
-    ERROR_STRIP_TRAILING_WHITESPACE
-  )
-  IF (PYTHON_SYSCONFIG_RESULT)
-    MESSAGE(SEND_ERROR "Could not determine Python site-package directory:\n${PYTHON_SYSCONFIG_ERROR}")
-  ENDIF()
-
-  INSTALL(TARGETS gnucash_core_c
-    LIBRARY DESTINATION ${PYTHON_SYSCONFIG_OUTPUT}/gnucash
-    ARCHIVE DESTINATION ${PYTHON_SYSCONFIG_OUTPUT}/gnucash
-  )
-  INSTALL(FILES __init__.py function_class.py gnucash_business.py gnucash_core.py
-    ${CMAKE_CURRENT_BINARY_DIR}/gnucash_core_c.py
-    DESTINATION ${PYTHON_SYSCONFIG_OUTPUT}/gnucash
-  )
-
-ENDIF()
-
-SET(python_bindings_DATA
-        __init__.py
-        function_class.py
-        gnucash_business.py
-        gnucash_core.i
-        gnucash_core.py
-        sqlite3test.c
-        timespec.i)
-
-SET_LOCAL_DIST(python_bindings_DIST_local CMakeLists.txt Makefile.am ${python_bindings_DATA})
-
-SET(python_bindings_DIST ${python_bindings_DIST_local} ${test_python_bindings_DIST} ${example_scripts_DIST} PARENT_SCOPE)
-
-
diff --git a/src/optional/python-bindings/Makefile.am b/src/optional/python-bindings/Makefile.am
deleted file mode 100644
index 6d0ac7d..0000000
--- a/src/optional/python-bindings/Makefile.am
+++ /dev/null
@@ -1,137 +0,0 @@
-SUBDIRS = . tests
-
-SWIG_FILES = gnucash_core.i timespec.i
-
-pkgpyexec_DATA = \
-  __init__.py \
-  function_class.py \
-  gnucash_core.py \
-  gnucash_core_c.py \
-  gnucash_business.py
-
-pkgpyexec_LTLIBRARIES = _gnucash_core_c.la
-
-_gnucash_core_c_la_SOURCES = \
-  gnucash_core.c
-
-_gnucash_core_c_la_CPPFLAGS = \
-  $(PYTHON_CPPFLAGS) \
-  $(GLIB_CFLAGS) \
-  -I$(top_srcdir)/src  \
-  -I$(top_srcdir)/src/engine \
-  -I${top_srcdir}/src/gnome-utils \
-  -I${top_srcdir}/src/app-utils \
-  -I${top_srcdir}/src/gnc-module \
-  -I${top_srcdir}/src/gnome \
-  -I${top_srcdir}/src/core-utils \
-  -I${top_srcdir}/src/gnc-module
-
-# Suppress all warnings for now, but we really only need to -Wno-implicit
-AM_CFLAGS = -w
-
-_gnucash_core_c_la_LDFLAGS = -avoid-version -module
-
-_gnucash_core_c_la_LIBADD = \
-  ${GLIB_LIBS} \
-  ${top_builddir}/src/gnc-module/libgnc-module.la \
-  ${top_builddir}/src/engine/libgncmod-engine.la \
-  ${top_builddir}/src/app-utils/libgncmod-app-utils.la
-if BUILDING_FROM_VCS
-_gnucash_core_c_includes= \
-	${top_builddir}/config.h \
-	${top_srcdir}/src/engine/qofsession.h \
-	${top_srcdir}/src/engine/qofbook.h \
-	${top_srcdir}/src/engine/qofbackend.h \
-	${top_srcdir}/src/engine/qoflog.h \
-	${top_srcdir}/src/engine/qofutil.h \
-	${top_srcdir}/src/engine/qofid.h \
-	${top_srcdir}/src/engine/guid.h \
-	${top_srcdir}/src/gnc-module/gnc-module.h \
-	${top_srcdir}/src/engine/gnc-engine.h \
-	${top_srcdir}/src/engine/Transaction.h \
-	${top_srcdir}/src/engine/Split.h \
-	${top_srcdir}/src/engine/Account.h \
-	${top_srcdir}/src/engine/gnc-commodity.h \
-	${top_srcdir}/src/engine/gnc-lot.h \
-	${top_srcdir}/src/engine/gnc-numeric.h \
-	${top_srcdir}/src/engine/gncCustomer.h \
-	${top_srcdir}/src/engine/gncEmployee.h \
-	${top_srcdir}/src/engine/gncVendor.h \
-	${top_srcdir}/src/engine/gncAddress.h \
-	${top_srcdir}/src/engine/gncBillTerm.h \
-	${top_srcdir}/src/engine/gncOwner.h \
-	${top_srcdir}/src/engine/gncInvoice.h \
-	${top_srcdir}/src/engine/gncJob.h \
-	${top_srcdir}/src/engine/gncEntry.h \
-	${top_srcdir}/src/engine/gncTaxTable.h \
-	${top_srcdir}/src/engine/gncIDSearch.h \
-	${top_srcdir}/src/engine/gnc-pricedb.h \
-	${top_srcdir}/src/app-utils/gnc-prefs-utils.h
-
-
-gnucash_core.c: $(SWIG_FILES) ${top_srcdir}/src/base-typemaps.i ${top_srcdir}/src/engine/engine-common.i $(_gnucash_core_c_includes)
-	$(SWIG) -python -Wall -Werror \
-	-I$(top_srcdir)/src -I$(top_srcdir)/src/engine \
-	-I$(top_srcdir)/src/app-utils -o $@ $<
-
-gnucash_core_c.py: gnucash_core.c $(SWIG_FILES)
-endif
-
-EXTRA_DIST = \
-  $(pkgpyexec_DATA) \
-  $(SWIG_FILES) \
-  example_scripts/Invoice.tex \
-  example_scripts/latex_invoices.py \
-  example_scripts/simple_book.py \
-  example_scripts/simple_session.py \
-  example_scripts/simple_test.py \
-  example_scripts/simple_business_create.py \
-  example_scripts/simple_invoice_insert.py \
-  example_scripts/simple_sqlite_create.py \
-  example_scripts/change_tax_code.py \
-  example_scripts/account_analysis.py \
-  example_scripts/new_book_with_opening_balances.py \
-  example_scripts/test_imbalance_transaction.py \
-  example_scripts/rest-api/gnucash_rest.py \
-  example_scripts/rest-api/gnucash_simple.py \
-  example_scripts/rest-api/README \
-  example_scripts/CMakeLists.txt \
-  CMakeLists.txt
-
-MAINTAINERCLEANFILES = gnucash_core.c
-
-
-check_PROGRAMS = sqlite3test
-sqlite3test_SOURCES = sqlite3test.c
-sqlite3test_LDADD = ${_gnucash_core_c_la_LIBADD}
-sqlite3test_CPPFLAGS = ${_gnucash_core_c_la_CPPFLAGS}
-
-PYTHON_LINK_FILES = \
-  $(pkgpyexec_DATA)
-
-.py-links:$(PYTHON_LINK_FILES)
-	$(RM) -rf gnucash
-	mkdir -p gnucash
-if GNUCASH_SEPARATE_BUILDDIR
-	for X in $(filter-out gnucash_core_c.py,${PYTHON_LINK_FILES}) ; do \
-	  $(LN_S) -f ${srcdir}/$$X . ; \
-	done
-endif
-	( cd gnucash; for file in $(PYTHON_LINK_FILES) ; do \
-	  $(LN_S) -f ../$$file .; \
-	  done )
-
-
-if ! OS_WIN32
-	touch .py-links
-endif
-
-noinst_DATA = .py-links
-
-CLEANFILES = $(BUILT_SOURCES) .py-links gnucash_core.c.py
-
-clean-local:
-	rm -rf gnucash
-
-uninstall-local:
-	rm -rf ${pkgpyexecdir}
diff --git a/src/optional/python-bindings/gnucash_core.i b/src/optional/python-bindings/gnucash_core.i
deleted file mode 100644
index d636ce7..0000000
--- a/src/optional/python-bindings/gnucash_core.i
+++ /dev/null
@@ -1,229 +0,0 @@
-/*
- * gnucash_core.i -- SWIG interface file for the core parts of GnuCash
- *
- * Copyright (C) 2008 ParIT Worker Co-operative <paritinfo at parit.ca>
- *
- * 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 at gnu.org
- *
- * @author Mark Jenkins, ParIT Worker Co-operative <mark at parit.ca>
- * @author Jeff Green, ParIT Worker Co-operative <jeff at parit.ca>
- */
-
-/** @file
-    @brief SWIG interface file for the core parts of GnuCash
-
-        This file is processed by SWIG and the resulting files are gnucash_core.c and gnucash_core_c.py.
-        Have a look at the includes to see which parts of the GnuCash source SWIG takes as input.
-    @author Mark Jenkins, ParIT Worker Co-operative <mark at parit.ca>
-    @author Jeff Green,   ParIT Worker Co-operative <jeff at parit.ca>
-    @ingroup python_bindings 
-
-    @file gnucash_core.c
-    @brief SWIG output file.
-    @ingroup python_bindings
-    @file gnucash_core_c.py
-    @brief SWIG output file.
-    @ingroup python_bindings
-*/
-
-%feature("autodoc", "1");
-%module(package="gnucash") gnucash_core_c
-
-%{
-#include "config.h"
-#include <datetime.h>
-#include "qofsession.h"
-#include "qofbook.h"
-#include "qofbackend.h"
-#include "qoflog.h"
-#include "qofutil.h"
-#include "qofid.h"
-#include "guid.h"
-#include "qofquery.h"
-#include "qofquerycore.h"
-#include "gnc-module/gnc-module.h"
-#include "engine/gnc-engine.h"
-#include "Transaction.h"
-#include "Split.h"
-#include "Account.h"
-#include "gnc-commodity.h"
-#include "gnc-environment.h"
-#include "gnc-lot.h"
-#include "gnc-numeric.h"
-#include "gncCustomer.h"
-#include "gncCustomerP.h"
-#include "gncEmployee.h"
-#include "gncVendor.h"
-#include "gncVendorP.h"
-#include "gncAddress.h"
-#include "gncBillTerm.h"
-#include "gncOwner.h"
-#include "gncInvoice.h"
-#include "gncInvoiceP.h"
-#include "gncJob.h"
-#include "gncEntry.h"
-#include "gncTaxTable.h"
-#include "gncIDSearch.h"
-#include "engine/gnc-pricedb.h"
-#include "app-utils/gnc-prefs-utils.h"
-#include "cap-gains.h"
-#include "Scrub3.h"
-%}
-
-%include <timespec.i>
-
-%include <base-typemaps.i>
-
-%include <engine-common.i>
-
-%include <qofbackend.h>
-
-// this function is defined in qofsession.h, but isnt found in the libraries,
-// ignored because SWIG attempts to link against (to create language bindings)
-%ignore qof_session_not_saved;
-%include <qofsession.h>
-
-%include <qofbook.h>
-
-%include <qofid.h>
-
-%include <qofquery.h>
-
-%include <qofquerycore.h>
-
-/* SWIG doesn't like this macro, so redefine it to simply mean const */
-#define G_CONST_RETURN const
-%include <guid.h>
-
-/* %include <Transaction.h>
-%include <Split.h>
-%include <Account.h> */
-
-//Ignored because it is unimplemented
-%ignore gnc_numeric_convert_with_error;
-%include <gnc-numeric.h>
-
-%include <gnc-commodity.h>
-
-%typemap(out) GncOwner * {
-    GncOwnerType owner_type = gncOwnerGetType($1);
-    PyObject * owner_tuple = PyTuple_New(2);
-    PyTuple_SetItem(owner_tuple, 0, PyInt_FromLong( (long) owner_type ) );
-    PyObject * swig_wrapper_object;
-    if (owner_type == GNC_OWNER_CUSTOMER ){
-        swig_wrapper_object = SWIG_NewPointerObj(
-        gncOwnerGetCustomer($1), $descriptor(GncCustomer *), 0);
-    }
-    else if (owner_type == GNC_OWNER_JOB){
-        swig_wrapper_object = SWIG_NewPointerObj(
-        gncOwnerGetJob($1), $descriptor(GncJob *), 0);
-    }
-    else if (owner_type == GNC_OWNER_VENDOR){
-        swig_wrapper_object = SWIG_NewPointerObj(
-        gncOwnerGetVendor($1), $descriptor(GncVendor *), 0);
-    }
-    else if (owner_type == GNC_OWNER_EMPLOYEE){
-        swig_wrapper_object = SWIG_NewPointerObj(
-        gncOwnerGetEmployee($1), $descriptor(GncEmployee *), 0);
-    }
-    else {
-        swig_wrapper_object = Py_None;
-    Py_INCREF(Py_None);
-    }
-    PyTuple_SetItem(owner_tuple, 1, swig_wrapper_object);
-    $result = owner_tuple;
-}
-
-
-%typemap(in) GncOwner * {
-    GncOwner * temp_owner = gncOwnerNew();
-    void * pointer_to_real_thing;
-    if ((SWIG_ConvertPtr($input, &pointer_to_real_thing,
-                         $descriptor(GncCustomer *),
-                         SWIG_POINTER_EXCEPTION)) == 0){
-        gncOwnerInitCustomer(temp_owner, (GncCustomer *)pointer_to_real_thing);
-        $1 = temp_owner;
-    }
-    else if ((SWIG_ConvertPtr($input, &pointer_to_real_thing,
-                         $descriptor(GncJob *),
-                         SWIG_POINTER_EXCEPTION)) == 0){
-        gncOwnerInitJob(temp_owner, (GncJob *)pointer_to_real_thing);
-        $1 = temp_owner;
-    }
-    else if ((SWIG_ConvertPtr($input, &pointer_to_real_thing,
-                         $descriptor(GncVendor *),
-                         SWIG_POINTER_EXCEPTION)) == 0){
-        gncOwnerInitVendor(temp_owner, (GncVendor *)pointer_to_real_thing);
-        $1 = temp_owner;
-    }
-    else if ((SWIG_ConvertPtr($input, &pointer_to_real_thing,
-                         $descriptor(GncEmployee *),
-                         SWIG_POINTER_EXCEPTION)) == 0){
-        gncOwnerInitEmployee(temp_owner, (GncEmployee *)pointer_to_real_thing);
-        $1 = temp_owner;
-    }
-    else {
-    PyErr_SetString(
-        PyExc_ValueError,
-        "Python object passed to function with GncOwner * argument "
-        "couldn't be converted back to pointer of that type");
-        return NULL;
-    }
-}
-
-%typemap(freearg) GncOwner * {
-    gncOwnerFree($1);
-}
-
-static const GncGUID * gncEntryGetGUID(GncEntry *x);
-
-%include <gnc-lot.h>
-
-//core business includes
-%include <gncOwner.h>
-%include <gncCustomer.h>
-%include <gncCustomerP.h>
-%include <gncEmployee.h>
-%include <gncVendor.h>
-%include <gncVendorP.h>
-%include <gncAddress.h>
-%include <gncBillTerm.h>
-%include <gncInvoice.h>
-%include <gncInvoiceP.h>
-%include <gncJob.h>
-%include <gncEntry.h>
-%include <gncTaxTable.h>
-%include <gncIDSearch.h>
-
-// Commodity prices includes and stuff
-%include <gnc-pricedb.h>
-
-%include <cap-gains.h>
-%include <Scrub3.h>
-
-%init %{
-gnc_environment_setup();
-qof_log_init();
-qof_init();
-qof_query_init();
-gnc_module_system_init();
-char * no_args[1] = { NULL };
-gnc_engine_init(0, no_args);
-gnc_prefs_init();
-%}
-
diff --git a/src/optional/python-bindings/tests/Makefile.am b/src/optional/python-bindings/tests/Makefile.am
deleted file mode 100644
index 6b638c5..0000000
--- a/src/optional/python-bindings/tests/Makefile.am
+++ /dev/null
@@ -1,53 +0,0 @@
-GNC_TEST_DEPS = --gnc-module-dir ${top_builddir}/src/engine \
-  --gnc-module-dir ${top_builddir}/src/app-utils \
-  --guile-load-dir ${top_builddir}/src/core-utils \
-  --guile-load-dir ${top_builddir}/src/gnc-module \
-  --guile-load-dir ${top_builddir}/src/engine \
-  --guile-load-dir ${top_builddir}/src/scm \
-  --guile-load-dir ${top_builddir}/src/app-utils \
-  --library-dir    ${top_builddir}/src/core-utils \
-  --library-dir    ${top_builddir}/src/gnc-module \
-  --library-dir    ${top_builddir}/src/engine \
-  --library-dir    ${top_builddir}/src/backend/xml \
-  --library-dir    ${top_builddir}/src/backend/sql \
-  --library-dir    ${top_builddir}/src/app-utils \
-  --library-dir    ${top_builddir}/src/test-core
-  
-TESTS_ENVIRONMENT = \
-  GNC_BUILDDIR="${abs_top_builddir}" \
-  PYTHON=${PYTHON} \
-  PYTHONPATH=$$PYTHONPATH:$(top_builddir)/src/optional/python-bindings \
-  PYTHONPATH=$$PYTHONPATH:$(top_builddir)/src/optional/python-bindings/.libs \
-  PYTHONPATH=$$PYTHONPATH:$(top_srcdir)/src/optional/python-bindings/tests \
-  PYTHONPATH=$$PYTHONPATH:$(top_builddir)/src/test-core/ \
-  PYTHONPATH=$$PYTHONPATH:$(top_srcdir)/src/test-core/ \
-  PYTHONPATH=$$PYTHONPATH:$(top_builddir)/src/test-core/.libs \
-  $(shell ${abs_top_srcdir}/src/gnc-test-env.pl --noexports ${GNC_TEST_DEPS})
-  
-## We borrow guile's convention and use @-...-@ as the substitution
-## brackets below, instead of the usual @... at .  This prevents autoconf
-## from substituting the values directly into the left-hand sides of
-## the sed substitutions.  *sigh*
-
-runTests.py: runTests.py.in ${top_builddir}/config.status Makefile
-	rm -f $@.tmp
-	sed < $< > $@.tmp \
-	    -e 's#@-PYTHON-@#${PYTHON}#'
-	mv $@.tmp $@
-	chmod u+x $@
-
-CLEANFILES = runTests.py
-
-TESTS = runTests.py
-
-clean-local:
-	rm -f translog.*
-
-EXTRA_DIST = \
-  runTests.py.in \
-  test_account.py \
-  test_book.py \
-  test_split.py \
-  test_transaction.py \
-  test_business.py \
-  CMakeLists.txt
diff --git a/src/plugins/bi_import/CMakeLists.txt b/src/plugins/bi_import/CMakeLists.txt
deleted file mode 100644
index f6b25f3..0000000
--- a/src/plugins/bi_import/CMakeLists.txt
+++ /dev/null
@@ -1,49 +0,0 @@
-
-ADD_SUBDIRECTORY(gtkbuilder)
-ADD_SUBDIRECTORY(ui)
-
-SET(bi_import_SOURCES
-  gnc-plugin-bi-import.c
-  gncmod-bi-import.c
-  dialog-bi-import-gui.c
-  dialog-bi-import-helper.c
-  dialog-bi-import.c
-)
-
-# Add dependency on config.h
-SET_SOURCE_FILES_PROPERTIES (${bi_import_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
-
-SET(bi_import_noinst_HEADERS
-  gnc-plugin-bi-import.h 
-  dialog-bi-import-gui.h 
-  dialog-bi-import-helper.h 
-  dialog-bi-import.h
-)
-
-ADD_LIBRARY(gncmod-bi_import ${bi_import_noinst_HEADERS} ${bi_import_SOURCES})
-
-TARGET_LINK_LIBRARIES(gncmod-bi_import
-  gncmod-gnome-utils
-  gncmod-gnome-search
-  gncmod-app-utils
-  gncmod-engine
-  gnc-core-utils
-  gnc-module
-  gnc-gnome
-)
-
-TARGET_INCLUDE_DIRECTORIES(gncmod-bi_import
-  PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
-  PRIVATE ${CMAKE_SOURCE_DIR}/src/gnome
-)
-
-TARGET_COMPILE_DEFINITIONS(gncmod-bi_import PRIVATE -DG_LOG_DOMAIN=\"gnc.plugin.bi-import\")
-
-INSTALL(TARGETS gncmod-bi_import
-  LIBRARY DESTINATION lib/gnucash
-  ARCHIVE DESTINATION lib/gnucash
-  RUNTIME DESTINATION bin)
-# No headers to install.
-
-SET_LOCAL_DIST(bi_import_DIST_local CMakeLists.txt Makefile.am README ${bi_import_SOURCES} ${bi_import_noinst_HEADERS})
-SET(bi_import_DIST ${bi_import_DIST_local} ${bi_import_ui_DIST} ${bi_import_glade_DIST} PARENT_SCOPE)
diff --git a/src/plugins/bi_import/Makefile.am b/src/plugins/bi_import/Makefile.am
deleted file mode 100644
index b17da1a..0000000
--- a/src/plugins/bi_import/Makefile.am
+++ /dev/null
@@ -1,52 +0,0 @@
-SUBDIRS = ui gtkbuilder .
-
-pkglib_LTLIBRARIES = libgncmod-bi_import.la
-
-libgncmod_bi_import_la_SOURCES = \
-  gnc-plugin-bi-import.c \
-  gncmod-bi-import.c \
-  dialog-bi-import-gui.c \
-  dialog-bi-import-helper.c \
-  dialog-bi-import.c
-
-noinst_HEADERS = \
-  gnc-plugin-bi-import.h \
-  dialog-bi-import-gui.h \
-  dialog-bi-import-helper.h \
-  dialog-bi-import.h
-
-libgncmod_bi_import_la_LDFLAGS = -avoid-version
-
-libgncmod_bi_import_la_LIBADD = \
-  ${top_builddir}/src/gnome/libgnc-gnome.la \
-  ${top_builddir}/src/gnome-utils/libgncmod-gnome-utils.la \
-  ${top_builddir}/src/app-utils/libgncmod-app-utils.la \
-  ${top_builddir}/src/engine/libgncmod-engine.la \
-  ${top_builddir}/src/core-utils/libgnc-core-utils.la \
-  ${top_builddir}/src/gnc-module/libgnc-module.la \
-  ${top_builddir}/lib/libc/libc-missing.la \
-  ${GLIB_LIBS}
-
-AM_CPPFLAGS = \
-  -I${top_srcdir}/src \
-  -I${top_builddir}/src \
-  -I${top_srcdir}/src/gnome \
-  -I${top_srcdir}/src/report/report-gnome \
-  -I${top_srcdir}/src/gnome-search/ \
-  -I${top_srcdir}/src/register/ledger-core \
-  -I${top_srcdir}/src/register/ledger-business \
-  -I${top_srcdir}/src/register/register-gnome \
-  -I${top_srcdir}/src/register/register-core \
-  -I${top_srcdir}/src/business/dialog-tax-table \
-  -I${top_srcdir}/src/gnome-utils \
-  -I${top_srcdir}/src/app-utils \
-  -I${top_srcdir}/src/engine \
-  -I${top_srcdir}/src/core-utils \
-  -I${top_srcdir}/src/gnc-module \
-  -I${top_srcdir}/lib/libc \
-  ${GTK_CFLAGS} \
-  ${GLIB_CFLAGS}
-
-AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.plugin.bi-import\"
-
-EXTRA_DIST = CMakeLists.txt
diff --git a/src/plugins/customer_import/CMakeLists.txt b/src/plugins/customer_import/CMakeLists.txt
deleted file mode 100644
index 36772b1..0000000
--- a/src/plugins/customer_import/CMakeLists.txt
+++ /dev/null
@@ -1,40 +0,0 @@
-ADD_SUBDIRECTORY(gtkbuilder)
-ADD_SUBDIRECTORY(ui)
-
-SET(customer_import_SOURCES
-  gnc-plugin-customer_import.c
-  libgncmod-customer_import.c
-  dialog-customer-import-gui.c
-  dialog-customer-import.c
-)
-
-# Add dependency on config.h
-SET_SOURCE_FILES_PROPERTIES (${customer_import_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
-
-
-SET(customer_import_noinst_HEADERS
-  gnc-plugin-customer_import.h
-  dialog-customer-import-gui.h
-  dialog-customer-import.h
-)
-
-ADD_LIBRARY(gncmod-customer_import ${customer_import_SOURCES} ${customer_input_noinst_HEADERS})
-
-TARGET_LINK_LIBRARIES(gncmod-customer_import gnc-gnome gncmod-gnome-utils gncmod-app-utils
-     gncmod-engine gnc-core-utils gnc-module ${GLIB2_LDFLAGS})
-
-TARGET_INCLUDE_DIRECTORIES(gncmod-bi_import
-  PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
-  PRIVATE ${CMAKE_SOURCE_DIR}/src/gnome
-)
-
-TARGET_COMPILE_DEFINITIONS(gncmod-customer_import PRIVATE -DG_LOG_DOMAIN=\"gnc.plugin.customer_import\")
-
-INSTALL(TARGETS gncmod-customer_import
-  LIBRARY DESTINATION lib/gnucash
-  ARCHIVE DESTINATION lib/gnucash
-  RUNTIME DESTINATION bin)
-# No headers to install.
-
-SET_LOCAL_DIST(customer_import_DIST_local CMakeLists.txt Makefile.am ${customer_import_SOURCES} ${customer_import_noinst_HEADERS})
-SET(customer_import_DIST ${customer_import_DIST_local} ${customer_import_glade_DIST} ${customer_import_ui_DIST} PARENT_SCOPE)
diff --git a/src/plugins/customer_import/Makefile.am b/src/plugins/customer_import/Makefile.am
deleted file mode 100644
index 61311aa..0000000
--- a/src/plugins/customer_import/Makefile.am
+++ /dev/null
@@ -1,49 +0,0 @@
-SUBDIRS = ui gtkbuilder .
-
-pkglib_LTLIBRARIES = libgncmod-customer_import.la
-
-libgncmod_customer_import_la_SOURCES = \
-  gnc-plugin-customer_import.c \
-  libgncmod-customer_import.c \
-  dialog-customer-import-gui.c \
-  dialog-customer-import.c
-
-noinst_HEADERS = \
-  gnc-plugin-customer_import.h \
-  dialog-customer-import-gui.h \
-  dialog-customer-import.h
-
-libgncmod_customer_import_la_LDFLAGS = -avoid-version
-
-libgncmod_customer_import_la_LIBADD = \
-  ${top_builddir}/src/gnome/libgnc-gnome.la \
-  ${top_builddir}/src/gnome-utils/libgncmod-gnome-utils.la \
-  ${top_builddir}/src/app-utils/libgncmod-app-utils.la \
-  ${top_builddir}/src/engine/libgncmod-engine.la \
-  ${top_builddir}/src/core-utils/libgnc-core-utils.la \
-  ${top_builddir}/src/gnc-module/libgnc-module.la \
-  ${top_builddir}/lib/libc/libc-missing.la \
-  ${GLIB_LIBS}
-
-AM_CPPFLAGS = \
-  -I${top_srcdir}/src \
-  -I${top_builddir}/src \
-  -I${top_srcdir}/src/gnome \
-  -I${top_srcdir}/src/report/report-gnome \
-  -I${top_srcdir}/src/gnome-search/ \
-  -I${top_srcdir}/src/register/ledger-core \
-  -I${top_srcdir}/src/register/register-gnome \
-  -I${top_srcdir}/src/register/register-core \
-  -I${top_srcdir}/src/business/dialog-tax-table \
-  -I${top_srcdir}/src/gnome-utils \
-  -I${top_srcdir}/src/app-utils \
-  -I${top_srcdir}/src/engine \
-  -I${top_srcdir}/src/core-utils \
-  -I${top_srcdir}/src/gnc-module \
-  -I${top_srcdir}/lib/libc \
-  ${GTK_CFLAGS} \
-  ${GLIB_CFLAGS}
-
-AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.plugin.customer_import\"
-
-EXTRA_DIST = CMakeLists.txt
diff --git a/src/plugins/example/Makefile.am b/src/plugins/example/Makefile.am
deleted file mode 100644
index 8944dcb..0000000
--- a/src/plugins/example/Makefile.am
+++ /dev/null
@@ -1,37 +0,0 @@
-SUBDIRS = ui glade .
-
-pkglib_LTLIBRARIES = libgncmod-example.la
-
-libgncmod_example_la_SOURCES = \
-  gnc-plugin-example.c \
-  gncmod-example.c
-
-noinst_HEADERS = \
-  gnc-plugin-example.h
-
-libgncmod_example_la_LDFLAGS = -avoid-version
-
-libgncmod_example_la_LIBADD = \
-  ${top_builddir}/src/gnc-module/libgnc-module.la \
-  ${GNOME_LIBS} \
-  ${GLADE_LIBS} \
-  ${GLIB_LIBS} \
-  ${AQBANKING_LIBS}
-
-AM_CFLAGS = \
-  -I${top_srcdir}/src \
-  -I${top_srcdir}/src/gnome \
-  -I${top_srcdir}/src/register/ledger-core \
-  -I${top_srcdir}/src/register/register-gnome \
-  -I${top_srcdir}/src/register/register-core \
-  -I${top_srcdir}/src/gnome-utils \
-  -I${top_srcdir}/src/app-utils \
-  -I${top_srcdir}/src/engine \
-  -I${top_srcdir}/src/core-utils \
-  -I${top_srcdir}/src/gnc-module \
-  ${GNOME_CFLAGS} \
-  ${GLADE_CFLAGS} \
-  ${GLIB_CFLAGS} \
-  ${AQBANKING_CFLAGS}
-
-INCLUDES = -DG_LOG_DOMAIN=\"gnc.plugin.example\"
diff --git a/src/python/Makefile.am b/src/python/Makefile.am
deleted file mode 100644
index 22b0184..0000000
--- a/src/python/Makefile.am
+++ /dev/null
@@ -1,62 +0,0 @@
-SUBDIRS = pycons 
-#test
-
-pkglib_LTLIBRARIES = libgncmod-python.la
-
-libgncmod_python_la_SOURCES = \
-  gncmod-python.c
-
-libgncmod_python_la_LDFLAGS = -avoid-version \
-  ${PYTHON_LDFLAGS}
-
-libgncmod_python_la_LIBADD = \
-  ${top_builddir}/src/gnc-module/libgnc-module.la \
-  ${top_builddir}/src/core-utils/libgnc-core-utils-python.la \
-  ${top_builddir}/src/app-utils/libgncmod-app-utils-python.la \
-  ${PYTHON_LIBS} \
-  ${PYTHON_EXTRA_LIBS} \
-  ${GLIB_LIBS}
-
-AM_CPPFLAGS = \
-  -I${top_srcdir}/src \
-  -I${top_srcdir}/src/core-utils \
-  -I${top_srcdir}/src/gnc-module \
-  ${PYTHON_CPPFLAGS} \
-  ${GLIB_CFLAGS}
-
-
-gncpymoddir = ${GNC_SHAREDIR}/python/
-gncpymod_DATA = \
-   init.py
-
-if GNUCASH_SEPARATE_BUILDDIR
-#For executing test cases
-PY_FILE_LINKS = ${gncpymod_DATA}
-endif
-
-.py-links:
-	$(RM) -rf gnucash
-	mkdir -p  gnucash
-	mkdir -p  gnucash/python
-if GNUCASH_SEPARATE_BUILDDIR
-	for X in ${PY_FILE_LINKS} ; do \
-	  $(LN_S) -f ${srcdir}/$$X . ; \
-	done
-endif
-	( cd gnucash/python; for A in $(gncpymod_DATA) ; do $(LN_S) -f ../../$$A . ; done )
-if ! OS_WIN32
-# Windows knows no "ln -s" but uses "cp": must copy every time (see bug #566567).
-	touch .py-links
-endif
-
-clean-local:
-	$(RM) -rf gnucash
-
-noinst_DATA = .py-links
-
-EXTRA_DIST = ${gncpymod_DATA} CMakeLists.txt
-
-CLEANFILES = .py-links
-DISTCLEANFILES = ${PY_FILE_LINKS}
-
-AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.python\"
diff --git a/src/register/ledger-core/CMakeLists.txt b/src/register/ledger-core/CMakeLists.txt
deleted file mode 100644
index 295e76a..0000000
--- a/src/register/ledger-core/CMakeLists.txt
+++ /dev/null
@@ -1,61 +0,0 @@
-
-ADD_SUBDIRECTORY(test)
-
-SET (ledger_core_SOURCES
-  gnc-ledger-display.c
-  gnc-ledger-display2.c
-  gncmod-ledger-core.c
-  split-register.c
-  split-register-control.c
-  split-register-layout.c
-  split-register-load.c
-  split-register-model.c
-  split-register-model-save.c
-  split-register-util.c
-  gncEntryLedger.c
-  gncEntryLedgerControl.c
-  gncEntryLedgerDisplay.c
-  gncEntryLedgerLayout.c
-  gncEntryLedgerLoad.c
-  gncEntryLedgerModel.c
-)
-
-
-SET (ledger_core_HEADERS
-  gnc-ledger-display.h
-  gnc-ledger-display2.h
-  split-register.h
-  split-register-control.h
-  split-register-layout.h
-  split-register-model.h
-  split-register-model-save.h
-  split-register-p.h
-  gncEntryLedger.h
-  gncEntryLedgerP.h
-  gncEntryLedgerControl.h
-  gncEntryLedgerLayout.h
-  gncEntryLedgerModel.h
-)
-
-# Add dependency on config.h
-SET_SOURCE_FILES_PROPERTIES (${ledger_core_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
-
-ADD_LIBRARY (gncmod-ledger-core ${ledger_core_SOURCES} ${ledger_core_HEADERS})
-
-TARGET_LINK_LIBRARIES(gncmod-ledger-core gncmod-register-gnome gncmod-register-core gncmod-gnome-utils
-        gncmod-engine gnc-core-utils ${GTK3_LDFLAGS})
-
-TARGET_COMPILE_DEFINITIONS (gncmod-ledger-core PRIVATE -DG_LOG_DOMAIN=\"gnc.register.ledger\")
-
-TARGET_INCLUDE_DIRECTORIES(gncmod-ledger-core PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
-
-INSTALL(TARGETS gncmod-ledger-core
-  LIBRARY DESTINATION lib/gnucash
-  ARCHIVE DESTINATION lib/gnucash
-  RUNTIME DESTINATION bin)
-# No headers to install
-
-
-SET_LOCAL_DIST(ledger_core_DIST_local CMakeLists.txt Makefile.am ${ledger_core_SOURCES} ${ledger_core_HEADERS})
-SET(ledger_core_DIST ${ledger_core_DIST_local} ${test_ledger_core_DIST} PARENT_SCOPE)
-
diff --git a/src/register/ledger-core/Makefile.am b/src/register/ledger-core/Makefile.am
deleted file mode 100644
index 739d311..0000000
--- a/src/register/ledger-core/Makefile.am
+++ /dev/null
@@ -1,70 +0,0 @@
-SUBDIRS = . test
-
-pkglib_LTLIBRARIES = libgncmod-ledger-core.la
-
-libgncmod_ledger_core_la_SOURCES = \
-  gnc-ledger-display.c \
-  gnc-ledger-display2.c \
-  gncmod-ledger-core.c \
-  split-register.c \
-  split-register-control.c \
-  split-register-layout.c \
-  split-register-load.c \
-  split-register-model.c \
-  split-register-model-save.c \
-  split-register-util.c \
-  gncEntryLedger.c \
-  gncEntryLedgerControl.c \
-  gncEntryLedgerDisplay.c \
-  gncEntryLedgerLayout.c \
-  gncEntryLedgerLoad.c \
-  gncEntryLedgerModel.c
-
-noinst_HEADERS = \
-  gnc-ledger-display.h \
-  gnc-ledger-display2.h \
-  split-register.h \
-  split-register-control.h \
-  split-register-layout.h \
-  split-register-model.h \
-  split-register-model-save.h \
-  split-register-p.h \
-  gncEntryLedger.h \
-  gncEntryLedgerP.h \
-  gncEntryLedgerControl.h \
-  gncEntryLedgerLayout.h \
-  gncEntryLedgerModel.h
-
-libgncmod_ledger_core_la_LDFLAGS = -avoid-version
-
-libgncmod_ledger_core_la_LIBADD = \
-  ${top_builddir}/src/register/register-gnome/libgncmod-register-gnome.la \
-  ${top_builddir}/src/register/register-core/libgncmod-register-core.la \
-  ${top_builddir}/src/gnome-utils/libgncmod-gnome-utils.la \
-  ${top_builddir}/src/app-utils/libgncmod-app-utils.la \
-  ${top_builddir}/src/engine/libgncmod-engine.la \
-  ${top_builddir}/src/core-utils/libgnc-core-utils.la \
-  ${top_builddir}/src/gnc-module/libgnc-module.la \
-  ${GUILE_LIBS} \
-  ${GTK_LIBS} \
-  ${GLIB_LIBS}
-
-AM_CPPFLAGS = \
-  -I${top_srcdir}/src \
-  -I${top_builddir}/src \
-  -I${top_srcdir}/src/engine \
-  -I${top_srcdir}/src/gnc-module \
-  -I${top_srcdir}/src/core-utils \
-  -I${top_srcdir}/src/app-utils \
-  -I${top_srcdir}/src/gnome-utils \
-  -I${top_srcdir}/src/register/register-core \
-  -I${top_srcdir}/src/register/register-gnome \
-  ${GUILE_CFLAGS} \
-  ${GTK_CFLAGS} \
-  ${GLIB_CFLAGS} \
-  ${GNOME_CFLAGS}
-
-
-AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.register.ledger\"
-
-EXTRA_DIST = CMakeLists.txt
diff --git a/src/register/ledger-core/gncEntryLedger.c b/src/register/ledger-core/gncEntryLedger.c
deleted file mode 100644
index 8257c51..0000000
--- a/src/register/ledger-core/gncEntryLedger.c
+++ /dev/null
@@ -1,1080 +0,0 @@
-/*
- * gncEntryLedger.c -- a Ledger widget for entering GncEntry objects
- * Copyright (C) 2001, 2002, 2003 Derek Atkins
- * Author: Derek Atkins <warlord at MIT.EDU>
- *
- * 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 at gnu.org
- */
-
-#include "config.h"
-
-#include <gtk/gtk.h>
-#include <glib/gi18n.h>
-
-#include "Account.h"
-#include "dialog-account.h"
-#include "dialog-utils.h"
-#include "gnc-ui-util.h"
-#include "combocell.h"
-#include "pricecell.h"
-#include "recncell.h"
-#include "checkboxcell.h"
-
-#include "gnc-component-manager.h"
-#include "gnc-ui.h"
-#include "gnome-utils/gnc-warnings.h"
-
-#include "gncEntry.h"
-#include "gncEntryLedger.h"
-#include "gncEntryLedgerP.h"
-#include "gncEntryLedgerLayout.h"
-#include "gncEntryLedgerModel.h"
-#include "gncEntryLedgerControl.h"
-
-static QofLogModule log_module = "Business Entry Ledger";
-
-/** Static Functions ***************************************************/
-
-static void
-gnc_entry_ledger_clear_blank_entry (GncEntryLedger *ledger)
-{
-    GncEntry *entry;
-
-    if (!ledger) return;
-
-    entry = gnc_entry_ledger_get_blank_entry (ledger);
-    if (entry)
-    {
-        if (!gncEntryIsOpen (entry))
-            gncEntryBeginEdit (entry);
-        gncEntryDestroy (entry);
-    }
-
-    ledger->blank_entry_guid = *guid_null ();
-    ledger->blank_entry_edited = FALSE;
-}
-
-/** Exported Functions ***************************************************/
-
-GncEntry *
-gnc_entry_ledger_get_blank_entry (GncEntryLedger *ledger)
-{
-    if (!ledger) return NULL;
-    return gncEntryLookup (ledger->book, &(ledger->blank_entry_guid));
-}
-
-Account *
-gnc_entry_ledger_get_account_by_name (GncEntryLedger *ledger, BasicCell * bcell,
-                                      const char *name, gboolean *isnew)
-{
-    const char *placeholder = _("The account %s does not allow transactions.");
-    const char *missing = _("The account %s does not exist. "
-                            "Would you like to create it?");
-    char *account_name;
-    ComboCell *cell = (ComboCell *) bcell;
-    Account *account;
-    GList *account_types = NULL;
-
-    /* Find the account */
-    account = gnc_account_lookup_for_register (gnc_get_current_root_account (), name);
-
-    if (!account)
-    {
-        /* Ask if they want to create a new one. */
-        if (!gnc_verify_dialog (ledger->parent, TRUE, missing, name))
-            return NULL;
-
-        /* No changes, as yet. */
-        *isnew = FALSE;
-
-        /* User said yes, they want to create a new account. */
-        account_types = g_list_prepend (account_types, (gpointer)ACCT_TYPE_CREDIT);
-        account_types = g_list_prepend (account_types, (gpointer)ACCT_TYPE_ASSET);
-        account_types = g_list_prepend (account_types, (gpointer)ACCT_TYPE_LIABILITY);
-        if ( ledger->is_cust_doc )
-            account_types = g_list_prepend (account_types, (gpointer)ACCT_TYPE_INCOME);
-        else
-            account_types = g_list_prepend (account_types, (gpointer)ACCT_TYPE_EXPENSE);
-
-        account = gnc_ui_new_accounts_from_name_window_with_types (name, account_types);
-        g_list_free ( account_types );
-        if (!account)
-            return NULL;
-        *isnew = TRUE;
-
-        /* Now have a new account. Update the cell with the name as created. */
-        account_name = gnc_get_account_name_for_register (account);
-        gnc_combo_cell_set_value (cell, account_name);
-        gnc_basic_cell_set_changed (&cell->cell, TRUE);
-        g_free (account_name);
-    }
-
-    /* See if the account (either old or new) is a placeholder. */
-    if (xaccAccountGetPlaceholder (account))
-    {
-        gnc_error_dialog (ledger->parent, placeholder, name);
-    }
-
-    /* Be seeing you. */
-    return account;
-}
-
-Account * gnc_entry_ledger_get_account (GncEntryLedger *ledger,
-                                        const char * cell_name)
-{
-    BasicCell *cell;
-    const char * name;
-    gboolean dummy;
-
-    cell = gnc_table_layout_get_cell (ledger->table->layout, cell_name);
-    if (!cell)
-        return NULL;
-    name = gnc_basic_cell_get_value (cell);
-    return gnc_entry_ledger_get_account_by_name (ledger, cell, name, &dummy);
-}
-
-GncTaxTable * gnc_entry_ledger_get_taxtable (GncEntryLedger *ledger,
-        const char *cell_name)
-{
-    GncEntry *entry;
-    const char * name;
-
-    /* If the cursor has changed, then pull in the current table */
-    if (gnc_table_layout_get_cell_changed (ledger->table->layout,
-                                           cell_name, TRUE))
-    {
-        name = gnc_table_layout_get_cell_value (ledger->table->layout, cell_name);
-        return gncTaxTableLookupByName (ledger->book, name);
-    }
-
-    /* If it has not changed, pull in the table from the entry */
-    entry = gnc_entry_ledger_get_current_entry (ledger);
-    if (ledger->is_cust_doc)
-        return gncEntryGetInvTaxTable (entry);
-    else
-        return gncEntryGetBillTaxTable (entry);
-}
-
-gboolean gnc_entry_ledger_get_checkmark (GncEntryLedger *ledger,
-        const char * cell_name)
-{
-    CheckboxCell *cell =
-        (CheckboxCell *) gnc_table_layout_get_cell (ledger->table->layout, cell_name);
-
-    if (!cell)
-        return FALSE;
-
-    return cell->flag;
-}
-
-gint gnc_entry_ledger_get_type (GncEntryLedger *ledger, const char * cell_name)
-{
-    RecnCell *cell =
-        (RecnCell *) gnc_table_layout_get_cell (ledger->table->layout, cell_name);
-
-    if (!cell)
-        return -1;
-
-    return (gnc_recn_cell_get_flag (cell) - '0');
-}
-
-/* Return TRUE if value is valid, return FALSE if invalid */
-gboolean gnc_entry_ledger_get_numeric (GncEntryLedger *ledger,
-                                       const char *cell_name,
-                                       gnc_numeric *value)
-{
-    PriceCell *cell =
-        (PriceCell *) gnc_table_layout_get_cell (ledger->table->layout, cell_name);
-
-    if (!value || !cell)
-        return FALSE;
-
-    *value = gnc_price_cell_get_value (cell);
-    return TRUE;
-}
-
-
-GncEntry * gnc_entry_ledger_get_entry (GncEntryLedger *ledger,
-                                       VirtualCellLocation vcell_loc)
-{
-    GncGUID *guid;
-
-    if (!ledger) return NULL;
-
-    guid = gnc_table_get_vcell_data (ledger->table, vcell_loc);
-    if (!guid) return NULL;
-
-    return gncEntryLookup (ledger->book, guid);
-}
-
-/* Returns the Entry where the cursor is currently located. */
-GncEntry * gnc_entry_ledger_get_current_entry (GncEntryLedger *ledger)
-{
-    if (!ledger) return NULL;
-
-    return
-        gnc_entry_ledger_get_entry (ledger,
-                                    ledger->table->current_cursor_loc.vcell_loc);
-}
-
-static void gnc_entry_ledger_config_action (GncEntryLedger *ledger)
-{
-    ComboCell *cell;
-
-    cell = (ComboCell *) gnc_table_layout_get_cell (ledger->table->layout,
-            ENTRY_ACTN_CELL);
-    if (!cell) return;
-
-    /* XXX: change this based on the ledger type */
-
-    gnc_combo_cell_add_menu_item (cell, _("Hours"));
-    gnc_combo_cell_add_menu_item (cell, _("Project"));
-    gnc_combo_cell_add_menu_item (cell, _("Material"));
-}
-
-static void
-gnc_entry_ledger_config_cells (GncEntryLedger *ledger)
-{
-    /* the action cell */
-    gnc_combo_cell_set_autosize
-    ((ComboCell *)
-     gnc_table_layout_get_cell (ledger->table->layout, ENTRY_ACTN_CELL), TRUE);
-
-    /* The action cell should also accept strings not in the list */
-    gnc_combo_cell_set_strict
-    ((ComboCell *)
-     gnc_table_layout_get_cell (ledger->table->layout, ENTRY_ACTN_CELL), FALSE);
-
-    /* Use 6 decimal places for all prices and quantities */
-    gnc_price_cell_set_fraction
-    ((PriceCell *)
-     gnc_table_layout_get_cell (ledger->table->layout, ENTRY_PRIC_CELL),
-     1000000);
-
-    gnc_price_cell_set_fraction
-    ((PriceCell *)
-     gnc_table_layout_get_cell (ledger->table->layout, ENTRY_DISC_CELL),
-     1000000);
-
-    gnc_price_cell_set_fraction
-    ((PriceCell *) gnc_table_layout_get_cell (ledger->table->layout,
-            ENTRY_QTY_CELL),
-     1000000);
-
-    /* add menu items for the action and payment cells */
-    gnc_entry_ledger_config_action (ledger);
-}
-
-/* Create and return a new GncEntry Ledger */
-GncEntryLedger * gnc_entry_ledger_new (QofBook *book, GncEntryLedgerType type)
-{
-    GncEntryLedger *ledger;
-
-    if (!book) return NULL;
-    if (type < 0 || type >= GNCENTRY_NUM_REGISTER_TYPES) return NULL;
-
-    ledger = g_new0 (GncEntryLedger, 1);
-    ledger->type = type;
-    ledger->book = book;
-    ledger->traverse_to_new = TRUE;
-    ledger->prefs_group = NULL;
-
-    /* Orders and Invoices are "invoices" for lookups */
-    switch (type)
-    {
-    case GNCENTRY_ORDER_ENTRY:
-    case GNCENTRY_ORDER_VIEWER:
-    case GNCENTRY_INVOICE_ENTRY:
-    case GNCENTRY_INVOICE_VIEWER:
-        ledger->is_cust_doc = TRUE;
-        ledger->is_credit_note = FALSE;
-        break;
-    case GNCENTRY_BILL_ENTRY:
-    case GNCENTRY_BILL_VIEWER:
-    case GNCENTRY_EXPVOUCHER_ENTRY:
-    case GNCENTRY_EXPVOUCHER_VIEWER:
-    case GNCENTRY_NUM_REGISTER_TYPES:
-        ledger->is_cust_doc = FALSE;
-        ledger->is_credit_note = FALSE;
-        break;
-    case GNCENTRY_CUST_CREDIT_NOTE_ENTRY:
-    case GNCENTRY_CUST_CREDIT_NOTE_VIEWER:
-        ledger->is_cust_doc = TRUE;
-        ledger->is_credit_note = TRUE;
-        break;
-    case GNCENTRY_VEND_CREDIT_NOTE_ENTRY:
-    case GNCENTRY_VEND_CREDIT_NOTE_VIEWER:
-    case GNCENTRY_EMPL_CREDIT_NOTE_ENTRY:
-    case GNCENTRY_EMPL_CREDIT_NOTE_VIEWER:
-        ledger->is_cust_doc = FALSE;
-        ledger->is_credit_note = TRUE;
-        break;
-    default:
-	PWARN ("Bad GncEntryLedgerType");
-	g_free (ledger);
-	return NULL;
-	break;
-    }
-
-    ledger->blank_entry_guid = *guid_null();
-    ledger->blank_entry_edited = FALSE;
-
-    {
-        GDate *today = gnc_g_date_new_today();
-        ledger->last_date_entered = *today;
-        g_date_free(today);
-    }
-
-    {
-        TableLayout *layout = gnc_entry_ledger_layout_new (ledger);
-        TableModel *model = gnc_entry_ledger_model_new (type);
-        TableControl *control = gnc_entry_ledger_control_new ();
-        model->handler_user_data = ledger;
-        control->user_data = ledger;
-
-        ledger->table = gnc_table_new (layout, model, control);
-    }
-
-    gnc_entry_ledger_config_cells (ledger);
-
-    /* set up header */
-    {
-        VirtualCellLocation vcell_loc = { 0, 0 };
-        CellBlock *header;
-
-        header = gnc_table_layout_get_cursor (ledger->table->layout, CURSOR_HEADER);
-
-        gnc_table_set_vcell (ledger->table, header, NULL, TRUE, TRUE, vcell_loc);
-    }
-
-    /* set up first initial row */
-    {
-        VirtualLocation vloc;
-        CellBlock *cursor;
-
-        vloc.vcell_loc.virt_row = 1;
-        vloc.vcell_loc.virt_col = 0;
-        vloc.phys_row_offset = 0;
-        vloc.phys_col_offset = 0;
-
-        cursor = gnc_table_layout_get_cursor (ledger->table->layout, "cursor");
-
-        gnc_table_set_vcell (ledger->table, cursor, NULL, TRUE, TRUE, vloc.vcell_loc);
-
-        if (gnc_table_find_close_valid_cell (ledger->table, &vloc, FALSE))
-            gnc_table_move_cursor (ledger->table, vloc);
-        else
-        {
-            g_warning ("Can't find valid initial location");
-        }
-    }
-
-    /* Initialize Display */
-    gnc_entry_ledger_display_init (ledger);
-    if (qof_book_is_readonly(ledger->book))
-    {
-        gnc_entry_ledger_set_readonly(ledger, TRUE);
-    }
-    return ledger;
-}
-
-/* Destroy the GncEntry Ledger */
-void gnc_entry_ledger_destroy (GncEntryLedger *ledger)
-{
-    if (!ledger) return;
-
-    /* Destroy blank entry, etc. */
-    gnc_entry_ledger_clear_blank_entry (ledger);
-    gnc_entry_ledger_display_fini (ledger);
-    gnc_table_destroy (ledger->table);
-    qof_query_destroy (ledger->query);
-    g_free (ledger);
-}
-
-Table * gnc_entry_ledger_get_table (GncEntryLedger *ledger)
-{
-    if (!ledger) return NULL;
-    return ledger->table;
-}
-
-void gnc_entry_ledger_set_default_order (GncEntryLedger *ledger,
-        GncOrder *order)
-{
-    if (!ledger) return;
-    ledger->order = order;
-
-    if (!ledger->query && order)
-    {
-        ledger->query = qof_query_create_for (GNC_ENTRY_MODULE_NAME);
-        qof_query_set_book (ledger->query, gncOrderGetBook (order));
-        qof_query_add_guid_match (ledger->query,
-                                  g_slist_prepend (g_slist_prepend (NULL,
-                                          QOF_PARAM_GUID),
-                                          ENTRY_ORDER),
-                                  gncOrderGetGUID (order), QOF_QUERY_AND);
-    }
-    gnc_entry_ledger_display_refresh (ledger);
-}
-
-static void create_invoice_query (GncEntryLedger *ledger)
-{
-    QofQuery *q, *q1;
-    char * type = NULL;
-
-    if (!ledger->invoice)
-        return;
-
-    if (ledger->query)
-        qof_query_destroy (ledger->query);
-
-    /* Match:   (where I-TYPE == Invoice or Bill)
-     *
-     * 1. book AND
-     * 2.   ( Entry->I-TYPE == ledger->invoice
-     * #if I-TYPE == Invoice/Cust Credit Note (entry only)
-     *        OR
-     * 3.     ( Entry->Invoice == NULL AND
-     *          ( Entry->Billable == TRUE AND
-     *            Entry->Bill->Is-Posted? == TRUE AND
-     *            ( Entry->BillTo == Invoice->parent OR
-     *              ( Entry->BillTo == NULL AND Entry->Bill->BillTo == Invoice->parent ) ) )
-     *           OR
-     *           ( Entry->Order->real-parent == Invoice->parent ) )
-     * #endif
-     *      )
-     *
-     * Note that term 3 is only for Editable invoices.
-     */
-
-    /* Term 1 */
-    ledger->query = qof_query_create_for (GNC_ENTRY_MODULE_NAME);
-    qof_query_set_book (ledger->query, gncInvoiceGetBook (ledger->invoice));
-
-    /* Term 2 */
-    switch (ledger->type)
-    {
-    case GNCENTRY_INVOICE_ENTRY:
-    case GNCENTRY_INVOICE_VIEWER:
-    case GNCENTRY_CUST_CREDIT_NOTE_ENTRY:
-    case GNCENTRY_CUST_CREDIT_NOTE_VIEWER:
-        type = ENTRY_INVOICE;
-        break;
-    case GNCENTRY_BILL_ENTRY:
-    case GNCENTRY_BILL_VIEWER:
-    case GNCENTRY_EXPVOUCHER_ENTRY:
-    case GNCENTRY_EXPVOUCHER_VIEWER:
-    case GNCENTRY_VEND_CREDIT_NOTE_ENTRY:
-    case GNCENTRY_VEND_CREDIT_NOTE_VIEWER:
-    case GNCENTRY_EMPL_CREDIT_NOTE_ENTRY:
-    case GNCENTRY_EMPL_CREDIT_NOTE_VIEWER:
-        type = ENTRY_BILL;
-        break;
-    default:
-        g_warning ("Invalid Ledger type");
-        type = ENTRY_INVOICE;
-        break;
-    }
-
-    q = qof_query_create_for (GNC_ENTRY_MODULE_NAME);
-    qof_query_add_guid_match (q, qof_query_build_param_list (type, QOF_PARAM_GUID, NULL),
-                              gncInvoiceGetGUID (ledger->invoice), QOF_QUERY_OR);
-
-    /* Term 3 */
-    if ((ledger->type == GNCENTRY_INVOICE_ENTRY ||
-            ledger->type == GNCENTRY_CUST_CREDIT_NOTE_ENTRY) &&
-            gncOwnerGetEndGUID (gncInvoiceGetOwner (ledger->invoice)) != NULL)
-    {
-
-        const GncGUID *invoice_parent =
-            gncOwnerGetGUID (gncInvoiceGetOwner (ledger->invoice));
-        QofQuery *q2 = qof_query_create_for (GNC_ENTRY_MODULE_NAME);
-
-        /*
-         * Entry->BillTo == Invoice->parent OR
-         * ( Entry->BillTo == NULL AND Entry->Bill->BillTo == Invoice->parent )
-         */
-
-        qof_query_add_guid_match (q2, qof_query_build_param_list (ENTRY_BILLTO,
-                                  QOF_PARAM_GUID, NULL),
-                                  NULL, QOF_QUERY_AND);
-        qof_query_add_guid_match (q2, qof_query_build_param_list (ENTRY_BILL, INVOICE_BILLTO,
-                                  QOF_PARAM_GUID, NULL),
-                                  invoice_parent, QOF_QUERY_AND);
-        qof_query_add_guid_match (q2, qof_query_build_param_list (ENTRY_BILLTO,
-                                  QOF_PARAM_GUID, NULL),
-                                  invoice_parent, QOF_QUERY_OR);
-
-        /* Entry->Billable == TRUE AND Entry->Bill->Is-Posted? == TRUE */
-        qof_query_add_boolean_match (q2, qof_query_build_param_list (ENTRY_BILLABLE, NULL),
-                                     TRUE, QOF_QUERY_AND);
-        qof_query_add_boolean_match (q2, qof_query_build_param_list (ENTRY_BILL,
-                                     INVOICE_IS_POSTED, NULL),
-                                     TRUE, QOF_QUERY_AND);
-
-        /* Entry->Order->real-parent == Invoice->parent */
-        qof_query_add_guid_match (q2, qof_query_build_param_list (ENTRY_ORDER, ORDER_OWNER,
-                                  OWNER_PARENTG, NULL),
-                                  invoice_parent, QOF_QUERY_OR);
-
-        /* Entry->Invoice == NULL */
-        qof_query_add_guid_match (q2, qof_query_build_param_list (ENTRY_INVOICE,
-                                  QOF_PARAM_GUID, NULL),
-                                  NULL, QOF_QUERY_AND);
-
-
-        /* Combine terms 2 and 3 */
-        q1 = qof_query_merge (q, q2, QOF_QUERY_OR);
-        qof_query_destroy (q);
-        qof_query_destroy (q2);
-        q = q1;
-    }
-
-    /* Combine terms 1 and 2 */
-    q1 = qof_query_merge (ledger->query, q, QOF_QUERY_AND);
-    qof_query_destroy (q);
-    qof_query_destroy (ledger->query);
-    ledger->query = q1;
-}
-
-void gnc_entry_ledger_set_default_invoice (GncEntryLedger *ledger,
-        GncInvoice *invoice)
-{
-    if (!ledger) return;
-    ledger->invoice = invoice;
-
-    /* For bills only, set the default date for new entries
-     * to the bill's opened date. This saves a lot of typing when
-     * adding bills on a day different from the bill's own date.
-     * Note this is for bills only, because for (customer's) invoices
-     * it makes more sense to use the current date.
-     * Consult https://bugzilla.gnome.org/show_bug.cgi?id=646541
-     * to understand why.
-     */
-    if (gncInvoiceGetOwnerType (invoice) == GNC_OWNER_VENDOR)
-        ledger->last_date_entered = timespec_to_gdate(gncInvoiceGetDateOpened (invoice));
-
-    if (!ledger->query && invoice)
-        create_invoice_query (ledger);
-
-    gnc_entry_ledger_display_refresh (ledger);
-}
-
-void gnc_entry_ledger_reset_query (GncEntryLedger *ledger)
-{
-    if (!ledger) return;
-    if (!ledger->invoice) return;
-
-    create_invoice_query (ledger);
-    gnc_entry_ledger_display_refresh (ledger);
-}
-
-void gnc_entry_ledger_set_parent (GncEntryLedger *ledger, GtkWidget *parent)
-{
-    if (!ledger) return;
-    ledger->parent = parent;
-}
-
-gboolean gnc_entry_ledger_find_entry (GncEntryLedger *ledger, GncEntry *entry,
-                                      VirtualCellLocation *vcell_loc)
-{
-    Table *table = ledger->table;
-    int v_row;
-    GncEntry *e;
-
-    for (v_row = 1; v_row < table->num_virt_rows; v_row++)
-    {
-        VirtualCellLocation vc_loc = { v_row, 0 };
-
-        e = gnc_entry_ledger_get_entry (ledger, vc_loc);
-
-        if (e == entry)
-        {
-            if (vcell_loc != NULL)
-                *vcell_loc = vc_loc;
-            return TRUE;
-        }
-    }
-    return FALSE;
-}
-
-void gnc_entry_ledger_set_readonly (GncEntryLedger *ledger, gboolean readonly)
-{
-    if (!ledger) return;
-    if (!readonly && qof_book_is_readonly(ledger->book)) return;
-
-    /* reset the ledger type appropriately */
-    if (readonly)
-    {
-        switch (ledger->type)
-        {
-        case GNCENTRY_ORDER_ENTRY:
-            ledger->type = GNCENTRY_ORDER_VIEWER;
-            break;
-        case GNCENTRY_INVOICE_ENTRY:
-            ledger->type = GNCENTRY_INVOICE_VIEWER;
-            create_invoice_query (ledger);
-            break;
-        case GNCENTRY_BILL_ENTRY:
-            ledger->type = GNCENTRY_BILL_VIEWER;
-            create_invoice_query (ledger);
-            break;
-        case GNCENTRY_EXPVOUCHER_ENTRY:
-            ledger->type = GNCENTRY_EXPVOUCHER_VIEWER;
-            create_invoice_query (ledger);
-            break;
-        case GNCENTRY_CUST_CREDIT_NOTE_ENTRY:
-            ledger->type = GNCENTRY_CUST_CREDIT_NOTE_VIEWER;
-            create_invoice_query (ledger);
-            break;
-        case GNCENTRY_VEND_CREDIT_NOTE_ENTRY:
-            ledger->type = GNCENTRY_VEND_CREDIT_NOTE_VIEWER;
-            create_invoice_query (ledger);
-            break;
-        case GNCENTRY_EMPL_CREDIT_NOTE_ENTRY:
-            ledger->type = GNCENTRY_EMPL_CREDIT_NOTE_VIEWER;
-            create_invoice_query (ledger);
-            break;
-        default:
-            return;        /* Nothing to do */
-        }
-    }
-    else
-    {
-        switch (ledger->type)
-        {
-        case GNCENTRY_ORDER_VIEWER:
-            ledger->type = GNCENTRY_ORDER_ENTRY;
-            break;
-        case GNCENTRY_INVOICE_VIEWER:
-            ledger->type = GNCENTRY_INVOICE_ENTRY;
-            create_invoice_query (ledger);
-            break;
-        case GNCENTRY_BILL_VIEWER:
-            ledger->type = GNCENTRY_BILL_ENTRY;
-            create_invoice_query (ledger);
-            break;
-        case GNCENTRY_EXPVOUCHER_VIEWER:
-            ledger->type = GNCENTRY_EXPVOUCHER_ENTRY;
-            create_invoice_query (ledger);
-            break;
-        case GNCENTRY_CUST_CREDIT_NOTE_VIEWER:
-            ledger->type = GNCENTRY_CUST_CREDIT_NOTE_ENTRY;
-            create_invoice_query (ledger);
-            break;
-        case GNCENTRY_VEND_CREDIT_NOTE_VIEWER:
-            ledger->type = GNCENTRY_VEND_CREDIT_NOTE_ENTRY;
-            create_invoice_query (ledger);
-            break;
-        case GNCENTRY_EMPL_CREDIT_NOTE_VIEWER:
-            ledger->type = GNCENTRY_EMPL_CREDIT_NOTE_ENTRY;
-            create_invoice_query (ledger);
-            break;
-        default:
-            return;        /* Nothing to do */
-        }
-    }
-
-    /* reset the model */
-    gnc_table_model_set_read_only (ledger->table->model, readonly);
-
-    /* if readonly is TRUE, get rid of the blank entry. */
-    if (readonly)
-        gnc_entry_ledger_clear_blank_entry (ledger);
-
-    /* and refresh the display */
-    gnc_entry_ledger_display_refresh (ledger);
-}
-
-gboolean
-gnc_entry_ledger_changed (GncEntryLedger *ledger)
-{
-    if (!ledger)
-        return FALSE;
-
-    if (gnc_table_current_cursor_changed (ledger->table, FALSE))
-        return TRUE;
-
-    return FALSE;
-}
-
-void
-gnc_entry_ledger_compute_value (GncEntryLedger *ledger,
-                                gnc_numeric *value, gnc_numeric *tax_value)
-{
-    gnc_numeric qty, price, discount;
-    gint disc_type, disc_how;
-    gboolean taxable, taxincluded;
-    GncTaxTable *table;
-    GList *taxes = NULL;
-    int denom = 100;
-
-    gnc_entry_ledger_get_numeric (ledger, ENTRY_QTY_CELL, &qty);
-    gnc_entry_ledger_get_numeric (ledger, ENTRY_PRIC_CELL, &price);
-    gnc_entry_ledger_get_numeric (ledger, ENTRY_DISC_CELL, &discount);
-
-    disc_type = gnc_entry_ledger_get_type (ledger, ENTRY_DISTYPE_CELL);
-    disc_how = gnc_entry_ledger_get_type (ledger, ENTRY_DISHOW_CELL);
-
-    /* Bills and exp-vouchers dont have discounts */
-    if (ledger->type == GNCENTRY_BILL_ENTRY ||
-            ledger->type == GNCENTRY_BILL_VIEWER ||
-            ledger->type == GNCENTRY_EXPVOUCHER_ENTRY ||
-            ledger->type == GNCENTRY_EXPVOUCHER_VIEWER)
-    {
-        g_assert (gnc_numeric_zero_p (discount));
-        disc_type = GNC_AMT_TYPE_VALUE;
-        disc_how = GNC_DISC_PRETAX;
-    }
-
-
-    /* If we're so early in the process that we don't have info, stop now */
-    if (disc_type < 0 || disc_how < 0)
-    {
-        if (value)
-            *value = gnc_numeric_zero ();
-        if (tax_value)
-            *tax_value = gnc_numeric_zero ();
-        return;
-    }
-
-    taxable = gnc_entry_ledger_get_checkmark (ledger, ENTRY_TAXABLE_CELL);
-    taxincluded = gnc_entry_ledger_get_checkmark (ledger, ENTRY_TAXINCLUDED_CELL);
-    table = gnc_entry_ledger_get_taxtable (ledger, ENTRY_TAXTABLE_CELL);
-
-    /* Expense vouchers don't have taxable, taxincluded, or taxtable cells, either */
-    if (ledger->type == GNCENTRY_EXPVOUCHER_ENTRY ||
-            ledger->type == GNCENTRY_EXPVOUCHER_VIEWER)
-    {
-        taxable = FALSE;
-        taxincluded = FALSE;
-        table = NULL;
-    }
-
-    if (ledger->invoice)
-    {
-        gnc_commodity *currency = gncInvoiceGetCurrency(ledger->invoice);
-        if (currency)
-            denom = gnc_commodity_get_fraction(currency);
-    }
-
-    gncEntryComputeValue (qty, price, (taxable ? table : NULL), taxincluded,
-                          discount, disc_type, disc_how, denom,
-                          value, NULL, &taxes);
-
-    /* return the tax value */
-    if (tax_value)
-        *tax_value = gncAccountValueTotal (taxes);
-}
-
-gboolean
-gnc_entry_ledger_get_entry_virt_loc (GncEntryLedger *ledger, const GncEntry *entry,
-                                     VirtualCellLocation *vcell_loc)
-{
-    Table *table;
-    int v_row;
-    int v_col;
-
-    if ((ledger == NULL) || (entry == NULL))
-        return FALSE;
-    g_assert(vcell_loc);
-
-    table = ledger->table;
-
-    /* go backwards because typically you search for entries at the end */
-
-    for (v_row = table->num_virt_rows - 1; v_row > 0; v_row--)
-        for (v_col = 0; v_col < table->num_virt_cols; v_col++)
-        {
-            VirtualCellLocation vc_loc = { v_row, v_col };
-            VirtualCell *vcell;
-            GncEntry *e;
-
-            vcell = gnc_table_get_virtual_cell (table, vc_loc);
-            if (vcell == NULL)
-                continue;
-
-            if (!vcell->visible)
-                continue;
-
-            e = gncEntryLookup (ledger->book, vcell->vcell_data);
-
-            if (e == entry)
-            {
-                if (vcell_loc)
-                    *vcell_loc = vc_loc;
-
-                return TRUE;
-            }
-        }
-
-    return FALSE;
-}
-
-void
-gnc_entry_ledger_delete_current_entry (GncEntryLedger *ledger)
-{
-    GncEntry *entry;
-
-    if (!ledger)
-        return;
-
-    /* If there is no entry, just return */
-    entry = gnc_entry_ledger_get_current_entry (ledger);
-    if (!entry)
-        return;
-
-    /* If this is the blank entry, just cancel the changes */
-    if (entry == gnc_entry_ledger_get_blank_entry (ledger))
-    {
-        gnc_entry_ledger_cancel_cursor_changes (ledger);
-        return;
-    }
-
-    /* Ok, let's delete this entry */
-    gnc_suspend_gui_refresh ();
-    if (!gncEntryIsOpen (entry))
-        gncEntryBeginEdit (entry);
-
-    {
-        GncOrder *order;
-        GncInvoice *invoice;
-
-        order = gncEntryGetOrder (entry);
-        if (order)
-            gncOrderRemoveEntry (order, entry);
-
-        invoice = gncEntryGetInvoice (entry);
-        if (invoice)
-            gncInvoiceRemoveEntry (invoice, entry);
-
-        invoice = gncEntryGetBill (entry);
-        if (invoice)
-            gncBillRemoveEntry (invoice, entry);
-
-        gncEntryDestroy (entry);
-    }
-    gnc_resume_gui_refresh ();
-}
-
-void
-gnc_entry_ledger_duplicate_current_entry (GncEntryLedger *ledger)
-{
-    GncEntry *entry;
-    gboolean changed;
-
-    if (!ledger)
-        return;
-
-    /* Be paranoid */
-    entry = gnc_entry_ledger_get_current_entry (ledger);
-    if (!entry)
-        return;
-
-    changed = gnc_table_current_cursor_changed (ledger->table, FALSE);
-
-    /* See if we're asked to duplicate an unchanged blank entry --
-     * there is no point in doing that.
-     */
-    if (!changed && entry == gnc_entry_ledger_get_blank_entry (ledger))
-        return;
-
-    gnc_suspend_gui_refresh ();
-
-    /* If the cursor has been edited, we are going to have to commit
-     * it before we can duplicate. Make sure the user wants to do that. */
-    if (changed)
-    {
-        const char *title = _("Save the current entry?");
-        const char *message =
-            _("The current transaction has been changed. Would you like to "
-              "record the changes before duplicating this entry, or "
-              "cancel the duplication?");
-        GtkWidget *dialog;
-        gint response;
-
-        dialog = gtk_message_dialog_new(GTK_WINDOW(ledger->parent),
-                                        GTK_DIALOG_DESTROY_WITH_PARENT,
-                                        GTK_MESSAGE_QUESTION,
-                                        GTK_BUTTONS_NONE,
-                                        "%s", title);
-        gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
-                "%s", message);
-        gtk_dialog_add_buttons(GTK_DIALOG(dialog),
-                               _("_Cancel"), GTK_RESPONSE_CANCEL,
-                               _("_Record"), GTK_RESPONSE_ACCEPT,
-                               NULL);
-        response = gnc_dialog_run(GTK_DIALOG(dialog), GNC_PREF_WARN_INV_ENTRY_DUP);
-        gtk_widget_destroy(dialog);
-
-        if (response != GTK_RESPONSE_ACCEPT)
-        {
-            gnc_resume_gui_refresh ();
-            return;
-        }
-
-        if (!gnc_entry_ledger_commit_entry (ledger))
-        {
-            gnc_resume_gui_refresh ();
-            return;
-        }
-    }
-
-    /* Ok, we're ready to make the copy */
-    {
-        GncEntry * new_entry;
-
-        new_entry = gncEntryCreate (ledger->book);
-        gncEntryCopy (entry, new_entry, TRUE);
-        gncEntrySetDateGDate (new_entry, &ledger->last_date_entered);
-
-        /* We also must set a new DateEntered on the new entry
-         * because otherwise the ordering is not deterministic */
-        gncEntrySetDateEntered (new_entry, timespec_now());
-
-        /* Set the hint for where to display on the refresh */
-        ledger->hint_entry = new_entry;
-    }
-
-    gnc_resume_gui_refresh ();
-    return;
-}
-
-QofQuery *
-gnc_entry_ledger_get_query (GncEntryLedger *ledger)
-{
-    if (!ledger)
-        return NULL;
-
-    return ledger->query;
-}
-
-void
-gnc_entry_ledger_set_prefs_group (GncEntryLedger *ledger, const gchar *string)
-{
-    if (!ledger)
-        return;
-
-    ledger->prefs_group = string;
-}
-
-void gnc_entry_ledger_move_current_entry_updown (GncEntryLedger *ledger,
-        gboolean move_up)
-{
-    GncEntry *blank, *current, *target;
-    VirtualCellLocation vcell_loc;
-
-    g_assert(ledger);
-
-    blank = gnc_entry_ledger_get_blank_entry(ledger);
-    if (!blank)
-        return;
-
-    /* Ensure we have a valid current GncEntry and it isn't the blank
-     * entry */
-    current = gnc_entry_ledger_get_current_entry(ledger);
-    if (!current || current == blank)
-        return;
-
-    /* Obtain the GncEntry at the up or down virtual table location */
-    vcell_loc = ledger->table->current_cursor_loc.vcell_loc;
-    if (move_up)
-    {
-        if (vcell_loc.virt_row == 0)
-            return;
-        vcell_loc.virt_row--;
-    }
-    else
-    {
-        vcell_loc.virt_row++;
-    }
-
-    /* Ensure we have a valid other GncEntry and it isn't the blank
-     * entry */
-    target = gnc_entry_ledger_get_entry(ledger, vcell_loc);
-    if (!target || target == blank)
-        return;
-
-    /* Also, only continue if both have the same date, because the
-     * "standard ordering" is tied to the date anyway. Note: This
-     * unfortunately prevents the user from changing the ordering if
-     * he has chosen a different sort order and the sort key happens
-     * to be equal among the two entries. But I don't know how to look
-     * up the current sort ordering from here, so I cowardly refuse to
-     * tweak the EntryDate in this case. */
-    {
-        Timespec t1, t2;
-        GDate d1 = gncEntryGetDateGDate(current),
-              d2 = gncEntryGetDateGDate(target);
-        if (g_date_compare(&d1, &d2) != 0)
-            return;
-
-        /* Special treatment if the equality doesn't hold if we access the
-        dates as timespec. See the comment in gncEntrySetDateGDate() for the
-        reason: Some code used the timespec at noon for the EntryDate, other
-        code used the timespec at the start of day. */
-        t1 = gncEntryGetDate(current);
-        t2 = gncEntryGetDate(target);
-        if (!timespec_equal(&t1, &t2))
-        {
-            /* Timespecs are not equal, even though the GDates were equal? Then
-            we set the GDates again. This will force the timespecs to be equal
-            as well. */
-            gncEntrySetDateGDate(current, &d1);
-            gncEntrySetDateGDate(target, &d2);
-        }
-    }
-
-    /*g_warning("Ok, current desc='%s' target desc='%s'",
-              gncEntryGetDescription(current),
-              gncEntryGetDescription(target));*/
-
-    gnc_suspend_gui_refresh ();
-
-    /* Swap the date-entered of both entries. That's already
-     * sufficient! */
-    {
-        Timespec time_current = gncEntryGetDateEntered(current);
-        Timespec time_target = gncEntryGetDateEntered(target);
-
-        /* Special treatment for identical times (potentially caused
-         * by the "duplicate entry" command) */
-        if (timespec_equal(&time_current, &time_target))
-        {
-            /*g_warning("Surprise - both DateEntered are equal.");*/
-            /* We just increment the DateEntered of the previously
-             * lower of the two by one second. This might still cause
-             * issues if multiple entries had this problem, but
-             * whatever. */
-            if (move_up)
-                time_current.tv_sec++;
-            else
-                time_target.tv_sec++;
-        }
-
-        /* Write the new DateEntered. */
-        gncEntrySetDateEntered(current, time_target);
-        gncEntrySetDateEntered(target, time_current);
-
-        /* And finally let the GncInvoice sort its entries
-         * accordingly, so that the invoice reports will give the same
-         * ordering as the register window. */
-        gncInvoiceSortEntries(ledger->invoice);
-    }
-
-    gnc_resume_gui_refresh ();
-}
diff --git a/src/register/ledger-core/gncEntryLedgerControl.c b/src/register/ledger-core/gncEntryLedgerControl.c
deleted file mode 100644
index ec0e84c..0000000
--- a/src/register/ledger-core/gncEntryLedgerControl.c
+++ /dev/null
@@ -1,1049 +0,0 @@
-/** \file gncEntryLedgerControl.c
- * \brief Control for GncEntry ledger
- *
- * Copyright (C) 2001, 2002, 2003 Derek Atkins
- * Author: Derek Atkins <warlord at MIT.EDU>
- * Copyright (C) 2010 Christian Stimming <christian at cstimming.de> */
-/*
- * 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 at gnu.org
- */
-
-#include "config.h"
-
-#include <glib.h>
-#include <glib/gi18n.h>
-
-#include "Account.h"
-#include "combocell.h"
-#include "dialog-account.h"
-#include "dialog-utils.h"
-#include "gnc-component-manager.h"
-#include "gnc-prefs.h"
-#include "gnc-ui.h"
-#include "gnc-ui-util.h"
-#include "gnc-gui-query.h"
-#include "gnome-utils/gnc-warnings.h"
-#include "table-allgui.h"
-#include "pricecell.h"
-#include "dialog-tax-table.h"
-#include "register/register-core/checkboxcell.h"
-
-#include "gncEntryLedgerP.h"
-#include "gncEntryLedgerControl.h"
-
-
-static gboolean
-gnc_entry_ledger_save (GncEntryLedger *ledger, gboolean do_commit)
-{
-    GncEntry *blank_entry;
-    GncEntry *entry;
-
-    if (!ledger) return FALSE;
-
-    blank_entry = gnc_entry_ledger_get_blank_entry (ledger);
-
-    entry = gnc_entry_ledger_get_current_entry (ledger);
-    if (entry == NULL) return FALSE;
-
-    /* Try to avoid heavy-weight updates if nothing has changed */
-    if (!gnc_table_current_cursor_changed (ledger->table, FALSE))
-    {
-        if (!do_commit) return FALSE;
-
-        if (entry == blank_entry)
-        {
-            if (ledger->blank_entry_edited)
-            {
-                ledger->last_date_entered = gncEntryGetDateGDate (entry);
-                ledger->blank_entry_guid = *guid_null ();
-                ledger->blank_entry_edited = FALSE;
-                blank_entry = NULL;
-            }
-            else
-                return FALSE;
-        }
-
-        return TRUE;
-    }
-
-    gnc_suspend_gui_refresh ();
-
-    if (!gncEntryIsOpen (entry))
-        gncEntryBeginEdit (entry);
-
-    gnc_table_save_cells (ledger->table, entry);
-
-    if (entry == blank_entry)
-    {
-        Timespec ts;
-        ts.tv_sec = gnc_time (NULL);
-        ts.tv_nsec = 0;
-        gncEntrySetDateEntered (blank_entry, ts);
-
-        switch (ledger->type)
-        {
-        case GNCENTRY_ORDER_ENTRY:
-            gncOrderAddEntry (ledger->order, blank_entry);
-            break;
-        case GNCENTRY_INVOICE_ENTRY:
-        case GNCENTRY_CUST_CREDIT_NOTE_ENTRY:
-            /* Anything entered on an invoice entry must be part of the invoice! */
-            gncInvoiceAddEntry (ledger->invoice, blank_entry);
-            break;
-        case GNCENTRY_BILL_ENTRY:
-        case GNCENTRY_EXPVOUCHER_ENTRY:
-        case GNCENTRY_VEND_CREDIT_NOTE_ENTRY:
-        case GNCENTRY_EMPL_CREDIT_NOTE_ENTRY:
-            /* Anything entered on an invoice entry must be part of the invoice! */
-            gncBillAddEntry (ledger->invoice, blank_entry);
-            break;
-        default:
-            /* Nothing to do for viewers */
-            g_warning ("blank entry traversed in a viewer");
-            break;
-        }
-    }
-
-    if (entry == blank_entry)
-    {
-        if (do_commit)
-        {
-            ledger->blank_entry_guid = *guid_null ();
-            blank_entry = NULL;
-            ledger->last_date_entered = gncEntryGetDateGDate (entry);
-        }
-        else
-            ledger->blank_entry_edited = TRUE;
-    }
-
-    if (do_commit)
-        gncEntryCommitEdit (entry);
-
-    gnc_table_clear_current_cursor_changes (ledger->table);
-
-    gnc_resume_gui_refresh ();
-
-    return TRUE;
-}
-
-static gboolean
-gnc_entry_ledger_verify_acc_cell_ok (GncEntryLedger *ledger,
-                                     const char *cell_name,
-                                     const char *cell_msg)
-{
-    ComboCell *cell;
-    const char *name;
-
-    cell = (ComboCell *) gnc_table_layout_get_cell (ledger->table->layout,
-            cell_name);
-    g_return_val_if_fail (cell, TRUE);
-    name = cell->cell.value;
-    if (!name || *name == '\0')
-    {
-        const char *format = ("%s %s");
-        const char *gen_msg = _("Invalid Entry: You need to supply an account in the right currency for this position.");
-
-        gnc_error_dialog (ledger->parent, format, gen_msg, cell_msg);
-        return FALSE;
-    }
-    return TRUE;
-}
-
-/** Verify whether we can save the entry, or warn the user when we can't
- * return TRUE if we can save, FALSE if there is a problem
- */
-static gboolean
-gnc_entry_ledger_verify_can_save (GncEntryLedger *ledger)
-{
-    gnc_numeric value;
-
-    /* Compute the value and tax value of the current cursor */
-    gnc_entry_ledger_compute_value (ledger, &value, NULL);
-
-    /* If there is a value, make sure there is an account */
-    if (! gnc_numeric_zero_p (value))
-    {
-        switch (ledger->type)
-        {
-        case GNCENTRY_INVOICE_ENTRY:
-        case GNCENTRY_CUST_CREDIT_NOTE_ENTRY:
-            if (!gnc_entry_ledger_verify_acc_cell_ok (ledger, ENTRY_IACCT_CELL,
-                    _("This account should usually be of type income.")))
-                return FALSE;
-            break;
-        case GNCENTRY_BILL_ENTRY:
-        case GNCENTRY_EXPVOUCHER_ENTRY:
-        case GNCENTRY_VEND_CREDIT_NOTE_ENTRY:
-        case GNCENTRY_EMPL_CREDIT_NOTE_ENTRY:
-            if (!gnc_entry_ledger_verify_acc_cell_ok (ledger, ENTRY_BACCT_CELL,
-                    _("This account should usually be of type expense or asset.")))
-                return FALSE;
-            break;
-        default:
-            g_warning ("Unhandled ledger type");
-            break;
-        }
-    }
-
-    return TRUE;
-}
-
-static void gnc_entry_ledger_move_cursor (VirtualLocation *p_new_virt_loc,
-        gpointer user_data)
-{
-    GncEntryLedger *ledger = user_data;
-    VirtualLocation new_virt_loc = *p_new_virt_loc;
-    GncEntry *new_entry;
-    GncEntry *old_entry;
-    gboolean saved;
-
-    if (!ledger) return;
-
-    old_entry = gnc_entry_ledger_get_current_entry (ledger);
-    new_entry = gnc_entry_ledger_get_entry (ledger, new_virt_loc.vcell_loc);
-
-    gnc_suspend_gui_refresh ();
-    saved = gnc_entry_ledger_save (ledger, old_entry != new_entry);
-    gnc_resume_gui_refresh ();
-
-    /* redrawing can muck everything up */
-    if (saved)
-    {
-        VirtualCellLocation vcell_loc;
-
-        /* redraw */
-        gnc_entry_ledger_display_refresh (ledger);
-
-        if (ledger->traverse_to_new)
-            new_entry = gnc_entry_ledger_get_blank_entry (ledger);
-
-        /* if the entry we were going to is still in the register,
-         * then it may have moved. Find out where it is now. */
-        if (gnc_entry_ledger_find_entry (ledger, new_entry, &vcell_loc))
-        {
-            gnc_table_get_virtual_cell (ledger->table, vcell_loc);
-            new_virt_loc.vcell_loc = vcell_loc;
-        }
-        else
-            new_virt_loc.vcell_loc = ledger->table->current_cursor_loc.vcell_loc;
-    }
-
-    gnc_table_find_close_valid_cell (ledger->table, &new_virt_loc, FALSE);
-
-    *p_new_virt_loc = new_virt_loc;
-}
-
-/** Creates a new query that searches for an GncEntry item with
- * description string equal to the given "desc" argument. The query
- * will find the single GncEntry with the latest (=newest)
- * DATE_ENTERED. */
-static QofQuery *new_query_for_entry_desc(GncEntryLedger *reg, const char* desc, gboolean use_invoice)
-{
-    QofQuery *query = NULL;
-    QofQueryPredData *predData = NULL;
-    GSList *param_list = NULL;
-    GSList *primary_sort_params = NULL;
-    const char* should_be_null = (use_invoice ? ENTRY_BILL : ENTRY_INVOICE);
-
-    g_assert(reg);
-    g_assert(desc);
-
-    /* The query itself and its book */
-    query = qof_query_create_for (GNC_ID_ENTRY);
-    qof_query_set_book (query, reg->book);
-
-    /* Predicate data: We want to compare one string, namely the given
-     * argument */
-    predData =
-        qof_query_string_predicate (QOF_COMPARE_EQUAL, desc,
-                                    QOF_STRING_MATCH_CASEINSENSITIVE, FALSE);
-
-    /* Search Parameter: We want to query on the ENTRY_DESC column */
-    param_list = qof_query_build_param_list (ENTRY_DESC, NULL);
-
-    /* Register this in the query */
-    qof_query_add_term (query, param_list, predData, QOF_QUERY_FIRST_TERM);
-
-    /* For invoice entries, Entry->Bill must be NULL, and vice versa */
-    qof_query_add_guid_match (query,
-                              qof_query_build_param_list (should_be_null,
-                                      QOF_PARAM_GUID, NULL),
-                              NULL, QOF_QUERY_AND);
-
-    /* Set the sort order: By DATE_ENTERED, increasing, and returning
-     * only one single resulting item. */
-    primary_sort_params = qof_query_build_param_list(ENTRY_DATE_ENTERED, NULL);
-    qof_query_set_sort_order (query, primary_sort_params, NULL, NULL);
-    qof_query_set_sort_increasing (query, TRUE, TRUE, TRUE);
-
-    qof_query_set_max_results(query, 1);
-
-    return query;
-}
-
-/** Finds the GncEntry with the matching description string as given
- * in "desc", but searches this in the whole book. */
-static GncEntry*
-find_entry_in_book_by_desc(GncEntryLedger *reg, const char* desc)
-{
-    GncEntry *result = NULL;
-    gboolean use_invoice;
-    QofQuery *query;
-    GList *entries = NULL;
-
-    switch (reg->type)
-    {
-    case GNCENTRY_INVOICE_ENTRY:
-    case GNCENTRY_INVOICE_VIEWER:
-    case GNCENTRY_CUST_CREDIT_NOTE_ENTRY:
-    case GNCENTRY_CUST_CREDIT_NOTE_VIEWER:
-        use_invoice = TRUE;
-        break;
-    default:
-        use_invoice = FALSE;
-        break;
-    };
-
-    query = new_query_for_entry_desc(reg, desc, use_invoice);
-    entries = qof_query_run(query);
-
-    /* Do we have a non-empty result? */
-    if (entries)
-    {
-        /* That's the result. */
-        result = (GncEntry*) entries->data;
-        /*g_warning("Found %d GncEntry items", g_list_length (entries));*/
-    }
-
-    qof_query_destroy(query);
-    return result;
-}
-
-#if 0
-/** Finds the GncEntry with the matching description string as given
- * in "desc", but searches this only in the given entry ledger
- * (i.e. the currently opened ledger window). */
-static GncEntry*
-gnc_find_entry_in_reg_by_desc(GncEntryLedger *reg, const char* desc)
-{
-    int virt_row, virt_col;
-    int num_rows, num_cols;
-    GncEntry *last_entry;
-
-    g_assert(reg);
-    g_assert(reg->table);
-    if (!reg || !reg->table)
-        return NULL;
-
-    num_rows = reg->table->num_virt_rows;
-    num_cols = reg->table->num_virt_cols;
-
-    last_entry = NULL;
-
-    for (virt_row = num_rows - 1; virt_row >= 0; virt_row--)
-        for (virt_col = num_cols - 1; virt_col >= 0; virt_col--)
-        {
-            GncEntry *entry;
-            VirtualCellLocation vcell_loc = { virt_row, virt_col };
-
-            entry = gnc_entry_ledger_get_entry(reg, vcell_loc);
-
-            if (entry == last_entry)
-                continue;
-
-            if (g_strcmp0 (desc, gncEntryGetDescription (entry)) == 0)
-                return entry;
-
-            last_entry = entry;
-        }
-
-    return NULL;
-}
-#endif
-
-static void set_value_combo_cell(BasicCell *cell, const char *new_value)
-{
-    if (!cell || !new_value)
-        return;
-    if (g_strcmp0 (new_value, gnc_basic_cell_get_value (cell)) == 0)
-        return;
-
-    gnc_combo_cell_set_value ((ComboCell *) cell, new_value);
-    gnc_basic_cell_set_changed (cell, TRUE);
-}
-
-static void set_value_price_cell(BasicCell *cell, gnc_numeric new_value)
-{
-    PriceCell *pcell = (PriceCell*) cell;
-    if (!cell)
-        return;
-    if (gnc_numeric_equal (new_value, gnc_price_cell_get_value(pcell)))
-        return;
-
-    gnc_price_cell_set_value (pcell, new_value);
-    gnc_basic_cell_set_changed (cell, TRUE);
-}
-
-static gboolean
-gnc_entry_ledger_auto_completion (GncEntryLedger *ledger,
-                                  gncTableTraversalDir dir,
-                                  VirtualLocation *p_new_virt_loc)
-{
-    GncEntry *entry;
-    GncEntry *blank_entry;
-    GncEntry *auto_entry;
-    const char* cell_name;
-    const char *desc;
-    BasicCell *cell = NULL;
-    char *account_name = NULL;
-
-    g_assert(ledger);
-    g_assert(ledger->table);
-    blank_entry = gnc_entry_ledger_get_blank_entry (ledger);
-
-    /* auto-completion is only triggered by a tab out */
-    if (dir != GNC_TABLE_TRAVERSE_RIGHT)
-        return FALSE;
-
-    entry = gnc_entry_ledger_get_current_entry (ledger);
-    if (entry == NULL)
-        return FALSE;
-
-    cell_name = gnc_table_get_current_cell_name (ledger->table);
-
-    /* Auto-completion is done only in an entry ledger */
-    switch (ledger->type)
-    {
-    case GNCENTRY_ORDER_ENTRY:
-    case GNCENTRY_INVOICE_ENTRY:
-    case GNCENTRY_BILL_ENTRY:
-    case GNCENTRY_EXPVOUCHER_ENTRY:
-    case GNCENTRY_CUST_CREDIT_NOTE_ENTRY:
-    case GNCENTRY_VEND_CREDIT_NOTE_ENTRY:
-    case GNCENTRY_EMPL_CREDIT_NOTE_ENTRY:
-        break;
-    default:
-        return FALSE;
-    }
-
-    /* Further conditions before we actually do auto-completion: */
-    /* There must be a blank entry */
-    if (blank_entry == NULL)
-        return FALSE;
-
-    /* we must be on the blank entry */
-    if (entry != blank_entry)
-        return FALSE;
-
-    /* and leaving the description cell */
-    if (!gnc_cell_name_equal (cell_name, ENTRY_DESC_CELL))
-        return FALSE;
-
-    /* nothing but the date and description should be changed */
-    /* FIXME, this should be refactored. */
-    if (gnc_table_layout_get_cell_changed (ledger->table->layout,
-                                           ENTRY_ACTN_CELL, TRUE)
-            || gnc_table_layout_get_cell_changed (ledger->table->layout,
-                    ENTRY_QTY_CELL, TRUE)
-            || gnc_table_layout_get_cell_changed (ledger->table->layout,
-                    ENTRY_PRIC_CELL, TRUE)
-            || gnc_table_layout_get_cell_changed (ledger->table->layout,
-                    ENTRY_DISC_CELL, TRUE)
-            || gnc_table_layout_get_cell_changed (ledger->table->layout,
-                    ENTRY_DISTYPE_CELL, TRUE)
-            || gnc_table_layout_get_cell_changed (ledger->table->layout,
-                    ENTRY_DISHOW_CELL, TRUE)
-            || gnc_table_layout_get_cell_changed (ledger->table->layout,
-                    ENTRY_IACCT_CELL, TRUE)
-            || gnc_table_layout_get_cell_changed (ledger->table->layout,
-                    ENTRY_BACCT_CELL, TRUE)
-            || gnc_table_layout_get_cell_changed (ledger->table->layout,
-                    ENTRY_TAXABLE_CELL, TRUE)
-            || gnc_table_layout_get_cell_changed (ledger->table->layout,
-                    ENTRY_TAXINCLUDED_CELL, TRUE)
-            || gnc_table_layout_get_cell_changed (ledger->table->layout,
-                    ENTRY_TAXTABLE_CELL, TRUE)
-            || gnc_table_layout_get_cell_changed (ledger->table->layout,
-                    ENTRY_VALUE_CELL, TRUE)
-            || gnc_table_layout_get_cell_changed (ledger->table->layout,
-                    ENTRY_TAXVAL_CELL, TRUE)
-            || gnc_table_layout_get_cell_changed (ledger->table->layout,
-                    ENTRY_BILLABLE_CELL, TRUE)
-            || gnc_table_layout_get_cell_changed (ledger->table->layout,
-                    ENTRY_PAYMENT_CELL, TRUE))
-        return FALSE;
-
-    /* and the description should indeed be changed */
-    if (!gnc_table_layout_get_cell_changed (ledger->table->layout,
-                                            ENTRY_DESC_CELL, TRUE))
-        return FALSE;
-
-    /* to a non-empty value */
-    desc = gnc_table_layout_get_cell_value (ledger->table->layout, ENTRY_DESC_CELL);
-    if ((desc == NULL) || (*desc == '\0'))
-        return FALSE;
-
-    /* Ok, we are sure we want to trigger auto-completion. Now find an
-     * entry to copy the values from. */
-    auto_entry =
-        /* Use this for book-wide auto-completion of the invoice entries */
-        find_entry_in_book_by_desc(ledger, desc);
-
-    if (auto_entry == NULL)
-        return FALSE;
-
-    /* now perform the completion */
-    gnc_suspend_gui_refresh ();
-
-    /* Auto-complete the action field */
-    cell = gnc_table_layout_get_cell (ledger->table->layout, ENTRY_ACTN_CELL);
-    set_value_combo_cell (cell, gncEntryGetAction (auto_entry));
-
-    /* Auto-complete the account field */
-    switch (ledger->type)
-    {
-    case GNCENTRY_INVOICE_ENTRY:
-    case GNCENTRY_CUST_CREDIT_NOTE_ENTRY:
-        cell = gnc_table_layout_get_cell (ledger->table->layout, ENTRY_IACCT_CELL);
-        account_name = gnc_get_account_name_for_register (gncEntryGetInvAccount(auto_entry));
-        break;
-    case GNCENTRY_EXPVOUCHER_ENTRY:
-    case GNCENTRY_BILL_ENTRY:
-    case GNCENTRY_VEND_CREDIT_NOTE_ENTRY:
-    case GNCENTRY_EMPL_CREDIT_NOTE_ENTRY:
-        cell = gnc_table_layout_get_cell (ledger->table->layout, ENTRY_BACCT_CELL);
-        account_name = gnc_get_account_name_for_register (gncEntryGetBillAccount(auto_entry));
-        break;
-    case GNCENTRY_ORDER_ENTRY:
-    default:
-        cell = NULL;
-        account_name = NULL;
-        break;
-    }
-    set_value_combo_cell (cell, account_name);
-    g_free (account_name);
-
-    /* Auto-complete quantity cell. Note that this requires some care because
-     * credit notes store quantities with a reversed sign. So we need to figure
-     * out if the original document from which we extract the autofill entry
-     * was a credit note or not. */
-    {
-        gboolean orig_is_cn;
-        switch (ledger->type)
-        {
-        case GNCENTRY_INVOICE_ENTRY:
-        case GNCENTRY_CUST_CREDIT_NOTE_ENTRY:
-            orig_is_cn = gncInvoiceGetIsCreditNote (gncEntryGetInvoice (auto_entry));
-            break;
-        default:
-            orig_is_cn = gncInvoiceGetIsCreditNote (gncEntryGetBill (auto_entry));
-            break;
-        }
-        cell = gnc_table_layout_get_cell (ledger->table->layout, ENTRY_QTY_CELL);
-        set_value_price_cell (cell, gncEntryGetDocQuantity (auto_entry, orig_is_cn));
-    }
-
-    /* Auto-complete price cell */
-    {
-        gnc_numeric price;
-        switch (ledger->type)
-        {
-        case GNCENTRY_INVOICE_ENTRY:
-        case GNCENTRY_CUST_CREDIT_NOTE_ENTRY:
-            price = gncEntryGetInvPrice (auto_entry);
-            break;
-        default:
-            price = gncEntryGetBillPrice (auto_entry);
-            break;
-        }
-
-        /* Auto-complete price cell */
-        cell = gnc_table_layout_get_cell (ledger->table->layout, ENTRY_PRIC_CELL);
-        set_value_price_cell (cell, price);
-    }
-
-    /* We intentionally skip the discount column */
-
-    /* Taxable?, Tax-include?, Tax table */
-    {
-        gboolean taxable = FALSE, taxincluded = FALSE;
-        GncTaxTable *taxtable = NULL;
-        switch (ledger->type)
-        {
-        case GNCENTRY_INVOICE_ENTRY:
-        case GNCENTRY_CUST_CREDIT_NOTE_ENTRY:
-            taxable = gncEntryGetInvTaxable (auto_entry);
-            taxincluded = gncEntryGetInvTaxIncluded (auto_entry);
-            taxtable = gncEntryGetInvTaxTable (auto_entry);
-            break;
-        case GNCENTRY_BILL_ENTRY:
-        case GNCENTRY_VEND_CREDIT_NOTE_ENTRY:
-            taxable = gncEntryGetBillTaxable (auto_entry);
-            taxincluded = gncEntryGetBillTaxIncluded (auto_entry);
-            taxtable = gncEntryGetBillTaxTable (auto_entry);
-            break;
-        default:
-            break;
-        }
-
-        switch (ledger->type)
-        {
-        case GNCENTRY_INVOICE_ENTRY:
-        case GNCENTRY_CUST_CREDIT_NOTE_ENTRY:
-        case GNCENTRY_BILL_ENTRY:
-        case GNCENTRY_VEND_CREDIT_NOTE_ENTRY:
-            /* Taxable? cell */
-            cell = gnc_table_layout_get_cell (ledger->table->layout, ENTRY_TAXABLE_CELL);
-            gnc_checkbox_cell_set_flag ((CheckboxCell *) cell, taxable);
-            gnc_basic_cell_set_changed (cell, TRUE);
-
-            /* taxincluded? cell */
-            cell = gnc_table_layout_get_cell (ledger->table->layout, ENTRY_TAXINCLUDED_CELL);
-            gnc_checkbox_cell_set_flag ((CheckboxCell *) cell, taxincluded);
-            gnc_basic_cell_set_changed (cell, TRUE);
-
-            /* Taxable? cell */
-            cell = gnc_table_layout_get_cell (ledger->table->layout, ENTRY_TAXTABLE_CELL);
-            set_value_combo_cell(cell, gncTaxTableGetName (taxtable));
-            break;
-        default:
-            break;
-        }
-    }
-
-
-    gnc_resume_gui_refresh ();
-
-    /* now move to the non-empty amount column unless config setting says not */
-    if ( !gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL_REGISTER,
-                             GNC_PREF_TAB_TRANS_MEMORISED) )
-    {
-        VirtualLocation new_virt_loc;
-        const char *cell_name = ENTRY_QTY_CELL;
-
-        if (gnc_table_get_current_cell_location (ledger->table, cell_name,
-                &new_virt_loc))
-            *p_new_virt_loc = new_virt_loc;
-    }
-
-    return TRUE;
-}
-
-static gboolean gnc_entry_ledger_traverse (VirtualLocation *p_new_virt_loc,
-        gncTableTraversalDir dir,
-        gpointer user_data)
-{
-    GncEntryLedger *ledger = user_data;
-    GncEntry *entry, *new_entry;
-    gint response;
-    VirtualLocation virt_loc;
-    int changed;
-    char const *cell_name;
-    gboolean exact_traversal;
-
-    if (!ledger) return FALSE;
-
-    exact_traversal = (dir == GNC_TABLE_TRAVERSE_POINTER);
-
-    entry = gnc_entry_ledger_get_current_entry (ledger);
-    if (!entry)
-        return FALSE;
-
-    /* no changes, make sure we aren't going off the end */
-    changed = gnc_table_current_cursor_changed (ledger->table, FALSE);
-    if (!changed)
-        return FALSE;
-
-    virt_loc = *p_new_virt_loc;
-
-    cell_name = gnc_table_get_current_cell_name (ledger->table);
-
-    /* See if we are leaving the account field */
-    do
-    {
-        ComboCell *cell;
-        char *name;
-        char *cell_name = NULL;
-
-        switch (ledger->type)
-        {
-        case GNCENTRY_INVOICE_ENTRY:
-        case GNCENTRY_INVOICE_VIEWER:
-        case GNCENTRY_CUST_CREDIT_NOTE_ENTRY:
-        case GNCENTRY_CUST_CREDIT_NOTE_VIEWER:
-            cell_name = ENTRY_IACCT_CELL;
-            break;
-        case GNCENTRY_BILL_ENTRY:
-        case GNCENTRY_BILL_VIEWER:
-        case GNCENTRY_EXPVOUCHER_ENTRY:
-        case GNCENTRY_EXPVOUCHER_VIEWER:
-        case GNCENTRY_VEND_CREDIT_NOTE_ENTRY:
-        case GNCENTRY_VEND_CREDIT_NOTE_VIEWER:
-        case GNCENTRY_EMPL_CREDIT_NOTE_ENTRY:
-        case GNCENTRY_EMPL_CREDIT_NOTE_VIEWER:
-            cell_name = ENTRY_BACCT_CELL;
-            break;
-        default:
-            g_warning ("Unhandled ledger type");
-            break;
-        }
-
-        if (!cell_name)
-            break;
-
-        if (!gnc_cell_name_equal (cell_name, cell_name))
-            break;
-
-        if (!gnc_table_layout_get_cell_changed (ledger->table->layout,
-                                                cell_name, FALSE))
-            break;
-
-        cell = (ComboCell *) gnc_table_layout_get_cell (ledger->table->layout,
-                cell_name);
-        if (!cell)
-            break;
-
-        name = cell->cell.value;
-        if (!name || *name == '\0')
-            break;
-
-        /* Create the account if necessary. Also checks for a placeholder */
-        if (!gnc_entry_ledger_get_account_by_name (ledger, (BasicCell *) cell,
-                cell->cell.value,
-                &ledger->full_refresh))
-            return TRUE;
-
-    }
-    while (FALSE);
-
-
-    /* See if we are leaving the TaxTable field */
-    do
-    {
-        ComboCell *cell;
-        GncTaxTable *table;
-        char *name;
-
-        if (!gnc_cell_name_equal (cell_name, ENTRY_TAXTABLE_CELL))
-            break;
-
-        if (!gnc_table_layout_get_cell_changed (ledger->table->layout,
-                                                ENTRY_TAXTABLE_CELL, FALSE))
-            break;
-
-        cell = (ComboCell *) gnc_table_layout_get_cell (ledger->table->layout,
-                ENTRY_TAXTABLE_CELL);
-        if (!cell)
-            break;
-
-        name = cell->cell.value;
-        if (!name || *name == '\0')
-            break;
-
-        table = gncTaxTableLookupByName (ledger->book, cell->cell.value);
-        if (table)
-            break;
-
-        {
-            const char *format = _("The tax table %s does not exist. "
-                                   "Would you like to create it?");
-            if (!gnc_verify_dialog (ledger->parent, TRUE, format, name))
-                break;
-        }
-
-        ledger->full_refresh = FALSE;
-
-        table = gnc_ui_tax_table_new_from_name (ledger->book, name);
-        if (!table)
-            break;
-
-        ledger->full_refresh = TRUE;
-
-        name = (char *)gncTaxTableGetName (table);
-        gnc_combo_cell_set_value (cell, name);
-        gnc_basic_cell_set_changed (&cell->cell, TRUE);
-
-    }
-    while (FALSE);
-
-
-    /* See if we are tabbing off the end of the very last line
-     * (i.e. the blank entry)
-     */
-    do
-    {
-        VirtualLocation virt_loc;
-
-        if (!changed && !ledger->blank_entry_edited)
-            break;
-
-        if (dir != GNC_TABLE_TRAVERSE_RIGHT)
-            break;
-
-        virt_loc = ledger->table->current_cursor_loc;
-        if (gnc_table_move_vertical_position (ledger->table, &virt_loc, 1))
-            break;
-
-        virt_loc = ledger->table->current_cursor_loc;
-        if (gnc_table_move_tab (ledger->table, &virt_loc, TRUE))
-            break;
-
-        *p_new_virt_loc = ledger->table->current_cursor_loc;
-
-        /* Yep, we're trying to leave the blank entry -- make sure
-         * we are allowed to do so by verifying the current cursor.
-         * If the current cursor is ok, then move on!
-         */
-
-        /* Verify that the cursor is ok.  If we can't save the cell, don't move! */
-        if (!gnc_entry_ledger_verify_can_save (ledger))
-        {
-            return TRUE;
-        }
-
-        (p_new_virt_loc->vcell_loc.virt_row)++;
-        p_new_virt_loc->phys_row_offset = 0;
-        p_new_virt_loc->phys_col_offset = 0;
-
-        ledger->traverse_to_new = TRUE;
-
-        /* If we're here, we're tabbing off the end of the 'blank entry' */
-        return FALSE;
-
-    }
-    while (FALSE);
-
-    /* Now see if we are changing cursors. If not, we may be able to
-     * auto-complete. */
-    if (!gnc_table_virtual_cell_out_of_bounds (ledger->table,
-            virt_loc.vcell_loc))
-    {
-        if (gnc_entry_ledger_auto_completion (ledger, dir, p_new_virt_loc))
-            return FALSE;
-    }
-
-    /* Check for going off the end */
-    gnc_table_find_close_valid_cell (ledger->table, &virt_loc, exact_traversal);
-
-    /* Same entry, no problem -- we're just moving backwards in the cursor */
-    new_entry = gnc_entry_ledger_get_entry (ledger, virt_loc.vcell_loc);
-    if (entry == new_entry)
-    {
-        *p_new_virt_loc = virt_loc;
-
-        return FALSE;
-    }
-
-    /* If we are here, then we are trying to leave the cursor.  Make sure
-     * the cursor we are leaving is valid.  If so, ask the user if the
-     * changes should be recorded.  If not, don't go anywhere.
-     */
-
-    /* Verify this cursor -- if it's not valid, don't let them move on */
-    if (!gnc_entry_ledger_verify_can_save (ledger))
-    {
-        *p_new_virt_loc = ledger->table->current_cursor_loc;
-        return TRUE;
-    }
-
-    /*
-     * XXX  GNCENTRY_INVOICE_EDIT processing to be added:
-     * 1) check if the qty field changed.
-     * 2) if so, check if this entry is part of an order.
-     * 3) if so, ask if they want to change the entry or
-     *    split the entry into two parts.
-     */
-
-    /* Ok, we are changing lines and the current entry has
-     * changed. We only ask them what they want to do in
-     * limited cases -- usually just let the change go through.
-     */
-    {
-        GtkWidget *dialog;
-        const char *title = _("Save the current entry?");
-        const char *message =
-            _("The current entry has been changed. However, this entry is "
-              "part of an existing order. Would you like to record the change "
-              "and effectively change your order?");
-
-        switch (ledger->type)
-        {
-        case GNCENTRY_INVOICE_ENTRY:
-        case GNCENTRY_CUST_CREDIT_NOTE_ENTRY:
-            if (gncEntryGetOrder (entry) != NULL)
-            {
-                dialog = gtk_message_dialog_new(GTK_WINDOW(ledger->parent),
-                                                GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                GTK_MESSAGE_QUESTION,
-                                                GTK_BUTTONS_NONE,
-                                                "%s", title);
-                gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
-                        "%s", message);
-                gtk_dialog_add_buttons(GTK_DIALOG(dialog),
-                                       _("_Don't Record"), GTK_RESPONSE_REJECT,
-                                       _("_Cancel"), GTK_RESPONSE_CANCEL,
-                                       _("_Record"), GTK_RESPONSE_ACCEPT,
-                                       NULL);
-                response = gnc_dialog_run(GTK_DIALOG(dialog), GNC_PREF_WARN_INV_ENTRY_MOD);
-                gtk_widget_destroy(dialog);
-                break;
-            }
-
-            /* FALL THROUGH */
-        default:
-            response = GTK_RESPONSE_ACCEPT;
-            break;
-        }
-    }
-
-    switch (response)
-    {
-    case GTK_RESPONSE_ACCEPT:
-        break;
-
-    case GTK_RESPONSE_REJECT:
-    {
-        VirtualCellLocation vcell_loc;
-        GncEntry *new_entry;
-
-        new_entry = gnc_entry_ledger_get_entry (ledger, virt_loc.vcell_loc);
-
-        gnc_entry_ledger_cancel_cursor_changes (ledger);
-
-        if (gnc_entry_ledger_find_entry (ledger, new_entry, &vcell_loc))
-            virt_loc.vcell_loc = vcell_loc;
-
-        gnc_table_find_close_valid_cell (ledger->table, &virt_loc,
-                                         exact_traversal);
-
-        *p_new_virt_loc = virt_loc;
-    }
-
-    break;
-
-    case GTK_RESPONSE_CANCEL:
-    default:
-        return TRUE;
-    }
-
-    return FALSE;
-}
-
-TableControl * gnc_entry_ledger_control_new (void)
-{
-    TableControl * control;
-
-    control = gnc_table_control_new ();
-    control->move_cursor = gnc_entry_ledger_move_cursor;
-    control->traverse = gnc_entry_ledger_traverse;
-
-    return control;
-}
-
-
-void gnc_entry_ledger_cancel_cursor_changes (GncEntryLedger *ledger)
-{
-    VirtualLocation virt_loc;
-
-    if (ledger == NULL)
-        return;
-
-    virt_loc = ledger->table->current_cursor_loc;
-
-    if (!gnc_table_current_cursor_changed (ledger->table, FALSE))
-        return;
-
-    /* When cancelling edits, reload the cursor from the entry. */
-    gnc_table_clear_current_cursor_changes (ledger->table);
-
-    if (gnc_table_find_close_valid_cell (ledger->table, &virt_loc, FALSE))
-        gnc_table_move_cursor_gui (ledger->table, virt_loc);
-
-    gnc_table_refresh_gui (ledger->table, TRUE);
-}
-
-static gboolean
-gnc_entry_ledger_check_close_internal (GtkWidget *parent,
-                                       GncEntryLedger *ledger,
-                                       gboolean dontask)
-{
-    const char *message = _("The current entry has been changed. "
-                            "Would you like to save it?");
-    VirtualLocation virt_loc;
-
-    virt_loc = ledger->table->current_cursor_loc;
-
-    if (gnc_entry_ledger_traverse (&virt_loc, GNC_TABLE_TRAVERSE_POINTER,
-                                   ledger))
-        return FALSE;
-
-    if (!gnc_entry_ledger_verify_can_save (ledger))
-        return FALSE;
-
-    if (dontask || gnc_verify_dialog (parent, TRUE, "%s", message))
-        gnc_entry_ledger_save (ledger, TRUE);
-    else
-        gnc_entry_ledger_cancel_cursor_changes (ledger);
-
-    return TRUE;
-}
-
-gboolean
-gnc_entry_ledger_commit_entry (GncEntryLedger *ledger)
-{
-    if (!ledger) return TRUE;
-
-    return gnc_entry_ledger_check_close_internal (NULL, ledger, TRUE);
-}
-
-gboolean
-gnc_entry_ledger_check_close (GtkWidget *parent, GncEntryLedger *ledger)
-{
-    if (!ledger) return TRUE;
-
-    if (gnc_entry_ledger_changed (ledger))
-    {
-        gboolean dontask = FALSE;
-
-        if (ledger->type ==  GNCENTRY_INVOICE_ENTRY ||
-                ledger->type ==  GNCENTRY_CUST_CREDIT_NOTE_ENTRY)
-        {
-            gboolean inv_value;
-            gboolean only_inv_changed = FALSE;
-
-            if (gnc_table_current_cursor_changed (ledger->table, FALSE) == 1 &&
-                    gnc_table_layout_get_cell_changed (ledger->table->layout,
-                            ENTRY_INV_CELL, TRUE))
-                only_inv_changed = TRUE;
-
-            inv_value = gnc_entry_ledger_get_checkmark (ledger, ENTRY_INV_CELL);
-
-            if (inv_value && only_inv_changed)
-            {
-                /* If the only change is that the 'inv' entry was clicked
-                 * "on", then just accept the change it without question.
-                 */
-                dontask = TRUE;
-            }
-        }
-
-        return gnc_entry_ledger_check_close_internal (parent, ledger, dontask);
-
-    }
-    return TRUE;
-}
diff --git a/src/register/ledger-core/gncEntryLedgerLoad.c b/src/register/ledger-core/gncEntryLedgerLoad.c
deleted file mode 100644
index c277836..0000000
--- a/src/register/ledger-core/gncEntryLedgerLoad.c
+++ /dev/null
@@ -1,617 +0,0 @@
-/*
- * gncEntryLedgerLoad.c -- a Ledger widget for entering GncEntry objects
- * Copyright (C) 2001, 2002, 2003 Derek Atkins
- * Author: Derek Atkins <warlord at MIT.EDU>
- *
- * 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 at gnu.org
- */
-
-#include "config.h"
-
-#include <glib.h>
-#include <glib/gi18n.h>
-
-#include "Account.h"
-#include "account-quickfill.h"
-#include "combocell.h"
-#include "gnc-component-manager.h"
-#include "gnc-prefs.h"
-#include "gnc-ui-util.h"
-#include "recncell.h"
-
-#include "business-helpers.h"
-
-#include "gncEntry.h"
-#include "gncEntryLedger.h"
-#include "gncEntryLedgerP.h"
-#include "quickfillcell.h"
-#include "app-utils/gnc-entry-quickfill.h"
-
-#define GNC_PREF_TAX_INCL "tax-included"
-
-static const QofLogModule log_module = "Business Entry Ledger";
-
-/* XXX: This should go elsewhere */
-const char * gnc_entry_ledger_type_string_getter (char flag)
-{
-    switch (flag)
-    {
-    case '1':
-        return _("$");
-    case '2':
-        return _("%");
-    default:
-        break;
-    };
-    return "?";
-}
-
-const char * gnc_entry_ledger_how_string_getter (char flag)
-{
-    switch (flag)
-    {
-    case '1':
-        return _("<");
-    case '2':
-        return _("=");
-    case '3':
-        return _(">");
-    default:
-        break;
-    };
-        return "?";
-}
-
-static void load_discount_type_cells (GncEntryLedger *ledger)
-{
-    RecnCell *cell;
-
-    if (!ledger) return;
-
-    cell = (RecnCell *)
-           gnc_table_layout_get_cell (ledger->table->layout, ENTRY_DISTYPE_CELL);
-
-    if (!cell) return;
-
-    gnc_recn_cell_set_valid_flags (cell, "12", '2');
-    gnc_recn_cell_set_flag_order (cell, "21");
-    gnc_recn_cell_set_string_getter (cell, gnc_entry_ledger_type_string_getter);
-}
-
-static void load_discount_how_cells (GncEntryLedger *ledger)
-{
-    RecnCell *cell;
-
-    if (!ledger) return;
-
-    cell = (RecnCell *)
-           gnc_table_layout_get_cell (ledger->table->layout, ENTRY_DISHOW_CELL);
-
-    if (!cell) return;
-
-    gnc_recn_cell_set_valid_flags (cell, "123", '1');
-    gnc_recn_cell_set_flag_order (cell, "123");
-    gnc_recn_cell_set_string_getter (cell, gnc_entry_ledger_how_string_getter);
-}
-
-static void load_payment_type_cells (GncEntryLedger *ledger)
-{
-    ComboCell *cell;
-    const GncOwner *owner;
-    GncEmployee *employee;
-
-    cell = (ComboCell *) gnc_table_layout_get_cell (ledger->table->layout,
-            ENTRY_PAYMENT_CELL);
-    if (!cell) return;
-
-    if (!ledger->invoice) return;
-
-    owner = gncOwnerGetEndOwner (gncInvoiceGetOwner (ledger->invoice));
-    if (gncOwnerGetType (owner) != GNC_OWNER_EMPLOYEE)
-        return;
-
-    employee = gncOwnerGetEmployee (owner);
-    g_return_if_fail (employee);
-
-    gnc_combo_cell_clear_menu (cell);
-    gnc_combo_cell_add_menu_item (cell, _("Cash"));
-
-    if (gncEmployeeGetCCard (employee))
-        gnc_combo_cell_add_menu_item (cell, _("Charge"));
-}
-
-/* ==================================================================== */
-/* Return TRUE if we don't want to add this account to the xfer menu */
-
-static gboolean
-skip_expense_acct_cb (Account *account, gpointer user_data)
-{
-    GNCAccountType type;
-
-    /* Don't add A/R, A/P, Bank, Cash, or Equity accounts */
-    type = xaccAccountGetType (account);
-    if (type == ACCT_TYPE_PAYABLE || type == ACCT_TYPE_RECEIVABLE ||
-            type == ACCT_TYPE_CASH || type == ACCT_TYPE_BANK ||
-            type == ACCT_TYPE_EQUITY || type == ACCT_TYPE_TRADING)
-    {
-        return TRUE;
-    }
-
-    /* If this is an ORDER or INVOICE, then leave out the expenses.  */
-    if (type == ACCT_TYPE_EXPENSE) return TRUE;
-
-    /* Don't add placeholder accounts */
-    if (xaccAccountGetPlaceholder (account)) return TRUE;
-
-    return FALSE;
-}
-
-static gboolean
-skip_income_acct_cb (Account *account, gpointer user_data)
-{
-    GNCAccountType type;
-
-    /* Don't add A/R, A/P, Bank, Cash, or Equity accounts */
-    type = xaccAccountGetType (account);
-    if (type == ACCT_TYPE_PAYABLE || type == ACCT_TYPE_RECEIVABLE ||
-            type == ACCT_TYPE_CASH || type == ACCT_TYPE_BANK ||
-            type == ACCT_TYPE_EQUITY || type == ACCT_TYPE_TRADING)
-    {
-        return TRUE;
-    }
-
-    /* If this is a BILL, then leave out the incomes */
-    if (type == ACCT_TYPE_INCOME) return TRUE;
-
-    /* Don't add placeholder accounts */
-    if (xaccAccountGetPlaceholder (account)) return TRUE;
-
-    return FALSE;
-}
-
-/* ===================================================================== */
-/* Splat the account name into the transfer cell combobox menu */
-
-#define EKEY "Expense Business entry quickfill"
-#define IKEY "Income Business entry quickfill"
-
-static void
-load_xfer_type_cells (GncEntryLedger *ledger)
-{
-    Account *root;
-    ComboCell *cell;
-    QuickFill *qf = NULL;
-    GtkListStore *store = NULL;
-
-    root = gnc_book_get_root_account (ledger->book);
-    if (root == NULL) return;
-
-    /* Use a common, shared quickfill.  For the ORDER or INVOICE,
-     * ledgers, we don't want expense-type accounts in the menu.
-     * For BILL, etc. then leave out the income types.
-     */
-    switch (ledger->type)
-    {
-    case GNCENTRY_ORDER_ENTRY:
-    case GNCENTRY_ORDER_VIEWER:
-    case GNCENTRY_INVOICE_ENTRY:
-    case GNCENTRY_INVOICE_VIEWER:
-    case GNCENTRY_CUST_CREDIT_NOTE_ENTRY:
-    case GNCENTRY_CUST_CREDIT_NOTE_VIEWER:
-        qf = gnc_get_shared_account_name_quickfill (root, IKEY,
-                skip_expense_acct_cb, NULL);
-        store = gnc_get_shared_account_name_list_store (root, IKEY,
-                skip_expense_acct_cb, NULL);
-        break;
-
-    case GNCENTRY_BILL_ENTRY:
-    case GNCENTRY_BILL_VIEWER:
-    case GNCENTRY_EXPVOUCHER_ENTRY:
-    case GNCENTRY_EXPVOUCHER_VIEWER:
-    case GNCENTRY_VEND_CREDIT_NOTE_ENTRY:
-    case GNCENTRY_VEND_CREDIT_NOTE_VIEWER:
-    case GNCENTRY_EMPL_CREDIT_NOTE_ENTRY:
-    case GNCENTRY_EMPL_CREDIT_NOTE_VIEWER:
-    case GNCENTRY_NUM_REGISTER_TYPES:
-        qf = gnc_get_shared_account_name_quickfill (root, EKEY,
-                skip_income_acct_cb, NULL);
-        store = gnc_get_shared_account_name_list_store (root, EKEY,
-                skip_income_acct_cb, NULL);
-        break;
-    default:
-	PWARN ("Bad GncEntryLedgerType");
-	break;
-    }
-
-    cell = (ComboCell *)
-           gnc_table_layout_get_cell (ledger->table->layout, ENTRY_IACCT_CELL);
-    gnc_combo_cell_use_quickfill_cache (cell, qf);
-    gnc_combo_cell_use_list_store_cache (cell, store);
-
-    cell = (ComboCell *)
-           gnc_table_layout_get_cell (ledger->table->layout, ENTRY_BACCT_CELL);
-    gnc_combo_cell_use_quickfill_cache (cell, qf);
-    gnc_combo_cell_use_list_store_cache (cell, store);
-}
-
-/* ===================================================================== */
-
-static void load_taxtable_type_cells (GncEntryLedger *ledger)
-{
-    GList *list;
-    ComboCell *cell;
-
-    cell = (ComboCell *)
-           gnc_table_layout_get_cell (ledger->table->layout, ENTRY_TAXTABLE_CELL);
-    gnc_combo_cell_clear_menu (cell);
-
-    list = gncTaxTableGetTables (ledger->book);
-    for ( ; list ; list = list->next )
-    {
-        GncTaxTable *table = list->data;
-        const char *name = gncTaxTableGetName (table);
-        if (name != NULL)
-            gnc_combo_cell_add_menu_item (cell, (char*)name);
-    }
-}
-
-static void
-gnc_entry_ledger_show_entry (GncEntryLedger *ledger,
-                             VirtualCellLocation start_loc)
-{
-    VirtualCellLocation end_loc;
-    int v_row;
-
-    end_loc = start_loc;
-    v_row = end_loc.virt_row + 1;
-    end_loc.virt_row = MIN (v_row, ledger->table->num_virt_rows - 1);
-
-    gnc_table_show_range (ledger->table, start_loc, end_loc);
-}
-
-#define DESC_QF_KEY_INVOICES "ENTRY_DESC_CELL_QF_INVOICES"
-#define DESC_QF_KEY_BILLS "ENTRY_DESC_CELL_QF_BILLS"
-
-static void
-load_description_cell (GncEntryLedger *ledger)
-{
-    QuickFill *shared_quickfill;
-    QuickFillCell *cell;
-
-    switch (ledger->type)
-    {
-    case GNCENTRY_INVOICE_ENTRY:
-    case GNCENTRY_INVOICE_VIEWER:
-    case GNCENTRY_CUST_CREDIT_NOTE_ENTRY:
-    case GNCENTRY_CUST_CREDIT_NOTE_VIEWER:
-        shared_quickfill = gnc_get_shared_entry_desc_quickfill(ledger->book, DESC_QF_KEY_INVOICES, TRUE);
-        break;
-    default:
-        shared_quickfill = gnc_get_shared_entry_desc_quickfill(ledger->book, DESC_QF_KEY_BILLS, FALSE);
-        break;
-    };
-
-    cell = (QuickFillCell *)
-           gnc_table_layout_get_cell (ledger->table->layout, ENTRY_DESC_CELL);
-    gnc_quickfill_cell_use_quickfill_cache (cell, shared_quickfill);
-}
-
-void gnc_entry_ledger_load_xfer_cells (GncEntryLedger *ledger)
-{
-    load_xfer_type_cells (ledger);
-    load_taxtable_type_cells (ledger);
-    load_payment_type_cells (ledger);
-    load_description_cell (ledger);
-}
-
-/* XXX (FIXME): This should be in a config file! */
-/* Copy GncEntry information from the list to the rows of the Ledger. */
-/* XXX This code is a cut-n-paste job from the SplitRegister code;
- * the split-register should be generalized to the point where a cut-n-paste
- * like this isn't required, and this should be trashed.
- */
-void gnc_entry_ledger_load (GncEntryLedger *ledger, GList *entry_list)
-{
-    GncEntry *blank_entry, *find_entry;
-    CursorBuffer *cursor_buffer;
-    Table *table;
-
-    GList *node;
-    CellBlock *cursor_header, *cursor;
-    VirtualCellLocation vcell_loc;
-    VirtualLocation save_loc;
-    gboolean start_primary_color = TRUE;
-
-    int new_entry_row = -1;
-
-    if (!ledger) return;
-
-    /* Load up cells */
-    load_discount_type_cells (ledger);
-    load_discount_how_cells (ledger);
-    gnc_entry_ledger_load_xfer_cells (ledger);
-
-    blank_entry = gnc_entry_ledger_get_blank_entry (ledger);
-
-    if (blank_entry == NULL && ledger->invoice == NULL && entry_list == NULL)
-        return;
-
-    if (blank_entry == NULL && ledger->invoice)
-    {
-        switch (ledger->type)
-        {
-        case GNCENTRY_ORDER_ENTRY:
-        case GNCENTRY_INVOICE_ENTRY:
-        case GNCENTRY_BILL_ENTRY:
-        case GNCENTRY_EXPVOUCHER_ENTRY:
-        case GNCENTRY_CUST_CREDIT_NOTE_ENTRY:
-        case GNCENTRY_VEND_CREDIT_NOTE_ENTRY:
-        case GNCENTRY_EMPL_CREDIT_NOTE_ENTRY:
-
-            gnc_suspend_gui_refresh ();
-
-            blank_entry = gncEntryCreate (ledger->book);
-            gncEntrySetDateGDate (blank_entry, &ledger->last_date_entered);
-            ledger->blank_entry_guid = *gncEntryGetGUID (blank_entry);
-
-            gnc_resume_gui_refresh ();
-
-            /* The rest of this does not apply to expense vouchers */
-            if (ledger->type != GNCENTRY_EXPVOUCHER_ENTRY)
-            {
-                const GncOwner *owner = gncOwnerGetEndOwner (gncInvoiceGetOwner (ledger->invoice));
-                GncTaxTable *table = NULL;
-                GncTaxIncluded taxincluded_p = GNC_TAXINCLUDED_USEGLOBAL;
-                gboolean taxincluded = FALSE;
-                gnc_numeric discount = gnc_numeric_zero ();
-                gnc_numeric price = gnc_numeric_zero ();
-
-                /* Determine the Price from Customer's or Vendor's Job */
-                switch (gncOwnerGetType (gncInvoiceGetOwner (ledger->invoice)))
-                {
-                case GNC_OWNER_JOB:
-                    price = gncJobGetRate( gncOwnerGetJob (gncInvoiceGetOwner (ledger->invoice)));
-                    break;
-                default:
-                    break;
-                }
-
-                /* Determine the TaxIncluded and Discount values */
-                switch (gncOwnerGetType (owner))
-                {
-                case GNC_OWNER_CUSTOMER:
-                    taxincluded_p = gncCustomerGetTaxIncluded (owner->owner.customer);
-                    discount = gncCustomerGetDiscount (owner->owner.customer);
-                    break;
-                case GNC_OWNER_VENDOR:
-                    taxincluded_p = gncVendorGetTaxIncluded (owner->owner.vendor);
-                    break;
-                default:
-                    break;
-                }
-
-                /* Compute the default taxincluded */
-                switch (taxincluded_p)
-                {
-                case GNC_TAXINCLUDED_YES:
-                    taxincluded = TRUE;
-                    break;
-                case GNC_TAXINCLUDED_NO:
-                    taxincluded = FALSE;
-                    break;
-                case GNC_TAXINCLUDED_USEGLOBAL:
-                    if (ledger->prefs_group)
-                    {
-                        taxincluded = gnc_prefs_get_bool (ledger->prefs_group, GNC_PREF_TAX_INCL);
-                    }
-                    else
-                    {
-                        taxincluded = FALSE;
-                    }
-                    break;
-                }
-
-                /* Compute the proper taxtable */
-                switch (gncOwnerGetType (owner))
-                {
-                case GNC_OWNER_CUSTOMER:
-                    table = gnc_business_get_default_tax_table (ledger->book,
-                            GNC_OWNER_CUSTOMER);
-
-                    if (gncCustomerGetTaxTableOverride (owner->owner.customer))
-                        table = gncCustomerGetTaxTable (owner->owner.customer);
-                    break;
-
-                case GNC_OWNER_VENDOR:
-                    table = gnc_business_get_default_tax_table (ledger->book,
-                            GNC_OWNER_VENDOR);
-
-                    if (gncVendorGetTaxTableOverride (owner->owner.vendor))
-                        table = gncVendorGetTaxTable (owner->owner.vendor);
-                    break;
-
-                default:
-                    break;
-                }
-
-                if (ledger->is_cust_doc)
-                {
-                    gncEntrySetInvTaxable (blank_entry, table != NULL);
-                    gncEntrySetInvTaxTable (blank_entry, table);
-                    gncEntrySetInvTaxIncluded (blank_entry, taxincluded);
-                    gncEntrySetInvDiscount (blank_entry, discount);
-                    gncEntrySetInvPrice (blank_entry, price);
-                }
-                else
-                {
-                    gncEntrySetBillTaxable (blank_entry, table != NULL);
-                    gncEntrySetBillTaxTable (blank_entry, table);
-                    gncEntrySetBillTaxIncluded (blank_entry, taxincluded);
-                    gncEntrySetBillPrice (blank_entry, price);
-                }
-            }
-
-            break;
-        default:
-            ledger->blank_entry_guid = *guid_null ();
-            break;
-        }
-        ledger->blank_entry_edited = FALSE;
-    }
-
-    table = ledger->table;
-
-    gnc_table_leave_update (table, table->current_cursor_loc);
-    save_loc = table->current_cursor_loc;
-
-    /* Figure out where we are going to */
-    if (ledger->traverse_to_new)
-    {
-        find_entry = blank_entry;
-    }
-    else if (ledger->hint_entry)
-    {
-        find_entry = ledger->hint_entry;
-    }
-    else
-    {
-        find_entry = gnc_entry_ledger_get_current_entry(ledger);
-        /* XXX: get current entry (cursor_hint_xxx) */
-    }
-
-    /* If the current cursor has changed we save the values for later
-     * possible restoration. */
-    if (gnc_table_current_cursor_changed (table, TRUE) &&
-            (find_entry == gnc_entry_ledger_get_current_entry (ledger)))
-    {
-        cursor_buffer = gnc_cursor_buffer_new ();
-        gnc_table_save_current_cursor (table, cursor_buffer);
-    }
-    else
-        cursor_buffer = NULL;
-
-    /* disable move callback -- we don't want the cascade of
-     * callbacks while we are fiddling with loading the register */
-    gnc_table_control_allow_move (table->control, FALSE);
-
-    /* invalidate the cursor */
-    {
-        VirtualLocation virt_loc;
-
-        virt_loc.vcell_loc.virt_row = -1;
-        virt_loc.vcell_loc.virt_col = -1;
-        virt_loc.phys_row_offset = -1;
-        virt_loc.phys_col_offset = -1;
-
-        gnc_table_move_cursor_gui (table, virt_loc);
-    }
-
-    /* make sure that the header is loaded */
-    vcell_loc.virt_row = 0;
-    vcell_loc.virt_col = 0;
-    cursor_header = gnc_table_layout_get_cursor (table->layout, CURSOR_HEADER);
-    gnc_table_set_vcell (table, cursor_header, NULL, TRUE, TRUE, vcell_loc);
-    vcell_loc.virt_row++;
-
-    /* get the current time and reset the dividing row */
-    table->model->dividing_row_upper = -1;
-    table->model->dividing_row = -1;
-    table->model->dividing_row_lower = -1;
-    cursor = gnc_table_layout_get_cursor (table->layout, "cursor");
-
-    /* Populate the table */
-    for (node = entry_list; node; node = node->next)
-    {
-        GncEntry *entry = node->data;
-
-        /* Don't load the blank entry */
-        if (entry == blank_entry)
-            continue;
-
-        /* If this is the first load of the ledger, fill the quickfill cells */
-        {
-            /* XXX */
-        }
-
-        if (entry == find_entry)
-            new_entry_row = vcell_loc.virt_row;
-
-        gnc_table_set_vcell (table, cursor, gncEntryGetGUID (entry),
-                             TRUE, start_primary_color, vcell_loc);
-        vcell_loc.virt_row++;
-
-        /* Flip color for the next guy */
-        start_primary_color = !start_primary_color;
-    }
-
-    /* Add the blank entry at the end. */
-    if (blank_entry)
-    {
-        gnc_table_set_vcell (table, cursor, gncEntryGetGUID (blank_entry),
-                             TRUE, start_primary_color, vcell_loc);
-
-        if (find_entry == blank_entry)
-            new_entry_row = vcell_loc.virt_row;
-
-        vcell_loc.virt_row++;
-    }
-
-    /* Resize the table */
-    gnc_table_set_size (table, vcell_loc.virt_row, 1);
-
-    /* Restore the cursor to its rightful position */
-    if (new_entry_row > 0)
-        save_loc.vcell_loc.virt_row = new_entry_row;
-
-    if (gnc_table_find_close_valid_cell (table, &save_loc, FALSE))
-    {
-        gnc_table_move_cursor_gui (table, save_loc);
-
-        if (find_entry == gnc_entry_ledger_get_current_entry (ledger))
-            gnc_table_restore_current_cursor (table, cursor_buffer);
-    }
-
-    gnc_cursor_buffer_destroy (cursor_buffer);
-    cursor_buffer = NULL;
-
-    /* Reset the ledger */
-    ledger->traverse_to_new = FALSE;
-    ledger->hint_entry = NULL;
-
-    /* Set the cell fractions */
-
-
-    gnc_table_refresh_gui (table, TRUE);
-    gnc_entry_ledger_show_entry (ledger, table->current_cursor_loc.vcell_loc);
-
-    /* Set completion character */
-    gnc_combo_cell_set_complete_char
-    ((ComboCell *)
-     gnc_table_layout_get_cell (table->layout, ENTRY_IACCT_CELL),
-     gnc_get_account_separator ());
-
-    gnc_combo_cell_set_complete_char
-    ((ComboCell *)
-     gnc_table_layout_get_cell (table->layout, ENTRY_BACCT_CELL),
-     gnc_get_account_separator ());
-
-    /* enable callback for cursor user-driven moves */
-    gnc_table_control_allow_move (table->control, TRUE);
-}
-
-/* =========================== END OF FILE ========================== */
diff --git a/src/register/ledger-core/split-register-control.c b/src/register/ledger-core/split-register-control.c
deleted file mode 100644
index 3117dac..0000000
--- a/src/register/ledger-core/split-register-control.c
+++ /dev/null
@@ -1,1859 +0,0 @@
-/********************************************************************\
- * split-register-control.c -- split register control object        *
- *                                                                  *
- * 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 at gnu.org                   *
- *                                                                  *
-\********************************************************************/
-
-#include "config.h"
-
-#include <glib.h>
-#include <glib/gi18n.h>
-
-#include "Scrub.h"
-#include "combocell.h"
-#include "gnc-component-manager.h"
-#include "gnc-prefs.h"
-#include "gnc-ui.h"
-#include "gnome-utils/gnc-warnings.h"
-#include "pricecell.h"
-#include "datecell.h"
-#include "dialog-transfer.h"
-#include "dialog-utils.h"
-#include "split-register-control.h"
-#include "split-register-model-save.h"
-#include "split-register-p.h"
-#include "table-allgui.h"
-#include "engine-helpers.h"
-
-
-/* This static indicates the debugging module that this .o belongs to. */
-static QofLogModule log_module = GNC_MOD_LEDGER;
-
-
-static gboolean
-gnc_split_register_balance_trans (SplitRegister *reg, Transaction *trans)
-{
-    int choice;
-    int default_value;
-    Account *default_account;
-    Account *other_account;
-    Account *root;
-    GList *radio_list = NULL;
-    const char *title   = _("Rebalance Transaction");
-    const char *message = _("The current transaction is not balanced.");
-    Split *split;
-    Split *other_split;
-    gboolean two_accounts;
-    gboolean multi_currency;
-
-
-    if (xaccTransIsBalanced (trans))
-        return FALSE;
-
-    if (xaccTransUseTradingAccounts (trans))
-    {
-        MonetaryList *imbal_list;
-        gnc_monetary *imbal_mon;
-        imbal_list = xaccTransGetImbalance (trans);
-
-        /* See if the imbalance is only in the transaction's currency */
-        if (!imbal_list)
-            /* Value imbalance, but not commodity imbalance.  This shouldn't
-               be something that scrubbing can cause to happen.  Perhaps someone
-               entered invalid splits.  */
-            multi_currency = TRUE;
-        else
-        {
-            imbal_mon = imbal_list->data;
-            if (!imbal_list->next &&
-                    gnc_commodity_equiv(gnc_monetary_commodity(*imbal_mon),
-                                        xaccTransGetCurrency(trans)))
-                multi_currency = FALSE;
-            else
-                multi_currency = TRUE;
-        }
-
-        /* We're done with the imbalance list, the real work will be done
-           by xaccTransScrubImbalance which will get it again. */
-        gnc_monetary_list_free(imbal_list);
-    }
-    else
-        multi_currency = FALSE;
-
-    split = xaccTransGetSplit (trans, 0);
-    other_split = xaccSplitGetOtherSplit (split);
-
-    if (other_split == NULL)
-    {
-        /* Attempt to handle the inverted many-to-one mapping */
-        split = xaccTransGetSplit (trans, 1);
-        if (split) other_split = xaccSplitGetOtherSplit (split);
-        else split = xaccTransGetSplit (trans, 0);
-    }
-    if (other_split == NULL || multi_currency)
-    {
-        two_accounts = FALSE;
-        other_account = NULL;
-    }
-    else
-    {
-        two_accounts = TRUE;
-        other_account = xaccSplitGetAccount (other_split);
-    }
-
-    default_account = gnc_split_register_get_default_account (reg);
-
-    /* If the two pointers are the same, the account from other_split
-     * is actually the default account. We must make other_account
-     * the account from split instead.   */
-
-    if (default_account == other_account)
-        other_account = xaccSplitGetAccount (split);
-
-    /*  If the two pointers are still the same, we have two splits, but
-     *  they both refer to the same account. While non-sensical, we don't
-     *  object.   */
-
-    if (default_account == other_account)
-        two_accounts = FALSE;
-
-    radio_list = g_list_append (radio_list,
-                                _("Balance it _manually"));
-    radio_list = g_list_append (radio_list,
-                                _("Let GnuCash _add an adjusting split"));
-
-    if (reg->type < NUM_SINGLE_REGISTER_TYPES && !multi_currency)
-    {
-        radio_list = g_list_append (radio_list,
-                                    _("Adjust current account _split total"));
-
-        default_value = 2;
-        if (two_accounts)
-        {
-            radio_list = g_list_append (radio_list,
-                                        _("Adjust _other account split total"));
-            default_value = 3;
-        }
-    }
-    else
-        default_value = 0;
-
-    choice = gnc_choose_radio_option_dialog
-             (gnc_split_register_get_parent (reg),
-              title,
-              message,
-              _("_Rebalance"),
-              default_value,
-              radio_list);
-
-    g_list_free (radio_list);
-
-    root = default_account ? gnc_account_get_root(default_account) : NULL;
-    switch (choice)
-    {
-    default:
-    case 0:
-        break;
-
-    case 1:
-        xaccTransScrubImbalance (trans, root, NULL);
-        break;
-
-    case 2:
-        xaccTransScrubImbalance (trans, root, default_account);
-        break;
-
-    case 3:
-        xaccTransScrubImbalance (trans, root, other_account);
-        break;
-    }
-
-    return TRUE;
-}
-
-static gboolean
-gnc_split_register_old_split_empty_p (SplitRegister *reg, Split *split)
-{
-    BasicCell *cell;
-    gnc_numeric amount;
-    const char *string;
-
-    string = gnc_table_layout_get_cell_value (reg->table->layout, MEMO_CELL);
-    if ((string != NULL) && (*string != '\0'))
-        return FALSE;
-
-    string = gnc_table_layout_get_cell_value (reg->table->layout, XFRM_CELL);
-    if ((string != NULL) && (*string != '\0'))
-        return FALSE;
-
-    cell = gnc_table_layout_get_cell (reg->table->layout, CRED_CELL);
-    if (cell)
-    {
-        amount = gnc_price_cell_get_value ((PriceCell *) cell);
-        if (!gnc_numeric_zero_p (amount))
-            return FALSE;
-    }
-
-    cell = gnc_table_layout_get_cell (reg->table->layout, DEBT_CELL);
-    if (cell)
-    {
-        amount = gnc_price_cell_get_value ((PriceCell *) cell);
-        if (!gnc_numeric_zero_p (amount))
-            return FALSE;
-    }
-
-    return TRUE;
-}
-
-/* Checks a cell for a debit or credit change to see if a new exchange
- * rate is needed. */
-
-static gboolean
-gnc_split_register_check_debcred (SplitRegister *reg,
-                                  const char *cell_name)
-{
-    if ((gnc_cell_name_equal (cell_name, DEBT_CELL) &&
-            gnc_table_layout_get_cell_changed (reg->table->layout,
-                                               DEBT_CELL, FALSE)) ||
-         (gnc_cell_name_equal (cell_name, CRED_CELL) &&
-            gnc_table_layout_get_cell_changed (reg->table->layout,
-                                               CRED_CELL, FALSE)))
-    {
-        SRInfo *info = gnc_split_register_get_info (reg);
-        PriceCell *rate_cell = (PriceCell *) gnc_table_layout_get_cell (reg->table->layout,
-                                RATE_CELL);
-        if (gnc_split_reg_has_rate_cell(reg->type) && info->rate_reset != RATE_RESET_DONE)
-        {
-            /* Debit or credit amount changed, get a new exchange rate */
-            info->rate_reset = RATE_RESET_REQD;
-            if (info->auto_complete)
-            {
-                /* It's auto-filled, start with rate from price DB for the date
-                   of the transaction. */
-                gnc_price_cell_set_value (rate_cell, gnc_numeric_zero());
-            }
-        }
-    }
-
-    return TRUE;
-}
-
-/* Checks a cell for an account change and takes any necessary action if
- * one has occurred. Returns TRUE if the check passes, FALSE if it fails. */
-static gboolean
-gnc_split_register_check_account (SplitRegister *reg,
-                                  const char *cell_name)
-{
-    SRInfo *info;
-    ComboCell *cell = NULL;
-    Account* new_acct;
-    Split *split;
-    char *name;
-
-    g_return_val_if_fail(reg, TRUE);
-
-    /* See if we are leaving an account field */
-    if (gnc_cell_name_equal (cell_name, XFRM_CELL))
-    {
-        if (gnc_table_layout_get_cell_changed (reg->table->layout,
-                                               XFRM_CELL, FALSE))
-            cell = (ComboCell *) gnc_table_layout_get_cell (reg->table->layout,
-                    XFRM_CELL);
-    }
-    else if (gnc_cell_name_equal (cell_name, MXFRM_CELL))
-    {
-        if (gnc_table_layout_get_cell_changed (reg->table->layout,
-                                               MXFRM_CELL, FALSE))
-            cell = (ComboCell *) gnc_table_layout_get_cell (reg->table->layout,
-                    MXFRM_CELL);
-    }
-
-    if (!cell)
-        return TRUE;
-
-    /* The account has been changed. */
-    name = cell->cell.value;
-    DEBUG("Changed to %s", name ? name : "NULL");
-    if (!name || *name == '\0' ||
-            g_strcmp0 (name, SPLIT_TRANS_STR) == 0 ||
-            g_strcmp0 (name, STOCK_SPLIT_STR) == 0)
-        return TRUE;
-
-    /* Create the account if necessary. Also checks for a placeholder. */
-    info = gnc_split_register_get_info (reg);
-    new_acct = gnc_split_register_get_account_by_name (reg,
-               (BasicCell *) cell,
-               cell->cell.value);
-    if (!new_acct)
-        return FALSE;
-
-    split = gnc_split_register_get_current_split(reg);
-    gnc_split_register_set_cell_fractions (reg, split);
-
-    /* See if we need to reset the exchange rate. */
-    if (gnc_split_reg_has_rate_cell(reg->type))
-    {
-        PriceCell     *rate_cell = (PriceCell *) gnc_table_layout_get_cell (reg->table->layout,
-                                                                            RATE_CELL);
-        Account       *orig_acct = xaccSplitGetAccount(split);
-        gnc_commodity *orig_com  = xaccAccountGetCommodity(orig_acct);
-        gnc_commodity *last_com  = xaccAccountGetCommodity(info->rate_account);
-        gnc_commodity *new_com   = xaccAccountGetCommodity(new_acct);
-
-        if (gnc_commodity_equal(last_com ? last_com : orig_com, new_com))
-        {
-            DEBUG("Commodity is still %s. Leaving rate unchanged.",
-                  new_com  ? gnc_commodity_get_mnemonic(new_com) : "NULL");
-        }
-        else if (!gnc_commodity_equal(orig_com, new_com))
-        {
-            /* The commodity has changed but is not the original. Reset the rate. */
-            DEBUG("Commodity now %s (originally %s). Clearing rate.",
-                  new_com  ? gnc_commodity_get_mnemonic(new_com) : "NULL",
-                  orig_com ? gnc_commodity_get_mnemonic(orig_com) : "NULL");
-
-            gnc_price_cell_set_value (rate_cell, gnc_numeric_zero());
-            info->rate_account = new_acct;
-            info->rate_reset = RATE_RESET_REQD;
-        }
-        else
-        {
-            /* Get the original rate from the split. */
-            gnc_numeric amt       = xaccSplitGetAmount(split);
-            gnc_numeric val       = xaccSplitGetValue(split);
-            gnc_numeric orig_rate = gnc_numeric_div(amt, val, GNC_DENOM_AUTO,
-                                                    GNC_HOW_DENOM_REDUCE);
-
-            if (!gnc_numeric_check(orig_rate))
-            {
-                DEBUG("Using original rate of %s.",
-                      gnc_num_dbg_to_string(orig_rate));
-                gnc_price_cell_set_value (rate_cell, orig_rate);
-                info->rate_account = new_acct;
-                info->rate_reset = RATE_RESET_NOT_REQD;
-            }
-            else
-            {
-                DEBUG("Can't get rate. Using zero.");
-                gnc_price_cell_set_value (rate_cell, gnc_numeric_zero());
-                info->rate_account = new_acct;
-                info->rate_reset = RATE_RESET_REQD;
-            }
-        }
-    }
-
-    return TRUE;
-}
-
-static void
-gnc_split_register_move_cursor (VirtualLocation *p_new_virt_loc,
-                                gpointer user_data)
-{
-    VirtualLocation new_virt_loc = *p_new_virt_loc;
-    VirtualCellLocation old_trans_split_loc;
-    SplitRegister *reg = user_data;
-    Transaction *pending_trans;
-    Transaction *new_trans;
-    Transaction *old_trans;
-    Split *old_trans_split;
-    Split *new_trans_split;
-    Split *new_split;
-    Split *old_split;
-    CursorClass new_class;
-    CursorClass old_class;
-    gboolean exact_traversal;
-    gboolean do_refresh;
-    gboolean saved;
-    SRInfo *info;
-
-    ENTER("reg=%p, p_new_virt_loc=%p (%d, %d)",
-          reg, p_new_virt_loc,
-          new_virt_loc.vcell_loc.virt_row,
-          new_virt_loc.vcell_loc.virt_col);
-
-    if (!reg)
-    {
-        LEAVE("no register");
-        return;
-    }
-
-    info = gnc_split_register_get_info (reg);
-
-    /* The transaction we are coming from */
-    old_split = gnc_split_register_get_current_split (reg);
-    old_trans = gnc_split_register_get_current_trans (reg);
-    old_trans_split =
-        gnc_split_register_get_current_trans_split (reg, &old_trans_split_loc);
-    old_class = gnc_split_register_get_current_cursor_class (reg);
-
-    exact_traversal = info->exact_traversal;
-
-    if (info->traverse_to_new)
-    {
-        if (old_class == CURSOR_CLASS_SPLIT)
-            new_trans = old_trans;
-        else
-            new_trans = NULL;
-
-        new_split = NULL;
-        new_trans_split = NULL;
-        new_class = CURSOR_CLASS_NONE;
-    }
-    else if (!info->hint_set_by_traverse)
-    {
-        /* The transaction where we are moving to */
-        new_trans = gnc_split_register_get_trans (reg, new_virt_loc.vcell_loc);
-
-        /* The split we are moving to */
-        new_split = gnc_split_register_get_split (reg, new_virt_loc.vcell_loc);
-
-        /* The split at the transaction line we are moving to */
-        new_trans_split = gnc_split_register_get_trans_split
-                          (reg, new_virt_loc.vcell_loc, NULL);
-
-        new_class = gnc_split_register_get_cursor_class (reg,
-                    new_virt_loc.vcell_loc);
-    }
-    else
-    {
-        new_trans = info->cursor_hint_trans;
-        new_split = info->cursor_hint_split;
-        new_trans_split = info->cursor_hint_trans_split;
-        new_class = info->cursor_hint_cursor_class;
-    }
-
-    info->hint_set_by_traverse = FALSE;
-    info->reg_loaded = FALSE;
-
-    gnc_suspend_gui_refresh ();
-
-    /* commit the contents of the cursor into the database */
-    saved = gnc_split_register_save (reg, old_trans != new_trans);
-    pending_trans = xaccTransLookup (&info->pending_trans_guid,
-                                     gnc_get_current_book ());
-    if ((old_class == CURSOR_CLASS_SPLIT) &&
-            old_split &&
-            (old_split != new_split) &&
-            gnc_split_register_old_split_empty_p(reg, old_split))
-    {
-        int current_row;
-
-        xaccSplitDestroy(old_split);
-        old_split = NULL;
-
-        /*
-         * If the user is moving down a row, we've just thrown off the
-         * numbers by deleting a split. Correct for that.
-         */
-        current_row = reg->table->current_cursor_loc.vcell_loc.virt_row;
-        if (new_virt_loc.vcell_loc.virt_row > current_row)
-            new_virt_loc.vcell_loc.virt_row--;
-    }
-    else if ((pending_trans != NULL)      &&
-             (pending_trans == old_trans) &&
-             (old_trans != new_trans))
-    {
-        if (gnc_split_register_balance_trans (reg, pending_trans))
-        {
-            /* Trans was unbalanced. */
-            new_trans = old_trans;
-            new_split = old_split;
-            new_trans_split = old_trans_split;
-            new_class = old_class;
-            new_virt_loc = reg->table->current_cursor_loc;
-        }
-        else
-        {
-            /* Trans was balanced. Let it go. */
-            info->pending_trans_guid = *guid_null ();
-            if (xaccTransIsOpen (pending_trans))
-                xaccTransCommitEdit (pending_trans);
-            else g_assert_not_reached();
-
-            pending_trans = NULL;
-            saved = TRUE;
-        }
-    }
-    else if (old_trans &&
-             (old_trans != new_trans) &&
-             !xaccTransHasReconciledSplits(old_trans) &&
-             !info->first_pass &&
-             gnc_split_register_balance_trans (reg, old_trans))
-    {
-        /* no matter what, stay there so the user can see what happened */
-        new_trans = old_trans;
-        new_split = old_split;
-        new_trans_split = old_trans_split;
-        new_class = old_class;
-        new_virt_loc = reg->table->current_cursor_loc;
-    }
-
-    if (saved)
-    {
-        info->cursor_hint_trans = new_trans;
-        info->cursor_hint_split = new_split;
-        info->cursor_hint_trans_split = new_trans_split;
-        info->cursor_hint_cursor_class = new_class;
-    }
-
-    if (old_split != new_split)
-    {
-        info->change_confirmed = FALSE;
-        info->rate_account = NULL;
-        info->rate_reset = RATE_RESET_NOT_REQD;
-    }
-
-    gnc_resume_gui_refresh ();
-
-    /* redrawing the register can muck everything up */
-    if (saved)
-    {
-        VirtualCellLocation vcell_loc;
-
-        if (!info->reg_loaded)
-            gnc_split_register_redraw (reg);
-
-        /* if the split we were going to is still in the register,
-         * then it may have moved. Find out where it is now. */
-        if (gnc_split_register_find_split (reg, new_trans, new_trans_split,
-                                           new_split, new_class, &vcell_loc))
-        {
-
-            gnc_table_get_virtual_cell (reg->table, vcell_loc);
-            new_virt_loc.vcell_loc = vcell_loc;
-        }
-        else
-            new_virt_loc.vcell_loc = reg->table->current_cursor_loc.vcell_loc;
-
-        new_trans = gnc_split_register_get_trans (reg, new_virt_loc.vcell_loc);
-        new_split = gnc_split_register_get_split (reg, new_virt_loc.vcell_loc);
-        new_trans_split = gnc_split_register_get_trans_split(
-                              reg, new_virt_loc.vcell_loc, NULL);
-        new_class = gnc_split_register_get_cursor_class (reg,
-                    new_virt_loc.vcell_loc);
-    }
-    else if (info->traverse_to_new)
-    {
-        new_trans = info->cursor_hint_trans;
-        new_split = info->cursor_hint_split;
-        new_trans_split = info->cursor_hint_trans_split;
-        new_class = info->cursor_hint_cursor_class;
-    }
-
-    gnc_table_find_close_valid_cell (reg->table, &new_virt_loc, exact_traversal);
-
-    *p_new_virt_loc = new_virt_loc;
-
-    PINFO ("after move %d %d \n",
-           new_virt_loc.vcell_loc.virt_row,
-           new_virt_loc.vcell_loc.virt_col);
-
-    /* if the register was reloaded, then everything should be fine :)
-     * otherwise, we may need to change some visibility settings. */
-    if (saved)
-    {
-        gnc_split_register_set_cell_fractions (reg, new_split);
-
-        LEAVE("saved");
-        return;
-    }
-
-    /* in the mult-line and dynamic modes, we need to hide the old
-     * and show the new. */
-    if (gnc_split_register_current_trans_expanded (reg) &&
-            (old_trans_split != new_trans_split))
-    {
-        VirtualCellLocation vc_loc;
-
-        vc_loc = old_trans_split_loc;
-        gnc_table_set_virt_cell_cursor(
-            reg->table, vc_loc, gnc_split_register_get_passive_cursor (reg));
-        gnc_split_register_set_trans_visible (reg, vc_loc, FALSE,
-                                              reg->style == REG_STYLE_JOURNAL);
-
-        if ((REG_STYLE_AUTO_LEDGER == reg->style) ||
-                (REG_STYLE_JOURNAL     == reg->style))
-        {
-            gnc_split_register_get_trans_split (reg, new_virt_loc.vcell_loc,
-                                                &vc_loc);
-            gnc_table_set_virt_cell_cursor
-            (reg->table, vc_loc, gnc_split_register_get_active_cursor (reg));
-            gnc_split_register_set_trans_visible (reg, vc_loc, TRUE,
-                                                  reg->style == REG_STYLE_JOURNAL);
-        }
-
-        info->trans_expanded = FALSE;
-
-        do_refresh = TRUE;
-    }
-    else
-        do_refresh = FALSE;
-
-    info->cursor_hint_trans = new_trans;
-    info->cursor_hint_split = new_split;
-    info->cursor_hint_trans_split = new_trans_split;
-    info->cursor_hint_cursor_class = new_class;
-
-    gnc_split_register_set_cell_fractions (reg, new_split);
-
-    gnc_table_find_close_valid_cell (reg->table, p_new_virt_loc,
-                                     exact_traversal);
-
-    if (do_refresh)
-    {
-        VirtualCellLocation vc_loc;
-
-        gnc_table_refresh_gui (reg->table, FALSE);
-        gnc_table_leave_update (reg->table, reg->table->current_cursor_loc);
-
-        gnc_split_register_get_trans_split (reg, p_new_virt_loc->vcell_loc,
-                                            &vc_loc);
-        gnc_split_register_show_trans (reg, vc_loc);
-    }
-
-    LEAVE(" ");
-}
-
-static Split *
-gnc_find_split_in_trans_by_memo (Transaction *trans, const char *memo,
-                                 gboolean unit_price)
-{
-    int i = 0;
-    Split *split;
-
-    while ((split = xaccTransGetSplit(trans, i)) != NULL)
-    {
-        i++;
-        if (unit_price)
-        {
-            gnc_numeric price = xaccSplitGetSharePrice (split);
-            if (!gnc_numeric_equal (price, gnc_numeric_create (1, 1)))
-                continue;
-        }
-
-        if (g_strcmp0 (memo, xaccSplitGetMemo (split)) == 0)
-            return split;
-    }
-
-    return NULL;
-}
-
-static Split *
-gnc_find_split_in_account_by_memo (Account *account, const char *memo,
-                                   gboolean unit_price)
-{
-    GList *slp;
-
-    if (account == NULL) return NULL;
-
-    for (slp = g_list_last (xaccAccountGetSplitList (account));
-            slp;
-            slp = slp->prev)
-    {
-        Split *split = slp->data;
-        Transaction *trans = xaccSplitGetParent (split);
-
-        split = gnc_find_split_in_trans_by_memo (trans, memo, unit_price);
-
-        if (split) return split;
-    }
-
-    return NULL;
-}
-
-static Split *
-gnc_find_split_in_reg_by_memo (SplitRegister *reg, const char *memo,
-                               gboolean unit_price)
-{
-    int virt_row, virt_col;
-    int num_rows, num_cols;
-    Transaction *last_trans;
-
-    if (!reg || !reg->table)
-        return NULL;
-
-    num_rows = reg->table->num_virt_rows;
-    num_cols = reg->table->num_virt_cols;
-
-    last_trans = NULL;
-
-    for (virt_row = num_rows - 1; virt_row >= 0; virt_row--)
-        for (virt_col = num_cols - 1; virt_col >= 0; virt_col--)
-        {
-            Split *split;
-            Transaction *trans;
-            VirtualCellLocation vcell_loc = { virt_row, virt_col };
-
-            split = gnc_split_register_get_split (reg, vcell_loc);
-            trans = xaccSplitGetParent (split);
-
-            if (trans == last_trans)
-                continue;
-
-            split = gnc_find_split_in_trans_by_memo (trans, memo, unit_price);
-            if (split != NULL)
-                return split;
-
-            last_trans = trans;
-        }
-
-    return NULL;
-}
-
-static Transaction *
-gnc_find_trans_in_reg_by_desc (SplitRegister *reg, const char *description)
-{
-    int virt_row, virt_col;
-    int num_rows, num_cols;
-    Transaction *last_trans;
-
-    if (!reg || !reg->table)
-        return NULL;
-
-    num_rows = reg->table->num_virt_rows;
-    num_cols = reg->table->num_virt_cols;
-
-    last_trans = NULL;
-
-    for (virt_row = num_rows - 1; virt_row >= 0; virt_row--)
-        for (virt_col = num_cols - 1; virt_col >= 0; virt_col--)
-        {
-            Split *split;
-            Transaction *trans;
-            VirtualCellLocation vcell_loc = { virt_row, virt_col };
-
-            split = gnc_split_register_get_split (reg, vcell_loc);
-            trans = xaccSplitGetParent(split);
-
-            if (trans == last_trans)
-                continue;
-
-            if (g_strcmp0 (description, xaccTransGetDescription (trans)) == 0)
-                return trans;
-
-            last_trans = trans;
-        }
-
-    return NULL;
-}
-
-/* This function determines if auto-completion is appropriate and,
- * if so, performs it. This should only be called by LedgerTraverse. */
-static gboolean
-gnc_split_register_auto_completion (SplitRegister *reg,
-                                    gncTableTraversalDir dir,
-                                    VirtualLocation *p_new_virt_loc)
-{
-    SRInfo *info = gnc_split_register_get_info (reg);
-    VirtualLocation new_virt_loc;
-    CursorClass cursor_class;
-    Transaction *pending_trans;
-    Transaction *blank_trans;
-    const char *cell_name;
-    Transaction *trans;
-    Split *blank_split;
-    gnc_numeric amount;
-    BasicCell *cell;
-    Split *split;
-
-    if (!reg->do_auto_complete)
-        return FALSE;
-
-    blank_split = xaccSplitLookup (&info->blank_split_guid,
-                                   gnc_get_current_book ());
-    blank_trans = xaccSplitGetParent (blank_split);
-
-    pending_trans = xaccTransLookup (&info->pending_trans_guid,
-                                     gnc_get_current_book ());
-
-    /* auto-completion is only triggered by a tab out */
-    if (dir != GNC_TABLE_TRAVERSE_RIGHT)
-        return FALSE;
-
-    split = gnc_split_register_get_current_split (reg);
-    trans = gnc_split_register_get_current_trans (reg);
-    if (trans == NULL)
-        return FALSE;
-
-    cursor_class = gnc_split_register_get_current_cursor_class (reg);
-    cell_name = gnc_table_get_current_cell_name (reg->table);
-
-    switch (cursor_class)
-    {
-    case CURSOR_CLASS_TRANS:
-    {
-        Transaction *auto_trans;
-        const char *desc;
-
-        /* there must be a blank transaction * */
-        if (blank_trans == NULL)
-            return FALSE;
-
-        /* we must be on the blank split */
-        if (trans != blank_trans)
-            return FALSE;
-
-        /* and leaving the description cell */
-        if (!gnc_cell_name_equal (cell_name, DESC_CELL))
-            return FALSE;
-
-        /* nothing but the date, num, and description should be changed */
-        /* FIXME, this should be refactored. */
-        if (gnc_table_layout_get_cell_changed (reg->table->layout,
-                                               XFRM_CELL, TRUE)  ||
-                gnc_table_layout_get_cell_changed (reg->table->layout,
-                        MXFRM_CELL, TRUE) ||
-                gnc_table_layout_get_cell_changed (reg->table->layout,
-                        PRIC_CELL, TRUE)  ||
-                gnc_table_layout_get_cell_changed (reg->table->layout,
-                        SHRS_CELL, TRUE)  ||
-                gnc_table_layout_get_cell_changed (reg->table->layout,
-                        DEBT_CELL, TRUE)  ||
-                gnc_table_layout_get_cell_changed (reg->table->layout,
-                        CRED_CELL, TRUE)  ||
-                gnc_table_layout_get_cell_changed (reg->table->layout,
-                        NOTES_CELL, TRUE) ||
-                gnc_table_layout_get_cell_changed (reg->table->layout,
-                        RECN_CELL, TRUE))
-            return FALSE;
-
-        /* and the description should be changed */
-        if (!gnc_table_layout_get_cell_changed (reg->table->layout,
-                                                DESC_CELL, TRUE))
-            return FALSE;
-
-        /* to a non-empty value */
-        desc = gnc_table_layout_get_cell_value (reg->table->layout, DESC_CELL);
-        if ((desc == NULL) || (*desc == '\0'))
-            return FALSE;
-
-        /* find a transaction to auto-complete on */
-        if (gnc_split_register_get_default_account (reg) != NULL)
-        {
-            Account *account = gnc_split_register_get_default_account (reg);
-
-            auto_trans = xaccAccountFindTransByDesc(account, desc);
-        }
-        else
-            auto_trans = gnc_find_trans_in_reg_by_desc(reg, desc);
-
-        if (auto_trans == NULL)
-            return FALSE;
-
-        gnc_suspend_gui_refresh ();
-
-        /* We are guaranteed to be on the blank trans, so we can
-           discount the possibility that the current transaction is
-           being edited in another register. */
-        /* now perform the completion */
-        if (pending_trans != trans)
-        {
-            if (!xaccTransIsOpen(trans))
-                xaccTransBeginEdit(trans);
-            /* This is now the pending transaction */
-            info->pending_trans_guid = *xaccTransGetGUID(trans);
-            if (pending_trans != NULL)
-            {
-                if (xaccTransIsOpen (pending_trans))
-                    xaccTransCommitEdit (pending_trans);
-                else g_assert_not_reached();
-            }
-        }
-        g_assert(xaccTransIsOpen(trans));
-        pending_trans = xaccTransLookup(&info->pending_trans_guid,
-                                        gnc_get_current_book ());
-        g_assert(pending_trans == trans);
-
-        gnc_copy_trans_onto_trans (auto_trans, trans, FALSE, FALSE);
-        blank_split = NULL;
-
-        if (gnc_split_register_get_default_account (reg) != NULL)
-        {
-            Account *default_account =
-                gnc_split_register_get_default_account (reg);
-            gnc_commodity *trans_cmdty = xaccTransGetCurrency(trans);
-            gnc_commodity *acct_cmdty = xaccAccountGetCommodity(default_account);
-            Split *s;
-            int i = 0;
-            if (gnc_commodity_is_currency(acct_cmdty) &&
-                !gnc_commodity_equal(trans_cmdty, acct_cmdty))
-                xaccTransSetCurrency(trans, acct_cmdty);
-
-            while ((s = xaccTransGetSplit(trans, i)) != NULL)
-            {
-                if (default_account == xaccSplitGetAccount(s))
-                {
-                    blank_split = s;
-                    info->blank_split_guid = *xaccSplitGetGUID(blank_split);
-                    break;
-                }
-                i++;
-            }
-        }
-
-        if (blank_split == NULL)
-        {
-            blank_split = xaccTransGetSplit(trans, 0);
-            info->blank_split_guid = *xaccSplitGetGUID(blank_split);
-        }
-        DEBUG("blank_split=%p", blank_split);
-
-        info->blank_split_edited = TRUE;
-
-        {
-            SRSaveData *sd;
-
-            sd = gnc_split_register_save_data_new(
-                     trans, blank_split, gnc_split_register_current_trans_expanded (reg));
-            gnc_table_save_cells (reg->table, sd);
-            gnc_split_register_save_data_destroy (sd);
-        }
-
-        gnc_resume_gui_refresh ();
-
-        /* now move to the non-empty amount column unless config setting says not */
-        if ( !gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL_REGISTER,
-                                 GNC_PREF_TAB_TRANS_MEMORISED) )
-        {
-            amount = xaccSplitGetAmount (blank_split);
-            cell_name = (gnc_numeric_negative_p (amount)) ? CRED_CELL : DEBT_CELL;
-
-            if (gnc_table_get_current_cell_location (reg->table, cell_name,
-                    &new_virt_loc))
-                *p_new_virt_loc = new_virt_loc;
-        }
-    }
-
-    break;
-
-    case CURSOR_CLASS_SPLIT:
-    {
-        char *account_name;
-        const char *memo;
-        gboolean unit_price;
-        Split *auto_split;
-
-        /* we must be on a blank split of a transaction */
-        if (split != NULL)
-            return FALSE;
-
-        /* and leaving the memo cell */
-        if (!gnc_cell_name_equal (cell_name, MEMO_CELL))
-            return FALSE;
-
-        /* nothing but the action, memo, and amounts should be changed */
-        /* FIXME. This should be refactored. */
-        if (gnc_table_layout_get_cell_changed (reg->table->layout,
-                                               XFRM_CELL, TRUE)  ||
-                gnc_table_layout_get_cell_changed (reg->table->layout,
-                        MXFRM_CELL, TRUE) ||
-                gnc_table_layout_get_cell_changed (reg->table->layout,
-                        PRIC_CELL, TRUE)  ||
-                gnc_table_layout_get_cell_changed (reg->table->layout,
-                        SHRS_CELL, TRUE)  ||
-                gnc_table_layout_get_cell_changed (reg->table->layout,
-                        RECN_CELL, TRUE))
-            return FALSE;
-
-        /* and the memo should be changed */
-        if (!gnc_table_layout_get_cell_changed (reg->table->layout,
-                                                MEMO_CELL, TRUE))
-            return FALSE;
-
-        /* to a non-empty value */
-        memo = gnc_table_layout_get_cell_value (reg->table->layout, MEMO_CELL);
-        if ((memo == NULL) || (*memo == '\0'))
-            return FALSE;
-
-        /* if there is no price field, only auto-complete from splits with
-         * a unit share price. */
-        unit_price = !gnc_table_get_current_cell_location (reg->table,
-                     PRIC_CELL, NULL);
-
-        /* find a split to auto-complete on */
-        if (gnc_split_register_get_default_account (reg) != NULL)
-        {
-            Account *account = gnc_split_register_get_default_account (reg);
-
-            auto_split = gnc_find_split_in_account_by_memo (account, memo,
-                         unit_price);
-        }
-        else
-            auto_split = gnc_find_split_in_reg_by_memo (reg, memo, unit_price);
-
-        if (auto_split == NULL)
-            return FALSE;
-
-        /* the auto-complete code below is taken from xaccSRGetEntryHandler */
-
-        /* auto-complete the action field if it wasn't changed */
-        if (!gnc_table_layout_get_cell_changed (reg->table->layout,
-                                                ACTN_CELL, TRUE))
-        {
-            cell = gnc_table_layout_get_cell (reg->table->layout, ACTN_CELL);
-            gnc_combo_cell_set_value ((ComboCell *) cell,
-                                      gnc_get_num_action (NULL, auto_split));
-        }
-
-        /* auto-complete the account name */
-        cell = gnc_table_layout_get_cell (reg->table->layout, XFRM_CELL);
-
-        account_name = gnc_get_account_name_for_register (xaccSplitGetAccount (auto_split));
-        gnc_combo_cell_set_value ((ComboCell *) cell, account_name);
-        g_free(account_name);
-
-        gnc_basic_cell_set_changed (cell, TRUE);
-
-        if (!gnc_table_layout_get_cell_changed (reg->table->layout,
-                                                DEBT_CELL, TRUE) &&
-                !gnc_table_layout_get_cell_changed (reg->table->layout,
-                        CRED_CELL, TRUE))
-        {
-            BasicCell *debit_cell;
-            BasicCell *credit_cell;
-
-            amount = xaccSplitGetValue (auto_split);
-
-            debit_cell = gnc_table_layout_get_cell (reg->table->layout,
-                                                    DEBT_CELL);
-            credit_cell = gnc_table_layout_get_cell (reg->table->layout,
-                          CRED_CELL);
-
-            gnc_price_cell_set_debt_credit_value ((PriceCell *) debit_cell,
-                                                  (PriceCell *) credit_cell,
-                                                  amount);
-
-            gnc_basic_cell_set_changed (debit_cell, TRUE);
-            gnc_basic_cell_set_changed (credit_cell, TRUE);
-        }
-
-        /* and refresh the gui */
-        gnc_table_refresh_gui (reg->table, TRUE);
-
-        /* now move to the non-empty amount column */
-        amount = xaccSplitGetAmount (auto_split);
-        cell_name = (gnc_numeric_negative_p (amount)) ? CRED_CELL : DEBT_CELL;
-
-        if (gnc_table_get_current_cell_location (reg->table, cell_name,
-                &new_virt_loc))
-            *p_new_virt_loc = new_virt_loc;
-    }
-
-    break;
-
-    default:
-        break;
-    }
-
-    return TRUE;
-}
-
-static void
-gnc_split_register_check_stock_action (SplitRegister *reg,
-                                       const char *cell_name)
-{
-    BasicCell *cell;
-    gnc_numeric shares;
-    gboolean buy, sell;
-    const char *name;
-
-    if (!gnc_cell_name_equal (cell_name, ACTN_CELL) ||
-            !gnc_table_layout_get_cell_changed (reg->table->layout,
-                    ACTN_CELL, FALSE))
-        return;
-
-    cell = gnc_table_layout_get_cell (reg->table->layout, ACTN_CELL);
-    if (!cell)
-        return;
-    name = ((ComboCell *)cell)->cell.value;
-    if ((name == NULL) || (*name == '\0'))
-        return;
-
-    buy  = g_strcmp0 (name, ACTION_BUY_STR)  == 0;
-    sell = g_strcmp0 (name, ACTION_SELL_STR) == 0;
-    if (!buy && !sell)
-        return;
-
-    cell = gnc_table_layout_get_cell (reg->table->layout, SHRS_CELL);
-    if (!cell)
-        return;
-    shares = gnc_price_cell_get_value ((PriceCell *) cell);
-
-    if ((buy  && !gnc_numeric_positive_p (shares)) ||
-            (sell &&  gnc_numeric_positive_p (shares)))
-    {
-        gnc_price_cell_set_value ((PriceCell *)cell, gnc_numeric_neg (shares));
-        gnc_basic_cell_set_changed (cell, TRUE);
-    }
-}
-
-static void
-gnc_split_register_check_stock_shares (SplitRegister *reg,
-                                       const char *cell_name)
-{
-    BasicCell *cell;
-    gnc_numeric shares;
-    gboolean buy;
-    const char *name;
-
-    if (!gnc_cell_name_equal (cell_name, SHRS_CELL) ||
-            !gnc_table_layout_get_cell_changed (reg->table->layout,
-                    SHRS_CELL, FALSE))
-        return;
-
-    cell = gnc_table_layout_get_cell (reg->table->layout, SHRS_CELL);
-    if (!cell)
-        return;
-    shares = gnc_price_cell_get_value ((PriceCell *) cell);
-    if (gnc_numeric_zero_p (shares))
-        return;
-    buy  = gnc_numeric_positive_p (shares);
-
-    cell = gnc_table_layout_get_cell (reg->table->layout, ACTN_CELL);
-    if (!cell)
-        return;
-    name = ((ComboCell *)cell)->cell.value;
-
-    if (!g_strcmp0(name, "") ||
-            !g_strcmp0(name, buy ? ACTION_SELL_STR : ACTION_BUY_STR))
-    {
-        gnc_combo_cell_set_value((ComboCell *)cell,
-                                 buy ? ACTION_BUY_STR : ACTION_SELL_STR);
-        gnc_basic_cell_set_changed (cell, TRUE);
-    }
-}
-
-/* This function checks a cell for changes and takes appropriate action if a
- * change has occurred. It is recommended to call this function just before
- * leaving a cell. Returns FALSE if control should remain in this cell. For
- * example, the user may have made a mistake and needs another chance to
- * edit the information before moving on. */
-gboolean
-gnc_split_register_check_cell (SplitRegister *reg, const char *cell_name)
-{
-    ENTER("reg=%p, cell_name=%s", reg, cell_name ? cell_name : "NULL");
-
-    /* See if we are leaving an account field. */
-    if (!gnc_split_register_check_account (reg, cell_name))
-    {
-        LEAVE("account check failed");
-        return FALSE;
-    }
-
-    /* See if we are leaving a debit or credit cell */
-    if (!gnc_split_register_check_debcred (reg, cell_name))
-    {
-        LEAVE("debit/credit check failed");
-        return FALSE;
-    }
-
-    /* See if we are leaving an action field */
-    if ((reg->type == STOCK_REGISTER) ||
-            (reg->type == PORTFOLIO_LEDGER) ||
-            (reg->type == CURRENCY_REGISTER))
-    {
-        gnc_split_register_check_stock_action (reg, cell_name);
-        gnc_split_register_check_stock_shares (reg, cell_name);
-    }
-
-    LEAVE(" ");
-    return TRUE;
-}
-
-static Account *
-gnc_split_register_get_account_always (SplitRegister *reg,
-                                       const char * cell_name)
-{
-    BasicCell *cell;
-    const char *name;
-
-    cell = gnc_table_layout_get_cell (reg->table->layout, cell_name);
-    if (!cell)
-        return NULL;
-    name = gnc_basic_cell_get_value (cell);
-
-    /* If 'name' is "-- Split Transaction --" then return NULL or the
-       register acct */
-    if (!g_strcmp0 (name, SPLIT_TRANS_STR))
-    {
-        return NULL;
-    }
-
-    return gnc_split_register_get_account_by_name (reg, cell, name);
-}
-
-#if 0 /* Not Used */
-static const char *
-gnc_split_register_get_cell_string (SplitRegister *reg, const char *cell_name)
-{
-    BasicCell *cell;
-
-    cell = gnc_table_layout_get_cell (reg->table->layout, cell_name);
-    if (!cell)
-        return "";
-
-    return gnc_basic_cell_get_value (cell);
-}
-
-static Timespec
-gnc_split_register_get_cell_date (SplitRegister *reg, const char *cell_name)
-{
-    DateCell *cell;
-    Timespec ts;
-
-    cell = (DateCell*) gnc_table_layout_get_cell (reg->table->layout, cell_name);
-
-    if (cell)
-        gnc_date_cell_get_date (cell, &ts);
-    else
-        timespecFromTime64 (&ts, gnc_time (NULL));
-
-    return ts;
-}
-#endif /* Not Used */
-
-/* Creates a transfer dialog and fills its values from register cells (if
- * available) or from the provided transaction and split.
- */
-static XferDialog *
-gnc_split_register_xfer_dialog(SplitRegister *reg, Transaction *txn,
-                               Split *split)
-{
-    XferDialog *xfer;
-    CellBlock *cur;
-    BasicCell *cell;
-
-    g_return_val_if_fail(reg, NULL);
-    g_return_val_if_fail(reg->table, NULL);
-    cur = reg->table->current_cursor;
-
-    /* Create the exchange rate dialog. */
-    xfer = gnc_xfer_dialog(NULL, NULL);
-    g_return_val_if_fail(xfer, NULL);
-
-    /* Set the description. */
-    cell = gnc_cellblock_get_cell_by_name(cur, DESC_CELL, NULL, NULL);
-    if (cell)
-        gnc_xfer_dialog_set_description(xfer, gnc_basic_cell_get_value(cell));
-    else
-    {
-        const char *str = xaccTransGetDescription(txn);
-        gnc_xfer_dialog_set_description(xfer, str ? str : "");
-    }
-
-    /* Set the memo. */
-    cell = gnc_cellblock_get_cell_by_name(cur, MEMO_CELL, NULL, NULL);
-    if (cell)
-        gnc_xfer_dialog_set_memo(xfer, gnc_basic_cell_get_value(cell));
-    else
-    {
-        const char *str = xaccSplitGetMemo(split);
-        gnc_xfer_dialog_set_memo(xfer, str ? str : "");
-    }
-
-    /* Set the num. */
-    cell = gnc_cellblock_get_cell_by_name(cur, NUM_CELL, NULL, NULL);
-    if (cell)
-        gnc_xfer_dialog_set_num(xfer, gnc_basic_cell_get_value(cell));
-    else
-    {
-        const char *str = gnc_get_num_action (txn, split);
-        gnc_xfer_dialog_set_num(xfer, str ? str : "");
-    }
-
-    /* Set the date. */
-    cell = gnc_cellblock_get_cell_by_name(cur, DATE_CELL, NULL, NULL);
-    if (cell)
-    {
-        Timespec ts;
-        gnc_date_cell_get_date((DateCell*) cell, &ts);
-        gnc_xfer_dialog_set_date(xfer, timespecToTime64(ts));
-    }
-    else
-        gnc_xfer_dialog_set_date(xfer, xaccTransGetDate(txn));
-
-    return xfer;
-}
-
-/** If needed display the transfer dialog to get a price/exchange rate and
- * adjust the price cell accordingly.
- * If the dialog does not complete successfully, then return TRUE.
- * Return FALSE in all other cases (meaning "move on")
- * @param reg the register to operate on
- * @param force_dialog pop a dialog even if we don't think we need it.
- * @return whether more handling is required.
- */
-gboolean
-gnc_split_register_handle_exchange (SplitRegister *reg, gboolean force_dialog)
-{
-    SRInfo *info;
-    Transaction *txn;
-    Split *split, *osplit;
-    Account *xfer_acc, *reg_acc;
-    gnc_commodity *txn_cur, *xfer_com, *reg_com;
-    gnc_numeric amount, exch_rate;
-    XferDialog *xfer;
-    gboolean expanded = FALSE;
-    PriceCell *rate_cell;
-    const char *message;
-    CursorClass cursor_class;
-
-    ENTER("reg=%p, force_dialog=%s", reg, force_dialog ? "TRUE" : "FALSE" );
-
-    /* Make sure we NEED this for this type of register */
-    if (!gnc_split_reg_has_rate_cell (reg->type))
-    {
-        if (force_dialog)
-        {
-            message = _("This register does not support editing exchange rates.");
-            gnc_error_dialog(gnc_split_register_get_parent(reg), "%s", message);
-        }
-        LEAVE("no rate cell");
-        return FALSE;
-    }
-
-    rate_cell = (PriceCell*) gnc_table_layout_get_cell(
-                    reg->table->layout, RATE_CELL);
-    if (!rate_cell)
-    {
-        if (force_dialog)
-        {
-            message = _("This register does not support editing exchange rates.");
-            gnc_error_dialog(gnc_split_register_get_parent(reg), "%s", message);
-        }
-        LEAVE("null rate cell");
-        return FALSE;
-    }
-
-    /* See if we already have an exchange rate... */
-    info = gnc_split_register_get_info (reg);
-    exch_rate = gnc_price_cell_get_value (rate_cell);
-    if (!gnc_numeric_zero_p(exch_rate) && !force_dialog &&
-        info->rate_reset != RATE_RESET_REQD)
-    {
-        LEAVE("rate already non-zero");
-        return FALSE;
-    }
-
-    /* Are we expanded? */
-    expanded = gnc_split_register_current_trans_expanded (reg);
-    cursor_class = gnc_split_register_get_current_cursor_class (reg);
-
-    /* If we're expanded AND a transaction cursor, there is nothing to do */
-    if (expanded && cursor_class == CURSOR_CLASS_TRANS)
-    {
-        if (force_dialog)
-        {
-            message = _("You need to select a split in order to modify its exchange "
-                        "rate.");
-            gnc_error_dialog(gnc_split_register_get_parent(reg), "%s", message);
-        }
-        LEAVE("expanded with transaction cursor; nothing to do");
-        return FALSE;
-    }
-
-    /* Grab the xfer account */
-    xfer_acc = gnc_split_register_get_account_always(
-                   reg, expanded ? XFRM_CELL : MXFRM_CELL);
-
-    /* If this is an un-expanded, multi-split transaction, then warn the user */
-    if (force_dialog && !expanded && !xfer_acc)
-    {
-        message = _("You need to expand the transaction in order to modify its "
-                    "exchange rates.");
-        gnc_error_dialog (gnc_split_register_get_parent (reg), "%s", message);
-        LEAVE("%s", message);
-        return TRUE;
-    }
-
-    /* No account -- don't run the dialog */
-    if (!xfer_acc)
-    {
-        if (force_dialog)
-        {
-            message = _("The entered account could not be found.");
-            gnc_error_dialog(gnc_split_register_get_parent(reg), "%s", message);
-        }
-        LEAVE("no xfer account");
-        return FALSE;
-    }
-
-    /* Grab the txn currency and xfer commodity */
-    txn = gnc_split_register_get_current_trans (reg);
-    txn_cur = xaccTransGetCurrency (txn);
-    xfer_com = xaccAccountGetCommodity (xfer_acc);
-
-    /* Grab the register account and commodity (may be used later) */
-    reg_acc = gnc_split_register_get_default_account (reg);
-    reg_com = xaccAccountGetCommodity (reg_acc);
-
-    /* Grab the split and perhaps the "other" split (if it is a two-split txn) */
-    split = gnc_split_register_get_current_split (reg);
-    osplit = xaccSplitGetOtherSplit (split);
-
-    /* Check if the txn- and xfer- commodities are the same */
-    if (gnc_commodity_equal (txn_cur, xfer_com))
-    {
-        /* If we're not forcing the dialog, then there is no reason to
-         * go on.  We're using the correct accounts.
-         */
-        if (!force_dialog)
-        {
-            LEAVE("txn and account currencies match, and not forcing");
-            return FALSE;
-        }
-
-        /* Only proceed with two-split, basic, non-expanded registers */
-        if (expanded || osplit == NULL)
-        {
-            message = _("The two currencies involved equal each other.");
-            gnc_error_dialog(gnc_split_register_get_parent(reg), "%s", message);
-            LEAVE("register is expanded or osplit == NULL; not forcing dialog");
-            return FALSE;
-        }
-
-        /* If we're forcing, then compare the current account
-         * commodity to the transaction currency.
-         */
-        xfer_acc = reg_acc;
-        xfer_com = reg_com;
-        if (gnc_commodity_equal (txn_cur, xfer_com))
-        {
-            message = _("The two currencies involved equal each other.");
-            gnc_error_dialog(gnc_split_register_get_parent(reg), "%s", message);
-            LEAVE("reg commodity == txn commodity; not forcing");
-            return FALSE;
-        }
-    }
-
-    /* If this is a non-expanded, two-split txn where BOTH splits need
-     * conversion rates, then require the user to actually expand the
-     * transaction in order to edit it.
-     */
-    if (!expanded && osplit &&
-            gnc_split_register_split_needs_amount (reg, split) &&
-            gnc_split_register_split_needs_amount (reg, osplit))
-    {
-        message = _("You need to expand the transaction in order to modify its "
-                    "exchange rates.");
-        if (force_dialog)
-        {
-            gnc_error_dialog (gnc_split_register_get_parent (reg), "%s", message);
-        }
-        LEAVE("%s", message);
-        return TRUE;
-    }
-
-    /* Strangely, if we're in a two-split, non-expanded txn, we need
-     * to do something really special with the exchange rate!  In
-     * particular, we have to pick it up from the _other_ split --
-     * right?
-     * XXX: perhaps I should pop up an error here?  Or maybe require the
-     * user to go into expanded-mode?
-     */
-    if (!expanded && osplit && !gnc_commodity_equal(reg_com, txn_cur) &&
-            !gnc_commodity_equal(reg_com, xfer_com))
-    {
-        gnc_numeric amt = xaccSplitGetAmount (osplit);
-        gnc_numeric val = xaccSplitGetValue (osplit);
-        exch_rate = gnc_numeric_div (amt, val, GNC_DENOM_AUTO, GNC_HOW_DENOM_REDUCE);
-    }
-
-    /* Ok, we need to grab the exchange rate */
-    amount = gnc_split_register_debcred_cell_value (reg);
-
-    /*
-     * If "amount" is zero then we don't need an exchange-rate.. Return
-     * FALSE to let the user continue on.
-     */
-    if (gnc_numeric_zero_p (amount))
-    {
-        if (force_dialog)
-        {
-            message = _("The split's amount is zero, so no exchange rate is needed.");
-            gnc_error_dialog(gnc_split_register_get_parent(reg), "%s", message);
-        }
-        LEAVE("amount is zero; no exchange rate needed");
-        return FALSE;
-    }
-
-    /* If the exch_rate is zero, we're not forcing the dialog, and this is
-     * _not_ the blank split, then return FALSE -- this is a "special"
-     * gain/loss stock transaction.
-     */
-    if (gnc_numeric_zero_p(exch_rate) && !force_dialog && split &&
-            info->rate_reset != RATE_RESET_REQD &&
-            split != gnc_split_register_get_blank_split (reg))
-    {
-        LEAVE("gain/loss split; no exchange rate needed");
-        return FALSE;
-    }
-
-    /* Show the exchange-rate dialog */
-    xfer = gnc_split_register_xfer_dialog(reg, txn, split);
-    gnc_xfer_dialog_is_exchange_dialog(xfer, &exch_rate);
-    if (gnc_xfer_dialog_run_exchange_dialog(
-                xfer, &exch_rate, amount, reg_acc, txn, xfer_com, expanded))
-    {
-        /* FIXME: How should the dialog be destroyed? */
-        LEAVE("leaving rate unchanged");
-        return TRUE;
-    }
-    /* FIXME: How should the dialog be destroyed? */
-
-    /* Set the RATE_CELL on this cursor and mark it changed */
-    gnc_price_cell_set_value (rate_cell, exch_rate);
-    gnc_basic_cell_set_changed (&rate_cell->cell, TRUE);
-    info->rate_account = xfer_acc;
-    info->rate_reset = RATE_RESET_DONE;
-    LEAVE("set rate=%s", gnc_num_dbg_to_string(exch_rate));
-    return FALSE;
-}
-
-/* Returns FALSE if dialog was canceled. */
-static gboolean
-transaction_changed_confirm(VirtualLocation *p_new_virt_loc,
-                            VirtualLocation *virt_loc,
-                            SplitRegister *reg, Transaction *new_trans,
-                            gboolean exact_traversal)
-{
-    GtkWidget *dialog, *window;
-    gint response;
-    const char *title = _("Save the changed transaction?");
-    const char *message =
-        _("The current transaction has been changed. Would you like to "
-          "record the changes before moving to a new transaction, discard the "
-          "changes, or return to the changed transaction?");
-
-    window = gnc_split_register_get_parent(reg);
-    dialog = gtk_message_dialog_new(GTK_WINDOW(window),
-                                    GTK_DIALOG_DESTROY_WITH_PARENT,
-                                    GTK_MESSAGE_QUESTION,
-                                    GTK_BUTTONS_NONE,
-                                    "%s", title);
-    gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
-            "%s", message);
-    gtk_dialog_add_buttons(GTK_DIALOG(dialog),
-                           _("_Discard Changes"), GTK_RESPONSE_REJECT,
-                           _("_Cancel"), GTK_RESPONSE_CANCEL,
-                           _("_Record Changes"), GTK_RESPONSE_ACCEPT,
-                           NULL);
-    response = gnc_dialog_run(GTK_DIALOG(dialog), GNC_PREF_WARN_REG_TRANS_MOD);
-    gtk_widget_destroy(dialog);
-
-    switch (response)
-    {
-    case GTK_RESPONSE_ACCEPT:
-        break;
-
-    case GTK_RESPONSE_REJECT:
-    {
-        VirtualCellLocation vcell_loc;
-        Split *new_split;
-        Split *trans_split;
-        CursorClass new_class;
-
-        new_split = gnc_split_register_get_split (reg, virt_loc->vcell_loc);
-        trans_split = gnc_split_register_get_trans_split (reg,
-                      virt_loc->vcell_loc,
-                      NULL);
-        new_class = gnc_split_register_get_cursor_class (reg,
-                    virt_loc->vcell_loc);
-
-        gnc_split_register_cancel_cursor_trans_changes (reg);
-
-        if (gnc_split_register_find_split (reg, new_trans, trans_split,
-                                           new_split, new_class, &vcell_loc))
-            virt_loc->vcell_loc = vcell_loc;
-
-        gnc_table_find_close_valid_cell (reg->table, virt_loc,
-                                         exact_traversal);
-
-        *p_new_virt_loc = *virt_loc;
-    }
-    break;
-
-    case GTK_RESPONSE_CANCEL:
-    default:
-        return TRUE;
-    }
-
-    return FALSE;
-}
-
-/** Examine a request to traverse to a new location in the register and
- *  decide whether it should be allowed to proceed, and where the new
- *  location will be.
- *
- *  @param p_new_virt_loc a pointer to storage for the new location
- *
- *  @param dir the direction of the traversal
- *
- *  @param user_data pointer to a ::SplitRegister to traverse
- *
- *  @return @c TRUE if the traversal cannot be completed. Otherwise,
- *  @c FALSE is returned and the new location is stored at @a p_new_virt_loc. */
-static gboolean
-gnc_split_register_traverse (VirtualLocation *p_new_virt_loc,
-                             gncTableTraversalDir dir,
-                             gpointer user_data)
-{
-    SplitRegister *reg = user_data;
-    Transaction *pending_trans;
-    VirtualLocation virt_loc;
-    Transaction *trans, *new_trans;
-    gboolean changed;
-    SRInfo *info;
-    Split *split;
-    const char *cell_name;
-
-    g_return_val_if_fail(p_new_virt_loc, TRUE);
-
-    ENTER("reg=%p, p_new_virt_loc=%p (%d,%d), dir=%d",
-          reg, p_new_virt_loc, (*p_new_virt_loc).vcell_loc.virt_row,
-          (*p_new_virt_loc).vcell_loc.virt_col, dir);
-
-    if (!reg)
-    {
-        LEAVE("no register");
-        return FALSE;
-    }
-
-    info = gnc_split_register_get_info (reg);
-
-    if (info->first_pass)
-    {
-        LEAVE("first pass");
-        return FALSE;
-    }
-
-    pending_trans = xaccTransLookup (&info->pending_trans_guid,
-                                     gnc_get_current_book ());
-    virt_loc = *p_new_virt_loc;
-
-    info->exact_traversal = (dir == GNC_TABLE_TRAVERSE_POINTER);
-
-    split = gnc_split_register_get_current_split (reg);
-    trans = gnc_split_register_get_current_trans (reg);
-    if (trans == NULL)
-    {
-        LEAVE("no transaction");
-        return FALSE;
-    }
-
-    /* no changes, make sure we aren't going off the end */
-    changed = gnc_table_current_cursor_changed (reg->table, FALSE);
-    if (!changed && (pending_trans != trans))
-    {
-        gnc_table_find_close_valid_cell (reg->table, &virt_loc,
-                                         info->exact_traversal);
-
-        *p_new_virt_loc = virt_loc;
-
-        LEAVE("no changes");
-        return FALSE;
-    }
-
-    /* Get the current cell-name and check it for changes. */
-    cell_name = gnc_table_get_current_cell_name (reg->table);
-    if (!gnc_split_register_check_cell (reg, cell_name))
-    {
-        LEAVE("check cell");
-        return TRUE;
-    }
-
-    /* See if we are tabbing off the end of the very last line */
-    do
-    {
-        VirtualLocation virt_loc;
-
-        if (!changed && !info->blank_split_edited)
-            break;
-
-        if (dir != GNC_TABLE_TRAVERSE_RIGHT)
-            break;
-
-        virt_loc = reg->table->current_cursor_loc;
-        if (gnc_table_move_vertical_position (reg->table, &virt_loc, 1))
-            break;
-
-        virt_loc = reg->table->current_cursor_loc;
-        if (gnc_table_move_tab (reg->table, &virt_loc, TRUE))
-            break;
-
-        /* Deal with the exchange-rate */
-        if (gnc_split_register_handle_exchange (reg, FALSE))
-        {
-            LEAVE("no exchange rate");
-            return TRUE;
-        }
-
-        *p_new_virt_loc = reg->table->current_cursor_loc;
-        (p_new_virt_loc->vcell_loc.virt_row)++;
-        p_new_virt_loc->phys_row_offset = 0;
-        p_new_virt_loc->phys_col_offset = 0;
-
-        info->traverse_to_new = TRUE;
-
-        LEAVE("off end of last line");
-        return FALSE;
-
-    }
-    while (FALSE);
-
-    /* Now see if we are changing cursors. If not, we may be able to
-     * auto-complete. */
-    if (!gnc_table_virtual_cell_out_of_bounds (reg->table, virt_loc.vcell_loc))
-    {
-        if (gnc_split_register_auto_completion (reg, dir, p_new_virt_loc))
-        {
-            info->auto_complete = TRUE;
-            LEAVE("auto-complete");
-            return FALSE;
-        }
-    }
-
-    /* See if we are tabbing off the end of a blank split */
-    do
-    {
-        VirtualLocation virt_loc;
-        int old_virt_row;
-
-        if (!changed)
-            break;
-
-        if (split)
-            break;
-
-        if (dir != GNC_TABLE_TRAVERSE_RIGHT)
-            break;
-
-        virt_loc = reg->table->current_cursor_loc;
-        old_virt_row = virt_loc.vcell_loc.virt_row;
-
-        if (gnc_table_move_tab (reg->table, &virt_loc, TRUE) &&
-                old_virt_row == virt_loc.vcell_loc.virt_row)
-            break;
-
-        /* If we are here, then: (a) the current cursor has been
-         * edited, and (b) we are on the blank split of a multi-line
-         * transaction, and (c) we are tabbing out of the last cell
-         * on the line. Thus, we want to go ahead and add the new
-         * split and end up on the new blank split of the current
-         * transaction. */
-
-        /* Deal with the exchange-rate */
-        if (gnc_split_register_handle_exchange (reg, FALSE))
-        {
-            LEAVE("no exchange rate");
-            return TRUE;
-        }
-
-        info->cursor_hint_trans = trans;
-        info->cursor_hint_split = split;
-        info->cursor_hint_trans_split =
-            gnc_split_register_get_current_trans_split (reg, NULL);
-        info->cursor_hint_cursor_class = CURSOR_CLASS_SPLIT;
-        info->hint_set_by_traverse = TRUE;
-
-        LEAVE("off end of blank split");
-        return FALSE;
-
-    }
-    while (FALSE);
-
-    {
-        int old_virt_row = reg->table->current_cursor_loc.vcell_loc.virt_row;
-
-        /* Check for going off the end */
-        gnc_table_find_close_valid_cell (reg->table, &virt_loc,
-                                         info->exact_traversal);
-
-
-        /* Did we change vertical position? */
-        if (virt_loc.vcell_loc.virt_row != old_virt_row)
-            /* Deal with the exchange-rate */
-            if (gnc_split_register_handle_exchange (reg, FALSE))
-            {
-                LEAVE("no exchange rate");
-                return TRUE;
-            }
-    }
-
-
-    /* Same transaction, no problem */
-    new_trans = gnc_split_register_get_trans (reg, virt_loc.vcell_loc);
-    if (trans == new_trans)
-    {
-        *p_new_virt_loc = virt_loc;
-        {
-            LEAVE("staying within txn");
-            return FALSE;
-        }
-    }
-
-    /* Ok, we are changing transactions and the current transaction has
-     * changed. See what the user wants to do. */
-    LEAVE("txn change");
-    return transaction_changed_confirm(p_new_virt_loc, &virt_loc, reg,
-                                       new_trans, info->exact_traversal);
-}
-
-TableControl *
-gnc_split_register_control_new (void)
-{
-    TableControl *control = gnc_table_control_new();
-
-    control->move_cursor = gnc_split_register_move_cursor;
-    control->traverse = gnc_split_register_traverse;
-
-    return control;
-}
-
-gboolean
-gnc_split_register_recn_cell_confirm (char old_flag, gpointer data)
-{
-    SplitRegister *reg = data;
-    GtkWidget *dialog, *window;
-    gint response;
-    const gchar *title = _("Mark split as unreconciled?");
-    const gchar *message =
-        _("You are about to mark a reconciled split as unreconciled. Doing "
-          "so might make future reconciliation difficult! Continue "
-          "with this change?");
-
-    if (old_flag != YREC)
-        return TRUE;
-
-    /* Does the user want to be warned? */
-    window = gnc_split_register_get_parent(reg);
-    dialog =
-        gtk_message_dialog_new(GTK_WINDOW(window),
-                               GTK_DIALOG_DESTROY_WITH_PARENT,
-                               GTK_MESSAGE_WARNING,
-                               GTK_BUTTONS_CANCEL,
-                               "%s", title);
-    gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
-            "%s", message);
-    gtk_dialog_add_button(GTK_DIALOG(dialog), _("_Unreconcile"),
-                          GTK_RESPONSE_YES);
-    response = gnc_dialog_run(GTK_DIALOG(dialog), GNC_PREF_WARN_REG_RECD_SPLIT_UNREC);
-    gtk_widget_destroy(dialog);
-    return (response == GTK_RESPONSE_YES);
-}
diff --git a/src/register/ledger-core/split-register-model-save.c b/src/register/ledger-core/split-register-model-save.c
deleted file mode 100644
index 723ce2e..0000000
--- a/src/register/ledger-core/split-register-model-save.c
+++ /dev/null
@@ -1,903 +0,0 @@
-/********************************************************************\
- * split-register-model-save.c -- split register model object       *
- *                                                                  *
- * 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 at gnu.org                   *
- *                                                                  *
-\********************************************************************/
-
-#include "config.h"
-
-#include <glib.h>
-
-#include "Scrub.h"
-#include "SchedXaction.h"
-#include "datecell.h"
-#include "gnc-engine.h"
-#include "engine-helpers.h"
-#include "numcell.h"
-#include "pricecell.h"
-#include "recncell.h"
-#include "split-register-model-save.h"
-#include "split-register-p.h"
-#include "app-utils/gnc-exp-parser.h"
-
-
-struct sr_save_data
-{
-    Transaction *trans;
-    Split *split;
-
-    gboolean handled_dc; /* We have already handled the debit/credit cells. */
-    gboolean do_scrub;   /* Scrub other split at the end. */
-    gboolean reg_expanded; /* Register is in expanded (split) mode */
-};
-
-/* This static indicates the debugging module that this .o belongs to. */
-static QofLogModule log_module = GNC_MOD_LEDGER;
-
-
-static void
-gnc_split_register_save_date_cell (BasicCell * cell,
-                                   gpointer save_data,
-                                   gpointer user_data)
-{
-    SRSaveData *sd = save_data;
-    const char *value;
-    GDate gdate;
-
-    g_return_if_fail (gnc_basic_cell_has_name (cell, DATE_CELL));
-
-    value = gnc_basic_cell_get_value (cell);
-
-    /* commit any pending changes */
-    gnc_date_cell_commit ((DateCell *) cell);
-
-    DEBUG ("DATE: %s", value ? value : "(null)");
-
-    gnc_date_cell_get_date_gdate ((DateCell *) cell, &gdate);
-
-    xaccTransSetDatePostedGDate (sd->trans, gdate);
-}
-
-static void
-gnc_split_register_save_type_cell (BasicCell * cell,
-                                   gpointer save_data,
-                                   gpointer user_data)
-{
-    SRSaveData *sd = save_data;
-    char value;
-
-    g_return_if_fail (gnc_basic_cell_has_name (cell, TYPE_CELL));
-
-    value = gnc_recn_cell_get_flag ((RecnCell *)cell);
-
-    xaccTransSetTxnType (sd->trans, value);
-}
-
-static void
-gnc_split_register_save_due_date_cell (BasicCell * cell,
-                                       gpointer save_data,
-                                       gpointer user_data)
-{
-    SRSaveData *sd = save_data;
-    const char *value;
-    Timespec ts;
-
-    g_return_if_fail (gnc_basic_cell_has_name (cell, DDUE_CELL));
-
-    value = gnc_basic_cell_get_value (cell);
-
-    /* commit any pending changes */
-    gnc_date_cell_commit ((DateCell *) cell);
-
-    DEBUG ("DATE: %s", value ? value : "(null)");
-
-    gnc_date_cell_get_date ((DateCell *) cell, &ts);
-
-    xaccTransSetDateDueTS (sd->trans, &ts);
-}
-
-static void
-gnc_split_register_save_num_cell (BasicCell * cell,
-                                  gpointer save_data,
-                                  gpointer user_data)
-{
-    SRSaveData *sd = save_data;
-    SplitRegister *reg = user_data;
-    const char *value;
-
-    g_return_if_fail (gnc_basic_cell_has_name (cell, NUM_CELL));
-
-    value = gnc_basic_cell_get_value (cell);
-
-    DEBUG ("NUM: %s\n", value ? value : "(null)");
-
-    /* set per book option */
-    gnc_set_num_action (sd->trans, sd->split, value, NULL);
-
-    if (gnc_num_cell_set_last_num ((NumCell *) cell, value))
-    {
-        SRInfo *info = gnc_split_register_get_info (reg);
-        Split *blank_split = xaccSplitLookup (&info->blank_split_guid,
-                                                  gnc_get_current_book ());
-        Transaction *blank_trans = xaccSplitGetParent (blank_split);
-
-        if (sd->trans == blank_trans)
-           gnc_split_register_set_last_num (reg, gnc_basic_cell_get_value (cell));
-    }
-}
-
-static void
-gnc_split_register_save_tnum_cell (BasicCell * cell,
-                                  gpointer save_data,
-                                  gpointer user_data)
-{
-    SRSaveData *sd = save_data;
-    const char *value;
-
-    g_return_if_fail (gnc_basic_cell_has_name (cell, TNUM_CELL));
-
-    value = gnc_basic_cell_get_value (cell);
-
-    DEBUG ("TNUM: %s\n", value ? value : "(null)");
-
-    /* set tran-num using utility function */
-    gnc_set_num_action (sd->trans, NULL, value, NULL);
-}
-
-static void
-gnc_split_register_save_desc_cell (BasicCell * cell,
-                                   gpointer save_data,
-                                   gpointer user_data)
-{
-    SRSaveData *sd = save_data;
-    const char *value;
-
-    g_return_if_fail (gnc_basic_cell_has_name (cell, DESC_CELL));
-
-    value = gnc_basic_cell_get_value (cell);
-
-    DEBUG ("DESC: %s", value ? value : "(null)");
-
-    xaccTransSetDescription (sd->trans, value);
-}
-
-static void
-gnc_split_register_save_notes_cell (BasicCell * cell,
-                                    gpointer save_data,
-                                    gpointer user_data)
-{
-    SRSaveData *sd = save_data;
-    const char *value;
-
-    g_return_if_fail (gnc_basic_cell_has_name (cell, NOTES_CELL));
-
-    value = gnc_basic_cell_get_value (cell);
-
-    DEBUG ("NOTES: %s", value ? value : "(null)");
-
-    xaccTransSetNotes (sd->trans, value);
-}
-
-static void
-gnc_split_register_save_recn_cell (BasicCell * bcell,
-                                   gpointer save_data,
-                                   gpointer user_data)
-{
-    SRSaveData *sd = save_data;
-    RecnCell *cell = (RecnCell *) bcell;
-
-    g_return_if_fail (gnc_basic_cell_has_name (bcell, RECN_CELL));
-
-    DEBUG ("RECN: %c", gnc_recn_cell_get_flag (cell));
-
-    xaccSplitSetReconcile (sd->split, gnc_recn_cell_get_flag (cell));
-}
-
-static void
-gnc_split_register_save_actn_cell (BasicCell * cell,
-                                   gpointer save_data,
-                                   gpointer user_data)
-{
-    SRSaveData *sd = save_data;
-    const char *value;
-
-    g_return_if_fail (gnc_basic_cell_has_name (cell, ACTN_CELL));
-
-    value = gnc_basic_cell_get_value (cell);
-
-    DEBUG ("ACTN: %s", value ? value : "(null)");
-
-    /* Set split-action with gnc_set_num_action which is the same as
-     * xaccSplitSetAction with these arguments */
-    gnc_set_num_action (NULL, sd->split, NULL, value);
-}
-
-static void
-gnc_split_register_save_memo_cell (BasicCell * cell,
-                                   gpointer save_data,
-                                   gpointer user_data)
-{
-    SRSaveData *sd = save_data;
-    const char *value;
-
-    g_return_if_fail (gnc_basic_cell_has_name (cell, MEMO_CELL));
-
-    value = gnc_basic_cell_get_value (cell);
-
-    DEBUG ("MEMO: %s", value ? value : "(null)");
-
-    xaccSplitSetMemo (sd->split, value);
-}
-
-/* OK, the handling of transfers gets complicated because it depends
- * on what was displayed to the user. For a multi-line display, we
- * just reparent the indicated split. For a two-line display, we want
- * to reparent the "other" split, but only if there is one. XFRM is
- * the straight split, MXFRM is the mirrored split. */
-static void
-gnc_split_register_save_xfrm_cell (BasicCell * cell,
-                                   gpointer save_data,
-                                   gpointer user_data)
-{
-    SRSaveData *sd = save_data;
-    SplitRegister *reg = user_data;
-    Account *old_acc;
-    Account *new_acc;
-
-    g_return_if_fail (gnc_basic_cell_has_name (cell, XFRM_CELL));
-
-    old_acc = xaccSplitGetAccount (sd->split);
-
-    new_acc = gnc_split_register_get_account (reg, XFRM_CELL);
-
-    if ((new_acc != NULL) && (old_acc != new_acc))
-        xaccAccountInsertSplit (new_acc, sd->split);
-}
-
-static void
-gnc_split_register_save_mxfrm_cell (BasicCell * cell,
-                                    gpointer save_data,
-                                    gpointer user_data)
-{
-    SRSaveData *sd = save_data;
-    SplitRegister *reg = user_data;
-    Split * other_split;
-
-    g_return_if_fail (gnc_basic_cell_has_name (cell, MXFRM_CELL));
-
-    other_split = xaccSplitGetOtherSplit (sd->split);
-
-    /* other_split may be null for two very different reasons:
-     * (1) the parent transaction has three or more splits in it,
-     *     and so the "other" split is ambiguous, and thus null.
-     * (2) the parent transaction has only this one split as a child.
-     *     and "other" is null because there is no other.
-     *
-     * In the case (2), we want to create the other split, so that
-     * the user's request to transfer actually works out. */
-
-    if (!other_split)
-    {
-        other_split = xaccTransGetSplit (sd->trans, 1);
-
-        if (!other_split)
-        {
-            other_split = xaccMallocSplit (gnc_get_current_book ());
-            xaccTransAppendSplit (sd->trans, other_split);
-        }
-    }
-
-    if (other_split)
-    {
-        Account *old_acc;
-        Account *new_acc;
-
-        /* Do some reparenting. Insertion into new account
-         * will automatically delete from the old account. */
-        old_acc = xaccSplitGetAccount (other_split);
-        new_acc = gnc_split_register_get_account (reg, MXFRM_CELL);
-
-        if ((new_acc != NULL) && (old_acc != new_acc))
-            xaccAccountInsertSplit (new_acc, other_split);
-    }
-}
-
-static void
-gnc_split_register_save_shares_cell (BasicCell * bcell,
-                                     gpointer save_data,
-                                     gpointer user_data)
-{
-    SRSaveData *sd = save_data;
-    PriceCell *cell = (PriceCell *) bcell;
-    gnc_numeric amount;
-
-    g_return_if_fail (gnc_basic_cell_has_name (bcell, SHRS_CELL));
-
-    amount = gnc_price_cell_get_value (cell);
-
-    DEBUG ("SHRS");
-
-    xaccSplitSetAmount (sd->split, amount);
-
-    sd->do_scrub = TRUE;
-}
-
-static void
-gnc_split_register_save_price_cell (BasicCell * bcell,
-                                    gpointer save_data,
-                                    gpointer user_data)
-{
-    SRSaveData *sd = save_data;
-    PriceCell *cell = (PriceCell *) bcell;
-    gnc_numeric price;
-
-    g_return_if_fail (gnc_basic_cell_has_name (bcell, PRIC_CELL));
-
-    price = gnc_price_cell_get_value (cell);
-
-    DEBUG ("PRIC");
-
-    /* If we handled the Debcred cell then don't set the share price! */
-    if (!sd->handled_dc)
-        xaccSplitSetSharePrice (sd->split, price);
-
-    sd->do_scrub = TRUE;
-}
-
-gnc_numeric
-gnc_split_register_debcred_cell_value (SplitRegister *reg)
-{
-    PriceCell *cell;
-    gnc_numeric new_amount;
-    gnc_numeric credit;
-    gnc_numeric debit;
-
-    cell = (PriceCell *) gnc_table_layout_get_cell (reg->table->layout,
-            CRED_CELL);
-    credit = gnc_price_cell_get_value (cell);
-
-    cell = (PriceCell *) gnc_table_layout_get_cell (reg->table->layout,
-            DEBT_CELL);
-    debit  = gnc_price_cell_get_value (cell);
-
-    new_amount = gnc_numeric_sub_fixed (debit, credit);
-
-    return new_amount;
-}
-
-static gnc_numeric
-gnc_split_register_get_rate_cell (SplitRegister *reg, const char *cell_name)
-{
-    PriceCell *rate_cell;
-
-    rate_cell = (PriceCell*) gnc_table_layout_get_cell (reg->table->layout,
-                cell_name);
-    if (rate_cell)
-        return gnc_price_cell_get_value (rate_cell);
-
-    /* Uhh, just return '1' */
-    return gnc_numeric_create (100, 100);
-}
-
-gboolean
-gnc_split_register_split_needs_amount (SplitRegister *reg, Split *split)
-{
-    Transaction *txn = xaccSplitGetParent (split);
-    Account *acc = xaccSplitGetAccount (split);
-
-    return gnc_split_register_needs_conv_rate (reg, txn, acc);
-}
-
-static void
-gnc_split_register_save_amount_values (SRSaveData *sd, SplitRegister *reg)
-{
-    Account *acc;
-    gnc_numeric new_amount, convrate, amtconv, value;
-    gnc_commodity *curr, *reg_com, *xfer_com;
-    Account *xfer_acc;
-
-    new_amount = gnc_split_register_debcred_cell_value (reg);
-    acc = gnc_split_register_get_default_account (reg);
-
-    xfer_acc = xaccSplitGetAccount (sd->split);
-    xfer_com = xaccAccountGetCommodity (xfer_acc);
-    reg_com = xaccAccountGetCommodity (acc);
-    curr = xaccTransGetCurrency (sd->trans);
-
-    /* First, compute the conversion rate to convert the value to the
-      * amount.
-      */
-    amtconv = convrate = gnc_split_register_get_rate_cell (reg, RATE_CELL);
-    if (acc && gnc_split_register_needs_conv_rate (reg, sd->trans, acc))
-    {
-
-        /* If we are in an expanded register and the xfer_acc->comm !=
-        * reg_acc->comm then we need to compute the convrate here.
-        * Otherwise, we _can_ use the rate_cell!
-        */
-        if (sd->reg_expanded && ! gnc_commodity_equal (reg_com, xfer_com))
-            amtconv = xaccTransGetAccountConvRate(sd->trans, acc);
-    }
-
-    if (xaccTransUseTradingAccounts (sd->trans))
-    {
-        /* Using currency accounts, the amount is probably really the
-           amount and not the value. */
-        gboolean is_amount;
-        if (reg->type == STOCK_REGISTER ||
-                reg->type == CURRENCY_REGISTER ||
-                reg->type == PORTFOLIO_LEDGER)
-        {
-            if (xaccAccountIsPriced(xfer_acc) ||
-                    !gnc_commodity_is_iso(xaccAccountGetCommodity(xfer_acc)))
-                is_amount = FALSE;
-            else
-                is_amount = TRUE;
-        }
-        else
-        {
-            is_amount = TRUE;
-        }
-
-        if (is_amount)
-        {
-            xaccSplitSetAmount(sd->split, new_amount);
-            if (gnc_split_register_split_needs_amount (reg, sd->split))
-            {
-                value = gnc_numeric_div(new_amount, amtconv,
-                                        gnc_commodity_get_fraction(curr),
-                                        GNC_HOW_RND_ROUND_HALF_UP);
-                xaccSplitSetValue(sd->split, value);
-            }
-            else
-                xaccSplitSetValue(sd->split, new_amount);
-        }
-        else
-        {
-            xaccSplitSetValue(sd->split, new_amount);
-        }
-
-        return;
-    }
-
-    /* How to interpret new_amount depends on our view of this
-     * transaction.  If we're sitting in an account with the same
-     * commodity as the transaction, then we can set the Value and then
-     * compute the amount.  Otherwise we are setting the "converted
-     * value".  This means we need to convert new_amount to the actual
-     * 'value' by dividing by the convrate in order to set the value.
-     */
-
-    /* Now compute/set the split value.  Amount is in the register
-     * currency but we need to convert to the txn currency.
-     */
-    if (acc && gnc_split_register_needs_conv_rate (reg, sd->trans, acc))
-    {
-
-        /* convert the amount to the Value ... */
-        value = gnc_numeric_div (new_amount, amtconv,
-                                 gnc_commodity_get_fraction (curr),
-                                 GNC_HOW_RND_ROUND_HALF_UP);
-        xaccSplitSetValue (sd->split, value);
-    }
-    else
-        xaccSplitSetValue (sd->split, new_amount);
-
-    /* Now re-compute the Amount from the Value.  We may need to convert
-     * from the Value back to the amount here using the convrate from
-     * earlier.
-     */
-    value = xaccSplitGetValue (sd->split);
-
-    if (gnc_split_register_split_needs_amount (reg, sd->split))
-    {
-        acc = xaccSplitGetAccount (sd->split);
-        new_amount = gnc_numeric_mul (value, convrate,
-                                      xaccAccountGetCommoditySCU (acc),
-                                      GNC_HOW_RND_ROUND_HALF_UP);
-        xaccSplitSetAmount (sd->split, new_amount);
-    }
-}
-
-static void
-gnc_split_register_save_debcred_cell (BasicCell * bcell,
-                                      gpointer save_data,
-                                      gpointer user_data)
-{
-    SRSaveData *sd = save_data;
-    SplitRegister *reg = user_data;
-
-    g_return_if_fail (gnc_basic_cell_has_name (bcell, DEBT_CELL) ||
-                      gnc_basic_cell_has_name (bcell, CRED_CELL));
-
-    if (sd->handled_dc)
-        return;
-
-    gnc_split_register_save_amount_values (sd, reg);
-
-    sd->handled_dc = TRUE;
-    sd->do_scrub = TRUE;
-}
-
-static void
-gnc_split_register_save_rate_cell (BasicCell * bcell,
-                                   gpointer save_data,
-                                   gpointer user_data)
-{
-    SRSaveData *sd = save_data;
-
-    /* if the exchrate cell changed, then make sure to force a scrub */
-    sd->do_scrub = TRUE;
-}
-
-static void
-gnc_split_register_save_cells (gpointer save_data,
-                               gpointer user_data)
-{
-    SRSaveData *sd = save_data;
-    SplitRegister *reg = user_data;
-    Split *other_split;
-    gnc_commodity *txn_cur;
-    gnc_numeric rate = gnc_numeric_zero();
-
-    g_return_if_fail (sd != NULL);
-
-    if (!sd->do_scrub)
-        return;
-
-    other_split = xaccSplitGetOtherSplit (sd->split);
-    txn_cur = xaccTransGetCurrency (sd->trans);
-
-    xaccSplitScrub (sd->split);
-
-    rate = gnc_split_register_get_rate_cell (reg, RATE_CELL);
-
-    if (other_split && !sd->reg_expanded)
-    {
-        gnc_numeric amount, value = xaccSplitGetValue (sd->split);
-        Account *acc;
-        gboolean split_needs_amount;
-
-        split_needs_amount = gnc_split_register_split_needs_amount(reg, sd->split);
-
-        /* We are changing the rate on the current split, but it was not
-         * handled in the debcred handler, so we need to do it here.
-         */
-        if (!sd->handled_dc && split_needs_amount && !gnc_numeric_zero_p (rate))
-        {
-            gnc_numeric amount = xaccSplitGetAmount (sd->split);
-            value = gnc_numeric_div(
-                        amount, rate, gnc_commodity_get_fraction(txn_cur), GNC_HOW_RND_ROUND_HALF_UP);
-            xaccSplitSetValue (sd->split, value);
-
-            /* XXX: do we need to set the amount on the other split? */
-        }
-
-        /* Now reverse the value for the other split */
-        value = gnc_numeric_neg (value);
-
-        if (gnc_split_register_split_needs_amount (reg, other_split))
-        {
-            acc = xaccSplitGetAccount (other_split);
-
-            /* If we don't have an exchange rate then figure it out.  Or, if
-             * BOTH splits require an amount, then most likely we're in the
-             * strange case of having a transaction currency different than
-             * _both_ accounts -- so grab the other exchange rate.
-             */
-            if (gnc_numeric_zero_p (rate) || split_needs_amount)
-                rate = xaccTransGetAccountConvRate(xaccSplitGetParent (other_split),
-                                                   acc);
-
-            amount = gnc_numeric_mul (value, rate, xaccAccountGetCommoditySCU (acc),
-                                      GNC_HOW_RND_ROUND_HALF_UP);
-            xaccSplitSetAmount (other_split, amount);
-
-        }
-
-        xaccSplitSetValue (other_split, value);
-
-        xaccSplitScrub (other_split);
-    }
-    else if (gnc_split_register_split_needs_amount (reg, sd->split) &&
-             ! gnc_numeric_zero_p (rate))
-    {
-        /* this is either a multi-split or expanded transaction, so only
-         * deal with this split...  In particular we need to reset the
-         * Value if the conv-rate changed.
-         *
-         * If we handled the debcred then no need to do anything there --
-         * the debcred handler did all the computation.  If NOT, then the
-         * convrate changed -- reset the value from the amount.
-         */
-        if (!sd->handled_dc)
-        {
-            gnc_split_register_save_amount_values (sd, reg);
-#if 0
-            gnc_numeric value, amount;
-
-            amount = xaccSplitGetAmount (sd->split);
-            value = gnc_numeric_div (amount, rate, gnc_commodity_get_fraction (txn_cur),
-                                     GNC_HOW_RND_ROUND_HALF_UP);
-            xaccSplitSetValue (sd->split, value);
-#endif
-        }
-    }
-}
-
-static void
-gnc_template_register_save_unexpected_cell (BasicCell * cell,
-        gpointer save_data,
-        gpointer user_data)
-{
-    PERR ("unexpected changed fields in a template register");
-}
-
-static void
-gnc_template_register_save_xfrm_cell (BasicCell * cell,
-                                      gpointer save_data,
-                                      gpointer user_data)
-{
-    SRSaveData *sd = save_data;
-    SplitRegister *reg = user_data;
-    SRInfo *info = gnc_split_register_get_info (reg);
-    Account *template_acc;
-    const GncGUID *acctGUID;
-    Account *acct;
-
-    g_return_if_fail (gnc_basic_cell_has_name (cell, XFRM_CELL));
-
-    /* save the account GncGUID into the kvp_data. */
-    acct = gnc_split_register_get_account (reg, XFRM_CELL);
-    if (!acct)
-    {
-        PERR ("unknown account");
-        return;
-    }
-
-    acctGUID = xaccAccountGetGUID (acct);
-    qof_instance_set (QOF_INSTANCE (sd->split),
-		      "sx-account", acctGUID,
-		      NULL);
-    template_acc = xaccAccountLookup (&info->template_account,
-                                      gnc_get_current_book ());
-
-    /* set the actual account to the fake account for these templates */
-    xaccAccountInsertSplit (template_acc, sd->split);
-}
-
-static void
-gnc_template_register_save_mxfrm_cell (BasicCell * cell,
-                                       gpointer save_data,
-                                       gpointer user_data)
-{
-}
-
-static void
-save_cell (SplitRegister *reg, Split* split, const char *cell_name)
-{
-    const gboolean is_credit = g_strcmp0 (cell_name, FCRED_CELL) == 0;
-    const char *formula = is_credit ?
-        "sx-credit-formula" : "sx-debit-formula";
-    const char *numeric = is_credit ?
-        "sx-credit-numeric" : "sx-debit-numeric";
-    const char *value = gnc_table_layout_get_cell_value (reg->table->layout,
-                                                         cell_name);
-    gnc_numeric new_amount = gnc_numeric_zero ();
-    GHashTable *parser_vars = g_hash_table_new (g_str_hash, g_str_equal);
-    char *error_loc;
-
-    /* If the value can be parsed into a numeric result (without any
-     * further variable definitions), store that numeric value
-     * additionally in the kvp. Otherwise store a zero numeric
-     * there.*/
-    const gboolean parse_result =
-        gnc_exp_parser_parse_separate_vars (value, &new_amount,
-                                            &error_loc, parser_vars);
-    if (!parse_result || g_hash_table_size (parser_vars) != 0)
-        new_amount = gnc_numeric_zero ();
-    g_hash_table_unref (parser_vars);
-    qof_instance_set (QOF_INSTANCE (split),
-		  numeric, &new_amount,
-		  formula, value,
-		  NULL);
-}
-
-static void
-gnc_template_register_save_debcred_cell (BasicCell * cell,
-        gpointer save_data,
-        gpointer user_data)
-{
-    SRSaveData *sd = save_data;
-    SplitRegister *reg = user_data;
-
-    g_return_if_fail (gnc_basic_cell_has_name (cell, FDEBT_CELL) ||
-                      gnc_basic_cell_has_name (cell, FCRED_CELL));
-
-    if (sd->handled_dc)
-        return;
-
-    save_cell (reg, sd->split, FCRED_CELL);
-    save_cell (reg, sd->split, FDEBT_CELL);
-
-    /* set the amount to an innocuous value */
-    /* Note that this marks the split dirty */
-    xaccSplitSetValue (sd->split, gnc_numeric_create (0, 1));
-
-    sd->handled_dc = TRUE;
-}
-
-static void
-gnc_template_register_save_shares_cell (BasicCell * cell,
-                                        gpointer save_data,
-                                        gpointer user_data)
-{
-    SRSaveData *sd = save_data;
-    char *sharesStr = "(x + y)/42";
-
-    g_return_if_fail (gnc_basic_cell_has_name (cell, SHRS_CELL));
-    /* FIXME: shares cells are numeric by definition. */
-    qof_instance_set (QOF_INSTANCE (sd->split),
-		      "sx-shares", sharesStr,
-		      NULL);
-
-    /* set the shares to an innocuous value */
-    /* Note that this marks the split dirty */
-    xaccSplitSetSharePriceAndAmount (sd->split,
-                                     gnc_numeric_create (0, 1),
-                                     gnc_numeric_create (0, 1));
-}
-
-void
-gnc_split_register_model_add_save_handlers (TableModel *model)
-{
-    g_return_if_fail (model != NULL);
-
-    gnc_table_model_set_save_handler (model,
-                                      gnc_split_register_save_date_cell,
-                                      DATE_CELL);
-
-    gnc_table_model_set_save_handler (model,
-                                      gnc_split_register_save_due_date_cell,
-                                      DDUE_CELL);
-
-    gnc_table_model_set_save_handler (model,
-                                      gnc_split_register_save_type_cell,
-                                      TYPE_CELL);
-
-    gnc_table_model_set_save_handler (model,
-                                      gnc_split_register_save_num_cell,
-                                      NUM_CELL);
-
-    gnc_table_model_set_save_handler (model,
-                                      gnc_split_register_save_tnum_cell,
-                                      TNUM_CELL);
-
-    gnc_table_model_set_save_handler (model,
-                                      gnc_split_register_save_desc_cell,
-                                      DESC_CELL);
-
-    gnc_table_model_set_save_handler (model,
-                                      gnc_split_register_save_notes_cell,
-                                      NOTES_CELL);
-
-    gnc_table_model_set_save_handler (model,
-                                      gnc_split_register_save_recn_cell,
-                                      RECN_CELL);
-
-    gnc_table_model_set_save_handler (model,
-                                      gnc_split_register_save_actn_cell,
-                                      ACTN_CELL);
-
-    gnc_table_model_set_save_handler (model,
-                                      gnc_split_register_save_memo_cell,
-                                      MEMO_CELL);
-
-    gnc_table_model_set_save_handler (model,
-                                      gnc_split_register_save_xfrm_cell,
-                                      XFRM_CELL);
-
-    gnc_table_model_set_save_handler (model,
-                                      gnc_split_register_save_mxfrm_cell,
-                                      MXFRM_CELL);
-
-    gnc_table_model_set_save_handler (model,
-                                      gnc_split_register_save_shares_cell,
-                                      SHRS_CELL);
-
-    gnc_table_model_set_save_handler (model,
-                                      gnc_split_register_save_price_cell,
-                                      PRIC_CELL);
-
-    gnc_table_model_set_save_handler (model,
-                                      gnc_split_register_save_debcred_cell,
-                                      DEBT_CELL);
-
-    gnc_table_model_set_save_handler (model,
-                                      gnc_split_register_save_debcred_cell,
-                                      CRED_CELL);
-
-    gnc_table_model_set_save_handler (model,
-                                      gnc_split_register_save_rate_cell,
-                                      RATE_CELL);
-
-    gnc_table_model_set_post_save_handler (model, gnc_split_register_save_cells);
-}
-
-void
-gnc_template_register_model_add_save_handlers (TableModel *model)
-{
-    g_return_if_fail (model != NULL);
-
-    gnc_split_register_model_add_save_handlers (model);
-
-    gnc_table_model_set_save_handler (model,
-                                      gnc_template_register_save_unexpected_cell,
-                                      DATE_CELL);
-
-    gnc_table_model_set_save_handler (model,
-                                      gnc_template_register_save_unexpected_cell,
-                                      DDUE_CELL);
-
-    gnc_table_model_set_save_handler (model,
-                                      gnc_template_register_save_xfrm_cell,
-                                      XFRM_CELL);
-
-    gnc_table_model_set_save_handler (model,
-                                      gnc_template_register_save_mxfrm_cell,
-                                      MXFRM_CELL);
-
-    gnc_table_model_set_save_handler (model,
-                                      gnc_template_register_save_debcred_cell,
-                                      FDEBT_CELL);
-
-    gnc_table_model_set_save_handler (model,
-                                      gnc_template_register_save_debcred_cell,
-                                      FCRED_CELL);
-
-    gnc_table_model_set_save_handler (model,
-                                      gnc_template_register_save_shares_cell,
-                                      SHRS_CELL);
-}
-
-SRSaveData *
-gnc_split_register_save_data_new (Transaction *trans, Split *split,
-                                  gboolean expanded)
-{
-    SRSaveData *sd;
-
-    g_return_val_if_fail (trans != NULL, NULL);
-    g_return_val_if_fail (split != NULL, NULL);
-
-    sd = g_new0 (SRSaveData, 1);
-
-    sd->trans = trans;
-    sd->split = split;
-    sd->handled_dc = FALSE;
-    sd->do_scrub = FALSE;
-    sd->reg_expanded = expanded;
-
-    return sd;
-}
-
-void
-gnc_split_register_save_data_destroy (SRSaveData *sd)
-{
-    g_free (sd);
-}
diff --git a/src/register/ledger-core/split-register-model.c b/src/register/ledger-core/split-register-model.c
deleted file mode 100644
index e299fca..0000000
--- a/src/register/ledger-core/split-register-model.c
+++ /dev/null
@@ -1,2736 +0,0 @@
-/********************************************************************\
- * split-register-model.c -- split register model object            *
- *                                                                  *
- * 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 at gnu.org                   *
- *                                                                  *
-\********************************************************************/
-
-#include "config.h"
-
-#include <glib.h>
-#include <glib/gi18n.h>
-
-#include "datecell.h"
-#include "dialog-utils.h"
-#include "gnc-engine.h"
-#include "gnc-prefs.h"
-#include "gnc-ui.h"
-#include "gnome-utils/gnc-warnings.h"
-#include "pricecell.h"
-#include "recncell.h"
-#include "split-register.h"
-#include "split-register-model.h"
-#include "split-register-model-save.h"
-#include "split-register-p.h"
-#include "engine-helpers.h"
-
-/* This static indicates the debugging module that this .o belongs to. */
-static QofLogModule log_module = GNC_MOD_LEDGER;
-
-/* Flag for determining colorization of negative amounts. */
-static gboolean use_red_for_negative = TRUE;
-
-/* This returns the balance at runtime of a register at the split defined by virt_loc regardless of
- * sort order. It always assumes that the first txn in the register is starting from a 0 balance.
- * If gboolean subaccounts is TRUE, then it will return the total balance of the parent account
- * and all its subaccounts. FALSE will return the balance of just the parent account of the register. */
-static gnc_numeric
-gnc_split_register_get_rbaln (VirtualLocation virt_loc, gpointer user_data, gboolean subaccounts)
-{
-    SplitRegister *reg = user_data;
-    Split *split;
-    SRInfo *info = gnc_split_register_get_info (reg);
-    gnc_numeric balance = gnc_numeric_zero();
-    Account *account = NULL;
-    Transaction *trans;
-    GList *node, *child;
-    GList *children = NULL;
-    int i, row;
-
-    balance = gnc_numeric_zero();
-
-    /* Return NULL if this is a blank transaction. */
-    split = gnc_split_register_get_split (reg, virt_loc.vcell_loc);
-    if (split == xaccSplitLookup (&info->blank_split_guid,
-                                  gnc_get_current_book ()))
-        return gnc_numeric_zero();
-
-    trans = xaccSplitGetParent (split);
-    if (!trans)
-        return gnc_numeric_zero();
-
-    /* Get a list of accounts for matching */
-    account = gnc_split_register_get_default_account(reg);
-    if (!account)
-        /* Register has no account (perhaps general journal) so it has no
-           well defined balance, return zero. */
-        return balance;
-
-    if (subaccounts)
-    {
-        children = gnc_account_get_descendants(account);
-        children = g_list_append(children, account);
-    }
-
-    /* Get the row number we're on, then start with the first row. */
-    row = virt_loc.vcell_loc.virt_row;
-    virt_loc.vcell_loc.virt_row = 0;
-
-    while (virt_loc.vcell_loc.virt_row <= row )
-    {
-        /* Get new temporary split and its parent transaction */
-        split = gnc_split_register_get_split (reg, virt_loc.vcell_loc);
-        trans = xaccSplitGetParent (split);
-
-        i = 1;
-        for (node = xaccTransGetSplitList (trans); node; node = node->next)
-        {
-            Split *secondary = node->data;
-            i++;
-
-            if (subaccounts)
-            {
-                /* Add up the splits that belong to the transaction if they are
-                 * from the lead account or one of the subaccounts. */
-                account = xaccSplitGetAccount (secondary);
-
-                for (child = children; child; child = child->next)
-                {
-                    if (account == child->data)
-                    {
-                        balance = gnc_numeric_add_fixed(balance, xaccSplitGetAmount(secondary));
-                        break;
-                    }
-                }
-            }
-            else
-            {
-                if ( account == xaccSplitGetAccount(secondary) )
-                    balance = gnc_numeric_add_fixed( balance, xaccSplitGetAmount(secondary) );
-            }
-        }
-        virt_loc.vcell_loc.virt_row += i;
-    }
-
-    if (subaccounts)
-        g_list_free(children);
-
-    return balance;
-}
-
-static gnc_commodity *
-gnc_split_register_get_split_commodity (SplitRegister *reg,
-                                        VirtualLocation virt_loc)
-{
-    CursorClass cursor_class;
-    Account *account;
-    Split *split;
-
-    split = gnc_split_register_get_split (reg, virt_loc.vcell_loc);
-    if (!split)
-        return NULL;
-
-    cursor_class = gnc_split_register_get_cursor_class (reg,
-                   virt_loc.vcell_loc);
-    if (cursor_class != CURSOR_CLASS_SPLIT)
-        return NULL;
-
-    account = NULL;
-
-    if (virt_cell_loc_equal (virt_loc.vcell_loc,
-                             reg->table->current_cursor_loc.vcell_loc) &&
-            gnc_table_layout_get_cell_changed (reg->table->layout, XFRM_CELL, FALSE))
-    {
-        const char *name;
-
-        name = gnc_table_layout_get_cell_value (reg->table->layout, XFRM_CELL);
-        account = gnc_account_lookup_for_register (gnc_get_current_root_account (), name);
-    }
-
-    if (!account)
-        account = xaccSplitGetAccount (split);
-
-    if (!account)
-        return NULL;
-        
-    return xaccAccountGetCommodity(account);
-}
-
-static gboolean
-gnc_split_register_use_security_cells (SplitRegister *reg,
-                                       VirtualLocation virt_loc)
-{
-    CursorClass cursor_class;
-    Account *account;
-    Split *split;
-
-    split = gnc_split_register_get_split (reg, virt_loc.vcell_loc);
-    if (!split)
-        return TRUE;
-
-    cursor_class = gnc_split_register_get_cursor_class (reg,
-                   virt_loc.vcell_loc);
-    if (cursor_class != CURSOR_CLASS_SPLIT)
-        return TRUE;
-
-    account = NULL;
-
-    if (virt_cell_loc_equal (virt_loc.vcell_loc,
-                             reg->table->current_cursor_loc.vcell_loc) &&
-            gnc_table_layout_get_cell_changed (reg->table->layout, XFRM_CELL, FALSE))
-    {
-        const char *name;
-
-        name = gnc_table_layout_get_cell_value (reg->table->layout, XFRM_CELL);
-        account = gnc_account_lookup_for_register (gnc_get_current_root_account (), name);
-    }
-
-    if (!account)
-        account = xaccSplitGetAccount (split);
-
-    if (!account)
-        return TRUE;
-
-    if (xaccTransUseTradingAccounts (xaccSplitGetParent (split)))
-    {
-        gnc_commodity *commod = xaccAccountGetCommodity(account);
-        if (!gnc_commodity_is_iso(commod) ||
-            !gnc_commodity_equal(commod, xaccTransGetCurrency(xaccSplitGetParent(split))))
-            return TRUE;
-    }
-
-    return xaccAccountIsPriced(account);
-}
-
-static const char *
-gnc_split_register_get_date_label (VirtualLocation virt_loc,
-                                   gpointer user_data)
-{
-    return _("Date");
-}
-
-static const char *
-gnc_split_register_get_due_date_label (VirtualLocation virt_loc,
-                                       gpointer user_data)
-{
-    return _("Due Date");
-}
-
-static const char *
-gnc_split_register_get_num_label (VirtualLocation virt_loc,
-                                  gpointer user_data)
-{
-    SplitRegister *reg = user_data;
-
-    switch (reg->type)
-    {
-    case RECEIVABLE_REGISTER:
-    case PAYABLE_REGISTER:
-        return _("Ref");
-    default:
-        return _("Num");
-    }
-}
-
-static const char *
-gnc_split_register_get_tran_num_label (VirtualLocation virt_loc,
-                                  gpointer user_data)
-{
-    SplitRegister *reg = user_data;
-
-    switch (reg->type)
-    {
-    case RECEIVABLE_REGISTER:
-    case PAYABLE_REGISTER:
-        return _("T-Ref");
-    case GENERAL_JOURNAL:
-    case INCOME_LEDGER:
-    case SEARCH_LEDGER:
-    {
-        if (reg->use_tran_num_for_num_field)
-            return _("Num");
-    }
-    default:
-        return _("T-Num");
-    }
-}
-
-static const char *
-gnc_split_register_get_desc_label (VirtualLocation virt_loc,
-                                   gpointer user_data)
-{
-    SplitRegister *reg = user_data;
-
-    switch (reg->type)
-    {
-    case RECEIVABLE_REGISTER:
-        return _("Customer");
-    case PAYABLE_REGISTER:
-        return _("Vendor");
-    default:
-        return _("Description");
-    }
-}
-
-static const char *
-gnc_split_register_get_recn_label (VirtualLocation virt_loc,
-                                   gpointer user_data)
-{
-    SplitRegister *reg = user_data;
-
-    switch (reg->type)
-    {
-    case RECEIVABLE_REGISTER:
-    case PAYABLE_REGISTER:
-        return _("Paid");
-
-    default:
-        return _("Reconciled:R") + 11;
-    }
-}
-
-static const char *
-gnc_split_register_get_baln_label (VirtualLocation virt_loc,
-                                   gpointer user_data)
-{
-    return _("Balance");
-}
-
-static const char *
-gnc_split_register_get_action_label (VirtualLocation virt_loc,
-                                     gpointer user_data)
-{
-    return _("Action");
-}
-
-static const char *
-gnc_split_register_get_associate_label (VirtualLocation virt_loc,
-                                   gpointer user_data)
-{
-    return _("Associate:A") + 10;
-}
-
-static const char *
-gnc_split_register_get_xfrm_label (VirtualLocation virt_loc,
-                                   gpointer user_data)
-{
-    return _("Account");
-}
-
-static const char *
-gnc_split_register_get_mxfrm_label (VirtualLocation virt_loc,
-                                    gpointer user_data)
-{
-    return _("Transfer");
-}
-
-static const char *
-gnc_split_register_get_memo_label (VirtualLocation virt_loc,
-                                   gpointer user_data)
-{
-    return _("Memo");
-}
-
-static const char *
-gnc_split_register_get_type_label (VirtualLocation virt_loc,
-                                   gpointer user_data)
-{
-    return _("Type");
-}
-
-static const char *
-gnc_split_register_get_debit_label (VirtualLocation virt_loc,
-                                    gpointer user_data)
-{
-    SplitRegister *reg = user_data;
-
-    return gnc_split_register_get_debit_string (reg);
-}
-
-static const char *
-gnc_split_register_get_credit_label (VirtualLocation virt_loc,
-                                     gpointer user_data)
-{
-    SplitRegister *reg = user_data;
-
-    return gnc_split_register_get_credit_string (reg);
-}
-
-static const char *
-gnc_split_register_get_price_label (VirtualLocation virt_loc,
-                                    gpointer user_data)
-{
-    SplitRegister *reg = user_data;
-    gnc_commodity *commod;
-
-    if (!gnc_split_register_use_security_cells (reg, virt_loc))
-        return NULL;
-
-    commod = gnc_split_register_get_split_commodity (reg, virt_loc);
-    if (!commod || !gnc_commodity_is_iso(commod))
-        return _("Price");
-    else
-        return _("Exch. Rate");
-}
-
-static const char *
-gnc_split_register_get_shares_label (VirtualLocation virt_loc,
-                                     gpointer user_data)
-{
-    SplitRegister *reg = user_data;
-    gnc_commodity *commod;
-
-    if (!gnc_split_register_use_security_cells (reg, virt_loc))
-        return NULL;
-
-    commod = gnc_split_register_get_split_commodity (reg, virt_loc);
-    if (!commod || !gnc_commodity_is_iso(commod))
-        return _("Shares");
-    else
-        return _("Oth. Curr.");
-}
-
-static const char *
-gnc_split_register_get_tcredit_label (VirtualLocation virt_loc,
-                                      gpointer user_data)
-{
-    SplitRegister *reg = user_data;
-    SRInfo *info = gnc_split_register_get_info (reg);
-
-    if (info->tcredit_str)
-        return info->tcredit_str;
-
-    {
-        const char *string = gnc_split_register_get_credit_string (reg);
-
-        if (string)
-            info->tcredit_str = g_strdup_printf (_("Tot %s"), string);
-    }
-
-    if (info->tcredit_str)
-        return info->tcredit_str;
-
-    info->tcredit_str = g_strdup (_("Tot Credit"));
-
-    return info->tcredit_str;
-}
-
-static const char *
-gnc_split_register_get_tdebit_label (VirtualLocation virt_loc,
-                                     gpointer user_data)
-{
-    SplitRegister *reg = user_data;
-    SRInfo *info = gnc_split_register_get_info (reg);
-
-    if (info->tdebit_str)
-        return info->tdebit_str;
-
-    {
-        const char *string = gnc_split_register_get_debit_string (reg);
-        if (string)
-            info->tdebit_str = g_strdup_printf (_("Tot %s"), string);
-    }
-
-    if (info->tdebit_str)
-        return info->tdebit_str;
-
-    info->tdebit_str = g_strdup (_("Tot Debit"));
-
-    return info->tdebit_str;
-}
-
-static const char *
-gnc_split_register_get_tshares_label (VirtualLocation virt_loc,
-                                      gpointer user_data)
-{
-    return _("Tot Shares");
-}
-
-static const char *
-gnc_split_register_get_tbalance_label (VirtualLocation virt_loc,
-                                       gpointer user_data)
-{
-    return _("Balance");
-}
-
-static const char *
-gnc_split_register_get_notes_label (VirtualLocation virt_loc,
-                                    gpointer user_data)
-{
-    return _("Notes");
-}
-
-static const char *
-gnc_split_register_get_fdebit_label (VirtualLocation virt_loc,
-                                     gpointer user_data)
-{
-    return _("Debit Formula");
-}
-
-static const char *
-gnc_split_register_get_fcredit_label (VirtualLocation virt_loc,
-                                      gpointer user_data)
-{
-    return _("Credit Formula");
-}
-
-static gnc_numeric
-get_trans_total_amount (SplitRegister *reg, Transaction *trans)
-{
-    Account *account = gnc_split_register_get_default_account (reg);
-    return xaccTransGetAccountAmount(trans, account);
-}
-
-static gnc_numeric
-get_trans_total_balance (SplitRegister *reg, Transaction *trans)
-{
-    Account *account;
-
-    account = gnc_split_register_get_default_account (reg);
-    if (!trans || !account) return gnc_numeric_zero();
-
-    return xaccTransGetAccountBalance(trans, account);
-}
-
-static guint32
-gnc_split_register_get_color_internal (VirtualLocation virt_loc,
-                                       SplitRegister *reg,
-                                       const guint32 *color_table,
-                                       gboolean foreground)
-{
-    const char *cursor_name;
-    VirtualCell *vcell;
-    gboolean is_current;
-    gboolean double_alternate_virt;
-    guint32 colorbase = 0; /* By default return background colors */
-
-    if (foreground)
-        colorbase = COLOR_UNKNOWN_FG; /* a bit of enum arithmetic */
-
-    if (!reg)
-        return color_table[colorbase + COLOR_UNKNOWN_BG];
-
-    if (gnc_table_virtual_location_in_header (reg->table, virt_loc))
-        return color_table[colorbase + COLOR_HEADER_BG];
-
-    vcell = gnc_table_get_virtual_cell (reg->table, virt_loc.vcell_loc);
-    if (!vcell || !vcell->cellblock)
-        return color_table[colorbase + COLOR_UNKNOWN_BG];
-
-    if ((virt_loc.phys_col_offset < vcell->cellblock->start_col) ||
-            (virt_loc.phys_col_offset > vcell->cellblock->stop_col))
-        return color_table[colorbase + COLOR_UNKNOWN_BG];
-
-    is_current = virt_cell_loc_equal (reg->table->current_cursor_loc.vcell_loc,
-                                      virt_loc.vcell_loc);
-
-    cursor_name = vcell->cellblock->cursor_name;
-
-    if (g_strcmp0 (cursor_name, CURSOR_SINGLE_JOURNAL) == 0 ||
-            g_strcmp0 (cursor_name, CURSOR_SINGLE_LEDGER) == 0)
-    {
-        if (is_current)
-            return vcell->start_primary_color ?
-                    color_table[colorbase + COLOR_PRIMARY_BG_ACTIVE] :
-                    color_table[colorbase + COLOR_SECONDARY_BG_ACTIVE];
-
-        return vcell->start_primary_color ?
-                color_table[colorbase + COLOR_PRIMARY_BG] : color_table[colorbase + COLOR_SECONDARY_BG];
-    }
-
-    if (g_strcmp0 (cursor_name, CURSOR_DOUBLE_JOURNAL) == 0 ||
-            g_strcmp0 (cursor_name, CURSOR_DOUBLE_JOURNAL_NUM_ACTN) == 0 ||
-            g_strcmp0 (cursor_name, CURSOR_DOUBLE_LEDGER) == 0 ||
-            g_strcmp0 (cursor_name, CURSOR_DOUBLE_LEDGER_NUM_ACTN) == 0)
-    {
-        double_alternate_virt = gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL_REGISTER,
-                                                    GNC_PREF_ALT_COLOR_BY_TRANS);
-        if (is_current)
-        {
-            if (double_alternate_virt)
-                return vcell->start_primary_color ?
-                        color_table[colorbase + COLOR_PRIMARY_BG_ACTIVE] :
-                        color_table[colorbase + COLOR_SECONDARY_BG_ACTIVE];
-
-            return (virt_loc.phys_row_offset % 2 == 0) ?
-                    color_table[colorbase + COLOR_PRIMARY_BG_ACTIVE] :
-                    color_table[colorbase + COLOR_SECONDARY_BG_ACTIVE];
-        }
-
-        if (double_alternate_virt)
-            return vcell->start_primary_color ?
-                    color_table[colorbase + COLOR_PRIMARY_BG] :
-                    color_table[colorbase + COLOR_SECONDARY_BG];
-
-        return (virt_loc.phys_row_offset % 2 == 0) ?
-                color_table[colorbase + COLOR_PRIMARY_BG] :
-                color_table[colorbase + COLOR_SECONDARY_BG];
-    }
-
-    if (g_strcmp0 (cursor_name, CURSOR_SPLIT) == 0)
-    {
-        if (is_current)
-            return color_table[colorbase + COLOR_SPLIT_BG_ACTIVE];
-
-        return color_table[colorbase + COLOR_SPLIT_BG];
-    }
-
-    PWARN ("Unexpected cursor: %s\n", cursor_name);
-
-    return color_table[colorbase + COLOR_UNKNOWN_BG];
-}
-
-static guint32
-gnc_split_register_get_fg_color_internal (VirtualLocation virt_loc,
-                                          SplitRegister *reg,
-                                          const guint32 *color_table)
-{
-    const guint32 red_color = color_table[COLOR_NEGATIVE];
-    guint32 fg_color;
-    const char * cell_name;
-    gnc_numeric value;
-    Split *split;
-
-    fg_color = gnc_split_register_get_color_internal (virt_loc, reg, color_table, TRUE);
-
-    if (!use_red_for_negative)
-        return fg_color;
-
-    split = gnc_split_register_get_split (reg, virt_loc.vcell_loc);
-    if (!split)
-        return fg_color;
-
-    cell_name = gnc_table_get_cell_name (reg->table, virt_loc);
-
-    if (gnc_cell_name_equal (cell_name, TSHRS_CELL))
-        value = get_trans_total_amount (reg, xaccSplitGetParent (split));
-    else if (gnc_cell_name_equal (cell_name, SHRS_CELL))
-    {
-        if (virt_cell_loc_equal (reg->table->current_cursor_loc.vcell_loc,
-                                      virt_loc.vcell_loc))
-            value = gnc_price_cell_get_value
-                     ((PriceCell *) gnc_table_layout_get_cell (reg->table->layout,
-                             SHRS_CELL));
-        else
-            value = xaccSplitGetAmount (split);
-    }
-    else if (gnc_cell_name_equal (cell_name, BALN_CELL))
-        value = xaccSplitGetBalance (split);
-    else if (gnc_cell_name_equal (cell_name, RBALN_CELL))
-        value = gnc_split_register_get_rbaln (virt_loc, reg, TRUE);
-    else if (gnc_cell_name_equal (cell_name, TBALN_CELL))
-        value = get_trans_total_balance (reg, xaccSplitGetParent (split));
-
-    if ((gnc_cell_name_equal (cell_name, BALN_CELL)) ||
-            (gnc_cell_name_equal (cell_name, RBALN_CELL)) ||
-            (gnc_cell_name_equal (cell_name, TBALN_CELL)))
-        {
-            Account *account = xaccSplitGetAccount (split);
-            if (gnc_reverse_balance (account))
-                value = gnc_numeric_neg (value);
-        }
-
-    if (gnc_numeric_negative_p (value))
-        return red_color;
-
-    return fg_color;
-}
-
-static guint32
-gnc_split_register_get_fg_color (VirtualLocation virt_loc,
-                                 gpointer user_data)
-{
-    SplitRegister *reg = user_data;
-    return gnc_split_register_get_fg_color_internal (virt_loc, reg, reg_colors_default);
-}
-
-static guint32
-gnc_split_register_get_gtkrc_fg_color (VirtualLocation virt_loc,
-                                       gpointer user_data)
-{
-    SplitRegister *reg = user_data;
-    return gnc_split_register_get_fg_color_internal (virt_loc, reg, reg_colors_gtkrc);
-}
-
-static guint32
-gnc_split_register_get_bg_color (VirtualLocation virt_loc,
-        gboolean *hatching,
-        gpointer user_data)
-{
-    SplitRegister *reg = user_data;
-
-    if (hatching)
-        *hatching = FALSE;
-
-    return gnc_split_register_get_color_internal (virt_loc, reg, reg_colors_default, FALSE);
-}
-
-
-static RegisterColor
-gnc_split_register_get_gtkrc_bg_color (VirtualLocation virt_loc,
-                                       gboolean *hatching,
-                                       gpointer user_data)
-{
-    SplitRegister *reg = user_data;
-
-    if (hatching)
-        *hatching = FALSE;
-
-    return gnc_split_register_get_color_internal (virt_loc, reg, reg_colors_gtkrc, FALSE);
-}
-
-static guint32
-gnc_split_register_get_debcred_bg_color (VirtualLocation virt_loc,
-        gboolean *hatching,
-        gpointer user_data)
-{
-    SplitRegister *reg = user_data;
-
-    if (hatching)
-    {
-        Transaction *trans;
-
-        trans = gnc_split_register_get_trans (reg, virt_loc.vcell_loc);
-
-        if (trans)
-            *hatching = !xaccTransIsBalanced (trans);
-        else
-            *hatching = FALSE;
-    }
-
-    return gnc_split_register_get_bg_color (virt_loc, NULL, user_data);
-}
-
-static void
-gnc_split_register_get_border (VirtualLocation virt_loc,
-                               PhysicalCellBorders *borders,
-                               gpointer user_data)
-{
-    SplitRegister *reg = user_data;
-    CursorClass cursor_class;
-    VirtualCell *vcell;
-
-    vcell = gnc_table_get_virtual_cell (reg->table, virt_loc.vcell_loc);
-    if (!vcell || !vcell->cellblock)
-        return;
-
-    if (virt_loc.phys_col_offset < vcell->cellblock->start_col ||
-            virt_loc.phys_col_offset > vcell->cellblock->stop_col)
-    {
-        borders->top    = CELL_BORDER_LINE_NONE;
-        borders->bottom = CELL_BORDER_LINE_NONE;
-        borders->left   = CELL_BORDER_LINE_NONE;
-        borders->right  = CELL_BORDER_LINE_NONE;
-        return;
-    }
-
-    cursor_class =
-        gnc_split_register_cursor_name_to_class (vcell->cellblock->cursor_name);
-
-    if (cursor_class == CURSOR_CLASS_SPLIT)
-    {
-        borders->top    = CELL_BORDER_LINE_LIGHT;
-        borders->bottom = CELL_BORDER_LINE_LIGHT;
-        borders->left   = MIN (borders->left,   CELL_BORDER_LINE_LIGHT);
-        borders->right  = MIN (borders->right,  CELL_BORDER_LINE_LIGHT);
-
-        if (virt_loc.phys_col_offset == vcell->cellblock->start_col)
-            borders->left = CELL_BORDER_LINE_NORMAL;
-        if (virt_loc.phys_col_offset == vcell->cellblock->stop_col)
-            borders->right = CELL_BORDER_LINE_NORMAL;
-    }
-}
-
-static const char *
-gnc_split_register_get_associate_entry (VirtualLocation virt_loc,
-                                   gboolean translate,
-                                   gboolean *conditionally_changed,
-                                   gpointer user_data)
-{
-    SplitRegister *reg = user_data;
-    Transaction *trans;
-    char associate;
-    static char s[2];
-    const char *uri;
-
-    trans = gnc_split_register_get_trans (reg, virt_loc.vcell_loc);
-    if (!trans)
-        return NULL;
-
-    // get the existing uri
-    uri = xaccTransGetAssociation (trans);
-
-    // Check for uri is empty or NULL
-    if (g_strcmp0 (uri, "") != 0 && g_strcmp0 (uri, NULL) != 0)
-    {
-        if (g_str_has_prefix (uri, "file:"))
-            associate = 'f';
-        else
-            associate = 'w';
-    }
-    else
-        associate = ' ';
-
-    s[0] = associate;
-    s[1] = '\0';
-
-    return s;
-}
-
-#if 0
-// this code is not used yet
-static char
-gnc_split_register_get_associate_value (SplitRegister *reg,
-                                   VirtualLocation virt_loc)
-{
-    RecnCell *cell;
-
-    cell = (RecnCell *)gnc_table_layout_get_cell (reg->table->layout, ASSOC_CELL);
-    if (!cell)
-        return '\0';
-
-    return gnc_recn_cell_get_flag (cell);
-}
-#endif
-
-static const char *
-gnc_split_register_get_type_entry (VirtualLocation virt_loc,
-                                   gboolean translate,
-                                   gboolean *conditionally_changed,
-                                   gpointer user_data)
-{
-    SplitRegister *reg = user_data;
-    Transaction *trans;
-    char type;
-    static char s[2];
-
-    trans = gnc_split_register_get_trans (reg, virt_loc.vcell_loc);
-    if (!trans)
-        return NULL;
-
-    type = xaccTransGetTxnType (trans);
-
-    if (type == TXN_TYPE_NONE)
-        type = '?';
-
-    s[0] = type;
-    s[1] = '\0';
-
-    return s;
-}
-
-static char
-gnc_split_register_get_type_value (SplitRegister *reg,
-                                   VirtualLocation virt_loc)
-{
-    RecnCell *cell;
-
-    cell = (RecnCell *)gnc_table_layout_get_cell (reg->table->layout, TYPE_CELL);
-    if (!cell)
-        return '\0';
-
-    return gnc_recn_cell_get_flag (cell);
-}
-
-static const char *
-gnc_split_register_get_due_date_entry (VirtualLocation virt_loc,
-                                       gboolean translate,
-                                       gboolean *conditionally_changed,
-                                       gpointer user_data)
-{
-    SplitRegister *reg = user_data;
-    Transaction *trans;
-    Split *split;
-    Timespec ts;
-    gboolean is_current;
-    char type;
-
-    is_current = virt_cell_loc_equal (reg->table->current_cursor_loc.vcell_loc,
-                                      virt_loc.vcell_loc);
-
-    if (is_current)
-    {
-        type = gnc_split_register_get_type_value (reg, virt_loc);
-    }
-    else
-    {
-        const char *typestr =
-            gnc_split_register_get_type_entry (virt_loc, translate,
-                                               conditionally_changed, user_data);
-        if (typestr != NULL)
-            type = *typestr;
-        else
-            type = '\0';
-    }
-
-    /* Only print the due date for invoice transactions */
-    if (type != TXN_TYPE_INVOICE)
-    {
-        //PWARN ("returning NULL due_date entry");
-        return NULL;
-    }
-
-    split = gnc_split_register_get_split (reg, virt_loc.vcell_loc);
-    trans = xaccSplitGetParent (split);
-    if (!trans)
-    {
-        //PWARN ("No transaction in due_date entry");
-        return NULL;
-    }
-
-    xaccTransGetDateDueTS (trans, &ts);
-    //PWARN ("returning valid due_date entry");
-
-    return gnc_print_date (ts);
-}
-
-static const char *
-gnc_split_register_get_date_entry (VirtualLocation virt_loc,
-                                   gboolean translate,
-                                   gboolean *conditionally_changed,
-                                   gpointer user_data)
-{
-    SplitRegister *reg = user_data;
-    Transaction *trans;
-    Split *split;
-    Timespec ts;
-
-    split = gnc_split_register_get_split (reg, virt_loc.vcell_loc);
-    trans = xaccSplitGetParent (split);
-    if (!trans)
-        return NULL;
-
-    xaccTransGetDatePostedTS (trans, &ts);
-
-    return gnc_print_date (ts);
-}
-
-static char *
-gnc_split_register_get_date_help (VirtualLocation virt_loc,
-                                  gpointer user_data)
-{
-    SplitRegister *reg = user_data;
-    BasicCell *cell;
-    char string[1024];
-    GDate date;
-
-    cell = gnc_table_get_cell (reg->table, virt_loc);
-    if (!cell || !cell->value || *cell->value == '\0')
-        return NULL;
-
-    g_date_clear (&date, 1);
-    gnc_date_cell_get_date_gdate ((DateCell *) cell, &date);
-
-    g_date_strftime (string, sizeof (string), _("%A %d %B %Y"), &date);
-
-    return g_strdup (string);
-}
-
-static const char *
-gnc_split_register_get_inactive_date_entry (VirtualLocation virt_loc,
-        gboolean translate,
-        gboolean *conditionally_changed,
-        gpointer user_data)
-{
-    /* This seems to be the one that initially gets used, the InactiveDateCell
-       is set to, and subsequently displayed. */
-    return _("Scheduled");
-}
-
-static const char *
-gnc_split_register_get_num_entry (VirtualLocation virt_loc,
-                                  gboolean translate,
-                                  gboolean *conditionally_changed,
-                                  gpointer user_data)
-{
-    SplitRegister *reg = user_data;
-    Transaction *trans;
-    Split *split;
-
-    split = gnc_split_register_get_split (reg, virt_loc.vcell_loc);
-    trans = xaccSplitGetParent (split);
-
-    return gnc_get_num_action (trans, split); 
-}
-
-static const char *
-gnc_split_register_get_tran_num_entry (VirtualLocation virt_loc,
-                                  gboolean translate,
-                                  gboolean *conditionally_changed,
-                                  gpointer user_data)
-{
-    SplitRegister *reg = user_data;
-    Transaction *trans;
-    Split *split;
-
-    split = gnc_split_register_get_split (reg, virt_loc.vcell_loc);
-    trans = xaccSplitGetParent (split);
-
-    return gnc_get_num_action (trans, NULL);
-}
-
-static char *
-gnc_split_register_get_num_help (VirtualLocation virt_loc,
-                                 gpointer user_data)
-{
-    SplitRegister *reg = user_data;
-    const char *help;
-
-    help = gnc_table_get_entry (reg->table, virt_loc);
-    if (!help || *help == '\0')
-        switch (reg->type)
-        {
-        case RECEIVABLE_REGISTER:
-        case PAYABLE_REGISTER:
-            help = reg->use_tran_num_for_num_field ?
-                    _("Enter a reference, such as an invoice or check number, "
-                        "common to all entry lines (splits)") :
-                    _("Enter a reference, such as an invoice or check number, "
-                        "unique to each entry line (split)");
-            break;
-        default:
-            help = reg->use_tran_num_for_num_field ?
-                    _("Enter a reference, such as a check number, "
-                        "common to all entry lines (splits)") :
-                    _("Enter a reference, such as a check number, "
-                        "unique to each entry line (split)");
-            break;
-        }
-
-    return g_strdup (help);
-}
-
-static char *
-gnc_split_register_get_tran_num_help (VirtualLocation virt_loc,
-                                 gpointer user_data)
-{
-    SplitRegister *reg = user_data;
-    const char *help;
-
-    help = gnc_table_get_entry (reg->table, virt_loc);
-    if (!help || *help == '\0')
-        switch (reg->type)
-        {
-        case RECEIVABLE_REGISTER:
-        case PAYABLE_REGISTER:
-            help = _("Enter a transaction reference, such as an invoice "
-                    "or check number, common to all entry lines (splits)");
-            break;
-        default:
-            help = _("Enter a transaction reference "
-                    "that will be common to all entry lines (splits)");
-            break;
-        }
-
-    return g_strdup (help);
-}
-
-static const char *
-gnc_split_register_get_desc_entry (VirtualLocation virt_loc,
-                                   gboolean translate,
-                                   gboolean *conditionally_changed,
-                                   gpointer user_data)
-{
-    SplitRegister *reg = user_data;
-    Transaction *trans;
-    Split *split;
-
-    split = gnc_split_register_get_split (reg, virt_loc.vcell_loc);
-    trans = xaccSplitGetParent (split);
-
-    return xaccTransGetDescription (trans);
-}
-
-static char *
-gnc_split_register_get_desc_help (VirtualLocation virt_loc,
-                                  gpointer user_data)
-{
-    SplitRegister *reg = user_data;
-    const char *help;
-
-    help = gnc_table_get_entry (reg->table, virt_loc);
-    if (!help || *help == '\0')
-        switch (reg->type)
-        {
-        case RECEIVABLE_REGISTER:
-            help = _("Enter the name of the Customer");
-            break;
-        case PAYABLE_REGISTER:
-            help = _("Enter the name of the Vendor");
-            break;
-        default:
-            help = _("Enter a description of the transaction");
-            break;
-        }
-    return g_strdup (help);
-}
-
-static const char *
-gnc_split_register_get_notes_entry (VirtualLocation virt_loc,
-                                    gboolean translate,
-                                    gboolean *conditionally_changed,
-                                    gpointer user_data)
-{
-    SplitRegister *reg = user_data;
-    Transaction *trans;
-    Split *split;
-
-    split = gnc_split_register_get_split (reg, virt_loc.vcell_loc);
-    trans = xaccSplitGetParent (split);
-
-    return xaccTransGetNotes (trans);
-}
-
-static char *
-gnc_split_register_get_notes_help (VirtualLocation virt_loc,
-                                   gpointer user_data)
-{
-    SplitRegister *reg = user_data;
-    const char *help;
-
-    help = gnc_table_get_entry (reg->table, virt_loc);
-    if (!help || *help == '\0')
-        help = _("Enter notes for the transaction");
-
-    return g_strdup (help);
-}
-
-static const char *
-gnc_split_register_get_vnotes_entry (VirtualLocation virt_loc,
-                                     gboolean translate,
-                                     gboolean *conditionally_changed,
-                                     gpointer user_data)
-{
-    SplitRegister *reg = user_data;
-    Transaction *trans;
-    Split *split;
-
-    split = gnc_split_register_get_split (reg, virt_loc.vcell_loc);
-    trans = xaccSplitGetParent (split);
-
-    if(trans == NULL)
-        return NULL;
-    else
-        return xaccTransGetVoidReason(trans);
-}
-
-static char *
-gnc_split_register_get_vnotes_help (VirtualLocation virt_loc,
-                                    gpointer user_data)
-{
-    SplitRegister *reg = user_data;
-    const char *help;
-
-    help = gnc_table_get_entry (reg->table, virt_loc);
-    if (!help || *help == '\0')
-        help = _("Reason the transaction was voided");
-
-    return g_strdup (help);
-}
-
-static const char *
-gnc_split_register_get_rate_entry (VirtualLocation virt_loc,
-                                   gboolean translate,
-                                   gboolean *conditionally_changed,
-                                   gpointer user_data)
-{
-    SplitRegister *reg = user_data;
-    Split *split, *osplit;
-    Transaction *txn;
-    gnc_numeric amount, value, convrate;
-    SRInfo *info = gnc_split_register_get_info (reg);
-
-    if (info->rate_reset == RATE_RESET_REQD && info->auto_complete)
-        return "0";
-        
-    split = gnc_split_register_get_split (reg, virt_loc.vcell_loc);
-    if (!split)
-        return NULL;
-
-    /* If this is a basic, non-expanded ledger with exactly two splits,
-     * and split->txn->curr == split->acc->comm, then use the OTHER
-     * split for the rate.
-     */
-    osplit = xaccSplitGetOtherSplit (split);
-    txn = gnc_split_register_get_trans (reg, virt_loc.vcell_loc);
-
-    if (!gnc_split_register_current_trans_expanded (reg) && osplit &&
-            !gnc_split_register_needs_conv_rate(reg, txn,
-                    xaccSplitGetAccount(split)))
-    {
-        split = osplit;
-    }
-
-    amount = xaccSplitGetAmount (split);
-    value = xaccSplitGetValue (split);
-
-    if (gnc_numeric_zero_p (value))
-        return "0";
-
-    convrate = gnc_numeric_div (amount, value, GNC_DENOM_AUTO, GNC_HOW_DENOM_REDUCE);
-
-    return xaccPrintAmount (convrate, gnc_default_price_print_info ());
-}
-
-static const char *
-gnc_split_register_get_recn_entry (VirtualLocation virt_loc,
-                                   gboolean translate,
-                                   gboolean *conditionally_changed,
-                                   gpointer user_data)
-{
-    SplitRegister *reg = user_data;
-    Split *split;
-
-    split = gnc_split_register_get_split (reg, virt_loc.vcell_loc);
-    if (!split)
-        return NULL;
-
-    if (translate)
-        return gnc_get_reconcile_str (xaccSplitGetReconcile (split));
-    else
-    {
-        static char s[2];
-
-        s[0] = xaccSplitGetReconcile (split);
-        s[1] = '\0';
-
-        return s;
-    }
-}
-
-static const char *
-gnc_split_register_get_action_entry (VirtualLocation virt_loc,
-                                     gboolean translate,
-                                     gboolean *conditionally_changed,
-                                     gpointer user_data)
-{
-    SplitRegister *reg = user_data;
-    Split *split = gnc_split_register_get_split(reg, virt_loc.vcell_loc);
-
-    return gnc_get_num_action (NULL, split);
-}
-
-static char *
-gnc_split_register_get_action_help (VirtualLocation virt_loc,
-                                    gpointer user_data)
-{
-    SplitRegister *reg = user_data;
-    const char *help;
-
-    help = gnc_table_get_entry (reg->table, virt_loc);
-    if (!help || *help == '\0')
-        help = reg->use_tran_num_for_num_field ?
-        _("Enter an action type, or choose one from the list") :
-        _("Enter a reference number, such as the next check number, or choose an action type from the list");
-
-    return g_strdup (help);
-}
-
-static const char *
-gnc_split_register_get_memo_entry (VirtualLocation virt_loc,
-                                   gboolean translate,
-                                   gboolean *conditionally_changed,
-                                   gpointer user_data)
-{
-    SplitRegister *reg = user_data;
-    Split *split;
-
-    split = gnc_split_register_get_split (reg, virt_loc.vcell_loc);
-
-    return xaccSplitGetMemo (split);
-}
-
-static char *
-gnc_split_register_get_memo_help (VirtualLocation virt_loc,
-                                  gpointer user_data)
-{
-    SplitRegister *reg = user_data;
-    const char *help;
-
-    help = gnc_table_get_entry (reg->table, virt_loc);
-    if (!help || *help == '\0')
-        help = _("Enter a description of the split");
-    return g_strdup (help);
-}
-
-static const char *
-gnc_split_register_get_balance_entry (VirtualLocation virt_loc,
-                                      gboolean translate,
-                                      gboolean *conditionally_changed,
-                                      gpointer user_data)
-{
-    SplitRegister *reg = user_data;
-    SRInfo *info = gnc_split_register_get_info (reg);
-    gnc_numeric balance;
-    gboolean is_trans;
-    Split *split;
-    Account *account;
-
-    split = gnc_split_register_get_split (reg, virt_loc.vcell_loc);
-
-    if (split == xaccSplitLookup (&info->blank_split_guid,
-                                  gnc_get_current_book ()))
-        return NULL;
-
-    is_trans = gnc_cell_name_equal
-               (gnc_table_get_cell_name (reg->table, virt_loc), TBALN_CELL);
-
-    if (is_trans)
-        balance = get_trans_total_balance (reg, xaccSplitGetParent (split));
-    else
-        balance = xaccSplitGetBalance (split);
-
-    account = xaccSplitGetAccount (split);
-    if (!account)
-        account = gnc_split_register_get_default_account (reg);
-
-    if (gnc_reverse_balance (account))
-        balance = gnc_numeric_neg (balance);
-
-    return xaccPrintAmount (balance, gnc_account_print_info (account, FALSE));
-}
-
-static const char *
-gnc_split_register_get_price_entry (VirtualLocation virt_loc,
-                                    gboolean translate,
-                                    gboolean *conditionally_changed,
-                                    gpointer user_data)
-{
-    SplitRegister *reg = user_data;
-    gnc_numeric price;
-    Split *split;
-
-    if (!gnc_split_register_use_security_cells (reg, virt_loc))
-        return NULL;
-
-    split = gnc_split_register_get_split (reg, virt_loc.vcell_loc);
-
-    price = xaccSplitGetSharePrice (split);
-    if (gnc_numeric_zero_p (price))
-        return NULL;
-
-    return xaccPrintAmount (price, gnc_default_price_print_info ());
-}
-
-static char *
-gnc_split_register_get_price_help (VirtualLocation virt_loc,
-                                   gpointer user_data)
-{
-    SplitRegister *reg = user_data;
-    const char *help;
-
-    help = gnc_table_get_entry (reg->table, virt_loc);
-    if (!help || *help == '\0')
-        help = _("Enter the effective share price");
-
-    return g_strdup (help);
-}
-
-static const char *
-gnc_split_register_get_shares_entry (VirtualLocation virt_loc,
-                                     gboolean translate,
-                                     gboolean *conditionally_changed,
-                                     gpointer user_data)
-{
-    SplitRegister *reg = user_data;
-    gnc_numeric shares;
-    Split *split;
-
-    if (!gnc_split_register_use_security_cells (reg, virt_loc))
-        return NULL;
-
-    split = gnc_split_register_get_split (reg, virt_loc.vcell_loc);
-
-    shares = xaccSplitGetAmount (split);
-    if (gnc_numeric_zero_p (shares))
-        return NULL;
-
-    return xaccPrintAmount (shares, gnc_split_amount_print_info (split, FALSE));
-}
-
-static char *
-gnc_split_register_get_shares_help (VirtualLocation virt_loc,
-                                    gpointer user_data)
-{
-    SplitRegister *reg = user_data;
-    const char *help;
-
-    help = gnc_table_get_entry (reg->table, virt_loc);
-    if (!help || *help == '\0')
-        help = _("Enter the number of shares bought or sold");
-
-    return g_strdup (help);
-}
-
-static const char *
-gnc_split_register_get_tshares_entry (VirtualLocation virt_loc,
-                                      gboolean translate,
-                                      gboolean *conditionally_changed,
-                                      gpointer user_data)
-{
-    SplitRegister *reg = user_data;
-    gnc_numeric total;
-    Split *split;
-
-    split = gnc_split_register_get_split (reg, virt_loc.vcell_loc);
-
-    total = get_trans_total_amount (reg, xaccSplitGetParent (split));
-
-    return xaccPrintAmount (total, gnc_split_amount_print_info (split, FALSE));
-}
-
-static const char *
-gnc_split_register_get_xfrm_entry (VirtualLocation virt_loc,
-                                   gboolean translate,
-                                   gboolean *conditionally_changed,
-                                   gpointer user_data)
-{
-    static char *name = NULL;
-
-    SplitRegister *reg = user_data;
-    Split *split;
-
-    split = gnc_split_register_get_split (reg, virt_loc.vcell_loc);
-
-    g_free (name);
-
-    name = gnc_get_account_name_for_register (xaccSplitGetAccount (split));
-
-    return name;
-}
-
-static char *
-gnc_split_register_get_xfrm_help (VirtualLocation virt_loc,
-                                  gpointer user_data)
-{
-    SplitRegister *reg = user_data;
-    const char *help;
-
-    help = gnc_table_get_entry (reg->table, virt_loc);
-    if (!help || *help == '\0')
-        help = _("Enter the account to transfer from, "
-                 "or choose one from the list");
-
-    return g_strdup (help);
-}
-
-static const char *
-gnc_split_register_get_mxfrm_entry (VirtualLocation virt_loc,
-                                    gboolean translate,
-                                    gboolean *conditionally_changed,
-                                    gpointer user_data)
-{
-    static char *name = NULL;
-
-    SplitRegister *reg = user_data;
-    Split *split;
-    Split *s;
-
-    split = gnc_split_register_get_split (reg, virt_loc.vcell_loc);
-    if (!split)
-        return NULL;
-
-    s = xaccSplitGetOtherSplit (split);
-
-    g_free (name);
-
-    if (s)
-        name = gnc_get_account_name_for_register (xaccSplitGetAccount (s));
-    else
-    {
-        /* For multi-split transactions and stock splits,
-         * use a special value. */
-        s = xaccTransGetSplit (xaccSplitGetParent(split), 1);
-
-        if (s)
-            name = g_strdup (SPLIT_TRANS_STR);
-        else if (g_strcmp0 ("stock-split", xaccSplitGetType (split)) == 0)
-            name = g_strdup (STOCK_SPLIT_STR);
-        else
-            name = g_strdup ("");
-    }
-
-    return name;
-}
-
-static char *
-gnc_split_register_get_mxfrm_help (VirtualLocation virt_loc,
-                                   gpointer user_data)
-{
-    const char *help;
-
-    SplitRegister *reg = user_data;
-    Split *split;
-    Split *s;
-
-    split = gnc_split_register_get_split (reg, virt_loc.vcell_loc);
-    if (!split)
-        return NULL;
-
-    s = xaccSplitGetOtherSplit (split);
-
-    if (s)
-    {
-        help = gnc_split_register_get_mxfrm_entry (virt_loc, FALSE,
-                NULL, user_data);
-        if (!help || *help == '\0')
-            help = _("Enter the account to transfer from, "
-                     "or choose one from the list");
-    }
-    else
-    {
-        /* For multi-split transactions and stock splits,
-         * use a special value. */
-        s = xaccTransGetSplit (xaccSplitGetParent(split), 1);
-
-        if (s)
-            help = _("This transaction has multiple splits; "
-                     "press the Split button to see them all");
-        else if (g_strcmp0 ("stock-split", xaccSplitGetType (split)) == 0)
-            help = _("This transaction is a stock split; "
-                     "press the Split button to see details");
-        else
-            help = "";
-    }
-
-    return g_strdup (help);
-}
-
-/* Return the total amount of the transaction for splits of default account
- * and all subaccounts of the register. */
-static gnc_numeric
-get_trans_total_amount_subaccounts (SplitRegister *reg, Transaction *trans)
-{
-    GList *children, *child;
-    Account *parent;
-    gnc_numeric total = gnc_numeric_zero();
-
-    /* Get a list of all subaccounts for matching */
-    parent = gnc_split_register_get_default_account(reg);
-    if (!parent)
-        /* Register has no account, perhaps it's the general journal.  If it
-           has no account then we have no way of picking out the desired splits,
-           return zero. */
-        return total;
-    children = gnc_account_get_descendants(parent);
-    children = g_list_append(children, parent);
-
-    for (child = children; child; child = child->next)
-    {
-        total = gnc_numeric_add_fixed(total, xaccTransGetAccountAmount(trans, child->data));
-    }
-
-    g_list_free(children);
-
-    return total;
-}
-
-static const char *
-gnc_split_register_get_tdebcred_entry (VirtualLocation virt_loc,
-                                       gboolean translate,
-                                       gboolean *conditionally_changed,
-                                       gpointer user_data)
-{
-    SplitRegister *reg = user_data;
-    const char * cell_name;
-    gnc_numeric total;
-    Split *split;
-
-    split = gnc_split_register_get_split (reg, virt_loc.vcell_loc);
-    if (!split)
-        return NULL;
-
-    cell_name = gnc_table_get_cell_name (reg->table, virt_loc);
-
-    switch (reg->type)
-    {
-    case GENERAL_JOURNAL:
-    case INCOME_LEDGER:
-        total = get_trans_total_amount_subaccounts (reg, xaccSplitGetParent (split));
-        break;
-    default:
-        total = get_trans_total_amount (reg, xaccSplitGetParent (split));
-        break;
-    }
-
-    if (gnc_numeric_zero_p (total))
-        return NULL;
-
-    if (gnc_numeric_negative_p (total) &&
-            gnc_cell_name_equal (cell_name, TDEBT_CELL))
-        return NULL;
-
-    if (gnc_numeric_positive_p (total) &&
-            gnc_cell_name_equal (cell_name, TCRED_CELL))
-        return NULL;
-
-    total = gnc_numeric_abs (total);
-
-    return xaccPrintAmount (total, gnc_split_amount_print_info (split, FALSE));
-}
-
-/* return TRUE if we have a RATE_CELL; return FALSE if we do not.
- * (note: should match split-register-layout.c)
- */
-gboolean
-gnc_split_reg_has_rate_cell (SplitRegisterType type)
-{
-    switch (type)
-    {
-    case BANK_REGISTER:
-    case CASH_REGISTER:
-    case ASSET_REGISTER:
-    case CREDIT_REGISTER:
-    case LIABILITY_REGISTER:
-    case INCOME_REGISTER:
-    case EXPENSE_REGISTER:
-    case EQUITY_REGISTER:
-    case TRADING_REGISTER:
-    case GENERAL_JOURNAL:
-    case INCOME_LEDGER:
-    case SEARCH_LEDGER:
-        return TRUE;
-
-    case STOCK_REGISTER:
-    case CURRENCY_REGISTER:
-    case PORTFOLIO_LEDGER:
-    case RECEIVABLE_REGISTER:
-    case PAYABLE_REGISTER:
-    default:
-        return FALSE;
-    }
-}
-
-/* returns TRUE if you need to convert the split's value to the local
- * (account) display currency.  Returns FALSE if you can just use the
- * split->value directly.
- */
-gboolean
-gnc_split_register_needs_conv_rate (SplitRegister *reg,
-                                    Transaction *txn, Account *acc)
-{
-    gnc_commodity *txn_cur, *acc_com;
-
-    /* If there is not a RATE_CELL, then don't do anything */
-    if (!gnc_split_reg_has_rate_cell (reg->type))
-        return FALSE;
-
-    /* if txn->currency == acc->commodity, then return FALSE */
-    acc_com = xaccAccountGetCommodity (acc);
-    txn_cur = xaccTransGetCurrency (txn);
-    if (txn_cur && acc_com && gnc_commodity_equal (txn_cur, acc_com))
-        return FALSE;
-
-    return TRUE;
-}
-
-static const char *
-gnc_split_register_get_debcred_entry (VirtualLocation virt_loc,
-                                      gboolean translate,
-                                      gboolean *conditionally_changed,
-                                      gpointer user_data)
-{
-    SplitRegister *reg = user_data;
-    gboolean is_debit;
-    Split *split;
-    Transaction *trans;
-    gnc_commodity *currency;
-
-    is_debit = gnc_cell_name_equal
-               (gnc_table_get_cell_name (reg->table, virt_loc), DEBT_CELL);
-
-    split = gnc_split_register_get_split (reg, virt_loc.vcell_loc);
-    trans = gnc_split_register_get_trans (reg, virt_loc.vcell_loc);
-
-    currency = xaccTransGetCurrency (trans);
-    if (!currency)
-        currency = gnc_default_currency ();
-
-    if (!split)
-    {
-        gnc_numeric imbalance;
-        Account *acc;
-
-        imbalance = xaccTransGetImbalanceValue (trans);
-
-        if (gnc_numeric_zero_p (imbalance))
-            return NULL;
-
-        if (xaccTransUseTradingAccounts (trans))
-        {
-            MonetaryList *imbal_list;
-            gnc_monetary *imbal_mon;
-            imbal_list = xaccTransGetImbalance (trans);
-
-            if (!imbal_list)
-            {
-                /* No commodity imbalance, there shouldn't be a value imablance. */
-                return NULL;
-            }
-
-            if (imbal_list->next)
-            {
-                /* Multiple currency imbalance. */
-                gnc_monetary_list_free(imbal_list);
-                return NULL;
-            }
-
-            imbal_mon = imbal_list->data;
-            if (!gnc_commodity_equal(gnc_monetary_commodity(*imbal_mon), currency))
-            {
-                /* Imbalance is in wrong currency */
-                gnc_monetary_list_free(imbal_list);
-                return NULL;
-            }
-
-            if (!gnc_numeric_equal (gnc_monetary_value(*imbal_mon), imbalance))
-            {
-                /* Value and commodity imbalances differ */
-                gnc_monetary_list_free(imbal_list);
-                return NULL;
-            }
-
-            /* Done with the imbalance list */
-            gnc_monetary_list_free(imbal_list);
-        }
-
-        imbalance = gnc_numeric_neg (imbalance);
-
-        if (gnc_numeric_negative_p (imbalance) && is_debit)
-            return NULL;
-
-        if (gnc_numeric_positive_p (imbalance) && !is_debit)
-            return NULL;
-
-        if (conditionally_changed)
-            *conditionally_changed = TRUE;
-
-        imbalance = gnc_numeric_abs (imbalance);
-
-        acc = gnc_split_register_get_default_account (reg);
-        if (gnc_split_register_needs_conv_rate (reg, trans, acc))
-        {
-            imbalance = gnc_numeric_mul (imbalance,
-                                         xaccTransGetAccountConvRate(trans, acc),
-                                         gnc_commodity_get_fraction (currency),
-                                         GNC_HOW_RND_ROUND_HALF_UP);
-        }
-        else
-        {
-            imbalance = gnc_numeric_convert (imbalance,
-                                             gnc_commodity_get_fraction (currency),
-                                             GNC_HOW_RND_ROUND_HALF_UP);
-        }
-
-        return xaccPrintAmount (imbalance, gnc_account_print_info (acc, FALSE));
-    }
-
-    {
-        gnc_numeric amount;
-        gnc_commodity *split_commodity;
-        GNCPrintAmountInfo print_info;
-        Account *account;
-        gnc_commodity * commodity;
-
-        account = gnc_split_register_get_default_account (reg);
-        commodity = xaccAccountGetCommodity (account);
-        split_commodity = xaccAccountGetCommodity(xaccSplitGetAccount(split));
-
-        if (xaccTransUseTradingAccounts (trans))
-        {
-            gboolean use_symbol, is_current;
-            is_current = virt_cell_loc_equal (reg->table->current_cursor_loc.vcell_loc,
-                                              virt_loc.vcell_loc);
-
-            if (reg->type == STOCK_REGISTER ||
-                    reg->type == CURRENCY_REGISTER ||
-                    reg->type == PORTFOLIO_LEDGER)
-            {
-                gnc_commodity *amount_commodity;
-                /* security register.  If this split has price and shares columns,
-                   use the value, otherwise use the amount.  */
-                if (gnc_split_register_use_security_cells(reg, virt_loc))
-                {
-                    amount = xaccSplitGetValue(split);
-                    amount_commodity = currency;
-                }
-                else
-                {
-                    amount = xaccSplitGetAmount(split);
-                    amount_commodity = split_commodity;
-                }
-                /* Show the currency if it is not the default currency */
-                if (is_current ||
-                        gnc_commodity_equiv(amount_commodity, gnc_default_currency()))
-                    use_symbol = FALSE;
-                else
-                    use_symbol = TRUE;
-                print_info = gnc_commodity_print_info(amount_commodity, use_symbol);
-            }
-            else
-            {
-                /* non-security register, always use the split amount. */
-                amount = xaccSplitGetAmount(split);
-                if (is_current ||
-                        gnc_commodity_equiv(split_commodity, commodity))
-                    use_symbol = FALSE;
-                else
-                    use_symbol = TRUE;
-                print_info = gnc_commodity_print_info(split_commodity, use_symbol);
-            }
-        }
-        else
-        {
-            /* If this account is not a stock/mutual/currency account, and
-            * currency != the account commodity, then use the SplitAmount
-            * instead of the SplitValue.
-            */
-            switch (reg->type)
-            {
-            case STOCK_REGISTER:
-            case CURRENCY_REGISTER:
-            case PORTFOLIO_LEDGER:
-                amount = xaccSplitGetValue (split);
-                print_info = gnc_commodity_print_info (currency, FALSE);
-                break;
-
-            default:
-                if (commodity && !gnc_commodity_equal (commodity, currency))
-                    /* Convert this to the "local" value */
-                    amount = xaccSplitConvertAmount(split, account);
-                else
-                    amount = xaccSplitGetValue (split);
-                print_info = gnc_account_print_info (account, FALSE);
-                break;
-            }
-        }
-
-        if (gnc_numeric_zero_p (amount))
-            return NULL;
-
-        if (gnc_numeric_negative_p (amount) && is_debit)
-            return NULL;
-
-        if (gnc_numeric_positive_p (amount) && !is_debit)
-            return NULL;
-
-        amount = gnc_numeric_abs (amount);
-
-        return xaccPrintAmount (amount, print_info);
-    }
-}
-
-/* Calculates the register balance for each split at runtime.
- * This works regardless of the sort order. */
-static const char *
-gnc_split_register_get_rbaln_entry (VirtualLocation virt_loc,
-                                    gboolean translate,
-                                    gboolean *conditionally_changed,
-                                    gpointer user_data)
-{
-    SplitRegister *reg = user_data;
-    SRInfo *info = gnc_split_register_get_info (reg);
-    Split *split;
-    Transaction *trans;
-    gnc_numeric balance;
-    Account *account;
-
-    /* Return NULL if this is a blank transaction. */
-    split = gnc_split_register_get_split (reg, virt_loc.vcell_loc);
-    if (split == xaccSplitLookup (&info->blank_split_guid,
-                                  gnc_get_current_book ()))
-        return NULL;
-
-    trans = xaccSplitGetParent (split);
-    if (!trans)
-        return NULL;
-
-    balance = gnc_split_register_get_rbaln (virt_loc, user_data, TRUE);
-
-    account = xaccSplitGetAccount (split);
-    if (!account)
-        account = gnc_split_register_get_default_account (reg);
-
-    if (gnc_reverse_balance (account))
-        balance = gnc_numeric_neg (balance);
-
-    return xaccPrintAmount (balance, gnc_account_print_info (account, FALSE));
-}
-
-static gboolean
-gnc_split_register_cursor_is_readonly (VirtualLocation virt_loc,
-                                       gpointer user_data)
-{
-    SplitRegister *reg = user_data;
-    Split *split;
-    Transaction *txn;
-    char type;
-
-    split = gnc_split_register_get_split (reg, virt_loc.vcell_loc);
-    if (!split) return FALSE;
-
-    txn = xaccSplitGetParent (split);
-    if (!txn) return FALSE;
-
-    if (xaccTransGetReadOnly(txn)
-            || xaccTransIsReadonlyByPostedDate(txn))
-        return(TRUE);
-
-    type = xaccTransGetTxnType (txn);
-    return (type == TXN_TYPE_INVOICE);
-}
-
-static CellIOFlags
-gnc_split_register_get_inactive_io_flags (VirtualLocation virt_loc,
-        gpointer user_data)
-{
-    if (gnc_split_register_cursor_is_readonly (virt_loc, user_data))
-        return XACC_CELL_ALLOW_READ_ONLY;
-
-    return XACC_CELL_ALLOW_NONE;
-}
-
-static CellIOFlags
-gnc_split_register_get_standard_io_flags (VirtualLocation virt_loc,
-        gpointer user_data)
-{
-    if (gnc_split_register_cursor_is_readonly (virt_loc, user_data))
-        return XACC_CELL_ALLOW_READ_ONLY;
-
-    return XACC_CELL_ALLOW_ALL;
-}
-
-static CellIOFlags
-gnc_split_register_get_recn_io_flags (VirtualLocation virt_loc,
-                                      gpointer user_data)
-{
-    if (gnc_split_register_cursor_is_readonly (virt_loc, user_data))
-        return XACC_CELL_ALLOW_READ_ONLY;
-
-    return XACC_CELL_ALLOW_ALL | XACC_CELL_ALLOW_EXACT_ONLY;
-}
-
-static CellIOFlags
-gnc_split_register_get_ddue_io_flags (VirtualLocation virt_loc,
-                                      gpointer user_data)
-{
-    SplitRegister *reg = user_data;
-    char type;
-
-    type = gnc_split_register_get_type_value (reg, virt_loc);
-
-    /* Only print the due date for invoice transactions */
-    if (type != TXN_TYPE_INVOICE)
-    {
-        return XACC_CELL_ALLOW_NONE;
-    }
-
-    return XACC_CELL_ALLOW_READ_ONLY;
-}
-
-static CellIOFlags
-gnc_split_register_get_rate_io_flags (VirtualLocation virt_loc,
-                                      gpointer user_data)
-{
-    return XACC_CELL_ALLOW_SHADOW;
-}
-
-static CellIOFlags
-gnc_split_register_get_debcred_io_flags (VirtualLocation virt_loc,
-        gpointer user_data)
-{
-    SplitRegister *reg = user_data;
-    Split *split;
-
-    if (gnc_split_register_cursor_is_readonly (virt_loc, user_data))
-        return XACC_CELL_ALLOW_READ_ONLY;
-
-    split = gnc_split_register_get_split (reg, virt_loc.vcell_loc);
-
-    if (g_strcmp0 ("stock-split", xaccSplitGetType (split)) == 0)
-        return XACC_CELL_ALLOW_NONE;
-
-    return XACC_CELL_ALLOW_ALL;
-}
-
-static CellIOFlags
-gnc_split_register_get_security_io_flags (VirtualLocation virt_loc,
-        gpointer user_data)
-{
-    SplitRegister *reg = user_data;
-
-    if (gnc_split_register_cursor_is_readonly (virt_loc, user_data))
-        return XACC_CELL_ALLOW_READ_ONLY;
-
-    if (gnc_split_register_use_security_cells (reg, virt_loc))
-        return XACC_CELL_ALLOW_ALL;
-
-    return XACC_CELL_ALLOW_SHADOW;
-}
-
-static gboolean
-xaccTransWarnReadOnly (const Transaction *trans)
-{
-    GtkWidget *dialog;
-    const gchar *reason;
-    const gchar *format =
-        _("Cannot modify or delete this transaction. This transaction is "
-          "marked read-only because:\n\n'%s'");
-
-    if (!trans) return FALSE;
-
-    reason = xaccTransGetReadOnly (trans);
-    if (reason)
-    {
-        dialog = gtk_message_dialog_new(NULL,
-                                        0,
-                                        GTK_MESSAGE_ERROR,
-                                        GTK_BUTTONS_OK,
-                                        format,
-                                        reason);
-        gtk_dialog_run(GTK_DIALOG(dialog));
-        gtk_widget_destroy(dialog);
-        return TRUE;
-    }
-    return FALSE;
-}
-
-
-static gboolean
-gnc_split_register_confirm (VirtualLocation virt_loc, gpointer user_data)
-{
-    SplitRegister *reg = user_data;
-    SRInfo *info = gnc_split_register_get_info (reg);
-    Transaction *trans;
-    Split *split;
-    char recn;
-    const char *cell_name;
-    gboolean change_ok;
-
-    /* This assumes we reset the flag whenever we change splits.
-     * This happens in gnc_split_register_move_cursor(). */
-    if (info->change_confirmed)
-        return TRUE;
-
-    split = gnc_split_register_get_split (reg, virt_loc.vcell_loc);
-    if (!split)
-        return TRUE;
-
-    trans = xaccSplitGetParent (split);
-    if (xaccTransWarnReadOnly(trans))
-        return FALSE;
-    if (gnc_table_layout_get_cell_changed (reg->table->layout, RECN_CELL, FALSE))
-        recn = gnc_recn_cell_get_flag
-               ((RecnCell *) gnc_table_layout_get_cell (reg->table->layout, RECN_CELL));
-    else
-        recn = xaccSplitGetReconcile (split);
-
-    /* What Cell are we in */
-    cell_name = gnc_table_get_cell_name (reg->table, virt_loc);
-
-    /* These cells can be changed */
-    change_ok = (g_strcmp0(cell_name, "notes") == 0) || (g_strcmp0(cell_name, "memo") == 0) || (g_strcmp0(cell_name, "action") == 0);
-
-    if ((recn == YREC || xaccTransHasReconciledSplits (trans)) && !change_ok)
-    {
-        GtkWidget *dialog, *window;
-        gint response;
-        const gchar *title;
-        const gchar *message;
-
-        if(recn == YREC)
-        {
-            title = _("Change reconciled split?");
-            message =
-             _("You are about to change a reconciled split. Doing so might make "
-               "future reconciliation difficult! Continue with this change?");
-        }
-        else
-        {
-            title = _("Change split linked to a reconciled split?");
-            message =
-            _("You are about to change a split that is linked to a reconciled split. "
-              "Doing so might make future reconciliation difficult! Continue with this change?");
-        }
-
-        /* Does the user want to be warned? */
-        window = gnc_split_register_get_parent(reg);
-        dialog =
-            gtk_message_dialog_new(GTK_WINDOW(window),
-                                   GTK_DIALOG_DESTROY_WITH_PARENT,
-                                   GTK_MESSAGE_WARNING,
-                                   GTK_BUTTONS_CANCEL,
-                                   "%s", title);
-        gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
-                "%s", message);
-        gtk_dialog_add_button(GTK_DIALOG(dialog), _("Chan_ge Split"),
-                              GTK_RESPONSE_YES);
-        response = gnc_dialog_run(GTK_DIALOG(dialog), GNC_PREF_WARN_REG_RECD_SPLIT_MOD);
-        gtk_widget_destroy(dialog);
-        if (response != GTK_RESPONSE_YES)
-            return FALSE;
-
-        info->change_confirmed = TRUE;
-    }
-
-    return TRUE;
-}
-
-static gpointer
-gnc_split_register_guid_malloc (void)
-{
-    GncGUID *guid;
-
-    guid = guid_malloc ();
-
-    *guid = *guid_null ();
-
-    return guid;
-}
-
-static const char *
-gnc_template_register_get_xfrm_entry (VirtualLocation virt_loc,
-                                      gboolean translate,
-                                      gboolean *conditionally_changed,
-                                      gpointer user_data)
-{
-    static char *name = NULL;
-
-    SplitRegister *reg = user_data;
-    Split *split;
-    Account *account;
-    GncGUID *guid = NULL;
-
-    split = gnc_split_register_get_split (reg, virt_loc.vcell_loc);
-    if (!split)
-        return NULL;
-    /* Caller either uses the return as a temporary in a boolean
-     * expression or g_strdups it, so we keep it static and free the
-     * old one on every call to avoid leaks. Ugly, but it works.
-     */
-    g_free (name);
-    qof_instance_get (QOF_INSTANCE (split),
-		      "sx-account", &guid,
-		      NULL);
-    account = xaccAccountLookup (guid, gnc_get_current_book ());
-    name = account ? gnc_get_account_name_for_register (account) : NULL;
-
-    return name;
-}
-
-static const char *
-gnc_template_register_get_fdebt_entry (VirtualLocation virt_loc,
-                                       gboolean translate,
-                                       gboolean *conditionally_changed,
-                                       gpointer user_data)
-{
-    SplitRegister *reg = user_data;
-    Split *split = gnc_split_register_get_split(reg, virt_loc.vcell_loc);
-    char *formula = NULL;
-
-    if (split)
-    {
-        qof_instance_get (QOF_INSTANCE (split),
-                  "sx-debit-formula", &formula,
-                  NULL);
-    }
-
-    return formula;
-}
-
-static char *
-gnc_split_register_get_fdebt_help (VirtualLocation virt_loc,
-                                   gpointer user_data)
-{
-    SplitRegister *reg = user_data;
-    const char *help;
-
-    help = gnc_table_get_entry (reg->table, virt_loc);
-    if (!help || *help == '\0')
-        help = _("Enter debit formula for real transaction");
-
-    return g_strdup (help);
-}
-
-static const char *
-gnc_template_register_get_fcred_entry (VirtualLocation virt_loc,
-                                       gboolean translate,
-                                       gboolean *conditionally_changed,
-                                       gpointer user_data)
-{
-    SplitRegister *reg = user_data;
-    Split *split = gnc_split_register_get_split(reg, virt_loc.vcell_loc);
-    char *formula = NULL;
-
-    if (split)
-    {
-        qof_instance_get (QOF_INSTANCE (split),
-                  "sx-credit-formula", &formula,
-                  NULL);
-    }
-
-    return formula;
-
-}
-
-static char *
-gnc_split_register_get_fcred_help (VirtualLocation virt_loc,
-                                   gpointer user_data)
-{
-    SplitRegister *reg = user_data;
-    const char *help = gnc_table_get_entry (reg->table, virt_loc);
-
-    if (!help || *help == '\0')
-        help = _("Enter credit formula for real transaction");
-
-    return g_strdup (help);
-}
-
-static char *
-gnc_split_register_get_default_help (VirtualLocation virt_loc,
-                                     gpointer user_data)
-{
-    SplitRegister *reg = user_data;
-    const char *help = gnc_table_get_entry(reg->table, virt_loc);
-
-    return g_strdup (help);
-}
-
-/* This function has been #if-zeroed for a year; in all released versions since
- * 2001 it has issued dire warnings about being wrong, and returned nothing
- * because it was querying a non-existent slot.
- *
- * Now it retrieves the sx-debit-numeric or sx-credit-numeric properties from
- * the split. I'm not sure that it's what was originally intended, but at least
- * it can do something now.	<jralls, 8 June 2015>
- */
-static const char *
-gnc_template_register_get_debcred_entry (VirtualLocation virt_loc,
-        gboolean translate,
-        gboolean *conditionally_changed,
-        gpointer user_data)
-{
-    SplitRegister *reg = user_data;
-    Split *split;
-    gnc_numeric *amount;
-    const char * cell_name;
-
-    split = gnc_split_register_get_split (reg, virt_loc.vcell_loc);
-    if (!split)
-        return gnc_split_register_get_debcred_entry (virt_loc,
-                translate,
-                conditionally_changed,
-                user_data);
-
-    cell_name = gnc_table_get_cell_name (reg->table, virt_loc);
-    if (gnc_cell_name_equal (cell_name, DEBT_CELL))
-        qof_instance_get (QOF_INSTANCE (split),
-                          "sx-debit-numeric", &amount,
-                          NULL);
-    else
-        qof_instance_get (QOF_INSTANCE (split),
-                          "sx-credit-numeric", &amount,
-                          NULL);
-    if (gnc_numeric_zero_p (*amount))
-        return "";
-
-    *amount = gnc_numeric_abs (*amount);
-    return xaccPrintAmount (*amount, gnc_default_print_info (FALSE));
-}
-
-static void
-gnc_split_register_guid_free (gpointer guid)
-{
-    guid_free (guid);
-}
-
-static void
-gnc_split_register_guid_copy (gpointer p_to, gconstpointer p_from)
-{
-    GncGUID *to = p_to;
-    const GncGUID *from = p_from;
-
-    g_return_if_fail (to != NULL);
-    *to = from ? *from : *guid_null();
-}
-
-
-static void
-gnc_split_register_colorize_negative (gpointer gsettings, gchar *key, gpointer unused)
-{
-    use_red_for_negative = gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL,
-                                              GNC_PREF_NEGATIVE_IN_RED);
-}
-
-
-static gpointer
-gnc_split_register_model_add_hooks (gpointer unused)
-{
-    gnc_prefs_register_cb(GNC_PREFS_GROUP_GENERAL, GNC_PREF_NEGATIVE_IN_RED,
-                          gnc_split_register_colorize_negative,
-                          NULL);
-    /* Get the initial value */
-    use_red_for_negative = gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL,
-                                              GNC_PREF_NEGATIVE_IN_RED);
-    return NULL;
-}
-
-
-TableModel *
-gnc_split_register_model_new (void)
-{
-    TableModel *model;
-    static GOnce once = G_ONCE_INIT;
-
-    g_once(&once, gnc_split_register_model_add_hooks, NULL);
-
-    model = gnc_table_model_new ();
-
-    gnc_table_model_set_entry_handler (model,
-                                       gnc_split_register_get_date_entry,
-                                       DATE_CELL);
-
-    gnc_table_model_set_entry_handler (model,
-                                       gnc_split_register_get_due_date_entry,
-                                       DDUE_CELL);
-
-    gnc_table_model_set_entry_handler (model,
-                                       gnc_split_register_get_num_entry,
-                                       NUM_CELL);
-
-    gnc_table_model_set_entry_handler (model,
-                                       gnc_split_register_get_tran_num_entry,
-                                       TNUM_CELL);
-
-    gnc_table_model_set_entry_handler (model,
-                                       gnc_split_register_get_desc_entry,
-                                       DESC_CELL);
-
-    gnc_table_model_set_entry_handler (model,
-                                       gnc_split_register_get_notes_entry,
-                                       NOTES_CELL);
-
-    gnc_table_model_set_entry_handler (model,
-                                       gnc_split_register_get_vnotes_entry,
-                                       VNOTES_CELL);
-
-    gnc_table_model_set_entry_handler (model,
-                                       gnc_split_register_get_rate_entry,
-                                       RATE_CELL);
-
-    gnc_table_model_set_entry_handler (model,
-                                       gnc_split_register_get_recn_entry,
-                                       RECN_CELL);
-
-    gnc_table_model_set_entry_handler (model,
-                                       gnc_split_register_get_action_entry,
-                                       ACTN_CELL);
-
-    gnc_table_model_set_entry_handler (model,
-                                       gnc_split_register_get_memo_entry,
-                                       MEMO_CELL);
-
-    gnc_table_model_set_entry_handler (model,
-                                       gnc_split_register_get_balance_entry,
-                                       BALN_CELL);
-
-    gnc_table_model_set_entry_handler (model,
-                                       gnc_split_register_get_balance_entry,
-                                       TBALN_CELL);
-
-    gnc_table_model_set_entry_handler (model,
-                                       gnc_split_register_get_price_entry,
-                                       PRIC_CELL);
-
-    gnc_table_model_set_entry_handler (model,
-                                       gnc_split_register_get_shares_entry,
-                                       SHRS_CELL);
-
-    gnc_table_model_set_entry_handler (model,
-                                       gnc_split_register_get_tshares_entry,
-                                       TSHRS_CELL);
-
-    gnc_table_model_set_entry_handler (model,
-                                       gnc_split_register_get_xfrm_entry,
-                                       XFRM_CELL);
-
-    gnc_table_model_set_entry_handler (model,
-                                       gnc_split_register_get_mxfrm_entry,
-                                       MXFRM_CELL);
-
-    gnc_table_model_set_entry_handler (model,
-                                       gnc_split_register_get_tdebcred_entry,
-                                       TDEBT_CELL);
-
-    gnc_table_model_set_entry_handler (model,
-                                       gnc_split_register_get_tdebcred_entry,
-                                       TCRED_CELL);
-
-    gnc_table_model_set_entry_handler (model,
-                                       gnc_split_register_get_associate_entry,
-                                       ASSOC_CELL);
-
-    gnc_table_model_set_entry_handler (model,
-                                       gnc_split_register_get_type_entry,
-                                       TYPE_CELL);
-
-    gnc_table_model_set_entry_handler (model,
-                                       gnc_split_register_get_debcred_entry,
-                                       DEBT_CELL);
-
-    gnc_table_model_set_entry_handler (model,
-                                       gnc_split_register_get_debcred_entry,
-                                       CRED_CELL);
-
-    gnc_table_model_set_entry_handler (model,
-                                       gnc_split_register_get_rbaln_entry,
-                                       RBALN_CELL);
-
-
-    gnc_table_model_set_label_handler (model,
-                                       gnc_split_register_get_date_label,
-                                       DATE_CELL);
-
-    gnc_table_model_set_label_handler (model,
-                                       gnc_split_register_get_due_date_label,
-                                       DDUE_CELL);
-
-    gnc_table_model_set_label_handler (model,
-                                       gnc_split_register_get_num_label,
-                                       NUM_CELL);
-
-    gnc_table_model_set_label_handler (model,
-                                       gnc_split_register_get_tran_num_label,
-                                       TNUM_CELL);
-
-    gnc_table_model_set_label_handler (model,
-                                       gnc_split_register_get_desc_label,
-                                       DESC_CELL);
-
-    gnc_table_model_set_label_handler (model,
-                                       gnc_split_register_get_recn_label,
-                                       RECN_CELL);
-
-    gnc_table_model_set_label_handler (model,
-                                       gnc_split_register_get_baln_label,
-                                       BALN_CELL);
-
-    gnc_table_model_set_label_handler (model,
-                                       gnc_split_register_get_action_label,
-                                       ACTN_CELL);
-
-    gnc_table_model_set_label_handler (model,
-                                       gnc_split_register_get_xfrm_label,
-                                       XFRM_CELL);
-
-    gnc_table_model_set_label_handler (model,
-                                       gnc_split_register_get_memo_label,
-                                       MEMO_CELL);
-
-    gnc_table_model_set_label_handler (model,
-                                       gnc_split_register_get_debit_label,
-                                       DEBT_CELL);
-
-    gnc_table_model_set_label_handler (model,
-                                       gnc_split_register_get_credit_label,
-                                       CRED_CELL);
-
-    gnc_table_model_set_label_handler (model,
-                                       gnc_split_register_get_price_label,
-                                       PRIC_CELL);
-
-    gnc_table_model_set_label_handler (model,
-                                       gnc_split_register_get_shares_label,
-                                       SHRS_CELL);
-
-    gnc_table_model_set_label_handler (model,
-                                       gnc_split_register_get_mxfrm_label,
-                                       MXFRM_CELL);
-
-    gnc_table_model_set_label_handler (model,
-                                       gnc_split_register_get_tcredit_label,
-                                       TCRED_CELL);
-
-    gnc_table_model_set_label_handler (model,
-                                       gnc_split_register_get_tdebit_label,
-                                       TDEBT_CELL);
-
-    gnc_table_model_set_label_handler (model,
-                                       gnc_split_register_get_tshares_label,
-                                       TSHRS_CELL);
-
-    gnc_table_model_set_label_handler (model,
-                                       gnc_split_register_get_tbalance_label,
-                                       TBALN_CELL);
-
-    gnc_table_model_set_label_handler (model,
-                                       gnc_split_register_get_associate_label,
-                                       ASSOC_CELL);
-
-    gnc_table_model_set_label_handler (model,
-                                       gnc_split_register_get_type_label,
-                                       TYPE_CELL);
-
-    gnc_table_model_set_label_handler (model,
-                                       gnc_split_register_get_notes_label,
-                                       NOTES_CELL);
-
-    gnc_table_model_set_label_handler (model,
-                                       gnc_split_register_get_fdebit_label,
-                                       FDEBT_CELL);
-
-    gnc_table_model_set_label_handler (model,
-                                       gnc_split_register_get_fcredit_label,
-                                       FCRED_CELL);
-
-    gnc_table_model_set_label_handler (model,
-                                       gnc_split_register_get_tbalance_label,
-                                       RBALN_CELL);
-
-
-    gnc_table_model_set_default_help_handler(
-        model, gnc_split_register_get_default_help);
-
-    gnc_table_model_set_help_handler (model,
-                                      gnc_split_register_get_date_help,
-                                      DATE_CELL);
-
-    gnc_table_model_set_help_handler (model,
-                                      gnc_split_register_get_date_help,
-                                      DDUE_CELL);
-
-    gnc_table_model_set_help_handler (model,
-                                      gnc_split_register_get_num_help,
-                                      NUM_CELL);
-
-    gnc_table_model_set_help_handler (model,
-                                      gnc_split_register_get_tran_num_help,
-                                      TNUM_CELL);
-
-    gnc_table_model_set_help_handler (model,
-                                      gnc_split_register_get_desc_help,
-                                      DESC_CELL);
-
-    gnc_table_model_set_help_handler (model,
-                                      gnc_split_register_get_price_help,
-                                      PRIC_CELL);
-
-    gnc_table_model_set_help_handler (model,
-                                      gnc_split_register_get_shares_help,
-                                      SHRS_CELL);
-
-    gnc_table_model_set_help_handler (model,
-                                      gnc_split_register_get_action_help,
-                                      ACTN_CELL);
-
-    gnc_table_model_set_help_handler (model,
-                                      gnc_split_register_get_memo_help,
-                                      MEMO_CELL);
-
-    gnc_table_model_set_help_handler (model,
-                                      gnc_split_register_get_notes_help,
-                                      NOTES_CELL);
-
-    gnc_table_model_set_help_handler (model,
-                                      gnc_split_register_get_vnotes_help,
-                                      VNOTES_CELL);
-
-    gnc_table_model_set_help_handler (model,
-                                      gnc_split_register_get_xfrm_help,
-                                      XFRM_CELL);
-
-    gnc_table_model_set_help_handler (model,
-                                      gnc_split_register_get_mxfrm_help,
-                                      MXFRM_CELL);
-
-    gnc_table_model_set_help_handler (model,
-                                      gnc_split_register_get_fcred_help,
-                                      FCRED_CELL);
-
-    gnc_table_model_set_help_handler (model,
-                                      gnc_split_register_get_fdebt_help,
-                                      FDEBT_CELL);
-
-
-    gnc_table_model_set_io_flags_handler(
-        model, gnc_split_register_get_standard_io_flags, DATE_CELL);
-
-    /* FIXME: We really only need a due date for 'invoices', not for
-     * 'payments' or 'receipts'.  This implies we really only need the
-     * due-date for transactions that credit the ACCT_TYPE_RECEIVABLE or
-     * debit the ACCT_TYPE_PAYABLE account type.
-     */
-    gnc_table_model_set_io_flags_handler(
-        model, gnc_split_register_get_rate_io_flags, RATE_CELL);
-
-    gnc_table_model_set_io_flags_handler(
-        model, gnc_split_register_get_ddue_io_flags, DDUE_CELL);
-
-    gnc_table_model_set_io_flags_handler(
-        model, gnc_split_register_get_standard_io_flags, NUM_CELL);
-
-    gnc_table_model_set_io_flags_handler(
-        model, gnc_split_register_get_standard_io_flags, TNUM_CELL);
-
-    gnc_table_model_set_io_flags_handler(
-        model, gnc_split_register_get_standard_io_flags, DESC_CELL);
-
-    gnc_table_model_set_io_flags_handler(
-        model, gnc_split_register_get_standard_io_flags, ACTN_CELL);
-
-    gnc_table_model_set_io_flags_handler(
-        model, gnc_split_register_get_standard_io_flags, XFRM_CELL);
-
-    gnc_table_model_set_io_flags_handler(
-        model, gnc_split_register_get_standard_io_flags, MEMO_CELL);
-
-    gnc_table_model_set_io_flags_handler(
-        model, gnc_split_register_get_standard_io_flags, MXFRM_CELL);
-
-    gnc_table_model_set_io_flags_handler(
-        model, gnc_split_register_get_standard_io_flags, NOTES_CELL);
-
-    gnc_table_model_set_io_flags_handler(
-        model, gnc_split_register_get_inactive_io_flags, VNOTES_CELL);
-
-    gnc_table_model_set_io_flags_handler(
-        model, gnc_split_register_get_debcred_io_flags, CRED_CELL);
-
-    gnc_table_model_set_io_flags_handler(
-        model, gnc_split_register_get_debcred_io_flags, DEBT_CELL);
-
-    gnc_table_model_set_io_flags_handler(
-        model, gnc_split_register_get_recn_io_flags, RECN_CELL);
-
-    gnc_table_model_set_io_flags_handler(
-        model, gnc_split_register_get_recn_io_flags, ASSOC_CELL);
-
-    gnc_table_model_set_io_flags_handler(
-        model, gnc_split_register_get_recn_io_flags, TYPE_CELL);
-
-    gnc_table_model_set_io_flags_handler(
-        model, gnc_split_register_get_security_io_flags, PRIC_CELL);
-
-    gnc_table_model_set_io_flags_handler(
-        model, gnc_split_register_get_security_io_flags, SHRS_CELL);
-
-
-    gnc_table_model_set_fg_color_handler(
-        model, gnc_split_register_get_fg_color, SHRS_CELL);
-
-    gnc_table_model_set_fg_color_handler(
-        model, gnc_split_register_get_fg_color, TSHRS_CELL);
-
-    gnc_table_model_set_fg_color_handler(
-        model, gnc_split_register_get_fg_color, BALN_CELL);
-
-    gnc_table_model_set_fg_color_handler(
-        model, gnc_split_register_get_fg_color, TBALN_CELL);
-
-    gnc_table_model_set_fg_color_handler(
-        model, gnc_split_register_get_fg_color, RBALN_CELL);
-
-    gnc_table_model_set_fg_color_handler(
-        model, gnc_split_register_get_gtkrc_fg_color, "gtkrc");
-
-
-    gnc_table_model_set_default_bg_color_handler(
-        model, gnc_split_register_get_bg_color);
-
-    gnc_table_model_set_bg_color_handler(
-        model, gnc_split_register_get_gtkrc_bg_color, "gtkrc");
-
-    gnc_table_model_set_bg_color_handler(
-        model, gnc_split_register_get_debcred_bg_color, DEBT_CELL);
-
-    gnc_table_model_set_bg_color_handler(
-        model, gnc_split_register_get_debcred_bg_color, CRED_CELL);
-
-    gnc_table_model_set_bg_color_handler(
-        model, gnc_split_register_get_debcred_bg_color, TDEBT_CELL);
-
-    gnc_table_model_set_bg_color_handler(
-        model, gnc_split_register_get_debcred_bg_color, TCRED_CELL);
-
-    gnc_table_model_set_bg_color_handler(
-        model, gnc_split_register_get_debcred_bg_color, FCRED_CELL);
-
-    gnc_table_model_set_bg_color_handler(
-        model, gnc_split_register_get_debcred_bg_color, FDEBT_CELL);
-
-
-    gnc_table_model_set_default_cell_border_handler(
-        model, gnc_split_register_get_border);
-
-
-    gnc_table_model_set_default_confirm_handler(
-        model, gnc_split_register_confirm);
-
-    model->cell_data_allocator   = gnc_split_register_guid_malloc;
-    model->cell_data_deallocator = gnc_split_register_guid_free;
-    model->cell_data_copy        = gnc_split_register_guid_copy;
-
-    gnc_split_register_model_add_save_handlers (model);
-
-    return model;
-}
-
-TableModel *
-gnc_template_register_model_new (void)
-{
-    TableModel *model;
-
-    model = gnc_split_register_model_new ();
-
-    gnc_table_model_set_entry_handler(
-        model, gnc_split_register_get_inactive_date_entry, DATE_CELL );
-
-    gnc_table_model_set_entry_handler(
-        model, gnc_split_register_get_inactive_date_entry, DDUE_CELL );
-
-    gnc_table_model_set_io_flags_handler(
-        model, gnc_split_register_get_inactive_io_flags, DATE_CELL );
-
-    gnc_table_model_set_io_flags_handler(
-        model, gnc_split_register_get_inactive_io_flags, DDUE_CELL );
-
-    gnc_table_model_set_entry_handler(
-        model, gnc_template_register_get_xfrm_entry, XFRM_CELL);
-
-    gnc_table_model_set_entry_handler(
-        model, gnc_template_register_get_fdebt_entry, FDEBT_CELL);
-
-    gnc_table_model_set_entry_handler(
-        model, gnc_template_register_get_fcred_entry, FCRED_CELL);
-
-    gnc_table_model_set_entry_handler(
-        model, gnc_template_register_get_debcred_entry, DEBT_CELL);
-
-    gnc_table_model_set_entry_handler(
-        model, gnc_template_register_get_debcred_entry, CRED_CELL);
-
-    gnc_table_model_set_io_flags_handler(
-        model, gnc_split_register_get_standard_io_flags, FCRED_CELL);
-
-    gnc_table_model_set_io_flags_handler(
-        model, gnc_split_register_get_standard_io_flags, FDEBT_CELL);
-
-    gnc_template_register_model_add_save_handlers (model);
-
-    return model;
-}
diff --git a/src/register/ledger-core/split-register.c b/src/register/ledger-core/split-register.c
deleted file mode 100644
index 99972d5..0000000
--- a/src/register/ledger-core/split-register.c
+++ /dev/null
@@ -1,2992 +0,0 @@
-/********************************************************************\
- * 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 at gnu.org                   *
- *                                                                  *
-\********************************************************************/
-/*
- * split-register.c
- * author Copyright (c) 1998-2000 Linas Vepstas <linas at linas.org>
- * author Copyright (c) 2000-2001 Dave Peticolas <dave at krondo.com>
- */
-#include "config.h"
-
-#include <glib.h>
-#include <glib/gi18n.h>
-#include <libguile.h>
-
-#include <gnc-gdate-utils.h>
-#include "combocell.h"
-#include "datecell.h"
-#include "dialog-utils.h"
-#include "gnc-component-manager.h"
-#include "split-register-p.h"
-#include "gnc-ledger-display.h"
-#include "gnc-prefs.h"
-#include "gnc-ui.h"
-#include "gnome-utils/gnc-warnings.h"
-#include "guile-util.h"
-#include "numcell.h"
-#include "pricecell.h"
-#include "quickfillcell.h"
-#include "recncell.h"
-#include "split-register.h"
-#include "split-register-control.h"
-#include "split-register-layout.h"
-#include "split-register-model.h"
-#include "split-register-model-save.h"
-#include "table-allgui.h"
-#include "dialog-account.h"
-#include "dialog-dup-trans.h"
-#include "engine-helpers.h"
-#include "qofbookslots.h"
-
-
-/** static variables ******************************************************/
-
-/* This static indicates the debugging module that this .o belongs to. */
-static QofLogModule log_module = GNC_MOD_LEDGER;
-
-/* The copied split or transaction, if any */
-static CursorClass copied_class = CURSOR_CLASS_NONE;
-static SCM copied_item = SCM_UNDEFINED;
-static GncGUID copied_leader_guid;
-/* A denominator representing number of digits to the right of the decimal point
- * displayed in a price cell. */
-static int PRICE_CELL_DENOM = 1000000;
-/** static prototypes *****************************************************/
-
-static gboolean gnc_split_register_save_to_scm (SplitRegister *reg,
-        SCM trans_scm, SCM split_scm,
-        gboolean use_cut_semantics);
-static gboolean gnc_split_register_auto_calc (SplitRegister *reg,
-        Split *split);
-
-
-/** implementations *******************************************************/
-
-/* Uses the scheme split copying routines */
-static void
-gnc_copy_split_onto_split(Split *from, Split *to, gboolean use_cut_semantics)
-{
-    SCM split_scm;
-
-    if ((from == NULL) || (to == NULL))
-        return;
-
-    split_scm = gnc_copy_split(from, use_cut_semantics);
-    if (split_scm == SCM_UNDEFINED)
-        return;
-
-    gnc_copy_split_scm_onto_split(split_scm, to, gnc_get_current_book ());
-}
-
-/* Uses the scheme transaction copying routines */
-void
-gnc_copy_trans_onto_trans(Transaction *from, Transaction *to,
-                          gboolean use_cut_semantics,
-                          gboolean do_commit)
-{
-    SCM trans_scm;
-
-    if ((from == NULL) || (to == NULL))
-        return;
-
-    trans_scm = gnc_copy_trans(from, use_cut_semantics);
-    if (trans_scm == SCM_UNDEFINED)
-        return;
-
-    gnc_copy_trans_scm_onto_trans(trans_scm, to, do_commit,
-                                  gnc_get_current_book ());
-}
-
-static int
-gnc_split_get_value_denom (Split *split)
-{
-    gnc_commodity *currency;
-    int denom;
-
-    currency = xaccTransGetCurrency (xaccSplitGetParent (split));
-    denom = gnc_commodity_get_fraction (currency);
-    if (denom == 0)
-    {
-        gnc_commodity *commodity = gnc_default_currency ();
-        denom = gnc_commodity_get_fraction (commodity);
-        if (denom == 0)
-            denom = 100;
-    }
-
-    return denom;
-}
-
-static int
-gnc_split_get_amount_denom (Split *split)
-{
-    int denom;
-
-    denom = xaccAccountGetCommoditySCU (xaccSplitGetAccount (split));
-    if (denom == 0)
-    {
-        gnc_commodity *commodity = gnc_default_currency ();
-        denom = gnc_commodity_get_fraction (commodity);
-        if (denom == 0)
-            denom = 100;
-    }
-
-    return denom;
-}
-
-/* returns TRUE if begin_edit was aborted */
-gboolean
-gnc_split_register_begin_edit_or_warn(SRInfo *info, Transaction *trans)
-{
-    ENTER("info=%p, trans=%p", info, trans);
-
-    if (!xaccTransIsOpen(trans))
-    {
-        xaccTransBeginEdit(trans);
-        /* This is now the pending transaction */
-        info->pending_trans_guid = *xaccTransGetGUID(trans);
-        LEAVE("opened and marked pending");
-        return FALSE;
-    }
-    else
-    {
-        Split       *blank_split = xaccSplitLookup (&info->blank_split_guid,
-                                   gnc_get_current_book ());
-        Transaction *blank_trans = xaccSplitGetParent (blank_split);
-
-        if (trans == blank_trans)
-        {
-            /* This is a brand-new transaction. It is already
-             * open, so just mark it as pending. */
-            info->pending_trans_guid = *xaccTransGetGUID(trans);
-            LEAVE("already open, now pending.");
-            return FALSE;
-        }
-        else
-        {
-            GtkWidget *parent = NULL;
-            if (info->get_parent)
-                parent = info->get_parent(info->user_data);
-            gnc_error_dialog(parent, "%s", _("This transaction is already being edited in another register. Please finish editing it there first."));
-            LEAVE("already editing");
-            return TRUE;
-        }
-    }
-    LEAVE(" ");
-    return FALSE;  /* to satisfy static code analysis */
-}
-
-void
-gnc_split_register_expand_current_trans (SplitRegister *reg, gboolean expand)
-{
-    SRInfo *info = gnc_split_register_get_info (reg);
-    VirtualLocation virt_loc;
-
-    if (!reg)
-        return;
-
-    if (reg->style == REG_STYLE_AUTO_LEDGER ||
-            reg->style == REG_STYLE_JOURNAL)
-        return;
-
-    /* ok, so I just wanted an excuse to use exclusive-or */
-    if (!(expand ^ info->trans_expanded))
-        return;
-
-    if (!expand)
-    {
-        virt_loc = reg->table->current_cursor_loc;
-        gnc_split_register_get_trans_split (reg, virt_loc.vcell_loc,
-                                            &virt_loc.vcell_loc);
-
-        if (gnc_table_find_close_valid_cell (reg->table, &virt_loc, FALSE))
-            gnc_table_move_cursor_gui (reg->table, virt_loc);
-        else
-        {
-            PERR ("Can't find place to go!");
-            return;
-        }
-    }
-
-    info->trans_expanded = expand;
-
-    gnc_table_set_virt_cell_cursor (reg->table,
-                                    reg->table->current_cursor_loc.vcell_loc,
-                                    gnc_split_register_get_active_cursor (reg));
-
-    gnc_split_register_set_trans_visible(
-        reg, reg->table->current_cursor_loc.vcell_loc, expand, FALSE);
-
-    virt_loc = reg->table->current_cursor_loc;
-    if (!expand || !gnc_table_virtual_loc_valid (reg->table, virt_loc, FALSE))
-    {
-        if (gnc_table_find_close_valid_cell (reg->table, &virt_loc, FALSE))
-            gnc_table_move_cursor_gui (reg->table, virt_loc);
-        else
-        {
-            PERR ("Can't find place to go!");
-            return;
-        }
-    }
-
-    gnc_table_refresh_gui (reg->table, TRUE);
-
-    if (expand)
-        gnc_split_register_show_trans (reg,
-                                       reg->table->current_cursor_loc.vcell_loc);
-}
-
-gboolean
-gnc_split_register_current_trans_expanded (SplitRegister *reg)
-{
-    SRInfo *info = gnc_split_register_get_info (reg);
-
-    if (!reg)
-        return FALSE;
-
-    if (reg->style == REG_STYLE_AUTO_LEDGER ||
-            reg->style == REG_STYLE_JOURNAL)
-        return TRUE;
-
-    return info->trans_expanded;
-}
-
-Transaction *
-gnc_split_register_get_current_trans (SplitRegister *reg)
-{
-    Split *split;
-    VirtualCellLocation vcell_loc;
-
-    if (reg == NULL)
-        return NULL;
-
-    split = gnc_split_register_get_current_split (reg);
-    if (split != NULL)
-        return xaccSplitGetParent(split);
-
-    /* Split is blank. Assume it is the blank split of a multi-line
-     * transaction. Go back one row to find a split in the transaction. */
-    vcell_loc = reg->table->current_cursor_loc.vcell_loc;
-
-    vcell_loc.virt_row--;
-
-    split = gnc_split_register_get_split (reg, vcell_loc);
-
-    return xaccSplitGetParent (split);
-}
-
-Split *
-gnc_split_register_get_current_split (SplitRegister *reg)
-{
-    if (reg == NULL)
-        return NULL;
-
-    return gnc_split_register_get_split(
-               reg, reg->table->current_cursor_loc.vcell_loc);
-}
-
-Split *
-gnc_split_register_get_blank_split (SplitRegister *reg)
-{
-    SRInfo *info = gnc_split_register_get_info (reg);
-
-    if (!reg) return NULL;
-
-    return xaccSplitLookup (&info->blank_split_guid, gnc_get_current_book ());
-}
-
-gboolean
-gnc_split_register_get_split_virt_loc (SplitRegister *reg, Split *split,
-                                       VirtualCellLocation *vcell_loc)
-{
-    Table *table;
-    int v_row;
-    int v_col;
-
-    if (!reg || !split) return FALSE;
-
-    table = reg->table;
-
-    /* go backwards because typically you search for splits at the end
-     * and because we find split rows before transaction rows. */
-
-    for (v_row = table->num_virt_rows - 1; v_row > 0; v_row--)
-        for (v_col = 0; v_col < table->num_virt_cols; v_col++)
-        {
-            VirtualCellLocation vc_loc = { v_row, v_col };
-            VirtualCell *vcell;
-            Split *s;
-
-            vcell = gnc_table_get_virtual_cell (table, vc_loc);
-            if (!vcell || !vcell->visible)
-                continue;
-
-            s = xaccSplitLookup (vcell->vcell_data, gnc_get_current_book ());
-
-            if (s == split)
-            {
-                if (vcell_loc)
-                    *vcell_loc = vc_loc;
-
-                return TRUE;
-            }
-        }
-
-    return FALSE;
-}
-
-gboolean
-gnc_split_register_get_split_amount_virt_loc (SplitRegister *reg, Split *split,
-        VirtualLocation *virt_loc)
-{
-    VirtualLocation v_loc;
-    CursorClass cursor_class;
-    const char *cell_name;
-    gnc_numeric value;
-
-    if (!gnc_split_register_get_split_virt_loc (reg, split, &v_loc.vcell_loc))
-        return FALSE;
-
-    cursor_class = gnc_split_register_get_cursor_class (reg, v_loc.vcell_loc);
-
-    value = xaccSplitGetValue (split);
-
-    switch (cursor_class)
-    {
-    case CURSOR_CLASS_SPLIT:
-    case CURSOR_CLASS_TRANS:
-        cell_name = (gnc_numeric_negative_p (value)) ? CRED_CELL : DEBT_CELL;
-        break;
-    default:
-        return FALSE;
-    }
-
-    if (!gnc_table_get_cell_location (reg->table, cell_name,
-                                      v_loc.vcell_loc, &v_loc))
-        return FALSE;
-
-    if (virt_loc == NULL)
-        return TRUE;
-
-    *virt_loc = v_loc;
-
-    return TRUE;
-}
-
-Split *
-gnc_split_register_duplicate_current (SplitRegister *reg)
-{
-    SRInfo *info = gnc_split_register_get_info(reg);
-    CursorClass cursor_class;
-    Transaction *trans;
-    Split *return_split;
-    Split *trans_split;
-    Split *blank_split;
-    gboolean changed;
-    Split *split;
-
-    ENTER("reg=%p", reg);
-
-    blank_split = xaccSplitLookup(&info->blank_split_guid,
-                                  gnc_get_current_book ());
-    split = gnc_split_register_get_current_split (reg);
-    trans = gnc_split_register_get_current_trans (reg);
-    trans_split = gnc_split_register_get_current_trans_split (reg, NULL);
-
-    /* This shouldn't happen, but be paranoid. */
-    if (trans == NULL)
-    {
-        LEAVE("no transaction");
-        return NULL;
-    }
-
-    cursor_class = gnc_split_register_get_current_cursor_class (reg);
-
-    /* Can't do anything with this. */
-    if (cursor_class == CURSOR_CLASS_NONE)
-    {
-        LEAVE("no cursor class");
-        return NULL;
-    }
-
-    /* This shouldn't happen, but be paranoid. */
-    if ((split == NULL) && (cursor_class == CURSOR_CLASS_TRANS))
-    {
-        LEAVE("no split with transaction class");
-        return NULL;
-    }
-
-    changed = gnc_table_current_cursor_changed (reg->table, FALSE);
-
-    /* See if we were asked to duplicate an unchanged blank split.
-     * There's no point in doing that! */
-    if (!changed && ((split == NULL) || (split == blank_split)))
-    {
-        LEAVE("skip unchanged blank split");
-        return NULL;
-    }
-
-    gnc_suspend_gui_refresh ();
-
-    /* If the cursor has been edited, we are going to have to commit
-     * it before we can duplicate. Make sure the user wants to do that. */
-    if (changed)
-    {
-        GtkWidget *dialog, *window;
-        gint response;
-        const char *title = _("Save transaction before duplicating?");
-        const char *message =
-            _("The current transaction has been changed. Would you like to "
-              "record the changes before duplicating the transaction, or "
-              "cancel the duplication?");
-
-        window = gnc_split_register_get_parent(reg);
-        dialog = gtk_message_dialog_new(GTK_WINDOW(window),
-                                        GTK_DIALOG_DESTROY_WITH_PARENT,
-                                        GTK_MESSAGE_QUESTION,
-                                        GTK_BUTTONS_CANCEL,
-                                        "%s", title);
-        gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
-                "%s", message);
-        gtk_dialog_add_button(GTK_DIALOG(dialog),
-                              _("_Record"), GTK_RESPONSE_ACCEPT);
-        response = gnc_dialog_run(GTK_DIALOG(dialog), GNC_PREF_WARN_REG_TRANS_DUP);
-        gtk_widget_destroy(dialog);
-
-        if (response != GTK_RESPONSE_ACCEPT)
-        {
-            gnc_resume_gui_refresh ();
-            LEAVE("save cancelled");
-            return NULL;
-        }
-
-        gnc_split_register_save (reg, TRUE);
-
-        /* If the split is NULL, then we were on a blank split row
-         * in an expanded transaction. The new split (created by
-         * gnc_split_register_save above) will be the last split in the
-         * current transaction, as it was just added. */
-        if (split == NULL)
-            split = xaccTransGetSplit (trans, xaccTransCountSplits (trans) - 1);
-    }
-
-    /* Ok, we are now ready to make the copy. */
-
-    if (cursor_class == CURSOR_CLASS_SPLIT)
-    {
-        Split *new_split;
-        char *out_num;
-        gboolean new_act_num = FALSE;
-
-        /* We are on a split in an expanded transaction.
-         * Just copy the split and add it to the transaction.
-         * However, if the split-action field is being used as the register
-         * number, and the action field is a number, request a new value or
-         * cancel. Need to get next number and update account last num from
-         * split account not register account, which may be the same or not */
-
-        if (!reg->use_tran_num_for_num_field
-            && gnc_strisnum (gnc_get_num_action (NULL, split)))
-        {
-            Account *account = xaccSplitGetAccount (split);
-            const char *in_num = NULL;
-            const char* title = _("New Split Information");
-            time64 date = info->last_date_entered;
-
-            if (account)
-                in_num = xaccAccountGetLastNum (account);
-            else
-                in_num = gnc_get_num_action (NULL, split);
-            if (!gnc_dup_trans_dialog (gnc_split_register_get_parent (reg),
-                                   title, FALSE, &date, in_num, &out_num, NULL, NULL))
-            {
-                gnc_resume_gui_refresh ();
-                LEAVE("dup cancelled");
-                return NULL;
-            }
-            new_act_num = TRUE;
-        }
-
-        new_split = xaccMallocSplit (gnc_get_current_book ());
-
-        xaccTransBeginEdit (trans);
-        xaccSplitSetParent (new_split, trans);
-        gnc_copy_split_onto_split (split, new_split, FALSE);
-        if (new_act_num) /* if new number supplied by user dialog */
-            gnc_set_num_action (NULL, new_split, out_num, NULL);
-        xaccTransCommitEdit (trans);
-
-        if (new_act_num && gnc_strisnum (out_num))
-        {
-            Account *account = xaccSplitGetAccount (new_split);
-
-            /* If current register is for account, set last num */
-            if (xaccAccountEqual(account,
-                                    gnc_split_register_get_default_account(reg),
-                                    TRUE))
-            {
-                NumCell *num_cell;
-                num_cell = (NumCell *) gnc_table_layout_get_cell (reg->table->layout,
-                       NUM_CELL);
-                if (gnc_num_cell_set_last_num (num_cell, out_num))
-                    gnc_split_register_set_last_num (reg, out_num);
-            }
-            else
-            {
-                xaccAccountSetLastNum (account, out_num);
-            }
-        }
-
-        return_split = new_split;
-
-        info->cursor_hint_split = new_split;
-        info->cursor_hint_cursor_class = CURSOR_CLASS_SPLIT;
-        if (new_act_num)
-            g_free (out_num);
-    }
-    else
-    {
-        NumCell *num_cell;
-        Transaction *new_trans;
-        int trans_split_index;
-        int split_index;
-        const char *in_num = NULL;
-        const char *in_tnum = NULL;
-        char *out_num = NULL;
-        char *out_tnum = NULL;
-        time64 date;
-        gboolean use_autoreadonly = qof_book_uses_autoreadonly(gnc_get_current_book());
-
-        /* We are on a transaction row. Copy the whole transaction. */
-
-        date = info->last_date_entered;
-        if (gnc_strisnum (gnc_get_num_action (trans, trans_split)))
-        {
-            Account *account = gnc_split_register_get_default_account (reg);
-
-            if (account)
-                in_num = xaccAccountGetLastNum (account);
-            else
-                in_num = gnc_get_num_action (trans, trans_split);
-            in_tnum = (reg->use_tran_num_for_num_field
-                                        ? NULL
-                                        : gnc_get_num_action (trans, NULL));
-        }
-
-        if (!gnc_dup_trans_dialog (gnc_split_register_get_parent (reg), NULL,
-                                   TRUE, &date, in_num, &out_num, in_tnum, &out_tnum))
-        {
-            gnc_resume_gui_refresh ();
-            LEAVE("dup cancelled");
-            return NULL;
-        }
-
-        if (use_autoreadonly)
-        {
-            GDate d;
-            GDate *readonly_threshold = qof_book_get_autoreadonly_gdate(gnc_get_current_book());
-            gnc_gdate_set_time64 (&d, date);
-            if (g_date_compare(&d, readonly_threshold) < 0)
-            {
-                GtkWidget *dialog = gtk_message_dialog_new(NULL,
-                                    0,
-                                    GTK_MESSAGE_ERROR,
-                                    GTK_BUTTONS_OK,
-                                    "%s", _("Cannot store a transaction at this date"));
-                gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
-                        "%s", _("The entered date of the duplicated transaction is older than the \"Read-Only Threshold\" set for this book. "
-                                "This setting can be changed in File -> Properties -> Accounts."));
-                gtk_dialog_run(GTK_DIALOG(dialog));
-                gtk_widget_destroy(dialog);
-
-                g_date_free(readonly_threshold);
-                return NULL;
-            }
-            g_date_free(readonly_threshold);
-        }
-
-        split_index = xaccTransGetSplitIndex(trans, split);
-        trans_split_index = xaccTransGetSplitIndex(trans, trans_split);
-
-        /* we should *always* find the split, but be paranoid */
-        if (split_index < 0)
-        {
-            gnc_resume_gui_refresh ();
-            LEAVE("no split");
-            return NULL;
-        }
-
-        new_trans = xaccMallocTransaction (gnc_get_current_book ());
-
-        xaccTransBeginEdit (new_trans);
-        gnc_copy_trans_onto_trans (trans, new_trans, FALSE, FALSE);
-        xaccTransSetDatePostedSecsNormalized (new_trans, date);
-        /* We also must set a new DateEntered on the new entry
-         * because otherwise the ordering is not deterministic */
-        xaccTransSetDateEnteredSecs(new_trans, gnc_time(NULL));
-
-        /* set per book option */
-        gnc_set_num_action (new_trans, NULL, out_num, out_tnum);
-        if (!reg->use_tran_num_for_num_field)
-        {
-            /* find split in new_trans that equals trans_split and set
-             * split_action to out_num */
-            gnc_set_num_action (NULL,
-                                xaccTransGetSplit (new_trans, trans_split_index),
-                                out_num, NULL);
-            /* note that if the transaction has multiple splits to the register
-             * account, only the anchor split will be set with user input. The
-             * user will have to adjust other splits manually. */
-        }
-        xaccTransCommitEdit (new_trans);
-
-        num_cell = (NumCell *) gnc_table_layout_get_cell (reg->table->layout,
-                   NUM_CELL);
-        if (gnc_num_cell_set_last_num (num_cell, out_num))
-            gnc_split_register_set_last_num (reg, out_num);
-
-        g_free (out_num);
-        if (!reg->use_tran_num_for_num_field)
-            g_free (out_tnum);
-
-        /* This shouldn't happen, but be paranoid. */
-        if (split_index >= xaccTransCountSplits (new_trans))
-            split_index = 0;
-
-        return_split = xaccTransGetSplit (new_trans, split_index);
-        trans_split = xaccTransGetSplit (new_trans, trans_split_index);
-
-        info->cursor_hint_trans = new_trans;
-        info->cursor_hint_split = return_split;
-        info->cursor_hint_trans_split = trans_split;
-        info->cursor_hint_cursor_class = CURSOR_CLASS_TRANS;
-
-        info->trans_expanded = FALSE;
-    }
-
-    /* Refresh the GUI. */
-    gnc_resume_gui_refresh ();
-
-    LEAVE(" ");
-    return return_split;
-}
-
-static void
-gnc_split_register_copy_current_internal (SplitRegister *reg,
-        gboolean use_cut_semantics)
-{
-    SRInfo *info = gnc_split_register_get_info(reg);
-    CursorClass cursor_class;
-    Transaction *trans;
-    Split *blank_split;
-    gboolean changed;
-    Split *split;
-    SCM new_item;
-
-    g_return_if_fail(reg);
-    ENTER("reg=%p, use_cut_semantics=%s", reg,
-          use_cut_semantics ? "TRUE" : "FALSE");
-
-    blank_split = xaccSplitLookup(&info->blank_split_guid,
-                                  gnc_get_current_book ());
-    split = gnc_split_register_get_current_split (reg);
-    trans = gnc_split_register_get_current_trans (reg);
-
-    /* This shouldn't happen, but be paranoid. */
-    if (trans == NULL)
-    {
-        LEAVE("no trans");
-        return;
-    }
-
-    cursor_class = gnc_split_register_get_current_cursor_class (reg);
-
-    /* Can't do anything with this. */
-    if (cursor_class == CURSOR_CLASS_NONE)
-    {
-        LEAVE("no cursor class");
-        return;
-    }
-
-    /* This shouldn't happen, but be paranoid. */
-    if ((split == NULL) && (cursor_class == CURSOR_CLASS_TRANS))
-    {
-        g_warning("BUG DETECTED: transaction cursor with no anchoring split!");
-        LEAVE("transaction cursor with no anchoring split");
-        return;
-    }
-
-    changed = gnc_table_current_cursor_changed (reg->table, FALSE);
-
-    /* See if we were asked to copy an unchanged blank split. Don't. */
-    if (!changed && ((split == NULL) || (split == blank_split)))
-    {
-        /* We're either on an unedited, brand-new split or an unedited, brand-new
-         * transaction (the transaction anchored by the blank split.) */
-        /* FIXME: This doesn't work exactly right. When entering a new transaction,
-         *        you can edit the description, move to a split row, then move
-         *        back to the description, then ask for a copy, and this code will
-         *        be reached. It forgets that you changed the row the first time
-         *        you were there.  -Charles */
-        LEAVE("nothing to copy/cut");
-        return;
-    }
-
-    /* Ok, we are now ready to make the copy. */
-
-    if (cursor_class == CURSOR_CLASS_SPLIT)
-    {
-        /* We are on a split in an expanded transaction. Just copy the split. */
-        new_item = gnc_copy_split(split, use_cut_semantics);
-
-        if (new_item != SCM_UNDEFINED)
-        {
-            if (changed)
-                gnc_split_register_save_to_scm (reg, SCM_UNDEFINED, new_item,
-                                                use_cut_semantics);
-
-            copied_leader_guid = *guid_null();
-        }
-    }
-    else
-    {
-        /* We are on a transaction row. Copy the whole transaction. */
-        new_item = gnc_copy_trans(trans, use_cut_semantics);
-
-        if (new_item != SCM_UNDEFINED)
-        {
-            if (changed)
-            {
-                int split_index;
-                SCM split_scm;
-
-                split_index = xaccTransGetSplitIndex(trans, split);
-                if (split_index >= 0)
-                    split_scm = gnc_trans_scm_get_split_scm(new_item, split_index);
-                else
-                    split_scm = SCM_UNDEFINED;
-
-                gnc_split_register_save_to_scm (reg, new_item, split_scm,
-                                                use_cut_semantics);
-            }
-
-            copied_leader_guid = info->default_account;
-        }
-    }
-
-    if (new_item == SCM_UNDEFINED)
-    {
-        g_warning("BUG DETECTED: copy failed");
-        LEAVE("copy failed");
-        return;
-    }
-
-    /* unprotect the old object, if any */
-    if (copied_item != SCM_UNDEFINED)
-        scm_gc_unprotect_object(copied_item);
-
-    copied_item = new_item;
-    scm_gc_protect_object(copied_item);
-
-    copied_class = cursor_class;
-    LEAVE("%s %s", use_cut_semantics ? "cut" : "copied",
-          cursor_class == CURSOR_CLASS_SPLIT ? "split" : "transaction");
-}
-
-void
-gnc_split_register_copy_current (SplitRegister *reg)
-{
-    gnc_split_register_copy_current_internal (reg, FALSE);
-}
-
-void
-gnc_split_register_cut_current (SplitRegister *reg)
-{
-    SRInfo *info = gnc_split_register_get_info (reg);
-    CursorClass cursor_class;
-    Transaction *trans;
-    Split *blank_split;
-    gboolean changed;
-    Split *split;
-
-    blank_split = xaccSplitLookup (&info->blank_split_guid,
-                                   gnc_get_current_book ());
-    split = gnc_split_register_get_current_split (reg);
-    trans = gnc_split_register_get_current_trans (reg);
-
-    /* This shouldn't happen, but be paranoid. */
-    if (trans == NULL)
-        return;
-
-    cursor_class = gnc_split_register_get_current_cursor_class (reg);
-
-    /* Can't do anything with this. */
-    if (cursor_class == CURSOR_CLASS_NONE)
-        return;
-
-    /* This shouldn't happen, but be paranoid. */
-    if ((split == NULL) && (cursor_class == CURSOR_CLASS_TRANS))
-        return;
-
-    changed = gnc_table_current_cursor_changed (reg->table, FALSE);
-
-    /* See if we were asked to cut an unchanged blank split. Don't. */
-    if (!changed && ((split == NULL) || (split == blank_split)))
-        return;
-
-    gnc_split_register_copy_current_internal (reg, TRUE);
-
-    if (cursor_class == CURSOR_CLASS_SPLIT)
-        gnc_split_register_delete_current_split (reg);
-    else
-        gnc_split_register_delete_current_trans (reg);
-}
-
-void
-gnc_split_register_paste_current (SplitRegister *reg)
-{
-    SRInfo *info = gnc_split_register_get_info(reg);
-    CursorClass cursor_class;
-    Transaction *trans;
-    Transaction *blank_trans;
-    Split *blank_split;
-    Split *trans_split;
-    Split *split;
-
-    ENTER("reg=%p", reg);
-
-    if (copied_class == CURSOR_CLASS_NONE)
-    {
-        LEAVE("no copied cursor class");
-        return;
-    }
-
-    blank_split = xaccSplitLookup (&info->blank_split_guid,
-                                   gnc_get_current_book ());
-    blank_trans = xaccSplitGetParent (blank_split);
-    split = gnc_split_register_get_current_split (reg);
-    trans = gnc_split_register_get_current_trans (reg);
-
-    trans_split = gnc_split_register_get_current_trans_split (reg, NULL);
-
-    /* This shouldn't happen, but be paranoid. */
-    if (trans == NULL)
-    {
-        LEAVE("no transaction");
-        return;
-    }
-
-    cursor_class = gnc_split_register_get_current_cursor_class (reg);
-
-    /* Can't do anything with this. */
-    if (cursor_class == CURSOR_CLASS_NONE)
-    {
-        LEAVE("no current cursor class");
-        return;
-    }
-
-    /* This shouldn't happen, but be paranoid. */
-    if ((split == NULL) && (cursor_class == CURSOR_CLASS_TRANS))
-    {
-        g_warning("BUG DETECTED: transaction cursor with no anchoring split!");
-        LEAVE("transaction cursor with no anchoring split");
-        return;
-    }
-
-    if (cursor_class == CURSOR_CLASS_SPLIT)
-    {
-        const char *message = _("You are about to overwrite an existing split. "
-                                "Are you sure you want to do that?");
-
-        if (copied_class == CURSOR_CLASS_TRANS)
-        {
-            /* An entire transaction was copied, but we're just on a split. */
-            LEAVE("can't copy trans to split");
-            return;
-        }
-
-        /* Ask before overwriting an existing split. */
-        if (split != NULL &&
-                !gnc_verify_dialog (gnc_split_register_get_parent (reg),
-                                    FALSE, "%s", message))
-        {
-            LEAVE("user cancelled");
-            return;
-        }
-
-        gnc_suspend_gui_refresh ();
-
-        if (split == NULL)
-        {
-            /* We are on a null split in an expanded transaction. */
-            split = xaccMallocSplit(gnc_get_current_book ());
-            xaccSplitSetParent(split, trans);
-        }
-
-        gnc_copy_split_scm_onto_split(copied_item, split,
-                                      gnc_get_current_book ());
-    }
-    else
-    {
-        const char *message = _("You are about to overwrite an existing "
-                                "transaction. "
-                                "Are you sure you want to do that?");
-        Account * copied_leader;
-        const GncGUID *new_guid;
-        int trans_split_index;
-        int split_index;
-        int num_splits;
-
-        if (copied_class == CURSOR_CLASS_SPLIT)
-        {
-            LEAVE("can't copy split to transaction");
-            return;
-        }
-
-        /* Ask before overwriting an existing transaction. */
-        if (split != blank_split &&
-                !gnc_verify_dialog(gnc_split_register_get_parent(reg),
-                                   FALSE, "%s", message))
-        {
-            LEAVE("user cancelled");
-            return;
-        }
-
-        /* Open the transaction for editing. */
-        if (gnc_split_register_begin_edit_or_warn(info, trans))
-        {
-            LEAVE("can't begin editing");
-            return;
-        }
-
-        gnc_suspend_gui_refresh ();
-
-        DEBUG("Pasting txn, trans=%p, split=%p, blank_trans=%p, blank_split=%p",
-              trans, split, blank_trans, blank_split);
-
-        split_index = xaccTransGetSplitIndex(trans, split);
-        trans_split_index = xaccTransGetSplitIndex(trans, trans_split);
-
-        copied_leader = xaccAccountLookup(&copied_leader_guid,
-                                          gnc_get_current_book());
-        if (copied_leader && (gnc_split_register_get_default_account(reg) != NULL))
-        {
-            new_guid = &info->default_account;
-            gnc_copy_trans_scm_onto_trans_swap_accounts(copied_item, trans,
-                    &copied_leader_guid,
-                    new_guid, FALSE,
-                    gnc_get_current_book ());
-        }
-        else
-            gnc_copy_trans_scm_onto_trans(copied_item, trans, FALSE,
-                                          gnc_get_current_book ());
-
-        num_splits = xaccTransCountSplits(trans);
-        if (split_index >= num_splits)
-            split_index = 0;
-
-        if (trans == blank_trans)
-        {
-            /* In pasting, the blank split is deleted. Pick a new one. */
-            blank_split = xaccTransGetSplit(trans, 0);
-            info->blank_split_guid = *xaccSplitGetGUID (blank_split);
-            info->blank_split_edited = TRUE;
-            info->auto_complete = FALSE;
-            DEBUG("replacement blank_split=%p", blank_split);
-
-            /* NOTE: At this point, the blank transaction virtual cell is still
-             *       anchored by the old, deleted blank split. The register will
-             *       have to be reloaded (redrawn) to correct this. */
-        }
-
-        info->cursor_hint_trans = trans;
-        info->cursor_hint_split = xaccTransGetSplit(trans, split_index);
-        info->cursor_hint_trans_split = xaccTransGetSplit(trans,
-                                        trans_split_index);
-        info->cursor_hint_cursor_class = CURSOR_CLASS_TRANS;
-    }
-
-    /* Refresh the GUI. */
-    gnc_resume_gui_refresh ();
-    LEAVE(" ");
-}
-
-void
-gnc_split_register_delete_current_split (SplitRegister *reg)
-{
-    SRInfo *info = gnc_split_register_get_info (reg);
-    Transaction *pending_trans;
-    Transaction *trans;
-    Split *blank_split;
-    Split *split;
-
-    if (!reg) return;
-
-    blank_split = xaccSplitLookup (&info->blank_split_guid,
-                                   gnc_get_current_book ());
-
-    pending_trans = xaccTransLookup (&info->pending_trans_guid,
-                                     gnc_get_current_book ());
-
-    /* get the current split based on cursor position */
-    split = gnc_split_register_get_current_split (reg);
-    if (split == NULL)
-        return;
-
-    /* If we are deleting the blank split, just cancel. The user is
-     * allowed to delete the blank split as a method for discarding
-     * any edits they may have made to it. */
-    if (split == blank_split)
-    {
-        gnc_split_register_cancel_cursor_split_changes (reg);
-        return;
-    }
-
-    gnc_suspend_gui_refresh ();
-
-    trans = xaccSplitGetParent(split);
-
-    /* Check pending transaction */
-    if (trans == pending_trans)
-    {
-        g_assert(xaccTransIsOpen(trans));
-    }
-    else
-    {
-        g_assert(!pending_trans);
-        if (gnc_split_register_begin_edit_or_warn(info, trans))
-        {
-            gnc_resume_gui_refresh ();
-            return;
-        }
-    }
-    xaccSplitDestroy (split);
-
-    gnc_resume_gui_refresh ();
-    gnc_split_register_redraw(reg);
-}
-
-void
-gnc_split_register_delete_current_trans (SplitRegister *reg)
-{
-    SRInfo *info = gnc_split_register_get_info (reg);
-    Transaction *pending_trans;
-    Transaction *trans;
-    Split *blank_split;
-    Split *split;
-    gboolean was_open;
-
-    ENTER("reg=%p", reg);
-    if (!reg)
-    {
-        LEAVE("no register");
-        return;
-    }
-
-    blank_split = xaccSplitLookup (&info->blank_split_guid,
-                                   gnc_get_current_book ());
-    pending_trans = xaccTransLookup (&info->pending_trans_guid,
-                                     gnc_get_current_book ());
-
-    /* get the current split based on cursor position */
-    split = gnc_split_register_get_current_split (reg);
-    if (split == NULL)
-    {
-        LEAVE("no split");
-        return;
-    }
-
-    gnc_suspend_gui_refresh ();
-    trans = xaccSplitGetParent(split);
-
-    /* If we just deleted the blank split, clean up. The user is
-     * allowed to delete the blank split as a method for discarding
-     * any edits they may have made to it. */
-    if (split == blank_split)
-    {
-        DEBUG("deleting blank split");
-        info->blank_split_guid = *guid_null();
-        info->auto_complete = FALSE;
-    }
-    else
-    {
-        info->trans_expanded = FALSE;
-    }
-
-    /* Check pending transaction */
-    if (trans == pending_trans)
-    {
-        DEBUG("clearing pending trans");
-        info->pending_trans_guid = *guid_null();
-        pending_trans = NULL;
-    }
-
-    was_open = xaccTransIsOpen(trans);
-    xaccTransDestroy(trans);
-    if (was_open)
-    {
-        DEBUG("committing");
-        xaccTransCommitEdit(trans);
-    }
-    gnc_resume_gui_refresh ();
-    LEAVE(" ");
-}
-
-void
-gnc_split_register_void_current_trans (SplitRegister *reg, const char *reason)
-{
-    SRInfo *info = gnc_split_register_get_info (reg);
-    Transaction *pending_trans;
-    Transaction *trans;
-    Split *blank_split;
-    Split *split;
-
-    if (!reg) return;
-
-    blank_split = xaccSplitLookup (&info->blank_split_guid,
-                                   gnc_get_current_book ());
-    pending_trans = xaccTransLookup (&info->pending_trans_guid,
-                                     gnc_get_current_book ());
-
-    /* get the current split based on cursor position */
-    split = gnc_split_register_get_current_split (reg);
-    if (split == NULL)
-        return;
-
-    /* Bail if trying to void the blank split. */
-    if (split == blank_split)
-        return;
-
-    /* already voided. */
-    if (xaccSplitGetReconcile (split) == VREC)
-        return;
-
-    info->trans_expanded = FALSE;
-
-    gnc_suspend_gui_refresh ();
-
-    trans = xaccSplitGetParent(split);
-    xaccTransVoid(trans, reason);
-
-    /* Check pending transaction */
-    if (trans == pending_trans)
-    {
-        info->pending_trans_guid = *guid_null();
-        pending_trans = NULL;
-    }
-    if (xaccTransIsOpen(trans))
-    {
-        PERR("We should not be voiding an open transaction.");
-        xaccTransCommitEdit(trans);
-    }
-    gnc_resume_gui_refresh ();
-}
-
-void
-gnc_split_register_unvoid_current_trans (SplitRegister *reg)
-{
-    SRInfo *info = gnc_split_register_get_info (reg);
-    Transaction *pending_trans;
-    Transaction *trans;
-    Split *blank_split;
-    Split *split;
-
-    if (!reg) return;
-
-    blank_split = xaccSplitLookup (&info->blank_split_guid,
-                                   gnc_get_current_book ());
-    pending_trans = xaccTransLookup (&info->pending_trans_guid,
-                                     gnc_get_current_book ());
-
-    /* get the current split based on cursor position */
-    split = gnc_split_register_get_current_split (reg);
-    if (split == NULL)
-        return;
-
-    /* Bail if trying to unvoid the blank split. */
-    if (split == blank_split)
-        return;
-
-    /* not voided. */
-    if (xaccSplitGetReconcile (split) != VREC)
-        return;
-
-    info->trans_expanded = FALSE;
-
-    gnc_suspend_gui_refresh ();
-
-    trans = xaccSplitGetParent(split);
-
-    xaccTransUnvoid(trans);
-
-    /* Check pending transaction */
-    if (trans == pending_trans)
-    {
-        info->pending_trans_guid = *guid_null();
-        pending_trans = NULL;
-    }
-
-    gnc_resume_gui_refresh ();
-}
-
-void
-gnc_split_register_empty_current_trans_except_split (SplitRegister *reg,
-        Split *split)
-{
-    SRInfo *info;
-    Transaction *trans;
-    Transaction *pending;
-    int i = 0;
-    Split *s;
-
-    if ((reg == NULL)  || (split == NULL))
-        return;
-
-    gnc_suspend_gui_refresh ();
-    info = gnc_split_register_get_info(reg);
-    pending = xaccTransLookup(&info->pending_trans_guid, gnc_get_current_book());
-
-    trans = xaccSplitGetParent(split);
-    if (!pending)
-    {
-        if (gnc_split_register_begin_edit_or_warn(info, trans))
-        {
-            gnc_resume_gui_refresh ();
-            return;
-        }
-    }
-    else if (pending == trans)
-    {
-        g_assert(xaccTransIsOpen(trans));
-    }
-    else g_assert_not_reached();
-
-    while ((s = xaccTransGetSplit(trans, i)) != NULL)
-    {
-        if (s != split)
-            xaccSplitDestroy(s);
-        else i++;
-    }
-
-    gnc_resume_gui_refresh ();
-    gnc_split_register_redraw(reg);
-}
-
-void
-gnc_split_register_empty_current_trans (SplitRegister *reg)
-{
-    Split *split;
-
-    /* get the current split based on cursor position */
-    split = gnc_split_register_get_current_split (reg);
-    gnc_split_register_empty_current_trans_except_split (reg, split);
-}
-
-void
-gnc_split_register_cancel_cursor_split_changes (SplitRegister *reg)
-{
-    VirtualLocation virt_loc;
-
-    if (reg == NULL)
-        return;
-
-    virt_loc = reg->table->current_cursor_loc;
-
-    if (!gnc_table_current_cursor_changed (reg->table, FALSE))
-        return;
-
-    /* We're just cancelling the current split here, not the transaction.
-     * When cancelling edits, reload the cursor from the transaction. */
-    gnc_table_clear_current_cursor_changes (reg->table);
-
-    if (gnc_table_find_close_valid_cell (reg->table, &virt_loc, FALSE))
-        gnc_table_move_cursor_gui (reg->table, virt_loc);
-
-    gnc_table_refresh_gui (reg->table, TRUE);
-}
-
-void
-gnc_split_register_cancel_cursor_trans_changes (SplitRegister *reg)
-{
-    SRInfo *info = gnc_split_register_get_info (reg);
-    Transaction *pending_trans;
-
-    pending_trans = xaccTransLookup (&info->pending_trans_guid,
-                                     gnc_get_current_book ());
-
-    /* Get the currently open transaction, rollback the edits on it, and
-     * then repaint everything. To repaint everything, make a note of
-     * all of the accounts that will be affected by this rollback. */
-    if (!xaccTransIsOpen (pending_trans))
-    {
-        gnc_split_register_cancel_cursor_split_changes (reg);
-        return;
-    }
-
-    if (!pending_trans)
-        return;
-
-    gnc_suspend_gui_refresh ();
-
-    xaccTransRollbackEdit (pending_trans);
-
-    info->pending_trans_guid = *guid_null ();
-
-    gnc_resume_gui_refresh ();
-    gnc_split_register_redraw(reg);
-}
-
-void
-gnc_split_register_redraw (SplitRegister *reg)
-{
-    gnc_ledger_display_refresh_by_split_register (reg);
-}
-
-/* Copy from the register object to scheme. This needs to be
- * in sync with gnc_split_register_save and xaccSRSaveChangedCells. */
-static gboolean
-gnc_split_register_save_to_scm (SplitRegister *reg,
-                                SCM trans_scm, SCM split_scm,
-                                gboolean use_cut_semantics)
-{
-    SCM other_split_scm = SCM_UNDEFINED;
-    Transaction *trans;
-
-    /* use the changed flag to avoid heavy-weight updates
-     * of the split & transaction fields. This will help
-     * cut down on uneccessary register redraws. */
-    if (!gnc_table_current_cursor_changed (reg->table, FALSE))
-        return FALSE;
-
-    /* get the handle to the current split and transaction */
-    trans = gnc_split_register_get_current_trans (reg);
-    if (trans == NULL)
-        return FALSE;
-
-    /* copy the contents from the cursor to the split */
-    if (gnc_table_layout_get_cell_changed (reg->table->layout, DATE_CELL, TRUE))
-    {
-        BasicCell *cell;
-        Timespec ts;
-
-        cell = gnc_table_layout_get_cell (reg->table->layout, DATE_CELL);
-        gnc_date_cell_get_date ((DateCell *) cell, &ts);
-
-        gnc_trans_scm_set_date(trans_scm, &ts);
-    }
-
-    if (gnc_table_layout_get_cell_changed (reg->table->layout, NUM_CELL, TRUE))
-    {
-        const char *value;
-
-        value = gnc_table_layout_get_cell_value (reg->table->layout, NUM_CELL);
-        if (reg->use_tran_num_for_num_field)
-            gnc_trans_scm_set_num (trans_scm, value);
-     /* else this contains the same as ACTN_CELL which is already handled below *
-      * and the TNUM_CELL contains transaction number which is handled in next  *
-      * if statement. */
-    }
-
-    if (gnc_table_layout_get_cell_changed (reg->table->layout, TNUM_CELL, TRUE))
-    {
-        const char *value;
-
-        value = gnc_table_layout_get_cell_value (reg->table->layout, TNUM_CELL);
-        if (!reg->use_tran_num_for_num_field)
-            gnc_trans_scm_set_num (trans_scm, value);
-     /* else this cell is not used */
-    }
-
-    if (gnc_table_layout_get_cell_changed (reg->table->layout, DESC_CELL, TRUE))
-    {
-        const char *value;
-
-        value = gnc_table_layout_get_cell_value (reg->table->layout, DESC_CELL);
-        gnc_trans_scm_set_description (trans_scm, value);
-    }
-
-    if (gnc_table_layout_get_cell_changed (reg->table->layout, NOTES_CELL, TRUE))
-    {
-        const char *value;
-
-        value = gnc_table_layout_get_cell_value (reg->table->layout, NOTES_CELL);
-        gnc_trans_scm_set_notes (trans_scm, value);
-    }
-
-    if (gnc_table_layout_get_cell_changed (reg->table->layout, RECN_CELL, TRUE))
-    {
-        BasicCell *cell;
-        char flag;
-
-        cell = gnc_table_layout_get_cell (reg->table->layout, RECN_CELL);
-        flag = gnc_recn_cell_get_flag ((RecnCell *) cell);
-
-        gnc_split_scm_set_reconcile_state(split_scm, flag);
-    }
-
-    if (gnc_table_layout_get_cell_changed (reg->table->layout, ACTN_CELL, TRUE))
-    {
-        const char *value;
-
-        value = gnc_table_layout_get_cell_value (reg->table->layout, ACTN_CELL);
-        gnc_split_scm_set_action (split_scm, value);
-    }
-
-    if (gnc_table_layout_get_cell_changed (reg->table->layout, MEMO_CELL, TRUE))
-    {
-        const char *value;
-
-        value = gnc_table_layout_get_cell_value (reg->table->layout, MEMO_CELL);
-        gnc_split_scm_set_memo (split_scm, value);
-    }
-
-    if (gnc_table_layout_get_cell_changed (reg->table->layout, XFRM_CELL, TRUE))
-    {
-        Account *new_account;
-
-        new_account = gnc_split_register_get_account (reg, XFRM_CELL);
-
-        if (new_account != NULL)
-            gnc_split_scm_set_account (split_scm, new_account);
-    }
-
-    if (reg->style == REG_STYLE_LEDGER)
-        other_split_scm = gnc_trans_scm_get_other_split_scm (trans_scm, split_scm);
-
-    if (gnc_table_layout_get_cell_changed (reg->table->layout, MXFRM_CELL, TRUE))
-    {
-        other_split_scm = gnc_trans_scm_get_other_split_scm (trans_scm, split_scm);
-
-        if (other_split_scm == SCM_UNDEFINED)
-        {
-            if (gnc_trans_scm_get_num_splits(trans_scm) == 1)
-            {
-                Split *temp_split;
-
-                temp_split = xaccMallocSplit (gnc_get_current_book ());
-                other_split_scm = gnc_copy_split (temp_split, use_cut_semantics);
-                xaccSplitDestroy (temp_split);
-
-                gnc_trans_scm_append_split_scm (trans_scm, other_split_scm);
-            }
-        }
-
-        if (other_split_scm != SCM_UNDEFINED)
-        {
-            Account *new_account;
-
-            new_account = gnc_split_register_get_account (reg, MXFRM_CELL);
-
-            if (new_account != NULL)
-                gnc_split_scm_set_account (other_split_scm, new_account);
-        }
-    }
-
-    if (gnc_table_layout_get_cell_changed (reg->table->layout,
-                                           DEBT_CELL, TRUE) ||
-            gnc_table_layout_get_cell_changed (reg->table->layout,
-                    CRED_CELL, TRUE))
-    {
-        BasicCell *cell;
-        gnc_numeric new_value;
-        gnc_numeric credit;
-        gnc_numeric debit;
-
-        cell = gnc_table_layout_get_cell (reg->table->layout, CRED_CELL);
-        credit = gnc_price_cell_get_value ((PriceCell *) cell);
-
-        cell = gnc_table_layout_get_cell (reg->table->layout, DEBT_CELL);
-        debit = gnc_price_cell_get_value ((PriceCell *) cell);
-
-        new_value = gnc_numeric_sub_fixed (debit, credit);
-
-        gnc_split_scm_set_value (split_scm, new_value);
-    }
-
-    if (gnc_table_layout_get_cell_changed (reg->table->layout, PRIC_CELL, TRUE))
-    {
-        /* do nothing for now */
-    }
-
-    if (gnc_table_layout_get_cell_changed (reg->table->layout, SHRS_CELL, TRUE))
-    {
-        BasicCell *cell;
-        gnc_numeric shares;
-
-        cell = gnc_table_layout_get_cell (reg->table->layout, SHRS_CELL);
-
-        shares = gnc_price_cell_get_value ((PriceCell *) cell);
-
-        gnc_split_scm_set_amount (split_scm, shares);
-    }
-
-    if (gnc_table_layout_get_cell_changed (reg->table->layout,
-                                           DEBT_CELL, TRUE) ||
-            gnc_table_layout_get_cell_changed (reg->table->layout,
-                    CRED_CELL, TRUE) ||
-            gnc_table_layout_get_cell_changed (reg->table->layout,
-                    PRIC_CELL, TRUE) ||
-            gnc_table_layout_get_cell_changed (reg->table->layout,
-                    SHRS_CELL, TRUE))
-    {
-        if (other_split_scm != SCM_UNDEFINED)
-        {
-            gnc_numeric num;
-
-            num = gnc_split_scm_get_amount (split_scm);
-            gnc_split_scm_set_amount (other_split_scm, gnc_numeric_neg (num));
-
-            num = gnc_split_scm_get_value (split_scm);
-            gnc_split_scm_set_value (other_split_scm, gnc_numeric_neg (num));
-        }
-    }
-
-    return TRUE;
-}
-
-gboolean
-gnc_split_register_save (SplitRegister *reg, gboolean do_commit)
-{
-    SRInfo *info = gnc_split_register_get_info (reg);
-    Transaction *pending_trans;
-    Transaction *blank_trans;
-    Transaction *trans;
-    Account *account;
-    Split *blank_split;
-    const char *memo;
-    const char *desc;
-    Split *split;
-
-    ENTER("reg=%p, do_commit=%s", reg, do_commit ? "TRUE" : "FALSE");
-
-    if (!reg)
-    {
-        LEAVE("no register");
-        return FALSE;
-    }
-
-    blank_split = xaccSplitLookup (&info->blank_split_guid,
-                                   gnc_get_current_book ());
-
-    pending_trans = xaccTransLookup (&info->pending_trans_guid,
-                                     gnc_get_current_book ());
-
-    blank_trans = xaccSplitGetParent (blank_split);
-
-    /* get the handle to the current split and transaction */
-    split = gnc_split_register_get_current_split (reg);
-    trans = gnc_split_register_get_current_trans (reg);
-    if (trans == NULL)
-    {
-        LEAVE("no transaction");
-        return FALSE;
-    }
-
-    /* use the changed flag to avoid heavy-weight updates
-     * of the split & transaction fields. This will help
-     * cut down on unnecessary register redraws. */
-    if (!gnc_table_current_cursor_changed (reg->table, FALSE))
-    {
-        if (!do_commit)
-        {
-            LEAVE("commit unnecessary");
-            return FALSE;
-        }
-
-        if (!xaccTransIsOpen(trans))
-        {
-            LEAVE("transaction not open");
-            return FALSE;
-        }
-
-        if (trans == pending_trans ||
-                (trans == blank_trans && info->blank_split_edited))
-        {
-            /* We are going to commit. */
-
-            gnc_suspend_gui_refresh ();
-
-            if (trans == blank_trans)
-            {
-                /* We have to clear the blank split before the
-                 * refresh or a new one won't be created. */
-                info->last_date_entered = xaccTransGetDate (trans);
-                info->blank_split_guid = *guid_null ();
-                info->blank_split_edited = FALSE;
-                info->auto_complete = FALSE;
-            }
-
-            /* We have to clear the pending guid *before* committing the
-             * trans, because the event handler will find it otherwise. */
-            if (trans == pending_trans)
-                info->pending_trans_guid = *guid_null ();
-
-            PINFO("committing trans (%p)", trans);
-            xaccTransCommitEdit(trans);
-
-            gnc_resume_gui_refresh ();
-        }
-        else
-            DEBUG("leaving trans (%p) open", trans);
-
-        LEAVE("unchanged cursor");
-        return TRUE;
-    }
-
-    DEBUG("save split=%p", split);
-    DEBUG("blank_split=%p, blank_trans=%p, pending_trans=%p, trans=%p",
-          blank_split, blank_trans, pending_trans, trans);
-
-    /* Act on any changes to the current cell before the save. */
-    (void) gnc_split_register_check_cell (reg,
-                                          gnc_table_get_current_cell_name (reg->table));
-
-    if (!gnc_split_register_auto_calc (reg, split))
-    {
-        LEAVE("auto calc failed");
-        return FALSE;
-    }
-
-    /* Validate the transfer account names */
-    (void)gnc_split_register_get_account (reg, MXFRM_CELL);
-    (void)gnc_split_register_get_account (reg, XFRM_CELL);
-
-    /* Maybe deal with exchange-rate transfers */
-    if (gnc_split_register_handle_exchange (reg, FALSE))
-    {
-        LEAVE("no exchange rate");
-        return TRUE;
-    }
-
-    gnc_suspend_gui_refresh ();
-
-    /* determine whether we should commit the pending transaction */
-    if (pending_trans != trans)
-    {
-        // FIXME: How could the pending transaction not be open?
-        // FIXME: For that matter, how could an open pending
-        // transaction ever not be the current trans?
-        if (xaccTransIsOpen (pending_trans))
-        {
-            g_warning("Impossible? commiting pending %p", pending_trans);
-            xaccTransCommitEdit (pending_trans);
-        }
-        else if (pending_trans)
-        {
-            g_critical("BUG DETECTED! pending transaction (%p) not open",
-                       pending_trans);
-            g_assert_not_reached();
-        }
-
-        if (trans == blank_trans)
-        {
-            /* Don't begin editing the blank trans, because it's
-               already open, but mark it pending now. */
-            g_assert(xaccTransIsOpen(blank_trans));
-            /* This is now the pending transaction */
-            info->pending_trans_guid = *xaccTransGetGUID(blank_trans);
-        }
-        else
-        {
-            PINFO("beginning edit of trans %p", trans);
-            if (gnc_split_register_begin_edit_or_warn(info, trans))
-            {
-                gnc_resume_gui_refresh ();
-                LEAVE("transaction opened elsewhere");
-                return FALSE;
-            }
-        }
-        pending_trans = trans;
-    }
-    g_assert(xaccTransIsOpen(trans));
-
-    /* If we are saving a brand new transaction and the blank split hasn't
-     * been edited, then we need to give it a default account. */
-    /* Q: Why check 'split == blank_split'? Isn't 'trans == blank_trans'
-     *    even better? What if there were some way that we could be on
-     *    a row other than the transaction row or blank split row, but
-     *    the blank split still hasn't been edited? It seems to be assumed
-     *    that it isn't possible, but... -Charles, Jan 2009 */
-    if (split == blank_split && !info->blank_split_edited)
-    {
-        /* If we've reached this point, it means that the blank split is
-         * anchoring the transaction - see gnc_split_register_add_transaction()
-         * for an explanation - and the transaction has been edited (as evidenced
-         * by the earlier check for a changed cursor.) Since the blank split
-         * itself has not been edited, we'll have to assign a default account. */
-        account = gnc_split_register_get_default_account(reg);
-        if (account)
-            xaccSplitSetAccount(blank_split, account);
-        xaccTransSetDateEnteredSecs(trans, gnc_time (NULL));
-    }
-
-    if (split == NULL)
-    {
-        /* If we were asked to save data for a row for which there is no
-         * associated split, then assume that this was an "empty" row - see
-         * gnc_split_register_add_transaction() for an explanation. This row
-         * is used to add splits to an existing transaction, or to add the
-         * 2nd through nth split rows to a brand new transaction.
-         * xaccSRGetCurrent will handle this case, too. We will create
-         * a new split, copy the row contents to that split, and append
-         * the split to the pre-existing transaction. */
-        Split *trans_split;
-
-        split = xaccMallocSplit (gnc_get_current_book ());
-        xaccTransAppendSplit (trans, split);
-
-        gnc_table_set_virt_cell_data (reg->table,
-                                      reg->table->current_cursor_loc.vcell_loc,
-                                      xaccSplitGetGUID (split));
-        DEBUG("assigned cell to new split=%p", split);
-
-        trans_split = gnc_split_register_get_current_trans_split (reg, NULL);
-        if ((info->cursor_hint_trans == trans) &&
-                (info->cursor_hint_trans_split == trans_split) &&
-                (info->cursor_hint_split == NULL))
-        {
-            info->cursor_hint_split = split;
-            info->cursor_hint_cursor_class = CURSOR_CLASS_SPLIT;
-        }
-    }
-
-    DEBUG("updating trans=%p", trans);
-
-    {
-        SRSaveData *sd;
-
-        sd = gnc_split_register_save_data_new (
-                 trans, split, (info->trans_expanded ||
-                                reg->style == REG_STYLE_AUTO_LEDGER ||
-                                reg->style == REG_STYLE_JOURNAL));
-        gnc_table_save_cells (reg->table, sd);
-        gnc_split_register_save_data_destroy (sd);
-    }
-
-    memo = xaccSplitGetMemo (split);
-    memo = memo ? memo : "(null)";
-    desc = xaccTransGetDescription (trans);
-    desc = desc ? desc : "(null)";
-    PINFO ("finished saving split \"%s\" of trans \"%s\"", memo, desc);
-
-    /* If the modified split is the "blank split", then it is now an
-     * official part of the account. Set the blank split to NULL, so we
-     * can be sure of getting a new blank split. Also, save the date
-     * for the new blank split. */
-    if (trans == blank_trans)
-    {
-        if (do_commit)
-        {
-            info->blank_split_guid = *guid_null ();
-            info->auto_complete = FALSE;
-            blank_split = NULL;
-            info->last_date_entered = xaccTransGetDate (trans);
-        }
-        else
-            info->blank_split_edited = TRUE;
-    }
-
-    /* If requested, commit the current transaction and set the pending
-     * transaction to NULL. */
-    if (do_commit)
-    {
-        g_assert(trans == blank_trans || trans == pending_trans);
-        if (pending_trans == trans)
-        {
-            pending_trans = NULL;
-            info->pending_trans_guid = *guid_null ();
-        }
-        xaccTransCommitEdit (trans);
-    }
-
-    gnc_table_clear_current_cursor_changes (reg->table);
-
-    gnc_resume_gui_refresh ();
-
-    LEAVE(" ");
-    return TRUE;
-}
-
-
-Account *
-gnc_split_register_get_account_by_name (SplitRegister *reg, BasicCell * bcell,
-                                        const char *name)
-{
-    const char *placeholder = _("The account %s does not allow transactions.");
-    const char *missing = _("The account %s does not exist. "
-                            "Would you like to create it?");
-    char *account_name;
-    ComboCell *cell = (ComboCell *) bcell;
-    Account *account;
-    static gboolean creating_account = FALSE;
-
-    if (!name || (strlen(name) == 0))
-        return NULL;
-
-    /* Find the account */
-    account = gnc_account_lookup_for_register (gnc_get_current_root_account (), name);
-    if (!account)
-        account = gnc_account_lookup_by_code(gnc_get_current_root_account(), name);
-
-    if (!account && !creating_account)
-    {
-        /* Ask if they want to create a new one. */
-        if (!gnc_verify_dialog (gnc_split_register_get_parent (reg),
-                                TRUE, missing, name))
-            return NULL;
-        creating_account = TRUE;
-        /* User said yes, they want to create a new account. */
-        account = gnc_ui_new_accounts_from_name_window (name);
-        creating_account = FALSE;
-        if (!account)
-            return NULL;
-    }
-
-    /* Now have the account. */
-    account_name = gnc_get_account_name_for_register (account);
-    if (g_strcmp0(account_name, gnc_basic_cell_get_value(bcell)))
-    {
-        /* The name has changed. Update the cell. */
-        gnc_combo_cell_set_value (cell, account_name);
-        gnc_basic_cell_set_changed (&cell->cell, TRUE);
-    }
-    g_free (account_name);
-
-    /* See if the account (either old or new) is a placeholder. */
-    if (xaccAccountGetPlaceholder (account))
-    {
-        gnc_error_dialog (gnc_split_register_get_parent (reg),
-                          placeholder, name);
-    }
-
-    /* Be seeing you. */
-    return account;
-}
-
-Account *
-gnc_split_register_get_account (SplitRegister *reg, const char * cell_name)
-{
-    BasicCell *cell;
-    const char *name;
-
-    if (!gnc_table_layout_get_cell_changed (reg->table->layout, cell_name, TRUE))
-        return NULL;
-
-    cell = gnc_table_layout_get_cell (reg->table->layout, cell_name);
-    if (!cell)
-        return NULL;
-    name = gnc_basic_cell_get_value (cell);
-    return gnc_split_register_get_account_by_name (reg, cell, name);
-}
-
-static gnc_numeric
-calculate_value (SplitRegister *reg)
-{
-    gnc_numeric credit;
-    gnc_numeric debit;
-
-    PriceCell *cell = (PriceCell*)gnc_table_layout_get_cell (reg->table->layout,
-                                                             CRED_CELL);
-    credit = gnc_price_cell_get_value (cell);
-
-    cell = (PriceCell*)gnc_table_layout_get_cell (reg->table->layout,
-                                                  DEBT_CELL);
-    debit = gnc_price_cell_get_value (cell);
-
-    return gnc_numeric_sub_fixed (debit, credit);
-}
-
-
-static int
-recalc_message_box (SplitRegister *reg, gboolean shares_changed,
-                    gboolean price_changed, gboolean value_changed)
-{
-    int choice;
-    int default_value;
-    GList *node;
-    GList *radio_list = NULL;
-    const char *title = _("Recalculate Transaction");
-    const char *message = _("The values entered for this transaction "
-                            "are inconsistent. Which value would you "
-                            "like to have recalculated?");
-
-    if (shares_changed)
-        radio_list = g_list_append (radio_list, g_strdup_printf ("%s (%s)",
-                                                                 _("_Shares"),
-                                                                 _("Changed")));
-    else
-        radio_list = g_list_append (radio_list, g_strdup (_("_Shares")));
-
-    if (price_changed)
-        radio_list = g_list_append (radio_list, g_strdup_printf ("%s (%s)",
-                                                                 _("_Price"),
-                                                                 _("Changed")));
-    else
-        radio_list = g_list_append (radio_list, g_strdup (_("_Price")));
-
-    if (value_changed)
-        radio_list = g_list_append (radio_list, g_strdup_printf ("%s (%s)",
-                                                                 _("_Value"),
-                                                                 _("Changed")));
-    else
-        radio_list = g_list_append (radio_list, g_strdup (_("_Value")));
-
-    if (price_changed) default_value = 2;  /* change the value */
-    else  default_value = 1;  /* change the value */
-
-    choice = gnc_choose_radio_option_dialog
-        (gnc_split_register_get_parent (reg),
-         title,
-         message,
-         _("_Recalculate"),
-         default_value,
-         radio_list);
-
-    for (node = radio_list; node; node = node->next)
-        g_free (node->data);
-
-    g_list_free (radio_list);
-
-    return choice;
-}
-
-static void
-recalculate_shares (Split* split, SplitRegister *reg,
-               gnc_numeric value, gnc_numeric price, gboolean value_changed)
-{
-    gint64 denom = gnc_split_get_amount_denom (split);
-    gnc_numeric amount = gnc_numeric_div (value, price, denom,
-                                          GNC_HOW_RND_ROUND_HALF_UP);
-
-    BasicCell *cell = gnc_table_layout_get_cell (reg->table->layout, SHRS_CELL);
-    gnc_price_cell_set_value ((PriceCell *) cell, amount);
-    gnc_basic_cell_set_changed (cell, TRUE);
-
-    if (value_changed)
-    {
-        cell = gnc_table_layout_get_cell (reg->table->layout, PRIC_CELL);
-        gnc_basic_cell_set_changed (cell, FALSE);
-    }
-}
-
-static void
-recalculate_price (Split *split, SplitRegister *reg,
-              gnc_numeric value, gnc_numeric amount)
-{
-    BasicCell *price_cell;
-    gnc_numeric price = gnc_numeric_div (value, amount,
-                                         GNC_DENOM_AUTO,
-                                         GNC_HOW_DENOM_EXACT);
-
-    if (gnc_numeric_negative_p (price))
-    {
-        BasicCell *debit_cell;
-        BasicCell *credit_cell;
-
-        debit_cell = gnc_table_layout_get_cell (reg->table->layout,
-                                                DEBT_CELL);
-
-        credit_cell = gnc_table_layout_get_cell (reg->table->layout,
-                                                 CRED_CELL);
-
-        price = gnc_numeric_neg (price);
-
-        gnc_price_cell_set_debt_credit_value ((PriceCell *) debit_cell,
-                                              (PriceCell *) credit_cell,
-                                              gnc_numeric_neg (value));
-
-        gnc_basic_cell_set_changed (debit_cell, TRUE);
-        gnc_basic_cell_set_changed (credit_cell, TRUE);
-    }
-
-    price_cell = gnc_table_layout_get_cell (reg->table->layout, PRIC_CELL);
-    gnc_price_cell_set_value ((PriceCell *) price_cell, price);
-    gnc_basic_cell_set_changed (price_cell, TRUE);
-}
-
-static void
-recalculate_value (Split *split, SplitRegister *reg,
-              gnc_numeric price, gnc_numeric amount, gboolean shares_changed)
-{
-    BasicCell *debit_cell = gnc_table_layout_get_cell (reg->table->layout,
-                                                       DEBT_CELL);
-    BasicCell *credit_cell = gnc_table_layout_get_cell (reg->table->layout,
-                                                        CRED_CELL);
-    gint64 denom = gnc_split_get_value_denom (split);
-    gnc_numeric value = gnc_numeric_mul (price, amount, denom,
-                                         GNC_HOW_RND_ROUND_HALF_UP);
-
-    gnc_price_cell_set_debt_credit_value ((PriceCell *) debit_cell,
-                                          (PriceCell *) credit_cell, value);
-
-    gnc_basic_cell_set_changed (debit_cell, TRUE);
-    gnc_basic_cell_set_changed (credit_cell, TRUE);
-
-    if (shares_changed)
-    {
-        BasicCell *cell = gnc_table_layout_get_cell (reg->table->layout,
-                                                     PRIC_CELL);
-        gnc_basic_cell_set_changed (cell, FALSE);
-    }
-}
-
-static void
-record_price (SplitRegister *reg, Account *account, gnc_numeric value,
-              PriceSource source)
-{
-    Transaction *trans = gnc_split_register_get_current_trans (reg);
-    QofBook *book = qof_instance_get_book (QOF_INSTANCE (account));
-    GNCPriceDB *pricedb = gnc_pricedb_get_db (book);
-    gnc_commodity *comm = xaccAccountGetCommodity (account);
-    gnc_commodity *curr = xaccTransGetCurrency (trans);
-    GNCPrice *price;
-    gnc_numeric price_value;
-    int scu = gnc_commodity_get_fraction(curr);
-    Timespec ts;
-    BasicCell *cell = gnc_table_layout_get_cell (reg->table->layout, DATE_CELL);
-    gboolean swap = FALSE;
-
-    /* Only record the price for account types that don't have a
-     * "rate" cell. They'll get handled later by
-     * gnc_split_register_handle_exchange.
-     */
-    if (gnc_split_reg_has_rate_cell (reg->type))
-        return;
-    gnc_date_cell_get_date ((DateCell*)cell, &ts);
-    price = gnc_pricedb_lookup_day (pricedb, comm, curr, ts);
-    if (gnc_commodity_equiv (comm, gnc_price_get_currency (price)))
-            swap = TRUE;
-
-    if (price)
-    {
-        price_value = gnc_price_get_value(price);
-        if (gnc_numeric_equal(swap ? gnc_numeric_invert(value) : value,
-                              price_value))
-        {
-            gnc_price_unref (price);
-            return;
-        }
-        if (gnc_price_get_source(price) < PRICE_SOURCE_XFER_DLG_VAL)
-        {
-            /* Existing price is preferred over this one. */
-            gnc_price_unref(price);
-            return;
-        }
-        if (swap)
-        {
-            value = gnc_numeric_invert(value);
-            scu = gnc_commodity_get_fraction(comm);
-        }
-        value = gnc_numeric_convert(value, scu * COMMODITY_DENOM_MULT,
-                                    GNC_HOW_RND_ROUND_HALF_UP);
-        gnc_price_begin_edit (price);
-        gnc_price_set_time (price, ts);
-        gnc_price_set_source (price, source);
-        gnc_price_set_typestr (price, PRICE_TYPE_TRN);
-        gnc_price_set_value (price, value);
-        gnc_price_commit_edit (price);
-        gnc_price_unref (price);
-        return;
-    }
-
-    value = gnc_numeric_convert(value, scu * COMMODITY_DENOM_MULT,
-                                GNC_HOW_RND_ROUND_HALF_UP);
-    price = gnc_price_create (book);
-    gnc_price_begin_edit (price);
-    gnc_price_set_commodity (price, comm);
-    gnc_price_set_currency (price, curr);
-    gnc_price_set_time (price, ts);
-    gnc_price_set_source (price, source);
-    gnc_price_set_typestr (price, PRICE_TYPE_TRN);
-    gnc_price_set_value (price, value);
-    gnc_pricedb_add_price (pricedb, price);
-    gnc_price_commit_edit (price);
-}
-
-static gboolean
-gnc_split_register_auto_calc (SplitRegister *reg, Split *split)
-{
-    PriceCell *cell = NULL;
-    gboolean recalc_shares = FALSE;
-    gboolean recalc_price = FALSE;
-    gboolean recalc_value = FALSE;
-    gboolean price_changed;
-    gboolean value_changed;
-    gboolean shares_changed;
-    gnc_numeric calc_value;
-    gnc_numeric value;
-    gnc_numeric price;
-    gnc_numeric amount;
-    Account *account;
-    int denom;
-    int choice;
-    PriceSource source = PRICE_SOURCE_USER_PRICE;
-
-    if (STOCK_REGISTER    != reg->type &&
-        CURRENCY_REGISTER != reg->type &&
-        PORTFOLIO_LEDGER  != reg->type)
-        return TRUE;
-
-    account = gnc_split_register_get_account (reg, XFRM_CELL);
-
-    if (!account)
-        account = xaccSplitGetAccount (split);
-
-    if (!account)
-        account = gnc_split_register_get_default_account (reg);
-
-    if (!xaccAccountIsPriced(account))
-        return TRUE;
-
-    price_changed = gnc_table_layout_get_cell_changed (reg->table->layout,
-                    PRIC_CELL, TRUE);
-    value_changed = (gnc_table_layout_get_cell_changed (reg->table->layout,
-                      DEBT_CELL, TRUE) ||
-                      gnc_table_layout_get_cell_changed (reg->table->layout,
-                              CRED_CELL, TRUE));
-    shares_changed = gnc_table_layout_get_cell_changed (reg->table->layout,
-                     SHRS_CELL, TRUE);
-
-    if (!price_changed && !value_changed && !shares_changed)
-        return TRUE;
-
-    /* If we are using commodity trading accounts then the value may
-       not really be the value.  Punt if so. */
-    if (xaccTransUseTradingAccounts (xaccSplitGetParent (split)))
-    {
-        gnc_commodity *acc_commodity;
-        acc_commodity = xaccAccountGetCommodity (account);
-        if (! (xaccAccountIsPriced (account) ||
-                !gnc_commodity_is_iso (acc_commodity)))
-            return TRUE;
-    }
-
-    if (shares_changed)
-    {
-        cell = (PriceCell *) gnc_table_layout_get_cell (reg->table->layout,
-                SHRS_CELL);
-        amount = gnc_price_cell_get_value (cell);
-    }
-    else
-        amount = xaccSplitGetAmount (split);
-
-    if (price_changed)
-    {
-        cell = (PriceCell *) gnc_table_layout_get_cell (reg->table->layout,
-                PRIC_CELL);
-        price = gnc_price_cell_get_value (cell);
-    }
-    else
-        price = xaccSplitGetSharePrice (split);
-
-    if (value_changed)
-        value = calculate_value (reg);
-    else
-        value = xaccSplitGetValue (split);
-
-
-    /* Check if shares and price are BOTH zero (and value is non-zero).
-     * If so, we can assume that this is an income-correcting split
-     */
-    if (gnc_numeric_zero_p(amount) && gnc_numeric_zero_p(price) &&
-            !gnc_numeric_zero_p(value))
-    {
-        return TRUE;
-    }
-
-    /* Check if precisely one value is zero. If so, we can assume that the
-     * zero value needs to be recalculated.   */
-
-    if (!gnc_numeric_zero_p (amount))
-    {
-        if (gnc_numeric_zero_p (price))
-        {
-            if (!gnc_numeric_zero_p (value))
-                recalc_price = TRUE;
-        }
-        else if (gnc_numeric_zero_p (value))
-            recalc_value = TRUE;
-    }
-    else if (!gnc_numeric_zero_p (price))
-        if (!gnc_numeric_zero_p (value))
-            recalc_shares = TRUE;
-
-    /* If we have not already flagged a recalc, check if this is a split
-     * which has 2 of the 3 values changed. */
-
-    if ((!recalc_shares) &&
-            (!recalc_price)  &&
-            (!recalc_value))
-    {
-        if (price_changed && value_changed)
-        {
-            if (!shares_changed)
-                recalc_shares = TRUE;
-        }
-        else if (value_changed && shares_changed)
-            recalc_price = TRUE;
-        else if (price_changed && shares_changed)
-            recalc_value = TRUE;
-    }
-
-    calc_value = gnc_numeric_mul (price, amount,
-                                  GNC_DENOM_AUTO, GNC_HOW_DENOM_LCD);
-
-    denom = gnc_split_get_value_denom (split);
-
-    /*  Now, if we have not flagged one of the recalcs, and value and
-     *  calc_value are not the same number, then we need to ask for
-     *  help from the user. */
-
-    if (!recalc_shares &&
-        !recalc_price &&
-        !recalc_value &&
-        !gnc_numeric_same (value, calc_value, denom, GNC_HOW_RND_ROUND_HALF_UP))
-    {
-        choice = recalc_message_box(reg, shares_changed,
-                                    price_changed,
-                                    value_changed);
-        switch (choice)
-        {
-        case 0: /* Modify number of shares */
-            recalc_shares = TRUE;
-            break;
-        case 1: /* Modify the share price */
-            recalc_price = TRUE;
-            break;
-        case 2: /* Modify total value */
-            recalc_value = TRUE;
-            break;
-        default: /* Cancel */
-            return FALSE;
-        }
-    }
-
-    if (recalc_shares && !gnc_numeric_zero_p (price))
-        recalculate_shares (split, reg, value, price, value_changed);
-
-    if (recalc_price && !gnc_numeric_zero_p (amount))
-    {
-        recalculate_price (split, reg, value, amount);
-        price_changed = TRUE;
-        source = PRICE_SOURCE_SPLIT_REG;
-    }
-    if (recalc_value)
-        recalculate_value (split, reg, price, amount, shares_changed);
-
-    if (price_changed)
-    {
-        cell = (PriceCell *) gnc_table_layout_get_cell (reg->table->layout,
-                PRIC_CELL);
-        price = gnc_price_cell_get_value (cell);
-	if (gnc_numeric_positive_p(price))
-	    record_price (reg, account, price, source);
-    }
-    return TRUE;
-}
-
-static GNCAccountType
-gnc_split_register_type_to_account_type (SplitRegisterType sr_type)
-{
-    switch (sr_type)
-    {
-    case BANK_REGISTER:
-        return ACCT_TYPE_BANK;
-    case CASH_REGISTER:
-        return ACCT_TYPE_CASH;
-    case ASSET_REGISTER:
-        return ACCT_TYPE_ASSET;
-    case CREDIT_REGISTER:
-        return ACCT_TYPE_CREDIT;
-    case LIABILITY_REGISTER:
-        return ACCT_TYPE_LIABILITY;
-    case PAYABLE_REGISTER:
-        return ACCT_TYPE_PAYABLE;
-    case RECEIVABLE_REGISTER:
-        return ACCT_TYPE_RECEIVABLE;
-    case INCOME_LEDGER:
-    case INCOME_REGISTER:
-        return ACCT_TYPE_INCOME;
-    case EXPENSE_REGISTER:
-        return ACCT_TYPE_EXPENSE;
-    case STOCK_REGISTER:
-    case PORTFOLIO_LEDGER:
-        return ACCT_TYPE_STOCK;
-    case CURRENCY_REGISTER:
-        return ACCT_TYPE_CURRENCY;
-    case TRADING_REGISTER:
-        return ACCT_TYPE_TRADING;
-    case GENERAL_JOURNAL:
-        return ACCT_TYPE_NONE;
-    case EQUITY_REGISTER:
-        return ACCT_TYPE_EQUITY;
-    case SEARCH_LEDGER:
-        return ACCT_TYPE_NONE;
-    default:
-        return ACCT_TYPE_NONE;
-    }
-}
-
-const char *
-gnc_split_register_get_debit_string (SplitRegister *reg)
-{
-    SRInfo *info = gnc_split_register_get_info (reg);
-
-    if (!reg)
-        return NULL;
-
-    if (info->debit_str)
-        return info->debit_str;
-
-    info->debit_str =
-        gnc_get_debit_string
-        (gnc_split_register_type_to_account_type (reg->type));
-
-    if (info->debit_str)
-        return info->debit_str;
-
-    info->debit_str = g_strdup (_("Debit"));
-
-    return info->debit_str;
-}
-
-const char *
-gnc_split_register_get_credit_string (SplitRegister *reg)
-{
-    SRInfo *info = gnc_split_register_get_info (reg);
-
-    if (!reg)
-        return NULL;
-
-    if (info->credit_str)
-        return info->credit_str;
-
-    info->credit_str =
-        gnc_get_credit_string
-        (gnc_split_register_type_to_account_type (reg->type));
-
-    if (info->credit_str)
-        return info->credit_str;
-
-    info->credit_str = g_strdup (_("Credit"));
-
-    return info->credit_str;
-}
-
-gboolean
-gnc_split_register_changed (SplitRegister *reg)
-{
-    SRInfo *info = gnc_split_register_get_info (reg);
-    Transaction *pending_trans;
-
-    ENTER("reg=%p", reg);
-
-    if (reg == NULL)
-    {
-        LEAVE("no register");
-        return FALSE;
-    }
-
-    if (gnc_table_current_cursor_changed (reg->table, FALSE))
-    {
-        LEAVE("cursor changed");
-        return TRUE;
-    }
-
-    pending_trans = xaccTransLookup (&info->pending_trans_guid,
-                                     gnc_get_current_book ());
-    if (xaccTransIsOpen (pending_trans))
-    {
-        LEAVE("open and pending txn");
-        return TRUE;
-    }
-
-    LEAVE("register unchanged");
-    return FALSE;
-}
-
-void
-gnc_split_register_show_present_divider (SplitRegister *reg,
-        gboolean show_present)
-{
-    SRInfo *info = gnc_split_register_get_info (reg);
-
-    if (reg == NULL)
-        return;
-
-    info->show_present_divider = show_present;
-}
-
-gboolean
-gnc_split_register_full_refresh_ok (SplitRegister *reg)
-{
-    SRInfo *info = gnc_split_register_get_info (reg);
-
-    if (!info)
-        return FALSE;
-
-    return info->full_refresh;
-}
-
-/* configAction strings into the action cell */
-/* hack alert -- this stuff really, really should be in a config file ... */
-static void
-gnc_split_register_config_action (SplitRegister *reg)
-{
-    ComboCell *cell;
-
-    cell = (ComboCell *) gnc_table_layout_get_cell (reg->table->layout,
-            ACTN_CELL);
-
-    /* setup strings in the action pull-down */
-    switch (reg->type)
-    {
-    case BANK_REGISTER:
-        /* broken ! FIXME bg */
-    case SEARCH_LEDGER:
-        /* Translators: This string has a context prefix; the translation
-        	must only contain the part after the | character. */
-        gnc_combo_cell_add_menu_item (cell, Q_("Action Column|Deposit"));
-        gnc_combo_cell_add_menu_item (cell, _("Withdraw"));
-        gnc_combo_cell_add_menu_item (cell, _("Check"));
-        gnc_combo_cell_add_menu_item (cell, _("Interest"));
-        gnc_combo_cell_add_menu_item (cell, _("ATM Deposit"));
-        gnc_combo_cell_add_menu_item (cell, _("ATM Draw"));
-        gnc_combo_cell_add_menu_item (cell, _("Teller"));
-        gnc_combo_cell_add_menu_item (cell, _("Charge"));
-        gnc_combo_cell_add_menu_item (cell, _("Payment"));
-        gnc_combo_cell_add_menu_item (cell, _("Receipt"));
-        gnc_combo_cell_add_menu_item (cell, _("Increase"));
-        gnc_combo_cell_add_menu_item (cell, _("Decrease"));
-        /* Action: Point Of Sale */
-        gnc_combo_cell_add_menu_item (cell, _("POS"));
-        gnc_combo_cell_add_menu_item (cell, _("Phone"));
-        gnc_combo_cell_add_menu_item (cell, _("Online"));
-        /* Action: Automatic Deposit ?!? */
-        gnc_combo_cell_add_menu_item (cell, _("AutoDep"));
-        gnc_combo_cell_add_menu_item (cell, _("Wire"));
-        gnc_combo_cell_add_menu_item (cell, _("Credit"));
-        gnc_combo_cell_add_menu_item (cell, _("Direct Debit"));
-        gnc_combo_cell_add_menu_item (cell, _("Transfer"));
-        break;
-    case CASH_REGISTER:
-        gnc_combo_cell_add_menu_item (cell, _("Increase"));
-        gnc_combo_cell_add_menu_item (cell, _("Decrease"));
-        gnc_combo_cell_add_menu_item (cell, _("Buy"));
-        gnc_combo_cell_add_menu_item (cell, _("Sell"));
-        break;
-    case ASSET_REGISTER:
-        gnc_combo_cell_add_menu_item (cell, _("Buy"));
-        gnc_combo_cell_add_menu_item (cell, _("Sell"));
-        gnc_combo_cell_add_menu_item (cell, _("Fee"));
-        break;
-    case CREDIT_REGISTER:
-        gnc_combo_cell_add_menu_item (cell, _("ATM Deposit"));
-        gnc_combo_cell_add_menu_item (cell, _("ATM Draw"));
-        gnc_combo_cell_add_menu_item (cell, _("Buy"));
-        gnc_combo_cell_add_menu_item (cell, _("Credit"));
-        gnc_combo_cell_add_menu_item (cell, _("Fee"));
-        gnc_combo_cell_add_menu_item (cell, _("Interest"));
-        gnc_combo_cell_add_menu_item (cell, _("Online"));
-        gnc_combo_cell_add_menu_item (cell, _("Sell"));
-        break;
-    case LIABILITY_REGISTER:
-        gnc_combo_cell_add_menu_item (cell, _("Buy"));
-        gnc_combo_cell_add_menu_item (cell, _("Sell"));
-        gnc_combo_cell_add_menu_item (cell, _("Loan"));
-        gnc_combo_cell_add_menu_item (cell, _("Interest"));
-        gnc_combo_cell_add_menu_item (cell, _("Payment"));
-        break;
-    case RECEIVABLE_REGISTER:
-    case PAYABLE_REGISTER:
-        gnc_combo_cell_add_menu_item (cell, _("Invoice"));
-        gnc_combo_cell_add_menu_item (cell, _("Payment"));
-        gnc_combo_cell_add_menu_item (cell, _("Interest"));
-        gnc_combo_cell_add_menu_item (cell, _("Credit"));
-        break;
-    case INCOME_LEDGER:
-    case INCOME_REGISTER:
-        gnc_combo_cell_add_menu_item (cell, _("Increase"));
-        gnc_combo_cell_add_menu_item (cell, _("Decrease"));
-        gnc_combo_cell_add_menu_item (cell, _("Buy"));
-        gnc_combo_cell_add_menu_item (cell, _("Sell"));
-        gnc_combo_cell_add_menu_item (cell, _("Interest"));
-        gnc_combo_cell_add_menu_item (cell, _("Payment"));
-        gnc_combo_cell_add_menu_item (cell, _("Rebate"));
-        gnc_combo_cell_add_menu_item (cell, _("Paycheck"));
-        break;
-    case EXPENSE_REGISTER:
-    case TRADING_REGISTER:
-        gnc_combo_cell_add_menu_item (cell, _("Increase"));
-        gnc_combo_cell_add_menu_item (cell, _("Decrease"));
-        gnc_combo_cell_add_menu_item (cell, _("Buy"));
-        gnc_combo_cell_add_menu_item (cell, _("Sell"));
-        break;
-    case GENERAL_JOURNAL:
-    case EQUITY_REGISTER:
-        gnc_combo_cell_add_menu_item (cell, _("Buy"));
-        gnc_combo_cell_add_menu_item (cell, _("Sell"));
-        gnc_combo_cell_add_menu_item (cell, _("Equity"));
-        break;
-    case STOCK_REGISTER:
-    case PORTFOLIO_LEDGER:
-    case CURRENCY_REGISTER:
-        gnc_combo_cell_add_menu_item (cell, ACTION_BUY_STR);
-        gnc_combo_cell_add_menu_item (cell, ACTION_SELL_STR);
-        gnc_combo_cell_add_menu_item (cell, _("Price"));
-        gnc_combo_cell_add_menu_item (cell, _("Fee"));
-        /* Action: Dividend */
-        gnc_combo_cell_add_menu_item (cell, _("Dividend"));
-        gnc_combo_cell_add_menu_item (cell, _("Interest"));
-        /* Action: Long Term Capital Gains */
-        gnc_combo_cell_add_menu_item (cell, _("LTCG"));
-        /* Action: Short Term Capital Gains */
-        gnc_combo_cell_add_menu_item (cell, _("STCG"));
-        gnc_combo_cell_add_menu_item (cell, _("Income"));
-        /* Action: Distribution */
-        gnc_combo_cell_add_menu_item (cell, _("Dist"));
-        /* Translators: This string has a disambiguation prefix */
-        gnc_combo_cell_add_menu_item (cell, Q_("Action Column|Split"));
-        break;
-
-    default:
-        gnc_combo_cell_add_menu_item (cell, _("Increase"));
-        gnc_combo_cell_add_menu_item (cell, _("Decrease"));
-        gnc_combo_cell_add_menu_item (cell, _("Buy"));
-        gnc_combo_cell_add_menu_item (cell, _("Sell"));
-        break;
-    }
-}
-
-static void
-gnc_split_register_config_cells (SplitRegister *reg)
-{
-    gnc_combo_cell_add_ignore_string
-    ((ComboCell *)
-     gnc_table_layout_get_cell (reg->table->layout, MXFRM_CELL),
-     SPLIT_TRANS_STR);
-
-    gnc_combo_cell_add_ignore_string
-    ((ComboCell *)
-     gnc_table_layout_get_cell (reg->table->layout, MXFRM_CELL),
-     STOCK_SPLIT_STR);
-
-    /* the action cell */
-    gnc_combo_cell_set_autosize
-    ((ComboCell *)
-     gnc_table_layout_get_cell (reg->table->layout, ACTN_CELL), TRUE);
-
-    /* Use 6 decimal places for prices and "exchange rates"  */
-    gnc_price_cell_set_fraction
-    ((PriceCell *)
-     gnc_table_layout_get_cell (reg->table->layout, PRIC_CELL),
-     PRICE_CELL_DENOM);
-
-    /* Initialize shares and share balance cells */
-    gnc_price_cell_set_print_info
-    ((PriceCell *) gnc_table_layout_get_cell (reg->table->layout, SHRS_CELL),
-     gnc_default_share_print_info ());
-
-    gnc_price_cell_set_print_info
-    ((PriceCell *) gnc_table_layout_get_cell (reg->table->layout, TSHRS_CELL),
-     gnc_default_share_print_info ());
-
-    /* Initialize the rate cell
-     * use a share_print_info to make sure we don't have rounding errors
-     */
-    gnc_price_cell_set_print_info
-    ((PriceCell *) gnc_table_layout_get_cell (reg->table->layout, RATE_CELL),
-     gnc_default_share_print_info());
-
-    /* The action cell should accept strings not in the list */
-    gnc_combo_cell_set_strict
-    ((ComboCell *)
-     gnc_table_layout_get_cell (reg->table->layout, ACTN_CELL), FALSE);
-
-    /* number format for share quantities in stock ledgers */
-    switch (reg->type)
-    {
-    case CURRENCY_REGISTER:
-    case STOCK_REGISTER:
-    case PORTFOLIO_LEDGER:
-        gnc_price_cell_set_print_info
-        ((PriceCell *)
-         gnc_table_layout_get_cell (reg->table->layout, PRIC_CELL),
-         gnc_default_price_print_info ());
-        break;
-
-    default:
-        break;
-    }
-
-    /* add menu items for the action cell */
-    gnc_split_register_config_action (reg);
-}
-
-static void
-split_register_pref_changed (gpointer prefs, gchar *pref, gpointer user_data)
-{
-    SplitRegister * reg = user_data;
-    SRInfo *info;
-
-    g_return_if_fail(pref);
-    if (reg == NULL)
-        return;
-
-    info = reg->sr_info;
-    if (!info)
-        return;
-
-    if (g_str_has_suffix(pref, GNC_PREF_ACCOUNTING_LABELS))
-    {
-        /* Release current strings. Will be reloaded at next reference. */
-        g_free (info->debit_str);
-        g_free (info->tdebit_str);
-        g_free (info->credit_str);
-        g_free (info->tcredit_str);
-
-        info->debit_str = NULL;
-        info->tdebit_str = NULL;
-        info->credit_str = NULL;
-        info->tcredit_str = NULL;
-
-    }
-    else if (g_str_has_suffix(pref, GNC_PREF_ACCOUNT_SEPARATOR))
-    {
-        info->separator_changed = TRUE;
-    }
-    else
-    {
-        g_warning("split_register_pref_changed: Unknown preference %s", pref);
-    }
-}
-
-static void
-split_register_book_option_changed (gpointer new_val, gpointer user_data)
-{
-    SplitRegister * reg = user_data;
-    gboolean *new_data = (gboolean*)new_val;
-
-    if (reg == NULL)
-        return;
-
-    reg->use_tran_num_for_num_field = (*new_data ? FALSE : TRUE);
-}
-
-static void
-gnc_split_register_init (SplitRegister *reg,
-                         SplitRegisterType type,
-                         SplitRegisterStyle style,
-                         gboolean use_double_line,
-                         gboolean do_auto_complete,
-                         gboolean is_template)
-{
-    TableLayout *layout;
-    TableModel *model;
-    TableControl *control;
-
-    /* Register 'destroy' callback */
-    gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL,
-                           GNC_PREF_ACCOUNTING_LABELS,
-                           split_register_pref_changed,
-                           reg);
-    gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL,
-                           GNC_PREF_ACCOUNT_SEPARATOR,
-                           split_register_pref_changed,
-                           reg);
-    gnc_book_option_register_cb(OPTION_NAME_NUM_FIELD_SOURCE,
-                                split_register_book_option_changed,
-                                reg);
-
-    reg->sr_info = NULL;
-
-    reg->type = type;
-    reg->style = style;
-    reg->use_double_line = use_double_line;
-    reg->do_auto_complete = do_auto_complete;
-    reg->is_template = is_template;
-    reg->use_tran_num_for_num_field =
-                (qof_book_use_split_action_for_num_field(gnc_get_current_book())
-                    ? FALSE : TRUE);
-
-    layout = gnc_split_register_layout_new (reg);
-
-    if (is_template)
-        model = gnc_template_register_model_new ();
-    else
-        model = gnc_split_register_model_new ();
-    model->handler_user_data = reg;
-
-    control = gnc_split_register_control_new ();
-    control->user_data = reg;
-
-    reg->table = gnc_table_new (layout, model, control);
-
-    gnc_split_register_config_cells (reg);
-
-    /* Set up header */
-    {
-        VirtualCellLocation vcell_loc = { 0, 0 };
-        CellBlock *header;
-
-        header = gnc_table_layout_get_cursor (reg->table->layout, CURSOR_HEADER);
-
-        gnc_table_set_vcell (reg->table, header, NULL, TRUE, TRUE, vcell_loc);
-    }
-
-    /* Set up first and only initial row */
-    {
-        VirtualLocation vloc;
-        CellBlock *cursor;
-
-        vloc.vcell_loc.virt_row = 1;
-        vloc.vcell_loc.virt_col = 0;
-        vloc.phys_row_offset = 0;
-        vloc.phys_col_offset = 0;
-
-        cursor = gnc_table_layout_get_cursor (reg->table->layout,
-                                              CURSOR_SINGLE_LEDGER);
-
-        gnc_table_set_vcell (reg->table, cursor, NULL, TRUE, TRUE, vloc.vcell_loc);
-
-        if (gnc_table_find_close_valid_cell (reg->table, &vloc, FALSE))
-            gnc_table_move_cursor (reg->table, vloc);
-        else
-        {
-            PERR ("Can't find valid initial location");
-        }
-    }
-}
-
-SplitRegister *
-gnc_split_register_new (SplitRegisterType type,
-                        SplitRegisterStyle style,
-                        gboolean use_double_line,
-                        gboolean is_template)
-{
-    SplitRegister * reg;
-    gboolean default_do_auto_complete = TRUE;
-
-    reg = g_new0 (SplitRegister, 1);
-
-    if (type >= NUM_SINGLE_REGISTER_TYPES)
-        style = REG_STYLE_JOURNAL;
-
-    gnc_split_register_init (reg,
-                             type,
-                             style,
-                             use_double_line,
-                             default_do_auto_complete,
-                             is_template);
-
-    return reg;
-}
-
-void
-gnc_split_register_config (SplitRegister *reg,
-                           SplitRegisterType newtype,
-                           SplitRegisterStyle newstyle,
-                           gboolean use_double_line)
-{
-    if (!reg) return;
-
-    /* If shrinking the transaction split, put the cursor on the first row of the trans */
-    if (reg->use_double_line && !use_double_line)
-    {
-        VirtualLocation virt_loc = reg->table->current_cursor_loc;
-        if (gnc_table_find_close_valid_cell (reg->table, &virt_loc, FALSE))
-        {
-            if (virt_loc.phys_row_offset)
-            {
-                gnc_table_move_vertical_position (reg->table, &virt_loc, -virt_loc.phys_row_offset);
-                gnc_table_move_cursor_gui (reg->table, virt_loc);
-            }
-        }
-        else
-        {
-            /* WTF?  Go to a known safe location. */
-            virt_loc.vcell_loc.virt_row = 1;
-            virt_loc.vcell_loc.virt_col = 0;
-            virt_loc.phys_row_offset = 0;
-            virt_loc.phys_col_offset = 0;
-            gnc_table_move_cursor_gui (reg->table, virt_loc);
-        }
-    }
-
-    reg->type = newtype;
-
-    if (reg->type >= NUM_SINGLE_REGISTER_TYPES)
-        newstyle = REG_STYLE_JOURNAL;
-
-    reg->style = newstyle;
-    reg->use_double_line = use_double_line;
-
-    gnc_table_realize_gui (reg->table);
-}
-
-void
-gnc_split_register_set_auto_complete(SplitRegister *reg,
-                                     gboolean do_auto_complete)
-{
-    g_return_if_fail(reg);
-    reg->do_auto_complete = do_auto_complete;
-}
-
-static void
-gnc_split_register_destroy_info (SplitRegister *reg)
-{
-    SRInfo *info;
-
-    if (reg == NULL)
-        return;
-
-    info = reg->sr_info;
-    if (!info)
-        return;
-
-    g_free (info->debit_str);
-    g_free (info->tdebit_str);
-    g_free (info->credit_str);
-    g_free (info->tcredit_str);
-
-    info->debit_str = NULL;
-    info->tdebit_str = NULL;
-    info->credit_str = NULL;
-    info->tcredit_str = NULL;
-
-    g_free (reg->sr_info);
-
-    reg->sr_info = NULL;
-}
-
-void
-gnc_split_register_set_data (SplitRegister *reg, void *user_data,
-                             SRGetParentCallback get_parent)
-{
-    SRInfo *info = gnc_split_register_get_info (reg);
-
-    g_return_if_fail (reg != NULL);
-
-    info->user_data = user_data;
-    info->get_parent = get_parent;
-}
-
-static void
-gnc_split_register_cleanup (SplitRegister *reg)
-{
-    SRInfo *info = gnc_split_register_get_info (reg);
-    Transaction *pending_trans;
-    Transaction *blank_trans = NULL;
-    Split *blank_split;
-
-    ENTER("reg=%p", reg);
-
-    blank_split = xaccSplitLookup (&info->blank_split_guid,
-                                   gnc_get_current_book ());
-
-    pending_trans = xaccTransLookup (&info->pending_trans_guid,
-                                     gnc_get_current_book ());
-
-    gnc_suspend_gui_refresh ();
-
-    /* Destroy the transaction containing the "blank split", which was only
-     * created to support the area for entering a new transaction. Since the
-     * register is closing, this transaction is no longer needed. */
-    if (blank_split != NULL)
-    {
-        gboolean was_open;
-
-        blank_trans = xaccSplitGetParent (blank_split);
-
-        DEBUG("blank_split=%p, blank_trans=%p, pending_trans=%p",
-              blank_split, blank_trans, pending_trans);
-
-        /* Destroying the transaction will automatically remove its splits. */
-        was_open = xaccTransIsOpen (blank_trans);
-        xaccTransDestroy (blank_trans);
-        if (was_open)
-            xaccTransCommitEdit (blank_trans);
-
-        /* Update the register info. */
-        if (blank_trans == pending_trans)
-        {
-            info->pending_trans_guid = *guid_null ();
-            pending_trans = NULL;
-        }
-        info->blank_split_guid = *guid_null ();
-        info->auto_complete = FALSE;
-        blank_split = NULL;
-    }
-
-    /* be sure to take care of any open transactions */
-    if (pending_trans != NULL)
-    {
-        g_critical("BUG DETECTED: pending_trans=%p, blank_split=%p, blank_trans=%p",
-                   pending_trans, blank_split, blank_trans);
-        g_assert_not_reached();
-        info->pending_trans_guid = *guid_null ();
-        /* CAS: It's not clear to me that we'd really want to commit
-           here, rather than rollback. But, maybe this is just dead
-           code. */
-        if (xaccTransIsOpen (pending_trans))
-            xaccTransCommitEdit (pending_trans);
-        else g_assert_not_reached();
-
-        pending_trans = NULL;
-    }
-
-    gnc_split_register_destroy_info (reg);
-
-    gnc_resume_gui_refresh ();
-
-    LEAVE(" ");
-}
-
-void
-gnc_split_register_destroy (SplitRegister *reg)
-{
-    g_return_if_fail(reg);
-
-    ENTER("reg=%p", reg);
-
-    gnc_prefs_remove_cb_by_func (GNC_PREFS_GROUP_GENERAL,
-                                 GNC_PREF_ACCOUNTING_LABELS,
-                                 split_register_pref_changed,
-                                 reg);
-    gnc_prefs_remove_cb_by_func (GNC_PREFS_GROUP_GENERAL,
-                                 GNC_PREF_ACCOUNT_SEPARATOR,
-                                 split_register_pref_changed,
-                                 reg);
-    gnc_book_option_remove_cb(OPTION_NAME_NUM_FIELD_SOURCE,
-                                split_register_book_option_changed,
-                                reg);
-    gnc_split_register_cleanup (reg);
-
-    gnc_table_destroy (reg->table);
-    reg->table = NULL;
-
-    /* free the memory itself */
-    g_free (reg);
-    LEAVE(" ");
-}
-
-void
-gnc_split_register_set_read_only (SplitRegister *reg, gboolean read_only)
-{
-    gnc_table_model_set_read_only (reg->table->model, read_only);
-}
diff --git a/src/register/ledger-core/test/Makefile.am b/src/register/ledger-core/test/Makefile.am
deleted file mode 100644
index b9d57a4..0000000
--- a/src/register/ledger-core/test/Makefile.am
+++ /dev/null
@@ -1,15 +0,0 @@
-TESTS =  test-link-module
-
-check_PROGRAMS = test-link-module
-
-test_link_module_SOURCES=test-link-module.c
-test_link_module_LDADD=\
-	$(top_builddir)/src/engine/libgncmod-engine.la \
-        $(top_builddir)/src/app-utils/libgncmod-app-utils.la \
-	${top_builddir}/src/gnome-utils/libgncmod-gnome-utils.la \
-	${top_builddir}/src/gnome/libgnc-gnome.la \
-    ../libgncmod-ledger-core.la
-
-AM_CPPFLAGS = -I${top_srcdir}/src/test-core -I.. ${GLIB_CFLAGS}
-
-EXTRA_DIST = CMakeLists.txt
diff --git a/src/register/register-core/Makefile.am b/src/register/register-core/Makefile.am
deleted file mode 100644
index dca543d..0000000
--- a/src/register/register-core/Makefile.am
+++ /dev/null
@@ -1,70 +0,0 @@
-SUBDIRS = . test
-
-pkglib_LTLIBRARIES = libgncmod-register-core.la
-
-libgncmod_register_core_la_LDFLAGS = -avoid-version
-
-libgncmod_register_core_la_LIBADD = \
-  ${top_builddir}/src/gnc-module/libgnc-module.la \
-  ${top_builddir}/src/engine/libgncmod-engine.la \
-  ${top_builddir}/src/core-utils/libgnc-core-utils.la \
-  ${top_builddir}/src/app-utils/libgncmod-app-utils.la \
-  ${top_builddir}/src/gnome-utils/libgncmod-gnome-utils.la \
-  ${GUILE_LIBS} \
-  ${GLIB_LIBS}
-
-libgncmod_register_core_la_SOURCES = \
-  gncmod-register-core.c \
-  basiccell.c \
-  cell-factory.c \
-  cellblock.c \
-  formulacell.c \
-  gtable.c \
-  numcell.c \
-  pricecell.c \
-  quickfillcell.c \
-  recncell.c \
-  checkboxcell.c \
-  register-common.c \
-  table-allgui.c \
-  table-control.c \
-  table-layout.c \
-  table-model.c
-
-
-gncincludedir = ${GNC_INCLUDE_DIR}
-gncinclude_HEADERS = \
-  basiccell.h \
-  cell-factory.h \
-  cellblock.h \
-  combocell.h \
-  datecell.h \
-  formulacell.h \
-  gtable.h \
-  numcell.h \
-  pricecell.h \
-  quickfillcell.h \
-  recncell.h \
-  checkboxcell.h \
-  register-common.h \
-  table-allgui.h \
-  table-control.h \
-  table-layout.h \
-  table-model.h
-
-AM_CPPFLAGS = \
-  -I${top_srcdir}/src \
-  -I${top_srcdir}/src/engine \
-  -I${top_srcdir}/src/core-utils \
-  -I${top_srcdir}/src/app-utils \
-  -I${top_srcdir}/src/gnc-module \
-  -I${top_srcdir}/src/gnome-utils \
-  ${GUILE_CFLAGS} \
-  ${GTK_CFLAGS} \
-  ${GLIB_CFLAGS}
-
-CLEANFILES = $(BUILT_SOURCES)
-
-AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.register.core\"
-
-EXTRA_DIST = CMakeLists.txt
diff --git a/src/register/register-core/test/Makefile.am b/src/register/register-core/test/Makefile.am
deleted file mode 100644
index 785d760..0000000
--- a/src/register/register-core/test/Makefile.am
+++ /dev/null
@@ -1,24 +0,0 @@
-TESTS =  \
-  test-link-module
-#  test-load-module
-
-#GNC_TEST_DEPS := \
-#
-
-#TESTS_ENVIRONMENT := \
-#  $(shell ${abs_top_srcdir}/src/gnc-test-env.pl --noexports ${GNC_TEST_DEPS})
-
-check_PROGRAMS = \
-  test-link-module
-
-test_link_module_SOURCES=test-link-module.c
-test_link_module_LDADD=\
-  ${top_builddir}/src/engine/libgncmod-engine.la \
-  ${top_builddir}/src/app-utils/libgncmod-app-utils.la \
-  ${top_builddir}/src/gnome-utils/libgncmod-gnome-utils.la \
-  ../libgncmod-register-core.la
-
-EXTRA_DIST = CMakeLists.txt
-#            test-load-module
-
-AM_CPPFLAGS = ${GLIB_CFLAGS} -I${top_srcdir}/src/test-core -I..
diff --git a/src/register/register-gnome/CMakeLists.txt b/src/register/register-gnome/CMakeLists.txt
deleted file mode 100644
index 2e9b2e7..0000000
--- a/src/register/register-gnome/CMakeLists.txt
+++ /dev/null
@@ -1,64 +0,0 @@
-ADD_SUBDIRECTORY(test)
-
-SET (register_gnome_SOURCES
-  gncmod-register-gnome.c
-  combocell-gnome.c
-  datecell-gnome.c
-  formulacell-gnome.c
-  gnucash-color.c
-  gnucash-cursor.c
-  gnucash-date-picker.c
-  gnucash-header.c
-  gnucash-item-edit.c
-  gnucash-item-list.c
-  gnucash-register.c
-  gnucash-scrolled-window.c
-  gnucash-sheet-private.c
-  gnucash-sheet.c
-  gnucash-style.c
-  pricecell-gnome.c
-  quickfillcell-gnome.c
-  table-gnome.c
-)
-
-SET (register_gnome_noinst_HEADERS
-  formulacell-gnome.h
-  gnucash-color.h
-  gnucash-cursor.h
-  gnucash-date-picker.h
-  gnucash-header.h
-  gnucash-item-edit.h
-  gnucash-item-list.h
-  gnucash-register.h
-  gnucash-scrolled-window.h
-  gnucash-sheet.h
-  gnucash-sheetP.h
-  gnucash-style.h
-  pricecell-gnome.h
-  quickfillcell-gnome.h
-  table-gnome.h
-)
-
-# Add dependency on config.h
-SET_SOURCE_FILES_PROPERTIES (${register_gnome_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
-
-ADD_LIBRARY (gncmod-register-gnome ${register_gnome_SOURCES} ${register_gnome_noinst_HEADERS})
-
-TARGET_LINK_LIBRARIES(gncmod-register-gnome gncmod-register-core ${GTK3_LDFLAGS})
-
-TARGET_COMPILE_DEFINITIONS(gncmod-register-gnome PRIVATE -DG_LOG_DOMAIN=\"gnc.register.gnome\")
-
-TARGET_INCLUDE_DIRECTORIES(gncmod-register-gnome
-    PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
-    PRIVATE ${CMAKE_SOURCE_DIR}/src/register/ledger-core ${GTK3_INCLUDE_DIRS}
-)
-
-INSTALL(TARGETS gncmod-register-gnome
-  LIBRARY DESTINATION lib/gnucash
-  ARCHIVE DESTINATION lib/gnucash
-  RUNTIME DESTINATION bin)
-# No headers to install
-
-SET_LOCAL_DIST(register_gnome_DIST_local CMakeLists.txt Makefile.am ${register_gnome_SOURCES} ${register_gnome_noinst_HEADERS})
-
-SET(register_gnome_DIST ${register_gnome_DIST_local} ${test_register_gnome_DIST} PARENT_SCOPE)
diff --git a/src/register/register-gnome/Makefile.am b/src/register/register-gnome/Makefile.am
deleted file mode 100644
index 0da1eb2..0000000
--- a/src/register/register-gnome/Makefile.am
+++ /dev/null
@@ -1,69 +0,0 @@
-SUBDIRS = . test
-
-pkglib_LTLIBRARIES = libgncmod-register-gnome.la
-
-libgncmod_register_gnome_la_LDFLAGS = -avoid-version
-
-libgncmod_register_gnome_la_LIBADD = \
-  ${top_builddir}/src/register/register-core/libgncmod-register-core.la \
-  ${top_builddir}/src/core-utils/libgnc-core-utils.la \
-  ${top_builddir}/src/gnc-module/libgnc-module.la \
-  ${top_builddir}/src/engine/libgncmod-engine.la \
-  ${top_builddir}/src/app-utils/libgncmod-app-utils.la \
-  ${top_builddir}/src/gnome-utils/libgncmod-gnome-utils.la \
-  ${GLIB_LIBS} \
-  ${GTK_LIBS}
-
-libgncmod_register_gnome_la_SOURCES = \
-  gncmod-register-gnome.c \
-  combocell-gnome.c \
-  datecell-gnome.c \
-  formulacell-gnome.c \
-  gnucash-color.c \
-  gnucash-cursor.c \
-  gnucash-date-picker.c \
-  gnucash-header.c \
-  gnucash-item-edit.c \
-  gnucash-item-list.c \
-  gnucash-register.c \
-  gnucash-scrolled-window.c \
-  gnucash-sheet-private.c \
-  gnucash-sheet.c \
-  gnucash-style.c \
-  pricecell-gnome.c \
-  quickfillcell-gnome.c \
-  table-gnome.c 
-
-noinst_HEADERS = \
-  formulacell-gnome.h \
-  gnucash-color.h \
-  gnucash-cursor.h \
-  gnucash-date-picker.h \
-  gnucash-header.h \
-  gnucash-item-edit.h \
-  gnucash-item-list.h \
-  gnucash-register.h \
-  gnucash-scrolled-window.h \
-  gnucash-sheet.h \
-  gnucash-sheetP.h \
-  gnucash-style.h \
-  pricecell-gnome.h \
-  quickfillcell-gnome.h \
-  table-gnome.h
-
-AM_CPPFLAGS = \
-  -I${top_srcdir}/src \
-  -I${top_srcdir}/src/core-utils \
-  -I${top_srcdir}/src/engine \
-  -I${top_srcdir}/src/gnc-module \
-  -I${top_srcdir}/src/app-utils \
-  -I${top_srcdir}/src/gnome-utils \
-  -I${top_srcdir}/src/register/ledger-core \
-  -I${top_srcdir}/src/register/register-core \
-  ${GLIB_CFLAGS} \
-  ${GTK_CFLAGS} \
-  ${GTK_XIM_FLAGS}
-
-AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.register.gnome\"
-
-EXTRA_DIST = CMakeLists.txt
diff --git a/src/register/register-gnome/test/Makefile.am b/src/register/register-gnome/test/Makefile.am
deleted file mode 100644
index df8c865..0000000
--- a/src/register/register-gnome/test/Makefile.am
+++ /dev/null
@@ -1,24 +0,0 @@
-TESTS =  \
-  test-link-module
-#  test-load-module
-
-#GNC_TEST_DEPS := \
-#
-
-#TESTS_ENVIRONMENT := \
-#  $(shell ${abs_top_srcdir}/src/gnc-test-env.pl --noexports ${GNC_TEST_DEPS})
-
-check_PROGRAMS = \
-  test-link-module
-
-test_link_module_SOURCES = test-link-module.c
-test_link_module_LDADD = \
-  ${top_builddir}/src/engine/libgncmod-engine.la \
-  ${top_builddir}/src/app-utils/libgncmod-app-utils.la \
-  ${top_builddir}/src/gnome-utils/libgncmod-gnome-utils.la \
-  ../libgncmod-register-gnome.la
-
-EXTRA_DIST = CMakeLists.txt
-#            test-load-module
-
-AM_CPPFLAGS = -I${top_srcdir}/src/test-core -I.. ${GLIB_CFLAGS}
diff --git a/src/report/business-reports/CMakeLists.txt b/src/report/business-reports/CMakeLists.txt
deleted file mode 100644
index 9e67d08..0000000
--- a/src/report/business-reports/CMakeLists.txt
+++ /dev/null
@@ -1,48 +0,0 @@
-
-SET (business_reports_SCHEME
-  aging.scm
-  customer-summary.scm
-  easy-invoice.scm
-  fancy-invoice.scm
-  taxinvoice.scm
-  receipt.scm
-  invoice.scm
-  job-report.scm
-  owner-report.scm
-  payables.scm
-  receivables.scm
-  balsheet-eg.scm
-  business-reports.scm
-)
-
-SET(business_reports_DATA
-  taxinvoice.eguile.scm
-  taxinvoice.css
-  receipt.eguile.scm
-  receipt.css
-  balsheet-eg.css
-  balsheet-eg.eguile.scm
-)
-
-SET(GUILE_OUTPUT_DIR   gnucash/report)
-SET(GUILE_MODULES      src/app-utils src/engine src/html src/gnome-utils
-                         src/report/report-system src/report/standard-reports)
-SET(GUILE_LOAD_DIRS    src/app-utils src/core-utils src/engine src/gnc-module src/gnome-utils src/scm
-                         src/report/business_reports src/report/report-system src/report/standard-reports)
-SET(GUILE_LIBRARY_DIRS src/app-utils src/core-utils src/engine src/gnc-module src/gnome-utils src/report/report-system
-                         src/report/standard-reports)
-SET(GUILE_DEPENDS      scm-business-reports-links scm-standard-reports)
-
-GNC_ADD_SCHEME_TARGETS(scm-business-reports
-  "${business_reports_SCHEME}"
-  ${GUILE_OUTPUT_DIR} 
-  "${GUILE_MODULES}"
-  "${GUILE_LOAD_DIRS}"
-  "${GUILE_LIBRARY_DIRS}"
-  "${GUILE_DEPENDS}"
-  TRUE
-)
-
-INSTALL(FILES ${business_reports_DATA} DESTINATION ${SCHEME_INSTALLED_SOURCE_DIR}/gnucash/report)
-
-SET_DIST_LIST(business_reports_DIST CMakeLists.txt Makefile.am ${business_reports_SCHEME} ${business_reports_DATA})
diff --git a/src/report/business-reports/Makefile.am b/src/report/business-reports/Makefile.am
deleted file mode 100644
index 96f9790..0000000
--- a/src/report/business-reports/Makefile.am
+++ /dev/null
@@ -1,99 +0,0 @@
-gncscmmoddir = ${GNC_SCM_INSTALL_DIR}/gnucash/report
-gncscmmod_DATA = \
-   aging.scm \
-   customer-summary.scm \
-   easy-invoice.scm \
-   fancy-invoice.scm \
-   taxinvoice.scm \
-   receipt.scm \
-   invoice.scm \
-   job-report.scm \
-   owner-report.scm \
-   payables.scm \
-   receivables.scm \
-   balsheet-eg.scm \
-   business-reports.scm
-
-# Note: list these files separately because they can't be compiled by guile2
-#       templates are a mixture of scheme and hmtl
-#       css files are not scheme at all
-gncscmtpldir = ${GNC_SCM_INSTALL_DIR}/gnucash/report
-gncscmtpl_DATA = \
-   taxinvoice.eguile.scm \
-   taxinvoice.css \
-   receipt.eguile.scm \
-   receipt.css \
-   balsheet-eg.css \
-   balsheet-eg.eguile.scm
-
-if GNUCASH_SEPARATE_BUILDDIR
-SCM_FILE_LINKS = ${gncscmmod_DATA} \
-  ${gncscmtpl_DATA}
-endif
-
-.scm-links:
-	$(RM) -rf gnucash
-	mkdir -p  gnucash
-	mkdir -p  gnucash/report
-if GNUCASH_SEPARATE_BUILDDIR
-	for X in ${SCM_FILE_LINKS} ; do \
-	  $(LN_S) -f ${srcdir}/$$X . ; \
-	done
-endif
-	( cd gnucash/report; for A in $(gncscmmod_DATA) ; do $(LN_S) -f ../../$$A . ; done )
-if ! OS_WIN32
-# Windows knows no "ln -s" but uses "cp": must copy every time (see bug #566567).
-	touch .scm-links
-endif
-
-if GNC_HAVE_GUILE_2
-GUILE_COMPILE_ENV = \
-  --gnc-module-dir ${top_builddir}/src/app-utils \
-  --gnc-module-dir ${top_builddir}/src/engine \
-  --gnc-module-dir ${top_builddir}/src/gnome-utils \
-  --gnc-module-dir ${top_builddir}/src/html \
-  --gnc-module-dir ${top_builddir}/src/report/report-system \
-  --guile-load-dir ${top_builddir}/src/app-utils \
-  --guile-load-dir ${top_builddir}/src/core-utils \
-  --guile-load-dir ${top_builddir}/src/engine \
-  --guile-load-dir ${top_builddir}/src/gnc-module \
-  --guile-load-dir ${top_builddir}/src/gnome-utils \
-  --guile-load-dir ${top_builddir}/src/report/report-system \
-  --guile-load-dir ${top_builddir}/src/report/standard-reports \
-  --guile-load-dir ${top_builddir}/src/report/business-reports \
-  --guile-load-dir ${top_builddir}/src/scm \
-  --library-dir    ${top_builddir}/src/engine \
-  --library-dir    ${top_builddir}/src/app-utils \
-  --library-dir    ${top_builddir}/src/core-utils \
-  --library-dir    ${top_builddir}/src/gnome-utils \
-  --library-dir    ${top_builddir}/src/backend/xml \
-  --library-dir    ${top_builddir}/src/backend/sql \
-  --library-dir    ${top_builddir}/src/html \
-  --library-dir    ${top_builddir}/src/gnc-module \
-  --library-dir    ${top_builddir}/src/report/report-system
-
-
-%.go : %.scm .scm-links $(pkglib_LTLIBRARIES)
-	GNC_UNINSTALLED=yes \
-	GNC_BUILDDIR=${top_builddir} \
-	$(shell ${abs_top_srcdir}/src/gnc-test-env.pl --noexports ${GUILE_COMPILE_ENV}) \
-	$(GUILD) compile -o $@ $<
-
-gncscmmodcachedir = ${pkglibdir}/scm/ccache/@GUILE_EFFECTIVE_VERSION@/gnucash/report
-gncscmmodcache_DATA = $(gncscmmod_DATA:.scm=.go)
-endif
-
-clean-local:
-	$(RM) -rf gnucash
-
-noinst_DATA = .scm-links
-
-EXTRA_DIST = \
-  ${gncscmmod_DATA} \
-  ${gncscmtpl_DATA} \
-  CMakeLists.txt
-
-CLEANFILES = .scm-links ${gncscmmodcache_DATA}
-DISTCLEANFILES = ${SCM_FILE_LINKS}
-
-AM_CPPFLAGS = -DG_LOG_DOMAIN=\"gnc.business.reports\"
diff --git a/src/report/locale-specific/us/CMakeLists.txt b/src/report/locale-specific/us/CMakeLists.txt
deleted file mode 100644
index 47556cd..0000000
--- a/src/report/locale-specific/us/CMakeLists.txt
+++ /dev/null
@@ -1,59 +0,0 @@
-ADD_SUBDIRECTORY(test)
-
-SET(locale_reports_us_SOURCES
-  gncmod-locale-reports-us.c
-)
-
-ADD_LIBRARY(gncmod-locale-reports-us ${locale_reports_us_SOURCES})
-
-TARGET_LINK_LIBRARIES(gncmod-locale-reports-us gnc-module gncmod-app-utils gncmod-gnome-utils
-                         ${GUILE_LDFLAGS} ${GLIB2_LDFLAGS})
-
-TARGET_COMPILE_DEFINITIONS(gncmod-locale-reports-us PRIVATE -DG_LOG_DOMAIN=\"gnc.report.locale.us\")
-
-
-INSTALL(TARGETS gncmod-locale-reports-us
-  LIBRARY DESTINATION lib/gnucash
-  ARCHIVE DESTINATION lib/gnucash
-  RUNTIME DESTINATION bin)
-# No headers to install
-
-# Scheme
-
-SET(gncmod_local_reports_us_SCHEME_1 taxtxf.scm taxtxf-de_DE.scm)
-
-
-SET(gncmod_local_reports_us_SCHEME_2 us.scm de_DE.scm)
-
-
-SET(GUILE_MODULES src/app-utils src/engine src/gnome-utils src/html src/report/report-system src/tax/us)
-SET(GUILE_LOAD_DIRS  src/app-utils src/core-utils src/engine src/gnc-module src/gnome-utils src/report/report-system
-                     src/scm src/tax/us)
-SET(GUILE_LIBRARY_DIRS src/engine src/app-utils src/core-utils src/gnc-module src/gnome-utils
-                       src/html src/report/report-system)
-SET(GUILE_DEPENDS   gncmod-html scm-tax-us-1 scm-tax-us-2 scm-report-system-3)
-
-GNC_ADD_SCHEME_TARGETS(scm-report-locale-specific-1
-  "${gncmod_local_reports_us_SCHEME_1}"
-  gnucash/report
-  "${GUILE_MODULES}"
-  "${GUILE_LOAD_DIRS}"
-  "${GUILE_LIBRARY_DIRS}"
-  "${GUILE_DEPENDS}"
-  FALSE
-)
-
-GNC_ADD_SCHEME_TARGETS(scm-report-locale-specific-2
-  "${gncmod_local_reports_us_SCHEME_2}"
-  gnucash/report/locale-specific
-  "${GUILE_MODULES}"
-  "${GUILE_LOAD_DIRS}"
-  "${GUILE_LIBRARY_DIRS}"
-  "scm-report-locale-specific-1;${GUILE_DEPENDS}"
-  FALSE
-)
-
-SET_LOCAL_DIST(locale_specific_us_DIST_local CMakeLists.txt Makefile.am
-        ${locale_reports_us_SOURCES} ${gncmod_local_reports_us_SCHEME_1} ${gncmod_local_reports_us_SCHEME_2})
-
-SET(locale_specific_us_DIST ${locale_specific_us_DIST_local} ${test_locale_specific_us_DIST} PARENT_SCOPE)
diff --git a/src/report/locale-specific/us/Makefile.am b/src/report/locale-specific/us/Makefile.am
deleted file mode 100644
index 826f2a9..0000000
--- a/src/report/locale-specific/us/Makefile.am
+++ /dev/null
@@ -1,113 +0,0 @@
-SUBDIRS = . test
-
-pkglib_LTLIBRARIES = libgncmod-locale-reports-us.la
-
-libgncmod_locale_reports_us_la_SOURCES = \
-  gncmod-locale-reports-us.c 
-
-libgncmod_locale_reports_us_la_LDFLAGS = -avoid-version
-
-libgncmod_locale_reports_us_la_LIBADD = \
-  ${top_builddir}/src/gnc-module/libgnc-module.la \
-  $(top_builddir)/src/app-utils/libgncmod-app-utils.la \
-  $(top_builddir)/src/gnome-utils/libgncmod-gnome-utils.la \
-  ${GUILE_LIBS} \
-  ${GLIB_LIBS} 
-
-
-AM_CPPFLAGS = \
-  -I${top_srcdir}/src \
-  -I${top_srcdir}/src/gnc-module \
-  ${GUILE_CFLAGS} ${GLIB_CFLAGS}
-
-## This is unused and therefore no longer installed and/or loaded
-gncscmrptdir = ${GNC_SCM_INSTALL_DIR}/gnucash/report/locale-specific
-gncscmrpt_DATA = us.scm de_DE.scm
-
-gncscmmoddir = ${GNC_SCM_INSTALL_DIR}/gnucash/report/
-gncscmmod_DATA = taxtxf.scm taxtxf-de_DE.scm
-
-if GNUCASH_SEPARATE_BUILDDIR
-#For executing test cases
-SCM_FILE_LINKS = \
-  ${gncscmrpt_DATA} \
-  ${gncscmmod_DATA}
-endif
-
-.scm-links:
-	$(RM) -rf gnucash
-	mkdir -p  gnucash
-	mkdir -p  gnucash/report
-	mkdir -p  gnucash/report/locale-specific
-if GNUCASH_SEPARATE_BUILDDIR
-	for X in ${SCM_FILE_LINKS} ; do \
-	  $(LN_S) -f ${srcdir}/$$X . ; \
-	done
-endif
-	( cd gnucash/report/locale-specific; for A in $(gncscmrpt_DATA) ; do $(LN_S) -f ../../../$$A . ; done )
-	( cd gnucash/report; for A in $(gncscmmod_DATA) ; do $(LN_S) -f ../../$$A . ; done )
-if ! OS_WIN32
-# Windows knows no "ln -s" but uses "cp": must copy every time (see bug #566567).
-	touch .scm-links
-endif
-
-if GNC_HAVE_GUILE_2
-GUILE_COMPILE_ENV = \
-  --gnc-module-dir ${top_builddir}/src/app-utils \
-  --gnc-module-dir ${top_builddir}/src/engine \
-  --gnc-module-dir ${top_builddir}/src/gnome-utils \
-  --gnc-module-dir ${top_builddir}/src/html \
-  --gnc-module-dir ${top_builddir}/src/report/report-system \
-  --gnc-module-dir ${top_builddir}/src/report/locale-specific/us \
-  --gnc-module-dir ${top_builddir}/src/tax/us \
-  --guile-load-dir ${top_builddir}/src/app-utils \
-  --guile-load-dir ${top_builddir}/src/core-utils \
-  --guile-load-dir ${top_builddir}/src/engine \
-  --guile-load-dir ${top_builddir}/src/gnc-module \
-  --guile-load-dir ${top_builddir}/src/gnome-utils \
-  --guile-load-dir ${top_builddir}/src/report/report-system \
-  --guile-load-dir ${top_builddir}/src/report/locale-specific/us \
-  --guile-load-dir ${top_builddir}/src/scm \
-  --guile-load-dir ${top_builddir}/src/tax/us \
-  --library-dir    ${top_builddir}/src/engine \
-  --library-dir    ${top_builddir}/src/app-utils \
-  --library-dir    ${top_builddir}/src/core-utils \
-  --library-dir    ${top_builddir}/src/gnc-module \
-  --library-dir    ${top_builddir}/src/gnome-utils \
-  --library-dir    ${top_builddir}/src/backend/xml \
-  --library-dir    ${top_builddir}/src/backend/sql \
-  --library-dir    ${top_builddir}/src/html \
-  --library-dir    ${top_builddir}/src/report/report-system \
-  --library-dir    ${top_builddir}/src/report/locale-specific/us
-
-%.go : %.scm .scm-links $(pkglib_LTLIBRARIES)
-	GNC_UNINSTALLED=yes \
-	GNC_BUILDDIR=${top_builddir} \
-	$(shell ${abs_top_srcdir}/src/gnc-test-env.pl --noexports ${GUILE_COMPILE_ENV}) \
-	$(GUILD) compile -o $@ $<
-
-gncscmmodcachedir = ${pkglibdir}/scm/ccache/@GUILE_EFFECTIVE_VERSION@/gnucash/report
-gncscmmodcache_DATA = $(gncscmmod_DATA:.scm=.go)
-
-gncscmrptcachedir = ${pkglibdir}/scm/ccache/@GUILE_EFFECTIVE_VERSION@/gnucash/report/locale-specific
-gncscmrptcache_DATA = $(gncscmrpt_DATA:.scm=.go)
-endif
-
-clean-local:
-	$(RM) -rf gnucash
-
-noinst_DATA = .scm-links
-
-EXTRA_DIST = \
-  ${gncscmmod_DATA} \
-  ${gncscmrpt_DATA} \
-  CMakeLists.txt
-
-CLEANFILES = \
-	.scm-links \
-	${gncscmmodcache_DATA} \
-	${gncscmrptcache_DATA}
-
-DISTCLEANFILES = ${SCM_FILE_LINKS}
-
-AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.report.locale.us\"
diff --git a/src/report/locale-specific/us/test/Makefile.am b/src/report/locale-specific/us/test/Makefile.am
deleted file mode 100644
index ac71b66..0000000
--- a/src/report/locale-specific/us/test/Makefile.am
+++ /dev/null
@@ -1,29 +0,0 @@
-TESTS = test-link-module
-
-GNC_TEST_DEPS = --gnc-module-dir ${top_builddir}/src/engine \
-  --gnc-module-dir ${top_builddir}/src/tax/us \
-  --gnc-module-dir ${top_builddir}/src/report/report-system \
-  --gnc-module-dir ${top_builddir}/src/report/locale-specific/us \
-  --guile-load-dir ${top_builddir}/src/gnc-module \
-  --guile-load-dir ${top_builddir}/src/engine \
-  --guile-load-dir ${top_builddir}/src/tax/us \
-  --library-dir    ${top_builddir}/src/core-utils \
-  --library-dir    ${top_builddir}/src/gnc-module \
-  --library-dir    ${top_builddir}/src/engine \
-  --library-dir    ${top_builddir}/src/app-utils
-
-TESTS_ENVIRONMENT = \
-  GUILE_WARN_DEPRECATED=no \
-  GUILE="${GUILE}" \
-  $(shell ${abs_top_srcdir}/src/gnc-test-env.pl --noexports ${GNC_TEST_DEPS})
-
-check_PROGRAMS = test-link-module
-
-testit:
-	${TESTS_ENVIRONMENT} gdb guile
-
-test_link_module_SOURCES = test-link-module.c
-test_link_module_LDADD= \
-  ${top_builddir}/src/report/locale-specific/us/libgncmod-locale-reports-us.la
-
-EXTRA_DIST = CMakeLists.txt
diff --git a/src/report/report-gnome/CMakeLists.txt b/src/report/report-gnome/CMakeLists.txt
deleted file mode 100644
index 4230898..0000000
--- a/src/report/report-gnome/CMakeLists.txt
+++ /dev/null
@@ -1,81 +0,0 @@
-ADD_SUBDIRECTORY(test)
-
-SET (report_gnome_HEADERS
-  dialog-report-column-view.h
-  dialog-custom-report.h
-  dialog-report-style-sheet.h
-  gnc-plugin-page-report.h
-  window-report.h
-)
-
-IF (BUILDING_FROM_VCS)
-  SET (SWIG_REPORT_GNOME_C ${CMAKE_CURRENT_BINARY_DIR}/swig-report-gnome.c)
-  GNC_ADD_SWIG_COMMAND (swig-report-gnome-c ${SWIG_REPORT_GNOME_C} ${CMAKE_CURRENT_SOURCE_DIR}/report-gnome.i ${report_gnome_HEADERS})
-ELSE()
-  SET (SWIG_REPORT_GNOME_C swig-report-gnome.c)
-ENDIF()
-
-SET (report_gnome_SOURCES
-  dialog-report-column-view.c
-  dialog-custom-report.c
-  dialog-report-style-sheet.c
-  gnc-plugin-page-report.c
-  gncmod-report-gnome.c
-  window-report.c
-)
-
-ADD_LIBRARY (gncmod-report-gnome
-  ${report_gnome_SOURCES}
-  ${report_gnome_HEADERS}
-  ${SWIG_REPORT_GNOME_C}
-)
-TARGET_LINK_LIBRARIES(gncmod-report-gnome gncmod-report-system gncmod-html gncmod-gnome-utils
-      ${GUILE_LDFLAGS} ${GTK3_LDFLAGS})
-
-TARGET_COMPILE_DEFINITIONS (gncmod-report-gnome PRIVATE -DG_LOG_DOMAIN=\"gnc.report.gui\")
-
-TARGET_INCLUDE_DIRECTORIES(gncmod-report-gnome PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
-
-INSTALL(TARGETS gncmod-report-gnome
-  LIBRARY DESTINATION lib/gnucash
-  ARCHIVE DESTINATION lib/gnucash
-  RUNTIME DESTINATION bin)
-
-INSTALL(FILES ${report_gnome_HEADERS} DESTINATION include/gnucash)
-
-# Scheme
-
-SET(report_gnome_SCHEME
-    report-gnome.scm
-)
-
-SET(GUILE_OUTPUT_DIR   gnucash/report)
-SET(GUILE_MODULES      src/app-utils src/scm src/engine src/gnc-module src/gnome-utils src/reports/report-system src/report/utility-reports)
-SET(GUILE_LOAD_DIRS    src/app-utils src/gnc-module src/engine src/scm src/core-utils src/gnome-utils)
-SET(GUILE_LIBRARY_DIRS src/app-utils src/core-utils src/engine src/gnc-module src/gnome-utils src/report-gnome)
-SET(GUILE_DEPENDS      gncmod-report-gnome gncmod-engine scm-app-utils scm-gnome-utils scm-core-utils scm-gnc-module scm-scm scm-standard-reports scm-business-reports scm-utility-reports)
-
-GNC_ADD_SCHEME_TARGETS(scm-report-gnome
-    "${report_gnome_SCHEME}"
-    ${GUILE_OUTPUT_DIR}
-    "${GUILE_MODULES}"
-    "${GUILE_LOAD_DIRS}"
-    "${GUILE_LIBRARY_DIRS}"
-    "${GUILE_DEPENDS}"
-    FALSE
-)
-
-SET(report_gnome_GLADE dialog-custom-report.glade dialog-report.glade)
-
-INSTALL(FILES ${report_gnome_GLADE} DESTINATION share/gnucash/gtkbuilder)
-
-SET(report_gnome_UI gnc-plugin-page-report-ui.xml)
-
-INSTALL(FILES ${report_gnome_UI} DESTINATION share/gnucash/ui)
-
-FILE(COPY ${report_gnome_UI} DESTINATION ${DATADIR_BUILD}/gnucash/ui)
-FILE(COPY ${report_gnome_GLADE} DESTINATION ${DATADIR_BUILD}/gnucash/gtkbuilder)
-
-SET_LOCAL_DIST(report_gnome_DIST_local CMakeLists.txt Makefile.am report-gnome.i ${report_gnome_HEADERS} ${report_gnome_SOURCES}
-        ${report_gnome_SCHEME} ${report_gnome_GLADE} ${report_gnome_UI})
-SET(report_gnome_DIST ${report_gnome_DIST_local} ${test_report_gnome_DIST} PARENT_SCOPE)
diff --git a/src/report/report-gnome/Makefile.am b/src/report/report-gnome/Makefile.am
deleted file mode 100644
index ea546f3..0000000
--- a/src/report/report-gnome/Makefile.am
+++ /dev/null
@@ -1,147 +0,0 @@
-SUBDIRS = . test
-
-pkglib_LTLIBRARIES = libgncmod-report-gnome.la
-
-AM_CPPFLAGS = \
-  -I${top_srcdir}/src \
-  -I${top_builddir}/src \
-  -I${top_srcdir}/src/core-utils \
-  -I${top_srcdir}/src/gnc-module \
-  -I${top_srcdir}/src/engine \
-  -I${top_srcdir}/src/app-utils \
-  -I${top_srcdir}/src/gnome-utils \
-  -I${top_srcdir}/src/gnome \
-  -I${top_srcdir}/src/html \
-  -I${top_srcdir}/src/report/report-system \
-  ${GUILE_CFLAGS} \
-  ${GTK_CFLAGS} \
-  ${GLIB_CFLAGS}
-
-libgncmod_report_gnome_la_SOURCES = \
-  swig-report-gnome.c \
-  dialog-report-column-view.c \
-  dialog-custom-report.c \
-  dialog-report-style-sheet.c \
-  gnc-plugin-page-report.c \
-  gncmod-report-gnome.c \
-  window-report.c
-
-gncincludedir = ${GNC_INCLUDE_DIR}
-gncinclude_HEADERS = \
-  dialog-report-column-view.h \
-  dialog-custom-report.h \
-  dialog-report-style-sheet.h \
-  gnc-plugin-page-report.h \
-  window-report.h
-
-libgncmod_report_gnome_la_LDFLAGS = -avoid-version
-
-libgncmod_report_gnome_la_LIBADD = \
-  ${top_builddir}/src/core-utils/libgnc-core-utils.la \
-  ${top_builddir}/src/gnc-module/libgnc-module.la \
-  ${top_builddir}/src/engine/libgncmod-engine.la \
-  ${top_builddir}/src/app-utils/libgncmod-app-utils.la \
-  ${top_builddir}/src/gnome-utils/libgncmod-gnome-utils.la \
-  ${top_builddir}/src/html/libgncmod-html.la \
-  ${top_builddir}/src/report/report-system/libgncmod-report-system.la \
-  ${GUILE_LIBS} \
-  ${GLIB_LIBS}
-
-if BUILDING_FROM_VCS
-swig-report-gnome.c: report-gnome.i ${top_srcdir}/src/base-typemaps.i
-	$(SWIG) -guile $(SWIG_ARGS) -Linkage module \
-	-I${top_srcdir}/src -o $@ $<
-if ! OS_WIN32
-if ! SWIG_DIST_FAIL
-	if ! `grep "define scm_from_utf8_string" $@ > /dev/null 2>&1`; then \
-	  patch $@ $(top_srcdir)/src/swig-utf8.patch; \
-	fi
-endif
-endif
-endif
-
-gncscmmoddir = ${GNC_SCM_INSTALL_DIR}/gnucash/report
-gncscmmod_DATA = report-gnome.scm
-
-noinst_DATA = .scm-links
-
-gtkbuilderdir = $(GNC_GTKBUILDER_DIR)
-gtkbuilder_DATA = \
-  dialog-report.glade \
-  dialog-custom-report.glade
-
-uidir = $(GNC_UI_DIR)
-
-ui_DATA = \
-	gnc-plugin-page-report-ui.xml
-
-EXTRA_DIST = \
-  report-gnome.i \
-  ${gtkbuilder_DATA} \
-  ${gncscmmod_DATA} \
-  ${ui_DATA} \
-  CMakeLists.txt
-
-if GNUCASH_SEPARATE_BUILDDIR
-#Only needed when srcdir and builddir are different
-# for running
-SCM_FILE_LINKS = ${gncscmmod_DATA}
-endif
-
-.scm-links: 
-	$(RM) -rf gnucash
-	mkdir -p  gnucash
-	mkdir -p  gnucash/report
-if GNUCASH_SEPARATE_BUILDDIR
-	for X in ${SCM_FILE_LINKS} ; do \
-	  $(LN_S) -f ${srcdir}/$$X . ; \
-	done
-endif
-	( cd gnucash/report; for A in $(gncscmmod_DATA) ; do $(LN_S) -f ../../$$A . ; done )
-if ! OS_WIN32
-# Windows knows no "ln -s" but uses "cp": must copy every time (see bug #566567).
-	touch .scm-links
-endif
-
-if GNC_HAVE_GUILE_2
-GUILE_COMPILE_ENV = \
-  --gnc-module-dir ${top_builddir}/src/app-utils \
-  --gnc-module-dir ${top_builddir}/src/engine \
-  --gnc-module-dir ${top_builddir}/src/html \
-  --gnc-module-dir ${top_builddir}/src/report/report-system \
-  --guile-load-dir ${top_builddir}/src/app-utils \
-  --guile-load-dir ${top_builddir}/src/core-utils \
-  --guile-load-dir ${top_builddir}/src/engine \
-  --guile-load-dir ${top_builddir}/src/gnc-module \
-  --guile-load-dir ${top_builddir}/src/gnome-utils \
-  --guile-load-dir ${top_builddir}/src/report/report-system \
-  --guile-load-dir ${top_builddir}/src/report/utility-reports \
-  --guile-load-dir ${top_builddir}/src/scm \
-  --library-dir    ${top_builddir}/src/engine \
-  --library-dir    ${top_builddir}/src/app-utils \
-  --library-dir    ${top_builddir}/src/core-utils \
-  --library-dir    ${top_builddir}/src/gnc-module \
-  --library-dir    ${top_builddir}/src/gnome-utils \
-  --library-dir    ${top_builddir}/src/backend/xml \
-  --library-dir    ${top_builddir}/src/backend/sql \
-  --library-dir    ${top_builddir}/src/html \
-  --library-dir    ${top_builddir}/src/report/report-system \
-  --library-dir    ${top_builddir}/src/report/report-gnome
-
-%.go : %.scm .scm-links $(pkglib_LTLIBRARIES)
-	GNC_UNINSTALLED=yes \
-	GNC_BUILDDIR=${top_builddir} \
-	$(shell ${abs_top_srcdir}/src/gnc-test-env.pl --noexports ${GUILE_COMPILE_ENV}) \
-	$(GUILD) compile -o $@ $<
-
-gncscmmodcachedir = ${pkglibdir}/scm/ccache/@GUILE_EFFECTIVE_VERSION@/gnucash/report
-gncscmmodcache_DATA = $(gncscmmod_DATA:.scm=.go)
-endif
-
-clean-local:
-	rm -rf gnucash
-
-CLEANFILES = report .scm-links ${SCM_FILE_LINKS} ${gncscmmodcache_DATA}
-MAINTAINERCLEANFILES = swig-report-gnome.c
-
-AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.report.gui\"
diff --git a/src/report/report-gnome/gnc-plugin-page-report.c b/src/report/report-gnome/gnc-plugin-page-report.c
deleted file mode 100644
index 42ca6fb..0000000
--- a/src/report/report-gnome/gnc-plugin-page-report.c
+++ /dev/null
@@ -1,1952 +0,0 @@
-/* gnc-plugin-page-report.c
- * Copyright (C) 2004 Joshua Sled <jsled at asynchronous.org>
- * Copyright (C) 2005 David Hampton <hampton at employees.org>
- *
- * Originally from window-report.c:
- * Copyright (C) 1997 Robin D. Clark
- * Copyright (C) 1998 Linas Vepstas
- * Copyright (C) 1999 Jeremy Collins ( gtk-xmhtml port )
- * Copyright (C) 2000 Dave Peticolas
- * Copyright (C) 2000 Bill Gribble
- *
- * 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 at gnu.org
- */
-
-/** @addtogroup GUI
-    @{ */
-/** @addtogroup GuiReport Reports
-    @{ */
-/** @file gnc-plugin-page-report.c
-    @brief  Report page.
-    @author Copyright (C) 2004 Joshua Sled <jsled at asynchronous.org>
-    @author Copyright (C) 2005 David Hampton <hampton at employees.org>
-*/
-
-#include "config.h"
-
-#include <gtk/gtk.h>
-#include <glib/gi18n.h>
-#include <glib/gstdio.h>
-#include <libguile.h>
-#include <sys/stat.h>
-#include <errno.h>
-
-#include <gnc-glib-utils.h>
-#include "gfec.h"
-#include "dialog-custom-report.h"
-#include "dialog-utils.h"
-#include "gnc-component-manager.h"
-#include "gnc-engine.h"
-#include "gnc-gnome-utils.h"
-#include "gnc-guile-utils.h"
-#include "gnc-html-history.h"
-#include "gnc-html.h"
-#include "gnc-html-factory.h"
-#include "gnc-file.h"
-#include "gnc-filepath-utils.h"
-#include "gnc-plugin.h"
-#include "gnc-plugin-page-report.h"
-#include "gnc-plugin-file-history.h"
-#include "gnc-prefs.h"
-#include "gnc-report.h"
-#include "gnc-session.h"
-#include "gnc-ui-util.h"
-#include "gnc-ui.h"
-#include "gnc-window.h"
-#include "option-util.h"
-#include "window-report.h"
-#include "swig-runtime.h"
-#include "app-utils/business-options.h"
-#include "gnome-utils/gnc-icons.h"
-#include "gnome-utils/print-session.h"
-
-#define WINDOW_REPORT_CM_CLASS "window-report"
-
-/* NW: you can add GNC_MOD_REPORT to gnc-engine.h
-or simply define it locally. Any unique string with
-a gnucash- prefix will do. Then just set a log level
-with qof_log_set_level().*/
-static QofLogModule log_module = GNC_MOD_GUI;
-
-static GObjectClass *parent_class = NULL;
-
-// A static GHashTable to record the usage count for each printer
-// output name. FIXME: Currently this isn't cleaned up at program
-// shutdown because there isn't a place to easily insert a finalize()
-// function for this. Oh well.
-static GHashTable *static_report_printnames = NULL;
-
-// Property-id values.
-enum
-{
-    PROP_0,
-    PROP_REPORT_ID,
-};
-
-typedef struct GncPluginPageReportPrivate
-{
-    /// The report-id
-    int reportId;
-    gint component_manager_id;
-
-    /// The report which this Page is satisfying
-    SCM cur_report;
-    /// The Option DB for this report.
-    GNCOptionDB *cur_odb;
-    SCM option_change_cb_id;
-
-    /* initial_report is special; it's the one that's saved and
-     * restored.  The name_change_callback only gets called when
-     * the initial_report name is changed. */
-    SCM          initial_report;
-    GNCOptionDB  * initial_odb;
-    SCM          name_change_cb_id;
-
-    /* keep a list of edited reports so that we can destroy them when
-     * the window is closed. */
-    SCM          edited_reports;
-
-    /* The page is in the process of reloading the html */
-    gboolean	reloading;
-
-    /// the gnc_html abstraction this PluginPage contains
-//        gnc_html *html;
-    GncHtml *html;
-
-    /// the container the above HTML widget is in.
-    GtkContainer *container;
-} GncPluginPageReportPrivate;
-
-#define GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(o)  \
-   (G_TYPE_INSTANCE_GET_PRIVATE ((o), GNC_TYPE_PLUGIN_PAGE_REPORT, GncPluginPageReportPrivate))
-
-static void gnc_plugin_page_report_class_init( GncPluginPageReportClass *klass );
-static void gnc_plugin_page_report_init( GncPluginPageReport *plugin_page );
-static GObject *gnc_plugin_page_report_constructor(GType this_type, guint n_properties, GObjectConstructParam *properties);
-static void gnc_plugin_page_report_finalize (GObject *object);
-static void gnc_plugin_page_report_setup( GncPluginPage *ppage );
-
-static void gnc_plugin_page_report_constr_init(GncPluginPageReport *plugin_page, gint reportId);
-
-static GtkWidget* gnc_plugin_page_report_create_widget( GncPluginPage *plugin_page );
-static void gnc_plugin_page_report_destroy_widget( GncPluginPage *plugin_page );
-static void gnc_plugin_page_report_save_page (GncPluginPage *plugin_page, GKeyFile *file, const gchar *group);
-static GncPluginPage *gnc_plugin_page_report_recreate_page (GtkWidget *window, GKeyFile *file, const gchar *group);
-static void gnc_plugin_page_report_name_changed (GncPluginPage *page, const gchar *name);
-static void gnc_plugin_page_report_update_edit_menu (GncPluginPage *page, gboolean hide);
-static gboolean gnc_plugin_page_report_finish_pending (GncPluginPage *page);
-
-static int gnc_plugin_page_report_check_urltype(URLType t);
-//static void gnc_plugin_page_report_load_cb(gnc_html * html, URLType type,
-static void gnc_plugin_page_report_load_cb(GncHtml * html, URLType type,
-        const gchar * location, const gchar * label,
-        gpointer data);
-static void gnc_plugin_page_report_refresh (gpointer data);
-static void gnc_plugin_page_report_set_fwd_button(GncPluginPageReport * page, int enabled);
-static void gnc_plugin_page_report_set_back_button(GncPluginPageReport * page, int enabled);
-static void gnc_plugin_page_report_history_destroy_cb(gnc_html_history_node * node, gpointer user_data);
-static void close_handler(gpointer user_data);
-void gnc_plugin_page_report_destroy(GncPluginPageReportPrivate *priv);
-static void gnc_plugin_page_report_option_change_cb(gpointer data);
-
-void gnc_plugin_page_report_remove_edited_report(GncPluginPageReportPrivate *priv, SCM report);
-void gnc_plugin_page_report_add_edited_report(GncPluginPageReportPrivate *priv, SCM report);
-void gnc_plugin_page_report_raise_editor(SCM report);
-
-static void gnc_plugin_page_report_forw_cb(GtkAction *action, GncPluginPageReport *rep);
-static void gnc_plugin_page_report_back_cb(GtkAction *action, GncPluginPageReport *rep);
-static void gnc_plugin_page_report_reload_cb(GtkAction *action, GncPluginPageReport *rep);
-static void gnc_plugin_page_report_stop_cb(GtkAction *action, GncPluginPageReport *rep);
-static void gnc_plugin_page_report_save_cb(GtkAction *action, GncPluginPageReport *rep);
-static void gnc_plugin_page_report_save_as_cb(GtkAction *action, GncPluginPageReport *rep);
-static void gnc_plugin_page_report_export_cb(GtkAction *action, GncPluginPageReport *rep);
-static void gnc_plugin_page_report_options_cb(GtkAction *action, GncPluginPageReport *rep);
-static void gnc_plugin_page_report_print_cb(GtkAction *action, GncPluginPageReport *rep);
-static void gnc_plugin_page_report_exportpdf_cb(GtkAction *action, GncPluginPageReport *rep);
-static void gnc_plugin_page_report_copy_cb(GtkAction *action, GncPluginPageReport *rep);
-
-GType
-gnc_plugin_page_report_get_type (void)
-{
-    static GType gnc_plugin_page_report_type = 0;
-
-    if (gnc_plugin_page_report_type == 0)
-    {
-        static const GTypeInfo our_info =
-        {
-            sizeof (GncPluginPageReportClass),
-            NULL,
-            NULL,
-            (GClassInitFunc) gnc_plugin_page_report_class_init,
-            NULL,
-            NULL,
-            sizeof (GncPluginPageReport),
-            0,
-            (GInstanceInitFunc) gnc_plugin_page_report_init
-        };
-
-        gnc_plugin_page_report_type = g_type_register_static (GNC_TYPE_PLUGIN_PAGE,
-                                      "GncPluginPageReport",
-                                      &our_info, 0);
-    }
-
-    return gnc_plugin_page_report_type;
-}
-
-static void
-gnc_plugin_page_report_get_property( GObject *obj,
-                                     guint prop_id,
-                                     GValue *value,
-                                     GParamSpec *pspec )
-{
-    GncPluginPageReport *rep;
-    GncPluginPageReportPrivate *priv;
-
-    rep = GNC_PLUGIN_PAGE_REPORT( obj );
-    priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(rep);
-
-    switch ( prop_id )
-    {
-    case PROP_REPORT_ID:
-        g_value_set_int( value, priv->reportId );
-        break;
-    default:
-        PERR( "Unknown property id %d", prop_id );
-        break;
-    }
-}
-
-static void
-gnc_plugin_page_report_set_property( GObject *obj,
-                                     guint prop_id,
-                                     const GValue *value,
-                                     GParamSpec *pspec )
-{
-    GncPluginPageReport *rep;
-    GncPluginPageReportPrivate *priv;
-
-    rep = GNC_PLUGIN_PAGE_REPORT( obj );
-    priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(rep);
-
-    DEBUG( "setting property with id %d / %p to value %d",
-           prop_id, priv, g_value_get_int( value ) );
-
-    switch ( prop_id )
-    {
-    case PROP_REPORT_ID:
-        priv->reportId = g_value_get_int( value );
-        break;
-    default:
-        PERR( "unknown property id %d", prop_id );
-        break;
-    }
-
-}
-
-static void
-gnc_plugin_page_report_class_init (GncPluginPageReportClass *klass)
-{
-    GObjectClass *object_class = G_OBJECT_CLASS (klass);
-    GncPluginPageClass *gnc_plugin_page_class = GNC_PLUGIN_PAGE_CLASS(klass);
-
-    parent_class = g_type_class_peek_parent (klass);
-
-    object_class->constructor = gnc_plugin_page_report_constructor;
-    object_class->finalize = gnc_plugin_page_report_finalize;
-
-    object_class->set_property = gnc_plugin_page_report_set_property;
-    object_class->get_property = gnc_plugin_page_report_get_property;
-
-    gnc_plugin_page_class->tab_icon        = GNC_ICON_ACCOUNT_REPORT;
-    gnc_plugin_page_class->plugin_name     = GNC_PLUGIN_PAGE_REPORT_NAME;
-
-    gnc_plugin_page_class->create_widget   = gnc_plugin_page_report_create_widget;
-    gnc_plugin_page_class->destroy_widget  = gnc_plugin_page_report_destroy_widget;
-    gnc_plugin_page_class->save_page       = gnc_plugin_page_report_save_page;
-    gnc_plugin_page_class->recreate_page   = gnc_plugin_page_report_recreate_page;
-    gnc_plugin_page_class->page_name_changed = gnc_plugin_page_report_name_changed;
-    gnc_plugin_page_class->update_edit_menu_actions = gnc_plugin_page_report_update_edit_menu;
-    gnc_plugin_page_class->finish_pending   = gnc_plugin_page_report_finish_pending;
-
-    g_type_class_add_private(klass, sizeof(GncPluginPageReportPrivate));
-
-    // create the "reportId" property
-    g_object_class_install_property( object_class,
-                                     PROP_REPORT_ID,
-                                     g_param_spec_int( "report-id",
-                                             _("The numeric ID of the report."),
-                                             _("The numeric ID of the report."),
-                                             -1, G_MAXINT, -1, G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE ) );
-
-    /* JSLED: report-selected?
-    	plugin_page_signals[ACCOUNT_SELECTED] =
-    	  g_signal_new ("account_selected",
-    			G_OBJECT_CLASS_TYPE (object_class),
-    			G_SIGNAL_RUN_FIRST,
-    			G_STRUCT_OFFSET (GncPluginPageReportClass, account_selected),
-    			NULL, NULL,
-    			g_cclosure_marshal_VOID__POINTER,
-    			G_TYPE_NONE, 1,
-    			G_TYPE_POINTER);
-    */
-
-    // Also initialize the report name usage count table
-    if (!static_report_printnames)
-        static_report_printnames = g_hash_table_new_full(g_str_hash,
-                                   g_str_equal, g_free, NULL);
-}
-
-static void
-gnc_plugin_page_report_finalize (GObject *object)
-{
-    g_return_if_fail (GNC_IS_PLUGIN_PAGE_REPORT (object));
-
-    ENTER("object %p", object);
-    G_OBJECT_CLASS (parent_class)->finalize (object);
-    LEAVE(" ");
-}
-
-static void
-gnc_plugin_page_report_set_progressbar (GncPluginPage *page, gboolean set)
-{
-    GtkWidget *progressbar;
-    GtkAllocation allocation;
-
-    progressbar = gnc_window_get_progressbar (GNC_WINDOW(page->window));
-    gtk_widget_get_allocation (GTK_WIDGET(progressbar), &allocation); 
-
-    // this sets the minimum size of the progressbar to that allocated
-    if (set)
-        gtk_widget_set_size_request (GTK_WIDGET(progressbar), -1, allocation.height);
-    else
-        gtk_widget_set_size_request (GTK_WIDGET(progressbar), -1, -1); //reset
-}
-
-static gboolean
-gnc_plugin_page_report_load_uri (GncPluginPage *page)
-{
-    GncPluginPageReport *report;
-    GncPluginPageReportPrivate *priv;
-    URLType type;
-    char * id_name;
-    char * child_name;
-    char * url_location = NULL;
-    char * url_label = NULL;
-
-    report = GNC_PLUGIN_PAGE_REPORT(page);
-    priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(report);
-
-    // FIXME.  This is f^-1(f(x)), isn't it?
-    DEBUG( "Load uri id=%d", priv->reportId );
-    id_name = g_strdup_printf("id=%d", priv->reportId );
-    child_name = gnc_build_url( URL_TYPE_REPORT, id_name, NULL );
-    type = gnc_html_parse_url( priv->html, child_name, &url_location, &url_label);
-    DEBUG( "passing id_name=[%s] child_name=[%s] type=[%s], location=[%s], label=[%s]",
-           id_name, child_name ? child_name : "(null)",
-           type ? type : "(null)", url_location ? url_location : "(null)",
-           url_label ? url_label : "(null)" );
-
-    g_free(id_name);
-    g_free(child_name);
-
-    gtk_widget_show_all( GTK_WIDGET(priv->container) );
-
-    // this sets the window for the progressbar
-    gnc_window_set_progressbar_window( GNC_WINDOW(page->window) );
-
-    // this sets the minimum size of the progressbar to that allocated
-    gnc_plugin_page_report_set_progressbar( page, TRUE );
-
-    gnc_html_show_url(priv->html, type, url_location, url_label, 0);
-    g_free(url_location);
-
-    gnc_plugin_page_report_set_progressbar( page, FALSE );
-
-    // this resets the window for the progressbar to NULL
-    gnc_window_set_progressbar_window( NULL );
-
-    return FALSE;
-}
-
-static void
-gnc_plugin_page_report_realize_uri (GtkWidget *widget, GncPluginPage *page)
-{
-    GtkAllocation allocation;
-
-    gtk_widget_get_allocation (widget, &allocation);
-    PINFO("Realized Container size is %dw x %dh", allocation.width, allocation.height);
-
-    /* load uri when view idle */
-    g_idle_add ((GSourceFunc)gnc_plugin_page_report_load_uri, page);
-}
-
-static
-GtkWidget*
-gnc_plugin_page_report_create_widget( GncPluginPage *page )
-{
-    GncPluginPageReport *report;
-    GncPluginPageReportPrivate *priv;
-    GtkWindow *topLvl;
-    URLType type;
-    char * id_name;
-    char * child_name;
-    char * url_location = NULL;
-    char * url_label = NULL;
-
-    ENTER("page %p", page);
-
-    report = GNC_PLUGIN_PAGE_REPORT(page);
-    priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(report);
-
-    topLvl = GTK_WINDOW(gnc_ui_get_toplevel());
-//        priv->html = gnc_html_new( topLvl );
-    priv->html = gnc_html_factory_create_html();
-    gnc_html_set_parent( priv->html, topLvl );
-
-    gnc_html_history_set_node_destroy_cb(gnc_html_get_history(priv->html),
-                                         gnc_plugin_page_report_history_destroy_cb,
-                                         (gpointer)priv);
-
-    priv->container = GTK_CONTAINER(gtk_frame_new(NULL));
-    gtk_frame_set_shadow_type(GTK_FRAME(priv->container), GTK_SHADOW_NONE);
-
-    // Set the style context for this page so it can be easily manipulated with css
-    gnc_widget_set_style_context (GTK_WIDGET(priv->container), "GncReportPage");
-
-    gtk_container_add(GTK_CONTAINER(priv->container),
-                      gnc_html_get_widget(priv->html));
-
-    priv->component_manager_id =
-        gnc_register_gui_component(WINDOW_REPORT_CM_CLASS, NULL,
-                                   close_handler, page);
-    gnc_gui_component_set_session(priv->component_manager_id,
-                                  gnc_get_current_session());
-
-    gnc_html_set_urltype_cb(priv->html, gnc_plugin_page_report_check_urltype);
-    gnc_html_set_load_cb(priv->html, gnc_plugin_page_report_load_cb, report);
-
-    /* We need to call the load call back so the report appears to of been run
-     so it will get saved properly if the report is not realized in session */
-    id_name = g_strdup_printf("id=%d", priv->reportId );
-    child_name = gnc_build_url( URL_TYPE_REPORT, id_name, NULL );
-    type = gnc_html_parse_url( priv->html, child_name, &url_location, &url_label);
-
-    gnc_plugin_page_report_load_cb (priv->html, type, id_name, url_label, report);
-    g_free(id_name);
-    g_free(child_name);
-
-    // FIXME.  This is f^-1(f(x)), isn't it?
-    DEBUG( "id=%d", priv->reportId );
-
-    /* load uri when view is realized */
-    g_signal_connect (G_OBJECT(GTK_WIDGET(priv->container)), "realize",
-                      G_CALLBACK(gnc_plugin_page_report_realize_uri), page);
-
-    gtk_widget_show_all( GTK_WIDGET(priv->container) );
-    LEAVE("container %p", priv->container);
-    return GTK_WIDGET( priv->container );
-}
-
-/********************************************************************
- * gnc_plugin_page_report_check_urltype
- * is it OK to show a certain URLType in this window?
- ********************************************************************/
-static int
-gnc_plugin_page_report_check_urltype(URLType t)
-{
-    if (!g_strcmp0 (t, URL_TYPE_REPORT))
-    {
-        return TRUE;
-    }
-    else
-    {
-        return FALSE;
-    }
-}
-
-/**
- * Simply get the initial report given the id, so we can do initialization
- * things like setup the tab name based on the report's name.
- **/
-static void
-gnc_plugin_page_report_setup( GncPluginPage *ppage )
-{
-    GncPluginPageReport *report = GNC_PLUGIN_PAGE_REPORT(ppage);
-    GncPluginPageReportPrivate *priv;
-    SCM  set_needs_save = scm_c_eval_string("gnc:report-set-needs-save?!");
-    SCM  inst_report;
-    int  report_id;
-
-    priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(report);
-    priv->cur_report        = SCM_BOOL_F;
-    priv->initial_report    = SCM_BOOL_F;
-    priv->edited_reports    = SCM_EOL;
-    priv->name_change_cb_id = SCM_BOOL_F;
-
-    g_object_get( ppage, "report-id", &report_id, NULL );
-
-    PINFO("report-id: %d\n", report_id);
-
-    /* get the inst-report from the Scheme-side hash, and get its
-     * options and editor thunk */
-    if ((inst_report = gnc_report_find(report_id)) == SCM_BOOL_F)
-    {
-        return;
-    }
-
-    if (priv->initial_report == SCM_BOOL_F)
-    {
-        priv->initial_report = inst_report;
-        scm_gc_protect_object(priv->initial_report);
-    }
-
-    // all reports need [to be] saved immediately after they're created.
-    PINFO("set needs save");
-    scm_call_2(set_needs_save, inst_report, SCM_BOOL_T);
-}
-
-/********************************************************************
- * gnc_plugin_page_report_load_cb
- * called after a report is loaded into the gnc_html widget
- ********************************************************************/
-static void
-//gnc_plugin_page_report_load_cb(gnc_html * html, URLType type,
-gnc_plugin_page_report_load_cb(GncHtml * html, URLType type,
-                               const gchar * location, const gchar * label,
-                               gpointer data)
-{
-    GncPluginPageReport *report = GNC_PLUGIN_PAGE_REPORT(data);
-    GncPluginPageReportPrivate *priv;
-    int  report_id;
-    SCM  get_options    = scm_c_eval_string("gnc:report-options");
-    SCM  set_needs_save = scm_c_eval_string("gnc:report-set-needs-save?!");
-    SCM  inst_report;
-
-    ENTER( "load_cb: type=[%s], location=[%s], label=[%s]",
-           type ? type : "(null)", location ? location : "(null)",
-           label ? label : "(null)" );
-
-    /* we get this callback if a new report is requested to be loaded OR
-     * if any URL is clicked.  If an options URL is clicked, we want to
-     * know about it */
-    priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(report);
-    if (!g_strcmp0 (type, URL_TYPE_REPORT)
-            && location
-            && (strlen(location) > 3)
-            && !strncmp("id=", location, 3))
-    {
-        report_id = atoi(location + 3);
-        DEBUG( "parsed id=%d", report_id );
-    }
-    else if (!g_strcmp0( type, URL_TYPE_OPTIONS)
-             && location
-             && (strlen(location) > 10)
-             && !strncmp("report-id=", location, 10))
-    {
-        report_id = atoi(location + 10);
-        inst_report = gnc_report_find(report_id);
-        if (inst_report != SCM_BOOL_F)
-        {
-            gnc_plugin_page_report_add_edited_report(priv, inst_report);
-        }
-        LEAVE("");
-        return;
-    }
-    else
-    {
-        LEAVE( " unknown URL type [%s] location [%s]", type, location );
-        return;
-    }
-
-    /* get the inst-report from the hash, and get its
-     * options and editor thunk */
-    if ((inst_report = gnc_report_find(report_id)) == SCM_BOOL_F)
-    {
-        LEAVE( "error getting inst_report" );
-        return;
-    }
-
-    if (priv->initial_report == SCM_BOOL_F)
-    {
-        priv->initial_report = inst_report;
-        scm_gc_protect_object(priv->initial_report);
-
-        DEBUG("calling set_needs_save for report with id=%d", report_id);
-        scm_call_2(set_needs_save, inst_report, SCM_BOOL_T);
-
-        priv->initial_odb = gnc_option_db_new(scm_call_1(get_options, inst_report));
-        priv->name_change_cb_id =
-            gnc_option_db_register_change_callback(priv->initial_odb,
-                    gnc_plugin_page_report_refresh,
-                    priv,
-                    "General", "Report name");
-    }
-
-    if ((priv->cur_report != SCM_BOOL_F) && (priv->cur_odb != NULL))
-    {
-        gnc_option_db_unregister_change_callback_id(priv->cur_odb,
-                priv->option_change_cb_id);
-        gnc_option_db_destroy(priv->cur_odb);
-        priv->cur_odb = NULL;
-    }
-
-    if (priv->cur_report != SCM_BOOL_F)
-        scm_gc_unprotect_object(priv->cur_report);
-    priv->cur_report = inst_report;
-    scm_gc_protect_object(priv->cur_report);
-
-    priv->cur_odb = gnc_option_db_new(scm_call_1(get_options, inst_report));
-    priv->option_change_cb_id =
-        gnc_option_db_register_change_callback(priv->cur_odb,
-                gnc_plugin_page_report_option_change_cb,
-                report, NULL, NULL);
-
-    if (gnc_html_history_forward_p(gnc_html_get_history(priv->html)))
-    {
-        gnc_plugin_page_report_set_fwd_button(report, TRUE);
-    }
-    else
-    {
-        gnc_plugin_page_report_set_fwd_button(report, FALSE);
-    }
-
-    if (gnc_html_history_back_p(gnc_html_get_history(priv->html)))
-    {
-        gnc_plugin_page_report_set_back_button(report, TRUE);
-    }
-    else
-    {
-        gnc_plugin_page_report_set_back_button(report, FALSE);
-    }
-
-    LEAVE( "done" );
-}
-
-
-/** This function is called when one of the options for a report
- *  page has changed.  It is responsible for marking the report as
- *  dirty, and causing the report to reload using the new options.
- *
- *  @note This function currently also calls the main window code to
- *  update it if the name of the report has changed.  This code should
- *  eventually go away, and the only way to change the name should be
- *  via the main window.
- *
- *  @param data A pointer to the GncPluginPageReport data structure
- *  that describes a report. */
-static void
-gnc_plugin_page_report_option_change_cb(gpointer data)
-{
-    GncPluginPage *page;
-    GncPluginPageReport *report;
-    GncPluginPageReportPrivate *priv;
-    SCM dirty_report = scm_c_eval_string("gnc:report-set-dirty?!");
-    const gchar *old_name;
-    gchar *new_name;
-
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REPORT(data));
-    report = GNC_PLUGIN_PAGE_REPORT(data);
-    priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(report);
-    page = GNC_PLUGIN_PAGE(report);
-
-    DEBUG( "option_change" );
-    if (priv->cur_report == SCM_BOOL_F)
-        return;
-    DEBUG( "set-dirty, queue-draw" );
-
-    /* Update the page (i.e. the notebook tab and window title) */
-    old_name = gnc_plugin_page_get_page_name(GNC_PLUGIN_PAGE(report));
-    new_name = gnc_option_db_lookup_string_option(priv->cur_odb, "General",
-               "Report name", NULL);
-    if (strcmp(old_name, new_name) != 0)
-    {
-        /* Bug 727130, 760711 - remove only the non-printable
-         * characters from the new name */
-        gnc_utf8_strip_invalid_and_controls(new_name);
-        ENTER("Cleaned-up new report name: %s", new_name);
-        main_window_update_page_name(GNC_PLUGIN_PAGE(report), new_name);
-	}
-    g_free(new_name);
-
-    /* it's probably already dirty, but make sure */
-    scm_call_2(dirty_report, priv->cur_report, SCM_BOOL_T);
-
-    // prevent closing this page while loading...
-    priv->reloading = TRUE;
-
-    // this sets the window for the progressbar
-    gnc_window_set_progressbar_window( GNC_WINDOW(page->window) );
-
-    // this sets the minimum size of the progressbar to that allocated
-    gnc_plugin_page_report_set_progressbar( page, TRUE );
-
-    /* Now queue the fact that we need to reload this report */
-    gnc_html_reload( priv->html, TRUE ); //reload by rebuild
-
-    gnc_plugin_page_report_set_progressbar( page, FALSE );
-
-    // this resets the window for the progressbar to NULL
-    gnc_window_set_progressbar_window( NULL );
-
-    priv->reloading = FALSE;
-}
-
-/* FIXME: This function does... nothing?  */
-static void
-gnc_plugin_page_report_history_destroy_cb(gnc_html_history_node * node,
-        gpointer user_data)
-{
-#if 0
-    static SCM         remover = SCM_BOOL_F;
-    int                report_id;
-
-    if (remover == SCM_BOOL_F)
-    {
-        remover = scm_c_eval_string("gnc:report-remove-by-id");
-    }
-
-    if (node
-            && !g_strcmp0 (node->type, URL_TYPE_REPORT)\
-            && !strncmp("id=", node->location, 3))
-    {
-        sscanf(node->location + 3, "%d", &report_id);
-        /*    printf("unreffing report %d and children\n", report_id);
-              scm_call_1(remover, scm_from_int (report_id)); */
-    }
-    else
-    {
-        return;
-    }
-#endif
-}
-
-// @param data is actually GncPluginPageReportPrivate
-static void
-gnc_plugin_page_report_refresh(gpointer data)
-{
-    // FIXME?
-    DEBUG( "report-refresh called" );
-    // something like ... gnc_plugin_page_report_redraw( NULL, (GncPluginPageReportPrivate*)data );
-    return;
-}
-
-static void
-gnc_plugin_page_report_destroy_widget(GncPluginPage *plugin_page)
-{
-    GncPluginPageReportPrivate *priv;
-
-    // FIXME: cleanup other resources.
-
-    PINFO("destroy widget");
-    priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(plugin_page);
-
-    if (priv->component_manager_id)
-    {
-        gnc_unregister_gui_component(priv->component_manager_id);
-        priv->component_manager_id = 0;
-    }
-
-    gnc_plugin_page_report_destroy(priv);
-    gnc_report_remove_by_id(priv->reportId);
-}
-
-
-/** The key name used it the state file for storing the report
- *  options. */
-#define SCHEME_OPTIONS   "SchemeOptions"
-#define SCHEME_OPTIONS_N "SchemeOptions%d"
-
-
-/** Save enough information about this report page that it can be
- *  recreated next time the user starts gnucash.
- *
- *  @param plugin_page The page to save.
- *
- *  @param key_file A pointer to the GKeyFile data structure where the
- *  page information should be written.
- *
- *  @param group_name The group name to use when saving data. */
-static void
-gnc_plugin_page_report_save_page (GncPluginPage *plugin_page,
-                                  GKeyFile *key_file,
-                                  const gchar *group_name)
-{
-    GncPluginPageReport *report;
-    GncPluginPageReportPrivate *priv;
-    SCM gen_save_text, scm_text;
-    SCM get_embedded_list, embedded, item, tmp_report;
-    SCM  get_options;
-    gint count, id;
-    gchar *text, *key_name;
-
-    g_return_if_fail (GNC_IS_PLUGIN_PAGE_REPORT(plugin_page));
-    g_return_if_fail (key_file != NULL);
-    g_return_if_fail (group_name != NULL);
-
-    ENTER("page %p, key_file %p, group_name %s", plugin_page, key_file,
-          group_name);
-
-    report = GNC_PLUGIN_PAGE_REPORT(plugin_page);
-    priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(report);
-
-    if (!priv || !priv->cur_report || scm_is_null(priv->cur_report) ||
-            SCM_UNBNDP(priv->cur_report) || SCM_BOOL_F == priv->cur_report)
-    {
-        LEAVE("not saving invalid report");
-        return;
-    }
-
-    gen_save_text = scm_c_eval_string("gnc:report-serialize");
-    get_embedded_list = scm_c_eval_string("gnc:report-embedded-list");
-    get_options    = scm_c_eval_string("gnc:report-options");
-    embedded = scm_call_1(get_embedded_list, scm_call_1(get_options, priv->cur_report));
-    count = scm_ilength(embedded);
-    while (count-- > 0)
-    {
-        item = SCM_CAR(embedded);
-        embedded = SCM_CDR(embedded);
-        if (!scm_is_number(item))
-            continue;
-        id = scm_to_int (item);
-        tmp_report = gnc_report_find(id);
-        scm_text = scm_call_1(gen_save_text, tmp_report);
-        if (!scm_is_string (scm_text))
-        {
-            DEBUG("child report %d: nothing to save", id);
-            continue;
-        }
-
-        key_name = g_strdup_printf(SCHEME_OPTIONS_N, id);
-        text = gnc_scm_strip_comments(scm_text);
-        g_key_file_set_value(key_file, group_name, key_name, text);
-        g_free(text);
-        g_free(key_name);
-    }
-
-    scm_text = scm_call_1(gen_save_text, priv->cur_report);
-    if (!scm_is_string (scm_text))
-    {
-        LEAVE("nothing to save");
-        return;
-    }
-
-    text = gnc_scm_strip_comments(scm_text);
-    g_key_file_set_value(key_file, group_name, SCHEME_OPTIONS, text);
-    g_free(text);
-    LEAVE(" ");
-}
-
-
-/** Create a new report page based on the information saved during a
- *  previous instantiation of gnucash.
- *
- *  @param window The window where this page should be installed.
- *
- *  @param key_file A pointer to the GKeyFile data structure where the
- *  page information should be read.
- *
- *  @param group_name The group name to use when restoring data. */
-static GncPluginPage *
-gnc_plugin_page_report_recreate_page (GtkWidget *window,
-                                      GKeyFile *key_file,
-                                      const gchar *group_name)
-{
-    GncPluginPage *page;
-    gchar **keys;
-    gsize i, num_keys;
-    GError *error = NULL;
-    gchar *option_string;
-    gint report_id;
-    SCM scm_id, final_id = SCM_BOOL_F;
-    SCM report;
-
-    g_return_val_if_fail(key_file, NULL);
-    g_return_val_if_fail(group_name, NULL);
-    ENTER("key_file %p, group_name %s", key_file, group_name);
-
-    keys = g_key_file_get_keys(key_file, group_name, &num_keys, &error);
-    if (error)
-    {
-        g_warning("error reading group %s key list: %s",
-                  group_name, error->message);
-        g_error_free(error);
-        LEAVE("no keys");
-        return NULL;
-    }
-
-    for (i = 0; i < num_keys; i++)
-    {
-        if (strncmp(keys[i], SCHEME_OPTIONS, strlen(SCHEME_OPTIONS)) != 0)
-            continue;
-        option_string = g_key_file_get_value(key_file, group_name,
-                                              keys[i], &error);
-        if (error)
-        {
-            g_warning("error reading group %s key %s: %s",
-                      group_name, keys[i], error->message);
-            g_error_free(error);
-            LEAVE("bad value");
-            return NULL;
-        }
-
-        scm_id = scm_c_eval_string(option_string);
-        g_free(option_string);
-
-        if (!scm_integer_p(scm_id))
-        {
-            DEBUG("report id not an integer for key %s", keys[i]);
-            return NULL;
-        }
-
-        if (final_id == SCM_BOOL_F)
-        {
-            if (g_strcmp0(keys[i], SCHEME_OPTIONS) == 0)
-            {
-                final_id = scm_id;
-            }
-        }
-    }
-
-    if (final_id == SCM_BOOL_F)
-    {
-        LEAVE("report not specified");
-        return NULL;
-    }
-
-    report_id = scm_to_int(final_id);
-    report = gnc_report_find(report_id);
-    if (!report)
-    {
-        LEAVE("report doesn't exist");
-        return NULL;
-    }
-
-    page = gnc_plugin_page_report_new( report_id );
-
-    LEAVE(" ");
-    return page;
-}
-
-
-/** Update a report page to reflect a name change made by external
- *  code.  This is called from the main window code when a page's name
- *  is changes.  The report code will update its copy of the name and
- *  regenerate the report.
- *
- *  @internal
- *
- *  @param page The page whose name has changed.
- *
- *  @param name The new name for the page. */
-static void
-gnc_plugin_page_report_name_changed (GncPluginPage *page, const gchar *name)
-{
-    GncPluginPageReportPrivate *priv;
-    const gchar *old_name;
-
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REPORT(page));
-    g_return_if_fail(name != NULL);
-
-    ENTER("page %p, name %s", page, name);
-    priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(page);
-
-    /* Is this a redundant call? */
-    old_name = gnc_option_db_lookup_string_option(priv->cur_odb, "General",
-               "Report name", NULL);
-    DEBUG("Comparing old name '%s' to new name '%s'",
-          old_name ? old_name : "(null)", name);
-    if (old_name && (strcmp(old_name, name) == 0))
-    {
-        LEAVE("no change");
-        return;
-    }
-
-    /* Store the new name for the report. */
-    gnc_option_db_set_string_option(priv->cur_odb, "General",
-                                    "Report name", name);
-
-    /* Have to manually call the option change hook. */
-    gnc_plugin_page_report_option_change_cb(page);
-    LEAVE(" ");
-}
-
-static void
-gnc_plugin_page_report_update_edit_menu (GncPluginPage *page, gboolean hide)
-{
-    GtkAction *action;
-
-    action = gnc_plugin_page_get_action (page, "EditCopyAction");
-    gtk_action_set_sensitive (action, TRUE);
-    gtk_action_set_visible (action, TRUE);
-    action = gnc_plugin_page_get_action (page, "EditCutAction");
-    gtk_action_set_sensitive (action, FALSE);
-    gtk_action_set_visible (action, !hide);
-    action = gnc_plugin_page_get_action (page, "EditPasteAction");
-    gtk_action_set_sensitive (action, FALSE);
-    gtk_action_set_visible (action, !hide);
-}
-
-static gboolean
-gnc_plugin_page_report_finish_pending (GncPluginPage *page)
-{
-    GncPluginPageReportPrivate *priv;
-    GncPluginPageReport *report;
-
-    report = GNC_PLUGIN_PAGE_REPORT(page);
-    priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(report);
-    return !priv->reloading;
-}
-
-
-/********************************************************************
- * gnc_report_window_destroy
- * free and destroy a window
- ********************************************************************/
-void
-gnc_plugin_page_report_destroy(GncPluginPageReportPrivate * priv)
-{
-    SCM  get_editor = scm_c_eval_string("gnc:report-editor-widget");
-    SCM  set_editor = scm_c_eval_string("gnc:report-set-editor-widget!");
-    SCM  edited, editor;
-
-    /* close any open editors */
-    for (edited = scm_list_copy(priv->edited_reports); !scm_is_null(edited);
-            edited = SCM_CDR(edited))
-    {
-        editor = scm_call_1(get_editor, SCM_CAR(edited));
-        scm_call_2(set_editor, SCM_CAR(edited), SCM_BOOL_F);
-        if (editor != SCM_BOOL_F)
-        {
-            GtkWidget *w = NULL;
-#define FUNC_NAME "gtk_widget_destroy"
-            w = SWIG_MustGetPtr(editor,
-                                SWIG_TypeQuery("_p_GtkWidget"), 1, 0);
-#undef FUNC_NAME
-            gtk_widget_destroy(GTK_WIDGET(w));
-        }
-    }
-
-    if (priv->initial_odb)
-    {
-        gnc_option_db_unregister_change_callback_id(priv->initial_odb,
-                priv->name_change_cb_id);
-
-        gnc_option_db_destroy(priv->initial_odb);
-        priv->initial_odb = NULL;
-    }
-
-    gnc_html_destroy(priv->html);
-
-    priv->container     = NULL;
-    priv->html          = NULL;
-
-    if (priv->cur_report != SCM_BOOL_F)
-        scm_gc_unprotect_object(priv->cur_report);
-    if (priv->edited_reports != SCM_EOL)
-        scm_gc_unprotect_object(priv->edited_reports);
-}
-
-/** Short labels for use on the toolbar buttons. */
-static action_toolbar_labels toolbar_labels[] =
-{
-    { "FilePrintAction", 	    N_("Print") },
-    { "ReportExportAction",   N_("Export") },
-    { "ReportOptionsAction",  N_("Options") },
-    { NULL, NULL },
-};
-
-static const gchar *initially_insensitive_actions[] =
-{
-    NULL
-};
-
-static void
-gnc_plugin_page_report_init ( GncPluginPageReport *plugin_page )
-{
-}
-
-static GObject*
-gnc_plugin_page_report_constructor(GType this_type, guint n_properties, GObjectConstructParam *properties)
-{
-    GObject *obj;
-    GncPluginPageReportClass *our_class;
-    GObjectClass *parent_class;
-    gint reportId = -42;
-    int i;
-
-    our_class = GNC_PLUGIN_PAGE_REPORT_CLASS (
-                    g_type_class_peek (GNC_TYPE_PLUGIN_PAGE_REPORT));
-    parent_class = G_OBJECT_CLASS (g_type_class_peek_parent (our_class));
-    obj = parent_class->constructor(this_type, n_properties, properties);
-
-    for (i = 0; i < n_properties; i++)
-    {
-        GObjectConstructParam prop = properties[i];
-        if (strcmp(prop.pspec->name, "report-id") == 0)
-        {
-            reportId = g_value_get_int(prop.value);
-        }
-    }
-
-    gnc_plugin_page_report_constr_init(GNC_PLUGIN_PAGE_REPORT(obj), reportId);
-
-    return obj;
-}
-
-static void
-gnc_plugin_page_report_constr_init(GncPluginPageReport *plugin_page, gint reportId)
-{
-    GncPluginPageReportPrivate *priv;
-    GtkActionGroup *action_group;
-    GncPluginPage *parent;
-    gboolean use_new;
-    gchar *name;
-    gchar *saved_reports_path = gnc_build_dotgnucash_path (SAVED_REPORTS_FILE);
-    gchar *report_save_str = g_strdup_printf (
-        _("Update the current report's saved configuration. "
-        "The report will be saved in the file %s. "), saved_reports_path);
-    gchar *report_saveas_str = g_strdup_printf (
-        _("Add the current report's configuration to the `Saved Report Configurations' menu. "
-        "The report will be saved in the file %s. "), saved_reports_path);
-
-    GtkActionEntry report_actions[] =
-    {
-        {
-            "FilePrintAction", "document-print", N_("_Print Report..."), "<primary>p",
-            N_("Print the current report"),
-            G_CALLBACK(gnc_plugin_page_report_print_cb)
-        },
-        {
-            "FilePrintPDFAction", GNC_ICON_PDF_EXPORT, N_("Export as P_DF..."), NULL,
-            N_("Export the current report as a PDF document"),
-            G_CALLBACK(gnc_plugin_page_report_exportpdf_cb)
-        },
-        {
-            "EditCutAction", "edit-cut", N_("Cu_t"), "<primary>X",
-            N_("Cut the current selection and copy it to clipboard"),
-            NULL
-        },
-        {
-            "EditCopyAction", "edit-copy", N_("_Copy"), "<primary>C",
-            N_("Copy the current selection to clipboard"),
-            G_CALLBACK(gnc_plugin_page_report_copy_cb)
-        },
-        {
-            "EditPasteAction", "edit-paste", N_("_Paste"), "<primary>V",
-            N_("Paste the clipboard content at the cursor position"),
-            NULL
-        },
-        {
-            "ViewRefreshAction", "view-refresh", N_("_Refresh"), "<primary>r",
-            N_("Refresh this window"),
-            G_CALLBACK (gnc_plugin_page_report_reload_cb)
-        },
-        {
-            "ReportSaveAction", "document-save", N_("Save _Report Configuration"), "<primary><alt>s",
-            report_save_str, G_CALLBACK(gnc_plugin_page_report_save_cb)
-        },
-        {
-            "ReportSaveAsAction", "document-save-as", N_("Save Report Configuration As..."), "<primary><alt><shift>s",
-            report_saveas_str, G_CALLBACK(gnc_plugin_page_report_save_as_cb)
-        },
-        {
-            "ReportExportAction", "go-next", N_("Export _Report"), NULL,
-            N_("Export HTML-formatted report to file"),
-            G_CALLBACK(gnc_plugin_page_report_export_cb)
-        },
-        {
-            "ReportOptionsAction", "document-properties", N_("_Report Options"), NULL,
-            N_("Edit report options"),
-            G_CALLBACK(gnc_plugin_page_report_options_cb)
-        },
-
-        {
-            "ReportBackAction", "go-previous", N_("Back"), NULL,
-            N_("Move back one step in the history"),
-            G_CALLBACK(gnc_plugin_page_report_back_cb)
-        },
-        {
-            "ReportForwAction", "go-next", N_("Forward"), NULL,
-            N_("Move forward one step in the history"),
-            G_CALLBACK(gnc_plugin_page_report_forw_cb)
-        },
-        {
-            "ReportReloadAction", "view-refresh", N_("Reload"), NULL,
-            N_("Reload the current page"),
-            G_CALLBACK(gnc_plugin_page_report_reload_cb)
-        },
-        {
-            "ReportStopAction", "process-stop", N_("Stop"), NULL,
-            N_("Cancel outstanding HTML requests"),
-            G_CALLBACK(gnc_plugin_page_report_stop_cb)
-        },
-    };
-    guint num_report_actions = G_N_ELEMENTS( report_actions );
-
-    DEBUG( "property reportId=%d", reportId );
-    priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(plugin_page);
-    priv->reportId = reportId;
-
-    gnc_plugin_page_report_setup( GNC_PLUGIN_PAGE(plugin_page) );
-
-    /* Init parent declared variables */
-    parent = GNC_PLUGIN_PAGE(plugin_page);
-    use_new = gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL_REPORT, GNC_PREF_USE_NEW);
-    name = gnc_report_name( priv->initial_report );
-    g_object_set(G_OBJECT(plugin_page),
-                 "page-name",      name,
-                 "page-uri",       "default:",
-                 "ui-description", "gnc-plugin-page-report-ui.xml",
-                 "use-new-window", use_new,
-                 NULL);
-    g_free(name);
-
-    /* change me when the system supports multiple books */
-    gnc_plugin_page_add_book(parent, gnc_get_current_book());
-
-    /* Create menu and toolbar information */
-    action_group =
-        gnc_plugin_page_create_action_group(parent,
-                                            "GncPluginPageReportActions");
-    gtk_action_group_add_actions( action_group,
-                                  report_actions,
-                                  num_report_actions,
-                                  plugin_page );
-    gnc_plugin_update_actions(action_group,
-                              initially_insensitive_actions,
-                              "sensitive", FALSE);
-    gnc_plugin_init_short_names (action_group, toolbar_labels);
-
-    g_free (saved_reports_path);
-    g_free (report_save_str);
-    g_free (report_saveas_str);
-}
-
-GncPluginPage*
-gnc_plugin_page_report_new( int reportId )
-{
-    GncPluginPageReport *plugin_page;
-
-    DEBUG( "report id = %d", reportId );
-    plugin_page = g_object_new( GNC_TYPE_PLUGIN_PAGE_REPORT,
-                                "report-id", reportId, NULL );
-    DEBUG( "plugin_page: %p", plugin_page );
-    DEBUG( "set %d on page %p", reportId, plugin_page );
-    return GNC_PLUGIN_PAGE( plugin_page );
-}
-
-void
-gnc_plugin_page_report_remove_edited_report(GncPluginPageReportPrivate *priv,
-        SCM report)
-{
-    SCM new_edited = scm_delete(priv->edited_reports, report);
-    if (priv->edited_reports != SCM_EOL)
-        scm_gc_unprotect_object(priv->edited_reports);
-    priv->edited_reports = new_edited;
-    if (new_edited != SCM_EOL)
-        scm_gc_protect_object(priv->edited_reports);
-}
-
-void
-gnc_plugin_page_report_add_edited_report(GncPluginPageReportPrivate *priv,
-        SCM report)
-{
-    SCM new_edited = scm_cons(report, priv->edited_reports);
-    if (priv->edited_reports != SCM_EOL)
-        scm_gc_unprotect_object(priv->edited_reports);
-    priv->edited_reports = new_edited;
-    if (new_edited != SCM_EOL)
-        scm_gc_protect_object(priv->edited_reports);
-}
-
-void
-gnc_plugin_page_report_raise_editor(SCM report)
-{
-    SCM get_editor = scm_c_eval_string("gnc:report-editor-widget");
-    SCM editor = scm_call_1(get_editor, report);
-#define FUNC_NAME "gtk_window_present"
-    GtkWidget *w = SWIG_MustGetPtr(editor,
-                                   SWIG_TypeQuery("_p_GtkWidget"), 1, 0);
-#undef FUNC_NAME
-    gtk_window_present(GTK_WINDOW(w));
-}
-
-static void
-close_handler (gpointer user_data)
-{
-    GncPluginPage *plugin_page = GNC_PLUGIN_PAGE(user_data);
-    DEBUG("in close handler\n");
-    gnc_main_window_close_page (plugin_page);
-}
-
-static void
-gnc_plugin_page_report_set_fwd_button(GncPluginPageReport *report, int enabled)
-{
-    GtkAction *act;
-
-    act = gnc_plugin_page_get_action(GNC_PLUGIN_PAGE(report),
-                                     "ReportForwAction" );
-    gtk_action_set_sensitive(act, enabled);
-}
-
-static void
-gnc_plugin_page_report_set_back_button(GncPluginPageReport *report, int enabled)
-{
-    GtkAction *act;
-
-    act = gnc_plugin_page_get_action(GNC_PLUGIN_PAGE(report),
-                                     "ReportBackAction" );
-    gtk_action_set_sensitive(act, enabled);
-}
-
-// ------------------------------------------------------------
-// GTK ACTION CALLBACKS
-
-static void
-gnc_plugin_page_report_forw_cb( GtkAction *action, GncPluginPageReport *report )
-{
-    GncPluginPageReportPrivate *priv;
-    gnc_html_history_node * node = NULL;
-
-    DEBUG( "forw" );
-    priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(report);
-    gnc_html_history_forward(gnc_html_get_history(priv->html));
-    node = gnc_html_history_get_current(gnc_html_get_history(priv->html));
-    if (node)
-    {
-        gnc_html_show_url(priv->html, node->type, node->location,
-                          node->label, 0);
-    }
-}
-
-static void
-gnc_plugin_page_report_back_cb( GtkAction *action, GncPluginPageReport *report )
-{
-    GncPluginPageReportPrivate *priv;
-    gnc_html_history_node * node;
-
-    DEBUG( "back" );
-    priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(report);
-    gnc_html_history_back(gnc_html_get_history(priv->html));
-    node = gnc_html_history_get_current(gnc_html_get_history(priv->html));
-    if (node)
-    {
-        gnc_html_show_url(priv->html, node->type, node->location,
-                          node->label, 0);
-    }
-}
-
-static void
-gnc_plugin_page_report_reload_cb( GtkAction *action, GncPluginPageReport *report )
-{
-    GncPluginPage *page;
-    GncPluginPageReportPrivate *priv;
-    SCM dirty_report;
-
-    DEBUG( "reload" );
-    page = GNC_PLUGIN_PAGE(report);
-    priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(report);
-    if (priv->cur_report == SCM_BOOL_F)
-        return;
-
-    DEBUG( "reload-redraw" );
-    dirty_report = scm_c_eval_string("gnc:report-set-dirty?!");
-    scm_call_2(dirty_report, priv->cur_report, SCM_BOOL_T);
-
-    /* now queue the fact that we need to reload this report */
-
-    // prevent closing this page while loading...
-    priv->reloading = TRUE;
-    // this sets the window for the progressbar
-    gnc_window_set_progressbar_window( GNC_WINDOW(page->window) );
-
-    // this sets the minimum size of the progressbar to that allocated
-    gnc_plugin_page_report_set_progressbar( page, TRUE );
-
-    gnc_html_reload( priv->html, TRUE ); //reload by rebuild
-
-    gnc_plugin_page_report_set_progressbar( page, FALSE );
-
-    // this resets the window for the progressbar to NULL
-    gnc_window_set_progressbar_window( NULL );
-    priv->reloading = FALSE;
-}
-
-static void
-gnc_plugin_page_report_stop_cb( GtkAction *action, GncPluginPageReport *report )
-{
-    GncPluginPageReportPrivate *priv;
-
-    priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(report);
-    gnc_html_cancel(priv->html);
-}
-
-/* Returns SCM_BOOL_F if cancel. Returns SCM_BOOL_T if html.
- * Otherwise returns pair from export_types. */
-static SCM
-gnc_get_export_type_choice (SCM export_types)
-{
-    GList * choices = NULL;
-    gboolean bad = FALSE;
-    GList * node;
-    int choice;
-    SCM tail;
-
-    if (!scm_is_list (export_types))
-        return SCM_BOOL_F;
-
-    for (tail = export_types; !scm_is_null (tail); tail = SCM_CDR (tail))
-    {
-        SCM pair = SCM_CAR (tail);
-        char * name;
-        SCM scm;
-
-        if (!scm_is_pair (pair))
-        {
-            g_warning ("unexpected list element");
-            bad = TRUE;
-            break;
-        }
-
-        scm = SCM_CAR (pair);
-        if (!scm_is_string (scm))
-        {
-            g_warning ("unexpected pair element");
-            bad = TRUE;
-            break;
-        }
-
-        name = gnc_scm_to_utf8_string (scm);
-        choices = g_list_prepend (choices, name);
-    }
-
-    if (!bad)
-    {
-        choices = g_list_reverse (choices);
-
-        choices = g_list_prepend (choices, g_strdup (_("HTML")));
-
-        choice = gnc_choose_radio_option_dialog
-                 (NULL, _("Choose export format"),
-                  _("Choose the export format for this report:"),
-                  NULL, 0, choices);
-    }
-    else
-        choice = -1;
-
-    for (node = choices; node; node = node->next)
-        g_free (node->data);
-    g_list_free (choices);
-
-    if (choice < 0)
-        return SCM_BOOL_F;
-
-    if (choice == 0)
-        return SCM_BOOL_T;
-
-    choice--;
-    if (choice >= scm_ilength (export_types))
-        return SCM_BOOL_F;
-
-    return scm_list_ref (export_types, scm_from_int  (choice));
-}
-
-static char *
-gnc_get_export_filename (SCM choice)
-{
-    char * filepath;
-    GStatBuf statbuf;
-    char * title;
-    const gchar * html_type = _("HTML");
-    char * type;
-    int rc;
-    char * default_dir;
-
-    if (choice == SCM_BOOL_T)
-        type = g_strdup (html_type);
-    else
-        type = gnc_scm_to_utf8_string(SCM_CAR (choice));
-
-    /* %s is the type of what is about to be saved, e.g. "HTML". */
-    title = g_strdup_printf (_("Save %s To File"), type);
-    default_dir = gnc_get_default_directory(GNC_PREFS_GROUP_REPORT);
-
-    filepath = gnc_file_dialog (title, NULL, default_dir, GNC_FILE_DIALOG_EXPORT);
-
-    /* Try to test for extension on file name, add if missing */
-    if (g_strrstr(filepath, ".") == NULL)
-        filepath = g_strconcat(filepath, ".", g_ascii_strdown(type, strlen(type)), NULL);
-
-    g_free (type);
-    g_free (title);
-    g_free (default_dir);
-
-    if (!filepath)
-        return NULL;
-
-    default_dir = g_path_get_dirname(filepath);
-    gnc_set_default_directory (GNC_PREFS_GROUP_REPORT, default_dir);
-    g_free(default_dir);
-
-    rc = g_stat (filepath, &statbuf);
-
-    /* Check for an error that isn't a non-existent file. */
-    if (rc != 0 && errno != ENOENT)
-    {
-        /* %s is the strerror(3) string of the error that occurred. */
-        const char *format = _("You cannot save to that filename.\n\n%s");
-
-        gnc_error_dialog (NULL, format, strerror(errno));
-        g_free(filepath);
-        return NULL;
-    }
-
-    /* Check for a file that isn't a regular file. */
-    if (rc == 0 && !S_ISREG (statbuf.st_mode))
-    {
-        const char *message = _("You cannot save to that file.");
-
-        gnc_error_dialog (NULL, "%s", message);
-        g_free(filepath);
-        return NULL;
-    }
-
-    if (rc == 0)
-    {
-        const char *format = _("The file %s already exists. "
-                               "Are you sure you want to overwrite it?");
-
-        if (!gnc_verify_dialog (NULL, FALSE, format, filepath))
-        {
-            g_free(filepath);
-            return NULL;
-        }
-    }
-
-    return filepath;
-}
-
-static void
-gnc_plugin_page_report_save_as_cb( GtkAction *action, GncPluginPageReport *report )
-{
-    GncPluginPageReportPrivate *priv;
-    SCM save_func;
-    SCM rpt_id;
-
-    priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(report);
-    if (priv->cur_report == SCM_BOOL_F)
-        return;
-
-    /* Create a new report template based on the current report's settings
-     * and allow the user to rename the template.
-     */
-    save_func = scm_c_eval_string("gnc:report-to-template-new");
-    rpt_id = scm_call_1(save_func, priv->cur_report);
-
-    /* Open Preconfigured Reports dialog to allow user to change the name */
-    if (!scm_is_null (rpt_id))
-    {
-        GncPluginPage *reportPage = GNC_PLUGIN_PAGE (report);
-        GtkWidget *window = reportPage->window;
-
-        if (window)
-            g_return_if_fail(GNC_IS_MAIN_WINDOW(window));
-
-        gnc_ui_custom_report_edit_name (GNC_MAIN_WINDOW (window), rpt_id);
-    }
-
-}
-
-static void
-gnc_plugin_page_report_save_cb( GtkAction *action, GncPluginPageReport *report )
-{
-    GncPluginPageReportPrivate *priv;
-    SCM check_func, save_func;
-    SCM rpt_id;
-
-    priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(report);
-    if (priv->cur_report == SCM_BOOL_F)
-        return;
-
-    check_func = scm_c_eval_string("gnc:is-custom-report-type");
-    if (scm_is_true (scm_call_1 (check_func, priv->cur_report)))
-    {
-        /* The current report is already based on a custom report.
-         * Replace the existing one instead of adding a new one
-         */
-        save_func = scm_c_eval_string("gnc:report-to-template-update");
-        rpt_id = scm_call_1(save_func, priv->cur_report);
-        (void)rpt_id;
-    }
-    else
-    {
-        /* The current report is not based on a custom report.
-         * So let's create a new report template based on this report
-         * and allow the user to change the name.
-         */
-        gnc_plugin_page_report_save_as_cb (action, report);
-    }
-}
-
-static void
-gnc_plugin_page_report_export_cb( GtkAction *action, GncPluginPageReport *report )
-{
-    GncPluginPageReportPrivate *priv;
-    char * filepath;
-    SCM export_types;
-    SCM export_thunk;
-    gboolean result;
-    SCM choice;
-
-    priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(report);
-    export_types = scm_call_1 (scm_c_eval_string ("gnc:report-export-types"),
-                               priv->cur_report);
-
-    export_thunk = scm_call_1 (scm_c_eval_string ("gnc:report-export-thunk"),
-                               priv->cur_report);
-
-    if (scm_is_list (export_types) && scm_is_procedure (export_thunk))
-        choice = gnc_get_export_type_choice (export_types);
-    else
-        choice = SCM_BOOL_T;
-
-    if (choice == SCM_BOOL_F)
-        return;
-
-    filepath = gnc_get_export_filename (choice);
-    if (!filepath)
-        return;
-
-    if (scm_is_pair (choice))
-    {
-        SCM file_scm;
-        SCM res;
-
-        choice = SCM_CDR (choice);
-        file_scm = scm_from_locale_string (filepath);
-
-        res = scm_call_3 (export_thunk, priv->cur_report, choice, file_scm);
-
-        result = (res != SCM_BOOL_F);
-    }
-    else
-        result = gnc_html_export_to_file (priv->html, filepath);
-
-    if (!result)
-    {
-        const char *fmt = _("Could not open the file %s. "
-                            "The error is: %s");
-        gnc_error_dialog( NULL, fmt, filepath ? filepath : "(null)",
-                          strerror (errno) ? strerror (errno) : "" );
-    }
-
-    g_free(filepath);
-    return;
-}
-
-static void
-gnc_plugin_page_report_options_cb( GtkAction *action, GncPluginPageReport *report )
-{
-    GncPluginPageReportPrivate *priv;
-
-    priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(report);
-    if (priv->cur_report == SCM_BOOL_F)
-        return;
-
-    if (gnc_report_edit_options (priv->cur_report))
-        gnc_plugin_page_report_add_edited_report(priv, priv->cur_report);
-}
-
-static GncInvoice *lookup_invoice(GncPluginPageReportPrivate *priv)
-{
-    g_assert(priv);
-    return gnc_option_db_lookup_invoice_option(priv->cur_odb, "General",
-            "Invoice Number", NULL);
-}
-
-#define GNC_PREFS_GROUP_REPORT_PDFEXPORT GNC_PREFS_GROUP_GENERAL_REPORT ".pdf-export"
-#define GNC_PREF_FILENAME_DATE_FMT "filename-date-format"
-#define GNC_PREF_FILENAME_FMT "filename-format"
-
-static gchar *report_create_jobname(GncPluginPageReportPrivate *priv)
-{
-    gchar *job_name = NULL;
-    gchar *report_name = NULL;
-    const gchar *report_number = "";
-    gchar *job_date;
-    const gchar *default_jobname = N_("GnuCash-Report");
-
-    g_assert(priv);
-
-    {
-        // Look up the date format that was chosen in the preferences database
-        QofDateFormat date_format_here;
-        QofDateFormat date_format_old = qof_date_format_get();
-        char *format_code = gnc_prefs_get_string(GNC_PREFS_GROUP_REPORT_PDFEXPORT,
-                            GNC_PREF_FILENAME_DATE_FMT);
-        if (*format_code == '\0')
-        {
-            g_free(format_code);
-            format_code = g_strdup("locale");
-        }
-
-        if (gnc_date_string_to_dateformat(format_code, &date_format_here))
-        {
-            PERR("Incorrect date format code");
-            if (format_code != NULL)
-                free(format_code);
-        }
-
-        // To apply this chosen date format, temporarily switch the
-        // process-wide default to our chosen date format. Note: It is a
-        // totally brain-dead implementation of qof_print_date() to not offer a
-        // variation where the QofDateFormat can be passed as an argument.
-        // Hrmpf.
-        qof_date_format_set(date_format_here);
-
-        job_date = qof_print_date( time( NULL ) );
-
-        // Restore to the original general  date format
-        qof_date_format_set(date_format_old);
-    }
-
-
-    if (priv->cur_report == SCM_BOOL_F)
-        report_name = g_strdup (_(default_jobname));
-    else
-    {
-        /* Gather some information from the report to generate a
-         * decent print job name.
-         * FIXME: this is a bit of a hack. It would be better if each
-         *        report had a hidden job name option, because the
-         *        generic reporting code shouldn't know what makes
-         *        a decent job name for each report.
-         *
-         *        Also, the "Report name" for an invoice report is
-         *        "Printable Invoice", which is not what the user wants to see,
-         *        so I added yet another hack below for this. cstim.
-         */
-        GncInvoice *invoice;
-        report_name = gnc_option_db_lookup_string_option(priv->cur_odb, "General",
-                      "Report name", NULL);
-        if (!report_name)
-            report_name = g_strdup (_(default_jobname));
-        if (g_strcmp0(report_name, _("Printable Invoice")) == 0
-                || g_strcmp0(report_name, _("Tax Invoice")) == 0
-                || g_strcmp0(report_name, _("Easy Invoice")) == 0
-                || g_strcmp0(report_name, _("Fancy Invoice")) == 0)
-        {
-            /* Again HACK alert: We modify this single known string here into
-             * something more appropriate. */
-            g_free(report_name);
-            report_name = g_strdup(_("Invoice"));
-        }
-
-        invoice = lookup_invoice(priv);
-        if (invoice)
-        {
-            // Report is for an invoice. Hence, we get a number of the invoice.
-            report_number = gncInvoiceGetID(invoice);
-        }
-    }
-
-    if (report_name && job_date)
-    {
-        // Look up the sprintf format of the output name from the preferences database
-        char* format = gnc_prefs_get_string(GNC_PREFS_GROUP_REPORT_PDFEXPORT, GNC_PREF_FILENAME_FMT);
-
-        job_name = g_strdup_printf(format, report_name, report_number, job_date);
-
-        g_free(format);
-    }
-    g_free (report_name);
-    g_free (job_date);
-
-    {
-        char forbidden_char = '/';
-        // Now remove the characters that are not allowed in file
-        // names. FIXME: Check for all disallowed characters here!
-        while (strchr(job_name, forbidden_char))
-        {
-            *strchr(job_name, forbidden_char) = '_';
-        }
-    }
-
-    {
-        /* And one final checking issue: We want to avoid allocating
-         * the same name twice for a saved PDF.  Hence, we keep a
-         * GHashTable with the usage count of existing output
-         * names. (Because I'm lazy, I just use a static GHashTable
-         * for this.) */
-        gpointer value;
-        gboolean already_found;
-        g_assert(static_report_printnames);
-
-        // Lookup the existing usage count
-        value = g_hash_table_lookup(static_report_printnames, job_name);
-        already_found = (value != NULL);
-        if (!value)
-        {
-            value = GINT_TO_POINTER(0);
-        }
-
-        // Increment the stored usage count
-        value = GINT_TO_POINTER(1 + GPOINTER_TO_INT(value));
-        // and store it again
-        g_hash_table_insert(static_report_printnames, g_strdup(job_name), value);
-
-        // If the previous usage count was more than 0, append the current
-        // count (which is now 2 or higher) to the resulting name
-        if (already_found)
-        {
-            // The name was already in use, so modify the name again
-            gchar *tmp = g_strdup_printf("%s_%d", job_name, (int) GPOINTER_TO_INT(value));
-            g_free(job_name);
-            job_name = tmp;
-        }
-    }
-
-    return job_name;
-}
-
-static void
-gnc_plugin_page_report_print_cb( GtkAction *action, GncPluginPageReport *report )
-{
-    GncPluginPageReportPrivate *priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(report);
-    gchar *job_name = report_create_jobname(priv);
-
-    //g_warning("Setting job name=%s", job_name);
-
-#ifdef WEBKIT1
-    gnc_html_print (priv->html, job_name, TRUE);
-#else
-    gnc_html_print (priv->html);
-#endif
-
-    g_free (job_name);
-}
-
-static void
-gnc_plugin_page_report_exportpdf_cb( GtkAction *action, GncPluginPageReport *report )
-{
-    GncPluginPageReportPrivate *priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(report);
-    gchar *job_name = report_create_jobname(priv);
-    GncInvoice *invoice;
-    GncOwner *owner = NULL;
-
-    // Do we have an invoice report?
-    invoice = lookup_invoice(priv);
-    if (invoice)
-    {
-        // Does this invoice also have an owner?
-        owner = (GncOwner*) gncInvoiceGetOwner(invoice);
-        if (owner)
-        {
-	    QofInstance *inst = qofOwnerGetOwner (owner);
-	    gchar *dirname = NULL;
-	    qof_instance_get (inst, "export-pdf-dir", &dirname, NULL);
-            // Yes. In the kvp, look up the key for the Export-PDF output
-            // directory. If it exists, prepend this to the job name so that
-            // we can export to PDF.
-	    if (dirname && g_file_test(dirname,
-				       G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR))
-	    {
-		gchar *tmp = g_build_filename(dirname, job_name, NULL);
-		g_free(job_name);
-		job_name = tmp;
-	    }
-        }
-    }
-
-    //g_warning("Setting job name=%s", job_name);
-
-#ifdef WEBKIT1
-    gnc_html_print (priv->html, job_name, TRUE);
-#else
-    gnc_html_print (priv->html);
-#endif
-
-    if (owner)
-    {
-	/* As this is an invoice report with some owner, we will try
-	 * to look up the chosen output directory from the print
-	 * settings and store it again in the owner kvp.
-	 */
-        GtkPrintSettings *print_settings = gnc_print_get_settings();
-        if (print_settings &&
-	    gtk_print_settings_has_key(print_settings,
-				       GNC_GTK_PRINT_SETTINGS_EXPORT_DIR))
-        {
-            const char* dirname = gtk_print_settings_get(print_settings,
-                                  GNC_GTK_PRINT_SETTINGS_EXPORT_DIR);
-            // Only store the directory if it exists.
-            if (g_file_test(dirname, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR))
-            {
-                QofInstance *inst = qofOwnerGetOwner(owner);
-                gncOwnerBeginEdit(owner);
-		qof_instance_set (inst, "export-pdf-dir", dirname);
-		gncOwnerCommitEdit(owner);
-            }
-        }
-    }
-
-    g_free (job_name);
-}
-
-static void
-gnc_plugin_page_report_copy_cb(GtkAction *action, GncPluginPageReport *report)
-{
-    GncPluginPageReportPrivate *priv;
-
-    priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(report);
-    gnc_html_copy_to_clipboard(priv->html);
-}
-
-/********************************************************************
- * gnc_main_window_open_report()
- * open an report in a top level window from an ID number
- ********************************************************************/
-
-void
-gnc_main_window_open_report(int report_id, GncMainWindow *window)
-{
-    GncPluginPage *reportPage;
-
-    if (window)
-        g_return_if_fail(GNC_IS_MAIN_WINDOW(window));
-
-    reportPage = gnc_plugin_page_report_new( report_id );
-    gnc_main_window_open_page( window, reportPage );
-}
-
-void
-gnc_main_window_open_report_url(const char * url, GncMainWindow *window)
-{
-    GncPluginPage *reportPage;
-
-    DEBUG( "report url: [%s]\n", url );
-
-    if (window)
-        g_return_if_fail(GNC_IS_MAIN_WINDOW(window));
-
-    reportPage = gnc_plugin_page_report_new( 42 /* url? */ );
-    gnc_main_window_open_page( window, reportPage );
-}
-
-/** @} */
-/** @} */
diff --git a/src/report/report-gnome/test/CMakeLists.txt b/src/report/report-gnome/test/CMakeLists.txt
deleted file mode 100644
index fbed244..0000000
--- a/src/report/report-gnome/test/CMakeLists.txt
+++ /dev/null
@@ -1,19 +0,0 @@
-SET(REPORT_GNOME_TEST_INCLUDE_DIRS
-  ${CMAKE_SOURCE_DIR}/src/gnc-module
-  ${GUILE_INCLUDE_DIRS}
-
-)
-SET(REPORT_GNOME_TEST_LIBS gnc-module)
-
-GNC_ADD_TEST_WITH_GUILE(test-link-module-report-gnome test-link-module.c
-  REPORT_GNOME_TEST_INCLUDE_DIRS REPORT_GNOME_TEST_LIBS
-)
-
-GNC_ADD_SCHEME_TEST(test-load-module-report-gnome
-  test-load-module.in
-)
-
-CONFIGURE_FILE(test-load-module.in test-load-module @ONLY)
-
-SET_DIST_LIST(test_report_gnome_DIST CMakeLists.txt Makefile.am test-link-module.c test-load-module.in)
-
diff --git a/src/report/report-gnome/test/Makefile.am b/src/report/report-gnome/test/Makefile.am
deleted file mode 100644
index a894a75..0000000
--- a/src/report/report-gnome/test/Makefile.am
+++ /dev/null
@@ -1,65 +0,0 @@
-AM_CPPFLAGS = \
-  -I${top_srcdir} \
-  -I${top_srcdir}/src \
-  -I${top_srcdir}/src/test-core \
-  -I${top_srcdir}/src/engine \
-  -I${top_srcdir}/src/gnc-module \
-  ${GUILE_CFLAGS} \
-  ${GLIB_CFLAGS}
-
-LDADD = \
-  ${top_builddir}/src/engine/libgncmod-engine.la \
-  ${top_builddir}/src/gnc-module/libgnc-module.la \
-  ${top_builddir}/src/report/report-gnome/libgncmod-report-gnome.la \
-  $(top_builddir)/src/app-utils/libgncmod-app-utils.la \
-  ${top_builddir}/src/gnome-utils/libgncmod-gnome-utils.la \
-  ${GLIB_LIBS} \
-  ${GUILE_LIBS}
-
-TESTS = \
-  test-link-module \
-  test-load-module
-
-GNC_TEST_DEPS = --gnc-module-dir ${top_builddir}/src/engine \
-  --gnc-module-dir ${top_builddir}/src/app-utils \
-  --gnc-module-dir ${top_builddir}/src/gnome-utils \
-  --gnc-module-dir ${top_builddir}/src/html \
-  --gnc-module-dir ${top_builddir}/src/report/report-system \
-  --gnc-module-dir ${top_builddir}/src/report/report-gnome \
-\
-  --guile-load-dir ${top_builddir}/src/gnc-module \
-  --guile-load-dir ${top_builddir}/src/scm \
-  --guile-load-dir ${top_builddir}/src/engine \
-  --guile-load-dir ${top_builddir}/src/core-utils \
-  --guile-load-dir ${top_builddir}/src/app-utils \
-  --guile-load-dir ${top_builddir}/src/gnome-utils \
-  --guile-load-dir ${top_builddir}/src/report/report-system \
-  --guile-load-dir ${top_builddir}/src/report/standard-reports \
-  --guile-load-dir ${top_builddir}/src/report/business-reports \
-  --guile-load-dir ${top_builddir}/src/report/utility-reports \
-  --guile-load-dir ${top_builddir}/src/report/report-gnome \
-\
-  --library-dir    ${top_builddir}/src/report/report-gnome \
-  --library-dir    ${top_builddir}/src/report/report-system \
-  --library-dir    ${top_builddir}/src/core-utils \
-  --library-dir    ${top_builddir}/src/app-utils \
-  --library-dir    ${top_builddir}/src/gnc-module \
-  --library-dir    ${top_builddir}/src/engine \
-  --library-dir    ${top_builddir}/src/backend/xml \
-  --library-dir    ${top_builddir}/src/backend/sql \
-  --library-dir    ${top_builddir}/src/gnome-utils \
-  --library-dir    ${top_builddir}/src/html \
-  --library-dir    ${top_builddir}/src/report/report-system \
-  --library-dir    ${top_builddir}/src/report/report-gnome
-
-
-TESTS_ENVIRONMENT = \
-  GUILE_WARN_DEPRECATED=no \
-  GUILE="${GUILE}" \
-  GNC_BUILDDIR="${abs_top_builddir}" \
-  $(shell ${abs_top_srcdir}/src/gnc-test-env.pl --noexports ${GNC_TEST_DEPS})
-
-
-check_PROGRAMS = test-link-module
-
-EXTRA_DIST = test-load-module CMakeLists.txt
diff --git a/src/report/report-system/CMakeLists.txt b/src/report/report-system/CMakeLists.txt
deleted file mode 100644
index 5ca9c92..0000000
--- a/src/report/report-system/CMakeLists.txt
+++ /dev/null
@@ -1,118 +0,0 @@
-ADD_SUBDIRECTORY(test)
-
-SET (report_system_HEADERS
-  gnc-report.h
-)  
-
-IF (BUILDING_FROM_VCS)
-  SET (SWIG_REPORT_SYSTEM_C ${CMAKE_CURRENT_BINARY_DIR}/swig-report-system.c)
-  GNC_ADD_SWIG_COMMAND (swig-report-system-c ${SWIG_REPORT_SYSTEM_C} ${CMAKE_CURRENT_SOURCE_DIR}/report-system.i ${report_system_HEADERS})
-ELSE()
-  SET (SWIG_REPORT_SYSTEM_C swig-report-system.c)
-ENDIF()
-
-
-SET (report_system_SOURCES
-  gncmod-report-system.c
-  gnc-report.c
-)  
-
-ADD_LIBRARY (gncmod-report-system
-  ${report_system_SOURCES}
-  ${report_system_HEADERS}
-  ${SWIG_REPORT_SYSTEM_C}
-)
-
-TARGET_COMPILE_DEFINITIONS(gncmod-report-system PRIVATE -DG_LOG_DOMAIN=\"gnc.report.core\")
-
-TARGET_LINK_LIBRARIES(gncmod-report-system gnc-module gncmod-app-utils ${GTK3_LDFLAGS} ${GUILE_LDFLAGS})
-
-TARGET_INCLUDE_DIRECTORIES (gncmod-report-system
-    PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${GTK3_INCLUDE_DIRS}
-)
-
-
-INSTALL(TARGETS gncmod-report-system
-  LIBRARY DESTINATION lib/gnucash
-  ARCHIVE DESTINATION lib/gnucash
-  RUNTIME DESTINATION bin)
-
-INSTALL(FILES ${report_system_HEADERS} DESTINATION include/gnucash)
-
-# Scheme
-
-SET (report_system_SCHEME
-    report-system.scm
-    eguile-gnc.scm
-    eguile-utilities.scm
-    eguile-html-utilities.scm
-)
-
-SET (report_system_SCHEME_2
-    collectors.scm
-    list-extras.scm
-    report-collectors.scm
-)
-
-SET (report_system_SCHEME_3
-    commodity-utilities.scm
-    html-acct-table.scm
-    html-barchart.scm
-    html-document.scm
-    html-fonts.scm
-    html-piechart.scm
-    html-scatter.scm
-    html-linechart.scm
-    html-style-info.scm
-    html-style-sheet.scm
-    html-table.scm
-    html-text.scm
-    html-utilities.scm
-    html-jqplot.scm
-    options-utilities.scm
-    report-utilities.scm
-    report.scm
-)
-
-
-SET(GUILE_MODULES      src/app-utils src/engine src/html src/gnome-utils)
-SET(GUILE_LOAD_DIRS    src/app-utils src/core-utils src/engine src/gnc-module src/gnome-utils src/report/report-system src/scm)
-SET(GUILE_LIBRARY_DIRS src/app-utils src/core-utils src/engine src/gnc-module src/gnome-utils)
-SET(GUILE_DEPENDS      gncmod-html gncmod-gnome-utils gncmod-report-system scm-app-utils scm-gnome-utils)
-
-
-GNC_ADD_SCHEME_TARGETS(scm-report-system
-  "${report_system_SCHEME}"
-  "gnucash/report"
-  "${GUILE_MODULES}"
-  "${GUILE_LOAD_DIRS}"
-  "${GUILE_LIBRARY_DIRS}"
-  "${GUILE_DEPENDS}"
-  FALSE
-)
-
-GNC_ADD_SCHEME_TARGETS(scm-report-system-2
-  "${report_system_SCHEME_2}"
-  "gnucash/report/report-system"
-  "${GUILE_MODULES}"
-  "${GUILE_LOAD_DIRS}"
-  "${GUILE_LIBRARY_DIRS}"
-  scm-report-system
-  FALSE
-)
-
-GNC_ADD_SCHEME_TARGETS(scm-report-system-3
-  "${report_system_SCHEME_3}"
-  ""
-  "${GUILE_MODULES}"
-  "${GUILE_LOAD_DIRS}"
-  "${GUILE_LIBRARY_DIRS}"
-  scm-report-system-2
-  FALSE
-)
-
-SET_LOCAL_DIST(report_system_DIST_local CMakeLists.txt Makefile.am report-system.i
-        ${report_system_HEADERS} ${report_system_SOURCES} ${report_system_SCHEME} ${report_system_SCHEME_1}
-        ${report_system_SCHEME_2} ${report_system_SCHEME_3})
-
-SET(report_system_DIST ${report_system_DIST_local} ${test_report_system_DIST} PARENT_SCOPE)
diff --git a/src/report/report-system/Makefile.am b/src/report/report-system/Makefile.am
deleted file mode 100644
index c0352f5..0000000
--- a/src/report/report-system/Makefile.am
+++ /dev/null
@@ -1,170 +0,0 @@
-SUBDIRS = . test
-
-pkglib_LTLIBRARIES = libgncmod-report-system.la
-
-libgncmod_report_system_la_SOURCES = \
-  swig-report-system.c \
-  gncmod-report-system.c \
-  gnc-report.c
-
-gncincludedir = ${GNC_INCLUDE_DIR}
-gncinclude_HEADERS = \
-  gnc-report.h
-
-libgncmod_report_system_la_LDFLAGS = -avoid-version
-
-libgncmod_report_system_la_LIBADD = \
-  ${top_builddir}/src/core-utils/libgnc-core-utils.la \
-  ${top_builddir}/src/engine/libgncmod-engine.la \
-  ${top_builddir}/src/gnc-module/libgnc-module.la \
-  ${top_builddir}/src/app-utils/libgncmod-app-utils.la \
-  ${top_builddir}/src/engine/libgncmod-engine.la \
-  ${GUILE_LIBS} \
-  ${GLIB_LIBS} \
-  ${GTK_LIBS}
-
-if BUILDING_FROM_VCS
-swig-report-system.c: report-system.i ${top_srcdir}/src/base-typemaps.i
-	$(SWIG) -guile $(SWIG_ARGS) -Linkage module \
-	-I${top_srcdir}/src -o $@ $<
-if ! OS_WIN32
-if ! SWIG_DIST_FAIL
-	if ! `grep "define scm_from_utf8_string" $@ > /dev/null 2>&1`; then \
-	  patch $@ $(top_srcdir)/src/swig-utf8.patch; \
-	fi
-endif
-endif
-endif
-
-AM_CPPFLAGS = \
-  -I${top_srcdir}/src \
-  -I${top_srcdir}/src/core-utils \
-  -I${top_srcdir}/src/gnc-module \
-  -I${top_srcdir}/src/app-utils \
-  -I${top_srcdir}/src/engine \
-  ${GLIB_CFLAGS} \
-  ${GTK_CFLAGS} \
-  ${GUILE_CFLAGS}
-
-gncscmdir = ${GNC_SCM_INSTALL_DIR}
-gncscm_DATA = \
-     commodity-utilities.scm  \
-     html-acct-table.scm \
-     html-barchart.scm \
-     html-document.scm \
-     html-fonts.scm \
-     html-piechart.scm \
-     html-scatter.scm \
-     html-linechart.scm \
-     html-style-info.scm \
-     html-style-sheet.scm \
-     html-table.scm \
-     html-text.scm \
-     html-utilities.scm \
-     html-jqplot.scm \
-     options-utilities.scm \
-     report-utilities.scm \
-     report.scm
-
-gncmodscmdir = ${GNC_SCM_INSTALL_DIR}/gnucash/report/report-system
-gncmodscm_DATA = \
-     collectors.scm \
-     list-extras.scm \
-     report-collectors.scm
-
-gncscmmoddir = ${GNC_SCM_INSTALL_DIR}/gnucash/report/
-gncscmmod_DATA = \
-    report-system.scm \
-	eguile-gnc.scm \
-	eguile-utilities.scm \
-	eguile-html-utilities.scm
-
-if GNUCASH_SEPARATE_BUILDDIR
-#For executing test cases
-# for running
-SCM_FILE_LINKS = \
-  ${gncscmmod_DATA} \
-  ${gncscm_DATA} \
-  ${gncmodscm_DATA}
-endif
-
-.scm-links:
-	$(RM) -rf gnucash
-	mkdir -p  gnucash
-	mkdir -p  gnucash/report
-	mkdir -p  gnucash/report/report-system
-if GNUCASH_SEPARATE_BUILDDIR
-	for X in ${SCM_FILE_LINKS} ; do \
-	  $(LN_S) -f ${srcdir}/$$X . ; \
-	done
-endif
-	( cd gnucash/report; for A in $(gncscmmod_DATA) ; do $(LN_S) -f ../../$$A . ; done )
-	( cd gnucash/report/report-system; for A in $(gncmodscm_DATA) ; do $(LN_S) -f ../../../$$A . ; done )
-if ! OS_WIN32
-# Windows knows no "ln -s" but uses "cp": must copy every time (see bug #566567).
-	touch .scm-links
-endif
-
-if GNC_HAVE_GUILE_2
-GUILE_COMPILE_ENV = \
-  --gnc-module-dir ${top_builddir}/src/app-utils \
-  --gnc-module-dir ${top_builddir}/src/engine \
-  --gnc-module-dir ${top_builddir}/src/html \
-  --gnc-module-dir ${top_builddir}/src/gnome-utils \
-  --gnc-module-dir ${top_builddir}/src/report/report-system \
-  --guile-load-dir ${top_builddir}/src/app-utils \
-  --guile-load-dir ${top_builddir}/src/core-utils \
-  --guile-load-dir ${top_builddir}/src/engine \
-  --guile-load-dir ${top_builddir}/src/gnc-module \
-  --guile-load-dir ${top_builddir}/src/gnome-utils \
-  --guile-load-dir ${top_builddir}/src/scm \
-  --guile-load-dir ${top_builddir}/src/report/report-system \
-  --library-dir    ${top_builddir}/src/engine \
-  --library-dir    ${top_builddir}/src/app-utils \
-  --library-dir    ${top_builddir}/src/core-utils \
-  --library-dir    ${top_builddir}/src/gnc-module \
-  --library-dir    ${top_builddir}/src/gnome-utils \
-  --library-dir    ${top_builddir}/src/backend/xml \
-  --library-dir    ${top_builddir}/src/backend/sql \
-  --library-dir    ${top_builddir}/src/html \
-  --library-dir    ${top_builddir}/src/report/report-system
-
-%.go : %.scm .scm-links $(pkglib_LTLIBRARIES)
-	GNC_UNINSTALLED=yes \
-	GNC_BUILDDIR=${top_builddir} \
-	$(shell ${abs_top_srcdir}/src/gnc-test-env.pl --noexports ${GUILE_COMPILE_ENV}) \
-	$(GUILD) compile -o $@ $<
-
-gncscmmodcachedir = ${pkglibdir}/scm/ccache/@GUILE_EFFECTIVE_VERSION@/gnucash/report
-gncscmmodcache_DATA = $(gncscmmod_DATA:.scm=.go)
-
-gncmodscmcachedir = ${pkglibdir}/scm/ccache/@GUILE_EFFECTIVE_VERSION@/gnucash/report/report-system
-gncmodscmcache_DATA = $(gncmodscm_DATA:.scm=.go)
-
-gncscmcachedir = ${pkglibdir}/scm/ccache/@GUILE_EFFECTIVE_VERSION@
-gncscmcache_DATA = $(gncscm_DATA:.scm=.go)
-endif
-
-noinst_DATA = .scm-links
-
-EXTRA_DIST = \
-	report-system.i \
-	${gncscmmod_DATA} \
-	${gncscm_DATA} \
-	${gncmodscm_DATA} \
-	CMakeLists.txt
-
-clean-local:
-	rm -rf gnucash
-
-CLEANFILES = \
-	report \
-	.scm-links \
-	${SCM_FILE_LINKS} \
-	${gncscmmodcache_DATA} \
-	${gncmodscmcache_DATA} \
-	${gncscmcache_DATA}
-
-MAINTAINERCLEANFILES = swig-report-system.c
-
-AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.report.core\"
diff --git a/src/report/report-system/test/CMakeLists.txt b/src/report/report-system/test/CMakeLists.txt
deleted file mode 100644
index 42bea2a..0000000
--- a/src/report/report-system/test/CMakeLists.txt
+++ /dev/null
@@ -1,32 +0,0 @@
-
-SET(REPORT_SYSTEM_TEST_INCLUDE_DIRS
-  ${CMAKE_SOURCE_DIR}/src/gnc-module
-  ${GUILE_INCLUDE_DIRS}
-)
-SET(REPORT_SYSTEM_TEST_LIBS gnc-module)
-
-GNC_ADD_TEST_WITH_GUILE(test-link-module-report-system test-link-module.c
-  REPORT_SYSTEM_TEST_INCLUDE_DIRS REPORT_SYSTEM_TEST_LIBS
-)
-
-GNC_ADD_SCHEME_TEST(test-load-module-report-system test-load-module.in)
-GNC_ADD_SCHEME_TEST(test-collectors test-collectors.scm)
-GNC_ADD_SCHEME_TEST(test-list-extras test-list-extras.scm)
-GNC_ADD_SCHEME_TEST(test-report-utilities test-report-utilities.scm)
-# This test is not run in the autotools build.
-#GNC_ADD_SCHEME_TEST(test-test-extras test-test-extras.scm)
-
-GNC_ADD_SCHEME_TARGETS(scm-test-report-system
-  test-extras.scm
-  gnucash/report/report-system/test
-  ""
-  ""
-  ""
-  "scm-gnc-module;scm-test-engine;scm-report-system-3"
-  FALSE
-)
-
-CONFIGURE_FILE(test-load-module.in test-load-module @ONLY)
-
-SET_DIST_LIST(test_report_system_DIST CMakeLists.txt Makefile.am test-collectors.scm test-extras.scm test-link-module.c
-        test-load-module.in test-report-utilities.scm test-list-extras.scm)
\ No newline at end of file
diff --git a/src/report/report-system/test/Makefile.am b/src/report/report-system/test/Makefile.am
deleted file mode 100644
index b122c7b..0000000
--- a/src/report/report-system/test/Makefile.am
+++ /dev/null
@@ -1,101 +0,0 @@
-AM_CPPFLAGS = \
-  -I${top_srcdir} \
-  -I${top_srcdir}/src \
-  -I${top_srcdir}/src/test-core \
-  -I${top_srcdir}/src/engine \
-  -I${top_srcdir}/src/gnc-module \
-  ${GUILE_CFLAGS} \
-  ${GLIB_CFLAGS}
-
-LDADD = \
-  ${top_builddir}/src/engine/libgncmod-engine.la \
-  ${top_builddir}/src/gnc-module/libgnc-module.la \
-  ${GLIB_LIBS} \
-  ${GUILE_LIBS}
-
-TESTS = \
-  test-link-module \
-  test-load-module \
-  $(SCM_TESTS)
-
-SCM_TESTS = \
-	test-collectors \
-	test-list-extras \
-	test-report-utilities
-
-SCM_TEST_SRCS = $(SCM_TESTS:%=%.scm)
-
-GNC_TEST_DEPS = --gnc-module-dir ${top_builddir}/src/engine \
-  --gnc-module-dir ${top_builddir}/src/app-utils \
-  --gnc-module-dir ${top_builddir}/src/gnome-utils \
-  --gnc-module-dir ${top_builddir}/src/html \
-  --gnc-module-dir ${top_builddir}/src/report/report-system \
-  --gnc-module-dir ${top_builddir}/src/report/report-system/test \
-  --gnc-module-dir ${top_builddir}/src/engine/test \
-  --gnc-module-dir ${top_builddir}/src/backend/xml \
-  --gnc-module-dir ${top_builddir}/src/backend/sql \
-  --gnc-module-dir ${top_builddir}/src/backend/dbi \
- \
-  --guile-load-dir ${top_builddir}/src/gnc-module \
-  --guile-load-dir ${top_builddir}/src/scm \
-  --guile-load-dir ${top_builddir}/src/engine \
-  --guile-load-dir ${top_builddir}/src/engine/test \
-  --guile-load-dir ${top_builddir}/src/core-utils \
-  --guile-load-dir ${top_builddir}/src/app-utils \
-  --guile-load-dir ${top_builddir}/src/gnome-utils \
-  --guile-load-dir ${top_builddir}/src/report/report-system \
-  --guile-load-dir ${top_builddir}/src/report/report-system/test \
-\
-  --library-dir    ${top_builddir}/src/report/report-system \
-  --library-dir    ${top_builddir}/src/core-utils \
-  --library-dir    ${top_builddir}/src/app-utils \
-  --library-dir    ${top_builddir}/src/gnome-utils \
-  --library-dir    ${top_builddir}/src/engine \
-  --library-dir    ${top_builddir}/src/backend/xml \
-  --library-dir    ${top_builddir}/src/backend/sql  \
-  --library-dir    ${top_builddir}/src/backend/dbi  \
-  --library-dir    ${top_builddir}/src/gnc-module
-
-$(SCM_TESTS): %: $(srcdir)/%.scm Makefile .scm-links
-	echo 'export GNC_BUILDDIR="${abs_top_builddir}";' > $@
-	echo 'export GNC_UNINSTALLED=yes;' >> $@
-	echo '${GUILE} --debug -l $(srcdir)/$*.scm -c "(exit (run-test))"' >> $@
-	chmod a+x $@
-
-TESTS_ENVIRONMENT = \
-  GUILE_WARN_DEPRECATED=no \
-  GUILE="${GUILE}" \
-  GNC_BUILDDIR="${abs_top_builddir}" \
-  $(shell ${abs_top_srcdir}/src/gnc-test-env.pl --noexports ${GNC_TEST_DEPS})
-
-
-check_PROGRAMS = test-link-module
-
-SCM_TEST_HELPERS = test-extras.scm
-
-EXTRA_DIST = \
-	test-load-module \
-	$(SCM_TEST_HELPERS) \
-	$(SCM_TEST_SRCS) \
-	CMakeLists.txt
-
-testit:
-	$(TESTS_ENVIRONMENT) libtool --mode execute gdb test-link-module
-
-
-.scm-links:
-	$(RM) -rf gnucash
-	mkdir -p  gnucash/report/report-system/test
-	( cd gnucash/report/report-system/test; for A in $(SCM_TEST_HELPERS) ; do $(LN_S) -f $(abs_srcdir)/$$A . ; done )
-if ! OS_WIN32
-# Windows knows no "ln -s" but uses "cp": must copy every time (see bug #566567).
-	touch .scm-links
-endif
-
-clean-local:
-	$(RM) -rf gnucash
-	$(RM) *.log
-
-noinst_DATA = .scm-links
-CLEANFILES = .scm-links
-DISTCLEANFILES = $(SCM_TESTS)
diff --git a/src/report/standard-reports/CMakeLists.txt b/src/report/standard-reports/CMakeLists.txt
deleted file mode 100644
index 159e67c..0000000
--- a/src/report/standard-reports/CMakeLists.txt
+++ /dev/null
@@ -1,71 +0,0 @@
-
-ADD_SUBDIRECTORY(test)
-
-SET (standard_reports_SCHEME standard-reports.scm)
-
-SET (standard_reports_SCHEME_2
-    account-piecharts.scm
-    account-summary.scm
-    advanced-portfolio.scm
-    average-balance.scm
-    balance-sheet.scm
-    budget-balance-sheet.scm
-    budget-barchart.scm
-    budget-flow.scm
-    budget-income-statement.scm
-    budget.scm
-    cash-flow.scm
-    category-barchart.scm
-    daily-reports.scm
-    equity-statement.scm
-    general-journal.scm
-    general-ledger.scm
-    income-statement.scm
-    net-barchart.scm
-    net-linechart.scm
-    portfolio.scm
-    price-scatter.scm
-    register.scm
-    sx-summary.scm
-    transaction.scm
-    trial-balance.scm
-    )
-
-SET(GUILE_MODULES      src/app-utils src/engine src/gnome-utils src/html src/report/report-system)
-SET(GUILE_LOAD_DIRS    src/app-utils src/engine src/core-utils src/gnc-module src/gnome-utils src/report/report-system src/scm)
-SET(GUILE_LIBRARY_DIRS src/app-utils src/engine src/core-utils src/gnc-module src/gnome-utils src/report/report-system)
-SET(GUILE_DEPENDS      gncmod-html scm-app-utils scm-gnome-utils scm-report-system scm-report-system-3)
-
-GNC_ADD_SCHEME_TARGETS(scm-standard-reports-1
-  "${standard_reports_SCHEME}"
-  "gnucash/report"
-  "${GUILE_MODULES}"
-  "${GUILE_LOAD_DIRS}"
-  "${GUILE_LIBRARY_DIRS}"
-  "scm-standard-reports-2;${GUILE_DEPENDS}"
-  TRUE
-)
-
-GNC_ADD_SCHEME_TARGETS(scm-standard-reports-2
-  "${standard_reports_SCHEME_2}"
-  "gnucash/report/standard-reports"
-  "${GUILE_MODULES}"
-  "${GUILE_LOAD_DIRS}"
-  "${GUILE_LIBRARY_DIRS}"
-  "scm-standard-reports-2-links;${GUILE_DEPENDS}"
-  TRUE
-)
-
-ADD_CUSTOM_TARGET(scm-standard-reports ALL DEPENDS scm-standard-reports-2 scm-standard-reports)
-
-# FIXME: This is a hack since core-utils assumes an autotools build environment.
-
-SET(STD_RPT_DIR ${CMAKE_CURRENT_BINARY_DIR}/gnucash/report)
-FILE(MAKE_DIRECTORY ${STD_RPT_DIR})
-FILE(COPY standard-reports.scm DESTINATION ${STD_RPT_DIR})
-
-FILE(MAKE_DIRECTORY ${STD_RPT_DIR}/standard-reports)
-FILE(COPY ${standard_reports_SCHEME_2} DESTINATION ${STD_RPT_DIR}/standard-reports)
-
-SET_LOCAL_DIST(standard_reports_DIST_local CMakeLists.txt Makefile.am ${standard_reports_SCHEME} ${standard_reports_SCHEME_2})
-SET(standard_reports_DIST ${standard_reports_DIST_local} ${test_standard_reports_DIST} PARENT_SCOPE)
diff --git a/src/report/standard-reports/Makefile.am b/src/report/standard-reports/Makefile.am
deleted file mode 100644
index 7e7356a..0000000
--- a/src/report/standard-reports/Makefile.am
+++ /dev/null
@@ -1,114 +0,0 @@
-SUBDIRS = . test
-
-gncscmmoddir = ${GNC_SCM_INSTALL_DIR}/gnucash/report/
-gncscmmod_DATA = \
-   standard-reports.scm
-
-gncscmrptdir = ${GNC_SCM_INSTALL_DIR}/gnucash/report/standard-reports
-gncscmrpt_DATA = \
-   account-piecharts.scm \
-   account-summary.scm \
-   advanced-portfolio.scm \
-   average-balance.scm \
-   balance-sheet.scm \
-   budget.scm \
-   budget-balance-sheet.scm \
-   budget-barchart.scm \
-   budget-flow.scm \
-   budget-income-statement.scm \
-   cash-flow.scm \
-   category-barchart.scm \
-   daily-reports.scm \
-   equity-statement.scm \
-   general-journal.scm \
-   general-ledger.scm \
-   income-statement.scm \
-   net-barchart.scm \
-   net-linechart.scm \
-   portfolio.scm \
-   price-scatter.scm \
-   register.scm \
-   sx-summary.scm \
-   trial-balance.scm \
-   transaction.scm
-
-
-
-if GNUCASH_SEPARATE_BUILDDIR
-#For executing test cases
-SCM_FILE_LINKS = ${gncscmmod_DATA} ${gncscmrpt_DATA}
-endif
-
-.scm-links:
-	$(RM) -rf gnucash
-	mkdir -p  gnucash
-	mkdir -p  gnucash/report
-	mkdir -p  gnucash/report/standard-reports
-if GNUCASH_SEPARATE_BUILDDIR
-	for X in ${SCM_FILE_LINKS} ; do \
-	  $(LN_S) -f ${srcdir}/$$X . ; \
-	done
-endif
-	( cd gnucash/report; for A in $(gncscmmod_DATA) ; do $(LN_S) -f ../../$$A . ; done )
-	( cd gnucash/report/standard-reports; for A in $(gncscmrpt_DATA) ; do $(LN_S) -f ../../../$$A . ; done )
-if ! OS_WIN32
-# Windows knows no "ln -s" but uses "cp": must copy every time (see bug #566567).
-	touch .scm-links
-endif
-
-if GNC_HAVE_GUILE_2
-GUILE_COMPILE_ENV = \
-  --gnc-module-dir ${top_builddir}/src/app-utils \
-  --gnc-module-dir ${top_builddir}/src/engine \
-  --gnc-module-dir ${top_builddir}/src/gnome-utils \
-  --gnc-module-dir ${top_builddir}/src/html \
-  --gnc-module-dir ${top_builddir}/src/report/report-system \
-  --guile-load-dir ${top_builddir}/src/app-utils \
-  --guile-load-dir ${top_builddir}/src/core-utils \
-  --guile-load-dir ${top_builddir}/src/engine \
-  --guile-load-dir ${top_builddir}/src/gnc-module \
-  --guile-load-dir ${top_builddir}/src/gnome-utils \
-  --guile-load-dir ${top_builddir}/src/report/report-system \
-  --guile-load-dir ${top_builddir}/src/report/standard-reports \
-  --guile-load-dir ${top_builddir}/src/scm \
-  --library-dir    ${top_builddir}/src/engine \
-  --library-dir    ${top_builddir}/src/app-utils \
-  --library-dir    ${top_builddir}/src/core-utils \
-  --library-dir    ${top_builddir}/src/gnc-module \
-  --library-dir    ${top_builddir}/src/gnome-utils \
-  --library-dir    ${top_builddir}/src/backend/xml \
-  --library-dir    ${top_builddir}/src/backend/sql \
-  --library-dir    ${top_builddir}/src/html \
-  --library-dir    ${top_builddir}/src/report/report-system
-
-%.go : %.scm .scm-links $(pkglib_LTLIBRARIES)
-	GNC_UNINSTALLED=yes \
-	GNC_BUILDDIR=${top_builddir} \
-	$(shell ${abs_top_srcdir}/src/gnc-test-env.pl --noexports ${GUILE_COMPILE_ENV}) \
-	$(GUILD) compile -o $@ $<
-
-gncscmmodcachedir = ${pkglibdir}/scm/ccache/@GUILE_EFFECTIVE_VERSION@/gnucash/report
-gncscmmodcache_DATA = $(gncscmmod_DATA:.scm=.go)
-
-gncscmrptcachedir = ${pkglibdir}/scm/ccache/@GUILE_EFFECTIVE_VERSION@/gnucash/report/standard-reports
-gncscmrptcache_DATA = $(gncscmrpt_DATA:.scm=.go)
-endif
-
-clean-local:
-	$(RM) -rf gnucash
-
-noinst_DATA = .scm-links
-
-EXTRA_DIST = \
-	${gncscmmod_DATA} \
-	${gncscmrpt_DATA} \
-	CMakeLists.txt
-
-CLEANFILES = \
-	.scm-links \
-	${gncscmmodcache_DATA} \
-	${gncscmrptcache_DATA}
-
-DISTCLEANFILES = ${SCM_FILE_LINKS}
-
-AM_CPPFLAGS = -DG_LOG_DOMAIN=\"gnc.report.standard\"
diff --git a/src/report/standard-reports/advanced-portfolio.scm b/src/report/standard-reports/advanced-portfolio.scm
deleted file mode 100644
index b39f122..0000000
--- a/src/report/standard-reports/advanced-portfolio.scm
+++ /dev/null
@@ -1,1203 +0,0 @@
-;; -*-scheme-*- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; advanced-portfolio.scm
-;; by Martijn van Oosterhout (kleptog at svana.org) Feb 2002
-;; modified for GnuCash 1.8 by Herbert Thoma (herbie at hthoma.de) Oct 2002
-;;
-;; Heavily based on portfolio.scm
-;; by Robert Merkel (rgmerk at mira.net)
-;;
-;; 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 at gnu.org
-;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-(define-module (gnucash report standard-reports advanced-portfolio))
-
-(use-modules (gnucash main)) ;; FIXME: delete after we finish modularizing.
-(use-modules (srfi srfi-1))
-(use-modules (gnucash gnc-module))
-(use-modules (gnucash gettext))
-
-(use-modules (gnucash printf))
-
-(gnc:module-load "gnucash/report/report-system" 0)
-
-(define reportname (N_ "Advanced Portfolio"))
-
-(define optname-price-source (N_ "Price Source"))
-(define optname-shares-digits (N_ "Share decimal places"))
-(define optname-zero-shares (N_ "Include accounts with no shares"))
-(define optname-show-symbol (N_ "Show ticker symbols"))
-(define optname-show-listing (N_ "Show listings"))
-(define optname-show-price (N_ "Show prices"))
-(define optname-show-shares (N_ "Show number of shares"))
-(define optname-basis-method (N_ "Basis calculation method"))
-(define optname-prefer-pricelist (N_ "Set preference for price list data"))
-(define optname-brokerage-fees (N_ "How to report brokerage fees"))
-
-;; To avoid overflows in our calculations, define a denominator for prices and unit values
-(define price-denom 100000000)
-(define units-denom 100000000)
-
-(define (options-generator)
-  (let* ((options (gnc:new-options))
-         ;; This is just a helper function for making options.
-         ;; See gnucash/src/scm/options.scm for details.
-         (add-option
-          (lambda (new-option)
-            (gnc:register-option options new-option))))
-
-    ;; General Tab
-    ;; date at which to report balance
-    (gnc:options-add-report-date!
-     options gnc:pagename-general
-     (N_ "Date") "a")
-
-    (gnc:options-add-currency!
-     options gnc:pagename-general (N_ "Report's currency") "c")
-
-    (add-option
-     (gnc:make-multichoice-option
-      gnc:pagename-general optname-price-source
-      "d" (N_ "The source of price information.") 'pricedb-nearest
-      (list (vector 'pricedb-latest
-		    (N_ "Most recent")
-		    (N_ "The most recent recorded price."))
-	    (vector 'pricedb-nearest
-		    (N_ "Nearest in time")
-		    (N_ "The price recorded nearest in time to the report date."))
-	    )))
-
-    (add-option
-     (gnc:make-multichoice-option
-      gnc:pagename-general optname-basis-method
-      "e" (N_ "Basis calculation method.") 'average-basis
-      (list (vector 'average-basis
-		    (N_ "Average")
-		    (N_ "Use average cost of all shares for basis."))
-	    (vector 'fifo-basis
-		    (N_ "FIFO")
-		    (N_ "Use first-in first-out method for basis."))
-	    (vector 'filo-basis
-		    (N_ "LIFO")
-		    (N_ "Use last-in first-out method for basis."))
-	    )))
-
-    (add-option
-     (gnc:make-simple-boolean-option
-      gnc:pagename-general optname-prefer-pricelist "f"
-      (N_ "Prefer use of price editor pricing over transactions, where applicable.")
-      #t))
-
-    (add-option
-     (gnc:make-multichoice-option
-      gnc:pagename-general optname-brokerage-fees
-      "g" (N_ "How to report commissions and other brokerage fees.") 'include-in-basis
-      (list (vector 'include-in-basis
-                    (N_ "Include in basis")
-                    (N_ "Include brokerage fees in the basis for the asset."))
-            (vector 'include-in-gain
-                    (N_ "Include in gain")
-                    (N_  "Include brokerage fees in the gain and loss but not in the basis."))
-            (vector 'ignore-brokerage
-                    (N_ "Ignore")
-                    (N_ "Ignore brokerage fees entirely."))
-            )))
-
-    (gnc:register-option
-      options
-      (gnc:make-simple-boolean-option
-	gnc:pagename-display optname-show-symbol "a"
-	(N_ "Display the ticker symbols.")
-	#t))
-
-    (gnc:register-option
-      options
-      (gnc:make-simple-boolean-option
-	gnc:pagename-display optname-show-listing "b"
-	(N_ "Display exchange listings.")
-	#t))
-
-    (gnc:register-option
-      options
-      (gnc:make-simple-boolean-option
-	gnc:pagename-display optname-show-shares "c"
-	(N_ "Display numbers of shares in accounts.")
-	#t))
-
-    (add-option
-     (gnc:make-number-range-option
-      gnc:pagename-display optname-shares-digits
-      "d" (N_ "The number of decimal places to use for share numbers.") 2
-      0 6 0 1))
-
-    (gnc:register-option
-      options
-      (gnc:make-simple-boolean-option
-	gnc:pagename-display optname-show-price "e"
-	(N_ "Display share prices.")
-	#t))
-
-    ;; Account tab
-    (add-option
-     (gnc:make-account-list-option
-      gnc:pagename-accounts (N_ "Accounts")
-      "b"
-      (N_ "Stock Accounts to report on.")
-      (lambda () (filter gnc:account-is-stock?
-                         (gnc-account-get-descendants-sorted
-                          (gnc-get-current-root-account))))
-      (lambda (accounts) (list  #t
-                                (filter gnc:account-is-stock? accounts)))
-      #t))
-
-    (gnc:register-option
-     options
-     (gnc:make-simple-boolean-option
-      gnc:pagename-accounts optname-zero-shares "e"
-      (N_ "Include accounts that have a zero share balances.")
-      #f))
-
-    (gnc:options-set-default-section options gnc:pagename-general)
-    options))
-
-;; This is the rendering function. It accepts a database of options
-;; and generates an object of type <html-document>.  See the file
-;; report-html.txt for documentation; the file report-html.scm
-;; includes all the relevant Scheme code. The option database passed
-;; to the function is one created by the options-generator function
-;; defined above.
-
-(define (advanced-portfolio-renderer report-obj)
-
- (let ((work-done 0)
-       (work-to-do 0)
-       (warn-no-price #f)
-       (warn-price-dirty #f))
-
-  ;; These are some helper functions for looking up option values.
-  (define (get-op section name)
-    (gnc:lookup-option (gnc:report-options report-obj) section name))
-
-  (define (get-option section name)
-    (gnc:option-value (get-op section name)))
-
-  (define (split-account-type? split type)
-    (eq? type (xaccAccountGetType (xaccSplitGetAccount split))))
-
-  (define (same-split? s1 s2)
-    (equal? (gncSplitGetGUID s1) (gncSplitGetGUID s2)))
-
-  (define (same-account? a1 a2)
-    (equal? (gncAccountGetGUID a1) (gncAccountGetGUID a2)))
-
-  ;; sum up the contents of the b-list built by basis-builder below
-  (define (sum-basis b-list currency-frac)
-    (if (not (eqv? b-list '()))
-	(gnc-numeric-add (gnc-numeric-mul (caar b-list) (cdar b-list) currency-frac GNC-RND-ROUND)
-			 (sum-basis (cdr b-list) currency-frac) currency-frac GNC-RND-ROUND)
-	(gnc-numeric-zero)
-	)
-    )
-
-  ;; sum up the total number of units in the b-list built by basis-builder below
-  (define (units-basis b-list)
-    (if (not (eqv? b-list '()))
-	(gnc-numeric-add (caar b-list) (units-basis (cdr b-list))
-			 units-denom GNC-RND-ROUND)
-	(gnc-numeric-zero)
-	)
-    )
-
-  ;; apply a ratio to an existing basis-list, useful for splits/mergers and spinoffs
-  ;; I need to get a brain and use (map) for this.
-  (define (apply-basis-ratio b-list units-ratio value-ratio)
-    (if (not (eqv? b-list '()))
-	(cons (cons (gnc-numeric-mul units-ratio (caar b-list) units-denom GNC-RND-ROUND)
-		    (gnc-numeric-mul value-ratio (cdar b-list) price-denom GNC-RND-ROUND))
-	      (apply-basis-ratio (cdr b-list) units-ratio value-ratio))
-	'()
-	)
-    )
-
-  ;; this builds a list for basis calculation and handles average, fifo and lifo methods
-  ;; the list is cons cells of (units-of-stock . price-per-unit)... average method produces only one
-  ;; cell that mutates to the new average. Need to add a date checker so that we allow for prices
-  ;; coming in out of order, such as a transfer with a price adjusted to carryover the basis.
-  (define (basis-builder b-list b-units b-value b-method currency-frac)
-    (gnc:debug "actually in basis-builder")
-    (gnc:debug "b-list is " b-list " b-units is " (gnc-numeric-to-string b-units)
-               " b-value is " (gnc-numeric-to-string b-value) " b-method is " b-method)
-
-    ;; if there is no b-value, then this is a split/merger and needs special handling
-    (cond
-
-     ;; we have value and positive units, add units to basis
-     ((and (not (gnc-numeric-zero-p b-value))
-	   (gnc-numeric-positive-p b-units))
-      (case b-method
-	((average-basis)
-	 (if (not (eqv? b-list '()))
-	     (list (cons (gnc-numeric-add b-units
-					  (caar b-list) units-denom GNC-RND-ROUND)
-			 (gnc-numeric-div
-			  (gnc-numeric-add b-value
-					   (gnc-numeric-mul (caar b-list)
-							    (cdar b-list)
-							    GNC-DENOM-AUTO GNC-DENOM-REDUCE)
-					   GNC-DENOM-AUTO GNC-DENOM-REDUCE)
-			  (gnc-numeric-add b-units
-					   (caar b-list) GNC-DENOM-AUTO GNC-DENOM-REDUCE)
-			  price-denom GNC-RND-ROUND)))
-	     (append b-list
-		     (list (cons b-units (gnc-numeric-div
-					  b-value b-units price-denom GNC-RND-ROUND))))))
-	(else (append b-list
-		      (list (cons b-units (gnc-numeric-div
-					   b-value b-units price-denom GNC-RND-ROUND)))))))
-
-     ;; we have value and negative units, remove units from basis
-     ((and (not (gnc-numeric-zero-p b-value))
-	   (gnc-numeric-negative-p b-units))
-      (if (not (eqv? b-list '()))
-          (case b-method
-            ((fifo-basis)
-             (case (gnc-numeric-compare (gnc-numeric-abs b-units) (caar b-list))
-               ((-1)
-                 ;; Sold less than the first lot, create a new first lot from the remainder
-                 (let ((new-units (gnc-numeric-add b-units (caar b-list) units-denom GNC-RND-ROUND)))
-                        (cons (cons new-units (cdar b-list)) (cdr b-list))))
-               ((0)
-                 ;; Sold all of the first lot
-                 (cdr b-list))
-               ((1)
-                 ;; Sold more than the first lot, delete it and recurse
-                 (basis-builder (cdr b-list) (gnc-numeric-add b-units (caar b-list) units-denom GNC-RND-ROUND)
-                                b-value  ;; Only the sign of b-value matters since the new b-units is negative
-                                b-method currency-frac))))
-            ((filo-basis)
-             (let ((rev-b-list (reverse b-list)))
-               (case (gnc-numeric-compare (gnc-numeric-abs b-units) (caar rev-b-list))
-                 ((-1)
-                   ;; Sold less than the last lot
-                 (let ((new-units (gnc-numeric-add b-units (caar rev-b-list) units-denom GNC-RND-ROUND)))
-                        (reverse (cons (cons new-units (cdar rev-b-list)) (cdr rev-b-list)))))
-                 ((0)
-                   ;; Sold all of the last lot
-                   (reverse (cdr rev-b-list))
-                 )
-                 ((1)
-                   ;; Sold more than the last lot
-                   (basis-builder (reverse (cdr rev-b-list)) (gnc-numeric-add b-units (caar rev-b-list) units-denom GNC-RND-ROUND)
-                                           b-value b-method currency-frac)
-                 ))))
-            ((average-basis)
-             (list (cons (gnc-numeric-add
-                          (caar b-list) b-units units-denom GNC-RND-ROUND)
-                         (cdar b-list)))))
-          '()
-          ))
-
-     ;; no value, just units, this is a split/merge...
-     ((and (gnc-numeric-zero-p b-value)
-	   (not (gnc-numeric-zero-p b-units)))
-	(let* ((current-units (units-basis b-list))
-	       (units-ratio (gnc-numeric-div (gnc-numeric-add b-units current-units GNC-DENOM-AUTO GNC-DENOM-REDUCE)
-					     current-units GNC-DENOM-AUTO GNC-DENOM-REDUCE))
-               ;; If the units ratio is zero the stock is worthless and the value should be zero too
-	       (value-ratio (if (gnc-numeric-zero-p units-ratio)
-	                        (gnc-numeric-zero)
-                                (gnc-numeric-div (gnc:make-gnc-numeric 1 1) units-ratio GNC-DENOM-AUTO GNC-DENOM-REDUCE))))
-
-	  (gnc:debug "blist is " b-list " current units is "
-	             (gnc-numeric-to-string current-units)
-	             " value ratio is " (gnc-numeric-to-string value-ratio)
-	             " units ratio is " (gnc-numeric-to-string units-ratio))
-	  (apply-basis-ratio b-list units-ratio value-ratio)
-	  ))
-
-	;; If there are no units, just a value, then its a spin-off,
-	;; calculate a ratio for the values, but leave the units alone
-	;; with a ratio of 1
-     ((and (gnc-numeric-zero-p b-units)
-	   (not (gnc-numeric-zero-p b-value)))
-      (let* ((current-value (sum-basis b-list GNC-DENOM-AUTO))
-	     (value-ratio (gnc-numeric-div (gnc-numeric-add b-value current-value GNC-DENOM-AUTO GNC-DENOM-REDUCE)
-					   current-value GNC-DENOM-AUTO GNC-DENOM-REDUCE)))
-
-	(gnc:debug "this is a spinoff")
-	(gnc:debug "blist is " b-list " value ratio is " (gnc-numeric-to-string value-ratio))
-	(apply-basis-ratio b-list (gnc:make-gnc-numeric 1 1) value-ratio))
-      )
-
-     ;; when all else fails, just send the b-list back
-     (else
-      b-list)
-     )
-    )
-
-  ;; Given a price list and a currency find the price for that currency on the list.
-  ;; If there is none for the requested currency, return the first one.
-  ;; The price list is released but the price returned is ref counted.
-  (define (find-price price-list currency)
-    (if (eqv? price-list '()) #f
-      (let ((price (car price-list)))
-        (for-each
-          (lambda (p)
-            (if (gnc-commodity-equiv currency (gnc-price-get-currency p))
-                (set! price p))
-            (if (gnc-commodity-equiv currency (gnc-price-get-commodity p))
-                (set! price (gnc-price-invert p))))
-          price-list)
-        (gnc-price-ref price)
-        (gnc-price-list-destroy price-list)
-        price)))
-
-  ;; Return true if either account is the parent of the other or they are siblings
-  (define (parent-or-sibling? a1 a2)
-    (let ((a2parent (gnc-account-get-parent a2))
-          (a1parent (gnc-account-get-parent a1)))
-          (or (same-account? a2parent a1)
-              (same-account? a1parent a2)
-              (same-account? a1parent a2parent))))
-
-  ;; Test whether the given split is the source of a spin off transaction
-  ;; This will be a no-units split with only one other split.
-  ;; xaccSplitGetOtherSplit only returns on a two-split txn.  It's not a spinoff
-  ;; is the other split is in an income or expense account.
-  (define (spin-off? split current)
-     (let ((other-split (xaccSplitGetOtherSplit split)))
-          (and (gnc-numeric-zero-p (xaccSplitGetAmount split))
-               (same-account? current (xaccSplitGetAccount split))
-               (not (null? other-split))
-               (not (split-account-type? other-split ACCT-TYPE-EXPENSE))
-               (not (split-account-type? other-split ACCT-TYPE-INCOME)))))
-
-
-(define (table-add-stock-rows table accounts to-date
-                                currency price-fn exchange-fn price-source
-				include-empty show-symbol show-listing show-shares show-price
-                                basis-method prefer-pricelist handle-brokerage-fees
-                                total-basis total-value
-                                total-moneyin total-moneyout total-income total-gain
-                                total-ugain total-brokerage)
-
-   (let ((share-print-info
-	  (gnc-share-print-info-places
-	   (inexact->exact (get-option gnc:pagename-display
-      			       optname-shares-digits)))))
-
-    (define (table-add-stock-rows-internal accounts odd-row?)
-      (if (null? accounts) total-value
-          (let* ((row-style (if odd-row? "normal-row" "alternate-row"))
-                 (current (car accounts))
-                 (rest (cdr accounts))
-		 ;; commodity is the actual stock/thing we are looking at
-                 (commodity (xaccAccountGetCommodity current))
-                 (ticker-symbol (gnc-commodity-get-mnemonic commodity))
-                 (listing (gnc-commodity-get-namespace commodity))
-                 (unit-collector (gnc:account-get-comm-balance-at-date
-                                  current to-date #f))
-                 (units (cadr (unit-collector 'getpair commodity #f)))
-
-                 ;; Counter to keep track of stuff
-                 (brokeragecoll (gnc:make-commodity-collector))
-                 (dividendcoll  (gnc:make-commodity-collector))
-                 (moneyincoll   (gnc:make-commodity-collector))
-                 (moneyoutcoll  (gnc:make-commodity-collector))
-                 (gaincoll      (gnc:make-commodity-collector))
-
-
-		 ;; the price of the commodity at the time of the report
-                 (price (price-fn commodity currency to-date))
-		 ;; the value of the commodity, expressed in terms of
-		 ;; the report's currency.
-                 (value (gnc:make-gnc-monetary currency (gnc-numeric-zero)))  ;; Set later
-                 (currency-frac (gnc-commodity-get-fraction currency))
-
-		 (pricing-txn #f)
-		 (use-txn #f)
-		 (basis-list '())
-		 ;; setup an alist for the splits we've already seen.
-		 (seen_trans '())
-		 ;; Account used to hold remainders from income reinvestments and
-		 ;; running total of amount moved there
-		 (drp-holding-account #f)
-		 (drp-holding-amount (gnc-numeric-zero))
-		 )
-
-            (define (my-exchange-fn fromunits tocurrency)
-              (if (and (gnc-commodity-equiv currency tocurrency)
-                       (gnc-commodity-equiv (gnc:gnc-monetary-commodity fromunits) commodity))
-                    ;; Have a price for this commodity, but not necessarily in the report's
-                    ;; currency.  Get the value in the commodity's currency and convert it to
-                    ;; report currency.
-                    (exchange-fn
-                      ;; This currency will usually be the same as tocurrency so the
-                      ;; call to exchange-fn below will do nothing
-                      (gnc:make-gnc-monetary
-                        (if use-txn
-                            (gnc:gnc-monetary-commodity price)
-                            (gnc-price-get-currency price))
-                        (gnc-numeric-mul (gnc:gnc-monetary-amount fromunits)
-                                         (if use-txn
-                                             (gnc:gnc-monetary-amount price)
-                                             (gnc-price-get-value price))
-                                         currency-frac GNC-RND-ROUND))
-                      tocurrency)
-                    (exchange-fn fromunits tocurrency)))
-
-            (gnc:debug "Starting account " (xaccAccountGetName current) ", initial price: "
-                   (if price
-                     (gnc-commodity-value->string
-	 	         (list (gnc-price-get-currency price) (gnc-price-get-value price)))
-	 	     #f))
-
-            ;; If we have a price that can't be converted to the report currency
-            ;; don't use it
-            (if (and price (gnc-numeric-zero-p (gnc:gnc-monetary-amount
-                                       (exchange-fn
-                                          (gnc:make-gnc-monetary
-                                            (gnc-price-get-currency price)
-                                            (gnc:make-gnc-numeric 100 1))
-                                          currency))))
-                (set! price #f))
-
-            ;; If we are told to use a pricing transaction, or if we don't have a price
-            ;; from the price DB, find a good transaction to use.
-            (if (and (not use-txn)
-                     (or (not price) (not prefer-pricelist)))
-                  (let ((split-list (reverse (gnc:get-match-commodity-splits-sorted
-                                                 (list current)
-                                                 (case price-source
-                                                   ((pricedb-latest) (gnc:get-today))
-                                                   ((pricedb-nearest) to-date)
-                                                   (else (gnc:get-today)))  ;; error, but don't crash
-                                                 #f))))  ;; Any currency
-                        ;; Find the first (most recent) one that can be converted to report currency
-                        (while (and (not use-txn) (not (eqv? split-list '())))
-                          (let ((split (car split-list)))
-                            (if (and (not (gnc-numeric-zero-p (xaccSplitGetAmount split)))
-                                     (not (gnc-numeric-zero-p (xaccSplitGetValue split))))
-                              (let* ((trans (xaccSplitGetParent split))
-                                     (trans-currency (xaccTransGetCurrency trans))
-                                     (trans-price (exchange-fn (gnc:make-gnc-monetary
-                                                                   trans-currency
-                                                                   (xaccSplitGetSharePrice split))
-                                                               currency)))
-                                (if (not (gnc-numeric-zero-p (gnc:gnc-monetary-amount trans-price)))
-                                  ;; We can exchange the price from this transaction into the report currency
-                                  (begin
-                                    (if price (gnc-price-unref price))
-                                    (set! pricing-txn trans)
-                                    (set! price trans-price)
-                                    (gnc:debug "Transaction price is " (gnc:monetary->string price))
-                                    (set! use-txn #t))
-                                  (set! split-list (cdr split-list))))
-                              (set! split-list (cdr split-list)))
-                            ))))
-
-            ;; If we still don't have a price, use a price of 1 and complain later
-            (if (not price)
-              (begin
-                (set! price (gnc:make-gnc-monetary currency (gnc:make-gnc-numeric 1 1)))
-                ;; If use-txn is set, but pricing-txn isn't set, it's a bogus price
-                (set! use-txn #t)
-                (set! pricing-txn #f)
-              )
-            )
-
-            ;; Now that we have a pricing transaction if needed, set the value of the asset
-            (set! value (my-exchange-fn (gnc:make-gnc-monetary commodity units) currency))
-            (gnc:debug "Value " (gnc:monetary->string value)
-                       " from " (gnc-commodity-numeric->string commodity units))
-
-	    (for-each
-	     ;; we're looking at each split we find in the account. these splits
-	     ;; could refer to the same transaction, so we have to examine each
-	     ;; split, determine what kind of split it is and then act accordingly.
-	     (lambda (split)
-	       (set! work-done (+ 1 work-done))
-	       (gnc:report-percent-done (* 100 (/ work-done work-to-do)))
-
-	       (let* ((parent (xaccSplitGetParent split))
-		      (txn-date (gnc-transaction-get-date-posted parent))
-		      (commod-currency (xaccTransGetCurrency parent))
-		      (commod-currency-frac (gnc-commodity-get-fraction commod-currency)))
-
-		 (if (and (gnc:timepair-le txn-date to-date)
-		          (not (assoc-ref seen_trans (gncTransGetGUID parent))))
-		     (let ((trans-income (gnc-numeric-zero))
-		           (trans-brokerage (gnc-numeric-zero))
-		           (trans-shares (gnc-numeric-zero))
-		           (shares-bought (gnc-numeric-zero))
-		           (trans-sold (gnc-numeric-zero))
-		           (trans-bought (gnc-numeric-zero))
-		           (trans-spinoff (gnc-numeric-zero))
-		           (trans-drp-residual (gnc-numeric-zero))
-		           (trans-drp-account #f))
-
-		       (gnc:debug "Transaction " (xaccTransGetDescription parent))
-		       ;; Add this transaction to the list of processed transactions so we don't
-		       ;; do it again if there is another split in it for this account
-		       (set! seen_trans (acons (gncTransGetGUID parent) #t seen_trans))
-
-		       ;; Go through all the splits in the transaction to get an overall idea of
-		       ;; what it does in terms of income, money in or out, shares bought or sold, etc.
-		       (for-each
-		         (lambda (s)
-                           (let ((split-units (xaccSplitGetAmount s))
-                                 (split-value (xaccSplitGetValue s)))
-
-                             (gnc:debug "Pass 1: split units " (gnc-numeric-to-string split-units) " split-value "
-                                        (gnc-numeric-to-string split-value) " commod-currency "
-                                        (gnc-commodity-get-printname commod-currency))
-
-                             (cond
-                                ((split-account-type? s ACCT-TYPE-EXPENSE)
-                                 ;; Brokerage expense unless a two split transaction with other split
-                                 ;; in the stock account in which case it's a stock donation to charity.
-                                 (if (not (same-account? current (xaccSplitGetAccount (xaccSplitGetOtherSplit s))))
-                                   (set! trans-brokerage
-                                         (gnc-numeric-add trans-brokerage split-value commod-currency-frac GNC-RND-ROUND))))
-
-                                ((split-account-type? s ACCT-TYPE-INCOME)
-                                 (set! trans-income (gnc-numeric-sub trans-income split-value
-                                                             commod-currency-frac GNC-RND-ROUND)))
-
-                                ((same-account? current (xaccSplitGetAccount s))
-                                 (set! trans-shares (gnc-numeric-add trans-shares (gnc-numeric-abs split-units)
-                                                  units-denom GNC-RND-ROUND))
-                                 (if (gnc-numeric-zero-p split-units)
-                                     (if (spin-off? s current)
-                                         ;; Count money used in a spin off as money out
-                                         (if (gnc-numeric-negative-p split-value)
-                                             (set! trans-spinoff (gnc-numeric-sub trans-spinoff split-value
-                                                                                  commod-currency-frac GNC-RND-ROUND)))
-                                         (if (not (gnc-numeric-zero-p split-value))
-                                              ;; Gain/loss split (amount zero, value non-zero, and not spinoff).  There will be
-                                              ;; a corresponding income split that will incorrectly be added to trans-income
-                                              ;; Fix that by subtracting it here
-                                              (set! trans-income (gnc-numeric-sub trans-income split-value
-                                                                                  commod-currency-frac GNC-RND-ROUND))))
-                                     ;; Non-zero amount, add the value to the sale or purchase total.
-                                     (if (gnc-numeric-positive-p split-value)
-                                          (begin
-                                             (set! trans-bought
-                                                  (gnc-numeric-add trans-bought split-value commod-currency-frac GNC-RND-ROUND))
-                                             (set! shares-bought
-                                                  (gnc-numeric-add shares-bought split-units units-denom GNC-RND-ROUND)))
-                                          (set! trans-sold
-                                               (gnc-numeric-sub trans-sold split-value commod-currency-frac GNC-RND-ROUND)))))
-
-                                ((split-account-type? s ACCT-TYPE-ASSET)
-                                 ;; If all the asset accounts mentioned in the transaction are siblings of each other
-                                 ;; keep track of the money transferred to them if it is in the correct currency
-                                 (if (not trans-drp-account)
-                                     (begin
-                                       (set! trans-drp-account (xaccSplitGetAccount s))
-                                         (if (gnc-commodity-equiv commod-currency (xaccAccountGetCommodity trans-drp-account))
-                                             (set! trans-drp-residual split-value)
-                                             (set! trans-drp-account 'none)))
-                                     (if (not (eq? trans-drp-account 'none))
-                                       (if (parent-or-sibling? trans-drp-account (xaccSplitGetAccount s))
-                                           (set! trans-drp-residual (gnc-numeric-add trans-drp-residual split-value
-                                                                                     commod-currency-frac GNC-RND-ROUND))
-                                           (set! trans-drp-account 'none))))))
-		         ))
-		         (xaccTransGetSplitList parent)
-		       )
-
-		       (gnc:debug "Income: " (gnc-numeric-to-string trans-income)
-		                  " Brokerage: " (gnc-numeric-to-string trans-brokerage)
-		                  " Shares traded: " (gnc-numeric-to-string trans-shares)
-		                  " Shares bought: " (gnc-numeric-to-string shares-bought))
-		       (gnc:debug " Value sold: " (gnc-numeric-to-string trans-sold)
-		                  " Value purchased: " (gnc-numeric-to-string trans-bought)
-		                  " Spinoff value " (gnc-numeric-to-string trans-spinoff)
-		                  " Trans DRP residual: " (gnc-numeric-to-string trans-drp-residual))
-
-		       ;; We need to calculate several things for this transaction:
-		       ;; 1. Total income: this is already in trans-income
-		       ;; 2. Change in basis: calculated by loop below that looks at every
-		       ;;    that acquires or disposes of shares
-		       ;; 3. Realized gain: also calculated below while calculating basis
-		       ;; 4. Money in to the account: this is the value of shares bought
-		       ;;    except those purchased with reinvested income
-		       ;; 5. Money out: the money received by disposing of shares.   This
-		       ;;    is in trans-sold plus trans-spinoff
-		       ;; 6. Brokerage fees: this is in trans-brokerage
-
-		       ;; Income
-		       (dividendcoll 'add commod-currency trans-income)
-
-                       ;; Brokerage fees.  May be either ignored or part of basis, but that
-                       ;; will be dealt with elsewhere.
-                       (brokeragecoll 'add commod-currency trans-brokerage)
-
-                       ;; Add brokerage fees to trans-bought if not ignoring them and there are any
-                       (if (and (not (eq? handle-brokerage-fees 'ignore-brokerage))
-                                (gnc-numeric-positive-p trans-brokerage)
-                                (gnc-numeric-positive-p trans-shares))
-                           (let* ((fee-frac (gnc-numeric-div shares-bought trans-shares GNC-DENOM-AUTO GNC-DENOM-REDUCE))
-                                  (fees (gnc-numeric-mul trans-brokerage fee-frac commod-currency-frac GNC-RND-ROUND)))
-                                 (set! trans-bought (gnc-numeric-add trans-bought fees commod-currency-frac GNC-RND-ROUND))))
-
-                       ;; Update the running total of the money in the DRP residual account.  This is relevant
-                       ;; if this is a reinvestment transaction (both income and purchase) and there seems to
-                       ;; asset accounts used to hold excess income.
-                       (if (and trans-drp-account
-                                (not (eq? trans-drp-account 'none))
-                                (gnc-numeric-positive-p trans-income)
-                                (gnc-numeric-positive-p trans-bought))
-                           (if (not drp-holding-account)
-                               (begin
-                                 (set! drp-holding-account trans-drp-account)
-                                 (set! drp-holding-amount trans-drp-residual))
-                               (if (and (not (eq? drp-holding-account 'none))
-                                        (parent-or-sibling? trans-drp-account drp-holding-account))
-                                   (set! drp-holding-amount (gnc-numeric-add drp-holding-amount trans-drp-residual
-                                                                              commod-currency-frac GNC-RND-ROUND))
-                                   (begin
-                                     ;; Wrong account (or no account), assume there isn't a DRP holding account
-                                     (set! drp-holding-account 'none)
-                                     (set trans-drp-residual (gnc-numeric-zero))
-                                     (set! drp-holding-amount (gnc-numeric-zero))))))
-
-                       ;; Set trans-bought to the amount of money moved in to the account which was used to
-                       ;; purchase more shares.  If this is not a DRP transaction then all money used to purchase
-                       ;; shares is money in.
-                       (if (and (gnc-numeric-positive-p trans-income)
-                                (gnc-numeric-positive-p trans-bought))
-                           (begin
-                             (set! trans-bought (gnc-numeric-sub trans-bought trans-income
-                                                                 commod-currency-frac GNC-RND-ROUND))
-                             (set! trans-bought (gnc-numeric-add trans-bought trans-drp-residual
-                                                                 commod-currency-frac GNC-RND-ROUND))
-                             (set! trans-bought (gnc-numeric-sub trans-bought drp-holding-amount
-                                                                 commod-currency-frac GNC-RND-ROUND))
-                             ;; If the DRP holding account balance is negative, adjust it by the amount
-                             ;; used in this transaction
-                             (if (and (gnc-numeric-negative-p drp-holding-amount)
-                                      (gnc-numeric-positive-p trans-bought))
-                                 (set! drp-holding-amount (gnc-numeric-add drp-holding-amount trans-bought
-                                                                           commod-currency-frac GNC-RND-ROUND)))
-                             ;; Money in is never more than amount spent to purchase shares
-                             (if (gnc-numeric-negative-p trans-bought)
-                                 (set! trans-bought (gnc-numeric-zero)))))
-
-                       (gnc:debug "Adjusted trans-bought " (gnc-numeric-to-string trans-bought)
-                                  " DRP holding account " (gnc-numeric-to-string drp-holding-amount))
-
-                       (moneyincoll 'add commod-currency trans-bought)
-                       (moneyoutcoll 'add commod-currency trans-sold)
-                       (moneyoutcoll 'add commod-currency trans-spinoff)
-
-                       ;; Look at splits again to handle changes in basis and realized gains
-		       (for-each
-		         (lambda (s)
-                           (let
-                              ;; get the split's units and value
-                              ((split-units (xaccSplitGetAmount s))
-                               (split-value (xaccSplitGetValue s)))
-
-                             (gnc:debug "Pass 2: split units " (gnc-numeric-to-string split-units) " split-value "
-                                        (gnc-numeric-to-string split-value) " commod-currency "
-                                        (gnc-commodity-get-printname commod-currency))
-
-                             (cond
-                               ((and (not (gnc-numeric-zero-p split-units))
-                                     (same-account? current (xaccSplitGetAccount s)))
-                                ;; Split into subject account with non-zero amount.  This is a purchase
-                                ;; or a sale, adjust the basis
-				(let* ((split-value-currency (gnc:gnc-monetary-amount
-								(my-exchange-fn (gnc:make-gnc-monetary
-								   commod-currency split-value) currency)))
-			               (orig-basis (sum-basis basis-list currency-frac))
-			               ;; proportion of the fees attributable to this split
-			               (fee-ratio (gnc-numeric-div (gnc-numeric-abs split-units) trans-shares
-			                                           GNC-DENOM-AUTO GNC-DENOM-REDUCE))
-			               ;; Fees for this split in report currency
-			               (fees-currency (gnc:gnc-monetary-amount (my-exchange-fn
-			                               (gnc:make-gnc-monetary commod-currency
-			                                 (gnc-numeric-mul fee-ratio trans-brokerage
-			                                                commod-currency-frac GNC-RND-ROUND))
-			                                currency)))
-			               (split-value-with-fees (if (eq? handle-brokerage-fees 'include-in-basis)
-			                                          ;; Include brokerage fees in basis
-			                                          (gnc-numeric-add split-value-currency fees-currency
-			                                                        currency-frac GNC-RND-ROUND)
-			                                          split-value-currency)))
-                                  (gnc:debug "going in to basis list " basis-list " " (gnc-numeric-to-string split-units) " "
-                                             (gnc-numeric-to-string split-value-with-fees))
-
-				  ;; adjust the basis
-				  (set! basis-list (basis-builder basis-list split-units split-value-with-fees
-								  basis-method currency-frac))
-                                  (gnc:debug  "coming out of basis list " basis-list)
-
-                                  ;; If it's a sale or the stock is worthless, calculate the gain
-                                  (if (not (gnc-numeric-positive-p split-value))
-                                       ;; Split value is zero or negative.  If it's zero it's either a stock split/merge
-                                       ;; or the stock has become worthless (which looks like a merge where the number
-                                       ;; of shares goes to zero).  If the value is negative then it's a disposal of some sort.
-                                       (let ((new-basis (sum-basis basis-list currency-frac)))
-                                              (if (or (gnc-numeric-zero-p new-basis)
-                                                      (gnc-numeric-negative-p split-value))
-                                                ;; Split value is negative or new basis is zero (stock is worthless),
-                                                ;; Capital gain is money out minus change in basis
-                                                (let ((gain (gnc-numeric-sub (gnc-numeric-abs split-value-with-fees)
-                                                                          (gnc-numeric-sub orig-basis new-basis
-                                                                                           currency-frac GNC-RND-ROUND)
-                                                                          currency-frac GNC-RND-ROUND)))
-                                                       (gnc:debug "Old basis=" (gnc-numeric-to-string orig-basis)
-                                                                  " New basis=" (gnc-numeric-to-string new-basis)
-                                                                  " Gain=" (gnc-numeric-to-string gain))
-                                                       (gaincoll 'add currency gain)))))))
-
-                               ;; here is where we handle a spin-off txn. This will be a no-units
-                               ;; split with only one other split. xaccSplitGetOtherSplit only
-                               ;; returns on a two-split txn.  It's not a spinoff is the other split is
-                               ;; in an income or expense account.
-                               ((spin-off? s current)
-                                  (gnc:debug "before spin-off basis list " basis-list)
-                                  (set! basis-list (basis-builder basis-list split-units (gnc:gnc-monetary-amount
-                                                                                          (my-exchange-fn (gnc:make-gnc-monetary
-                                                                                                        commod-currency split-value)
-                                                                                                       currency))
-                                                                                                       basis-method
-                                                                                                       currency-frac))
-                                  (gnc:debug "after spin-off basis list "  basis-list))
-                             )
-		         ))
-		         (xaccTransGetSplitList parent)
-		       )
-		      )
-		   )
-		 )
-	       )
-	     (xaccAccountGetSplitList current)
-	     )
-
-	    ;; Look for income and expense transactions that don't have a split in the
-	    ;; the account we're processing.  We do this as follow
-	    ;; 1. Make sure the parent account is a currency-valued asset or bank account
-	    ;; 2. If so go through all the splits in that account
-	    ;; 3. If a split is part of a two split transaction where the other split is
-	    ;;    to an income or expense account and the leaf name of that account is the
-	    ;;    same as the leaf name of the account we're processing, add it to the
-	    ;;    income or expense accumulator
-	    ;;
-	    ;; In other words with an account structure like
-	    ;;
-	    ;;   Assets (type ASSET)
-	    ;;     Broker (type ASSET)
-	    ;;       Widget Stock (type STOCK)
-	    ;;   Income (type INCOME)
-	    ;;     Dividends (type INCOME)
-	    ;;       Widget Stock (type INCOME)
-	    ;;
-	    ;; If you are producing a report on "Assets:Broker:Widget Stock" a
-	    ;; transaction that debits the Assets:Broker account and credits the
-	    ;; "Income:Dividends:Widget Stock" account will count as income in
-	    ;; the report even though it doesn't have a split in the account
-	    ;; being reported on.
-
-	    (let ((parent-account (gnc-account-get-parent current))
-	          (account-name (xaccAccountGetName current)))
-	      (if (and (not (null? parent-account))
-	               (member (xaccAccountGetType parent-account) (list ACCT-TYPE-ASSET ACCT-TYPE-BANK))
-	               (gnc-commodity-is-currency (xaccAccountGetCommodity parent-account)))
-	        (for-each
-	          (lambda (split)
-	            (let* ((other-split (xaccSplitGetOtherSplit split))
-	                   ;; This is safe because xaccSplitGetAccount returns null for a null split
-	                   (other-acct (xaccSplitGetAccount other-split))
-	                   (parent (xaccSplitGetParent split))
-	                   (txn-date (gnc-transaction-get-date-posted parent)))
-	              (if (and (not (null? other-acct))
-	                       (gnc:timepair-le txn-date to-date)
-	                       (string=? (xaccAccountGetName other-acct) account-name)
-	                       (gnc-commodity-is-currency (xaccAccountGetCommodity other-acct)))
-	                ;; This is a two split transaction where the other split is to an
-	                ;; account with the same name as the current account.  If it's an
-	                ;; income or expense account accumulate the value of the transaction
-	                (let ((val (xaccSplitGetValue split))
-	                      (curr (xaccAccountGetCommodity other-acct)))
-                          (cond ((split-account-type? other-split ACCT-TYPE-INCOME)
-	                         (gnc:debug "More income " (gnc-numeric-to-string val))
-	                         (dividendcoll 'add curr val))
-                                ((split-account-type? other-split ACCT-TYPE-EXPENSE)
-                                 (gnc:debug "More expense " (gnc-numeric-to-string
-                                                             (gnc-numeric-neg val)))
-                                 (brokeragecoll 'add curr (gnc-numeric-neg val)))
-	                  )
-	                )
-	              )
-	            )
-	          )
-	          (xaccAccountGetSplitList parent-account)
-	        )
-	      )
-	    )
-
-	    (gnc:debug "pricing txn is " pricing-txn)
-	    (gnc:debug "use txn is " use-txn)
-	    (gnc:debug "prefer-pricelist is " prefer-pricelist)
-	    (gnc:debug "price is " price)
-
-	    (gnc:debug "basis we're using to build rows is " (gnc-numeric-to-string (sum-basis basis-list
-	                                                            currency-frac)))
-	    (gnc:debug "but the actual basis list is " basis-list)
-
-            (if (eq? handle-brokerage-fees 'include-in-gain)
-	      (gaincoll 'minusmerge brokeragecoll #f))
-
-	  (if (or include-empty (not (gnc-numeric-zero-p units)))
-	    (let* ((moneyin (gnc:sum-collector-commodity moneyincoll currency my-exchange-fn))
-		  (moneyout (gnc:sum-collector-commodity moneyoutcoll currency my-exchange-fn))
-                  (brokerage (gnc:sum-collector-commodity brokeragecoll currency my-exchange-fn))
-		  (income (gnc:sum-collector-commodity dividendcoll currency my-exchange-fn))
-		  ;; just so you know, gain == realized gain, ugain == un-realized gain, bothgain, well..
-		  (gain (gnc:sum-collector-commodity gaincoll currency my-exchange-fn))
-		  (ugain (gnc:make-gnc-monetary currency
-						(gnc-numeric-sub (gnc:gnc-monetary-amount (my-exchange-fn value currency))
-								 (sum-basis basis-list (gnc-commodity-get-fraction currency))
-								 currency-frac GNC-RND-ROUND)))
-		  (bothgain (gnc:make-gnc-monetary currency  (gnc-numeric-add (gnc:gnc-monetary-amount gain)
-									      (gnc:gnc-monetary-amount ugain)
-									      currency-frac GNC-RND-ROUND)))
-		  (totalreturn (gnc:make-gnc-monetary currency (gnc-numeric-add (gnc:gnc-monetary-amount bothgain)
-										    (gnc:gnc-monetary-amount income)
-										currency-frac GNC-RND-ROUND)))
-
-		  (activecols (list (gnc:html-account-anchor current)))
-		  )
-
-              ;; If we're using the txn, warn the user
-              (if use-txn
-                  (if pricing-txn
-                      (set! warn-price-dirty #t)
-                      (set! warn-no-price #t)
-                  ))
-
-	      (total-value 'add (gnc:gnc-monetary-commodity value) (gnc:gnc-monetary-amount value))
-	      (total-moneyin 'merge moneyincoll #f)
-	      (total-moneyout 'merge moneyoutcoll #f)
-              (total-brokerage 'merge brokeragecoll #f)
-	      (total-income 'merge dividendcoll #f)
-	      (total-gain 'merge gaincoll #f)
-	      (total-ugain 'add (gnc:gnc-monetary-commodity ugain) (gnc:gnc-monetary-amount ugain))
-	      (total-basis 'add currency (sum-basis basis-list currency-frac))
-
-	      ;; build a list for the row  based on user selections
-	      (if show-symbol (append! activecols (list (gnc:make-html-table-header-cell/markup "text-cell" ticker-symbol))))
-	      (if show-listing (append! activecols (list (gnc:make-html-table-header-cell/markup "text-cell" listing))))
-	      (if show-shares (append! activecols (list (gnc:make-html-table-header-cell/markup
- 	        "number-cell" (xaccPrintAmount units share-print-info)))))
-	      (if show-price (append! activecols (list (gnc:make-html-table-header-cell/markup
-	        "number-cell"
-	        (if use-txn
-	            (if pricing-txn
-                        (gnc:html-transaction-anchor
-                         pricing-txn
-                         price
-                         )
-                         price
-                     )
-	 	    (gnc:html-price-anchor
-	 	     price
-	 	     (gnc:make-gnc-monetary
-	  	     (gnc-price-get-currency price)
-		     (gnc-price-get-value price)))
-		    )))))
- 	      (append! activecols (list (if use-txn (if pricing-txn "*" "**") " ")
-					(gnc:make-html-table-header-cell/markup
-					 "number-cell" (gnc:make-gnc-monetary currency (sum-basis basis-list
-					                         currency-frac)))
-					(gnc:make-html-table-header-cell/markup "number-cell" value)
-					(gnc:make-html-table-header-cell/markup "number-cell" moneyin)
-					(gnc:make-html-table-header-cell/markup "number-cell" moneyout)
-					(gnc:make-html-table-header-cell/markup "number-cell" gain)
-					(gnc:make-html-table-header-cell/markup "number-cell" ugain)
-					(gnc:make-html-table-header-cell/markup "number-cell" bothgain)
-					(gnc:make-html-table-header-cell/markup "number-cell"
-					    (let* ((moneyinvalue (gnc-numeric-to-double
-								  (gnc:gnc-monetary-amount moneyin)))
-					           (bothgainvalue (gnc-numeric-to-double
-								   (gnc:gnc-monetary-amount bothgain)))
-                                             )
-					      (if (= 0.0 moneyinvalue)
-						  ""
-						  (sprintf #f "%.2f%%" (* 100 (/ bothgainvalue moneyinvalue)))))
-					)
-					(gnc:make-html-table-header-cell/markup "number-cell" income)))
-	      (if (not (eq? handle-brokerage-fees 'ignore-brokerage))
-		  (append! activecols (list (gnc:make-html-table-header-cell/markup "number-cell" brokerage))))
-	      (append! activecols (list (gnc:make-html-table-header-cell/markup "number-cell" totalreturn)
-					(gnc:make-html-table-header-cell/markup "number-cell"
-					    (let* ((moneyinvalue (gnc-numeric-to-double
-								  (gnc:gnc-monetary-amount moneyin)))
-					           (totalreturnvalue (gnc-numeric-to-double
-								      (gnc:gnc-monetary-amount totalreturn)))
-                                             )
-					      (if (= 0.0 moneyinvalue)
-						  ""
-						  (sprintf #f "%.2f%%" (* 100 (/ totalreturnvalue moneyinvalue))))))
-					 )
-			)
-
-	      (gnc:html-table-append-row/markup!
-	       table
-	       row-style
-	       activecols)
-
-              (if (and (not use-txn) price) (gnc-price-unref price))
-	      (table-add-stock-rows-internal rest (not odd-row?))
-	      )
-	    (begin
-	      (if (and (not use-txn) price) (gnc-price-unref price))
-	      (table-add-stock-rows-internal rest odd-row?)
-	      )
-            )
-	    )))
-
-    (set! work-to-do (gnc:accounts-count-splits accounts))
-    (table-add-stock-rows-internal accounts #t)))
-
-  ;; Tell the user that we're starting.
-  (gnc:report-starting reportname)
-
-  ;; The first thing we do is make local variables for all the specific
-  ;; options in the set of options given to the function. This set will
-  ;; be generated by the options generator above.
-  (let ((to-date     (gnc:date-option-absolute-time
-                      (get-option gnc:pagename-general "Date")))
-        (accounts    (get-option gnc:pagename-accounts "Accounts"))
-        (currency    (get-option gnc:pagename-general "Report's currency"))
-        (price-source (get-option gnc:pagename-general
-                                  optname-price-source))
-        (report-title (get-option gnc:pagename-general
-                                  gnc:optname-reportname))
-        (include-empty (get-option gnc:pagename-accounts
-                                  optname-zero-shares))
-	(show-symbol (get-option gnc:pagename-display
-				  optname-show-symbol))
-	(show-listing (get-option gnc:pagename-display
-				  optname-show-listing))
-	(show-shares (get-option gnc:pagename-display
-				  optname-show-shares))
-	(show-price (get-option gnc:pagename-display
-				  optname-show-price))
-	(basis-method (get-option gnc:pagename-general
-				  optname-basis-method))
-	(prefer-pricelist (get-option gnc:pagename-general
-				      optname-prefer-pricelist))
-	(handle-brokerage-fees (get-option gnc:pagename-general
-				  optname-brokerage-fees))
-
-	(total-basis (gnc:make-commodity-collector))
-        (total-value    (gnc:make-commodity-collector))
-        (total-moneyin  (gnc:make-commodity-collector))
-        (total-moneyout (gnc:make-commodity-collector))
-        (total-income   (gnc:make-commodity-collector))
-        (total-gain     (gnc:make-commodity-collector)) ;; realized gain
-	(total-ugain (gnc:make-commodity-collector))    ;; unrealized gain
-        (total-brokerage (gnc:make-commodity-collector))
-	;;document will be the HTML document that we return.
-        (table (gnc:make-html-table))
-        (document (gnc:make-html-document)))
-
-    (gnc:html-document-set-title!
-     document (string-append
-               report-title
-               (sprintf #f " %s" (gnc-print-date to-date))))
-
-    (if (not (null? accounts))
-        ; at least 1 account selected
-        (let* ((exchange-fn (gnc:case-exchange-fn price-source currency to-date))
-               (pricedb (gnc-pricedb-get-db (gnc-get-current-book)))
-               (price-fn
-                (case price-source
-                  ((pricedb-latest)
-                   (lambda (foreign domestic date)
-                    (find-price (gnc-pricedb-lookup-latest-any-currency pricedb foreign)
-                                domestic)))
-                  ((pricedb-nearest)
-                   (lambda (foreign domestic date)
-                    (find-price (gnc-pricedb-lookup-nearest-in-time-any-currency
-		     pricedb foreign (timespecCanonicalDayTime date)) domestic)))))
-	       (headercols (list (_ "Account")))
-	       (totalscols (list (gnc:make-html-table-cell/markup "total-label-cell" (_ "Total"))))
-	       (sum-total-moneyin (gnc-numeric-zero))
-	       (sum-total-income (gnc-numeric-zero))
-	       (sum-total-both-gains (gnc-numeric-zero))
-	       (sum-total-gain (gnc-numeric-zero))
-	       (sum-total-ugain (gnc-numeric-zero))
-	       (sum-total-brokerage (gnc-numeric-zero))
-	       (sum-total-totalreturn (gnc-numeric-zero))) ;;end of let
-
-	  ;;begin building lists for which columns to display
-          (if show-symbol
-	      (begin (append! headercols (list (_ "Symbol")))
-		     (append! totalscols (list " "))))
-
-	  (if show-listing
-	      (begin (append! headercols (list (_ "Listing")))
-		     (append! totalscols (list " "))))
-
-	  (if show-shares
-	      (begin (append! headercols (list (_ "Shares")))
-		     (append! totalscols (list " "))))
-
-	  (if show-price
-	      (begin (append! headercols (list (_ "Price")))
-		     (append! totalscols (list " "))))
-
-	  (append! headercols (list " "
-				    (_ "Basis")
-				    (_ "Value")
-				    (_ "Money In")
-				    (_ "Money Out")
-				    (_ "Realized Gain")
-				    (_ "Unrealized Gain")
-				    (_ "Total Gain")
-				    (_ "Rate of Gain")
-				    (_ "Income")))
-
-	  (if (not (eq? handle-brokerage-fees 'ignore-brokerage))
-	      (append! headercols (list (_ "Brokerage Fees"))))
-
-	  (append! headercols (list (_ "Total Return")
-				    (_ "Rate of Return")))
-
-          (append! totalscols (list " "))
-
-          (gnc:html-table-set-col-headers!
-           table
-	   headercols)
-
-          (table-add-stock-rows
-           table accounts to-date currency price-fn exchange-fn price-source
-           include-empty show-symbol show-listing show-shares show-price basis-method
-	   prefer-pricelist handle-brokerage-fees
-           total-basis total-value total-moneyin total-moneyout
-           total-income total-gain total-ugain total-brokerage)
-
-
-	  (set! sum-total-moneyin (gnc:sum-collector-commodity total-moneyin currency exchange-fn))
-	  (set! sum-total-income (gnc:sum-collector-commodity total-income currency exchange-fn))
-	  (set! sum-total-gain (gnc:sum-collector-commodity total-gain currency exchange-fn))
-	  (set! sum-total-ugain (gnc:sum-collector-commodity total-ugain currency exchange-fn))
-	  (set! sum-total-both-gains (gnc:make-gnc-monetary currency (gnc-numeric-add (gnc:gnc-monetary-amount sum-total-gain)
-										      (gnc:gnc-monetary-amount sum-total-ugain)
-										      (gnc-commodity-get-fraction currency) GNC-RND-ROUND)))
-	  (set! sum-total-brokerage (gnc:sum-collector-commodity total-brokerage currency exchange-fn))
-	  (set! sum-total-totalreturn (gnc:make-gnc-monetary currency (gnc-numeric-add (gnc:gnc-monetary-amount sum-total-both-gains)
-										           (gnc:gnc-monetary-amount sum-total-income)
-										       (gnc-commodity-get-fraction currency) GNC-RND-ROUND)))
-
-          (gnc:html-table-append-row/markup!
-           table
-           "grand-total"
-           (list
-            (gnc:make-html-table-cell/size
-             1 17 (gnc:make-html-text (gnc:html-markup-hr)))))
-
-	  ;; finish building the totals columns, now that totals are complete
-	  (append! totalscols (list
-			       (gnc:make-html-table-cell/markup
-				"total-number-cell" (gnc:sum-collector-commodity total-basis currency exchange-fn))
-			       (gnc:make-html-table-cell/markup
-				"total-number-cell" (gnc:sum-collector-commodity total-value currency exchange-fn))
-			       (gnc:make-html-table-cell/markup
-				"total-number-cell" sum-total-moneyin)
-			       (gnc:make-html-table-cell/markup
-				"total-number-cell" (gnc:sum-collector-commodity total-moneyout currency exchange-fn))
-			       (gnc:make-html-table-cell/markup
-				"total-number-cell" sum-total-gain)
-			       (gnc:make-html-table-cell/markup
-				"total-number-cell" sum-total-ugain)
-			       (gnc:make-html-table-cell/markup
-				"total-number-cell" sum-total-both-gains)
-			       (gnc:make-html-table-cell/markup
-				"total-number-cell"
-				(let* ((totalinvalue (gnc-numeric-to-double
-						      (gnc:gnc-monetary-amount sum-total-moneyin)))
-				       (totalgainvalue (gnc-numeric-to-double
-							(gnc:gnc-monetary-amount sum-total-both-gains)))
-				       )
-				  (if (= 0.0 totalinvalue)
-				      ""
-				      (sprintf #f "%.2f%%" (* 100 (/ totalgainvalue totalinvalue))))))
-			       (gnc:make-html-table-cell/markup
-				"total-number-cell" sum-total-income)))
-	  (if (not (eq? handle-brokerage-fees 'ignore-brokerage))
-	      (append! totalscols (list
-			       (gnc:make-html-table-cell/markup
-                                "total-number-cell" sum-total-brokerage))))
-	  (append! totalscols (list
-			       (gnc:make-html-table-cell/markup
-                                "total-number-cell" sum-total-totalreturn)
-			       (gnc:make-html-table-cell/markup
-				"total-number-cell"
-				(let* ((totalinvalue (gnc-numeric-to-double
-						      (gnc:gnc-monetary-amount sum-total-moneyin)))
-				       (totalreturnvalue (gnc-numeric-to-double
-						          (gnc:gnc-monetary-amount sum-total-totalreturn)))
-				 )
-				  (if (= 0.0 totalinvalue)
-				      ""
-				      (sprintf #f "%.2f%%" (* 100 (/ totalreturnvalue totalinvalue))))))
-			       ))
-
-
-          (gnc:html-table-append-row/markup!
-           table
-           "grand-total"
-           totalscols
-            )
-
-          (gnc:html-document-add-object! document table)
-          (if warn-price-dirty
-              (gnc:html-document-append-objects! document
-                                                 (list (gnc:make-html-text (_ "* this commodity data was built using transaction pricing instead of the price list."))
-						       (gnc:make-html-text (gnc:html-markup-br))
-						       (gnc:make-html-text (_ "If you are in a multi-currency situation, the exchanges may not be correct.")))))
-
-          (if warn-no-price
-              (gnc:html-document-append-objects! document
-                                                 (list (gnc:make-html-text (if warn-price-dirty (gnc:html-markup-br) ""))
-                                                       (gnc:make-html-text (_ "** this commodity has no price and a price of 1 has been used.")))))
-)
-
-					;if no accounts selected.
-        (gnc:html-document-add-object!
-         document
-	 (gnc:html-make-no-account-warning
-	  report-title (gnc:report-id report-obj))))
-
-    (gnc:report-finished)
-    document)))
-
-(gnc:define-report
- 'version 1
- 'report-guid "21d7cfc59fc74f22887596ebde7e462d"
- 'name reportname
- 'menu-path (list gnc:menuname-asset-liability)
- 'options-generator options-generator
- 'renderer advanced-portfolio-renderer)
diff --git a/src/report/standard-reports/budget-barchart.scm b/src/report/standard-reports/budget-barchart.scm
deleted file mode 100644
index 5e4973d..0000000
--- a/src/report/standard-reports/budget-barchart.scm
+++ /dev/null
@@ -1,379 +0,0 @@
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; net-barchart.scm : Display a time series for either net worth or
-;; net profit.
-;;
-;; By Robert Merkel <rgmerk at mira.net>
-;; and Christian Stimming <stimming at tu-harburg.de>
-;;
-;; 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 at gnu.org
-;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-(define-module (gnucash report standard-reports budget-barchart))
-
-(use-modules (srfi srfi-1))
-(use-modules (gnucash main)) ;; FIXME: delete after we finish modularizing.
-(use-modules (gnucash gnc-module))
-(use-modules (gnucash gettext))
-
-(use-modules (gnucash printf))
-
-(gnc:module-load "gnucash/report/report-system" 0)
-
-;; included since Bug726449
-(use-modules (ice-9 regex)) ;; for regexp-substitute/global, used by jpqplot
-(load-from-path "html-jqplot") ;; for jqplot-escape-string
-
-(define reportname (N_ "Budget Chart"))
-
-(define optname-accounts (N_ "Accounts"))
-(define optname-budget (N_ "Budget"))
-
-(define optname-running-sum (N_ "Running Sum"))
-(define optname-chart-type (N_ "Chart Type"))
-(define optname-plot-width (N_ "Plot Width"))
-(define optname-plot-height (N_ "Plot Height"))
-(define optname-from-date (N_ "Start Date"))
-(define optname-to-date (N_ "End Date"))
-
-(define optname-depth-limit (N_ "Levels of Subaccounts"))
-(define opthelp-depth-limit
-  (N_ "Maximum number of levels in the account tree displayed."))
-
-;(define (options-generator inc-exp?)
-(define (options-generator)
-  (let* (
-      (options (gnc:new-options)) 
-      ;; This is just a helper function for making options.
-      ;; See gnucash/src/scm/options.scm for details.
-      (add-option 
-        (lambda (new-option)
-          (gnc:register-option options new-option)))
-    )
-    ;; Option to select Budget
-    (add-option (gnc:make-budget-option
-        gnc:pagename-general optname-budget
-        "a" (N_ "Budget to use.")))
-
-    ;; date interval
-    (gnc:options-add-date-interval!
-     options gnc:pagename-general
-     optname-from-date optname-to-date "b")
-
-    ;; Option to select the accounts to that will be displayed
-    (add-option (gnc:make-account-list-option
-        gnc:pagename-accounts optname-accounts
-        "c" (N_ "Report on these accounts.")
-        (lambda ()
-	  (gnc:filter-accountlist-type
-	    (list ACCT-TYPE-BANK ACCT-TYPE-ASSET ACCT-TYPE-LIABILITY)
-	    (gnc-account-get-descendants-sorted (gnc-get-current-root-account))))
-        #f #t))
-
-    (gnc:options-add-account-levels!
-     options gnc:pagename-accounts optname-depth-limit
-     "d" opthelp-depth-limit 6)
-
-    ;; Display tab
-    (add-option
-     (gnc:make-simple-boolean-option
-      gnc:pagename-display 
-      optname-running-sum
-      "a"
-      (N_ "Calculate as running sum?")
-      #t))
-
-    ;; Display tab
-    (add-option
-      (gnc:make-multichoice-option
-        gnc:pagename-display                  ;; tab name
-        optname-chart-type                    ;; displayed option name
-        "b"                                   ;; localization in the tab
-        (N_ "This is a multi choice option.") ;; option help text
-        'bars                                 ;; default selectioin
-        (list
-          (list->vector
-            (list 'bars
-                  (N_ "Barchart")
-                  (N_ "Show the report as a bar chart.")
-            )
-          )
-          (list->vector
-            (list 'lines
-                  (N_ "Linechart")
-                  (N_ "Show the report as a line chart.")
-            )
-          )
-        )
-      )
-    )
-
-    (gnc:options-add-plot-size! 
-     options gnc:pagename-display 
-     optname-plot-width optname-plot-height "c" (cons 'percent 100.0) (cons 'percent 100.0))
-
-    ;; Set default page
-    (gnc:options-set-default-section options gnc:pagename-general)
-
-    ;; Return options
-    options
-))
-
-
-;; For each period in the budget:
-;; Retrieve the budgeted running sum and actual running sum
-;; for bac chart.
-;;
-;; Create bar and and values
-;;
-(define (gnc:chart-create-budget-actual budget acct running-sum chart-type width height from-tp to-tp)
-  (let* (
-          (chart #f)
-          (report-start-time (car from-tp))
-          (report-end-time (car to-tp))
-        )
-
-    (if (eqv? chart-type 'bars)
-      (begin
-        ;; Setup barchart
-        (set! chart (gnc:make-html-barchart))
-        (gnc:html-barchart-set-title! chart (xaccAccountGetName acct))
-        (gnc:html-barchart-set-width! chart width)
-        (gnc:html-barchart-set-height! chart height)
-        (gnc:html-barchart-set-row-labels-rotated?! chart #t)
-        (gnc:html-barchart-set-col-labels!
-          chart (list (_ "Budget") (_ "Actual")))
-        (gnc:html-barchart-set-col-colors!
-          chart '("blue" "red"))
-      )
-      ;; else
-      (begin
-        ;; Setup linechart
-        (set! chart (gnc:make-html-linechart))
-        (gnc:html-linechart-set-title! chart (xaccAccountGetName acct))
-        (gnc:html-linechart-set-width! chart width)
-        (gnc:html-linechart-set-height! chart height)
-        (gnc:html-linechart-set-row-labels-rotated?! chart #t)
-        (gnc:html-linechart-set-col-labels!
-          chart (list (_ "Budget") (_ "Actual")))
-        (gnc:html-linechart-set-col-colors!
-          chart '("blue" "red"))
-      )
-    )
-
-    ;; Prepair vars for running sums, and to loop though periods
-    (let* (
-        (num-periods (gnc-budget-get-num-periods budget))
-        (period 0)
-        (bgt-sum 0)
-        (act-sum 0)
-        (date (gnc-budget-get-period-start-date budget period))
-        (period-start-time (car date))
-        (bgt-vals '())
-        (act-vals '())
-        (date-iso-string-list '())
-        (save-fmt (qof-date-format-get))
-      )
-
-      ;; make sure jqplot receives the date strings in ISO format (Bug763257)
-      (qof-date-format-set QOF-DATE-FORMAT-ISO)
-
-      ;; Loop through periods
-      (while (< period num-periods)
-        ;;add calc new running sums
-	(if running-sum
-          (begin
-            (set! bgt-sum (+ bgt-sum
-              (gnc-numeric-to-double
-                (gnc:get-account-period-rolledup-budget-value budget acct period))))
-	    (set! act-sum (+ act-sum
-              (gnc-numeric-to-double
-                (gnc-budget-get-account-period-actual-value budget acct period))))
-          )
-        )
-        (if (<= report-start-time period-start-time)
-	  ;; within reporting period, update the display lists
-          (begin
-            (if (not running-sum)
-              (begin
-	        (set! bgt-sum
-                  (gnc-numeric-to-double
-                    (gnc:get-account-period-rolledup-budget-value budget acct period)))
-	        (set! act-sum
-                  (gnc-numeric-to-double
-                    (gnc-budget-get-account-period-actual-value budget acct period)))
-              )
-            )
-            (set! bgt-vals (append bgt-vals (list bgt-sum)))
-            (set! act-vals (append act-vals (list act-sum)))
-            (set! date-iso-string-list (append date-iso-string-list (list (gnc-print-date date))))
-          )
-        )
-        ;; prepare data for next loop repetition
-        (set! period (+ period 1))
-        (set! date (gnc-budget-get-period-start-date budget period))
-        (set! period-start-time (car date))
-        (if (< report-end-time period-start-time)
-          (set! period num-periods) ;; reporting period has ended, break the loop
-        )
-      )
-
-      ;; restore the date strings format
-      (qof-date-format-set save-fmt)
-
-      (if (eqv? chart-type 'bars)
-        (begin
-          ;; Add data to the bar chart
-          (gnc:html-barchart-append-column! chart bgt-vals)
-          (gnc:html-barchart-append-column! chart act-vals)
-          (gnc:html-barchart-set-row-labels! chart date-iso-string-list)
-          (if running-sum
-            (gnc:html-barchart-set-subtitle! chart
-              (string-append "Bgt:"
-                         (jqplot-escape-string (number->string bgt-sum))
-                         "<br /> Act:"
-                         (jqplot-escape-string (number->string act-sum))
-              )
-            )
-          )
-        )
-        ;; else
-        (begin
-          ;; Add data to the line chart
-          (gnc:html-linechart-append-column! chart bgt-vals)
-          (gnc:html-linechart-append-column! chart act-vals)
-          (gnc:html-linechart-set-row-labels! chart date-iso-string-list)
-          (if running-sum
-            (gnc:html-linechart-set-subtitle! chart
-              (string-append "Bgt:"
-                         (jqplot-escape-string (number->string bgt-sum))
-                         "<br /> Act:"
-                         (jqplot-escape-string (number->string act-sum))
-              )
-            )
-          )
-        )
-      )
-    )
-
-    ;; Return newly created chart
-    chart
-))
-
-
-;; This is the rendering function. It accepts a database of options
-;; and generates an object of type <html-document>.  See the file
-;; report-html.txt for documentation; the file report-html.scm
-;; includes all the relevant Scheme code. The option database passed
-;; to the function is one created by the options-generator function
-;; defined above.
-(define (net-renderer report-obj)
-
-  ;; This is a helper function for looking up option values.
-  (define (get-option section name)
-    (gnc:option-value 
-     (gnc:lookup-option (gnc:report-options report-obj) section name)))
-
-  ;; This is a helper function to find out the level of the account
-  ;; with in the account tree
-  (define (get-account-level account level)
-    (let (
-           (parent (gnc-account-get-parent account))
-         )
-      (cond
-        (
-          (null? parent) ;; exit
-          level
-        )
-        (else
-          (get-account-level parent (+ level 1))
-        )
-      )
-    )
-  )
-
-  (let* (
-      (budget (get-option gnc:pagename-general optname-budget))
-      (budget-valid? (and budget (not (null? budget))))
-      (running-sum (get-option gnc:pagename-display optname-running-sum))
-      (chart-type (get-option gnc:pagename-display optname-chart-type))
-      (height (get-option gnc:pagename-display optname-plot-height))
-      (width (get-option gnc:pagename-display optname-plot-width))
-      (accounts (get-option gnc:pagename-accounts optname-accounts))
-      (depth-limit (get-option gnc:pagename-accounts optname-depth-limit))
-      (report-title (get-option gnc:pagename-general
-        gnc:optname-reportname))
-      (document (gnc:make-html-document))
-      (from-date-tp (gnc:timepair-start-day-time
-                      (gnc:date-option-absolute-time
-                        (get-option gnc:pagename-general optname-from-date))))
-      (to-date-tp (gnc:timepair-end-day-time
-                    (gnc:date-option-absolute-time
-                      (get-option gnc:pagename-general optname-to-date))))
-    )
-    (cond
-      ((null? accounts)
-        ;; No accounts selected
-        (gnc:html-document-add-object!
-          document
-            (gnc:html-make-no-account-warning 
-              report-title (gnc:report-id report-obj))))
-
-      ((not budget-valid?)
-        ;; No budget selected.
-        (gnc:html-document-add-object!
-          document (gnc:html-make-generic-budget-warning reportname)))
-
-      ;; Else create chart for each account
-      (else
-        (for-each
-          (lambda (acct)
-            (if (or
-                  (and (equal? depth-limit 'all)
-                       (null? (gnc-account-get-descendants acct))
-                  )
-                  (and (not (equal? depth-limit 'all))
-                       (<= (get-account-level acct 0) depth-limit)
-                       (null? (gnc-account-get-descendants acct))
-                  )
-                  (and (not (equal? depth-limit 'all))
-                       (= (get-account-level acct 0) depth-limit)
-                  )
-                )
-              (gnc:html-document-add-object!
-                document
-                (gnc:chart-create-budget-actual budget acct running-sum chart-type width height from-date-tp to-date-tp)
-              )
-            )
-          )
-          accounts
-        )
-      )
-    ) ;; end cond
-    
-    document
-))
-
-;; Here we define the actual report
-(gnc:define-report
- 'version 1
- 'name reportname
- 'report-guid "415cd38d39054d9e9c4040455290c2b1"
- 'menu-path (list gnc:menuname-budget)
- 'options-generator (lambda () (options-generator))
- 'renderer (lambda (report-obj) (net-renderer report-obj)))
diff --git a/src/report/standard-reports/net-barchart.scm b/src/report/standard-reports/net-barchart.scm
deleted file mode 100644
index 5ccd285..0000000
--- a/src/report/standard-reports/net-barchart.scm
+++ /dev/null
@@ -1,480 +0,0 @@
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; net-barchart.scm : Display a time series for either net worth or
-;; net profit.
-;;
-;; By Robert Merkel <rgmerk at mira.net>
-;; and Christian Stimming <stimming at tu-harburg.de>
-;;
-;; 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 at gnu.org
-;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-(define-module (gnucash report standard-reports net-barchart))
-
-(use-modules (srfi srfi-1))
-(use-modules (gnucash main)) ;; FIXME: delete after we finish modularizing.
-(use-modules (gnucash gnc-module))
-(use-modules (gnucash gettext))
-
-(use-modules (gnucash printf))
-(use-modules (gnucash report report-system report-collectors))
-(use-modules (gnucash report report-system collectors))
-(use-modules (gnucash report standard-reports category-barchart)) ; for guids of called reports
-
-(gnc:module-load "gnucash/report/report-system" 0)
-
-;; included since Bug726449
-(use-modules (ice-9 regex)) ;; for regexp-substitute/global, used by jpqplot
-(load-from-path "html-jqplot") ;; for jqplot-escape-string
-
-(define reportname (N_ "Income/Expense Chart"))
-
-(define optname-from-date (N_ "Start Date"))
-(define optname-to-date (N_ "End Date"))
-(define optname-stepsize (N_ "Step Size"))
-(define optname-report-currency (N_ "Report's currency"))
-(define optname-price-source (N_ "Price Source"))
-
-(define optname-accounts (N_ "Accounts"))
-
-(define optname-inc-exp (N_ "Show Income/Expense"))
-(define optname-show-profit (N_ "Show Net Profit"))
-
-(define optname-sep-bars (N_ "Show Asset & Liability bars"))
-(define optname-net-bars (N_ "Show Net Worth bars"))
-
-(define optname-plot-width (N_ "Plot Width"))
-(define optname-plot-height (N_ "Plot Height"))
-
-(define (options-generator inc-exp?)
-  (let* ((options (gnc:new-options))
-         ;; This is just a helper function for making options.
-         ;; See gnucash/src/scm/options.scm for details.
-         (add-option
-          (lambda (new-option)
-            (gnc:register-option options new-option))))
-
-    ;; General tab
-    (gnc:options-add-date-interval!
-     options gnc:pagename-general
-     optname-from-date optname-to-date "a")
-
-    (gnc:options-add-interval-choice!
-     options gnc:pagename-general optname-stepsize "b" 'MonthDelta)
-
-    (gnc:options-add-currency!
-     options gnc:pagename-general optname-report-currency "c")
-
-    (gnc:options-add-price-source!
-     options gnc:pagename-general
-     optname-price-source "d" 'weighted-average)
-
-    ;; Account tab
-    (add-option
-     (gnc:make-account-list-option
-      gnc:pagename-accounts optname-accounts
-      "a"
-      (N_ "Report on these accounts, if chosen account level allows.")
-      (lambda ()
-        (filter
-         (if inc-exp?
-             gnc:account-is-inc-exp?
-             (lambda (account) (not (gnc:account-is-inc-exp? account))))
-         (gnc-account-get-descendants-sorted (gnc-get-current-root-account))))
-      (lambda (accounts)
-        (list #t
-              (filter
-               (if inc-exp?
-                   gnc:account-is-inc-exp?
-                   (lambda (account)
-                     (not (gnc:account-is-inc-exp? account))))
-               accounts)))
-      #t))
-
-    ;; Display tab
-    (add-option
-     (gnc:make-simple-boolean-option
-      gnc:pagename-display
-      (if inc-exp? optname-inc-exp optname-sep-bars)
-      "a"
-      (if inc-exp?
-          (N_ "Show Income and Expenses?")
-          (N_ "Show the Asset and the Liability bars?"))
-      #t))
-
-    (add-option
-     (gnc:make-simple-boolean-option
-      gnc:pagename-display
-      (if inc-exp? optname-show-profit optname-net-bars)
-      "b"
-      (if inc-exp?
-          (N_ "Show the net profit?")
-          (N_ "Show a Net Worth bar?"))
-      #t))
-
-    (add-option
-     (gnc:make-simple-boolean-option
-      gnc:pagename-display
-      (N_ "Show table")
-      "c" (N_ "Display a table of the selected data.")
-      #f))
-
-    (gnc:options-add-plot-size! 
-     options gnc:pagename-display 
-     optname-plot-width optname-plot-height "d" (cons 'percent 100.0) (cons 'percent 100.0))
-
-    (gnc:options-set-default-section options gnc:pagename-general)
-
-    options))
-
-;; This is the rendering function. It accepts a database of options
-;; and generates an object of type <html-document>.  See the file
-;; report-html.txt for documentation; the file report-html.scm
-;; includes all the relevant Scheme code. The option database passed
-;; to the function is one created by the options-generator function
-;; defined above.
-(define (net-renderer report-obj inc-exp?)
-
-  ;; This is a helper function for looking up option values.
-  (define (get-option section name)
-    (gnc:option-value
-     (gnc:lookup-option (gnc:report-options report-obj) section name)))
-
-  (gnc:report-starting reportname)
-  (let* ((to-date-tp (gnc:timepair-end-day-time
-                      (gnc:date-option-absolute-time
-                       (get-option gnc:pagename-general
-				   optname-to-date))))
-         (from-date-tp (gnc:timepair-start-day-time
-                        (gnc:date-option-absolute-time
-                         (get-option gnc:pagename-general
-				     optname-from-date))))
-         (interval (get-option gnc:pagename-general optname-stepsize))
-         (report-currency (get-option gnc:pagename-general
-                                      optname-report-currency))
-         (price-source (get-option gnc:pagename-general
-                                   optname-price-source))
-
-         (accounts (get-option gnc:pagename-accounts optname-accounts))
-
-         (show-sep? (get-option gnc:pagename-display
-				(if inc-exp? optname-inc-exp
-				    optname-sep-bars)))
-         (show-net? (get-option gnc:pagename-display
-				(if inc-exp? optname-show-profit
-				    optname-net-bars)))
-         (height (get-option gnc:pagename-display optname-plot-height))
-         (width (get-option gnc:pagename-display optname-plot-width))
-
-         (commodity-list #f)
-         (exchange-fn #f)
-
-         (dates-list ((if inc-exp? gnc:make-date-interval-list
-                          gnc:make-date-list)
-                      ((if inc-exp? gnc:timepair-start-day-time
-                           gnc:timepair-end-day-time) from-date-tp)
-                      (gnc:timepair-end-day-time to-date-tp)
-                      (gnc:deltasym-to-delta interval)))
-	 (report-title (get-option gnc:pagename-general
-                                  gnc:optname-reportname))
-         (classified-accounts (gnc:decompose-accountlist accounts))
-         (show-table? (get-option gnc:pagename-display (N_ "Show table")))
-         (document (gnc:make-html-document))
-         (chart (gnc:make-html-barchart))
-         (non-zeros #f))
-
-    (define (add-column! data-list)
-      (begin
-        (gnc:html-barchart-append-column! chart data-list)
-        (if (gnc:not-all-zeros data-list) (set! non-zeros #t))
-        #f))
-
-    ;; This exchanges the commodity-collector 'c' to one single
-    ;; 'report-currency' according to the exchange-fn. Returns a
-    ;; double.
-    (define (collector->double c date)
-      (if (not (gnc:timepair? date))
-	  (throw 'wrong))
-      (gnc-numeric-to-double
-       (gnc:gnc-monetary-amount
-        (gnc:sum-collector-commodity
-         c report-currency
-         (lambda (a b) (exchange-fn a b date))))))
-
-    ;; This calculates the balances for all the 'accounts' for each
-    ;; element of the list 'dates'. If income?==#t, the signs get
-    ;; reversed according to income-sign-reverse general option
-    ;; settings. Uses the collector->double conversion function
-    ;; above. Returns a list of doubles.
-    (define (process-datelist accounts dates income?)
-      (map
-       (lambda (date)
-         (collector->double
-          ((if inc-exp?
-               (if income?
-                   gnc:accounts-get-comm-total-income
-                   gnc:accounts-get-comm-total-expense)
-               gnc:accounts-get-comm-total-assets)
-           accounts
-           (lambda (account)
-             (if inc-exp?
-                 ;; for inc-exp, 'date' is a pair of time values, else
-                 ;; it is a time value.
-                 (gnc:account-get-comm-balance-interval
-                  account (first date) (second date) #f)
-                 (gnc:account-get-comm-balance-at-date
-                  account date #f))))
-          (if inc-exp? (second date) date)))
-       dates))
-
-    (gnc:report-percent-done 1)
-    (set! commodity-list (gnc:accounts-get-commodities
-                          (append
-                           (gnc:acccounts-get-all-subaccounts accounts)
-                           accounts)
-                          report-currency))
-    (gnc:report-percent-done 10)
-    (set! exchange-fn (gnc:case-exchange-time-fn
-                       price-source report-currency
-                       commodity-list to-date-tp
-		       10 40))
-    (gnc:report-percent-done 50)
-
-    (if
-     (not (null? accounts))
-     (let* ((assets-list #f)
-            (liability-list #f)
-            (net-list #f)
-	    (progress-range (cons 50 80))
-            (date-string-list (map
-                               (if inc-exp?
-                                   (lambda (date-list-item)
-                                     (gnc-print-date
-                                      (car date-list-item)))
-                                   gnc-print-date)
-                               dates-list)))
-       (let* ((the-acount-destination-alist
-	       (if inc-exp?
-		   (append (map (lambda (account) (cons account 'asset))
-				 (assoc-ref classified-accounts ACCT-TYPE-INCOME))
-			   (map (lambda (account) (cons account 'liability))
-				 (assoc-ref classified-accounts ACCT-TYPE-EXPENSE)))
-		   (append  (map (lambda (account) (cons account 'asset))
-				 (assoc-ref classified-accounts ACCT-TYPE-ASSET))
-			    (map (lambda (account) (cons account 'liability))
-				 (assoc-ref classified-accounts ACCT-TYPE-LIABILITY)))))
-	      (account-reformat (if inc-exp?
-				    (lambda (account result)
-				      (map (lambda (collector date-interval)
-					     (- (collector->double collector (second date-interval))))
-					   result dates-list))
-				    (lambda (account result)
-				      (let ((commodity-collector (gnc:make-commodity-collector)))
-					(collector-end (fold (lambda (next date list-collector)
-							       (commodity-collector 'merge next #f)
-							       (collector-add list-collector
-									      (collector->double
-									       commodity-collector date)))
-							     (collector-into-list)
-							     result
-							     dates-list))))))
-	      (work (category-by-account-report-work inc-exp?
-					  dates-list
-					  the-acount-destination-alist
-					  (lambda (account date)
-					    (make-gnc-collector-collector))
-					  account-reformat))
-	      (rpt (category-by-account-report-do-work work progress-range))
-	      (assets (assoc-ref rpt 'asset))
-	      (liabilities (assoc-ref rpt 'liability)))
-	 (set! assets-list (if assets (car assets)
-			       (map (lambda (d) 0) dates-list)))
-	 (set! liability-list (if liabilities (car liabilities)
-				  (map (lambda (d) 0) dates-list)))
-	 )
-
-       (gnc:report-percent-done 80)
-       (set! net-list
-             (map + assets-list liability-list))
-       (gnc:report-percent-done 90)
-
-       (gnc:html-barchart-set-title!
-        chart report-title)
-       (gnc:html-barchart-set-subtitle!
-        chart (sprintf #f
-                       (_ "%s to %s")
-                       (jqplot-escape-string (gnc-print-date from-date-tp))
-                       (jqplot-escape-string (gnc-print-date to-date-tp))))
-       (gnc:html-barchart-set-width! chart width)
-       (gnc:html-barchart-set-height! chart height)
-       (gnc:html-barchart-set-row-labels! chart date-string-list)
-       (gnc:html-barchart-set-y-axis-label!
-        chart (gnc-commodity-get-mnemonic report-currency))
-       ;; Determine whether we have enough space for horizontal labels
-       ;; -- kind of a hack. Assumptions: y-axis labels and legend
-       ;; require 200 pixels, and each x-axes label needs 60 pixels.
-       ;;(gnc:html-barchart-set-row-labels-rotated?!
-       ;; chart (< (/ (- width 200)
-       ;;             (length date-string-list)) 60))
-
-       ;; Add the data
-       (if show-sep?
-           (begin
-             (add-column! assets-list)
-             (add-column!		      ;;(if inc-exp?
-              (map - liability-list)
-              ;;liability-list)
-              )))
-       (if show-net?
-           (add-column! net-list))
-
-       ;; Legend labels, colors
-       (gnc:html-barchart-set-col-labels!
-        chart (append
-               (if show-sep?
-                   (if inc-exp?
-                       (list (_ "Income") (_ "Expense"))
-                       (list (_ "Assets") (_ "Liabilities")))
-                   '())
-               (if show-net?
-                   (if inc-exp?
-                       (list (_ "Net Profit"))
-                       (list (_ "Net Worth")))
-                   '())))
-       (gnc:html-barchart-set-col-colors!
-        chart (append
-               (if show-sep?
-                   '("blue" "red") '())
-               (if show-net?
-                   '("green") '())))
-
-       ;; URLs for income/expense or asset/liabilities bars.
-;;       (if show-sep?
-;;           (let ((urls
-;;                  (list
-;;                   (gnc:make-report-anchor
-;;                    (if inc-exp?
-;;                        category-barchart-income-uuid
-;;                        category-barchart-asset-uuid)
-;;                    report-obj
-;;                    (list
-;;                     (list gnc:pagename-display
-;;                           "Use Stacked Bars" #t)
-;;                     (list gnc:pagename-general
-;;                           gnc:optname-reportname
-;;                           (if inc-exp?
-;;                               (_ "Income Chart")
-;;                               (_ "Asset Chart")))))
-;;                   (gnc:make-report-anchor
-;;                    (if inc-exp?
-;;                        category-barchart-expense-uuid
-;;                        category-barchart-liability-uuid)
-;;                    report-obj
-;;                    (list
-;;                     (list gnc:pagename-display
-;;                           "Use Stacked Bars" #t)
-;;                     (list gnc:pagename-general
-;;                           gnc:optname-reportname
-;;                           (if inc-exp?
-;;                               (_ "Expense Chart")
-;;                               (_ "Liability Chart"))))))))
-;;             (gnc:html-barchart-set-button-1-bar-urls!
-;;              chart urls)
-;;             (gnc:html-barchart-set-button-1-legend-urls!
-;;              chart urls)))
-
-       ;; Test for all-zero data here.
-       (if non-zeros
-           (begin
-           (gnc:html-document-add-object! document chart)
-             (if show-table?
-             (let ((table (gnc:make-html-table)))
-                (gnc:html-table-set-col-headers!
-                 table
-                 (append
-                  (list (_ "Date"))
-                  (if show-sep?
-                      (if inc-exp?
-                          (list (_ "Income") (_ "Expense"))
-                          (list (_ "Assets") (_ "Liabilities")))
-                      '())
-                  (if show-net?
-                      (if inc-exp?
-                          (list (_ "Net Profit"))
-                          (list (_ "Net Worth")))
-                      '()))
-                 )
-               (gnc:html-table-append-column! table date-string-list)
-               (if show-sep?
-                   (begin
-                     (gnc:html-table-append-column! table assets-list)
-                     (gnc:html-table-append-column! table liability-list)
-                    )
-                   )
-               (if show-net?
-                   (gnc:html-table-append-column! table net-list)
-                   )
-               ;; set numeric columns to align right
-                (for-each
-                 (lambda (col)
-                   (gnc:html-table-set-col-style!
-                    table col "td"
-                    'attribute (list "class" "number-cell")))
-                 '(1 2 3))
-
-              (gnc:html-document-add-object! document table))
-             ))
-           (gnc:html-document-add-object!
-            document
-            (gnc:html-make-empty-data-warning
-	     report-title (gnc:report-id report-obj)))))
-
-     ;; else no accounts selected
-     (gnc:html-document-add-object!
-      document
-      (gnc:html-make-no-account-warning
-       report-title (gnc:report-id report-obj))))
-
-    (gnc:report-finished)
-    document))
-
-;; Export reports
-
-(export net-worth-barchart-uuid)
-(export income-expense-barchart-uuid)
-
-(define net-worth-barchart-uuid "cbba1696c8c24744848062c7f1cf4a72")
-(define income-expense-barchart-uuid "80769921e87943adade887b9835a7685")
-
-;; Here we define the actual report
-(gnc:define-report
- 'version 1
- 'name (N_ "Net Worth Barchart")
- 'report-guid net-worth-barchart-uuid
- 'menu-path (list gnc:menuname-asset-liability)
- 'options-generator (lambda () (options-generator #f))
- 'renderer (lambda (report-obj) (net-renderer report-obj #f)))
-
-(gnc:define-report
- 'version 1
- 'name reportname
- 'report-guid income-expense-barchart-uuid
- 'menu-name (N_ "Income & Expense Barchart")
- 'menu-path (list gnc:menuname-income-expense)
- 'options-generator (lambda () (options-generator #t))
- 'renderer (lambda (report-obj) (net-renderer report-obj #t)))
diff --git a/src/report/standard-reports/net-linechart.scm b/src/report/standard-reports/net-linechart.scm
deleted file mode 100644
index 299bd07..0000000
--- a/src/report/standard-reports/net-linechart.scm
+++ /dev/null
@@ -1,535 +0,0 @@
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; net-linechart.scm : Display a time series line chart for
-;; either net worth or net profit.
-;;
-;; By Robert Merkel <rgmerk at mira.net>
-;; and Christian Stimming <stimming at tu-harburg.de>
-;; and Mike Evans <mikee at saxicooa.co.uk>
-;;
-;; 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 at gnu.org
-;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-(define-module (gnucash report standard-reports net-linechart))
-
-(use-modules (srfi srfi-1))
-(use-modules (gnucash main)) ;; FIXME: delete after we finish modularizing.
-(use-modules (gnucash gnc-module))
-(use-modules (gnucash gettext))
-
-(use-modules (gnucash printf))
-(use-modules (gnucash report report-system report-collectors))
-(use-modules (gnucash report report-system collectors))
-(use-modules (gnucash report standard-reports category-barchart)) ; for guids of called reports
-(gnc:module-load "gnucash/report/report-system" 0)
-
-(define reportname (N_ "Income/Expense Chart"))
-
-(define optname-from-date (N_ "Start Date"))
-(define optname-to-date (N_ "End Date"))
-(define optname-stepsize (N_ "Step Size"))
-(define optname-report-currency (N_ "Report's currency"))
-(define optname-price-source (N_ "Price Source"))
-
-(define optname-accounts (N_ "Accounts"))
-
-(define optname-inc-exp (N_ "Show Income/Expense"))
-(define optname-show-profit (N_ "Show Net Profit"))
-
-(define optname-sep-bars (N_ "Show Asset & Liability"))
-(define optname-net-bars (N_ "Show Net Worth"))
-
-(define optname-plot-width (N_ "Plot Width"))
-(define optname-plot-height (N_ "Plot Height"))
-
-(define optname-line-width (N_ "Line Width"))
-(define opthelp-line-width (N_ "Set line width in pixels."))
-
-(define optname-markers (N_ "Data markers?"))
-
-;;(define optname-x-grid (N_ "X grid"))
-(define optname-y-grid (N_ "Grid"))
-
-
-
-(define (options-generator inc-exp?)
-  (let* ((options (gnc:new-options))
-         ;; This is just a helper function for making options.
-         ;; See gnucash/src/scm/options.scm for details.
-         (add-option
-          (lambda (new-option)
-            (gnc:register-option options new-option))))
-
-    ;; General tab
-    (gnc:options-add-date-interval!
-     options gnc:pagename-general
-     optname-from-date optname-to-date "a")
-
-    (gnc:options-add-interval-choice!
-     options gnc:pagename-general optname-stepsize "b" 'MonthDelta)
-
-    (gnc:options-add-currency!
-     options gnc:pagename-general optname-report-currency "c")
-
-    (gnc:options-add-price-source!
-     options gnc:pagename-general
-     optname-price-source "d" 'weighted-average)
-
-    ;; Account tab
-    (add-option
-     (gnc:make-account-list-option
-      gnc:pagename-accounts optname-accounts
-      "a"
-      (N_ "Report on these accounts, if chosen account level allows.")
-      (lambda ()
-        (filter
-         (if inc-exp?
-             gnc:account-is-inc-exp?
-             (lambda (account) (not (gnc:account-is-inc-exp? account))))
-         (gnc-account-get-descendants-sorted (gnc-get-current-root-account))))
-      (lambda (accounts)
-        (list #t
-              (filter
-               (if inc-exp?
-                   gnc:account-is-inc-exp?
-                   (lambda (account)
-                     (not (gnc:account-is-inc-exp? account))))
-               accounts)))
-      #t))
-
-    ;; Display tab
-    (add-option
-     (gnc:make-simple-boolean-option
-      gnc:pagename-display
-      (if inc-exp? optname-inc-exp optname-sep-bars)
-      "a"
-      (if inc-exp?
-          (N_ "Show Income and Expenses?")
-          (N_ "Show the Asset and the Liability bars?"))
-      #t))
-
-    (add-option
-     (gnc:make-simple-boolean-option
-      gnc:pagename-display
-      (if inc-exp? optname-show-profit optname-net-bars)
-      "b"
-      (if inc-exp?
-          (N_ "Show the net profit?")
-          (N_ "Show a Net Worth bar?"))
-      #t))
-
-    (add-option
-     (gnc:make-simple-boolean-option
-      gnc:pagename-display
-      (N_ "Show table")
-      "c" (N_ "Display a table of the selected data.")
-      #f))
-
-    (gnc:options-add-plot-size! 
-     options gnc:pagename-display 
-     optname-plot-width optname-plot-height "d" (cons 'percent 100.0) (cons 'percent 100.0))
-
-
-     (add-option
-     (gnc:make-number-range-option
-      gnc:pagename-display optname-line-width
-      "e" opthelp-line-width
-      1.5 0.5 5 1 0.1 ))
-
-
-    (add-option
-     (gnc:make-simple-boolean-option
-      gnc:pagename-display optname-y-grid
-      "f" (N_ "Add grid lines.")
-      #t))
-
-    ;(add-option
-    ; (gnc:make-simple-boolean-option
-    ;  gnc:pagename-display optname-x-grid
-    ;  "g" (N_ "Add vertical grid lines.")
-    ;  #f))
-
-    (add-option
-     (gnc:make-simple-boolean-option
-      gnc:pagename-display optname-markers
-      "g" (N_ "Display a mark for each data point.")
-      #t))
-
-    (gnc:options-set-default-section options gnc:pagename-general)
-
-    options))
-
-;; This is the rendering function. It accepts a database of options
-;; and generates an object of type <html-document>.  See the file
-;; report-html.txt for documentation; the file report-html.scm
-;; includes all the relevant Scheme code. The option database passed
-;; to the function is one created by the options-generator function
-;; defined above.
-(define (net-renderer report-obj inc-exp?)
-
-  ;; This is a helper function for looking up option values.
-  (define (get-option section name)
-    (gnc:option-value
-     (gnc:lookup-option (gnc:report-options report-obj) section name)))
-
-  (gnc:report-starting reportname)
-  (let* ((to-date-tp (gnc:timepair-end-day-time
-                      (gnc:date-option-absolute-time
-                       (get-option gnc:pagename-general
-				   optname-to-date))))
-         (from-date-tp (gnc:timepair-start-day-time
-                        (gnc:date-option-absolute-time
-                         (get-option gnc:pagename-general
-				     optname-from-date))))
-         (interval (get-option gnc:pagename-general optname-stepsize))
-         (report-currency (get-option gnc:pagename-general
-                                      optname-report-currency))
-         (price-source (get-option gnc:pagename-general
-                                   optname-price-source))
-
-         (accounts (get-option gnc:pagename-accounts optname-accounts))
-
-         (show-sep? (get-option gnc:pagename-display
-				(if inc-exp? optname-inc-exp
-				    optname-sep-bars)))
-         (show-net? (get-option gnc:pagename-display
-				(if inc-exp? optname-show-profit
-				    optname-net-bars)))
-         (height (get-option gnc:pagename-display optname-plot-height))
-         (width (get-option gnc:pagename-display optname-plot-width))
-        (markers (get-option gnc:pagename-display optname-markers))
-
-        (line-width (get-option gnc:pagename-display optname-line-width))
-        (y-grid (get-option gnc:pagename-display optname-y-grid))
-        ;(x-grid (get-option gnc:pagename-display optname-x-grid))
-
-         (commodity-list #f)
-         (exchange-fn #f)
-
-         (dates-list ((if inc-exp? gnc:make-date-interval-list
-                          gnc:make-date-list)
-                      ((if inc-exp? gnc:timepair-start-day-time
-                           gnc:timepair-end-day-time) from-date-tp)
-                      (gnc:timepair-end-day-time to-date-tp)
-                      (gnc:deltasym-to-delta interval)))
-	 (report-title (get-option gnc:pagename-general
-                                  gnc:optname-reportname))
-         (classified-accounts (gnc:decompose-accountlist accounts))
-         (show-table? (get-option gnc:pagename-display (N_ "Show table")))
-         (document (gnc:make-html-document))
-         (chart (gnc:make-html-linechart))
-         (non-zeros #f))
-
-    (define (add-column! data-list)
-      (begin
-        (gnc:html-linechart-append-column! chart data-list)
-        (if (gnc:not-all-zeros data-list) (set! non-zeros #t))
-        #f))
-
-    ;; This exchanges the commodity-collector 'c' to one single
-    ;; 'report-currency' according to the exchange-fn. Returns a
-    ;; double.
-    (define (collector->double c date)
-      (if (not (gnc:timepair? date))
-	  (throw 'wrong))
-      (gnc-numeric-to-double
-       (gnc:gnc-monetary-amount
-        (gnc:sum-collector-commodity
-         c report-currency
-         (lambda (a b) (exchange-fn a b date))))))
-
-    ;; This calculates the balances for all the 'accounts' for each
-    ;; element of the list 'dates'. If income?==#t, the signs get
-    ;; reversed according to income-sign-reverse general option
-    ;; settings. Uses the collector->double conversion function
-    ;; above. Returns a list of doubles.
-    (define (process-datelist accounts dates income?)
-      (map
-       (lambda (date)
-         (collector->double
-          ((if inc-exp?
-               (if income?
-                   gnc:accounts-get-comm-total-income
-                   gnc:accounts-get-comm-total-expense)
-               gnc:accounts-get-comm-total-assets)
-           accounts
-           (lambda (account)
-             (if inc-exp?
-                 ;; for inc-exp, 'date' is a pair of time values, else
-                 ;; it is a time value.
-                 (gnc:account-get-comm-balance-interval
-                  account (first date) (second date) #f)
-                 (gnc:account-get-comm-balance-at-date
-                  account date #f))))
-          (if inc-exp? (second date) date)))
-       dates))
-
-    (gnc:report-percent-done 1)
-    (set! commodity-list (gnc:accounts-get-commodities
-                          (append
-                           (gnc:acccounts-get-all-subaccounts accounts)
-                           accounts)
-                          report-currency))
-    (gnc:report-percent-done 10)
-    (set! exchange-fn (gnc:case-exchange-time-fn
-                       price-source report-currency
-                       commodity-list to-date-tp
-		       10 40))
-    (gnc:report-percent-done 50)
-
-    (if
-     (not (null? accounts))
-     (let* ((assets-list #f)
-            (liability-list #f)
-            (net-list #f)
-	    (progress-range (cons 50 80))
-            ;; Here the date strings for the x-axis labels are
-            ;; created.
-            (date-string-list '())
-            (date-iso-string-list '())
-            (save-fmt (qof-date-format-get)))
-
-       (define (datelist->stringlist dates-list)
-         (map (lambda (date-list-item)
-                      (gnc-print-date
-                       (if inc-exp?
-                           (car date-list-item)
-                           date-list-item)))
-              dates-list))
-
-       (let* ((the-acount-destination-alist
-	       (if inc-exp?
-		   (append (map (lambda (account) (cons account 'asset))
-				 (assoc-ref classified-accounts ACCT-TYPE-INCOME))
-			   (map (lambda (account) (cons account 'liability))
-				 (assoc-ref classified-accounts ACCT-TYPE-EXPENSE)))
-		   (append  (map (lambda (account) (cons account 'asset))
-				 (assoc-ref classified-accounts ACCT-TYPE-ASSET))
-			    (map (lambda (account) (cons account 'liability))
-				 (assoc-ref classified-accounts ACCT-TYPE-LIABILITY)))))
-	      (account-reformat (if inc-exp?
-				    (lambda (account result)
-				      (map (lambda (collector date-interval)
-					     (- (collector->double collector (second date-interval))))
-					   result dates-list))
-				    (lambda (account result)
-				      (let ((commodity-collector (gnc:make-commodity-collector)))
-					(collector-end (fold (lambda (next date list-collector)
-							       (commodity-collector 'merge next #f)
-							       (collector-add list-collector
-									      (collector->double
-									       commodity-collector date)))
-							     (collector-into-list)
-							     result
-							     dates-list))))))
-	      (work (category-by-account-report-work inc-exp?
-					  dates-list
-					  the-acount-destination-alist
-					  (lambda (account date)
-					    (make-gnc-collector-collector))
-					  account-reformat))
-	      (rpt (category-by-account-report-do-work work progress-range))
-	      (assets (assoc-ref rpt 'asset))
-	      (liabilities (assoc-ref rpt 'liability)))
-	 (set! assets-list (if assets (car assets)
-			       (map (lambda (d) 0) dates-list)))
-	 (set! liability-list (if liabilities (car liabilities)
-				  (map (lambda (d) 0) dates-list)))
-	 )
-
-       (gnc:report-percent-done 80)
-       (set! net-list
-             (map + assets-list liability-list))
-       (gnc:report-percent-done 90)
-
-       (gnc:html-linechart-set-title!
-        chart report-title)
-       (gnc:html-linechart-set-subtitle!
-        chart (sprintf #f
-                       (_ "%s to %s")
-                       (gnc-print-date from-date-tp)
-                       (gnc-print-date to-date-tp)))
-       (gnc:html-linechart-set-width! chart width)
-       (gnc:html-linechart-set-height! chart height)
-
-       (qof-date-format-set QOF-DATE-FORMAT-ISO)
-       (set! date-iso-string-list (datelist->stringlist dates-list))
-       (qof-date-format-set save-fmt)
-       (gnc:html-linechart-set-row-labels! chart date-iso-string-list)
-
-       (gnc:html-linechart-set-major-grid?! chart y-grid)
-       (gnc:html-linechart-set-y-axis-label!
-        chart (gnc-commodity-get-mnemonic report-currency))
-
-       ;; Add the data
-       (if show-sep?
-           (begin
-             (add-column! assets-list)
-             (add-column!		      ;;(if inc-exp?
-              (map - liability-list)
-              ;;liability-list)
-              )))
-       (if show-net?
-           (add-column! net-list))
-
-       ;; Legend labels, colors
-       (gnc:html-linechart-set-col-labels!
-        chart (append
-               (if show-sep?
-                   (if inc-exp?
-                       (list (_ "Income") (_ "Expense"))
-                       (list (_ "Assets") (_ "Liabilities")))
-                   '())
-               (if show-net?
-                   (if inc-exp?
-                       (list (_ "Net Profit"))
-                       (list (_ "Net Worth")))
-                   '())))
-       (gnc:html-linechart-set-col-colors!
-        chart (append
-               (if show-sep?
-                   '("blue" "red") '())
-               (if show-net?
-                   '("green") '())))
-
-        ;; Set the line width and markers
-        (gnc:html-linechart-set-line-width!
-            chart line-width)
-        (gnc:html-linechart-set-markers?!
-            chart markers)
-
-       ;; URLs for income/expense or asset/liabilities bars.
-;;       (if show-sep?
-;;           (let ((urls
-;;                  (list
-;;                   (gnc:make-report-anchor
-;;                    (if inc-exp?
-;;                        category-barchart-income-uuid
-;;                        category-barchart-asset-uuid)
-;;                    report-obj
-;;                    (list
-;;                     (list gnc:pagename-display
-;;                           "Use Stacked Lines" #t)
-;;                     (list gnc:pagename-general
-;;                           gnc:optname-reportname
-;;                           (if inc-exp?
-;;                               (_ "Income Chart")
-;;                               (_ "Asset Chart")))))
-;;                   (gnc:make-report-anchor
-;;                    (if inc-exp?
-;;                        category-barchart-expense-uuid
-;;                        category-barchart-liability-uuid)
-;;                    report-obj
-;;                    (list
-;;                     (list gnc:pagename-display
-;;                           "Use Stacked Lines" #t)
-;;                     (list gnc:pagename-general
-;;                           gnc:optname-reportname
-;;                           (if inc-exp?
-;;                               (_ "Expense Chart")
-;;                               (_ "Liability Chart"))))))))
-;;             (gnc:html-linechart-set-button-1-line-urls!
-;;              chart urls)
-;;             (gnc:html-linechart-set-button-1-legend-urls!
-;;              chart urls)))
-
-       ;; Test for all-zero data here.
-       (if non-zeros
-           (begin
-           (gnc:html-document-add-object! document chart)
-             (if show-table?
-             (let ((table (gnc:make-html-table)))
-                (gnc:html-table-set-style!
-                  table "table"
-                  'attribute (list "border" 0)
-                  'attribute (list "cellspacing" 0)
-                  'attribute (list "cellpadding" 4))
-                (gnc:html-table-set-col-headers!
-                 table
-                 (append
-                  (list (_ "Date"))
-                  (if show-sep?
-                      (if inc-exp?
-                          (list (_ "Income") (_ "Expense"))
-                          (list (_ "Assets") (_ "Liabilities")))
-                      '())
-                  (if show-net?
-                      (if inc-exp?
-                          (list (_ "Net Profit"))
-                          (list (_ "Net Worth")))
-                      '()))
-                 )
-               (set! date-string-list (datelist->stringlist dates-list))
-               (gnc:html-table-append-column! table date-string-list)
-               (if show-sep?
-                   (begin
-                     (gnc:html-table-append-column! table assets-list)
-                     (gnc:html-table-append-column! table liability-list)
-                    )
-                   )
-               (if show-net?
-                   (gnc:html-table-append-column! table net-list)
-                   )
-               ;; set numeric columns to align right
-                (for-each
-                 (lambda (col)
-                   (gnc:html-table-set-col-style!
-                    table col "td"
-                    'attribute (list "class" "number-cell")))
-                 '(1 2 3))
-
-              (gnc:html-document-add-object! document table))
-             ))
-           (gnc:html-document-add-object!
-            document
-            (gnc:html-make-empty-data-warning
-	     report-title (gnc:report-id report-obj)))))
-
-     ;; else no accounts selected
-     (gnc:html-document-add-object!
-      document
-      (gnc:html-make-no-account-warning
-       report-title (gnc:report-id report-obj))))
-
-    (gnc:report-finished)
-    document))
-
-;; Export reports
-
-(export net-worth-linechart-uuid)
-(define net-worth-linechart-uuid "d8b63264186b11e19038001558291366")
-
-;; Here we define the actual report
-(gnc:define-report
- 'version 1
- 'name (N_ "Net Worth Linechart")
- 'report-guid net-worth-linechart-uuid
- 'menu-path (list gnc:menuname-asset-liability)
- 'options-generator (lambda () (options-generator #f))
- 'renderer (lambda (report-obj) (net-renderer report-obj #f)))
-
-;; Not sure if a line chart makes sense for Income & Expense
-;; Feel free to uncomment and try it though
-(gnc:define-report
- 'version 1
- 'name reportname
- 'report-guid "e533c998186b11e1b2e2001558291366"
- 'menu-name (N_ "Income & Expense Linechart")
- 'menu-path (list gnc:menuname-income-expense)
- 'options-generator (lambda () (options-generator #t))
- 'renderer (lambda (report-obj) (net-renderer report-obj #t)))
diff --git a/src/report/standard-reports/portfolio.scm b/src/report/standard-reports/portfolio.scm
deleted file mode 100644
index afbf24b..0000000
--- a/src/report/standard-reports/portfolio.scm
+++ /dev/null
@@ -1,303 +0,0 @@
-;; -*-scheme-*- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; portfolio.scm
-;; by Robert Merkel (rgmerk at mira.net)
-;;
-;; 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 at gnu.org
-;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-(define-module (gnucash report standard-reports portfolio))
-
-(use-modules (gnucash main)) ;; FIXME: delete after we finish modularizing.
-(use-modules (srfi srfi-1))
-(use-modules (gnucash gnc-module))
-(use-modules (gnucash gettext))
-
-(use-modules (gnucash printf))
-
-(gnc:module-load "gnucash/report/report-system" 0)
-
-(define reportname (N_ "Investment Portfolio"))
-
-(define optname-price-source (N_ "Price Source"))
-(define optname-shares-digits (N_ "Share decimal places"))
-(define optname-zero-shares (N_ "Include accounts with no shares"))
-
-(define (options-generator)
-  (let* ((options (gnc:new-options))
-         ;; This is just a helper function for making options.
-         ;; See gnucash/src/scm/options.scm for details.
-         (add-option
-          (lambda (new-option)
-            (gnc:register-option options new-option))))
-
-    ;; General Tab
-    ;; date at which to report balance
-    (gnc:options-add-report-date!
-     options gnc:pagename-general
-     (N_ "Date") "a")
-
-    (gnc:options-add-currency!
-     options gnc:pagename-general (N_ "Report's currency") "c")
-
-    (gnc:options-add-price-source!
-     options gnc:pagename-general
-     optname-price-source "d" 'pricedb-latest)
-
-    (add-option
-     (gnc:make-number-range-option
-      gnc:pagename-general optname-shares-digits
-      "e" (N_ "The number of decimal places to use for share numbers.") 2
-      0 6 0 1))
-
-    ;; Account tab
-    (add-option
-     (gnc:make-account-list-option
-      gnc:pagename-accounts (N_ "Accounts")
-      "b"
-      (N_ "Stock Accounts to report on.")
-      (lambda () (filter gnc:account-is-stock?
-                         (gnc-account-get-descendants-sorted
-                          (gnc-get-current-root-account))))
-      (lambda (accounts) (list  #t
-                                (filter gnc:account-is-stock? accounts)))
-      #t))
-
-    (gnc:register-option
-     options
-     (gnc:make-simple-boolean-option
-      gnc:pagename-accounts optname-zero-shares "e"
-      (N_ "Include accounts that have a zero share balances.")
-      #f))
-
-    (gnc:options-set-default-section options gnc:pagename-general)
-    options))
-
-;; This is the rendering function. It accepts a database of options
-;; and generates an object of type <html-document>.  See the file
-;; report-html.txt for documentation; the file report-html.scm
-;; includes all the relevant Scheme code. The option database passed
-;; to the function is one created by the options-generator function
-;; defined above.
-(define (portfolio-renderer report-obj)
-
- (let ((work-done 0)
-       (work-to-do 0))
-
-  ;; These are some helper functions for looking up option values.
-  (define (get-op section name)
-    (gnc:lookup-option (gnc:report-options report-obj) section name))
-
-  (define (get-option section name)
-    (gnc:option-value (get-op section name)))
-
-  (define (table-add-stock-rows table accounts to-date currency
-                                exchange-fn price-fn include-empty collector)
-
-   (let ((share-print-info
-	  (gnc-share-print-info-places
-	   (inexact->exact (get-option gnc:pagename-general
-				       optname-shares-digits)))))
-
-    (define (table-add-stock-rows-internal accounts odd-row?)
-      (if (null? accounts) collector
-          (let* ((row-style (if odd-row? "normal-row" "alternate-row"))
-                 (current (car accounts))
-                 (rest (cdr accounts))
-                 (commodity (xaccAccountGetCommodity current))
-                 (ticker-symbol (gnc-commodity-get-mnemonic commodity))
-                 (listing (gnc-commodity-get-namespace commodity))
-                 (unit-collector (gnc:account-get-comm-balance-at-date
-                                  current to-date #f))
-                 (units (cadr (unit-collector 'getpair commodity #f)))
-
-                 (price-info (price-fn commodity to-date))
-                 (price (car price-info))
-                 (price-monetary (if price
-                                     (gnc:make-gnc-monetary
-                                      (gnc-price-get-currency price)
-                                      (gnc-price-get-value price))
-                                     (gnc:make-gnc-monetary
-                                      currency
-                                      (cdr price-info))))
-                 (value (exchange-fn (gnc:make-gnc-monetary commodity units)
-                                     currency)))
-
-	    (set! work-done (+ 1 work-done))
-	    (gnc:report-percent-done (* 100 (/ work-done work-to-do)))
-	    (if (or include-empty (not (gnc-numeric-zero-p units)))
-		(begin (collector 'add currency (gnc:gnc-monetary-amount value))
-		       (gnc:html-table-append-row/markup!
-			table
-			row-style
-			(list (gnc:html-account-anchor current)
-			      (gnc:make-html-table-header-cell/markup "text-cell" ticker-symbol)
-			      (gnc:make-html-table-header-cell/markup "text-cell" listing)
-			      (gnc:make-html-table-header-cell/markup
-			       "number-cell"
-			       (xaccPrintAmount units share-print-info))
-			      (gnc:make-html-table-header-cell/markup
-			       "number-cell"
-                               (gnc:html-price-anchor price price-monetary))
-			      (gnc:make-html-table-header-cell/markup
-			       "number-cell" value)))
-		       ;;(display (sprintf #f "Shares: %6.6d  " (gnc-numeric-to-double units)))
-		       ;;(display units) (newline)
-		       (if price (gnc-price-unref price))
-		       (table-add-stock-rows-internal rest (not odd-row?)))
-		(begin (if price (gnc-price-unref price))
-		       (table-add-stock-rows-internal rest odd-row?))))))
-
-    (set! work-to-do (length accounts))
-    (table-add-stock-rows-internal accounts #t)))
-
-  ;; Tell the user that we're starting.
-  (gnc:report-starting reportname)
-
-  ;; The first thing we do is make local variables for all the specific
-  ;; options in the set of options given to the function. This set will
-  ;; be generated by the options generator above.
-  (let ((to-date     (gnc:date-option-absolute-time
-                      (get-option gnc:pagename-general "Date")))
-        (accounts    (get-option gnc:pagename-accounts "Accounts"))
-        (currency    (get-option gnc:pagename-general "Report's currency"))
-        (report-title (get-option gnc:pagename-general
-                                  gnc:optname-reportname))
-        (price-source (get-option gnc:pagename-general
-                                  optname-price-source))
-        (include-empty (get-option gnc:pagename-accounts
-                                  optname-zero-shares))
-
-        (collector   (gnc:make-commodity-collector))
-        ;; document will be the HTML document that we return.
-        (table (gnc:make-html-table))
-        (document (gnc:make-html-document)))
-
-    (gnc:html-document-set-title!
-     document (string-append
-               report-title
-               (sprintf #f " %s" (gnc-print-date to-date))))
-
-    ;(gnc:debug "accounts" accounts)
-    (if (not (null? accounts))
-        (let* ((commodity-list (gnc:accounts-get-commodities
-                                (append
-                                 (gnc:acccounts-get-all-subaccounts
-                                  accounts) accounts) currency))
-               (pricedb (gnc-pricedb-get-db (gnc-get-current-book)))
-	       (exchange-fn (gnc:case-exchange-fn price-source currency to-date))
-               (price-fn
-                (case price-source
-                  ((weighted-average average-cost)
-                   (lambda (foreign date)
-                    (cons #f (gnc-numeric-div
-                               (gnc:gnc-monetary-amount
-                                  (exchange-fn (gnc:make-gnc-monetary foreign
-                                                  (gnc-numeric-create 10000 1))
-                                                  currency))
-                               (gnc-numeric-create 10000 1)
-                               GNC-DENOM-AUTO
-                               (logior (GNC-DENOM-SIGFIGS 5) GNC-RND-ROUND)))))
-                  ((pricedb-latest)
-                   (lambda (foreign date)
-                     (let* ((price
-                             (gnc-pricedb-lookup-latest-any-currency
-                              pricedb foreign))
-                            (fn (if (and price (> (length price) 0))
-                                    (let* ((the_price
-                                            (if (gnc-commodity-equiv
-                                                 foreign
-                                                 (gnc-price-get-commodity (car price)))
-                                                (car price)
-                                                (gnc-price-invert (car price))))
-                                           (v (gnc-price-get-value the_price)))
-                                          (gnc-price-ref (car price))
-                                          (cons (car price) v))
-                                        (cons #f (gnc-numeric-zero)))))
-                       (if price (gnc-price-list-destroy price))
-                       fn)))
-                  ((pricedb-nearest)
-                   (lambda (foreign date)
-                     (let*  ((price
-                             (gnc-pricedb-lookup-nearest-in-time-any-currency
-                              pricedb foreign (timespecCanonicalDayTime date)))
-                            (fn (if (and price (> (length price) 0))
-                                    (let* ((the_price
-                                            (if (gnc-commodity-equiv
-                                                 foreign
-                                                 (gnc-price-get-commodity (car price)))
-                                                (car price)
-                                                (gnc-price-invert (car price))))
-                                           (v (gnc-price-get-value (car price))))
-                                           (gnc-price-ref (car price))
-                                           (cons (car price) v))
-                                         (cons #f (gnc-numeric-zero)))))
-                       (if price (gnc-price-list-destroy price))
-                       fn))))))
-
-          (gnc:html-table-set-col-headers!
-           table
-           (list (_ "Account")
-                 (_ "Symbol")
-                 (_ "Listing")
-                 (_ "Units")
-                 (_ "Price")
-                 (_ "Value")))
-
-          (table-add-stock-rows
-           table accounts to-date currency
-           exchange-fn price-fn include-empty collector)
-
-          (gnc:html-table-append-row/markup!
-           table
-           "grand-total"
-           (list
-            (gnc:make-html-table-cell/size
-             1 6 (gnc:make-html-text (gnc:html-markup-hr)))))
-
-          (collector
-           'format
-           (lambda (currency amount)
-             (gnc:html-table-append-row/markup!
-              table
-              "grand-total"
-              (list (gnc:make-html-table-cell/markup
-                     "total-label-cell" (_ "Total"))
-                    (gnc:make-html-table-cell/size/markup
-                     1 5 "total-number-cell"
-                     (gnc:make-gnc-monetary currency amount)))))
-           #f)
-
-          (gnc:html-document-add-object! document table))
-
-                                        ;if no accounts selected.
-        (gnc:html-document-add-object!
-         document
-	 (gnc:html-make-no-account-warning
-	  report-title (gnc:report-id report-obj))))
-
-    (gnc:report-finished)
-    document)))
-
-(gnc:define-report
- 'version 1
- 'name reportname
- 'report-guid "4a6b82e8678c4f3d9e85d9f09634ca89"
- 'menu-path (list gnc:menuname-asset-liability)
- 'options-generator options-generator
- 'renderer portfolio-renderer)
diff --git a/src/report/standard-reports/test/Makefile.am b/src/report/standard-reports/test/Makefile.am
deleted file mode 100644
index 06e8c6a..0000000
--- a/src/report/standard-reports/test/Makefile.am
+++ /dev/null
@@ -1,86 +0,0 @@
-TESTS = $(SCM_TESTS)
-
-SCM_TESTS = \
-	test-cash-flow \
-	test-standard-category-report \
-	test-standard-net-barchart \
-	test-standard-net-linechart
-
-SCM_TEST_SRCS = $(SCM_TESTS:%=%.scm)
-
-GNC_TEST_DEPS = \
-  --gnc-module-dir ${top_builddir}/src/engine \
-  --gnc-module-dir ${top_builddir}/src/engine/test \
-  --gnc-module-dir ${top_builddir}/src/app-utils \
-  --gnc-module-dir ${top_builddir}/src/gnome-utils \
-  --gnc-module-dir ${top_builddir}/src/html \
-  --gnc-module-dir ${top_builddir}/src/report/app-utils \
-  --gnc-module-dir ${top_builddir}/src/report/report-system \
-  --gnc-module-dir ${top_builddir}/src/report/report-system/test \
-\
-  --guile-load-dir ${top_builddir}/src/gnc-module \
-  --guile-load-dir ${top_builddir}/src/scm \
-  --guile-load-dir ${top_builddir}/src/engine \
-  --guile-load-dir ${top_builddir}/src/engine/test \
-  --guile-load-dir ${top_builddir}/src/core-utils \
-  --guile-load-dir ${top_builddir}/src/app-utils \
-  --guile-load-dir ${top_builddir}/src/gnome-utils \
-  --guile-load-dir ${top_builddir}/src/report/report-system \
-  --guile-load-dir ${top_builddir}/src/report/report-system/test \
-  --guile-load-dir ${top_builddir}/src/report/standard-reports \
-  --guile-load-dir ${top_builddir}/src/report/standard-reports/test \
-\
-  --library-dir    ${top_builddir}/src/report/report-system \
-  --library-dir    ${top_builddir}/src/core-utils \
-  --library-dir    ${top_builddir}/src/app-utils \
-  --library-dir    ${top_builddir}/src/gnome-utils \
-  --library-dir    ${top_builddir}/src/engine \
-  --library-dir    ${top_builddir}/src/backend/xml \
-  --library-dir    ${top_builddir}/src/backend/sql \
-  --library-dir    ${top_builddir}/src/gnc-module
-
-$(SCM_TESTS): %: $(srcdir)/%.scm Makefile .scm-links
-	echo 'export GNC_BUILDDIR="${abs_top_builddir}";' > $@
-	echo 'export GNC_UNINSTALLED=yes;' >> $@
-	echo '${GUILE} --debug -l $(srcdir)/$*.scm -c "(exit (run-test))"' >> $@
-	chmod a+x $@
-
-TESTS_ENVIRONMENT = \
-  GUILE_WARN_DEPRECATED=no \
-  GUILE="${GUILE}" \
-  GNC_BUILDDIR="${abs_top_builddir}" \
-  $(shell ${abs_top_srcdir}/src/gnc-test-env.pl --noexports ${GNC_TEST_DEPS})
-
-
-SCM_TEST_HELPERS = \
-	test-generic-category-report.scm \
-	test-generic-net-barchart.scm \
-	test-generic-net-linechart.scm
-
-EXTRA_DIST = \
-	$(SCM_TEST_HELPERS) \
-	$(SCM_TEST_SRCS) \
-	CMakeLists.txt
-
-.scm-links:
-	$(RM) -rf gnucash
-	mkdir -p  gnucash/report/standard-reports/test
-	( cd gnucash/report/standard-reports/test; for A in $(SCM_TEST_HELPERS) ; do $(LN_S) -f $(abs_srcdir)/$$A . ; done )
-if ! OS_WIN32
-# Windows knows no "ln -s" but uses "cp": must copy every time (see bug #566567).
-	touch .scm-links
-endif
-
-interp:
-	$(TESTS_ENVIRONMENT) ${GUILE} --debug
-
-debug:
-	$(TESTS_ENVIRONMENT) gdb --args $(shell cat $(TEST))
-
-clean-local:
-	$(RM) -rf gnucash
-
-noinst_DATA = .scm-links
-CLEANFILES = .scm-links *.log
-DISTCLEANFILES = $(SCM_TESTS)
-
diff --git a/src/report/stylesheets/CMakeLists.txt b/src/report/stylesheets/CMakeLists.txt
deleted file mode 100644
index f2480f5..0000000
--- a/src/report/stylesheets/CMakeLists.txt
+++ /dev/null
@@ -1,85 +0,0 @@
-ADD_SUBDIRECTORY(test)
-
-SET(stylesheets_SOURCES
-  gnc-plugin-stylesheets.c
-  gncmod-stylesheets.c
-)
-
-SET(stylesheets_noinst_HEADERS
-  gnc-plugin-stylesheets.h
-)
-
-ADD_LIBRARY(gncmod-stylesheets MODULE ${stylesheets_SOURCES} ${stylesheets_noinst_HEADERS})
-
-TARGET_LINK_LIBRARIES(gncmod-stylesheets gncmod-report-gnome gncmod-report-system gncmod-gnome-utils gnc-module
-    ${GUILE_LDFLAGS} ${GTK3_LDFLAGS} ${GLIB2_LDFLAGS})
-
-TARGET_COMPILE_DEFINITIONS(gncmod-stylesheets PRIVATE -DG_LOG_DOMAIN=\"gnc.report.core\")
-
-SET(LIB_DIR lib/gnucash)
-IF (WIN32)
-  SET(LIB_DIR bin)
-ENDIF(WIN32)
-
-
-INSTALL(TARGETS gncmod-stylesheets
-  LIBRARY DESTINATION ${LIB_DIR}
-  ARCHIVE DESTINATION ${LIB_DIR}
-  RUNTIME DESTINATION bin)
-
-# No headers to install
-
-# Scheme
-
-SET(stylesheets_SCHEME_1
-  stylesheet-plain.scm
-  stylesheet-fancy.scm
-  stylesheet-footer.scm
-  stylesheet-easy.scm
-  stylesheet-head-or-tail.scm
-)
-
-SET(stylesheets_SCHEME_2
-  stylesheets.scm
-)
-
-SET(GUILE_OUTPUT_DIR gnucash/report)
-SET(GUILE_MODULES src/app-utils src/engine src/html src/gnome-utils src/report/report-system)
-SET(GUILE_LOAD_DIRS src/app-utils src/core-utils src/engine src/gnc-module src/gnome-utils src/report/report-system src/scm)
-SET(GUILE_LIBRARY_DIRS src/engine src/app-utils src/core-utils src/gnc-module src/gnome-utils src/html src/report/report-system)
-SET(GUILE_DEPENDS gncmod-html scm-app-utils scm-report-system-3)
-
-GNC_ADD_SCHEME_TARGETS(scm-report-stylesheets-1
-  "${stylesheets_SCHEME_1}"
-  ${GUILE_OUTPUT_DIR}
-  "${GUILE_MODULES}"
-  "${GUILE_LOAD_DIRS}"
-  "${GUILE_LIBRARY_DIRS}"
-  "${GUILE_DEPENDS}"
-  TRUE
-)
-
-GNC_ADD_SCHEME_TARGETS(scm-report-stylesheets-2
-  "${stylesheets_SCHEME_2}"
-  ${GUILE_OUTPUT_DIR}
-  "${GUILE_MODULES}"
-  "${GUILE_LOAD_DIRS}"
-  "${GUILE_LIBRARY_DIRS}"
-  "scm-report-stylesheets-1;${GUILE_DEPENDS}"
-  TRUE
-)
-
-ADD_CUSTOM_TARGET(scm-report-stylesheets ALL DEPENDS scm-report-stylesheets-1 scm-report-stylesheets-2)
-
-SET(stylesheets_UI gnc-plugin-stylesheets-ui.xml)
-
-INSTALL(FILES ${stylesheets_UI} DESTINATION share/gnucash/ui)
-
-FILE(COPY ${stylesheets_UI}
-  DESTINATION ${DATADIR_BUILD}/gnucash/ui)
-
-SET_LOCAL_DIST(stylesheets_DIST_local CMakeLists.txt Makefile.am
-        ${stylesheets_SOURCES} ${stylesheets_noinst_HEADERS}
-        ${stylesheets_SCHEME_1} ${stylesheets_SCHEME_2}  ${stylesheets_UI})
-
-SET(stylesheets_DIST ${stylesheets_DIST_local} ${test_stylesheets_DIST} PARENT_SCOPE)
diff --git a/src/report/stylesheets/Makefile.am b/src/report/stylesheets/Makefile.am
deleted file mode 100644
index 6596b11..0000000
--- a/src/report/stylesheets/Makefile.am
+++ /dev/null
@@ -1,115 +0,0 @@
-SUBDIRS = . test
-
-pkglib_LTLIBRARIES = libgncmod-stylesheets.la
-
-libgncmod_stylesheets_la_SOURCES = \
-  gnc-plugin-stylesheets.c \
-  gncmod-stylesheets.c 
-
-noinst_HEADERS = \
-  gnc-plugin-stylesheets.h
-
-libgncmod_stylesheets_la_LDFLAGS = -module -avoid-version
-
-libgncmod_stylesheets_la_LIBADD = \
-  ${top_builddir}/src/report/report-gnome/libgncmod-report-gnome.la \
-  ${top_builddir}/src/report/report-system/libgncmod-report-system.la \
-  ${top_builddir}/src/gnome-utils/libgncmod-gnome-utils.la \
-  ${top_builddir}/src/gnc-module/libgnc-module.la \
-  ${top_builddir}/src/engine/libgncmod-engine.la \
-  ${GUILE_LIBS} \
-  ${GTK_LIBS} \
-  ${GLIB_LIBS}
-
-AM_CPPFLAGS = \
-  -I${top_srcdir}/src \
-  -I${top_srcdir}/src/engine \
-  -I${top_srcdir}/src/gnc-module \
-  -I${top_srcdir}/src/gnome \
-  -I${top_srcdir}/src/gnome-utils \
-  -I${top_srcdir}/src/report/report-gnome \
-  ${GUILE_CFLAGS} \
-  ${GLIB_CFLAGS} \
-  ${GTK_CFLAGS}
-
-gncscmmoddir = ${GNC_SCM_INSTALL_DIR}/gnucash/report/
-gncscmmod_DATA = \
-  stylesheets.scm \
-  stylesheet-plain.scm \
-  stylesheet-fancy.scm \
-  stylesheet-footer.scm \
-  stylesheet-easy.scm \
-  stylesheet-head-or-tail.scm
-
-if GNUCASH_SEPARATE_BUILDDIR
-#For executing test cases
-SCM_FILE_LINKS = ${gncscmmod_DATA}
-endif
-
-.scm-links:
-	$(RM) -rf gnucash
-	mkdir -p  gnucash
-	mkdir -p  gnucash/report
-if GNUCASH_SEPARATE_BUILDDIR
-	for X in ${SCM_FILE_LINKS} ; do \
-	  $(LN_S) -f ${srcdir}/$$X . ; \
-	done
-endif
-	( cd gnucash/report; for A in $(gncscmmod_DATA) ; do $(LN_S) -f ../../$$A . ; done )
-if ! OS_WIN32
-# Windows knows no "ln -s" but uses "cp": must copy every time (see bug #566567).
-	touch .scm-links
-endif
-
-if GNC_HAVE_GUILE_2
-GUILE_COMPILE_ENV = \
-  --gnc-module-dir ${top_builddir}/src/app-utils \
-  --gnc-module-dir ${top_builddir}/src/engine \
-  --gnc-module-dir ${top_builddir}/src/html \
-  --gnc-module-dir ${top_builddir}/src/gnome-utils \
-  --gnc-module-dir ${top_builddir}/src/report/report-system \
-  --gnc-module-dir ${top_builddir}/src/report/stylesheets \
-  --guile-load-dir ${top_builddir}/src/app-utils \
-  --guile-load-dir ${top_builddir}/src/core-utils \
-  --guile-load-dir ${top_builddir}/src/engine \
-  --guile-load-dir ${top_builddir}/src/gnc-module \
-  --guile-load-dir ${top_builddir}/src/gnome-utils \
-  --guile-load-dir ${top_builddir}/src/report/report-system \
-  --guile-load-dir ${top_builddir}/src/report/stylesheets \
-  --guile-load-dir ${top_builddir}/src/scm \
-  --library-dir    ${top_builddir}/src/engine \
-  --library-dir    ${top_builddir}/src/app-utils \
-  --library-dir    ${top_builddir}/src/core-utils \
-  --library-dir    ${top_builddir}/src/gnc-module \
-  --library-dir    ${top_builddir}/src/gnome-utils \
-  --library-dir    ${top_builddir}/src/backend/xml \
-  --library-dir    ${top_builddir}/src/backend/sql \
-  --library-dir    ${top_builddir}/src/html \
-  --library-dir    ${top_builddir}/src/report/report-system \
-  --library-dir    ${top_builddir}/src/report/stylesheets
-
-%.go : %.scm .scm-links $(pkglib_LTLIBRARIES)
-	GNC_UNINSTALLED=yes \
-	GNC_BUILDDIR=${top_builddir} \
-	$(shell ${abs_top_srcdir}/src/gnc-test-env.pl --noexports ${GUILE_COMPILE_ENV}) \
-	$(GUILD) compile -o $@ $<
-
-gncscmmodcachedir = ${pkglibdir}/scm/ccache/@GUILE_EFFECTIVE_VERSION@/gnucash/report
-gncscmmodcache_DATA = $(gncscmmod_DATA:.scm=.go)
-endif
-
-clean-local:
-	$(RM) -rf gnucash
-
-noinst_DATA = .scm-links
-
-uidir = $(GNC_UI_DIR)
-dist_ui_DATA = \
-	gnc-plugin-stylesheets-ui.xml
-
-EXTRA_DIST = ${gncscmmod_DATA} CMakeLists.txt
-
-CLEANFILES = .scm-links ${gncscmmodcache_DATA}
-DISTCLEANFILES = ${SCM_FILE_LINKS}
-
-AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.report.core\"
diff --git a/src/report/stylesheets/test/Makefile.am b/src/report/stylesheets/test/Makefile.am
deleted file mode 100644
index 73b133a..0000000
--- a/src/report/stylesheets/test/Makefile.am
+++ /dev/null
@@ -1,38 +0,0 @@
-TESTS=test-load-module
-
-GNC_TEST_DEPS = --gnc-module-dir ${top_builddir}/src/engine \
-  --gnc-module-dir ${top_builddir}/src/app-utils \
-  --gnc-module-dir ${top_builddir}/src/gnome-utils \
-  --gnc-module-dir ${top_builddir}/src/html \
-  --gnc-module-dir ${top_builddir}/src/report/report-system \
-  --gnc-module-dir ${top_builddir}/src/report/stylesheets \
-\
-  --guile-load-dir ${top_builddir}/src/test-core \
-  --guile-load-dir ${top_builddir}/src/gnc-module \
-  --guile-load-dir ${top_builddir}/src/engine \
-  --guile-load-dir ${top_builddir}/src/scm \
-  --guile-load-dir ${top_builddir}/src/core-utils \
-  --guile-load-dir ${top_builddir}/src/app-utils \
-  --guile-load-dir ${top_builddir}/src/gnome-utils \
-  --guile-load-dir ${top_builddir}/src/report/report-system \
-  --guile-load-dir ${top_builddir}/src/report/stylesheets \
-\
-  --library-dir    ${top_builddir}/src/test-core \
-  --library-dir    ${top_builddir}/src/core-utils \
-  --library-dir    ${top_builddir}/src/gnc-module \
-  --library-dir    ${top_builddir}/src/engine \
-  --library-dir    ${top_builddir}/src/backend/xml \
-  --library-dir    ${top_builddir}/src/backend/sql \
-  --library-dir    ${top_builddir}/src/app-utils \
-  --library-dir    ${top_builddir}/src/gnome-utils \
-  --library-dir    ${top_builddir}/src/html \
-  --library-dir    ${top_builddir}/src/report/report-system \
-  --library-dir    ${top_builddir}/src/report/report-gnome
-
-TESTS_ENVIRONMENT = \
-  GUILE_WARN_DEPRECATED=no \
-  GUILE="${GUILE}" \
-  GNC_BUILDDIR="${abs_top_builddir}" \
-  $(shell ${abs_top_srcdir}/src/gnc-test-env.pl --noexports ${GNC_TEST_DEPS})
-
-EXTRA_DIST = test-load-module CMakeLists.txt
diff --git a/src/report/utility-reports/CMakeLists.txt b/src/report/utility-reports/CMakeLists.txt
deleted file mode 100644
index 2c0a4aa..0000000
--- a/src/report/utility-reports/CMakeLists.txt
+++ /dev/null
@@ -1,30 +0,0 @@
-# Scheme
-
-SET(utility_reports_SCHEME
-  hello-world.scm
-  utility-reports.scm
-  view-column.scm
-  welcome-to-gnucash.scm
-)
-
-SET(GUILE_OUTPUT_DIR     gnucash/report)
-SET(GUILE_MODULES        src/app-utils src/engine src/gnome-utils src/html src/report/report-system)
-SET(GUILE_LOAD_DIRS      src/app-utils src/core-utils src/engine src/gnc-module
-                            src/gnome-utils src/report/report-system src/scm)
-SET(GUILE_LIBRARY_DIRS   src/engine src/app-utils src/core-utils src/gnc-module src/gnome-utils src/html
-                              src/report/report-system)
-SET(GUILE_DEPENDS        scm-utility-reports-links scm-app-utils scm-report-system-3)
-
-GNC_ADD_SCHEME_TARGETS(scm-utility-reports
-  "${utility_reports_SCHEME}"
-  ${GUILE_OUTPUT_DIR}
-  "${GUILE_MODULES}"
-  "${GUILE_LOAD_DIRS}"
-  "${GUILE_LIBRARY_DIRS}"
-  "${GUILE_DEPENDS}"
-  TRUE
-)
-
-SET_LOCAL_DIST(utility_reports_DIST_local CMakeLists.txt Makefile.am
-        ${utility_reports_SCHEME})
-SET(utility_reports_DIST ${utility_reports_DIST_local} ${test_utility_reports_DIST} PARENT_SCOPE)
diff --git a/src/report/utility-reports/Makefile.am b/src/report/utility-reports/Makefile.am
deleted file mode 100644
index 33a03b0..0000000
--- a/src/report/utility-reports/Makefile.am
+++ /dev/null
@@ -1,76 +0,0 @@
-gncscmmoddir = ${GNC_SCM_INSTALL_DIR}/gnucash/report/
-gncscmmod_DATA = \
-  hello-world.scm \
-  utility-reports.scm \
-  view-column.scm \
-  welcome-to-gnucash.scm
-
-#  test-graphing.scm -- not intended for general public?!? Surely not translated at all.
-
-if GNUCASH_SEPARATE_BUILDDIR
-#For separate build directory
-SCM_FILE_LINKS = \
-  ${gncscmmod_DATA}
-endif
-
-.scm-links:
-	$(RM) -rf gnucash
-	mkdir -p  gnucash
-	mkdir -p  gnucash/report
-if GNUCASH_SEPARATE_BUILDDIR
-	for X in ${SCM_FILE_LINKS} ; do \
-	  $(LN_S) -f ${srcdir}/$$X . ; \
-	done
-endif
-	( cd gnucash/report; for A in $(gncscmmod_DATA) ; do $(LN_S) -f ../../$$A . ; done )
-if ! OS_WIN32
-# Windows knows no "ln -s" but uses "cp": must copy every time (see bug #566567).
-	touch .scm-links
-endif
-
-if GNC_HAVE_GUILE_2
-GUILE_COMPILE_ENV = \
-  --gnc-module-dir ${top_builddir}/src/app-utils \
-  --gnc-module-dir ${top_builddir}/src/engine \
-  --gnc-module-dir ${top_builddir}/src/gnome-utils \
-  --gnc-module-dir ${top_builddir}/src/html \
-  --gnc-module-dir ${top_builddir}/src/report/report-system \
-  --guile-load-dir ${top_builddir}/src/app-utils \
-  --guile-load-dir ${top_builddir}/src/core-utils \
-  --guile-load-dir ${top_builddir}/src/engine \
-  --guile-load-dir ${top_builddir}/src/gnc-module \
-  --guile-load-dir ${top_builddir}/src/gnome-utils \
-  --guile-load-dir ${top_builddir}/src/report/report-system \
-  --guile-load-dir ${top_builddir}/src/report/utility-reports \
-  --guile-load-dir ${top_builddir}/src/scm \
-  --library-dir    ${top_builddir}/src/engine \
-  --library-dir    ${top_builddir}/src/app-utils \
-  --library-dir    ${top_builddir}/src/core-utils \
-  --library-dir    ${top_builddir}/src/gnc-module \
-  --library-dir    ${top_builddir}/src/gnome-utils \
-  --library-dir    ${top_builddir}/src/backend/xml \
-  --library-dir    ${top_builddir}/src/backend/sql \
-  --library-dir    ${top_builddir}/src/html \
-  --library-dir    ${top_builddir}/src/report/report-system
-
-%.go : %.scm .scm-links $(pkglib_LTLIBRARIES)
-	GNC_UNINSTALLED=yes \
-	GNC_BUILDDIR=${top_builddir} \
-	$(shell ${abs_top_srcdir}/src/gnc-test-env.pl --noexports ${GUILE_COMPILE_ENV}) \
-	$(GUILD) compile -o $@ $<
-
-gncscmmodcachedir = ${pkglibdir}/scm/ccache/@GUILE_EFFECTIVE_VERSION@/gnucash/report
-gncscmmodcache_DATA = $(gncscmmod_DATA:.scm=.go)
-endif
-
-clean-local:
-	$(RM) -rf gnucash
-
-noinst_DATA = .scm-links
-
-EXTRA_DIST = ${gncscmmod_DATA} CMakeLists.txt
-
-CLEANFILES = .scm-links ${gncscmmodcache_DATA}
-DISTCLEANFILES = ${SCM_FILE_LINKS}
-
-AM_CPPFLAGS = -DG_LOG_DOMAIN=\"gnc.report.util\"
diff --git a/src/report/utility-reports/hello-world.scm b/src/report/utility-reports/hello-world.scm
deleted file mode 100644
index 6cf6109..0000000
--- a/src/report/utility-reports/hello-world.scm
+++ /dev/null
@@ -1,522 +0,0 @@
-;; -*-scheme-*-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; 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 at gnu.org
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-
-;; This is a sample guile report generator for GnuCash.
-;; It illustrates the basic techniques used to create
-;; new reports for GnuCash.
-
-(define-module (gnucash report hello-world))
-(use-modules (gnucash main)) ;; FIXME: delete after we finish modularizing.
-(use-modules (gnucash gnc-module))
-(use-modules (gnucash gettext))
-
-;; 'debug is deprecated and unused since guile 2
-(cond-expand
-  (guile-2 )
-  (else
-    (debug-enable 'debug)))
-(debug-enable 'backtrace)
-
-(gnc:module-load "gnucash/report/report-system" 0)
-(gnc:module-load "gnucash/html" 0) ;for gnc-build-url
-
-;; This function will generate a set of options that GnuCash
-;; will use to display a dialog where the user can select
-;; values for your report's parameters.
-(define (options-generator)    
-  (let* ((options (gnc:new-options)) 
-         ;; This is just a helper function for making options.
-         ;; See gnucash/src/app-utils/options.scm for details.
-         (add-option 
-          (lambda (new-option)
-            (gnc:register-option options new-option))))
-    
-    ;; This is a boolean option. It is in Section 'Hello, World!'
-    ;; and is named 'Boolean Option'. Its sorting key is 'a',
-    ;; thus it will come before options with sorting keys
-    ;; 'b', 'c', etc. in the same section. The default value
-    ;; is #t (true). The phrase 'This is a boolean option'
-    ;; will be displayed as help text when the user puts
-    ;; the mouse pointer over the option.
-    (add-option
-     (gnc:make-simple-boolean-option
-      (N_ "Hello, World!") (N_ "Boolean Option")
-      "a" (N_ "This is a boolean option.") #t))
-    
-    ;; This is a multichoice option. The user can choose between
-    ;; the values 'first, 'second, 'third, or 'fourth. These are guile
-    ;; symbols. The value 'first will be displayed as "First Option"
-    ;; and have a help string of "Help for first option.". The default
-    ;; value is 'third.
-    (add-option
-     (gnc:make-multichoice-option
-      (N_ "Hello, World!") (N_ "Multi Choice Option")
-      "b" (N_ "This is a multi choice option.") 'third
-      (list (list->vector
-             (list 'first
-                   (N_ "First Option")
-                   (N_ "Help for first option.")))
-            (list->vector
-             (list 'second
-                   (N_ "Second Option")
-                   (N_ "Help for second option.")))
-            (list->vector
-             (list 'third
-                   (N_ "Third Option")
-                   (N_ "Help for third option.")))
-            (list->vector
-             (list 'fourth
-                   (N_ "Fourth Options")
-                   (N_ "The fourth option rules!"))))))
-    
-    ;; This is a string option. Users can type anything they want
-    ;; as a value. The default value is "Hello, World". This is
-    ;; in the same section as the option above. It will be shown
-    ;; after the option above because its key is 'b' while the
-    ;; other key is 'a'.
-    (add-option
-     (gnc:make-string-option
-      (N_ "Hello, World!") (N_ "String Option")
-      "c" (N_ "This is a string option.") (N_ "Hello, World")))
-    
-    ;; This is a date/time option. The user can pick a date and,
-    ;; possibly, a time. Times are stored as a pair
-    ;; (seconds . nanoseconds) measured from Jan 1, 1970, i.e.,
-    ;; Unix time. The last option is false, so the user can only
-    ;; select a date, not a time. The default value is the current
-    ;; time.
-    (add-option
-     (gnc:make-date-option
-      (N_ "Hello, World!") (N_ "Just a Date Option")
-      "d" (N_ "This is a date option.")
-      (lambda () (cons 'absolute (cons (current-time) 0)))
-      #f 'absolute #f ))
-    
-    ;; This is another date option, but the user can also select
-    ;; the time.
-    (add-option
-     (gnc:make-date-option
-      (N_ "Hello, World!") (N_ "Time and Date Option")
-      "e" (N_ "This is a date option with time.")
-      (lambda () (cons 'absolute (cons (current-time) 0)))
-      #t 'absolute #f ))
-    
-    (add-option
-     (gnc:make-date-option
-      (N_ "Hello, World!") (N_ "Combo Date Option")
-      "y" (N_ "This is a combination date option.")
-      (lambda () (cons 'relative 'start-cal-year))
-      #f 'both '(start-cal-year start-prev-year end-prev-year) ))
-    
-    (add-option
-     (gnc:make-date-option
-      (N_ "Hello, World!") (N_ "Relative Date Option")
-      "x" (N_ "This is a relative date option.")
-      (lambda () (cons 'relative 'start-cal-year))
-      #f 'relative '(start-cal-year start-prev-year end-prev-year) ))
-    
-    ;; This is a number range option. The user can enter a number
-    ;; between a lower and upper bound given below. There are also
-    ;; arrows the user can click to go up or down, the amount changed
-    ;; by a single click is given by the step size.
-    (add-option
-     (gnc:make-number-range-option
-      (N_ "Hello, World!") (N_ "Number Option")
-      "ee" (N_ "This is a number option.")
-      1500.0  ;; default
-      0.0     ;; lower bound
-      10000.0 ;; upper bound
-      2.0     ;; number of decimals
-      0.01    ;; step size
-      ))
-    
-    ;; This is a color option, defined by rgba values. A color value
-    ;; is a list where the elements are the red, green, blue, and
-    ;; alpha channel values respectively. The penultimate argument
-    ;; (255) is the allowed range of rgba values. The final argument
-    ;; (#f) indicates the alpha value should be ignored. You can get
-    ;; a color string from a color option with gnc:color-option->html,
-    ;; which will scale the values appropriately according the range.
-    (add-option
-     (gnc:make-color-option
-      (N_ "Hello, World!") (N_ "Background Color")
-      "f" (N_ "This is a color option.")
-      (list #xf6 #xff #xdb 0)
-      255
-      #f))
-    (add-option
-     (gnc:make-color-option
-      (N_ "Hello, World!") (N_ "Text Color")
-      "f" (N_ "This is a color option.")
-      (list #x00 #x00 #x00 0)
-      255
-      #f))
-    
-    ;; This is an account list option. The user can select one
-    ;; or (possibly) more accounts from the list of accounts
-    ;; in the current file. Values are scheme handles to actual
-    ;; C pointers to accounts. 
-    ;; The #f value indicates that any account will be accepted.
-    ;; Instead of a #f values, you could provide a function that
-    ;; accepts a list of account values and returns a pair. If
-    ;; the first element is #t, the second element is the list
-    ;; of accounts actually accepted. If the first element is
-    ;; #f, the accounts are rejected and the second element is
-    ;; and error string. The last argument is #t which means
-    ;; the user is allowed to select more than one account.
-    ;; The default value for this option is the currently
-    ;; selected account in the main window, if any.
-    (add-option
-     (gnc:make-account-list-option
-      (N_ "Hello Again") (N_ "An account list option")
-      "g" (N_ "This is an account list option.")
-      ;; FIXME : this used to be gnc:get-current-accounts, but 
-      ;; that doesn't exist any more.
-      (lambda () '())
-      #f #t))
-    
-    ;; This is a list option. The user can select one or (possibly)
-    ;; more values from a list. The list of acceptable values is
-    ;; the same format as a multichoice option. The value of the
-    ;; option is a list of symbols.
-    (add-option
-     (gnc:make-list-option
-      (N_ "Hello Again") (N_ "A list option")
-      "h" (N_ "This is a list option.")
-      (list 'good)
-      (list (list->vector
-             (list 'good
-                   (N_ "The Good")
-                   (N_ "Good option.")))
-            (list->vector
-             (list 'bad
-                   (N_ "The Bad")
-                   (N_ "Bad option.")))
-            (list->vector
-             (list 'ugly
-                   (N_ "The Ugly")
-                   (N_ "Ugly option."))))))
-    
-    ;; This option is for testing. When true, the report generates
-    ;; an exception.
-    (add-option
-     (gnc:make-simple-boolean-option
-      (N_ "Testing") (N_ "Crash the report")
-      "a" 
-      (N_ "This is for testing. \
-Your reports probably shouldn't have an \
-option like this.") 
-      #f))
-    
-    (gnc:options-set-default-section options "Hello, World!")      
-    options))
-
-;; This is the rendering function. It accepts a database of options
-;; and generates an object of type <html-document>.  See the file
-;; report-html.txt for documentation; the file report-html.scm
-;; includes all the relevant Scheme code. The option database passed
-;; to the function is one created by the options-generator function
-;; defined above.
-(define (hello-world-renderer report-obj)
-  ;; These are some helper functions for looking up option values.
-  (define (get-op section name)
-    (gnc:lookup-option (gnc:report-options report-obj) section name))
-  
-  (define (op-value section name)
-    (gnc:option-value (get-op section name)))
-
-  ;; The first thing we do is make local variables for all the specific
-  ;; options in the set of options given to the function. This set will
-  ;; be generated by the options generator above.
-  (let ((bool-val     (op-value "Hello, World!" "Boolean Option"))
-        (mult-val     (op-value "Hello, World!" "Multi Choice Option"))
-        (string-val   (op-value "Hello, World!" "String Option"))
-        (date-val     (gnc:date-option-absolute-time
-                       (op-value "Hello, World!" "Just a Date Option")))
-        (date2-val    (gnc:date-option-absolute-time
-                       (op-value "Hello, World!" "Time and Date Option")))
-        (rel-date-val (gnc:date-option-absolute-time
-                       (op-value "Hello, World!" "Relative Date Option")))
-        (combo-date-val (gnc:date-option-absolute-time
-                         (op-value "Hello, World!" "Combo Date Option")))
-        (num-val      (op-value "Hello, World!" "Number Option"))
-        (bg-color-op  (get-op   "Hello, World!" "Background Color"))
-        (txt-color-op (get-op   "Hello, World!" "Text Color"))
-        (accounts     (op-value "Hello Again"   "An account list option"))
-        (list-val     (op-value "Hello Again"   "A list option"))
-        (crash-val    (op-value "Testing"       "Crash the report"))
-        
-        ;; document will be the HTML document that we return.
-        (document (gnc:make-html-document)))
-
-    ;; Crash if asked to.
-    (if crash-val (string-length #f)) ;; string-length needs a string
-
-    ;; these are samples of different date options. for a simple
-    ;; date with day, month, and year but no time you should use
-    ;; gnc-print-date
-    (let ((time-string (strftime "%X" (gnc-localtime (current-time))))
-          (date-string (strftime "%x" (gnc-localtime (car date-val))))
-          (date-string2 (strftime "%x %X" (gnc-localtime (car date2-val))))
-          (rel-date-string (strftime "%x" (gnc-localtime (car rel-date-val))))
-          (combo-date-string
-           (strftime "%x" (gnc-localtime (car combo-date-val)))))
-
-      ;; Here's where we fill the report document with content.  We
-      ;; do this by adding 'html objects' such as text, tables, and
-      ;; graphs to the html document we already created.
-      
-      ;; the report's style sheet (an "invisible" option that every
-      ;; report has) will usually set the default background color,
-      ;; but we can override that here.  You set background color in
-      ;; HTML by specifying the "bgcolor" attribute for the <body>
-      ;; tag.
-
-      ;; every HTML object has "styles" for markup and data.  the
-      ;; style for an HTML tag such as "body" tells the HTML
-      ;; document how to render the markup and content for tagged
-      ;; elements.  For each tag, you can specify a font-face,
-      ;; font-color, and font-size to render the contents of the
-      ;; element, and any number of attributes to put in the
-      ;; start-tag.  You can pass 'inheritable? #f if you wish the
-      ;; style to apply only to markup in the object itself and not
-      ;; to its components.  You can also override the tag itself if
-      ;; you want to create your own custom markup (see
-      ;; documentation).
-      
-      ;; in this case, we are saying "every time you see <body>
-      ;; markup anywhere in 'document' or its components, add the
-      ;; attribute "bgcolor=0xXXXXXX" in the start tag, and enclose
-      ;; the content in a <font> block to set the font color".
-      ;; Altogether, we get
-      ;;
-      ;; <body bgcolor=0xXXXXXXX>
-      ;; <font color="0xXXXXXX"> (body) </font>
-      ;; </body>
-
-      ;; of course if a component object explicitly selects a 
-      ;; different font that will override the body font.
-      
-      (gnc:html-document-set-style!
-       document "body" 
-       'attribute (list "bgcolor" (gnc:color-option->html bg-color-op))
-       'font-color (gnc:color-option->html txt-color-op))
-      
-      ;; the title of the report will be rendered by the 
-      ;; selected style sheet.  All we have to do is set it in the
-      ;; HTML document.
-      
-      ;; Note we invoke the _ function upon this string.
-      ;; The _ function works the same way as in C -- if a
-      ;; translation of the given string is available for the
-      ;; current locale, then the translation is returned,
-      ;; otherwise the original string is returned.
-      (gnc:html-document-set-title! document (_ "Hello, World"))
-
-      ;; we make a "text object" to add a bunch of text to.
-      ;; the function gnc:make-html-text can take any number of 
-      ;; arguments.  The gnc:html-markup functions are designed
-      ;; to work with the style system so that you can control
-      ;; the appearance of the report from the Gnucash UI; you 
-      ;; should use the HTML markup functions whenever possible
-      ;; rather than including literal HTML in your report.
-
-      (gnc:html-document-add-object!
-       document
-       (gnc:make-html-text         
-        (gnc:html-markup-p
-         (gnc:html-markup/format
-          (_ "This is a sample GnuCash report. \
-See the guile (scheme) source code in the scm/report directory \
-for details on writing your own reports, \
-or extending existing reports.")))
-        (gnc:html-markup-p
-         (gnc:html-markup/format
-          (_ "For help on writing reports, or to contribute your brand \
-new, totally cool report, consult the mailing list %s.")
-          (gnc:html-markup-anchor 
-           "mailto:gnucash-devel at gnucash.org"
-           (gnc:html-markup-tt "gnucash-devel at gnucash.org")))
-         (_ "For details on subscribing to that list, see <http://www.gnucash.org/>.")
-         (_ "You can learn more about writing scheme at <http://www.scheme.com/tspl2d/>."))
-
-        (gnc:html-markup-p
-         (gnc:html-markup/format
-          (_ "The current time is %s.") 
-          (gnc:html-markup-b time-string)))
-
-        (gnc:html-markup-p
-         (gnc:html-markup/format
-          (_ "The boolean option is %s.")
-          (gnc:html-markup-b (if bool-val (_ "true") (_ "false")))))
-
-        (gnc:html-markup-p
-         (gnc:html-markup/format
-          (_ "The multi-choice option is %s.")
-          (gnc:html-markup-b (symbol->string mult-val))))
-
-        (gnc:html-markup-p
-         (gnc:html-markup/format
-          (_ "The string option is %s.") 
-          (gnc:html-markup-b string-val)))
-
-        (gnc:html-markup-p
-         (gnc:html-markup/format
-          (_ "The date option is %s.") 
-          (gnc:html-markup-b date-string)))
-
-        (gnc:html-markup-p
-         (gnc:html-markup/format
-          (_ "The date and time option is %s.") 
-          (gnc:html-markup-b date-string2)))
-
-        (gnc:html-markup-p
-         (gnc:html-markup/format 
-          (_ "The relative date option is %s.")
-          (gnc:html-markup-b rel-date-string)))
-
-        (gnc:html-markup-p
-         (gnc:html-markup/format 
-          (_ "The combination date option is %s.")
-          (gnc:html-markup-b combo-date-string)))
-
-        (gnc:html-markup-p
-         (gnc:html-markup/format 
-          (_ "The number option is %s.")
-          (gnc:html-markup-b (number->string num-val))))
-
-        ;; Here we print the value of the number option formatted as
-        ;; currency. When printing currency values, you should use
-        ;; the function (xaccPrintAmount), which is defined in
-        ;; report-utilities. This functions will format the number
-        ;; appropriately in the current locale. Don't try to format
-        ;; it yourself -- it will be wrong in other locales.
-        (gnc:html-markup-p 
-         (gnc:html-markup/format
-          (_ "The number option formatted as currency is %s.")
-          (gnc:html-markup-b
-           (xaccPrintAmount
-            (gnc:make-gnc-numeric (inexact->exact num-val) 1)
-            (gnc-default-print-info #f)))))))
-
-      ;; you can add as many objects as you want.  Here's another 
-      ;; one.  We'll make a single-column table of the selected list 
-      ;; options just for grins. 
-      (gnc:html-document-add-object!
-       document
-       (gnc:make-html-text
-        (gnc:html-markup-p (_ "Items you selected:"))))
-
-      (if (not (null? list-val))
-          (let ((table (gnc:make-html-table)))
-            (gnc:html-table-append-column! 
-             table (map symbol->string list-val))
-            (gnc:html-table-set-caption! table 
-                                         (_ "List items selected"))
-            (gnc:html-document-add-object! document table))
-          (let ((txt (gnc:make-html-text)))
-            (gnc:html-text-append!
-             txt
-             (gnc:html-markup-p (_ "(You selected no list items.)")))
-            (gnc:html-document-add-object! document txt)))
-      
-      ;; here's a bullet list of accounts.  We can mark up the
-      ;; account name with an <a></a> anchor with a special HREF to
-      ;; open a Gnucash register when the link is clicked.  What you
-      ;; need to do is pass the HREF "gnc-register:account=My
-      ;; Account Name" to html-markup-anchor.  The account name
-      ;; passed must be the "full" account name that you get from
-      ;; gnc-account-get-full-name.  You should build this url using
-      ;; (gnc-build-url ...)
-      ;;
-      ;; html-markup-anchor takes the link to jump to as its first
-      ;; arg and then puts the remaining args in the body of the
-      ;; link).
-      ;;
-      ;; html-markup-ul makes a "<ul>" unnumbered list, and takes as
-      ;; its one argument a list of items to put in <li> blocks.
-      (if (not (null? accounts))
-          (gnc:html-document-add-object!
-           document
-           (gnc:make-html-text
-            (gnc:html-markup-ul
-             (map 
-              (lambda (acct)
-                (gnc:html-markup-anchor 
-		 (gnc-build-url URL-TYPE-REGISTER
-				     (string-append "account=" 
-						    (gnc-account-get-full-name
-						     acct))
-				     "")
-                 (xaccAccountGetName acct)))
-              accounts))))
-          (gnc:html-document-add-object!
-           document
-           (gnc:make-html-text
-            (gnc:html-markup-p (_ "You have selected no accounts.")))))
-            
-      (gnc:html-document-add-object! 
-       document 
-       (gnc:make-html-text 
-        (gnc:html-markup-anchor (gnc-build-url URL-TYPE-HELP "gnucash-guide" "") (_ "Display help"))))
-
-      (gnc:html-document-add-object! 
-       document 
-       (gnc:make-html-text 
-        (gnc:html-markup-p (_ "Have a nice day!"))))
-      
-      document)))
-
-;; Here we define the actual report with gnc:define-report
-(gnc:define-report
- 
- ;; The version of this report.
- 'version 1
- 
- ;; The name of this report. This will be used, among other things,
- ;; for making its menu item in the main menu. You need to use the
- ;; untranslated value here!
- 'name (N_ "Hello, World")
-
- ;; The GUID for this report. This string should be unique, set once
- ;; and left alone forever after that. In theory, you could use any
- ;; unique string, even a meaningful one (!) but its probably best to
- ;; use a true uuid. Get them from `uuidgen | sed -e s/-//g` and paste
- ;; the results in here. You must make a new guid for each report!
- 'report-guid "898d78ec92854402bf76e20a36d24ade"
-
- ;; The name in the menu
- ;; (only necessary if it differs from the name)
- 'menu-name (N_ "Sample Report with Examples")
-
- ;; A tip that is used to provide additional information about the
- ;; report to the user.
- 'menu-tip (N_ "A sample report with examples.")
-
- ;; A path describing where to put the report in the menu system.
- ;; In this case, it's going under the utility menu.
- 'menu-path (list gnc:menuname-utility)
-
- ;; The options generator function defined above.
- 'options-generator options-generator
- 
- ;; The rendering function defined above.
- 'renderer hello-world-renderer)
diff --git a/src/scm/CMakeLists.txt b/src/scm/CMakeLists.txt
deleted file mode 100644
index 2d29179..0000000
--- a/src/scm/CMakeLists.txt
+++ /dev/null
@@ -1,70 +0,0 @@
-ADD_SUBDIRECTORY(gnumeric)
-
-SET (BUILD_CONFIG_SCM ${CMAKE_CURRENT_BINARY_DIR}/build-config.scm)
-
-SET (scm_SCHEME_4
-    substring-search.scm
-    xml-generator.scm
-)
-
-# We need to replace a couple of variables in build-config.scm. Normally, I 
-# would use CONFIGURE_FILE to do this. But this scheme files is using a different
-# replacement marking scheme ("@-", "-@") than the usual one with just "@" 
-# that CONFIGURE_FILE expects.
-
-# FIXME: ${BUILD_CONFIG_SCM} needs a rule to cause it to be generated, I think.
-
-IF (HAVE_GUILE1)
-  GNC_CONFIGURE(build-config.scm.in build-config.scm)
-ELSE()
-  GNC_CONFIGURE2(build-config-scm build-config.scm.in build-config.scm)
-ENDIF()
-
-# CONFIGURE_FILE(build-config.scm.in ${BUILD_CONFIG_SCM})
-
-SET(GUILE_MODULES      "")
-SET(GUILE_LOAD_DIRS    src/core-utils src/gnc-module)
-SET(GUILE_LIBRARY_DIRS src/core-utils src/gnc-module)
-SET(GUILE_DEPENDS      scm-core-utils scm-gnc-module)
-
-SET(scm_SCHEME_0
-  fin.scm
-  string.scm
-  ${BUILD_CONFIG_SCM}
-  substring-search.scm
-  xml-generator.scm
-)
-
-GNC_ADD_SCHEME_TARGETS(scm-scm-0 "${scm_SCHEME_0}" "" "" "" "" "" FALSE)
-
-GNC_ADD_SCHEME_TARGETS(scm-scm-1 "printf.scm" gnucash "" "" "" "" FALSE)
-
-GNC_ADD_SCHEME_TARGETS(scm-scm-2
-  main.scm
-  gnucash
-  "${GUILE_MODULES}"
-  "${GUILE_LOAD_DIRS}"
-  "${GUILE_LIBRARY_DIRS}"
-  "scm-scm-1;${GUILE_DEPENDS}"  # requires printf.scm from scm-scm-1 and modules from GUILE_DEPENDS
-  FALSE
-)
-
-# depends on main.scm
-GNC_ADD_SCHEME_TARGETS(scm-scm-3
-  price-quotes.scm
-  gnucash
-  "${GUILE_MODULES}"
-  "${GUILE_LOAD_DIRS}"
-  "${GUILE_LIBRARY_DIRS}"
-  "scm-scm-2;scm-scm-0"  # depends on build_config.scm
-  FALSE)
-
-ADD_CUSTOM_TARGET(scm-scm ALL DEPENDS scm-scm-3 scm-scm-2 scm-scm-1 scm-scm-0 scm-gnumeric)
-
-INSTALL(FILES config DESTINATION etc/gnucash)
-
-SET_LOCAL_DIST(scm_DIST_local config CMakeLists.txt Makefile.am fin.scm string.scm build-config.scm.in substring-search.scm
-                              xml-generator.scm main.scm price-quotes.scm printf.scm ${scm_SCHEME_4})
-SET(scm_DIST ${scm_DIST_local} ${scm_gnumeric_DIST} PARENT_SCOPE)
-
-
diff --git a/src/scm/Makefile.am b/src/scm/Makefile.am
deleted file mode 100644
index 318af4d..0000000
--- a/src/scm/Makefile.am
+++ /dev/null
@@ -1,89 +0,0 @@
-
-SUBDIRS = gnumeric
-
-gncscmdir = ${GNC_SCM_INSTALL_DIR}
-gncscmmoddir = ${GNC_SCM_INSTALL_DIR}/gnucash
-
-gncscmmod_DATA = main.scm price-quotes.scm printf.scm
-
-gnc_regular_scm_files = \
-  string.scm \
-  fin.scm \
-  substring-search.scm \
-  xml-generator.scm
-
-gncscm_DATA = \
-  build-config.scm \
-  ${gnc_regular_scm_files}
-
-noinst_DATA = .scm-links
-
-configdir = ${GNC_CONFIGDIR}
-config_DATA = config
-
-if GNUCASH_SEPARATE_BUILDDIR
-SCM_FILE_LINKS = \
-  ${gncscmmod_DATA} \
-  ${gnc_regular_scm_files}
-endif
-
-.scm-links: 
-	$(RM) -rf gnucash
-	mkdir -p  gnucash
-if GNUCASH_SEPARATE_BUILDDIR
-	for X in ${SCM_FILE_LINKS} ; do \
-	  $(LN_S) -f ${srcdir}/$$X . ; \
-	done
-endif
-	( cd gnucash; for A in $(gncscmmod_DATA) ; do $(LN_S) -f ../$$A . ; done )
-if ! OS_WIN32
-# Windows knows no "ln -s" but uses "cp": must copy every time (see bug #566567).
-	touch .scm-links
-endif
-
-if GNC_HAVE_GUILE_2
-GUILE_COMPILE_ENV = \
-  --guile-load-dir ${top_builddir}/src/core-utils \
-  --guile-load-dir ${top_builddir}/src/gnc-module \
-  --guile-load-dir ${top_builddir}/src/scm \
-  --library-dir    ${top_builddir}/src/core-utils \
-  --library-dir    ${top_builddir}/src/gnc-module \
-  --library-dir    ${top_builddir}/src/engine
-
-%.go : %.scm .scm-links
-	$(shell ${abs_top_srcdir}/src/gnc-test-env.pl --noexports ${GUILE_COMPILE_ENV}) \
-	$(GUILD) compile -o $@ $<
-
-gncscmmodcachedir = ${pkglibdir}/scm/ccache/@GUILE_EFFECTIVE_VERSION@/gnucash
-gncscmmodcache_DATA = $(gncscmmod_DATA:.scm=.go)
-
-gncscmcachedir = ${pkglibdir}/scm/ccache/@GUILE_EFFECTIVE_VERSION@
-gncscmcache_DATA = $(gncscm_DATA:.scm=.go)
-endif
-
-clean-local:
-	$(RM) -rf gnucash
-
-SCM_FILES = ${gncscm_DATA} ${gncscmmod_DATA}
-
-EXTRA_DIST = \
-  build-config.scm.in \
-  config \
-  ${SCM_FILES} \
-  CMakeLists.txt
-
-## We borrow guile's convention and use @-...-@ as the substitution
-## brackets here, instead of the usual @... at .  This prevents autoconf
-## from substituting the values directly into the left-hand sides of
-## the sed substitutions.  *sigh*
-build-config.scm: ${srcdir}/build-config.scm.in Makefile
-	rm -f $@.tmp
-	sed < $< > $@.tmp \
-            -e 's#@-VERSION-@#${VERSION}#' \
-            -e 's#@-GNC_HELPDIR-@#${GNC_HELPDIR}#'
-	mv $@.tmp $@
-
-CLEANFILES = .scm-links ${gncscmmodcache_DATA} ${gncscmcache_DATA}
-
-DISTCLEANFILES = ${SCM_FILE_LINKS}
-MAINTAINERCLEANFILES = build-config.scm
diff --git a/src/tax/us/CMakeLists.txt b/src/tax/us/CMakeLists.txt
deleted file mode 100644
index bf3f5fb..0000000
--- a/src/tax/us/CMakeLists.txt
+++ /dev/null
@@ -1,51 +0,0 @@
-ADD_SUBDIRECTORY(test)
-
-SET(tax_us_SOURCES gncmod-tax-us.c)
-
-# Add dependency on config.h
-SET_SOURCE_FILES_PROPERTIES (${tax_us_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
-
-ADD_LIBRARY(gncmod-tax-us ${tax_us_SOURCES})
-TARGET_LINK_LIBRARIES(gncmod-tax-us gnc-module ${GLIB2_LDFLAGS} ${GUILE_LDFLAGS})
-
-TARGET_INCLUDE_DIRECTORIES(gncmod-tax-us
-    PRIVATE ${CMAKE_BINARY_DIR}/src ${GUILE_INCLUDE_DIRS})
-
-INSTALL(TARGETS gncmod-tax-us
-  LIBRARY DESTINATION lib/gnucash
-  ARCHIVE DESTINATION lib/gnucash
-  RUNTIME DESTINATION bin)
-# No headers to install
-
-# Scheme
-
-SET(gncmod_tax_us_SCHEME_1 txf.scm txf-help.scm txf-de_DE.scm txf-help-de_DE.scm)
-SET(gncmod_tax_us_SCHEME_2 de_DE.scm us.scm)
-
-SET(GUILE_MODULES      src/app-utils src/engine)
-SET(GUILE_LOAD_DIRS    src/app-utils src/core-utils src/engine src/gnc-module src/scm)
-SET(GUILE_LIBRARY_DIRS src/app-utils src/engine src/gnc-module)
-SET(GUILE_DEPENDS      scm-app-utils)
-
-GNC_ADD_SCHEME_TARGETS(scm-tax-us-1
-  "${gncmod_tax_us_SCHEME_1}"
-  ""
-  "${GUILE_MODULES}"
-  "${GUILE_LOAD_DIRS}"
-  "${GUILE_LIBRARY_DIRS}"
-  "${GUILE_DEPENDS}"
-  FALSE
-  )
-GNC_ADD_SCHEME_TARGETS(scm-tax-us-2
-  "${gncmod_tax_us_SCHEME_2}"
-  gnucash/tax
-  "${GUILE_MODULES}"
-  "${GUILE_LOAD_DIRS}"
-  "${GUILE_LIBRARY_DIRS}"
-  "${GUILE_DEPENDS}"
-  FALSE
-  )
-
-SET_LOCAL_DIST(tax_us_DIST_local CMakeLists.txt Makefile.am ${tax_us_SOURCES} ${gncmod_tax_us_SCHEME_1} ${gncmod_tax_us_SCHEME_2})
-SET(tax_us_DIST ${tax_us_DIST_local} ${test_tax_us_DIST} PARENT_SCOPE)
-
diff --git a/src/tax/us/Makefile.am b/src/tax/us/Makefile.am
deleted file mode 100644
index 082710b..0000000
--- a/src/tax/us/Makefile.am
+++ /dev/null
@@ -1,85 +0,0 @@
-SUBDIRS = . test
-
-pkglib_LTLIBRARIES = libgncmod-tax-us.la
-
-libgncmod_tax_us_la_SOURCES = \
-  gncmod-tax-us.c 
-
-libgncmod_tax_us_la_LDFLAGS = -avoid-version
-
-libgncmod_tax_us_la_LIBADD = \
- ${GUILE_LIBS} \
- ${GLIB_LIBS}
-
-AM_CPPFLAGS = \
-  -I${top_srcdir}/src \
-  -I${top_srcdir}/src/gnc-module \
-  ${GLIB_CFLAGS} ${GUILE_CFLAGS}
-
-gncscmmoddir = ${GNC_SCM_INSTALL_DIR}/gnucash/tax
-gncscmmod_DATA = us.scm de_DE.scm
-
-gncscmdir = ${GNC_SCM_INSTALL_DIR}
-gncscm_DATA = txf.scm txf-help.scm txf-de_DE.scm txf-help-de_DE.scm 
-
-if GNUCASH_SEPARATE_BUILDDIR
-#For executing test cases
-SCM_FILE_LINKS = \
-  ${gncscmmod_DATA} \
-  ${gncscm_DATA}
-endif
-
-.scm-links:
-	$(RM) -rf gnucash
-	mkdir -p gnucash
-	mkdir -p gnucash/tax
-if GNUCASH_SEPARATE_BUILDDIR
-	for X in ${SCM_FILE_LINKS} ; do \
-	  $(LN_S) -f ${srcdir}/$$X . ; \
-	done
-endif
-	( cd gnucash/tax; for A in $(gncscmmod_DATA) ; do $(LN_S) -f ../../$$A . ; done )
-if ! OS_WIN32
-# Windows knows no "ln -s" but uses "cp": must copy every time (see bug #566567).
-	touch .scm-links
-endif
-
-if GNC_HAVE_GUILE_2
-GUILE_COMPILE_ENV = \
-  --gnc-module-dir ${top_builddir}/src/engine \
-  --guile-load-dir ${top_builddir}/src/app-utils \
-  --guile-load-dir ${top_builddir}/src/core-utils \
-  --guile-load-dir ${top_builddir}/src/engine \
-  --guile-load-dir ${top_builddir}/src/gnc-module \
-  --guile-load-dir ${top_builddir}/src/scm \
-  --library-dir    ${top_builddir}/src/engine \
-  --library-dir    ${top_builddir}/src/app-utils \
-  --library-dir    ${top_builddir}/src/core-utils \
-  --library-dir    ${top_builddir}/src/gnc-module
-
-%.go : %.scm .scm-links $(pkglib_LTLIBRARIES)
-	GNC_UNINSTALLED=yes \
-	GNC_BUILDDIR=${top_builddir} \
-	$(shell ${abs_top_srcdir}/src/gnc-test-env.pl --noexports ${GUILE_COMPILE_ENV}) \
-	$(GUILD) compile -o $@ $<
-
-gncscmmodcachedir = ${pkglibdir}/scm/ccache/@GUILE_EFFECTIVE_VERSION@/gnucash/tax
-gncscmmodcache_DATA = $(gncscmmod_DATA:.scm=.go)
-
-gncscmcachedir = ${pkglibdir}/scm/ccache/@GUILE_EFFECTIVE_VERSION@
-gncscmcache_DATA = $(gncscm_DATA:.scm=.go)
-endif
-
-clean-local:
-	$(RM) -rf gnucash
-
-noinst_DATA = .scm-links
-
-EXTRA_DIST = \
-  ${gncscmmod_DATA} \
-  ${gncscm_DATA} \
-  CMakeLists.txt
-
-CLEANFILES = .scm-links ${gncscmmodcache_DATA} ${gncscmcache_DATA}
-
-DISTCLEANFILES = ${SCM_FILE_LINKS}
diff --git a/src/tax/us/test/Makefile.am b/src/tax/us/test/Makefile.am
deleted file mode 100644
index c25bb43..0000000
--- a/src/tax/us/test/Makefile.am
+++ /dev/null
@@ -1,19 +0,0 @@
-TESTS = test-link-module
-
-# Some of these dirs may not be needed anymore.
-GNC_TEST_DEPS = \
-  --gnc-module-dir ${top_builddir}/src/tax/us \
-  --guile-load-dir ${top_builddir}/src/gnc-module \
-  --guile-load-dir ${top_builddir}/src/tax/us \
-  --library-dir    ${top_builddir}/src/core-utils \
-  --library-dir    ${top_builddir}/src/gnc-module
-
-TESTS_ENVIRONMENT = \
-  GUILE="${GUILE}" \
-  $(shell ${abs_top_srcdir}/src/gnc-test-env.pl --noexports ${GNC_TEST_DEPS})
-
-check_PROGRAMS=test-link-module
-test_link_module_SOURCES=test-link-module.c
-test_link_module_LDADD=../libgncmod-tax-us.la ${GUILE_LIBS} ${GLIB_LIBS}
-
-EXTRA_DIST = CMakeLists.txt
diff --git a/src/test-core/CMakeLists.txt b/src/test-core/CMakeLists.txt
deleted file mode 100644
index 1cb2ca3..0000000
--- a/src/test-core/CMakeLists.txt
+++ /dev/null
@@ -1,81 +0,0 @@
-SET(test_core_SOURCES
-  test-stuff.c
-  unittest-support.c
-)
-
-SET(test_core_noinst_HEADERS
-  test-stuff.h
-  unittest-support.h
-)
-
-INCLUDE_DIRECTORIES(
-  ${CMAKE_BINARY_DIR}/src
-  ${CMAKE_SOURCE_DIR}/src
-  ${CMAKE_SOURCE_DIR}/src/engine
-  ${CMAKE_SOURCE_DIR}/src/test-core
-
-  ${GLIB2_INCLUDE_DIRS}
-  ${GUILE_INCLUDE_DIRS}
-)
-
-SET_DIST_LIST(test_core_DIST ${test_core_SOURCES} ${test_core_noinst_HEADERS} CMakeLists.txt
-        Makefile.am unittest-support.i unittest-support.scm)
-
-ADD_LIBRARY(test-core STATIC ${test_core_SOURCES} ${test_core_noinst_HEADERS})
-TARGET_LINK_LIBRARIES(test-core gncmod-engine ${GLIB2_LDFLAGS})
-IF (UNIX)
-  TARGET_COMPILE_OPTIONS(test-core PRIVATE -fPIC)
-ENDIF()
-
-IF (BUILDING_FROM_VCS)
-  SET (SWIG_UNITTEST_SUPPORT_GUILE_C ${CMAKE_CURRENT_BINARY_DIR}/swig-unittest-support-guile.c)
-  GNC_ADD_SWIG_COMMAND (swig-unittest-support-guile-c ${SWIG_UNITTEST_SUPPORT_GUILE_C}
-      ${CMAKE_CURRENT_SOURCE_DIR}/unittest-support.i ${test_core_HEADERS})
-  SET (SWIG_UNITTEST_SUPPORT_PYTHON_C ${CMAKE_CURRENT_BINARY_DIR}/swig-unittest-support-python.c)
-  GNC_ADD_SWIG_PYTHON_COMMAND (swig-unittest-support-python ${SWIG_UNITTEST_SUPPORT_PYTHON_C} ${CMAKE_CURRENT_SOURCE_DIR}/unittest-support.i)
-ELSE()
-  SET (SWIG_UNITTEST_SUPPORT_GUILE_C  swig-unittest-support-guile.c)
-  SET (SWIG_UNITTEST_SUPPORT_PYTHON_C swig-unittest-support-python.c)
-ENDIF()
-
-
-ADD_LIBRARY(test-core-guile ${SWIG_UNITTEST_SUPPORT_GUILE_C})
-TARGET_LINK_LIBRARIES(test-core-guile test-core ${GUILE_LDFLAGS} ${GLIB2_LDFLAGS})
-
-IF (WITH_PYTHON)
-  ADD_LIBRARY(unittest_support MODULE ${SWIG_UNITTEST_SUPPORT_PYTHON_C})
-  TARGET_LINK_LIBRARIES(unittest_support test-core ${PYTHON_LIBRARIES})
-  TARGET_INCLUDE_DIRECTORIES(unittest_support PRIVATE ${PYTHON_INCLUDE_DIRS})
-  SET_TARGET_PROPERTIES(unittest_support PROPERTIES PREFIX "_")
-ENDIF()
-
-SET(test_core_SCHEME unittest-support.scm)
-
-SET(GUILE_OUTPUT_DIR   gnucash)
-SET(GUILE_MODULES      "")
-SET(GUILE_LOAD_DIRS    "")
-SET(GUILE_LIBRARY_DIRS src/test-core src/engine)
-SET(GUILE_DEPENDS      test-core-guile)
-
-
-GNC_ADD_SCHEME_TARGETS(scm-test-core
-  ${test_core_SCHEME}
-  ${GUILE_OUTPUT_DIR}
-  "${GUILE_MODULES}"
-  "${GUILE_LOAD_DIRS}"
-  "${GUILE_LIBRARY_DIRS}"
-  "${GUILE_DEPENDS}"
-  FALSE
-  )
-
-IF(NOT GTEST_SHARED_LIB)
-  SET (lib_gtest_SOURCES ${GTEST_SRC_DIR}/src/gtest-all.cc)
-  ADD_LIBRARY(gtest STATIC  ${lib_gtest_SOURCES})
-  TARGET_INCLUDE_DIRECTORIES(gtest PUBLIC ${GTEST_INCLUDE_DIR} ${GTEST_SRC_DIR})
-ENDIF()
-SET (lib_gmock_SOURCES ${GMOCK_SRC})
-ADD_LIBRARY(gmock STATIC  ${lib_gmock_SOURCES})
-TARGET_INCLUDE_DIRECTORIES(gmock PUBLIC
-  ${GTEST_INCLUDE_DIR} ${GTEST_SRC_DIR}
-  ${GMOCK_INCLUDE_DIR} ${GMOCK_SRC_DIR})
-INSTALL(FILES unittest-support.h DESTINATION libexec/gnucash/src/engine/test)
diff --git a/src/test-core/Makefile.am b/src/test-core/Makefile.am
deleted file mode 100644
index 5a59b8e..0000000
--- a/src/test-core/Makefile.am
+++ /dev/null
@@ -1,144 +0,0 @@
-noinst_LTLIBRARIES = libtest-core.la
-
-SWIG_FILES = \
-	unittest-support.i
-
-libtest_core_la_SOURCES = \
-	test-stuff.c \
-	unittest-support.c
-
-libtest_core_la_LIBADD = \
-  ${top_builddir}/src/engine/libgncmod-engine.la \
-  ${GLIB_LIBS}
-
-noinst_HEADERS = \
-	test-stuff.h \
-	unittest-support.h
-
-libtest_core_la_CPPFLAGS = \
-  -I${top_srcdir}/src \
-  -I${top_srcdir}/src/engine \
-  ${GLIB_CFLAGS}
-
-libtest_core_la_LDFLAGS = \
-  -rpath ${exec-prefix}/lib
-
-if BUILDING_FROM_VCS
-swig-unittest-support-guile.c: unittest-support.i $(top_srcdir)/src/base-typemaps.i
-	$(SWIG) -guile $(SWIG_ARGS) -Linkage module \
-	-I${top_srcdir}/src \
-	${AM_CPPFLAGS} -o $@ $<
-if ! OS_WIN32
-if ! SWIG_DIST_FAIL
-	if ! `grep "define scm_from_utf8_string" $@ > /dev/null 2>&1`; then \
-	  patch $@ $(top_srcdir)/src/swig-utf8.patch; \
-	fi
-endif
-endif
-
-swig-unittest-support-python.c: unittest-support.i $(top_srcdir)/src/base-typemaps.i
-	$(SWIG) -python  -Wall -Werror $(SWIG_ARGS) \
-	-I${top_srcdir}/src \
-	${AM_CPPFLAGS} -o $@ $<
-
-unittest-support.py: swig-unittest-support-python.c ${SWIG_FILES}
-endif
-noinst_LTLIBRARIES += libtest-core-guile.la
-libtest_core_guile_la_SOURCES = swig-unittest-support-guile.c
-libtest_core_guile_la_LIBADD = \
-  ${GUILE_LIBS} \
-  ${GLIB_LIBS} \
-  libtest-core.la
-
-libtest_core_guile_la_CFLAGS = \
-	${libtest_core_la_CPPFLAGS} \
-	${GUILE_CFLAGS} \
-	${AM_CFLAGS}
-
-libtest_core_guile_la_LDFLAGS = \
-  -rpath ${exec-prefix}/lib
-
-if WITH_PYTHON
-
-noinst_LTLIBRARIES += _unittest_support.la
-
-_unittest_support_la_SOURCES = \
-  swig-unittest-support-python.c
-_unittest_support_la_CFLAGS = \
-  ${libtest_core_la_CPPFLAGS} \
-  ${PYTHON_CPPFLAGS}
-_unittest_support_la_LDFLAGS = \
-  ${PYTHON_LDFLAGS} \
-  -module \
-  -rpath ${exec-prefix}/lib
-
-_unittest_support_la_LIBADD = \
-  ${PYTHON_LIBS} \
-  ${PYTHON_EXTRA_LIBS} \
-  libtest-core.la
-
-endif
-
-if GOOGLE_TEST_LIBS
-noinst_LIBRARIES = libgmock.a
-else
-noinst_LIBRARIES = \
-        libgtest.a \
-        libgmock.a
-nodist_libgtest_a_SOURCES = ${GTEST_SRC}/src/gtest-all.cc
-libgtest_a_CPPFLAGS = ${AM_CPPFLAGS} -I${GTEST_HEADERS} -I${GTEST_SRC}
-endif
-nodist_libgmock_a_SOURCES = ${GMOCK_SRC_PATH}/gmock-all.cc
-libgmock_a_CPPFLAGS = ${libgtest_a_CPPFLAGS} -I${GMOCK_HEADERS} -I${GMOCK_SRC}
-
-gncscmmoddir = ${GNC_SCM_INSTALL_DIR}/gnucash
-gncscmmod_DATA = unittest-support.scm
-
-SCM_FILES = $(gncscmmod_DATA)
-
-.scm-links:
-	$(RM) -rf gnucash
-	mkdir -p  gnucash
-if GNUCASH_SEPARATE_BUILDDIR
-	for X in ${SCM_FILES} ; do \
-	  $(LN_S) -f ${srcdir}/$$X . ; \
-	done
-endif
-	( cd gnucash; for A in $(gncscmmod_DATA) ; do $(LN_S) -f ../$$A . ; done )
-if ! OS_WIN32
-# Windows knows no "ln -s" but uses "cp": must copy every time (see bug #566567).
-	touch .scm-links
-endif
-
-if GNC_HAVE_GUILE_2
-GUILE_COMPILE_ENV = \
-  --library-dir    ${top_builddir}/src/test-core \
-  --library-dir    ${top_builddir}/src/engine
-
-%.go : %.scm .scm-links $(noinst_LTLIBRARIES)
-	GNC_UNINSTALLED=yes \
-	GNC_BUILDDIR=${top_builddir} \
-	$(shell ${abs_top_srcdir}/src/gnc-test-env.pl --noexports ${GUILE_COMPILE_ENV}) \
-	$(GUILD) compile -o $@ $<
-
-gncscmmodcachedir = ${pkglibdir}/scm/ccache/@GUILE_EFFECTIVE_VERSION@/gnucash
-gncscmmodcache_DATA = $(gncscmmod_DATA:.scm=.go)
-endif
-
-clean-local:
-	$(RM) -rf gnucash
-
-noinst_DATA = .scm-links
-CLEANFILES = .scm-links ${gncscmmodcache_DATA}
-
-EXTRA_DIST = \
-  $(SCM_FILES) \
-  swig-unittest-support-python.c \
-  swig-unittest-support-guile.c \
-  unittest_support.py \
-  unittest-support.i \
-  CMakeLists.txt
-
-MAINTAINERCLEANFILES = \
-	swig-unittest-support-guile.c \
-	swig-unittest-support-python.c

commit ffc640bada6070186f9f00f2c8416596b4b40790
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Wed Aug 9 17:30:59 2017 +0200

    Move global definitions to toplevel CMakeLists.txt

diff --git a/CMakeLists.txt b/CMakeLists.txt
index eb9a65d..db01fcd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -549,6 +549,143 @@ SET(gnucash_DOCS
 
 INSTALL(FILES ${gnucash_DOCS} DESTINATION share/doc/gnucash)
 
+# ############################################################
+
+# Create config.h
+
+SET (GETTEXT_PACKAGE "gnucash")
+
+IF (WIN32)
+  IF (MINGW)
+    SET (HAVE_SCANF_LLD 1)
+  ELSE ()
+    SET (HAVE_SCANF_I64D 1)
+  ENDIF ()
+  SET (HAVE_HTMLHELPW 1)
+ENDIF (WIN32)
+
+IF (NOT WIN32)
+  CHECK_INCLUDE_FILES (X11/Xlib.h HAVE_X11_XLIB_H)
+ENDIF (NOT WIN32)
+
+CHECK_INCLUDE_FILES (dirent.h HAVE_DIRENT_H)
+CHECK_INCLUDE_FILES (dlfcn.h HAVE_DLFCN_H)
+CHECK_INCLUDE_FILES (glob.h HAVE_GLOB_H)
+CHECK_INCLUDE_FILES (inttypes.h HAVE_INTTYPES_H)
+CHECK_INCLUDE_FILES (limits.h HAVE_LIMITS_H)
+CHECK_INCLUDE_FILES (locale.h HAVE_LOCALE_H)
+CHECK_INCLUDE_FILES (memory.h HAVE_MEMORY_H)
+CHECK_INCLUDE_FILES (stdint.h HAVE_STDINT_H)
+CHECK_INCLUDE_FILES (stdlib.h HAVE_STDLIB_H)
+CHECK_INCLUDE_FILES (string.h HAVE_STRING_H)
+CHECK_INCLUDE_FILES (strings.h HAVE_STRINGS_H)
+CHECK_INCLUDE_FILES (sys/stat.h HAVE_SYS_STAT_H)
+CHECK_INCLUDE_FILES (sys/time.h HAVE_SYS_TIME_H)
+CHECK_INCLUDE_FILES (sys/times.h HAVE_SYS_TIMES_H)
+CHECK_INCLUDE_FILES (sys/types.h HAVE_SYS_TYPES_H)
+CHECK_INCLUDE_FILES (sys/wait.h HAVE_SYS_WAIT_H)
+CHECK_INCLUDE_FILES (unistd.h HAVE_UNISTD_H)
+CHECK_INCLUDE_FILES (utmp.h HAVE_UTMP_H)
+CHECK_INCLUDE_FILES (wctype.h HAVE_WCTYPE_H)
+
+IF (NOT DISABLE_NLS)
+  SET(ENABLE_NLS 1)
+ENDIF(NOT DISABLE_NLS)
+
+IF (ENABLE_BINRELOC)
+  IF (UNIX OR MINGW)
+    SET(BR_PTHREAD 1)
+  ENDIF(UNIX OR MINGW)
+ENDIF(ENABLE_BINRELOC)
+
+IF (UNIX OR MINGW)
+  SET (HAVE_BIND_TEXTDOMAIN_CODESET 1)
+  SET (HAVE_DCGETTEXT 1)
+  SET (HAVE_GETTEXT 1)
+  SET (HAVE_GETTIMEOFDAY 1)
+  SET (HAVE_GUILE 1)
+  SET (HAVE_LIBM 1)
+  SET (HAVE_MEMCPY 1)
+  SET (STDC_HEADERS 1)
+  SET (_ALL_SOURCE 1)
+  SET (_GNU_SOURCE 1)
+  SET (_POSIX_PTHREAD_SEMANTICS 1)
+  SET (_TANDEM_SOURCE 1)
+  SET (__EXTENSIONS__ 1)
+ENDIF (UNIX OR MINGW)
+
+IF (UNIX)
+  SET (HAVE_CHOWN 1)
+  SET (HAVE_DLERROR 1)
+  SET (HAVE_DLSYM 1)
+  SET (HAVE_GETHOSTID 1)
+  SET (HAVE_GETHOSTNAME 1)
+  SET (HAVE_GETPPID 1)
+  SET (HAVE_GETUID 1)
+  SET (HAVE_GMTIME_R 1)
+  SET (HAVE_LANGINFO_D_FMT 1)
+  SET (HAVE_LC_MESSAGES 1)
+  SET (HAVE_LIBPTHREAD 1)
+  SET (HAVE_LINK 1)
+  SET (HAVE_LOCALTIME_R 1)
+  SET (HAVE_PTHREAD_MUTEX_INIT 1)
+  SET (HAVE_PTHREAD_PRIO_INHERIT 1)
+  SET (HAVE_SCANF_LLD 1)
+  SET (HAVE_SETENV 1)
+  SET (HAVE_STPCPY 1)
+  SET (HAVE_STRFMON 1)
+  SET (HAVE_STRPTIME 1)
+  SET (HAVE_STRUCT_TM_GMTOFF 1)
+  SET (HAVE_TIMEGM 1)
+  SET (HAVE_TOWUPPER 1)
+  SET (GNC_PLATFORM_POSIX 1)
+ENDIF (UNIX)
+
+IF (WIN32)
+  SET (GNC_PLATFORM_WINDOWS 1)
+ENDIF (WIN32)
+
+IF (APPLE)
+# FIXME: HANDLE gtk-mac-integration-gtk2
+  SET(GNC_PLATFORM_DARWIN 1)
+  SET(GNC_PLATFORM_OSX 1)
+  SET(PLATFORM_OSX 1)
+  SET(HAVE_OSX_KEYCHAIN 1)
+ENDIF(APPLE)
+
+IF(GLIB2_VERSION VERSION_GREATER 2.46.0 OR GLIB2_VERSION VERSION_EQUAL 2.46.0)
+  SET(HAVE_GLIB_2_46 1)
+ENDIF()
+
+IF(DISABLE_DEPRECATED_GNOME)
+  SET(GNOME_DISABLE_DEPRECATED 1)
+ENDIF(DISABLE_DEPRECATED_GNOME)
+
+IF(DISABLE_DEPRECATED_GTK)
+  SET(GTK_DISABLE_DEPRECATED 1)
+  SET(GDK_DISABLE_DEPRECATED 1)
+  SET(GDK_PIXMAP_DISABLE_DEPRECATED 1)
+ENDIF(DISABLE_DEPRECATED_GTK)
+
+IF(DISABLE_DEPRECATED_GLIB)
+  SET(G_DISABLE_DEPRECATED 1)
+ENDIF(DISABLE_DEPRECATED_GLIB)
+
+ADD_DEFINITIONS (-DHAVE_CONFIG_H)
+
+SET (CONFIG_H ${CMAKE_CURRENT_BINARY_DIR}/src/config.h)
+CONFIGURE_FILE (${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.cmake.in ${CONFIG_H})
+
+IF (BUILDING_FROM_VCS)
+  SET (SWIG_RUNTIME_H ${CMAKE_CURRENT_BINARY_DIR}/src/swig-runtime.h)
+ELSE()
+  SET (SWIG_RUNTIME_H ${CMAKE_CURRENT_SOURCE_DIR}/src/swig-runtime.h)
+ENDIF()
+
+
+SET(SCHEME_INSTALLED_SOURCE_DIR ${CMAKE_INSTALL_PREFIX}/share/gnucash/scm)
+SET(SCHEME_INSTALLED_CACHE_DIR ${CMAKE_INSTALL_PREFIX}/lib/gnucash/scm/ccache/${GUILE_EFFECTIVE_VERSION})
+
 # The subdirectories
 ADD_SUBDIRECTORY (accounts)
 ADD_SUBDIRECTORY (checks)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 9071d81..312a7e6 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,143 +1,5 @@
 # CMakeLists.txt for src/
 
-# ############################################################
-
-# Create config.h
-
-SET (GETTEXT_PACKAGE "gnucash")
-
-IF (WIN32)
-  IF (MINGW)
-    SET (HAVE_SCANF_LLD 1)
-  ELSE ()
-    SET (HAVE_SCANF_I64D 1)
-  ENDIF ()
-  SET (HAVE_HTMLHELPW 1)
-ENDIF (WIN32)
-
-IF (NOT WIN32)
-  CHECK_INCLUDE_FILES (X11/Xlib.h HAVE_X11_XLIB_H)
-ENDIF (NOT WIN32)
-
-CHECK_INCLUDE_FILES (dirent.h HAVE_DIRENT_H)
-CHECK_INCLUDE_FILES (dlfcn.h HAVE_DLFCN_H)
-CHECK_INCLUDE_FILES (glob.h HAVE_GLOB_H)
-CHECK_INCLUDE_FILES (inttypes.h HAVE_INTTYPES_H)
-CHECK_INCLUDE_FILES (limits.h HAVE_LIMITS_H)
-CHECK_INCLUDE_FILES (locale.h HAVE_LOCALE_H)
-CHECK_INCLUDE_FILES (memory.h HAVE_MEMORY_H)
-CHECK_INCLUDE_FILES (stdint.h HAVE_STDINT_H)
-CHECK_INCLUDE_FILES (stdlib.h HAVE_STDLIB_H)
-CHECK_INCLUDE_FILES (string.h HAVE_STRING_H)
-CHECK_INCLUDE_FILES (strings.h HAVE_STRINGS_H)
-CHECK_INCLUDE_FILES (sys/stat.h HAVE_SYS_STAT_H)
-CHECK_INCLUDE_FILES (sys/time.h HAVE_SYS_TIME_H)
-CHECK_INCLUDE_FILES (sys/times.h HAVE_SYS_TIMES_H)
-CHECK_INCLUDE_FILES (sys/types.h HAVE_SYS_TYPES_H)
-CHECK_INCLUDE_FILES (sys/wait.h HAVE_SYS_WAIT_H)
-CHECK_INCLUDE_FILES (unistd.h HAVE_UNISTD_H)
-CHECK_INCLUDE_FILES (utmp.h HAVE_UTMP_H)
-CHECK_INCLUDE_FILES (wctype.h HAVE_WCTYPE_H)
-
-IF (NOT DISABLE_NLS)
-SET(ENABLE_NLS 1)
-ENDIF(NOT DISABLE_NLS)
-
-IF (ENABLE_BINRELOC)
-  IF (UNIX OR MINGW)
-    SET(BR_PTHREAD 1)
-  ENDIF(UNIX OR MINGW)
-ENDIF(ENABLE_BINRELOC)
-
-IF (UNIX OR MINGW)
-  SET (HAVE_BIND_TEXTDOMAIN_CODESET 1)
-  SET (HAVE_DCGETTEXT 1)
-  SET (HAVE_GETTEXT 1)
-  SET (HAVE_GETTIMEOFDAY 1)
-  SET (HAVE_GUILE 1)
-  SET (HAVE_LIBM 1)
-  SET (HAVE_MEMCPY 1)
-  SET (STDC_HEADERS 1)
-  SET (_ALL_SOURCE 1)
-  SET (_GNU_SOURCE 1)
-  SET (_POSIX_PTHREAD_SEMANTICS 1)
-  SET (_TANDEM_SOURCE 1)
-  SET (__EXTENSIONS__ 1)
-ENDIF (UNIX OR MINGW)
-
-IF (UNIX)
-  SET (HAVE_CHOWN 1)
-  SET (HAVE_DLERROR 1)
-  SET (HAVE_DLSYM 1)
-  SET (HAVE_GETHOSTID 1)
-  SET (HAVE_GETHOSTNAME 1)
-  SET (HAVE_GETPPID 1)
-  SET (HAVE_GETUID 1)
-  SET (HAVE_GMTIME_R 1)
-  SET (HAVE_LANGINFO_D_FMT 1)
-  SET (HAVE_LC_MESSAGES 1)
-  SET (HAVE_LIBPTHREAD 1)
-  SET (HAVE_LINK 1)
-  SET (HAVE_LOCALTIME_R 1)
-  SET (HAVE_PTHREAD_MUTEX_INIT 1)
-  SET (HAVE_PTHREAD_PRIO_INHERIT 1)
-  SET (HAVE_SCANF_LLD 1)
-  SET (HAVE_SETENV 1)
-  SET (HAVE_STPCPY 1)
-  SET (HAVE_STRFMON 1)
-  SET (HAVE_STRPTIME 1)
-  SET (HAVE_STRUCT_TM_GMTOFF 1)
-  SET (HAVE_TIMEGM 1)
-  SET (HAVE_TOWUPPER 1)
-  SET (GNC_PLATFORM_POSIX 1)
-ENDIF (UNIX)
-
-IF (WIN32)
-  SET (GNC_PLATFORM_WINDOWS 1)
-ENDIF (WIN32)
-
-IF (APPLE)
-  # FIXME: HANDLE gtk-mac-integration-gtk2
-  SET(GNC_PLATFORM_DARWIN 1)
-  SET(GNC_PLATFORM_OSX 1)
-  SET(PLATFORM_OSX 1)
-  SET(HAVE_OSX_KEYCHAIN 1)
-
-ENDIF(APPLE)
-
-IF(GLIB2_VERSION VERSION_GREATER 2.46.0 OR GLIB2_VERSION VERSION_EQUAL 2.46.0)
-  SET(HAVE_GLIB_2_46 1)
-ENDIF()
-
-IF(DISABLE_DEPRECATED_GNOME)
-  SET(GNOME_DISABLE_DEPRECATED 1)
-ENDIF(DISABLE_DEPRECATED_GNOME)
-
-IF(DISABLE_DEPRECATED_GTK)
-  SET(GTK_DISABLE_DEPRECATED 1)
-  SET(GDK_DISABLE_DEPRECATED 1)
-  SET(GDK_PIXMAP_DISABLE_DEPRECATED 1)
-ENDIF(DISABLE_DEPRECATED_GTK)
-
-IF(DISABLE_DEPRECATED_GLIB)
-  SET(G_DISABLE_DEPRECATED 1)
-ENDIF(DISABLE_DEPRECATED_GLIB)
-
-ADD_DEFINITIONS (-DHAVE_CONFIG_H)
-
-SET (CONFIG_H ${CMAKE_CURRENT_BINARY_DIR}/config.h)
-CONFIGURE_FILE (${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake.in ${CONFIG_H})
-
-IF (BUILDING_FROM_VCS)
-  SET (SWIG_RUNTIME_H ${CMAKE_CURRENT_BINARY_DIR}/swig-runtime.h)
-ELSE()
-  SET (SWIG_RUNTIME_H ${CMAKE_CURRENT_SOURCE_DIR}/swig-runtime.h)
-ENDIF()
-
-
-SET(SCHEME_INSTALLED_SOURCE_DIR ${CMAKE_INSTALL_PREFIX}/share/gnucash/scm)
-SET(SCHEME_INSTALLED_CACHE_DIR ${CMAKE_INSTALL_PREFIX}/lib/gnucash/scm/ccache/${GUILE_EFFECTIVE_VERSION})
-
 # The subdirectories
 ADD_SUBDIRECTORY (core-utils)
 ADD_SUBDIRECTORY (debug)

commit 9de9f5362eff3f0fb25672dfc93c5cb87f5201c0
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Wed Aug 9 16:09:32 2017 +0200

    Drop the cutecash experiment and the gtkmm optional bindings
    
    These are currently unmaintained, cutecash us based on the obsolete qt4
    and gtkmm is only used by cutecash. Whenever someone wishes to revive
    this experiment it can be recovered from git history and be brought
    into a separate repository.

diff --git a/.gitignore b/.gitignore
index 3d5e3ea..3691093 100644
--- a/.gitignore
+++ b/.gitignore
@@ -193,7 +193,6 @@ src/import-export/qif-import/test/test-link
 src/import-export/test/test-import-parse
 src/import-export/test/test-link
 src/engine/test/test-qof
-src/optional/gtkmm/test/test-gtkmm
 src/optional/python-bindings/.py-links
 src/optional/python-bindings/gnucash/
 src/optional/python-bindings/gnucash_core.c
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 363e452..eb9a65d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -53,8 +53,7 @@ INCLUDE (MakeDistFiles)
 
 OPTION (WITH_SQL "Build this project with SQL (libdbi) support" ON)
 OPTION (WITH_AQBANKING "Build this project with aqbanking (online banking) support" ON)
-OPTION (WITH_GNUCASH "Build all of GnuCash, not just cutecash" ON)
-OPTION (WITH_CUTECASH "Also build cutecash" OFF)
+OPTION (WITH_GNUCASH "Build all of GnuCash, not just the library" ON)
 OPTION (WITH_OFX "compile with ofx support (needs LibOFX)" ON)
 OPTION (WITH_PYTHON "enable python plugin and bindings" OFF)
 OPTION (ENABLE_BINRELOC "compile with binary relocation support" ON)
@@ -197,9 +196,6 @@ IF (WITH_GNUCASH)
 ENDIF (WITH_GNUCASH)
 
 GNC_PKG_CHECK_MODULES (ZLIB REQUIRED zlib)
-IF (WITH_CUTECASH)
-  GNC_PKG_CHECK_MODULES (GLIBMM REQUIRED glibmm-2.4>=2.24)
-ENDIF(WITH_CUTECASH)
 
 IF (MSVC)
   MESSAGE (STATUS "Hint: To create the import libraries for the gnome DLLs (e.g. gconf-2.lib), use the dlltool as follows: pexports bin/libgconf-2-4.dll > lib/libgconf-2.def ; dlltool -d lib/libgconf-2.def -D bin/libgconf-2-4.dll -l lib/gconf-2.lib")
@@ -289,12 +285,6 @@ IF (NOT GUILE_EXECUTABLE)
   MESSAGE (SEND_ERROR "The guile executable was not found, but is required. Please set GUILE_EXECUTABLE.")
 ENDIF (NOT GUILE_EXECUTABLE)
 
-# Qt
-IF (WITH_CUTECASH)
-  SET (QT_MIN_VERSION "4.5.0")
-  FIND_PACKAGE (Qt4 REQUIRED) # find and setup Qt4 for this project
-ENDIF (WITH_CUTECASH)
-
 # ############################################################
 IF (WITH_AQBANKING)
   GNC_PKG_CHECK_MODULES (GWENHYWFAR REQUIRED gwenhywfar)
@@ -731,22 +721,6 @@ ENDIF()
 # ############################################################
 # Package creation rules
 
-IF (WITH_CUTECASH)
-SET (CUTECASH_VERSION_MAJOR "0")
-SET (CUTECASH_VERSION_MINOR "1")
-SET (CUTECASH_VERSION_PATCH "0")
-SET (CUTECASH_VERSION_NANO "0")
-
-SET (CPACK_PACKAGE_NAME "Cutecash")
-SET (CPACK_PACKAGE_DESCRIPTION_SUMMARY "Cutecash Free Finance Software")
-SET (CPACK_PACKAGE_VERSION_MAJOR ${CUTECASH_VERSION_MAJOR})
-SET (CPACK_PACKAGE_VERSION_MINOR ${CUTECASH_VERSION_MINOR})
-SET (CPACK_PACKAGE_VERSION_PATCH ${CUTECASH_VERSION_PATCH})
-SET (CPACK_PACKAGE_VENDOR "Christian Stimming")
-SET (CPACK_SOURCE_IGNORE_FILES "/\\\\.svn/;/\\\\.git/;.*~;build.*;html;Debug;Release")
-SET (CPACK_STRIP_FILES "bin/cutecash")
-#SET (CPACK_PACKAGE_EXECUTABLES "bin/carclient")
-ENDIF (WITH_CUTECASH)
 IF(UNIX)
   SET(CPACK_GENERATOR "TGZ")
 ENDIF(UNIX)
diff --git a/configure.ac b/configure.ac
index 3478c82..2e4354a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -153,30 +153,7 @@ AX_BOOST_BASE([1.53.0], [ac_cv_BOOST=yes], [ac_cv_BOOST=no])
 if test x$ac_cv_BOOST != xyes; then
     AC_MSG_ERROR([Boost 1.53.0 or later was not found and is required to build GnuCash])
 fi
-###--------------------------------------------------------
-### Optionally enable gtkmm plugin (requires c++ compiler)
-###--------------------------------------------------------
-enable_GTKMM=false
-
-AC_ARG_ENABLE(gtkmm,
-  [AS_HELP_STRING([--enable-gtkmm],[enable gtkmm gui])],
-  [case "${enableval}" in
-     yes) enable_GTKMM=true ;;
-     no) enable_GTKMM=false ;;
-     *) enable_GTKMM=false ;;
-   esac]
-  )
 
-AS_IF([test x${enable_GTKMM} = "xtrue"],
-  [
-    # We require gtkmm, of course
-    PKG_CHECK_MODULES(GTKMM, gtkmm-2.4 >= 2.24)
-    # and also the c++ compiler
-    AC_PROG_CXXCPP
-    AC_PROG_CXX
-    _COMPONENTS="$_COMPONENTS gtkmm"
-  ])
-AM_CONDITIONAL([WITH_GTKMM], [test x${enable_GTKMM} = "xtrue"])
 # This section must come before AC_PROG_LIBTOOL because libtool
 # must know about the c++ compiler.
 ###--------------------------------------------------------
@@ -1730,8 +1707,6 @@ AC_CONFIG_FILES(
   src/import-export/aqb/gschemas/Makefile
   src/import-export/aqb/test/Makefile
   src/optional/Makefile
-  src/optional/gtkmm/Makefile
-  src/optional/gtkmm/test/Makefile
   src/optional/python-bindings/Makefile
   src/optional/python-bindings/tests/Makefile
   src/pixmaps/Makefile
diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt
index 2ab86f7..bf8f0ba 100644
--- a/po/CMakeLists.txt
+++ b/po/CMakeLists.txt
@@ -66,7 +66,7 @@ ENDFUNCTION()
 
 FUNCTION(MAKE_GNUCASH_POTFILES)
 
-  SET(IGNORE_PATTERNS "gw-" "test" "experimental" "python-bindings" "swig-.*\\.c" "^src/gnc/" "^src/optional/gtkmm")
+  SET(IGNORE_PATTERNS "gw-" "test" "experimental" "python-bindings" "swig-.*\\.c")
 
   # Create a list of candidate translation files
   FILE(GLOB_RECURSE FILES_IN RELATIVE ${CMAKE_SOURCE_DIR}
diff --git a/po/POTFILES.skip b/po/POTFILES.skip
index 27588ce..11ae5e5 100644
--- a/po/POTFILES.skip
+++ b/po/POTFILES.skip
@@ -5,10 +5,6 @@ src/backend/xml/gncmod-backend-xml.c
 src/backend/xml/gncmod-backend-xml.cpp
 src/gnome-utils/gnc-tree-model-selection.c
 
-# These we don't want to translate because they're experimental:
-src/gnc/.*
-src/optional/gtkmm/.*
-
 # Skip softlinks to scm files. These softlinks are created in builddir
 # for testing purposes, intltool-extract isn't smart enough to ignore
 # them when bulddir and srcdir are the same, and both intltool-extract
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 0255d9f..9071d81 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -6,8 +6,6 @@
 
 SET (GETTEXT_PACKAGE "gnucash")
 
-SET(GNOME 1)
-
 IF (WIN32)
   IF (MINGW)
     SET (HAVE_SCANF_LLD 1)
@@ -169,10 +167,6 @@ IF (WITH_GNUCASH)
   ADD_SUBDIRECTORY(report)
 ENDIF (WITH_GNUCASH)
 
-IF (WITH_CUTECASH)
-  ADD_SUBDIRECTORY (gnc)
-ENDIF (WITH_CUTECASH)
-
 SET(src_EXTRA_DIST
         base-typemaps.i
         config.h.cmake.in
diff --git a/src/bin/gnucash-bin.c b/src/bin/gnucash-bin.c
index fe4ceec..2a1187a 100644
--- a/src/bin/gnucash-bin.c
+++ b/src/bin/gnucash-bin.c
@@ -507,7 +507,6 @@ load_gnucash_modules()
         { "gnucash/report/stylesheets", 0, FALSE },
         { "gnucash/report/locale-specific/us", 0, FALSE },
         { "gnucash/report/report-gnome", 0, FALSE },
-        { "gnucash/gtkmm", 0, TRUE },
         { "gnucash/python", 0, TRUE },
         { "gnucash/plugins/bi_import", 0, TRUE},
         { "gnucash/plugins/customer_import", 0, TRUE},
diff --git a/src/gnc/.gitignore b/src/gnc/.gitignore
deleted file mode 100644
index 1936cc1..0000000
--- a/src/gnc/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-html
diff --git a/src/gnc/AccountItemModel.cpp b/src/gnc/AccountItemModel.cpp
deleted file mode 100644
index 9f811df..0000000
--- a/src/gnc/AccountItemModel.cpp
+++ /dev/null
@@ -1,248 +0,0 @@
-/*
- * AccountItemModel.hpp
- * Copyright (C) 2010 Christian Stimming
- *
- * 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 at gnu.org
- */
-
-#include "AccountItemModel.hpp"
-
-#include "engine/gnc-event.h" // for GNC_EVENT_ITEM_ADDED
-#include "gncmm/Numeric.hpp"
-#include <QDebug>
-
-namespace gnc
-{
-
-AccountTreeModel::AccountTreeModel(Glib::RefPtr<Account> rootaccount, QObject *parent)
-        : QAbstractItemModel(parent)
-        , m_root(rootaccount)
-{
-}
-
-QModelIndex AccountTreeModel::index(int row, int column,
-                                    const QModelIndex &parent) const
-{
-    //qDebug() << "index(), " << row << column << parent;
-    if (!hasIndex(row, column, parent))
-        return QModelIndex();
-
-    Glib::RefPtr<Account> parentItem;
-
-    if (!parent.isValid())
-        parentItem = m_root;
-    else
-        parentItem = Glib::wrap(static_cast< ::Account*>(parent.internalPointer()));
-
-    Glib::RefPtr<Account> childItem = parentItem->get_nth_child(row);
-    if (childItem)
-    {
-        //qDebug() << "returning" << childItem.getName();
-        return createIndex(row, column, childItem->gobj());
-    }
-    else
-        return QModelIndex();
-}
-
-QModelIndex AccountTreeModel::parent(const QModelIndex &index) const
-{
-    //qDebug() << "parent()" << index;
-    if (!index.isValid())
-        return QModelIndex();
-
-    Glib::RefPtr<Account> childItem = Glib::wrap(static_cast< ::Account*>(index.internalPointer()));
-    Glib::RefPtr<Account> parentItem(childItem->get_parent());
-
-    if (parentItem->gobj() == m_root->gobj())
-        return QModelIndex();
-
-    return createIndex(parentItem->child_index(), 0, parentItem->gobj());
-}
-
-int AccountTreeModel::rowCount(const QModelIndex& parent) const
-{
-    //qDebug() << "rowCount()" << parent;
-    if (parent.column() > 0)
-        return 0;
-    // FIXME: Doesn't this just mean the nonzero columns don't have a
-    // tree? In that case it would be correct.
-
-    Glib::RefPtr<Account> parentItem;
-    if (!parent.isValid())
-        parentItem = m_root;
-    else
-        parentItem = Glib::wrap(static_cast< ::Account*>(parent.internalPointer()));
-
-    //qDebug() << "Returning " << parentItem.n_children();
-    return parentItem->get_num_children();
-}
-
-int AccountTreeModel::columnCount(const QModelIndex& parent) const
-{
-    //qDebug() << "columnCount()" << parent;
-//     if (!parent.isValid())
-//         return 0;
-//     else
-    return 4; // Fixed number for now
-}
-
-QVariant AccountTreeModel::data(const QModelIndex& index, int role) const
-{
-    //qDebug() << "data(), " << index;
-    if (!index.isValid())
-        return QVariant();
-
-    Glib::RefPtr<Account> account = Glib::wrap(static_cast< ::Account*>(index.internalPointer()));
-    if (role == Qt::DisplayRole)
-    {
-        switch (index.column())
-        {
-        case 0:
-            return g2q(account->get_name());
-        case 1:
-            return g2q(account->get_code());
-        case 2:
-            return g2q(account->get_description());
-        case 3:
-        {
-            Numeric balance = gnc_ui_account_get_balance(account->gobj(), false);
-            PrintAmountInfo printInfo(account, true);
-            return g2q(balance.printAmount(printInfo));
-        }
-        default:
-            return QVariant();
-        }
-    }
-    else
-        return QVariant();
-}
-
-Qt::ItemFlags AccountTreeModel::flags(const QModelIndex &index) const
-{
-    //qDebug() << "flags()" << index;
-    if (!index.isValid())
-        return 0;
-
-    // Ensure read-only access only
-    return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
-}
-
-QVariant AccountTreeModel::headerData(int section, Qt::Orientation orientation, int role) const
-{
-    //qDebug() << "headerData()" << section;
-    if (role != Qt::DisplayRole)
-        return QVariant();
-    if (orientation == Qt::Horizontal)
-    {
-        switch (section)
-        {
-        case 0:
-            return QString("Name");
-        case 1:
-            return QString("Code");
-        case 2:
-            return QString("Description");
-        case 3:
-            return QString("Balance");
-        default:
-            return QVariant();
-        }
-    }
-    else
-        return QString("%1").arg(1 + section);
-}
-
-// ////////////////////////////////////////////////////////////
-
-
-AccountListModel::AccountListModel(Glib::RefPtr<Account> rootaccount, QObject *parent)
-        : base_class(rootaccount, parent)
-        , m_list()
-        , m_eventWrapperAccount(*this, &AccountListModel::accountEvent)
-{
-    recreateCache();
-}
-
-void AccountListModel::recreateCache()
-{
-    m_list = accountFromGList(m_root->get_descendants());
-    reset();
-}
-
-void AccountListModel::accountEvent( ::Account* acc, QofEventId event_type)
-{
-    //qDebug() << "AccountListModel::accountEvent, id=" << qofEventToString(event_type);
-
-    switch (event_type)
-    {
-    case QOF_EVENT_CREATE:
-    case QOF_EVENT_DESTROY:
-        recreateCache();
-        break;
-    default:
-        break;
-    }
-}
-
-QModelIndex AccountListModel::index(int row, int column,
-                                    const QModelIndex &parent) const
-{
-    //qDebug() << "index(), " << row << column << parent;
-    if (!hasIndex(row, column, parent) || row >= m_list.size())
-        return QModelIndex();
-
-    Glib::RefPtr<Account> childItem = Glib::wrap(m_list.at(row));
-    if (childItem)
-    {
-        //qDebug() << "returning" << childItem.getName();
-        return createIndex(row, column, childItem->gobj());
-    }
-    else
-        return QModelIndex();
-}
-
-
-// ////////////////////////////////////////////////////////////
-
-int AccountListNamesModel::columnCount(const QModelIndex& parent) const
-{
-    return 1;
-}
-
-QVariant AccountListNamesModel::data(const QModelIndex& index, int role) const
-{
-    if (!index.isValid())
-        return QVariant();
-
-    Glib::RefPtr<Account> account = Glib::wrap(static_cast< ::Account*>(index.internalPointer()));
-    switch (index.column())
-    {
-    case 0:
-        switch (role)
-        {
-        case Qt::DisplayRole:
-            return g2q(account->get_full_name());
-        default:
-            return QVariant();
-        }
-    default:
-        return QVariant();
-    }
-}
-
-} // END namespace gnc
diff --git a/src/gnc/AccountItemModel.hpp b/src/gnc/AccountItemModel.hpp
deleted file mode 100644
index c3b9c0d..0000000
--- a/src/gnc/AccountItemModel.hpp
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * AccountItemModel.hpp
- * Copyright (C) 2010 Christian Stimming
- *
- * 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 at gnu.org
- */
-
-#ifndef GNC_ACCOUNTITEMMODEL_HPP
-#define GNC_ACCOUNTITEMMODEL_HPP
-
-#include "config.h"
-#include "gncmm/Account.hpp"
-#include "gnc/QofEventWrapper.hpp"
-#include "gnc/conv.hpp"
-#include "gnc/metatype.hpp"
-
-#include <QAbstractItemModel>
-
-namespace gnc
-{
-
-/** This is the data model for an account tree.
- *
- * It was written following the "Simple Tree Model Example" in the qt4
- * documentation. In particular, the trick is that each returned
- * QModelIndex of our model implementation which is valid will have a
- * ::Account* pointer in its QModelIndex::internalPointer() member,
- * which can then be used in the data() method and the other
- * methods. This trick works quite nice because our C structures
- * ::Account* already have all the methods to iterate the tree back
- * and forth, and our C++ wrapper gnc::Account doesn't add any
- * functionality except for some nicer method names.
- */
-class AccountTreeModel : public QAbstractItemModel
-{
-    Q_OBJECT
-public:
-    AccountTreeModel(Glib::RefPtr<Account> rootaccount, QObject *parent = 0);
-
-    int rowCount(const QModelIndex& parent = QModelIndex()) const;
-    int columnCount(const QModelIndex& parent = QModelIndex()) const;
-    QModelIndex parent(const QModelIndex &index) const;
-    QModelIndex index(int row, int column,
-                      const QModelIndex &parent = QModelIndex()) const;
-    Qt::ItemFlags flags(const QModelIndex &index) const;
-
-    QVariant data(const QModelIndex& index, int role) const;
-    QVariant headerData(int section, Qt::Orientation orientation, int role) const;
-
-protected:
-    Glib::RefPtr<Account> m_root;
-};
-
-typedef QList< ::Account*> AccountQList;
-inline AccountQList accountFromGList(GList *glist)
-{
-    return from_glist<AccountQList>(glist);
-}
-
-/** Specialization of the account tree model for when all accounts
- * should be viewed as a flat list instead of a tree. Only the index()
- * and parent() functions had to be overridden - quite easy. */
-class AccountListModel : public AccountTreeModel
-{
-    Q_OBJECT
-public:
-    typedef AccountTreeModel base_class;
-    AccountListModel(Glib::RefPtr<Account> rootaccount, QObject *parent = 0);
-
-    int rowCount(const QModelIndex& parent = QModelIndex()) const { return m_list.size(); }
-
-    QModelIndex index(int row, int column,
-                      const QModelIndex &parent = QModelIndex()) const;
-
-    QModelIndex parent(const QModelIndex &index) const { return QModelIndex(); }
-
-    int indexOf(AccountQList::value_type value) const { return m_list.indexOf(value); }
-    const AccountQList::value_type at(int i) const { return m_list.at(i); }
-
-public Q_SLOTS:
-    void accountEvent( ::Account* v, QofEventId event_type);
-
-private:
-    void recreateCache();
-
-    AccountQList m_list;
-    QofEventWrapper<AccountListModel, ::Account*> m_eventWrapperAccount;
-};
-
-/** Specialization of the account list model that only shows the
- * "Account Full Name" in one single column.
- */
-class AccountListNamesModel : public AccountListModel
-{
-    Q_OBJECT
-public:
-    typedef AccountListModel base_class;
-    AccountListNamesModel(Glib::RefPtr<Account> rootaccount, QObject *parent = 0)
-            : base_class(rootaccount, parent)
-    {}
-    int columnCount(const QModelIndex& parent = QModelIndex()) const;
-    QVariant data(const QModelIndex& index, int role) const;
-};
-
-} // END namespace gnc
-
-#endif
diff --git a/src/gnc/AccountSelectionDelegate.cpp b/src/gnc/AccountSelectionDelegate.cpp
deleted file mode 100644
index 3412ca3..0000000
--- a/src/gnc/AccountSelectionDelegate.cpp
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * AccountSelectionDelegate.cpp
- * Copyright (C) 2010 Christian Stimming
- *
- * 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 at gnu.org
- */
-
-#include "AccountSelectionDelegate.hpp"
-
-#include "gnc/AccountItemModel.hpp"
-#include "gncmm/Book.hpp"
-#include "gncmm/Split.hpp"
-#include "gnc/SplitListModel.hpp"
-
-#include <QDebug>
-#include <QComboBox>
-
-namespace gnc
-{
-
-AccountSelectionDelegate::AccountSelectionDelegate(QObject* parent)
-        : base_class(parent)
-{}
-
-QString AccountSelectionDelegate::displayText(const QVariant& value, const QLocale& locale) const
-{
-    if (value.canConvert< ::Account*>())
-    {
-        Glib::RefPtr<Account> acc = Glib::wrap(value.value< ::Account*>());
-        if (acc)
-            return g2q(acc->get_full_name());
-        else
-            return QString();
-    }
-    else
-    {
-        return base_class::displayText(value, locale);
-    }
-}
-
-QWidget *AccountSelectionDelegate::createEditor(QWidget *parent,
-        const QStyleOptionViewItem &option,
-        const QModelIndex &index) const
-{
-    QComboBox* comboBox = new QComboBox(parent);
-
-    Q_ASSERT(index.isValid());
-    const SplitListModel* smodel = dynamic_cast<const SplitListModel*>(index.model());
-    if (smodel)
-    {
-        Glib::RefPtr<Account> modelAccount = smodel->getAccount();
-        Q_ASSERT(modelAccount);
-        Glib::RefPtr<Book> book = modelAccount->get_book();
-        Q_ASSERT(book);
-        Glib::RefPtr<Account> rootaccount = book->get_root_account();
-        Q_ASSERT(rootaccount);
-        AccountListModel* model = new AccountListNamesModel(rootaccount, comboBox);
-        comboBox->setModel(model);
-    }
-
-    return comboBox;
-}
-
-void AccountSelectionDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
-{
-    QComboBox* comboBox = dynamic_cast<QComboBox*>(editor);
-    Q_ASSERT(comboBox);
-
-    Q_ASSERT(index.isValid());
-
-    QVariant value = index.model()->data(index, Qt::EditRole);
-    if (value.canConvert< ::Account*>())
-    {
-        Glib::RefPtr<Account> acc = Glib::wrap(value.value< ::Account*>());
-        if (acc)
-        {
-            const AccountListModel* amodel = dynamic_cast<const AccountListModel*>(comboBox->model());
-            Q_ASSERT(amodel);
-            comboBox->setCurrentIndex(amodel->indexOf(acc->gobj()));
-        }
-    }
-    else
-    {
-        qDebug() << "AccountSelectionDelegate::setEditorData: oops, item returns no account in the column";
-    }
-}
-
-void AccountSelectionDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
-        const QModelIndex &index) const
-{
-    QComboBox* comboBox = dynamic_cast<QComboBox*>(editor);
-    Q_ASSERT(comboBox);
-
-    int currentIndex = comboBox->currentIndex();
-    if (currentIndex == -1)
-        return;
-    const AccountListModel* amodel = dynamic_cast<const AccountListModel*>(comboBox->model());
-    Q_ASSERT(amodel);
-    ::Account* acc(amodel->at(currentIndex));
-    if (acc)
-    {
-        model->setData(index, QVariant::fromValue(acc), Qt::EditRole);
-    }
-}
-
-
-} // END namespace gnc
diff --git a/src/gnc/AccountSelectionDelegate.hpp b/src/gnc/AccountSelectionDelegate.hpp
deleted file mode 100644
index 05ae44e..0000000
--- a/src/gnc/AccountSelectionDelegate.hpp
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * AccountSelectionDelegate.hpp
- * Copyright (C) 2010 Christian Stimming
- *
- * 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 at gnu.org
- */
-
-#ifndef GNC_ACCOUNTSELECTIONDELEGATE_HPP
-#define GNC_ACCOUNTSELECTIONDELEGATE_HPP
-
-#include "config.h"
-#include "gncmm/Account.hpp"
-
-#include <QtGui/QStyledItemDelegate>
-#include <QDebug>
-
-namespace gnc
-{
-
-class AccountSelectionDelegate : public QStyledItemDelegate
-{
-    Q_OBJECT
-public:
-    typedef QStyledItemDelegate base_class;
-
-    AccountSelectionDelegate(QObject* parent = 0);
-
-    virtual QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
-                                  const QModelIndex &index) const;
-    virtual QString displayText(const QVariant& value, const QLocale& locale) const;
-    virtual void setEditorData(QWidget *editor, const QModelIndex &index) const;
-    virtual void setModelData(QWidget *editor, QAbstractItemModel *model,
-                              const QModelIndex &index) const;
-
-};
-
-
-} // END namespace gnc
-
-#endif
diff --git a/src/gnc/CMakeLists.txt b/src/gnc/CMakeLists.txt
deleted file mode 100644
index 6ba10f5..0000000
--- a/src/gnc/CMakeLists.txt
+++ /dev/null
@@ -1,133 +0,0 @@
-# CMakeLists.txt for src/gnc
-
-
-# A test executable
-LINK_DIRECTORIES (${GLIB2_LIBRARY_DIRS}
-  ${GMODULE_LIBRARY_DIRS}
-  ${GOBJECT_LIBRARY_DIRS}
-  ${GTHREAD_LIBRARY_DIRS}
-  ${GCONF2_LIBRARY_DIRS}
-  ${GLIBMM_LIBRARY_DIRS}
-#  ${GWENHYWFAR_LIBRARY_DIRS}
-#  ${AQBANKING_LIBRARY_DIRS}
-)
-
-SET (gnc_SOURCES
-  AccountItemModel.cpp
-  AccountSelectionDelegate.cpp
-  Cmd.cpp
-  QofEventWrapper.cpp
-  RecentFileMenu.cpp
-  Session.cpp
-  SplitListModel.cpp
-  SplitListView.cpp
-  main.cpp
-  mainwindow.cpp
-  mainwindow-file.cpp
-  dashboard.cpp
-  fpo/FPO.cpp
-  fpo/ViewletModel.cpp
-  fpo/ViewletView.cpp
-)
-
-SET (gnc_QOBJECT_HEADERS
-  AccountItemModel.hpp
-  AccountSelectionDelegate.hpp
-  RecentFileMenu.hpp
-  SplitListModel.hpp
-  SplitListView.hpp
-  mainwindow.hpp
-  dashboard.hpp
-  fpo/FPO.hpp
-  fpo/ViewletModel.hpp
-  fpo/ViewletView.hpp
-)
-SET (gnc_HEADERS ${gnc_QOBJECT_HEADERS}
-  conv.hpp
-  metatype.hpp
-  Cmd.hpp
-  QofEventWrapper.hpp
-  Session.hpp
-  WeakPointer.hpp
-)
-
-SET (gnc_FORMS
-  mainwindow.ui
-  dashboard.ui
-)
-
-SET (gnc_RESOURCES
-  gnucash.qrc
-  gtk-icons.qrc
-  fallback-icons.qrc
-  stylesheets.qrc
-)
-
-IF (WITH_SQL)
-  ADD_DEFINITIONS (-DWITH_SQL)
-ENDIF (WITH_SQL)
-
-# Generation of resource files
-QT4_ADD_RESOURCES (gnc_RESOURCE ${gnc_RESOURCES})
-
-# Generation of the foo_MOC_SRCS = moc_Class1.cxx moc_Class2.cxx
-QT4_WRAP_CPP (gnc_MOC_SOURCES ${gnc_QOBJECT_HEADERS})
-
-# Generation of the ui source files
-QT4_WRAP_UI (gnc_FORMS_HEADERS ${gnc_FORMS})
-
-INCLUDE_DIRECTORIES (${GLIB2_INCLUDE_DIRS})
-INCLUDE_DIRECTORIES (${GLIBMM_INCLUDE_DIRS})
-INCLUDE_DIRECTORIES (${GUILE_INCLUDE_DIRS})
-INCLUDE_DIRECTORIES (${LIBINTL_INCLUDE_PATH})
-INCLUDE_DIRECTORIES (${REGEX_INCLUDE_PATH})
-INCLUDE_DIRECTORIES (${CMAKE_BINARY_DIR}/src ) # for config.h
-INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/src ) # for gnc-ui.h
-INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/src/gnc-module) # for gnc-glib-utils.h
-INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/src/core-utils) # for gnc-glib-utils.h
-INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/src/engine) # for gnc-glib-utils.h
-INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/src/optional/gtkmm)
-INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/src/backend/xml)
-INCLUDE_DIRECTORIES (${CMAKE_BINARY_DIR}/src/engine) # for swig-runtime.h
-INCLUDE_DIRECTORIES (${CMAKE_CURRENT_BINARY_DIR}) # for ui_mainwindow.h
-
-INCLUDE_DIRECTORIES (${QT_INCLUDES})
-ADD_DEFINITIONS(-DQT_NO_KEYWORDS)
-
-ADD_EXECUTABLE (cutecash
-  ${gnc_FORMS_HEADERS}
-  ${gnc_HEADERS}
-  ${gnc_MOC_SOURCES}
-  ${gnc_RESOURCE}
-  ${gnc_SOURCES}
-)
-
-TARGET_LINK_LIBRARIES (cutecash gncmod-backend-xml-utils gnc-backend-xml-utils)
-TARGET_LINK_LIBRARIES (cutecash gncmod-generic-import)
-TARGET_LINK_LIBRARIES (cutecash gncmod-app-utils)
-IF (WITH_SQL)
-  TARGET_LINK_LIBRARIES (cutecash gncmod-backend-dbi gnc-backend-sql)
-  TARGET_LINK_LIBRARIES (cutecash ${LIBDBI_LIBRARY})
-ENDIF (WITH_SQL)
-IF (WITH_AQBANKING)
-  TARGET_LINK_LIBRARIES (cutecash gncmod-aqbanking)
-#  TARGET_LINK_LIBRARIES (cutecash ${AQBANKING_LIBRARIES} ${GWENHYWFAR_LIBRARIES})
-ENDIF (WITH_AQBANKING)
-TARGET_LINK_LIBRARIES (cutecash libgncmod-gtkmm)
-TARGET_LINK_LIBRARIES (cutecash gncmod-engine gnc-module gnc-core-utils)
-
-TARGET_LINK_LIBRARIES (cutecash ${GUILE_LIBRARY} ${GUILE_LIBRARIES})
-TARGET_LINK_LIBRARIES (cutecash ${GLIBMM_LIBRARIES})
-TARGET_LINK_LIBRARIES (cutecash ${GCONF2_LIBRARIES})
-TARGET_LINK_LIBRARIES (cutecash ${GTHREAD_LIBRARIES} ${GOBJECT_LIBRARIES} ${GMODULE_LIBRARIES} ${GLIB2_LIBRARIES})
-TARGET_LINK_LIBRARIES (cutecash ${LIBXML2_LIBRARIES})
-TARGET_LINK_LIBRARIES (cutecash ${ZLIB_LIBRARIES})
-IF (WIN32)
-  TARGET_LINK_LIBRARIES (cutecash ${LIBINTL_LIBRARY} ${REGEX_LIBRARY})
-ENDIF (WIN32)
-
-TARGET_LINK_LIBRARIES (cutecash ${Boost_LIBRARIES})
-TARGET_LINK_LIBRARIES (cutecash ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY})
-TARGET_LINK_LIBRARIES (cutecash pthread)
-
-INSTALL (TARGETS cutecash RUNTIME DESTINATION bin)
diff --git a/src/gnc/Cmd.cpp b/src/gnc/Cmd.cpp
deleted file mode 100644
index c231df1..0000000
--- a/src/gnc/Cmd.cpp
+++ /dev/null
@@ -1,478 +0,0 @@
-/*
- * Cmd.hpp
- * Copyright (C) 2010 Christian Stimming
- *
- * 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 at gnu.org
- */
-
-#include "Cmd.hpp"
-#include "gncmm/Split.hpp"
-#include "gncmm/Account.hpp"
-#include "gncmm/Transaction.hpp"
-#include "gnc/conv.hpp"
-#include <QObject>
-
-namespace gnc
-{
-
-// Explicit instantiations to check for compiler errors
-template class Cmd<Account, QString>;
-
-namespace cmd
-{
-
-// ////////////////////////////////////////////////////////////
-
-QUndoCommand* setSplitMemo(Glib::RefPtr<Split> t, const QString& newValue)
-{
-    return new Cmd<Split, Glib::ustring>(QObject::tr("Edit Split Memo"),
-                                         t, &Split::set_memo,
-                                         t->get_memo(), q2g(newValue));
-}
-
-QUndoCommand* setSplitAction(Glib::RefPtr<Split> t, const QString& newValue)
-{
-    return new Cmd<Split, Glib::ustring>(QObject::tr("Edit Split Action"),
-                                         t, &Split::set_action,
-                                         t->get_action(), q2g(newValue));
-}
-
-QUndoCommand* setSplitReconcile(Glib::RefPtr<Split> t, char newValue)
-{
-    if (newValue == t->get_reconcile())
-        return NULL;
-    // Special third argument: The setter function takes a value
-    // directly, instead of a const-reference, so the template type
-    // must be given explicitly.
-    return new Cmd<Split, char, void (Split::*)(char)>(QObject::tr("Edit Split Reconcile"),
-            t, &Split::set_reconcile,
-            t->get_reconcile(), newValue);
-}
-
-QUndoCommand* setSplitAccount(Glib::RefPtr<Split> t, Glib::RefPtr<Account> newValue)
-{
-    // Temporary function pointer "tmp" to resolve the ambiguous
-    // overload "setAccount()".
-    void (Split::*tmp)(Glib::RefPtr<Account>) = &Split::set_account;
-    return new Cmd<Split, Glib::RefPtr<Account>, void (Split::*)(Glib::RefPtr<Account>)>(QObject::tr("Edit Split Account"),
-            t, tmp,
-            t->get_account(), newValue);
-}
-
-QUndoCommand* setSplitAmount(Glib::RefPtr<Split> t, const Numeric& newValue)
-{
-    return new Cmd<Split, Numeric>(QObject::tr("Edit Split Amount"),
-                                   t, &Split::set_amount,
-                                   t->get_amount(), newValue);
-}
-
-QUndoCommand* setSplitValue(Glib::RefPtr<Split> t, const Numeric& newValue)
-{
-    return new Cmd<Split, Numeric>(QObject::tr("Edit Split Value"),
-                                   t, &Split::set_value,
-                                   t->get_value(), newValue);
-}
-
-// ////////////////////////////////////////////////////////////
-
-class SplitValueAndAmountCmd : public QUndoCommand
-{
-public:
-    typedef QUndoCommand base_class;
-    typedef Split target_type;
-    typedef Numeric value_type;
-
-    /** Constructor without a getter-function but instead the previous
-     * value given directly.
-     */
-    SplitValueAndAmountCmd(const QString& text,
-                           Glib::RefPtr<Split> targetPtr,
-                           const value_type& previousValue,
-                           const value_type& newValue,
-                           QUndoCommand *parent = 0)
-        : base_class(text, parent)
-        , m_target(targetPtr)
-        , m_previousValue(previousValue)
-        , m_newValue(newValue)
-    {
-        Q_ASSERT(m_target);
-    }
-
-    virtual void redo()
-    {
-        set(m_newValue);
-    }
-    virtual void undo()
-    {
-        set(m_previousValue);
-    }
-private:
-    void set(const value_type& value)
-    {
-        Glib::RefPtr<Transaction> trans = m_target->get_parent();
-        if (!trans || trans->get_num_splits() != 2)
-            return;
-        Glib::RefPtr<Split> other = m_target->get_other_split();
-        Q_ASSERT(other);
-        Glib::RefPtr<Commodity> originCommodity = m_target->get_account()->get_commodity();
-        Glib::RefPtr<Commodity> transCommodity = trans->get_currency();
-        Glib::RefPtr<Commodity> otherCommodity = other->get_account()->get_commodity();
-        if (originCommodity != transCommodity
-                || transCommodity != otherCommodity)
-            return;
-
-        trans->begin_edit();
-        m_target->set_value(value);
-        m_target->set_amount(value);
-        Numeric valueNeg = value.neg();
-        other->set_amount(valueNeg);
-        other->set_value(valueNeg);
-        trans->commit_edit();
-    }
-
-protected:
-    Glib::RefPtr<target_type> m_target;
-    value_type m_previousValue;
-    value_type m_newValue;
-
-};
-
-QUndoCommand* setSplitValueAndAmount(Glib::RefPtr<Split> t, const Numeric& newValue)
-{
-    return new SplitValueAndAmountCmd(QObject::tr("Edit Transaction Value"),
-                                      t, t->get_value(), newValue);
-}
-
-// ////////////////////////////////////////////////////////////
-
-QUndoCommand* setTransactionNum(Glib::RefPtr<Transaction> t, const QString& newValue)
-{
-    if (newValue == g2q(t->get_num()))
-        return NULL;
-    return new Cmd<Transaction, Glib::ustring>(QObject::tr("Edit Transaction Number"),
-            t, &Transaction::set_num,
-            t->get_num(), q2g(newValue));
-}
-
-QUndoCommand* setTransactionDescription(Glib::RefPtr<Transaction> t, const QString& newValue)
-{
-    if (newValue == g2q(t->get_description()))
-        return NULL;
-    return new Cmd<Transaction, Glib::ustring>(QObject::tr("Edit Transaction Description"),
-            t, &Transaction::set_description,
-            t->get_description(), q2g(newValue));
-}
-
-QUndoCommand* setTransactionNotes(Glib::RefPtr<Transaction> t, const QString& newValue)
-{
-    return new Cmd<Transaction, Glib::ustring>(QObject::tr("Edit Transaction Notes"),
-            t, &Transaction::set_notes,
-            t->get_notes(), q2g(newValue));
-}
-
-QUndoCommand* setTransactionDate(Glib::RefPtr<Transaction> t, const QDate& newValue)
-{
-    if (newValue == g2q(t->get_date_posted()))
-        return NULL;
-    return new Cmd<Transaction, Glib::Date>(QObject::tr("Edit Transaction Date"),
-                                            t, &Transaction::set_date_posted,
-                                            t->get_date_posted(), q2g(newValue));
-}
-
-// ////////////////////////////////////////////////////////////
-
-class TransactionDestroyCmd : public QUndoCommand
-{
-public:
-    typedef QUndoCommand base_class;
-    typedef Transaction target_type;
-
-    /** Constructor
-     */
-    TransactionDestroyCmd(const QString& text,
-                          Glib::RefPtr<target_type>& targetPtr,
-                          QUndoCommand *parent = 0)
-        : base_class(text, parent)
-        , m_target(targetPtr)
-        , m_previousValue(*targetPtr.operator->())
-        , m_book(m_target->get_book())
-    {
-        Q_ASSERT(m_target);
-    }
-
-    virtual void redo()
-    {
-        xaccTransDestroy(m_target->gobj());
-        m_target.reset();
-    }
-
-    virtual void undo()
-    {
-        m_target = Glib::wrap(Transaction::new_instance(m_book));
-        m_target->begin_edit();
-        m_previousValue.copy_to(m_target);
-        m_target->commit_edit();
-        // Could also use m_previousValue.createAsReal()
-    }
-
-protected:
-    Glib::RefPtr<Transaction> m_target;
-    TmpTransaction m_previousValue;
-    Glib::RefPtr<Book> m_book;
-};
-
-QUndoCommand* destroyTransaction(Glib::RefPtr<Transaction> t)
-{
-    return new TransactionDestroyCmd(QObject::tr("Delete Transaction"),
-                                     t);
-}
-
-// ////////////////////////////////////////////////////////////
-
-/** This is another templated implementation of a QUndoCommand
- * class, this time with keeping a direct reference to the target object.
- *
- * This implements the Command pattern: Any instance of this
- * class represents the change of one member variable (of type ValueT)
- * in an instance of a TargetT object.
- *
- * As we need to keep a reference to the original object, it is
- * relevant who owns the life cycle of that original object. For
- * simplicity, we constrain this current implementation only to
- * classes which are implementations of a WeakPointer<...> which by
- * definition keeps a C pointer to the original object, and we hope
- * that one lives longer than we do.
- */
-template < class TargetT, class ValueT, typename SetterFunc = void (TargetT::*)(const ValueT&) >
-class CmdRef : public QUndoCommand
-{
-public:
-    /// The base class
-    typedef QUndoCommand base_class;
-
-    /// Type of the target object on which this command is applied
-    typedef TargetT target_type;
-
-    /// Type of the value that is set by this command
-    typedef ValueT value_type;
-
-    /// Type of the setter function to set the value in the target object
-    typedef SetterFunc setter_func;
-
-    /** Constructor with the previous value given directly.
-     *
-     * @param text The QUndoCommand's text which will be displayed in the Undo action.
-     * @param targetRef Reference to the target object on which this command is applied.
-     * @param setter Pointer to function which sets the value in the target object
-     * @param previousValue The previous value, in case this command needs to be undone
-     * @param newValue The new value to be set
-     * @param parent The parent QUndoCommand instance, or NULL.
-     */
-    CmdRef(const QString& text,
-           TargetT& targetRef,
-           setter_func setter,
-           const value_type& previousValue,
-           const value_type& newValue,
-           QUndoCommand *parent = 0)
-        : base_class(text, parent)
-        , m_target(targetRef)
-        , m_setter(setter)
-        , m_previousValue(previousValue)
-        , m_newValue(newValue)
-    {
-        Q_ASSERT(m_setter);
-    }
-
-    virtual void redo()
-    {
-        set(m_newValue);
-    }
-    virtual void undo()
-    {
-        set(m_previousValue);
-    }
-
-private:
-    void set(const value_type& value)
-    {
-        // Call the pointer-to-member which is stored in m_setter.
-        (m_target.*m_setter)(value);
-    }
-
-protected:
-    target_type& m_target;
-    setter_func m_setter;
-    value_type m_previousValue;
-    value_type m_newValue;
-};
-
-
-QUndoCommand* setSplitAccount(TmpSplit& t, Glib::RefPtr<Account> newValue)
-{
-    return new CmdRef<TmpSplit, ::Account*, void(TmpSplit::*)(::Account*)>(QObject::tr("Edit Split Account"),
-            t, &TmpSplit::set_account,
-            t.get_account(), newValue->gobj());
-}
-QUndoCommand* setSplitReconcile(TmpSplit& t, char newValue)
-{
-    // Special third argument: The setter function takes a value
-    // directly, instead of a const-reference, so the template type
-    // must be given explicitly.
-    return new CmdRef<TmpSplit, char, void (TmpSplit::*)(char)>(QObject::tr("Edit Split Reconcile"),
-            t, &TmpSplit::set_reconcile,
-            t.get_reconcile(), newValue);
-}
-QUndoCommand* setTransactionNum(TmpTransaction& t, const QString& newValue)
-{
-    return new CmdRef<TmpTransaction, Glib::ustring>(QObject::tr("Edit Transaction Number"),
-            t, &TmpTransaction::set_num,
-            t.get_num(), q2g(newValue));
-}
-QUndoCommand* setTransactionDescription(TmpTransaction& t, const QString& newValue)
-{
-    return new CmdRef<TmpTransaction, Glib::ustring>(QObject::tr("Edit Transaction Description"),
-            t, &TmpTransaction::set_description,
-            t.get_description(), q2g(newValue));
-}
-QUndoCommand* setTransactionDate(TmpTransaction& t, const QDate& newValue)
-{
-    return new CmdRef<TmpTransaction, Glib::Date>(QObject::tr("Edit Transaction Date"),
-            t, &TmpTransaction::set_date_posted,
-            t.get_date_posted(), q2g(newValue));
-}
-
-// ////////////////////////////////////////////////////////////
-
-class TmpSplitValueAndAmountCmd : public QUndoCommand
-{
-public:
-    typedef QUndoCommand base_class;
-    typedef TmpSplit target_type;
-    typedef Numeric value_type;
-
-    /** Constructor without a getter-function but instead the previous
-     * value given directly.
-     */
-    TmpSplitValueAndAmountCmd(const QString& text,
-                              target_type& targetRef,
-                              const value_type& previousValue,
-                              const value_type& newValue,
-                              QUndoCommand *parent = 0)
-        : base_class(text, parent)
-        , m_target(targetRef)
-        , m_previousValue(previousValue)
-        , m_newValue(newValue)
-    {
-        Q_ASSERT(m_target.get_parent());
-        Q_ASSERT(m_target.get_other_split());
-        Q_ASSERT(m_target.get_account());
-    }
-
-    virtual void redo()
-    {
-        set(m_newValue);
-    }
-    virtual void undo()
-    {
-        set(m_previousValue);
-    }
-private:
-    void set(const value_type& value)
-    {
-        Q_ASSERT(m_target.get_parent());
-        const TmpTransaction& trans = *m_target.get_parent();
-        if (trans.get_num_splits() != 2)
-            return;
-        TmpSplit* p_other = m_target.get_other_split();
-        Q_ASSERT(p_other);
-        TmpSplit& other = *p_other;
-        Glib::RefPtr<Commodity> originCommodity = Glib::wrap(m_target.get_account())->get_commodity();
-        Glib::RefPtr<Commodity> transCommodity = trans.get_commodity();
-        Q_ASSERT(other.get_account());
-        Glib::RefPtr<Commodity> otherCommodity = Glib::wrap(other.get_account())->get_commodity();
-        if (originCommodity != transCommodity
-                || transCommodity != otherCommodity)
-            return;
-
-        m_target.set_value(value);
-        m_target.set_amount(value);
-        Numeric valueNeg = value.neg();
-        other.set_amount(valueNeg);
-        other.set_value(valueNeg);
-    }
-
-protected:
-    target_type& m_target;
-    value_type m_previousValue;
-    value_type m_newValue;
-
-};
-
-
-QUndoCommand* setSplitValueAndAmount(TmpSplit& t, const Numeric& newValue)
-{
-    return new TmpSplitValueAndAmountCmd(QObject::tr("Edit Transaction Value"),
-                                         t, t.get_value(), newValue);
-}
-
-// ////////////////////////////////////////////////////////////
-
-
-
-class TransactionCreateCmd : public QUndoCommand
-{
-public:
-    typedef QUndoCommand base_class;
-
-    /** Constructor
-     */
-    TransactionCreateCmd(const QString& text,
-                         const TmpTransaction& target,
-                         QUndoCommand *parent = 0)
-        : base_class(text, parent)
-        , m_template(target)
-        , m_created(NULL)
-    {}
-
-    virtual void redo()
-    {
-        m_created = m_template.create_as_real();
-    }
-
-    virtual void undo()
-    {
-        xaccTransDestroy(m_created->gobj());
-        m_created.reset();
-    }
-
-protected:
-    TmpTransaction m_template;
-    Glib::RefPtr<Transaction> m_created;
-};
-
-QUndoCommand* commitNewTransaction(const TmpTransaction& t)
-{
-    return new TransactionCreateCmd(QObject::tr("Create Transaction"), t);
-}
-
-
-
-} // END namespace cmd
-
-
-} // END namespace gnc
diff --git a/src/gnc/Cmd.hpp b/src/gnc/Cmd.hpp
deleted file mode 100644
index 3b3e3c7..0000000
--- a/src/gnc/Cmd.hpp
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * Cmd.hpp
- * Copyright (C) 2010 Christian Stimming
- *
- * 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 at gnu.org
- */
-
-#ifndef GNC_CMD_HPP
-#define GNC_CMD_HPP
-
-#include <QUndoCommand>
-#include <QDate>
-#include <gnc/WeakPointer.hpp>
-#include <gncmm/Numeric.hpp>
-
-namespace gnc
-{
-
-class Account;
-class Split;
-class TmpSplit;
-class TmpTransaction;
-class Transaction;
-
-/** This is a templated implementation of a QUndoCommand class. This
- * implements the Command pattern: Any instance of this class
- * represents the change of one member variable (of type ValueT) in an
- * instance of a TargetT object.
- *
- * The fun part is that we can pass pointers to the getter and setter
- * functions into this class' constructor, and the redo()/undo()
- * implementations follow naturally. Hence, this class is already
- * sufficient for any Command that is executed by a particular Setter
- * function.
- *
- * As we need to keep a reference to the original object, it is
- * relevant who owns the life cycle of that original object. For
- * simplicity, we constrain this current implementation only to
- * classes which are implementations of a WeakPointer<...> which by
- * definition keeps a C pointer to the original object, and we hope
- * that one lives longer than we do.
- */
-template<class TargetT, class ValueT, typename SetterFunc = void (TargetT::*)(const ValueT&)>
-class Cmd : public QUndoCommand
-{
-public:
-    /// The base class
-    typedef QUndoCommand base_class;
-
-    /// Type of the target object on which this command is applied
-    typedef TargetT target_type;
-
-    /// Type of the value that is set by this command
-    typedef ValueT value_type;
-
-    /// Type of the setter function to set the value in the target object
-    typedef SetterFunc setter_func;
-
-    /// Type of the getter function to retrieve the current value from the target object
-    typedef value_type (target_type::*getter_func)() const;
-
-    /** Constructor with the to-be-manipulated object "targetPtr", the setter
-     * function, the previous value, and the new value.
-     *
-     * @param text The QUndoCommand's text which will be displayed in the Undo action.
-     * @param targetPtr Reference to the target object on which this command is applied.
-     * @param setter Pointer to function which sets the value in the target object
-     * @param previousValue The previous value, in case this command needs to be undone
-     * @param newValue The new value to be set
-     * @param parent The parent QUndoCommand instance, or NULL.
-     */
-    Cmd(const QString& text,
-        Glib::RefPtr<target_type> targetPtr,
-        setter_func setter,
-        const value_type& previousValue,
-        const value_type& newValue,
-        QUndoCommand *parent = 0)
-            : base_class(text, parent)
-            , m_target(targetPtr)
-            , m_setter(setter)
-            , m_previousValue(previousValue)
-            , m_newValue(newValue)
-    {
-        Q_ASSERT(m_target);
-        Q_ASSERT(m_setter);
-    }
-
-    virtual void redo()
-    {
-        set(m_newValue);
-    }
-
-    virtual void undo()
-    {
-        set(m_previousValue);
-    }
-
-
-private:
-    void set(const value_type& value)
-    {
-        // Uh oh.  The calling syntax for pointer-to-member
-        // variables (here: m_setter) looks rather weird:
-        (m_target.operator->()->*m_setter)(value);
-    }
-
-protected:
-    Glib::RefPtr<target_type> m_target;
-    setter_func m_setter;
-    value_type m_previousValue;
-    value_type m_newValue;
-
-};
-
-namespace cmd
-{
-
-// This is the collection of command objects which are already
-// provided for the different data types and their simple
-// members. Just create one of those, add it to a QUndoStack, and
-// magically the values will change with undo/redo back and
-// forth. Spooky, IMHO.
-// QUndoCommand* setSplitMemo(Split& split, const QString& newValue);
-// QUndoCommand* setSplitAction(Split& t, const QString& newValue);
-QUndoCommand* setSplitAccount(Glib::RefPtr<Split> t, Glib::RefPtr<Account> newValue);
-QUndoCommand* setSplitAccount(TmpSplit& t, Glib::RefPtr<Account> newValue);
-QUndoCommand* setSplitReconcile(Glib::RefPtr<Split> t, char newValue);
-QUndoCommand* setSplitReconcile(TmpSplit& t, char newValue);
-// QUndoCommand* setSplitAmount(Glib::RefPtr<Split> t, const Numeric& newValue);
-// QUndoCommand* setSplitValue(Glib::RefPtr<Split> t, const Numeric& newValue);
-QUndoCommand* setTransactionNum(Glib::RefPtr<Transaction> t, const QString& newValue);
-QUndoCommand* setTransactionNum(TmpTransaction& t, const QString& newValue);
-QUndoCommand* setTransactionDescription(Glib::RefPtr<Transaction> t, const QString& newValue);
-QUndoCommand* setTransactionDescription(TmpTransaction& t, const QString& newValue);
-// QUndoCommand* setTransactionNotes(Glib::RefPtr<Transaction> t, const QString& newValue);
-QUndoCommand* setTransactionDate(Glib::RefPtr<Transaction> t, const QDate& newValue);
-QUndoCommand* setTransactionDate(TmpTransaction& t, const QDate& newValue);
-QUndoCommand* setSplitValueAndAmount(Glib::RefPtr<Split> t, const Numeric& newValue);
-QUndoCommand* setSplitValueAndAmount(TmpSplit& t, const Numeric& newValue);
-QUndoCommand* destroyTransaction(Glib::RefPtr<Transaction> t);
-QUndoCommand* commitNewTransaction(const TmpTransaction& t);
-
-} // END namespace cmd
-
-} // END namespace gnc
-
-#endif
diff --git a/src/gnc/Doxyfile b/src/gnc/Doxyfile
deleted file mode 100644
index c10806e..0000000
--- a/src/gnc/Doxyfile
+++ /dev/null
@@ -1,228 +0,0 @@
-# Doxyfile 1.5.5
-
-#---------------------------------------------------------------------------
-# Project related configuration options
-#---------------------------------------------------------------------------
-DOXYFILE_ENCODING      = UTF-8
-PROJECT_NAME           = Cutecash
-PROJECT_NUMBER         = 0.1.0
-OUTPUT_DIRECTORY       = 
-CREATE_SUBDIRS         = NO
-OUTPUT_LANGUAGE        = English
-BRIEF_MEMBER_DESC      = YES
-REPEAT_BRIEF           = YES
-ABBREVIATE_BRIEF       = "The $name class " \
-                         "The $name widget " \
-                         "The $name file " \
-                         is \
-                         provides \
-                         specifies \
-                         contains \
-                         represents \
-                         a \
-                         an \
-                         the
-ALWAYS_DETAILED_SEC    = NO
-INLINE_INHERITED_MEMB  = NO
-FULL_PATH_NAMES        = NO
-STRIP_FROM_PATH        = 
-STRIP_FROM_INC_PATH    = 
-SHORT_NAMES            = NO
-JAVADOC_AUTOBRIEF      = NO
-QT_AUTOBRIEF           = NO
-MULTILINE_CPP_IS_BRIEF = NO
-INHERIT_DOCS           = YES
-SEPARATE_MEMBER_PAGES  = NO
-TAB_SIZE               = 4
-ALIASES                = 
-OPTIMIZE_OUTPUT_FOR_C  = NO
-OPTIMIZE_OUTPUT_JAVA   = NO
-OPTIMIZE_FOR_FORTRAN   = NO
-OPTIMIZE_OUTPUT_VHDL   = NO
-BUILTIN_STL_SUPPORT    = YES
-CPP_CLI_SUPPORT        = NO
-SIP_SUPPORT            = NO
-DISTRIBUTE_GROUP_DOC   = NO
-SUBGROUPING            = YES
-TYPEDEF_HIDES_STRUCT   = NO
-#---------------------------------------------------------------------------
-# Build related configuration options
-#---------------------------------------------------------------------------
-EXTRACT_ALL            = YES
-EXTRACT_PRIVATE        = YES
-EXTRACT_STATIC         = YES
-EXTRACT_LOCAL_CLASSES  = YES
-EXTRACT_LOCAL_METHODS  = NO
-EXTRACT_ANON_NSPACES   = NO
-HIDE_UNDOC_MEMBERS     = NO
-HIDE_UNDOC_CLASSES     = NO
-HIDE_FRIEND_COMPOUNDS  = NO
-HIDE_IN_BODY_DOCS      = NO
-INTERNAL_DOCS          = NO
-CASE_SENSE_NAMES       = NO
-HIDE_SCOPE_NAMES       = NO
-SHOW_INCLUDE_FILES     = YES
-INLINE_INFO            = YES
-SORT_MEMBER_DOCS       = YES
-SORT_BRIEF_DOCS        = NO
-SORT_GROUP_NAMES       = NO
-SORT_BY_SCOPE_NAME     = NO
-GENERATE_TODOLIST      = YES
-GENERATE_TESTLIST      = YES
-GENERATE_BUGLIST       = YES
-GENERATE_DEPRECATEDLIST= YES
-ENABLED_SECTIONS       = 
-MAX_INITIALIZER_LINES  = 30
-SHOW_USED_FILES        = YES
-SHOW_DIRECTORIES       = YES
-FILE_VERSION_FILTER    = 
-#---------------------------------------------------------------------------
-# configuration options related to warning and progress messages
-#---------------------------------------------------------------------------
-QUIET                  = YES
-WARNINGS               = YES
-WARN_IF_UNDOCUMENTED   = YES
-WARN_IF_DOC_ERROR      = YES
-WARN_NO_PARAMDOC       = NO
-WARN_FORMAT            = "$file:$line: $text "
-WARN_LOGFILE           = 
-#---------------------------------------------------------------------------
-# configuration options related to the input files
-#---------------------------------------------------------------------------
-INPUT                  = . \
-	../core-utils \
-	../gnc-module \
-	../engine \
-	../app-utils
-INPUT_ENCODING         = UTF-8
-FILE_PATTERNS          = *.cpp \
-                         *.hpp \
-                         *.h
-RECURSIVE              = NO
-EXCLUDE                = 
-EXCLUDE_SYMLINKS       = NO
-EXCLUDE_PATTERNS       = test-*.c
-EXCLUDE_SYMBOLS        = 
-EXAMPLE_PATH           = 
-EXAMPLE_PATTERNS       = *
-EXAMPLE_RECURSIVE      = NO
-IMAGE_PATH             = 
-INPUT_FILTER           = 
-FILTER_PATTERNS        = 
-FILTER_SOURCE_FILES    = NO
-#---------------------------------------------------------------------------
-# configuration options related to source browsing
-#---------------------------------------------------------------------------
-SOURCE_BROWSER         = NO
-INLINE_SOURCES         = NO
-STRIP_CODE_COMMENTS    = YES
-REFERENCED_BY_RELATION = NO
-REFERENCES_RELATION    = NO
-REFERENCES_LINK_SOURCE = YES
-USE_HTAGS              = NO
-VERBATIM_HEADERS       = NO
-#---------------------------------------------------------------------------
-# configuration options related to the alphabetical class index
-#---------------------------------------------------------------------------
-ALPHABETICAL_INDEX     = YES
-COLS_IN_ALPHA_INDEX    = 4
-IGNORE_PREFIX          = 
-#---------------------------------------------------------------------------
-# configuration options related to the HTML output
-#---------------------------------------------------------------------------
-GENERATE_HTML          = YES
-HTML_OUTPUT            = html
-HTML_FILE_EXTENSION    = .html
-HTML_HEADER            = 
-HTML_FOOTER            = 
-HTML_STYLESHEET        = 
-HTML_ALIGN_MEMBERS     = YES
-GENERATE_HTMLHELP      = NO
-GENERATE_DOCSET        = NO
-DOCSET_FEEDNAME        = "Doxygen generated docs"
-DOCSET_BUNDLE_ID       = org.doxygen.Project
-HTML_DYNAMIC_SECTIONS  = NO
-CHM_FILE               = 
-HHC_LOCATION           = 
-GENERATE_CHI           = NO
-BINARY_TOC             = NO
-TOC_EXPAND             = NO
-DISABLE_INDEX          = NO
-ENUM_VALUES_PER_LINE   = 4
-GENERATE_TREEVIEW      = YES
-TREEVIEW_WIDTH         = 250
-#---------------------------------------------------------------------------
-# configuration options related to the LaTeX output
-#---------------------------------------------------------------------------
-GENERATE_LATEX         = NO
-#---------------------------------------------------------------------------
-# configuration options related to the RTF output
-#---------------------------------------------------------------------------
-GENERATE_RTF           = NO
-#---------------------------------------------------------------------------
-# configuration options related to the man page output
-#---------------------------------------------------------------------------
-GENERATE_MAN           = NO
-#---------------------------------------------------------------------------
-# configuration options related to the XML output
-#---------------------------------------------------------------------------
-GENERATE_XML           = NO
-#---------------------------------------------------------------------------
-# configuration options for the AutoGen Definitions output
-#---------------------------------------------------------------------------
-GENERATE_AUTOGEN_DEF   = NO
-#---------------------------------------------------------------------------
-# configuration options related to the Perl module output
-#---------------------------------------------------------------------------
-GENERATE_PERLMOD       = NO
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor   
-#---------------------------------------------------------------------------
-ENABLE_PREPROCESSING   = YES
-MACRO_EXPANSION        = NO
-EXPAND_ONLY_PREDEF     = NO
-SEARCH_INCLUDES        = YES
-INCLUDE_PATH           = 
-INCLUDE_FILE_PATTERNS  = 
-PREDEFINED             = DOXYGEN_IGNORE
-EXPAND_AS_DEFINED      = 
-SKIP_FUNCTION_MACROS   = YES
-#---------------------------------------------------------------------------
-# Configuration::additions related to external references   
-#---------------------------------------------------------------------------
-TAGFILES               = 
-GENERATE_TAGFILE       = 
-ALLEXTERNALS           = NO
-EXTERNAL_GROUPS        = YES
-PERL_PATH              = /usr/bin/perl
-#---------------------------------------------------------------------------
-# Configuration options related to the dot tool   
-#---------------------------------------------------------------------------
-CLASS_DIAGRAMS         = YES
-MSCGEN_PATH            = 
-HIDE_UNDOC_RELATIONS   = YES
-HAVE_DOT               = YES
-CLASS_GRAPH            = YES
-COLLABORATION_GRAPH    = NO
-GROUP_GRAPHS           = YES
-UML_LOOK               = NO
-TEMPLATE_RELATIONS     = NO
-INCLUDE_GRAPH          = NO
-INCLUDED_BY_GRAPH      = NO
-CALL_GRAPH             = NO
-CALLER_GRAPH           = NO
-GRAPHICAL_HIERARCHY    = YES
-DIRECTORY_GRAPH        = YES
-DOT_IMAGE_FORMAT       = png
-DOT_PATH               = 
-DOTFILE_DIRS           = 
-DOT_GRAPH_MAX_NODES    = 50
-MAX_DOT_GRAPH_DEPTH    = 1000
-DOT_TRANSPARENT        = NO
-DOT_MULTI_TARGETS      = NO
-GENERATE_LEGEND        = YES
-DOT_CLEANUP            = YES
-#---------------------------------------------------------------------------
-# Configuration::additions related to the search engine   
-#---------------------------------------------------------------------------
-SEARCHENGINE           = NO
diff --git a/src/gnc/QofEventWrapper.cpp b/src/gnc/QofEventWrapper.cpp
deleted file mode 100644
index f1455df..0000000
--- a/src/gnc/QofEventWrapper.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * QofEventWrapper.cpp
- * Copyright (C) 2010 Christian Stimming
- *
- * 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 at gnu.org
- */
-
-#include "QofEventWrapper.hpp"
-#include "engine/gnc-event.h"
-
-#include "gnc/SplitListModel.hpp"
-#include "gncmm/Transaction.hpp"
-
-namespace gnc
-{
-
-// Explicit instantiation to check for compiler errors
-template class QofEventWrapper<SplitListModel, ::Transaction*>;
-
-#define EVENT_TO_STR(result, input, evtype) \
-    if ((input) & (evtype)) result += QString(result.isEmpty() ? "" : ",") + #evtype
-
-QString qofEventToString(QofEventId event_type)
-{
-    if (event_type == QOF_EVENT_NONE)
-        return "NONE";
-    QString r;
-    EVENT_TO_STR(r, event_type, QOF_EVENT_CREATE);
-    EVENT_TO_STR(r, event_type, QOF_EVENT_MODIFY);
-    EVENT_TO_STR(r, event_type, QOF_EVENT_DESTROY);
-    EVENT_TO_STR(r, event_type, QOF_EVENT_ADD);
-    EVENT_TO_STR(r, event_type, QOF_EVENT_REMOVE);
-
-    EVENT_TO_STR(r, event_type, GNC_EVENT_ITEM_ADDED);
-    EVENT_TO_STR(r, event_type, GNC_EVENT_ITEM_REMOVED);
-    EVENT_TO_STR(r, event_type, GNC_EVENT_ITEM_CHANGED);
-
-    if (r.isEmpty())
-        r = QString::number(event_type);
-    return r;
-}
-
-
-} // END namespace gnc
diff --git a/src/gnc/QofEventWrapper.hpp b/src/gnc/QofEventWrapper.hpp
deleted file mode 100644
index f21154d..0000000
--- a/src/gnc/QofEventWrapper.hpp
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * QofEventWrapper.hpp
- * Copyright (C) 2010 Christian Stimming
- *
- * 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 at gnu.org
- */
-
-#ifndef GNC_QOFEVENTWRAPPER_HPP
-#define GNC_QOFEVENTWRAPPER_HPP
-
-// gnucash includes
-#include "config.h" // required by qof/qofutil.h
-#include "engine/guid.hpp"
-extern "C"
-{
-#include "qof.h"
-#include "engine/gnc-engine.h"
-#include "engine/Account.h"
-#include "engine/Transaction.h"
-#include "engine/gnc-commodity.h"
-}
-
-#include <QString>
-#include <QDebug>
-#include <stdexcept>
-
-namespace gnc
-{
-
-/** Conversion of the event_type to string (for debugging) */
-QString qofEventToString(QofEventId event_type);
-
-/** Retrieval of the Qof instance class name (for debugging) */
-inline const char* getQofType( ::QofInstance* obj)
-{
-    return obj->e_type;
-}
-
-namespace detail
-{
-    template<class ValuePtrT> inline const char* getQofTypeT()
-    {
-        Q_ASSERT(false);
-        // This would need a BOOST_STATIC_ASSERT(sizeof(T)==0) to
-        // trigger a compile-time warning in case this function is
-        // erroneously instantiated.
-        // This template must not be instantiated. Instead, for each
-        // templated usage there must exist a specialization which
-        // will return the correct QOF_ID string!
-        throw std::runtime_error("Should not have been instantiated");
-    }
-    template<> inline const char* getQofTypeT< ::Transaction*>()
-    {
-        return GNC_ID_TRANS;
-    }
-    template<> inline const char* getQofTypeT< ::Account*>()
-    {
-        return GNC_ID_ACCOUNT;
-    }
-    template<> inline const char* getQofTypeT< ::QofBook*>()
-    {
-        return QOF_ID_BOOK;
-    }
-    template<> inline const char* getQofTypeT< ::QofSession*>()
-    {
-        return QOF_ID_SESSION;
-    }
-    template<> inline const char* getQofTypeT< ::gnc_commodity*>()
-    {
-        return GNC_ID_COMMODITY;
-    }
-    template<> inline const char* getQofTypeT< ::Split*>()
-    {
-        return GNC_ID_SPLIT;
-    }
-}
-
-/** Template wrapper class for objects which want to receive
- * notifications from the qof_event system in any of their member
- * functions.
- *
- * The receiver's class is the first template argument; the argument
- * type of the to-be-called member function is the second template
- * (usually a pointer type). */
-template<class ReceiverT, class ValuePtrT, typename SlotFunc = void (ReceiverT::*)(ValuePtrT, QofEventId)>
-class QofEventWrapper
-{
-public:
-    QofEventWrapper(ReceiverT& receiver,
-                    SlotFunc recvSlot)
-            : m_receiver(receiver)
-            , m_receiveFunc(recvSlot)
-            , m_qof_type(gnc::detail::getQofTypeT<ValuePtrT>())
-    {
-        m_handler_id = qof_event_register_handler(QofEventWrapper::event_handler, this);
-    }
-
-    ~QofEventWrapper()
-    {
-        qof_event_unregister_handler(m_handler_id);
-    }
-
-    static void event_handler (::QofInstance *entity,  QofEventId event_type,
-                               gpointer user_data, gpointer event_data)
-    {
-        QofEventWrapper* wrapper = static_cast<QofEventWrapper *>(user_data);
-        wrapper->private_event_handler(entity, event_type, event_data);
-    }
-
-private:
-    void private_event_handler (::QofInstance *entity,  QofEventId event_type,
-                                gpointer event_data)
-    {
-//         qDebug() << "private_event_handler, id=" << qofEventToString(event_type)
-//         << "entity=" << getQofType(entity);
-
-        // Verify that we have the correct QofInstance type and also
-        // correct event type
-        if (!QOF_CHECK_TYPE(entity, m_qof_type))
-            return;
-//         if ((event_type & m_event_type) == 0)
-//             return;
-
-//         qDebug() << "private_event_handler, id=" << qofEventToString(event_type)
-//         << "entity=" << getQofType(entity);
-
-        ValuePtrT vptr = reinterpret_cast<ValuePtrT>(entity);
-
-        // Call the pointer-to-member function with that weird C++
-        // syntax
-        (m_receiver.*m_receiveFunc)(vptr, event_type);
-    }
-
-    ReceiverT& m_receiver;
-    SlotFunc m_receiveFunc;
-    const char* m_qof_type;
-    gint m_handler_id;
-};
-
-} // END namespace gnc
-
-#endif
diff --git a/src/gnc/RecentFileMenu.cpp b/src/gnc/RecentFileMenu.cpp
deleted file mode 100644
index ca8a794..0000000
--- a/src/gnc/RecentFileMenu.cpp
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * RecentFileMenu.hpp
- * Copyright (C) 2010 Christian Stimming
- *
- * 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 at gnu.org
- */
-
-
-#include "RecentFileMenu.hpp"
-
-#include <QMenu>
-#include <QAction>
-#include <QSettings>
-#include <QFileInfo>
-
-namespace gnc
-{
-
-RecentFileMenu::RecentFileMenu(const QString& title, QWidget *parent)
-        : QMenu(title, parent)
-{
-    createActions();
-}
-
-
-RecentFileMenu::~RecentFileMenu()
-{
-}
-
-
-void RecentFileMenu::createActions()
-{
-    for (int i = 0; i < MaxRecentFiles; ++i)
-    {
-        QAction *newAct = new QAction(this);
-        newAct->setVisible(false);
-        connect(newAct, SIGNAL(triggered()),
-                this, SLOT(on_actionRecentFile()));
-        addAction(newAct);
-
-        m_actionRecentFile[i] = newAct;
-    }
-}
-
-
-void RecentFileMenu::usingFile(const QString& filename)
-{
-    if (filename.isEmpty())
-        return;
-
-    m_fileNames.removeAll(filename);
-    while (m_fileNames.size() > MaxRecentFiles - 1)
-        // remove last allowed position
-        m_fileNames.removeAt(MaxRecentFiles - 1);
-    m_fileNames.insert(0, filename);
-    updateMenu();
-}
-
-
-void RecentFileMenu::updateMenu()
-{
-    setEnabled(!m_fileNames.isEmpty());
-    for (int i = 0; i < std::min(int(MaxRecentFiles), m_fileNames.size()); ++i)
-    {
-        const QString& qs = m_fileNames.at(i);
-        QAction *act = m_actionRecentFile[i];
-        act->setVisible(true);
-        act->setText(tr("&%1 %2").arg(i + 1).arg(QFileInfo(qs).fileName()));
-        act->setStatusTip(qs);
-        act->setData(qs);
-    }
-    for (int i = m_fileNames.size(); i < MaxRecentFiles; ++i)
-    {
-        QAction *act = m_actionRecentFile[i];
-        act->setVisible(false);
-    }
-
-    update();
-}
-
-
-void RecentFileMenu::readSettings(QSettings *settings, const QString &groupName)
-{
-    int size = settings->beginReadArray(groupName);
-    for (int i = 0; i < size; i++)
-    {
-        settings->setArrayIndex(i);
-        QString qs = settings->value("filename").toString();
-        if (!qs.isEmpty())
-        {
-            m_fileNames << qs;
-        }
-    }
-    settings->endArray();
-    updateMenu();
-}
-
-QString RecentFileMenu::getRecentFileName(QSettings *settings,
-                                          const QString &groupName)
-{
-    settings->beginReadArray(groupName);
-    settings->setArrayIndex(0);
-    QString qs = settings->value("filename").toString();
-    settings->endArray();
-    return qs;
-}
-
-void RecentFileMenu::writeSettings(QSettings *settings, const QString &groupName)
-{
-    settings->remove(groupName);
-    settings->beginWriteArray(groupName);
-
-    int numElements = m_fileNames.size();
-    int j = 0;
-    for (int i = 0; i < numElements; i++)
-    {
-        QString qs = m_fileNames.at(i);
-        if (!qs.isEmpty())
-        {
-            settings->setArrayIndex(j++);
-            settings->setValue("filename", qs);
-        }
-    }
-
-    settings->endArray();
-}
-
-
-void RecentFileMenu::on_actionRecentFile()
-{
-    QAction *action = qobject_cast<QAction *>(sender());
-    if (action)
-    {
-        QString str = action->data().toString();
-        if (!str.isEmpty())
-            Q_EMIT fileSelected(str);
-    }
-}
-
-} // END namespace gnc
diff --git a/src/gnc/RecentFileMenu.hpp b/src/gnc/RecentFileMenu.hpp
deleted file mode 100644
index 6debccd..0000000
--- a/src/gnc/RecentFileMenu.hpp
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * RecentFileMenu.hpp
- * Copyright (C) 2010 Christian Stimming
- *
- * 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 at gnu.org
- */
-
-#ifndef GNC_RECENTFILEMENU_HPP
-#define GNC_RECENTFILEMENU_HPP
-
-#include <QtGui/QMenu>
-#include <QtCore/QStringList>
-
-class QAction;
-class QSettings;
-
-namespace gnc
-{
-
-/**
- * A menu that shows a list of recently opened files.
- */
-class RecentFileMenu: public QMenu
-{
-    Q_OBJECT
-
-public:
-    RecentFileMenu(const QString& title, QWidget *parent = 0);
-    ~RecentFileMenu();
-
-    /**
-     * Read the internal list from a QSettings array.
-     * @param settings QSettings to read from
-     * @param groupName name of the array for QSettings::beginReadArray().
-     */
-    void readSettings(QSettings *settings, const QString &groupName);
-
-    QString getRecentFileName(QSettings *settings, const QString &groupName);
-
-    /**
-     * Write the internal list to a QSettings array.
-     * @param settings QSettings to write to
-     * @param groupName name of the array for QSettings::beginWriteArray().
-     */
-    void writeSettings(QSettings *settings, const QString &groupName);
-
-public Q_SLOTS:
-    /**
-     * Record the given string as a filename that was (or is)
-     * being used in the application.  As a result the given
-     * filename will always become the new first menu entry.
-     */
-    void usingFile(const QString &fileName);
-
-Q_SIGNALS:
-    /**
-     * This signal is emitted whenever the user selects a file from the internally managed
-     * menu (i.e. the user wants to open the given file).
-     */
-    void fileSelected(const QString &fileName);
-
-private Q_SLOTS:
-    void on_actionRecentFile();
-
-private:
-    void updateMenu();
-    void createActions();
-
-private:
-    QStringList m_fileNames;
-
-    enum { MaxRecentFiles = 5 };
-    QAction *m_actionRecentFile[MaxRecentFiles];
-
-};
-
-} // END namespace gnc
-
-#endif
diff --git a/src/gnc/Session.cpp b/src/gnc/Session.cpp
deleted file mode 100644
index 78d5734..0000000
--- a/src/gnc/Session.cpp
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Session.cpp
- * Copyright (C) 2010 Christian Stimming
- *
- * 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 at gnu.org
- */
-
-#include "config.h"
-#include "gnc/Session.hpp"
-#include "gncmm/Book.hpp"
-
-// Explicit instantiation to check for compiler errors in the template
-template class gnc::WeakPointer< QofSession >;
-
-
-namespace gnc
-{
-
-Glib::RefPtr<Book> Session::get_book () const
-{
-    return Glib::wrap(qof_session_get_book(gobj()));
-}
-
-
-#define TYPE_TO_STR(tstr, desc) tstr : return std::make_pair<QString,QString>(QString::fromUtf8(#tstr), QString::fromUtf8(desc))
-
-std::pair<QString, QString> errorToStringPair(QofBackendError err)
-{
-    switch (err)
-    {
-    case TYPE_TO_STR(ERR_BACKEND_NO_ERR, "No Error");
-    case TYPE_TO_STR(ERR_BACKEND_NO_HANDLER, "no backend handler found for this access method (ENOSYS)");
-    case TYPE_TO_STR(ERR_BACKEND_NO_BACKEND, "Backend * pointer was unexpectedly null");
-    case TYPE_TO_STR(ERR_BACKEND_BAD_URL, "Can't parse url");
-    case TYPE_TO_STR(ERR_BACKEND_NO_SUCH_DB, "the named database doesn't exist");
-    case TYPE_TO_STR(ERR_BACKEND_CANT_CONNECT, "bad dbname/login/passwd or network failure");
-    case TYPE_TO_STR(ERR_BACKEND_CONN_LOST, "Lost connection to server");
-    case TYPE_TO_STR(ERR_BACKEND_LOCKED, "in use by another user (ETXTBSY)");
-    case TYPE_TO_STR(ERR_BACKEND_READONLY, "cannot write to file/directory");
-    case TYPE_TO_STR(ERR_BACKEND_TOO_NEW, "file/db version newer than what we can read");
-    case TYPE_TO_STR(ERR_BACKEND_DATA_CORRUPT, "data in db is corrupt");
-    case TYPE_TO_STR(ERR_BACKEND_SERVER_ERR, "error in response from server");
-    case TYPE_TO_STR(ERR_BACKEND_ALLOC, "internal memory allocation failure");
-    case TYPE_TO_STR(ERR_BACKEND_PERM, "user login successful, but no permissions to access the desired object");
-    case TYPE_TO_STR(ERR_BACKEND_MODIFIED, "commit of object update failed because another user has modified the object");
-    case TYPE_TO_STR(ERR_BACKEND_MOD_DESTROY, "commit of object update failed because another user has deleted the object");
-    case TYPE_TO_STR(ERR_BACKEND_MISC, "undetermined error");
-    case TYPE_TO_STR(ERR_QOF_OVERFLOW, "EOVERFLOW - generated by strtol or strtoll.");
-    case TYPE_TO_STR(ERR_FILEIO_FILE_BAD_READ, "read failed or file prematurely truncated");
-    case TYPE_TO_STR(ERR_FILEIO_FILE_EMPTY, "file exists, is readable, but is empty");
-    case TYPE_TO_STR(ERR_FILEIO_FILE_LOCKERR, "mangled locks (unspecified error)");
-    case TYPE_TO_STR(ERR_FILEIO_FILE_NOT_FOUND, "not found / no such file");
-    case TYPE_TO_STR(ERR_FILEIO_FILE_TOO_OLD, "file version so old we can't read it");
-    case TYPE_TO_STR(ERR_FILEIO_UNKNOWN_FILE_TYPE, "didn't recognize the file type");
-    case TYPE_TO_STR(ERR_FILEIO_PARSE_ERROR, "couldn't parse the data in the file");
-    case TYPE_TO_STR(ERR_FILEIO_BACKUP_ERROR, "couldn't make a backup of the file");
-    case TYPE_TO_STR(ERR_FILEIO_WRITE_ERROR, "couldn't write to the file");
-    case TYPE_TO_STR(ERR_FILEIO_READ_ERROR, "Could not open the file for reading.");
-    case TYPE_TO_STR(ERR_FILEIO_NO_ENCODING, "file does not specify encoding");
-    case TYPE_TO_STR(ERR_FILEIO_FILE_EACCES, "No read access permission for the given file");
-    case TYPE_TO_STR(ERR_NETIO_SHORT_READ, "not enough bytes received");
-    case TYPE_TO_STR(ERR_NETIO_WRONG_CONTENT_TYPE, "wrong kind of server, wrong data served");
-    case TYPE_TO_STR(ERR_NETIO_NOT_GNCXML, "whatever it is, we can't parse it.");
-    case TYPE_TO_STR(ERR_SQL_MISSING_DATA, "database doesn't contain expected data");
-    case TYPE_TO_STR(ERR_SQL_DB_TOO_OLD, "database is old and needs upgrading");
-    case TYPE_TO_STR(ERR_SQL_DB_BUSY, "database is busy, cannot upgrade version");
-    case TYPE_TO_STR(ERR_RPC_HOST_UNK, "Host unknown");
-    case TYPE_TO_STR(ERR_RPC_CANT_BIND, "can't bind to address");
-    case TYPE_TO_STR(ERR_RPC_CANT_ACCEPT, "can't accept connection");
-    case TYPE_TO_STR(ERR_RPC_NO_CONNECTION, "no connection to server");
-    case TYPE_TO_STR(ERR_RPC_BAD_VERSION, "RPC Version Mismatch");
-    case TYPE_TO_STR(ERR_RPC_FAILED, "Operation failed");
-    case TYPE_TO_STR(ERR_RPC_NOT_ADDED, "object not added");
-    default:
-        assert(0); // must not be reached
-        return std::make_pair("Unknown", "Unknown");
-    }
-}
-
-} // END namespace gnc
diff --git a/src/gnc/Session.hpp b/src/gnc/Session.hpp
deleted file mode 100644
index 2d47628..0000000
--- a/src/gnc/Session.hpp
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Session.hpp
- * Copyright (C) 2010 Christian Stimming
- *
- * 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 at gnu.org
- */
-
-#ifndef GNC_SESSION_HPP
-#define GNC_SESSION_HPP
-
-// gnucash includes
-#include "config.h" // required by qof/qofutil.h
-#include <glib/gi18n.h>
-#include "engine/guid.hpp"
-extern "C"
-{
-#include "qof.h"
-#include "engine/gnc-hooks.h"
-}
-
-#include "gnc/WeakPointer.hpp"
-#include <glibmm/refptr.h>
-#include <QString>
-
-namespace gnc
-{
-
-class Book;
-
-/** Wrapper around a gnucash ::QofSession pointer with C++ methods for
- * easier setter and getter access.
- *
- * Unfortunately this object has no information about whether the
- * underlying gnucash ::QofSession object is still alive or has been
- * deleted.
- */
-class Session : public WeakPointer< ::QofSession >
-{
-public:
-    typedef WeakPointer< ::QofSession > base_class;
-
-    Session(element_type *ptr = 0)
-            : base_class(ptr)
-    {}
-
-    // Now the actual functions on the object
-
-    void begin(const QString& book_id, bool ignore_lock, bool create_if_nonexistent, bool force)
-    {
-        qof_session_begin(gobj(), book_id.toUtf8(), ignore_lock, create_if_nonexistent, force);
-    }
-    void load (QofPercentageFunc percentage_func)
-    {
-        qof_session_load(gobj(), percentage_func);
-    }
-    QofBackendError get_error ()
-    {
-        return qof_session_get_error(gobj());
-    }
-    QofBackendError pop_error ()
-    {
-        return qof_session_pop_error(gobj());
-    }
-    QString get_error_message() const
-    {
-        return QString::fromUtf8(qof_session_get_error_message(gobj()));
-    }
-    Glib::RefPtr<Book> get_book () const;
-
-    QString get_file_path () const
-    {
-        return QString::fromUtf8(qof_session_get_file_path(gobj()));
-    }
-
-    QString get_url() const
-    {
-        return QString::fromUtf8(qof_session_get_url(gobj()));
-    }
-
-    bool save_in_progress() const
-    {
-        return qof_session_save_in_progress(gobj());
-    }
-    void save (QofPercentageFunc percentage_func)
-    {
-        qof_session_save(gobj(), percentage_func);
-    }
-};
-
-std::pair<QString, QString> errorToStringPair(QofBackendError err);
-
-} // END namespace gnc
-
-#endif
diff --git a/src/gnc/SplitListModel.cpp b/src/gnc/SplitListModel.cpp
deleted file mode 100644
index 528869d..0000000
--- a/src/gnc/SplitListModel.cpp
+++ /dev/null
@@ -1,756 +0,0 @@
-/*
- * SplitListModel.cpp
- * Copyright (C) 2010 Christian Stimming
- *
- * 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 at gnu.org
- */
-
-#include "SplitListModel.hpp"
-#include "engine/gnc-event.h" // for GNC_EVENT_ITEM_ADDED
-#include "gncmm/Transaction.hpp"
-#include "gnc/Cmd.hpp"
-#include "gnc/Session.hpp"
-#include "gnc/metatype.hpp"
-#include <QDebug>
-#include <QUndoStack>
-#include <QBrush>
-#include <QMessageBox>
-#include <QDateTime>
-
-#include "app-utils/gnc-ui-util.h" // for gnc_get_reconcile_str
-
-namespace gnc
-{
-
-
-
-SplitListModel::SplitListModel(const Glib::RefPtr<Account> acc, QUndoStack* undoStack, QObject *parent)
-        : QAbstractItemModel(parent)
-        , m_account(acc)
-        , m_list()
-        , m_undoStack(undoStack)
-        , m_eventWrapper(*this, &SplitListModel::transactionEvent)
-        , m_eventWrapperAccount(*this, &SplitListModel::accountEvent)
-        , m_enableNewTransaction(true)
-{
-    recreateCache();
-
-    m_tmpTransaction.push_back(TmpSplit(NULL));
-    m_tmpTransaction.push_back(TmpSplit(NULL));
-    recreateTmpTrans();
-}
-
-void SplitListModel::recreateCache()
-{
-    SplitQList newSplits = Split::from_glist(m_account->get_split_list());
-    bool doReset = (newSplits.size() != m_list.size());
-
-    m_list = newSplits;
-
-    // Cache the mapping of transactions to split in the m_hash
-    m_hash.clear();
-    for (int k = 0; k < m_list.size(); ++k)
-    {
-        m_hash.insert(Glib::wrap(m_list[k])->get_parent()->gobj(), k);
-    }
-
-    if (doReset)
-        reset();
-}
-
-void SplitListModel::recreateTmpTrans()
-{
-    m_tmpTransaction.reset_content();
-    while (m_tmpTransaction.get_num_splits() > 2)
-        m_tmpTransaction.get_splits().pop_back();
-    Q_ASSERT(m_tmpTransaction.get_num_splits() == 2);
-
-    m_tmpTransaction.set_commodity(m_account->get_commodity());
-    m_tmpTransaction.set_date_posted(q2g(QDate::currentDate()));
-    TmpSplit& oursplit = m_tmpTransaction.get_splits().front();
-    TmpSplit& othersplit = m_tmpTransaction.get_splits().back();
-    oursplit.set_account(m_account->gobj());
-
-    Q_ASSERT(m_tmpTransaction.get_num_splits() == 2);
-    Q_ASSERT(oursplit.get_account() == m_account->gobj());
-    Q_ASSERT(othersplit.get_account() == NULL);
-}
-
-SplitListModel::~SplitListModel()
-{
-}
-
-QModelIndex SplitListModel::index(int row, int column,
-                                  const QModelIndex &parent) const
-{
-    //qDebug() << "index(), " << row << column << parent;
-    if (!hasIndex(row, column, parent) || row >= rowCount())
-        return QModelIndex();
-
-    if (m_enableNewTransaction && row == m_list.size())
-        return createIndex(row, column, (void*)NULL);
-
-    Glib::RefPtr<Split> childItem = Glib::wrap(m_list.at(row));
-    if (childItem)
-    {
-        //qDebug() << "returning" << childItem.getName();
-        return createIndex(row, column, childItem->gobj());
-    }
-    else
-        return QModelIndex();
-}
-
-bool SplitListModel::removeRows(int position, int rows, const QModelIndex &index)
-{
-    for (int row = position; row < position + rows; ++row)
-    {
-        Glib::RefPtr<Split> s = Glib::wrap(m_list.at(row));
-        Q_ASSERT(s);
-        Glib::RefPtr<Transaction> t = s->get_parent();
-        Q_ASSERT(t);
-        QUndoCommand* cmd = cmd::destroyTransaction(t);
-        m_undoStack->push(cmd);
-    }
-    // No beginInsertRows/endInsertRows because reset() is called in
-    // recreateCache() anyway.
-    return true;
-}
-
-int SplitListModel::rowCount(const QModelIndex& parent) const
-{
-    return m_list.size() + (m_enableNewTransaction ? 1 : 0);
-}
-
-int SplitListModel::columnCount(const QModelIndex& parent) const
-{
-    //qDebug() << "columnCount()" << parent;
-//     if (!parent.isValid())
-//         return 0;
-//     else
-    return COLUMN_LAST; // Fixed number for now
-}
-
-Qt::ItemFlags SplitListModel::flags(const QModelIndex &index) const
-{
-    //qDebug() << "flags()" << index;
-    if (!index.isValid())
-        return 0;
-
-    Qt::ItemFlags result = Qt::ItemIsEnabled | Qt::ItemIsSelectable;
-    switch (index.column())
-    {
-    case COLUMN_DATE:
-    case COLUMN_NUM:
-    case COLUMN_DESC:
-    case COLUMN_RECONCILE:
-    case COLUMN_INCREASE:
-    case COLUMN_DECREASE:
-    case COLUMN_ACCOUNT:
-        // Allow write access as well
-        return result | Qt::ItemIsEditable;
-    case COLUMN_BALANCE:
-    default:
-        // Ensure read-only access only
-        return result;
-    }
-}
-
-QVariant SplitListModel::data(const QModelIndex& index, int role) const
-{
-    //qDebug() << "data(), " << index;
-    if (!index.isValid())
-        return QVariant();
-
-    if (m_enableNewTransaction && index.row() == m_list.size())
-    {
-        // Special case: We are in the last row which represents the
-        // newly entered txn.
-
-        const TmpSplit& split(m_tmpTransaction.get_splits().front());
-        const TmpTransaction& trans = m_tmpTransaction;
-        Numeric amount = split.get_value();
-        PrintAmountInfo printInfo(m_account, false);
-        switch (index.column())
-        {
-        case COLUMN_DATE:
-            switch (role)
-            {
-            case Qt::DisplayRole:
-            case Qt::EditRole:
-                return g2q(trans.get_date_posted());
-            default:
-                return QVariant();
-            }
-        case COLUMN_NUM:
-            switch (role)
-            {
-            case Qt::DisplayRole:
-            case Qt::EditRole:
-                return g2q(trans.get_num());
-            default:
-                return QVariant();
-            }
-        case COLUMN_DESC:
-            switch (role)
-            {
-            case Qt::DisplayRole:
-            case Qt::EditRole:
-                return g2q(trans.get_description());
-            default:
-                return QVariant();
-            }
-        case COLUMN_ACCOUNT:
-            switch (role)
-            {
-            case Qt::DisplayRole:
-            case Qt::EditRole:
-                if (trans.get_num_splits() == 2)
-                    return QVariant::fromValue(trans.get_splits().back().get_account());
-                else
-                    return QVariant(); // FIXME: Multi-split txn here
-            default:
-                return QVariant();
-            }
-        case COLUMN_RECONCILE:
-            switch (role)
-            {
-            case Qt::DisplayRole:
-            case Qt::EditRole:
-                return QString::fromUtf8(gnc_get_reconcile_str(split.get_reconcile()));
-            default:
-                return QVariant();
-            }
-        case COLUMN_INCREASE:
-            switch (role)
-            {
-            case Qt::DisplayRole:
-            case Qt::EditRole:
-                if (!amount.zero_p() && amount.positive_p())
-                    return g2q(amount.printAmount(printInfo));
-                else
-                    return QString();
-            default:
-                return QVariant();
-            }
-        case COLUMN_DECREASE:
-            switch (role)
-            {
-            case Qt::DisplayRole:
-            case Qt::EditRole:
-                if (amount.zero_p() || amount.positive_p())
-                    return QString();
-                else
-                    return g2q(amount.neg().printAmount(printInfo));
-            default:
-                return QVariant();
-            }
-        case COLUMN_BALANCE:
-        default:
-            return QVariant();
-        }
-
-
-    }
-    else
-    {
-        // Normal case: We are in a row that displays a normal
-        // transaction and split
-
-        Glib::RefPtr<Split> split = Glib::wrap(static_cast< ::Split*>(index.internalPointer()));
-        Glib::RefPtr<Transaction> trans(split->get_parent());
-        Numeric amount = split->get_value(); // Alternatively: xaccSplitConvertAmount(split.gobj(), split.getAccount().gobj());
-        PrintAmountInfo printInfo(split, false);
-
-        switch (index.column())
-        {
-        case COLUMN_DATE:
-            switch (role)
-            {
-            case Qt::DisplayRole:
-            case Qt::EditRole:
-                return g2q(trans->get_date_posted());
-            default:
-                return QVariant();
-            }
-        case COLUMN_NUM:
-            switch (role)
-            {
-            case Qt::DisplayRole:
-            case Qt::EditRole:
-                return g2q(trans->get_num());
-            default:
-                return QVariant();
-            }
-        case COLUMN_DESC:
-            switch (role)
-            {
-            case Qt::DisplayRole:
-            case Qt::EditRole:
-                return g2q(trans->get_description());
-            default:
-                return QVariant();
-            }
-        case COLUMN_ACCOUNT:
-            switch (role)
-            {
-            case Qt::DisplayRole:
-            case Qt::EditRole:
-                if (trans->get_num_splits() == 2)
-                    return QVariant::fromValue(split->get_other_split()->get_account()->gobj());
-                else
-                    return g2q(split->get_corr_account_full_name());
-            default:
-                return QVariant();
-            }
-        case COLUMN_RECONCILE:
-            switch (role)
-            {
-            case Qt::DisplayRole:
-            case Qt::EditRole:
-                return QString::fromUtf8(gnc_get_reconcile_str(split->get_reconcile()));
-            default:
-                return QVariant();
-            }
-        case COLUMN_INCREASE:
-            switch (role)
-            {
-            case Qt::DisplayRole:
-            case Qt::EditRole:
-                if (amount.positive_p())
-                    return g2q(amount.printAmount(printInfo));
-                else
-                    return QString();
-            default:
-                return QVariant();
-            }
-        case COLUMN_DECREASE:
-            switch (role)
-            {
-            case Qt::DisplayRole:
-            case Qt::EditRole:
-                if (amount.positive_p())
-                    return QString();
-                else
-                    return g2q(amount.neg().printAmount(printInfo));
-            default:
-                return QVariant();
-            }
-        case COLUMN_BALANCE:
-            switch (role)
-            {
-            case Qt::DisplayRole:
-                return g2q(split->get_balance().printAmount(printInfo));
-            case Qt::ForegroundRole:
-                return split->get_balance().negative_p()
-                       ? QBrush(Qt::red)
-                       : QBrush();
-            default:
-                return QVariant();
-            }
-        default:
-            return QVariant();
-        }
-    }
-}
-
-QVariant SplitListModel::headerData(int section, Qt::Orientation orientation, int role) const
-{
-    //qDebug() << "headerData()" << section;
-    if (role != Qt::DisplayRole)
-        return QVariant();
-    if (orientation == Qt::Horizontal)
-    {
-        switch (section)
-        {
-        case COLUMN_DATE:
-            return tr("Date");
-        case COLUMN_NUM:
-            return tr("Num");
-        case COLUMN_DESC:
-            return tr("Description");
-        case COLUMN_ACCOUNT:
-            return tr("Transfer");
-        case COLUMN_RECONCILE:
-            return tr("R?");
-        case COLUMN_INCREASE:
-            return tr("Increase");
-        case COLUMN_DECREASE:
-            return tr("Decrease");
-        case COLUMN_BALANCE:
-            return tr("Balance");
-        default:
-            return QVariant();
-        }
-    }
-    else
-        return QString("%1").arg(1 + section);
-}
-
-bool SplitListModel::setData(const QModelIndex &index, const QVariant &value, int role)
-{
-    if (!index.isValid() || role != Qt::EditRole)
-        return false;
-
-    QUndoCommand* cmd = NULL;
-    if (m_enableNewTransaction && index.row() == m_list.size())
-    {
-        // Special case: We are in the last row which represents the
-        // newly entered txn.
-
-        TmpTransaction& trans = m_tmpTransaction;
-        TmpSplit& split = trans.get_splits().front();
-        Q_ASSERT(split.get_account() == m_account->gobj());
-        Q_ASSERT(trans.get_num_splits() == 2);
-        TmpSplit& other = trans.get_splits().back();
-
-        // "Editing" is done by creating a Cmd-object and adding it to
-        // the undo stack. That's in fact all that was needed to
-        // create an *undoable* edit of this data cell. Seems almost
-        // spooky, doesn't it?
-        switch (index.column())
-        {
-        case COLUMN_DATE:
-        {
-            QDate date = value.toDate();
-            if (date.isValid())
-            {
-                cmd = cmd::setTransactionDate(trans, date);
-            }
-            break;
-        }
-        case COLUMN_NUM:
-            cmd = cmd::setTransactionNum(trans, value.toString());
-            break;
-        case COLUMN_DESC:
-            cmd = cmd::setTransactionDescription(trans, value.toString());
-            break;
-        case COLUMN_ACCOUNT:
-            if (value.canConvert< ::Account*>())
-            {
-                if (trans.get_num_splits() == 2)
-                {
-                    cmd = cmd::setSplitAccount(other, Glib::wrap(value.value< ::Account*>()));
-                }
-                else
-                    QMessageBox::warning(NULL, tr("Unimplemented"),
-                                         tr("Sorry, but editing a transaction with more than two splits (here: %1) is not yet implemented.").arg(trans.get_num_splits()));
-            }
-            break;
-        case COLUMN_RECONCILE:
-        {
-            QString str(value.toString());
-            if (str.size() > 0)
-            {
-                char recn = str[0].toLatin1();
-                switch (recn)
-                {
-                case NREC:
-                case CREC:
-                case YREC:
-                case FREC:
-                case VREC:
-                    cmd = cmd::setSplitReconcile(split, recn);
-                    break;
-                default:
-                    qDebug() << "Unknown reconcile string:" << str;
-                }
-            }
-            break;
-        }
-        case COLUMN_INCREASE:
-        case COLUMN_DECREASE:
-        {
-            QString str(value.toString().simplified());
-            if (str.isEmpty())
-                break;
-            Numeric n;
-            QString errmsg = g2q(n.parse(q2g(str)));
-            if (errmsg.isEmpty())
-            {
-                qDebug() << "Successfully parsed string to numeric=" << g2q(n.to_string());
-                if (index.column() == COLUMN_DECREASE)
-                    n = n.neg();
-                // Check whether we have the simple case here
-                if (trans.get_num_splits() != 2)
-                {
-                    QMessageBox::warning(NULL, tr("Unimplemented"),
-                                         tr("Sorry, but editing a transaction with more than two splits (here: %1) is not yet implemented.").arg(trans.get_num_splits()));
-                }
-                else
-                {
-                    Glib::RefPtr<Commodity> originCommodity = m_account->get_commodity();
-                    Glib::RefPtr<Commodity> transCommodity = trans.get_commodity();
-                    bool sameCommodities = (originCommodity == transCommodity);
-                    if (other.get_account())
-                    {
-                        Glib::RefPtr<Commodity> otherCommodity = Glib::wrap(other.get_account())->get_commodity();
-                        sameCommodities = sameCommodities && (transCommodity == otherCommodity);
-                    }
-                    if (!sameCommodities)
-                    {
-                        QMessageBox::warning(NULL, tr("Unimplemented"),
-                                             tr("Sorry, but editing a transaction with different accounts is not yet implemented."));
-                    }
-                    else
-                    {
-                        // This is the really simple case which we can
-                        // handle now.
-                        cmd = cmd::setSplitValueAndAmount(split, n);
-                    }
-                }
-            }
-            else
-            {
-                qDebug() << "Cannot convert this string to gnc_numeric:" << str;
-            }
-            break;
-        }
-        default:
-            break;
-        }
-    }
-    else
-    {
-        // Normal case: We are in a row that displays a normal
-        // transaction and split
-
-        Glib::RefPtr<Split> split = Glib::wrap(static_cast< ::Split*>(index.internalPointer()));
-        Glib::RefPtr<Transaction> trans(split->get_parent());
-        QVariant y(trans);
-
-        // "Editing" is done by creating a Cmd-object and adding it to
-        // the undo stack. That's in fact all that was needed to
-        // create an *undoable* edit of this data cell. Seems almost
-        // spooky, doesn't it?
-        switch (index.column())
-        {
-        case COLUMN_DATE:
-        {
-            QDate date = value.toDate();
-            if (date.isValid())
-            {
-                cmd = cmd::setTransactionDate(trans, date);
-            }
-            break;
-        }
-        case COLUMN_NUM:
-            cmd = cmd::setTransactionNum(trans, value.toString());
-            break;
-        case COLUMN_DESC:
-            cmd = cmd::setTransactionDescription(trans, value.toString());
-            break;
-        case COLUMN_ACCOUNT:
-            if (value.canConvert< ::Account*>())
-            {
-                if (trans->get_num_splits() == 2)
-                {
-                    Glib::RefPtr<Split> other = split->get_other_split();
-                    cmd = cmd::setSplitAccount(other, Glib::wrap(value.value< ::Account*>()));
-                }
-                else
-                    QMessageBox::warning(NULL, tr("Unimplemented"),
-                                         tr("Sorry, but editing a transaction with more than two splits "
-                                            "(here: %1) is not yet implemented.").arg(trans->get_num_splits()));
-            }
-            break;
-        case COLUMN_RECONCILE:
-        {
-            QString str(value.toString());
-            if (!str.isEmpty())
-            {
-                char recn = str[0].toLatin1();
-                switch (recn)
-                {
-                case NREC:
-                case CREC:
-                case YREC:
-                case FREC:
-                case VREC:
-                    cmd = cmd::setSplitReconcile(split, recn);
-                    break;
-                default:
-                    qDebug() << "Unknown reconcile string:" << str;
-                }
-            }
-            break;
-        }
-        case COLUMN_INCREASE:
-        case COLUMN_DECREASE:
-        {
-            QString str(value.toString().simplified());
-            if (str.isEmpty())
-                break;
-            Numeric n;
-            QString errmsg = g2q(n.parse(q2g(str)));
-            if (errmsg.isEmpty())
-            {
-                qDebug() << "Successfully parsed string to numeric=" << g2q(n.to_string());
-                if (index.column() == COLUMN_DECREASE)
-                    n = n.neg();
-                // Check whether we have the simple case here
-                if (split->get_parent()->get_num_splits() != 2)
-                {
-                    QMessageBox::warning(NULL, tr("Unimplemented"),
-                                         tr("Sorry, but editing a transaction with more than two splits "
-                                            "(here: %1) is not yet implemented.").arg(split->get_parent()->get_num_splits()));
-                }
-                else
-                {
-                    Glib::RefPtr<Transaction> trans = split->get_parent();
-                    Glib::RefPtr<Split> other = split->get_other_split();
-                    Q_ASSERT(other);
-                    Glib::RefPtr<Commodity> originCommodity = split->get_account()->get_commodity();
-                    Glib::RefPtr<Commodity> transCommodity = trans->get_currency();
-                    Glib::RefPtr<Commodity> otherCommodity = other->get_account()->get_commodity();
-                    if (originCommodity != transCommodity
-                            || transCommodity != otherCommodity)
-                    {
-                        QMessageBox::warning(NULL, tr("Unimplemented"),
-                                             tr("Sorry, but editing a transaction with different accounts is not yet implemented."));
-                    }
-                    else
-                    {
-                        // This is the really simple case which we can
-                        // handle now.
-                        cmd = cmd::setSplitValueAndAmount(split, n);
-                    }
-                }
-            }
-            else
-            {
-                qDebug() << "Cannot convert this string to gnc_numeric:" << str;
-            }
-            break;
-        }
-        default:
-            break;
-        }
-    }
-    if (cmd)
-    {
-        m_undoStack->push(cmd);
-        // No dataChanged() signal here because it is emitted from the
-        // transactionChanged slot.
-        return true;
-    }
-    return false;
-}
-
-void SplitListModel::transactionEvent( ::Transaction* trans, QofEventId event_type)
-{
-    //qDebug() << "SplitListModel::transactionEvent, id=" << qofEventToString(event_type);
-    switch (event_type)
-    {
-    case QOF_EVENT_MODIFY:
-        if (m_hash.contains(trans))
-        {
-            int row = m_hash.value(trans);
-            Q_EMIT dataChanged(index(row, 0), index(row, columnCount() - 1));
-        }
-        break;
-    case GNC_EVENT_ITEM_REMOVED:
-    case GNC_EVENT_ITEM_ADDED:
-        // This event is triggered by a split being added (or removed)
-        // to a transaction. Ignored because we already reacted upon
-        // the MODIFY event.
-        break;
-    case QOF_EVENT_CREATE:
-        // This event is triggered by a newly created transaction, but
-        // we reacted on this in the accountEvent handler already.
-        break;
-    default:
-        qDebug() << "SplitListModel::transactionEvent, ignored event id=" << qofEventToString(event_type);
-        break;
-    }
-
-}
-
-void SplitListModel::accountEvent( ::Account* acc, QofEventId event_type)
-{
-    if (acc != m_account->gobj())
-        return;
-    //qDebug() << "SplitListModel::accountEvent, id=" << qofEventToString(event_type);
-
-    switch (event_type)
-    {
-    case GNC_EVENT_ITEM_REMOVED:
-    case GNC_EVENT_ITEM_ADDED:
-        recreateCache();
-        break;
-    case QOF_EVENT_MODIFY:
-    case GNC_EVENT_ITEM_CHANGED:
-        // These events are also triggered e.g. by a newly added
-        // transaction/split in this account. However, we already
-        // reacted on this by the above events, so we can ignore them
-        // here.
-        break;
-    default:
-        qDebug() << "SplitListModel::accountEvent, ignored event id=" << qofEventToString(event_type);
-        break;
-    }
-}
-
-void SplitListModel::editorClosed(const QModelIndex& index,
-                                  QAbstractItemDelegate::EndEditHint hint)
-{
-    if (!index.isValid())
-        return;
-
-    if (m_enableNewTransaction && index.row() == m_list.size())
-    {
-        // Special case: The line with the new transaction
-
-        switch (hint)
-        {
-        case QAbstractItemDelegate::SubmitModelCache:
-            switch (index.column())
-            {
-            case COLUMN_DATE:
-            case COLUMN_NUM:
-            case COLUMN_DESC:
-            case COLUMN_ACCOUNT:
-            case COLUMN_RECONCILE:
-                break; // we want to do nothing
-            case COLUMN_INCREASE:
-            case COLUMN_DECREASE:
-            {
-                // Commit the new transaction
-                //qDebug() << "Commit the new transaction as a real one";
-                m_tmpTransaction.set_date_entered(QDateTime::currentDateTime().toTime_t());
-                QUndoCommand* cmd = cmd::commitNewTransaction(m_tmpTransaction);
-                recreateTmpTrans();
-                m_undoStack->push(cmd);
-                break;
-            }
-            default:
-                break; // nothing to do
-            }
-        case QAbstractItemDelegate::RevertModelCache:
-            recreateTmpTrans();
-            break;
-        }
-    }
-    else
-    {
-        // We are in the line of an existing transaction - no function
-        // implemented yet.
-    }
-
-}
-
-} // END namespace gnc
diff --git a/src/gnc/SplitListModel.hpp b/src/gnc/SplitListModel.hpp
deleted file mode 100644
index 60a1775..0000000
--- a/src/gnc/SplitListModel.hpp
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * SplitListModel.hpp
- * Copyright (C) 2010 Christian Stimming
- *
- * 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 at gnu.org
- */
-
-#ifndef GNC_SPLITLISTMODEL_HPP
-#define GNC_SPLITLISTMODEL_HPP
-
-#include "config.h"
-#include "gncmm/Account.hpp"
-#include "gncmm/Split.hpp"
-#include "gnc/QofEventWrapper.hpp"
-#include "gncmm/Transaction.hpp"
-#include "gnc/conv.hpp"
-
-extern "C"
-{
-#include "engine/Transaction.h"
-}
-
-#include <QAbstractItemModel>
-#include <QAbstractItemDelegate>
-#include <QHash>
-class QUndoStack;
-
-namespace gnc
-{
-
-/** This is the data model for a list of splits.
- */
-class SplitListModel : public QAbstractItemModel
-{
-    Q_OBJECT
-public:
-
-    enum ColumnNumbers
-    {
-        COLUMN_DATE = 0
-        , COLUMN_NUM
-        , COLUMN_DESC
-        , COLUMN_ACCOUNT
-        , COLUMN_RECONCILE
-        , COLUMN_INCREASE
-        , COLUMN_DECREASE
-        , COLUMN_BALANCE
-        , COLUMN_LAST
-    };
-
-    SplitListModel(const Glib::RefPtr<Account> acc, QUndoStack* undoStack, QObject *parent = 0);
-    ~SplitListModel();
-
-    Glib::RefPtr<Account> getAccount() const { return m_account; }
-
-    QModelIndex parent(const QModelIndex &index) const { return QModelIndex(); }
-    int rowCount(const QModelIndex& parent = QModelIndex()) const;
-    int columnCount(const QModelIndex& parent = QModelIndex()) const;
-    QModelIndex index(int row, int column,
-                      const QModelIndex &parent = QModelIndex()) const;
-    Qt::ItemFlags flags(const QModelIndex &index) const;
-
-    QVariant data(const QModelIndex& index, int role) const;
-    QVariant headerData(int section, Qt::Orientation orientation, int role) const;
-    bool setData(const QModelIndex &index, const QVariant &value, int role);
-
-    bool removeRows(int position, int rows, const QModelIndex &index = QModelIndex());
-
-public Q_SLOTS:
-    void transactionEvent( ::Transaction* trans, QofEventId event_type);
-    void accountEvent( ::Account* trans, QofEventId event_type);
-    void editorClosed(const QModelIndex& index, QAbstractItemDelegate::EndEditHint hint);
-
-private:
-    void recreateCache();
-    void recreateTmpTrans();
-
-protected:
-    Glib::RefPtr<Account> m_account;
-    SplitQList m_list;
-    QUndoStack* m_undoStack;
-    typedef QHash< ::Transaction*, int> TransactionRowHash;
-    TransactionRowHash m_hash;
-
-    /** The wrapper for receiving events from gnc. */
-    QofEventWrapper<SplitListModel, ::Transaction*> m_eventWrapper;
-    QofEventWrapper<SplitListModel, ::Account*> m_eventWrapperAccount;
-
-    bool m_enableNewTransaction;
-    TmpTransaction m_tmpTransaction;
-};
-
-} // END namespace gnc
-
-#endif
diff --git a/src/gnc/SplitListView.cpp b/src/gnc/SplitListView.cpp
deleted file mode 100644
index d66847d..0000000
--- a/src/gnc/SplitListView.cpp
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * SplitListView.cpp
- * Copyright (C) 2010 Christian Stimming
- *
- * 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 at gnu.org
- */
-
-#include "SplitListView.hpp"
-
-#include "engine/gnc-event.h" // for GNC_EVENT_ITEM_ADDED
-#include "gncmm/Account.hpp"
-#include "gnc/SplitListModel.hpp"
-#include "gnc/AccountSelectionDelegate.hpp"
-
-#include <QtGui/QAbstractItemDelegate>
-#include <QUndoStack>
-#include <QDebug>
-
-namespace gnc
-{
-
-SplitListView::SplitListView(Glib::RefPtr<Account> account, QUndoStack* undoStack, QWidget* parent)
-        : base_class(parent)
-        , m_account(account)
-        , m_eventWrapperAccount(*this, &SplitListView::accountEvent)
-        , m_eventWrapperBook(*this, &SplitListView::bookEvent)
-{
-    // Create a model that is used in this view
-    SplitListModel *smodel = new SplitListModel(account, undoStack, this);
-    setModel(smodel);
-    connect(this, SIGNAL(editorClosed(const QModelIndex&,QAbstractItemDelegate::EndEditHint)),
-            smodel, SLOT(editorClosed(const QModelIndex&,QAbstractItemDelegate::EndEditHint)));
-
-    // Create a separate delegate only for the Account colum
-    QAbstractItemDelegate *accountDelegate = new AccountSelectionDelegate(this);
-    setItemDelegateForColumn(SplitListModel::COLUMN_ACCOUNT, accountDelegate);
-
-    // Appearance of this view
-    setAlternatingRowColors(true);
-
-    // Move the focus to the latest line
-    scrollToBottom();
-    if (model()->rowCount() > 0)
-        setCurrentIndex(model()->index(model()->rowCount() - 1, 0));
-}
-
-void SplitListView::closeEditor(QWidget* editor, QAbstractItemDelegate::EndEditHint hint)
-{
-    base_class::closeEditor(editor, hint);
-    //qDebug() << "closeEditor, row=" << currentIndex().row() << "hint=" << hint;
-    QModelIndex index = currentIndex();
-    if (hint != QAbstractItemDelegate::NoHint)
-        Q_EMIT editorClosed(index, hint);
-    if (index.isValid()
-            && hint == QAbstractItemDelegate::SubmitModelCache
-            && index.row() < model()->rowCount() - 1)
-    {
-        switch (index.column())
-        {
-        case SplitListModel::COLUMN_INCREASE:
-        case SplitListModel::COLUMN_DECREASE:
-            setCurrentIndex(model()->index(index.row() + 1,
-                                           SplitListModel::COLUMN_DATE,
-                                           index.parent()));
-            break;
-        default:
-            break;
-        }
-    }
-}
-
-void SplitListView::accountEvent( ::Account* v, QofEventId event_type)
-{
-    if (v != m_account->gobj())
-        return;
-    //qDebug() << "SplitListView::accountEvent, id=" << qofEventToString(event_type);
-    switch (event_type)
-    {
-    case QOF_EVENT_DESTROY:
-        // This account seems to be getting deleted - better close
-        // this view.
-        deleteLater();
-        break;
-    default:
-        break;
-    }
-}
-
-void SplitListView::bookEvent( ::QofBook* v, QofEventId event_type)
-{
-    qDebug() << "SplitListView::bookEvent, id=" << qofEventToString(event_type);
-
-    switch (event_type)
-    {
-    case QOF_EVENT_DESTROY:
-        // The book is being deleted - better close this view ASAP!
-        deleteLater();
-        break;
-    default:
-        break;
-    }
-}
-
-}
diff --git a/src/gnc/SplitListView.hpp b/src/gnc/SplitListView.hpp
deleted file mode 100644
index 5da90b3..0000000
--- a/src/gnc/SplitListView.hpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * SplitListView.hpp
- * Copyright (C) 2010 Christian Stimming
- *
- * 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 at gnu.org
- */
-
-#ifndef GNC_SPLITLISTVIEW_HPP
-#define GNC_SPLITLISTVIEW_HPP
-
-#include "config.h"
-#include "gncmm/Account.hpp"
-#include "gnc/SplitListModel.hpp"
-#include "gnc/QofEventWrapper.hpp"
-
-#include <QtGui/QTableView>
-#include <QtGui/QAbstractItemDelegate>
-#include <QUndoStack>
-#include <QDebug>
-
-namespace gnc
-{
-
-class SplitListView : public QTableView
-{
-    Q_OBJECT
-public:
-    typedef QTableView base_class;
-    SplitListView(Glib::RefPtr<Account> account, QUndoStack* undoStack, QWidget* parent = 0);
-
-Q_SIGNALS:
-    void editorClosed(const QModelIndex& index, QAbstractItemDelegate::EndEditHint hint);
-
-public Q_SLOTS:
-    void closeEditor(QWidget* editor, QAbstractItemDelegate::EndEditHint hint);
-    void accountEvent( ::Account* v, QofEventId event_type);
-    void bookEvent( ::QofBook* v, QofEventId event_type);
-
-private:
-    Glib::RefPtr<Account> m_account;
-    QofEventWrapper<SplitListView, ::Account*> m_eventWrapperAccount;
-    QofEventWrapper<SplitListView, ::QofBook*> m_eventWrapperBook;
-};
-
-}
-
-#endif
diff --git a/src/gnc/WeakPointer.hpp b/src/gnc/WeakPointer.hpp
deleted file mode 100644
index 6d775e2..0000000
--- a/src/gnc/WeakPointer.hpp
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * WeakPointer.hpp
- * Copyright (C) 2010 Christian Stimming
- *
- * 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 at gnu.org
- */
-
-#ifndef GNC_WEAKPOINTER_HPP
-#define GNC_WEAKPOINTER_HPP
-
-#include <string>
-#include <cassert>
-
-namespace gnc
-{
-
-/** A thin wrapper for a C object which is owned by someone else.
- *
- * This copies the interface of the boost::scoped_ptr, but in contrast
- * to the boost::scoped_ptr this class does not take on ownership of
- * the given pointer. Instead, the pointer is owned by someone else,
- * and we hope nobody accesses this object after the pointer's object
- * was deleted somewhere else. Unfortunately currently we have no
- * information about whether the pointed-to object is still alive or
- * already deleted. Sorry for that.
- */
-template<class T>
-class WeakPointer
-{
-public:
-    typedef T element_type;
-private:
-    element_type *m_ptr;
-    typedef WeakPointer<T> this_type;
-public:
-
-    WeakPointer(element_type* ptr = 0)
-            : m_ptr(ptr)
-    { }
-
-    void reset(element_type* ptr = 0)
-    {
-        m_ptr = ptr;
-    }
-
-    T & operator*() const // never throws
-    {
-        assert(m_ptr != 0);
-        return *m_ptr;
-    }
-
-    T * operator->() const // never throws
-    {
-        assert(m_ptr != 0);
-        return m_ptr;
-    }
-
-    T * gobj() const // never throws
-    {
-        return m_ptr;
-    }
-
-    // implicit conversion to "bool"
-    typedef T * this_type::*unspecified_bool_type;
-    operator unspecified_bool_type() const // never throws
-    {
-        return m_ptr == 0 ? 0 : &this_type::m_ptr;
-    }
-
-    bool operator! () const // never throws
-    {
-        return m_ptr == 0;
-    }
-
-};
-
-} // END namespace gnc
-
-#endif
diff --git a/src/gnc/bla.html b/src/gnc/bla.html
deleted file mode 100644
index dd2e6e2..0000000
--- a/src/gnc/bla.html
+++ /dev/null
@@ -1,20 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-<html>
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15">
-<title>GnuCash C++ Test</title>
-</head>
-
-<body>
-<h1>GnuCash C++ Test</h1>
-
-<p>This is a text that demonstrates how we can build a GnuCash variant in C++ and Qt.</p>
-
-<h2>Images</h2>
-<p><img src=":/pixmaps/gnucash_splash.png"></p>
-<p>We can also embed images here in this compiled-in HTML page.</p>
-
-<hr>
-<address></address>
-<!-- hhmts start -->Last modified: Mon Mar  1 09:11:12 CET 2010 <!-- hhmts end -->
-</body> </html>
diff --git a/src/gnc/conv.hpp b/src/gnc/conv.hpp
deleted file mode 100644
index 46216c3..0000000
--- a/src/gnc/conv.hpp
+++ /dev/null
@@ -1,37 +0,0 @@
-#ifndef CONV_HPP
-#define CONV_HPP
-
-#include <QDate>
-#include <QString>
-#include <glibmm/date.h>
-#include <glibmm/ustring.h>
-
-namespace gnc
-{
-
-/// Convert the given Glib::Date into a QDate object
-inline QDate g2q(const Glib::Date& d)
-{
-    return QDate(d.get_year(), d.get_month(), d.get_day());
-}
-
-/// Convert the given QDate into a Glib::Date object
-inline Glib::Date q2g(const QDate& d)
-{
-    return Glib::Date(d.day(), Glib::Date::Month(d.month()), d.year());
-}
-
-/// Convert the given Glib::ustring into a QString object
-inline QString g2q(const Glib::ustring& s)
-{
-    return QString::fromUtf8(s.c_str());
-}
-
-/// Convert the given QString into a Glib::ustring object
-inline Glib::ustring q2g(const QString& s)
-{
-    return Glib::ustring(s.toUtf8());
-}
-}
-
-#endif // CONV_HPP
diff --git a/src/gnc/dashboard.cpp b/src/gnc/dashboard.cpp
deleted file mode 100644
index fc415dc..0000000
--- a/src/gnc/dashboard.cpp
+++ /dev/null
@@ -1,335 +0,0 @@
-/*
- * Copyright (C) 2011 Free Software Foundation, 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 Foobar.  If not, see <http://www.gnu.org/licenses/>.
- */
-/**
- * @file
- * Dashboard for embedding various dock widgets.
- *
- * Dock Widgets:
- * 1) Transfer Funds
- * 2) First Person Overview
- */
-
-#include "dashboard.hpp"
-#include "ui_dashboard.h"
-#include "engine/gnc-event.h" // for GNC_EVENT_ITEM_ADDED
-
-#include <QtGui>
-#include <QAbstractItemModel>
-#include <QDate>
-
-namespace gnc
-{
-Dashboard::Dashboard(QWidget *parent) :
-    QMainWindow(parent),
-    ui(new Ui::Dashboard),
-    m_eventWrapper(*this, &Dashboard::transactionEvent),
-    m_eventWrapperAccount(*this, &Dashboard::accountEvent)
-{
-    QSettings settings;
-    restoreGeometry(settings.value("dashboardGeometry").toByteArray());
-
-    ui->setupUi(this);
-
-    // Generate UI
-    setUiWidgets();
-    setBasicTxnEntryFormLayout();
-    setCentralWidget(ui->dockwFPO);
-    setFPO();
-    //this->tabifyDockWidget(ui->dockwBasicTxn, ui->dockwSplitTxn);
-    //ui->dockwBasicTxn->raise();
-    ui->dockwSplitTxn->hide();
-    ui->dockwLogViewer->hide();
-
-    /* Set stylesheet, so that some styling to viewlets can be applied */
-    /*QFile styleSheetFile(":/qss-default");
-    styleSheetFile.open(QFile::ReadOnly);
-    QString styleSheetName = QLatin1String(styleSheetFile.readAll());
-    this->setStyleSheet(styleSheetName);*/
-
-    restoreState(settings.value("dashboardState").toByteArray());
-    bool isBasicTxnDockVisible = settings.value("basic-txn-dockwidget-visible").toBool();
-    ui->dockwBasicTxn->setVisible(isBasicTxnDockVisible);
-
-    /*
-    // Trying to restore pos and size of dockwidget manually
-    QSettings settings;
-    QPoint bTxnWdgPos = settings.value("basic-txn-entry-dockwidget-pos").toPoint();
-    ui->dockwBasicTxn->move(bTxnWdgPos);
-    QSize bTxnWdgSize = settings.value("basic-txn-entry-dockwidget-size").toSize();
-    ui->dockwBasicTxn->resize(bTxnWdgSize);
-    */
-
-    connect(btnCreateBasicTxn, SIGNAL(clicked()),
-            this, SLOT(on_btnCreateBasicTxn_clicked()));
-}
-
-Dashboard::~Dashboard()
-{
-    /*
-    QSettings settings;
-    settings.setValue("basic-txn-entry-dockwidget-pos", ui->dockwBasicTxn->pos());
-    settings.setValue("basic-txn-entry-dockwidget-size", ui->dockwBasicTxn->size());
-    */
-    delete ui;
-}
-
-void
-Dashboard::mainWindowCloseEvent()
-{
-    QSettings settings;
-    settings.setValue("dashboardGeometry", saveGeometry());
-    settings.setValue("dashboardState", saveState());
-    settings.setValue("basic-txn-dockwidget-visible", ui->dockwBasicTxn->isVisible());
-    //qDebug()<<"while writing dockwdg visibility is "<<settings.value("basic-txn-dockwidget-visible").toBool();
-}
-
-void
-Dashboard::showDashboardWidgets()
-{
-    QSettings settings;
-    ui->dockwBasicTxn->setVisible(settings.value("basic-txn-dockwidget-visible").toBool());
-    ui->dockwFPO->show();
-}
-
-/** Initialise widgets to startup defaults */
-void
-Dashboard::setUiWidgets()
-{
-    numer = 0.0;
-
-    lblDescription  = new QLabel(tr("Description:"));
-    lblDate         = new QLabel(tr("Date:"));
-    lblTransferFrom = new QLabel(tr("Transfer From:"));
-    lblTransferTo   = new QLabel(tr("TransferTo:"));
-    lblAmount       = new QLabel(tr("Amount:"));
-    lblMemo         = new QLabel(tr("Memo:"));
-    lblNum          = new QLabel(tr("Num:"));
-    comboTransferFrom = new QComboBox();
-    comboTransferFrom->addItem(tr("- NA -"));
-    comboTransferTo   = new QComboBox();
-    comboTransferTo->addItem(tr("- NA -"));
-    lineDescription = new QLineEdit();
-    lineAmount      = new QLineEdit();
-    lineAmount->setText(tr("0.00"));
-    lineAmount->setValidator(new QDoubleValidator(0.0, 1e100, 2, this));
-    lineMemo        = new QLineEdit();
-    lineNum         = new QLineEdit();
-    dateTxnDate = new QDateEdit();
-    dateVal = QDate::currentDate();
-    dateTxnDate->setDate(dateVal);
-    btnCreateBasicTxn = new QPushButton(tr("Create Transaction"));
-}
-
-/** Layout for data entry. Type: Form Based
- *
- * Set this as default to make this layout as default
- * for all data entry widgets. */
-void
-Dashboard::setBasicTxnEntryFormLayout()
-{
-    gridBasicTxnEntry = new QGridLayout(ui->dockcBasicTxn);
-
-    gridBasicTxnEntry->addWidget(lblDescription, 0, 0);
-    gridBasicTxnEntry->addWidget(lineDescription, 0, 1);
-
-    gridBasicTxnEntry->addWidget(lblDate, 1, 0);
-    gridBasicTxnEntry->addWidget(dateTxnDate, 1, 1);
-
-    gridBasicTxnEntry->addWidget(lblTransferFrom, 2, 0);
-    gridBasicTxnEntry->addWidget(comboTransferFrom, 2, 1);
-
-    gridBasicTxnEntry->addWidget(lblTransferTo, 3, 0);
-    gridBasicTxnEntry->addWidget(comboTransferTo, 3, 1);
-
-    gridBasicTxnEntry->addWidget(lblAmount, 4, 0);
-    gridBasicTxnEntry->addWidget(lineAmount, 4, 1);
-
-    gridBasicTxnEntry->addWidget(lblMemo, 5, 0);
-    gridBasicTxnEntry->addWidget(lineMemo, 5, 1);
-
-    gridBasicTxnEntry->addWidget(lblNum, 6, 0);
-    gridBasicTxnEntry->addWidget(lineNum, 6, 1);
-
-    gridBasicTxnEntry->addWidget(btnCreateBasicTxn, 7, 1);
-}
-
-void
-Dashboard::setFPO()
-{
-    QHBoxLayout *FPOLayout = new QHBoxLayout;
-    ui->dockcFPO->setLayout(FPOLayout);
-    fpoWidget = new FPO(ui->dockcFPO, FPOLayout);
-}
-
-void
-Dashboard::clearFields()
-{
-    lineDescription->clear();
-    lineAmount->clear();
-    lineMemo->clear();
-    lineNum->clear();
-}
-
-void
-Dashboard::transactionEvent( ::Transaction* trans, QofEventId event_type)
-{
-    //qDebug() << "Dashboard::transactionEvent, id=" << qofEventToString(event_type);
-    switch (event_type)
-    {
-    case QOF_EVENT_MODIFY:
-        fpoWidget->leftViewlet->leftVUpdate();
-        fpoWidget->rightViewlet->rightVUpdate();
-        fpoWidget->defaultViewlet->defaultVUpdate();
-        break;
-    case GNC_EVENT_ITEM_REMOVED:
-    case GNC_EVENT_ITEM_ADDED:
-        // This event is triggered by a split being added (or removed)
-        // to a transaction. Ignored because we already reacted upon
-        // the MODIFY event.
-        break;
-    case QOF_EVENT_CREATE:
-        // This event is triggered by a newly created transaction, but
-        // we reacted on this in the accountEvent handler already.
-        break;
-    default:
-        qDebug() << "Dashboard::transactionEvent, ignored event id=" << qofEventToString(event_type);
-        break;
-    }
-}
-
-void
-Dashboard::accountEvent( ::Account* acc, QofEventId event_type)
-{
-    //qDebug() << "Dashboard::accountEvent, id=" << qofEventToString(event_type);
-
-    switch (event_type)
-    {
-    case GNC_EVENT_ITEM_REMOVED:
-        fpoWidget->leftViewlet->leftVUpdate();
-        fpoWidget->rightViewlet->rightVUpdate();
-        fpoWidget->defaultViewlet->defaultVUpdate();
-        break;
-    case GNC_EVENT_ITEM_CHANGED:
-    case GNC_EVENT_ITEM_ADDED:
-    case QOF_EVENT_MODIFY:
-        // These events are also triggered e.g. by a newly added
-        // transaction/split in this account. However, we already
-        // reacted on this by the above events, so we can ignore them
-        // here.
-        break;
-    default:
-        qDebug() << "Dashboard::accountEvent, ignored event id=" << qofEventToString(event_type);
-        break;
-    }
-}
-
-
-void
-Dashboard::loadAccountsTreeComboBox(AccountListModel * const m_accountsListModel)
-{
-    accountsList = m_accountsListModel;
-    comboTransferFrom->setModel(accountsList);
-    comboTransferTo->setModel(accountsList);
-}
-
-/***** Slots *****/
-
-/** "Create Transaction" button for Basic Transaction Entry dock widget */
-void
-Dashboard::on_btnCreateBasicTxn_clicked()
-{
-    if (lineDescription->text().isEmpty())
-    {
-        QMessageBox::StandardButton warnEmptyDesc;
-        warnEmptyDesc = QMessageBox::warning(this, tr("Empty Description"), "You have not set a description. Are you sure you want to create a transaction with no description?", QMessageBox::Yes | QMessageBox::No);
-        if (warnEmptyDesc == QMessageBox::No)
-            return;
-    }
-
-    // Allocate memory and start editing a new transaction
-    int index = comboTransferFrom->currentIndex();
-    account = accountsList->at(index);
-    book = gnc_account_get_book(account);
-    transaction = ::xaccMallocTransaction(book);
-    ::xaccTransBeginEdit(transaction);
-
-    // Populate transaction details
-    dateVal = dateTxnDate->date();
-    ::xaccTransSetDate(transaction, dateVal.day(), dateVal.month(),
-                       dateVal.year());
-
-    ::xaccTransSetNum(transaction, lineNum->text().toUtf8());
-    ::xaccTransSetDescription(transaction, lineDescription->text().toUtf8());
-
-    currency = gnc_account_or_default_currency(account, NULL);
-    ::xaccTransSetCurrency(transaction, currency);
-
-    denom = ::gnc_commodity_get_fraction(currency);
-
-    // Populate split 1
-    // Check whether the account for this split is a placeholder
-    qDebug() << ::xaccAccountGetPlaceholder(account);
-    // ^^ does not work as expected, returns false for placeholder accounts too. Why?
-
-    split = xaccMallocSplit(book);
-    ::xaccTransAppendSplit(transaction, split);
-    ::xaccAccountInsertSplit(account, split);
-
-    numer = lineAmount->text().toDouble();
-    amount = ::double_to_gnc_numeric(numer, denom,
-                                     GNC_HOW_DENOM_REDUCE | GNC_HOW_RND_NEVER);
-    ::xaccSplitSetValue(split, amount);
-    ::xaccSplitSetAmount(split, amount);
-
-    // Populate split 2
-    split2 = ::xaccMallocSplit(book);
-    ::xaccTransAppendSplit(transaction, split2);
-    int index2 = comboTransferTo->currentIndex();
-    account2 = accountsList->at(index2);
-    ::xaccAccountInsertSplit(account2, split2);
-
-    amount2 = ::gnc_numeric_neg(amount);
-    ::xaccSplitSetValue(split2, amount2);
-    ::xaccSplitSetAmount(split2, amount2);
-
-    // Finally commit the transaction to storage backend.
-    ::xaccTransCommitEdit(transaction);
-
-    statusBar()->showMessage(tr("Transaction has been created"), 2000);
-    clearFields();
-}
-
-void
-Dashboard::on_dockwBasicTxn_visibilityChanged(bool visible)
-{
-    ((MainWindow *)parentWidget()->parentWidget()->parentWidget()->parentWidget())->dockWidgetsVisibilityChanged(0, visible);
-}
-
-void
-Dashboard::transferFundsWidgetButtonToggled(bool checked)
-{
-    if (checked)
-    {
-        ui->dockwBasicTxn->show();
-    }
-    else
-    {
-        ui->dockwBasicTxn->hide();
-    }
-}
-
-} // END namespace gnc
diff --git a/src/gnc/dashboard.hpp b/src/gnc/dashboard.hpp
deleted file mode 100644
index 233a571..0000000
--- a/src/gnc/dashboard.hpp
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Copyright (C) 2011 Free Software Foundation, 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 Foobar.  If not, see <http://www.gnu.org/licenses/>.
- */
-/**
- * @file
- * Dashboard for embedding various dock widgets.
- */
-
-#ifndef DASHBOARD_HPP
-#define DASHBOARD_HPP
-
-#include "config.h"
-#include "engine/guid.hpp"
-
-extern "C"
-{
-#include "qof.h"
-#include "engine/Account.h"
-#include "engine/Transaction.h"
-}
-
-#include "AccountItemModel.hpp"
-#include "fpo/FPO.hpp"
-#include "gnc/QofEventWrapper.hpp"
-
-#include <QMainWindow>
-#include <QAbstractItemModel>
-#include <QtGui>
-
-namespace Ui {
-    class Dashboard;
-}
-
-namespace gnc
-{
-
-class FPO;
-
-class Dashboard : public QMainWindow
-{
-    Q_OBJECT
-
-public:
-    explicit Dashboard(QWidget *parent = 0);
-    ~Dashboard();
-
-    FPO *fpoWidget;
-    AccountListModel *accountsList;
-    void loadAccountsTreeComboBox(AccountListModel * const m_accountListModel);
-    void showDashboardWidgets();
-    void mainWindowCloseEvent();
-
-public Q_SLOTS:
-    void transferFundsWidgetButtonToggled(bool checked);
-    void transactionEvent( ::Transaction* trans, QofEventId event_type);
-    void accountEvent( ::Account* acc, QofEventId event_type);
-
-private:
-    Ui::Dashboard *ui;
-
-    /* UI widgets */
-    QGridLayout *gridBasicTxnEntry;
-    QHBoxLayout *hbox;
-    QVBoxLayout *vbox;
-    QLabel *lblDescription;
-    QLabel *lblDate;
-    QLabel *lblTransferFrom;
-    QLabel *lblTransferTo;
-    QLabel *lblAmount;
-    QLabel *lblMemo;
-    QLabel *lblNum;
-    QComboBox *comboTransferFrom;
-    QComboBox *comboTransferTo;
-    QLineEdit *lineDescription;
-    QLineEdit *lineAmount;
-    QLineEdit *lineMemo;
-    QLineEdit *lineNum;
-    QDateEdit *dateTxnDate;
-    QDate dateVal;
-    QPushButton *btnCreateBasicTxn;
-
-    /* Transaction related data types */
-    ::QofBook *book;
-    ::Transaction *transaction;
-    ::gnc_commodity *currency;
-    int denom;
-
-    ::Account *account;
-    ::Split *split;
-    double numer;
-    ::gnc_numeric amount;
-
-    ::Account *account2;
-    ::Split *split2;
-    ::gnc_numeric amount2;
-
-    void setUiWidgets();
-    void setBasicTxnEntryFormLayout();
-    void setFPO();
-    void clearFields();
-    QofEventWrapper<Dashboard, ::Transaction*> m_eventWrapper;
-    QofEventWrapper<Dashboard, ::Account*> m_eventWrapperAccount;
-
-private Q_SLOTS:
-    void on_btnCreateBasicTxn_clicked();
-    void on_dockwBasicTxn_visibilityChanged(bool visible);
-};
-
-} // END namespace gnc
-
-#endif // DASHBOARD_HPP
diff --git a/src/gnc/dashboard.ui b/src/gnc/dashboard.ui
deleted file mode 100644
index fc18998..0000000
--- a/src/gnc/dashboard.ui
+++ /dev/null
@@ -1,329 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>Dashboard</class>
- <widget class="QMainWindow" name="Dashboard">
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>1049</width>
-    <height>617</height>
-   </rect>
-  </property>
-  <property name="windowTitle">
-   <string>MainWindow</string>
-  </property>
-  <property name="dockOptions">
-   <set>QMainWindow::AllowTabbedDocks|QMainWindow::AnimatedDocks|QMainWindow::ForceTabbedDocks</set>
-  </property>
-  <widget class="QWidget" name="centralwidget"/>
-  <widget class="QMenuBar" name="menubar">
-   <property name="geometry">
-    <rect>
-     <x>0</x>
-     <y>0</y>
-     <width>1049</width>
-     <height>21</height>
-    </rect>
-   </property>
-  </widget>
-  <widget class="QStatusBar" name="statusbar"/>
-  <widget class="QDockWidget" name="dockwBasicTxn">
-   <property name="sizePolicy">
-    <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
-     <horstretch>0</horstretch>
-     <verstretch>0</verstretch>
-    </sizepolicy>
-   </property>
-   <property name="minimumSize">
-    <size>
-     <width>300</width>
-     <height>265</height>
-    </size>
-   </property>
-   <property name="maximumSize">
-    <size>
-     <width>500</width>
-     <height>275</height>
-    </size>
-   </property>
-   <property name="baseSize">
-    <size>
-     <width>200</width>
-     <height>275</height>
-    </size>
-   </property>
-   <property name="acceptDrops">
-    <bool>false</bool>
-   </property>
-   <property name="accessibleName">
-    <string/>
-   </property>
-   <property name="features">
-    <set>QDockWidget::AllDockWidgetFeatures</set>
-   </property>
-   <property name="allowedAreas">
-    <set>Qt::AllDockWidgetAreas</set>
-   </property>
-   <property name="windowTitle">
-    <string>Basic</string>
-   </property>
-   <attribute name="dockWidgetArea">
-    <number>4</number>
-   </attribute>
-   <widget class="QWidget" name="dockcBasicTxn"/>
-  </widget>
-  <widget class="QDockWidget" name="dockwSplitTxn">
-   <property name="sizePolicy">
-    <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
-     <horstretch>0</horstretch>
-     <verstretch>0</verstretch>
-    </sizepolicy>
-   </property>
-   <property name="minimumSize">
-    <size>
-     <width>200</width>
-     <height>265</height>
-    </size>
-   </property>
-   <property name="maximumSize">
-    <size>
-     <width>500</width>
-     <height>275</height>
-    </size>
-   </property>
-   <property name="features">
-    <set>QDockWidget::AllDockWidgetFeatures</set>
-   </property>
-   <property name="allowedAreas">
-    <set>Qt::AllDockWidgetAreas</set>
-   </property>
-   <property name="windowTitle">
-    <string>Split</string>
-   </property>
-   <attribute name="dockWidgetArea">
-    <number>4</number>
-   </attribute>
-   <widget class="QWidget" name="dockcSplitTxn">
-    <widget class="QGroupBox" name="groupBox">
-     <property name="geometry">
-      <rect>
-       <x>10</x>
-       <y>60</y>
-       <width>261</width>
-       <height>161</height>
-      </rect>
-     </property>
-     <property name="title">
-      <string>Split</string>
-     </property>
-     <widget class="QLabel" name="label_10">
-      <property name="geometry">
-       <rect>
-        <x>10</x>
-        <y>30</y>
-        <width>101</width>
-        <height>16</height>
-       </rect>
-      </property>
-      <property name="text">
-       <string>Transfer From/To</string>
-      </property>
-     </widget>
-     <widget class="QComboBox" name="comboBox_3">
-      <property name="geometry">
-       <rect>
-        <x>120</x>
-        <y>30</y>
-        <width>111</width>
-        <height>24</height>
-       </rect>
-      </property>
-     </widget>
-     <widget class="QLabel" name="label_11">
-      <property name="geometry">
-       <rect>
-        <x>10</x>
-        <y>60</y>
-        <width>55</width>
-        <height>15</height>
-       </rect>
-      </property>
-      <property name="text">
-       <string>Amount</string>
-      </property>
-     </widget>
-     <widget class="QLabel" name="label_12">
-      <property name="geometry">
-       <rect>
-        <x>10</x>
-        <y>90</y>
-        <width>55</width>
-        <height>15</height>
-       </rect>
-      </property>
-      <property name="text">
-       <string>Memo</string>
-      </property>
-     </widget>
-     <widget class="QLabel" name="label_13">
-      <property name="geometry">
-       <rect>
-        <x>10</x>
-        <y>120</y>
-        <width>55</width>
-        <height>15</height>
-       </rect>
-      </property>
-      <property name="text">
-       <string>Num</string>
-      </property>
-     </widget>
-     <widget class="QLineEdit" name="lineEdit_6">
-      <property name="geometry">
-       <rect>
-        <x>70</x>
-        <y>60</y>
-        <width>181</width>
-        <height>23</height>
-       </rect>
-      </property>
-     </widget>
-     <widget class="QLineEdit" name="lineEdit_7">
-      <property name="geometry">
-       <rect>
-        <x>70</x>
-        <y>90</y>
-        <width>181</width>
-        <height>23</height>
-       </rect>
-      </property>
-     </widget>
-     <widget class="QLineEdit" name="lineEdit_8">
-      <property name="geometry">
-       <rect>
-        <x>70</x>
-        <y>120</y>
-        <width>181</width>
-        <height>23</height>
-       </rect>
-      </property>
-     </widget>
-    </widget>
-    <widget class="QLineEdit" name="lineEdit_3">
-     <property name="geometry">
-      <rect>
-       <x>80</x>
-       <y>0</y>
-       <width>331</width>
-       <height>23</height>
-      </rect>
-     </property>
-    </widget>
-    <widget class="QLabel" name="label_6">
-     <property name="geometry">
-      <rect>
-       <x>10</x>
-       <y>0</y>
-       <width>81</width>
-       <height>16</height>
-      </rect>
-     </property>
-     <property name="text">
-      <string>Description</string>
-     </property>
-    </widget>
-    <widget class="QLabel" name="label_9">
-     <property name="geometry">
-      <rect>
-       <x>10</x>
-       <y>30</y>
-       <width>55</width>
-       <height>15</height>
-      </rect>
-     </property>
-     <property name="text">
-      <string>Date</string>
-     </property>
-    </widget>
-    <widget class="QDateEdit" name="dateEdit_2">
-     <property name="geometry">
-      <rect>
-       <x>80</x>
-       <y>30</y>
-       <width>110</width>
-       <height>23</height>
-      </rect>
-     </property>
-    </widget>
-    <widget class="QPushButton" name="pushButton_2">
-     <property name="geometry">
-      <rect>
-       <x>280</x>
-       <y>130</y>
-       <width>121</width>
-       <height>31</height>
-      </rect>
-     </property>
-     <property name="text">
-      <string>Add Split ></string>
-     </property>
-    </widget>
-    <widget class="QPushButton" name="pushButton_3">
-     <property name="geometry">
-      <rect>
-       <x>280</x>
-       <y>170</y>
-       <width>121</width>
-       <height>31</height>
-      </rect>
-     </property>
-     <property name="text">
-      <string>Create Transaction</string>
-     </property>
-    </widget>
-   </widget>
-  </widget>
-  <widget class="QDockWidget" name="dockwLogViewer">
-   <property name="minimumSize">
-    <size>
-     <width>100</width>
-     <height>100</height>
-    </size>
-   </property>
-   <property name="windowTitle">
-    <string>Event Logger</string>
-   </property>
-   <attribute name="dockWidgetArea">
-    <number>4</number>
-   </attribute>
-   <widget class="QWidget" name="dockcLogViewer"/>
-  </widget>
-  <widget class="QDockWidget" name="dockwFPO">
-   <property name="enabled">
-    <bool>true</bool>
-   </property>
-   <property name="sizePolicy">
-    <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
-     <horstretch>0</horstretch>
-     <verstretch>0</verstretch>
-    </sizepolicy>
-   </property>
-   <property name="features">
-    <set>QDockWidget::NoDockWidgetFeatures</set>
-   </property>
-   <property name="allowedAreas">
-    <set>Qt::BottomDockWidgetArea|Qt::TopDockWidgetArea</set>
-   </property>
-   <property name="windowTitle">
-    <string/>
-   </property>
-   <attribute name="dockWidgetArea">
-    <number>8</number>
-   </attribute>
-   <widget class="QWidget" name="dockcFPO"/>
-  </widget>
- </widget>
- <resources/>
- <connections/>
-</ui>
diff --git a/src/gnc/fallback-icons.qrc b/src/gnc/fallback-icons.qrc
deleted file mode 100644
index 23c6e46..0000000
--- a/src/gnc/fallback-icons.qrc
+++ /dev/null
@@ -1,18 +0,0 @@
-<RCC>
-    <qresource prefix="/">
-        <file>icons/oxygen/index.theme</file>
-        <file>icons/oxygen/48x48/actions/list-add.png</file>
-        <file>icons/oxygen/48x48/actions/edit-undo.png</file>
-        <file>icons/oxygen/48x48/actions/edit-redo.png</file>
-        <file>icons/oxygen/48x48/actions/edit-copy.png</file>
-        <file>icons/oxygen/48x48/actions/edit-cut.png</file>
-        <file>icons/oxygen/48x48/actions/edit-paste.png</file>
-        <file>icons/oxygen/48x48/actions/window-close.png</file>
-        <file>icons/oxygen/48x48/actions/tab-close-other.png</file>
-        <file>icons/oxygen/48x48/actions/document-new.png</file>
-        <file>icons/oxygen/48x48/actions/document-open.png</file>
-        <file>icons/oxygen/48x48/actions/document-save.png</file>
-        <file>icons/oxygen/48x48/actions/document-save-as.png</file>
-        <file>icons/oxygen/48x48/actions/help-about.png</file>
-    </qresource>
-</RCC>
diff --git a/src/gnc/fpo/FPO.cpp b/src/gnc/fpo/FPO.cpp
deleted file mode 100644
index af09ab3..0000000
--- a/src/gnc/fpo/FPO.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-/********************************************************************\
- * 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 at gnu.org                   *
- *                                                                  *
-\********************************************************************/
-
-#include "FPO.hpp"
-#include "gnc/dashboard.hpp"
-#include "gnc/mainwindow.hpp"
-
-#include <QLabel>
-
-namespace gnc
-{
-
-FPO::FPO(QWidget *parent, QHBoxLayout *FPOLayout) :
-    QWidget(parent)
-{
-    /* Left viewlet */
-    leftViewlet = new ViewletView(parent, FPOLayout);
-    leftViewlet->leftVSet(parent, FPOLayout);
-
-    /* Right viewlet */
-    rightViewlet = new ViewletView(parent, FPOLayout);
-    rightViewlet->rightVSet(parent, FPOLayout);
-
-    /* Default viewlet */
-    defaultViewlet = new ViewletView(parent, FPOLayout);
-    defaultViewlet->defaultVSet(parent, FPOLayout);
-}
-
-} // END namespace gnc
diff --git a/src/gnc/fpo/FPO.hpp b/src/gnc/fpo/FPO.hpp
deleted file mode 100644
index f51f586..0000000
--- a/src/gnc/fpo/FPO.hpp
+++ /dev/null
@@ -1,35 +0,0 @@
-#ifndef FPO_HPP
-#define FPO_HPP
-
-#include "ViewletView.hpp"
-#include "gnc/Session.hpp"
-
-#include <QWidget>
-#include <QGridLayout>
-
-namespace gnc
-{
-
-class ViewletView;
-
-class FPO : public QWidget
-{
-    Q_OBJECT
-public:
-    explicit FPO(QWidget *parent = 0, QHBoxLayout *FPOLayout = NULL);
-    ViewletView *leftViewlet;
-    ViewletView *rightViewlet;
-    ViewletView *defaultViewlet;
-
-    Session m_session;
-
-Q_SIGNALS:
-    void sessionLoaded();
-
-public Q_SLOTS:
-
-};
-
-} // END namespace gnc
-
-#endif // FPO_HPP
diff --git a/src/gnc/fpo/ViewletModel.cpp b/src/gnc/fpo/ViewletModel.cpp
deleted file mode 100644
index f504236..0000000
--- a/src/gnc/fpo/ViewletModel.cpp
+++ /dev/null
@@ -1,236 +0,0 @@
-/********************************************************************\
- * 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 at gnu.org                   *
- *                                                                  *
-\********************************************************************/
-
-#include "ViewletModel.hpp"
-#include "gncmm/Transaction.hpp"
-#include "gncmm/Account.hpp"
-
-#include "gncmm/Numeric.hpp"
-
-namespace gnc
-{
-
-ViewletModel::ViewletModel()
-{
-}
-
-void
-ViewletModel::defaultVGenerate(::Account *selectedAccount)
-{
-    SplitQList splitList = buildSplitListDateSort(selectedAccount);
-    buildMiniJournalStruct(splitList);
-}
-
-void
-ViewletModel::leftVGenerate(::Account *selectedAccount)
-{
-    ::QofBook *book = gnc_account_get_book(selectedAccount);
-    ::Account *rootAccount = gnc_book_get_root_account(book);
-
-    GList *accountsGList = gnc_account_get_descendants(rootAccount);
-    AccountQList accountsList = accountFromGList(accountsGList);
-
-    int numOfAccounts = accountsList.count();
-    qDebug()<<"Total num of accounts: "<<numOfAccounts;
-
-    AccountQList expenseAccountsList;
-    for(int i = 0; i < numOfAccounts; i++)
-    {
-        if(xaccAccountGetType(accountsList.at(i)) == 9)
-        {
-            expenseAccountsList.append(accountsList.at(i));
-        }
-    }
-
-    SplitQList splitsList = buildSplitListDateSort(expenseAccountsList);
-    buildMiniJournalStruct(splitsList);
-}
-
-void
-ViewletModel::rightVGenerate(::Account *selectedAccount)
-{
-    ::QofBook *book = gnc_account_get_book(selectedAccount);
-    ::Account *rootAccount = gnc_book_get_root_account(book);
-
-    GList *accountsGList = gnc_account_get_descendants(rootAccount);
-    AccountQList accountsList = accountFromGList(accountsGList);
-
-    int numOfAccounts = accountsList.count();
-    qDebug()<<"Total num of accounts: "<<numOfAccounts;
-
-    AccountQList expenseAccountsList;
-    for(int i = 0; i < numOfAccounts; i++)
-    {
-        if(xaccAccountGetType(accountsList.at(i)) == 8)
-        {
-            expenseAccountsList.append(accountsList.at(i));
-        }
-    }
-
-    SplitQList splitsList = buildSplitListDateSort(expenseAccountsList);
-    buildMiniJournalStruct(splitsList);
-}
-
-#if 0
-
-    /* get all transactions earlier than the specified date */
-    QofQuery *qr =  qof_query_create_for (GNC_ID_SPLIT);
-    qof_query_set_book(qr, ::gnc_account_get_book(selectedAccount));
-    // To look for dates, you need to create a "PredData" object
-    Timespec calve_date;
-
-    //calve_date =  gdate_to_timespec(trans.getGDatePosted());
-    QofQueryPredData *pred_data = qof_query_date_predicate (QOF_COMPARE_LTE,
-                                          QOF_DATE_MATCH_NORMAL,
-                                          calve_date);
-    // and additionally a "query parameter" object
-    GSList *param_list = qof_query_build_param_list (TRANS_DATE_POSTED, NULL);
-    // The "PredData" and the "query parameter" object are added to this query
-    qof_query_add_term (qr, param_list, pred_data,
-                        QOF_QUERY_FIRST_TERM);
-
-    // Query is run; result is returned
-    GList *result =  qof_query_run (qr);
-
-    SplitQList querySplitList = Split::fromGList(result);
-    Split qSplit;
-    int numOfQuerSplits = querySplitList.count();
-
-    for(i=0; i < numOfQuerSplits; ++i)
-    {
-        qSplit = querySplitList.at(i);
-        //qDebug()<<qSplit.getCorrAccountName();
-        qDebug()<<qSplit.getParent().getDatePosted().toString();
-
-    }
-
-    // "result" is now a GList of "Transaction*" because at
-    //qof_query_create_for, we've asked for transactions.
-
-    // When finished, delete the QofQuery object but this will
-    // also delete the "result" list.
-    qof_query_destroy (qr);
-#endif
-
-SplitQList
-ViewletModel::buildSplitListDateSort(::Account *selectedAccount)
-{
-    ::SplitList * splitL = ::xaccAccountGetSplitList(selectedAccount);
-    return Split::from_glist(splitL);
-}
-
-static bool greaterThanByDate(const ::Split* a, const ::Split* b)
-{
-    const ::Transaction* tx_a = xaccSplitGetParent(a);
-    const ::Transaction* tx_b = xaccSplitGetParent(b);
-    return xaccTransGetDate(tx_a) > xaccTransGetDate(tx_b);
-}
-
-SplitQList
-ViewletModel::buildSplitListDateSort(AccountQList accountsList)
-{
-    int numOfAccounts = accountsList.count();
-    qDebug() <<"Num of accounts of X TYPE: "<<numOfAccounts;
-
-    SplitQList allSplitsList;
-    for(int i=0; i< numOfAccounts; i++)
-    {
-        ::Account *C_acct = static_cast< ::Account *>(accountsList.at(i));
-
-        SplitQList tempList = Split::from_glist(::xaccAccountGetSplitList(C_acct));
-
-        int numOfSplits = tempList.size();
-        for(int i=0; i<numOfSplits; i++)
-        {
-            allSplitsList.push_back(tempList.at(i));
-        }
-    }
-
-    qSort(allSplitsList.begin(), allSplitsList.end(), &greaterThanByDate);
-    return allSplitsList;
-}
-
-bool
-ViewletModel::lessThanByDate(::Split* a, ::Split* b)
-{
-    ::Transaction* tx_a = xaccSplitGetParent(a);
-    ::Transaction* tx_b = xaccSplitGetParent(b);
-    return xaccTransGetDate(tx_a) < xaccTransGetDate(tx_b);
-}
-
-void
-ViewletModel::buildMiniJournalStruct(SplitQList splitList)
-{
-    int numOfSplits = splitList.size();
-    Glib::Date tempDate;
-    Glib::ustring tempAccount;
-
-    for (int i = 0; i < numOfSplits; i++)
-    {
-        Glib::RefPtr<Split> split = Glib::wrap(splitList.at(i));
-        Glib::RefPtr<Transaction> txn = split->get_parent();
-
-        structViewletEntries entry;
-
-        if(i == 0)
-        {
-            tempDate = txn->get_date_posted();
-            entry.isDateEqual = false;
-            tempAccount = split->get_corr_account_name();
-            entry.isSplitAccountEqual = false;
-        }
-        else
-        {
-            if(txn->get_date_posted() == tempDate)
-            {
-                entry.isDateEqual = true;
-            }
-            else
-            {
-                entry.isDateEqual = false;
-                tempDate = txn->get_date_posted();
-            }
-
-            if(split->get_corr_account_name() == tempAccount)
-            {
-                entry.isSplitAccountEqual = true;
-            }
-            else
-            {
-                entry.isSplitAccountEqual = false;
-                tempAccount = split->get_corr_account_name();
-            }
-        }
-
-        entry.txnDate = g2q(txn->get_date_posted()).toString();
-        entry.splitAccount = g2q(split->get_corr_account_name());
-        entry.txnDescription = g2q(txn->get_description());
-
-        Numeric splitAmount = split->get_amount();
-        PrintAmountInfo printInfo(split, true);
-        entry.splitAmount = g2q(splitAmount.printAmount(printInfo));
-
-        //qDebug()<<entry.isDateEqual;
-        //qDebug()<<entry.isSplitAccountEqual;
-
-        queueEntries.enqueue(entry);
-    }
-}
-} // END namespace gnc
diff --git a/src/gnc/fpo/ViewletModel.hpp b/src/gnc/fpo/ViewletModel.hpp
deleted file mode 100644
index 7701715..0000000
--- a/src/gnc/fpo/ViewletModel.hpp
+++ /dev/null
@@ -1,55 +0,0 @@
-#ifndef VIEWLETMODEL_HPP
-#define VIEWLETMODEL_HPP
-
-#include <QtCore>
-#include <QtGui>
-
-#include "config.h"
-#include "engine/guid.hpp"
-
-extern "C"
-{
-#include "qof.h"
-#include "engine/Account.h"
-#include "engine/Transaction.h"
-#include "engine/Split.h"
-}
-
-#include "gncmm/Split.hpp"
-#include "gnc/SplitListModel.hpp"
-#include "gnc/AccountItemModel.hpp"
-
-namespace gnc
-{
-
-class ViewletModel
-{
-public:
-    ViewletModel();
-    void defaultVGenerate(::Account * selectedAccount);
-    void leftVGenerate(::Account * selectedAccount);
-    void rightVGenerate(::Account *selectedAccount);
-
-    struct structViewletEntries
-    {
-        QString txnDate;
-        bool isDateEqual;
-        QString splitAccount;
-        bool isSplitAccountEqual;
-        QString txnDescription;
-        QString splitAmount;
-    };
-    structViewletEntries tempEntry;
-    QQueue<structViewletEntries> queueEntries;
-
-private:
-    SplitQList buildSplitListDateSort(::Account *selectedAccount);
-    SplitQList buildSplitListDateSort(AccountQList accountsList);
-    bool static lessThanByDate(::Split* a, ::Split* b);
-    void buildMiniJournalStruct(SplitQList splitList);
-
-};
-
-} // END namespace gnc
-
-#endif // VIEWLETMODEL_HPP
diff --git a/src/gnc/fpo/ViewletView.cpp b/src/gnc/fpo/ViewletView.cpp
deleted file mode 100644
index 2086767..0000000
--- a/src/gnc/fpo/ViewletView.cpp
+++ /dev/null
@@ -1,371 +0,0 @@
-/********************************************************************\
- * 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 at gnu.org                   *
- *                                                                  *
-\********************************************************************/
-
-#include "ViewletView.hpp"
-
-namespace gnc
-{
-
-ViewletView::ViewletView(QWidget * parent, QHBoxLayout * FPOlayout) :
-    QWidget(parent)
-{
-    viewletModel = new ViewletModel();
-}
-
-/***** Public *****/
-
-void
-ViewletView::defaultVSet(QWidget *parent, QHBoxLayout *FPOLayout)
-{
-    /* For default viewlet */
-    comboAccountsList = new QComboBox();
-    comboAccountsList->addItem(tr("-NA-"));
-
-    connect(comboAccountsList, SIGNAL(currentIndexChanged(int)),
-            this, SLOT(defaultVUpdate()));
-
-    /* Add a new QWidget (acts as a container for this viewlet) to the
-       layout of QWidget (QDockWidget>QWidget, i.e, dockwFPO>dockcFPO)
-       in dashboard QMainWindow.
-    */
-    QWidget *viewletContainer = new QWidget;
-    FPOLayout->addWidget(viewletContainer);
-
-    /* Set a layout for the container QWidget */
-    QVBoxLayout *vLay = new QVBoxLayout;
-    viewletContainer->setLayout(vLay);
-
-    /***** Start of viewlet specific implementations *****/
-    /* Specification:
-       This default viewlet contains two widgets, 1) An account
-       selection widget, and 2) A scroll area which wraps a QWidget
-       to show the entries.*/
-    /** @bugid_1 1) Account selection feature of the viewlet  */
-    /*
-    comboAccountsList = new QComboBox();
-    comboAccountsList->addItem(tr("-NA-"));
-    */
-
-    vLay->addWidget(comboAccountsList);
-
-    /* 2) The actual viewlet display of account selected in 1) */
-    QWidget *defaultViewletWidget = new QWidget();
-    defaultVLayout = new QVBoxLayout();
-    QScrollArea *viewletScrollArea = new QScrollArea();
-
-    viewletScrollArea->setWidget(defaultViewletWidget);
-    viewletScrollArea->setAlignment(Qt::AlignLeft);
-    viewletScrollArea->setWidgetResizable(true);
-    defaultViewletWidget->setLayout(defaultVLayout);
-    vLay->addWidget(viewletScrollArea);
-
-    //create viewlet
-    if(comboAccountsList->currentIndex())
-    {
-        selectedAccountIndex = comboAccountsList->currentIndex();
-        selectedAccount = accountsList->at(selectedAccountIndex);
-
-        viewletModel->defaultVGenerate(selectedAccount);
-        defaultVDraw();
-    }
-}
-
-void
-ViewletView::leftVSet(QWidget *parent, QHBoxLayout *FPOLayout)
-{
-    connect(this, SIGNAL(fileLoaded()),
-            this, SLOT(leftVLoad()));
-
-    //connect(comboAccountsList, SIGNAL(currentIndexChanged(int)),
-          //  this, SLOT(leftVUpdate()));
-
-    //not required. remove after cleaning loadAccountsTreeComboBox()
-    comboAccountsList = new QComboBox();
-    comboAccountsList->addItem(tr("-NA-"));
-
-
-    QWidget *viewletContainer = new QWidget;
-    FPOLayout->addWidget(viewletContainer);
-
-    QVBoxLayout *vLay = new QVBoxLayout;
-    viewletContainer->setLayout(vLay);
-
-    QLabel *title = new QLabel(tr("Expense"));
-    vLay->addWidget(title);
-
-    /* The actual viewlet display of account(s) chosen*/
-    QWidget *defaultViewletWidget = new QWidget();
-    defaultVLayout = new QVBoxLayout();
-    QScrollArea *viewletScrollArea = new QScrollArea();
-
-    viewletScrollArea->setWidget(defaultViewletWidget);
-    viewletScrollArea->setAlignment(Qt::AlignLeft);
-    viewletScrollArea->setWidgetResizable(true);
-    defaultViewletWidget->setLayout(defaultVLayout);
-    vLay->addWidget(viewletScrollArea);
-
-    /*//create viewlet
-    if(comboAccountsList->currentIndex())
-    {
-        selectedAccountIndex = comboAccountsList->currentIndex();
-        selectedAccount = accountsList->at(selectedAccountIndex);
-
-        defaultVDraw();
-    }*/
-
-}
-
-void
-ViewletView::rightVSet(QWidget *parent, QHBoxLayout *FPOLayout)
-{
-    connect(this, SIGNAL(fileLoaded()),
-            this, SLOT(rightVLoad()));
-
-    //connect(comboAccountsList, SIGNAL(currentIndexChanged(int)),
-          //  this, SLOT(leftVUpdate()));
-
-    //not required. remove after cleaning loadAccountsTreeComboBox()
-    comboAccountsList = new QComboBox();
-    comboAccountsList->addItem(tr("-NA-"));
-
-
-    QWidget *viewletContainer = new QWidget;
-    FPOLayout->addWidget(viewletContainer);
-
-    QVBoxLayout *vLay = new QVBoxLayout;
-    viewletContainer->setLayout(vLay);
-
-    QLabel *title = new QLabel(tr("Income"));
-    vLay->addWidget(title);
-
-    /* The actual viewlet display of account(s) chosen*/
-    QWidget *defaultViewletWidget = new QWidget();
-    defaultVLayout = new QVBoxLayout();
-    QScrollArea *viewletScrollArea = new QScrollArea();
-
-    viewletScrollArea->setWidget(defaultViewletWidget);
-    viewletScrollArea->setAlignment(Qt::AlignLeft);
-    viewletScrollArea->setWidgetResizable(true);
-    defaultViewletWidget->setLayout(defaultVLayout);
-    vLay->addWidget(viewletScrollArea);
-
-    /*//create viewlet
-    if(comboAccountsList->currentIndex())
-    {
-        selectedAccountIndex = comboAccountsList->currentIndex();
-        selectedAccount = accountsList->at(selectedAccountIndex);
-
-        defaultVDraw();
-    }*/
-
-}
-
-/***** Private *****/
-
-/** Create the widgets for the viewlet entries
-
-    Passes the selected account to the model. The updated textual
-    data in the struct of the model is used in the newly created
-    widgets.
-*/
-void
-ViewletView::defaultVDraw()
-{
-    /* Update the struct in ViewletModel with data from the selected
-       account
-    */
-
-
-    int numOfTransactions = viewletModel->queueEntries.count();
-    for (int i = 0; i < numOfTransactions; i++)
-    {
-        viewletModel->tempEntry = viewletModel->queueEntries.at(i);
-
-        //1 & 2
-        if((!viewletModel->tempEntry.isDateEqual && !viewletModel->tempEntry.isSplitAccountEqual)
-            || (!viewletModel->tempEntry.isDateEqual && viewletModel->tempEntry.isSplitAccountEqual))
-        {
-            dateCheckOutput();
-            accountCheckOutput();
-            descriptionAmountOutput();
-        }
-
-        //3
-        if(viewletModel->tempEntry.isDateEqual && !viewletModel->tempEntry.isSplitAccountEqual)
-        {
-            accountCheckOutput();
-            descriptionAmountOutput();
-        }
-
-        //4
-        if(viewletModel->tempEntry.isDateEqual && viewletModel->tempEntry.isSplitAccountEqual)
-        {
-            descriptionAmountOutput();
-        }
-    }
-}
-
-void
-ViewletView::dateCheckOutput()
-{
-    QWidget *dateLevelContainer = new QWidget();
-    QVBoxLayout *dateLayout = new QVBoxLayout;
-    dateLevelContainer->setLayout(dateLayout);
-
-    /* Append the pointer of this top level widget
-      of the viewlet for later removal during update */
-    viewletWidgetContainersList.append(dateLevelContainer);
-
-    defaultVLayout->addWidget(dateLevelContainer, 10, Qt::AlignTop);
-
-    txnDate = viewletModel->tempEntry.txnDate;
-    setLabel(txnDate, "dateWidget", dateLayout);
-
-    QWidget *accountLevelContainer = new QWidget();
-    accountLayout = new QVBoxLayout;
-    accountLevelContainer->setLayout(accountLayout);
-    dateLayout->addWidget(accountLevelContainer);
-}
-
-void
-ViewletView::accountCheckOutput()
-{
-    QWidget *singleAccountLevelContainer = new QWidget();
-    QVBoxLayout *singleAccountLayout = new QVBoxLayout();
-    singleAccountLevelContainer->setLayout(singleAccountLayout);
-
-    accountLayout->addWidget(singleAccountLevelContainer);
-
-    // 1
-    splitAccount = viewletModel->tempEntry.splitAccount;
-    setLabel(splitAccount, "accountWidget", singleAccountLayout);
-
-    QWidget *descriptionAmountLevelContainer = new QWidget();
-    descriptionAmountLayout = new QVBoxLayout();
-    descriptionAmountLevelContainer->setLayout(descriptionAmountLayout);
-
-    // 2
-    singleAccountLayout->addWidget(descriptionAmountLevelContainer);
-}
-
-void
-ViewletView::descriptionAmountOutput()
-{
-    txnDescription = viewletModel->tempEntry.txnDescription;
-    setLabel(txnDescription, "descWidget", descriptionAmountLayout);
-
-    splitAmount = viewletModel->tempEntry.splitAmount;
-    setLabel(splitAmount, "amountWidget", descriptionAmountLayout);
-}
-
-void
-ViewletView::defaultVRemoveWidgets()
-{
-    /* Remove old widgets. */
-    int numOfContainers = viewletWidgetContainersList.count();
-    for (int i=0; i<numOfContainers; i++)
-    {
-        delete viewletWidgetContainersList.at(i);
-    }
-
-    /* Empty the data structures */
-    viewletModel->queueEntries.clear();
-    viewletWidgetContainersList.clear();
-}
-
-/**********/
-
-void
-ViewletView::setLabel(QString data, QString objectName, QVBoxLayout *layout)
-{
-    QLabel *lbl = new QLabel();
-    lbl->setText(data);
-    layout->addWidget(lbl);
-    /* Used as CSS ID by QStyleSheet */
-    lbl->setObjectName(objectName);
-    viewletWidgetsList.append(lbl);
-}
-
-void
-ViewletView::loadAccountsTreeComboBox(AccountListModel * const m_accountsListModel)
-{
-    accountsList = m_accountsListModel;
-    comboAccountsList->setModel(accountsList);
-    Q_EMIT fileLoaded();
-}
-
-/***** Slots *****/
-
-void
-ViewletView::defaultVUpdate()
-{
-    selectedAccountIndex = comboAccountsList->currentIndex();
-    selectedAccount = accountsList->at(selectedAccountIndex);
-
-    defaultVRemoveWidgets();
-    viewletModel->defaultVGenerate(selectedAccount);
-    defaultVDraw();
-}
-
-
-void
-ViewletView::leftVUpdate()
-{
-    selectedAccountIndex = comboAccountsList->currentIndex();
-    selectedAccount = accountsList->at(selectedAccountIndex);
-
-    //Call this in dboard gnc event switch
-    defaultVRemoveWidgets();
-    viewletModel->leftVGenerate(selectedAccount);
-    defaultVDraw();
-}
-
-void
-ViewletView::leftVLoad()
-{
-    selectedAccount = accountsList->at(1);
-    defaultVRemoveWidgets();
-    viewletModel->leftVGenerate(selectedAccount);
-    defaultVDraw();
-}
-
-void
-ViewletView::rightVUpdate()
-{
-    selectedAccountIndex = comboAccountsList->currentIndex();
-    selectedAccount = accountsList->at(selectedAccountIndex);
-
-    //Call this in dboard gnc event switch
-    defaultVRemoveWidgets();
-    viewletModel->rightVGenerate(selectedAccount);
-    defaultVDraw();
-}
-
-void
-ViewletView::rightVLoad()
-{
-    selectedAccount = accountsList->at(1);
-    defaultVRemoveWidgets();
-    viewletModel->rightVGenerate(selectedAccount);
-    defaultVDraw();
-}
-
-} // END namespace gnc
-
diff --git a/src/gnc/fpo/ViewletView.hpp b/src/gnc/fpo/ViewletView.hpp
deleted file mode 100644
index 6fd4f91..0000000
--- a/src/gnc/fpo/ViewletView.hpp
+++ /dev/null
@@ -1,102 +0,0 @@
-#ifndef VIEWLETVIEW_HPP
-#define VIEWLETVIEW_HPP
-
-#include "config.h"
-#include "engine/guid.hpp"
-
-extern "C"
-{
-#include "qof.h"
-#include "engine/Account.h"
-#include "engine/Transaction.h"
-#include "engine/Split.h"
-}
-
-#include "gnc/mainwindow.hpp"
-#include "gnc/fpo/ViewletModel.hpp"
-#include "gnc/AccountItemModel.hpp"
-#include "gnc/SplitListModel.hpp"
-
-#include <QtCore>
-#include <QAbstractItemModel>
-#include <QtGui>
-#include <QWidget>
-
-namespace gnc
-{
-class ViewletModel;
-
-class ViewletView : public QWidget
-{
-    Q_OBJECT
-public:
-    explicit ViewletView(QWidget * parent = 0, QHBoxLayout * FPOLayout = NULL);
-    void loadAccountsTreeComboBox(AccountListModel * const m_accountsListModel);
-
-    /* Call the appropriate method to set the viewlet of that type */
-    void defaultVSet(QWidget * parent, QHBoxLayout * FPOLayout);
-    void leftVSet(QWidget * parent, QHBoxLayout * FPOLayout);
-    void rightVSet(QWidget * parent, QHBoxLayout * FPOLayout);
-
-    void leftVUpdate();
-    void rightVUpdate();
-
-Q_SIGNALS:
-    void fileLoaded();
-
-public Q_SLOTS:
-    void defaultVUpdate();
-
-private:
-    ViewletModel *viewletModel;
-    AccountListModel *accountsList;
-
-    QString txnDate;
-    QString txnDescription;
-    QString splitAccount;
-    QString splitAmount;
-
-    QVBoxLayout *defaultVLayout;
-    QVBoxLayout *leftVLayout;
-    QVBoxLayout *rightVLayout;
-
-    QVBoxLayout *accountLayout;
-    QVBoxLayout *descriptionAmountLayout;
-
-    /* A simple list to store widgets generated by any of the three
-       viewlet types. When the viewlet updates, a new viewlet could
-       be drawn by first removing the old widgets in this list. */
-    QList<QWidget *> viewletWidgetsList;
-    QList<QWidget *> viewletWidgetContainersList;
-
-    /** @bugid_1 */
-    QComboBox * comboAccountsList;    
-
-    /** @todo */
-    ::SplitList * pSplitList;
-    ::Account * selectedAccount;
-    int selectedAccountIndex;
-
-    /* Widget generator */
-    void setLabel(QString data, QString objectName, QVBoxLayout *layout);
-
-    /* Viewlet generator methods */
-    void defaultVDraw();
-    void defaultVRemoveWidgets();
-    //void leftVDraw();
-    void leftVRemoveWidgets();
-    //void rightVDraw();
-    void rightVRemoveWidgets();
-
-    void dateCheckOutput();
-    void accountCheckOutput();
-    void descriptionAmountOutput();
-
-private Q_SLOTS:
-    void leftVLoad();
-    void rightVLoad();
-};
-
-} // END namespace gnc
-
-#endif // VIEWLETVIEW_HPP
diff --git a/src/gnc/gnucash.qrc b/src/gnc/gnucash.qrc
deleted file mode 100644
index ac7b9c1..0000000
--- a/src/gnc/gnucash.qrc
+++ /dev/null
@@ -1,21 +0,0 @@
-<!DOCTYPE RCC>
-<RCC version="1.0">
-<qresource prefix="/pixmaps">
-    <file alias="gnc-account-delete.png">../pixmaps/hicolor/24x24/actions/gnc-account-delete.png</file>
-    <file alias="gnc-account-edit.png">../pixmaps/hicolor/24x24/actions/gnc-account-edit.png</file>
-    <file alias="gnc-account-new.png">../pixmaps/hicolor/24x24/actions/gnc-account-new.png</file>
-    <file alias="gnc-account-open.png">../pixmaps/hicolor/24x24/actions/gnc-account-open.png</file>
-    <file alias="gnc-account.png">../pixmaps/hicolor/24x24/actions/gnc-account.png</file>
-    <file alias="gnc-invoice-edit.png">../pixmaps/hicolor/24x24/actions/gnc-invoice-edit.png</file>
-    <file alias="gnc-invoice.png">../pixmaps/hicolor/24x24/actions/gnc-invoice.png</file>
-    <file alias="gnc-invoice-post.png">../pixmaps/hicolor/24x24/actions/gnc-invoice-post.png</file>
-    <file alias="gnc-invoice-unpost.png">../pixmaps/hicolor/24x24/actions/gnc-invoice-unpost.png</file>
-    <file alias="gnc-jumpto.png">../pixmaps/hicolor/24x24/actions/gnc-jumpto.png</file>
-    <file alias="gnc-split-trans.png">../pixmaps/hicolor/24x24/actions/gnc-split-trans.png</file>
-    <file alias="gnc-sx-new.png">../pixmaps/hicolor/24x24/actions/gnc-sx-new.png</file>
-    <file alias="gnc-transfer.png">../pixmaps/hicolor/24x24/actions/gnc-transfer.png</file>
-    <file alias="gnucash-icon-48x48.png">../pixmaps/hicolor/24x24/actions/gnucash-icon.png</file>
-    <file alias="gnucash-icon-64x64.png">../pixmaps/hicolor/24x24/actions/gnucash-icon.png</file>
-    <file alias="gnucash_splash.png">../pixmaps/gnucash_splash.png</file>
-</qresource>
-</RCC>
diff --git a/src/gnc/gtk-icons.qrc b/src/gnc/gtk-icons.qrc
deleted file mode 100644
index eb634cf..0000000
--- a/src/gnc/gtk-icons.qrc
+++ /dev/null
@@ -1,16 +0,0 @@
-<RCC>
-  <qresource>
-    <file>gtk-icons/gtk-about.png</file>
-    <file>gtk-icons/gtk-close.png</file>
-    <file>gtk-icons/gtk-copy.png</file>
-    <file>gtk-icons/gtk-cut.png</file>
-    <file>gtk-icons/gtk-new.png</file>
-    <file>gtk-icons/gtk-open.png</file>
-    <file>gtk-icons/gtk-paste.png</file>
-    <file>gtk-icons/gtk-quit.png</file>
-    <file>gtk-icons/gtk-redo.png</file>
-    <file>gtk-icons/gtk-save-as.png</file>
-    <file>gtk-icons/gtk-save.png</file>
-    <file>gtk-icons/gtk-undo.png</file>
-  </qresource>
-</RCC>
diff --git a/src/gnc/gtk-icons/gtk-about.png b/src/gnc/gtk-icons/gtk-about.png
deleted file mode 100644
index dd06dd4..0000000
Binary files a/src/gnc/gtk-icons/gtk-about.png and /dev/null differ
diff --git a/src/gnc/gtk-icons/gtk-close.png b/src/gnc/gtk-icons/gtk-close.png
deleted file mode 100644
index bf8104f..0000000
Binary files a/src/gnc/gtk-icons/gtk-close.png and /dev/null differ
diff --git a/src/gnc/gtk-icons/gtk-copy.png b/src/gnc/gtk-icons/gtk-copy.png
deleted file mode 100644
index adea8fe..0000000
Binary files a/src/gnc/gtk-icons/gtk-copy.png and /dev/null differ
diff --git a/src/gnc/gtk-icons/gtk-cut.png b/src/gnc/gtk-icons/gtk-cut.png
deleted file mode 100644
index b672b73..0000000
Binary files a/src/gnc/gtk-icons/gtk-cut.png and /dev/null differ
diff --git a/src/gnc/gtk-icons/gtk-new.png b/src/gnc/gtk-icons/gtk-new.png
deleted file mode 100644
index ad05906..0000000
Binary files a/src/gnc/gtk-icons/gtk-new.png and /dev/null differ
diff --git a/src/gnc/gtk-icons/gtk-open.png b/src/gnc/gtk-icons/gtk-open.png
deleted file mode 100644
index 0a7bedd..0000000
Binary files a/src/gnc/gtk-icons/gtk-open.png and /dev/null differ
diff --git a/src/gnc/gtk-icons/gtk-paste.png b/src/gnc/gtk-icons/gtk-paste.png
deleted file mode 100644
index 2822dbf..0000000
Binary files a/src/gnc/gtk-icons/gtk-paste.png and /dev/null differ
diff --git a/src/gnc/gtk-icons/gtk-quit.png b/src/gnc/gtk-icons/gtk-quit.png
deleted file mode 100644
index 7e3207d..0000000
Binary files a/src/gnc/gtk-icons/gtk-quit.png and /dev/null differ
diff --git a/src/gnc/gtk-icons/gtk-redo.png b/src/gnc/gtk-icons/gtk-redo.png
deleted file mode 100644
index f0ad664..0000000
Binary files a/src/gnc/gtk-icons/gtk-redo.png and /dev/null differ
diff --git a/src/gnc/gtk-icons/gtk-save-as.png b/src/gnc/gtk-icons/gtk-save-as.png
deleted file mode 100644
index eae69e8..0000000
Binary files a/src/gnc/gtk-icons/gtk-save-as.png and /dev/null differ
diff --git a/src/gnc/gtk-icons/gtk-save.png b/src/gnc/gtk-icons/gtk-save.png
deleted file mode 100644
index 1214883..0000000
Binary files a/src/gnc/gtk-icons/gtk-save.png and /dev/null differ
diff --git a/src/gnc/gtk-icons/gtk-undo.png b/src/gnc/gtk-icons/gtk-undo.png
deleted file mode 100644
index 087f59a..0000000
Binary files a/src/gnc/gtk-icons/gtk-undo.png and /dev/null differ
diff --git a/src/gnc/icons/oxygen/48x48/actions/document-new.png b/src/gnc/icons/oxygen/48x48/actions/document-new.png
deleted file mode 100644
index 61db97a..0000000
Binary files a/src/gnc/icons/oxygen/48x48/actions/document-new.png and /dev/null differ
diff --git a/src/gnc/icons/oxygen/48x48/actions/document-open.png b/src/gnc/icons/oxygen/48x48/actions/document-open.png
deleted file mode 100644
index f003f17..0000000
Binary files a/src/gnc/icons/oxygen/48x48/actions/document-open.png and /dev/null differ
diff --git a/src/gnc/icons/oxygen/48x48/actions/document-save-as.png b/src/gnc/icons/oxygen/48x48/actions/document-save-as.png
deleted file mode 100644
index ed2453d..0000000
Binary files a/src/gnc/icons/oxygen/48x48/actions/document-save-as.png and /dev/null differ
diff --git a/src/gnc/icons/oxygen/48x48/actions/document-save.png b/src/gnc/icons/oxygen/48x48/actions/document-save.png
deleted file mode 100644
index cc380a0..0000000
Binary files a/src/gnc/icons/oxygen/48x48/actions/document-save.png and /dev/null differ
diff --git a/src/gnc/icons/oxygen/48x48/actions/edit-copy.png b/src/gnc/icons/oxygen/48x48/actions/edit-copy.png
deleted file mode 100644
index d33b436..0000000
Binary files a/src/gnc/icons/oxygen/48x48/actions/edit-copy.png and /dev/null differ
diff --git a/src/gnc/icons/oxygen/48x48/actions/edit-cut.png b/src/gnc/icons/oxygen/48x48/actions/edit-cut.png
deleted file mode 100644
index 8210957..0000000
Binary files a/src/gnc/icons/oxygen/48x48/actions/edit-cut.png and /dev/null differ
diff --git a/src/gnc/icons/oxygen/48x48/actions/edit-paste.png b/src/gnc/icons/oxygen/48x48/actions/edit-paste.png
deleted file mode 100644
index 1800a29..0000000
Binary files a/src/gnc/icons/oxygen/48x48/actions/edit-paste.png and /dev/null differ
diff --git a/src/gnc/icons/oxygen/48x48/actions/edit-redo.png b/src/gnc/icons/oxygen/48x48/actions/edit-redo.png
deleted file mode 100644
index 8de333f..0000000
Binary files a/src/gnc/icons/oxygen/48x48/actions/edit-redo.png and /dev/null differ
diff --git a/src/gnc/icons/oxygen/48x48/actions/edit-undo.png b/src/gnc/icons/oxygen/48x48/actions/edit-undo.png
deleted file mode 100644
index 5071aa1..0000000
Binary files a/src/gnc/icons/oxygen/48x48/actions/edit-undo.png and /dev/null differ
diff --git a/src/gnc/icons/oxygen/48x48/actions/help-about.png b/src/gnc/icons/oxygen/48x48/actions/help-about.png
deleted file mode 100644
index 8f3a936..0000000
Binary files a/src/gnc/icons/oxygen/48x48/actions/help-about.png and /dev/null differ
diff --git a/src/gnc/icons/oxygen/48x48/actions/list-add.png b/src/gnc/icons/oxygen/48x48/actions/list-add.png
deleted file mode 100644
index af5b56e..0000000
Binary files a/src/gnc/icons/oxygen/48x48/actions/list-add.png and /dev/null differ
diff --git a/src/gnc/icons/oxygen/48x48/actions/tab-close-other.png b/src/gnc/icons/oxygen/48x48/actions/tab-close-other.png
deleted file mode 100644
index fba2eb6..0000000
Binary files a/src/gnc/icons/oxygen/48x48/actions/tab-close-other.png and /dev/null differ
diff --git a/src/gnc/icons/oxygen/48x48/actions/window-close.png b/src/gnc/icons/oxygen/48x48/actions/window-close.png
deleted file mode 100644
index 8d7f19f..0000000
Binary files a/src/gnc/icons/oxygen/48x48/actions/window-close.png and /dev/null differ
diff --git a/src/gnc/icons/oxygen/index.theme b/src/gnc/icons/oxygen/index.theme
deleted file mode 100644
index efb2ee2..0000000
--- a/src/gnc/icons/oxygen/index.theme
+++ /dev/null
@@ -1,35 +0,0 @@
-[Icon Theme]
-Name=Oxygen
-
-Comment=Oxygen Team
-
-DisplayDepth=32
-
-Inherits=hicolor
-
-Example=folder
-
-LinkOverlay=link
-LockOverlay=lockoverlay
-ShareOverlay=share
-ZipOverlay=zip
-
-DesktopDefault=48
-DesktopSizes=16,22,32,48,64,128,256
-ToolbarDefault=22
-ToolbarSizes=16,22,32,48
-MainToolbarDefault=22
-MainToolbarSizes=16,22,32,48
-SmallDefault=16
-SmallSizes=16,22,32,48
-PanelDefault=32
-PanelSizes=16,22,32,48,64,128,256
-DialogDefault=32
-DialogSizes=16,22,32,48,64,128,256
-
-Directories=48x48/actions
-
-[48x48/actions]
-Size=48
-Context=Actions
-Type=Threshold
\ No newline at end of file
diff --git a/src/gnc/main.cpp b/src/gnc/main.cpp
deleted file mode 100644
index 7aab5fd..0000000
--- a/src/gnc/main.cpp
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- * main.cpp -- The program entry point for cutecash
- *
- * Copyright (C) 2006 Chris Shoemaker <c.shoemaker at cox.net>
- * Copyright (C) 2010 Christian Stimming
- *
- * 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 at gnu.org
- */
-#include "config.h"
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <glib/gi18n.h>
-#include <glib.h>
-#include <libguile.h>
-#include "engine/guid.hpp"
-extern "C"
-{
-#include "gnc-module/gnc-module.h"
-#include "core-utils/gnc-path.h"
-#include "core-utils/binreloc.h"
-    /* #include "gnc-version.h" */
-#include "engine/gnc-engine.h"
-#include "core-utils/gnc-filepath-utils.h"
-#include "engine/gnc-hooks.h"
-#include "engine/gnc-commodity.h"
-#include "core-utils/gnc-prefs.h"
-#include "engine/gnc-session.h"
-#include "engine/engine-helpers.h"
-#include "engine/gnc-engine.h"
-#include "app-utils/gnc-ui-util.h" // for gnc_ui_util_init()
-#include "app-utils/gnc-exp-parser.h" // for gnc_exp_parser_init()
-#include "swig-runtime.h"
-
-#include "backend/xml/gnc-backend-xml.h"
-#ifdef WITH_SQL
-#  include "backend/dbi/gnc-backend-dbi.h"
-#endif
-} // END extern C
-
-#ifdef HAVE_GETTEXT
-#  include <libintl.h>
-#  include <locale.h>
-#endif
-
-// Glibmm includes
-#include <glibmm.h>
-#include "gncmm/wrap_init.hpp"
-
-// Qt includes
-#include <QApplication>
-#include "mainwindow.hpp"
-
-namespace gnc
-{
-
-#define APP_GNUCASH "/apps/gnucash"
-
-/* GNUCASH_SCM is defined whenever we're building from an svn/svk/git/bzr tree */
-#ifdef GNUCASH_SCM
-static int is_development_version = TRUE;
-#else
-static int is_development_version = FALSE;
-#endif
-
-static gchar **log_flags = NULL;
-static gchar *log_to_filename = NULL;
-
-static void
-gnc_log_init()
-{
-    if (log_to_filename != NULL)
-    {
-        qof_log_init_filename_special(log_to_filename);
-    }
-    else
-    {
-        /* initialize logging to our file. */
-        gchar *tracefilename;
-        tracefilename = g_build_filename(g_get_tmp_dir(), "gnucash.trace",
-                                         (gchar *)NULL);
-        qof_log_init_filename(tracefilename);
-        g_free(tracefilename);
-    }
-
-    // set a reasonable default.
-    qof_log_set_default(QOF_LOG_WARNING);
-
-    gnc_log_default();
-
-    if (gnc_prefs_is_debugging_enabled())
-    {
-        qof_log_set_level("", QOF_LOG_INFO);
-        qof_log_set_level("qof", QOF_LOG_INFO);
-        qof_log_set_level("gnc", QOF_LOG_INFO);
-    }
-
-    {
-        gchar *log_config_filename;
-        log_config_filename = gnc_build_dotgnucash_path("log.conf");
-        if (g_file_test(log_config_filename, G_FILE_TEST_EXISTS))
-            qof_log_parse_log_config(log_config_filename);
-        g_free(log_config_filename);
-    }
-
-    if (log_flags != NULL)
-    {
-        int i = 0;
-        for (; log_flags[i] != NULL; i++)
-        {
-            QofLogLevel level;
-            gchar **parts = NULL;
-
-            gchar *log_opt = log_flags[i];
-            parts = g_strsplit(log_opt, "=", 2);
-            if (parts == NULL || parts[0] == NULL || parts[1] == NULL)
-            {
-                g_warning("string [%s] not parseable", log_opt);
-                continue;
-            }
-
-            level = qof_log_level_from_string(parts[1]);
-            qof_log_set_level(parts[0], level);
-            g_strfreev(parts);
-        }
-    }
-}
-
-} // END namespace gnc
-
-int
-main(int argc, char ** argv)
-{
-#if !defined(G_THREADS_ENABLED) || defined(G_THREADS_IMPL_NONE)
-#    error "No GLib thread implementation available!"
-#endif
-    g_thread_init(NULL);
-
-    QApplication app(argc, argv);
-
-    // Binreloc is initialized by the Qt exe path lookup.
-    gnc_gbr_set_exe(QCoreApplication::applicationFilePath().toUtf8());
-
-#ifdef HAVE_GETTEXT
-    {
-        gchar *localedir = gnc_path_get_localedir();
-        /* setlocale(LC_ALL, ""); is already called by gtk_set_locale()
-           via gtk_init(). */
-        bindtextdomain(GETTEXT_PACKAGE, localedir);
-        textdomain(GETTEXT_PACKAGE);
-        bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
-        g_free(localedir);
-    }
-#endif
-
-    qof_log_init();
-    qof_log_set_default(QOF_LOG_INFO);
-
-    gnc::gnc_log_init();
-
-    qof_init();
-    gnc_module_system_init();
-    gnc_engine_init_static(argc, argv);
-
-    // Initialize glibmm
-    Glib::init();
-    gnc::wrap_init();
-
-    // Call the statically-linked versions of the backend init
-    // functions
-    gnc_module_init_backend_xml();
-#ifdef WITH_SQL
-    gnc_module_init_backend_dbi();
-#endif
-    gnc_ui_util_init();
-    gnc_exp_parser_init();
-
-    int r;
-    {
-        // From here on the new C++ code
-        gnc::MainWindow mainWin;
-        mainWin.show();
-
-        /* set stylesheet */
-        QFile styleSheetFile(":/qss-default");
-        styleSheetFile.open(QFile::ReadOnly);
-        QString styleSheetName = QLatin1String(styleSheetFile.readAll());
-        app.setStyleSheet(styleSheetName);
-
-        // Go into the main qt event loop
-        r = app.exec();
-
-        // Destruction of the MainWindow will trigger all the C++
-        // destructors
-    }
-
-    // Shutdown of the C side after all C++ was destructed already.
-    gnc_exp_parser_shutdown();
-#ifdef WITH_SQL
-    gnc_module_finalize_backend_dbi();
-#endif
-    qof_close();
-    return r;
-
-}
diff --git a/src/gnc/mainwindow-file.cpp b/src/gnc/mainwindow-file.cpp
deleted file mode 100644
index 432f0c6..0000000
--- a/src/gnc/mainwindow-file.cpp
+++ /dev/null
@@ -1,763 +0,0 @@
-/*
- * mainwindow-file.cpp
- * Copyright (C) 2010 Christian Stimming
- *
- * 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 at gnu.org
- */
-
-#include <QtCore/QSettings>
-#include <QtGui/QCloseEvent>
-#include <QtGui/QFileDialog>
-#include <QtGui/QMessageBox>
-#include <QtGui/QProgressBar>
-#include <QtGui/QPushButton>
-#include <QtGui/QToolBar>
-#include <QtGui/QUndoStack>
-#include <QDebug>
-
-#include "config.h"
-#include "mainwindow.hpp"
-#include "ui_mainwindow.h"
-
-// gnucash includes
-#include <glib/gi18n.h>
-extern "C"
-{
-#include "qof.h"
-#include "engine/gnc-hooks.h"
-#include "core-utils/gnc-uri-utils.h"
-#include "engine/Account.h"
-#include "engine/TransLog.h"
-}
-
-#include "gncmm/Account.hpp"
-#include "gnc/AccountItemModel.hpp"
-#include "gncmm/Book.hpp"
-#include "gncmm/Numeric.hpp"
-#include "gncmm/Split.hpp"
-#include "gnc/SplitListModel.hpp"
-#include "gnc/RecentFileMenu.hpp"
-
-/* Temp solution for accounts list */
-#include "gnc/fpo/ViewletView.hpp"
-
-#include "gnc/Cmd.hpp"
-
-namespace gnc
-{
-
-inline QString errorToString(QofBackendError err)
-{
-    return errorToStringPair(err).first;
-}
-inline QString errorToDescription(QofBackendError err)
-{
-    return errorToStringPair(err).second;
-}
-
-/* This static indicates the debugging module that this .o belongs to.  */
-static QofLogModule log_module = GNC_MOD_GUI;
-static const char* PROPERTY_TAB_PREVIOUSPOS = "tab_previouspos";
-static gint save_in_progress = 0;
-
-// ////////////////////////////////////////////////////////////
-
-bool MainWindow::show_session_error (QWidget *parent,
-                                     ::QofBackendError io_error,
-                                     const QString& filename,
-                                     GNCFileDialogType type)
-{
-    bool should_abort = true;
-    QString fmt;
-
-    switch (io_error)
-    {
-    case ERR_BACKEND_NO_ERR:
-        should_abort = FALSE;
-        break;
-
-    case ERR_BACKEND_NO_HANDLER:
-        QMessageBox::critical(parent, tr("Error"),
-                              tr("No suitable backend was found for %1.").arg(filename));
-        break;
-
-    case ERR_BACKEND_NO_BACKEND:
-        QMessageBox::critical(parent, tr("Error"),
-                              tr("The URL %1 is not supported by this version of GnuCash.").arg(filename));
-        break;
-
-    case ERR_BACKEND_BAD_URL:
-        QMessageBox::critical(parent, tr("Error"),
-                              tr("Can't parse the URL %1.").arg(filename));
-        break;
-
-    case ERR_BACKEND_CANT_CONNECT:
-        QMessageBox::critical(parent, tr("Error"),
-                              tr("Can't connect to %1. "
-                                 "The host, username or password were incorrect.").arg(filename));
-        break;
-
-    case ERR_BACKEND_CONN_LOST:
-        QMessageBox::critical(parent, tr("Error"),
-                              tr("Can't connect to %1. "
-                                 "Connection was lost, unable to send data.").arg(filename));
-        break;
-
-    case ERR_BACKEND_TOO_NEW:
-        QMessageBox::critical(parent, tr("Error"),
-                              tr("This file/URL appears to be from a newer version "
-                                 "of GnuCash. You must upgrade your version of GnuCash "
-                                 "to work with this data."));
-        break;
-
-    case ERR_BACKEND_NO_SUCH_DB:
-        if (QMessageBox::question(parent, tr("Create New File?"),
-                                  tr("The database %1 doesn't seem to exist. "
-                                     "Do you want to create it?").arg(filename),
-                                  QMessageBox::Ok | QMessageBox::Cancel)
-                == QMessageBox::Ok)
-        {
-            should_abort = false;
-        }
-        break;
-
-    case ERR_BACKEND_LOCKED:
-        switch (type)
-        {
-        case GNC_FILE_DIALOG_OPEN:
-        default:
-            fmt = tr("GnuCash could not obtain the lock for %1. "
-                     "That database may be in use by another user, "
-                     "in which case you should not open the database. "
-                     "Do you want to proceed with opening the database?");
-            break;
-
-        case GNC_FILE_DIALOG_IMPORT:
-            fmt = tr("GnuCash could not obtain the lock for %1. "
-                     "That database may be in use by another user, "
-                     "in which case you should not import the database. "
-                     "Do you want to proceed with importing the database?");
-            break;
-
-        case GNC_FILE_DIALOG_SAVE:
-            fmt = tr("GnuCash could not obtain the lock for %1. "
-                     "That database may be in use by another user, "
-                     "in which case you should not save the database. "
-                     "Do you want to proceed with saving the database?");
-            break;
-
-        case GNC_FILE_DIALOG_EXPORT:
-            fmt = tr("GnuCash could not obtain the lock for %1. "
-                     "That database may be in use by another user, "
-                     "in which case you should not export the database. "
-                     "Do you want to proceed with exporting the database?");
-            break;
-        }
-
-        if (QMessageBox::question(parent, tr("Create New File?"),
-                                  tr("The database %1 doesn't seem to exist. "
-                                     "Do you want to create it?").arg(filename),
-                                  QMessageBox::Yes | QMessageBox::No, QMessageBox::No)
-                == QMessageBox::Yes)
-        {
-            should_abort = false;
-        }
-        break;
-
-    case ERR_BACKEND_READONLY:
-        QMessageBox::critical(parent, tr("Error"),
-                              tr("GnuCash could not write to %1. "
-                                 "That database may be on a read-only file system, "
-                                 "or you may not have write permission for the directory.").arg(filename));
-        break;
-
-    case ERR_BACKEND_DATA_CORRUPT:
-        QMessageBox::critical(parent, tr("Error"),
-                              tr("The file/URL %1 "
-                                 "does not contain GnuCash data or the data is corrupt.").arg(filename));
-        break;
-
-    case ERR_BACKEND_SERVER_ERR:
-        QMessageBox::critical(parent, tr("Error"),
-                              tr("The server at URL %1 "
-                                 "experienced an error or encountered bad or corrupt data.").arg(filename));
-        break;
-
-    case ERR_BACKEND_PERM:
-        QMessageBox::critical(parent, tr("Error"),
-                              tr("You do not have permission to access %1.").arg(filename));
-        break;
-
-    case ERR_BACKEND_MISC:
-        QMessageBox::critical(parent, tr("Error"),
-                              tr("An error occurred while processing %1.").arg(filename));
-        break;
-
-
-    case ERR_FILEIO_FILE_BAD_READ:
-        if (QMessageBox::question(parent, tr("Continue?"),
-                                  tr("There was an error reading the file. "
-                                     "Do you want to continue?"),
-                                  QMessageBox::Ok | QMessageBox::Cancel)
-                == QMessageBox::Ok)
-        {
-            should_abort = false;
-        }
-        break;
-
-    case ERR_FILEIO_PARSE_ERROR:
-        QMessageBox::critical(parent, tr("Error"),
-                              tr("There was an error parsing the file %1.").arg(filename));
-        break;
-
-    case ERR_FILEIO_FILE_EMPTY:
-        QMessageBox::critical(parent, tr("Error"),
-                              tr("The file %1 is empty.").arg(filename));
-        break;
-
-    case ERR_FILEIO_FILE_NOT_FOUND:
-        if (type == GNC_FILE_DIALOG_SAVE)
-        {
-            should_abort = false;
-        }
-        else
-        {
-            QMessageBox::critical(parent, tr("Error"),
-                                  tr("The file %1 could not be found.").arg(filename));
-        }
-        break;
-
-    case ERR_FILEIO_FILE_TOO_OLD:
-        if (QMessageBox::question(parent, tr("Continue?"),
-                                  tr("This file is from an older version of GnuCash. "
-                                     "Do you want to continue?"),
-                                  QMessageBox::Ok | QMessageBox::Cancel)
-                == QMessageBox::Ok)
-        {
-            should_abort = false;
-        }
-        break;
-
-    case ERR_FILEIO_UNKNOWN_FILE_TYPE:
-        QMessageBox::critical(parent, tr("Error"),
-                              tr("The file type of file %1 is unknown.").arg(filename));
-        break;
-
-    case ERR_FILEIO_BACKUP_ERROR:
-        QMessageBox::critical(parent, tr("Error"),
-                              tr("Could not make a backup of the file %1").arg(filename));
-        break;
-
-    case ERR_FILEIO_WRITE_ERROR:
-        QMessageBox::critical(parent, tr("Error"),
-                              tr("Could not write to file %1.  Check that you have "
-                                 "permission to write to this file and that "
-                                 "there is sufficient space to create it.").arg(filename));
-        break;
-
-    case ERR_FILEIO_FILE_EACCES:
-        QMessageBox::critical(parent, tr("Error"),
-                              tr("No read permission to read from file %1.").arg(filename));
-        break;
-
-    case ERR_SQL_DB_TOO_OLD:
-        if (QMessageBox::question(parent, tr("Upgrade Database?"),
-                                  tr("This database is from an older version of GnuCash. "
-                                     "Do you want to want to upgrade the database "
-                                     "to the current version?"),
-                                  QMessageBox::Yes | QMessageBox::No, QMessageBox::No)
-                == QMessageBox::Yes)
-        {
-            should_abort = false;
-        }
-        break;
-
-    case ERR_SQL_DB_BUSY:
-        QMessageBox::critical(parent, tr("Error"),
-                              tr("The SQL database is in use by other users, "
-                                 "and the upgrade cannot be performed until they logoff. "
-                                 "If there are currently no other users, consult the  "
-                                 "documentation to learn how to clear out dangling login "
-                                 "sessions."));
-        break;
-
-    default:
-        PERR("FIXME: Unhandled error %d", io_error);
-        QMessageBox::critical(parent, tr("Error"),
-                              tr("An unknown I/O error (%1) occurred.").arg(int(io_error)));
-        break;
-    }
-
-    return should_abort;
-}
-
-// ////////////////////////////////////////////////////////////
-
-
-static void
-gnc_book_opened (Session& sess)
-{
-    gnc_hook_run(HOOK_BOOK_OPENED, sess.gobj());
-}
-
-
-namespace
-{
-/** This is a workaround function object so that we can obtain a
- * QofPercentageFunc without extra boost::bind usage; obviously due to
- * the static member variable it will not work if multiple instances
- * are in use simultaneously */
-class progress_functor
-{
-public:
-    progress_functor(QProgressBar *progressBar)
-    {
-        m_progressBar = progressBar;
-    }
-    ~progress_functor()
-    {
-        m_progressBar = NULL;
-    }
-    static void static_func(const char *message, double percent)
-    {
-        assert(m_progressBar);
-        m_progressBar->setValue(int(percent));
-        // Give the Qt event loop some time
-        qApp->processEvents();
-    }
-private:
-    static QProgressBar *m_progressBar;
-};
-QProgressBar *progress_functor::m_progressBar = NULL;
-
-} // END namespace anonymous
-
-
-void MainWindow::loadFile(const QString &fileName)
-{
-    if (fileName.isEmpty())
-        return;
-
-    // copied from gnc_post_file_open, gnome-utils/gnc-file.c
-
-    QString newfile_qstring =
-        g2q(gchar_to_ustring(gnc_uri_normalize_uri(fileName.toUtf8(), TRUE)));
-    if (newfile_qstring.isEmpty())
-    {
-        show_session_error (this, ERR_FILEIO_FILE_NOT_FOUND, fileName,
-                            GNC_FILE_DIALOG_OPEN);
-        return;
-    }
-    QByteArray newfile = newfile_qstring.toUtf8();
-
-    /* disable events while moving over to the new set of accounts;
-     * the mass deletion of accounts and transactions during
-     * switchover would otherwise cause excessive redraws. */
-    qof_event_suspend ();
-
-    // Change the mouse to a busy cusor
-    QApplication::setOverrideCursor(Qt::WaitCursor);
-
-    /* -------------- BEGIN CORE SESSION CODE ------------- */
-    /* -- this code is almost identical in FileOpen and FileSaveAs -- */
-    gnc_hook_run(HOOK_BOOK_CLOSED, m_session.gobj());
-    qof_session_destroy(m_session.gobj());
-    m_session.reset();
-
-    /* load the accounts from the users datafile */
-    /* but first, check to make sure we've got a session going. */
-    QofSession *new_session = qof_session_new ();
-
-    bool we_are_in_error = false;
-    qof_session_begin (new_session, newfile, FALSE, FALSE, FALSE);
-    QofBackendError io_err = qof_session_get_error (new_session);
-    /* if file appears to be locked, ask the user ... */
-    if (ERR_BACKEND_LOCKED == io_err || ERR_BACKEND_READONLY == io_err)
-    {
-        QString fmt1 = tr("GnuCash could not obtain the lock for %1. ").arg(fileName);
-        QString fmt2 =
-            ((ERR_BACKEND_LOCKED == io_err)
-             ? tr("That database may be in use by another user, "
-                  "in which case you should not open the database. "
-                  "What would you like to do?")
-             : tr("That database may be on a read-only file system, "
-                  "or you may not have write permission for the directory. "
-                  "If you proceed you may not be able to save any changes. "
-                  "What would you like to do?"));
-        QMessageBox msgBox(this);
-        msgBox.setWindowTitle(tr("Could not obtain file lock"));
-        msgBox.setText(fmt1 + fmt2);
-        QPushButton *openAnyway = msgBox.addButton(tr("&Open Anyway"), QMessageBox::ActionRole);
-        QPushButton *createNewFile = msgBox.addButton(tr("&Create New File"), QMessageBox::ActionRole);
-        QPushButton *close = msgBox.addButton(QMessageBox::Close);
-        msgBox.exec();
-        if (msgBox.clickedButton() == openAnyway)
-        {
-            /* user told us to ignore locks. So ignore them. */
-            qof_session_begin (new_session, newfile, TRUE, FALSE, FALSE);
-        }
-        else if (msgBox.clickedButton() == createNewFile)
-        {
-            /* Can't use the given file, so just create a new
-             * database so that the user will gobj a window that
-             * they can click "Exit" on.
-             */
-            newFile();
-            return;
-        }
-        else
-        {
-            qApp->quit();
-            return;
-        }
-    }
-
-    /* if the database doesn't exist, ask the user ... */
-    else if ((ERR_BACKEND_NO_SUCH_DB == io_err) ||
-             (ERR_SQL_DB_TOO_OLD == io_err))
-    {
-        if (false == show_session_error (this, io_err, newfile, GNC_FILE_DIALOG_OPEN))
-        {
-            /* user told us to create a new database. Do it. */
-            qof_session_begin (new_session, newfile, FALSE, TRUE, FALSE);
-        }
-    }
-
-    /* Check for errors again, since above may have cleared the lock.
-     * If its still locked, still, doesn't exist, still too old, then
-     * don't bother with the message, just die. */
-    io_err = qof_session_get_error (new_session);
-    if ((ERR_BACKEND_LOCKED == io_err) ||
-            (ERR_BACKEND_READONLY == io_err) ||
-            (ERR_BACKEND_NO_SUCH_DB == io_err) ||
-            (ERR_SQL_DB_TOO_OLD == io_err))
-    {
-        we_are_in_error = true;
-    }
-    else
-    {
-        we_are_in_error = show_session_error (this, io_err, newfile, GNC_FILE_DIALOG_OPEN);
-    }
-
-    if (!we_are_in_error)
-    {
-        xaccLogDisable();
-
-        {
-            // Set up a progress bar in the statusBar()
-            QProgressBar progressBar;
-            progressBar.setMinimum(0);
-            progressBar.setMaximum(100);
-            statusBar()->showMessage(tr("Loading user data..."));
-            statusBar()->addPermanentWidget(&progressBar);
-            progressBar.show();
-            // This local progress_functor is a workaround on how to
-            // pass the suitable function pointer to session_load -
-            // not very nice because of its static member, but it does
-            // the trick for now.
-            progress_functor functor(&progressBar);
-
-            // Do the loading.
-            qof_session_load (new_session, &progress_functor::static_func);
-
-            // Remove the progress bar again from the status bar.
-            statusBar()->removeWidget(&progressBar);
-        }
-        xaccLogEnable();
-
-        /* check for i/o error, put up appropriate error dialog */
-        io_err = qof_session_get_error (new_session);
-
-        we_are_in_error = show_session_error(this, io_err, newfile, GNC_FILE_DIALOG_OPEN);
-
-        ::Account* new_root_account = gnc_book_get_root_account (qof_session_get_book (new_session));
-        if (we_are_in_error) new_root_account = NULL;
-
-        /* Umm, came up empty-handed, but no error:
-         * The backend forgot to set an error. So make one up. */
-        if (!we_are_in_error && !new_root_account)
-        {
-            we_are_in_error = show_session_error (this, ERR_BACKEND_MISC, newfile,
-                                                  GNC_FILE_DIALOG_OPEN);
-        }
-    }
-
-    QApplication::restoreOverrideCursor();
-
-    /* going down -- abandon ship */
-    if (we_are_in_error)
-    {
-        xaccLogDisable();
-        qof_session_destroy (new_session);
-        xaccLogEnable();
-
-        /* well, no matter what, I think it's a good idea to have a root
-         * account around.  For example, early in the gnucash startup
-         * sequence, the user opens a file; if this open fails for any
-         * reason, we don't want to leave them high & dry without a root
-         * account, because if the user continues, then bad things will
-         * happen. */
-        new_session = qof_session_new ();
-        m_session.reset(new_session);
-
-        qof_event_resume ();
-        return;
-    }
-
-    /* if we got to here, then we've successfully gotten a new session */
-    /* close up the old file session (if any) */
-    m_session.reset(new_session);
-
-    qof_event_resume ();
-
-    /* Call this after re-enabling events. */
-    gnc_book_opened (m_session);
-
-    // ////////////////////////////////////////////////////////////
-    // Some display about this file
-
-    Glib::RefPtr<Account> root (m_session.get_book()->get_root_account());
-    if (root)
-    {
-        m_accountListModel = new AccountListModel(root, this);
-        ui->tableView->setModel(m_accountListModel);
-
-        m_accountTreeModel = new AccountTreeModel(root, this);
-        ui->treeView->setModel(m_accountTreeModel);
-        /* Load the tree in combo boxes of dashboard */
-        m_dboard->loadAccountsTreeComboBox(m_accountListModel);
-        m_dboard->fpoWidget->defaultViewlet->loadAccountsTreeComboBox(m_accountListModel);
-        m_dboard->fpoWidget->leftViewlet->loadAccountsTreeComboBox(m_accountListModel);
-        m_dboard->fpoWidget->rightViewlet->loadAccountsTreeComboBox(m_accountListModel);
-
-        ui->treeViewTab->setProperty(PROPERTY_TAB_PREVIOUSPOS, ui->tabWidget->currentIndex());
-        ui->tabWidget->setCurrentWidget(m_dboard);
-    }
-    else
-    {
-        //ui->labelMain->setText(tr("No root account"));
-    }
-
-    // ////////////////////////////////////////////////////////////
-
-    setCurrentFile(fileName);
-    statusBar()->showMessage(tr("File loaded"), 5000);
-}
-
-
-// ////////////////////////////////////////////////////////////
-
-bool MainWindow::saveFileAs(const QString &fileName)
-{
-    if (gnc_uri_is_file_uri(fileName.toUtf8()))
-    {
-        QFile file(g2q(gchar_to_ustring(gnc_uri_get_path(fileName.toUtf8()))));
-        if (!file.open(QFile::WriteOnly))
-        {
-            QMessageBox::warning(this, tr("Application"),
-                                 tr("Cannot write file %1:\n%2.")
-                                 .arg(fileName)
-                                 .arg(file.errorString()));
-            return false;
-        }
-        file.close();
-    }
-
-    /* Check to see if the user specified the same file as the current
-     * file. If so, then just do a simple save, instead of a full save as */
-    /* FIXME Check if it is ok to have a password in the uri here */
-    QString newfile_qstring =
-        g2q(gchar_to_ustring(gnc_uri_normalize_uri ( fileName.toUtf8(), TRUE )));
-    if (newfile_qstring.isEmpty())
-    {
-        show_session_error (this, ERR_FILEIO_FILE_NOT_FOUND, fileName,
-                            GNC_FILE_DIALOG_SAVE);
-        return false;
-    }
-    QByteArray newfile = newfile_qstring.toUtf8();
-
-    QofSession *session = m_session.gobj();
-    if (m_session.get_url() == fileName)
-    {
-        return saveFile();
-    }
-
-    /* Make sure all of the data from the old file is loaded */
-    qof_session_ensure_all_data_loaded(session);
-
-    /* -- this session code is NOT identical in FileOpen and FileSaveAs -- */
-
-    save_in_progress++;
-    QofSession *new_session = qof_session_new ();
-    qof_session_begin (new_session, newfile, FALSE, FALSE, FALSE);
-
-    QofBackendError io_err = qof_session_get_error (new_session);
-
-    /* if file appears to be locked, ask the user ... */
-    if (ERR_BACKEND_LOCKED == io_err || ERR_BACKEND_READONLY == io_err)
-    {
-        if (false == show_session_error (this, io_err, newfile, GNC_FILE_DIALOG_SAVE))
-        {
-            /* user told us to ignore locks. So ignore them. */
-            qof_session_begin (new_session, newfile, TRUE, FALSE, FALSE);
-        }
-    }
-
-    /* if the database doesn't exist, ask the user ... */
-    else if ((ERR_FILEIO_FILE_NOT_FOUND == io_err) ||
-             (ERR_BACKEND_NO_SUCH_DB == io_err) ||
-             (ERR_SQL_DB_TOO_OLD == io_err))
-    {
-        if (false == show_session_error (this, io_err, newfile, GNC_FILE_DIALOG_SAVE))
-        {
-            /* user told us to create a new database. Do it. */
-            qof_session_begin (new_session, newfile, FALSE, TRUE, FALSE);
-        }
-    }
-
-    /* check again for session errors (since above dialog may have
-     * cleared a file lock & moved things forward some more)
-     * This time, errors will be fatal.
-     */
-    io_err = qof_session_get_error (new_session);
-    if (ERR_BACKEND_NO_ERR != io_err)
-    {
-        show_session_error (this, io_err, newfile, GNC_FILE_DIALOG_SAVE);
-        xaccLogDisable();
-        qof_session_destroy (new_session);
-        xaccLogEnable();
-        save_in_progress--;
-        return false;
-    }
-
-    /* oops ... file already exists ... ask user what to do... */
-    if (false) //qof_session_save_may_clobber_data (new_session))
-        // FIXME: Need to copy the other implementation from r19798 in
-        // gnc-file.c for overwrite-on-existing-file.
-    {
-        if (QMessageBox::question(this, tr("File Exists"),
-                                  tr("The file %1 already exists. "
-                                     "Are you sure you want to overwrite it?").arg(fileName),
-                                  QMessageBox::Yes | QMessageBox::No)
-                != QMessageBox::Yes)
-        {
-            /* if user says cancel, we should break out */
-            xaccLogDisable();
-            qof_session_destroy (new_session);
-            xaccLogEnable();
-            save_in_progress--;
-            return false;
-        }
-
-        /* Whoa-ok. Blow away the previous file. */
-    }
-
-
-    /* Prevent race condition between swapping the contents of the two
-     * sessions, and actually installing the new session as the current
-     * one. Any event callbacks that occur in this interval will have
-     * problems if they check for the current book. */
-    qof_event_suspend();
-
-    /* if we got to here, then we've successfully gotten a new session */
-    /* close up the old file session (if any) */
-    qof_session_swap_data (session, new_session);
-    qof_session_destroy(m_session.gobj());
-    m_session.reset();
-    session = NULL;
-
-    /* XXX At this point, we should really mark the data in the new session
-     * as being 'dirty', since we haven't saved it at all under the new
-     * session. But I'm lazy...
-     */
-    m_session.reset(new_session);
-
-    qof_event_resume();
-
-    /* --------------- END CORE SESSION CODE -------------- */
-
-    bool r = saveFile();
-
-    save_in_progress--;
-    setCurrentFile(fileName);
-    return r;
-}
-
-static bool been_here_before = false;
-
-bool MainWindow::saveFile()
-{
-    /* hack alert -- Somehow make sure all in-progress edits gobj committed! */
-
-    /* If we don't have a filename/path to save to gobj one. */
-    if (m_session.get_url().isEmpty())
-        return on_actionSave_as_triggered();
-
-    /* use the current session to save to file */
-    save_in_progress++;
-    QApplication::setOverrideCursor(Qt::WaitCursor);
-
-    {
-        // Set up a progress bar in the statusBar()
-        QProgressBar progressBar;
-        progressBar.setMinimum(0);
-        progressBar.setMaximum(100);
-        statusBar()->showMessage(tr("Saving user data..."));
-        statusBar()->addPermanentWidget(&progressBar);
-        progressBar.show();
-        // A local progress_functor to pass the suitable function
-        // pointer to session_load
-        progress_functor functor(&progressBar);
-
-        // The actual saving
-        qof_session_save (m_session.gobj(), &progress_functor::static_func);
-
-        // Remove the progress bar again from the status bar.
-        statusBar()->removeWidget(&progressBar);
-    }
-
-    // And saving is finished
-    QApplication::restoreOverrideCursor();
-    save_in_progress--;
-
-
-    /* Make sure everything's OK - disk could be full, file could have
-       become read-only etc. */
-    QofBackendError io_err = m_session.get_error ();
-    if (ERR_BACKEND_NO_ERR != io_err)
-    {
-        show_session_error (this, io_err, m_session.get_url(), GNC_FILE_DIALOG_SAVE);
-
-        if (been_here_before)
-            return true;
-        been_here_before = true;
-        on_actionSave_as_triggered();
-        /* been_here prevents infinite recursion */
-        been_here_before = false;
-        return true;
-    }
-
-    xaccReopenLog();
-    gnc_hook_run(HOOK_BOOK_SAVED, m_session.gobj());
-
-    documentCleanStateChanged(true);
-    statusBar()->showMessage(tr("File saved"), 5000);
-    return true;
-}
-
-} // END namespace gnc
diff --git a/src/gnc/mainwindow.cpp b/src/gnc/mainwindow.cpp
deleted file mode 100644
index d68749c..0000000
--- a/src/gnc/mainwindow.cpp
+++ /dev/null
@@ -1,633 +0,0 @@
-/*
- * mainwindow.cpp
- * Copyright (C) 2010 Christian Stimming
- *
- * 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 at gnu.org
- */
-
-#include <QtCore/QSettings>
-#include <QtGui/QCloseEvent>
-#include <QtGui/QFileDialog>
-#include <QtGui/QMessageBox>
-#include <QtGui/QToolBar>
-#include <QtGui/QProgressBar>
-#include <QtGui/QUndoStack>
-#include <QDebug>
-
-#include "config.h"
-#include "mainwindow.hpp"
-#include "ui_mainwindow.h"
-
-// gnucash includes
-#include <glib/gi18n.h>
-extern "C"
-{
-#include "qof.h"
-#include "engine/gnc-hooks.h"
-#include "core-utils/gnc-uri-utils.h"
-#include "engine/Account.h"
-#include "engine/TransLog.h"
-}
-
-#include "gncmm/Account.hpp"
-#include "gnc/AccountItemModel.hpp"
-#include "gncmm/Book.hpp"
-#include "gncmm/Numeric.hpp"
-#include "gncmm/Split.hpp"
-#include "gnc/SplitListModel.hpp"
-#include "gnc/RecentFileMenu.hpp"
-#include "gnc/SplitListView.hpp"
-
-namespace gnc
-{
-
-inline QString errorToString(QofBackendError err)
-{
-    return errorToStringPair(err).first;
-}
-inline QString errorToDescription(QofBackendError err)
-{
-    return errorToStringPair(err).second;
-}
-
-/* This static indicates the debugging module that this .o belongs to.  */
-static QofLogModule log_module = GNC_MOD_GUI;
-
-static const char* PROPERTY_TAB_LABEL = "tab_label";
-static const char* PROPERTY_TAB_POSITION = "tab_position";
-static const char* PROPERTY_TAB_ISCURRENT = "tab_iscurrent";
-static const char* PROPERTY_TAB_PREVIOUSPOS = "tab_previouspos";
-
-// ////////////////////////////////////////////////////////////
-
-MainWindow::MainWindow()
-        : ui(new Ui::MainWindow)
-        , m_menuRecentFiles(new RecentFileMenu(tr("Open &Recent")))
-        , m_undoStack(new QUndoStack(this))
-{
-    ui->setupUi(this);
-
-    createActions();
-    createToolBars();
-    createStatusBar();
-    setIcons();
-
-    m_dboard = new Dashboard(this);
-    m_dboard->setWindowTitle("Dashboard");
-    //m_dboard->show();
-    ui->tabWidget->addTab(m_dboard, "Dashboard");
-
-    /* Properties used by QSettings */
-    QCoreApplication::setOrganizationName("Gnucash");
-    QCoreApplication::setOrganizationDomain("gnucash.org");
-    QCoreApplication::setApplicationName("Cutecash");
-
-    readSettings();
-
-    connect(m_undoStack, SIGNAL(cleanChanged(bool)),
-            this, SLOT(documentCleanStateChanged(bool)));
-    connect(m_btnTransferFundsWidget, SIGNAL(toggled(bool)),
-            m_dboard, SLOT(transferFundsWidgetButtonToggled(bool)));
-    connect(this, SIGNAL(dashboardVisible(bool)),
-            m_dboard, SLOT(transferFundsWidgetButtonToggled(bool)));
-
-    setWindowIcon(QIcon(":/pixmaps/gnucash-icon-64x64.png"));
-
-    /* Check if the system supports freedesktop standards for icons,
-     * if not, then use the bundled icon set. */
-    if (!QIcon::hasThemeIcon("document-open"))
-    {
-        QIcon::setThemeName("oxygen");
-    }
-
-    newFile();
-    setUnifiedTitleAndToolBarOnMac(true);
-
-    autoLoadRecentFile();
-}
-
-MainWindow::~MainWindow()
-{
-    if (m_session.gobj())
-    {
-        qof_session_destroy(m_session.gobj());
-        m_session.reset();
-    }
-}
-
-// Auto-connected to ui->actionOpen's signal triggered()
-void MainWindow::on_actionOpen_triggered()
-{
-    if (maybeSave())
-    {
-        QString fileName = QFileDialog::getOpenFileName(this);
-        if (!fileName.isEmpty())
-            loadFile(fileName);
-    }
-}
-
-void MainWindow::loadFileMaybe(const QString &fileName)
-{
-    if (maybeSave())
-    {
-        loadFile(fileName);
-    }
-}
-
-
-// Auto-connected to ui->actionSave's signal triggered()
-bool MainWindow::on_actionSave_triggered()
-{
-    if (m_currentFilename.isEmpty())
-    {
-        return on_actionSave_as_triggered();
-    }
-    else
-    {
-        return saveFile();
-    }
-}
-
-// Auto-connected to ui->actionSave_as's signal triggered()
-bool MainWindow::on_actionSave_as_triggered()
-{
-    QString fileName = QFileDialog::getSaveFileName(this);
-    if (fileName.isEmpty())
-        return false;
-
-    return saveFileAs(fileName);
-}
-
-// Auto-connected to ui->actionAbout's signal triggered()
-void MainWindow::on_actionAbout_triggered()
-{
-    QMessageBox::about(this, tr("About Application"),
-                       tr("This is a Gnucash C++ gui example, from the Qt4 Application example. It demonstrates how to "
-                          "write modern GUI applications using Qt, with a menu bar, "
-                          "toolbars, and a status bar."));
-}
-
-void MainWindow::documentWasModified()
-{
-    documentCleanStateChanged(false);
-}
-
-void MainWindow::documentCleanStateChanged(bool documentIsClean)
-{
-    bool unchanged = (documentIsClean == isWindowModified());
-
-    setWindowModified(!documentIsClean);
-    if (!unchanged)
-        updateWindowTitle();
-}
-
-// Auto-connected to ui->textBrowser's signal anchorClicked()
-void MainWindow::on_textBrowser_anchorClicked(const QUrl &url)
-{
-    QMessageBox::information(this, tr("Got you!"),
-                             tr("Obviously you clicked the link with the URL %1.")
-                             .arg(url.toString()));
-}
-
-void MainWindow::createActions()
-{
-    ui->actionNew->setShortcuts(QKeySequence::New);
-    ui->actionOpen->setShortcuts(QKeySequence::Open);
-    ui->actionSave->setShortcuts(QKeySequence::Save);
-    ui->actionSave_as->setShortcuts(QKeySequence::SaveAs);
-
-    m_actionRedo = m_undoStack->createRedoAction(ui->menuEdit, tr("&Redo"));
-    m_actionRedo->setShortcuts(QKeySequence::Redo);
-    m_actionUndo = m_undoStack->createUndoAction(ui->menuEdit, tr("&Undo"));
-    m_actionUndo->setShortcuts(QKeySequence::Undo);
-    ui->menuEdit->insertAction(ui->actionCut, m_actionUndo);
-    ui->menuEdit->insertAction(ui->actionCut, m_actionRedo);
-    ui->menuEdit->insertSeparator(ui->actionCut);
-
-    ui->actionCut->setShortcuts(QKeySequence::Cut);
-    ui->actionCopy->setShortcuts(QKeySequence::Copy);
-    ui->actionPaste->setShortcuts(QKeySequence::Paste);
-
-    ui->actionCloseTab->setShortcuts(QKeySequence::Close);
-
-    connect(ui->actionNew, SIGNAL(triggered()), this, SLOT(newFile()));
-    connect(ui->actionExit, SIGNAL(triggered()), this, SLOT(close()));
-    connect(ui->actionAbout_Qt, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
-
-    ui->actionCut->setEnabled(false);
-    ui->actionCopy->setEnabled(false);
-
-//     connect(ui->textBrowser, SIGNAL(copyAvailable(bool)),
-//             ui->actionCut, SLOT(setEnabled(bool)));
-    connect(ui->textBrowser, SIGNAL(copyAvailable(bool)),
-            ui->actionCopy, SLOT(setEnabled(bool)));
-    connect(ui->actionCopy, SIGNAL(triggered()),
-            ui->textBrowser, SLOT(copy()));
-
-    connect(ui->treeView, SIGNAL(activated(const QModelIndex &)),
-            this, SLOT(accountItemActivated(const QModelIndex&)));
-    connect(ui->tableView, SIGNAL(activated(const QModelIndex &)),
-            this, SLOT(accountItemActivated(const QModelIndex&)));
-}
-
-void MainWindow::createToolBars()
-{
-    ui->menuFile->insertMenu(ui->actionSave, m_menuRecentFiles.data());
-    connect(m_menuRecentFiles.data(), SIGNAL(fileSelected(const QString &)),
-            this, SLOT(loadFileMaybe(const QString&)));
-
-    m_fileToolBar = addToolBar(tr("File"));
-    m_fileToolBar->addAction(ui->actionNew);
-    m_fileToolBar->addAction(ui->actionOpen);
-    m_fileToolBar->addAction(ui->actionSave);
-    m_fileToolBar->addAction(ui->actionCloseTab);
-
-    m_editToolBar = addToolBar(tr("Edit"));
-    m_editToolBar->addAction(m_actionUndo);
-    m_editToolBar->addAction(m_actionRedo);
-    m_editToolBar->addAction(ui->actionCut);
-    m_editToolBar->addAction(ui->actionCopy);
-    m_editToolBar->addAction(ui->actionPaste);
-
-    m_dashboardToolBar = addToolBar(tr("Dashboard"));
-    m_dashboardToolBar->setObjectName("m_dashboardToolBar");
-    m_btnTransferFundsWidget = new QToolButton;
-    m_btnTransferFundsWidget->setCheckable(true);
-    QSettings settings;
-    m_btnTransferFundsWidget->setChecked(settings.value("basic-txn-dockwidget-visible").toBool());
-    m_dashboardToolBar->addWidget(m_btnTransferFundsWidget);
-}
-
-void MainWindow::createStatusBar()
-{
-    statusBar()->showMessage(tr("Ready"));
-}
-
-void MainWindow::setIcons()
-{
-    m_actionRedo->setIcon(QIcon::fromTheme("edit-redo"));
-    m_actionUndo->setIcon(QIcon::fromTheme("edit-undo"));
-    ui->actionCut->setIcon(QIcon::fromTheme("edit-cut"));
-    ui->actionCopy->setIcon(QIcon::fromTheme("edit-copy"));
-    ui->actionPaste->setIcon(QIcon::fromTheme("edit-paste"));
-    ui->actionCloseTab->setIcon(QIcon::fromTheme("tab-close-other"));
-    ui->actionNew->setIcon(QIcon::fromTheme("document-new"));
-    ui->actionOpen->setIcon(QIcon::fromTheme("document-open"));
-    ui->actionSave->setIcon(QIcon::fromTheme("document-save"));
-    ui->actionCloseTab->setIcon(QIcon::fromTheme("tab-close-other"));
-    ui->actionSave_as->setIcon(QIcon::fromTheme("document-save-as"));
-    ui->actionExit->setIcon(QIcon::fromTheme("window-close"));
-    ui->actionAbout->setIcon(QIcon::fromTheme("help-about"));
-    m_btnTransferFundsWidget->setIcon(QIcon::fromTheme("help-about"));
-}
-
-void MainWindow::readSettings()
-{
-    QSettings settings;
-    QPoint pos = settings.value("pos", QPoint(200, 200)).toPoint();
-    QSize size = settings.value("size", QSize(400, 400)).toSize();
-    //resize(size);
-    //move(pos);
-    restoreState(settings.value("state").toByteArray());
-    restoreGeometry(settings.value("geometry").toByteArray());
-    m_menuRecentFiles->readSettings(&settings, "RecentFiles");
-}
-
-void MainWindow::autoLoadRecentFile()
-{
-    QSettings settings;
-    QString lastOpenedFile = "";
-    lastOpenedFile = m_menuRecentFiles->getRecentFileName(&settings,
-                     "RecentFiles");
-    if (maybeSave())
-    {
-        loadFile(lastOpenedFile);
-    }
-}
-
-void MainWindow::writeSettings()
-{
-    QSettings settings;
-    //settings.setValue("pos", pos());
-    //settings.setValue("size", size());
-    settings.setValue("state", saveState());
-    settings.setValue("geometry", saveGeometry());
-    m_menuRecentFiles->writeSettings(&settings, "RecentFiles");
-}
-
-bool MainWindow::maybeSave()
-{
-    if (isWindowModified())
-    {
-        QMessageBox::StandardButton ret;
-        ret = QMessageBox::warning(this, tr("Application"),
-                                   tr("The document has been modified.\n"
-                                      "Do you want to save your changes?"),
-                                   QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
-        if (ret == QMessageBox::Save)
-            return on_actionSave_triggered();
-        else if (ret == QMessageBox::Cancel)
-            return false;
-    }
-    return true;
-}
-
-void MainWindow::setCurrentFile(const QString &fileName)
-{
-    m_menuRecentFiles->usingFile(fileName);
-    m_currentFilename = fileName;
-    documentCleanStateChanged(true);
-
-    updateWindowTitle();
-}
-
-void MainWindow::updateWindowTitle()
-{
-    QString shownName;
-    if (m_currentFilename.isEmpty())
-        shownName = "untitled.txt";
-    else
-        shownName = strippedName(m_currentFilename);
-
-    setWindowTitle(tr("%1[*]%2 - %3").arg(shownName).arg(isWindowModified() ? "(*)" : "").arg(tr("Application")));
-}
-
-QString MainWindow::strippedName(const QString &fullFileName)
-{
-    return QFileInfo(fullFileName).fileName();
-}
-
-
-// ////////////////////////////////////////////////////////////
-
-// Auto-connected to ui->actionCloseTab's signal triggered
-void MainWindow::on_actionCloseTab_triggered()
-{
-    on_tabWidget_tabCloseRequested(ui->tabWidget->currentIndex());
-}
-
-// Auto-connected to ui->tabWidget's signal tabCloseRequested(int)
-void MainWindow::on_tabWidget_tabCloseRequested(int index)
-{
-    QWidget *widget = ui->tabWidget->widget(index);
-    if (widget == ui->textBrowserTab)
-    {
-        ui->actionViewWelcomepage->setChecked(false);
-        reallyRemoveTab(index);
-    }
-    else if (widget == ui->treeViewTab)
-    {
-        ui->actionViewAccountTree->setChecked(false);
-        reallyRemoveTab(index);
-    }
-    else if (widget == ui->tableViewTab)
-    {
-        ui->actionViewAccountList->setChecked(false);
-        reallyRemoveTab(index);
-    }
-    else if (widget == m_dboard)
-    {
-        ui->actionViewDashboard->setChecked(false);
-        m_dashboardToolBar->setEnabled(false);
-        m_dashboardToolBar->setHidden(true);
-        reallyRemoveTab(index);
-    }
-    else
-    {
-        QVariant prevPos = widget->property(PROPERTY_TAB_PREVIOUSPOS);
-        if (prevPos.isValid())
-            ui->tabWidget->setCurrentIndex(prevPos.toInt());
-        ui->tabWidget->removeTab(index);
-        delete widget;
-    }
-}
-
-// Auto-connected to ui->actionViewAccountTree's signal triggered()
-void MainWindow::on_actionViewAccountTree_triggered(bool checked)
-{
-    viewOrHideTab(checked, ui->treeViewTab);
-}
-
-// Auto-connected to ui->actionViewAccountList's signal triggered()
-void MainWindow::on_actionViewAccountList_triggered(bool checked)
-{
-    viewOrHideTab(checked, ui->tableViewTab);
-}
-
-// Auto-connected to ui->actionViewWelcomepage's signal triggered()
-void MainWindow::on_actionViewWelcomepage_triggered(bool checked)
-{
-    viewOrHideTab(checked, ui->textBrowserTab);
-}
-
-void MainWindow::on_actionViewDashboard_triggered(bool checked)
-{
-    viewOrHideTab(checked, m_dboard);
-}
-
-void MainWindow::viewOrHideTab(bool checked, QWidget *widget)
-{
-    if (checked)
-    {
-        QVariant tabLabel = widget->property(PROPERTY_TAB_LABEL);
-        Q_ASSERT(tabLabel.isValid());
-        QVariant tabPosition = widget->property(PROPERTY_TAB_POSITION);
-        Q_ASSERT(tabPosition.isValid());
-        QVariant tabIsCurrentV = widget->property(PROPERTY_TAB_ISCURRENT);
-        Q_ASSERT(tabIsCurrentV.isValid());
-        bool tabIsCurrent = tabIsCurrentV.toBool();
-
-        if (tabIsCurrent)
-            widget->setProperty(PROPERTY_TAB_PREVIOUSPOS, ui->tabWidget->currentIndex());
-
-        ui->tabWidget->insertTab(tabPosition.toInt(), widget, tabLabel.toString());
-        if (tabIsCurrent)
-            ui->tabWidget->setCurrentWidget(widget);
-
-        if(widget == m_dboard)
-        {
-            m_dashboardToolBar->setEnabled(true);
-            m_dashboardToolBar->setHidden(false);
-            Q_EMIT dashboardVisible(true);
-        }
-    }
-    else
-    {
-        on_tabWidget_tabCloseRequested(ui->tabWidget->indexOf(widget));
-    }
-}
-
-void MainWindow::reallyRemoveTab(int index)
-{
-    QWidget *widget = ui->tabWidget->widget(index);
-    widget->setProperty(PROPERTY_TAB_LABEL, ui->tabWidget->tabText(index));
-    widget->setProperty(PROPERTY_TAB_POSITION, index);
-    widget->setProperty(PROPERTY_TAB_ISCURRENT, (index == ui->tabWidget->currentIndex()));
-    ui->tabWidget->removeTab(index);
-    QVariant prevPos = widget->property(PROPERTY_TAB_PREVIOUSPOS);
-    if (prevPos.isValid())
-        ui->tabWidget->setCurrentIndex(prevPos.toInt());
-}
-
-// Auto-connected to ui->tabWidget's signal currentChanged(int)
-void MainWindow::on_tabWidget_currentChanged(int index)
-{
-    QWidget *widget = ui->tabWidget->widget(index);
-    bool tabWithAccounts = (widget != ui->textBrowserTab);
-    ui->menuAccount->setEnabled(tabWithAccounts);
-
-    if(ui->tabWidget->currentWidget() == m_dboard)
-    {
-        m_dashboardToolBar->setEnabled(true);
-        m_dashboardToolBar->setHidden(false);
-        m_dboard->showDashboardWidgets();
-    }
-    else
-    {
-        m_dashboardToolBar->setEnabled(false);
-        m_dashboardToolBar->setHidden(true);
-    }
-}
-
-void MainWindow::accountItemActivated(const QModelIndex & index)
-{
-    if (index.model() != m_accountTreeModel
-            && index.model() != m_accountListModel)
-    {
-        qDebug() << "Wrong model; row=" << (index.isValid()? index.row() : -1);
-        return;
-    }
-    Glib::RefPtr<Account> account = Glib::wrap(static_cast< ::Account*>(index.internalPointer()));
-    if (!account)
-    {
-        qDebug() << "Account is null; why?";
-        return;
-    }
-
-    // We create a new model for this account which will query it for
-    // its splits, and also a view widget for this list.
-    QTableView *tableView =
-        new SplitListView(account, m_undoStack, ui->tabWidget);
-    ui->actionCut->setEnabled(tableView->model()->rowCount() > 0);
-
-    // Insert this as a new tab
-    tableView->setProperty(PROPERTY_TAB_PREVIOUSPOS, ui->tabWidget->currentIndex());
-    ui->tabWidget->addTab(tableView, g2q(account->get_name()));
-    ui->tabWidget->setCurrentWidget(tableView);
-
-    connect(tableView->selectionModel(), SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)),
-            this, SLOT(selectionChanged(const QItemSelection &, const QItemSelection & )));
-}
-
-void MainWindow::selectionChanged(const QItemSelection & selected, const QItemSelection & deselected )
-{
-    ui->actionCut->setEnabled(!selected.isEmpty());
-    //ui->actionCopy->setEnabled(!selected.isEmpty());
-}
-
-// Auto-connected to actionCut's signal triggered()
-void MainWindow::on_actionCut_triggered()
-{
-    QWidget *widget = ui->tabWidget->currentWidget();
-    QTableView *tableView = qobject_cast<QTableView *>(widget);
-    if (tableView)
-    {
-//         QModelIndexList selection = tableView->selectionModel()->selectedIndexes();
-//         QSet<int> rows;
-//         Q_FOREACH (QModelIndex index, selection)
-//         {
-//             rows.insert(index.row());
-//         }
-//         qDebug() << "Removing number of rows:" << rows.size();
-        QModelIndex index = tableView->currentIndex();
-        if (!index.isValid())
-            return;
-        QAbstractItemModel *model = tableView->model();
-        Q_ASSERT(model);
-        model->removeRow(index.row());
-    }
-}
-
-// ////////////////////////////////////////////////////////////
-
-void MainWindow::closeEvent(QCloseEvent *event)
-{
-    if (maybeSave())
-    {
-        m_dboard->mainWindowCloseEvent();
-        writeSettings();
-        event->accept();
-
-        /* disable events; otherwise the mass deletion of accounts and
-         * transactions during shutdown would cause massive redraws */
-        qof_event_suspend ();
-
-        gnc_hook_run(HOOK_BOOK_CLOSED, m_session.gobj());
-
-        qof_session_destroy(m_session.gobj());
-        m_session.reset();
-
-        qof_event_resume ();
-    }
-    else
-    {
-        event->ignore();
-    }
-}
-
-void MainWindow::newFile()
-{
-    if (maybeSave())
-    {
-
-        if (m_session)
-        {
-            /* close any ongoing file sessions, and free the accounts.
-             * disable events so we don't gobj spammed by redraws. */
-            qof_event_suspend ();
-
-            gnc_hook_run(HOOK_BOOK_CLOSED, m_session.gobj());
-
-            qof_session_destroy(m_session.gobj());
-            m_session.reset();
-            qof_event_resume ();
-        }
-
-        /* start a new book */
-        m_session.reset(qof_session_new());
-
-        gnc_hook_run(HOOK_NEW_BOOK, NULL);
-
-        /* Call this after re-enabling events. */
-        gnc_hook_run(HOOK_BOOK_OPENED, m_session.gobj());
-
-        setCurrentFile("");
-    }
-}
-
-void MainWindow::dockWidgetsVisibilityChanged(int wdg, bool visible)
-{
-    if (wdg == 0)
-    {
-        /** todo: handle tabs */
-        m_btnTransferFundsWidget->setChecked(visible);
-    }
-}
-
-
-} // END namespace gnc
diff --git a/src/gnc/mainwindow.hpp b/src/gnc/mainwindow.hpp
deleted file mode 100644
index 4e77f40..0000000
--- a/src/gnc/mainwindow.hpp
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * mainwindow.hpp
- * Copyright (C) 2010 Christian Stimming
- *
- * 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 at gnu.org
- */
-
-#ifndef MAINWINDOW_H
-#define MAINWINDOW_H
-
-#include <QMainWindow>
-#include <QItemSelection>
-#include <QSharedPointer>
-#include "gnc/Session.hpp"
-#include "gnc/AccountItemModel.hpp"
-#include "gnc/dashboard.hpp"
-
-class QAction;
-class QMenu;
-class QPlainTextEdit;
-class QTextEdit;
-class QTabWidget;
-class QUndoStack;
-class QToolButton;
-
-namespace Ui
-{
-class MainWindow;
-}
-
-namespace gnc
-{
-
-class RecentFileMenu;
-class Dashboard;
-
-/** The main window of Cutecash.
- *
- * Some of the action parts in here should probably be refactored into
- * separate classes/functions.
- */
-class MainWindow : public QMainWindow
-{
-    Q_OBJECT
-
-public:
-    MainWindow();
-    ~MainWindow();
-
-    const QString& getCurrentFilename() const { return m_currentFilename; }
-    bool hasOpenedFile() const { return !m_currentFilename.isEmpty(); }
-    void dockWidgetsVisibilityChanged(int wdg, bool visible);
-
-public Q_SLOTS:
-    void accountItemActivated(const QModelIndex & index);
-    void loadFileMaybe(const QString &fileName);
-    void documentCleanStateChanged(bool clean);
-
-protected:
-    void closeEvent(QCloseEvent *event);
-
-Q_SIGNALS:
-    void dashboardVisible(bool visible);
-
-private Q_SLOTS:
-    void newFile();
-    void on_actionOpen_triggered();
-    bool on_actionSave_triggered();
-    void on_actionAbout_triggered();
-    bool on_actionSave_as_triggered();
-    void on_actionCloseTab_triggered();
-    void on_actionCut_triggered();
-    void on_tabWidget_tabCloseRequested(int index);
-    void on_tabWidget_currentChanged(int index);
-    void on_textBrowser_anchorClicked(const QUrl &);
-    void on_actionViewAccountTree_triggered(bool checked);
-    void on_actionViewAccountList_triggered(bool checked);
-    void on_actionViewWelcomepage_triggered(bool checked);
-    void on_actionViewDashboard_triggered(bool checked);
-    void documentWasModified();
-    void selectionChanged(const QItemSelection & selected, const QItemSelection & deselected );
-
-private:
-    void createActions();
-    void createToolBars();
-    void createStatusBar();
-    void setIcons();
-    void readSettings();
-    void autoLoadRecentFile();
-    void writeSettings();
-    bool maybeSave();
-    void setCurrentFile(const QString &fileName);
-    QString strippedName(const QString &fullFileName);
-    void viewOrHideTab(bool checkedView, QWidget *widget);
-    void reallyRemoveTab(int index);
-    void updateWindowTitle();
-
-    void loadFile(const QString &fileName);
-    bool saveFile();
-    bool saveFileAs(const QString &fileName);
-
-    typedef enum
-    {
-        GNC_FILE_DIALOG_OPEN,
-        GNC_FILE_DIALOG_IMPORT,
-        GNC_FILE_DIALOG_SAVE,
-        GNC_FILE_DIALOG_EXPORT
-    } GNCFileDialogType;
-    static bool show_session_error (QWidget *parent,
-                                    ::QofBackendError io_error,
-                                    const QString& newfile,
-                                    GNCFileDialogType type);
-
-    QSharedPointer<Ui::MainWindow> ui;
-
-    QString m_currentFilename;
-
-    QToolBar *m_fileToolBar;
-    QToolBar *m_editToolBar;
-    QToolBar *m_dashboardToolBar;
-    QAction *m_actionUndo;
-    QAction *m_actionRedo;
-    QToolButton *m_btnTransferFundsWidget;
-    QSharedPointer<RecentFileMenu> m_menuRecentFiles;
-    QUndoStack *m_undoStack;
-
-    Dashboard *m_dboard;
-
-    Session m_session;
-    AccountListModel *m_accountListModel;
-    AccountTreeModel *m_accountTreeModel;
-};
-
-} // END namespace gnc
-
-#endif
diff --git a/src/gnc/mainwindow.ui b/src/gnc/mainwindow.ui
deleted file mode 100644
index 00c222c..0000000
--- a/src/gnc/mainwindow.ui
+++ /dev/null
@@ -1,430 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>MainWindow</class>
- <widget class="QMainWindow" name="MainWindow">
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>707</width>
-    <height>665</height>
-   </rect>
-  </property>
-  <property name="windowTitle">
-   <string>GnuCash Qt Example</string>
-  </property>
-  <property name="windowIcon">
-   <iconset>
-    <normaloff>:/pixmaps/gnucash-icon-32x32.png</normaloff>:/pixmaps/gnucash-icon-32x32.png</iconset>
-  </property>
-  <widget class="QWidget" name="centralwidget">
-   <layout class="QHBoxLayout" name="horizontalLayout">
-    <property name="leftMargin">
-     <number>0</number>
-    </property>
-    <property name="topMargin">
-     <number>2</number>
-    </property>
-    <property name="rightMargin">
-     <number>0</number>
-    </property>
-    <property name="bottomMargin">
-     <number>0</number>
-    </property>
-    <item>
-     <widget class="QTabWidget" name="tabWidget">
-      <property name="currentIndex">
-       <number>0</number>
-      </property>
-      <property name="documentMode">
-       <bool>true</bool>
-      </property>
-      <property name="tabsClosable">
-       <bool>true</bool>
-      </property>
-      <property name="movable">
-       <bool>true</bool>
-      </property>
-      <widget class="QWidget" name="textBrowserTab">
-       <attribute name="icon">
-        <iconset resource="gtk-icons.qrc">
-         <normaloff>:/gtk-icons/gtk-about.png</normaloff>:/gtk-icons/gtk-about.png</iconset>
-       </attribute>
-       <attribute name="title">
-        <string>Example Welcome Page</string>
-       </attribute>
-       <layout class="QHBoxLayout" name="horizontalLayout_2">
-        <property name="margin">
-         <number>0</number>
-        </property>
-        <item>
-         <widget class="QTextBrowser" name="textBrowser">
-          <property name="html">
-           <string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
-<html><head><meta name="qrichtext" content="1" /><style type="text/css">
-p, li { white-space: pre-wrap; }
-</style></head><body style=" font-family:'Ubuntu'; font-size:9pt; font-weight:400; font-style:normal;">
-<p style=" margin-top:18px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2'; font-size:12pt; font-weight:600;">Cutecash</span></p>
-<p style=" margin-top:18px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2'; font-size:12pt; font-weight:600;">Free Finance Software. Easy to develop, easy to use.</span></p>
-<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2'; font-size:8pt;">Currently this is more or less a proof-of-concept for developers:</span></p>
-<ol style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" font-family:'Sans'; font-size:10pt;" style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Load an existing gnucash XML file</li>
-<li style=" font-family:'Sans'; font-size:10pt;" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">It will show the account tree in a tree view and also a list view </li>
-<li style=" font-family:'Sans'; font-size:10pt;" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Double-click on any account in either view; it will open the list of splits in that account.</li>
-<li style=" font-family:'Sans'; font-size:10pt;" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Save and Save-As works as normal.</li>
-<li style=" font-family:'Sans'; font-size:10pt;" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Edit any of the existing transaction/splits: Date, Description, or Amount. Click Undo. Click Redo. Click Undo. Etc. etc.</li>
-<li style=" font-family:'Sans'; font-size:10pt;" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Delete any of the existings transactions. Or entering a new one. Click Undo. Click Redo. Etc. etc.</li></ol>
-<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans'; font-size:10pt;">The list of splits in the account is comparable to gnucash's single line view.  Amounts, balance, date, all there.</span></p>
-<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans'; font-size:10pt;">The following parts are still missing:</span></p>
-<ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" font-family:'MS Shell Dlg 2'; font-size:8pt;" style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> Currently the accout selection of a transaction cannot be edited. </li>
-<li style=" font-family:'MS Shell Dlg 2'; font-size:8pt;" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Editing or adding multi-split transactions are not yet supported (it shows only the string &quot;--Split Transaction--&quot;). </li>
-<li style=" font-family:'MS Shell Dlg 2'; font-size:8pt;" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Editing or adding multi-currency transactions are not yet supported. </li>
-<li style=" font-family:'MS Shell Dlg 2'; font-size:8pt;" style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Any of the more specialized account views are not yet implemented.</li></ul>
-<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2'; font-size:8pt;">The fun part is how easy it was to add this. Let's see how far we will get...</span></p>
-<p style=" margin-top:16px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2'; font-size:8pt; font-weight:600;">Images</span></p>
-<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><img src=":/pixmaps/gnucash_splash.png" /></p>
-<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2'; font-size:8pt;">We can also embed images here in this compiled-in HTML page, as you can see above. Eventually, this page should explain what this software can do for the new user. Maybe a </span><a href="gnc:test"><span style=" font-family:'Sans'; font-size:10pt; text-decoration: underline; color:#0000ff;">hyperlink </span></a><span style=" font-family:'MS Shell Dlg 2'; font-size:8pt;">here?</span></p></body></html></string>
-          </property>
-          <property name="openLinks">
-           <bool>false</bool>
-          </property>
-         </widget>
-        </item>
-       </layout>
-      </widget>
-      <widget class="QWidget" name="tableViewTab">
-       <attribute name="icon">
-        <iconset resource="gnucash.qrc">
-         <normaloff>:/pixmaps/gnc-account.png</normaloff>:/pixmaps/gnc-account.png</iconset>
-       </attribute>
-       <attribute name="title">
-        <string>Account List</string>
-       </attribute>
-       <layout class="QHBoxLayout" name="horizontalLayout_3">
-        <property name="margin">
-         <number>0</number>
-        </property>
-        <item>
-         <widget class="QTableView" name="tableView">
-          <attribute name="verticalHeaderVisible">
-           <bool>false</bool>
-          </attribute>
-         </widget>
-        </item>
-       </layout>
-      </widget>
-      <widget class="QWidget" name="treeViewTab">
-       <attribute name="icon">
-        <iconset resource="gnucash.qrc">
-         <normaloff>:/pixmaps/gnc-account.png</normaloff>:/pixmaps/gnc-account.png</iconset>
-       </attribute>
-       <attribute name="title">
-        <string>Account Tree</string>
-       </attribute>
-       <layout class="QHBoxLayout" name="horizontalLayout_4">
-        <property name="margin">
-         <number>0</number>
-        </property>
-        <item>
-         <widget class="QTreeView" name="treeView"/>
-        </item>
-       </layout>
-      </widget>
-     </widget>
-    </item>
-   </layout>
-  </widget>
-  <widget class="QMenuBar" name="menubar">
-   <property name="geometry">
-    <rect>
-     <x>0</x>
-     <y>0</y>
-     <width>707</width>
-     <height>21</height>
-    </rect>
-   </property>
-   <widget class="QMenu" name="menuFile">
-    <property name="title">
-     <string>&File</string>
-    </property>
-    <addaction name="actionNew"/>
-    <addaction name="actionOpen"/>
-    <addaction name="actionSave"/>
-    <addaction name="actionSave_as"/>
-    <addaction name="separator"/>
-    <addaction name="actionCloseTab"/>
-    <addaction name="separator"/>
-    <addaction name="actionExit"/>
-   </widget>
-   <widget class="QMenu" name="menuHelp">
-    <property name="title">
-     <string>&Help</string>
-    </property>
-    <addaction name="actionAbout"/>
-    <addaction name="actionAbout_Qt"/>
-   </widget>
-   <widget class="QMenu" name="menuAccount">
-    <property name="enabled">
-     <bool>false</bool>
-    </property>
-    <property name="title">
-     <string>&Account</string>
-    </property>
-    <addaction name="actionOpenAccount"/>
-    <addaction name="actionNewAccount"/>
-    <addaction name="actionDeleteAccount"/>
-    <addaction name="separator"/>
-    <addaction name="actionAccountProperties"/>
-   </widget>
-   <widget class="QMenu" name="menuEdit">
-    <property name="title">
-     <string>&Edit</string>
-    </property>
-    <addaction name="actionCut"/>
-    <addaction name="actionCopy"/>
-    <addaction name="actionPaste"/>
-   </widget>
-   <widget class="QMenu" name="menu_View">
-    <property name="title">
-     <string>&View</string>
-    </property>
-    <addaction name="actionViewWelcomepage"/>
-    <addaction name="actionViewAccountList"/>
-    <addaction name="actionViewAccountTree"/>
-    <addaction name="actionViewDashboard"/>
-   </widget>
-   <addaction name="menuFile"/>
-   <addaction name="menuEdit"/>
-   <addaction name="menu_View"/>
-   <addaction name="menuAccount"/>
-   <addaction name="menuHelp"/>
-  </widget>
-  <widget class="QStatusBar" name="statusbar"/>
-  <action name="actionNew">
-   <property name="text">
-    <string>&New</string>
-   </property>
-   <property name="statusTip">
-    <string>Create a new file</string>
-   </property>
-   <property name="shortcut">
-    <string>Ctrl+N</string>
-   </property>
-  </action>
-  <action name="actionOpen">
-   <property name="text">
-    <string>&Open...</string>
-   </property>
-   <property name="statusTip">
-    <string>Open an existing file</string>
-   </property>
-   <property name="shortcut">
-    <string>Ctrl+O</string>
-   </property>
-  </action>
-  <action name="actionAbout">
-   <property name="text">
-    <string>&About</string>
-   </property>
-  </action>
-  <action name="actionSave">
-   <property name="text">
-    <string>&Save</string>
-   </property>
-   <property name="statusTip">
-    <string>Save the document to disk</string>
-   </property>
-   <property name="shortcut">
-    <string>Ctrl+S</string>
-   </property>
-  </action>
-  <action name="actionSave_as">
-   <property name="text">
-    <string>Save &as...</string>
-   </property>
-   <property name="statusTip">
-    <string>Save the document under a new name</string>
-   </property>
-  </action>
-  <action name="actionExit">
-   <property name="text">
-    <string>E&xit</string>
-   </property>
-   <property name="whatsThis">
-    <string>Exit the application</string>
-   </property>
-   <property name="shortcut">
-    <string>Ctrl+Q</string>
-   </property>
-  </action>
-  <action name="actionNewAccount">
-   <property name="enabled">
-    <bool>false</bool>
-   </property>
-   <property name="icon">
-    <iconset resource="gnucash.qrc">
-     <normaloff>:/pixmaps/gnc-account-new.png</normaloff>:/pixmaps/gnc-account-new.png</iconset>
-   </property>
-   <property name="text">
-    <string>&New...</string>
-   </property>
-  </action>
-  <action name="actionOpenAccount">
-   <property name="enabled">
-    <bool>false</bool>
-   </property>
-   <property name="icon">
-    <iconset resource="gnucash.qrc">
-     <normaloff>:/pixmaps/gnc-account-open.png</normaloff>:/pixmaps/gnc-account-open.png</iconset>
-   </property>
-   <property name="text">
-    <string>&Open</string>
-   </property>
-  </action>
-  <action name="actionAccountProperties">
-   <property name="enabled">
-    <bool>false</bool>
-   </property>
-   <property name="icon">
-    <iconset resource="gnucash.qrc">
-     <normaloff>:/pixmaps/gnc-account-edit.png</normaloff>:/pixmaps/gnc-account-edit.png</iconset>
-   </property>
-   <property name="text">
-    <string>&Properties...</string>
-   </property>
-  </action>
-  <action name="actionCut">
-   <property name="enabled">
-    <bool>false</bool>
-   </property>
-   <property name="text">
-    <string>Cu&t</string>
-   </property>
-  </action>
-  <action name="actionCopy">
-   <property name="enabled">
-    <bool>false</bool>
-   </property>
-   <property name="text">
-    <string>&Copy</string>
-   </property>
-  </action>
-  <action name="actionPaste">
-   <property name="enabled">
-    <bool>false</bool>
-   </property>
-   <property name="text">
-    <string>&Paste</string>
-   </property>
-  </action>
-  <action name="actionDeleteAccount">
-   <property name="enabled">
-    <bool>false</bool>
-   </property>
-   <property name="icon">
-    <iconset resource="gnucash.qrc">
-     <normaloff>:/pixmaps/gnc-account-delete.png</normaloff>:/pixmaps/gnc-account-delete.png</iconset>
-   </property>
-   <property name="text">
-    <string>&Delete...</string>
-   </property>
-  </action>
-  <action name="actionAbout_Qt">
-   <property name="text">
-    <string>About Qt</string>
-   </property>
-  </action>
-  <action name="actionViewWelcomepage">
-   <property name="checkable">
-    <bool>true</bool>
-   </property>
-   <property name="checked">
-    <bool>true</bool>
-   </property>
-   <property name="text">
-    <string>&Welcome Page</string>
-   </property>
-  </action>
-  <action name="actionViewAccountList">
-   <property name="checkable">
-    <bool>true</bool>
-   </property>
-   <property name="checked">
-    <bool>true</bool>
-   </property>
-   <property name="text">
-    <string>Account &List</string>
-   </property>
-  </action>
-  <action name="actionViewAccountTree">
-   <property name="checkable">
-    <bool>true</bool>
-   </property>
-   <property name="checked">
-    <bool>true</bool>
-   </property>
-   <property name="text">
-    <string>Account &Tree</string>
-   </property>
-  </action>
-  <action name="actionCloseTab">
-   <property name="text">
-    <string>&Close Current Tab</string>
-   </property>
-  </action>
-  <action name="actionViewDashboard">
-   <property name="checkable">
-    <bool>true</bool>
-   </property>
-   <property name="checked">
-    <bool>true</bool>
-   </property>
-   <property name="text">
-    <string>&Dashboard</string>
-   </property>
-  </action>
-  <action name="actionViewTransferFunds">
-   <property name="checkable">
-    <bool>true</bool>
-   </property>
-   <property name="checked">
-    <bool>true</bool>
-   </property>
-   <property name="text">
-    <string>&Transfer Funds</string>
-   </property>
-  </action>
-  <action name="actionViewFPO">
-   <property name="checkable">
-    <bool>true</bool>
-   </property>
-   <property name="checked">
-    <bool>true</bool>
-   </property>
-   <property name="text">
-    <string>&FPO</string>
-   </property>
-  </action>
- </widget>
- <resources>
-  <include location="gnucash.qrc"/>
-  <include location="gtk-icons.qrc"/>
- </resources>
- <connections>
-  <connection>
-   <sender>textBrowser</sender>
-   <signal>copyAvailable(bool)</signal>
-   <receiver>actionCopy</receiver>
-   <slot>setEnabled(bool)</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>352</x>
-     <y>343</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>-1</x>
-     <y>-1</y>
-    </hint>
-   </hints>
-  </connection>
- </connections>
-</ui>
diff --git a/src/gnc/metatype.hpp b/src/gnc/metatype.hpp
deleted file mode 100644
index c926d94..0000000
--- a/src/gnc/metatype.hpp
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef METATYPE_HPP
-#define METATYPE_HPP
-
-#include <QMetaType>
-
-#include "config.h"
-#include <gncmm/Account.hpp>
-
-// The macros to declare those types for inclusion in QVariant
-Q_DECLARE_METATYPE(::Account*);
-
-#endif // METATYPE_HPP
diff --git a/src/gnc/qss/default.qss b/src/gnc/qss/default.qss
deleted file mode 100644
index 2b4ed0d..0000000
--- a/src/gnc/qss/default.qss
+++ /dev/null
@@ -1,48 +0,0 @@
-#dateWidget {
-background-color: #FAA0A0;
-color:black;
-border-style: outset;
-border-width: 1px;
-border-radius: 5px;
-border-color: beige;
-
-border-bottom-width: 2px;
-border-bottom-color: darkgray;
-border-bottom-style: solid;
-
-min-width: 12em;
-padding: 2px;
-}
-
-#accountWidget {
-background-color: #A0A1FA;
-border-style: outset;
-border-width: 1px;
-border-radius: 5px;
-border-color: beige;
-padding: 2px;
-
-/* Test with colours */
-/*
-background-color: qlineargradient(x1: 0, y1: 0, x2: 0.5, y2: 0.5,
-                                 stop: 0 #FF92BB, stop: 1 white);
-*/
-}
-
-#descWidget {
-background-color: #A9FAA0;
-border-style: outset;
-border-width: 1px;
-border-radius: 5px;
-border-color: beige;
-padding: 2px;
-}
-
-#amountWidget {
-background-color: #F0F7F0;
-border-style: outset;
-border-width: 1px;
-border-radius: 5px;
-border-color: beige;
-padding: 2px;
-}
diff --git a/src/gnc/stylesheets.qrc b/src/gnc/stylesheets.qrc
deleted file mode 100644
index 9d422f7..0000000
--- a/src/gnc/stylesheets.qrc
+++ /dev/null
@@ -1,5 +0,0 @@
-<RCC>
-    <qresource prefix="/">
-        <file alias="qss-default">qss/default.qss</file>
-    </qresource>
-</RCC>
diff --git a/src/optional/CMakeLists.txt b/src/optional/CMakeLists.txt
index 3fe88da..320b387 100644
--- a/src/optional/CMakeLists.txt
+++ b/src/optional/CMakeLists.txt
@@ -1,5 +1,4 @@
 ADD_SUBDIRECTORY(python-bindings)
-ADD_SUBDIRECTORY(gtkmm)
 
 SET_LOCAL_DIST(optional_DIST_local CMakeLists.txt Makefile.am)
-SET(optional_DIST ${optional_DIST_local} ${gtkmm_DIST} ${python_bindings_DIST} PARENT_SCOPE)
\ No newline at end of file
+SET(optional_DIST ${optional_DIST_local} ${python_bindings_DIST} PARENT_SCOPE)
diff --git a/src/optional/Makefile.am b/src/optional/Makefile.am
index 14cda7a..73573b1 100644
--- a/src/optional/Makefile.am
+++ b/src/optional/Makefile.am
@@ -1,9 +1,6 @@
 if WITH_PYTHON
     PYTHON_BINDINGS_DIR = python-bindings
 endif
-if WITH_GTKMM
-    GTKMM_DIR=gtkmm
-endif
-SUBDIRS = ${PYTHON_BINDINGS_DIR} ${GTKMM_DIR}
+SUBDIRS = ${PYTHON_BINDINGS_DIR}
 
 EXTRA_DIST = CMakeLists.txt
diff --git a/src/optional/gtkmm/CMakeLists.txt b/src/optional/gtkmm/CMakeLists.txt
deleted file mode 100644
index ad777a0..0000000
--- a/src/optional/gtkmm/CMakeLists.txt
+++ /dev/null
@@ -1,63 +0,0 @@
-# CMakeLists.txt for src/optional/gtkmm
-#ADD_SUBDIRECTORY(gncmm)
-ADD_SUBDIRECTORY(test)
-
-
-ADD_DEFINITIONS (-DG_LOG_DOMAIN=\"gnc.gtkmm\")
-
-INCLUDE_DIRECTORIES (${GLIB2_INCLUDE_DIRS})
-INCLUDE_DIRECTORIES (${GLIBMM_INCLUDE_DIRS})
-INCLUDE_DIRECTORIES (${LIBINTL_INCLUDE_PATH})
-INCLUDE_DIRECTORIES (${REGEX_INCLUDE_PATH})
-INCLUDE_DIRECTORIES (${GUILE_INCLUDE_DIRS})
-INCLUDE_DIRECTORIES (${CMAKE_BINARY_DIR}/src ) # for config.h
-INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/src ) # for gnc-ui.h
-INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/src/gnc-module) # for gnc-glib-utils.h
-INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/src/core-utils) # for gnc-glib-utils.h
-INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/src/engine) # for gnc-glib-utils.h
-INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/src/backend/xml)
-INCLUDE_DIRECTORIES (${CMAKE_BINARY_DIR}/src/engine) # for swig-runtime.h
-
-SET (libgncmod_gtkmm_HEADERS
-  gncmm/Account.hpp
-  gncmm/Book.hpp
-  gncmm/Commodity.hpp
-  gncmm/GncInstance.hpp
-  gncmm/Numeric.hpp
-  gncmm/Split.hpp
-  gncmm/Transaction.hpp
-  gncmm/private/Account_p.hpp
-  gncmm/private/Book_p.hpp
-  gncmm/private/Commodity_p.hpp
-  gncmm/private/GncInstance_p.hpp
-  gncmm/private/Split_p.hpp
-  gncmm/private/Transaction_p.hpp
-  gncmm/wrap_init.hpp
-)
-
-SET (libgncmod_gtkmm_SOURCES
-  gncmm/Account.cpp
-  gncmm/Book.cpp
-  gncmm/Commodity.cpp
-  gncmm/GncInstance.cpp
-  gncmm/Numeric.cpp
-  gncmm/Split.cpp
-  gncmm/Transaction.cpp
-  gncmm/wrap_init.cpp
-)
-
-SET(gnc_plugin_SOURCES gnc-plugin-gtkmm.cpp gncmod-gtkmm.cpp)
-SET(gnc_plugin_noinst_SOURCES gnc-plugin-gtkmm.hpp)
-SET(gnc_plugin_UI gnc-plugin-gtkmm-ui.xml)
-
-IF (WITH_CUTECASH)
-  ADD_LIBRARY (libgncmod-gtkmm
-    ${libgncmod_gtkmm_SOURCES}
-    ${libgncmod_gtkmm_HEADERS}
-  )
-ENDIF()
-
-SET_LOCAL_DIST(gtkmm_DIST_local CMakeLists.txt Makefile.am
-        ${libgncmod_gtkmm_SOURCES} ${libgncmod_gtkmm_HEADERS}
-        ${gnc_plugin_SOURCES} ${gnc_plugin_noinst_SOURCES} ${gnc_plugin_UI})
-SET(gtkmm_DIST ${gtkmm_DIST_local} ${test_gtkmm_DIST} PARENT_SCOPE)
diff --git a/src/optional/gtkmm/Makefile.am b/src/optional/gtkmm/Makefile.am
deleted file mode 100644
index 7b4be86..0000000
--- a/src/optional/gtkmm/Makefile.am
+++ /dev/null
@@ -1,62 +0,0 @@
-SUBDIRS = . test
-
-pkglib_LTLIBRARIES = libgncmod-gtkmm.la
-
-libgncmod_gtkmm_la_SOURCES = \
-  gncmm/Account.cpp \
-  gncmm/Book.cpp \
-  gncmm/Commodity.cpp \
-  gncmm/GncInstance.cpp \
-  gncmm/Numeric.cpp \
-  gncmm/Split.cpp \
-  gncmm/Transaction.cpp \
-  gncmm/wrap_init.cpp \
-  gnc-plugin-gtkmm.cpp \
-  gncmod-gtkmm.cpp
-
-noinst_HEADERS = \
-  gncmm/Account.hpp \
-  gncmm/Book.hpp \
-  gncmm/Commodity.hpp \
-  gncmm/GncInstance.hpp \
-  gncmm/Numeric.hpp \
-  gncmm/Split.hpp \
-  gncmm/Transaction.hpp \
-  gncmm/private/Account_p.hpp \
-  gncmm/private/Book_p.hpp \
-  gncmm/private/Commodity_p.hpp \
-  gncmm/private/GncInstance_p.hpp \
-  gncmm/private/Split_p.hpp \
-  gncmm/private/Transaction_p.hpp \
-  gncmm/wrap_init.hpp \
-  gnc-plugin-gtkmm.hpp
-
-libgncmod_gtkmm_la_LDFLAGS = -avoid-version
-
-libgncmod_gtkmm_la_LIBADD = \
-  ${top_builddir}/src/gnome/libgnc-gnome.la \
-  ${top_builddir}/src/gnome-utils/libgncmod-gnome-utils.la \
-  ${top_builddir}/src/app-utils/libgncmod-app-utils.la \
-  ${top_builddir}/src/engine/libgncmod-engine.la \
-  ${top_builddir}/src/core-utils/libgnc-core-utils.la \
-  ${top_builddir}/src/gnc-module/libgnc-module.la \
-  ${GTKMM_LIBS} \
-  ${GLIB_LIBS}
-
-AM_CPPFLAGS = \
-  -I${top_srcdir}/src \
-  -I${top_srcdir}/src/gnc-module \
-  -I${top_srcdir}/src/core-utils \
-  -I${top_srcdir}/src/engine \
-  ${GTKMM_CFLAGS} \
-  ${GLIB_CFLAGS}
-
-uidir = $(GNC_UI_DIR)
-ui_DATA = gnc-plugin-gtkmm-ui.xml
-
-gtkbuilderdir = $(GNC_GTKBUILDER_DIR)
-gtkbuilder_DATA =
-
-EXTRA_DIST = ${ui_DATA} ${gtkbuilder_DATA} CMakeLists.txt
-
-AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.gui.gtkmm\"
diff --git a/src/optional/gtkmm/gnc-plugin-gtkmm-ui.xml b/src/optional/gtkmm/gnc-plugin-gtkmm-ui.xml
deleted file mode 100644
index a4b3460..0000000
--- a/src/optional/gtkmm/gnc-plugin-gtkmm-ui.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<ui>
-  <menubar>
-    <menu name="File" action="FileAction">
-      <menu name="FileImport" action="FileImportAction">
-      	<placeholder name="FileImportPlaceholder">
-      	   <menuitem name="FileSomethingImport" action="GtkmmSomethingAction"/>
-      	</placeholder>
-      </menu>
-    </menu>
-  </menubar>
-</ui>
diff --git a/src/optional/gtkmm/gnc-plugin-gtkmm.cpp b/src/optional/gtkmm/gnc-plugin-gtkmm.cpp
deleted file mode 100644
index ae94f08..0000000
--- a/src/optional/gtkmm/gnc-plugin-gtkmm.cpp
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- * gnc-plugin-gtkmm.cpp --
- *
- * 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 at gnu.org
- */
-
-/**
- * @internal
- * @file
- * @brief Plugin registration of the Gtkmm module
- * @author Copyright (C) 2011 Christian Stimming <christian at cstimming.de>
- */
-
-#include "config.h"
-
-#include <gtk/gtk.h>
-#include <glib/gi18n.h>
-extern "C" {
-#include "gnome-utils/gnc-plugin-manager.h"
-#include "gnome-utils/gnc-main-window.h"
-#include "engine/Account.h"
-}
-
-#include "gnc-plugin-gtkmm.hpp"
-#include <gtkmm.h>
-
-namespace gncmm
-{
-
-// This static indicates the debugging module that this .o belongs to.
-static QofLogModule log_module = G_LOG_DOMAIN;
-
-static void gnc_plugin_gtkmm_class_init (GncPluginGtkmmClass *klass);
-static void gnc_plugin_gtkmm_init (GncPluginGtkmm *plugin);
-static void gnc_plugin_gtkmm_finalize (GObject *object);
-
-/* Command callbacks */
-static void gnc_plugin_gtkmm_cmd_something (GtkAction *action, GncMainWindowActionData *data);
-
-#define PLUGIN_ACTIONS_NAME "gnc-plugin-gtkmm-actions"
-#define PLUGIN_UI_FILENAME  "gnc-plugin-gtkmm-ui.xml"
-
-static GtkActionEntry gnc_plugin_actions [] =
-{
-    {
-        // FIXME: I've intentionally remove the i18n markers so that
-        // translators don't have to deal with these example strings!
-        "GtkmmSomethingAction", NULL, "Do _Something in C++/gtkmm...", NULL,
-        "This demonstrates how to integrate C++/gtkmm in a plugin of gnucash",
-        G_CALLBACK (gnc_plugin_gtkmm_cmd_something)
-    },
-};
-static guint gnc_plugin_n_actions = G_N_ELEMENTS (gnc_plugin_actions);
-
-struct GncPluginGtkmmPrivate
-{
-    gpointer dummy;
-};
-
-#define GNC_PLUGIN_GTKMM_GET_PRIVATE(o)  \
-   (G_TYPE_INSTANCE_GET_PRIVATE ((o), GNC_TYPE_PLUGIN_GTKMM, GncPluginGtkmmPrivate))
-
-static GObjectClass *parent_class = NULL;
-
-GType
-gnc_plugin_gtkmm_get_type (void)
-{
-    static GType gnc_plugin_gtkmm_type = 0;
-
-    if (gnc_plugin_gtkmm_type == 0)
-    {
-        static const GTypeInfo our_info =
-        {
-            sizeof (GncPluginGtkmmClass),
-            NULL,		/* base_init */
-            NULL,		/* base_finalize */
-            (GClassInitFunc) gnc_plugin_gtkmm_class_init,
-            NULL,		/* class_finalize */
-            NULL,		/* class_data */
-            sizeof (GncPluginGtkmm),
-            0,		/* n_preallocs */
-            (GInstanceInitFunc) gnc_plugin_gtkmm_init,
-        };
-
-        gnc_plugin_gtkmm_type = g_type_register_static (GNC_TYPE_PLUGIN,
-                                "GncPluginGtkmm",
-                                &our_info, GTypeFlags(0));
-    }
-
-    return gnc_plugin_gtkmm_type;
-}
-
-GncPlugin *
-gnc_plugin_gtkmm_new (void)
-{
-    return GNC_PLUGIN (g_object_new (GNC_TYPE_PLUGIN_GTKMM, NULL));
-}
-
-static void
-gnc_plugin_gtkmm_class_init (GncPluginGtkmmClass *klass)
-{
-    GObjectClass *object_class = G_OBJECT_CLASS (klass);
-    GncPluginClass *plugin_class = GNC_PLUGIN_CLASS (klass);
-
-    parent_class = reinterpret_cast<GObjectClass *>(g_type_class_peek_parent (klass));
-
-    object_class->finalize = gnc_plugin_gtkmm_finalize;
-
-    // plugin info
-    plugin_class->plugin_name  = GNC_PLUGIN_GTKMM_NAME;
-
-    // widget addition/removal
-    plugin_class->actions_name = PLUGIN_ACTIONS_NAME;
-    plugin_class->actions      = gnc_plugin_actions;
-    plugin_class->n_actions    = gnc_plugin_n_actions;
-    plugin_class->ui_filename  = PLUGIN_UI_FILENAME;
-
-    g_type_class_add_private(klass, sizeof(GncPluginGtkmmPrivate));
-}
-
-static void
-gnc_plugin_gtkmm_init (GncPluginGtkmm *plugin)
-{
-}
-
-static void
-gnc_plugin_gtkmm_finalize (GObject *object)
-{
-    g_return_if_fail (GNC_IS_PLUGIN_GTKMM (object));
-
-    GncPluginGtkmm *plugin = GNC_PLUGIN_GTKMM (object);
-    GncPluginGtkmmPrivate *priv = GNC_PLUGIN_GTKMM_GET_PRIVATE(plugin);
-
-    G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-/************************************************************
- *              Plugin Function Implementation              *
- ************************************************************/
-
-/************************************************************
- *                    Command Callbacks                     *
- ************************************************************/
-
-static void
-gnc_plugin_gtkmm_cmd_something (GtkAction *action,
-                                GncMainWindowActionData *data)
-{
-    // Now we're gonna do something.
-    ENTER("action %p, main window data %p", action, data);
-    g_return_if_fail(data);
-
-//     ::Account *c_account = NULL;//main_window_to_account(data->window);
-//     Glib::RefPtr<Glib::Object> account_ptr = Glib::wrap(c_account);
-
-    LEAVE("");
-}
-
-
-/************************************************************
- *                    Plugin Bootstrapping                   *
- ************************************************************/
-
-void
-gnc_plugin_gtkmm_create_plugin (void)
-{
-    GncPlugin *plugin = gnc_plugin_gtkmm_new ();
-
-    gnc_plugin_manager_add_plugin (gnc_plugin_manager_get (), plugin);
-}
-
-} // END namespace gncmm
diff --git a/src/optional/gtkmm/gnc-plugin-gtkmm.hpp b/src/optional/gtkmm/gnc-plugin-gtkmm.hpp
deleted file mode 100644
index e5a0b3d..0000000
--- a/src/optional/gtkmm/gnc-plugin-gtkmm.hpp
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * gnc-plugin-gtkmm.h --
- *
- * 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 at gnu.org
- */
-
-/**
- * @addtogroup GUI
- * @{
- * @addtogroup Gtkmm
- * @{
- * @file
- * @brief Plugin registration of the Gtkmm module
- * @author Copyright (C) 2011 Christian Stimming <christian at cstimming.de>
- */
-
-#ifndef GNC_PLUGIN_GTKMM_H
-#define GNC_PLUGIN_GTKMM_H
-
-#include <glib.h>
-extern "C" {
-#include "gnome-utils/gnc-plugin.h"
-}
-
-namespace gncmm
-{
-
-G_BEGIN_DECLS
-
-/* type macros */
-#define GNC_TYPE_PLUGIN_GTKMM            (gnc_plugin_gtkmm_get_type())
-#define GNC_PLUGIN_GTKMM(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), GNC_TYPE_PLUGIN_GTKMM, GncPluginGtkmm))
-#define GNC_PLUGIN_GTKMM_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass), GNC_TYPE_PLUGIN_GTKMM, GncPluginGtkmmClass))
-#define GNC_IS_PLUGIN_GTKMM(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), GNC_TYPE_PLUGIN_GTKMM))
-#define GNC_IS_PLUGIN_GTKMM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GNC_TYPE_PLUGIN_GTKMM))
-#define GNC_PLUGIN_GTKMM_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), GNC_TYPE_PLUGIN_GTKMM, GncPluginGtkmmClass))
-
-#define GNC_PLUGIN_GTKMM_NAME "gnc-plugin-gtkmm"
-
-/* typedefs & structures */
-struct GncPluginGtkmm
-{
-    GncPlugin gnc_plugin;
-};
-
-struct GncPluginGtkmmClass
-{
-    GncPluginClass gnc_plugin;
-};
-
-/* function prototypes */
-
-/**
- * @return The glib runtime type of an gtkmm plugin page
- **/
-GType gnc_plugin_gtkmm_get_type(void);
-
-/**
- * @return A new GncPluginGtkmm object
- */
-GncPlugin* gnc_plugin_gtkmm_new(void);
-
-/**
- * Create a new GncPluginGtkmm object and register it.
- */
-void gnc_plugin_gtkmm_create_plugin(void);
-
-G_END_DECLS
-
-} // END namespace gncmm
-
-/** @} */
-/** @} */
-
-#endif /* GNC_PLUGIN_GTKMM_H */
diff --git a/src/optional/gtkmm/gncmm/Account.cpp b/src/optional/gtkmm/gncmm/Account.cpp
deleted file mode 100644
index 6c67822..0000000
--- a/src/optional/gtkmm/gncmm/Account.cpp
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Account.cpp
- * Copyright (C) 2011 Christian Stimming
- *
- * 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 at gnu.org
- */
-
-#include "config.h"
-#include "Account.hpp"
-#include "private/Account_p.hpp"
-#include "Commodity.hpp"
-
-namespace Glib
-{
-
-Glib::RefPtr<gnc::Account> wrap(::Account* object, bool refuse_ownership)
-{
-    return Glib::RefPtr<gnc::Account>( dynamic_cast<gnc::Account*> (Glib::wrap_auto ((GObject*)(object), refuse_ownership)) );
-    //We use dynamic_cast<> in case of multiple inheritance.
-}
-
-} /* namespace Glib */
-
-
-namespace gnc
-{
-
-
-/* The *_Class implementation: */
-
-const Glib::Class& Account_Class::init()
-{
-    if (!gtype_) // create the GType if necessary
-    {
-        // Glib::Class has to know the class init function to clone custom types.
-        class_init_func_ = &Account_Class::class_init_function;
-
-        // This is actually just optimized away, apparently with no harm.
-        // Make sure that the parent type has been created.
-        //CppClassParent::CppObjectType::get_type();
-
-        // Create the wrapper type, with the same class/instance size as the base type.
-        register_derived_type(gnc_account_get_type());
-
-        // Add derived versions of interfaces, if the C type implements any interfaces:
-
-    }
-
-    return *this;
-}
-
-
-void Account_Class::class_init_function(void* g_class, void* class_data)
-{
-    BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
-    CppClassParent::class_init_function(klass, class_data);
-}
-
-
-Glib::ObjectBase* Account_Class::wrap_new(GObject* object)
-{
-    return new Account((::Account*)object);
-}
-
-
-/* The implementation: */
-
-::Account* Account::gobj_copy()
-{
-    reference();
-    return gobj();
-}
-
-Account::Account(const Glib::ConstructParams& construct_params)
-    : GncInstance(construct_params)
-{
-
-}
-
-Account::Account(::Account* castitem)
-    : GncInstance((::QofInstance*)(castitem))
-{}
-
-
-Account::~Account()
-{}
-
-
-Account::CppClassType Account::account_class_; // initialize static member
-
-GType Account::get_type()
-{
-    return account_class_.init().get_type();
-}
-
-
-GType Account::get_base_type()
-{
-    return gnc_account_get_type();
-}
-
-
-
-Glib::RefPtr<Commodity> Account::get_commodity() const
-{
-    return Glib::wrap(xaccAccountGetCommodity(gobj()));
-}
-Glib::RefPtr<Account> Account::get_parent() const
-{
-    return Glib::wrap(gnc_account_get_parent(gobj()));
-}
-Glib::RefPtr<Account> Account::get_root()
-{
-    return Glib::wrap(gnc_account_get_root(gobj()));
-}
-Glib::RefPtr<Account> Account::get_nth_child (gint num) const
-{
-    return Glib::wrap(gnc_account_nth_child(gobj(), num));
-}
-
-} // END namespace gnc
diff --git a/src/optional/gtkmm/gncmm/Account.hpp b/src/optional/gtkmm/gncmm/Account.hpp
deleted file mode 100644
index 5761882..0000000
--- a/src/optional/gtkmm/gncmm/Account.hpp
+++ /dev/null
@@ -1,194 +0,0 @@
-/*
- * Account.hpp
- * Copyright (C) 2011 Christian Stimming
- *
- * 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 at gnu.org
- */
-
-#ifndef GNC_ACCOUNT_HPP
-#define GNC_ACCOUNT_HPP
-
-// gnucash includes
-#include "engine/guid.hpp"
-extern "C"
-{
-#include "qof.h"
-#include "engine/Account.h"
-}
-
-#include <glibmm/object.h>
-#include <glibmm/ustring.h>
-
-#include "Numeric.hpp"
-#include "GncInstance.hpp"
-
-namespace gnc
-{
-class Account_Class;
-} // END namespace gnc
-
-namespace gnc
-{
-class Account;
-class Commodity;
-
-/** Wrapper around a gnucash ::Account pointer with C++ methods for
- * easier setter and getter access.
- */
-class Account : public GncInstance
-{
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
-    typedef Account CppObjectType;
-    typedef Account_Class CppClassType;
-    typedef ::Account BaseObjectType;
-    typedef ::AccountClass BaseClassType;
-
-private:
-    friend class Account_Class;
-    static CppClassType account_class_;
-
-private:
-    // noncopyable
-    Account(const Account&);
-    Account& operator=(const Account&);
-
-protected:
-    explicit Account(const Glib::ConstructParams& construct_params);
-    explicit Account(::Account* castitem);
-
-#endif /* DOXYGEN_SHOULD_SKIP_THIS */
-
-public:
-    virtual ~Account();
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
-    static GType get_type()      G_GNUC_CONST;
-    static GType get_base_type() G_GNUC_CONST;
-#endif
-
-    ///Provides access to the underlying C GObject.
-    ::Account*       gobj()
-    {
-        return reinterpret_cast< ::Account*>(gobject_);
-    }
-
-    ///Provides access to the underlying C GObject.
-    const ::Account* gobj() const
-    {
-        return reinterpret_cast< ::Account*>(gobject_);
-    }
-
-    ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
-    ::Account* gobj_copy();
-
-private:
-public:
-
-
-    // actual implementation follows here
-
-    Glib::ustring get_name() const
-    {
-        return (xaccAccountGetName(gobj()));
-    }
-    Glib::ustring get_full_name() const
-    {
-        return gchar_to_ustring(gnc_account_get_full_name (gobj()));
-    }
-    Glib::ustring get_code() const
-    {
-        return (xaccAccountGetCode(gobj()));
-    }
-    Glib::ustring get_description() const
-    {
-        return (xaccAccountGetDescription(gobj()));
-    }
-    Glib::RefPtr<Commodity> get_commodity() const;
-    int get_commodity_scu() const
-    {
-        return xaccAccountGetCommoditySCU(gobj());
-    }
-
-    ::SplitList* get_split_list() const
-    {
-        return xaccAccountGetSplitList(gobj());
-    }
-
-    /** @name Account tree traversal */
-    //@{
-
-    Glib::RefPtr<Account> get_parent() const;
-    Glib::RefPtr<Account> get_root();
-    bool is_root() const
-    {
-        return gnc_account_is_root(gobj());
-    }
-    gint get_num_children() const
-    {
-        return gnc_account_n_children(gobj());
-    }
-    GList *get_children() const
-    {
-        return gnc_account_get_children(gobj());
-    }
-    GList *get_descendants () const
-    {
-        return gnc_account_get_descendants (gobj());
-    }
-    Glib::RefPtr<Account> get_nth_child (gint num) const;
-
-
-    /** Return the index of this account in the children's list of its
-     * parent account.
-     */
-    gint child_index () const
-    {
-        Glib::RefPtr<Account> parent(get_parent());
-        if (parent && parent->gobj())
-            return gnc_account_child_index(parent->gobj(), gobj());
-        else
-            return 0;
-    }
-
-    gint get_current_depth () const
-    {
-        return gnc_account_get_current_depth(gobj());
-    }
-    gint get_tree_depth () const
-    {
-        return gnc_account_get_tree_depth(gobj());
-    }
-    //@}
-
-};
-
-} // END namespace gnc
-
-namespace Glib
-{
-/** A Glib::wrap() method for this object.
- *
- * @param object The C instance.
- * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
- * @result A C++ instance that wraps this C instance.
- *
- * @relates Gio::FileInfo
- */
-Glib::RefPtr<gnc::Account> wrap(::Account* object, bool refuse_ownership = true);
-}
-
-#endif
diff --git a/src/optional/gtkmm/gncmm/Book.cpp b/src/optional/gtkmm/gncmm/Book.cpp
deleted file mode 100644
index a8fc38a..0000000
--- a/src/optional/gtkmm/gncmm/Book.cpp
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Book.cpp
- * Copyright (C) 2011 Christian Stimming
- *
- * 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 at gnu.org
- */
-
-#include "config.h"
-#include "Book.hpp"
-#include "private/Book_p.hpp"
-#include "Account.hpp"
-
-namespace Glib
-{
-
-Glib::RefPtr<gnc::Book> wrap(QofBook* object, bool take_copy)
-{
-    return Glib::RefPtr<gnc::Book>( dynamic_cast<gnc::Book*> (Glib::wrap_auto ((GObject*)(object), take_copy)) );
-    //We use dynamic_cast<> in case of multiple inheritance.
-}
-
-} /* namespace Glib */
-
-
-namespace gnc
-{
-
-
-/* The *_Class implementation: */
-
-const Glib::Class& Book_Class::init()
-{
-    if (!gtype_) // create the GType if necessary
-    {
-        // Glib::Class has to know the class init function to clone custom types.
-        class_init_func_ = &Book_Class::class_init_function;
-
-        // This is actually just optimized away, apparently with no harm.
-        // Make sure that the parent type has been created.
-        //CppClassParent::CppObjectType::get_type();
-
-        // Create the wrapper type, with the same class/instance size as the base type.
-        register_derived_type(qof_book_get_type());
-
-        // Add derived versions of interfaces, if the C type implements any interfaces:
-
-    }
-
-    return *this;
-}
-
-
-void Book_Class::class_init_function(void* g_class, void* class_data)
-{
-    BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
-    CppClassParent::class_init_function(klass, class_data);
-}
-
-
-Glib::ObjectBase* Book_Class::wrap_new(GObject* object)
-{
-    return new Book((QofBook*)object);
-}
-
-
-/* The implementation: */
-
-QofBook* Book::gobj_copy()
-{
-    reference();
-    return gobj();
-}
-
-Book::Book(const Glib::ConstructParams& construct_params)
-    : GncInstance(construct_params)
-{
-
-}
-
-Book::Book(QofBook* castitem)
-    : GncInstance((::QofInstance*)(castitem))
-{}
-
-
-Book::~Book()
-{}
-
-
-Book::CppClassType Book::book_class_; // initialize static member
-
-GType Book::get_type()
-{
-    return book_class_.init().get_type();
-}
-
-
-GType Book::get_base_type()
-{
-    return qof_book_get_type();
-}
-
-
-void Book::string_option_set (const Glib::ustring& opt_name, const Glib::ustring& opt_val)
-{
-    qof_book_set_string_option(gobj(), opt_name.c_str(), opt_val.c_str());
-}
-
-Glib::ustring Book::string_option_get (const Glib::ustring& opt_name) const
-{
-    const char* r = qof_book_get_string_option(gobj(), opt_name.c_str());
-    if (r)
-        return r;
-    else
-        return "";
-}
-bool Book::string_option_exists (const Glib::ustring& opt_name) const
-{
-    const char* r = qof_book_get_string_option(gobj(), opt_name.c_str());
-    if (r)
-        return true;
-    else
-        return false;
-}
-
-Glib::RefPtr<Account> Book::get_root_account()
-{
-    return Glib::wrap(gnc_book_get_root_account (gobj()));
-}
-
-} // END namespace gnc
diff --git a/src/optional/gtkmm/gncmm/Book.hpp b/src/optional/gtkmm/gncmm/Book.hpp
deleted file mode 100644
index 2795166..0000000
--- a/src/optional/gtkmm/gncmm/Book.hpp
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Book.hpp
- * Copyright (C) 2011 Christian Stimming
- *
- * 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 at gnu.org
- */
-
-#ifndef GNC_BOOK_HPP
-#define GNC_BOOK_HPP
-
-// gnucash includes
-#include "engine/guid.hpp"
-extern "C"
-{
-#include "qof.h"
-#include "engine/gnc-hooks.h"
-#include "engine/Account.h"
-}
-
-#include <glibmm/object.h>
-#include "GncInstance.hpp"
-
-namespace gnc
-{
-class Book_Class;
-class Book;
-class GncInstance;
-} // END namespace gnc
-
-namespace gnc
-{
-class Account;
-
-/** Wrapper around a gnucash ::QofBook pointer with C++ methods for
- * easier setter and getter access.
- */
-class Book : public GncInstance
-{
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
-    typedef Book CppObjectType;
-    typedef Book_Class CppClassType;
-    typedef ::QofBook BaseObjectType;
-    typedef ::QofBookClass BaseClassType;
-
-private:
-    friend class Book_Class;
-    static CppClassType book_class_;
-
-private:
-    // noncopyable
-    Book(const Book&);
-    Book& operator=(const Book&);
-
-protected:
-    explicit Book(const Glib::ConstructParams& construct_params);
-    explicit Book(QofBook* castitem);
-
-#endif /* DOXYGEN_SHOULD_SKIP_THIS */
-
-public:
-    virtual ~Book();
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
-    static GType get_type()      G_GNUC_CONST;
-    static GType get_base_type() G_GNUC_CONST;
-#endif
-
-    ///Provides access to the underlying C GObject.
-    QofBook*       gobj()
-    {
-        return reinterpret_cast<QofBook*>(gobject_);
-    }
-
-    ///Provides access to the underlying C GObject.
-    const QofBook* gobj() const
-    {
-        return reinterpret_cast<QofBook*>(gobject_);
-    }
-
-    ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
-    QofBook* gobj_copy();
-
-private:
-public:
-
-
-    Glib::RefPtr<Account> get_root_account();
-    bool is_readonly() const
-    {
-        return qof_book_is_readonly(gobj());
-    }
-    void mark_readonly()
-    {
-        qof_book_mark_readonly(gobj());
-    }
-    void string_option_set (const Glib::ustring& opt_name, const Glib::ustring& opt_val);
-    Glib::ustring string_option_get (const Glib::ustring& opt_name) const;
-    bool string_option_exists (const Glib::ustring& opt_name) const;
-};
-
-} // END namespace gnc
-
-namespace Glib
-{
-/** A Glib::wrap() method for this object.
- *
- * @param object The C instance.
- * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
- * @result A C++ instance that wraps this C instance.
- *
- * @relates Gio::FileInfo
- */
-Glib::RefPtr<gnc::Book> wrap(::QofBook* object, bool refuse_ownership = true);
-}
-
-#endif
diff --git a/src/optional/gtkmm/gncmm/Commodity.cpp b/src/optional/gtkmm/gncmm/Commodity.cpp
deleted file mode 100644
index 6b291a5..0000000
--- a/src/optional/gtkmm/gncmm/Commodity.cpp
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Commodity.cpp
- * Copyright (C) 2011 Christian Stimming
- *
- * 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 at gnu.org
- */
-
-#include "Commodity.hpp"
-#include "private/Commodity_p.hpp"
-
-
-namespace Glib
-{
-
-Glib::RefPtr<gnc::Commodity> wrap(gnc_commodity* object, bool take_copy)
-{
-    return Glib::RefPtr<gnc::Commodity>( dynamic_cast<gnc::Commodity*> (Glib::wrap_auto ((GObject*)(object), take_copy)) );
-    //We use dynamic_cast<> in case of multiple inheritance.
-}
-
-} /* namespace Glib */
-
-
-namespace gnc
-{
-
-
-/* The *_Class implementation: */
-
-const Glib::Class& Commodity_Class::init()
-{
-    if (!gtype_) // create the GType if necessary
-    {
-        // Glib::Class has to know the class init function to clone custom types.
-        class_init_func_ = &Commodity_Class::class_init_function;
-
-        // This is actually just optimized away, apparently with no harm.
-        // Make sure that the parent type has been created.
-        //CppClassParent::CppObjectType::get_type();
-
-        // Create the wrapper type, with the same class/instance size as the base type.
-        register_derived_type(gnc_commodity_get_type());
-
-        // Add derived versions of interfaces, if the C type implements any interfaces:
-
-    }
-
-    return *this;
-}
-
-
-void Commodity_Class::class_init_function(void* g_class, void* class_data)
-{
-    BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
-    CppClassParent::class_init_function(klass, class_data);
-}
-
-
-Glib::ObjectBase* Commodity_Class::wrap_new(GObject* object)
-{
-    return new Commodity((gnc_commodity*)object);
-}
-
-
-/* The implementation: */
-
-gnc_commodity* Commodity::gobj_copy()
-{
-    reference();
-    return gobj();
-}
-
-Commodity::Commodity(const Glib::ConstructParams& construct_params)
-    : GncInstance(construct_params)
-{
-
-}
-
-Commodity::Commodity(gnc_commodity* castitem)
-    : GncInstance((::QofInstance*)(castitem))
-{}
-
-
-Commodity::~Commodity()
-{}
-
-
-Commodity::CppClassType Commodity::commodity_class_; // initialize static member
-
-GType Commodity::get_type()
-{
-    return commodity_class_.init().get_type();
-}
-
-
-GType Commodity::get_base_type()
-{
-    return gnc_commodity_get_type();
-}
-
-
-
-} // END namespace gnc
diff --git a/src/optional/gtkmm/gncmm/Commodity.hpp b/src/optional/gtkmm/gncmm/Commodity.hpp
deleted file mode 100644
index f2e9f9f..0000000
--- a/src/optional/gtkmm/gncmm/Commodity.hpp
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * Commodity.hpp
- * Copyright (C) 2011 Christian Stimming
- *
- * 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 at gnu.org
- */
-
-#ifndef GNC_COMMODITY_HPP
-#define GNC_COMMODITY_HPP
-
-// gnucash includes
-#include "config.h"
-#include "engine/guid.hpp"
-extern "C"
-{
-#include "qof.h"
-#include "engine/gnc-commodity.h"
-}
-
-#include <glibmm/object.h>
-#include <glibmm/ustring.h>
-#include "GncInstance.hpp"
-
-namespace gnc
-{
-class Commodity_Class;
-} // END namespace gnc
-
-namespace gnc
-{
-
-/** Wrapper around a gnucash \ref gnc_commodity object */
-class Commodity : public GncInstance
-{
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
-    typedef Commodity CppObjectType;
-    typedef Commodity_Class CppClassType;
-    typedef ::gnc_commodity BaseObjectType;
-    typedef ::gnc_commodityClass BaseClassType;
-
-private:
-    friend class Commodity_Class;
-    static CppClassType commodity_class_;
-
-private:
-    // noncopyable
-    Commodity(const Commodity&);
-    Commodity& operator=(const Commodity&);
-
-protected:
-    explicit Commodity(const Glib::ConstructParams& construct_params);
-    explicit Commodity(gnc_commodity* castitem);
-
-#endif /* DOXYGEN_SHOULD_SKIP_THIS */
-
-public:
-    virtual ~Commodity();
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
-    static GType get_type()      G_GNUC_CONST;
-    static GType get_base_type() G_GNUC_CONST;
-#endif
-
-    ///Provides access to the underlying C GObject.
-    gnc_commodity*       gobj()
-    {
-        return reinterpret_cast<gnc_commodity*>(gobject_);
-    }
-
-    ///Provides access to the underlying C GObject.
-    const gnc_commodity* gobj() const
-    {
-        return reinterpret_cast<gnc_commodity*>(gobject_);
-    }
-
-    ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
-    gnc_commodity* gobj_copy();
-
-private:
-public:
-
-    Glib::ustring get_mnemonic() const
-    {
-        return gnc_commodity_get_mnemonic(gobj());
-    }
-    Glib::ustring get_namespace() const
-    {
-        return gnc_commodity_get_namespace(gobj());
-    }
-    Glib::ustring get_fullname() const
-    {
-        return gnc_commodity_get_fullname(gobj());
-    }
-    Glib::ustring get_printname() const
-    {
-        return gnc_commodity_get_printname(gobj());
-    }
-
-    int get_fraction() const
-    {
-        return gnc_commodity_get_fraction(gobj());
-    }
-    bool get_quote_flag() const
-    {
-        return gnc_commodity_get_quote_flag(gobj());
-    }
-
-    bool is_currency() const
-    {
-        return gnc_commodity_is_currency(gobj());
-    }
-
-    bool equal(const Commodity& other) const
-    {
-        return gnc_commodity_equal(gobj(), other.gobj());
-    }
-};
-
-inline bool operator==(const Commodity& a, const Commodity& b)
-{
-    return a.equal(b);
-}
-
-inline bool operator!=(const Commodity& a, const Commodity& b)
-{
-    return !(a == b);
-}
-
-} // END namespace gnc
-
-namespace Glib
-{
-/** A Glib::wrap() method for this object.
- *
- * @param object The C instance.
- * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
- * @result A C++ instance that wraps this C instance.
- *
- * @relates Gio::FileInfo
- */
-Glib::RefPtr<gnc::Commodity> wrap(gnc_commodity* object, bool refuse_ownership = true);
-}
-
-
-#endif
diff --git a/src/optional/gtkmm/gncmm/GncInstance.cpp b/src/optional/gtkmm/gncmm/GncInstance.cpp
deleted file mode 100644
index 498e194..0000000
--- a/src/optional/gtkmm/gncmm/GncInstance.cpp
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * GncInstance.cpp
- * Copyright (C) 2011 Christian Stimming
- *
- * 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 at gnu.org
- */
-
-#include "GncInstance.hpp"
-#include "private/GncInstance_p.hpp"
-#include "Book.hpp"
-#include "qofinstance-p.h"
-
-
-namespace Glib
-{
-
-Glib::RefPtr<gnc::GncInstance> wrap(::QofInstance* object, bool take_copy)
-{
-    return Glib::RefPtr<gnc::GncInstance>( dynamic_cast<gnc::GncInstance*> (Glib::wrap_auto ((GObject*)(object), take_copy)) );
-    //We use dynamic_cast<> in case of multiple inheritance.
-}
-
-} /* namespace Glib */
-
-
-namespace gnc
-{
-
-
-/* The *_Class implementation: */
-
-const Glib::Class& GncInstance_Class::init()
-{
-    if (!gtype_) // create the GType if necessary
-    {
-        // Glib::Class has to know the class init function to clone custom types.
-        class_init_func_ = &GncInstance_Class::class_init_function;
-
-        // This is actually just optimized away, apparently with no harm.
-        // Make sure that the parent type has been created.
-        //CppClassParent::CppObjectType::get_type();
-
-        // Create the wrapper type, with the same class/instance size as the base type.
-        register_derived_type(qof_instance_get_type());
-
-        // Add derived versions of interfaces, if the C type implements any interfaces:
-
-    }
-
-    return *this;
-}
-
-
-void GncInstance_Class::class_init_function(void* g_class, void* class_data)
-{
-    BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
-    CppClassParent::class_init_function(klass, class_data);
-}
-
-
-Glib::ObjectBase* GncInstance_Class::wrap_new(GObject* object)
-{
-    return new GncInstance((::QofInstance*)object);
-}
-
-
-/* The implementation: */
-
-::QofInstance* GncInstance::gobj_copy()
-{
-    reference();
-    return gobj();
-}
-
-GncInstance::GncInstance(const Glib::ConstructParams& construct_params)
-    : Glib::Object(construct_params)
-{
-
-}
-
-GncInstance::GncInstance(::QofInstance* castitem)
-    : Glib::Object((GObject*)(castitem))
-{}
-
-
-GncInstance::~GncInstance()
-{}
-
-
-GncInstance::CppClassType GncInstance::gncInstance_class_; // initialize static member
-
-GType GncInstance::get_type()
-{
-    return gncInstance_class_.init().get_type();
-}
-
-
-GType GncInstance::get_base_type()
-{
-    return qof_instance_get_type();
-}
-
-void GncInstance::set_dirty()
-{
-    return qof_instance_set_dirty(gobj());
-}
-void GncInstance::mark_clean()
-{
-    return qof_instance_mark_clean(gobj());
-}
-
-
-// ////////////////////////////////////////
-
-Glib::RefPtr<Book> GncInstance::get_book() const
-{
-    return Glib::wrap(qof_instance_get_book (gobj()));
-}
-void GncInstance::set_book(Glib::RefPtr<Book> book)
-{
-    g_assert (book);
-    qof_instance_set_book(gobj(), book->gobj());
-}
-
-
-
-} // END namespace gnc
diff --git a/src/optional/gtkmm/gncmm/GncInstance.hpp b/src/optional/gtkmm/gncmm/GncInstance.hpp
deleted file mode 100644
index 14a8369..0000000
--- a/src/optional/gtkmm/gncmm/GncInstance.hpp
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * GncInstance.hpp
- * Copyright (C) 2011 Christian Stimming
- *
- * 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 at gnu.org
- */
-
-#ifndef GNC_GNCINSTANCE_HPP
-#define GNC_GNCINSTANCE_HPP
-
-// gnucash includes
-#include "config.h"
-#include "engine/guid.hpp"
-extern "C"
-{
-#include "qof.h"
-}
-
-#include <glibmm/object.h>
-
-namespace gnc
-{
-class Book;
-class GncInstance;
-class GncInstance_Class;
-} // END namespace gnc
-
-namespace gnc
-{
-
-/** Wrapper for ::QofInstance
- * This
- * base class offers some common methods.
- *
- * We cannot name it QofInstance because those stupid C macros (like
- * QOF_CHECK_TYPE) would always confuse our namespaced declaration
- * with the C declaration. I hate macros!
- */
-class GncInstance : public Glib::Object
-{
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
-    typedef GncInstance CppObjectType;
-    typedef GncInstance_Class CppClassType;
-    typedef ::QofInstance BaseObjectType;
-    typedef ::QofInstanceClass BaseClassType;
-
-private:
-    friend class GncInstance_Class;
-    static CppClassType gncInstance_class_;
-
-private:
-    // noncopyable
-    GncInstance(const GncInstance&);
-    GncInstance& operator=(const GncInstance&);
-
-protected:
-    explicit GncInstance(const Glib::ConstructParams& construct_params);
-    explicit GncInstance(::QofInstance* castitem);
-
-#endif /* DOXYGEN_SHOULD_SKIP_THIS */
-
-public:
-    virtual ~GncInstance();
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
-    static GType get_type()      G_GNUC_CONST;
-    static GType get_base_type() G_GNUC_CONST;
-#endif
-
-    ///Provides access to the underlying C GObject.
-    ::QofInstance*       gobj()
-    {
-        return reinterpret_cast< ::QofInstance*>(gobject_);
-    }
-
-    ///Provides access to the underlying C GObject.
-    const ::QofInstance* gobj() const
-    {
-        return reinterpret_cast< ::QofInstance*>(gobject_);
-    }
-
-    ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
-    ::QofInstance* gobj_copy();
-
-public:
-
-    Glib::RefPtr<Book> get_book() const;
-    void set_book(Glib::RefPtr<Book> book);
-    const ::GncGUID* get_guid() const
-    {
-        return qof_entity_get_guid(gobj_const());
-    }
-
-    bool is_dirty() const
-    {
-        return qof_instance_get_dirty(gobj_const());
-    }
-    void set_dirty();
-    void mark_clean();
-
-    //bool check_type(const char* type_id) { return (0 == g_strcmp0(type_id, QOF_INSTANCE(base_class::get())->e_type)); }
-    //Slots getSlots() const { return qof_instance_get_slots(QOF_INSTANCE(get())); }
-
-private:
-    /*const*/
-    ::QofInstance* gobj_const() const
-    {
-        return const_cast< ::QofInstance*>(gobj());
-    }
-};
-
-} // END namespace gnc
-
-#endif
diff --git a/src/optional/gtkmm/gncmm/Numeric.cpp b/src/optional/gtkmm/gncmm/Numeric.cpp
deleted file mode 100644
index ebdeda1..0000000
--- a/src/optional/gtkmm/gncmm/Numeric.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Numeric.cpp
- * Copyright (C) 2011 Christian Stimming
- *
- * 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 at gnu.org
- */
-
-#include "Numeric.hpp"
-#include "Account.hpp"
-#include "Split.hpp"
-
-extern "C"
-{
-#include "app-utils/gnc-exp-parser.h"
-}
-
-namespace gnc
-{
-
-// These are in the cpp file to avoid circular dependency between the
-// headers
-
-PrintAmountInfo::PrintAmountInfo(const Glib::RefPtr<Account> account, bool use_symbol)
-    : base_class(gnc_account_print_info(account->gobj(), use_symbol))
-{}
-PrintAmountInfo::PrintAmountInfo(const Glib::RefPtr<Split> split, bool use_symbol)
-    : base_class(gnc_split_amount_print_info(split->gobj(), use_symbol))
-{}
-
-Glib::ustring Numeric::printAmount(const PrintAmountInfo& info) const
-{
-    char buf[256];
-    if (!xaccSPrintAmount (buf, *this, info))
-        buf[0] = '\0';
-    return Glib::ustring(buf);
-}
-
-Glib::ustring Numeric::parse(const Glib::ustring& str)
-{
-    Glib::ustring errorString;
-
-    const char* input = str.c_str();
-    char *error_loc;
-    Numeric result;
-    gboolean p = gnc_exp_parser_parse(input, &result, &error_loc);
-    if (p)
-    {
-        *this = result;
-    }
-    else
-    {
-        errorString = Glib::ustring(gnc_exp_parser_error_string());
-    }
-
-    return errorString;
-}
-
-
-} // END namespace gnc
diff --git a/src/optional/gtkmm/gncmm/Numeric.hpp b/src/optional/gtkmm/gncmm/Numeric.hpp
deleted file mode 100644
index 74e8041..0000000
--- a/src/optional/gtkmm/gncmm/Numeric.hpp
+++ /dev/null
@@ -1,340 +0,0 @@
-/*
- * Numeric.hpp
- * Copyright (C) 2011 Christian Stimming
- *
- * 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 at gnu.org
- */
-
-#ifndef GNC_NUMERIC_HPP
-#define GNC_NUMERIC_HPP
-
-// gnucash includes
-#include "config.h"
-#include "engine/guid.hpp"
-extern "C"
-{
-#include "qof.h"
-#include "gnc-date.h"
-#include "app-utils/gnc-ui-util.h"
-#include "app-utils/gnc-ui-balances.h"
-}
-
-#include <glibmm/ustring.h>
-#include <glibmm/refptr.h>
-
-#if GLIB_HAVE_DATETIME
-// Glib::DateTime is new in glibmm-2.29 but very useful
-# include <glibmm/datetime.h>
-#endif
-
-namespace gnc
-{
-
-class Account;
-class Split;
-
-/** Conversion of a newly allocated gchar* to QString, which will
- * correctly g_free() the newly allocated gchar* as well.
- *
- * If a gchar* does not have to be freed again, the standard
- * conversion constructor Glib::ustring(const gchar*) is sufficient
- * (as it expects its input in UTF-8) and we do not need to define an
- * extra function for that.
- */
-inline Glib::ustring gchar_to_ustring(gchar* tmp_string)
-{
-    if (!tmp_string)
-        return Glib::ustring();
-    Glib::ustring result(tmp_string); // implies source string in UTF-8
-    g_free(tmp_string);
-    return result;
-}
-
-#if GLIB_HAVE_DATETIME
-// Glib::DateTime is new in glibmm-2.29 but very useful
-inline Glib::DateTime to_gdatetime(const ::Timespec& timespec)
-{
-    Glib::DateTime result = Glib::DateTime::create_now_utc(timespec.tv_sec);
-    result.add_seconds(timespec.tv_nsec * 1e-9);
-    return result;
-}
-inline ::Timespec to_timespec(const Glib::DateTime& gdt)
-{
-    ::Timespec result;
-    result.tv_sec = qdt.to_unix;
-    result.tv_nsec = qdt.get_microseconds() * 1000;
-    return result;
-}
-#endif
-
-/** Copies the pointer values from the given GList into the specified output
- * list type, such as std::vector<FooBar*>. */
-template<class ResultListType>
-ResultListType from_glist(GList* glist)
-{
-    ResultListType result;
-    GList* list = glist;
-    while (list)
-    {
-        result.push_back(reinterpret_cast< typename ResultListType::value_type >(list->data));
-        list = g_list_next(list);
-    }
-    return result;
-}
-
-/** Wrapper around a gnucash ::GNCPrintAmountInfo structure with C++
- * methods for easier setter and getter access.
- *
- * Since this class is a derived class of the original gnucash struct,
- * it keeps the data by-value and its member variables will always
- * exist as long as this object exists.
- */
-class PrintAmountInfo : public ::GNCPrintAmountInfo
-{
-public:
-    typedef ::GNCPrintAmountInfo base_class;
-
-    PrintAmountInfo(const base_class& other)
-        : base_class(other)
-    {}
-    PrintAmountInfo(bool use_symbol)
-        : base_class(gnc_default_print_info(use_symbol))
-    {}
-
-    /* If the boolean set to true, then prefix 3 letter ISO 4217
-       currency code to the amount. */
-    PrintAmountInfo(const Glib::RefPtr<Account> account, bool use_symbol);
-    PrintAmountInfo(const Glib::RefPtr<Split> split, bool use_symbol);
-
-    static PrintAmountInfo share_places(int decplaces)
-    {
-        return gnc_share_print_info_places(decplaces);
-    }
-    static PrintAmountInfo default_share()
-    {
-        return gnc_default_share_print_info();
-    }
-    static PrintAmountInfo default_price()
-    {
-        return gnc_default_price_print_info();
-    }
-    static PrintAmountInfo integral()
-    {
-        return gnc_integral_print_info();
-    }
-};
-
-
-/** Wrapper around a gnucash ::gnc_numeric structure with C++ methods
- * for easier setter and getter access.
- *
- * Since this class is a derived class of the original gnucash struct,
- * it keeps the data by-value and its member variables will always
- * exist as long as this object exists.
- */
-class Numeric : public ::gnc_numeric
-{
-public:
-    typedef ::gnc_numeric base_class;
-
-    /// Constructor for value zero
-    Numeric()
-    {
-        base_class::num = 0;
-        base_class::denom = 1;
-    }
-
-    /// Constructor with given nominator and denominator
-    Numeric(gint64 num, gint64 denom)
-    {
-        base_class::num = num;
-        base_class::denom = denom;
-    }
-
-    /// Copy constructor
-    Numeric(const base_class& other) : base_class(other) {}
-
-    /// Constructor for value zero
-    static Numeric zero()
-    {
-        return Numeric(0, 1);
-    }
-
-    /// Constructor for value one
-    static Numeric one()
-    {
-        return Numeric(1, 1);
-    }
-
-    /// Conversion from a double value, with the given target
-    /// denominator and the specified rounding method "how".
-    Numeric(double in, gint64 denom, gint how)
-    {
-        *this = double_to_gnc_numeric(in, denom, how);
-    }
-
-    /// Watch out: This conversion never seems to work!
-    static bool string_to_numeric(const Glib::ustring& str, Numeric& n)
-    {
-        return string_to_gnc_numeric(str.c_str(), &n);
-    }
-
-    /// Constructor for representing any of the given
-    /// GNCNumericErrorCode values
-    Numeric(GNCNumericErrorCode error_code)
-    {
-        *this = gnc_numeric_error(error_code);
-    }
-
-    /// Returns the numerator
-    gint64 num() const
-    {
-        return base_class::num;
-    }
-    /// Returns the denominator
-    gint64 denom() const
-    {
-        return base_class::denom;
-    }
-    /// Conversion to double
-    gdouble to_double() const
-    {
-        return gnc_numeric_to_double(*this);
-    }
-
-    /// Conversion to string, but only as a fractional representation
-    /// i.e. "123/456". Use printAmount() for user-visible values
-    /// instead.
-    Glib::ustring to_string() const
-    {
-        return gchar_to_ustring(gnc_numeric_to_string(*this));
-    }
-
-    GNCNumericErrorCode check() const
-    {
-        return gnc_numeric_check(*this);
-    }
-    gint compare(const Numeric& b) const
-    {
-        return gnc_numeric_compare(*this, b);
-    }
-    bool zero_p() const
-    {
-        return gnc_numeric_zero_p(*this);
-    }
-    bool negative_p() const
-    {
-        return gnc_numeric_negative_p(*this);
-    }
-    bool positive_p() const
-    {
-        return gnc_numeric_positive_p(*this);
-    }
-    bool eq(const Numeric& b) const
-    {
-        return gnc_numeric_eq(*this, b);
-    }
-    bool equal(const Numeric& b) const
-    {
-        return gnc_numeric_equal(*this, b);
-    }
-    bool same(const Numeric& b, gint64 denom, gint how) const
-    {
-        return gnc_numeric_same(*this, b, denom, how);
-    }
-
-    Numeric add(const Numeric& b, gint64 denom, gint how) const
-    {
-        return gnc_numeric_add(*this, b, denom, how);
-    }
-    Numeric sub(const Numeric& b, gint64 denom, gint how) const
-    {
-        return gnc_numeric_sub(*this, b, denom, how);
-    }
-    Numeric mul(const Numeric& b, gint64 denom, gint how) const
-    {
-        return gnc_numeric_mul(*this, b, denom, how);
-    }
-    Numeric div(const Numeric& b, gint64 denom, gint how) const
-    {
-        return gnc_numeric_div(*this, b, denom, how);
-    }
-    Numeric neg() const
-    {
-        return gnc_numeric_neg(*this);
-    }
-    Numeric abs() const
-    {
-        return gnc_numeric_abs(*this);
-    }
-
-    Numeric add_fixed(const Numeric& b) const
-    {
-        return gnc_numeric_add_fixed(*this, b);
-    }
-    Numeric sub_fixed(const Numeric& b) const
-    {
-        return gnc_numeric_sub_fixed(*this, b);
-    }
-
-    Numeric reduce() const
-    {
-        return gnc_numeric_reduce(*this);
-    }
-
-    Glib::ustring printAmount(const PrintAmountInfo& info) const;
-
-    /** Parses the given string by the expression parser. On success,
-     * the value is written into this object and an empty string is
-     * returned. On error, this object is unchanged and a string with
-     * the error message is returned. */
-    Glib::ustring parse(const Glib::ustring& str);
-};
-
-inline bool operator==(const Numeric& a, const Numeric& b)
-{
-    return a.equal(b);
-}
-
-inline bool operator!=(const Numeric& a, const Numeric& b)
-{
-    return !(a == b);
-}
-
-/// Returns the negative value of a
-inline Numeric operator-(const Numeric& a)
-{
-    return a.neg();
-}
-
-/// Returns a + b
-inline Numeric operator+(const Numeric& a, const Numeric& b)
-{
-    return a.add_fixed(b);
-}
-
-/// Returns a - b
-inline Numeric operator-(const Numeric& a, const Numeric& b)
-{
-    return a.sub_fixed(b);
-}
-
-} // END namespace gnc
-
-
-#endif
diff --git a/src/optional/gtkmm/gncmm/Split.cpp b/src/optional/gtkmm/gncmm/Split.cpp
deleted file mode 100644
index d4fe73a..0000000
--- a/src/optional/gtkmm/gncmm/Split.cpp
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- * Split.cpp
- * Copyright (C) 2010 Christian Stimming
- *
- * 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 at gnu.org
- */
-
-#include "Split.hpp"
-
-#include "Account.hpp"
-#include "Book.hpp"
-#include "Transaction.hpp"
-#include "private/Split_p.hpp"
-
-namespace Glib
-{
-
-Glib::RefPtr<gnc::Split> wrap(::Split* object, bool take_copy)
-{
-    return Glib::RefPtr<gnc::Split>( dynamic_cast<gnc::Split*> (Glib::wrap_auto ((GObject*)(object), take_copy)) );
-    //We use dynamic_cast<> in case of multiple inheritance.
-}
-
-} /* namespace Glib */
-
-namespace gnc
-{
-
-/* The *_Class implementation: */
-
-const Glib::Class& Split_Class::init()
-{
-    if (!gtype_) // create the GType if necessary
-    {
-        // Glib::Class has to know the class init function to clone custom types.
-        class_init_func_ = &Split_Class::class_init_function;
-
-        // This is actually just optimized away, apparently with no harm.
-        // Make sure that the parent type has been created.
-        //CppClassParent::CppObjectType::get_type();
-
-        // Create the wrapper type, with the same class/instance size as the base type.
-        register_derived_type(gnc_split_get_type());
-
-        // Add derived versions of interfaces, if the C type implements any interfaces:
-
-    }
-
-    return *this;
-}
-
-
-void Split_Class::class_init_function(void* g_class, void* class_data)
-{
-    BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
-    CppClassParent::class_init_function(klass, class_data);
-}
-
-
-Glib::ObjectBase* Split_Class::wrap_new(GObject* object)
-{
-    return new Split((::Split*)object);
-}
-
-
-/* The implementation: */
-
-::Split* Split::gobj_copy()
-{
-    reference();
-    return gobj();
-}
-
-Split::Split(const Glib::ConstructParams& construct_params)
-    : GncInstance(construct_params)
-{
-
-}
-
-Split::Split(::Split* castitem)
-    : GncInstance((::QofInstance*)(castitem))
-{}
-
-
-Split::~Split()
-{}
-
-
-Split::CppClassType Split::split_class_; // initialize static member
-
-GType Split::get_type()
-{
-    return split_class_.init().get_type();
-}
-
-
-GType Split::get_base_type()
-{
-    return gnc_split_get_type();
-}
-
-
-
-Glib::RefPtr<Account> Split::get_account() const
-{
-    return Glib::wrap(xaccSplitGetAccount(gobj()));
-}
-void Split::set_account(Glib::RefPtr<Account> acc)
-{
-    if (acc) xaccSplitSetAccount(gobj(), acc->gobj());
-}
-void Split::set_account(::Account* acc)
-{
-    xaccSplitSetAccount(gobj(), acc);
-}
-
-
-Glib::RefPtr<Transaction> Split::get_parent() const
-{
-    return Glib::wrap(xaccSplitGetParent(gobj()));
-}
-void Split::set_parent(Glib::RefPtr<Transaction> trans)
-{
-    if (trans) xaccSplitSetParent(gobj(), trans->gobj());
-}
-void Split::set_parent(Transaction& trans)
-{
-    xaccSplitSetParent(gobj(), trans.gobj());
-}
-
-Glib::RefPtr<Split> Split::get_other_split() const
-{
-    return Glib::wrap(xaccSplitGetOtherSplit(gobj()));
-}
-
-
-TmpSplit::TmpSplit(const Glib::RefPtr<Split>& s, const TmpTransaction* parent_trans)
-    : m_account(s->get_account()->gobj())
-    , m_parent(parent_trans)
-    , m_memo(s->get_memo())
-    , m_action(s->get_action())
-    , m_reconcile(s->get_reconcile())
-    , m_amount(s->get_amount())
-    , m_value(s->get_value())
-{}
-
-TmpSplit::TmpSplit(::Account* account)
-{
-    clear(account);
-}
-
-TmpSplit* TmpSplit::get_other_split() const
-{
-    if (!m_parent)
-        return NULL;
-    const TmpTransaction& p = *m_parent;
-    if (p.get_num_splits() != 2)
-        return NULL;
-    TmpTransaction::TmpSplitList& splits = const_cast<TmpTransaction&>(p).get_splits();
-    if (splits.front().get_account() != m_account)
-        return &splits.front();
-    else
-        return &splits.back();
-}
-
-void TmpSplit::clear(::Account* account)
-{
-    m_account = account;
-    m_parent = NULL;
-    m_memo.clear();
-    m_action.clear();
-    m_reconcile = NREC;
-    m_amount = Numeric::zero();
-    m_value = Numeric::zero();
-}
-
-void TmpSplit::copy_into(Glib::RefPtr<Transaction> t) const
-{
-    g_assert(t);
-    Glib::RefPtr<Split> s(Glib::wrap(xaccMallocSplit(t->get_book()->gobj())));
-    s->set_account(m_account);
-    s->set_parent(t);
-    s->set_memo(m_memo);
-    s->set_action(m_action);
-    s->set_reconcile(m_reconcile);
-    s->set_amount(m_amount);
-    s->set_value(m_value);
-}
-
-} // END namespace gnc
diff --git a/src/optional/gtkmm/gncmm/Split.hpp b/src/optional/gtkmm/gncmm/Split.hpp
deleted file mode 100644
index 0465bc5..0000000
--- a/src/optional/gtkmm/gncmm/Split.hpp
+++ /dev/null
@@ -1,322 +0,0 @@
-/*
- * Split.hpp
- * Copyright (C) 2011 Christian Stimming
- *
- * 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 at gnu.org
- */
-
-#ifndef GNC_SPLIT_HPP
-#define GNC_SPLIT_HPP
-
-// gnucash includes
-#include "config.h"
-#include "engine/guid.hpp"
-extern "C"
-{
-#include "qof.h"
-#include "engine/Split.h"
-}
-
-#include <glibmm/object.h>
-#include <glibmm/date.h>
-#include <glibmm/ustring.h>
-#include <vector>
-
-#include "GncInstance.hpp"
-#include "Numeric.hpp"
-
-namespace gnc
-{
-class Split_Class;
-} // END namespace gnc
-
-namespace gnc
-{
-class Book;
-class Account;
-class Transaction;
-class TmpTransaction;
-
-typedef std::vector< ::Split*> SplitQList;
-
-/** Wrapper around a gnucash ::Split pointer with C++ methods for
- * easier setter and getter access.
- */
-class Split : public GncInstance
-{
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
-    typedef Split CppObjectType;
-    typedef Split_Class CppClassType;
-    typedef ::Split BaseObjectType;
-    typedef ::SplitClass BaseClassType;
-
-private:
-    friend class Split_Class;
-    static CppClassType split_class_;
-
-private:
-    // noncopyable
-    Split(const Split&);
-    Split& operator=(const Split&);
-
-protected:
-    explicit Split(const Glib::ConstructParams& construct_params);
-    explicit Split(::Split* castitem);
-
-#endif /* DOXYGEN_SHOULD_SKIP_THIS */
-
-public:
-    virtual ~Split();
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
-    static GType get_type()      G_GNUC_CONST;
-    static GType get_base_type() G_GNUC_CONST;
-#endif
-
-    ///Provides access to the underlying C GObject.
-    ::Split*       gobj()
-    {
-        return reinterpret_cast< ::Split*>(gobject_);
-    }
-
-    ///Provides access to the underlying C GObject.
-    const ::Split* gobj() const
-    {
-        return reinterpret_cast< ::Split*>(gobject_);
-    }
-
-    ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
-    ::Split* gobj_copy();
-
-private:
-public:
-
-
-    Glib::RefPtr<Account> get_account() const;
-    void set_account(Glib::RefPtr<Account> acc);
-    void set_account(::Account* acc);
-
-    Glib::RefPtr<Transaction> get_parent() const;
-    void set_parent(Glib::RefPtr<Transaction> trans);
-    void set_parent(Transaction& trans);
-
-    Glib::ustring get_memo() const
-    {
-        return xaccSplitGetMemo(gobj());
-    }
-    void set_memo(const Glib::ustring& v)
-    {
-        xaccSplitSetMemo(gobj(), v.c_str());
-    }
-
-    Glib::ustring get_action() const
-    {
-        return xaccSplitGetAction(gobj());
-    }
-    void set_action(const Glib::ustring& v)
-    {
-        xaccSplitSetAction(gobj(), v.c_str());
-    }
-
-    char get_reconcile() const
-    {
-        return xaccSplitGetReconcile(gobj());
-    }
-    void set_reconcile(char v)
-    {
-        xaccSplitSetReconcile(gobj(), v);
-    }
-
-    Glib::RefPtr<Split> get_other_split() const;
-
-    Glib::ustring get_corr_account_full_name() const
-    {
-        return gchar_to_ustring(xaccSplitGetCorrAccountFullName(gobj()));
-    }
-    Glib::ustring get_corr_account_name() const
-    {
-        return xaccSplitGetCorrAccountName(gobj());
-    }
-    Glib::ustring get_corr_account_code() const
-    {
-        return xaccSplitGetCorrAccountCode(gobj());
-    }
-
-    void set_amount(const Numeric& amount)
-    {
-        xaccSplitSetAmount(gobj(), amount);
-    }
-    Numeric get_amount() const
-    {
-        return xaccSplitGetAmount(gobj());
-    }
-    void set_value(const Numeric& value)
-    {
-        xaccSplitSetValue(gobj(), value);
-    }
-    Numeric get_value() const
-    {
-        return xaccSplitGetValue(gobj());
-    }
-    Numeric get_share_price() const
-    {
-        return xaccSplitGetSharePrice(gobj());
-    }
-    Numeric get_balance() const
-    {
-        return xaccSplitGetBalance(gobj());
-    }
-    Numeric get_cleared_balance() const
-    {
-        return xaccSplitGetClearedBalance(gobj());
-    }
-    Numeric get_reconciled_balance() const
-    {
-        return xaccSplitGetReconciledBalance(gobj());
-    }
-
-
-    static SplitQList from_glist(GList* glist)
-    {
-        return gnc::from_glist<SplitQList>(glist);
-    }
-};
-
-
-/** This is a temporary split which belongs to a temporary transaction
- * (class gnc::TmpTransaction). Each of this tmp splits has all data
- * fields just like a "real" split, but it is not (yet) added to the
- * respective Account and Book. In other words, it is not stored in
- * the book yet.
- *
- * For this reason this class supports a full copy-by-value, which
- * will create new independent instances of all data fields. */
-class TmpSplit
-{
-public:
-    /** Creates a new tmp split whose content is copied from the given
-     * real transaction and it should belong to the given
-     * TmpTransaction (but it is not added to the TmpTransaction's
-     * split list here). */
-    TmpSplit(const Glib::RefPtr<Split>& s, const TmpTransaction* parent_trans);
-
-    /** Creates a new empty tmp split, with the Account pointer
-     * initialized with the given value. */
-    TmpSplit(::Account* account = NULL);
-
-    /** Clears all data fields of this split. */
-    void clear(::Account* account = NULL);
-
-    /** Copies the content of this tmp split into the given real
-     * transaction by allocating a new real gnc::Split and adding it
-     * to the given real gnc::Transaction. */
-    void copy_into(Glib::RefPtr<Transaction> t) const;
-
-    ::Account* get_account() const
-    {
-        return m_account;
-    }
-    void set_account(::Account* v)
-    {
-        m_account = v;
-    }
-
-    const TmpTransaction* get_parent() const
-    {
-        return m_parent;
-    }
-    void set_parent(const TmpTransaction* v)
-    {
-        m_parent = v;
-    }
-
-    /** Returns a pointer to the "Other" split if it exists, or NULL
-     * if none or multiple of them exist. */
-    TmpSplit* get_other_split() const;
-
-    Glib::ustring get_memo() const
-    {
-        return m_memo;
-    }
-    void set_memo(const Glib::ustring& v)
-    {
-        m_memo = v;
-    }
-
-    Glib::ustring get_action() const
-    {
-        return m_action;
-    }
-    void set_action(const Glib::ustring& v)
-    {
-        m_action = v;
-    }
-
-    char get_reconcile() const
-    {
-        return m_reconcile;
-    }
-    void set_reconcile(char v)
-    {
-        m_reconcile = v;
-    }
-
-    Numeric get_amount() const
-    {
-        return m_amount;
-    }
-    void set_amount(const Numeric& v)
-    {
-        m_amount = v;
-    }
-
-    Numeric get_value() const
-    {
-        return m_value;
-    }
-    void set_value(const Numeric& v)
-    {
-        m_value = v;
-    }
-
-private:
-    ::Account* m_account;
-    const TmpTransaction* m_parent;
-    Glib::ustring m_memo;
-    Glib::ustring m_action;
-    char m_reconcile;
-    Numeric m_amount;
-    Numeric m_value;
-};
-
-} // END namespace gnc
-
-namespace Glib
-{
-/** A Glib::wrap() method for this object.
- *
- * @param object The C instance.
- * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
- * @result A C++ instance that wraps this C instance.
- *
- * @relates Gio::FileInfo
- */
-Glib::RefPtr<gnc::Split> wrap(::Split* object, bool refuse_ownership = true);
-}
-
-
-#endif
diff --git a/src/optional/gtkmm/gncmm/Transaction.cpp b/src/optional/gtkmm/gncmm/Transaction.cpp
deleted file mode 100644
index ecc31d0..0000000
--- a/src/optional/gtkmm/gncmm/Transaction.cpp
+++ /dev/null
@@ -1,225 +0,0 @@
-/*
- * Transaction.cpp
- * Copyright (C) 2011 Christian Stimming
- *
- * 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 at gnu.org
- */
-
-#include "Transaction.hpp"
-#include "Split.hpp"
-#include <cassert>
-#if HAVE_GLIBMM_VECTORUTILS_H
-// new in glibmm-2.29
-#include <glibmm/vectorutils.h>
-#endif
-#include "private/Transaction_p.hpp"
-
-namespace Glib
-{
-
-Glib::RefPtr<gnc::Transaction> wrap(::Transaction* object, bool take_copy)
-{
-    return Glib::RefPtr<gnc::Transaction>( dynamic_cast<gnc::Transaction*> (Glib::wrap_auto ((GObject*)(object), take_copy)) );
-    //We use dynamic_cast<> in case of multiple inheritance.
-}
-
-} /* namespace Glib */
-
-namespace gnc
-{
-
-/* The *_Class implementation: */
-
-const Glib::Class& Transaction_Class::init()
-{
-    if (!gtype_) // create the GType if necessary
-    {
-        // Glib::Class has to know the class init function to clone custom types.
-        class_init_func_ = &Transaction_Class::class_init_function;
-
-        // This is actually just optimized away, apparently with no harm.
-        // Make sure that the parent type has been created.
-        //CppClassParent::CppObjectType::get_type();
-
-        // Create the wrapper type, with the same class/instance size as the base type.
-        register_derived_type(gnc_transaction_get_type());
-
-        // Add derived versions of interfaces, if the C type implements any interfaces:
-
-    }
-
-    return *this;
-}
-
-
-void Transaction_Class::class_init_function(void* g_class, void* class_data)
-{
-    BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
-    CppClassParent::class_init_function(klass, class_data);
-}
-
-
-Glib::ObjectBase* Transaction_Class::wrap_new(GObject* object)
-{
-    return new Transaction((::Transaction*)object);
-}
-
-
-/* The implementation: */
-
-::Transaction* Transaction::gobj_copy()
-{
-    reference();
-    return gobj();
-}
-
-Transaction::Transaction(const Glib::ConstructParams& construct_params)
-    : GncInstance(construct_params)
-{
-
-}
-
-Transaction::Transaction(::Transaction* castitem)
-    : GncInstance((::QofInstance*)(castitem))
-{}
-
-
-Transaction::~Transaction()
-{}
-
-
-Transaction::CppClassType Transaction::transaction_class_; // initialize static member
-
-GType Transaction::get_type()
-{
-    return transaction_class_.init().get_type();
-}
-
-
-GType Transaction::get_base_type()
-{
-    return gnc_transaction_get_type();
-}
-
-
-
-Glib::RefPtr<Split> Transaction::find_split_by_account(const Account& acc) const
-{
-    return Glib::wrap(xaccTransFindSplitByAccount(gobj(), acc.gobj()));
-}
-Glib::RefPtr<Split> Transaction::get_split(int i) const
-{
-    return Glib::wrap(xaccTransGetSplit(gobj(), i));
-}
-void Transaction::append_split(Glib::RefPtr<Split> split)
-{
-    g_assert(split);
-    xaccSplitSetParent(split->gobj(), gobj());
-}
-int Transaction::get_split_index(const Split& split) const
-{
-    return xaccTransGetSplitIndex(gobj(), split.gobj());
-}
-::Transaction* Transaction::new_instance(const Glib::RefPtr<Book> b)
-{
-    if (b)
-        return xaccMallocTransaction (const_cast< ::QofBook*>(b->gobj()));
-    else
-        return NULL;
-}
-
-// ////////////////////////////////////////////////////////////
-
-TmpTransaction::TmpTransaction()
-{
-    clear();
-}
-TmpTransaction::TmpTransaction(const Transaction& t)
-    : m_num(t.get_num())
-    , m_description(t.get_description())
-    , m_notes(t.get_notes())
-    , m_commodity(t.get_currency())
-    , m_datePosted(t.get_date_posted())
-    , m_dateTimeEntered(t.get_date_entered_tt())
-{
-    SplitQList slist = Split::from_glist(t.get_split_list());
-    for (SplitQList::const_iterator iter = slist.begin(); iter != slist.end(); ++iter)
-    {
-        m_splits.push_back(TmpSplit(Glib::wrap(*iter), this));
-    }
-}
-
-void TmpTransaction::clear()
-{
-    m_splits.clear();
-    reset_content();
-}
-
-void TmpTransaction::reset_content()
-{
-    m_num.clear();
-    m_description.clear();
-    m_notes.clear();
-    m_commodity.reset();
-    m_datePosted = Glib::Date();
-    m_dateTimeEntered = 0;
-    for (int i = 0; i < m_splits.size(); ++i)
-    {
-        TmpSplit& split = m_splits[i];
-        split.clear();
-        split.set_parent(this);
-    }
-}
-
-void TmpTransaction::copy_to(Glib::RefPtr<Transaction> t) const
-{
-    assert(t);
-    t->set_num(m_num);
-    t->set_description(m_description);
-    if (!m_notes.empty())
-        t->set_notes(m_notes);
-    t->set_currency(m_commodity);
-    t->set_date_posted(m_datePosted);
-    t->set_date_entered(m_dateTimeEntered);
-    for (int i = 0; i < m_splits.size(); ++i)
-    {
-        m_splits[i].copy_into(t);
-    }
-}
-
-Glib::RefPtr<Transaction> TmpTransaction::create_as_real() const
-{
-    assert (!m_splits.empty());
-    Glib::RefPtr<Account> acc(Glib::wrap(m_splits.front().get_account()));
-    assert (acc);
-    Glib::RefPtr<Book> book(acc->get_book());
-    assert (book);
-    Glib::RefPtr<Transaction> trans(Glib::wrap(Transaction::new_instance(book)));
-    trans->begin_edit();
-    copy_to(trans);
-    trans->commit_edit();
-    return trans;
-}
-
-void TmpTransaction::push_back(const TmpSplit& s)
-{
-    m_splits.push_back(s);
-    m_splits.back().set_parent(this);
-}
-
-} // END namespace gnc
diff --git a/src/optional/gtkmm/gncmm/Transaction.hpp b/src/optional/gtkmm/gncmm/Transaction.hpp
deleted file mode 100644
index c921739..0000000
--- a/src/optional/gtkmm/gncmm/Transaction.hpp
+++ /dev/null
@@ -1,336 +0,0 @@
-/*
- * Transaction.hpp
- * Copyright (C) 2011 Christian Stimming
- *
- * 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 at gnu.org
- */
-
-#ifndef GNC_TRANSACTION_HPP
-#define GNC_TRANSACTION_HPP
-
-// gnucash includes
-#include "config.h"
-#include "libqof/qof/guid.hpp"
-extern "C"
-{
-#include "qof.h"
-#include "engine/Transaction.h"
-}
-
-#include "Account.hpp"
-#include "Book.hpp"
-#include "Commodity.hpp"
-#include "Numeric.hpp"
-#include "GncInstance.hpp"
-#include "Split.hpp"
-
-#include <glibmm/object.h>
-#include <glibmm/date.h>
-#include <glibmm/ustring.h>
-#include <vector>
-
-namespace gnc
-{
-class Transaction_Class;
-} // END namespace gnc
-
-namespace gnc
-{
-class Account;
-class Split;
-class TmpSplit;
-
-/** Wrapper around a gnucash ::Transaction pointer with C++ methods for
- * easier setter and getter access.
- */
-class Transaction : public GncInstance
-{
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
-    typedef Transaction CppObjectType;
-    typedef Transaction_Class CppClassType;
-    typedef ::Transaction BaseObjectType;
-    typedef ::TransactionClass BaseClassType;
-
-private:
-    friend class Transaction_Class;
-    static CppClassType transaction_class_;
-
-private:
-    // noncopyable
-    Transaction(const Transaction&);
-    Transaction& operator=(const Transaction&);
-
-protected:
-    explicit Transaction(const Glib::ConstructParams& construct_params);
-    explicit Transaction(::Transaction* castitem);
-
-#endif /* DOXYGEN_SHOULD_SKIP_THIS */
-
-public:
-    virtual ~Transaction();
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
-    static GType get_type()      G_GNUC_CONST;
-    static GType get_base_type() G_GNUC_CONST;
-#endif
-
-    ///Provides access to the underlying C GObject.
-    ::Transaction*       gobj()
-    {
-        return reinterpret_cast< ::Transaction*>(gobject_);
-    }
-
-    ///Provides access to the underlying C GObject.
-    const ::Transaction* gobj() const
-    {
-        return reinterpret_cast< ::Transaction*>(gobject_);
-    }
-
-    ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
-    ::Transaction* gobj_copy();
-
-private:
-public:
-
-    void begin_edit()
-    {
-        xaccTransBeginEdit(gobj());
-    }
-    void commit_edit()
-    {
-        xaccTransCommitEdit(gobj());
-    }
-    void rollback_edit()
-    {
-        xaccTransRollbackEdit(gobj());
-    }
-    bool is_open() const
-    {
-        return xaccTransIsOpen(gobj());
-    }
-
-
-    Glib::ustring get_num() const
-    {
-        return xaccTransGetNum(gobj());
-    }
-    void set_num(const Glib::ustring& v)
-    {
-        xaccTransSetNum(gobj(), v.c_str());
-    }
-
-    Glib::ustring get_description() const
-    {
-        return xaccTransGetDescription(gobj());
-    }
-    void set_description(const Glib::ustring& v)
-    {
-        xaccTransSetDescription(gobj(), v.c_str());
-    }
-
-    Glib::ustring get_notes() const
-    {
-        return xaccTransGetNotes(gobj());
-    }
-    void set_notes(const Glib::ustring& v)
-    {
-        xaccTransSetNotes(gobj(), v.c_str());
-    }
-
-    int get_num_splits() const
-    {
-        return xaccTransCountSplits(gobj());
-    }
-    Glib::RefPtr<Split> find_split_by_account(const Account& acc) const;
-    void append_split(Glib::RefPtr<Split> split);
-    Glib::RefPtr<Split> get_split(int i) const;
-    int get_split_index(const Split& split) const;
-    ::SplitList* get_split_list() const
-    {
-        return xaccTransGetSplitList(gobj());
-    }
-
-    Glib::RefPtr<Commodity> get_currency() const
-    {
-        return Glib::wrap(xaccTransGetCurrency(gobj()));
-    }
-    void set_currency(const Glib::RefPtr<Commodity>& c)
-    {
-        if (c) xaccTransSetCurrency(gobj(), c->gobj());
-    }
-
-    Numeric get_imbalance_value() const
-    {
-        return xaccTransGetImbalanceValue(gobj());
-    }
-    bool is_balanced() const
-    {
-        return xaccTransIsBalanced(gobj());
-    }
-    Numeric get_account_conv_rate(const Account& acc) const
-    {
-        return xaccTransGetAccountConvRate(gobj(), acc.gobj());
-    }
-
-    void set_date_posted(const Glib::Date& d)
-    {
-        xaccTransSetDatePostedGDate(gobj(), *d.gobj());
-    }
-    Glib::Date get_date_posted() const
-    {
-        return Glib::Date(xaccTransGetDatePostedGDate(gobj()));
-    }
-    void set_date_entered(time_t t)
-    {
-        xaccTransSetDateEnteredSecs(gobj(), t);
-    }
-//    void set_date_entered(const Glib::DateTime& t) { xaccTransSetDateEnteredSecs(gobj(), t.toTime_t()); }
-    time_t get_date_entered_tt() const
-    {
-        return timespecToTime64 (xaccTransRetDateEnteredTS(gobj()));
-    }
-    //Glib::DateTime get_date_entered() const { return toGDateTime(xaccTransRetDateEnteredTS(gobj())); }
-
-    static ::Transaction* new_instance(const Glib::RefPtr<Book> b);
-};
-
-
-/** This is a temporary transaction. Each of this tmp transactions has
- * all data fields just like a "real" transaction, but it is not (yet)
- * added to the respective Account and Book. In other words, it is not
- * stored in the book yet.
- *
- * For this reason this class supports a full copy-by-value, which
- * will create new independent instances of all data fields. */
-class TmpTransaction
-{
-public:
-    typedef std::vector<TmpSplit> TmpSplitList;
-
-    /** Creates an empty tmp transaction */
-    TmpTransaction();
-
-    /** Creates a tmp transaction whose content is copied from the
-     * given real transaction */
-    TmpTransaction(const Transaction& t);
-
-    /** Clears all data fields of this transaction, including deletion
-     * of all splits stored here. */
-    void clear();
-
-    /** Clears all data fields, but does not delete the splits and
-     * instead only resets the data fields of all splits */
-    void reset_content();
-
-    /** Copies the content of this tmp transaction into the given real
-     * transaction. */
-    void copy_to(Glib::RefPtr<Transaction> t) const;
-
-    /** Allocates a new real transaction in the Book and Account as
-     * stored in the tmp transaction, copies the content of this tmp
-     * transaction into the newly allocated one, and returns the
-     * pointer to the newly created real transaction. */
-    Glib::RefPtr<Transaction> create_as_real() const;
-
-    Glib::ustring get_num() const
-    {
-        return m_num;
-    }
-    void set_num(const Glib::ustring& v)
-    {
-        m_num = v;
-    }
-
-    Glib::ustring get_description() const
-    {
-        return m_description;
-    }
-    void set_description(const Glib::ustring& v)
-    {
-        m_description = v;
-    }
-
-    void push_back(const TmpSplit& s);
-    const TmpSplitList& get_splits() const
-    {
-        return m_splits;
-    }
-    TmpSplitList& get_splits()
-    {
-        return m_splits;
-    }
-    int get_num_splits() const
-    {
-        return m_splits.size();
-    }
-
-    Glib::RefPtr<Commodity> get_commodity() const
-    {
-        return m_commodity;
-    }
-    void set_commodity(const Glib::RefPtr<Commodity>& v)
-    {
-        m_commodity = v;
-    }
-
-    Glib::Date get_date_posted() const
-    {
-        return m_datePosted;
-    }
-    void set_date_posted(const Glib::Date& v)
-    {
-        m_datePosted = v;
-    }
-
-    time_t get_date_entered_tt() const
-    {
-        return m_dateTimeEntered;
-    }
-    void set_date_entered(time_t v)
-    {
-        m_dateTimeEntered = v;
-    }
-    //Glib::DateTime get_date_entered() const { return m_dateTimeEntered; }
-    //void set_date_entered(const Glib::DateTime& v) { m_dateTimeEntered = v; }
-
-private:
-    Glib::ustring m_num;
-    Glib::ustring m_description;
-    Glib::ustring m_notes;
-    TmpSplitList m_splits;
-    Glib::RefPtr<Commodity> m_commodity;
-    Glib::Date m_datePosted;
-    time_t m_dateTimeEntered;
-    //Glib::DateTime m_dateTimeEntered;
-};
-
-} // END namespace gnc
-
-namespace Glib
-{
-/** A Glib::wrap() method for this object.
- *
- * @param object The C instance.
- * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
- * @result A C++ instance that wraps this C instance.
- *
- * @relates Gio::FileInfo
- */
-Glib::RefPtr<gnc::Transaction> wrap(::Transaction* object, bool refuse_ownership = true);
-}
-
-#endif
diff --git a/src/optional/gtkmm/gncmm/private/Account_p.hpp b/src/optional/gtkmm/gncmm/private/Account_p.hpp
deleted file mode 100644
index e73a316..0000000
--- a/src/optional/gtkmm/gncmm/private/Account_p.hpp
+++ /dev/null
@@ -1,48 +0,0 @@
-// -*- c++ -*-
-// Generated by gtkmmproc -- DO NOT MODIFY!
-#ifndef _GNCMM_PRIVATE_ACCOUNT_P_HPP
-#define _GNCMM_PRIVATE_ACCOUNT_P_HPP
-
-
-#include <glibmm/private/object_p.h>
-
-#include <glibmm/class.h>
-
-namespace gnc
-{
-
-class Account_Class : public Glib::Class
-{
-public:
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
-    typedef Account CppObjectType;
-    typedef ::Account BaseObjectType;
-    typedef ::AccountClass BaseClassType;
-    typedef Glib::Object_Class CppClassParent;
-    typedef GObjectClass BaseClassParent;
-
-    friend class Account;
-#endif /* DOXYGEN_SHOULD_SKIP_THIS */
-
-    const Glib::Class& init();
-
-
-    static void class_init_function(void* g_class, void* class_data);
-
-    static Glib::ObjectBase* wrap_new(GObject*);
-
-protected:
-
-    //Callbacks (default signal handlers):
-    //These will call the *_impl member methods, which will then call the existing default signal callbacks, if any.
-    //You could prevent the original default signal handlers being called by overriding the *_impl method.
-
-    //Callbacks (virtual functions):
-};
-
-
-} // namespace gnc
-
-
-#endif /* _GNCMM_PRIVATE_ACCOUNT_P_HPP */
-
diff --git a/src/optional/gtkmm/gncmm/private/Book_p.hpp b/src/optional/gtkmm/gncmm/private/Book_p.hpp
deleted file mode 100644
index b24dbe1..0000000
--- a/src/optional/gtkmm/gncmm/private/Book_p.hpp
+++ /dev/null
@@ -1,48 +0,0 @@
-// -*- c++ -*-
-// Generated by gtkmmproc -- DO NOT MODIFY!
-#ifndef _GNCMM_PRIVATE_BOOK_P_HPP
-#define _GNCMM_PRIVATE_BOOK_P_HPP
-
-
-#include <glibmm/private/object_p.h>
-
-#include <glibmm/class.h>
-
-namespace gnc
-{
-
-class Book_Class : public Glib::Class
-{
-public:
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
-    typedef Book CppObjectType;
-    typedef QofBook BaseObjectType;
-    typedef QofBookClass BaseClassType;
-    typedef Glib::Object_Class CppClassParent;
-    typedef GObjectClass BaseClassParent;
-
-    friend class Book;
-#endif /* DOXYGEN_SHOULD_SKIP_THIS */
-
-    const Glib::Class& init();
-
-
-    static void class_init_function(void* g_class, void* class_data);
-
-    static Glib::ObjectBase* wrap_new(GObject*);
-
-protected:
-
-    //Callbacks (default signal handlers):
-    //These will call the *_impl member methods, which will then call the existing default signal callbacks, if any.
-    //You could prevent the original default signal handlers being called by overriding the *_impl method.
-
-    //Callbacks (virtual functions):
-};
-
-
-} // namespace gnc
-
-
-#endif /* _GNCMM_PRIVATE_BOOK_P_HPP */
-
diff --git a/src/optional/gtkmm/gncmm/private/Commodity_p.hpp b/src/optional/gtkmm/gncmm/private/Commodity_p.hpp
deleted file mode 100644
index 816fd9d..0000000
--- a/src/optional/gtkmm/gncmm/private/Commodity_p.hpp
+++ /dev/null
@@ -1,48 +0,0 @@
-// -*- c++ -*-
-// Generated by gtkmmproc -- DO NOT MODIFY!
-#ifndef _GNCMM_GNC_COMMODITY_P_H
-#define _GNCMM_GNC_COMMODITY_P_H
-
-
-#include <glibmm/private/object_p.h>
-
-#include <glibmm/class.h>
-
-namespace gnc
-{
-
-class Commodity_Class : public Glib::Class
-{
-public:
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
-    typedef Commodity CppObjectType;
-    typedef gnc_commodity BaseObjectType;
-    typedef gnc_commodityClass BaseClassType;
-    typedef Glib::Object_Class CppClassParent;
-    typedef GObjectClass BaseClassParent;
-
-    friend class Commodity;
-#endif /* DOXYGEN_SHOULD_SKIP_THIS */
-
-    const Glib::Class& init();
-
-
-    static void class_init_function(void* g_class, void* class_data);
-
-    static Glib::ObjectBase* wrap_new(GObject*);
-
-protected:
-
-    //Callbacks (default signal handlers):
-    //These will call the *_impl member methods, which will then call the existing default signal callbacks, if any.
-    //You could prevent the original default signal handlers being called by overriding the *_impl method.
-
-    //Callbacks (virtual functions):
-};
-
-
-} // namespace gnc
-
-
-#endif /* _GNCMM_GNC_COMMODITY_P_H */
-
diff --git a/src/optional/gtkmm/gncmm/private/GncInstance_p.hpp b/src/optional/gtkmm/gncmm/private/GncInstance_p.hpp
deleted file mode 100644
index 62b30a8..0000000
--- a/src/optional/gtkmm/gncmm/private/GncInstance_p.hpp
+++ /dev/null
@@ -1,48 +0,0 @@
-// -*- c++ -*-
-// Generated by gtkmmproc -- DO NOT MODIFY!
-#ifndef _GNCMM_GNC_COMMODITY_P_H
-#define _GNCMM_GNC_COMMODITY_P_H
-
-
-#include <glibmm/private/object_p.h>
-
-#include <glibmm/class.h>
-
-namespace gnc
-{
-
-class GncInstance_Class : public Glib::Class
-{
-public:
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
-    typedef GncInstance CppObjectType;
-    typedef ::QofInstance BaseObjectType;
-    typedef ::QofInstanceClass BaseClassType;
-    typedef Glib::Object_Class CppClassParent;
-    typedef GObjectClass BaseClassParent;
-
-    friend class GncInstance;
-#endif /* DOXYGEN_SHOULD_SKIP_THIS */
-
-    const Glib::Class& init();
-
-
-    static void class_init_function(void* g_class, void* class_data);
-
-    static Glib::ObjectBase* wrap_new(GObject*);
-
-protected:
-
-    //Callbacks (default signal handlers):
-    //These will call the *_impl member methods, which will then call the existing default signal callbacks, if any.
-    //You could prevent the original default signal handlers being called by overriding the *_impl method.
-
-    //Callbacks (virtual functions):
-};
-
-
-} // namespace gnc
-
-
-#endif /* _GNCMM_GNC_COMMODITY_P_H */
-
diff --git a/src/optional/gtkmm/gncmm/private/Split_p.hpp b/src/optional/gtkmm/gncmm/private/Split_p.hpp
deleted file mode 100644
index 3fdea56..0000000
--- a/src/optional/gtkmm/gncmm/private/Split_p.hpp
+++ /dev/null
@@ -1,48 +0,0 @@
-// -*- c++ -*-
-// Generated by gtkmmproc -- DO NOT MODIFY!
-#ifndef _GNCMM_PRIVATE_SPLIT_P_HPP
-#define _GNCMM_PRIVATE_SPLIT_P_HPP
-
-
-#include <glibmm/private/object_p.h>
-
-#include <glibmm/class.h>
-
-namespace gnc
-{
-
-class Split_Class : public Glib::Class
-{
-public:
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
-    typedef Split CppObjectType;
-    typedef ::Split BaseObjectType;
-    typedef ::SplitClass BaseClassType;
-    typedef Glib::Object_Class CppClassParent;
-    typedef GObjectClass BaseClassParent;
-
-    friend class Split;
-#endif /* DOXYGEN_SHOULD_SKIP_THIS */
-
-    const Glib::Class& init();
-
-
-    static void class_init_function(void* g_class, void* class_data);
-
-    static Glib::ObjectBase* wrap_new(GObject*);
-
-protected:
-
-    //Callbacks (default signal handlers):
-    //These will call the *_impl member methods, which will then call the existing default signal callbacks, if any.
-    //You could prevent the original default signal handlers being called by overriding the *_impl method.
-
-    //Callbacks (virtual functions):
-};
-
-
-} // namespace gnc
-
-
-#endif /* _GNCMM_PRIVATE_SPLIT_P_HPP */
-
diff --git a/src/optional/gtkmm/gncmm/private/Transaction_p.hpp b/src/optional/gtkmm/gncmm/private/Transaction_p.hpp
deleted file mode 100644
index 7a93517..0000000
--- a/src/optional/gtkmm/gncmm/private/Transaction_p.hpp
+++ /dev/null
@@ -1,48 +0,0 @@
-// -*- c++ -*-
-// Generated by gtkmmproc -- DO NOT MODIFY!
-#ifndef _GNCMM_PRIVATE_TRANSACTION_P_HPP
-#define _GNCMM_PRIVATE_TRANSACTION_P_HPP
-
-
-#include <glibmm/private/object_p.h>
-
-#include <glibmm/class.h>
-
-namespace gnc
-{
-
-class Transaction_Class : public Glib::Class
-{
-public:
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
-    typedef Transaction CppObjectType;
-    typedef ::Transaction BaseObjectType;
-    typedef ::TransactionClass BaseClassType;
-    typedef Glib::Object_Class CppClassParent;
-    typedef GObjectClass BaseClassParent;
-
-    friend class Transaction;
-#endif /* DOXYGEN_SHOULD_SKIP_THIS */
-
-    const Glib::Class& init();
-
-
-    static void class_init_function(void* g_class, void* class_data);
-
-    static Glib::ObjectBase* wrap_new(GObject*);
-
-protected:
-
-    //Callbacks (default signal handlers):
-    //These will call the *_impl member methods, which will then call the existing default signal callbacks, if any.
-    //You could prevent the original default signal handlers being called by overriding the *_impl method.
-
-    //Callbacks (virtual functions):
-};
-
-
-} // namespace gnc
-
-
-#endif /* _GNCMM_PRIVATE_TRANSACTION_P_HPP */
-
diff --git a/src/optional/gtkmm/gncmm/wrap_init.cpp b/src/optional/gtkmm/gncmm/wrap_init.cpp
deleted file mode 100644
index 3087a28..0000000
--- a/src/optional/gtkmm/gncmm/wrap_init.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-/********************************************************************\
- * 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 at gnu.org                   *
- *                                                                  *
-\********************************************************************/
-
-
-#include <glib.h>
-
-// Disable the 'const' function attribute of the get_type() functions.
-// GCC would optimize them out because we don't use the return value.
-#undef  G_GNUC_CONST
-#define G_GNUC_CONST /* empty */
-
-//#include <giomm/wrap_init.h>
-#include <glibmm/error.h>
-#include <glibmm/object.h>
-
-// #include the widget headers so that we can call the get_type() static methods:
-
-#include "config.h"
-#include "Account.hpp"
-#include "Book.hpp"
-#include "Commodity.hpp"
-#include "Split.hpp"
-#include "Transaction.hpp"
-
-extern "C"
-{
-
-//Declarations of the *_get_type() functions:
-
-    GType gnc_account_get_type(void);
-    GType qof_book_get_type(void);
-    GType gnc_commodity_get_type(void);
-    GType gnc_split_get_type(void);
-    GType gnc_transaction_get_type(void);
-    GType qof_instance_get_type (void);
-} // extern "C"
-
-//Declarations of the *_Class::wrap_new() methods, instead of including all the private headers:
-
-namespace gnc {  class Account_Class { public: static Glib::ObjectBase* wrap_new(GObject*); };  }
-namespace gnc {  class Book_Class { public: static Glib::ObjectBase* wrap_new(GObject*); };  }
-namespace gnc {  class Commodity_Class { public: static Glib::ObjectBase* wrap_new(GObject*); };  }
-namespace gnc {  class GncInstance_Class { public : static Glib::ObjectBase* wrap_new(GObject*); }; }
-namespace gnc {  class Split_Class { public: static Glib::ObjectBase* wrap_new(GObject*); };  }
-namespace gnc {  class Transaction_Class { public: static Glib::ObjectBase* wrap_new(GObject*); };  }
-
-namespace gnc
-{
-void wrap_init()
-{
-// Map gtypes to gtkmm wrapper-creation functions:
-    Glib::wrap_register(gnc_account_get_type(), &gnc::Account_Class::wrap_new);
-    Glib::wrap_register(qof_book_get_type(), &gnc::Book_Class::wrap_new);
-    Glib::wrap_register(gnc_commodity_get_type(), &gnc::Commodity_Class::wrap_new);
-    Glib::wrap_register(qof_instance_get_type(), &gnc::GncInstance_Class::wrap_new);
-    Glib::wrap_register(gnc_split_get_type(), &gnc::Split_Class::wrap_new);
-    Glib::wrap_register(gnc_transaction_get_type(), &gnc::Transaction_Class::wrap_new);
-
-    // Register our gtkmm gtypes:
-    gnc::Account::get_type();
-    gnc::Book::get_type();
-    gnc::Commodity::get_type();
-    gnc::GncInstance::get_type();
-    gnc::Split::get_type();
-    gnc::Transaction::get_type();
-} // wrap_init()
-} // END namespace gnc
-
diff --git a/src/optional/gtkmm/gncmm/wrap_init.hpp b/src/optional/gtkmm/gncmm/wrap_init.hpp
deleted file mode 100644
index 41d1190..0000000
--- a/src/optional/gtkmm/gncmm/wrap_init.hpp
+++ /dev/null
@@ -1,32 +0,0 @@
-// -*- c++ -*-
-#ifndef _GNCMM_WRAP_INIT_H
-#define _GNCMM_WRAP_INIT_H
-
-#include <glibmm.h>
-
-/* wrap_init.h
- *
- * Copyright (C) 2007 The gtkmm development team
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-namespace gnc
-{
-void wrap_init () ;
-}
-
-#endif //_GNCMM_WRAP_INIT_H
-
diff --git a/src/optional/gtkmm/gncmod-gtkmm.cpp b/src/optional/gtkmm/gncmod-gtkmm.cpp
deleted file mode 100644
index 3a380eb..0000000
--- a/src/optional/gtkmm/gncmod-gtkmm.cpp
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * gncmod-gtkmm.cpp --
- *
- * 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 at gnu.org
- */
-
-/**
- * @internal
- * @file gncmod-gtkmm.cpp
- * @brief Module definition/initialization for gtkmm support
- * @author Copyright (C) 2011 Christian Stimming <stimming at tuhh.de>
- */
-
-#include "config.h"
-/*#include <glib.h>*/
-#include <glib/gi18n.h>
-
-extern "C" {
-#include "gnc-module/gnc-module.h"
-#include "gnc-module/gnc-module-api.h"
-
-    GNC_MODULE_API_DECL(libgncmod_gtkmm)
-
-    /* version of the gnc module system interface we require */
-    gint libgncmod_gtkmm_gnc_module_system_interface = 0;
-
-    /* module versioning uses libtool semantics. */
-    gint libgncmod_gtkmm_gnc_module_current  = 0;
-    gint libgncmod_gtkmm_gnc_module_revision = 0;
-    gint libgncmod_gtkmm_gnc_module_age      = 0;
-} // END extern "C"
-
-// c++ includes
-#include <gtkmm.h>
-
-// And our own plugin
-#include "gncmm/wrap_init.hpp"
-#include "gnc-plugin-gtkmm.hpp"
-
-extern "C" {
-
-    gchar *
-    libgncmod_gtkmm_gnc_module_path(void)
-    {
-        return g_strdup("gnucash/gtkmm");
-    }
-
-    gchar *
-    libgncmod_gtkmm_gnc_module_description(void)
-    {
-        return g_strdup("Support for gtkmm gui");
-    }
-
-    gint
-    libgncmod_gtkmm_gnc_module_init(gint refcount)
-    {
-        // Load modules we depend on
-        if (!gnc_module_load("gnucash/engine", 0)
-                || !gnc_module_load("gnucash/app-utils", 0)
-                || !gnc_module_load("gnucash/gnome-utils", 0))
-        {
-            return FALSE;
-        }
-
-        // Initialize glibmm
-        Glib::init();
-
-        // Register our own gncmm wrapper classes at glib type system
-        gnc::wrap_init();
-
-        // Initialize the gtkmm framework. Calling this static method
-        // is sufficient; we don't actually need a Gtk::Main object.
-        Gtk::Main::init_gtkmm_internals();
-
-        // Register our plugin, adding menu items with callbacks
-        gncmm::gnc_plugin_gtkmm_create_plugin();
-
-        return 1;
-    }
-
-    gint
-    libgncmod_gtkmm_gnc_module_end(gint refcount)
-    {
-        return 1;
-    }
-
-} // END extern "C"
diff --git a/src/optional/gtkmm/test/CMakeLists.txt b/src/optional/gtkmm/test/CMakeLists.txt
deleted file mode 100644
index eec21b2..0000000
--- a/src/optional/gtkmm/test/CMakeLists.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-
-SET_DIST_LIST(test_gtkmm_DIST CMakeLists.txt Makefile.am test-book.cpp test-gtkmm.cpp)
diff --git a/src/optional/gtkmm/test/Makefile.am b/src/optional/gtkmm/test/Makefile.am
deleted file mode 100644
index c36d0a0..0000000
--- a/src/optional/gtkmm/test/Makefile.am
+++ /dev/null
@@ -1,50 +0,0 @@
-# A template Makefile.am for GLib g_test-based test directories.
-# Copyright 2011 John Ralls <jralls at ceridwen.us>
-
-include $(top_srcdir)/test-templates/Makefile.decl
-
-
-#You will only need one of these: It points to the module directory
-#after $(top_srcdir) or $(top_builddir):
-MODULEPATH = src/optional/gtkmm
-
-#The test program. You'll need to add to this if you have more than one module above.
-
-check_PROGRAMS = test-gtkmm
-
-TESTS = ${check_PROGRAMS}
-
-test_gtkmmdir = ${top_srcdir}/${MODULEPATH}/test
-
-#Program files for tests go here. It's probably best to have one for
-#each file in the parent directory. Include
-#test_foo_support.c if you have one and aren't building the
-#support library.
-test_gtkmm_SOURCES = \
-	test-gtkmm.cpp \
-	test-book.cpp
-
-test_gtkmm_HEADERS = \
-	$(top_srcdir)/${MODULEPATH}/gncmm/Book.hpp
-
-#The tests might require more libraries, but try to keep them
-#as independent as possible.
-test_gtkmm_LDADD = ${top_builddir}/${MODULEPATH}/libgncmod-gtkmm.la \
-  ${top_builddir}/src/engine/libgncmod-engine.la \
-  ${GTKMM_LIBS} \
-  ${GLIB_LIBS}
-
-AM_CPPFLAGS = \
-	${DEFAULT_INCLUDES} \
-	-DTESTPROG=test_gtkmm \
-  -I${top_srcdir}/src \
-  -I${top_srcdir}/src/test-core \
-  -I${top_srcdir}/src/libqof/qof \
-  -I${top_srcdir}/src/gnc-module \
-  -I${top_srcdir}/src/core-utils \
-  -I${top_srcdir}/src/engine \
-  -I${top_srcdir}/src/optional/gtkmm \
-  ${GTKMM_CFLAGS} \
-  ${GLIB_CFLAGS}
-
-EXTRA_DIST += CMakeLists.txt
diff --git a/src/optional/gtkmm/test/test-book.cpp b/src/optional/gtkmm/test/test-book.cpp
deleted file mode 100644
index bc029c9..0000000
--- a/src/optional/gtkmm/test/test-book.cpp
+++ /dev/null
@@ -1,176 +0,0 @@
-/********************************************************************
- * test-book.cpp: GLib g_test test suite for gnc::Book.		    *
- * Copyright 2011 Christian Stimming
- * Copyright 2011 John Ralls <jralls at ceridwen.us>		    *
- *                                                                  *
- * 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 at gnu.org                   *
-\********************************************************************/
-
-#include "config.h"
-
-#include <string.h>
-#include <glib.h>
-
-#include "gncmm/Book.hpp"
-
-extern "C" {
-#include <qofbook-p.h>
-#include <qofbookslots.h>
-#include <unittest-support.h>
-}
-
-static const gchar *suitename = "/optional/gtkmm";
-void test_suite_gtkmm_book();
-
-typedef struct
-{
-    QofBook *book;
-} Fixture;
-
-static struct
-{
-    guint param;
-    gpointer data;
-    gboolean called;
-    gchar* msg;
-} test_struct;
-
-static struct
-{
-    gboolean col1_called;
-    gboolean col2_called;
-    gpointer data;
-} col_struct;
-
-static void
-setup( Fixture *fixture, gconstpointer pData )
-{
-    fixture->book = qof_book_new();
-}
-
-static void
-teardown( Fixture *fixture, gconstpointer pData )
-{
-    qof_book_destroy( fixture->book );
-}
-
-/* use g_free on test_struct.msg after this function been called */
-static gboolean
-handle_faults ( const char * log_domain, GLogLevelFlags log_level, const gchar *msg, gpointer user_data)
-{
-    test_struct.msg = (gchar *) g_strdup( msg );
-    return FALSE;
-}
-
-/* mock dirty callback function */
-static void
-mock_dirty_cb (QofBook *book, gboolean dirty, gpointer user_data)
-{
-    test_struct.called = TRUE;
-    g_test_message( "Checking if book is valid" );
-    g_assert( book );
-    g_assert( QOF_IS_BOOK( book ) );
-    g_test_message( "Checking parameters" );
-    g_assert( dirty );
-    g_assert( user_data == test_struct.data );
-}
-
-/* mock callback for qof_book_foreach_collection testing */
-static void
-mock_foreach_collection (QofCollection *col, gpointer user_data)
-{
-    g_test_message( "Checking if collection and data passed correctly" );
-    g_assert( col );
-    g_assert( user_data == col_struct.data );
-    if ( g_strcmp0( qof_collection_get_type(col), "my_type" ) == 0 )
-        col_struct.col1_called = TRUE;
-    else if ( g_strcmp0( qof_collection_get_type(col), "my_type2" ) == 0 )
-        col_struct.col2_called = TRUE;
-}
-
-/* mock final callback function */
-static void
-mock_final_cb (QofBook *book, gpointer key, gpointer user_data)
-{
-    test_struct.called = TRUE;
-    g_assert( book );
-    g_assert( QOF_IS_BOOK( book ) );
-    g_test_message( "Checking parameters" );
-    g_assert_cmpstr( (gchar*)key, == , "key" );
-    g_assert_cmpstr( (gchar*)user_data, == , "data" );
-}
-
-static void
-test_book_readonly( Fixture *fixture, gconstpointer pData )
-{
-    g_assert( fixture->book != NULL );
-    g_assert( !qof_book_is_readonly( fixture->book ) );
-    qof_book_mark_readonly( fixture->book );
-    g_assert( qof_book_is_readonly( fixture->book ) );
-}
-static void
-test_book_wrap( Fixture *fixture, gconstpointer pData )
-{
-    g_assert( fixture->book != NULL );
-    {
-        // WATCH OUT: The second "true" argument is very important, as it says
-        // the Glib::RefPtr must not take ownership of the original object.
-        Glib::RefPtr<gnc::Book> book = Glib::wrap(fixture->book, true);
-        g_assert( book->gobj() == fixture->book );
-        g_assert(G_IS_OBJECT(fixture->book));
-    }
-    g_assert(G_IS_OBJECT(fixture->book)); // All is fine due to the "true" above.
-    // The setup() and teardown() indeed uses the GObject ref counting correctly.
-
-    qof_book_mark_readonly( fixture->book );
-    g_assert( qof_book_is_readonly( fixture->book ) );
-}
-static void
-test_book_wrap_readonly( Fixture *fixture, gconstpointer pData )
-{
-    Glib::RefPtr<gnc::Book> book = Glib::wrap(fixture->book, true); // "true" is important!
-    g_assert( book );
-    g_assert( book->gobj() == fixture-> book); // indeed the identical object
-    g_assert( !book->is_readonly() );
-    g_assert( !qof_book_is_readonly( fixture->book ) );
-    book->mark_readonly();
-    g_assert( book->is_readonly() );
-    g_assert( qof_book_is_readonly( fixture->book ) ); // indeed the identical object
-}
-static void
-test_book_get_string_option( Fixture *fixture, gconstpointer pData )
-{
-    Glib::ustring opt_name("Option Name");
-    Glib::ustring opt_value("Option Value");
-    Glib::ustring opt_name_notset("Not Set");
-    Glib::RefPtr<gnc::Book> book = Glib::wrap(fixture->book, true); // "true" is important!
-    g_assert( book );
-    book->string_option_set( opt_name, opt_value);
-    g_assert_cmpstr( book->string_option_get( opt_name ).c_str(), == , opt_value.c_str());
-    g_assert( book->string_option_exists(opt_name) == true);
-    g_assert( book->string_option_get( opt_name_notset ).empty());
-    g_assert( book->string_option_exists( opt_name_notset ) == false);
-}
-
-void test_suite_gtkmm_book()
-{
-    GNC_TEST_ADD( suitename, "readonly", Fixture, NULL, setup, test_book_readonly, teardown );
-    GNC_TEST_ADD( suitename, "wrap", Fixture, NULL, setup, test_book_wrap, teardown );
-    GNC_TEST_ADD( suitename, "wrapped-readonly", Fixture, NULL, setup, test_book_wrap_readonly, teardown );
-    GNC_TEST_ADD( suitename, "wrapped-get_string_option", Fixture, NULL, setup, test_book_get_string_option, teardown );
-}
diff --git a/src/optional/gtkmm/test/test-gtkmm.cpp b/src/optional/gtkmm/test/test-gtkmm.cpp
deleted file mode 100644
index 7556c6e..0000000
--- a/src/optional/gtkmm/test/test-gtkmm.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/********************************************************************
- * testmain.c: GLib g_test test execution file.			    *
- * Copyright 2011 Christian Stimming
- * Copyright 2011 John Ralls <jralls at ceridwen.us>		    *
- *                                                                  *
- * 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 at gnu.org                   *
-\********************************************************************/
-
-
-#include "config.h"
-#include <glib.h>
-#include <glibmm.h>
-extern "C" {
-#include "qof.h"
-
-//    gint libgncmod_gtkmm_gnc_module_init(gint refcount);
-}
-// c++ includes
-//#include <gtkmm.h>
-// And our own plugin
-#include "gncmm/wrap_init.hpp"
-
-
-extern void test_suite_gtkmm_book();
-
-int
-main (int   argc,
-      char *argv[])
-{
-    qof_init(); 			/* Initialize the GObject system */
-    qof_log_init_filename_special("stderr"); /* Init the log system */
-    g_test_init ( &argc, &argv, NULL ); 	/* initialize test program */
-    g_test_bug_base("https://bugzilla.gnome.org/show_bug.cgi?id="); /* init the bugzilla URL */
-
-    // Initialize glibmm
-    Glib::init();
-    gnc::wrap_init();
-
-    // The below only needed if we use gtkmm stuff
-    //Gtk::Main::init_gtkmm_internals();
-
-    //libgncmod_gtkmm_gnc_module_init(1);
-
-    test_suite_gtkmm_book();
-
-    return g_test_run( );
-}
-
-

commit 785568b0a345e5796ac7f994ce9f033da217a0a5
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Tue Aug 8 13:46:53 2017 +0200

    Drop gtk dependency from app-utils
    
    The resolves it's 'allmost nongui' status. Note the options code still
    stores a pointer to a gtk widget but this is never used in the app-utils code
    itself. This was already so before this commit and fixing this will require
    more refactoring later on.
    
    This commit also aligns the list of non-gui source directories between
    cmake and autotools. This may need further tweaking in the context of
    splitting the source in libgnucash and gnucash (the application)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index cc02ebb..363e452 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -172,6 +172,7 @@ ENDIF (NOT PKG_CONFIG_FOUND)
 
 # glib et al.
 GNC_PKG_CHECK_MODULES (GLIB2 REQUIRED glib-2.0>=2.40)
+GNC_PKG_CHECK_MODULES (GIO REQUIRED gio-2.0)
 GNC_PKG_CHECK_MODULES (GOBJECT REQUIRED gobject-2.0>=2.20)
 GNC_PKG_CHECK_MODULES (GMODULE REQUIRED gmodule-2.0>=2.20)
 GNC_PKG_CHECK_MODULES (GTHREAD REQUIRED gthread-2.0>=2.20)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 55fbe34..0255d9f 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -142,31 +142,31 @@ SET(SCHEME_INSTALLED_CACHE_DIR ${CMAKE_INSTALL_PREFIX}/lib/gnucash/scm/ccache/${
 
 # The subdirectories
 ADD_SUBDIRECTORY (core-utils)
+ADD_SUBDIRECTORY (debug)
+ADD_SUBDIRECTORY (doc)
 ADD_SUBDIRECTORY (gnc-module)
 ADD_SUBDIRECTORY (engine)
 ADD_SUBDIRECTORY (backend)
 ADD_SUBDIRECTORY (app-utils)
-ADD_SUBDIRECTORY (import-export)
+ADD_SUBDIRECTORY (pixmaps)
+ADD_SUBDIRECTORY (quotes)
+ADD_SUBDIRECTORY (scm)
+ADD_SUBDIRECTORY (tax)
+ADD_SUBDIRECTORY (test-core)
 
 IF (WITH_GNUCASH)
   ADD_SUBDIRECTORY (bin)
   ADD_SUBDIRECTORY (cmake_modules)
-  ADD_SUBDIRECTORY (debug)
-  ADD_SUBDIRECTORY (doc)
   ADD_SUBDIRECTORY (gnome)
   ADD_SUBDIRECTORY (gnome-utils)
   ADD_SUBDIRECTORY (gnome-search)
   ADD_SUBDIRECTORY (html)
+  ADD_SUBDIRECTORY (import-export)
   ADD_SUBDIRECTORY (optional)
   ADD_SUBDIRECTORY (plugins)
-  ADD_SUBDIRECTORY (pixmaps)
   ADD_SUBDIRECTORY (python)
-  ADD_SUBDIRECTORY (quotes)
   ADD_SUBDIRECTORY (register)
   ADD_SUBDIRECTORY(report)
-  ADD_SUBDIRECTORY (scm)
-  ADD_SUBDIRECTORY (tax)
-  ADD_SUBDIRECTORY (test-core)
 ENDIF (WITH_GNUCASH)
 
 IF (WITH_CUTECASH)
diff --git a/src/Makefile.am b/src/Makefile.am
index 7d72bcd..00fe7b6 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -15,18 +15,18 @@ NONGUI_SUBDIRS = \
   engine/test \
   backend \
   scm \
-  quotes
+  quotes \
+  app-utils \
+  tax
 
 if WITH_PYTHON
    PYTHON_DIR = python
 endif
 
 # These directories should also not contain any gtk dependencies, but
-# currently there is only single very little dependency in
-# app-utils. It should go away in the long run, though.
+# currently there is a gtk based console in the python bindings
+# that should probably live elsewhere.
 ALMOST_NONGUI_SUBDIRS = \
-  app-utils \
-  tax \
   ${PYTHON_DIR}
 
 # These directories contain the code with gtk dependency
diff --git a/src/app-utils/CMakeLists.txt b/src/app-utils/CMakeLists.txt
index b15f510..ebd2ad9 100644
--- a/src/app-utils/CMakeLists.txt
+++ b/src/app-utils/CMakeLists.txt
@@ -81,9 +81,9 @@ SET (app_utils_SOURCES
 SET_SOURCE_FILES_PROPERTIES (${app_utils_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
 
 SET(app_utils_ALL_SOURCES ${app_utils_SOURCES} ${app_utils_HEADERS} ${app_utils_noinst_HEADERS})
-SET(app_utils_ALL_LIBRARIES gncmod-engine gnc-module ${GTK3_LDFLAGS} ${LIBXML2_LDFLAGS} ${LIBXSLT_LDFLAGS})
-SET(app_utils_ALL_INCLUDES  ${CMAKE_CURRENT_SOURCE_DIR}/calculation  ${LIBXML2_INCLUDE_DIRS}
-                            ${LIBXSLT_INCLUDE_DIRS} ${GTK3_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/engine)
+SET(app_utils_ALL_LIBRARIES gncmod-engine gnc-module ${GIO_LDFLAGS} ${LIBXML2_LDFLAGS} ${LIBXSLT_LDFLAGS})
+SET(app_utils_ALL_INCLUDES  ${CMAKE_CURRENT_SOURCE_DIR}/calculation ${GIO_INCLUDE_DIRS} ${LIBXML2_INCLUDE_DIRS}
+                            ${LIBXSLT_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/engine)
 
 IF (WIN32)
   LIST(APPEND app_utils_ALL_SOURCES gnc-help-utils.c)
diff --git a/src/app-utils/Makefile.am b/src/app-utils/Makefile.am
index f9efdf4..7f55114 100644
--- a/src/app-utils/Makefile.am
+++ b/src/app-utils/Makefile.am
@@ -32,7 +32,6 @@ AM_CPPFLAGS = \
   ${GUILE_CFLAGS} \
   ${PYTHON_CPPFLAGS} \
   ${GLIB_CFLAGS} \
-  ${GTK_CFLAGS} \
   ${LIBXML2_CFLAGS} \
   ${LIBXSLT_CFLAGS}
 
@@ -99,7 +98,6 @@ libgncmod_app_utils_la_LIBADD = \
   ${top_builddir}/src/gnc-module/libgnc-module.la \
   ${top_builddir}/src/engine/libgncmod-engine.la \
   ${top_builddir}/src/core-utils/libgnc-core-utils.la \
-  ${GTK_LIBS} \
   ${GUILE_LIBS} \
   ${GLIB_LIBS} \
   ${LIBXML2_LIBS} \
diff --git a/src/app-utils/option-util.c b/src/app-utils/option-util.c
index 8a45ea7..52987fb 100644
--- a/src/app-utils/option-util.c
+++ b/src/app-utils/option-util.c
@@ -22,9 +22,6 @@
 
 #include "config.h"
 
-#ifdef GNOME
-# include <gtk/gtk.h>
-#endif
 #include <glib/gi18n.h>
 #include <time.h>
 #include <string.h>
@@ -1682,16 +1679,17 @@ gnc_option_valid_value(GNCOption *option, SCM value)
 }
 
 
-static void
+static char*
 gnc_commit_option(GNCOption *option)
 {
     SCM validator, setter, value;
     SCM result, ok;
+    char* retval = NULL;
 
     /* Validate the ui's value */
     value = gnc_option_get_ui_value(option);
     if (value == SCM_UNDEFINED)
-        return;
+        return NULL;
 
     validator = gnc_option_value_validator(option);
 
@@ -1699,7 +1697,7 @@ gnc_commit_option(GNCOption *option)
     if (!scm_is_list(result) || scm_is_null(result))
     {
         PERR("bad validation result\n");
-        return;
+        return NULL;
     }
 
     /* First element determines validity */
@@ -1707,7 +1705,7 @@ gnc_commit_option(GNCOption *option)
     if (!scm_is_bool(ok))
     {
         PERR("bad validation result\n");
-        return;
+        return NULL;
     }
 
     if (scm_is_true(ok))
@@ -1724,40 +1722,29 @@ gnc_commit_option(GNCOption *option)
     {
         SCM oops;
         char *section, *name;
-        const gchar *message;
-        const gchar *format = _("There is a problem with option %s:%s.\n%s");
+        const char *message;
+        const char *format = _("There is a problem with option %s:%s.\n%s");
+        const char *bad_value = _("Invalid option value");
+
+        name = gnc_option_name(option);
+        section = gnc_option_section(option);
 
         /* Second element is error message */
         oops = SCM_CADR(result);
         if (!scm_is_string(oops))
         {
             PERR("bad validation result\n");
-            return;
+            retval = g_strdup_printf(format,
+                                     section ? section : "(null)",
+                                     name ? name : "(null)",
+                                     bad_value);
         }
 
         message = gnc_scm_to_utf8_string (oops);
-        name = gnc_option_name(option);
-        section = gnc_option_section(option);
-
-#ifdef GNOME
-        {
-            GtkWidget *dialog = gtk_message_dialog_new(NULL,
-                                0,
-                                GTK_MESSAGE_ERROR,
-                                GTK_BUTTONS_OK,
-                                format,
-                                section ? section : "(null)",
-                                name ? name : "(null)",
-                                message ? message : "(null)");
-            gtk_dialog_run(GTK_DIALOG(dialog));
-            gtk_widget_destroy(dialog);
-        }
-#else
-        printf(format,
-               section ? section : "(null)",
-               name ? name : "(null)",
-               message ? message : "(null)");
-#endif
+        retval = g_strdup_printf(format,
+                                 section ? section : "(null)",
+                                 name ? name : "(null)",
+                                 message ? message : "(null)");
 
         if (name != NULL)
             free(name);
@@ -1765,6 +1752,8 @@ gnc_commit_option(GNCOption *option)
             free(section);
         g_free ((gpointer *) message);
     }
+
+    return retval;
 }
 
 
@@ -1814,7 +1803,7 @@ gnc_option_db_get_changed(GNCOptionDB *odb)
  * Args: odb - option database to commit                            *
  * Return: nothing                                                  *
 \********************************************************************/
-void
+GList*
 gnc_option_db_commit(GNCOptionDB *odb)
 {
     GSList *section_node;
@@ -1822,8 +1811,9 @@ gnc_option_db_commit(GNCOptionDB *odb)
     GNCOptionSection *section;
     GNCOption *option;
     gboolean changed_something = FALSE;
+    GList *commit_errors = NULL;
 
-    g_return_if_fail (odb);
+    g_return_val_if_fail (odb, NULL);
 
     section_node = odb->option_sections;
     while (section_node != NULL)
@@ -1837,7 +1827,10 @@ gnc_option_db_commit(GNCOptionDB *odb)
 
             if (option->changed)
             {
-                gnc_commit_option(option_node->data);
+                char *result = NULL;
+                result = gnc_commit_option(option_node->data);
+                if (result)
+                    commit_errors = g_list_append (commit_errors, result);
                 changed_something = TRUE;
                 option->changed = FALSE;
             }
@@ -1850,6 +1843,8 @@ gnc_option_db_commit(GNCOptionDB *odb)
 
     if (changed_something)
         gnc_call_option_change_callbacks(odb);
+
+    return commit_errors;
 }
 
 
diff --git a/src/app-utils/option-util.h b/src/app-utils/option-util.h
index d3040e5..32e1080 100644
--- a/src/app-utils/option-util.h
+++ b/src/app-utils/option-util.h
@@ -153,7 +153,7 @@ gboolean gnc_option_db_dirty(GNCOptionDB *odb);
 void     gnc_option_db_clean(GNCOptionDB *odb);
 
 gboolean gnc_option_db_get_changed(GNCOptionDB *odb);
-void gnc_option_db_commit(GNCOptionDB *odb);
+GList* gnc_option_db_commit(GNCOptionDB *odb);
 
 char * gnc_option_db_get_default_section(GNCOptionDB *odb);
 
diff --git a/src/app-utils/test/CMakeLists.txt b/src/app-utils/test/CMakeLists.txt
index b179a97..43b4cbb 100644
--- a/src/app-utils/test/CMakeLists.txt
+++ b/src/app-utils/test/CMakeLists.txt
@@ -5,11 +5,11 @@ SET(APP_UTILS_TEST_INCLUDE_DIRS
   ${CMAKE_SOURCE_DIR}/src/engine # for qof.h
   ${CMAKE_SOURCE_DIR}/src/engine/test-core
   ${CMAKE_BINARY_DIR}/src # for config.h
-  ${GLIB2_INCLUDE_DIRS}
+  ${GIO_INCLUDE_DIRS}
   ${GUILE_INCLUDE_DIRS}
 )
 
-SET(APP_UTILS_TEST_LIBS gncmod-app-utils gncmod-test-engine test-core ${GUILE_LDFLAGS})
+SET(APP_UTILS_TEST_LIBS gncmod-app-utils gncmod-test-engine test-core ${GIO_LDFLAGS} ${GUILE_LDFLAGS})
 
 SET(test_app_utils_SOURCES test-app-utils.c test-option-util.cpp test-gnc-ui-util.c)
 
diff --git a/src/gnome-utils/dialog-options.c b/src/gnome-utils/dialog-options.c
index 7952bd6..356905c 100644
--- a/src/gnome-utils/dialog-options.c
+++ b/src/gnome-utils/dialog-options.c
@@ -4265,7 +4265,22 @@ scm_apply_cb (GNCOptionWin *win, gpointer data)
 
     if (gnc_option_db_get_changed (win->option_db))
     {
-        gnc_option_db_commit (win->option_db);
+        GList *results = NULL, *iter;
+        results = gnc_option_db_commit (win->option_db);
+        for (iter = results; iter; iter = iter->next)
+        {
+            GtkWidget *dialog = gtk_message_dialog_new(NULL,
+                                                       0,
+                                                       GTK_MESSAGE_ERROR,
+                                                       GTK_BUTTONS_OK,
+                                                       "%s",
+                                                       (char*)iter->data);
+            gtk_dialog_run(GTK_DIALOG(dialog));
+            gtk_widget_destroy(dialog);
+            g_free (iter->data);
+        }
+        g_list_free (results);
+
         if (cbdata->apply_cb != SCM_BOOL_F)
         {
             scm_call_0 (cbdata->apply_cb);
diff --git a/src/gnome-utils/gnc-main-window.c b/src/gnome-utils/gnc-main-window.c
index 437bb1f..20339ea 100644
--- a/src/gnome-utils/gnc-main-window.c
+++ b/src/gnome-utils/gnc-main-window.c
@@ -3984,10 +3984,24 @@ gnc_book_options_dialog_apply_helper(GNCOptionDB * options)
     gboolean use_split_action_for_num_after;
     gboolean use_book_currency_after;
     gboolean return_val = FALSE;
+    GList *results = NULL, *iter;
 
     if (!options) return return_val;
 
-    gnc_option_db_commit (options);
+    results = gnc_option_db_commit (options);
+    for (iter = results; iter; iter = iter->next)
+    {
+        GtkWidget *dialog = gtk_message_dialog_new(NULL,
+                                                   0,
+                                                   GTK_MESSAGE_ERROR,
+                                                   GTK_BUTTONS_OK,
+                                                   "%s",
+                                                   (char*)iter->data);
+        gtk_dialog_run(GTK_DIALOG(dialog));
+        gtk_widget_destroy(dialog);
+        g_free (iter->data);
+    }
+    g_list_free (results);
     qof_book_begin_edit (book);
     qof_book_save_options (book, gnc_option_db_save, options, TRUE);
     use_split_action_for_num_after =
diff --git a/src/report/report-gnome/dialog-report-column-view.c b/src/report/report-gnome/dialog-report-column-view.c
index d98683f..6f1101e 100644
--- a/src/report/report-gnome/dialog-report-column-view.c
+++ b/src/report/report-gnome/dialog-report-column-view.c
@@ -247,9 +247,24 @@ gnc_column_view_edit_apply_cb(GNCOptionWin * w, gpointer user_data)
 {
     SCM  dirty_report = scm_c_eval_string("gnc:report-set-dirty?!");
     gnc_column_view_edit * win = user_data;
+    GList *results = NULL, *iter;
 
     if (!win) return;
-    gnc_option_db_commit(win->odb);
+    results = gnc_option_db_commit (win->odb);
+    for (iter = results; iter; iter = iter->next)
+    {
+        GtkWidget *dialog = gtk_message_dialog_new(NULL,
+                                                   0,
+                                                   GTK_MESSAGE_ERROR,
+                                                   GTK_BUTTONS_OK,
+                                                   "%s",
+                                                   (char*)iter->data);
+        gtk_dialog_run(GTK_DIALOG(dialog));
+        gtk_widget_destroy(dialog);
+        g_free (iter->data);
+    }
+    g_list_free (results);
+
     scm_call_2(dirty_report, win->view, SCM_BOOL_T);
 }
 
diff --git a/src/report/report-gnome/dialog-report-style-sheet.c b/src/report/report-gnome/dialog-report-style-sheet.c
index 6991175..791b8f7 100644
--- a/src/report/report-gnome/dialog-report-style-sheet.c
+++ b/src/report/report-gnome/dialog-report-style-sheet.c
@@ -95,13 +95,28 @@ gnc_style_sheet_options_apply_cb(GNCOptionWin * propertybox,
 {
     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_option_db_commit(ssi->odb);
+    results = gnc_option_db_commit (ssi->odb);
+    for (iter = results; iter; iter = iter->next)
+    {
+        GtkWidget *dialog = gtk_message_dialog_new(NULL,
+                                                   0,
+                                                   GTK_MESSAGE_ERROR,
+                                                   GTK_BUTTONS_OK,
+                                                   "%s",
+                                                   (char*)iter->data);
+        gtk_dialog_run(GTK_DIALOG(dialog));
+        gtk_widget_destroy(dialog);
+        g_free (iter->data);
+    }
+    g_list_free (results);
+
 }
 
 
diff --git a/src/report/report-gnome/window-report.c b/src/report/report-gnome/window-report.c
index 00d7b1a..4fe2645 100644
--- a/src/report/report-gnome/window-report.c
+++ b/src/report/report-gnome/window-report.c
@@ -82,9 +82,24 @@ gnc_options_dialog_apply_cb(GNCOptionWin * propertybox,
 {
     SCM  dirty_report = scm_c_eval_string("gnc:report-set-dirty?!");
     struct report_default_params_data * win = user_data;
+    GList *results = NULL, *iter;
 
     if (!win) return;
-    gnc_option_db_commit(win->db);
+    results = gnc_option_db_commit (win->db);
+    for (iter = results; iter; iter = iter->next)
+    {
+        GtkWidget *dialog = gtk_message_dialog_new(NULL,
+                                                   0,
+                                                   GTK_MESSAGE_ERROR,
+                                                   GTK_BUTTONS_OK,
+                                                   "%s",
+                                                   (char*)iter->data);
+        gtk_dialog_run(GTK_DIALOG(dialog));
+        gtk_widget_destroy(dialog);
+        g_free (iter->data);
+    }
+    g_list_free (results);
+
     scm_call_2(dirty_report, win->cur_report, SCM_BOOL_T);
 }
 

commit 708a9a47756fb7da8b6755e207d93bf09405821b
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Mon Aug 7 11:37:53 2017 +0200

    Make all backend loading use the same build environment module path resolution
    
    This obsoletes some cmake hacks

diff --git a/CMakeLists.txt b/CMakeLists.txt
index b8ace79..cc02ebb 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -527,12 +527,8 @@ ADD_CUSTOM_TARGET(check
      scm-test-core scm-test-report-system scm-standard-reports-2
      scm-test-standard-reports foo gncmodfoo baz gncmodbaz
      bar gncmodbar gncmod_agedver gncmod_incompatdep
-     gncmod_futuremodsys check-po test-core-guile
+     gncmod_futuremodsys check-po test-core-guile gncmod-backend-xml
 )
-IF (NOT WIN32)
-  ADD_DEPENDENCIES(check gncmod-backend-xml-link)
-ENDIF()
-
 
 SET(gnucash_DOCS
     AUTHORS
diff --git a/src/backend/dbi/CMakeLists.txt b/src/backend/dbi/CMakeLists.txt
index e7432a2..f8028bd 100644
--- a/src/backend/dbi/CMakeLists.txt
+++ b/src/backend/dbi/CMakeLists.txt
@@ -45,20 +45,3 @@ INSTALL(TARGETS gncmod-backend-dbi
   ARCHIVE DESTINATION lib/gnucash
   RUNTIME DESTINATION bin)
 # No headers to install
-
-# FIXME: Below is a hack to create .libs/libgncmod-backend-dbi to silence some complaints
-# from guile when compiling. Eventually, fix the guile module loader to not expect items
-# to be in .libs. At this time, WIN32 does not use guile-2, so no need for this.
-
-IF (NOT WIN32)
-  SET(_LINK_TARGET ${CMAKE_CURRENT_BINARY_DIR}/.libs/libgncmod-backend-dbi${CMAKE_SHARED_LIBRARY_SUFFIX})
-  FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/.libs)
-
-  ADD_CUSTOM_COMMAND(
-      OUTPUT ${_LINK_TARGET}
-      COMMAND ${CMAKE_COMMAND} -E create_symlink $<TARGET_FILE:gncmod-backend-dbi> ${_LINK_TARGET}
-      DEPENDS gnc-backend-dbi
-  )
-
-  ADD_CUSTOM_TARGET(gncmod-backend-dbi-link ALL DEPENDS gncmod-backend-dbi ${_LINK_TARGET})
-ENDIF()
diff --git a/src/backend/dbi/test/Makefile.am b/src/backend/dbi/test/Makefile.am
index 15e48fc..13e52cb 100644
--- a/src/backend/dbi/test/Makefile.am
+++ b/src/backend/dbi/test/Makefile.am
@@ -35,6 +35,7 @@ GNC_TEST_DEPS = \
   --library-dir    ${top_builddir}/src/backend/xml
 
 TESTS_ENVIRONMENT = \
+  GNC_BUILDDIR=${abs_top_builddir} \
   GNC_ACCOUNT_PATH=${top_srcdir}/accounts/C \
   SRCDIR=${srcdir} \
   ${gnc_dbd_dir_override} \
diff --git a/src/backend/dbi/test/test-backend-dbi.cpp b/src/backend/dbi/test/test-backend-dbi.cpp
index 6bf6785..4936ed0 100644
--- a/src/backend/dbi/test/test-backend-dbi.cpp
+++ b/src/backend/dbi/test/test-backend-dbi.cpp
@@ -29,20 +29,23 @@ extern "C"
 }
 extern void test_suite_gnc_backend_dbi ();
 
-#define GNC_LIB_NAME "gncmod-backend-dbi"
+#define GNC_LIB_NAME_1 "gncmod-backend-dbi"
+#define GNC_LIB_REL_PATH_1 "dbi"
+#define GNC_LIB_NAME_2 "gncmod-backend-xml"
+#define GNC_LIB_REL_PATH_2 "xml"
 
 int
 main (int   argc,
       char* argv[])
 {
+    g_setenv ("GNC_UNINSTALLED", "1", TRUE);
     qof_init (); /* equally initializes gobject system */
     qof_log_init_filename_special ("stderr"); /* Init the log system */
     g_test_init (&argc, &argv, NULL);       /* initialize test program */
     g_test_bug_base ("https://bugzilla.gnome.org/show_bug.cgi?id="); /* init the bugzilla URL */
     cashobjects_register ();
-    g_assert (qof_load_backend_library ("../.libs/", GNC_LIB_NAME));
-    g_assert (qof_load_backend_library ("../../xml/.libs",
-                                        "gncmod-backend-xml"));
+    g_assert (qof_load_backend_library (GNC_LIB_REL_PATH_1, GNC_LIB_NAME_1));
+    g_assert (qof_load_backend_library (GNC_LIB_REL_PATH_2, GNC_LIB_NAME_2));
 
     test_suite_gnc_backend_dbi ();
 
diff --git a/src/backend/sql/test/test-column-types.cpp b/src/backend/sql/test/test-column-types.cpp
index b8f9b53..ce92fb8 100644
--- a/src/backend/sql/test/test-column-types.cpp
+++ b/src/backend/sql/test/test-column-types.cpp
@@ -38,10 +38,6 @@ int main (int argc, char** argv)
 {
     qof_init ();
     cashobjects_register ();
-    /*    do_test(
-            qof_load_backend_library ("../.libs/", GNC_LIB_NAME),
-            " loading gnc-backend-gda GModule failed");
-    */
     print_test_results ();
     qof_close ();
     exit (get_rv ());
diff --git a/src/backend/xml/CMakeLists.txt b/src/backend/xml/CMakeLists.txt
index e238f1e..fa10ebd 100644
--- a/src/backend/xml/CMakeLists.txt
+++ b/src/backend/xml/CMakeLists.txt
@@ -127,22 +127,3 @@ ADD_LIBRARY(gncmod-backend-xml-utils ${libgncmod_backend_xml_SOURCES})
 TARGET_LINK_LIBRARIES(gncmod-backend-xml-utils gnc-backend-xml-utils gncmod-engine
                         gnc-core-utils ${LIBXML2_LDFLAGS} ${GLIB2_LDFLAGS} ${ZLIB_LIBRARY})
 TARGET_COMPILE_DEFINITIONS (gncmod-backend-xml-utils PRIVATE -DG_LOG_DOMAIN=\"gnc.backend.xml\" -DU_SHOW_CPLUSPLUS_API=0)
-
-# ----
-
-# FIXME: Below is a hack to create .libs/libgncmod-backend-xml to silence some complaints
-# from guile when compiling. Eventually, fix the guile module loader to not expect items
-# to be in .libs. At this time, WIN32 does not use guile-2, so no need for this.
-
-IF (NOT WIN32)
-  SET(_LINK_TARGET ${CMAKE_CURRENT_BINARY_DIR}/.libs/libgncmod-backend-xml${CMAKE_SHARED_MODULE_SUFFIX})
-  FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/.libs)
-
-  ADD_CUSTOM_COMMAND(
-      OUTPUT ${_LINK_TARGET}
-      COMMAND ${CMAKE_COMMAND} -E create_symlink $<TARGET_FILE:gncmod-backend-xml> ${_LINK_TARGET}
-      DEPENDS gnc-backend-xml-utils
-  )
-
-  ADD_CUSTOM_TARGET(gncmod-backend-xml-link ALL DEPENDS gncmod-backend-xml ${_LINK_TARGET})
-ENDIF()
diff --git a/src/backend/xml/test/test-load-backend.cpp b/src/backend/xml/test/test-load-backend.cpp
index b891743..30dde8a 100644
--- a/src/backend/xml/test/test-load-backend.cpp
+++ b/src/backend/xml/test/test-load-backend.cpp
@@ -33,13 +33,15 @@ extern "C"
 }
 
 #define GNC_LIB_NAME "gncmod-backend-xml"
+#define GNC_LIB_REL_PATH "xml"
 
 int main (int argc, char** argv)
 {
+    g_setenv ("GNC_UNINSTALLED", "1", TRUE);
     qof_init ();
     cashobjects_register ();
     do_test (
-        qof_load_backend_library ("../.libs/", GNC_LIB_NAME),
+        qof_load_backend_library (GNC_LIB_REL_PATH, GNC_LIB_NAME),
         " loading gnc-backend-xml GModule failed");
     print_test_results ();
     qof_close ();
diff --git a/src/backend/xml/test/test-load-xml2.cpp b/src/backend/xml/test/test-load-xml2.cpp
index 9d0ce80..08eb170 100644
--- a/src/backend/xml/test/test-load-xml2.cpp
+++ b/src/backend/xml/test/test-load-xml2.cpp
@@ -55,6 +55,7 @@ extern "C"
 #include "test-file-stuff.h"
 
 #define GNC_LIB_NAME "gncmod-backend-xml"
+#define GNC_LIB_REL_PATH "xml"
 
 static void
 remove_files_pattern (const char* begining, const char* ending)
@@ -120,13 +121,14 @@ test_load_file (const char* filename)
 int
 main (int argc, char** argv)
 {
+    g_setenv ("GNC_UNINSTALLED", "1", TRUE);
     const char* location = g_getenv ("GNC_TEST_FILES");
     int files_tested = 0;
     GDir* xml2_dir;
 
     qof_init ();
     cashobjects_register ();
-    do_test (qof_load_backend_library ("../.libs/", GNC_LIB_NAME),
+    do_test (qof_load_backend_library (GNC_LIB_REL_PATH, GNC_LIB_NAME),
              " loading gnc-backend-xml GModule failed");
 
     if (!location)
diff --git a/src/cmake_modules/GncAddTest.cmake b/src/cmake_modules/GncAddTest.cmake
index b76fd8e..fc87714 100644
--- a/src/cmake_modules/GncAddTest.cmake
+++ b/src/cmake_modules/GncAddTest.cmake
@@ -76,14 +76,15 @@ FUNCTION(GNC_ADD_TEST _TARGET _SOURCE_FILES TEST_INCLUDE_VAR_NAME TEST_LIBS_VAR_
   IF (${HAVE_ENV_VARS})
     SET(CMAKE_COMMAND_TMP "")
     IF (${CMAKE_VERSION} VERSION_GREATER 3.1)
-      SET(CMAKE_COMMAND_TMP ${CMAKE_COMMAND} -E env "${ARGN}")
+      SET(CMAKE_COMMAND_TMP ${CMAKE_COMMAND} -E env "GNC_BUILDDIR=${CMAKE_BINARY_DIR};${ARGN}")
     ENDIF()
     ADD_TEST(${_TARGET} ${CMAKE_COMMAND_TMP}
       ${CMAKE_BINARY_DIR}/bin/${_TARGET}
     )
-    SET_TESTS_PROPERTIES(${_TARGET} PROPERTIES ENVIRONMENT "${ARGN}")
+    SET_TESTS_PROPERTIES(${_TARGET} PROPERTIES ENVIRONMENT "GNC_BUILDDIR=${CMAKE_BINARY_DIR};${ARGN}")
   ELSE()
     ADD_TEST(NAME ${_TARGET} COMMAND ${_TARGET})
+    SET_TESTS_PROPERTIES(${_TARGET} PROPERTIES ENVIRONMENT "GNC_BUILDDIR=${CMAKE_BINARY_DIR}")
   ENDIF()
   ADD_DEPENDENCIES(check ${_TARGET})
 ENDFUNCTION()
diff --git a/src/engine/CMakeLists.txt b/src/engine/CMakeLists.txt
index b325b02..c47c102 100644
--- a/src/engine/CMakeLists.txt
+++ b/src/engine/CMakeLists.txt
@@ -269,23 +269,18 @@ SET (engine_SCHEME_1
     engine-utilities.scm
     gnc-numeric.scm
 )
-IF (NOT WIN32)
-  SET(BACKEND_DEPENDS gncmod-backend-xml-link)
-
-  IF(WITH_SQL)
-    LIST(APPEND BACKEND_DEPENDS gncmod-backend-dbi-link)
-  ENDIF(WITH_SQL)
-ELSE (NOT WIN32)
+IF (WIN32)
   ADD_DEFINITIONS (-DOS_WIN32)
   SET (engine_SOURCES ${engine_SOURCES}
   qof-win32.cpp
   ../../lib/libc/strptime.c
   )
-   SET(BACKEND_DEPENDS gncmod-backend-xml)
-   IF (WITH_SQL)
-      LIST(APPEND BACKEND_DEPENDS gncmod-backend-dbi)
-   ENDIF(WITH_SQL)
-ENDIF (NOT WIN32)
+ENDIF (WIN32)
+
+SET(BACKEND_DEPENDS gncmod-backend-xml)
+IF (WITH_SQL)
+    LIST(APPEND BACKEND_DEPENDS gncmod-backend-dbi)
+ENDIF(WITH_SQL)
 
 SET(GUILE_MODULES      "")
 SET(GUILE_LOAD_DIRS    src/gnc-module)
diff --git a/src/engine/gnc-engine.c b/src/engine/gnc-engine.c
index fd6bf11..0cb344d 100644
--- a/src/engine/gnc-engine.c
+++ b/src/engine/gnc-engine.c
@@ -66,11 +66,6 @@ gnc_engine_init_part1()
 static void
 gnc_engine_init_part2()
 {
-    gchar *pkglibdir;
-    const gchar *builddir = g_getenv ("GNC_BUILDDIR");
-    gboolean uninstalled = (g_getenv ("GNC_UNINSTALLED") != NULL
-                            && builddir != NULL);
-
     static struct
     {
         const gchar* subdir;
@@ -85,50 +80,22 @@ gnc_engine_init_part2()
         { NULL, FALSE }
     }, *lib;
 
-    if (uninstalled)
-#ifdef CMAKE_BUILD
-	pkglibdir = g_build_path (G_DIR_SEPARATOR_S, builddir, NULL);
-#ifdef WIN32
-#define LIBDIR "bin"
-#else
-#define LIBDIR "lib/gnucash"
-#endif
-#else
-        pkglibdir = g_build_path (G_DIR_SEPARATOR_S, builddir,
-                                  "src", "backend", NULL);
-#endif
-    else
-        pkglibdir = gnc_path_get_pkglibdir ();
-
     for (lib = libs; lib->lib ; lib++)
     {
-        gchar *libdir;
-        if (uninstalled)
-#ifdef CMAKE_BUILD
-	    libdir = g_build_path (G_DIR_SEPARATOR_S, pkglibdir, LIBDIR, NULL);
-#else
-            libdir = g_build_path (G_DIR_SEPARATOR_S, pkglibdir,
-                                   lib->subdir, ".libs", NULL);
-#endif
-        else
-            libdir = pkglibdir;
-        if (qof_load_backend_library(libdir, lib->lib))
+        if (qof_load_backend_library(lib->subdir, lib->lib))
         {
             engine_is_initialized = 1;
         }
         else
         {
-            g_warning("failed to load %s from %s\n", lib->lib, libdir);
+            g_warning("failed to load %s from relative path %s\n", lib->lib, lib->subdir);
             /* If this is a required library, stop now! */
             if (lib->required)
             {
                 g_critical("required library %s not found.\n", lib->lib);
             }
         }
-        if (uninstalled)
-            g_free (libdir);
     }
-    g_free (pkglibdir);
 }
 
 static void
diff --git a/src/engine/gnc-engine.h b/src/engine/gnc-engine.h
index 4522e1e..f8f1c98 100644
--- a/src/engine/gnc-engine.h
+++ b/src/engine/gnc-engine.h
@@ -220,19 +220,15 @@ typedef void (* gnc_engine_init_hook_t)(int, char **);
 /** PROTOTYPES ******************************************************/
 
 /** gnc_engine_init should be called before gnc engine
- * functions can be used - see also ::qof_init for a
- * method that does not require Guile. */
+ * functions can be used. */
 void gnc_engine_init(int argc, char ** argv);
 
 /** This is the statically linked-in version of gnc_engine_init. It is
- * identically to that function except that it doesn't load the
- * loadable shared module, which means this function will not load the
- * "(gnucash engine)" scheme module.
+ * identical to that function except that it doesn't load any backend library.
  */
 void gnc_engine_init_static(int argc, char ** argv);
 
-/** Called to shutdown the engine, see also ::qof_close
- * for use without Guile. */
+/** Called to shutdown the engine. */
 void gnc_engine_shutdown (void);
 
 /** check the engine is fully initialized */
diff --git a/src/engine/qof-backend.cpp b/src/engine/qof-backend.cpp
index e779fc0..24f58a9 100644
--- a/src/engine/qof-backend.cpp
+++ b/src/engine/qof-backend.cpp
@@ -27,6 +27,7 @@ extern "C"
 
 #include <config.h>
 #include "qof.h"
+#include <gnc-path.h>
 }
 
 #include <string>
@@ -81,6 +82,48 @@ QofBackend::get_message ()
     return std::move(m_error_msg);
 }
 
+/* Helper function that return a directory from which the requested module
+ * can be loaded. This is needed because the location of the modules
+ * depends on
+ * - whether we're running in an installed environment or the build environment
+ * - the operation system
+ * - (in the build environment) which build system is used
+ *
+ * Note parameter rel_path is only used when invoked in the build environment
+ * because each backend module is likely to reside in its own directory. At
+ * install time it is assumed all backend modules reside in one single directory.
+ */
+static char* get_default_module_dir(const char* rel_path)
+{
+    gchar *pkglibdir;
+    const gchar *builddir = g_getenv ("GNC_BUILDDIR");
+    gboolean uninstalled = (g_getenv ("GNC_UNINSTALLED") != NULL
+                            && builddir != NULL);
+
+    if (uninstalled)
+    {
+#ifdef CMAKE_BUILD
+    #ifdef WIN32
+        #define LIBDIR "bin"
+    #else
+        #define LIBDIR "lib/gnucash"
+    #endif
+        pkglibdir = g_build_path (G_DIR_SEPARATOR_S, builddir, LIBDIR, NULL);
+#else
+        if (rel_path)
+            pkglibdir = g_build_path (G_DIR_SEPARATOR_S, builddir,
+                                      "src", "backend", rel_path, ".libs", NULL);
+        else
+            pkglibdir = g_build_path (G_DIR_SEPARATOR_S, builddir,
+                                      "src", "backend", ".libs", NULL);
+#endif
+    }
+    else
+        pkglibdir = gnc_path_get_pkglibdir ();
+
+    return pkglibdir;
+}
+
 bool
 QofBackend::register_backend(const char* directory, const char* module_name)
 {
@@ -89,15 +132,20 @@ QofBackend::register_backend(const char* directory, const char* module_name)
         PWARN("Modules not supported.");
         return false;
     }
-    auto fullpath = g_module_build_path (directory, module_name);
+
+    auto absdir = g_strdup(directory);
+    if (!absdir || !g_path_is_absolute(absdir))
+        absdir = get_default_module_dir(directory);
+    auto fullpath = g_module_build_path (absdir, module_name);
+    g_free (absdir);
 /* Darwin modules can have either .so or .dylib for a suffix */
     if (!g_file_test (fullpath, G_FILE_TEST_EXISTS) &&
-	g_strcmp0 (G_MODULE_SUFFIX, "so") == 0)
+        g_strcmp0 (G_MODULE_SUFFIX, "so") == 0)
     {
-	auto modname = g_strdup_printf ("lib%s.dylib", module_name);
-	g_free (fullpath);
-	fullpath = g_build_filename (directory, modname, NULL);
-	g_free (modname);
+        auto modname = g_strdup_printf ("lib%s.dylib", module_name);
+        g_free (fullpath);
+        fullpath = g_build_filename (directory, modname, NULL);
+        g_free (modname);
     }
     auto backend = g_module_open (fullpath, G_MODULE_BIND_LAZY);
     g_free (fullpath);
diff --git a/src/import-export/aqb/test/Makefile.am b/src/import-export/aqb/test/Makefile.am
index be4a096..e2abe12 100644
--- a/src/import-export/aqb/test/Makefile.am
+++ b/src/import-export/aqb/test/Makefile.am
@@ -61,7 +61,8 @@ test_aqb_CFLAGS = \
   ${GLIB_CFLAGS} \
   ${AQBANKING_CFLAGS}
 
-TESTS_ENVIRONMENT = \
+  TESTS_ENVIRONMENT = \
+  GNC_BUILDDIR=${abs_top_builddir} \
   SRCDIR=${srcdir} \
   G_DEBUG=
 
diff --git a/src/import-export/aqb/test/test-aqb.c b/src/import-export/aqb/test/test-aqb.c
index aef78b3..95c8860 100644
--- a/src/import-export/aqb/test/test-aqb.c
+++ b/src/import-export/aqb/test/test-aqb.c
@@ -37,6 +37,7 @@ int
 main (int   argc,
       char *argv[])
 {
+    g_setenv ("GNC_UNINSTALLED", "1", TRUE);
     qof_init(); 			/* Initialize the GObject system */
     qof_log_init_filename_special("stderr"); /* Init the log system */
     g_test_init ( &argc, &argv, NULL ); 	/* initialize test program */
@@ -46,9 +47,7 @@ main (int   argc,
     xaccLogDisable();
 
     gnc_module_system_init();
-    gnc_engine_init_static(argc, argv);
-    qof_load_backend_library ("../../../backend/xml/.libs/",
-			      "gncmod-backend-xml");
+    gnc_engine_init(argc, argv);
 
     /* Add test functions and suites. See
      * http://library.gnome.org/devel/glib/stable/glib-Testing.html for

commit 8687dfb1da570bd850c21b644d7cf1bf3c571c4d
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Sun Aug 6 17:12:16 2017 +0200

    Merge qof directory into engine
    
    They are both about handling core gnucash objects. Qof was once split out
    in an attempt to make it a separate library. This hasn't worked out so there's
    no good reason any more to keep this artificial separation.
    
    A few considerations:
    - The qof tests are merged into the engine test directory but they are kept as
      a separate test entity for now. Several assumptions made in the qof tests
      are no longer valid in the context of the engine. (For example if the
      pricedb test is added in the same test executable as the qofbook test,
      the book creation test fails because it now has 2 collections (pricedb and
      book) instead of only one. There are plenty of others like this so merging
      the tests needs more careful review and is perhaps best done while converting
      to c++/Google test.
    - I had to use unique names for the MockBackend classes because apparently the tests were
      using a MockClass from another file in the cmake builds, causing several
      tests to fail.

diff --git a/.gitignore b/.gitignore
index 0c499a6..3d5e3ea 100644
--- a/.gitignore
+++ b/.gitignore
@@ -51,8 +51,6 @@ intltool-merge.in
 intltool-update
 intltool-update.in
 lib/guile-www/www
-lib/libqof/backend/file/qsf-dir.h
-lib/libqof/qof/qofla-dir.h
 libtool
 ltmain.sh
 macros/intltool.m4
@@ -194,10 +192,7 @@ src/import-export/qif-import/qif-import
 src/import-export/qif-import/test/test-link
 src/import-export/test/test-import-parse
 src/import-export/test/test-link
-src/libqof/backend/file/qsf-dir.h
-src/libqof/qof/qofla-dir.h
-src/libqof/qof/test-qofmath
-src/libqof/qof/test/test-qof
+src/engine/test/test-qof
 src/optional/gtkmm/test/test-gtkmm
 src/optional/python-bindings/.py-links
 src/optional/python-bindings/gnucash/
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e9d973f..b8ace79 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -672,7 +672,7 @@ configure_file(
 add_custom_target(uninstall
         COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
 
-SET_TARGET_PROPERTIES(gnc-qof gnc-core-utils gnc-module gnc-backend-sql gnc-backend-xml-utils
+SET_TARGET_PROPERTIES(gnc-core-utils gnc-module gnc-backend-sql gnc-backend-xml-utils
   gnc-gnome PROPERTIES
   LIBRARY_OUTPUT_DIRECTORY         ${CMAKE_BINARY_DIR}/lib
   IF (XCODE_VERSION)
diff --git a/HACKING b/HACKING
index ecefe41..24b8ed6 100644
--- a/HACKING
+++ b/HACKING
@@ -79,7 +79,7 @@ This is known to not work very well.  Instead, `--prefix` your build into /opt/g
 
 Getting Trace Messages From GnuCash
 -----------------------------------
-See the doxygen comments in lib/libqof/qof/qoflog.h (and .c)
+See the doxygen comments in src/engine/qoflog.h (and .c)
 
 Starting GnuCash in GDB
 -----------------------
diff --git a/configure.ac b/configure.ac
index f1e5c02..3478c82 100644
--- a/configure.ac
+++ b/configure.ac
@@ -657,17 +657,6 @@ AC_CHECK_LIB(z, gzopen, [:], [
 ])
 LIBS="$oLIBS"
 
-### --------------------------------------------------------------------------
-### Internal code part which is called "qof"
-
-LIBQOF_LIBRARY_VERSION=1:4:0
-AC_SUBST(LIBQOF_LIBRARY_VERSION)
-
-QOF_CFLAGS='-I${top_builddir}/src/libqof/qof -I${top_srcdir}/src/libqof/qof'
-QOF_LIBS='${top_builddir}/src/libqof/qof/libgnc-qof.la'
-AC_SUBST(QOF_CFLAGS)
-AC_SUBST(QOF_LIBS)
-
 ### ----------------------
 ### LIBDBI
 
@@ -1740,9 +1729,6 @@ AC_CONFIG_FILES(
   src/import-export/aqb/Makefile
   src/import-export/aqb/gschemas/Makefile
   src/import-export/aqb/test/Makefile
-  src/libqof/Makefile
-  src/libqof/qof/Makefile
-  src/libqof/qof/test/Makefile
   src/optional/Makefile
   src/optional/gtkmm/Makefile
   src/optional/gtkmm/test/Makefile
diff --git a/make-gnucash-potfiles.in b/make-gnucash-potfiles.in
index 576c0bb..a3d58ac 100644
--- a/make-gnucash-potfiles.in
+++ b/make-gnucash-potfiles.in
@@ -79,5 +79,5 @@ foreach my $file (@possible_files) {
 # These are also added, even though they are outside of src/
 print "src/gnome/gnucash.appdata.xml.in\n";
 print "src/gnome/gnucash.desktop.in.in\n";
-print "src/libqof/qof/qofbookslots.h\n";
+print "src/engine/qofbookslots.h\n";
 print "doc/tip_of_the_day.list.in\n";
diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt
index 77bd40c..2ab86f7 100644
--- a/po/CMakeLists.txt
+++ b/po/CMakeLists.txt
@@ -132,7 +132,7 @@ FUNCTION(MAKE_GNUCASH_POTFILES)
   # These are also added, even though they are outside of src/
   FILE(APPEND ${POTFILES_IN_PATH} "src/gnome/gnucash.appdata.xml.in
 src/gnome/gnucash.desktop.in.in
-src/libqof/qof/qofbookslots.h
+src/engine/qofbookslots.h
 doc/tip_of_the_day.list.in
 ")
 
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 135a8ee..b5d9eec 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -134,12 +134,15 @@ src/engine/engine.scm
 src/engine/engine-utilities.scm
 src/engine/glib-helpers.c
 src/engine/gncAddress.c
+src/engine/gnc-aqbanking-templates.cpp
 src/engine/gncBillTerm.c
 src/engine/gnc-budget.c
 src/engine/gncBusGuile.c
 src/engine/gncBusiness.c
 src/engine/gnc-commodity.c
 src/engine/gncCustomer.c
+src/engine/gnc-date.cpp
+src/engine/gnc-datetime.cpp
 src/engine/gncEmployee.c
 src/engine/gnc-engine.c
 src/engine/gncEntry.c
@@ -147,20 +150,42 @@ src/engine/gnc-event.c
 src/engine/gnc-features.c
 src/engine/gnc-hooks.c
 src/engine/gncIDSearch.c
+src/engine/gnc-int128.cpp
 src/engine/gncInvoice.c
 src/engine/gncJob.c
 src/engine/gnc-lot.c
 src/engine/gncmod-engine.c
+src/engine/gnc-numeric.cpp
 src/engine/gnc-numeric.scm
 src/engine/gncOrder.c
 src/engine/gncOwner.c
 src/engine/gnc-pricedb.c
+src/engine/gnc-rational.cpp
 src/engine/gnc-session.c
 src/engine/gncTaxTable.c
+src/engine/gnc-timezone.cpp
 src/engine/gnc-uri-utils.c
 src/engine/gncVendor.c
+src/engine/guid.cpp
+src/engine/kvp-frame.cpp
 src/engine/kvp-scm.cpp
+src/engine/kvp-value.cpp
 src/engine/policy.c
+src/engine/qof-backend.cpp
+src/engine/qofbook.cpp
+src/engine/qofchoice.cpp
+src/engine/qofclass.cpp
+src/engine/qofevent.cpp
+src/engine/qofid.cpp
+src/engine/qofinstance.cpp
+src/engine/qoflog.cpp
+src/engine/qofobject.cpp
+src/engine/qofquerycore.cpp
+src/engine/qofquery.cpp
+src/engine/qofsession.cpp
+src/engine/qof-string-cache.cpp
+src/engine/qofutil.cpp
+src/engine/qof-win32.cpp
 src/engine/Query.c
 src/engine/Recurrence.c
 src/engine/SchedXaction.c
@@ -477,31 +502,6 @@ src/import-export/qif-imp/qif-objects.scm
 src/import-export/qif-imp/qif-parse.scm
 src/import-export/qif-imp/qif-to-gnc.scm
 src/import-export/qif-imp/qif-utils.scm
-src/libqof/qof/gnc-aqbanking-templates.cpp
-src/libqof/qof/gnc-date.cpp
-src/libqof/qof/gnc-datetime.cpp
-src/libqof/qof/gnc-int128.cpp
-src/libqof/qof/gnc-numeric.cpp
-src/libqof/qof/gnc-rational.cpp
-src/libqof/qof/gnc-timezone.cpp
-src/libqof/qof/guid.cpp
-src/libqof/qof/kvp_frame.cpp
-src/libqof/qof/kvp-value.cpp
-src/libqof/qof/qof-backend.cpp
-src/libqof/qof/qofbook.cpp
-src/libqof/qof/qofchoice.cpp
-src/libqof/qof/qofclass.cpp
-src/libqof/qof/qofevent.cpp
-src/libqof/qof/qofid.cpp
-src/libqof/qof/qofinstance.cpp
-src/libqof/qof/qoflog.cpp
-src/libqof/qof/qofobject.cpp
-src/libqof/qof/qofquerycore.cpp
-src/libqof/qof/qofquery.cpp
-src/libqof/qof/qofsession.cpp
-src/libqof/qof/qof-string-cache.cpp
-src/libqof/qof/qofutil.cpp
-src/libqof/qof/qof-win32.cpp
 src/plugins/bi_import/dialog-bi-import.c
 src/plugins/bi_import/dialog-bi-import-gui.c
 src/plugins/bi_import/dialog-bi-import-helper.c
@@ -678,5 +678,5 @@ src/tax/us/txf.scm
 src/tax/us/us.scm
 src/gnome/gnucash.appdata.xml.in
 src/gnome/gnucash.desktop.in.in
-src/libqof/qof/qofbookslots.h
+src/engine/qofbookslots.h
 doc/tip_of_the_day.list.in
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 4573fc7..55fbe34 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -141,7 +141,6 @@ SET(SCHEME_INSTALLED_SOURCE_DIR ${CMAKE_INSTALL_PREFIX}/share/gnucash/scm)
 SET(SCHEME_INSTALLED_CACHE_DIR ${CMAKE_INSTALL_PREFIX}/lib/gnucash/scm/ccache/${GUILE_EFFECTIVE_VERSION})
 
 # The subdirectories
-ADD_SUBDIRECTORY (libqof)
 ADD_SUBDIRECTORY (core-utils)
 ADD_SUBDIRECTORY (gnc-module)
 ADD_SUBDIRECTORY (engine)
@@ -187,5 +186,5 @@ SET_LOCAL_DIST(src_DIST_local CMakeLists.txt Makefile.am ${src_EXTRA_DIST})
 
 SET(src_DIST ${src_DIST_local} ${app_utils_DIST} ${backend_DIST} ${bin_DIST} ${cmake_modules_DIST}
              ${core_utils_DIST} ${debug_DIST} ${doc_DIST} ${engine_DIST} ${gnc_module_DIST} ${gnome_DIST} ${gnome_search_DIST}
-             ${gnome_utils_DIST} ${html_DIST} ${import_export_DIST} ${libqof_DIST} ${optional_DIST} ${plugins_DIST} ${pixmaps_DIST} ${python_DIST}
+             ${gnome_utils_DIST} ${html_DIST} ${import_export_DIST} ${optional_DIST} ${plugins_DIST} ${pixmaps_DIST} ${python_DIST}
              ${quotes_DIST} ${register_DIST} ${report_DIST} ${scm_DIST} ${tax_DIST} ${test_core_DIST} PARENT_SCOPE)
diff --git a/src/Makefile.am b/src/Makefile.am
index 280839a..7d72bcd 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,13 +1,18 @@
 # These directories do not contain any gtk dependencies
+# Note the unusual ordering of some test directories. This is
+# because test-core depends on engine and the test directories
+# in turn depend on test-core.
 NONGUI_SUBDIRS = \
-  libqof \
-  test-core \
   debug \
   doc \
   pixmaps \
   core-utils \
   gnc-module \
   engine \
+  test-core \
+  core-utils/test \
+  gnc-module/test \
+  engine/test \
   backend \
   scm \
   quotes
diff --git a/src/app-utils/CMakeLists.txt b/src/app-utils/CMakeLists.txt
index f27cbf4..b15f510 100644
--- a/src/app-utils/CMakeLists.txt
+++ b/src/app-utils/CMakeLists.txt
@@ -83,7 +83,7 @@ SET_SOURCE_FILES_PROPERTIES (${app_utils_SOURCES} PROPERTIES OBJECT_DEPENDS ${CO
 SET(app_utils_ALL_SOURCES ${app_utils_SOURCES} ${app_utils_HEADERS} ${app_utils_noinst_HEADERS})
 SET(app_utils_ALL_LIBRARIES gncmod-engine gnc-module ${GTK3_LDFLAGS} ${LIBXML2_LDFLAGS} ${LIBXSLT_LDFLAGS})
 SET(app_utils_ALL_INCLUDES  ${CMAKE_CURRENT_SOURCE_DIR}/calculation  ${LIBXML2_INCLUDE_DIRS}
-                               ${LIBXSLT_INCLUDE_DIRS} ${GTK3_INCLUDE_DIRS})
+                            ${LIBXSLT_INCLUDE_DIRS} ${GTK3_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/engine)
 
 IF (WIN32)
   LIST(APPEND app_utils_ALL_SOURCES gnc-help-utils.c)
@@ -171,7 +171,7 @@ SET(app_utils_SCHEME_3
 
 SET(GUILE_MODULES      src/engine)
 SET(GUILE_LOAD_DIRS    src/app-utils src/core-utils src/engine src/gnc-module src/scm)
-SET(GUILE_LIBRARY_DIRS src/app-utils src/core-utils src/engine src/gnc-module src/libqof/qof)
+SET(GUILE_LIBRARY_DIRS src/app-utils src/core-utils src/engine src/gnc-module)
 SET(GUILE_DEPENDS      gncmod-app-utils scm-core-utils scm-engine scm-scm)
 
 GNC_ADD_SCHEME_TARGETS(scm-gettext
diff --git a/src/app-utils/Makefile.am b/src/app-utils/Makefile.am
index 10d6836..f9efdf4 100644
--- a/src/app-utils/Makefile.am
+++ b/src/app-utils/Makefile.am
@@ -28,7 +28,6 @@ AM_CPPFLAGS = \
   -I${top_srcdir}/src/app-utils/calculation \
   -I${top_srcdir}/src/core-utils \
   -I${top_srcdir}/src/engine \
-  -I${top_srcdir}/src/libqof/qof \
   -I${top_srcdir}/src/backend/xml \
   ${GUILE_CFLAGS} \
   ${PYTHON_CPPFLAGS} \
@@ -100,7 +99,6 @@ libgncmod_app_utils_la_LIBADD = \
   ${top_builddir}/src/gnc-module/libgnc-module.la \
   ${top_builddir}/src/engine/libgncmod-engine.la \
   ${top_builddir}/src/core-utils/libgnc-core-utils.la \
-  ${top_builddir}/src/libqof/qof/libgnc-qof.la \
   ${GTK_LIBS} \
   ${GUILE_LIBS} \
   ${GLIB_LIBS} \
@@ -213,7 +211,6 @@ GUILE_COMPILE_ENV = \
   --guile-load-dir ${top_builddir}/src/engine \
   --guile-load-dir ${top_builddir}/src/gnc-module \
   --guile-load-dir ${top_builddir}/src/scm \
-  --library-dir    ${top_builddir}/src/libqof/qof \
   --library-dir    ${top_builddir}/src/core-utils \
   --library-dir    ${top_builddir}/src/gnc-module \
   --library-dir    ${top_builddir}/src/engine \
diff --git a/src/app-utils/gnc-gsettings.c b/src/app-utils/gnc-gsettings.c
index 00f2f53..99b4deb 100644
--- a/src/app-utils/gnc-gsettings.c
+++ b/src/app-utils/gnc-gsettings.c
@@ -30,7 +30,7 @@
 #include "gnc-path.h"
 #include "guile-mappings.h"
 #include <libguile.h>
-#include "libqof/qof/qof.h"
+#include "qof.h"
 #include "gnc-prefs-p.h"
 
 #include <libxml/xmlmemory.h>
diff --git a/src/app-utils/test/CMakeLists.txt b/src/app-utils/test/CMakeLists.txt
index d1a1b7d..b179a97 100644
--- a/src/app-utils/test/CMakeLists.txt
+++ b/src/app-utils/test/CMakeLists.txt
@@ -1,15 +1,15 @@
 
 SET(APP_UTILS_TEST_INCLUDE_DIRS
   ${CMAKE_SOURCE_DIR}/src/app-utils
-  ${CMAKE_SOURCE_DIR}/src/libqof/qof # for qof.h
   ${CMAKE_SOURCE_DIR}/src/test-core
+  ${CMAKE_SOURCE_DIR}/src/engine # for qof.h
   ${CMAKE_SOURCE_DIR}/src/engine/test-core
   ${CMAKE_BINARY_DIR}/src # for config.h
   ${GLIB2_INCLUDE_DIRS}
   ${GUILE_INCLUDE_DIRS}
 )
 
-SET(APP_UTILS_TEST_LIBS gncmod-app-utils gncmod-test-engine gnc-qof test-core ${GUILE_LDFLAGS})
+SET(APP_UTILS_TEST_LIBS gncmod-app-utils gncmod-test-engine test-core ${GUILE_LDFLAGS})
 
 SET(test_app_utils_SOURCES test-app-utils.c test-option-util.cpp test-gnc-ui-util.c)
 
diff --git a/src/app-utils/test/Makefile.am b/src/app-utils/test/Makefile.am
index df77543..af52d0c 100644
--- a/src/app-utils/test/Makefile.am
+++ b/src/app-utils/test/Makefile.am
@@ -23,7 +23,6 @@ GNC_TEST_DEPS = --gnc-module-dir ${top_builddir}/src/engine \
   --guile-load-dir ${top_builddir}/src/engine \
   --guile-load-dir ${top_builddir}/src/scm \
   --guile-load-dir ${top_builddir}/src/app-utils \
-  --library-dir    ${top_builddir}/src/libqof/qof \
   --library-dir    ${top_builddir}/src/core-utils \
   --library-dir    ${top_builddir}/src/gnc-module \
   --library-dir    ${top_builddir}/src/engine \
@@ -39,7 +38,6 @@ TESTS_ENVIRONMENT = \
   $(shell ${abs_top_srcdir}/src/gnc-test-env.pl --noexports ${GNC_TEST_DEPS})
 
 LDADD = \
-   ${top_builddir}/src/libqof/qof/libgnc-qof.la \
    ${top_builddir}/src/core-utils/libgnc-core-utils.la \
    ${top_builddir}/src/engine/libgncmod-engine.la \
    ${top_builddir}/src/gnc-module/libgnc-module.la \
@@ -61,7 +59,6 @@ AM_CPPFLAGS = \
   -I${top_srcdir}/src/app-utils \
   -I${top_srcdir}/src/gnc-module \
   -I${top_srcdir}/src/core-utils \
-  -I${top_srcdir}/src/libqof/qof \
   ${GUILE_CFLAGS} \
   ${GLIB_CFLAGS} \
   ${BOOST_CPPFLAGS}
diff --git a/src/app-utils/test/test-option-util.cpp b/src/app-utils/test/test-option-util.cpp
index 480d024..fd560fe 100644
--- a/src/app-utils/test/test-option-util.cpp
+++ b/src/app-utils/test/test-option-util.cpp
@@ -21,7 +21,7 @@
  * 51 Franklin Street, Fifth Floor    Fax:    +1-617-542-2652       *
  * Boston, MA  02110-1301,  USA       gnu at gnu.org                   *
  ********************************************************************/
-#include <kvp_frame.hpp>
+#include <kvp-frame.hpp>
 #include <gmp.h> 
 extern "C"
 {
diff --git a/src/backend/dbi/CMakeLists.txt b/src/backend/dbi/CMakeLists.txt
index 61a5649..e7432a2 100644
--- a/src/backend/dbi/CMakeLists.txt
+++ b/src/backend/dbi/CMakeLists.txt
@@ -34,7 +34,7 @@ SET(WINSOCK_LIB "")
 IF(MINGW64)
   SET(WINSOCK_LIB "-lws2_32")
 ENDIF(MINGW64)
-TARGET_LINK_LIBRARIES(gncmod-backend-dbi gnc-backend-sql gncmod-engine gnc-qof ${GTK2_LDFLAGS} ${Boost_REGEX_LIBRARY} ${LIBDBI_LIBRARY} ${WINSOCK_LIB})
+TARGET_LINK_LIBRARIES(gncmod-backend-dbi gnc-backend-sql gncmod-engine ${GTK2_LDFLAGS} ${Boost_REGEX_LIBRARY} ${LIBDBI_LIBRARY} ${WINSOCK_LIB})
 
 TARGET_COMPILE_DEFINITIONS(gncmod-backend-dbi PRIVATE -DG_LOG_DOMAIN=\"gnc.backend.dbi\")
 
diff --git a/src/backend/dbi/Makefile.am b/src/backend/dbi/Makefile.am
index 67f85d6..86ecc90 100644
--- a/src/backend/dbi/Makefile.am
+++ b/src/backend/dbi/Makefile.am
@@ -14,7 +14,6 @@ AM_CPPFLAGS = \
   -I${top_srcdir}/src/engine \
   -I${top_srcdir}/src/core-utils \
   -I${top_srcdir}/lib/libc \
-  -I${top_srcdir}/src/libqof/qof \
   -I${top_srcdir}/src \
   ${GLIB_CFLAGS} \
   ${BOOST_CPPFLAGS} \
@@ -39,7 +38,6 @@ libgncmod_backend_dbi_la_LIBADD = \
    ${top_builddir}/src/backend/sql/libgnc-backend-sql.la \
    ${top_builddir}/src/engine/libgncmod-engine.la \
    ${top_builddir}/src/core-utils/libgnc-core-utils.la \
-   ${top_builddir}/src/libqof/qof/libgnc-qof.la \
    ${BOOST_LDFLAGS} -lboost_regex \
    ${LIBDBI_LIBS}
 
diff --git a/src/backend/dbi/test/CMakeLists.txt b/src/backend/dbi/test/CMakeLists.txt
index 5be867b..637519b 100644
--- a/src/backend/dbi/test/CMakeLists.txt
+++ b/src/backend/dbi/test/CMakeLists.txt
@@ -4,14 +4,13 @@ SET(BACKEND_DBI_TEST_INCLUDE_DIRS
   ${CMAKE_SOURCE_DIR}/src/core-utils
   ${CMAKE_SOURCE_DIR}/src/backend/dbi/test
   ${CMAKE_SOURCE_DIR}/src/backend/sql
-  ${CMAKE_SOURCE_DIR}/src/libqof/qof # for qof.h
   ${CMAKE_SOURCE_DIR}/src/engine
   ${CMAKE_SOURCE_DIR}/src/engine/test-core
   ${CMAKE_SOURCE_DIR}/src/test-core
   ${LIBDBI_INCLUDE_PATH}
   ${GLIB2_INCLUDE_DIRS}
 )
-SET(BACKEND_DBI_TEST_LIBS gnc-backend-sql gncmod-engine gncmod-test-engine gnc-qof test-core ${Boost_REGEX_LIBRARY} ${LIBDBI_LIBRARY})
+SET(BACKEND_DBI_TEST_LIBS gnc-backend-sql gncmod-engine gncmod-test-engine test-core ${Boost_REGEX_LIBRARY} ${LIBDBI_LIBRARY})
 
 SET(test_dbi_backend_SOURCES
   test-backend-dbi.cpp
diff --git a/src/backend/dbi/test/Makefile.am b/src/backend/dbi/test/Makefile.am
index 6a7bd14..15e48fc 100644
--- a/src/backend/dbi/test/Makefile.am
+++ b/src/backend/dbi/test/Makefile.am
@@ -10,7 +10,6 @@ AM_CPPFLAGS = \
   -I${top_srcdir}/src/test-core \
   -I${top_srcdir}/src/engine \
   -I${top_srcdir}/src/engine/test-core \
-  -I${top_srcdir}/src/libqof/qof \
   -I${top_srcdir}/src/backend/sql \
   -DTEST_MYSQL_URL=\"${TEST_MYSQL_URL}\" \
   -DTEST_PGSQL_URL=\"${TEST_PGSQL_URL}\" \
@@ -23,7 +22,6 @@ LDADD = ${top_builddir}/src/test-core/libtest-core.la \
         ${top_builddir}/src/engine/libgncmod-engine.la \
         ${top_builddir}/src/engine/test-core/libgncmod-test-engine.la \
         ${top_builddir}/src/core-utils/libgnc-core-utils.la \
-        ${top_builddir}/src/libqof/qof/libgnc-qof.la \
         ${top_builddir}/src/backend/sql/libgnc-backend-sql.la \
         ${top_builddir}/src/backend/xml/libgnc-backend-xml-utils.la \
         ${top_builddir}/lib/libc/libc-missing.la
@@ -31,7 +29,6 @@ LDADD = ${top_builddir}/src/test-core/libtest-core.la \
 GNC_TEST_DEPS = \
   --gnc-module-dir ${top_builddir}/src/engine \
   --guile-load-dir ${top_builddir}/src/engine \
-  --library-dir    ${top_builddir}/src/libqof/qof \
   --library-dir    ${top_builddir}/src/core-utils \
   --library-dir    ${top_builddir}/src/gnc-module \
   --library-dir    ${top_builddir}/src/engine \
diff --git a/src/backend/dbi/test/test-backend-dbi-basic.cpp b/src/backend/dbi/test/test-backend-dbi-basic.cpp
index 1a2eeb5..179ac82 100644
--- a/src/backend/dbi/test/test-backend-dbi-basic.cpp
+++ b/src/backend/dbi/test/test-backend-dbi-basic.cpp
@@ -24,7 +24,7 @@
  *                                                                  *
 \********************************************************************/
 
-#include <kvp_frame.hpp>
+#include <kvp-frame.hpp>
 
 extern "C"
 {
diff --git a/src/backend/dbi/test/test-dbi-stuff.cpp b/src/backend/dbi/test/test-dbi-stuff.cpp
index 0d0f56a..ac59f9d 100644
--- a/src/backend/dbi/test/test-dbi-stuff.cpp
+++ b/src/backend/dbi/test/test-dbi-stuff.cpp
@@ -38,7 +38,7 @@ extern "C"
 #include <gnc-lot.h>
 }
 
-#include <kvp_frame.hpp>
+#include <kvp-frame.hpp>
 #include "../gnc-backend-dbi.hpp"
 
 G_GNUC_UNUSED static QofLogModule log_module = "test-dbi";
diff --git a/src/backend/sql/CMakeLists.txt b/src/backend/sql/CMakeLists.txt
index 771d2b1..89d06d9 100644
--- a/src/backend/sql/CMakeLists.txt
+++ b/src/backend/sql/CMakeLists.txt
@@ -69,7 +69,7 @@ ADD_LIBRARY	(gnc-backend-sql
   ${backend_sql_noinst_HEADERS}
 )
 
-TARGET_LINK_LIBRARIES(gnc-backend-sql gncmod-engine gnc-qof)
+TARGET_LINK_LIBRARIES(gnc-backend-sql gncmod-engine)
 
 TARGET_COMPILE_DEFINITIONS (gnc-backend-sql PRIVATE -DG_LOG_DOMAIN=\"gnc.backend.sql\")
 
diff --git a/src/backend/sql/Makefile.am b/src/backend/sql/Makefile.am
index 795a018..07c26d8 100644
--- a/src/backend/sql/Makefile.am
+++ b/src/backend/sql/Makefile.am
@@ -14,7 +14,6 @@ AM_CPPFLAGS = \
   -I${top_srcdir}/src/engine \
   -I${top_srcdir}/src/core-utils\
   -I${top_srcdir}/lib/libc\
-  -I${top_srcdir}/src/libqof/qof \
   ${GLIB_CFLAGS} \
   ${GUILE_CFLAGS} \
   ${WARN_CFLAGS} \
@@ -78,8 +77,7 @@ noinst_HEADERS = \
 libgnc_backend_sql_la_LIBADD = \
    ${GLIB_LIBS} \
    ${GUILE_LIBS} \
-   ${top_builddir}/src/engine/libgncmod-engine.la \
-   ${top_builddir}/src/libqof/qof/libgnc-qof.la
+   ${top_builddir}/src/engine/libgncmod-engine.la
 
 AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.backend.sql\"
 
diff --git a/src/backend/sql/gnc-slots-sql.cpp b/src/backend/sql/gnc-slots-sql.cpp
index 395167e..c563e95 100644
--- a/src/backend/sql/gnc-slots-sql.cpp
+++ b/src/backend/sql/gnc-slots-sql.cpp
@@ -49,7 +49,7 @@ extern "C"
 #include "gnc-sql-column-table-entry.hpp"
 #include "gnc-slots-sql.h"
 
-#include <kvp_frame.hpp>
+#include <kvp-frame.hpp>
 
 static QofLogModule log_module = G_LOG_DOMAIN;
 
diff --git a/src/backend/sql/test/CMakeLists.txt b/src/backend/sql/test/CMakeLists.txt
index e30d06d..545487c 100644
--- a/src/backend/sql/test/CMakeLists.txt
+++ b/src/backend/sql/test/CMakeLists.txt
@@ -2,7 +2,6 @@
 SET(BACKEND_SQL_TEST_INCLUDE_DIRS
   ${CMAKE_BINARY_DIR}/src # for config.h
   ${CMAKE_SOURCE_DIR}/src/backend/sql
-  ${CMAKE_SOURCE_DIR}/src/libqof/qof # for qof.
   ${CMAKE_SOURCE_DIR}/src/engine
   ${CMAKE_SOURCE_DIR}/src/test-core
   ${GLIB2_INCLUDE_DIRS}
@@ -10,7 +9,7 @@ SET(BACKEND_SQL_TEST_INCLUDE_DIRS
 
 SET(test_backend_sql_SOURCES test-sqlbe.cpp utest-gnc-backend-sql.cpp)
 
-SET(BACKEND_SQL_TEST_LIBS gnc-backend-sql gncmod-engine gnc-qof test-core)
+SET(BACKEND_SQL_TEST_LIBS gnc-backend-sql gncmod-engine test-core)
 
 SET_DIST_LIST(test_backend_sql_DIST ${test_backend_sql_SOURCES} CMakeLists.txt
   Makefile.am test-column-types.cpp)
@@ -23,4 +22,4 @@ GNC_ADD_TEST(test-column-types test-column-types.cpp
 GNC_ADD_TEST(test-sqlbe "${test_backend_sql_SOURCES}"
    BACKEND_SQL_TEST_INCLUDE_DIRS BACKEND_SQL_TEST_LIBS
 )
-TARGET_COMPILE_DEFINITIONS(test-sqlbe PRIVATE TESTPROG=test_sqlbe)
\ No newline at end of file
+TARGET_COMPILE_DEFINITIONS(test-sqlbe PRIVATE TESTPROG=test_sqlbe)
diff --git a/src/backend/sql/test/Makefile.am b/src/backend/sql/test/Makefile.am
index d07c554..8ec28ad 100644
--- a/src/backend/sql/test/Makefile.am
+++ b/src/backend/sql/test/Makefile.am
@@ -15,7 +15,6 @@ TESTS = ${check_PROGRAMS}
 GNC_TEST_DEPS = \
   --gnc-module-dir ${top_builddir}/src/engine \
   --guile-load-dir ${top_builddir}/src/engine \
-  --library-dir    ${top_builddir}/src/libqof/qof \
   --library-dir    ${top_builddir}/src/core-utils \
   --library-dir    ${top_builddir}/src/gnc-module \
   --library-dir    ${top_builddir}/src/engine \
@@ -32,7 +31,6 @@ LDADD = ${top_builddir}/src/test-core/libtest-core.la \
         ${top_builddir}/src/engine/libgncmod-engine.la \
         ${top_builddir}/src/engine/test-core/libgncmod-test-engine.la \
         ${top_builddir}/src/core-utils/libgnc-core-utils.la \
-        ${top_builddir}/src/libqof/qof/libgnc-qof.la \
         ${top_builddir}/lib/libc/libc-missing.la
 
 AM_CPPFLAGS = \
@@ -44,7 +42,6 @@ AM_CPPFLAGS = \
   -I${top_srcdir}/src/engine \
   -I${top_srcdir}/src/engine/test-core \
   -I${top_srcdir}/src/backend/sql \
-  -I${top_srcdir}/src/libqof/qof \
   ${GLIB_CFLAGS} \
   ${GUILE_CFLAGS}
 
@@ -58,7 +55,7 @@ test_sqlbe_SOURCES = \
 
 test_sqlbe_LDADD = \
 	$(top_builddir)/$(MODULEPATH)/libgnc-backend-sql.la \
-	$(top_builddir)/src/libqof/qof/libgnc-qof.la \
+	$(top_builddir)/src/engine/libgncmod-engine.la \
 	$(top_builddir)/src/test-core/libtest-core.la \
 	$(top_builddir)/src/core-utils/libgnc-core-utils.la \
 	$(GLIB_LIBS)
@@ -68,7 +65,7 @@ test_sqlbe_CFLAGS = \
 	$(DEFAULT_INCLUDES) \
 	-I$(top_srcdir)/$(MODULEPATH)/ \
 	-I$(top_srcdir)/src/backend/dbi/ \
-	-I$(top_srcdir)/src/libqof/qof/ \
+	-I$(top_srcdir)/src/engine/ \
 	-I$(top_srcdir)/src/test-core/ \
 	$(GLIB_CFLAGS)
 
diff --git a/src/backend/xml/Makefile.am b/src/backend/xml/Makefile.am
index 9362f4d..eb58ca3 100644
--- a/src/backend/xml/Makefile.am
+++ b/src/backend/xml/Makefile.am
@@ -13,7 +13,6 @@ AM_CPPFLAGS = \
   -I${top_srcdir}/src/core-utils \
   -I${top_srcdir}/src/gnc-module \
   -I${top_srcdir}/lib/libc\
-  -I${top_srcdir}/src/libqof/qof \
   -I$(top_srcdir)/src \
   ${LIBXML2_CFLAGS} \
   ${GLIB_CFLAGS} \
@@ -92,8 +91,7 @@ libgnc_backend_xml_utils_la_LIBADD = \
    ${LIBXML2_LIBS} \
    ${ZLIB_LIBS} \
    ${top_builddir}/src/engine/libgncmod-engine.la \
-   ${top_builddir}/src/core-utils/libgnc-core-utils.la \
-   ${top_builddir}/src/libqof/qof/libgnc-qof.la
+   ${top_builddir}/src/core-utils/libgnc-core-utils.la
 
 libgncmod_backend_xml_la_LDFLAGS = -module -avoid-version
 libgncmod_backend_xml_la_LIBADD = \
@@ -102,8 +100,7 @@ libgncmod_backend_xml_la_LIBADD = \
    ${ZLIB_LIBS} \
    ${top_builddir}/src/engine/libgncmod-engine.la \
    ${top_builddir}/src/core-utils/libgnc-core-utils.la \
-   libgnc-backend-xml-utils.la \
-   ${top_builddir}/src/libqof/qof/libgnc-qof.la
+   libgnc-backend-xml-utils.la
 
 AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.backend.xml\"
 
diff --git a/src/backend/xml/io-gncxml-v1.cpp b/src/backend/xml/io-gncxml-v1.cpp
index bec03b9..14b1b32 100644
--- a/src/backend/xml/io-gncxml-v1.cpp
+++ b/src/backend/xml/io-gncxml-v1.cpp
@@ -53,7 +53,7 @@ extern "C"
 #include "sixtp-parsers.h"
 #include "sixtp-utils.h"
 
-#include <kvp_frame.hpp>
+#include <kvp-frame.hpp>
 
 /* from Transaction-xml-parser-v1.c */
 static sixtp* gnc_transaction_parser_new (void);
diff --git a/src/backend/xml/sixtp-dom-generators.cpp b/src/backend/xml/sixtp-dom-generators.cpp
index d659da5..87e28b0 100644
--- a/src/backend/xml/sixtp-dom-generators.cpp
+++ b/src/backend/xml/sixtp-dom-generators.cpp
@@ -34,7 +34,7 @@ extern "C"
 #include "sixtp-dom-generators.h"
 #include "sixtp-utils.h"
 
-#include <kvp_frame.hpp>
+#include <kvp-frame.hpp>
 
 static QofLogModule log_module = GNC_MOD_IO;
 
diff --git a/src/backend/xml/sixtp-dom-parsers.cpp b/src/backend/xml/sixtp-dom-parsers.cpp
index 0b15296..94e3322 100644
--- a/src/backend/xml/sixtp-dom-parsers.cpp
+++ b/src/backend/xml/sixtp-dom-parsers.cpp
@@ -33,7 +33,7 @@ extern "C"
 
 #include "sixtp-utils.h"
 #include "sixtp-dom-parsers.h"
-#include <kvp_frame.hpp>
+#include <kvp-frame.hpp>
 
 static QofLogModule log_module = GNC_MOD_IO;
 
diff --git a/src/backend/xml/test/CMakeLists.txt b/src/backend/xml/test/CMakeLists.txt
index c051da7..62ccb71 100644
--- a/src/backend/xml/test/CMakeLists.txt
+++ b/src/backend/xml/test/CMakeLists.txt
@@ -6,7 +6,6 @@ SET(XML_TEST_INCLUDE_DIRS
   ${CMAKE_SOURCE_DIR}/src/backend/xml/test
   ${CMAKE_SOURCE_DIR}/src/engine
   ${CMAKE_SOURCE_DIR}/src/engine/test-core
-  ${CMAKE_SOURCE_DIR}/src/libqof/qof # for qof.h
   ${CMAKE_BINARY_DIR}/src # for config.h
   ${CMAKE_SOURCE_DIR}/src/test-core  # for unittest-support.h
   ${GLIB2_INCLUDE_DIRS}
@@ -15,7 +14,7 @@ SET(XML_TEST_INCLUDE_DIRS
 )
 
 
-SET(XML_TEST_LIBS gncmod-engine gnc-qof gncmod-test-engine test-core ${LIBXML2_LDFLAGS} -lz)
+SET(XML_TEST_LIBS gncmod-engine gncmod-test-engine test-core ${LIBXML2_LDFLAGS} -lz)
 
 FUNCTION(ADD_XML_TEST _TARGET _SOURCE_FILES)
   GNC_ADD_TEST(${_TARGET} "${_SOURCE_FILES}" XML_TEST_INCLUDE_DIRS XML_TEST_LIBS ${ARGN})
diff --git a/src/backend/xml/test/Makefile.am b/src/backend/xml/test/Makefile.am
index 428f4ed..7bebc33 100644
--- a/src/backend/xml/test/Makefile.am
+++ b/src/backend/xml/test/Makefile.am
@@ -211,7 +211,6 @@ GNC_TEST_DEPS = \
   --gnc-module-dir ${top_builddir}/src/engine \
   --guile-load-dir ${top_builddir}/src/gnc-module \
   --guile-load-dir ${top_builddir}/src/engine \
-  --library-dir    ${top_builddir}/src/libqof/qof \
   --library-dir    ${top_builddir}/src/core-utils \
   --library-dir    ${top_builddir}/src/gnc-module \
   --library-dir    ${top_builddir}/src/engine \
@@ -250,7 +249,6 @@ check_PROGRAMS = \
 noinst_HEADERS = test-file-stuff.h
 
 LDADD = \
-        ${top_builddir}/src/libqof/qof/libgnc-qof.la \
         ${top_builddir}/src/test-core/libtest-core.la \
         ${top_builddir}/src/gnc-module/libgnc-module.la \
         ${top_builddir}/src/engine/libgncmod-engine.la \
@@ -270,7 +268,6 @@ AM_CPPFLAGS = \
   -I${top_srcdir}/src/engine \
   -I${top_srcdir}/src/engine/test-core \
   -I${top_srcdir}/src/backend/xml \
-  -I${top_srcdir}/src/libqof/qof \
   -DU_SHOW_CPLUSPLUS_API=0 \
   ${LIBXML2_CFLAGS} \
   ${GLIB_CFLAGS} \
diff --git a/src/backend/xml/test/test-file-stuff.cpp b/src/backend/xml/test/test-file-stuff.cpp
index 8e99a07..e0f2f74 100644
--- a/src/backend/xml/test/test-file-stuff.cpp
+++ b/src/backend/xml/test/test-file-stuff.cpp
@@ -20,7 +20,7 @@
  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  *  02110-1301, USA.
  */
-#include <kvp_frame.hpp>
+#include <kvp-frame.hpp>
 
 extern "C"
 {
diff --git a/src/backend/xml/test/test-kvp-frames.cpp b/src/backend/xml/test/test-kvp-frames.cpp
index 2a483d1..1b8e39f 100644
--- a/src/backend/xml/test/test-kvp-frames.cpp
+++ b/src/backend/xml/test/test-kvp-frames.cpp
@@ -1,4 +1,4 @@
-#include <kvp_frame.hpp>
+#include <kvp-frame.hpp>
 
 extern "C"
 {
diff --git a/src/bin/CMakeLists.txt b/src/bin/CMakeLists.txt
index bd661ce..33332c2 100644
--- a/src/bin/CMakeLists.txt
+++ b/src/bin/CMakeLists.txt
@@ -24,7 +24,7 @@ TARGET_COMPILE_DEFINITIONS(gnucash PRIVATE -DG_LOG_DOMAIN=\"gnc.bin\")
 
 TARGET_LINK_LIBRARIES (gnucash
    gncmod-ledger-core gncmod-report-gnome gnc-gnome gncmod-gnome-utils gncmod-app-utils
-   gncmod-engine gnc-module gnc-core-utils gnc-qof gncmod-report-system
+   gncmod-engine gnc-module gnc-core-utils gncmod-report-system
    ${GUILE_LDFLAGS} ${GLIB2_LDFLAGS} ${GTK3_LDFLAGS} ${GTK_MAC_LDFLAGS}
 )
 
diff --git a/src/bin/Makefile.am b/src/bin/Makefile.am
index 11f2070..e6e254c 100644
--- a/src/bin/Makefile.am
+++ b/src/bin/Makefile.am
@@ -18,7 +18,6 @@ AM_CPPFLAGS = -I${top_builddir} ${GLIB_CFLAGS} ${GNOME_CFLAGS} ${GTK_CFLAGS} \
   -I${top_builddir}/src \
   -I${top_builddir}/src/core-utils \
   -I${top_srcdir}/src/gnc-module \
-  -I${top_srcdir}/src/libqof/qof \
   -I${top_srcdir}/src/report/report-system \
   ${GUILE_CFLAGS} \
   ${GTK_MAC_CFLAGS}
@@ -55,7 +54,6 @@ gnucash_LDADD = \
   ${top_builddir}/src/engine/libgncmod-engine.la \
   ${top_builddir}/src/gnc-module/libgnc-module.la \
   ${top_builddir}/src/core-utils/libgnc-core-utils.la \
-  ${top_builddir}/src/libqof/qof/libgnc-qof.la \
   ${top_builddir}/src/report/report-system/libgncmod-report-system.la \
   ${GUILE_LIBS} \
   ${GLIB_LIBS} \
diff --git a/src/bin/overrides/gnucash-build-env.in b/src/bin/overrides/gnucash-build-env.in
index 58f6112..ec2e5df 100644
--- a/src/bin/overrides/gnucash-build-env.in
+++ b/src/bin/overrides/gnucash-build-env.in
@@ -66,7 +66,6 @@ eval `${top_srcdir}/src/gnc-test-env.pl \
   --guile-load-dir ${top_builddir}/src/report/stylesheets \
   --guile-load-dir ${top_builddir}/src/import-export/qif-import \
   --library-dir    ${top_builddir}/src/test-core \
-  --library-dir    ${top_builddir}/src/libqof/qof \
   --library-dir    ${top_builddir}/src/core-utils \
   --library-dir    ${top_builddir}/src/calculation \
   --library-dir    ${top_builddir}/src/app-utils \
diff --git a/src/cmake_modules/GncAddSwigCommand.cmake b/src/cmake_modules/GncAddSwigCommand.cmake
index bfbe846..cffd611 100644
--- a/src/cmake_modules/GncAddSwigCommand.cmake
+++ b/src/cmake_modules/GncAddSwigCommand.cmake
@@ -9,7 +9,7 @@ MACRO (GNC_ADD_SWIG_COMMAND _target _output _input)
 ADD_CUSTOM_COMMAND (
   OUTPUT ${_output}
   DEPENDS ${_input} ${CMAKE_SOURCE_DIR}/src/base-typemaps.i ${ARGN}
-COMMAND ${SWIG_EXECUTABLE} -guile ${SWIG_ARGS} -Linkage module -I${CMAKE_SOURCE_DIR}/src/libqof/qof -I${CMAKE_SOURCE_DIR}/src  -o ${_output} ${_input}
+COMMAND ${SWIG_EXECUTABLE} -guile ${SWIG_ARGS} -Linkage module -I${CMAKE_SOURCE_DIR}/src/engine -I${CMAKE_SOURCE_DIR}/src  -o ${_output} ${_input}
 )
 
 ADD_CUSTOM_TARGET(${_target} DEPENDS ${_output})
@@ -22,7 +22,7 @@ MACRO (GNC_ADD_SWIG_PYTHON_COMMAND _target _output _input)
   ADD_CUSTOM_COMMAND(OUTPUT ${_output}
 
     COMMAND ${SWIG_EXECUTABLE} -python -Wall -Werror ${SWIG_ARGS}
-       -I${CMAKE_SOURCE_DIR}/src/libqof/qof -I${CMAKE_SOURCE_DIR}/src
+       -I${CMAKE_SOURCE_DIR}/src
        -I${CMAKE_SOURCE_DIR}/src/engine -I${CMAKE_SOURCE_DIR}/src/app-utils
        -o ${_output} ${_input}
     DEPENDS ${_input} ${CMAKE_SOURCE_DIR}/src/base-typemaps.i ${ARGN}
diff --git a/src/core-utils/CMakeLists.txt b/src/core-utils/CMakeLists.txt
index cd7072a..eefe503 100644
--- a/src/core-utils/CMakeLists.txt
+++ b/src/core-utils/CMakeLists.txt
@@ -117,11 +117,12 @@ SET(core_utils_noinst_HEADERS
 )
 
 SET(core_utils_ALL_SOURCES ${core_utils_SOURCES} ${core_utils_noinst_HEADERS})
-SET(core_utils_ALL_LIBRARIES gnc-qof ${GUILE_LDFLAGS} ${GLIB2_LDFLAGS} ${GOBJECT_LDFLAGS} ${GTK_MAC_LDFLAGS})
+SET(core_utils_ALL_LIBRARIES ${GUILE_LDFLAGS} ${GLIB2_LDFLAGS} ${GOBJECT_LDFLAGS} ${GTK_MAC_LDFLAGS})
 SET(core_utils_ALL_INCLUDES
+  ${CMAKE_SOURCE_DIR}/src
   ${CMAKE_CURRENT_BINARY_DIR}
-  ${CMAKE_SOURCE_DIR}/src/libqof/qof
   ${CMAKE_CURRENT_SOURCE_DIR}
+  ${GLIB2_INCLUDE_DIRS}
   ${GUILE_INCLUDE_DIRS}
   ${GTK_MAC_INCLUDE_DIRS})
 
diff --git a/src/core-utils/Makefile.am b/src/core-utils/Makefile.am
index 86c2b42..c827c4a 100644
--- a/src/core-utils/Makefile.am
+++ b/src/core-utils/Makefile.am
@@ -1,4 +1,6 @@
-SUBDIRS = . test
+# No SUBDIR variable here...
+# The 'test' subdir is added via src/Makefile to handle
+# it's dependency on src/engine
 
 lib_LTLIBRARIES = libgnc-core-utils.la
 
@@ -19,8 +21,7 @@ libgnc_core_utils_la_LIBADD = \
   ${GUILE_LIBS} \
   ${GLIB_LIBS} \
   ${BINRELOC_LIBS} \
-  ${GTK_MAC_LIBS} \
-  ${QOF_LIBS}
+  ${GTK_MAC_LIBS}
 
 
 noinst_HEADERS = \
@@ -56,8 +57,6 @@ AM_CPPFLAGS = \
   ${GUILE_CFLAGS} \
   ${GLIB_CFLAGS} \
   ${GTK_MAC_CFLAGS} \
-  ${QOF_CFLAGS} \
-  -I${top_srcdir}/src/libqof/qof \
   -I${top_builddir}/src \
   -I${top_srcdir}/src
 
@@ -84,9 +83,7 @@ libgnc_core_utils_python_la_LIBADD = \
 libgnc_core_utils_python_la_CPPFLAGS = \
   ${GLIB_CFLAGS} \
   ${GTK_MAC_CFLAGS} \
-  ${QOF_CFLAGS} \
   ${PYTHON_CPPFLAGS} \
-  -I${top_srcdir}/src/libqof/qof \
   -I${top_builddir}/src \
   -I${top_srcdir}/src
 
@@ -108,8 +105,7 @@ endif
 
 if GNC_HAVE_GUILE_2
 GUILE_COMPILE_ENV = \
-  --library-dir    ${top_builddir}/src/core-utils \
-  --library-dir    ${top_builddir}/src/libqof/qof
+  --library-dir    ${top_builddir}/src/core-utils
 
 %.go : %.scm .scm-links $(lib_LTLIBRARIES)
 	GNC_UNINSTALLED=yes \
diff --git a/src/core-utils/gnc-filepath-utils.c b/src/core-utils/gnc-filepath-utils.c
index 041e940..477cfb0 100644
--- a/src/core-utils/gnc-filepath-utils.c
+++ b/src/core-utils/gnc-filepath-utils.c
@@ -50,17 +50,12 @@
 
 #include "gnc-path.h"
 #include "gnc-filepath-utils.h"
-#include "libqof/qof/qof.h"
 
 #ifdef _MSC_VER
 #include <glib/gwin32.h>
 #define PATH_MAX MAXPATHLEN
 #endif
 
-/* This static indicates the debugging module that this .o belongs to.  */
-static QofLogModule log_module = G_LOG_DOMAIN;
-
-
 /**
  * Scrubs a filename by changing "strange" chars (e.g. those that are not
  * valid in a win32 file name) to "_".
@@ -220,7 +215,7 @@ gnc_path_find_localized_html_file_internal (const gchar * file_name)
     for (i = 0; dirs[i]; i++)
     {
         full_path = g_build_filename (dirs[i], file_name, (gchar *)NULL);
-        DEBUG ("Checking for existence of %s", full_path);
+        g_debug ("Checking for existence of %s", full_path);
         full_path = check_path_return_if_valid (full_path);
         if (full_path != NULL)
             return full_path;
diff --git a/src/core-utils/gnc-gkeyfile-utils.c b/src/core-utils/gnc-gkeyfile-utils.c
index f58a8eb..5767a9e 100644
--- a/src/core-utils/gnc-gkeyfile-utils.c
+++ b/src/core-utils/gnc-gkeyfile-utils.c
@@ -61,10 +61,6 @@
 #endif
 
 #include "gnc-gkeyfile-utils.h"
-#include "qof.h"
-
-/* This static indicates the debugging module that this .o belongs to.  */
-static QofLogModule log_module = G_LOG_DOMAIN;
 
 GKeyFile *
 gnc_key_file_load_from_file (const gchar *filename,
@@ -118,7 +114,7 @@ gnc_key_file_save_to_file (const gchar *filename,
         g_return_val_if_fail(*error == NULL, FALSE);
 
     contents = g_key_file_to_data(key_file, NULL, NULL);
-    DEBUG("Keyfile data:\n%s", contents);
+    g_debug ("Keyfile data:\n%s", contents);
     length = strlen(contents);
     fd = g_open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0666);
     if (fd == -1)
diff --git a/src/core-utils/gnc-guile-utils.c b/src/core-utils/gnc-guile-utils.c
index e9c2ab9..bbb71ea 100644
--- a/src/core-utils/gnc-guile-utils.c
+++ b/src/core-utils/gnc-guile-utils.c
@@ -23,13 +23,9 @@
 #include "swig-runtime.h"
 #include <libguile.h>
 
-#include "qof.h"
 #include "gnc-guile-utils.h"
 #include "guile-mappings.h"
 
-/* This static indicates the debugging module this .o belongs to.  */
-static QofLogModule log_module = G_LOG_DOMAIN;
-
 
 /********************************************************************\
  * gnc_scm_to_utf8_string                                           *
@@ -54,7 +50,7 @@ gchar *gnc_scm_to_utf8_string(SCM scm_string)
     }
 
     /* Unable to extract string from the symbol...*/
-    PERR("bad value\n");
+    g_error ("bad value\n");
     return NULL;
 }
 
@@ -86,7 +82,7 @@ gchar *gnc_scm_to_locale_string(SCM scm_string)
     }
 
     /* Unable to extract string from the symbol...*/
-    PERR("bad value\n");
+    g_error ("bad value\n");
     return NULL;
 }
 
@@ -117,7 +113,7 @@ gnc_scm_symbol_to_locale_string(SCM symbol_value)
     }
 
     /* Unable to extract string from the symbol...*/
-    PERR("bad value\n");
+    g_error ("bad value\n");
     return NULL;
 }
 
@@ -146,12 +142,12 @@ gnc_scm_call_1_to_string(SCM func, SCM arg)
         }
         else
         {
-            PERR("bad value\n");
+            g_error ("bad value\n");
         }
     }
     else
     {
-        PERR("not a procedure\n");
+        g_error ("not a procedure\n");
     }
 
     return NULL;
@@ -180,7 +176,7 @@ gnc_scm_call_1_symbol_to_string(SCM func, SCM arg)
     }
     else
     {
-        PERR("not a procedure\n");
+        g_error ("not a procedure\n");
     }
 
     return NULL;
@@ -209,12 +205,12 @@ gnc_scm_call_1_to_procedure(SCM func, SCM arg)
             return value;
         else
         {
-            PERR("bad value\n");
+            g_error ("bad value\n");
         }
     }
     else
     {
-        PERR("not a procedure\n");
+        g_error ("not a procedure\n");
     }
 
     return SCM_UNDEFINED;
@@ -243,12 +239,12 @@ gnc_scm_call_1_to_list(SCM func, SCM arg)
             return value;
         else
         {
-            PERR("bad value\n");
+            g_error ("bad value\n");
         }
     }
     else
     {
-        PERR("not a procedure\n");
+        g_error ("not a procedure\n");
     }
 
     return SCM_UNDEFINED;
@@ -277,12 +273,12 @@ gnc_scm_call_1_to_vector(SCM func, SCM arg)
             return value;
         else
         {
-            PERR("bad value\n");
+            g_error ("bad value\n");
         }
     }
     else
     {
-        PERR("not a procedure\n");
+        g_error ("not a procedure\n");
     }
 
     return SCM_UNDEFINED;
diff --git a/src/core-utils/gnc-prefs.c b/src/core-utils/gnc-prefs.c
index 84aeb51..27d3be9 100644
--- a/src/core-utils/gnc-prefs.c
+++ b/src/core-utils/gnc-prefs.c
@@ -22,11 +22,11 @@
  */
 
 #include <stdlib.h>
+#include <glib.h>
 #include "config.h"
 #include "gnc-prefs.h"
 #include "gnc-prefs-p.h"
 #include "gnc-version.h"
-#include "libqof/qof/qof.h"
 
 static gchar *namespace_regexp    = NULL;
 static gboolean is_debugging      = FALSE;
@@ -37,9 +37,6 @@ static gint file_retention_days   = 30;   // This is also the default in the pre
 
 PrefsBackend *prefsbackend = NULL;
 
-/* This static indicates the debugging module that this .o belongs to.  */
-static QofLogModule log_module = G_LOG_DOMAIN;
-
 const gchar *
 gnc_prefs_get_namespace_regexp(void)
 {
@@ -130,18 +127,11 @@ gulong gnc_prefs_register_cb (const char *group,
                               gpointer func,
                               gpointer user_data)
 {
-    ENTER("group %s; pref_name %s, prefsbackend->register_cb %p", group, pref_name,
-            prefsbackend ? prefsbackend->register_cb : NULL);
     if (prefsbackend && prefsbackend->register_cb)
-    {
-        LEAVE("");
         return (prefsbackend->register_cb) (group, pref_name, func, user_data);
-    }
     else
-    {
-        LEAVE("no backend loaded, or the backend doesn't define register_cb, returning 0");
+        g_warning ("no backend loaded, or the backend doesn't define register_cb, returning 0");
         return 0;
-    }
 }
 
 
diff --git a/src/core-utils/test/CMakeLists.txt b/src/core-utils/test/CMakeLists.txt
index cbb07e4..ed51fbe 100644
--- a/src/core-utils/test/CMakeLists.txt
+++ b/src/core-utils/test/CMakeLists.txt
@@ -4,10 +4,9 @@ SET(CORE_UTILS_TEST_INCLUDE_DIRS
   ${CMAKE_BINARY_DIR}/src # for config.h
   ${CMAKE_SOURCE_DIR}/src/core-utils
   ${CMAKE_SOURCE_DIR}/src/test-core
-  ${CMAKE_SOURCE_DIR}/src/libqof/qof # for qof.h
   ${GLIB2_INCLUDE_DIRS}
 )
-SET(CORE_UTILS_TEST_LIBS gnc-core-utils gnc-qof test-core)
+SET(CORE_UTILS_TEST_LIBS gnc-core-utils test-core)
 
 MACRO(ADD_CORE_UTILS_TEST _TARGET _SOURCE_FILES)
   GNC_ADD_TEST(${_TARGET} "${_SOURCE_FILES}" CORE_UTILS_TEST_INCLUDE_DIRS CORE_UTILS_TEST_LIBS)
diff --git a/src/core-utils/test/Makefile.am b/src/core-utils/test/Makefile.am
index 75d6067..a097569 100644
--- a/src/core-utils/test/Makefile.am
+++ b/src/core-utils/test/Makefile.am
@@ -1,17 +1,18 @@
 include $(top_srcdir)/test-templates/Makefile.decl
 MODULEPATH = src/core-utils
 
+# We add src/engine here, just to load qof.h, which
+# is pulled in via test-core
 AM_CPPFLAGS = \
   -I${top_srcdir} \
   -I${top_srcdir}/src \
   -I${top_srcdir}/src/test-core \
-  -I${top_srcdir}/src/libqof/qof \
   -I${top_srcdir}/src/core-utils \
+  -I${top_srcdir}/src/engine \
   ${GUILE_CFLAGS} \
   ${GLIB_CFLAGS}
 
 LDADD = \
-  ${top_builddir}/src/libqof/qof/libgnc-qof.la \
   ../libgnc-core-utils.la \
   ${top_builddir}/src/test-core/libtest-core.la \
   ${GLIB_LIBS}
@@ -25,7 +26,6 @@ TESTS = \
   test-gnc-glib-utils
 
 GNC_TEST_DEPS = \
-  --library-dir    ${top_builddir}/src/libqof/qof \
   --library-dir    ${top_builddir}/src/core-utils
 
 TESTS_ENVIRONMENT = \
@@ -39,7 +39,6 @@ test_gnc_glib_utils_SOURCES = \
   test-gnc-glib-utils.c
 
 test_gnc_glib_utils_LDADD = \
-        ${top_builddir}/src/libqof/qof/libgnc-qof.la \
         ${top_builddir}/src/test-core/libtest-core.la \
         $(GLIB_LIBS)
 
diff --git a/src/core-utils/test/test-resolve-file-path.c b/src/core-utils/test/test-resolve-file-path.c
index 707f522..b79d136 100644
--- a/src/core-utils/test/test-resolve-file-path.c
+++ b/src/core-utils/test/test-resolve-file-path.c
@@ -26,7 +26,6 @@
 #include <string.h>
 
 #include <glib.h>
-#include "qof.h"
 #include "test-stuff.h"
 #include "gnc-filepath-utils.h"
 
@@ -59,8 +58,6 @@ main(int argc, char **argv)
 {
     int i;
 
-    qof_init();
-
     for (i = 0; strs[i].input != NULL; i++)
     {
         char *daout;
diff --git a/src/doc/doxygen.cfg.in b/src/doc/doxygen.cfg.in
index 647de2f..b2772a3 100644
--- a/src/doc/doxygen.cfg.in
+++ b/src/doc/doxygen.cfg.in
@@ -653,7 +653,7 @@ WARN_LOGFILE           = doxygen.log
 # with spaces.
 
 INPUT                  = @-top_srcdir-@/src \
-                         @-top_srcdir-@/src/libqof/
+                         @-top_srcdir-@/src/engine/
 
 # This tag can be used to specify the character encoding of the source files
 # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
diff --git a/src/engine/CMakeLists.txt b/src/engine/CMakeLists.txt
index 9029f32..b325b02 100644
--- a/src/engine/CMakeLists.txt
+++ b/src/engine/CMakeLists.txt
@@ -10,11 +10,21 @@ SET(engine_noinst_HEADERS
   SX-book.h
   SX-ttinfo.h
   TransactionP.h
+  gnc-backend-prov.hpp
+  gnc-date-p.h
   gnc-hooks-scm.h
+  gnc-int128.hpp
   gnc-lot.h
   gnc-lot-p.h
   gnc-pricedb-p.h
   policy-p.h
+  qofbook-p.h
+  qofclass-p.h
+  qofevent-p.h
+  qofobject-p.h
+  qofquery-p.h
+  qofquerycore-p.h
+  qofsession.hpp
 )
 
 SET (engine_HEADERS
@@ -37,17 +47,48 @@ SET (engine_HEADERS
   engine-helpers.h
   engine-helpers-guile.h
   glib-helpers.h
+  gnc-aqbanking-templates.h
   gnc-budget.h
   gnc-commodity.h
+  gnc-date.h
+  gnc-datetime.hpp
   gnc-engine.h
   gnc-event.h
   gnc-features.h
   gnc-hooks.h
+  gnc-numeric.h
+  gnc-numeric.hpp
   gnc-pricedb.h
+  gnc-rational.hpp
+  gnc-rational-rounding.hpp
   gnc-session.h
+  gnc-timezone.hpp
   gnc-uri-utils.h
+  guid.h
+  kvp-frame.hpp
   kvp-scm.h
+  kvp-value.hpp
   policy.h
+  qof.h
+  qof-backend.hpp
+  qofbackend.h
+  qofbook.h
+  qofbookslots.h
+  qofchoice.h
+  qofclass.h
+  qofevent.h
+  qofid-p.h
+  qofid.h
+  qofinstance-p.h
+  qofinstance.h
+  qoflog.h
+  qofobject.h
+  qofquery.h
+  qofquerycore.h
+  qofsession.h
+  qofutil.h
+  qof-gobject.h
+  qof-string-cache.h
   gncAddress.h
   gncAddressP.h
   gncBillTerm.h
@@ -109,20 +150,28 @@ SET (engine_SOURCES
   Transaction.c
   cap-gains.c
   cashobjects.c
+  gnc-aqbanking-templates.cpp
   gnc-budget.c
   gnc-commodity.c
+  gnc-date.cpp
+  gnc-datetime.cpp
   gnc-engine.c
   gnc-event.c
   gnc-features.c
   gnc-hooks.c
+  gnc-int128.cpp
   gnc-lot.c
+  gnc-numeric.cpp
   gnc-pricedb.c
+  gnc-rational.cpp
   gnc-session.c
+  gnc-timezone.cpp
   gnc-uri-utils.c
   gncmod-engine.c
   kvp-scm.cpp
   engine-helpers.c
   glib-helpers.c
+  guid.cpp
   policy.c
   gncAddress.c
   gncBillTerm.c
@@ -138,6 +187,22 @@ SET (engine_SOURCES
   gncOwner.c
   gncTaxTable.c
   gncVendor.c
+  kvp-frame.cpp
+  kvp-value.cpp
+  qof-backend.cpp
+  qofbook.cpp
+  qofchoice.cpp
+  qofclass.cpp
+  qofevent.cpp
+  qofid.cpp
+  qofinstance.cpp
+  qoflog.cpp
+  qofobject.cpp
+  qofquery.cpp
+  qofquerycore.cpp
+  qofsession.cpp
+  qofutil.cpp
+  qof-string-cache.cpp
 )
 
 # Add dependency on config.h
@@ -158,13 +223,20 @@ ADD_LIBRARY (gncmod-engine
   ${engine_noinst_HEADERS}
 )
 
-TARGET_LINK_LIBRARIES(gncmod-engine gnc-core-utils gnc-module gnc-qof ${GUILE_LDFLAGS} ${GLIB2_LDFLAGS})
+TARGET_LINK_LIBRARIES(gncmod-engine gnc-core-utils gnc-module ${Boost_DATE_TIME_LIBRARIES}  ${Boost_REGEX_LIBRARIES} ${REGEX_LDFLAGS} ${GMODULE_LDFLAGS} ${GLIB2_LDFLAGS} ${GOBJECT_LDFLAGS} ${GUILE_LDFLAGS})
 
 TARGET_COMPILE_DEFINITIONS (gncmod-engine PRIVATE -DG_LOG_DOMAIN=\"gnc.engine\")
 
 TARGET_INCLUDE_DIRECTORIES (gncmod-engine
     PRIVATE ${CMAKE_CURRENT_BINARY_DIR} # for iso-4217-currencies.c
-    PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
+    PUBLIC
+        ${CMAKE_CURRENT_SOURCE_DIR}
+        ${CMAKE_BINARY_DIR}/src # for config.h
+        ${CMAKE_SOURCE_DIR}/src # for platform.h
+        ${GLIB2_INCLUDE_DIRS}
+        ${LIBINTL_INCLUDE_PATH}
+        ${REGEX_INCLUDE_PATH}
+        ${CMAKE_SOURCE_DIR}/lib/libc # for strptime.h
 )
 
 INSTALL(TARGETS gncmod-engine
@@ -174,6 +246,16 @@ INSTALL(TARGETS gncmod-engine
 
 INSTALL(FILES ${engine_HEADERS} DESTINATION include/gnucash)
 
+SET(qof_test_HEADERS
+kvp-frame.hpp
+qofbook.h
+qofinstance.h
+qofobject.h
+qofsession.h
+)
+
+INSTALL(FILES ${qof_test_HEADERS} DESTINATION libexec/gnucash/src/engine/test)
+
 # Scheme
 
 SET (engine_SCHEME_0
@@ -194,6 +276,11 @@ IF (NOT WIN32)
     LIST(APPEND BACKEND_DEPENDS gncmod-backend-dbi-link)
   ENDIF(WITH_SQL)
 ELSE (NOT WIN32)
+  ADD_DEFINITIONS (-DOS_WIN32)
+  SET (engine_SOURCES ${engine_SOURCES}
+  qof-win32.cpp
+  ../../lib/libc/strptime.c
+  )
    SET(BACKEND_DEPENDS gncmod-backend-xml)
    IF (WITH_SQL)
       LIST(APPEND BACKEND_DEPENDS gncmod-backend-dbi)
diff --git a/src/engine/Makefile.am b/src/engine/Makefile.am
index f533b76..c0ba0b5 100644
--- a/src/engine/Makefile.am
+++ b/src/engine/Makefile.am
@@ -1,4 +1,7 @@
-SUBDIRS = . test-core test
+# Note the test subdirectory is added in src/Makefile.am rather
+# than here. This is because we need it to build after src/test-core
+# but that directory requires src/engine to be built already...
+SUBDIRS = . test-core
 
 pkglib_LTLIBRARIES = libgncmod-engine.la
 
@@ -8,7 +11,6 @@ AM_CPPFLAGS = \
 	-I${top_srcdir}/src \
 	-I${top_builddir}/src \
 	-I${top_srcdir}/src/gnc-module \
-	-I${top_srcdir}/src/libqof/qof \
 	${GLIB_CFLAGS} \
 	${GUILE_CFLAGS} \
 	$(BOOST_CPPFLAGS)
@@ -30,19 +32,29 @@ libgncmod_engine_la_SOURCES = \
   Transaction.c \
   cap-gains.c \
   cashobjects.c \
+  gnc-aqbanking-templates.cpp \
   gnc-budget.c \
   gnc-commodity.c \
+  gnc-date.cpp \
+  gnc-datetime.cpp \
   gnc-engine.c \
   gnc-event.c \
   gnc-features.c \
   gnc-hooks.c \
+  gnc-int128.cpp \
   gnc-lot.c \
+  gnc-numeric.cpp \
   gnc-pricedb.c \
+  gnc-rational.cpp \
   gnc-session.c \
+  gnc-timezone.cpp \
   gnc-uri-utils.c \
   gncmod-engine.c \
+  guid.cpp \
   swig-engine.c \
+  kvp-frame.cpp \
   kvp-scm.cpp \
+  kvp-value.cpp \
   engine-helpers.c \
   glib-helpers.c  \
   policy.c \
@@ -59,7 +71,27 @@ libgncmod_engine_la_SOURCES = \
   gncOwner.c \
   gncTaxTable.c \
   gncIDSearch.c \
-  gncVendor.c
+  gncVendor.c \
+  qof-backend.cpp \
+  qofbook.cpp \
+  qofchoice.cpp \
+  qofclass.cpp \
+  qofevent.cpp \
+  qofid.cpp \
+  qofinstance.cpp \
+  qoflog.cpp \
+  qofobject.cpp \
+  qofquery.cpp \
+  qofquerycore.cpp \
+  qofsession.cpp \
+  qof-string-cache.cpp \
+  qofutil.cpp
+
+if OS_WIN32
+libgncmod_engine_la_SOURCES += qof-win32.cpp
+else
+WIN32_EXTRA_DIST = qof-win32.cpp
+endif
 
 EXTRA_libgncmod_engine_la_SOURCES = iso-4217-currencies.c
 
@@ -84,16 +116,28 @@ gncinclude_HEADERS = \
   engine-helpers.h \
   engine-helpers-guile.h \
   glib-helpers.h \
+  gnc-aqbanking-templates.h \
   gnc-budget.h \
   gnc-commodity.h \
+  gnc-date-p.h \
+  gnc-date.h \
+  gnc-datetime.hpp \
   gnc-engine.h \
   gnc-event.h \
   gnc-features.h \
   gnc-hooks.h \
+  gnc-numeric.h \
+  gnc-numeric.hpp \
   gnc-pricedb.h \
+  gnc-rational.hpp \
+  gnc-rational-rounding.hpp \
   gnc-session.h \
+  gnc-timezone.hpp \
   gnc-uri-utils.h \
+  guid.h \
+  kvp-frame.hpp \
   kvp-scm.h \
+  kvp-value.hpp \
   policy.h \
   gncAddress.h \
   gncAddressP.h \
@@ -119,7 +163,28 @@ gncinclude_HEADERS = \
   gncTaxTableP.h \
   gncIDSearch.h \
   gncVendor.h \
-  gncVendorP.h
+  gncVendorP.h \
+  qof.h \
+  qof-backend.hpp \
+  qofbackend.h \
+  qofbook.h \
+  qofbookslots.h \
+  qofchoice.h \
+  qofclass.h \
+  qofevent.h \
+  qofid-p.h \
+  qofid.h \
+  qofinstance-p.h \
+  qofinstance.h \
+  qoflog.h \
+  qofobject.h \
+  qofquery.h \
+  qofquerycore.h \
+  qofsession.h \
+  qofsession.hpp \
+  qof-string-cache.h \
+  qofutil.h \
+  qof-gobject.h
 
 noinst_HEADERS = \
   AccountP.h \
@@ -128,11 +193,18 @@ noinst_HEADERS = \
   SX-book.h \
   SX-ttinfo.h \
   TransactionP.h \
+  gnc-backend-prov.hpp \
   gnc-hooks-scm.h \
   gnc-lot.h \
   gnc-lot-p.h \
   gnc-pricedb-p.h \
-  policy-p.h
+  policy-p.h  \
+  qofclass-p.h \
+  qofevent-p.h \
+  gnc-int128.hpp \
+  qofobject-p.h \
+  qofquery-p.h \
+  qofquerycore-p.h
 
 libgncmod_engine_la_LDFLAGS = -avoid-version
 if PLATFORM_WIN32
@@ -146,10 +218,10 @@ endif
 libgncmod_engine_la_LIBADD = \
   ../gnc-module/libgnc-module.la \
   ../core-utils/libgnc-core-utils.la \
-  ${top_builddir}/src/libqof/qof/libgnc-qof.la \
   ${GUILE_LIBS} \
   ${REGEX_LIBS} \
   ${GLIB_LIBS} \
+  ${BOOST_LDFLAGS} -lboost_regex \
   ${top_builddir}/lib/libc/libc-missing.la
 
 gncscmmoddir = ${GNC_SCM_INSTALL_DIR}/gnucash
@@ -176,7 +248,8 @@ EXTRA_DIST = \
   business-core.i \
   ${gncscmmod_DATA} \
   ${gncscm_DATA} \
-  CMakeLists.txt
+  CMakeLists.txt \
+  ${WIN32_EXTRA_DIST}
 
 if GNUCASH_SEPARATE_BUILDDIR
 #For executing test cases
@@ -204,8 +277,7 @@ GUILE_COMPILE_ENV = \
   --guile-load-dir ${top_builddir}/src/gnc-module \
   --library-dir    ${top_builddir}/src/engine \
   --library-dir    ${top_builddir}/src/gnc-module \
-  --library-dir    ${top_builddir}/src/core-utils \
-  --library-dir    ${top_builddir}/src/libqof/qof
+  --library-dir    ${top_builddir}/src/core-utils
 
 %.go : %.scm .scm-links $(pkglib_LTLIBRARIES)
 	GNC_UNINSTALLED=yes \
@@ -224,18 +296,10 @@ noinst_DATA = .scm-links
 
 if BUILDING_FROM_VCS
 
-# The generated file depends on various libqof headers. Out of
-# laziness I only include a few here - more might be needed
-# subsequently.
-QOFHEADERS = \
-  $(top_srcdir)/src/libqof/qof/qofbook.h \
-  $(top_srcdir)/src/libqof/qof/qofbookslots.h
-
 swig-engine.c: engine.i $(top_srcdir)/src/base-typemaps.i \
-               $(QOFHEADERS) \
                $(gncinclude_HEADERS) $(noinst_HEADERS)
 	$(SWIG) -guile $(SWIG_ARGS) -Linkage module \
-	-I${top_srcdir}/src/libqof/qof -I${top_srcdir}/src -o $@ $<
+	-I${top_srcdir}/src -o $@ $<
 if ! OS_WIN32
 if ! SWIG_DIST_FAIL
 	if ! `grep "define scm_from_utf8_string" $@ > /dev/null 2>&1`; then \
diff --git a/src/engine/business-core.i b/src/engine/business-core.i
index f1582bc..5aee7a5 100644
--- a/src/engine/business-core.i
+++ b/src/engine/business-core.i
@@ -129,7 +129,7 @@ GLIST_HELPER_INOUT(OwnerList, SWIGTYPE_p__gncOwner);
 #endif
 /* Import query bindings for the below invoice query functions (but
  * don't generate bindings for them). */
-%import <libqof/qof/qofquery.h>
+%import <qofquery.h>
 
 #define URL_TYPE_CUSTOMER GNC_ID_CUSTOMER
 #define URL_TYPE_VENDOR GNC_ID_VENDOR
diff --git a/src/libqof/qof/gnc-aqbanking-templates.cpp b/src/engine/gnc-aqbanking-templates.cpp
similarity index 99%
rename from src/libqof/qof/gnc-aqbanking-templates.cpp
rename to src/engine/gnc-aqbanking-templates.cpp
index 54f9b6f..eb8d6e7 100644
--- a/src/libqof/qof/gnc-aqbanking-templates.cpp
+++ b/src/engine/gnc-aqbanking-templates.cpp
@@ -33,7 +33,7 @@ extern "C"
 #include "qofinstance-p.h"
 }
 
-#include "kvp_frame.hpp"
+#include "kvp-frame.hpp"
 #include "gnc-rational.hpp"
 
 namespace {
diff --git a/src/libqof/qof/gnc-aqbanking-templates.h b/src/engine/gnc-aqbanking-templates.h
similarity index 100%
rename from src/libqof/qof/gnc-aqbanking-templates.h
rename to src/engine/gnc-aqbanking-templates.h
diff --git a/src/libqof/qof/gnc-backend-prov.hpp b/src/engine/gnc-backend-prov.hpp
similarity index 100%
rename from src/libqof/qof/gnc-backend-prov.hpp
rename to src/engine/gnc-backend-prov.hpp
diff --git a/src/libqof/qof/gnc-date-p.h b/src/engine/gnc-date-p.h
similarity index 100%
rename from src/libqof/qof/gnc-date-p.h
rename to src/engine/gnc-date-p.h
diff --git a/src/libqof/qof/gnc-date.cpp b/src/engine/gnc-date.cpp
similarity index 100%
rename from src/libqof/qof/gnc-date.cpp
rename to src/engine/gnc-date.cpp
diff --git a/src/libqof/qof/gnc-date.h b/src/engine/gnc-date.h
similarity index 100%
rename from src/libqof/qof/gnc-date.h
rename to src/engine/gnc-date.h
diff --git a/src/libqof/qof/gnc-datetime.cpp b/src/engine/gnc-datetime.cpp
similarity index 100%
rename from src/libqof/qof/gnc-datetime.cpp
rename to src/engine/gnc-datetime.cpp
diff --git a/src/libqof/qof/gnc-datetime.hpp b/src/engine/gnc-datetime.hpp
similarity index 100%
rename from src/libqof/qof/gnc-datetime.hpp
rename to src/engine/gnc-datetime.hpp
diff --git a/src/engine/gnc-features.c b/src/engine/gnc-features.c
index 9189862..9f97eae 100644
--- a/src/engine/gnc-features.c
+++ b/src/engine/gnc-features.c
@@ -29,7 +29,7 @@
 #include <sys/stat.h>
 #include <sys/types.h>
 
-#include "libqof/qof/qof.h"
+#include "qof.h"
 #include "gnc-features.h"
 
 typedef struct
diff --git a/src/engine/gnc-features.h b/src/engine/gnc-features.h
index 88c860d..39f1c03 100644
--- a/src/engine/gnc-features.h
+++ b/src/engine/gnc-features.h
@@ -36,7 +36,7 @@
 #ifndef GNC_FEATURES_H
 #define GNC_FEATURES_H
 
-#include "libqof/qof/qof.h"
+#include "qof.h"
 
 /** @name Defined features
 @{
diff --git a/src/libqof/qof/gnc-int128.cpp b/src/engine/gnc-int128.cpp
similarity index 100%
rename from src/libqof/qof/gnc-int128.cpp
rename to src/engine/gnc-int128.cpp
diff --git a/src/libqof/qof/gnc-int128.hpp b/src/engine/gnc-int128.hpp
similarity index 100%
rename from src/libqof/qof/gnc-int128.hpp
rename to src/engine/gnc-int128.hpp
diff --git a/src/libqof/qof/gnc-numeric.cpp b/src/engine/gnc-numeric.cpp
similarity index 100%
rename from src/libqof/qof/gnc-numeric.cpp
rename to src/engine/gnc-numeric.cpp
diff --git a/src/libqof/qof/gnc-numeric.h b/src/engine/gnc-numeric.h
similarity index 100%
rename from src/libqof/qof/gnc-numeric.h
rename to src/engine/gnc-numeric.h
diff --git a/src/libqof/qof/gnc-numeric.hpp b/src/engine/gnc-numeric.hpp
similarity index 100%
rename from src/libqof/qof/gnc-numeric.hpp
rename to src/engine/gnc-numeric.hpp
diff --git a/src/libqof/qof/gnc-rational-rounding.hpp b/src/engine/gnc-rational-rounding.hpp
similarity index 100%
rename from src/libqof/qof/gnc-rational-rounding.hpp
rename to src/engine/gnc-rational-rounding.hpp
diff --git a/src/libqof/qof/gnc-rational.cpp b/src/engine/gnc-rational.cpp
similarity index 100%
rename from src/libqof/qof/gnc-rational.cpp
rename to src/engine/gnc-rational.cpp
diff --git a/src/libqof/qof/gnc-rational.hpp b/src/engine/gnc-rational.hpp
similarity index 100%
rename from src/libqof/qof/gnc-rational.hpp
rename to src/engine/gnc-rational.hpp
diff --git a/src/libqof/qof/gnc-timezone.cpp b/src/engine/gnc-timezone.cpp
similarity index 100%
rename from src/libqof/qof/gnc-timezone.cpp
rename to src/engine/gnc-timezone.cpp
diff --git a/src/libqof/qof/gnc-timezone.hpp b/src/engine/gnc-timezone.hpp
similarity index 100%
rename from src/libqof/qof/gnc-timezone.hpp
rename to src/engine/gnc-timezone.hpp
diff --git a/src/libqof/qof/guid.cpp b/src/engine/guid.cpp
similarity index 100%
rename from src/libqof/qof/guid.cpp
rename to src/engine/guid.cpp
diff --git a/src/libqof/qof/guid.h b/src/engine/guid.h
similarity index 100%
rename from src/libqof/qof/guid.h
rename to src/engine/guid.h
diff --git a/src/libqof/qof/guid.hpp b/src/engine/guid.hpp
similarity index 100%
rename from src/libqof/qof/guid.hpp
rename to src/engine/guid.hpp
diff --git a/src/libqof/qof/kvp_frame.cpp b/src/engine/kvp-frame.cpp
similarity index 99%
rename from src/libqof/qof/kvp_frame.cpp
rename to src/engine/kvp-frame.cpp
index 5a5b6be..79c2db3 100644
--- a/src/libqof/qof/kvp_frame.cpp
+++ b/src/engine/kvp-frame.cpp
@@ -33,7 +33,7 @@ extern "C"
 }
 
 #include "kvp-value.hpp"
-#include "kvp_frame.hpp"
+#include "kvp-frame.hpp"
 #include <typeinfo>
 #include <sstream>
 #include <algorithm>
diff --git a/src/libqof/qof/kvp_frame.hpp b/src/engine/kvp-frame.hpp
similarity index 100%
rename from src/libqof/qof/kvp_frame.hpp
rename to src/engine/kvp-frame.hpp
diff --git a/src/engine/kvp-scm.cpp b/src/engine/kvp-scm.cpp
index 9f69319..e8b1223 100644
--- a/src/engine/kvp-scm.cpp
+++ b/src/engine/kvp-scm.cpp
@@ -1,5 +1,5 @@
 #include <guid.hpp>
-#include <kvp_frame.hpp>
+#include <kvp-frame.hpp>
 #include <libguile.h>
 
 extern "C"
diff --git a/src/libqof/qof/kvp-value.cpp b/src/engine/kvp-value.cpp
similarity index 99%
rename from src/libqof/qof/kvp-value.cpp
rename to src/engine/kvp-value.cpp
index a671284..277cca0 100644
--- a/src/libqof/qof/kvp-value.cpp
+++ b/src/engine/kvp-value.cpp
@@ -22,7 +22,7 @@
 \********************************************************************/
 
 #include "kvp-value.hpp"
-#include "kvp_frame.hpp"
+#include "kvp-frame.hpp"
 #include <cmath>
 
 #include <sstream>
diff --git a/src/libqof/qof/kvp-value.hpp b/src/engine/kvp-value.hpp
similarity index 100%
rename from src/libqof/qof/kvp-value.hpp
rename to src/engine/kvp-value.hpp
diff --git a/src/libqof/qof/qof-backend.cpp b/src/engine/qof-backend.cpp
similarity index 100%
rename from src/libqof/qof/qof-backend.cpp
rename to src/engine/qof-backend.cpp
diff --git a/src/libqof/qof/qof-backend.hpp b/src/engine/qof-backend.hpp
similarity index 100%
rename from src/libqof/qof/qof-backend.hpp
rename to src/engine/qof-backend.hpp
diff --git a/src/libqof/qof/qof-gobject.h b/src/engine/qof-gobject.h
similarity index 100%
rename from src/libqof/qof/qof-gobject.h
rename to src/engine/qof-gobject.h
diff --git a/src/libqof/qof/qof-string-cache.cpp b/src/engine/qof-string-cache.cpp
similarity index 100%
rename from src/libqof/qof/qof-string-cache.cpp
rename to src/engine/qof-string-cache.cpp
diff --git a/src/libqof/qof/qof-string-cache.h b/src/engine/qof-string-cache.h
similarity index 100%
rename from src/libqof/qof/qof-string-cache.h
rename to src/engine/qof-string-cache.h
diff --git a/src/libqof/qof/qof-win32.cpp b/src/engine/qof-win32.cpp
similarity index 100%
rename from src/libqof/qof/qof-win32.cpp
rename to src/engine/qof-win32.cpp
diff --git a/src/libqof/qof/qof.h b/src/engine/qof.h
similarity index 100%
rename from src/libqof/qof/qof.h
rename to src/engine/qof.h
diff --git a/src/libqof/qof/qofbackend.h b/src/engine/qofbackend.h
similarity index 100%
rename from src/libqof/qof/qofbackend.h
rename to src/engine/qofbackend.h
diff --git a/src/libqof/qof/qofbook-p.h b/src/engine/qofbook-p.h
similarity index 100%
rename from src/libqof/qof/qofbook-p.h
rename to src/engine/qofbook-p.h
diff --git a/src/libqof/qof/qofbook.cpp b/src/engine/qofbook.cpp
similarity index 99%
rename from src/libqof/qof/qofbook.cpp
rename to src/engine/qofbook.cpp
index 09707d8..1b2dfd6 100644
--- a/src/libqof/qof/qofbook.cpp
+++ b/src/engine/qofbook.cpp
@@ -57,7 +57,7 @@ extern "C"
 #include "qofid-p.h"
 #include "qofobject-p.h"
 #include "qofbookslots.h"
-#include "kvp_frame.hpp"
+#include "kvp-frame.hpp"
 
 static QofLogModule log_module = QOF_MOD_ENGINE;
 #define AB_KEY "hbci"
diff --git a/src/libqof/qof/qofbook.h b/src/engine/qofbook.h
similarity index 100%
rename from src/libqof/qof/qofbook.h
rename to src/engine/qofbook.h
diff --git a/src/libqof/qof/qofbookslots.h b/src/engine/qofbookslots.h
similarity index 100%
rename from src/libqof/qof/qofbookslots.h
rename to src/engine/qofbookslots.h
diff --git a/src/libqof/qof/qofchoice.cpp b/src/engine/qofchoice.cpp
similarity index 100%
rename from src/libqof/qof/qofchoice.cpp
rename to src/engine/qofchoice.cpp
diff --git a/src/libqof/qof/qofchoice.h b/src/engine/qofchoice.h
similarity index 100%
rename from src/libqof/qof/qofchoice.h
rename to src/engine/qofchoice.h
diff --git a/src/libqof/qof/qofclass-p.h b/src/engine/qofclass-p.h
similarity index 100%
rename from src/libqof/qof/qofclass-p.h
rename to src/engine/qofclass-p.h
diff --git a/src/libqof/qof/qofclass.cpp b/src/engine/qofclass.cpp
similarity index 100%
rename from src/libqof/qof/qofclass.cpp
rename to src/engine/qofclass.cpp
diff --git a/src/libqof/qof/qofclass.h b/src/engine/qofclass.h
similarity index 100%
rename from src/libqof/qof/qofclass.h
rename to src/engine/qofclass.h
diff --git a/src/libqof/qof/qofevent-p.h b/src/engine/qofevent-p.h
similarity index 100%
rename from src/libqof/qof/qofevent-p.h
rename to src/engine/qofevent-p.h
diff --git a/src/libqof/qof/qofevent.cpp b/src/engine/qofevent.cpp
similarity index 100%
rename from src/libqof/qof/qofevent.cpp
rename to src/engine/qofevent.cpp
diff --git a/src/libqof/qof/qofevent.h b/src/engine/qofevent.h
similarity index 100%
rename from src/libqof/qof/qofevent.h
rename to src/engine/qofevent.h
diff --git a/src/libqof/qof/qofid-p.h b/src/engine/qofid-p.h
similarity index 100%
rename from src/libqof/qof/qofid-p.h
rename to src/engine/qofid-p.h
diff --git a/src/libqof/qof/qofid.cpp b/src/engine/qofid.cpp
similarity index 100%
rename from src/libqof/qof/qofid.cpp
rename to src/engine/qofid.cpp
diff --git a/src/libqof/qof/qofid.h b/src/engine/qofid.h
similarity index 100%
rename from src/libqof/qof/qofid.h
rename to src/engine/qofid.h
diff --git a/src/libqof/qof/qofinstance-p.h b/src/engine/qofinstance-p.h
similarity index 100%
rename from src/libqof/qof/qofinstance-p.h
rename to src/engine/qofinstance-p.h
diff --git a/src/libqof/qof/qofinstance.cpp b/src/engine/qofinstance.cpp
similarity index 99%
rename from src/libqof/qof/qofinstance.cpp
rename to src/engine/qofinstance.cpp
index d58335c..512225d 100644
--- a/src/libqof/qof/qofinstance.cpp
+++ b/src/engine/qofinstance.cpp
@@ -39,7 +39,7 @@ extern "C"
 #include "qof.h"
 #include "qofbook-p.h"
 #include "qofid-p.h"
-#include "kvp_frame.hpp"
+#include "kvp-frame.hpp"
 #include "qofinstance-p.h"
 #include "qof-backend.hpp"
 
diff --git a/src/libqof/qof/qofinstance.h b/src/engine/qofinstance.h
similarity index 100%
rename from src/libqof/qof/qofinstance.h
rename to src/engine/qofinstance.h
diff --git a/src/libqof/qof/qoflog.cpp b/src/engine/qoflog.cpp
similarity index 100%
rename from src/libqof/qof/qoflog.cpp
rename to src/engine/qoflog.cpp
diff --git a/src/libqof/qof/qoflog.h b/src/engine/qoflog.h
similarity index 100%
rename from src/libqof/qof/qoflog.h
rename to src/engine/qoflog.h
diff --git a/src/libqof/qof/qofobject-p.h b/src/engine/qofobject-p.h
similarity index 100%
rename from src/libqof/qof/qofobject-p.h
rename to src/engine/qofobject-p.h
diff --git a/src/libqof/qof/qofobject.cpp b/src/engine/qofobject.cpp
similarity index 100%
rename from src/libqof/qof/qofobject.cpp
rename to src/engine/qofobject.cpp
diff --git a/src/libqof/qof/qofobject.h b/src/engine/qofobject.h
similarity index 100%
rename from src/libqof/qof/qofobject.h
rename to src/engine/qofobject.h
diff --git a/src/libqof/qof/qofquery-p.h b/src/engine/qofquery-p.h
similarity index 100%
rename from src/libqof/qof/qofquery-p.h
rename to src/engine/qofquery-p.h
diff --git a/src/libqof/qof/qofquery.cpp b/src/engine/qofquery.cpp
similarity index 100%
rename from src/libqof/qof/qofquery.cpp
rename to src/engine/qofquery.cpp
diff --git a/src/libqof/qof/qofquery.h b/src/engine/qofquery.h
similarity index 100%
rename from src/libqof/qof/qofquery.h
rename to src/engine/qofquery.h
diff --git a/src/libqof/qof/qofquerycore-p.h b/src/engine/qofquerycore-p.h
similarity index 100%
rename from src/libqof/qof/qofquerycore-p.h
rename to src/engine/qofquerycore-p.h
diff --git a/src/libqof/qof/qofquerycore.cpp b/src/engine/qofquerycore.cpp
similarity index 100%
rename from src/libqof/qof/qofquerycore.cpp
rename to src/engine/qofquerycore.cpp
diff --git a/src/libqof/qof/qofquerycore.h b/src/engine/qofquerycore.h
similarity index 100%
rename from src/libqof/qof/qofquerycore.h
rename to src/engine/qofquerycore.h
diff --git a/src/libqof/qof/qofsession.cpp b/src/engine/qofsession.cpp
similarity index 100%
rename from src/libqof/qof/qofsession.cpp
rename to src/engine/qofsession.cpp
diff --git a/src/libqof/qof/qofsession.h b/src/engine/qofsession.h
similarity index 100%
rename from src/libqof/qof/qofsession.h
rename to src/engine/qofsession.h
diff --git a/src/libqof/qof/qofsession.hpp b/src/engine/qofsession.hpp
similarity index 100%
rename from src/libqof/qof/qofsession.hpp
rename to src/engine/qofsession.hpp
diff --git a/src/libqof/qof/qofutil.cpp b/src/engine/qofutil.cpp
similarity index 100%
rename from src/libqof/qof/qofutil.cpp
rename to src/engine/qofutil.cpp
diff --git a/src/libqof/qof/qofutil.h b/src/engine/qofutil.h
similarity index 100%
rename from src/libqof/qof/qofutil.h
rename to src/engine/qofutil.h
diff --git a/src/engine/test-core/CMakeLists.txt b/src/engine/test-core/CMakeLists.txt
index 75049b0..c376bd4 100644
--- a/src/engine/test-core/CMakeLists.txt
+++ b/src/engine/test-core/CMakeLists.txt
@@ -10,7 +10,6 @@ TARGET_INCLUDE_DIRECTORIES(gncmod-test-engine PRIVATE
   ${CMAKE_PREFIX_PATH}/include
   ${GMODULE_INCLUDE_DIRS}
   ${CMAKE_SOURCE_DIR}/src/gnc-module
-  ${CMAKE_SOURCE_DIR}/src/libqof/qof
   ${CMAKE_BINARY_DIR}/src # for config.h
   ${CMAKE_SOURCE_DIR}/src
   ${CMAKE_SOURCE_DIR}/src/engine
diff --git a/src/engine/test-core/Makefile.am b/src/engine/test-core/Makefile.am
index 98a41fb..6513014 100644
--- a/src/engine/test-core/Makefile.am
+++ b/src/engine/test-core/Makefile.am
@@ -3,7 +3,6 @@ noinst_LTLIBRARIES=libgncmod-test-engine.la
 LDADD = \
   ${top_builddir}/src/gnc-module/libgnc-module.la \
   ../libgncmod-engine.la \
-  ${top_builddir}/src/libqof/qof/libgnc-qof.la \
   ${GLIB_LIBS}
 
 libgncmod_test_engine_la_SOURCES = gncmod-test-engine.c test-engine-stuff.cpp
@@ -11,7 +10,6 @@ libgncmod_test_engine_la_LDFLAGS = -module
 libgncmod_test_engine_la_LIBADD = \
   ${top_builddir}/src/gnc-module/libgnc-module.la \
   ../libgncmod-engine.la \
-  ${top_builddir}/src/libqof/qof/libgnc-qof.la \
   ${GLIB_LIBS}
 
 noinst_HEADERS=test-engine-stuff.h test-engine-strings.h
@@ -21,7 +19,6 @@ AM_CPPFLAGS = \
   -I${top_srcdir}/src/gnc-module \
   -I${top_srcdir}/src/test-core \
   -I${top_srcdir}/src/engine \
-  -I${top_srcdir}/src/libqof/qof \
   ${GLIB_CFLAGS} \
   ${GUILE_CFLAGS} \
   ${BOOST_CPPFLAGS}
diff --git a/src/engine/test-core/test-engine-stuff.cpp b/src/engine/test-core/test-engine-stuff.cpp
index 9578978..b95c14d 100644
--- a/src/engine/test-core/test-engine-stuff.cpp
+++ b/src/engine/test-core/test-engine-stuff.cpp
@@ -36,7 +36,7 @@
 \********************************************************************/
 
 #include <guid.hpp>
-#include <kvp_frame.hpp>
+#include <kvp-frame.hpp>
 
 extern "C"
 {
diff --git a/src/engine/test/CMakeLists.txt b/src/engine/test/CMakeLists.txt
index 19dafe7..c8cb436 100644
--- a/src/engine/test/CMakeLists.txt
+++ b/src/engine/test/CMakeLists.txt
@@ -4,13 +4,12 @@ SET(ENGINE_TEST_INCLUDE_DIRS
   ${CMAKE_SOURCE_DIR}/src/backend/xml
   ${CMAKE_SOURCE_DIR}/src/engine
   ${CMAKE_SOURCE_DIR}/src/engine/test-core
-  ${CMAKE_SOURCE_DIR}/src/libqof/qof # for qof.h
   ${CMAKE_BINARY_DIR}/src # for config.h
   ${CMAKE_SOURCE_DIR}/src/test-core  # for unittest-support.h
   ${GLIB2_INCLUDE_DIRS}
 )
 
-SET(ENGINE_TEST_LIBS gncmod-engine gnc-qof gncmod-test-engine test-core ${LIBXML2_LDFLAGS})
+SET(ENGINE_TEST_LIBS gncmod-engine gncmod-test-engine test-core ${LIBXML2_LDFLAGS} -lm)
 
 MACRO(ADD_ENGINE_TEST _TARGET _SOURCE_FILES)
   GNC_ADD_TEST(${_TARGET} "${_SOURCE_FILES}" ENGINE_TEST_INCLUDE_DIRS ENGINE_TEST_LIBS)
@@ -21,7 +20,7 @@ CONFIGURE_FILE(test-create-account.in test-create-account @ONLY)
 # Not via macro because of unique link requirements
 
 ADD_EXECUTABLE(test-link EXCLUDE_FROM_ALL test-link.c)
-TARGET_LINK_LIBRARIES(test-link gnc-qof gnc-core-utils)
+TARGET_LINK_LIBRARIES(test-link gnc-core-utils)
 ADD_TEST(NAME test-link COMMAND test-link)
 ADD_DEPENDENCIES(check test-link)
 
@@ -33,8 +32,18 @@ ADD_ENGINE_TEST(test-date test-date.cpp)
 ADD_ENGINE_TEST(test-object test-object.c)
 ADD_ENGINE_TEST(test-commodities test-commodities.cpp)
 
+SET(test_qof_SOURCES
+  test-gnc-date.c
+  test-qof.c
+  test-qofbook.c
+  test-qofinstance.cpp
+  test-qofobject.c
+  test-qof-string-cache.c
+)
+
 SET(test_engine_SOURCES
   test-engine.c
+  test-engine-kvp-properties.c
   test-gnc-uri-utils.c
   utest-Account.cpp
   utest-Budget.c
@@ -42,14 +51,19 @@ SET(test_engine_SOURCES
   utest-Invoice.c
   utest-Split.cpp
   utest-Transaction.cpp
-  test-engine-kvp-properties.c
   utest-gnc-pricedb.c
 )
 
 # This test does not run on Win32
 IF (NOT WIN32)
-  ADD_ENGINE_TEST(test-engine "${test_engine_SOURCES}")
+  SET(SOURCES ${test_qof_SOURCES} ${CMAKE_SOURCE_DIR}/src/test-core/unittest-support.c)
+  ADD_ENGINE_TEST(test-qof "${SOURCES}")
+  TARGET_COMPILE_DEFINITIONS(test-qof PRIVATE TESTPROG=test_qof)
+
+  SET(SOURCES ${test_engine_SOURCES} ${CMAKE_SOURCE_DIR}/src/test-core/unittest-support.c)
+  ADD_ENGINE_TEST(test-engine "${SOURCES}")
   TARGET_COMPILE_OPTIONS(test-engine PRIVATE -Wno-write-strings)
+  TARGET_COMPILE_DEFINITIONS(test-engine PRIVATE TESTPROG=test_engine)
 ENDIF()
 
 ADD_ENGINE_TEST(test-account-object test-account-object.cpp)
@@ -68,6 +82,108 @@ ADD_ENGINE_TEST(test-employee test-employee.c)
 ADD_ENGINE_TEST(test-job test-job.c)
 ADD_ENGINE_TEST(test-vendor test-vendor.c)
 
+SET(test_numeric_SOURCES
+  ${CMAKE_SOURCE_DIR}/src/engine/gnc-numeric.cpp
+  ${CMAKE_SOURCE_DIR}/src/engine/gnc-rational.cpp
+  ${CMAKE_SOURCE_DIR}/src/engine/gnc-int128.cpp
+  ${CMAKE_SOURCE_DIR}/src/engine/test/test-numeric.cpp
+)
+ADD_ENGINE_TEST(test-numeric "${test_numeric_SOURCES}")
+
+SET(MODULEPATH ${CMAKE_SOURCE_DIR}/src/engine)
+SET(gtest_old_engine_LIBS
+  gncmod-engine
+  ${GLIB2_LDFLAGS}
+  ${Boost_LIBRARIES}
+  ${GTEST_LIB})
+
+SET(gtest_qof_LIBS
+  ${GLIB2_LDFLAGS}
+  ${GOBJECT_LDFLAGS}
+  ${GMODULE_LDFLAGS}
+  ${GTHREAD_LDFLAGS}
+  ${Boost_LIBRARIES}
+  ${GTEST_LIB})
+
+SET(gtest_engine_INCLUDES
+  ${MODULEPATH}
+  ${CMAKE_BINARY_DIR}/src # for config.h
+  ${CMAKE_SOURCE_DIR}/src # for platform.h
+  ${GLIB2_INCLUDE_DIRS}
+  ${GTEST_INCLUDE_DIR})
+
+SET(test_gnc_guid_SOURCES
+  ${MODULEPATH}/guid.cpp
+  test-gnc-guid.cpp
+  ${GTEST_SRC})
+GNC_ADD_TEST(test-gnc-guid "${test_gnc_guid_SOURCES}"
+  gtest_engine_INCLUDES gtest_old_engine_LIBS)
+
+SET(test_kvp_value_SOURCES
+  ${MODULEPATH}/kvp-value.cpp
+  test-kvp-value.cpp
+  test-kvp-frame.cpp
+  ${GTEST_SRC})
+GNC_ADD_TEST(test-kvp-value "${test_kvp_value_SOURCES}"
+  gtest_engine_INCLUDES gtest_old_engine_LIBS)
+
+SET(test_qofsession_SOURCES
+  ${MODULEPATH}/qofsession.cpp
+  test-qofsession.cpp
+  ${GTEST_SRC})
+GNC_ADD_TEST(test-qofsession "${test_qofsession_SOURCES}"
+  gtest_engine_INCLUDES gtest_old_engine_LIBS)
+
+SET(test_gnc_int128_SOURCES
+  ${MODULEPATH}/gnc-int128.cpp
+  gtest-gnc-int128.cpp
+  ${GTEST_SRC})
+GNC_ADD_TEST(test-gnc-int128 "${test_gnc_int128_SOURCES}"
+  gtest_engine_INCLUDES gtest_qof_LIBS)
+
+SET(test_gnc_rational_SOURCES
+  ${MODULEPATH}/gnc-rational.cpp
+  ${MODULEPATH}/gnc-numeric.cpp
+  ${MODULEPATH}/gnc-int128.cpp
+  ${MODULEPATH}/gnc-datetime.cpp
+  ${MODULEPATH}/gnc-timezone.cpp
+  ${MODULEPATH}/gnc-date.cpp
+  ${MODULEPATH}/qoflog.cpp
+  gtest-gnc-rational.cpp
+  ${GTEST_SRC})
+GNC_ADD_TEST(test-gnc-rational "${test_gnc_rational_SOURCES}"
+  gtest_engine_INCLUDES gtest_qof_LIBS)
+
+SET(test_gnc_numeric_SOURCES
+  ${MODULEPATH}/gnc-rational.cpp
+  ${MODULEPATH}/gnc-int128.cpp
+  ${MODULEPATH}/gnc-numeric.cpp
+  ${MODULEPATH}/gnc-datetime.cpp
+  ${MODULEPATH}/gnc-timezone.cpp
+  ${MODULEPATH}/gnc-date.cpp
+  ${MODULEPATH}/qoflog.cpp
+  gtest-gnc-numeric.cpp
+  ${GTEST_SRC})
+GNC_ADD_TEST(test-gnc-numeric "${test_gnc_numeric_SOURCES}"
+  gtest_engine_INCLUDES gtest_qof_LIBS)
+
+SET(test_gnc_timezone_SOURCES
+  ${MODULEPATH}/gnc-timezone.cpp
+  gtest-gnc-timezone.cpp
+  ${GTEST_SRC})
+GNC_ADD_TEST(test-gnc-timezone "${test_gnc_timezone_SOURCES}"
+  gtest_engine_INCLUDES gtest_old_engine_LIBS)
+
+SET(test_gnc_datetime_SOURCES
+  ${MODULEPATH}/gnc-datetime.cpp
+  ${MODULEPATH}/gnc-timezone.cpp
+  ${MODULEPATH}/gnc-date.cpp
+  ${MODULEPATH}/qoflog.cpp
+  gtest-gnc-datetime.cpp
+  ${GTEST_SRC})
+GNC_ADD_TEST(test-gnc-datetime "${test_gnc_datetime_SOURCES}"
+  gtest_engine_INCLUDES gtest_qof_LIBS)
+
 ############################
 # This is a C test that needs GUILE environment variables set.
 # It does not pass on Win32.
@@ -100,6 +216,11 @@ GNC_ADD_SCHEME_TARGETS(scm-test-engine
 
 SET(test_engine_SOURCES_DIST
         dummy.cpp
+        gtest-gnc-int128.cpp
+        gtest-gnc-rational.cpp
+        gtest-gnc-numeric.cpp
+        gtest-gnc-timezone.cpp
+        gtest-gnc-datetime.cpp
         gtest-import-map.cpp
         test-account-object.cpp
         test-address.c
@@ -108,16 +229,27 @@ SET(test_engine_SOURCES_DIST
         test-customer.c
         test-date.cpp
         test-employee.c
-	test-engine-kvp-properties.c
+        test-engine-kvp-properties.c
         test-engine.c
-        test-gnc-uri-utils.c
+        test-gnc-date.c
+        test-gnc-guid.cpp
+	test-gnc-uri-utils.c
         test-group-vs-book.cpp
         test-guid.cpp
         test-job.c
+        test-kvp-value.cpp
+        test-kvp-frame.cpp
         test-link.c
         test-load-engine.c
         test-lots.cpp
+        test-numeric.cpp
         test-object.c
+        test-qof.c
+        test-qofbook.c
+        test-qofinstance.cpp
+        test-qofobject.c
+        test-qofsession.cpp
+        test-qof-string-cache.c
         test-query.cpp
         test-querynew.c
         test-recurrence.c
@@ -132,7 +264,7 @@ SET(test_engine_SOURCES_DIST
         utest-Invoice.c
         utest-Split.cpp
         utest-Transaction.cpp
-	utest-gnc-pricedb.c
+        utest-gnc-pricedb.c
 )
 
 SET(test_engine_SCHEME_DIST
diff --git a/src/engine/test/Makefile.am b/src/engine/test/Makefile.am
index a363e53..1af7131 100644
--- a/src/engine/test/Makefile.am
+++ b/src/engine/test/Makefile.am
@@ -9,14 +9,12 @@ AM_CPPFLAGS = \
   -I${top_srcdir}/src/test-core \
   -I${top_srcdir}/src/engine \
   -I${top_srcdir}/src/engine/test-core \
-  -I${top_srcdir}/src/libqof/qof \
   -I${top_srcdir}/src/core-utils \
   ${GUILE_CFLAGS} \
   ${GLIB_CFLAGS} \
   ${BOOST_CPPFLAGS}
 
 LDADD = \
-  ${top_builddir}/src/libqof/qof/libgnc-qof.la \
   ${top_builddir}/src/gnc-module/libgnc-module.la \
   ${top_builddir}/src/test-core/libtest-core.la \
   ../libgncmod-engine.la \
@@ -36,6 +34,7 @@ TEST_GROUP_1 = \
   test-date \
   test-object \
   test-commodities \
+  test-qof \
   test-engine
 
 TEST_GROUP_2 = \
@@ -73,7 +72,6 @@ GNC_TEST_DEPS = \
   --guile-load-dir ${top_builddir}/src/core-utils \
   --guile-load-dir ${top_builddir}/src/scm \
   --guile-load-dir ${top_builddir}/src/engine/test \
-  --library-dir    ${top_builddir}/src/libqof/qof \
   --library-dir    ${top_builddir}/src/core-utils \
   --library-dir    ${top_builddir}/src/gnc-module \
   --library-dir    ${top_builddir}/src/engine \
@@ -113,7 +111,6 @@ TESTS = ${TEST_GROUP_1} test-create-account ${TEST_GROUP_2} ${SCM_TESTS}
 
 test_link_SOURCES = test-link.c
 test_link_LDADD = ../libgncmod-engine.la \
-  ${top_builddir}/src/libqof/qof/libgnc-qof.la \
   ${top_builddir}/src/core-utils/libgnc-core-utils.la
 
 if WITH_GOOGLE_PROFILER
@@ -146,6 +143,23 @@ noinst_PROGRAMS = ${TEST_PROGS} ${CHECK_PROGS}
 
 noinst_DATA: .scm-links
 
+test_qof_SOURCES = \
+	test-gnc-date.c \
+	test-qof.c \
+	test-qofbook.c \
+	test-qofinstance.cpp \
+	test-qofobject.c \
+	test-qof-string-cache.c
+
+test_qof_LDADD = \
+	$(LDADD)
+test_qof_CFLAGS = \
+	${DEFAULT_INCLUDES} \
+	-I${top_srcdir}/${MODULEPATH}/ \
+	-DTESTPROG=test_qof \
+	${GLIB_CFLAGS} \
+	${AM_CFLAGS}
+
 test_engine_SOURCES = \
 	test-engine.c \
 	test-gnc-uri-utils.c \
@@ -155,11 +169,12 @@ test_engine_SOURCES = \
 	utest-Invoice.c \
 	test-engine-kvp-properties.c \
 	utest-gnc-pricedb.c \
-	dummy.cpp
+	utest-Transaction.cpp \
+	dummy.cpp \
+	utest-Split.cpp \
+	${top_srcdir}/${MODULEPATH}/gnc-numeric.cpp
 
 test_engine_LDADD = \
-	libutest-Split.la \
-	libutest-Trans.la \
 	$(LDADD)
 test_engine_CFLAGS = \
 	${DEFAULT_INCLUDES} \
@@ -167,27 +182,11 @@ test_engine_CFLAGS = \
 	-DTESTPROG=test_engine \
 	${GLIB_CFLAGS} \
 	${AM_CFLAGS}
-
-noinst_LTLIBRARIES = \
-	libutest-Split.la \
-	libutest-Trans.la
-
-libutest_Split_la_SOURCES = \
-	utest-Split.cpp \
-	${top_srcdir}/src/libqof/qof/gnc-numeric.cpp
-libutest_Split_la_CXXFLAGS = -Wno-write-strings $(AM_CXXFLAGS)
-
-libutest_Split_la_LIBADD = $(LDADD)
-
-libutest_Trans_la_SOURCES = \
-	utest-Transaction.cpp
-
-libutest_Trans_la_LIBADD = $(LDADD)
+test_engine_CXXFLAGS = -Wno-write-strings $(AM_CXXFLAGS)
 
 test_import_map_SOURCES = \
         gtest-import-map.cpp
 test_import_map_LDADD = \
-        ${top_builddir}/src/libqof/qof/libgnc-qof.la \
         ${top_builddir}/src/engine/libgncmod-engine.la \
         ${GLIB_LIBS} \
         ${GTEST_LIBS}
@@ -200,7 +199,6 @@ endif
 test_import_map_CPPFLAGS = \
         -I${GTEST_HEADERS} \
         -I${top_srcdir}/${MODULEPATH} \
-        -I${top_srcdir}/src/libqof/qof \
         -I${top_srcdir}/src/core-utils \
         ${GLIB_CFLAGS}
 
diff --git a/src/libqof/qof/test/gtest-gnc-datetime.cpp b/src/engine/test/gtest-gnc-datetime.cpp
similarity index 100%
rename from src/libqof/qof/test/gtest-gnc-datetime.cpp
rename to src/engine/test/gtest-gnc-datetime.cpp
diff --git a/src/libqof/qof/test/gtest-gnc-int128.cpp b/src/engine/test/gtest-gnc-int128.cpp
similarity index 100%
rename from src/libqof/qof/test/gtest-gnc-int128.cpp
rename to src/engine/test/gtest-gnc-int128.cpp
diff --git a/src/libqof/qof/test/gtest-gnc-numeric.cpp b/src/engine/test/gtest-gnc-numeric.cpp
similarity index 100%
rename from src/libqof/qof/test/gtest-gnc-numeric.cpp
rename to src/engine/test/gtest-gnc-numeric.cpp
diff --git a/src/libqof/qof/test/gtest-gnc-rational.cpp b/src/engine/test/gtest-gnc-rational.cpp
similarity index 100%
rename from src/libqof/qof/test/gtest-gnc-rational.cpp
rename to src/engine/test/gtest-gnc-rational.cpp
diff --git a/src/libqof/qof/test/gtest-gnc-timezone.cpp b/src/engine/test/gtest-gnc-timezone.cpp
similarity index 100%
rename from src/libqof/qof/test/gtest-gnc-timezone.cpp
rename to src/engine/test/gtest-gnc-timezone.cpp
diff --git a/src/engine/test/gtest-import-map.cpp b/src/engine/test/gtest-import-map.cpp
index b0a9b50..47746d6 100644
--- a/src/engine/test/gtest-import-map.cpp
+++ b/src/engine/test/gtest-import-map.cpp
@@ -28,7 +28,7 @@ extern "C"
 #include <qofinstance-p.h>
 }
 
-#include <kvp_frame.hpp>
+#include <kvp-frame.hpp>
 #include <gtest/gtest.h>
 
 class ImapTest : public testing::Test
diff --git a/src/libqof/qof/test/test-gnc-date.c b/src/engine/test/test-gnc-date.c
similarity index 99%
rename from src/libqof/qof/test/test-gnc-date.c
rename to src/engine/test/test-gnc-date.c
index e15fffc..fb93341 100644
--- a/src/libqof/qof/test/test-gnc-date.c
+++ b/src/engine/test/test-gnc-date.c
@@ -27,7 +27,7 @@ extern "C"
 #endif
 
 #include <config.h>
-#include "../../../platform.h"
+#include "../../platform.h"
 #include <string.h>
 #include <sys/time.h>
 #include <glib.h>
diff --git a/src/libqof/qof/test/test-gnc-guid-old.cpp b/src/engine/test/test-gnc-guid-old.cpp
similarity index 100%
rename from src/libqof/qof/test/test-gnc-guid-old.cpp
rename to src/engine/test/test-gnc-guid-old.cpp
diff --git a/src/libqof/qof/test/test-gnc-guid.cpp b/src/engine/test/test-gnc-guid.cpp
similarity index 100%
rename from src/libqof/qof/test/test-gnc-guid.cpp
rename to src/engine/test/test-gnc-guid.cpp
diff --git a/src/libqof/qof/test/test-kvp-frame.cpp b/src/engine/test/test-kvp-frame.cpp
similarity index 99%
rename from src/libqof/qof/test/test-kvp-frame.cpp
rename to src/engine/test/test-kvp-frame.cpp
index 92c68b8..3df1c75 100644
--- a/src/libqof/qof/test/test-kvp-frame.cpp
+++ b/src/engine/test/test-kvp-frame.cpp
@@ -24,7 +24,7 @@
 
 #include <guid.hpp>
 #include "../kvp-value.hpp"
-#include "../kvp_frame.hpp"
+#include "../kvp-frame.hpp"
 #include <gtest/gtest.h>
 #include <algorithm>
 
diff --git a/src/libqof/qof/test/test-kvp-value.cpp b/src/engine/test/test-kvp-value.cpp
similarity index 99%
rename from src/libqof/qof/test/test-kvp-value.cpp
rename to src/engine/test/test-kvp-value.cpp
index e8568d2..f564fe3 100644
--- a/src/libqof/qof/test/test-kvp-value.cpp
+++ b/src/engine/test/test-kvp-value.cpp
@@ -25,7 +25,7 @@
 #include <guid.hpp>
 #include "../kvp-value.hpp"
 #include "../guid.h"
-#include "../kvp_frame.hpp"
+#include "../kvp-frame.hpp"
 #include "../gnc-date.h"
 #include <memory>
 #include <gtest/gtest.h>
diff --git a/src/libqof/qof/test/test-numeric.cpp b/src/engine/test/test-numeric.cpp
similarity index 100%
rename from src/libqof/qof/test/test-numeric.cpp
rename to src/engine/test/test-numeric.cpp
diff --git a/src/libqof/qof/test/test-qof-string-cache.c b/src/engine/test/test-qof-string-cache.c
similarity index 100%
rename from src/libqof/qof/test/test-qof-string-cache.c
rename to src/engine/test/test-qof-string-cache.c
diff --git a/src/libqof/qof/test/test-qof.c b/src/engine/test/test-qof.c
similarity index 100%
rename from src/libqof/qof/test/test-qof.c
rename to src/engine/test/test-qof.c
diff --git a/src/libqof/qof/test/test-qofbackend.c b/src/engine/test/test-qofbackend.c
similarity index 100%
rename from src/libqof/qof/test/test-qofbackend.c
rename to src/engine/test/test-qofbackend.c
diff --git a/src/libqof/qof/test/test-qofbook.c b/src/engine/test/test-qofbook.c
similarity index 100%
rename from src/libqof/qof/test/test-qofbook.c
rename to src/engine/test/test-qofbook.c
diff --git a/src/libqof/qof/test/test-qofinstance.cpp b/src/engine/test/test-qofinstance.cpp
similarity index 99%
rename from src/libqof/qof/test/test-qofinstance.cpp
rename to src/engine/test/test-qofinstance.cpp
index 2758c10..7ed7d2d 100644
--- a/src/libqof/qof/test/test-qofinstance.cpp
+++ b/src/engine/test/test-qofinstance.cpp
@@ -29,7 +29,7 @@ extern "C"
 #include "../qof.h"
 }
 #include "../qof-backend.hpp"
-#include "../kvp_frame.hpp"
+#include "../kvp-frame.hpp"
 static const gchar *suitename = "/qof/qofinstance";
 extern "C" void test_suite_qofinstance ( void );
 static gchar* error_message;
@@ -49,10 +49,10 @@ static struct
 } commit_test;
 
 
-class MockBackend : public QofBackend
+class QofInstMockBackend : public QofBackend
 {
 public:
-    MockBackend() : m_qof_error{ERR_BACKEND_NO_ERR} {
+    QofInstMockBackend() : m_qof_error{ERR_BACKEND_NO_ERR} {
         commit_test.m_be = this;
     }
     void session_begin(QofSession* sess, const char* book_name,
@@ -503,7 +503,7 @@ test_instance_begin_edit( Fixture *fixture, gconstpointer pData )
     gboolean result;
 
     /* setup */
-    auto be = new MockBackend;
+    auto be = new QofInstMockBackend;
     g_assert( be );
     book = qof_book_new();
     g_assert( book );
@@ -598,7 +598,7 @@ test_instance_commit_edit_part2( Fixture *fixture, gconstpointer pData )
     gboolean result;
 
     /* setup */
-    auto be = new MockBackend;
+    auto be = new QofInstMockBackend;
     g_assert( be );
     book = qof_book_new();
     g_assert( book );
diff --git a/src/libqof/qof/test/test-qofobject.c b/src/engine/test/test-qofobject.c
similarity index 100%
rename from src/libqof/qof/test/test-qofobject.c
rename to src/engine/test/test-qofobject.c
diff --git a/src/libqof/qof/test/test-qofsession-old.cpp b/src/engine/test/test-qofsession-old.cpp
similarity index 100%
rename from src/libqof/qof/test/test-qofsession-old.cpp
rename to src/engine/test/test-qofsession-old.cpp
diff --git a/src/libqof/qof/test/test-qofsession.cpp b/src/engine/test/test-qofsession.cpp
similarity index 92%
rename from src/libqof/qof/test/test-qofsession.cpp
rename to src/engine/test/test-qofsession.cpp
index 863316d..8e64370 100644
--- a/src/libqof/qof/test/test-qofsession.cpp
+++ b/src/engine/test/test-qofsession.cpp
@@ -36,13 +36,13 @@ static bool load_error {true};
 static bool hook_called {false};
 static bool data_loaded {false};
 
-class MockBackend : public QofBackend
+class QofSessionMockBackend : public QofBackend
 {
 public:
-    MockBackend() = default;
-    MockBackend(const MockBackend&) = delete;
-    MockBackend(const MockBackend&&) = delete;
-    virtual ~MockBackend() = default;
+    QofSessionMockBackend() = default;
+    QofSessionMockBackend(const QofSessionMockBackend&) = delete;
+    QofSessionMockBackend(const QofSessionMockBackend&&) = delete;
+    virtual ~QofSessionMockBackend() = default;
     void session_begin(QofSession*, const char*, bool, bool, bool) {}
     void session_end() {}
     void load(QofBook*, QofBackendLoadType);
@@ -56,30 +56,30 @@ void example_hook (QofSession & session)
     hook_called = true;
 }
 
-void MockBackend::load (QofBook *, QofBackendLoadType)
+void QofSessionMockBackend::load (QofBook *, QofBackendLoadType)
 {
     if (load_error) set_error(ERR_BACKEND_NO_BACKEND);
     data_loaded = true;
 }
 
-void MockBackend::safe_sync (QofBook *)
+void QofSessionMockBackend::safe_sync (QofBook *)
 {
     safe_sync_called = true;
 }
 
-void MockBackend::sync (QofBook *)
+void QofSessionMockBackend::sync (QofBook *)
 {
     sync_called = true;
 }
 
-void MockBackend::export_coa(QofBook * book)
+void QofSessionMockBackend::export_coa(QofBook * book)
 {
     exported_book = book;
 }
 
 QofBackend * test_backend_factory ()
 {
-    return new MockBackend;
+    return new QofSessionMockBackend;
 }
 
 struct MockProvider : public QofBackendProvider
diff --git a/src/engine/test/utest-Account.cpp b/src/engine/test/utest-Account.cpp
index b499669..df075bb 100644
--- a/src/engine/test/utest-Account.cpp
+++ b/src/engine/test/utest-Account.cpp
@@ -42,7 +42,7 @@ static const gchar *suitename = "/engine/Account";
 void test_suite_account (void);
 }
 
-#include <kvp_frame.hpp>
+#include <kvp-frame.hpp>
 
 typedef struct
 {
diff --git a/src/engine/test/utest-Split.cpp b/src/engine/test/utest-Split.cpp
index a0e9ceb..42bf871 100644
--- a/src/engine/test/utest-Split.cpp
+++ b/src/engine/test/utest-Split.cpp
@@ -45,7 +45,7 @@ static const gchar *suitename = "/engine/Split";
 void test_suite_split ( void );
 }
 
-#include <kvp_frame.hpp>
+#include <kvp-frame.hpp>
 
 typedef struct
 {
diff --git a/src/engine/test/utest-Transaction.cpp b/src/engine/test/utest-Transaction.cpp
index 9b5f56d..4624593 100644
--- a/src/engine/test/utest-Transaction.cpp
+++ b/src/engine/test/utest-Transaction.cpp
@@ -45,7 +45,7 @@ void test_suite_transaction ( void );
 }
 
 #include <qof-backend.hpp>
-#include <kvp_frame.hpp>
+#include <kvp-frame.hpp>
 
 /* Copied from Transaction.c. Changing these values will break
  * existing databases, which is a good reason to fail a test.
@@ -81,10 +81,10 @@ typedef struct
     Account *gains_acc;
 } GainsFixture;
 
-class MockBackend : public QofBackend
+class TransMockBackend : public QofBackend
 {
 public:
-    MockBackend() : QofBackend(), m_last_call{"Constructor"},
+    TransMockBackend() : QofBackend(), m_last_call{"Constructor"},
                     m_result_err{ERR_BACKEND_NO_ERR} {}
     void session_begin(QofSession*, const char*, bool, bool, bool) override {
         m_last_call = "session_begin";
@@ -117,7 +117,7 @@ static void
 setup (Fixture *fixture, gconstpointer pData)
 {
     QofBook *book = qof_book_new ();
-    MockBackend *mbe = new MockBackend;
+    TransMockBackend *mbe = new TransMockBackend;
     Transaction *txn;
     Timespec entered = gnc_dmy2timespec (20, 4, 2012);
     Timespec posted = gnc_dmy2timespec (21, 4, 2012);
@@ -208,7 +208,7 @@ static void
 teardown (Fixture *fixture, gconstpointer pData)
 {
     QofBook *book = qof_instance_get_book (QOF_INSTANCE (fixture->txn));
-    auto mbe = static_cast<MockBackend*>(qof_book_get_backend (book));
+    auto mbe = static_cast<TransMockBackend*>(qof_book_get_backend (book));
 
     test_destroy (fixture->txn);
     test_destroy (fixture->acc1);
@@ -1692,7 +1692,7 @@ test_xaccTransRollbackEdit (Fixture *fixture, gconstpointer pData)
     KvpFrame *base_frame = NULL;
     auto sig_account = test_signal_new (QOF_INSTANCE (fixture->acc1),
                               GNC_EVENT_ITEM_CHANGED, NULL);
-    auto mbe = static_cast<MockBackend*>(qof_book_get_backend (book));
+    auto mbe = static_cast<TransMockBackend*>(qof_book_get_backend (book));
     auto split_00 = static_cast<Split*>(txn->splits->data);
     auto split_01 = static_cast<Split*>(txn->splits->next->data);
     auto split_02 = xaccMallocSplit (book);
@@ -1754,7 +1754,7 @@ test_xaccTransRollbackEdit (Fixture *fixture, gconstpointer pData)
 static void
 test_xaccTransRollbackEdit_BackendErrors (Fixture *fixture, gconstpointer pData)
 {
-    auto mbe = static_cast<MockBackend*>(qof_book_get_backend (qof_instance_get_book (fixture->txn)));
+    auto mbe = static_cast<TransMockBackend*>(qof_book_get_backend (qof_instance_get_book (fixture->txn)));
     auto loglevel = static_cast<GLogLevelFlags>(G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_FATAL);
     auto msg = "[xaccTransRollbackEdit()] Rollback Failed.  Ouch!";
     auto check = test_error_struct_new ("gnc.engine", loglevel, msg);
diff --git a/src/gnc-module/CMakeLists.txt b/src/gnc-module/CMakeLists.txt
index d1ded15..ce06e3e 100644
--- a/src/gnc-module/CMakeLists.txt
+++ b/src/gnc-module/CMakeLists.txt
@@ -2,7 +2,7 @@
 ADD_SUBDIRECTORY(test)
 
 IF (BUILDING_FROM_VCS)
-  # Command to generate the swig-engine.c wrapper file
+  # Command to generate the swig-gnc-module.c wrapper file
   SET (SWIG_GNC_MODULE_C ${CMAKE_CURRENT_BINARY_DIR}/swig-gnc-module.c)
   GNC_ADD_SWIG_COMMAND (swig-gnc-module-c ${SWIG_GNC_MODULE_C} ${CMAKE_CURRENT_SOURCE_DIR}/gnc-module.i)
 ELSE()
@@ -25,13 +25,16 @@ ADD_LIBRARY	(gnc-module
   ${SWIG_GNC_MODULE_C}
 )
 
-TARGET_LINK_LIBRARIES(gnc-module gnc-qof ${GUILE_LDFLAGS} ${GMODULE_LDFLAGS} ${GLIB2_LDFLAGS})
+TARGET_LINK_LIBRARIES(gnc-module ${GUILE_LDFLAGS} ${GMODULE_LDFLAGS} ${GLIB2_LDFLAGS})
 
 TARGET_COMPILE_DEFINITIONS (gnc-module PRIVATE -DG_LOG_DOMAIN=\"gnc.module\")
 
 TARGET_INCLUDE_DIRECTORIES (gnc-module
     PRIVATE ${GUILE_INCLUDE_DIRS}
     PUBLIC  ${CMAKE_CURRENT_SOURCE_DIR}
+            ${CMAKE_SOURCE_DIR}/src
+            ${CMAKE_BINARY_DIR}/src # for config.h
+            ${GLIB2_INCLUDE_DIRS}
 )
 
 INSTALL(TARGETS gnc-module
@@ -63,4 +66,4 @@ GNC_ADD_SCHEME_TARGETS(scm-gnc-module
 
 SET_LOCAL_DIST(gnc_module_DIST_local CMakeLists.txt Makefile.am ${gnc_module_SOURCES} ${gnc_module_HEADERS}
         gnc-module.i gnc-module.scm README)
-SET(gnc_module_DIST ${gnc_module_DIST_local} ${test_gnc_module_DIST} PARENT_SCOPE)
\ No newline at end of file
+SET(gnc_module_DIST ${gnc_module_DIST_local} ${test_gnc_module_DIST} PARENT_SCOPE)
diff --git a/src/gnc-module/Makefile.am b/src/gnc-module/Makefile.am
index 2a413f6..cecaed5 100644
--- a/src/gnc-module/Makefile.am
+++ b/src/gnc-module/Makefile.am
@@ -1,10 +1,11 @@
-SUBDIRS = . test
+# No SUBDIR variable here...
+# The 'test' subdir is added via src/Makefile to handle
+# it's dependency on src/engine
 
 AM_CPPFLAGS = \
    -I${top_srcdir}/lib/libc \
    -I${top_srcdir}/src \
    -I${top_srcdir}/src/core-utils \
-  -I${top_srcdir}/src/libqof/qof \
    ${GLIB_CFLAGS} \
    ${GUILE_CFLAGS}
 
@@ -15,7 +16,6 @@ libgnc_module_la_SOURCES = gnc-module.c swig-gnc-module.c
 libgnc_module_la_LIBADD = \
   ../core-utils/libgnc-core-utils.la \
   ${top_builddir}/lib/libc/libc-missing.la \
-  ${top_builddir}/src/libqof/qof/libgnc-qof.la \
   ${GLIB_LIBS} \
   ${GUILE_LIBS}
 
@@ -69,8 +69,7 @@ endif
 if GNC_HAVE_GUILE_2
 GUILE_COMPILE_ENV = \
   --library-dir    ${top_builddir}/src/gnc-module \
-  --library-dir    ${top_builddir}/src/core-utils \
-  --library-dir    ${top_builddir}/src/libqof/qof
+  --library-dir    ${top_builddir}/src/core-utils
 
 %.go : %.scm .scm-links $(lib_LTLIBRARIES)
 	GNC_UNINSTALLED=yes \
diff --git a/src/gnc-module/gnc-module.c b/src/gnc-module/gnc-module.c
index 7165e7b..a2221cd 100644
--- a/src/gnc-module/gnc-module.c
+++ b/src/gnc-module/gnc-module.c
@@ -35,10 +35,6 @@
 #endif
 
 #include "gnc-module.h"
-#include "libqof/qof/qof.h"
-
-/* This static indicates the debugging module that this .o belongs to.  */
-static QofLogModule log_module = "gnc.gui";
 
 static GHashTable * loaded_modules = NULL;
 static GList      * module_info = NULL;
@@ -455,7 +451,7 @@ gnc_module_load_common(const char * module_name, gint iface, gboolean optional)
     GModule         * gmodule;
     GNCModuleInfo   * modinfo;
 
-    ENTER("module_name: %s", module_name);
+    g_debug ("module_name: %s", module_name);
 
     if (!loaded_modules)
     {
@@ -477,25 +473,22 @@ gnc_module_load_common(const char * module_name, gint iface, gboolean optional)
             if (info->init_func(info->load_count))
             {
                 info->load_count++;
-                LEAVE("module %s already loaded", module_name);
+                g_debug ("module %s already loaded", module_name);
                 return info;
             }
             else
             {
                 g_warning ("module init failed: %s", module_name);
-                LEAVE("");
                 return NULL;
             }
         }
         else
         {
             g_warning ("module has no init func: %s", module_name);
-            LEAVE("");
             return NULL;
         }
         /* NOTREACHED */
         g_error("internal error");
-        LEAVE("");
         return NULL;
     }
 
@@ -512,7 +505,6 @@ gnc_module_load_common(const char * module_name, gint iface, gboolean optional)
             g_warning ("Could not locate module %s interface v.%d",
                        module_name, iface);
         }
-        LEAVE("");
         return NULL;
     }
 
@@ -544,11 +536,9 @@ gnc_module_load_common(const char * module_name, gint iface, gboolean optional)
                 g_free(info->filename);
                 g_free(info);
                 /* g_module_close(module); */
-                LEAVE("");
                 return NULL;
             }
 
-            LEAVE("");
             return info;
         }
         else
@@ -557,13 +547,11 @@ gnc_module_load_common(const char * module_name, gint iface, gboolean optional)
                        modinfo->module_filepath);
             //lt_dlclose(handle);
         }
-        LEAVE("");
         return info;
     }
 
     g_warning ("Failed to open module %s: %s\n", module_name, g_module_error());
 
-    LEAVE("");
     return NULL;
 }
 
diff --git a/src/gnc-module/test/CMakeLists.txt b/src/gnc-module/test/CMakeLists.txt
index 9053cfc..522f433 100644
--- a/src/gnc-module/test/CMakeLists.txt
+++ b/src/gnc-module/test/CMakeLists.txt
@@ -8,12 +8,11 @@ SET(GNC_MODULE_TEST_INCLUDE_DIRS
   ${CMAKE_BINARY_DIR}/src # for config.h
   ${CMAKE_SOURCE_DIR}/src/gnc-module
   ${CMAKE_SOURCE_DIR}/src/test-core
-  ${CMAKE_SOURCE_DIR}/src/libqof/qof # for qof.h
   ${GLIB2_INCLUDE_DIRS}
   ${GUILE_INCLUDE_DIRS}
 )
 
-SET(GNC_MODULE_TEST_LIBS gnc-module gnc-qof test-core)
+SET(GNC_MODULE_TEST_LIBS gnc-module test-core)
 
 MACRO(ADD_GNC_MODULE_TEST _TARGET _SOURCE_FILES)
   GNC_ADD_TEST(${_TARGET} "${_SOURCE_FILES}" GNC_MODULE_TEST_INCLUDE_DIRS GNC_MODULE_TEST_LIBS)
@@ -112,4 +111,4 @@ SET(test_gnc_module_EXTRA_DIST
 SET_LOCAL_DIST(test_gnc_module_DIST_local CMakeLists.txt Makefile.am README ${test_gnc_module_SOURCE_DIST} ${test_gnc_module_EXTRA_DIST})
 
 SET(test_gnc_module_DIST ${test_gnc_module_DIST_local} ${misc_mods_DIST}
-                         ${mod_bar_DIST} ${mod_baz_DIST} ${mod_foo_DIST} PARENT_SCOPE)
\ No newline at end of file
+                         ${mod_bar_DIST} ${mod_baz_DIST} ${mod_foo_DIST} PARENT_SCOPE)
diff --git a/src/gnc-module/test/Makefile.am b/src/gnc-module/test/Makefile.am
index 53edbff..d849762 100644
--- a/src/gnc-module/test/Makefile.am
+++ b/src/gnc-module/test/Makefile.am
@@ -2,14 +2,13 @@ SUBDIRS = mod-foo mod-bar mod-baz misc-mods
 
 LDADD = \
   ${top_builddir}/src/test-core/libtest-core.la \
-  ${top_builddir}/src/libqof/qof/libgnc-qof.la \
   ../libgnc-module.la ${GLIB_LIBS} ${GUILE_LIBS}
 
 AM_CPPFLAGS = \
   -I${top_srcdir}/src \
   -I${top_srcdir}/src/gnc-module \
-  -I${top_srcdir}/src/libqof/qof \
   -I${top_srcdir}/src/test-core \
+  -I${top_srcdir}/src/engine \
   ${GUILE_CFLAGS} \
   ${GLIB_CFLAGS}
 
@@ -38,7 +37,6 @@ GNC_TEST_DEPS = \
   --guile-load-dir ${top_srcdir}/src/gnc-module/test/mod-foo \
   --guile-load-dir ${top_srcdir}/src/gnc-module/test/mod-baz \
   --guile-load-dir ${top_srcdir}/src/gnc-module/test/mod-bar \
-  --library-dir    ${top_builddir}/src/libqof/qof \
   --library-dir    ${top_builddir}/src/core-utils \
   --library-dir    ${top_builddir}/src/test-core \
   --library-dir    ${top_builddir}/src/gnc-module \
diff --git a/src/gnc/CMakeLists.txt b/src/gnc/CMakeLists.txt
index 156d578..6ba10f5 100644
--- a/src/gnc/CMakeLists.txt
+++ b/src/gnc/CMakeLists.txt
@@ -83,7 +83,6 @@ INCLUDE_DIRECTORIES (${LIBINTL_INCLUDE_PATH})
 INCLUDE_DIRECTORIES (${REGEX_INCLUDE_PATH})
 INCLUDE_DIRECTORIES (${CMAKE_BINARY_DIR}/src ) # for config.h
 INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/src ) # for gnc-ui.h
-INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/src/libqof/qof) # for qof.h
 INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/src/gnc-module) # for gnc-glib-utils.h
 INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/src/core-utils) # for gnc-glib-utils.h
 INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/src/engine) # for gnc-glib-utils.h
@@ -115,7 +114,7 @@ IF (WITH_AQBANKING)
 #  TARGET_LINK_LIBRARIES (cutecash ${AQBANKING_LIBRARIES} ${GWENHYWFAR_LIBRARIES})
 ENDIF (WITH_AQBANKING)
 TARGET_LINK_LIBRARIES (cutecash libgncmod-gtkmm)
-TARGET_LINK_LIBRARIES (cutecash gncmod-engine gnc-module gnc-core-utils gnc-qof)
+TARGET_LINK_LIBRARIES (cutecash gncmod-engine gnc-module gnc-core-utils)
 
 TARGET_LINK_LIBRARIES (cutecash ${GUILE_LIBRARY} ${GUILE_LIBRARIES})
 TARGET_LINK_LIBRARIES (cutecash ${GLIBMM_LIBRARIES})
diff --git a/src/gnc/Doxyfile b/src/gnc/Doxyfile
index 0061e5d..c10806e 100644
--- a/src/gnc/Doxyfile
+++ b/src/gnc/Doxyfile
@@ -90,7 +90,6 @@ WARN_LOGFILE           =
 # configuration options related to the input files
 #---------------------------------------------------------------------------
 INPUT                  = . \
-    ../libqof/qof \
 	../core-utils \
 	../gnc-module \
 	../engine \
diff --git a/src/gnc/QofEventWrapper.hpp b/src/gnc/QofEventWrapper.hpp
index 10379fa..f21154d 100644
--- a/src/gnc/QofEventWrapper.hpp
+++ b/src/gnc/QofEventWrapper.hpp
@@ -25,7 +25,7 @@
 
 // gnucash includes
 #include "config.h" // required by qof/qofutil.h
-#include "libqof/qof/guid.hpp"
+#include "engine/guid.hpp"
 extern "C"
 {
 #include "qof.h"
diff --git a/src/gnc/Session.hpp b/src/gnc/Session.hpp
index 6e1650c..2d47628 100644
--- a/src/gnc/Session.hpp
+++ b/src/gnc/Session.hpp
@@ -26,7 +26,7 @@
 // gnucash includes
 #include "config.h" // required by qof/qofutil.h
 #include <glib/gi18n.h>
-#include "libqof/qof/guid.hpp"
+#include "engine/guid.hpp"
 extern "C"
 {
 #include "qof.h"
diff --git a/src/gnc/dashboard.hpp b/src/gnc/dashboard.hpp
index a4a88a7..233a571 100644
--- a/src/gnc/dashboard.hpp
+++ b/src/gnc/dashboard.hpp
@@ -23,7 +23,7 @@
 #define DASHBOARD_HPP
 
 #include "config.h"
-#include "libqof/qof/guid.hpp"
+#include "engine/guid.hpp"
 
 extern "C"
 {
diff --git a/src/gnc/fpo/ViewletModel.hpp b/src/gnc/fpo/ViewletModel.hpp
index 59b550c..7701715 100644
--- a/src/gnc/fpo/ViewletModel.hpp
+++ b/src/gnc/fpo/ViewletModel.hpp
@@ -5,7 +5,7 @@
 #include <QtGui>
 
 #include "config.h"
-#include "libqof/qof/guid.hpp"
+#include "engine/guid.hpp"
 
 extern "C"
 {
diff --git a/src/gnc/fpo/ViewletView.hpp b/src/gnc/fpo/ViewletView.hpp
index 173f6fa..6fd4f91 100644
--- a/src/gnc/fpo/ViewletView.hpp
+++ b/src/gnc/fpo/ViewletView.hpp
@@ -2,7 +2,7 @@
 #define VIEWLETVIEW_HPP
 
 #include "config.h"
-#include "libqof/qof/guid.hpp"
+#include "engine/guid.hpp"
 
 extern "C"
 {
diff --git a/src/gnc/main.cpp b/src/gnc/main.cpp
index dc0bce4..7aab5fd 100644
--- a/src/gnc/main.cpp
+++ b/src/gnc/main.cpp
@@ -29,7 +29,7 @@
 #include <glib/gi18n.h>
 #include <glib.h>
 #include <libguile.h>
-#include "libqof/qof/guid.hpp"
+#include "engine/guid.hpp"
 extern "C"
 {
 #include "gnc-module/gnc-module.h"
diff --git a/src/gnome-search/CMakeLists.txt b/src/gnome-search/CMakeLists.txt
index ffd53dd..c823388 100644
--- a/src/gnome-search/CMakeLists.txt
+++ b/src/gnome-search/CMakeLists.txt
@@ -46,7 +46,7 @@ ADD_LIBRARY (gncmod-gnome-search
     ${gnome_search_noinst_HEADERS}
 )
 
-TARGET_LINK_LIBRARIES(gncmod-gnome-search gnc-qof gncmod-gnome-utils ${GTK3_LDFLAGS})
+TARGET_LINK_LIBRARIES(gncmod-gnome-search gncmod-gnome-utils ${GTK3_LDFLAGS})
 
 TARGET_COMPILE_DEFINITIONS(gncmod-gnome-search PRIVATE -DG_LOG_DOMAIN=\"gnc.gui.search\")
 
diff --git a/src/gnome-search/Makefile.am b/src/gnome-search/Makefile.am
index 79e4bbc..8056c04 100644
--- a/src/gnome-search/Makefile.am
+++ b/src/gnome-search/Makefile.am
@@ -7,7 +7,6 @@ AM_CPPFLAGS = \
   -I${top_srcdir}/src/app-utils \
   -I${top_srcdir}/src/gnome-utils \
   -I${top_srcdir}/src/gnc-module \
-  -I${top_srcdir}/src/libqof/qof \
   ${GUILE_CFLAGS} \
   ${GTK_CFLAGS} \
   ${GLIB_CFLAGS}
@@ -51,7 +50,7 @@ libgncmod_gnome_search_la_LIBADD = \
   ${top_builddir}/src/app-utils/libgncmod-app-utils.la \
   ${top_builddir}/src/gnc-module/libgnc-module.la \
   ${top_builddir}/src/core-utils/libgnc-core-utils.la \
-  ${top_builddir}/src/libqof/qof/libgnc-qof.la \
+  ${top_builddir}/src/engine/libgncmod-engine.la \
   ${GUILE_LIBS} \
   ${GLIB_LIBS} \
   ${REGEX_LIBS}
diff --git a/src/gnome-utils/Makefile.am b/src/gnome-utils/Makefile.am
index b8becc9..c94e88b 100644
--- a/src/gnome-utils/Makefile.am
+++ b/src/gnome-utils/Makefile.am
@@ -14,13 +14,11 @@ AM_CPPFLAGS = \
   -I${top_builddir}/src \
   -I${top_builddir}/src/core-utils \
   -I${top_srcdir}/lib/libc \
-  -I${top_srcdir}/src/libqof/qof \
   ${GLIB_CFLAGS} \
   ${GTK_CFLAGS} \
   ${GNOME_KEYRING_CFLAGS} \
   ${LIBSECRET_CFLAGS} \
   ${GUILE_CFLAGS} \
-  ${QOF_CFLAGS} \
   ${LIBGDA_CFLAGS} \
   ${LIBXML2_CFLAGS} \
   ${GTK_MAC_CFLAGS}
@@ -201,7 +199,6 @@ libgncmod_gnome_utils_la_LIBADD = \
   ${top_builddir}/src/backend/xml/libgnc-backend-xml-utils.la \
   ${top_builddir}/src/app-utils/libgncmod-app-utils.la \
   $(top_builddir)/lib/libc/libc-missing.la \
-  ${top_builddir}/src/libqof/qof/libgnc-qof.la \
   ${GTK_LIBS} \
   ${GNOME_KEYRING_LIBS} \
   ${LIBSECRET_LIBS} \
@@ -280,7 +277,6 @@ GUILE_COMPILE_ENV = \
   --guile-load-dir ${top_builddir}/src/gnc-module \
   --guile-load-dir ${top_builddir}/src/scm \
   --library-dir    ${top_builddir}/src/engine \
-  --library-dir    ${top_builddir}/src/libqof/qof \
   --library-dir    ${top_builddir}/src/core-utils \
   --library-dir    ${top_builddir}/src/gnc-module \
   --library-dir    ${top_builddir}/src/app-utils \
diff --git a/src/gnome-utils/test/CMakeLists.txt b/src/gnome-utils/test/CMakeLists.txt
index 42611bc..4244d10 100644
--- a/src/gnome-utils/test/CMakeLists.txt
+++ b/src/gnome-utils/test/CMakeLists.txt
@@ -16,7 +16,6 @@ SET(GNOME_UTILS_GUI_TEST_INCLUDE_DIRS
   ${CMAKE_BINARY_DIR}/src
   ${CMAKE_SOURCE_DIR}/src/gnome-utils
   ${CMAKE_SOURCE_DIR}/src/engine
-  ${CMAKE_SOURCE_DIR}/src/libqof/qof # for qof.h
   ${GTK3_INCLUDE_DIRS}
 )
 SET(GNOME_UTILS_GUI_TEST_LIBS
diff --git a/src/gnome-utils/test/Makefile.am b/src/gnome-utils/test/Makefile.am
index 34c0856..d7a34c3 100644
--- a/src/gnome-utils/test/Makefile.am
+++ b/src/gnome-utils/test/Makefile.am
@@ -18,7 +18,6 @@ GNC_TEST_DEPS = --gnc-module-dir ${top_builddir}/src/engine \
   --guile-load-dir ${top_builddir}/src/app-utils \
   --guile-load-dir ${top_builddir}/src/gnome-utils \
   --library-dir    ${top_builddir}/src/gnome-utils \
-  --library-dir    ${top_builddir}/src/libqof/qof \
   --library-dir    ${top_builddir}/src/core-utils \
   --library-dir    ${top_builddir}/src/gnc-module \
   --library-dir    ${top_builddir}/src/engine \
@@ -45,7 +44,6 @@ AM_CPPFLAGS = \
   -I${top_srcdir}/src/gnc-module \
   -I${top_srcdir}/src/app-utils \
   -I${top_srcdir}/src/test-core \
-  -I${top_srcdir}/src/libqof/qof \
   ${GLIB_CFLAGS} \
   ${GTK_CFLAGS} \
   ${GUILE_CFLAGS}
diff --git a/src/gnome/Makefile.am b/src/gnome/Makefile.am
index 48bb953..1aa5de1 100644
--- a/src/gnome/Makefile.am
+++ b/src/gnome/Makefile.am
@@ -15,12 +15,10 @@ libgnc_gnome_la_LIBADD = \
   ${top_builddir}/src/html/libgncmod-html.la \
   ${top_builddir}/src/engine/libgncmod-engine.la \
   ${top_builddir}/src/core-utils/libgnc-core-utils.la \
-  ${top_builddir}/src/libqof/qof/libgnc-qof.la \
   ${LIBXML2_LIBS} \
   ${GUILE_LIBS} \
   ${GTK_LIBS} \
-  ${GLIB_LIBS} \
-  ${QOF_LIBS}
+  ${GLIB_LIBS}
 
 libgnc_gnome_la_SOURCES = \
   swig-gnome.c \
@@ -186,7 +184,6 @@ AM_CPPFLAGS = \
   -I${top_srcdir}/src/report/report-system \
   -I${top_srcdir}/src/report/report-gnome \
   -I${top_srcdir}/lib/libc \
-  -I${top_srcdir}/src/libqof/qof \
   ${LIBXML2_CFLAGS} \
   ${GUILE_CFLAGS} \
   ${GTK_CFLAGS} \
diff --git a/src/html/CMakeLists.txt b/src/html/CMakeLists.txt
index f2aec95..eecbc96 100644
--- a/src/html/CMakeLists.txt
+++ b/src/html/CMakeLists.txt
@@ -39,7 +39,7 @@ ADD_LIBRARY (gncmod-html
   ${html_HEADERS}
 )
 
-TARGET_LINK_LIBRARIES(gncmod-html gnc-qof gnc-module gncmod-gnome-utils ${WEBKIT_LDFLAGS} ${GUILE_LDFLAGS})
+TARGET_LINK_LIBRARIES(gncmod-html gncmod-engine gnc-module gncmod-gnome-utils ${WEBKIT_LDFLAGS} ${GUILE_LDFLAGS})
 
 TARGET_COMPILE_DEFINITIONS(gncmod-html PRIVATE -DG_LOG_DOMAIN=\"gnc.html\")
 
diff --git a/src/html/Makefile.am b/src/html/Makefile.am
index 98a7695..2826b43 100644
--- a/src/html/Makefile.am
+++ b/src/html/Makefile.am
@@ -12,7 +12,6 @@ AM_CPPFLAGS = \
   -I${top_srcdir}/src \
   -I${top_builddir}/src \
   -I${top_srcdir}/lib/libc \
-  ${QOF_CFLAGS} \
   ${GLIB_CFLAGS} \
   ${GUILE_CFLAGS} \
   ${GTK_CFLAGS} \
@@ -50,7 +49,6 @@ libgncmod_html_la_LIBADD = \
   ${GTK_LIBS} \
   ${GLIB_LIBS} \
   ${DB_LIBS} \
-  ${QOF_LIBS} \
   ${GUILE_LIBS} \
   ${REGEX_LIBS}
 
diff --git a/src/import-export/Makefile.am b/src/import-export/Makefile.am
index 1adfdf6..b276d0a 100644
--- a/src/import-export/Makefile.am
+++ b/src/import-export/Makefile.am
@@ -44,7 +44,6 @@ libgncmod_generic_import_la_LIBADD = \
   ${top_builddir}/src/engine/libgncmod-engine.la \
   ${top_builddir}/src/core-utils/libgnc-core-utils.la \
   ${top_builddir}/src/gnc-module/libgnc-module.la \
-  ${top_builddir}/src/libqof/qof/libgnc-qof.la \
   ${REGEX_LIBS} \
   ${GLIB_LIBS}
 
@@ -59,7 +58,6 @@ AM_CPPFLAGS = \
   -I${top_srcdir}/src/app-utils \
   -I${top_srcdir}/src/gnome \
   -I${top_srcdir}/src/gnome-utils \
-  -I${top_srcdir}/src/libqof/qof \
   ${GTK_CFLAGS} \
   ${GLIB_CFLAGS}
 
diff --git a/src/import-export/aqb/CMakeLists.txt b/src/import-export/aqb/CMakeLists.txt
index 30fffec..1355444 100644
--- a/src/import-export/aqb/CMakeLists.txt
+++ b/src/import-export/aqb/CMakeLists.txt
@@ -57,7 +57,7 @@ IF(WITH_AQBANKING)
   TARGET_LINK_LIBRARIES(gncmod-aqbanking gnc-gnome gncmod-gnome-utils
          gncmod-generic-import gncmod-register-core
          gncmod-register-gnome gncmod-ledger-core gncmod-engine
-         gnc-qof ${AQB_EXPORT_SYMBOLS} ${AQBANKING_LDFLAGS}
+         ${AQB_EXPORT_SYMBOLS} ${AQBANKING_LDFLAGS}
          ${GWENHYWFAR_LDFLAGS} ${GWENGUI_GTK2_LDFLAGS}
          ${GNOME_LDFLAGS} ${KTOBLZCHECK_LDFLAGS} ${AQB_LIBSTDCXX})
 
diff --git a/src/import-export/aqb/Makefile.am b/src/import-export/aqb/Makefile.am
index e006c26..7ee956a 100644
--- a/src/import-export/aqb/Makefile.am
+++ b/src/import-export/aqb/Makefile.am
@@ -41,7 +41,6 @@ libgncmod_aqbanking_la_LIBADD = \
   ${top_builddir}/src/engine/libgncmod-engine.la \
   ${top_builddir}/src/core-utils/libgnc-core-utils.la \
   ${top_builddir}/src/gnc-module/libgnc-module.la \
-  ${top_builddir}/src/libqof/qof/libgnc-qof.la \
   ${GTK_LIBS} \
   ${GLIB_LIBS} \
   ${GWENGUI_GTK2_LIBS} \
@@ -59,7 +58,6 @@ AM_CPPFLAGS = \
   -I${top_srcdir}/src/engine \
   -I${top_srcdir}/src/core-utils \
   -I${top_srcdir}/src/gnc-module \
-  -I${top_srcdir}/src/libqof/qof \
   ${GTK_CFLAGS} \
   ${GLIB_CFLAGS} \
   ${AQBANKING_CFLAGS}
diff --git a/src/import-export/aqb/test/CMakeLists.txt b/src/import-export/aqb/test/CMakeLists.txt
index cf2be91..2fd2379 100644
--- a/src/import-export/aqb/test/CMakeLists.txt
+++ b/src/import-export/aqb/test/CMakeLists.txt
@@ -14,7 +14,6 @@ set(test_aqb_INCLUDE_DIRS
   ${CMAKE_SOURCE_DIR}/src/engine
   ${CMAKE_SOURCE_DIR}/src/core-utils
   ${CMAKE_SOURCE_DIR}/src/gnc-module
-  ${CMAKE_SOURCE_DIR}/src/libqof/qof
   ${GLIB2_INCLUDE_DIRS}
   ${GTK_INCLUDE_DIRS}
   ${AQBANKING_INCLUDE_DIRS}
@@ -24,7 +23,7 @@ set(test_aqb_LIBS
   gncmod-aqbanking gncmod-generic-import gnc-gnome gncmod-gnome-utils
   gncmod-ledger-core gncmod-report-gnome gncmod-app-utils
   gncmod-backend-xml-utils gncmod-engine gnc-core-utils gnc-module
-  gnc-qof ${GLIB2_LDFLAGS}
+  ${GLIB2_LDFLAGS}
 )
 
 SET_DIST_LIST(test_aqb_DIST ${test_aqb_SOURCES} file-book.gnucash
diff --git a/src/import-export/aqb/test/Makefile.am b/src/import-export/aqb/test/Makefile.am
index b08eef5..be4a096 100644
--- a/src/import-export/aqb/test/Makefile.am
+++ b/src/import-export/aqb/test/Makefile.am
@@ -40,7 +40,6 @@ test_aqb_LDADD = \
   ${top_builddir}/src/engine/libgncmod-engine.la \
   ${top_builddir}/src/core-utils/libgnc-core-utils.la \
   ${top_builddir}/src/gnc-module/libgnc-module.la \
-  ${top_builddir}/src/libqof/qof/libgnc-qof.la \
   ${GLIB_LIBS}
 
 test_aqb_CFLAGS = \
@@ -58,7 +57,6 @@ test_aqb_CFLAGS = \
   -I${top_srcdir}/src/engine \
   -I${top_srcdir}/src/core-utils \
   -I${top_srcdir}/src/gnc-module \
-  -I${top_srcdir}/src/libqof/qof \
   ${GTK_CFLAGS} \
   ${GLIB_CFLAGS} \
   ${AQBANKING_CFLAGS}
diff --git a/src/import-export/csv-exp/Makefile.am b/src/import-export/csv-exp/Makefile.am
index 86c142a..b3177da 100644
--- a/src/import-export/csv-exp/Makefile.am
+++ b/src/import-export/csv-exp/Makefile.am
@@ -26,7 +26,6 @@ libgncmod_csv_export_la_LIBADD = \
   ${top_builddir}/src/core-utils/libgnc-core-utils.la \
   ${top_builddir}/src/gnc-module/libgnc-module.la \
   ${top_builddir}/lib/libc/libc-missing.la \
-  ${top_builddir}/src/libqof/qof/libgnc-qof.la \
   ${GTK_LIBS} \
   ${GLIB_LIBS}
 
@@ -42,7 +41,6 @@ AM_CPPFLAGS = \
   -I${top_srcdir}/src/register/register-core \
   -I${top_srcdir}/src/register/register-gnome \
   -I${top_srcdir}/src/import-export \
-  -I${top_srcdir}/src/libqof/qof \
   -I${top_srcdir}/lib/libc \
   -I${top_srcdir}/lib \
   ${GUILE_CFLAGS} \
diff --git a/src/import-export/csv-imp/Makefile.am b/src/import-export/csv-imp/Makefile.am
index 74d0160..d57ccbd 100644
--- a/src/import-export/csv-imp/Makefile.am
+++ b/src/import-export/csv-imp/Makefile.am
@@ -44,7 +44,6 @@ libgncmod_csv_import_la_LIBADD = \
   ${top_builddir}/src/gnc-module/libgnc-module.la \
   ${top_builddir}/lib/goffice/libgnc-goffice.la \
   ${top_builddir}/lib/libc/libc-missing.la \
-  ${top_builddir}/src/libqof/qof/libgnc-qof.la \
   ${GLIB_LIBS} \
   ${GTK_LIBS} \
   ${ICU4C_I18N_LIBS} \
@@ -61,7 +60,6 @@ AM_CPPFLAGS = \
   -I${top_srcdir}/src/gnome \
   -I${top_srcdir}/src/gnome-utils \
   -I${top_srcdir}/src/import-export \
-  -I${top_srcdir}/src/libqof/qof \
   -I${top_srcdir}/lib/libc \
   -I${top_srcdir}/lib/goffice \
   -I${top_srcdir}/lib \
diff --git a/src/import-export/csv-imp/test/CMakeLists.txt b/src/import-export/csv-imp/test/CMakeLists.txt
index 5fd8cea..66bd440 100644
--- a/src/import-export/csv-imp/test/CMakeLists.txt
+++ b/src/import-export/csv-imp/test/CMakeLists.txt
@@ -4,11 +4,10 @@ SET(CSV_IMP_TEST_INCLUDE_DIRS
   ${CMAKE_SOURCE_DIR}/src
   ${CMAKE_SOURCE_DIR}/src/engine
   ${CMAKE_SOURCE_DIR}/src/test-core
-  ${CMAKE_SOURCE_DIR}/src/libqof/qof
   ${CMAKE_SOURCE_DIR}/lib
   ${GLIB2_INCLUDE_DIRS}
 )
-SET(CSV_IMP_TEST_LIBS gncmod-csv-import gncmod-engine gnc-qof test-core)
+SET(CSV_IMP_TEST_LIBS gncmod-csv-import gncmod-engine test-core)
 
 # This test does not run in Win32
 IF (NOT WIN32)
diff --git a/src/import-export/csv-imp/test/Makefile.am b/src/import-export/csv-imp/test/Makefile.am
index f0055f4..8ae7d61 100644
--- a/src/import-export/csv-imp/test/Makefile.am
+++ b/src/import-export/csv-imp/test/Makefile.am
@@ -48,7 +48,6 @@ IMP_TEST_CPPFLAGS =  \
   -I${top_srcdir}/src/engine \
   -I${top_srcdir}/src/core-utils \
   -I${top_srcdir}/src/gnc-module \
-  -I${top_srcdir}/src/libqof/qof \
   -I${top_srcdir}/lib/libc \
   -I${top_srcdir}/lib \
   ${GTK_CFLAGS} \
@@ -77,7 +76,6 @@ IMP_TEST_LDFLAGS = \
   ${top_builddir}/src/engine/libgncmod-engine.la \
   ${top_builddir}/src/core-utils/libgnc-core-utils.la \
   ${top_builddir}/src/gnc-module/libgnc-module.la \
-  ${top_builddir}/src/libqof/qof/libgnc-qof.la \
   ${GLIB_LIBS} \
   $(BOOST_LDFLAGS)
 
@@ -105,8 +103,7 @@ GNC_TEST_DEPS = \
 --library-dir    ${top_builddir}/src/backend/xml \
 --library-dir    ${top_builddir}/src/engine \
 --library-dir    ${top_builddir}/src/core-utils \
---library-dir    ${top_builddir}/src/gnc-module \
---library-dir    ${top_builddir}/src/libqof/qof
+--library-dir    ${top_builddir}/src/gnc-module
 
 TESTS_ENVIRONMENT = \
   SRCDIR=${srcdir} \
diff --git a/src/import-export/log-replay/CMakeLists.txt b/src/import-export/log-replay/CMakeLists.txt
index 412d99d..b7ad96d 100644
--- a/src/import-export/log-replay/CMakeLists.txt
+++ b/src/import-export/log-replay/CMakeLists.txt
@@ -16,7 +16,7 @@ SET(log_replay_noinst_HEADERS
 ADD_LIBRARY(gncmod-log-replay ${log_replay_SOURCES} ${log_replay_noinst_HEADERS})
 
 TARGET_LINK_LIBRARIES(gncmod-log-replay gncmod-gnome-utils gncmod-app-utils gncmod-engine
-     gnc-core-utils gnc-module gnc-qof ${GTK3_LDFLAGS})
+     gnc-core-utils gnc-module ${GTK3_LDFLAGS})
 
 TARGET_COMPILE_DEFINITIONS(gncmod-log-replay PRIVATE -DG_LOG_DOMAIN=\"gnc.import.log-replay\")
 
diff --git a/src/import-export/log-replay/Makefile.am b/src/import-export/log-replay/Makefile.am
index 0be39fc..048b7eb 100644
--- a/src/import-export/log-replay/Makefile.am
+++ b/src/import-export/log-replay/Makefile.am
@@ -19,10 +19,8 @@ libgncmod_log_replay_la_LIBADD = \
   ${top_builddir}/src/engine/libgncmod-engine.la \
   ${top_builddir}/src/core-utils/libgnc-core-utils.la \
   ${top_builddir}/src/gnc-module/libgnc-module.la \
-  ${top_builddir}/src/libqof/qof/libgnc-qof.la \
   ${GTK_LIBS} \
-  ${GLIB_LIBS} \
-  ${QOF_LIBS}
+  ${GLIB_LIBS}
 
 AM_CPPFLAGS = \
   -I${top_srcdir}/src \
@@ -33,7 +31,6 @@ AM_CPPFLAGS = \
   -I${top_srcdir}/src/gnome \
   -I${top_srcdir}/src/gnome-utils \
   -I${top_srcdir}/src/import-export \
-  -I${top_srcdir}/src/libqof/qof \
   ${GTK_CFLAGS} \
   ${GLIB_CFLAGS}
 
diff --git a/src/import-export/ofx/CMakeLists.txt b/src/import-export/ofx/CMakeLists.txt
index e35ba49..7a88499 100644
--- a/src/import-export/ofx/CMakeLists.txt
+++ b/src/import-export/ofx/CMakeLists.txt
@@ -23,7 +23,7 @@ IF (WITH_OFX)
   ADD_LIBRARY(gncmod-ofx ${ofx_SOURCES} ${ofx_noinst_HEADERS})
 
   TARGET_LINK_LIBRARIES(gncmod-ofx gncmod-generic-import gncmod-engine gncmod-app-utils gnc-core-utils
-                    gncmod-gnome-utils gnc-qof ${LIBOFX_LDFLAGS})
+                    gncmod-gnome-utils ${LIBOFX_LDFLAGS})
 
   TARGET_COMPILE_DEFINITIONS(gncmod-ofx PRIVATE -DG_LOG_DOMAIN=\"gnc.import.ofx\")
 
diff --git a/src/import-export/ofx/Makefile.am b/src/import-export/ofx/Makefile.am
index 59fad5c..8a6533e 100644
--- a/src/import-export/ofx/Makefile.am
+++ b/src/import-export/ofx/Makefile.am
@@ -22,7 +22,6 @@ libgncmod_ofx_la_LIBADD = \
   ${top_builddir}/src/engine/libgncmod-engine.la \
   ${top_builddir}/src/core-utils/libgnc-core-utils.la \
   ${top_builddir}/src/gnc-module/libgnc-module.la \
-  ${top_builddir}/src/libqof/qof/libgnc-qof.la \
   ${GLIB_LIBS} \
   ${LIBOFX_LIBS}
 
@@ -35,7 +34,6 @@ AM_CPPFLAGS = \
   -I${top_srcdir}/src/gnome \
   -I${top_srcdir}/src/gnome-utils \
   -I${top_srcdir}/src/import-export \
-  -I${top_srcdir}/src/libqof/qof \
   ${GTK_CFLAGS} \
   ${GLIB_CFLAGS} \
   ${LIBOFX_CFLAGS} 
diff --git a/src/import-export/ofx/test/Makefile.am b/src/import-export/ofx/test/Makefile.am
index 54cc321..0306c97 100644
--- a/src/import-export/ofx/test/Makefile.am
+++ b/src/import-export/ofx/test/Makefile.am
@@ -5,9 +5,9 @@ check_PROGRAMS=test-link
 
 test_link_SOURCES=test-link.c
 test_link_LDADD=\
-	$(top_builddir)/src/libqof/qof/libgnc-qof.la \
-        $(top_builddir)/src/app-utils/libgncmod-app-utils.la \
+	$(top_builddir)/src/engine/libgncmod-engine.la \
+	$(top_builddir)/src/app-utils/libgncmod-app-utils.la \
 	${top_builddir}/src/gnome-utils/libgncmod-gnome-utils.la \
-    ../libgncmod-ofx.la 
+	../libgncmod-ofx.la
 
 EXTRA_DIST = CMakeLists.txt
diff --git a/src/import-export/qif-imp/Makefile.am b/src/import-export/qif-imp/Makefile.am
index 790b39d..96b29c0 100644
--- a/src/import-export/qif-imp/Makefile.am
+++ b/src/import-export/qif-imp/Makefile.am
@@ -23,7 +23,6 @@ libgncmod_qif_import_la_LIBADD = \
   ${top_builddir}/src/core-utils/libgnc-core-utils.la \
   ${top_builddir}/src/engine/libgncmod-engine.la \
   ${top_builddir}/src/gnc-module/libgnc-module.la \
-  ${top_builddir}/src/libqof/qof/libgnc-qof.la \
   ${GUILE_LIBS} \
   ${GLIB_LIBS}
 
@@ -59,7 +58,6 @@ AM_CPPFLAGS = \
   -I${top_srcdir}/src/gnome \
   -I${top_srcdir}/src/gnome-utils \
   -I${top_srcdir}/src/import-export \
-  -I${top_srcdir}/src/libqof/qof \
   ${GUILE_CFLAGS} \
   ${GLIB_CFLAGS} \
   ${GTK_CFLAGS}
@@ -106,7 +104,6 @@ GUILE_COMPILE_ENV = \
   --guile-load-dir ${top_builddir}/src/gnc-module \
   --guile-load-dir ${top_builddir}/src/scm \
   --library-dir    ${top_builddir}/src/engine \
-  --library-dir    ${top_builddir}/src/libqof/qof \
   --library-dir    ${top_builddir}/src/core-utils \
   --library-dir    ${top_builddir}/src/app-utils \
   --library-dir    ${top_builddir}/src/gnome \
diff --git a/src/import-export/qif-imp/test/Makefile.am b/src/import-export/qif-imp/test/Makefile.am
index 38db806..202b6cb 100644
--- a/src/import-export/qif-imp/test/Makefile.am
+++ b/src/import-export/qif-imp/test/Makefile.am
@@ -7,7 +7,6 @@ test_link_SOURCES = \
 
 test_link_LDADD=../libgncmod-qif-import.la \
   ${top_builddir}/src/register/ledger-core/libgncmod-ledger-core.la \
-  ${top_builddir}/src/libqof/qof/libgnc-qof.la \
   ${top_builddir}/src/core-utils/libgnc-core-utils.la \
   ${top_builddir}/src/gnome/libgnc-gnome.la \
   ${top_builddir}/src/engine/libgncmod-engine.la \
diff --git a/src/import-export/qif/CMakeLists.txt b/src/import-export/qif/CMakeLists.txt
index 0178673..7a2047a 100644
--- a/src/import-export/qif/CMakeLists.txt
+++ b/src/import-export/qif/CMakeLists.txt
@@ -25,7 +25,7 @@ SET(qif_noinst_HEADERS
 
 ADD_LIBRARY(gncmod-qif ${qif_noinst_HEADERS} ${qif_SOURCES})
 
-TARGET_LINK_LIBRARIES(gncmod-qif gncmod-generic-import gncmod-engine gnc-qof ${GLIB2_LDFLAGS})
+TARGET_LINK_LIBRARIES(gncmod-qif gncmod-generic-import gncmod-engine ${GLIB2_LDFLAGS})
 
 TARGET_COMPILE_DEFINITIONS(gncmod-qif PRIVATE -DG_LOG_DOMAIN=\"gnc.import.qif\")
 
@@ -36,4 +36,4 @@ INSTALL(TARGETS gncmod-qif
 # No headers to install.
 
 SET_LOCAL_DIST(qif_DIST_local CMakeLists.txt Makefile.am ${qif_SOURCES} ${qif_noinst_HEADERS})
-SET(qif_DIST ${qif_DIST_local} ${test_qif_DIST} PARENT_SCOPE)
\ No newline at end of file
+SET(qif_DIST ${qif_DIST_local} ${test_qif_DIST} PARENT_SCOPE)
diff --git a/src/import-export/qif/Makefile.am b/src/import-export/qif/Makefile.am
index cff9cde..88c7280 100644
--- a/src/import-export/qif/Makefile.am
+++ b/src/import-export/qif/Makefile.am
@@ -22,7 +22,6 @@ noinst_HEADERS = \
 libgncmod_qif_la_LIBADD = \
   ${top_builddir}/src/import-export/libgncmod-generic-import.la \
   ${top_builddir}/src/engine/libgncmod-engine.la \
-  ${top_builddir}/src/libqof/qof/libgnc-qof.la \
   ${REGEX_LIBS} \
   ${GLIB_LIBS}
 
@@ -32,7 +31,6 @@ AM_CPPFLAGS = \
   -I${top_srcdir}/src/gnc-module \
   -I${top_srcdir}/src/app-utils \
   -I${top_srcdir}/src/import-export \
-  -I${top_srcdir}/src/libqof/qof \
   ${GLIB_CFLAGS} \
   ${GUILE_CFLAGS}
 
diff --git a/src/import-export/qif/test/CMakeLists.txt b/src/import-export/qif/test/CMakeLists.txt
index b5c2d48..eb4d2b4 100644
--- a/src/import-export/qif/test/CMakeLists.txt
+++ b/src/import-export/qif/test/CMakeLists.txt
@@ -2,7 +2,7 @@
 SET(QIF_TEST_INCLUDE_DIRS
   ${CMAKE_BINARY_DIR}/src
   ${CMAKE_SOURCE_DIR}/src/import-export/qif
-  ${CMAKE_SOURCE_DIR}/src/libqof/qof
+  ${CMAKE_SOURCE_DIR}/src/engine
   ${CMAKE_SOURCE_DIR}/src/test-core
   ${GLIB2_INCLUDE_DIRS}
 )
diff --git a/src/import-export/qif/test/Makefile.am b/src/import-export/qif/test/Makefile.am
index 7110425..befbc4a 100644
--- a/src/import-export/qif/test/Makefile.am
+++ b/src/import-export/qif/test/Makefile.am
@@ -6,7 +6,6 @@ AM_CPPFLAGS = \
   -I${top_srcdir}/src/app-utils \
   -I${top_srcdir}/src/import-export \
   -I${top_srcdir}/src/import-export/qif \
-  -I${top_srcdir}/src/libqof/qof \
   ${GUILE_CFLAGS} \
   ${GLIB_CFLAGS}
 
@@ -15,7 +14,6 @@ LDADD = \
   ${top_builddir}/src/test-core/libtest-core.la \
   ../../libgncmod-generic-import.la \
   ../libgncmod-qif.la \
-  ${top_builddir}/src/libqof/qof/libgnc-qof.la \
   ${GLIB_LIBS}
 
 TESTS = \
diff --git a/src/import-export/test/CMakeLists.txt b/src/import-export/test/CMakeLists.txt
index a81cdf3..12a9ade 100644
--- a/src/import-export/test/CMakeLists.txt
+++ b/src/import-export/test/CMakeLists.txt
@@ -4,14 +4,14 @@ SET(GENERIC_IMPORT_TEST_INCLUDE_DIRS
   ${CMAKE_BINARY_DIR}/src # for config.h
   ${CMAKE_SOURCE_DIR}/src/gnc-module
   ${CMAKE_SOURCE_DIR}/src/import-export
-  ${CMAKE_SOURCE_DIR}/src/libqof/qof
   ${CMAKE_SOURCE_DIR}/src/test-core
+  ${CMAKE_SOURCE_DIR}/src/engine
   ${CMAKE_SOURCE_DIR}/src/engine/test-core
   ${GLIB2_INCLUDE_DIRS}
   ${GUILE_INCLUDE_DIRS}
 )
 
-SET(GENERIC_IMPORT_TEST_LIBS gncmod-generic-import gncmod-test-engine gnc-qof test-core)
+SET(GENERIC_IMPORT_TEST_LIBS gncmod-generic-import gncmod-test-engine test-core)
 
 GNC_ADD_TEST_WITH_GUILE(test-import-parse test-import-parse.c
   GENERIC_IMPORT_TEST_INCLUDE_DIRS GENERIC_IMPORT_TEST_LIBS
diff --git a/src/import-export/test/Makefile.am b/src/import-export/test/Makefile.am
index 1d32295..196731e 100644
--- a/src/import-export/test/Makefile.am
+++ b/src/import-export/test/Makefile.am
@@ -7,14 +7,12 @@ AM_CPPFLAGS = \
   -I${top_srcdir}/src/engine \
   -I${top_srcdir}/src/app-utils \
   -I${top_srcdir}/src/import-export \
-  -I${top_srcdir}/src/libqof/qof \
   -I${top_srcdir}/src/engine/test-core \
   ${GTK_CFLAGS} \
   ${GUILE_CFLAGS} \
   ${GLIB_CFLAGS}
 
 LDADD = \
-  ${top_builddir}/src/libqof/qof/libgnc-qof.la \
   ${top_builddir}/src/core-utils/libgnc-core-utils.la \
   ${top_builddir}/src/gnc-module/libgnc-module.la \
   ${top_builddir}/src/test-core/libtest-core.la \
@@ -40,7 +38,6 @@ GNC_TEST_DEPS = --gnc-module-dir ${top_builddir}/src/engine \
   --guile-load-dir ${top_builddir}/src/app-utils \
   --guile-load-dir ${top_builddir}/src/gnome-utils \
 \
-  --library-dir    ${top_builddir}/src/libqof/qof \
   --library-dir    ${top_builddir}/src/core-utils \
   --library-dir    ${top_builddir}/src/app-utils \
   --library-dir    ${top_builddir}/src/gnome-utils \
@@ -65,7 +62,6 @@ noinst_PROGRAMS = $(TEST_PROGS) $(check_PROGRAMS)
 test_import_pending_matches_SOURCES = test-import-pending-matches.c
 
 test_import_pending_matches_LDADD = \
-  ${top_builddir}/src/libqof/qof/libgnc-qof.la \
   ${top_builddir}/src/engine/libgncmod-engine.la \
   ../libgncmod-generic-import.la \
   ${top_builddir}/src/engine/test-core/libgncmod-test-engine.la \
diff --git a/src/libqof/CMakeLists.txt b/src/libqof/CMakeLists.txt
deleted file mode 100644
index fdb7748..0000000
--- a/src/libqof/CMakeLists.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-# CMakeLists.txt for src/libqof
-
-ADD_SUBDIRECTORY(qof)
-
-SET_LOCAL_DIST(libqof_DIST_local CMakeLists.txt Makefile.am)
-SET(libqof_DIST ${libqof_DIST_local} ${qof_DIST} PARENT_SCOPE)
diff --git a/src/libqof/Makefile.am b/src/libqof/Makefile.am
deleted file mode 100644
index 3a35153..0000000
--- a/src/libqof/Makefile.am
+++ /dev/null
@@ -1,3 +0,0 @@
-SUBDIRS = . qof
-
-EXTRA_DIST = CMakeLists.txt
diff --git a/src/libqof/qof/CMakeLists.txt b/src/libqof/qof/CMakeLists.txt
deleted file mode 100644
index 0ef2525..0000000
--- a/src/libqof/qof/CMakeLists.txt
+++ /dev/null
@@ -1,129 +0,0 @@
-# CMakeLists.txt for src/libqof
-
-ADD_SUBDIRECTORY(test)
-
-SET (gnc_qof_HEADERS
-   gnc-aqbanking-templates.h
-   gnc-date-p.h
-   gnc-date.h
-   gnc-datetime.hpp
-   gnc-timezone.hpp
-   gnc-numeric.h
-   gnc-numeric.hpp
-   gnc-rational.hpp
-   gnc-rational-rounding.hpp
-   guid.h
-   kvp_frame.hpp
-   kvp-value.hpp
-   qof.h
-   qof-backend.hpp
-   qofbackend.h
-   qofbook.h
-   qofbookslots.h
-   qofchoice.h
-   qofclass.h
-   qofevent.h
-   qofid-p.h
-   qofid.h
-   qofinstance-p.h
-   qofinstance.h
-   qoflog.h
-   qofobject.h
-   qofquery.h
-   qofquerycore.h
-   qofsession.h
-   qofutil.h
-   qof-gobject.h
-   qof-string-cache.h
-)
-SET (gnc_qof_noinst_HEADERS
-   gnc-backend-prov.hpp
-   qofbook-p.h
-   qofclass-p.h
-   gnc-date-p.h
-   qofevent-p.h
-   gnc-int128.hpp
-   qofobject-p.h
-   qofquery-p.h
-   qofquerycore-p.h
-   qofsession.hpp
-)
-
-SET (gnc_qof_SOURCES
-  gnc-aqbanking-templates.cpp
-  gnc-date.cpp
-  gnc-datetime.cpp
-  gnc-int128.cpp
-  gnc-numeric.cpp
-  gnc-rational.cpp
-  gnc-datetime.cpp
-  gnc-timezone.cpp
-  guid.cpp
-  kvp_frame.cpp
-  kvp-value.cpp
-  qof-backend.cpp
-  qofbook.cpp
-  qofchoice.cpp
-  qofclass.cpp
-  qofevent.cpp
-  qofid.cpp
-  qofinstance.cpp
-  qoflog.cpp
-  qofobject.cpp
-  qofquery.cpp
-  qofquerycore.cpp
-  qofsession.cpp
-  qofutil.cpp
-  qof-string-cache.cpp
-)
-
-IF (WIN32)
-  ADD_DEFINITIONS (-DOS_WIN32)
-  SET (gnc_qof_SOURCES ${gnc_qof_SOURCES}
-   qof-win32.cpp
-	../../../lib/libc/strptime.c
-  )
-ENDIF (WIN32)
-
-# Add dependency on config.h
-SET_SOURCE_FILES_PROPERTIES (${gnc_qof_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
-
-
-ADD_LIBRARY(gnc-qof
-  ${gnc_qof_SOURCES}
-  ${gnc_qof_HEADERS}
-  ${gnc_qof_noinst_HEADERS}
-)
-
-TARGET_LINK_LIBRARIES(gnc-qof ${Boost_DATE_TIME_LIBRARIES}  ${Boost_REGEX_LIBRARIES} ${REGEX_LDFLAGS} ${GMODULE_LDFLAGS} ${GLIB2_LDFLAGS} ${GOBJECT_LDFLAGS})
-
-TARGET_COMPILE_DEFINITIONS (gnc-qof PRIVATE -DG_LOG_DOMAIN=\"qof\")
-
-TARGET_INCLUDE_DIRECTORIES (gnc-qof PUBLIC
-  ${CMAKE_BINARY_DIR}/src # for config.h
-  ${CMAKE_SOURCE_DIR}/src # for platform.h
-  ${CMAKE_CURRENT_SOURCE_DIR}/qof
-  ${GLIB2_INCLUDE_DIRS}
-  ${LIBINTL_INCLUDE_PATH}
-  ${REGEX_INCLUDE_PATH}
-  ${CMAKE_SOURCE_DIR}/lib/libc # for strptime.h
-)
-
-INSTALL(TARGETS gnc-qof
-  LIBRARY DESTINATION lib
-  ARCHIVE DESTINATION lib
-  RUNTIME DESTINATION bin)
-INSTALL(FILES ${gnc_qof_HEADERS} DESTINATION include/gnucash)
-
-SET(qof_test_HEADERS
-    kvp_frame.hpp
-    qofbook.h
-    qofinstance.h
-    qofobject.h
-    qofsession.h
-)
-
-INSTALL(FILES ${qof_test_HEADERS} DESTINATION libexec/gnucash/src/libqof/qof/test)
-SET_LOCAL_DIST(qof_DIST_local CMakeLists.txt Makefile.am ${gnc_qof_EXTRA_DIST}
-  ${gnc_qof_HEADERS} ${gnc_qof_noinst_HEADERS} ${gnc_qof_SOURCES} qof-win32.cpp)
-SET(qof_DIST ${qof_DIST_local} ${test_qof_DIST} PARENT_SCOPE) 
diff --git a/src/libqof/qof/Makefile.am b/src/libqof/qof/Makefile.am
deleted file mode 100644
index 418fe93..0000000
--- a/src/libqof/qof/Makefile.am
+++ /dev/null
@@ -1,107 +0,0 @@
-include $(top_srcdir)/test-templates/Makefile.decl
-SUBDIRS = . test
-TEST_SUBDIRS = test
-
-lib_LTLIBRARIES = libgnc-qof.la
-
-libgnc_qof_la_LDFLAGS= \
-	-version-info \
-	$(LIBQOF_LIBRARY_VERSION)
-
-libgnc_qof_common_libs =  \
-  $(GLIB_LIBS) \
-  $(REGEX_LIBS) \
-  ${BOOST_LDFLAGS} -lboost_regex \
-  $(top_builddir)/lib/libc/libc-missing.la
-
-libgnc_qof_la_LIBADD = $(libgnc_qof_common_libs)
-
-AM_CPPFLAGS = \
-  -I$(top_srcdir)/lib/libc \
-  -I$(top_srcdir)/src \
-  $(GLIB_CFLAGS) \
-  $(BOOST_CPPFLAGS)
-
-libgnc_qof_la_SOURCES =  \
-   gnc-aqbanking-templates.cpp \
-   gnc-date.cpp        \
-   gnc-int128.cpp      \
-   gnc-numeric.cpp     \
-   gnc-rational.cpp    \
-   gnc-timezone.cpp    \
-   gnc-datetime.cpp    \
-   guid.cpp            \
-   kvp_frame.cpp       \
-   kvp-value.cpp       \
-   qof-backend.cpp      \
-   qofbook.cpp         \
-   qofchoice.cpp       \
-   qofclass.cpp        \
-   qofevent.cpp        \
-   qofid.cpp           \
-   qofinstance.cpp     \
-   qoflog.cpp          \
-   qofobject.cpp       \
-   qofquery.cpp        \
-   qofquerycore.cpp    \
-   qofsession.cpp      \
-   qof-string-cache.cpp  \
-   qofutil.cpp
-
-qofincludedir = ${pkgincludedir}
-
-qofinclude_HEADERS = \
-   gnc-aqbanking-templates.h \
-   gnc-date-p.h      \
-   gnc-date.h        \
-   gnc-numeric.h     \
-   gnc-numeric.hpp   \
-   gnc-rational.hpp  \
-   gnc-rational-rounding.hpp \
-   gnc-timezone.hpp  \
-   gnc-datetime.hpp  \
-   guid.h            \
-   kvp_frame.hpp     \
-   kvp-value.hpp     \
-   qof.h             \
-   qof-backend.hpp   \
-   qofbackend.h      \
-   qofbook.h         \
-   qofbookslots.h    \
-   qofchoice.h       \
-   qofclass.h        \
-   qofevent.h        \
-   qofid-p.h         \
-   qofid.h           \
-   qofinstance-p.h   \
-   qofinstance.h     \
-   qoflog.h          \
-   qofobject.h       \
-   qofquery.h        \
-   qofquerycore.h    \
-   qofsession.h      \
-   qofsession.hpp    \
-   qof-string-cache.h  \
-   qofutil.h         \
-   qof-gobject.h
-
-noinst_HEADERS = \
-   gnc-backend-prov.hpp \
-   qofbook-p.h  \
-   qofclass-p.h  \
-   qofevent-p.h \
-   gnc-int128.hpp  \
-   qofobject-p.h  \
-   qofquery-p.h  \
-   qofquerycore-p.h
-
-EXTRA_DIST += \
-  CMakeLists.txt
-
-if OS_WIN32
-libgnc_qof_la_SOURCES += qof-win32.cpp
-else
-EXTRA_DIST += qof-win32.cpp
-endif
-
-AM_CPPFLAGS += -DG_LOG_DOMAIN=\"qof\"
diff --git a/src/libqof/qof/test/CMakeLists.txt b/src/libqof/qof/test/CMakeLists.txt
deleted file mode 100644
index 356b532..0000000
--- a/src/libqof/qof/test/CMakeLists.txt
+++ /dev/null
@@ -1,145 +0,0 @@
-SET(TEST_QOF_INCLUDE_DIRS
-  ${CMAKE_BINARY_DIR}/src # for config.h
-  ${CMAKE_SOURCE_DIR}/src/test-core  # for unittest-support.h
-  ${CMAKE_SOURCE_DIR}/src/libqof/qof # for qof.h
-  ${GLIB2_INCLUDE_DIRS}
-)
-
-SET(TEST_QOF_LIBS
-  gnc-qof test-core ${GLIB2_LDFLAGS} -lm
-)
-
-SET(test_qof_SOURCES
-  test-gnc-date.c
-  test-qof.c
-  test-qofbook.c
-  test-qofinstance.cpp
-  test-qofobject.c
-  test-qof-string-cache.c
-)
-
-SET(TEST_ENGINE_INCLUDE_DIRS
-  ${TEST_QOF_INCLUDE_DIRS}
-  ${CMAKE_SOURCE_DIR}/src/engine
-  ${CMAKE_SOURCE_DIR}/src/engine/test-core
-  ${CMAKE_BINARY_DIR}/src # for config.h
-  )
-
-SET(TEST_ENGINE_LIBS
-  ${TEST_QOF_LIBS}
-  gncmod-test-engine
-  )
-
-SET(test_numeric_SOURCES
-  ${CMAKE_SOURCE_DIR}/src/engine/cashobjects.c
-  ${CMAKE_SOURCE_DIR}/src/engine/test-core/test-engine-stuff.cpp
-  ${CMAKE_SOURCE_DIR}/src/libqof/qof/gnc-numeric.cpp
-  ${CMAKE_SOURCE_DIR}/src/libqof/qof/gnc-rational.cpp
-  ${CMAKE_SOURCE_DIR}/src/libqof/qof/gnc-int128.cpp
-  ${CMAKE_SOURCE_DIR}/src/libqof/qof/test/test-numeric.cpp
-)
-
-
-GNC_ADD_TEST(test-numeric "${test_numeric_SOURCES}" TEST_ENGINE_INCLUDE_DIRS TEST_ENGINE_LIBS)
-
-# This test does not on Win32. Worse, it causes a dialog box to
-# pop up due to an assertion. This interferes with running the tests
-# unattended.
-IF (NOT WIN32)
-  SET(SOURCES ${test_qof_SOURCES} ${CMAKE_SOURCE_DIR}/src/test-core/unittest-support.c)
-  GNC_ADD_TEST(test-qof "${SOURCES}"
-          TEST_QOF_INCLUDE_DIRS TEST_QOF_LIBS)
-  TARGET_COMPILE_DEFINITIONS(test-qof PRIVATE TESTPROG=test_qof)
-  SET(MODULEPATH ${CMAKE_SOURCE_DIR}/src/libqof/qof)
-  SET(gtest_old_qof_LIBS gnc-qof ${GLIB2_LDFLAGS} ${Boost_LIBRARIES} ${GTEST_LIB})
-  SET(gtest_qof_LIBS
-    ${GLIB2_LDFLAGS}
-    ${GOBJECT_LDFLAGS}
-    ${GMODULE_LDFLAGS}
-    ${GTHREAD_LDFLAGS}
-    ${Boost_LIBRARIES}
-    ${GTEST_LIB})
-  SET(gtest_qof_INCLUDES
-    ${MODULEPATH}
-    ${CMAKE_BINARY_DIR}/src # for config.h
-    ${CMAKE_SOURCE_DIR}/src # for platform.h
-    ${GLIB2_INCLUDE_DIRS}
-    ${GTEST_INCLUDE_DIR})
-
-  SET(test_gnc_guid_SOURCES
-    ${MODULEPATH}/guid.cpp
-    test-gnc-guid.cpp
-    ${GTEST_SRC})
-  GNC_ADD_TEST(test-gnc-guid "${test_gnc_guid_SOURCES}"
-    gtest_qof_INCLUDES gtest_old_qof_LIBS)
-
-  SET(test_kvp_value_SOURCES
-    ${MODULEPATH}/kvp-value.cpp
-    test-kvp-value.cpp
-    test-kvp-frame.cpp
-    ${GTEST_SRC})
-  GNC_ADD_TEST(test-kvp-value "${test_kvp_value_SOURCES}"
-    gtest_qof_INCLUDES gtest_old_qof_LIBS)
-
-  SET(test_qofsession_SOURCES
-    ${MODULEPATH}/qofsession.cpp
-    test-qofsession.cpp
-    ${GTEST_SRC})
-  GNC_ADD_TEST(test-qofsession "${test_qofsession_SOURCES}"
-    gtest_qof_INCLUDES gtest_old_qof_LIBS)
-
-  SET(test_gnc_int128_SOURCES
-    ${MODULEPATH}/gnc-int128.cpp
-    gtest-gnc-int128.cpp
-    ${GTEST_SRC})
-  GNC_ADD_TEST(test-gnc-int128 "${test_gnc_int128_SOURCES}"
-    gtest_qof_INCLUDES gtest_qof_LIBS)
-
-  SET(test_gnc_rational_SOURCES
-    ${MODULEPATH}/gnc-rational.cpp
-    ${MODULEPATH}/gnc-numeric.cpp
-    ${MODULEPATH}/gnc-int128.cpp
-    ${MODULEPATH}/gnc-datetime.cpp
-    ${MODULEPATH}/gnc-timezone.cpp
-    ${MODULEPATH}/gnc-date.cpp
-    ${MODULEPATH}/qoflog.cpp
-    gtest-gnc-rational.cpp
-    ${GTEST_SRC})
-  GNC_ADD_TEST(test-gnc-rational "${test_gnc_rational_SOURCES}"
-    gtest_qof_INCLUDES gtest_qof_LIBS)
-
-  SET(test_gnc_numeric_SOURCES
-    ${MODULEPATH}/gnc-rational.cpp
-    ${MODULEPATH}/gnc-int128.cpp
-    ${MODULEPATH}/gnc-numeric.cpp
-    ${MODULEPATH}/gnc-datetime.cpp
-    ${MODULEPATH}/gnc-timezone.cpp
-    ${MODULEPATH}/gnc-date.cpp
-    ${MODULEPATH}/qoflog.cpp
-    gtest-gnc-numeric.cpp
-    ${GTEST_SRC})
-  GNC_ADD_TEST(test-gnc-numeric "${test_gnc_numeric_SOURCES}"
-    gtest_qof_INCLUDES gtest_qof_LIBS)
-
-  SET(test_gnc_timezone_SOURCES
-    ${MODULEPATH}/gnc-timezone.cpp
-    gtest-gnc-timezone.cpp
-    ${GTEST_SRC})
-  GNC_ADD_TEST(test-gnc-timezone "${test_gnc_timezone_SOURCES}"
-    gtest_qof_INCLUDES gtest_old_qof_LIBS)
-
-  SET(test_gnc_datetime_SOURCES
-    ${MODULEPATH}/gnc-datetime.cpp
-    ${MODULEPATH}/gnc-timezone.cpp
-    ${MODULEPATH}/gnc-date.cpp
-    ${MODULEPATH}/qoflog.cpp
-    gtest-gnc-datetime.cpp
-    ${GTEST_SRC})
-  GNC_ADD_TEST(test-gnc-datetime "${test_gnc_datetime_SOURCES}"
-    gtest_qof_INCLUDES gtest_qof_LIBS)
-ENDIF()
-
-SET_DIST_LIST(test_qof_DIST CMakeLists.txt Makefile.am ${test_qof_SOURCES}
-  test-numeric.cpp test-gnc-guid.cpp test-kvp-value.cpp test-kvp-frame.cpp
-  test-qofsession.cpp gtest-gnc-int128.cpp gtest-gnc-rational.cpp
-  gtest-gnc-numeric.cpp gtest-gnc-timezone.cpp gtest-gnc-datetime.cpp)
diff --git a/src/libqof/qof/test/Makefile.am b/src/libqof/qof/test/Makefile.am
deleted file mode 100644
index 304fc6f..0000000
--- a/src/libqof/qof/test/Makefile.am
+++ /dev/null
@@ -1,252 +0,0 @@
-# A template Makefile.am for GLib g_test-based test directories.
-# Copyright 2011 John Ralls <jralls at ceridwen.us>
-
-include $(top_srcdir)/test-templates/Makefile.decl
-
-
-#You will only need one of these: It points to the module directory
-#after $(top_srcdir) or $(top_builddir):
-MODULEPATH = src/libqof/qof
-
-test_qof_SOURCES = \
-        test-gnc-date.c \
-        test-qof.c \
-        test-qofbook.c \
-        test-qofinstance.cpp \
-        test-qofobject.c \
-        test-qof-string-cache.c \
-        ${top_srcdir}/src/test-core/unittest-support.c
-
-test_qof_HEADERS = \
-        $(top_srcdir)/${MODULEPATH}/qofbook.h \
-        $(top_srcdir)/${MODULEPATH}/qofinstance.h \
-        $(top_srcdir)/${MODULEPATH}/kvp_frame.hpp \
-        $(top_srcdir)/${MODULEPATH}/qofobject.h \
-        $(top_srcdir)/${MODULEPATH}/qofsession.h \
-        $(top_srcdir)/src/test-core/unittest-support.h
-
-test_numeric_SOURCES = \
-        ${top_srcdir}/src/engine/cashobjects.c \
-        ${top_srcdir}/src/test-core/test-stuff.c \
-        ${top_srcdir}/src/engine/test-core/test-engine-stuff.cpp \
-        ${top_srcdir}/${MODULEPATH}/gnc-numeric.cpp \
-        ${top_srcdir}/${MODULEPATH}/gnc-rational.cpp \
-        ${top_srcdir}/${MODULEPATH}/gnc-int128.cpp \
-        ${top_srcdir}/${MODULEPATH}/test/test-numeric.cpp
-
-test_numeric_CPPFLAGS = \
-       -I${top_srcdir}/src/engine \
-       -I${top_srcdir}/src/test-core \
-       -I${top_srcdir}/src/engine/test-core \
-       -I${top_srcdir}/src \
-       -I${top_srcdir}/${MODULEPATH} \
-       ${BOOST_CPPFLAGS} \
-       ${GLIB_CFLAGS}
-
-test_numeric_LDADD = \
-      ${top_builddir}/src/engine/libgncmod-engine.la \
-      ${top_builddir}/${MODULEPATH}/libgnc-qof.la \
-      ${BOOST_LDFLAGS} -lboost_regex \
-      ${GLIB_LIBS}
-
-check_PROGRAMS = \
-  test-numeric \
-  test-qof
-
-TESTS = ${check_PROGRAMS}
-
-test_gnc_guid_SOURCES = \
-        $(top_srcdir)/$(MODULEPATH)/guid.cpp \
-        test-gnc-guid.cpp
-test_gnc_guid_LDADD = \
-        $(top_builddir)/$(MODULEPATH)/libgnc-qof.la \
-        $(GLIB_LIBS) \
-        $(GTEST_LIBS) \
-        $(BOOST_LDFLAGS)
-if !GOOGLE_TEST_LIBS
-nodist_test_gnc_guid_SOURCES = \
-        ${GTEST_SRC}/src/gtest_main.cc
-endif
-
-test_gnc_guid_CPPFLAGS = \
-    -I$(GTEST_HEADERS) \
-    -I$(top_srcdir)/$(MODULEPATH) \
-    $(GLIB_CFLAGS) \
-    $(BOOST_CPPFLAGS)
-
-check_PROGRAMS += test-gnc-guid
-
-test_kvp_value_SOURCES = \
-    $(top_srcdir)/$(MODULEPATH)/kvp-value.cpp \
-    test-kvp-value.cpp \
-    test-kvp-frame.cpp
-test_kvp_value_LDADD = \
-        $(top_builddir)/$(MODULEPATH)/libgnc-qof.la \
-        $(GLIB_LIBS) \
-        $(GTEST_LIBS) \
-        $(BOOST_LDFLAGS)
-
-if !GOOGLE_TEST_LIBS
-nodist_test_kvp_value_SOURCES = \
-        ${GTEST_SRC}/src/gtest_main.cc
-endif
-
-test_kvp_value_CPPFLAGS = \
-    -I$(GTEST_HEADERS) \
-    -I$(top_srcdir)/$(MODULEPATH) \
-    $(GLIB_CFLAGS) \
-    $(BOOST_CPPFLAGS)
-
-check_PROGRAMS += test-kvp-value
-
-test_qofsession_SOURCES = \
-        $(top_srcdir)/$(MODULEPATH)/qofsession.cpp \
-        test-qofsession.cpp
-test_qofsession_LDADD = \
-        $(top_builddir)/$(MODULEPATH)/libgnc-qof.la \
-        $(GLIB_LIBS) \
-        $(GTEST_LIBS) \
-        $(BOOST_LDFLAGS) -lboost_regex
-
-if !GOOGLE_TEST_LIBS
-nodist_test_qofsession_SOURCES = \
-        ${GTEST_SRC}/src/gtest_main.cc
-endif
-
-test_qofsession_CPPFLAGS = \
-        -I$(GTEST_HEADERS) \
-        -I$(top_srcdir)/$(MODULEPATH) \
-        $(GLIB_CFLAGS) \
-        $(BOOST_CPPFLAGS)
-
-check_PROGRAMS += test-qofsession
-
-test_gnc_int128_SOURCES = \
-        $(top_srcdir)/${MODULEPATH}/gnc-int128.cpp \
-        gtest-gnc-int128.cpp
-test_gnc_int128_CPPFLAGS = -I${GTEST_HEADERS}
-
-test_gnc_int128_LDADD = ${GTEST_LIBS}
-if !GOOGLE_TEST_LIBS
-nodist_test_gnc_int128_SOURCES = \
-        ${GTEST_SRC}/src/gtest_main.cc
-endif
-check_PROGRAMS += test-gnc-int128
-
-test_gnc_rational_SOURCES = \
-        $(top_srcdir)/${MODULEPATH}/gnc-rational.cpp \
-        $(top_srcdir)/${MODULEPATH}/gnc-numeric.cpp \
-        $(top_srcdir)/${MODULEPATH}/gnc-int128.cpp \
-        $(top_srcdir)/$(MODULEPATH)/gnc-datetime.cpp \
-        $(top_srcdir)/$(MODULEPATH)/gnc-timezone.cpp \
-        $(top_srcdir)/$(MODULEPATH)/gnc-date.cpp \
-        $(top_srcdir)/${MODULEPATH}/qoflog.cpp \
-        gtest-gnc-rational.cpp
-
-test_gnc_rational_CPPFLAGS = \
-        -I${top_srcdir}/src \
-        -I${top_srcdir}/src/libqof/qof \
-        -I${GTEST_HEADERS} \
-        ${BOOST_CPPFLAGS} \
-        ${GLIB_CFLAGS}
-
-test_gnc_rational_LDADD = \
-        ${GTEST_LIBS} \
-        ${BOOST_LDFLAGS} -lboost_regex \
-        ${GLIB_LIBS}
-
-if !GOOGLE_TEST_LIBS
-nodist_test_gnc_rational_SOURCES = \
-        ${GTEST_SRC}/src/gtest_main.cc
-endif
-check_PROGRAMS += test-gnc-rational
-check_PROGRAMS += test-gnc-int128
-
-test_gnc_numeric_SOURCES = \
-        $(top_srcdir)/${MODULEPATH}/gnc-rational.cpp \
-        $(top_srcdir)/${MODULEPATH}/gnc-int128.cpp \
-        $(top_srcdir)/${MODULEPATH}/gnc-numeric.cpp \
-        $(top_srcdir)/$(MODULEPATH)/gnc-datetime.cpp \
-        $(top_srcdir)/$(MODULEPATH)/gnc-timezone.cpp \
-        $(top_srcdir)/$(MODULEPATH)/gnc-date.cpp \
-        $(top_srcdir)/${MODULEPATH}/qoflog.cpp \
-        gtest-gnc-numeric.cpp
-test_gnc_numeric_CPPFLAGS = \
-        -I${top_srcdir}/src \
-        -I${top_srcdir}/src/libqof/qof \
-        -I${GTEST_HEADERS} \
-        ${BOOST_CPPFLAGS} \
-        ${GLIB_CFLAGS}
-
-test_gnc_numeric_LDADD = \
-        ${GTEST_LIBS} \
-        ${BOOST_LDFLAGS} -lboost_regex \
-        ${GLIB_LIBS}
-if !GOOGLE_TEST_LIBS
-nodist_test_gnc_numeric_SOURCES = \
-        ${GTEST_SRC}/src/gtest_main.cc
-endif
-check_PROGRAMS += test-gnc-numeric
-
-test_gnc_timezone_SOURCES = \
-        $(top_srcdir)/${MODULEPATH}/gnc-timezone.cpp \
-        gtest-gnc-timezone.cpp
-
-test_gnc_timezone_CPPFLAGS = \
-        -I${GTEST_HEADERS} \
-        -I$(top_srcdir)/$(MODULEPATH) \
-        -I${top_srcdir}/src \
-        $(GLIB_CFLAGS) \
-        $(BOOST_CPPFLAGS)
-
-test_gnc_timezone_LDADD = \
-        ${top_builddir}/${MODULEPATH}/libgnc-qof.la \
-        $(GLIB_LIBS) \
-        $(GTEST_LIBS)
-if !GOOGLE_TEST_LIBS
-nodist_test_gnc_timezone_SOURCES = \
-        ${GTEST_SRC}/src/gtest_main.cc
-endif
-check_PROGRAMS += test-gnc-timezone
-
-test_gnc_datetime_SOURCES = \
-        $(top_srcdir)/$(MODULEPATH)/gnc-datetime.cpp \
-        $(top_srcdir)/$(MODULEPATH)/gnc-timezone.cpp \
-        $(top_srcdir)/$(MODULEPATH)/gnc-date.cpp \
-        $(top_srcdir)/${MODULEPATH}/qoflog.cpp \
-        gtest-gnc-datetime.cpp
-test_gnc_datetime_CPPFLAGS =\
-        -I$(GTEST_HEADERS) \
-        -I$(top_srcdir)/$(MODULEPATH) \
-        -I$(top_srcdir)/src \
-        $(GLIB_CFLAGS) \
-        $(BOOST_CPPFLAGS)
-
-test_gnc_datetime_LDADD = \
-        $(GLIB_LIBS) \
-        $(GTEST_LIBS) \
-        ${BOOST_LDFLAGS} -lboost_regex -lboost_date_time
-if !GOOGLE_TEST_LIBS
-nodist_test_gnc_datetime_SOURCES = \
-        $(GTEST_SRC)/src/gtest_main.cc
-endif
-check_PROGRAMS += test-gnc-datetime
-
-
-test_qofdir = ${GNC_LIBEXECDIR}/${MODULEPATH}/test
-
-#The tests might require more libraries, but try to keep them
-#as independent as possible.
-test_qof_LDADD = \
-        ${top_builddir}/${MODULEPATH}/libgnc-qof.la \
-        $(GLIB_LIBS)
-
-test_qof_CPPFLAGS = \
-        ${DEFAULT_INCLUDES} \
-        -I$(top_srcdir)/${MODULEPATH} \
-        -I$(top_srcdir)/src/test-core \
-        -DTESTPROG=test_qof \
-        -I$(top_srcdir)/lib/libc \
-        ${GLIB_CFLAGS}
-
-EXTRA_DIST += CMakeLists.txt
diff --git a/src/optional/gtkmm/CMakeLists.txt b/src/optional/gtkmm/CMakeLists.txt
index b3a3958..ad777a0 100644
--- a/src/optional/gtkmm/CMakeLists.txt
+++ b/src/optional/gtkmm/CMakeLists.txt
@@ -12,7 +12,6 @@ INCLUDE_DIRECTORIES (${REGEX_INCLUDE_PATH})
 INCLUDE_DIRECTORIES (${GUILE_INCLUDE_DIRS})
 INCLUDE_DIRECTORIES (${CMAKE_BINARY_DIR}/src ) # for config.h
 INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/src ) # for gnc-ui.h
-INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/src/libqof/qof) # for qof.h
 INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/src/gnc-module) # for gnc-glib-utils.h
 INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/src/core-utils) # for gnc-glib-utils.h
 INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/src/engine) # for gnc-glib-utils.h
diff --git a/src/optional/gtkmm/Makefile.am b/src/optional/gtkmm/Makefile.am
index f0757a3..7b4be86 100644
--- a/src/optional/gtkmm/Makefile.am
+++ b/src/optional/gtkmm/Makefile.am
@@ -40,13 +40,11 @@ libgncmod_gtkmm_la_LIBADD = \
   ${top_builddir}/src/engine/libgncmod-engine.la \
   ${top_builddir}/src/core-utils/libgnc-core-utils.la \
   ${top_builddir}/src/gnc-module/libgnc-module.la \
-  ${top_builddir}/src/libqof/qof/libgnc-qof.la \
   ${GTKMM_LIBS} \
   ${GLIB_LIBS}
 
 AM_CPPFLAGS = \
   -I${top_srcdir}/src \
-  -I${top_srcdir}/src/libqof/qof \
   -I${top_srcdir}/src/gnc-module \
   -I${top_srcdir}/src/core-utils \
   -I${top_srcdir}/src/engine \
diff --git a/src/optional/gtkmm/gncmm/Account.hpp b/src/optional/gtkmm/gncmm/Account.hpp
index efd53f1..5761882 100644
--- a/src/optional/gtkmm/gncmm/Account.hpp
+++ b/src/optional/gtkmm/gncmm/Account.hpp
@@ -24,7 +24,7 @@
 #define GNC_ACCOUNT_HPP
 
 // gnucash includes
-#include "libqof/qof/guid.hpp"
+#include "engine/guid.hpp"
 extern "C"
 {
 #include "qof.h"
diff --git a/src/optional/gtkmm/gncmm/Book.hpp b/src/optional/gtkmm/gncmm/Book.hpp
index 41ad8b7..2795166 100644
--- a/src/optional/gtkmm/gncmm/Book.hpp
+++ b/src/optional/gtkmm/gncmm/Book.hpp
@@ -24,7 +24,7 @@
 #define GNC_BOOK_HPP
 
 // gnucash includes
-#include "libqof/qof/guid.hpp"
+#include "engine/guid.hpp"
 extern "C"
 {
 #include "qof.h"
diff --git a/src/optional/gtkmm/gncmm/Commodity.hpp b/src/optional/gtkmm/gncmm/Commodity.hpp
index e944eba..f2e9f9f 100644
--- a/src/optional/gtkmm/gncmm/Commodity.hpp
+++ b/src/optional/gtkmm/gncmm/Commodity.hpp
@@ -25,7 +25,7 @@
 
 // gnucash includes
 #include "config.h"
-#include "libqof/qof/guid.hpp"
+#include "engine/guid.hpp"
 extern "C"
 {
 #include "qof.h"
diff --git a/src/optional/gtkmm/gncmm/GncInstance.hpp b/src/optional/gtkmm/gncmm/GncInstance.hpp
index 641c029..14a8369 100644
--- a/src/optional/gtkmm/gncmm/GncInstance.hpp
+++ b/src/optional/gtkmm/gncmm/GncInstance.hpp
@@ -25,7 +25,7 @@
 
 // gnucash includes
 #include "config.h"
-#include "libqof/qof/guid.hpp"
+#include "engine/guid.hpp"
 extern "C"
 {
 #include "qof.h"
diff --git a/src/optional/gtkmm/gncmm/Numeric.hpp b/src/optional/gtkmm/gncmm/Numeric.hpp
index b621450..74e8041 100644
--- a/src/optional/gtkmm/gncmm/Numeric.hpp
+++ b/src/optional/gtkmm/gncmm/Numeric.hpp
@@ -25,7 +25,7 @@
 
 // gnucash includes
 #include "config.h"
-#include "libqof/qof/guid.hpp"
+#include "engine/guid.hpp"
 extern "C"
 {
 #include "qof.h"
diff --git a/src/optional/gtkmm/gncmm/Split.hpp b/src/optional/gtkmm/gncmm/Split.hpp
index 2fc40a5..0465bc5 100644
--- a/src/optional/gtkmm/gncmm/Split.hpp
+++ b/src/optional/gtkmm/gncmm/Split.hpp
@@ -25,7 +25,7 @@
 
 // gnucash includes
 #include "config.h"
-#include "libqof/qof/guid.hpp"
+#include "engine/guid.hpp"
 extern "C"
 {
 #include "qof.h"
diff --git a/src/optional/gtkmm/test/Makefile.am b/src/optional/gtkmm/test/Makefile.am
index 631b518..c36d0a0 100644
--- a/src/optional/gtkmm/test/Makefile.am
+++ b/src/optional/gtkmm/test/Makefile.am
@@ -30,7 +30,7 @@ test_gtkmm_HEADERS = \
 #The tests might require more libraries, but try to keep them
 #as independent as possible.
 test_gtkmm_LDADD = ${top_builddir}/${MODULEPATH}/libgncmod-gtkmm.la \
-  ${top_builddir}/src/libqof/qof/libgnc-qof.la \
+  ${top_builddir}/src/engine/libgncmod-engine.la \
   ${GTKMM_LIBS} \
   ${GLIB_LIBS}
 
diff --git a/src/optional/python-bindings/CMakeLists.txt b/src/optional/python-bindings/CMakeLists.txt
index 93682fb..8aed964 100644
--- a/src/optional/python-bindings/CMakeLists.txt
+++ b/src/optional/python-bindings/CMakeLists.txt
@@ -5,21 +5,21 @@ IF (BUILDING_FROM_VCS)
   SET(SWIG_FILES ${CMAKE_CURRENT_SOURCE_DIR}/gnucash_core.i ${CMAKE_CURRENT_SOURCE_DIR}/timespec.i)
   SET(GNUCASH_CORE_C_INCLUDES
     ${CMAKE_BINARY_DIR}/src/config.h
-    ${CMAKE_SOURCE_DIR}/src/libqof/qof/qofsession.h
-    ${CMAKE_SOURCE_DIR}/src/libqof/qof/qofbook.h
-    ${CMAKE_SOURCE_DIR}/src/libqof/qof/qofbackend.h
-    ${CMAKE_SOURCE_DIR}/src/libqof/qof/qoflog.h
-    ${CMAKE_SOURCE_DIR}/src/libqof/qof/qofutil.h
-    ${CMAKE_SOURCE_DIR}/src/libqof/qof/qofid.h
-    ${CMAKE_SOURCE_DIR}/src/libqof/qof/guid.h
+    ${CMAKE_SOURCE_DIR}/src/engine/qofsession.h
+    ${CMAKE_SOURCE_DIR}/src/engine/qofbook.h
+    ${CMAKE_SOURCE_DIR}/src/engine/qofbackend.h
+    ${CMAKE_SOURCE_DIR}/src/engine/qoflog.h
+    ${CMAKE_SOURCE_DIR}/src/engine/qofutil.h
+    ${CMAKE_SOURCE_DIR}/src/engine/qofid.h
+    ${CMAKE_SOURCE_DIR}/src/engine/guid.h
     ${CMAKE_SOURCE_DIR}/src/gnc-module/gnc-module.h
     ${CMAKE_SOURCE_DIR}/src/engine/gnc-engine.h
-		${CMAKE_SOURCE_DIR}/src/engine/Transaction.h
+    ${CMAKE_SOURCE_DIR}/src/engine/Transaction.h
     ${CMAKE_SOURCE_DIR}/src/engine/Split.h
     ${CMAKE_SOURCE_DIR}/src/engine/Account.h
     ${CMAKE_SOURCE_DIR}/src/engine/gnc-commodity.h
     ${CMAKE_SOURCE_DIR}/src/engine/gnc-lot.h
-    ${CMAKE_SOURCE_DIR}/src/libqof/qof/gnc-numeric.h
+    ${CMAKE_SOURCE_DIR}/src/engine/gnc-numeric.h
     ${CMAKE_SOURCE_DIR}/src/engine/gncCustomer.h
     ${CMAKE_SOURCE_DIR}/src/engine/gncEmployee.h
     ${CMAKE_SOURCE_DIR}/src/engine/gncVendor.h
@@ -50,7 +50,6 @@ ENDIF()
 IF(WITH_PYTHON)
 
   SET(gnucash_core_c_INCLUDE_DIRS
-    ${CMAKE_SOURCE_DIR}/src/libqof/qof
     ${CMAKE_SOURCE_DIR}/src
     ${CMAKE_SOURCE_DIR}/src/engine
     ${CMAKE_SOURCE_DIR}/src/gnome-utils
@@ -66,12 +65,12 @@ IF(WITH_PYTHON)
   ADD_LIBRARY(gnucash_core_c MODULE ${SWIG_GNUCASH_CORE_C})
   TARGET_INCLUDE_DIRECTORIES(gnucash_core_c PRIVATE ${gnucash_core_c_INCLUDE_DIRS})
 
-  TARGET_LINK_LIBRARIES(gnucash_core_c gnc-qof gnc-module gncmod-engine gncmod-app-utils ${GLIB_LIBS} ${PYTHON_LIBRARIES})
+  TARGET_LINK_LIBRARIES(gnucash_core_c gncmod-app-utils gncmod-engine gnc-module ${GLIB_LIBS} ${PYTHON_LIBRARIES})
   SET_TARGET_PROPERTIES(gnucash_core_c PROPERTIES PREFIX "_")
   TARGET_COMPILE_OPTIONS(gnucash_core_c PRIVATE -Wno-implicit -Wno-missing-prototypes -Wno-declaration-after-statement -Wno-missing-declarations)
 
   ADD_EXECUTABLE(sqlite3test EXCLUDE_FROM_ALL sqlite3test.c ${SWIG_GNUCASH_CORE_C})
-  TARGET_LINK_LIBRARIES(sqlite3test gnc-qof gnc-module gncmod-engine gncmod-app-utils ${GLIB_LIBS} ${PYTHON_LIBRARIES})
+  TARGET_LINK_LIBRARIES(sqlite3test gncmod-app-utils gncmod-engine gnc-module ${GLIB_LIBS} ${PYTHON_LIBRARIES})
   TARGET_INCLUDE_DIRECTORIES(sqlite3test PRIVATE ${gnucash_core_c_INCLUDE_DIRS})
   TARGET_COMPILE_OPTIONS(sqlite3test PRIVATE -Wno-implicit -Wno-missing-prototypes -Wno-declaration-after-statement -Wno-missing-declarations)
 
diff --git a/src/optional/python-bindings/Makefile.am b/src/optional/python-bindings/Makefile.am
index 7f9bf9c..6d0ac7d 100644
--- a/src/optional/python-bindings/Makefile.am
+++ b/src/optional/python-bindings/Makefile.am
@@ -17,7 +17,6 @@ _gnucash_core_c_la_SOURCES = \
 _gnucash_core_c_la_CPPFLAGS = \
   $(PYTHON_CPPFLAGS) \
   $(GLIB_CFLAGS) \
-  -I${top_srcdir}/src/libqof/qof \
   -I$(top_srcdir)/src  \
   -I$(top_srcdir)/src/engine \
   -I${top_srcdir}/src/gnome-utils \
@@ -34,20 +33,19 @@ _gnucash_core_c_la_LDFLAGS = -avoid-version -module
 
 _gnucash_core_c_la_LIBADD = \
   ${GLIB_LIBS} \
-  ${top_builddir}/src/libqof/qof/libgnc-qof.la \
   ${top_builddir}/src/gnc-module/libgnc-module.la \
   ${top_builddir}/src/engine/libgncmod-engine.la \
   ${top_builddir}/src/app-utils/libgncmod-app-utils.la
 if BUILDING_FROM_VCS
 _gnucash_core_c_includes= \
 	${top_builddir}/config.h \
-	${top_srcdir}/src/libqof/qof/qofsession.h \
-	${top_srcdir}/src/libqof/qof/qofbook.h \
-	${top_srcdir}/src/libqof/qof/qofbackend.h \
-	${top_srcdir}/src/libqof/qof/qoflog.h \
-	${top_srcdir}/src/libqof/qof/qofutil.h \
-	${top_srcdir}/src/libqof/qof/qofid.h \
-	${top_srcdir}/src/libqof/qof/guid.h \
+	${top_srcdir}/src/engine/qofsession.h \
+	${top_srcdir}/src/engine/qofbook.h \
+	${top_srcdir}/src/engine/qofbackend.h \
+	${top_srcdir}/src/engine/qoflog.h \
+	${top_srcdir}/src/engine/qofutil.h \
+	${top_srcdir}/src/engine/qofid.h \
+	${top_srcdir}/src/engine/guid.h \
 	${top_srcdir}/src/gnc-module/gnc-module.h \
 	${top_srcdir}/src/engine/gnc-engine.h \
 	${top_srcdir}/src/engine/Transaction.h \
@@ -55,7 +53,7 @@ _gnucash_core_c_includes= \
 	${top_srcdir}/src/engine/Account.h \
 	${top_srcdir}/src/engine/gnc-commodity.h \
 	${top_srcdir}/src/engine/gnc-lot.h \
-	${top_srcdir}/src/libqof/qof/gnc-numeric.h \
+	${top_srcdir}/src/engine/gnc-numeric.h \
 	${top_srcdir}/src/engine/gncCustomer.h \
 	${top_srcdir}/src/engine/gncEmployee.h \
 	${top_srcdir}/src/engine/gncVendor.h \
@@ -74,8 +72,7 @@ _gnucash_core_c_includes= \
 gnucash_core.c: $(SWIG_FILES) ${top_srcdir}/src/base-typemaps.i ${top_srcdir}/src/engine/engine-common.i $(_gnucash_core_c_includes)
 	$(SWIG) -python -Wall -Werror \
 	-I$(top_srcdir)/src -I$(top_srcdir)/src/engine \
-	-I$(top_srcdir)/src/app-utils -I${top_srcdir}/src/libqof/qof \
-	-o $@ $<
+	-I$(top_srcdir)/src/app-utils -o $@ $<
 
 gnucash_core_c.py: gnucash_core.c $(SWIG_FILES)
 endif
diff --git a/src/optional/python-bindings/tests/Makefile.am b/src/optional/python-bindings/tests/Makefile.am
index 8a0d3f6..6b638c5 100644
--- a/src/optional/python-bindings/tests/Makefile.am
+++ b/src/optional/python-bindings/tests/Makefile.am
@@ -5,7 +5,6 @@ GNC_TEST_DEPS = --gnc-module-dir ${top_builddir}/src/engine \
   --guile-load-dir ${top_builddir}/src/engine \
   --guile-load-dir ${top_builddir}/src/scm \
   --guile-load-dir ${top_builddir}/src/app-utils \
-  --library-dir    ${top_builddir}/src/libqof/qof \
   --library-dir    ${top_builddir}/src/core-utils \
   --library-dir    ${top_builddir}/src/gnc-module \
   --library-dir    ${top_builddir}/src/engine \
diff --git a/src/plugins/bi_import/CMakeLists.txt b/src/plugins/bi_import/CMakeLists.txt
index 9662853..f6b25f3 100644
--- a/src/plugins/bi_import/CMakeLists.txt
+++ b/src/plugins/bi_import/CMakeLists.txt
@@ -29,7 +29,6 @@ TARGET_LINK_LIBRARIES(gncmod-bi_import
   gncmod-engine
   gnc-core-utils
   gnc-module
-  gnc-qof
   gnc-gnome
 )
 
diff --git a/src/plugins/bi_import/Makefile.am b/src/plugins/bi_import/Makefile.am
index c996cf6..b17da1a 100644
--- a/src/plugins/bi_import/Makefile.am
+++ b/src/plugins/bi_import/Makefile.am
@@ -24,9 +24,7 @@ libgncmod_bi_import_la_LIBADD = \
   ${top_builddir}/src/engine/libgncmod-engine.la \
   ${top_builddir}/src/core-utils/libgnc-core-utils.la \
   ${top_builddir}/src/gnc-module/libgnc-module.la \
-  ${top_builddir}/src/libqof/qof/libgnc-qof.la \
   ${top_builddir}/lib/libc/libc-missing.la \
-  ${QOF_LIBS} \
   ${GLIB_LIBS}
 
 AM_CPPFLAGS = \
@@ -47,7 +45,6 @@ AM_CPPFLAGS = \
   -I${top_srcdir}/src/gnc-module \
   -I${top_srcdir}/lib/libc \
   ${GTK_CFLAGS} \
-  ${QOF_CFLAGS} \
   ${GLIB_CFLAGS}
 
 AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.plugin.bi-import\"
diff --git a/src/plugins/customer_import/CMakeLists.txt b/src/plugins/customer_import/CMakeLists.txt
index 5beaaa6..36772b1 100644
--- a/src/plugins/customer_import/CMakeLists.txt
+++ b/src/plugins/customer_import/CMakeLists.txt
@@ -21,7 +21,7 @@ SET(customer_import_noinst_HEADERS
 ADD_LIBRARY(gncmod-customer_import ${customer_import_SOURCES} ${customer_input_noinst_HEADERS})
 
 TARGET_LINK_LIBRARIES(gncmod-customer_import gnc-gnome gncmod-gnome-utils gncmod-app-utils
-     gncmod-engine gnc-core-utils gnc-module gnc-qof ${GLIB2_LDFLAGS})
+     gncmod-engine gnc-core-utils gnc-module ${GLIB2_LDFLAGS})
 
 TARGET_INCLUDE_DIRECTORIES(gncmod-bi_import
   PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
diff --git a/src/plugins/customer_import/Makefile.am b/src/plugins/customer_import/Makefile.am
index 5569e54..61311aa 100644
--- a/src/plugins/customer_import/Makefile.am
+++ b/src/plugins/customer_import/Makefile.am
@@ -22,9 +22,7 @@ libgncmod_customer_import_la_LIBADD = \
   ${top_builddir}/src/engine/libgncmod-engine.la \
   ${top_builddir}/src/core-utils/libgnc-core-utils.la \
   ${top_builddir}/src/gnc-module/libgnc-module.la \
-  ${top_builddir}/src/libqof/qof/libgnc-qof.la \
   ${top_builddir}/lib/libc/libc-missing.la \
-  ${QOF_LIBS} \
   ${GLIB_LIBS}
 
 AM_CPPFLAGS = \
@@ -44,7 +42,6 @@ AM_CPPFLAGS = \
   -I${top_srcdir}/src/gnc-module \
   -I${top_srcdir}/lib/libc \
   ${GTK_CFLAGS} \
-  ${QOF_CFLAGS} \
   ${GLIB_CFLAGS}
 
 AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.plugin.customer_import\"
diff --git a/src/plugins/example/Makefile.am b/src/plugins/example/Makefile.am
index ff20330..8944dcb 100644
--- a/src/plugins/example/Makefile.am
+++ b/src/plugins/example/Makefile.am
@@ -15,7 +15,6 @@ libgncmod_example_la_LIBADD = \
   ${top_builddir}/src/gnc-module/libgnc-module.la \
   ${GNOME_LIBS} \
   ${GLADE_LIBS} \
-  ${QOF_LIBS} \
   ${GLIB_LIBS} \
   ${AQBANKING_LIBS}
 
@@ -32,7 +31,6 @@ AM_CFLAGS = \
   -I${top_srcdir}/src/gnc-module \
   ${GNOME_CFLAGS} \
   ${GLADE_CFLAGS} \
-  ${QOF_CFLAGS} \
   ${GLIB_CFLAGS} \
   ${AQBANKING_CFLAGS}
 
diff --git a/src/register/ledger-core/Makefile.am b/src/register/ledger-core/Makefile.am
index b0e256d..739d311 100644
--- a/src/register/ledger-core/Makefile.am
+++ b/src/register/ledger-core/Makefile.am
@@ -45,7 +45,6 @@ libgncmod_ledger_core_la_LIBADD = \
   ${top_builddir}/src/engine/libgncmod-engine.la \
   ${top_builddir}/src/core-utils/libgnc-core-utils.la \
   ${top_builddir}/src/gnc-module/libgnc-module.la \
-  ${top_builddir}/src/libqof/qof/libgnc-qof.la \
   ${GUILE_LIBS} \
   ${GTK_LIBS} \
   ${GLIB_LIBS}
@@ -60,7 +59,6 @@ AM_CPPFLAGS = \
   -I${top_srcdir}/src/gnome-utils \
   -I${top_srcdir}/src/register/register-core \
   -I${top_srcdir}/src/register/register-gnome \
-  -I${top_srcdir}/src/libqof/qof \
   ${GUILE_CFLAGS} \
   ${GTK_CFLAGS} \
   ${GLIB_CFLAGS} \
diff --git a/src/register/ledger-core/test/Makefile.am b/src/register/ledger-core/test/Makefile.am
index 2029ee5..b9d57a4 100644
--- a/src/register/ledger-core/test/Makefile.am
+++ b/src/register/ledger-core/test/Makefile.am
@@ -4,7 +4,7 @@ check_PROGRAMS = test-link-module
 
 test_link_module_SOURCES=test-link-module.c
 test_link_module_LDADD=\
-	$(top_builddir)/src/libqof/qof/libgnc-qof.la \
+	$(top_builddir)/src/engine/libgncmod-engine.la \
         $(top_builddir)/src/app-utils/libgncmod-app-utils.la \
 	${top_builddir}/src/gnome-utils/libgncmod-gnome-utils.la \
 	${top_builddir}/src/gnome/libgnc-gnome.la \
diff --git a/src/register/register-core/CMakeLists.txt b/src/register/register-core/CMakeLists.txt
index c4b4aa8..6ab939f 100644
--- a/src/register/register-core/CMakeLists.txt
+++ b/src/register/register-core/CMakeLists.txt
@@ -45,7 +45,7 @@ SET_SOURCE_FILES_PROPERTIES (${register_core_SOURCES} PROPERTIES OBJECT_DEPENDS
 
 ADD_LIBRARY (gncmod-register-core ${register_core_SOURCES} ${register_core_HEADERS})
 
-TARGET_LINK_LIBRARIES(gncmod-register-core gncmod-gnome-utils  gnc-qof gncmod-app-utils ${GMODULE_LDFLAGS})
+TARGET_LINK_LIBRARIES(gncmod-register-core gncmod-gnome-utils gncmod-app-utils ${GMODULE_LDFLAGS})
 
 TARGET_COMPILE_DEFINITIONS (gncmod-register-core PRIVATE -DG_LOG_DOMAIN=\"gnc.register.core\")
 
diff --git a/src/register/register-core/Makefile.am b/src/register/register-core/Makefile.am
index b5305e6..dca543d 100644
--- a/src/register/register-core/Makefile.am
+++ b/src/register/register-core/Makefile.am
@@ -10,7 +10,6 @@ libgncmod_register_core_la_LIBADD = \
   ${top_builddir}/src/core-utils/libgnc-core-utils.la \
   ${top_builddir}/src/app-utils/libgncmod-app-utils.la \
   ${top_builddir}/src/gnome-utils/libgncmod-gnome-utils.la \
-  ${top_builddir}/src/libqof/qof/libgnc-qof.la \
   ${GUILE_LIBS} \
   ${GLIB_LIBS}
 
@@ -60,7 +59,6 @@ AM_CPPFLAGS = \
   -I${top_srcdir}/src/app-utils \
   -I${top_srcdir}/src/gnc-module \
   -I${top_srcdir}/src/gnome-utils \
-  -I${top_srcdir}/src/libqof/qof \
   ${GUILE_CFLAGS} \
   ${GTK_CFLAGS} \
   ${GLIB_CFLAGS}
diff --git a/src/register/register-core/test/Makefile.am b/src/register/register-core/test/Makefile.am
index bf223e9..785d760 100644
--- a/src/register/register-core/test/Makefile.am
+++ b/src/register/register-core/test/Makefile.am
@@ -13,7 +13,6 @@ check_PROGRAMS = \
 
 test_link_module_SOURCES=test-link-module.c
 test_link_module_LDADD=\
-  $(top_builddir)/src/libqof/qof/libgnc-qof.la \
   ${top_builddir}/src/engine/libgncmod-engine.la \
   ${top_builddir}/src/app-utils/libgncmod-app-utils.la \
   ${top_builddir}/src/gnome-utils/libgncmod-gnome-utils.la \
diff --git a/src/register/register-gnome/CMakeLists.txt b/src/register/register-gnome/CMakeLists.txt
index 45a36c8..2e9b2e7 100644
--- a/src/register/register-gnome/CMakeLists.txt
+++ b/src/register/register-gnome/CMakeLists.txt
@@ -44,7 +44,7 @@ SET_SOURCE_FILES_PROPERTIES (${register_gnome_SOURCES} PROPERTIES OBJECT_DEPENDS
 
 ADD_LIBRARY (gncmod-register-gnome ${register_gnome_SOURCES} ${register_gnome_noinst_HEADERS})
 
-TARGET_LINK_LIBRARIES(gncmod-register-gnome gncmod-register-core gnc-qof ${GTK3_LDFLAGS})
+TARGET_LINK_LIBRARIES(gncmod-register-gnome gncmod-register-core ${GTK3_LDFLAGS})
 
 TARGET_COMPILE_DEFINITIONS(gncmod-register-gnome PRIVATE -DG_LOG_DOMAIN=\"gnc.register.gnome\")
 
diff --git a/src/register/register-gnome/Makefile.am b/src/register/register-gnome/Makefile.am
index 0909205..0da1eb2 100644
--- a/src/register/register-gnome/Makefile.am
+++ b/src/register/register-gnome/Makefile.am
@@ -11,7 +11,6 @@ libgncmod_register_gnome_la_LIBADD = \
   ${top_builddir}/src/engine/libgncmod-engine.la \
   ${top_builddir}/src/app-utils/libgncmod-app-utils.la \
   ${top_builddir}/src/gnome-utils/libgncmod-gnome-utils.la \
-  ${top_builddir}/src/libqof/qof/libgnc-qof.la \
   ${GLIB_LIBS} \
   ${GTK_LIBS}
 
@@ -61,7 +60,6 @@ AM_CPPFLAGS = \
   -I${top_srcdir}/src/gnome-utils \
   -I${top_srcdir}/src/register/ledger-core \
   -I${top_srcdir}/src/register/register-core \
-  -I${top_srcdir}/src/libqof/qof \
   ${GLIB_CFLAGS} \
   ${GTK_CFLAGS} \
   ${GTK_XIM_FLAGS}
diff --git a/src/register/register-gnome/test/Makefile.am b/src/register/register-gnome/test/Makefile.am
index d615f02..df8c865 100644
--- a/src/register/register-gnome/test/Makefile.am
+++ b/src/register/register-gnome/test/Makefile.am
@@ -13,7 +13,6 @@ check_PROGRAMS = \
 
 test_link_module_SOURCES = test-link-module.c
 test_link_module_LDADD = \
-  $(top_builddir)/src/libqof/qof/libgnc-qof.la \
   ${top_builddir}/src/engine/libgncmod-engine.la \
   ${top_builddir}/src/app-utils/libgncmod-app-utils.la \
   ${top_builddir}/src/gnome-utils/libgncmod-gnome-utils.la \
diff --git a/src/report/business-reports/Makefile.am b/src/report/business-reports/Makefile.am
index a15a37a..96f9790 100644
--- a/src/report/business-reports/Makefile.am
+++ b/src/report/business-reports/Makefile.am
@@ -63,7 +63,6 @@ GUILE_COMPILE_ENV = \
   --guile-load-dir ${top_builddir}/src/report/business-reports \
   --guile-load-dir ${top_builddir}/src/scm \
   --library-dir    ${top_builddir}/src/engine \
-  --library-dir    ${top_builddir}/src/libqof/qof \
   --library-dir    ${top_builddir}/src/app-utils \
   --library-dir    ${top_builddir}/src/core-utils \
   --library-dir    ${top_builddir}/src/gnome-utils \
diff --git a/src/report/locale-specific/us/CMakeLists.txt b/src/report/locale-specific/us/CMakeLists.txt
index 7cf180d..47556cd 100644
--- a/src/report/locale-specific/us/CMakeLists.txt
+++ b/src/report/locale-specific/us/CMakeLists.txt
@@ -29,7 +29,7 @@ SET(gncmod_local_reports_us_SCHEME_2 us.scm de_DE.scm)
 SET(GUILE_MODULES src/app-utils src/engine src/gnome-utils src/html src/report/report-system src/tax/us)
 SET(GUILE_LOAD_DIRS  src/app-utils src/core-utils src/engine src/gnc-module src/gnome-utils src/report/report-system
                      src/scm src/tax/us)
-SET(GUILE_LIBRARY_DIRS src/engine src/libqof/qof src/app-utils src/core-utils src/gnc-module src/gnome-utils
+SET(GUILE_LIBRARY_DIRS src/engine src/app-utils src/core-utils src/gnc-module src/gnome-utils
                        src/html src/report/report-system)
 SET(GUILE_DEPENDS   gncmod-html scm-tax-us-1 scm-tax-us-2 scm-report-system-3)
 
diff --git a/src/report/locale-specific/us/Makefile.am b/src/report/locale-specific/us/Makefile.am
index 462c462..826f2a9 100644
--- a/src/report/locale-specific/us/Makefile.am
+++ b/src/report/locale-specific/us/Makefile.am
@@ -70,7 +70,6 @@ GUILE_COMPILE_ENV = \
   --guile-load-dir ${top_builddir}/src/scm \
   --guile-load-dir ${top_builddir}/src/tax/us \
   --library-dir    ${top_builddir}/src/engine \
-  --library-dir    ${top_builddir}/src/libqof/qof \
   --library-dir    ${top_builddir}/src/app-utils \
   --library-dir    ${top_builddir}/src/core-utils \
   --library-dir    ${top_builddir}/src/gnc-module \
diff --git a/src/report/locale-specific/us/test/Makefile.am b/src/report/locale-specific/us/test/Makefile.am
index 03e33bb..ac71b66 100644
--- a/src/report/locale-specific/us/test/Makefile.am
+++ b/src/report/locale-specific/us/test/Makefile.am
@@ -7,7 +7,6 @@ GNC_TEST_DEPS = --gnc-module-dir ${top_builddir}/src/engine \
   --guile-load-dir ${top_builddir}/src/gnc-module \
   --guile-load-dir ${top_builddir}/src/engine \
   --guile-load-dir ${top_builddir}/src/tax/us \
-  --library-dir    ${top_builddir}/src/libqof/qof \
   --library-dir    ${top_builddir}/src/core-utils \
   --library-dir    ${top_builddir}/src/gnc-module \
   --library-dir    ${top_builddir}/src/engine \
diff --git a/src/report/report-gnome/CMakeLists.txt b/src/report/report-gnome/CMakeLists.txt
index f6223e8..4230898 100644
--- a/src/report/report-gnome/CMakeLists.txt
+++ b/src/report/report-gnome/CMakeLists.txt
@@ -30,7 +30,7 @@ ADD_LIBRARY (gncmod-report-gnome
   ${SWIG_REPORT_GNOME_C}
 )
 TARGET_LINK_LIBRARIES(gncmod-report-gnome gncmod-report-system gncmod-html gncmod-gnome-utils
-      gnc-qof ${GUILE_LDFLAGS} ${GTK3_LDFLAGS})
+      ${GUILE_LDFLAGS} ${GTK3_LDFLAGS})
 
 TARGET_COMPILE_DEFINITIONS (gncmod-report-gnome PRIVATE -DG_LOG_DOMAIN=\"gnc.report.gui\")
 
diff --git a/src/report/report-gnome/Makefile.am b/src/report/report-gnome/Makefile.am
index 39a7bf3..ea546f3 100644
--- a/src/report/report-gnome/Makefile.am
+++ b/src/report/report-gnome/Makefile.am
@@ -13,7 +13,6 @@ AM_CPPFLAGS = \
   -I${top_srcdir}/src/gnome \
   -I${top_srcdir}/src/html \
   -I${top_srcdir}/src/report/report-system \
-  -I${top_srcdir}/src/libqof/qof \
   ${GUILE_CFLAGS} \
   ${GTK_CFLAGS} \
   ${GLIB_CFLAGS}
@@ -45,7 +44,6 @@ libgncmod_report_gnome_la_LIBADD = \
   ${top_builddir}/src/gnome-utils/libgncmod-gnome-utils.la \
   ${top_builddir}/src/html/libgncmod-html.la \
   ${top_builddir}/src/report/report-system/libgncmod-report-system.la \
-  ${top_builddir}/src/libqof/qof/libgnc-qof.la \
   ${GUILE_LIBS} \
   ${GLIB_LIBS}
 
@@ -120,7 +118,6 @@ GUILE_COMPILE_ENV = \
   --guile-load-dir ${top_builddir}/src/report/utility-reports \
   --guile-load-dir ${top_builddir}/src/scm \
   --library-dir    ${top_builddir}/src/engine \
-  --library-dir    ${top_builddir}/src/libqof/qof \
   --library-dir    ${top_builddir}/src/app-utils \
   --library-dir    ${top_builddir}/src/core-utils \
   --library-dir    ${top_builddir}/src/gnc-module \
diff --git a/src/report/report-gnome/test/Makefile.am b/src/report/report-gnome/test/Makefile.am
index 1c08979..a894a75 100644
--- a/src/report/report-gnome/test/Makefile.am
+++ b/src/report/report-gnome/test/Makefile.am
@@ -2,13 +2,13 @@ AM_CPPFLAGS = \
   -I${top_srcdir} \
   -I${top_srcdir}/src \
   -I${top_srcdir}/src/test-core \
-  -I${top_srcdir}/src/libqof/qof \
+  -I${top_srcdir}/src/engine \
   -I${top_srcdir}/src/gnc-module \
   ${GUILE_CFLAGS} \
   ${GLIB_CFLAGS}
 
 LDADD = \
-  ${top_builddir}/src/libqof/qof/libgnc-qof.la \
+  ${top_builddir}/src/engine/libgncmod-engine.la \
   ${top_builddir}/src/gnc-module/libgnc-module.la \
   ${top_builddir}/src/report/report-gnome/libgncmod-report-gnome.la \
   $(top_builddir)/src/app-utils/libgncmod-app-utils.la \
@@ -41,7 +41,6 @@ GNC_TEST_DEPS = --gnc-module-dir ${top_builddir}/src/engine \
 \
   --library-dir    ${top_builddir}/src/report/report-gnome \
   --library-dir    ${top_builddir}/src/report/report-system \
-  --library-dir    ${top_builddir}/src/libqof/qof \
   --library-dir    ${top_builddir}/src/core-utils \
   --library-dir    ${top_builddir}/src/app-utils \
   --library-dir    ${top_builddir}/src/gnc-module \
diff --git a/src/report/report-system/CMakeLists.txt b/src/report/report-system/CMakeLists.txt
index bc97a93..5ca9c92 100644
--- a/src/report/report-system/CMakeLists.txt
+++ b/src/report/report-system/CMakeLists.txt
@@ -25,7 +25,7 @@ ADD_LIBRARY (gncmod-report-system
 
 TARGET_COMPILE_DEFINITIONS(gncmod-report-system PRIVATE -DG_LOG_DOMAIN=\"gnc.report.core\")
 
-TARGET_LINK_LIBRARIES(gncmod-report-system gnc-module gncmod-app-utils gnc-qof ${GTK3_LDFLAGS} ${GUILE_LDFLAGS})
+TARGET_LINK_LIBRARIES(gncmod-report-system gnc-module gncmod-app-utils ${GTK3_LDFLAGS} ${GUILE_LDFLAGS})
 
 TARGET_INCLUDE_DIRECTORIES (gncmod-report-system
     PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${GTK3_INCLUDE_DIRS}
@@ -115,4 +115,4 @@ SET_LOCAL_DIST(report_system_DIST_local CMakeLists.txt Makefile.am report-system
         ${report_system_HEADERS} ${report_system_SOURCES} ${report_system_SCHEME} ${report_system_SCHEME_1}
         ${report_system_SCHEME_2} ${report_system_SCHEME_3})
 
-SET(report_system_DIST ${report_system_DIST_local} ${test_report_system_DIST} PARENT_SCOPE)
\ No newline at end of file
+SET(report_system_DIST ${report_system_DIST_local} ${test_report_system_DIST} PARENT_SCOPE)
diff --git a/src/report/report-system/Makefile.am b/src/report/report-system/Makefile.am
index 07cd4ef..c0352f5 100644
--- a/src/report/report-system/Makefile.am
+++ b/src/report/report-system/Makefile.am
@@ -18,7 +18,7 @@ libgncmod_report_system_la_LIBADD = \
   ${top_builddir}/src/engine/libgncmod-engine.la \
   ${top_builddir}/src/gnc-module/libgnc-module.la \
   ${top_builddir}/src/app-utils/libgncmod-app-utils.la \
-  ${top_builddir}/src/libqof/qof/libgnc-qof.la \
+  ${top_builddir}/src/engine/libgncmod-engine.la \
   ${GUILE_LIBS} \
   ${GLIB_LIBS} \
   ${GTK_LIBS}
@@ -42,7 +42,6 @@ AM_CPPFLAGS = \
   -I${top_srcdir}/src/gnc-module \
   -I${top_srcdir}/src/app-utils \
   -I${top_srcdir}/src/engine \
-  -I${top_srcdir}/src/libqof/qof \
   ${GLIB_CFLAGS} \
   ${GTK_CFLAGS} \
   ${GUILE_CFLAGS}
@@ -120,7 +119,6 @@ GUILE_COMPILE_ENV = \
   --guile-load-dir ${top_builddir}/src/gnome-utils \
   --guile-load-dir ${top_builddir}/src/scm \
   --guile-load-dir ${top_builddir}/src/report/report-system \
-  --library-dir    ${top_builddir}/src/libqof/qof \
   --library-dir    ${top_builddir}/src/engine \
   --library-dir    ${top_builddir}/src/app-utils \
   --library-dir    ${top_builddir}/src/core-utils \
diff --git a/src/report/report-system/test/Makefile.am b/src/report/report-system/test/Makefile.am
index a62c741..b122c7b 100644
--- a/src/report/report-system/test/Makefile.am
+++ b/src/report/report-system/test/Makefile.am
@@ -2,13 +2,13 @@ AM_CPPFLAGS = \
   -I${top_srcdir} \
   -I${top_srcdir}/src \
   -I${top_srcdir}/src/test-core \
-  -I${top_srcdir}/src/libqof/qof \
+  -I${top_srcdir}/src/engine \
   -I${top_srcdir}/src/gnc-module \
   ${GUILE_CFLAGS} \
   ${GLIB_CFLAGS}
 
 LDADD = \
-  ${top_builddir}/src/libqof/qof/libgnc-qof.la \
+  ${top_builddir}/src/engine/libgncmod-engine.la \
   ${top_builddir}/src/gnc-module/libgnc-module.la \
   ${GLIB_LIBS} \
   ${GUILE_LIBS}
@@ -47,7 +47,6 @@ GNC_TEST_DEPS = --gnc-module-dir ${top_builddir}/src/engine \
   --guile-load-dir ${top_builddir}/src/report/report-system/test \
 \
   --library-dir    ${top_builddir}/src/report/report-system \
-  --library-dir    ${top_builddir}/src/libqof/qof \
   --library-dir    ${top_builddir}/src/core-utils \
   --library-dir    ${top_builddir}/src/app-utils \
   --library-dir    ${top_builddir}/src/gnome-utils \
diff --git a/src/report/standard-reports/Makefile.am b/src/report/standard-reports/Makefile.am
index 42f215c..7e7356a 100644
--- a/src/report/standard-reports/Makefile.am
+++ b/src/report/standard-reports/Makefile.am
@@ -71,7 +71,6 @@ GUILE_COMPILE_ENV = \
   --guile-load-dir ${top_builddir}/src/report/report-system \
   --guile-load-dir ${top_builddir}/src/report/standard-reports \
   --guile-load-dir ${top_builddir}/src/scm \
-  --library-dir    ${top_builddir}/src/libqof/qof \
   --library-dir    ${top_builddir}/src/engine \
   --library-dir    ${top_builddir}/src/app-utils \
   --library-dir    ${top_builddir}/src/core-utils \
diff --git a/src/report/standard-reports/test/Makefile.am b/src/report/standard-reports/test/Makefile.am
index e98cb85..06e8c6a 100644
--- a/src/report/standard-reports/test/Makefile.am
+++ b/src/report/standard-reports/test/Makefile.am
@@ -31,7 +31,6 @@ GNC_TEST_DEPS = \
   --guile-load-dir ${top_builddir}/src/report/standard-reports/test \
 \
   --library-dir    ${top_builddir}/src/report/report-system \
-  --library-dir    ${top_builddir}/src/libqof/qof \
   --library-dir    ${top_builddir}/src/core-utils \
   --library-dir    ${top_builddir}/src/app-utils \
   --library-dir    ${top_builddir}/src/gnome-utils \
diff --git a/src/report/stylesheets/CMakeLists.txt b/src/report/stylesheets/CMakeLists.txt
index c5e2b32..f2480f5 100644
--- a/src/report/stylesheets/CMakeLists.txt
+++ b/src/report/stylesheets/CMakeLists.txt
@@ -12,7 +12,7 @@ SET(stylesheets_noinst_HEADERS
 ADD_LIBRARY(gncmod-stylesheets MODULE ${stylesheets_SOURCES} ${stylesheets_noinst_HEADERS})
 
 TARGET_LINK_LIBRARIES(gncmod-stylesheets gncmod-report-gnome gncmod-report-system gncmod-gnome-utils gnc-module
-    gnc-qof ${GUILE_LDFLAGS} ${GTK3_LDFLAGS} ${GLIB2_LDFLAGS})
+    ${GUILE_LDFLAGS} ${GTK3_LDFLAGS} ${GLIB2_LDFLAGS})
 
 TARGET_COMPILE_DEFINITIONS(gncmod-stylesheets PRIVATE -DG_LOG_DOMAIN=\"gnc.report.core\")
 
diff --git a/src/report/stylesheets/Makefile.am b/src/report/stylesheets/Makefile.am
index 0f07988..6596b11 100644
--- a/src/report/stylesheets/Makefile.am
+++ b/src/report/stylesheets/Makefile.am
@@ -16,7 +16,7 @@ libgncmod_stylesheets_la_LIBADD = \
   ${top_builddir}/src/report/report-system/libgncmod-report-system.la \
   ${top_builddir}/src/gnome-utils/libgncmod-gnome-utils.la \
   ${top_builddir}/src/gnc-module/libgnc-module.la \
-  ${top_builddir}/src/libqof/qof/libgnc-qof.la \
+  ${top_builddir}/src/engine/libgncmod-engine.la \
   ${GUILE_LIBS} \
   ${GTK_LIBS} \
   ${GLIB_LIBS}
@@ -28,7 +28,6 @@ AM_CPPFLAGS = \
   -I${top_srcdir}/src/gnome \
   -I${top_srcdir}/src/gnome-utils \
   -I${top_srcdir}/src/report/report-gnome \
-  -I${top_srcdir}/src/libqof/qof \
   ${GUILE_CFLAGS} \
   ${GLIB_CFLAGS} \
   ${GTK_CFLAGS}
@@ -78,7 +77,6 @@ GUILE_COMPILE_ENV = \
   --guile-load-dir ${top_builddir}/src/report/report-system \
   --guile-load-dir ${top_builddir}/src/report/stylesheets \
   --guile-load-dir ${top_builddir}/src/scm \
-  --library-dir    ${top_builddir}/src/libqof/qof \
   --library-dir    ${top_builddir}/src/engine \
   --library-dir    ${top_builddir}/src/app-utils \
   --library-dir    ${top_builddir}/src/core-utils \
diff --git a/src/report/stylesheets/test/Makefile.am b/src/report/stylesheets/test/Makefile.am
index a2f8e5d..73b133a 100644
--- a/src/report/stylesheets/test/Makefile.am
+++ b/src/report/stylesheets/test/Makefile.am
@@ -17,7 +17,6 @@ GNC_TEST_DEPS = --gnc-module-dir ${top_builddir}/src/engine \
   --guile-load-dir ${top_builddir}/src/report/report-system \
   --guile-load-dir ${top_builddir}/src/report/stylesheets \
 \
-  --library-dir    ${top_builddir}/src/libqof/qof \
   --library-dir    ${top_builddir}/src/test-core \
   --library-dir    ${top_builddir}/src/core-utils \
   --library-dir    ${top_builddir}/src/gnc-module \
diff --git a/src/report/utility-reports/Makefile.am b/src/report/utility-reports/Makefile.am
index 686d6a0..33a03b0 100644
--- a/src/report/utility-reports/Makefile.am
+++ b/src/report/utility-reports/Makefile.am
@@ -44,7 +44,6 @@ GUILE_COMPILE_ENV = \
   --guile-load-dir ${top_builddir}/src/report/utility-reports \
   --guile-load-dir ${top_builddir}/src/scm \
   --library-dir    ${top_builddir}/src/engine \
-  --library-dir    ${top_builddir}/src/libqof/qof \
   --library-dir    ${top_builddir}/src/app-utils \
   --library-dir    ${top_builddir}/src/core-utils \
   --library-dir    ${top_builddir}/src/gnc-module \
diff --git a/src/scm/Makefile.am b/src/scm/Makefile.am
index fa1bdd7..318af4d 100644
--- a/src/scm/Makefile.am
+++ b/src/scm/Makefile.am
@@ -48,7 +48,7 @@ GUILE_COMPILE_ENV = \
   --guile-load-dir ${top_builddir}/src/scm \
   --library-dir    ${top_builddir}/src/core-utils \
   --library-dir    ${top_builddir}/src/gnc-module \
-  --library-dir    ${top_builddir}/src/libqof/qof
+  --library-dir    ${top_builddir}/src/engine
 
 %.go : %.scm .scm-links
 	$(shell ${abs_top_srcdir}/src/gnc-test-env.pl --noexports ${GUILE_COMPILE_ENV}) \
diff --git a/src/tax/us/Makefile.am b/src/tax/us/Makefile.am
index 143441a..082710b 100644
--- a/src/tax/us/Makefile.am
+++ b/src/tax/us/Makefile.am
@@ -52,7 +52,6 @@ GUILE_COMPILE_ENV = \
   --guile-load-dir ${top_builddir}/src/engine \
   --guile-load-dir ${top_builddir}/src/gnc-module \
   --guile-load-dir ${top_builddir}/src/scm \
-  --library-dir    ${top_builddir}/src/libqof/qof \
   --library-dir    ${top_builddir}/src/engine \
   --library-dir    ${top_builddir}/src/app-utils \
   --library-dir    ${top_builddir}/src/core-utils \
diff --git a/src/test-core/CMakeLists.txt b/src/test-core/CMakeLists.txt
index 824d633..1cb2ca3 100644
--- a/src/test-core/CMakeLists.txt
+++ b/src/test-core/CMakeLists.txt
@@ -11,7 +11,7 @@ SET(test_core_noinst_HEADERS
 INCLUDE_DIRECTORIES(
   ${CMAKE_BINARY_DIR}/src
   ${CMAKE_SOURCE_DIR}/src
-  ${CMAKE_SOURCE_DIR}/src/libqof/qof
+  ${CMAKE_SOURCE_DIR}/src/engine
   ${CMAKE_SOURCE_DIR}/src/test-core
 
   ${GLIB2_INCLUDE_DIRS}
@@ -22,7 +22,7 @@ SET_DIST_LIST(test_core_DIST ${test_core_SOURCES} ${test_core_noinst_HEADERS} CM
         Makefile.am unittest-support.i unittest-support.scm)
 
 ADD_LIBRARY(test-core STATIC ${test_core_SOURCES} ${test_core_noinst_HEADERS})
-TARGET_LINK_LIBRARIES(test-core gncmod-engine gnc-qof ${GLIB2_LDFLAGS})
+TARGET_LINK_LIBRARIES(test-core gncmod-engine ${GLIB2_LDFLAGS})
 IF (UNIX)
   TARGET_COMPILE_OPTIONS(test-core PRIVATE -fPIC)
 ENDIF()
@@ -54,7 +54,7 @@ SET(test_core_SCHEME unittest-support.scm)
 SET(GUILE_OUTPUT_DIR   gnucash)
 SET(GUILE_MODULES      "")
 SET(GUILE_LOAD_DIRS    "")
-SET(GUILE_LIBRARY_DIRS src/test-core src/libqof)
+SET(GUILE_LIBRARY_DIRS src/test-core src/engine)
 SET(GUILE_DEPENDS      test-core-guile)
 
 
@@ -78,4 +78,4 @@ ADD_LIBRARY(gmock STATIC  ${lib_gmock_SOURCES})
 TARGET_INCLUDE_DIRECTORIES(gmock PUBLIC
   ${GTEST_INCLUDE_DIR} ${GTEST_SRC_DIR}
   ${GMOCK_INCLUDE_DIR} ${GMOCK_SRC_DIR})
-INSTALL(FILES unittest-support.h DESTINATION libexec/gnucash/src/libqof/qof/test)
+INSTALL(FILES unittest-support.h DESTINATION libexec/gnucash/src/engine/test)
diff --git a/src/test-core/Makefile.am b/src/test-core/Makefile.am
index 5e3edf7..5a59b8e 100644
--- a/src/test-core/Makefile.am
+++ b/src/test-core/Makefile.am
@@ -8,7 +8,7 @@ libtest_core_la_SOURCES = \
 	unittest-support.c
 
 libtest_core_la_LIBADD = \
-  ${top_builddir}/src/libqof/qof/libgnc-qof.la \
+  ${top_builddir}/src/engine/libgncmod-engine.la \
   ${GLIB_LIBS}
 
 noinst_HEADERS = \
@@ -17,7 +17,7 @@ noinst_HEADERS = \
 
 libtest_core_la_CPPFLAGS = \
   -I${top_srcdir}/src \
-  -I${top_srcdir}/src/libqof/qof \
+  -I${top_srcdir}/src/engine \
   ${GLIB_CFLAGS}
 
 libtest_core_la_LDFLAGS = \
@@ -113,7 +113,7 @@ endif
 if GNC_HAVE_GUILE_2
 GUILE_COMPILE_ENV = \
   --library-dir    ${top_builddir}/src/test-core \
-  --library-dir    ${top_builddir}/src/libqof/qof
+  --library-dir    ${top_builddir}/src/engine
 
 %.go : %.scm .scm-links $(noinst_LTLIBRARIES)
 	GNC_UNINSTALLED=yes \

commit 848bb3474107a11d8d2a6e3351104ee39f66192a
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Sat Aug 5 13:54:28 2017 +0200

    Move core-utils files with depedencies on qof to engine
    
    I have done this in a separate commit from merging qof back
    into engine to keep an overview of changes

diff --git a/po/POTFILES.in b/po/POTFILES.in
index 0ec2b3f..135a8ee 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -27,6 +27,7 @@ src/app-utils/gnc-component-manager.c
 src/app-utils/gnc-entry-quickfill.c
 src/app-utils/gnc-euro.c
 src/app-utils/gnc-exp-parser.c
+src/app-utils/gnc-gdate-utils.c
 src/app-utils/gnc-gettext-util.c
 src/app-utils/gnc-gsettings.c
 src/app-utils/gnc-helpers.c
@@ -113,9 +114,7 @@ src/bin/gnucash-bin.c
 src/core-utils/binreloc.c
 src/core-utils/core-utils.scm
 src/core-utils/gnc-environment.c
-src/core-utils/gnc-features.c
 src/core-utils/gnc-filepath-utils.c
-src/core-utils/gnc-gdate-utils.c
 src/core-utils/gnc-gkeyfile-utils.c
 src/core-utils/gnc-glib-utils.c
 src/core-utils/gnc-guile-utils.c
@@ -123,7 +122,6 @@ src/core-utils/gnc-jalali.c
 src/core-utils/gnc-locale-utils.c
 src/core-utils/gnc-path.c
 src/core-utils/gnc-prefs.c
-src/core-utils/gnc-uri-utils.c
 src/doc/doxygen_main_page.c
 src/engine/Account.c
 src/engine/business-core.scm
@@ -146,6 +144,7 @@ src/engine/gncEmployee.c
 src/engine/gnc-engine.c
 src/engine/gncEntry.c
 src/engine/gnc-event.c
+src/engine/gnc-features.c
 src/engine/gnc-hooks.c
 src/engine/gncIDSearch.c
 src/engine/gncInvoice.c
@@ -158,6 +157,7 @@ src/engine/gncOwner.c
 src/engine/gnc-pricedb.c
 src/engine/gnc-session.c
 src/engine/gncTaxTable.c
+src/engine/gnc-uri-utils.c
 src/engine/gncVendor.c
 src/engine/kvp-scm.cpp
 src/engine/policy.c
diff --git a/src/app-utils/CMakeLists.txt b/src/app-utils/CMakeLists.txt
index b3e780b..f27cbf4 100644
--- a/src/app-utils/CMakeLists.txt
+++ b/src/app-utils/CMakeLists.txt
@@ -22,6 +22,7 @@ SET (app_utils_HEADERS
   gnc-entry-quickfill.h
   gnc-euro.h
   gnc-exp-parser.h
+  gnc-gdate-utils.h
   gnc-gettext-util.h
   gnc-gsettings.h
   gnc-help-utils.h
@@ -63,6 +64,7 @@ SET (app_utils_SOURCES
   gnc-entry-quickfill.c
   gnc-euro.c
   gnc-exp-parser.c
+  gnc-gdate-utils.c
   gnc-gettext-util.c
   gnc-gsettings.c
   gnc-helpers.c
diff --git a/src/app-utils/Makefile.am b/src/app-utils/Makefile.am
index 2666060..10d6836 100644
--- a/src/app-utils/Makefile.am
+++ b/src/app-utils/Makefile.am
@@ -53,6 +53,7 @@ libgncmod_app_utils_la_SOURCES = \
   gnc-entry-quickfill.c \
   gnc-euro.c \
   gnc-exp-parser.c \
+  gnc-gdate-utils.c \
   gnc-gettext-util.c \
   gnc-gsettings.c \
   gnc-helpers.c \
@@ -80,6 +81,7 @@ gncinclude_HEADERS = \
   gnc-entry-quickfill.h \
   gnc-euro.h \
   gnc-exp-parser.h \
+  gnc-gdate-utils.h \
   gnc-gettext-util.h \
   gnc-gsettings.h \
   gnc-help-utils.h \
diff --git a/src/core-utils/gnc-gdate-utils.c b/src/app-utils/gnc-gdate-utils.c
similarity index 95%
rename from src/core-utils/gnc-gdate-utils.c
rename to src/app-utils/gnc-gdate-utils.c
index 1ab4ed7..014a0e2 100644
--- a/src/core-utils/gnc-gdate-utils.c
+++ b/src/app-utils/gnc-gdate-utils.c
@@ -26,23 +26,6 @@
 
 #include "gnc-gdate-utils.h"
 
-void
-gnc_gdate_set_today (GDate* gd)
-{
-    GDate *today = gnc_g_date_new_today ();
-    g_date_set_julian (gd, g_date_get_julian (today));
-    g_date_free (today);
-}
-
-void
-gnc_gdate_set_time64 (GDate* gd, time64 time)
-{
-    struct tm tm;
-    gnc_localtime_r(&time, &tm);
-    g_date_set_dmy (gd, tm.tm_mday, tm.tm_mon + 1, tm.tm_year + 1900);
-
-}
-
 gboolean
 gnc_gdate_equal(gconstpointer gda, gconstpointer gdb)
 {
diff --git a/src/core-utils/gnc-gdate-utils.h b/src/app-utils/gnc-gdate-utils.h
similarity index 96%
rename from src/core-utils/gnc-gdate-utils.h
rename to src/app-utils/gnc-gdate-utils.h
index a9e3c74..3fd8830 100644
--- a/src/core-utils/gnc-gdate-utils.h
+++ b/src/app-utils/gnc-gdate-utils.h
@@ -40,21 +40,6 @@
 
 #include <gnc-date.h>
 
-/** @name GDate time64 setters
-    @{ */
-/** Set a GDate to the current day
- * @param theGDate: The date to act on
- */
-void gnc_gdate_set_today (GDate* gd);
-
-/** Set a GDate to a time64
- * @param theGDate: the date to act on
- * @param time: the time to set it to.
- */
-void gnc_gdate_set_time64 (GDate* gd, time64 time);
-
-/** @} */
-
 /** @name GDate hash table support
     @{ */
 
diff --git a/src/core-utils/CMakeLists.txt b/src/core-utils/CMakeLists.txt
index fdb3864..cd7072a 100644
--- a/src/core-utils/CMakeLists.txt
+++ b/src/core-utils/CMakeLists.txt
@@ -17,15 +17,12 @@ SET (core_utils_SOURCES
   gnc-prefs.c
   gnc-environment.c
   gnc-filepath-utils.c
-  gnc-features.c
-  gnc-gdate-utils.c
   gnc-gkeyfile-utils.c
   gnc-glib-utils.c
   gnc-guile-utils.c
   gnc-jalali.c
   gnc-locale-utils.c
   gnc-path.c
-  gnc-uri-utils.c
 )
 
 # Add dependency on config.h
@@ -110,16 +107,13 @@ SET(core_utils_noinst_HEADERS
   gnc-prefs.h
   gnc-prefs-p.h
   gnc-environment.h
-  gnc-features.h
   gnc-filepath-utils.h
-  gnc-gdate-utils.h
   gnc-gkeyfile-utils.h
   gnc-glib-utils.h
   gnc-guile-utils.h
   gnc-jalali.h
   gnc-locale-utils.h
   gnc-path.h
-  gnc-uri-utils.h
 )
 
 SET(core_utils_ALL_SOURCES ${core_utils_SOURCES} ${core_utils_noinst_HEADERS})
diff --git a/src/core-utils/Makefile.am b/src/core-utils/Makefile.am
index 38b6178..86c2b42 100644
--- a/src/core-utils/Makefile.am
+++ b/src/core-utils/Makefile.am
@@ -6,16 +6,13 @@ libgnc_core_utils_la_SOURCES = \
   binreloc.c \
   gnc-prefs.c \
   gnc-environment.c \
-  gnc-features.c \
   gnc-filepath-utils.c \
-  gnc-gdate-utils.c \
   gnc-gkeyfile-utils.c \
   gnc-glib-utils.c \
   gnc-guile-utils.c \
   gnc-jalali.c \
   gnc-locale-utils.c \
   gnc-path.c \
-  gnc-uri-utils.c \
   swig-core-utils-guile.c
 
 libgnc_core_utils_la_LIBADD = \
@@ -31,16 +28,13 @@ noinst_HEADERS = \
   gnc-prefs.h \
   gnc-prefs-p.h \
   gnc-environment.h \
-  gnc-features.h \
   gnc-filepath-utils.h \
-  gnc-gdate-utils.h \
   gnc-gkeyfile-utils.h \
   gnc-glib-utils.h \
   gnc-guile-utils.h \
   gnc-jalali.h \
   gnc-locale-utils.h \
-  gnc-path.h \
-  gnc-uri-utils.h
+  gnc-path.h
 
 if BUILDING_FROM_VCS
 swig-core-utils-guile.c: core-utils.i ${top_srcdir}/src/base-typemaps.i
diff --git a/src/core-utils/test/CMakeLists.txt b/src/core-utils/test/CMakeLists.txt
index 697c66f..cbb07e4 100644
--- a/src/core-utils/test/CMakeLists.txt
+++ b/src/core-utils/test/CMakeLists.txt
@@ -14,7 +14,6 @@ MACRO(ADD_CORE_UTILS_TEST _TARGET _SOURCE_FILES)
 ENDMACRO()
 
 ADD_CORE_UTILS_TEST(test-gnc-glib-utils test-gnc-glib-utils.c)
-ADD_CORE_UTILS_TEST(test-gnc-uri-utils test-gnc-uri-utils.c)
 ADD_CORE_UTILS_TEST(test-resolve-file-path test-resolve-file-path.c)
 
-SET_DIST_LIST(test_core_utils_DIST CMakeLists.txt Makefile.am test-gnc-glib-utils.c test-gnc-uri-utils.c test-resolve-file-path.c)
\ No newline at end of file
+SET_DIST_LIST(test_core_utils_DIST CMakeLists.txt Makefile.am test-gnc-glib-utils.c test-resolve-file-path.c)
diff --git a/src/core-utils/test/Makefile.am b/src/core-utils/test/Makefile.am
index 1c78d34..75d6067 100644
--- a/src/core-utils/test/Makefile.am
+++ b/src/core-utils/test/Makefile.am
@@ -21,7 +21,6 @@ LDADD = \
 #
 
 TESTS = \
-  test-gnc-uri-utils \
   test-resolve-file-path \
   test-gnc-glib-utils
 
diff --git a/src/engine/CMakeLists.txt b/src/engine/CMakeLists.txt
index e2c54d8..9029f32 100644
--- a/src/engine/CMakeLists.txt
+++ b/src/engine/CMakeLists.txt
@@ -41,9 +41,11 @@ SET (engine_HEADERS
   gnc-commodity.h
   gnc-engine.h
   gnc-event.h
+  gnc-features.h
   gnc-hooks.h
   gnc-pricedb.h
   gnc-session.h
+  gnc-uri-utils.h
   kvp-scm.h
   policy.h
   gncAddress.h
@@ -111,10 +113,12 @@ SET (engine_SOURCES
   gnc-commodity.c
   gnc-engine.c
   gnc-event.c
+  gnc-features.c
   gnc-hooks.c
   gnc-lot.c
   gnc-pricedb.c
   gnc-session.c
+  gnc-uri-utils.c
   gncmod-engine.c
   kvp-scm.cpp
   engine-helpers.c
diff --git a/src/engine/Makefile.am b/src/engine/Makefile.am
index a37c4bc..f533b76 100644
--- a/src/engine/Makefile.am
+++ b/src/engine/Makefile.am
@@ -34,10 +34,12 @@ libgncmod_engine_la_SOURCES = \
   gnc-commodity.c \
   gnc-engine.c \
   gnc-event.c \
+  gnc-features.c \
   gnc-hooks.c \
   gnc-lot.c \
   gnc-pricedb.c \
   gnc-session.c \
+  gnc-uri-utils.c \
   gncmod-engine.c \
   swig-engine.c \
   kvp-scm.cpp \
@@ -86,9 +88,11 @@ gncinclude_HEADERS = \
   gnc-commodity.h \
   gnc-engine.h \
   gnc-event.h \
+  gnc-features.h \
   gnc-hooks.h \
   gnc-pricedb.h \
   gnc-session.h \
+  gnc-uri-utils.h \
   kvp-scm.h \
   policy.h \
   gncAddress.h \
diff --git a/src/engine/Recurrence.c b/src/engine/Recurrence.c
index c9bc78a..8ac955b 100644
--- a/src/engine/Recurrence.c
+++ b/src/engine/Recurrence.c
@@ -27,7 +27,7 @@
 #include "gnc-date.h"
 #include "qof.h"
 #include "gnc-engine.h"
-#include "gnc-gdate-utils.h"
+#include "gnc-date.h"
 #include "Account.h"
 
 #define LOG_MOD "gnc.engine.recurrence"
@@ -381,16 +381,23 @@ time64
 recurrenceGetPeriodTime(const Recurrence *r, guint period_num, gboolean end)
 {
     GDate date;
+    Timespec ts;
     recurrenceNthInstance(r, period_num + (end ? 1 : 0), &date);
     if (end)
     {
         g_date_subtract_days(&date, 1);
-        return gnc_time64_get_day_end_gdate(&date);
+        ts = gnc_dmy2timespec_end (g_date_get_day(&date),
+                                   g_date_get_month(&date),
+                                   g_date_get_year (&date));
+
     }
     else
     {
-        return gnc_time64_get_day_start_gdate(&date);
+        ts = gnc_dmy2timespec (g_date_get_day(&date),
+                               g_date_get_month(&date),
+                               g_date_get_year (&date));
     }
+    return timespecToTime64(ts);
 }
 
 gnc_numeric
diff --git a/src/engine/Transaction.c b/src/engine/Transaction.c
index 4ac15be..a0b4c15 100644
--- a/src/engine/Transaction.c
+++ b/src/engine/Transaction.c
@@ -62,7 +62,7 @@ struct timeval
 #include "gnc-engine.h"
 #include "gnc-lot.h"
 #include "gnc-event.h"
-#include <gnc-gdate-utils.h>
+#include <gnc-date.h>
 #include "SchedXaction.h"
 #include "gncBusiness.h"
 #include <qofinstance-p.h>
diff --git a/src/engine/gnc-budget.c b/src/engine/gnc-budget.c
index f748f75..c49af4e 100644
--- a/src/engine/gnc-budget.c
+++ b/src/engine/gnc-budget.c
@@ -29,7 +29,6 @@
 #include <time.h>
 #include <qof.h>
 #include <qofbookslots.h>
-#include <gnc-gdate-utils.h>
 #include <qofinstance-p.h>
 
 #include "Account.h"
@@ -89,16 +88,17 @@ static void
 gnc_budget_init(GncBudget* budget)
 {
     BudgetPrivate* priv;
-    GDate date;
+    GDate *date;
 
     priv = GET_PRIVATE(budget);
     priv->name = CACHE_INSERT(_("Unnamed Budget"));
     priv->description = CACHE_INSERT("");
 
     priv->num_periods = 12;
-    gnc_gdate_set_today (&date);
-    g_date_subtract_days(&date, g_date_get_day(&date) - 1);
-    recurrenceSet(&priv->recurrence, 1, PERIOD_MONTH, &date, WEEKEND_ADJ_NONE);
+    date = gnc_g_date_new_today ();
+    g_date_subtract_days(date, g_date_get_day(date) - 1);
+    recurrenceSet(&priv->recurrence, 1, PERIOD_MONTH, date, WEEKEND_ADJ_NONE);
+    g_date_free (date);
 }
 
 static void
diff --git a/src/core-utils/gnc-features.c b/src/engine/gnc-features.c
similarity index 100%
rename from src/core-utils/gnc-features.c
rename to src/engine/gnc-features.c
diff --git a/src/core-utils/gnc-features.h b/src/engine/gnc-features.h
similarity index 100%
rename from src/core-utils/gnc-features.h
rename to src/engine/gnc-features.h
diff --git a/src/core-utils/gnc-uri-utils.c b/src/engine/gnc-uri-utils.c
similarity index 100%
rename from src/core-utils/gnc-uri-utils.c
rename to src/engine/gnc-uri-utils.c
diff --git a/src/core-utils/gnc-uri-utils.h b/src/engine/gnc-uri-utils.h
similarity index 100%
rename from src/core-utils/gnc-uri-utils.h
rename to src/engine/gnc-uri-utils.h
diff --git a/src/engine/test/CMakeLists.txt b/src/engine/test/CMakeLists.txt
index 7fb75f9..19dafe7 100644
--- a/src/engine/test/CMakeLists.txt
+++ b/src/engine/test/CMakeLists.txt
@@ -35,6 +35,7 @@ ADD_ENGINE_TEST(test-commodities test-commodities.cpp)
 
 SET(test_engine_SOURCES
   test-engine.c
+  test-gnc-uri-utils.c
   utest-Account.cpp
   utest-Budget.c
   utest-Entry.c
@@ -109,6 +110,7 @@ SET(test_engine_SOURCES_DIST
         test-employee.c
 	test-engine-kvp-properties.c
         test-engine.c
+        test-gnc-uri-utils.c
         test-group-vs-book.cpp
         test-guid.cpp
         test-job.c
diff --git a/src/engine/test/Makefile.am b/src/engine/test/Makefile.am
index fa264f3..a363e53 100644
--- a/src/engine/test/Makefile.am
+++ b/src/engine/test/Makefile.am
@@ -148,6 +148,7 @@ noinst_DATA: .scm-links
 
 test_engine_SOURCES = \
 	test-engine.c \
+	test-gnc-uri-utils.c \
 	utest-Account.cpp \
 	utest-Budget.c \
 	utest-Entry.c \
diff --git a/src/core-utils/test/test-gnc-uri-utils.c b/src/engine/test/test-gnc-uri-utils.c
similarity index 70%
rename from src/core-utils/test/test-gnc-uri-utils.c
rename to src/engine/test/test-gnc-uri-utils.c
index c94fe6c..5764c94 100644
--- a/src/core-utils/test/test-gnc-uri-utils.c
+++ b/src/engine/test/test-gnc-uri-utils.c
@@ -27,9 +27,12 @@
 
 #include <glib.h>
 #include "qof.h"
-#include "test-stuff.h"
+#include <unittest-support.h>
 #include "gnc-uri-utils.h"
 
+static const gchar *suitename = "engine/uri-utils";
+void test_suite_gnc_uri_utils(void);
+
 struct test_strings_struct
 {
     gchar *uri;
@@ -194,14 +197,11 @@ test_strings strs[] =
     { NULL, FALSE, NULL, NULL, NULL, NULL, NULL, 0, NULL, FALSE },
 };
 
-int
-main(int argc, char **argv)
+/* TEST: gnc_uri_get_components */
+static void
+test_gnc_uri_get_components()
 {
     int i;
-
-    qof_init();
-
-    /* TEST: gnc_uri_get_components */
     for (i = 0; strs[i].uri != NULL; i++)
     {
         gchar *tprotocol = NULL;
@@ -210,141 +210,124 @@ main(int argc, char **argv)
         gchar *tpassword = NULL;
         gchar *tpath     = NULL;
         gint32 tport     = 0;
-        gboolean testresult;
 
         gnc_uri_get_components( strs[i].uri, &tprotocol, &thostname,
                                 &tport, &tusername, &tpassword, &tpath );
-        testresult = ( g_strcmp0 ( tprotocol, strs[i].protocol ) == 0 ) &
-                     ( g_strcmp0 ( thostname, strs[i].hostname ) == 0 ) &
-                     ( g_strcmp0 ( tusername, strs[i].username ) == 0 ) &
-                     ( g_strcmp0 ( tpassword, strs[i].password ) == 0 ) &
-                     ( g_strcmp0 ( tpath, strs[i].path ) == 0 ) &
-                     ( tport == strs[i].port );
-        do_test_args(testresult,
-                     "gnc_uri_get_components",
-                     __FILE__, __LINE__,
-                     "\n  %s:\n"
-                     "    Expected: %s, %s, %s, %s, %s, %d\n"
-                     "    Got     : %s, %s, %s, %s, %s, %d\n",
-                     strs[i].uri, strs[i].protocol, strs[i].hostname,
-                     strs[i].username, strs[i].password, strs[i].path, strs[i].port,
-                     tprotocol, thostname, tusername, tpassword, tpath, tport);
+        g_assert_cmpstr ( tprotocol, ==, strs[i].protocol );
+        g_assert_cmpstr ( thostname, ==, strs[i].hostname );
+        g_assert_cmpstr ( tusername, ==, strs[i].username );
+        g_assert_cmpstr ( tpassword, ==, strs[i].password );
+        g_assert_cmpstr ( tpath, ==, strs[i].path );
+        g_assert_cmpint ( tport, ==, strs[i].port );
+
         g_free(tprotocol);
         g_free(thostname);
         g_free(tusername);
         g_free(tpassword);
         g_free(tpath);
     }
+}
 
-    /* TEST: gnc_uri_get_protocol */
+/* TEST: gnc_uri_get_protocol */
+static void
+test_gnc_uri_get_protocol()
+{
+    int i;
     for (i = 0; strs[i].uri != NULL; i++)
     {
         gchar *tprotocol = NULL;
-        gboolean testresult;
 
         tprotocol = gnc_uri_get_protocol( strs[i].uri );
-        testresult = ( g_strcmp0 ( tprotocol, strs[i].protocol ) == 0 );
-        do_test_args(testresult,
-                     "gnc_uri_get_protocol",
-                     __FILE__, __LINE__,
-                     "\n  %s:\n"
-                     "    Expected: %s\n"
-                     "    Got     : %s\n",
-                     strs[i].uri, strs[i].protocol, tprotocol );
+        g_assert_cmpstr ( tprotocol, ==, strs[i].protocol );
         g_free(tprotocol);
     }
+}
 
-    /* TEST: gnc_uri_get_path */
+/* TEST: gnc_uri_get_path */
+static void
+test_gnc_uri_get_path()
+{
+    int i;
     for (i = 0; strs[i].uri != NULL; i++)
     {
         gchar *tpath = NULL;
-        gboolean testresult;
 
         tpath = gnc_uri_get_path( strs[i].uri );
-        testresult = ( g_strcmp0 ( tpath, strs[i].path ) == 0 );
-        do_test_args(testresult,
-                     "gnc_uri_get_path",
-                     __FILE__, __LINE__,
-                     "\n  %s:\n"
-                     "    Expected: %s\n"
-                     "    Got     : %s\n",
-                     strs[i].uri, strs[i].path, tpath );
+        g_assert_cmpstr ( tpath, ==, strs[i].path );
         g_free(tpath);
     }
+}
 
-    /* TEST: gnc_uri_create_uri */
+/* TEST: gnc_uri_create_uri */
+static void
+test_gnc_uri_create_uri()
+{
+    int i;
     for (i = 0; strs[i].uri != NULL; i++)
     {
         gchar *turi = NULL;
-        gboolean testresult;
 
         turi = gnc_uri_create_uri( strs[i].protocol, strs[i].hostname, strs[i].port,
                                    strs[i].username, strs[i].password, strs[i].path );
-        testresult = ( g_strcmp0 ( turi, strs[i].created_uri ) == 0 );
-        do_test_args(testresult,
-                     "gnc_uri_create_uri",
-                     __FILE__, __LINE__,
-                     "\n  %s, %s, %s, %s, %s, %d:\n"
-                     "    Expected: %s\n"
-                     "    Got     : %s\n",
-                     strs[i].protocol, strs[i].hostname,
-                     strs[i].username, strs[i].password, strs[i].path, strs[i].port,
-                     strs[i].created_uri, turi);
+        g_assert_cmpstr ( turi, ==, strs[i].created_uri );
         g_free(turi);
     }
+}
+
+/* TEST: gnc_uri_normalize_uri */
+static void
+test_gnc_uri_normalize_uri()
+{
+    int i;
 
     /* TEST: gnc_uri_normalize_uri */
     for (i = 0; strs[i].uri != NULL; i++)
     {
         gchar *turi = NULL;
-        gboolean testresult;
 
         turi = gnc_uri_normalize_uri( strs[i].uri, strs[i].want_password );
-        testresult = ( g_strcmp0 ( turi, strs[i].normalized_uri ) == 0 );
-        do_test_args(testresult,
-                     "gnc_uri_normalize_uri",
-                     __FILE__, __LINE__,
-                     "\n  %s:\n"
-                     "    Expected: %s\n"
-                     "    Got     : %s\n",
-                     strs[i].uri, strs[i].normalized_uri, turi );
+        g_assert_cmpstr ( turi, ==, strs[i].normalized_uri );
         g_free(turi);
     }
+}
 
-    /* TEST: gnc_uri_is_file_protocol */
+/* TEST: gnc_uri_is_file_protocol */
+static void
+test_gnc_uri_is_file_protocol()
+{
+    int i;
     for (i = 0; strs[i].uri != NULL; i++)
     {
         gboolean tis_file_protocol;
-        gboolean testresult;
 
         tis_file_protocol = gnc_uri_is_file_protocol( strs[i].protocol );
-        testresult = ( tis_file_protocol == strs[i].is_file_protocol );
-        do_test_args(testresult,
-                     "gnc_uri_is_file_protocol",
-                     __FILE__, __LINE__,
-                     "\n  %s:\n"
-                     "    Expected: %s\n"
-                     "    Got     : %s\n",
-                     strs[i].uri, strs[i].is_file_protocol, tis_file_protocol );
+        g_assert_true ( tis_file_protocol == strs[i].is_file_protocol );;
     }
+}
 
-    /* TEST: gnc_uri_is_file_uri */
+/* TEST: gnc_uri_is_file_uri */
+static void
+test_gnc_uri_is_file_uri()
+{
+    int i;
     for (i = 0; strs[i].uri != NULL; i++)
     {
         gboolean tis_file_uri;
-        gboolean testresult;
 
         tis_file_uri = gnc_uri_is_file_uri( strs[i].uri );
-        testresult = ( tis_file_uri == strs[i].is_file_protocol );
-        do_test_args(testresult,
-                     "gnc_uri_is_file_uri",
-                     __FILE__, __LINE__,
-                     "\n  %s:\n"
-                     "    Expected: %s\n"
-                     "    Got     : %s\n",
-                     strs[i].uri, strs[i].is_file_protocol, tis_file_uri );
+        g_assert_true ( tis_file_uri == strs[i].is_file_protocol );
     }
+}
+
+void
+test_suite_gnc_uri_utils(void)
+{
+    GNC_TEST_ADD_FUNC(suitename, "gnc_uri_get_components()", test_gnc_uri_get_components);
+    GNC_TEST_ADD_FUNC(suitename, "gnc_uri_get_protocol()", test_gnc_uri_get_protocol);
+    GNC_TEST_ADD_FUNC(suitename, "gnc_uri_get_path()", test_gnc_uri_get_path);
+    GNC_TEST_ADD_FUNC(suitename, "gnc_uri_create_uri()", test_gnc_uri_create_uri);
+    GNC_TEST_ADD_FUNC(suitename, "gnc_uri_normalize_uri()", test_gnc_uri_normalize_uri);
+    GNC_TEST_ADD_FUNC(suitename, "gnc_uri_is_file_protocol()", test_gnc_uri_is_file_protocol);
+    GNC_TEST_ADD_FUNC(suitename, "gnc_uri_is_file_uri()", test_gnc_uri_is_file_uri);
 
-    print_test_results();
-    return get_rv();
 }
diff --git a/src/engine/test/utest-Account.cpp b/src/engine/test/utest-Account.cpp
index a0e9c40..b499669 100644
--- a/src/engine/test/utest-Account.cpp
+++ b/src/engine/test/utest-Account.cpp
@@ -26,7 +26,7 @@ extern "C"
 #include <glib.h>
 #include <unittest-support.h>
 #include <gnc-event.h>
-#include <gnc-gdate-utils.h>
+#include <gnc-date.h>
 #include <qofinstance-p.h>
 /* Add specific headers for this class */
 #include "../Account.h"
diff --git a/src/libqof/qof/gnc-date.cpp b/src/libqof/qof/gnc-date.cpp
index ad48810..9fe89ee 100644
--- a/src/libqof/qof/gnc-date.cpp
+++ b/src/libqof/qof/gnc-date.cpp
@@ -1354,8 +1354,28 @@ GDate* gnc_g_date_new_today ()
     auto result = g_date_new_dmy (ymd.day, month, ymd.year);
     g_assert(g_date_valid (result));
     return result;
+}void
+
+gnc_gdate_set_today (GDate* gd)
+{
+    GDate *today = gnc_g_date_new_today ();
+    g_date_set_julian (gd, g_date_get_julian (today));
+    g_date_free (today);
+}
+
+void
+gnc_gdate_set_time64 (GDate* gd, time64 time)
+{
+    struct tm tm;
+    gnc_localtime_r(&time, &tm);
+    g_date_set_dmy (gd, tm.tm_mday,
+                    static_cast<GDateMonth>(tm.tm_mon + 1),
+                    tm.tm_year + 1900);
+
 }
 
+
+
 Timespec gdate_to_timespec (GDate d)
 {
     return gnc_dmy2timespec_neutral (g_date_get_day(&d),
diff --git a/src/libqof/qof/gnc-date.h b/src/libqof/qof/gnc-date.h
index a8b2a63..432a00e 100644
--- a/src/libqof/qof/gnc-date.h
+++ b/src/libqof/qof/gnc-date.h
@@ -259,18 +259,32 @@ gboolean gnc_date_string_to_monthformat(const gchar *format_string,
                                         GNCDateMonthFormat *format);
 
 /** \brief print a time64 as a date string per format
- * \param time
+ * \param time The time64 to print
  * \param format A date format conforming to the strftime format rules.
  * \return a raw heap-allocated char* which must be freed.
  */
 char* gnc_print_time64(time64 time, const char* format);
 
+// @}
+
+/** @name GDate time64 setters
+ *    @{ */
 /** Returns a newly allocated date of the current clock time, taken from
  * time(2). The caller must g_date_free() the object afterwards. */
 GDate* gnc_g_date_new_today (void);
 
+/** Set a GDate to the current day
+ * @param gd The date to act on
+ */
+void gnc_gdate_set_today (GDate* gd);
 
-// @}
+/** Set a GDate to a time64
+ * @param gd the date to act on
+ * @param time the time to set it to.
+ */
+void gnc_gdate_set_time64 (GDate* gd, time64 time);
+
+/** @} */
 
 /* Datatypes *******************************************************/
 

commit 80be96219e7583d31573cdf32f174d6f50fa864e
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Sat Aug 5 12:19:10 2017 +0200

    Fix source file dependency on config.h in engine

diff --git a/src/engine/CMakeLists.txt b/src/engine/CMakeLists.txt
index 4bf6add..e2c54d8 100644
--- a/src/engine/CMakeLists.txt
+++ b/src/engine/CMakeLists.txt
@@ -90,14 +90,6 @@ ADD_CUSTOM_COMMAND (
     ${LIBXSLT_XSLTPROC_EXECUTABLE} -o ${ISO_4217_C} "${CMAKE_CURRENT_SOURCE_DIR}/iso-currencies-to-c.xsl" "${CMAKE_CURRENT_SOURCE_DIR}/iso-4217-currencies.xml"
     )
 ADD_CUSTOM_TARGET(iso-4217-c DEPENDS ${ISO_4217_C})
-# Add dependency on iso-4217-currencies.c
-SET_SOURCE_FILES_PROPERTIES (gnc-commodity.c PROPERTIES OBJECT_DEPENDS "${ISO_4217_C};${CONFIG_H}")
-
-# Add dependency on config.h
-SET_SOURCE_FILES_PROPERTIES (${libgncmod_engine_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
-
-# Add dependency on swig-runtime.h
-SET_SOURCE_FILES_PROPERTIES (gnc-hooks.c engine-helpers.c kvp-scm.cpp glib-helpers.c PROPERTIES OBJECT_DEPENDS "${CONFIG_H};${SWIG_RUNTIME_H}")
 
 SET (engine_SOURCES
   Account.c
@@ -144,8 +136,18 @@ SET (engine_SOURCES
   gncVendor.c
 )
 
+# Add dependency on config.h
+SET_SOURCE_FILES_PROPERTIES (${engine_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
+
+# Add dependency on iso-4217-currencies.c
+SET_SOURCE_FILES_PROPERTIES (gnc-commodity.c PROPERTIES OBJECT_DEPENDS "${ISO_4217_C};${CONFIG_H}")
+
+# Add dependency on swig-runtime.h
+SET_SOURCE_FILES_PROPERTIES (gnc-hooks.c engine-helpers.c kvp-scm.cpp glib-helpers.c PROPERTIES OBJECT_DEPENDS "${CONFIG_H};${SWIG_RUNTIME_H}")
+
+
 
-ADD_LIBRARY	(gncmod-engine
+ADD_LIBRARY (gncmod-engine
   ${engine_SOURCES}
   ${engine_HEADERS}
   ${SWIG_ENGINE_C}
@@ -237,4 +239,4 @@ SET(engine_EXTRA_DIST
         )
 SET_LOCAL_DIST(engine_DIST_local CMakeLists.txt Makefile.am ${engine_SOURCES} ${engine_HEADERS}
                      ${engine_noinst_HEADERS} ${engine_SCHEME_0} ${engine_SCHEME_1} ${engine_EXTRA_DIST})
-SET(engine_DIST ${engine_DIST_local} ${engine_test_core_DIST} ${test_engine_DIST} PARENT_SCOPE)
\ No newline at end of file
+SET(engine_DIST ${engine_DIST_local} ${engine_test_core_DIST} ${test_engine_DIST} PARENT_SCOPE)

commit 342627d5271e4b85f739f1a6675f92052bae0511
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Fri Aug 4 19:17:07 2017 +0200

    Remove the gncmod boilerplate from standard-reports and utility-reports
    
    This adds unnecessary overhead and also serves as an initial experiment
    to greatly reduce the gnc-module based modularization.
    
    Oh, and it fixes the autotools make check failure in standard-reports
    which I introduced in the previous commit. The fix was to either
    fully gnc-modularize business reports or to go to de-gnc-modularize
    standard-reports. I chose the latter as I don't want to add any new
    gnc-modules any more at this point.

diff --git a/configure.ac b/configure.ac
index 05970ed..f1e5c02 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1773,7 +1773,6 @@ AC_CONFIG_FILES(
   src/report/stylesheets/Makefile
   src/report/stylesheets/test/Makefile
   src/report/utility-reports/Makefile
-  src/report/utility-reports/test/Makefile
   src/report/jqplot/Makefile
   src/scm/Makefile
   src/scm/gnumeric/Makefile
@@ -1850,12 +1849,8 @@ AC_CONFIG_FILES([src/report/report-gnome/test/test-load-module],
                 [chmod +x src/report/report-gnome/test/test-load-module])
 AC_CONFIG_FILES([src/report/report-system/test/test-load-module],
                 [chmod +x src/report/report-system/test/test-load-module])
-AC_CONFIG_FILES([src/report/standard-reports/test/test-load-module],
-                [chmod +x src/report/standard-reports/test/test-load-module])
 AC_CONFIG_FILES([src/report/stylesheets/test/test-load-module],
                 [chmod +x src/report/stylesheets/test/test-load-module])
-AC_CONFIG_FILES([src/report/utility-reports/test/test-load-module],
-                [chmod +x src/report/utility-reports/test/test-load-module])
 AC_CONFIG_FILES([src/tax/us/test/test-load-module],
                 [chmod +x src/tax/us/test/test-load-module])
 
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 2e1917d..0ec2b3f 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -275,8 +275,6 @@ src/gnome/top-level.c
 src/gnome/window-autoclear.c
 src/gnome/window-reconcile2.c
 src/gnome/window-reconcile.c
-src/gnome-business/business-gnome.scm
-src/gnome-business/gncmod-business-gnome.c
 src/gnome-search/dialog-search.c
 src/gnome-search/dialog-search.glade
 src/gnome-search/gnc-general-search.c
@@ -640,7 +638,6 @@ src/report/standard-reports/daily-reports.scm
 src/report/standard-reports/equity-statement.scm
 src/report/standard-reports/general-journal.scm
 src/report/standard-reports/general-ledger.scm
-src/report/standard-reports/gncmod-standard-reports.c
 src/report/standard-reports/income-statement.scm
 src/report/standard-reports/net-barchart.scm
 src/report/standard-reports/net-linechart.scm
@@ -659,7 +656,6 @@ src/report/stylesheets/stylesheet-footer.scm
 src/report/stylesheets/stylesheet-head-or-tail.scm
 src/report/stylesheets/stylesheet-plain.scm
 src/report/stylesheets/stylesheets.scm
-src/report/utility-reports/gncmod-utility-reports.c
 src/report/utility-reports/hello-world.scm
 src/report/utility-reports/utility-reports.scm
 src/report/utility-reports/view-column.scm
diff --git a/src/README.modules b/src/README.modules
index 2217859..3bc005b 100644
--- a/src/README.modules
+++ b/src/README.modules
@@ -1,25 +1,22 @@
 -*-text-*-
 
 'Modules' in Gnucash are relatively self-contained segments of code that
-can be dynamically loaded at runtime.  Eventually we want the whole gnucash
-source tree to be a set of modules and the app itself to be a short Scheme
-program that loads them all. 
+can be dynamically loaded at runtime.  While this may have been a great
+design when gnucash was pure guile, it turns out this needlessly complicates
+the current mix of C, C++ and guile. So expect this gnc-module based 
+modularization to be greatly reduced in the future. All the core parts should
+be loadable straight away as dynamic libraries. This is currently not feasible
+so the gnc-module functionality will still be around for some time and perhaps
+forever as a way to extend gnucash with external code.
 
 We're not there yet :) 
 
-core-utils                  The lowest level.  Very basic code.
-                            Should not depend on any other modules.
-                            This module is not a gnc-module (and
-                            perhaps shouldn't be).
-
-Here are the bits that have been converted to use the module system so
-far.
+Here are the bits that are still using the module system so far (this list is probably
+outdated already, but can serve as a starting point to figure out which modules
+can already be de-modularized):.
 
 gnc-module                  The module system (actually not a module itself)
 
-calculation                 Low-level expression parsing & financial
-                            equation solving.
-
 engine                      The engine module, without any backends
 
 backend/xml                 Binary and XML (v1 and v2) backends
@@ -34,14 +31,10 @@ register/register-core      Toolkit independent register code, formerly in
 register/register-gnome     Gnome-specific register code, formerly in 
                             src/register/gnome
 
-import-export/binary-import utils for importing old GnuCash binary files
-
 import-export/qif-import    the old qif importer with Gnome druid 
 import-export/qif-io-core   new qif import/export module.  unfinished.
 
 report/report-system        the report infrastructure and HTML handling 
-report/standard-reports     most of the reports that are in gnucash
-report/utility-reports      the multicolumn view, the iframe report, etc. 
 report/locale-specific-reports  reports that should only be loaded in 
                                 certain locales. subdir per locale. 
 report/stylesheets          predefined style sheet templates 
@@ -50,14 +43,8 @@ report/report-gnome         Gnome gui for displaying reports.
 app-utils                   utils for the gnucash app framework (component 
                             mgr, cmd line processing, gettext stuff, etc)
 
-app-file                    application-level file handling
-
 gnome-utils                 Extensions and utilities for using Gnome/Gtk
                             with GnuCash, including new widgets.
 
-network-utils               Utils for network communication.
-
 tax/us                      US tax information
 
-(RPC was removed in v.1.9.0, subversion release: 12018)
-
diff --git a/src/bin/gnucash-bin.c b/src/bin/gnucash-bin.c
index 9d2ad76..fe4ceec 100644
--- a/src/bin/gnucash-bin.c
+++ b/src/bin/gnucash-bin.c
@@ -505,8 +505,6 @@ load_gnucash_modules()
         { "gnucash/import-export/aqbanking", 0, TRUE },
         { "gnucash/report/report-system", 0, FALSE },
         { "gnucash/report/stylesheets", 0, FALSE },
-        { "gnucash/report/standard-reports", 0, FALSE },
-        { "gnucash/report/utility-reports", 0, FALSE },
         { "gnucash/report/locale-specific/us", 0, FALSE },
         { "gnucash/report/report-gnome", 0, FALSE },
         { "gnucash/gtkmm", 0, TRUE },
diff --git a/src/bin/overrides/gnucash-build-env.in b/src/bin/overrides/gnucash-build-env.in
index 8e3aaeb..58f6112 100644
--- a/src/bin/overrides/gnucash-build-env.in
+++ b/src/bin/overrides/gnucash-build-env.in
@@ -39,9 +39,6 @@ eval `${top_srcdir}/src/gnc-test-env.pl \
   --gnc-module-dir ${top_builddir}/src/app-utils \
   --gnc-module-dir ${top_builddir}/src/gnome-utils \
   --gnc-module-dir ${top_builddir}/src/gnome-search \
-  --gnc-module-dir ${top_builddir}/src/report/report-system \
-  --gnc-module-dir ${top_builddir}/src/report/standard-reports \
-  --gnc-module-dir ${top_builddir}/src/report/utility-reports \
   --gnc-module-dir ${top_builddir}/src/report/locale-specific/us \
   --gnc-module-dir ${top_builddir}/src/report/report-gnome \
   --gnc-module-dir ${top_builddir}/src/report/stylesheets \
diff --git a/src/cmake_modules/MakeDistFiles.cmake b/src/cmake_modules/MakeDistFiles.cmake
index 3e91e29..fbddb2a 100644
--- a/src/cmake_modules/MakeDistFiles.cmake
+++ b/src/cmake_modules/MakeDistFiles.cmake
@@ -78,9 +78,7 @@ SET(COPY_FROM_BUILD
   src/report/report-gnome/test/test-load-module
   src/report/report-system/swig-report-system.c
   src/report/report-system/test/test-load-module
-  src/report/standard-reports/test/test-load-module
   src/report/stylesheets/test/test-load-module
-  src/report/utility-reports/test/test-load-module
   src/scm/build-config.scm
   src/swig-runtime.h
   src/test-core/swig-unittest-support-guile.c
diff --git a/src/engine/gnc-engine.c b/src/engine/gnc-engine.c
index f732750..fd6bf11 100644
--- a/src/engine/gnc-engine.c
+++ b/src/engine/gnc-engine.c
@@ -91,7 +91,7 @@ gnc_engine_init_part2()
 #ifdef WIN32
 #define LIBDIR "bin"
 #else
-#define LIBDIR "lib"
+#define LIBDIR "lib/gnucash"
 #endif
 #else
         pkglibdir = g_build_path (G_DIR_SEPARATOR_S, builddir,
diff --git a/src/report/business-reports/CMakeLists.txt b/src/report/business-reports/CMakeLists.txt
index 83bc14d..9e67d08 100644
--- a/src/report/business-reports/CMakeLists.txt
+++ b/src/report/business-reports/CMakeLists.txt
@@ -31,7 +31,7 @@ SET(GUILE_LOAD_DIRS    src/app-utils src/core-utils src/engine src/gnc-module sr
                          src/report/business_reports src/report/report-system src/report/standard-reports)
 SET(GUILE_LIBRARY_DIRS src/app-utils src/core-utils src/engine src/gnc-module src/gnome-utils src/report/report-system
                          src/report/standard-reports)
-SET(GUILE_DEPENDS      scm-business-reports-links gncmod-standard-reports scm-standard-reports)
+SET(GUILE_DEPENDS      scm-business-reports-links scm-standard-reports)
 
 GNC_ADD_SCHEME_TARGETS(scm-business-reports
   "${business_reports_SCHEME}"
diff --git a/src/report/business-reports/Makefile.am b/src/report/business-reports/Makefile.am
index babf228..a15a37a 100644
--- a/src/report/business-reports/Makefile.am
+++ b/src/report/business-reports/Makefile.am
@@ -53,8 +53,6 @@ GUILE_COMPILE_ENV = \
   --gnc-module-dir ${top_builddir}/src/gnome-utils \
   --gnc-module-dir ${top_builddir}/src/html \
   --gnc-module-dir ${top_builddir}/src/report/report-system \
-  --gnc-module-dir ${top_builddir}/src/report/standard-reports \
-  --gnc-module-dir ${top_builddir}/src/report/business-reports \
   --guile-load-dir ${top_builddir}/src/app-utils \
   --guile-load-dir ${top_builddir}/src/core-utils \
   --guile-load-dir ${top_builddir}/src/engine \
@@ -73,8 +71,7 @@ GUILE_COMPILE_ENV = \
   --library-dir    ${top_builddir}/src/backend/sql \
   --library-dir    ${top_builddir}/src/html \
   --library-dir    ${top_builddir}/src/gnc-module \
-  --library-dir    ${top_builddir}/src/report/report-system \
-  --library-dir    ${top_builddir}/src/report/business-reports
+  --library-dir    ${top_builddir}/src/report/report-system
 
 
 %.go : %.scm .scm-links $(pkglib_LTLIBRARIES)
diff --git a/src/report/business-reports/business-reports.scm b/src/report/business-reports/business-reports.scm
index 48e8d02..03d7cd3 100644
--- a/src/report/business-reports/business-reports.scm
+++ b/src/report/business-reports/business-reports.scm
@@ -27,7 +27,7 @@
 (use-modules (gnucash gnc-module))
 (use-modules (gnucash app-utils))
 (use-modules (gnucash report report-system))
-(gnc:module-load "gnucash/report/standard-reports" 0)
+(use-modules (gnucash report standard-reports))
 
 ;; to define gnc-build-url
 (gnc:module-load "gnucash/html" 0)
diff --git a/src/report/report-gnome/CMakeLists.txt b/src/report/report-gnome/CMakeLists.txt
index 263b294..f6223e8 100644
--- a/src/report/report-gnome/CMakeLists.txt
+++ b/src/report/report-gnome/CMakeLists.txt
@@ -53,7 +53,7 @@ SET(GUILE_OUTPUT_DIR   gnucash/report)
 SET(GUILE_MODULES      src/app-utils src/scm src/engine src/gnc-module src/gnome-utils src/reports/report-system src/report/utility-reports)
 SET(GUILE_LOAD_DIRS    src/app-utils src/gnc-module src/engine src/scm src/core-utils src/gnome-utils)
 SET(GUILE_LIBRARY_DIRS src/app-utils src/core-utils src/engine src/gnc-module src/gnome-utils src/report-gnome)
-SET(GUILE_DEPENDS      gncmod-report-gnome gncmod-engine scm-app-utils scm-gnome-utils scm-core-utils scm-gnc-module scm-scm)
+SET(GUILE_DEPENDS      gncmod-report-gnome gncmod-engine scm-app-utils scm-gnome-utils scm-core-utils scm-gnc-module scm-scm scm-standard-reports scm-business-reports scm-utility-reports)
 
 GNC_ADD_SCHEME_TARGETS(scm-report-gnome
     "${report_gnome_SCHEME}"
diff --git a/src/report/report-gnome/Makefile.am b/src/report/report-gnome/Makefile.am
index 9c2a163..39a7bf3 100644
--- a/src/report/report-gnome/Makefile.am
+++ b/src/report/report-gnome/Makefile.am
@@ -109,11 +109,15 @@ if GNC_HAVE_GUILE_2
 GUILE_COMPILE_ENV = \
   --gnc-module-dir ${top_builddir}/src/app-utils \
   --gnc-module-dir ${top_builddir}/src/engine \
+  --gnc-module-dir ${top_builddir}/src/html \
+  --gnc-module-dir ${top_builddir}/src/report/report-system \
   --guile-load-dir ${top_builddir}/src/app-utils \
   --guile-load-dir ${top_builddir}/src/core-utils \
   --guile-load-dir ${top_builddir}/src/engine \
   --guile-load-dir ${top_builddir}/src/gnc-module \
   --guile-load-dir ${top_builddir}/src/gnome-utils \
+  --guile-load-dir ${top_builddir}/src/report/report-system \
+  --guile-load-dir ${top_builddir}/src/report/utility-reports \
   --guile-load-dir ${top_builddir}/src/scm \
   --library-dir    ${top_builddir}/src/engine \
   --library-dir    ${top_builddir}/src/libqof/qof \
diff --git a/src/report/report-gnome/gncmod-report-gnome.c b/src/report/report-gnome/gncmod-report-gnome.c
index ea04c2c..70da204 100644
--- a/src/report/report-gnome/gncmod-report-gnome.c
+++ b/src/report/report-gnome/gncmod-report-gnome.c
@@ -87,6 +87,11 @@ libgncmod_report_gnome_gnc_module_init(int refcount)
     {
         return FALSE;
     }
+
+    lmod ("(gnucash report standard-reports)");
+    lmod ("(gnucash report business-reports)");
+    lmod ("(gnucash report utility-reports)");
+
     scm_init_sw_report_gnome_module();
 
     lmod ("(sw_report_gnome)");
diff --git a/src/report/report-gnome/report-gnome.scm b/src/report/report-gnome/report-gnome.scm
index 460d558..5f07220 100644
--- a/src/report/report-gnome/report-gnome.scm
+++ b/src/report/report-gnome/report-gnome.scm
@@ -29,6 +29,7 @@
 (use-modules (gnucash gnc-module))
 (use-modules (gnucash gnome-utils))
 (use-modules (gnucash gettext))
+(use-modules (gnucash report utility-reports))
 
 (use-modules (gnucash printf))
 
@@ -43,7 +44,6 @@
 
 (gnc:module-load "gnucash/gnome-utils" 0)
 (gnc:module-load "gnucash/report/report-system" 0)
-(gnc:module-load "gnucash/report/utility-reports" 0)
 
 (export gnc:report-menu-setup)
 (export gnc:add-report-template-menu-items)
diff --git a/src/report/report-gnome/test/Makefile.am b/src/report/report-gnome/test/Makefile.am
index 103a4fb..1c08979 100644
--- a/src/report/report-gnome/test/Makefile.am
+++ b/src/report/report-gnome/test/Makefile.am
@@ -25,7 +25,6 @@ GNC_TEST_DEPS = --gnc-module-dir ${top_builddir}/src/engine \
   --gnc-module-dir ${top_builddir}/src/gnome-utils \
   --gnc-module-dir ${top_builddir}/src/html \
   --gnc-module-dir ${top_builddir}/src/report/report-system \
-  --gnc-module-dir ${top_builddir}/src/report/utility-reports \
   --gnc-module-dir ${top_builddir}/src/report/report-gnome \
 \
   --guile-load-dir ${top_builddir}/src/gnc-module \
@@ -35,6 +34,8 @@ GNC_TEST_DEPS = --gnc-module-dir ${top_builddir}/src/engine \
   --guile-load-dir ${top_builddir}/src/app-utils \
   --guile-load-dir ${top_builddir}/src/gnome-utils \
   --guile-load-dir ${top_builddir}/src/report/report-system \
+  --guile-load-dir ${top_builddir}/src/report/standard-reports \
+  --guile-load-dir ${top_builddir}/src/report/business-reports \
   --guile-load-dir ${top_builddir}/src/report/utility-reports \
   --guile-load-dir ${top_builddir}/src/report/report-gnome \
 \
diff --git a/src/report/standard-reports/CMakeLists.txt b/src/report/standard-reports/CMakeLists.txt
index ce8bd36..159e67c 100644
--- a/src/report/standard-reports/CMakeLists.txt
+++ b/src/report/standard-reports/CMakeLists.txt
@@ -1,26 +1,6 @@
 
 ADD_SUBDIRECTORY(test)
 
-SET(standard_reports_SOURCES gncmod-standard-reports.c)
-
-ADD_LIBRARY (gncmod-standard-reports ${standard_reports_SOURCES})
-
-TARGET_LINK_LIBRARIES(gncmod-standard-reports gnc-module ${GTK3_LDFLAGS})
-
-TARGET_COMPILE_DEFINITIONS(gncmod-standard-reports PRIVATE -DG_LOG_DOMAIN=\"gnc.report.standard\")
-
-TARGET_INCLUDE_DIRECTORIES(gncmod-standard-reports PRIVATE ${GUILE_INCLUDE_DIRS})
-
-INSTALL(TARGETS gncmod-standard-reports
-  LIBRARY DESTINATION lib/gnucash
-  ARCHIVE DESTINATION lib/gnucash
-  RUNTIME DESTINATION bin)
-
-# No headers to install
-
-
-# Scheme
-
 SET (standard_reports_SCHEME standard-reports.scm)
 
 SET (standard_reports_SCHEME_2
@@ -56,7 +36,7 @@ SET(GUILE_LOAD_DIRS    src/app-utils src/engine src/core-utils src/gnc-module sr
 SET(GUILE_LIBRARY_DIRS src/app-utils src/engine src/core-utils src/gnc-module src/gnome-utils src/report/report-system)
 SET(GUILE_DEPENDS      gncmod-html scm-app-utils scm-gnome-utils scm-report-system scm-report-system-3)
 
-GNC_ADD_SCHEME_TARGETS(scm-standard-reports
+GNC_ADD_SCHEME_TARGETS(scm-standard-reports-1
   "${standard_reports_SCHEME}"
   "gnucash/report"
   "${GUILE_MODULES}"
@@ -76,6 +56,8 @@ GNC_ADD_SCHEME_TARGETS(scm-standard-reports-2
   TRUE
 )
 
+ADD_CUSTOM_TARGET(scm-standard-reports ALL DEPENDS scm-standard-reports-2 scm-standard-reports)
+
 # FIXME: This is a hack since core-utils assumes an autotools build environment.
 
 SET(STD_RPT_DIR ${CMAKE_CURRENT_BINARY_DIR}/gnucash/report)
@@ -85,5 +67,5 @@ FILE(COPY standard-reports.scm DESTINATION ${STD_RPT_DIR})
 FILE(MAKE_DIRECTORY ${STD_RPT_DIR}/standard-reports)
 FILE(COPY ${standard_reports_SCHEME_2} DESTINATION ${STD_RPT_DIR}/standard-reports)
 
-SET_LOCAL_DIST(standard_reports_DIST_local CMakeLists.txt Makefile.am ${standard_reports_SOURCES} ${standard_reports_SCHEME} ${standard_reports_SCHEME_2})
+SET_LOCAL_DIST(standard_reports_DIST_local CMakeLists.txt Makefile.am ${standard_reports_SCHEME} ${standard_reports_SCHEME_2})
 SET(standard_reports_DIST ${standard_reports_DIST_local} ${test_standard_reports_DIST} PARENT_SCOPE)
diff --git a/src/report/standard-reports/Makefile.am b/src/report/standard-reports/Makefile.am
index e9678ce..42f215c 100644
--- a/src/report/standard-reports/Makefile.am
+++ b/src/report/standard-reports/Makefile.am
@@ -1,23 +1,5 @@
 SUBDIRS = . test
 
-pkglib_LTLIBRARIES = libgncmod-standard-reports.la
-
-libgncmod_standard_reports_la_SOURCES = \
-  gncmod-standard-reports.c
-
-libgncmod_standard_reports_la_LDFLAGS = -avoid-version
-
-libgncmod_standard_reports_la_LIBADD = \
-  ${top_builddir}/src/gnc-module/libgnc-module.la \
-  ${GUILE_LIBS} \
-  ${GLIB_LIBS}
-
-AM_CPPFLAGS = \
-  -I${top_srcdir}/src \
-  -I${top_srcdir}/src/gnc-module \
-  ${GUILE_CFLAGS} \
-  ${GLIB_CFLAGS}
-
 gncscmmoddir = ${GNC_SCM_INSTALL_DIR}/gnucash/report/
 gncscmmod_DATA = \
    standard-reports.scm
@@ -81,7 +63,6 @@ GUILE_COMPILE_ENV = \
   --gnc-module-dir ${top_builddir}/src/gnome-utils \
   --gnc-module-dir ${top_builddir}/src/html \
   --gnc-module-dir ${top_builddir}/src/report/report-system \
-  --gnc-module-dir ${top_builddir}/src/report/standard-reports \
   --guile-load-dir ${top_builddir}/src/app-utils \
   --guile-load-dir ${top_builddir}/src/core-utils \
   --guile-load-dir ${top_builddir}/src/engine \
@@ -99,8 +80,7 @@ GUILE_COMPILE_ENV = \
   --library-dir    ${top_builddir}/src/backend/xml \
   --library-dir    ${top_builddir}/src/backend/sql \
   --library-dir    ${top_builddir}/src/html \
-  --library-dir    ${top_builddir}/src/report/report-system \
-  --library-dir    ${top_builddir}/src/report/standard-reports
+  --library-dir    ${top_builddir}/src/report/report-system
 
 %.go : %.scm .scm-links $(pkglib_LTLIBRARIES)
 	GNC_UNINSTALLED=yes \
@@ -127,10 +107,9 @@ EXTRA_DIST = \
 
 CLEANFILES = \
 	.scm-links \
-	${SCM_FILE_LINK} \
 	${gncscmmodcache_DATA} \
 	${gncscmrptcache_DATA}
 
-DISTCLEANFILES =
+DISTCLEANFILES = ${SCM_FILE_LINKS}
 
-AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.report.standard\"
+AM_CPPFLAGS = -DG_LOG_DOMAIN=\"gnc.report.standard\"
diff --git a/src/report/standard-reports/gncmod-standard-reports.c b/src/report/standard-reports/gncmod-standard-reports.c
deleted file mode 100644
index 43bdf67..0000000
--- a/src/report/standard-reports/gncmod-standard-reports.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/*********************************************************************
- * gncmod-standard-reports.c
- * module definition/initialization for the standard reports
- *
- * 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 at gnu.org                   *
- *                                                                  *
-\********************************************************************/
-
-
-#include "config.h"
-#include <gmodule.h>
-#include <libguile.h>
-
-#include "gnc-module.h"
-#include "gnc-module-api.h"
-
-GNC_MODULE_API_DECL(libgncmod_standard_reports)
-
-/* version of the gnc module system interface we require */
-int libgncmod_standard_reports_gnc_module_system_interface = 0;
-
-/* module versioning uses libtool semantics. */
-int libgncmod_standard_reports_gnc_module_current  = 0;
-int libgncmod_standard_reports_gnc_module_revision = 0;
-int libgncmod_standard_reports_gnc_module_age      = 0;
-
-
-char *
-libgncmod_standard_reports_gnc_module_path(void)
-{
-    return g_strdup("gnucash/report/standard-reports");
-}
-
-char *
-libgncmod_standard_reports_gnc_module_description(void)
-{
-    return g_strdup("Standard income, asset, balance sheet, etc. reports");
-}
-
-int
-libgncmod_standard_reports_gnc_module_init(int refcount)
-{
-    /* load the report system */
-    if (!gnc_module_load("gnucash/report/report-system", 0))
-    {
-        return FALSE;
-    }
-
-    /* load the report generation scheme code */
-    if (scm_c_eval_string("(use-modules (gnucash report standard-reports))") ==
-            SCM_BOOL_F)
-    {
-        return FALSE;
-    }
-    if (scm_c_eval_string("(use-modules (gnucash report business-reports))") ==
-            SCM_BOOL_F)
-    {
-        return FALSE;
-    }
-    return TRUE;
-}
-
-int
-libgncmod_standard_reports_gnc_module_end(int refcount)
-{
-    return TRUE;
-}
diff --git a/src/report/standard-reports/test/CMakeLists.txt b/src/report/standard-reports/test/CMakeLists.txt
index a54d495..a771186 100644
--- a/src/report/standard-reports/test/CMakeLists.txt
+++ b/src/report/standard-reports/test/CMakeLists.txt
@@ -1,9 +1,7 @@
-CONFIGURE_FILE(test-load-module.in test-load-module @ONLY)
 GNC_ADD_SCHEME_TEST(test-cash-flow test-cash-flow.scm)
 GNC_ADD_SCHEME_TEST(test-standard-category-report test-standard-category-report.scm)
 GNC_ADD_SCHEME_TEST(test-standard-net-barchart test-standard-net-barchart.scm)
 GNC_ADD_SCHEME_TEST(test-standard-net-linechart test-standard-net-linechart.scm)
-GNC_ADD_SCHEME_TEST(test-load-module-report-standard-reports test-load-module.in)
 
 SET(scm_test_standard_reports_SOURCES
   test-generic-category-report.scm
@@ -22,5 +20,5 @@ GNC_ADD_SCHEME_TARGETS(scm-test-standard-reports
 )
 
 SET_DIST_LIST(test_standard_reports_DIST CMakeLists.txt Makefile.am ${scm_test_standard_reports_SOURCES}
-        test-load-module.in test-cash-flow.scm test-standard-category-report.scm test-standard-net-barchart.scm
+        test-cash-flow.scm test-standard-category-report.scm test-standard-net-barchart.scm
         test-standard-net-linechart.scm)
diff --git a/src/report/standard-reports/test/Makefile.am b/src/report/standard-reports/test/Makefile.am
index 547738a..e98cb85 100644
--- a/src/report/standard-reports/test/Makefile.am
+++ b/src/report/standard-reports/test/Makefile.am
@@ -1,6 +1,4 @@
-MODULE_TESTS=test-load-module
-
-TESTS = $(SCM_TESTS) $(MODULE_TESTS)
+TESTS = $(SCM_TESTS)
 
 SCM_TESTS = \
 	test-cash-flow \
@@ -19,8 +17,6 @@ GNC_TEST_DEPS = \
   --gnc-module-dir ${top_builddir}/src/report/app-utils \
   --gnc-module-dir ${top_builddir}/src/report/report-system \
   --gnc-module-dir ${top_builddir}/src/report/report-system/test \
-  --gnc-module-dir ${top_builddir}/src/report/standard-reports \
-  --gnc-module-dir ${top_builddir}/src/report/standard-reports/test \
 \
   --guile-load-dir ${top_builddir}/src/gnc-module \
   --guile-load-dir ${top_builddir}/src/scm \
@@ -35,7 +31,6 @@ GNC_TEST_DEPS = \
   --guile-load-dir ${top_builddir}/src/report/standard-reports/test \
 \
   --library-dir    ${top_builddir}/src/report/report-system \
-  --library-dir    ${top_builddir}/src/report/standard-reports \
   --library-dir    ${top_builddir}/src/libqof/qof \
   --library-dir    ${top_builddir}/src/core-utils \
   --library-dir    ${top_builddir}/src/app-utils \
@@ -64,7 +59,6 @@ SCM_TEST_HELPERS = \
 	test-generic-net-linechart.scm
 
 EXTRA_DIST = \
-	test-load-module \
 	$(SCM_TEST_HELPERS) \
 	$(SCM_TEST_SRCS) \
 	CMakeLists.txt
diff --git a/src/report/standard-reports/test/test-load-module.in b/src/report/standard-reports/test/test-load-module.in
deleted file mode 100755
index 5f32565..0000000
--- a/src/report/standard-reports/test/test-load-module.in
+++ /dev/null
@@ -1,20 +0,0 @@
-#! @SHELL@ 
-exec ${GUILE} -s "$0"
-!#
-
-(display "  testing standard report module load ... ")
-(setenv "GNC_UNINSTALLED" "1")
-(use-modules (gnucash gnc-module))
-(gnc:module-system-init)
-
-(if (gnc:module-load "gnucash/report/standard-reports" 0)
-    (begin 
-      (display "ok\n")
-      (exit 0))
-    (begin 
-      (display "failed\n")
-      (exit -1)))
-
-
- 
-
diff --git a/src/report/utility-reports/CMakeLists.txt b/src/report/utility-reports/CMakeLists.txt
index 3caa0c3..2c0a4aa 100644
--- a/src/report/utility-reports/CMakeLists.txt
+++ b/src/report/utility-reports/CMakeLists.txt
@@ -1,30 +1,3 @@
-ADD_SUBDIRECTORY(test)
-
-SET(utility_reports_SOURCES
-  gncmod-utility-reports.c
-)
-
-ADD_LIBRARY(gncmod-utility-reports MODULE ${utility_reports_SOURCES})
-
-TARGET_LINK_LIBRARIES(gncmod-utility-reports gnc-module ${GUILE_LDFLAGS} ${GLIB2_LDFLAGS})
-
-TARGET_COMPILE_DEFINITIONS(gncmod-utility-reports PRIVATE -DG_LOG_DOMAIN=\"gnc.report.util\")
-
-TARGET_INCLUDE_DIRECTORIES(gncmod-utility-reports
-    PRIVATE ${GUILE_INCLUDE_DIRS}
-)
-
-SET(LIB_DIR lib/gnucash)
-IF (WIN32)
-  SET(LIB_DIR bin)
-ENDIF(WIN32)
-
-
-INSTALL(TARGETS gncmod-utility-reports
-  LIBRARY DESTINATION ${LIB_DIR}
-  ARCHIVE DESTINATION ${LIB_DIR}
-  RUNTIME DESTINATION bin)
-
 # Scheme
 
 SET(utility_reports_SCHEME
@@ -53,5 +26,5 @@ GNC_ADD_SCHEME_TARGETS(scm-utility-reports
 )
 
 SET_LOCAL_DIST(utility_reports_DIST_local CMakeLists.txt Makefile.am
-        ${utility_reports_SOURCES} ${utility_reports_SCHEME})
+        ${utility_reports_SCHEME})
 SET(utility_reports_DIST ${utility_reports_DIST_local} ${test_utility_reports_DIST} PARENT_SCOPE)
diff --git a/src/report/utility-reports/Makefile.am b/src/report/utility-reports/Makefile.am
index 5fc4770..686d6a0 100644
--- a/src/report/utility-reports/Makefile.am
+++ b/src/report/utility-reports/Makefile.am
@@ -1,21 +1,3 @@
-SUBDIRS = . test
-
-pkglib_LTLIBRARIES = libgncmod-utility-reports.la
-
-libgncmod_utility_reports_la_SOURCES = \
-  gncmod-utility-reports.c 
-libgncmod_utility_reports_la_LIBADD = \
-  ${top_builddir}/src/gnc-module/libgnc-module.la \
-  ${GUILE_LIBS} \
-  ${GLIB_LIBS}
-
-libgncmod_utility_reports_la_LDFLAGS = -module -avoid-version
-
-AM_CPPFLAGS = \
-  -I${top_srcdir}/src \
-  -I${top_srcdir}/src/gnc-module \
-  ${GUILE_CFLAGS} ${GLIB_CFLAGS}
-
 gncscmmoddir = ${GNC_SCM_INSTALL_DIR}/gnucash/report/
 gncscmmod_DATA = \
   hello-world.scm \
@@ -53,7 +35,6 @@ GUILE_COMPILE_ENV = \
   --gnc-module-dir ${top_builddir}/src/gnome-utils \
   --gnc-module-dir ${top_builddir}/src/html \
   --gnc-module-dir ${top_builddir}/src/report/report-system \
-  --gnc-module-dir ${top_builddir}/src/report/utility-reports \
   --guile-load-dir ${top_builddir}/src/app-utils \
   --guile-load-dir ${top_builddir}/src/core-utils \
   --guile-load-dir ${top_builddir}/src/engine \
@@ -71,8 +52,7 @@ GUILE_COMPILE_ENV = \
   --library-dir    ${top_builddir}/src/backend/xml \
   --library-dir    ${top_builddir}/src/backend/sql \
   --library-dir    ${top_builddir}/src/html \
-  --library-dir    ${top_builddir}/src/report/report-system \
-  --library-dir    ${top_builddir}/src/report/utility-reports
+  --library-dir    ${top_builddir}/src/report/report-system
 
 %.go : %.scm .scm-links $(pkglib_LTLIBRARIES)
 	GNC_UNINSTALLED=yes \
@@ -94,4 +74,4 @@ EXTRA_DIST = ${gncscmmod_DATA} CMakeLists.txt
 CLEANFILES = .scm-links ${gncscmmodcache_DATA}
 DISTCLEANFILES = ${SCM_FILE_LINKS}
 
-AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.report.util\"
+AM_CPPFLAGS = -DG_LOG_DOMAIN=\"gnc.report.util\"
diff --git a/src/report/utility-reports/gncmod-utility-reports.c b/src/report/utility-reports/gncmod-utility-reports.c
deleted file mode 100644
index a1cc3b2..0000000
--- a/src/report/utility-reports/gncmod-utility-reports.c
+++ /dev/null
@@ -1,81 +0,0 @@
-/*********************************************************************
- * gncmod-utility-reports.c
- * module definition/initialization for the utility reports
- *
- * 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 at gnu.org                   *
- *                                                                  *
-\********************************************************************/
-
-
-#include "config.h"
-#include <gmodule.h>
-#include <libguile.h>
-
-#include "gnc-module.h"
-#include "gnc-module-api.h"
-
-GNC_MODULE_API_DECL(libgncmod_utility_reports)
-
-/* version of the gnc module system interface we require */
-int libgncmod_utility_reports_gnc_module_system_interface = 0;
-
-/* module versioning uses libtool semantics. */
-int libgncmod_utility_reports_gnc_module_current  = 0;
-int libgncmod_utility_reports_gnc_module_revision = 0;
-int libgncmod_utility_reports_gnc_module_age      = 0;
-
-
-char *
-libgncmod_utility_reports_gnc_module_path(void)
-{
-    return g_strdup("gnucash/report/utility-reports");
-}
-
-char *
-libgncmod_utility_reports_gnc_module_description(void)
-{
-    return g_strdup("Non-financial (utility) reports");
-}
-
-int
-libgncmod_utility_reports_gnc_module_init(int refcount)
-{
-    /* load the report system */
-    if (!gnc_module_load("gnucash/report/report-system", 0))
-    {
-        return FALSE;
-    }
-
-    /* load the report generation scheme code */
-    if (scm_c_eval_string("(use-modules (gnucash report utility-reports))") ==
-            SCM_BOOL_F)
-    {
-        return FALSE;
-    }
-
-    return TRUE;
-}
-
-int
-libgncmod_utility_reports_gnc_module_end(int refcount)
-{
-    return TRUE;
-}
diff --git a/src/report/utility-reports/test/CMakeLists.txt b/src/report/utility-reports/test/CMakeLists.txt
deleted file mode 100644
index 15ff2fd..0000000
--- a/src/report/utility-reports/test/CMakeLists.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-CONFIGURE_FILE(test-load-module.in test-load-module @ONLY)
-GNC_ADD_SCHEME_TEST(test-load-module-report-utility-reports
-  test-load-module.in
-)
-
-SET_DIST_LIST(test_utility_reports_DIST CMakeLists.txt Makefile.am test-load-module.in)
\ No newline at end of file
diff --git a/src/report/utility-reports/test/Makefile.am b/src/report/utility-reports/test/Makefile.am
deleted file mode 100644
index fbfc3ff..0000000
--- a/src/report/utility-reports/test/Makefile.am
+++ /dev/null
@@ -1,35 +0,0 @@
-TESTS = test-load-module
-
-GNC_TEST_DEPS = --gnc-module-dir ${top_builddir}/src/engine \
-  --gnc-module-dir ${top_builddir}/src/app-utils \
-  --gnc-module-dir ${top_builddir}/src/gnome-utils \
-  --gnc-module-dir ${top_builddir}/src/html \
-  --gnc-module-dir ${top_builddir}/src/report/report-system \
-  --gnc-module-dir ${top_builddir}/src/report/utility-reports \
-\
-  --guile-load-dir ${top_builddir}/src/gnc-module \
-  --guile-load-dir ${top_builddir}/src/scm \
-  --guile-load-dir ${top_builddir}/src/engine \
-  --guile-load-dir ${top_builddir}/src/core-utils \
-  --guile-load-dir ${top_builddir}/src/app-utils \
-  --guile-load-dir ${top_builddir}/src/gnome-utils \
-  --guile-load-dir ${top_builddir}/src/report/report-system \
-  --guile-load-dir ${top_builddir}/src/report/utility-reports \
-\
-  --library-dir    ${top_builddir}/src/report/report-system \
-  --library-dir    ${top_builddir}/src/libqof/qof \
-  --library-dir    ${top_builddir}/src/core-utils \
-  --library-dir    ${top_builddir}/src/app-utils \
-  --library-dir    ${top_builddir}/src/gnome-utils \
-  --library-dir    ${top_builddir}/src/engine \
-  --library-dir    ${top_builddir}/src/backend/xml \
-  --library-dir    ${top_builddir}/src/backend/sql \
-  --library-dir    ${top_builddir}/src/gnc-module
-
-TESTS_ENVIRONMENT = \
-  GUILE_WARN_DEPRECATED=no \
-  GUILE="${GUILE}" \
-  GNC_BUILDDIR="${abs_top_builddir}" \
-  $(shell ${abs_top_srcdir}/src/gnc-test-env.pl --noexports ${GNC_TEST_DEPS})
-
-EXTRA_DIST = test-load-module CMakeLists.txt
diff --git a/src/report/utility-reports/test/test-load-module.in b/src/report/utility-reports/test/test-load-module.in
deleted file mode 100755
index 1140b3b..0000000
--- a/src/report/utility-reports/test/test-load-module.in
+++ /dev/null
@@ -1,20 +0,0 @@
-#! @SHELL@ 
-exec ${GUILE} -s "$0"
-!#
-
-(display "  testing utility report module load ... ")
-(setenv "GNC_UNINSTALLED" "1")
-(use-modules (gnucash gnc-module))
-(gnc:module-system-init)
-
-(if (gnc:module-load "gnucash/report/utility-reports" 0)
-    (begin 
-      (display "ok\n")
-      (exit 0))
-    (begin 
-      (display "failed\n")
-      (exit -1)))
-
-
- 
-

commit f71317626d32c1c7555cfee96aef3f5bf4e83c27
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Fri Jul 21 19:51:55 2017 +0200

    Integrate gnome-business into gnome
    
    This breaks autotools' make check, which will be fixed in a subsequent commit.

diff --git a/configure.ac b/configure.ac
index 337f01c..05970ed 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1781,7 +1781,6 @@ AC_CONFIG_FILES(
   src/tax/us/Makefile
   src/tax/us/test/Makefile
   src/test-core/Makefile
-  src/gnome-business/Makefile
   dnl # Stuff for bill/invoice import plugin
   src/plugins/Makefile
   src/plugins/bi_import/Makefile
diff --git a/po/POTFILES.in b/po/POTFILES.in
index a4e7988..2e1917d 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -179,14 +179,26 @@ src/gnome/assistant-acct-period.c
 src/gnome/assistant-hierarchy.c
 src/gnome/assistant-loan.c
 src/gnome/assistant-stock-split.c
+src/gnome/business-gnome-utils.c
+src/gnome/business-options-gnome.c
+src/gnome/business-urls.c
+src/gnome/dialog-billterms.c
+src/gnome/dialog-choose-owner.c
 src/gnome/dialog-commodities.c
+src/gnome/dialog-customer.c
+src/gnome/dialog-date-close.c
+src/gnome/dialog-employee.c
 src/gnome/dialog-fincalc.c
 src/gnome/dialog-find-account.c
 src/gnome/dialog-find-transactions2.c
 src/gnome/dialog-find-transactions.c
 src/gnome/dialog-imap-editor.c
+src/gnome/dialog-invoice.c
+src/gnome/dialog-job.c
 src/gnome/dialog-lot-viewer.c
 src/gnome/dialog-new-user.c
+src/gnome/dialog-order.c
+src/gnome/dialog-payment.c
 src/gnome/dialog-price-edit-db.c
 src/gnome/dialog-price-editor.c
 src/gnome/dialog-print-check.c
@@ -197,12 +209,16 @@ src/gnome/dialog-sx-from-trans.c
 src/gnome/dialog-sx-since-last-run.c
 src/gnome/dialog-tax-info.c
 src/gnome/dialog-trans-assoc.c
+src/gnome/dialog-vendor.c
 src/gnome/gnc-budget-view.c
 src/gnome/gnc-plugin-account-tree.c
 src/gnome/gnc-plugin-basic-commands.c
 src/gnome/gnc-plugin-budget.c
+src/gnome/gnc-plugin-business.c
 src/gnome/gnc-plugin-page-account-tree.c
 src/gnome/gnc-plugin-page-budget.c
+src/gnome/gnc-plugin-page-invoice.c
+src/gnome/gnc-plugin-page-owner-tree.c
 src/gnome/gnc-plugin-page-register2.c
 src/gnome/gnc-plugin-page-register.c
 src/gnome/gnc-plugin-page-sx-list.c
@@ -254,29 +270,13 @@ src/gnome/gtkbuilder/gnc-plugin-page-register.glade
 src/gnome/gtkbuilder/window-autoclear.glade
 src/gnome/gtkbuilder/window-reconcile.glade
 src/gnome/reconcile-view.c
+src/gnome/search-owner.c
 src/gnome/top-level.c
 src/gnome/window-autoclear.c
 src/gnome/window-reconcile2.c
 src/gnome/window-reconcile.c
 src/gnome-business/business-gnome.scm
-src/gnome-business/business-gnome-utils.c
-src/gnome-business/business-options-gnome.c
-src/gnome-business/business-urls.c
-src/gnome-business/dialog-billterms.c
-src/gnome-business/dialog-choose-owner.c
-src/gnome-business/dialog-customer.c
-src/gnome-business/dialog-date-close.c
-src/gnome-business/dialog-employee.c
-src/gnome-business/dialog-invoice.c
-src/gnome-business/dialog-job.c
-src/gnome-business/dialog-order.c
-src/gnome-business/dialog-payment.c
-src/gnome-business/dialog-vendor.c
 src/gnome-business/gncmod-business-gnome.c
-src/gnome-business/gnc-plugin-business.c
-src/gnome-business/gnc-plugin-page-invoice.c
-src/gnome-business/gnc-plugin-page-owner-tree.c
-src/gnome-business/search-owner.c
 src/gnome-search/dialog-search.c
 src/gnome-search/dialog-search.glade
 src/gnome-search/gnc-general-search.c
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 32036d1..4573fc7 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -155,7 +155,6 @@ IF (WITH_GNUCASH)
   ADD_SUBDIRECTORY (debug)
   ADD_SUBDIRECTORY (doc)
   ADD_SUBDIRECTORY (gnome)
-  ADD_SUBDIRECTORY (gnome-business)
   ADD_SUBDIRECTORY (gnome-utils)
   ADD_SUBDIRECTORY (gnome-search)
   ADD_SUBDIRECTORY (html)
@@ -186,7 +185,7 @@ SET(src_EXTRA_DIST
 
 SET_LOCAL_DIST(src_DIST_local CMakeLists.txt Makefile.am ${src_EXTRA_DIST})
 
-SET(src_DIST ${src_DIST_local} ${app_utils_DIST} ${backend_DIST} ${bin_DIST} ${business_DIST} ${cmake_modules_DIST}
+SET(src_DIST ${src_DIST_local} ${app_utils_DIST} ${backend_DIST} ${bin_DIST} ${cmake_modules_DIST}
              ${core_utils_DIST} ${debug_DIST} ${doc_DIST} ${engine_DIST} ${gnc_module_DIST} ${gnome_DIST} ${gnome_search_DIST}
              ${gnome_utils_DIST} ${html_DIST} ${import_export_DIST} ${libqof_DIST} ${optional_DIST} ${plugins_DIST} ${pixmaps_DIST} ${python_DIST}
              ${quotes_DIST} ${register_DIST} ${report_DIST} ${scm_DIST} ${tax_DIST} ${test_core_DIST} PARENT_SCOPE)
diff --git a/src/Makefile.am b/src/Makefile.am
index d11442b..280839a 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -32,7 +32,6 @@ GUI_SUBDIRS = \
   report \
   register \
   gnome \
-  gnome-business \
   import-export \
   optional \
   plugins \
diff --git a/src/bin/gnucash-bin.c b/src/bin/gnucash-bin.c
index 21b2389..9d2ad76 100644
--- a/src/bin/gnucash-bin.c
+++ b/src/bin/gnucash-bin.c
@@ -509,7 +509,6 @@ load_gnucash_modules()
         { "gnucash/report/utility-reports", 0, FALSE },
         { "gnucash/report/locale-specific/us", 0, FALSE },
         { "gnucash/report/report-gnome", 0, FALSE },
-        { "gnucash/business-gnome", 0, TRUE },
         { "gnucash/gtkmm", 0, TRUE },
         { "gnucash/python", 0, TRUE },
         { "gnucash/plugins/bi_import", 0, TRUE},
diff --git a/src/bin/overrides/gnucash-build-env.in b/src/bin/overrides/gnucash-build-env.in
index 111870a..8e3aaeb 100644
--- a/src/bin/overrides/gnucash-build-env.in
+++ b/src/bin/overrides/gnucash-build-env.in
@@ -53,7 +53,6 @@ eval `${top_srcdir}/src/gnc-test-env.pl \
   --gnc-module-dir ${top_builddir}/src/import-export/ofx \
   --gnc-module-dir ${top_builddir}/src/import-export/hbci \
   --gnc-module-dir ${top_builddir}/src/import-export/log-replay \
-  --gnc-module-dir ${top_builddir}/src/gnome-business \
   --guile-load-dir ${top_builddir}/src/core-utils \
   --guile-load-dir ${top_builddir}/src/gnc-module \
   --guile-load-dir ${top_builddir}/src/engine \
@@ -69,7 +68,6 @@ eval `${top_srcdir}/src/gnc-test-env.pl \
   --guile-load-dir ${top_builddir}/src/report/report-gnome \
   --guile-load-dir ${top_builddir}/src/report/stylesheets \
   --guile-load-dir ${top_builddir}/src/import-export/qif-import \
-  --guile-load-dir ${top_builddir}/src/gnome-business \
   --library-dir    ${top_builddir}/src/test-core \
   --library-dir    ${top_builddir}/src/libqof/qof \
   --library-dir    ${top_builddir}/src/core-utils \
diff --git a/src/gnome-business/CMakeLists.txt b/src/gnome-business/CMakeLists.txt
deleted file mode 100644
index ce04e29..0000000
--- a/src/gnome-business/CMakeLists.txt
+++ /dev/null
@@ -1,83 +0,0 @@
-SET(business_gnome_SOURCES
-  business-options-gnome.c
-  business-urls.c
-  business-gnome-utils.c
-  dialog-billterms.c
-  dialog-choose-owner.c
-  dialog-customer.c
-  dialog-date-close.c
-  dialog-employee.c
-  dialog-invoice.c
-  dialog-job.c
-  dialog-order.c
-  dialog-payment.c
-  dialog-vendor.c
-  gnc-plugin-business.c
-  gnc-plugin-page-invoice.c
-  gnc-plugin-page-owner-tree.c
-  gncmod-business-gnome.c
-  search-owner.c
-)
-
-SET(business_gnome_noinst_HEADERS
-  business-options-gnome.h
-  business-urls.h
-  business-gnome-utils.h
-  dialog-billterms.h
-  dialog-choose-owner.h
-  dialog-customer.h
-  dialog-date-close.h
-  dialog-employee.h
-  dialog-invoice.h
-  dialog-job.h
-  dialog-order.h
-  dialog-payment.h
-  dialog-vendor.h
-  gnc-plugin-business.h
-  gnc-plugin-page-invoice.h
-  gnc-plugin-page-owner-tree.h
-  search-owner.h
-)  
-
-SET_SOURCE_FILES_PROPERTIES (${business_gnome_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
-SET_SOURCE_FILES_PROPERTIES (business-options-gnome.c PROPERTIES OBJECT_DEPENDS ${SWIG_RUNTIME_H})
-ADD_LIBRARY(gncmod-business-gnome
-  ${business_gnome_SOURCES}
-  ${business_gnome_HEADERS}
-)
-
-TARGET_LINK_LIBRARIES(gncmod-business-gnome gncmod-ledger-core gncmod-gnome-search 
-   gncmod-report-gnome gncmod-gnome-utils gnc-gnome gncmod-engine gnc-qof ${GTK3_LDFLAGS})
-
-TARGET_COMPILE_DEFINITIONS(gncmod-business-gnome PRIVATE -DG_LOG_DOMAIN=\"gnc.business.gnome\")
-
-INSTALL(TARGETS gncmod-business-gnome
-  LIBRARY DESTINATION lib/gnucash
-  ARCHIVE DESTINATION lib/gnucash
-  RUNTIME DESTINATION bin)
-# No headers to install
-
-# Scheme
-
-SET(gncmod_business_gnome_SCHEME business-gnome.scm)
-
-SET(GUILE_OUTPUT_DIR   gnucash)
-SET(GUILE_MODULES      src/app-utils src/engine src/gnome-utils src/html src/report/report-system src/report/standard-reports)
-SET(GUILE_LOAD_DIRS    src/app-utils src/engine src/core-utils src/gnc-module src/gnome-utils src/report/business-reports src/report/report-system src/report/standard-reports src/scm)
-SET(GUILE_LIBRARY_DIRS src/app-utils src/engine src/core-utils src/gnc-module src/gnome-utils src/report/report-system)
-SET(GUILE_DEPENDS      scm-business-reports)
-
-GNC_ADD_SCHEME_TARGETS(scm-business-gnome
-  "${gncmod_business_gnome_SCHEME}"
-  ${GUILE_OUTPUT_DIR} 
-  "${GUILE_MODULES}"
-  "${GUILE_LOAD_DIRS}"
-  "${GUILE_LIBRARY_DIRS}"
-  "${GUILE_DEPENDS}"
-  FALSE
-)
-SET_LOCAL_DIST(business_gnome_DIST_local CMakeLists.txt Makefile.am ${business_gnome_SOURCES} ${business_gnome_HEADERS}
-               ${business_gnome_noinst_HEADERS} ${gncmod_business_gnome_SCHEME})
-
-SET(business_gnome_DIST ${business_gnome_DIST_local} ${business_gnome_gschema_DIST}
-        ${business_gnome_gtkbuilder_DIST} ${business_gnome_ui_DIST} PARENT_SCOPE)
diff --git a/src/gnome-business/Makefile.am b/src/gnome-business/Makefile.am
deleted file mode 100644
index ba02c6c..0000000
--- a/src/gnome-business/Makefile.am
+++ /dev/null
@@ -1,161 +0,0 @@
-SUBDIRS = .
-
-pkglib_LTLIBRARIES = libgncmod-business-gnome.la
-
-AM_CPPFLAGS = \
-  -I${top_srcdir}/src \
-  -I${top_builddir}/src \
-  -I${top_srcdir}/src/core-utils \
-  -I${top_srcdir}/src/engine \
-  -I${top_srcdir}/src/gnc-module \
-  -I${top_srcdir}/src/gnome-utils \
-  -I${top_srcdir}/src/gnome \
-  -I${top_srcdir}/src/app-utils \
-  -I${top_srcdir}/src/gnome-search \
-  -I${top_srcdir}/src/html \
-  -I${top_srcdir}/src/report/report-gnome \
-  -I${top_srcdir}/src/register/register-core \
-  -I${top_srcdir}/src/register/register-gnome \
-  -I${top_srcdir}/src/register/ledger-core \
-  -I${top_srcdir}/src/libqof/qof \
-  ${GTK_CFLAGS} \
-  ${GLIB_CFLAGS} \
-  ${GUILE_CFLAGS}
-
-libgncmod_business_gnome_la_SOURCES = \
-  business-options-gnome.c \
-  business-urls.c \
-  business-gnome-utils.c \
-  dialog-billterms.c \
-  dialog-choose-owner.c \
-  dialog-customer.c \
-  dialog-date-close.c \
-  dialog-employee.c \
-  dialog-invoice.c \
-  dialog-job.c \
-  dialog-order.c \
-  dialog-payment.c \
-  dialog-vendor.c \
-  gnc-plugin-business.c \
-  gnc-plugin-page-invoice.c \
-  gnc-plugin-page-owner-tree.c \
-  gncmod-business-gnome.c \
-  search-owner.c
-
-noinst_HEADERS = \
-  business-options-gnome.h \
-  business-urls.h \
-  business-gnome-utils.h \
-  dialog-billterms.h \
-  dialog-choose-owner.h \
-  dialog-customer.h \
-  dialog-date-close.h \
-  dialog-employee.h \
-  dialog-invoice.h \
-  dialog-job.h \
-  dialog-order.h \
-  dialog-payment.h \
-  dialog-vendor.h \
-  gnc-plugin-business.h \
-  gnc-plugin-page-invoice.h \
-  gnc-plugin-page-owner-tree.h \
-  search-owner.h
-
-libgncmod_business_gnome_la_LDFLAGS = -avoid-version
-
-libgncmod_business_gnome_la_LIBADD = \
-  ${top_builddir}/src/gnome/libgnc-gnome.la \
-  ${top_builddir}/src/register/register-core/libgncmod-register-core.la \
-  ${top_builddir}/src/register/register-gnome/libgncmod-register-gnome.la \
-  ${top_builddir}/src/register/ledger-core/libgncmod-ledger-core.la \
-  ${top_builddir}/src/report/report-gnome/libgncmod-report-gnome.la \
-  ${top_builddir}/src/gnome-search/libgncmod-gnome-search.la \
-  ${top_builddir}/src/gnome-utils/libgncmod-gnome-utils.la \
-  ${top_builddir}/src/app-utils/libgncmod-app-utils.la \
-  ${top_builddir}/src/html/libgncmod-html.la \
-  ${top_builddir}/src/engine/libgncmod-engine.la \
-  ${top_builddir}/src/core-utils/libgnc-core-utils.la \
-  ${top_builddir}/src/gnc-module/libgnc-module.la \
-  ${top_builddir}/src/libqof/qof/libgnc-qof.la \
-  ${GTK_LIBS} \
-  ${GUILE_LIBS} \
-  ${GLIB_LIBS} \
-  ${EFENCE_LIBS}
-
-gncscmmoddir = ${GNC_SCM_INSTALL_DIR}/gnucash
-gncscmmod_DATA = business-gnome.scm
-
-EXTRA_DIST = \
-  ${gncscmmod_DATA} \
-  CMakeLists.txt
-
-if GNUCASH_SEPARATE_BUILDDIR
-#Only needed when srcdir and builddir are different
-#for running
-SCM_FILE_LINKS = ${gncscmmod_DATA}
-endif
-
-.scm-links: 
-	$(RM) -rf gnucash
-	mkdir -p  gnucash
-if GNUCASH_SEPARATE_BUILDDIR
-	for X in ${SCM_FILE_LINKS} ; do \
-	  $(LN_S) -f ${srcdir}/$$X . ; \
-	done
-endif
-	( cd gnucash; for A in $(gncscmmod_DATA) ; do $(LN_S) -f ../$$A . ; done )
-if ! OS_WIN32
-# Windows knows no "ln -s" but uses "cp": must copy every time (see bug #566567).
-	touch .scm-links
-endif
-
-if GNC_HAVE_GUILE_2
-GUILE_COMPILE_ENV = \
-  --gnc-module-dir ${top_builddir}/src/app-utils \
-  --gnc-module-dir ${top_builddir}/src/engine \
-  --gnc-module-dir ${top_builddir}/src/html \
-  --gnc-module-dir ${top_builddir}/src/gnome-utils \
-  --gnc-module-dir ${top_builddir}/src/report/report-system \
-  --gnc-module-dir ${top_builddir}/src/report/standard-reports \
-  --guile-load-dir ${top_builddir}/src/app-utils \
-  --guile-load-dir ${top_builddir}/src/core-utils \
-  --guile-load-dir ${top_builddir}/src/engine \
-  --guile-load-dir ${top_builddir}/src/gnc-module \
-  --guile-load-dir ${top_builddir}/src/gnome-utils \
-  --guile-load-dir ${top_builddir}/src/report/business-reports \
-  --guile-load-dir ${top_builddir}/src/report/report-system \
-  --guile-load-dir ${top_builddir}/src/report/standard-reports \
-  --guile-load-dir ${top_builddir}/src/scm \
-  --library-dir    ${top_builddir}/src/libqof/qof \
-  --library-dir    ${top_builddir}/src/engine \
-  --library-dir    ${top_builddir}/src/app-utils \
-  --library-dir    ${top_builddir}/src/core-utils \
-  --library-dir    ${top_builddir}/src/gnc-module \
-  --library-dir    ${top_builddir}/src/gnome-utils \
-  --library-dir    ${top_builddir}/src/backend/xml \
-  --library-dir    ${top_builddir}/src/backend/sql \
-  --library-dir    ${top_builddir}/src/html \
-  --library-dir    ${top_builddir}/src/report/report-system
-
-
-%.go : %.scm .scm-links $(pkglib_LTLIBRARIES)
-	GNC_UNINSTALLED=yes \
-	GNC_BUILDDIR=${top_builddir} \
-	$(shell ${abs_top_srcdir}/src/gnc-test-env.pl --noexports ${GUILE_COMPILE_ENV}) \
-	$(GUILD) compile -o $@ $<
-
-gncscmmodcachedir = ${pkglibdir}/scm/ccache/@GUILE_EFFECTIVE_VERSION@/gnucash
-gncscmmodcache_DATA = $(gncscmmod_DATA:.scm=.go)
-endif
-
-noinst_DATA = .scm-links
-clean-local:
-	rm -rf gnucash
-
-CLEANFILES = \
-	$(BUILT_SOURCES) \
-	.scm-links \
-	${SCM_FILE_LINKS} \
-	${gncscmmodcache_DATA}
-
-AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.business.gnome\"
diff --git a/src/gnome-business/business-gnome.scm b/src/gnome-business/business-gnome.scm
deleted file mode 100644
index 617c10e..0000000
--- a/src/gnome-business/business-gnome.scm
+++ /dev/null
@@ -1,37 +0,0 @@
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; 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 at gnu.org
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-(define-module (gnucash business-gnome))
-(use-modules (gnucash gnc-module))
-
-(gnc:module-load "gnucash/gnome-utils" 0)
-(gnc:module-load "gnucash/app-utils" 0)
-(gnc:module-load "gnucash/gnome-search" 0)
-
-(gnc:module-load "gnucash/report/report-gnome" 0)
-
-(use-modules (gnucash report business-reports))
-(use-modules (gnucash main))		;for gnc:debug
-
-(define (business-report-function)
-  (gnc-add-scm-extension
-   (gnc:make-menu gnc:menuname-business-reports
-		  (list gnc:menuname-reports))))
-
-(gnc-hook-add-scm-dangler HOOK-REPORT business-report-function)
diff --git a/src/gnome-business/gncmod-business-gnome.c b/src/gnome-business/gncmod-business-gnome.c
deleted file mode 100644
index ccc269e..0000000
--- a/src/gnome-business/gncmod-business-gnome.c
+++ /dev/null
@@ -1,129 +0,0 @@
-/*********************************************************************
- * businessmod-core.c
- * module definition/initialization for the Business GNOME UI module
- *
- * Copyright (c) 2001 Derek Atkins <warlord at MIT.EDU>
- *
- * 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 at gnu.org
- *
- *********************************************************************/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <gmodule.h>
-#include <gtk/gtk.h>
-#include <glib/gi18n.h>
-#include <libguile.h>
-
-#include "gnc-hooks.h"
-#include "gnc-module.h"
-#include "gnc-module-api.h"
-
-#include "search-core-type.h"
-#include "search-owner.h"
-#include "gncOwner.h"
-#include "business-options-gnome.h"
-#include "business-urls.h"
-
-#include "gnc-plugin-manager.h"
-#include "gnc-plugin-business.h"
-
-#include "gnc-hooks.h"
-#include "dialog-invoice.h"
-#include "dialog-preferences.h"
-
-GNC_MODULE_API_DECL(libgncmod_business_gnome)
-
-/* version of the gnc module system interface we require */
-int libgncmod_business_gnome_gnc_module_system_interface = 0;
-
-/* module versioning uses libtool semantics. */
-int libgncmod_business_gnome_gnc_module_current  = 0;
-int libgncmod_business_gnome_gnc_module_revision = 0;
-int libgncmod_business_gnome_gnc_module_age      = 0;
-
-
-char *
-libgncmod_business_gnome_gnc_module_path(void)
-{
-    return g_strdup("gnucash/business-gnome");
-}
-
-char *
-libgncmod_business_gnome_gnc_module_description(void)
-{
-    return g_strdup("The GnuCash business module GNOME UI");
-}
-
-int
-libgncmod_business_gnome_gnc_module_init(int refcount)
-{
-    /* load app-utils: we depend on it -- and it depends on the engine */
-    if (!gnc_module_load ("gnucash/app-utils", 0))
-    {
-        return FALSE;
-    }
-    /* We also depend on gnome-utils and gnome-search modules */
-    if (!gnc_module_load ("gnucash/gnome-utils", 0))
-    {
-        return FALSE;
-    }
-    if (!gnc_module_load ("gnucash/gnome-search", 0))
-    {
-        return FALSE;
-    }
-    if (!gnc_module_load ("gnucash/report/report-gnome", 0))
-    {
-        return FALSE;
-    }
-
-    scm_c_eval_string("(use-modules (gnucash business-gnome))");
-    scm_c_eval_string("(use-modules (gnucash report business-reports))");
-
-    if (refcount == 0)
-    {
-        /* Register the Owner search type */
-        gnc_search_core_register_type (GNC_OWNER_MODULE_NAME,
-                                       (GNCSearchCoreNew) gnc_search_owner_new);
-        gnc_business_urls_initialize ();
-        gnc_business_options_gnome_initialize ();
-
-        gnc_plugin_manager_add_plugin (gnc_plugin_manager_get (),
-                                       gnc_plugin_business_new ());
-
-        gnc_hook_add_dangler(HOOK_BOOK_OPENED,
-                             (GFunc)gnc_invoice_remind_bills_due_cb, NULL);
-        gnc_hook_add_dangler(HOOK_BOOK_OPENED,
-                             (GFunc)gnc_invoice_remind_invoices_due_cb, NULL);
-
-        /* Add to preferences under Business */
-        /* The parameters are; glade file, items to add from glade file - last being the dialog, preference tab name */
-        gnc_preferences_add_page("business-prefs.glade", "liststore_printinvoice,days_in_adj,cust_days_in_adj,business_prefs",
-                                 _("Business"));
-    }
-
-    return TRUE;
-}
-
-int
-libgncmod_business_gnome_gnc_module_end(int refcount)
-{
-    return TRUE;
-}
diff --git a/src/gnome/CMakeLists.txt b/src/gnome/CMakeLists.txt
index 00fc3d8..b8fc331 100644
--- a/src/gnome/CMakeLists.txt
+++ b/src/gnome/CMakeLists.txt
@@ -8,13 +8,25 @@ SET (gnc_gnome_noinst_HEADERS
   assistant-hierarchy.h
   assistant-loan.h
   assistant-stock-split.h
+  business-options-gnome.h
+  business-urls.h
+  business-gnome-utils.h
+  dialog-billterms.h
+  dialog-choose-owner.h
+  dialog-customer.h
+  dialog-date-close.h
+  dialog-employee.h
   dialog-fincalc.h
   dialog-find-account.h
   dialog-find-transactions.h
   dialog-find-transactions2.h
   dialog-imap-editor.h
+  dialog-invoice.h
+  dialog-job.h
   dialog-lot-viewer.h
   dialog-new-user.h
+  dialog-order.h
+  dialog-payment.h
   dialog-print-check.h
   dialog-progress.h
   dialog-sx-editor.h
@@ -22,20 +34,25 @@ SET (gnc_gnome_noinst_HEADERS
   dialog-sx-from-trans.h
   dialog-sx-since-last-run.h
   dialog-trans-assoc.h
+  dialog-vendor.h
   gnc-budget-view.h
   gnc-plugin-account-tree.h
   gnc-plugin-basic-commands.h
   gnc-plugin-budget.h
+  gnc-plugin-business.h
   gnc-plugin-register.h
   gnc-plugin-register2.h
   gnc-plugin-page-account-tree.h
   gnc-plugin-page-budget.h
+  gnc-plugin-page-invoice.h
+  gnc-plugin-page-owner-tree.h
   gnc-plugin-page-sx-list.h
   gnc-plugin-page-register.h
   gnc-plugin-page-register2.h
   gnc-split-reg.h
   gnc-split-reg2.h
   reconcile-view.h
+  search-owner.h
   top-level.h
   window-reconcile.h
   window-reconcile2.h
@@ -55,14 +72,26 @@ SET (gnc_gnome_SOURCES
   assistant-hierarchy.c
   assistant-loan.c
   assistant-stock-split.c
+  business-options-gnome.c
+  business-urls.c
+  business-gnome-utils.c
+  dialog-billterms.c
+  dialog-choose-owner.c
   dialog-commodities.c
+  dialog-customer.c
+  dialog-date-close.c
+  dialog-employee.c
   dialog-fincalc.c
   dialog-find-account.c
   dialog-find-transactions.c
   dialog-find-transactions2.c
   dialog-imap-editor.c
+  dialog-invoice.c
+  dialog-job.c
   dialog-lot-viewer.c
   dialog-new-user.c
+  dialog-order.c
+  dialog-payment.c
   dialog-price-editor.c
   dialog-price-edit-db.c
   dialog-print-check.c
@@ -73,33 +102,41 @@ SET (gnc_gnome_SOURCES
   dialog-sx-since-last-run.c
   dialog-tax-info.c
   dialog-trans-assoc.c
+  dialog-vendor.c
   gnc-budget-view.c
   gnc-plugin-account-tree.c
   gnc-plugin-basic-commands.c
   gnc-plugin-budget.c
+  gnc-plugin-business.c
   gnc-plugin-register.c
   gnc-plugin-register2.c
   gnc-plugin-page-account-tree.c
   gnc-plugin-page-budget.c
+  gnc-plugin-page-invoice.c
+  gnc-plugin-page-owner-tree.c
   gnc-plugin-page-sx-list.c
   gnc-plugin-page-register.c
   gnc-plugin-page-register2.c
   gnc-split-reg.c
   gnc-split-reg2.c
   reconcile-view.c
+  search-owner.c
   top-level.c
   window-reconcile.c
   window-reconcile2.c
   window-autoclear.c
 )  
 
+SET_SOURCE_FILES_PROPERTIES (${gnc_gnome_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
+SET_SOURCE_FILES_PROPERTIES (business-options-gnome.c PROPERTIES OBJECT_DEPENDS ${SWIG_RUNTIME_H})
+
 IF (WIN32)
   SET (gnc_gnome_SOURCES ${gnc_gnome_SOURCES} ${CMAKE_SOURCE_DIR}/lib/libc/strfmon.c)
 ENDIF(WIN32)
 
 ADD_LIBRARY (gnc-gnome ${gnc_gnome_SOURCES} ${gnc_gnome_noinst_HEADERS} ${SWIG_GNOME_C})
 TARGET_LINK_LIBRARIES(gnc-gnome gncmod-gnome-search gncmod-ledger-core gncmod-report-gnome gncmod-report-system
-    gncmod-register-gnome gncmod-register-core gncmod-engine ${GTK3_LDFLAGS} ${GTK_MAC_LDFLAGS})
+    gncmod-register-gnome gncmod-register-core gncmod-gnome-utils gncmod-engine ${GTK3_LDFLAGS} ${GTK_MAC_LDFLAGS})
 
 TARGET_COMPILE_DEFINITIONS (gnc-gnome PRIVATE -DG_LOG_DOMAIN=\"gnc.gui\" ${GTK_MAC_CFLAGS_OTHER})
 
@@ -163,4 +200,4 @@ INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/gnucash.desktop DESTINATION share/appl
 SET_LOCAL_DIST(gnome_DIST_local
         CMakeLists.txt Makefile.am gnome.i gnucash.appdata.xml.in gnucash.desktop.in.in
         ${gnc_gnome_noinst_HEADERS} ${gnc_gnome_SOURCES})
-SET(gnome_DIST ${gnome_DIST_local} ${gnome_ui_DIST} ${gnome_gschema_DIST} ${gnome_gtkbuilder_DIST} PARENT_SCOPE)
\ No newline at end of file
+SET(gnome_DIST ${gnome_DIST_local} ${gnome_ui_DIST} ${gnome_gschema_DIST} ${gnome_gtkbuilder_DIST} PARENT_SCOPE)
diff --git a/src/gnome/Makefile.am b/src/gnome/Makefile.am
index 9c6785b..48bb953 100644
--- a/src/gnome/Makefile.am
+++ b/src/gnome/Makefile.am
@@ -28,14 +28,26 @@ libgnc_gnome_la_SOURCES = \
   assistant-hierarchy.c \
   assistant-loan.c \
   assistant-stock-split.c \
+  business-options-gnome.c \
+  business-urls.c \
+  business-gnome-utils.c \
+  dialog-billterms.c \
+  dialog-choose-owner.c \
   dialog-commodities.c \
+  dialog-customer.c \
+  dialog-date-close.c \
+  dialog-employee.c \
   dialog-fincalc.c \
   dialog-find-account.c \
   dialog-find-transactions.c \
   dialog-find-transactions2.c \
   dialog-imap-editor.c \
+  dialog-invoice.c \
+  dialog-job.c \
   dialog-lot-viewer.c \
   dialog-new-user.c \
+  dialog-order.c \
+  dialog-payment.c \
   dialog-price-editor.c \
   dialog-price-edit-db.c \
   dialog-print-check.c \
@@ -46,20 +58,25 @@ libgnc_gnome_la_SOURCES = \
   dialog-sx-since-last-run.c \
   dialog-tax-info.c \
   dialog-trans-assoc.c \
+  dialog-vendor.c \
   gnc-budget-view.c \
   gnc-plugin-account-tree.c \
   gnc-plugin-basic-commands.c \
   gnc-plugin-budget.c \
-  gnc-plugin-register.c \
-  gnc-plugin-register2.c \
+  gnc-plugin-business.c \
   gnc-plugin-page-account-tree.c \
   gnc-plugin-page-budget.c \
+  gnc-plugin-page-invoice.c \
+  gnc-plugin-page-owner-tree.c \
   gnc-plugin-page-sx-list.c \
   gnc-plugin-page-register.c \
   gnc-plugin-page-register2.c \
+  gnc-plugin-register.c \
+  gnc-plugin-register2.c \
   gnc-split-reg.c \
   gnc-split-reg2.c \
   reconcile-view.c \
+  search-owner.c \
   top-level.c \
   window-reconcile.c \
   window-reconcile2.c \
@@ -83,13 +100,25 @@ noinst_HEADERS = \
   assistant-hierarchy.h \
   assistant-loan.h \
   assistant-stock-split.h \
+  business-options-gnome.h \
+  business-urls.h \
+  business-gnome-utils.h \
+  dialog-billterms.h \
+  dialog-choose-owner.h \
+  dialog-customer.h \
+  dialog-date-close.h \
+  dialog-employee.h \
   dialog-fincalc.h \
   dialog-find-account.h \
   dialog-find-transactions.h \
   dialog-find-transactions2.h \
   dialog-imap-editor.h \
+  dialog-invoice.h \
+  dialog-job.h \
   dialog-lot-viewer.h \
   dialog-new-user.h \
+  dialog-order.h \
+  dialog-payment.h \
   dialog-print-check.h \
   dialog-progress.h \
   dialog-sx-editor.h \
@@ -97,20 +126,25 @@ noinst_HEADERS = \
   dialog-sx-from-trans.h \
   dialog-sx-since-last-run.h \
   dialog-trans-assoc.h \
+  dialog-vendor.h \
   gnc-budget-view.h \
   gnc-plugin-account-tree.h \
   gnc-plugin-basic-commands.h \
   gnc-plugin-budget.h \
-  gnc-plugin-register.h \
-  gnc-plugin-register2.h \
+  gnc-plugin-business.h \
   gnc-plugin-page-account-tree.h \
   gnc-plugin-page-budget.h \
+  gnc-plugin-page-invoice.h \
+  gnc-plugin-page-owner-tree.h \
   gnc-plugin-page-sx-list.h \
   gnc-plugin-page-register.h \
   gnc-plugin-page-register2.h \
+  gnc-plugin-register.h \
+  gnc-plugin-register2.h \
   gnc-split-reg.h \
   gnc-split-reg2.h \
   reconcile-view.h \
+  search-owner.h \
   top-level.h \
   window-reconcile.h \
   window-reconcile2.h \
diff --git a/src/gnome-business/business-gnome-utils.c b/src/gnome/business-gnome-utils.c
similarity index 100%
rename from src/gnome-business/business-gnome-utils.c
rename to src/gnome/business-gnome-utils.c
diff --git a/src/gnome-business/business-gnome-utils.h b/src/gnome/business-gnome-utils.h
similarity index 100%
rename from src/gnome-business/business-gnome-utils.h
rename to src/gnome/business-gnome-utils.h
diff --git a/src/gnome-business/business-options-gnome.c b/src/gnome/business-options-gnome.c
similarity index 100%
rename from src/gnome-business/business-options-gnome.c
rename to src/gnome/business-options-gnome.c
diff --git a/src/gnome-business/business-options-gnome.h b/src/gnome/business-options-gnome.h
similarity index 100%
rename from src/gnome-business/business-options-gnome.h
rename to src/gnome/business-options-gnome.h
diff --git a/src/gnome-business/business-urls.c b/src/gnome/business-urls.c
similarity index 100%
rename from src/gnome-business/business-urls.c
rename to src/gnome/business-urls.c
diff --git a/src/gnome-business/business-urls.h b/src/gnome/business-urls.h
similarity index 100%
rename from src/gnome-business/business-urls.h
rename to src/gnome/business-urls.h
diff --git a/src/gnome-business/dialog-billterms.c b/src/gnome/dialog-billterms.c
similarity index 100%
rename from src/gnome-business/dialog-billterms.c
rename to src/gnome/dialog-billterms.c
diff --git a/src/gnome-business/dialog-billterms.h b/src/gnome/dialog-billterms.h
similarity index 100%
rename from src/gnome-business/dialog-billterms.h
rename to src/gnome/dialog-billterms.h
diff --git a/src/gnome-business/dialog-choose-owner.c b/src/gnome/dialog-choose-owner.c
similarity index 100%
rename from src/gnome-business/dialog-choose-owner.c
rename to src/gnome/dialog-choose-owner.c
diff --git a/src/gnome-business/dialog-choose-owner.h b/src/gnome/dialog-choose-owner.h
similarity index 100%
rename from src/gnome-business/dialog-choose-owner.h
rename to src/gnome/dialog-choose-owner.h
diff --git a/src/gnome-business/dialog-customer.c b/src/gnome/dialog-customer.c
similarity index 100%
rename from src/gnome-business/dialog-customer.c
rename to src/gnome/dialog-customer.c
diff --git a/src/gnome-business/dialog-customer.h b/src/gnome/dialog-customer.h
similarity index 100%
rename from src/gnome-business/dialog-customer.h
rename to src/gnome/dialog-customer.h
diff --git a/src/gnome-business/dialog-date-close.c b/src/gnome/dialog-date-close.c
similarity index 100%
rename from src/gnome-business/dialog-date-close.c
rename to src/gnome/dialog-date-close.c
diff --git a/src/gnome-business/dialog-date-close.h b/src/gnome/dialog-date-close.h
similarity index 100%
rename from src/gnome-business/dialog-date-close.h
rename to src/gnome/dialog-date-close.h
diff --git a/src/gnome-business/dialog-employee.c b/src/gnome/dialog-employee.c
similarity index 100%
rename from src/gnome-business/dialog-employee.c
rename to src/gnome/dialog-employee.c
diff --git a/src/gnome-business/dialog-employee.h b/src/gnome/dialog-employee.h
similarity index 100%
rename from src/gnome-business/dialog-employee.h
rename to src/gnome/dialog-employee.h
diff --git a/src/gnome-business/dialog-invoice.c b/src/gnome/dialog-invoice.c
similarity index 100%
rename from src/gnome-business/dialog-invoice.c
rename to src/gnome/dialog-invoice.c
diff --git a/src/gnome-business/dialog-invoice.h b/src/gnome/dialog-invoice.h
similarity index 100%
rename from src/gnome-business/dialog-invoice.h
rename to src/gnome/dialog-invoice.h
diff --git a/src/gnome-business/dialog-job.c b/src/gnome/dialog-job.c
similarity index 100%
rename from src/gnome-business/dialog-job.c
rename to src/gnome/dialog-job.c
diff --git a/src/gnome-business/dialog-job.h b/src/gnome/dialog-job.h
similarity index 100%
rename from src/gnome-business/dialog-job.h
rename to src/gnome/dialog-job.h
diff --git a/src/gnome-business/dialog-order.c b/src/gnome/dialog-order.c
similarity index 100%
rename from src/gnome-business/dialog-order.c
rename to src/gnome/dialog-order.c
diff --git a/src/gnome-business/dialog-order.h b/src/gnome/dialog-order.h
similarity index 100%
rename from src/gnome-business/dialog-order.h
rename to src/gnome/dialog-order.h
diff --git a/src/gnome-business/dialog-payment.c b/src/gnome/dialog-payment.c
similarity index 100%
rename from src/gnome-business/dialog-payment.c
rename to src/gnome/dialog-payment.c
diff --git a/src/gnome-business/dialog-payment.h b/src/gnome/dialog-payment.h
similarity index 100%
rename from src/gnome-business/dialog-payment.h
rename to src/gnome/dialog-payment.h
diff --git a/src/gnome-business/dialog-vendor.c b/src/gnome/dialog-vendor.c
similarity index 100%
rename from src/gnome-business/dialog-vendor.c
rename to src/gnome/dialog-vendor.c
diff --git a/src/gnome-business/dialog-vendor.h b/src/gnome/dialog-vendor.h
similarity index 100%
rename from src/gnome-business/dialog-vendor.h
rename to src/gnome/dialog-vendor.h
diff --git a/src/gnome-business/gnc-plugin-business.c b/src/gnome/gnc-plugin-business.c
similarity index 100%
rename from src/gnome-business/gnc-plugin-business.c
rename to src/gnome/gnc-plugin-business.c
diff --git a/src/gnome-business/gnc-plugin-business.h b/src/gnome/gnc-plugin-business.h
similarity index 100%
rename from src/gnome-business/gnc-plugin-business.h
rename to src/gnome/gnc-plugin-business.h
diff --git a/src/gnome-business/gnc-plugin-page-invoice.c b/src/gnome/gnc-plugin-page-invoice.c
similarity index 100%
rename from src/gnome-business/gnc-plugin-page-invoice.c
rename to src/gnome/gnc-plugin-page-invoice.c
diff --git a/src/gnome-business/gnc-plugin-page-invoice.h b/src/gnome/gnc-plugin-page-invoice.h
similarity index 100%
rename from src/gnome-business/gnc-plugin-page-invoice.h
rename to src/gnome/gnc-plugin-page-invoice.h
diff --git a/src/gnome-business/gnc-plugin-page-owner-tree.c b/src/gnome/gnc-plugin-page-owner-tree.c
similarity index 100%
rename from src/gnome-business/gnc-plugin-page-owner-tree.c
rename to src/gnome/gnc-plugin-page-owner-tree.c
diff --git a/src/gnome-business/gnc-plugin-page-owner-tree.h b/src/gnome/gnc-plugin-page-owner-tree.h
similarity index 100%
rename from src/gnome-business/gnc-plugin-page-owner-tree.h
rename to src/gnome/gnc-plugin-page-owner-tree.h
diff --git a/src/gnome-business/search-owner.c b/src/gnome/search-owner.c
similarity index 100%
rename from src/gnome-business/search-owner.c
rename to src/gnome/search-owner.c
diff --git a/src/gnome-business/search-owner.h b/src/gnome/search-owner.h
similarity index 100%
rename from src/gnome-business/search-owner.h
rename to src/gnome/search-owner.h
diff --git a/src/gnome/top-level.c b/src/gnome/top-level.c
index 89c7b57..1aa3c6b 100644
--- a/src/gnome/top-level.c
+++ b/src/gnome/top-level.c
@@ -29,9 +29,13 @@
 #include <stdlib.h>
 
 #include "TransLog.h"
+#include "business-options-gnome.h"
+#include "business-urls.h"
 #include "combocell.h"
 #include "dialog-account.h"
 #include "dialog-commodity.h"
+#include "dialog-invoice.h"
+#include "dialog-preferences.h"
 #include "dialog-options.h"
 #include "dialog-sx-editor.h"
 #include "dialog-transfer.h"
@@ -52,6 +56,7 @@
 #include "gnc-plugin-register.h" /* FIXME Remove this line*/
 #include "gnc-plugin-register2.h" /* FIXME Remove this line*/
 #include "gnc-plugin-budget.h"
+#include "gnc-plugin-business.h"
 #include "gnc-plugin-page-register.h"
 #include "gnc-plugin-page-register2.h"
 #include "gnc-plugin-manager.h" /* FIXME Remove this line*/
@@ -66,6 +71,8 @@
 #include "gnucash-sheet.h"
 #include "gnucash-style.h"
 #include "guile-util.h"
+#include "search-core-type.h"
+#include "search-owner.h"
 #include "top-level.h"
 #include "window-report.h"
 #include "gnc-window.h"
@@ -372,6 +379,12 @@ gnc_main_gui_init (void)
 
     gnc_ui_sx_initialize();
 
+    /* Register the Owner search type */
+    gnc_search_core_register_type (GNC_OWNER_MODULE_NAME,
+                                    (GNCSearchCoreNew) gnc_search_owner_new);
+    gnc_business_urls_initialize ();
+    gnc_business_options_gnome_initialize ();
+
     /* FIXME Remove this test code */
     gnc_plugin_manager_add_plugin (
         gnc_plugin_manager_get (), gnc_plugin_account_tree_new ());
@@ -385,6 +398,8 @@ gnc_main_gui_init (void)
         gnc_plugin_manager_get (), gnc_plugin_register_new ());
     gnc_plugin_manager_add_plugin (
         gnc_plugin_manager_get (), gnc_plugin_register2_new ());
+    gnc_plugin_manager_add_plugin (
+        gnc_plugin_manager_get (), gnc_plugin_business_new ());
     /* I'm not sure why the FIXME note says to remove this.  Maybe
        each module should be adding its own plugin to the manager?
        Anyway... Oh, maybe... nah */
@@ -401,7 +416,15 @@ gnc_main_gui_init (void)
                          gnc_save_all_state, NULL);
     gnc_hook_add_dangler(HOOK_BOOK_CLOSED,
                          (GFunc)gnc_reports_flush_global, NULL);
+    gnc_hook_add_dangler(HOOK_BOOK_OPENED,
+                         (GFunc)gnc_invoice_remind_bills_due_cb, NULL);
+    gnc_hook_add_dangler(HOOK_BOOK_OPENED,
+                         (GFunc)gnc_invoice_remind_invoices_due_cb, NULL);
 
+    /* Add to preferences under Business */
+    /* The parameters are; glade file, items to add from glade file - last being the dialog, preference tab name */
+    gnc_preferences_add_page("business-prefs.glade", "liststore_printinvoice,days_in_adj,cust_days_in_adj,business_prefs",
+                            _("Business"));
 
     LEAVE(" ");
     return;
diff --git a/src/plugins/bi_import/CMakeLists.txt b/src/plugins/bi_import/CMakeLists.txt
index 2bdda50..9662853 100644
--- a/src/plugins/bi_import/CMakeLists.txt
+++ b/src/plugins/bi_import/CMakeLists.txt
@@ -23,7 +23,6 @@ SET(bi_import_noinst_HEADERS
 ADD_LIBRARY(gncmod-bi_import ${bi_import_noinst_HEADERS} ${bi_import_SOURCES})
 
 TARGET_LINK_LIBRARIES(gncmod-bi_import
-  gncmod-business-gnome
   gncmod-gnome-utils
   gncmod-gnome-search
   gncmod-app-utils
@@ -31,11 +30,12 @@ TARGET_LINK_LIBRARIES(gncmod-bi_import
   gnc-core-utils
   gnc-module
   gnc-qof
+  gnc-gnome
 )
 
 TARGET_INCLUDE_DIRECTORIES(gncmod-bi_import
   PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
-  PRIVATE ${CMAKE_SOURCE_DIR}/src/gnome-business
+  PRIVATE ${CMAKE_SOURCE_DIR}/src/gnome
 )
 
 TARGET_COMPILE_DEFINITIONS(gncmod-bi_import PRIVATE -DG_LOG_DOMAIN=\"gnc.plugin.bi-import\")
diff --git a/src/plugins/bi_import/Makefile.am b/src/plugins/bi_import/Makefile.am
index 6644552..c996cf6 100644
--- a/src/plugins/bi_import/Makefile.am
+++ b/src/plugins/bi_import/Makefile.am
@@ -18,7 +18,7 @@ noinst_HEADERS = \
 libgncmod_bi_import_la_LDFLAGS = -avoid-version
 
 libgncmod_bi_import_la_LIBADD = \
-  ${top_builddir}/src/gnome-business/libgncmod-business-gnome.la \
+  ${top_builddir}/src/gnome/libgnc-gnome.la \
   ${top_builddir}/src/gnome-utils/libgncmod-gnome-utils.la \
   ${top_builddir}/src/app-utils/libgncmod-app-utils.la \
   ${top_builddir}/src/engine/libgncmod-engine.la \
@@ -33,7 +33,6 @@ AM_CPPFLAGS = \
   -I${top_srcdir}/src \
   -I${top_builddir}/src \
   -I${top_srcdir}/src/gnome \
-  -I${top_srcdir}/src/gnome-business \
   -I${top_srcdir}/src/report/report-gnome \
   -I${top_srcdir}/src/gnome-search/ \
   -I${top_srcdir}/src/register/ledger-core \
diff --git a/src/plugins/customer_import/CMakeLists.txt b/src/plugins/customer_import/CMakeLists.txt
index 1200c70..5beaaa6 100644
--- a/src/plugins/customer_import/CMakeLists.txt
+++ b/src/plugins/customer_import/CMakeLists.txt
@@ -20,12 +20,12 @@ SET(customer_import_noinst_HEADERS
 
 ADD_LIBRARY(gncmod-customer_import ${customer_import_SOURCES} ${customer_input_noinst_HEADERS})
 
-TARGET_LINK_LIBRARIES(gncmod-customer_import gncmod-business-gnome gncmod-gnome-utils gncmod-app-utils
+TARGET_LINK_LIBRARIES(gncmod-customer_import gnc-gnome gncmod-gnome-utils gncmod-app-utils
      gncmod-engine gnc-core-utils gnc-module gnc-qof ${GLIB2_LDFLAGS})
 
 TARGET_INCLUDE_DIRECTORIES(gncmod-bi_import
   PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
-  PRIVATE ${CMAKE_SOURCE_DIR}/src/gnome-business
+  PRIVATE ${CMAKE_SOURCE_DIR}/src/gnome
 )
 
 TARGET_COMPILE_DEFINITIONS(gncmod-customer_import PRIVATE -DG_LOG_DOMAIN=\"gnc.plugin.customer_import\")
diff --git a/src/plugins/customer_import/Makefile.am b/src/plugins/customer_import/Makefile.am
index e6f9499..5569e54 100644
--- a/src/plugins/customer_import/Makefile.am
+++ b/src/plugins/customer_import/Makefile.am
@@ -16,7 +16,7 @@ noinst_HEADERS = \
 libgncmod_customer_import_la_LDFLAGS = -avoid-version
 
 libgncmod_customer_import_la_LIBADD = \
-  ${top_builddir}/src/gnome-business/libgncmod-business-gnome.la \
+  ${top_builddir}/src/gnome/libgnc-gnome.la \
   ${top_builddir}/src/gnome-utils/libgncmod-gnome-utils.la \
   ${top_builddir}/src/app-utils/libgncmod-app-utils.la \
   ${top_builddir}/src/engine/libgncmod-engine.la \
@@ -31,7 +31,6 @@ AM_CPPFLAGS = \
   -I${top_srcdir}/src \
   -I${top_builddir}/src \
   -I${top_srcdir}/src/gnome \
-  -I${top_srcdir}/src/gnome-business/ \
   -I${top_srcdir}/src/report/report-gnome \
   -I${top_srcdir}/src/gnome-search/ \
   -I${top_srcdir}/src/register/ledger-core \
diff --git a/src/report/report-gnome/report-gnome.scm b/src/report/report-gnome/report-gnome.scm
index 9c1f2c1..460d558 100644
--- a/src/report/report-gnome/report-gnome.scm
+++ b/src/report/report-gnome/report-gnome.scm
@@ -111,6 +111,8 @@
     (gnc:make-menu gnc:menuname-utility (list gnc:menuname-reports)))
   (define tax-menu 
     (gnc:make-menu gnc:menuname-taxes (list gnc:menuname-reports)))
+  (define business-menu 
+    (gnc:make-menu gnc:menuname-business-reports (list gnc:menuname-reports)))
 
   (gnc-add-scm-extension 
    (gnc:make-menu-item
@@ -126,6 +128,7 @@
   (gnc-add-scm-extension asset-liability-menu)
   (gnc-add-scm-extension budget-menu)
   (gnc-add-scm-extension utility-menu)
+  (gnc-add-scm-extension business-menu)
 
   ;; run report-hook danglers
   (gnc:hook-run-danglers HOOK-REPORT)
diff --git a/src/report/standard-reports/gncmod-standard-reports.c b/src/report/standard-reports/gncmod-standard-reports.c
index c6c6923..43bdf67 100644
--- a/src/report/standard-reports/gncmod-standard-reports.c
+++ b/src/report/standard-reports/gncmod-standard-reports.c
@@ -70,6 +70,11 @@ libgncmod_standard_reports_gnc_module_init(int refcount)
     {
         return FALSE;
     }
+    if (scm_c_eval_string("(use-modules (gnucash report business-reports))") ==
+            SCM_BOOL_F)
+    {
+        return FALSE;
+    }
     return TRUE;
 }
 

commit ea0d442235cf15a619067339bfe707fde69bc5c9
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Fri Jul 21 10:25:48 2017 +0200

    Move auxiliary business files to gnome directory

diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
index a8651da..5107819 100644
--- a/cmake/CMakeLists.txt
+++ b/cmake/CMakeLists.txt
@@ -15,7 +15,7 @@ IF (${CMAKE_VERSION} VERSION_GREATER 3.1)
   SET(CMAKE_COMMAND_TMP ${CMAKE_COMMAND} -E env)
 ENDIF()
 
-SET(schema-targets business-gnome-gschema csv-exp-gschema csv-imp-gschema
+SET(schema-targets csv-exp-gschema csv-imp-gschema
     generic-import-gschema gnome-gschema gnome-utils-gschema ofx-gschema qif-imp-gschema)
 
 IF (WITH_AQBANKING)
diff --git a/configure.ac b/configure.ac
index 7b77d3d..337f01c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1782,9 +1782,6 @@ AC_CONFIG_FILES(
   src/tax/us/test/Makefile
   src/test-core/Makefile
   src/gnome-business/Makefile
-  src/gnome-business/gtkbuilder/Makefile
-  src/gnome-business/gschemas/Makefile
-  src/gnome-business/ui/Makefile
   dnl # Stuff for bill/invoice import plugin
   src/plugins/Makefile
   src/plugins/bi_import/Makefile
@@ -1799,7 +1796,7 @@ AC_CONFIG_FILES(
   src/app-utils/migratable-prefs.xml
   src/gnome/gnucash.desktop.in
   dnl # GSettings schema files
-  src/gnome-business/gschemas/org.gnucash.dialogs.business.gschema.xml.in
+  src/gnome/gschemas/org.gnucash.dialogs.business.gschema.xml.in
   src/gnome/gschemas/org.gnucash.dialogs.checkprinting.gschema.xml.in
   src/gnome/gschemas/org.gnucash.dialogs.commodities.gschema.xml.in
   src/gnome/gschemas/org.gnucash.dialogs.gschema.xml.in
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 904aaec..a4e7988 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -210,6 +210,7 @@ src/gnome/gnc-plugin-register2.c
 src/gnome/gnc-plugin-register.c
 src/gnome/gnc-split-reg2.c
 src/gnome/gnc-split-reg.c
+[type: gettext/gsettings]src/gnome/gschemas/org.gnucash.dialogs.business.gschema.xml.in.in
 [type: gettext/gsettings]src/gnome/gschemas/org.gnucash.dialogs.checkprinting.gschema.xml.in.in
 [type: gettext/gsettings]src/gnome/gschemas/org.gnucash.dialogs.commodities.gschema.xml.in.in
 [type: gettext/gsettings]src/gnome/gschemas/org.gnucash.dialogs.gschema.xml.in.in
@@ -223,18 +224,30 @@ src/gnome/gtkbuilder/assistant-acct-period.glade
 src/gnome/gtkbuilder/assistant-hierarchy.glade
 src/gnome/gtkbuilder/assistant-loan.glade
 src/gnome/gtkbuilder/assistant-stock-split.glade
+src/gnome/gtkbuilder/business-options-gnome.glade
+src/gnome/gtkbuilder/business-prefs.glade
+src/gnome/gtkbuilder/dialog-billterms.glade
+src/gnome/gtkbuilder/dialog-choose-owner.glade
 src/gnome/gtkbuilder/dialog-commodities.glade
+src/gnome/gtkbuilder/dialog-customer.glade
+src/gnome/gtkbuilder/dialog-date-close.glade
+src/gnome/gtkbuilder/dialog-employee.glade
 src/gnome/gtkbuilder/dialog-fincalc.glade
 src/gnome/gtkbuilder/dialog-find-account.glade
 src/gnome/gtkbuilder/dialog-imap-editor.glade
+src/gnome/gtkbuilder/dialog-invoice.glade
+src/gnome/gtkbuilder/dialog-job.glade
 src/gnome/gtkbuilder/dialog-lot-viewer.glade
 src/gnome/gtkbuilder/dialog-new-user.glade
+src/gnome/gtkbuilder/dialog-order.glade
+src/gnome/gtkbuilder/dialog-payment.glade
 src/gnome/gtkbuilder/dialog-price.glade
 src/gnome/gtkbuilder/dialog-print-check.glade
 src/gnome/gtkbuilder/dialog-progress.glade
 src/gnome/gtkbuilder/dialog-sx.glade
 src/gnome/gtkbuilder/dialog-tax-info.glade
 src/gnome/gtkbuilder/dialog-trans-assoc.glade
+src/gnome/gtkbuilder/dialog-vendor.glade
 src/gnome/gtkbuilder/gnc-plugin-page-budget.glade
 src/gnome/gtkbuilder/gnc-plugin-page-register2.glade
 src/gnome/gtkbuilder/gnc-plugin-page-register.glade
@@ -263,19 +276,6 @@ src/gnome-business/gncmod-business-gnome.c
 src/gnome-business/gnc-plugin-business.c
 src/gnome-business/gnc-plugin-page-invoice.c
 src/gnome-business/gnc-plugin-page-owner-tree.c
-[type: gettext/gsettings]src/gnome-business/gschemas/org.gnucash.dialogs.business.gschema.xml.in.in
-src/gnome-business/gtkbuilder/business-options-gnome.glade
-src/gnome-business/gtkbuilder/business-prefs.glade
-src/gnome-business/gtkbuilder/dialog-billterms.glade
-src/gnome-business/gtkbuilder/dialog-choose-owner.glade
-src/gnome-business/gtkbuilder/dialog-customer.glade
-src/gnome-business/gtkbuilder/dialog-date-close.glade
-src/gnome-business/gtkbuilder/dialog-employee.glade
-src/gnome-business/gtkbuilder/dialog-invoice.glade
-src/gnome-business/gtkbuilder/dialog-job.glade
-src/gnome-business/gtkbuilder/dialog-order.glade
-src/gnome-business/gtkbuilder/dialog-payment.glade
-src/gnome-business/gtkbuilder/dialog-vendor.glade
 src/gnome-business/search-owner.c
 src/gnome-search/dialog-search.c
 src/gnome-search/dialog-search.glade
diff --git a/src/gnome-business/CMakeLists.txt b/src/gnome-business/CMakeLists.txt
index 1717ac9..ce04e29 100644
--- a/src/gnome-business/CMakeLists.txt
+++ b/src/gnome-business/CMakeLists.txt
@@ -1,7 +1,3 @@
-ADD_SUBDIRECTORY(gschemas)
-ADD_SUBDIRECTORY(gtkbuilder)
-ADD_SUBDIRECTORY(ui)
-
 SET(business_gnome_SOURCES
   business-options-gnome.c
   business-urls.c
diff --git a/src/gnome-business/Makefile.am b/src/gnome-business/Makefile.am
index a583ab3..ba02c6c 100644
--- a/src/gnome-business/Makefile.am
+++ b/src/gnome-business/Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS = . gtkbuilder gschemas ui
+SUBDIRS = .
 
 pkglib_LTLIBRARIES = libgncmod-business-gnome.la
 
diff --git a/src/gnome-business/gschemas/CMakeLists.txt b/src/gnome-business/gschemas/CMakeLists.txt
deleted file mode 100644
index 3a88499..0000000
--- a/src/gnome-business/gschemas/CMakeLists.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-
-SET(business_gnome_GSCHEMA org.gnucash.dialogs.business.gschema.xml)
-
-ADD_GSCHEMA_TARGETS(business-gnome-gschema "${business_gnome_GSCHEMA}")
-
-SET_DIST_LIST(business_gnome_gschema_DIST CMakeLists.txt Makefile.am org.gnucash.dialogs.business.gschema.xml.in.in)
\ No newline at end of file
diff --git a/src/gnome-business/gschemas/Makefile.am b/src/gnome-business/gschemas/Makefile.am
deleted file mode 100644
index 83eeea4..0000000
--- a/src/gnome-business/gschemas/Makefile.am
+++ /dev/null
@@ -1,12 +0,0 @@
- at INTLTOOL_XML_NOMERGE_RULE@
-
-gschema_in_files = \
-  org.gnucash.dialogs.business.gschema.xml.in
-
-gsettings_SCHEMAS = $(gschema_in_files:.gschema.xml.in=.gschema.xml)
-
- at GSETTINGS_RULES@
-
-CLEANFILES = $(gsettings_SCHEMAS)
-
-EXTRA_DIST = CMakeLists.txt
diff --git a/src/gnome-business/gtkbuilder/CMakeLists.txt b/src/gnome-business/gtkbuilder/CMakeLists.txt
deleted file mode 100644
index e1dd37e..0000000
--- a/src/gnome-business/gtkbuilder/CMakeLists.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-
-FILE(COPY .
-  DESTINATION ${DATADIR_BUILD}/gnucash/gtkbuilder
-  PATTERN Makefile.* EXCLUDE
-  PATTERN CMakeLists.txt EXCLUDE)
-
-INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
-  DESTINATION share/gnucash
-  PATTERN Makefile.* EXCLUDE
-  PATTERN CMakeLists.txt EXCLUDE)
-
-SET(business_gnome_GLADE business-options-gnome.glade business-prefs.glade dialog-billterms.glade dialog-choose-owner.glade
-        dialog-customer.glade dialog-date-close.glade dialog-employee.glade dialog-invoice.glade dialog-job.glade
-        dialog-order.glade dialog-payment.glade dialog-vendor.glade)
-
-SET_DIST_LIST(business_gnome_gtkbuilder_DIST CMakeLists.txt Makefile.am ${business_gnome_GLADE})
\ No newline at end of file
diff --git a/src/gnome-business/gtkbuilder/Makefile.am b/src/gnome-business/gtkbuilder/Makefile.am
deleted file mode 100644
index 9c3e52b..0000000
--- a/src/gnome-business/gtkbuilder/Makefile.am
+++ /dev/null
@@ -1,18 +0,0 @@
-gtkbuilderdir = $(GNC_GTKBUILDER_DIR)
-gtkbuilder_DATA = \
-  business-options-gnome.glade \
-  business-prefs.glade \
-  dialog-billterms.glade \
-  dialog-choose-owner.glade \
-  dialog-customer.glade \
-  dialog-date-close.glade \
-  dialog-employee.glade \
-  dialog-invoice.glade \
-  dialog-job.glade \
-  dialog-order.glade \
-  dialog-payment.glade \
-  dialog-vendor.glade
-
-EXTRA_DIST = \
-  ${gtkbuilder_DATA} \
-  CMakeLists.txt
diff --git a/src/gnome-business/ui/CMakeLists.txt b/src/gnome-business/ui/CMakeLists.txt
deleted file mode 100644
index 0b0f1e9..0000000
--- a/src/gnome-business/ui/CMakeLists.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-FILE(COPY .
-  DESTINATION ${DATADIR_BUILD}/gnucash/ui
-  PATTERN Makefile.* EXCLUDE
-  PATTERN CMakeLists.txt EXCLUDE)
-
-INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
-  DESTINATION share/gnucash
-  PATTERN Makefile.* EXCLUDE
-  PATTERN CMakeLists.txt EXCLUDE)
-
-SET(business_gnome_UI gnc-plugin-business-ui.xml gnc-plugin-page-invoice-ui.xml gnc-plugin-page-owner-tree-ui.xml)
-SET_DIST_LIST(business_gnome_ui_DIST CMakeLists.txt Makefile.am ${business_gnome_UI})
\ No newline at end of file
diff --git a/src/gnome-business/ui/Makefile.am b/src/gnome-business/ui/Makefile.am
deleted file mode 100644
index 67923df..0000000
--- a/src/gnome-business/ui/Makefile.am
+++ /dev/null
@@ -1,7 +0,0 @@
-uidir = $(GNC_UI_DIR)
-ui_DATA = \
-	gnc-plugin-business-ui.xml \
-	gnc-plugin-page-invoice-ui.xml \
-	gnc-plugin-page-owner-tree-ui.xml
-
-EXTRA_DIST = $(ui_DATA) CMakeLists.txt
diff --git a/src/gnome/gschemas/CMakeLists.txt b/src/gnome/gschemas/CMakeLists.txt
index 05e8c82..4e1f417 100644
--- a/src/gnome/gschemas/CMakeLists.txt
+++ b/src/gnome/gschemas/CMakeLists.txt
@@ -1,6 +1,7 @@
 
 SET(gnome_GSCHEMA
   org.gnucash.dialogs.gschema.xml
+  org.gnucash.dialogs.business.gschema.xml
   org.gnucash.dialogs.commodities.gschema.xml
   org.gnucash.dialogs.checkprinting.gschema.xml
   org.gnucash.dialogs.reconcile.gschema.xml
@@ -22,4 +23,4 @@ SET(gnome_gschema_DIST_local "")
 FOREACH(file ${gnome_GSCHEMA})
     LIST(APPEND gnome_gschema_DIST_local ${file}.in.in)
 ENDFOREACH()
-SET_DIST_LIST(gnome_gschema_DIST CMakeLists.txt Makefile.am ${gnome_gschema_DIST_local})
\ No newline at end of file
+SET_DIST_LIST(gnome_gschema_DIST CMakeLists.txt Makefile.am ${gnome_gschema_DIST_local})
diff --git a/src/gnome/gschemas/Makefile.am b/src/gnome/gschemas/Makefile.am
index 6e5070a..d725399 100644
--- a/src/gnome/gschemas/Makefile.am
+++ b/src/gnome/gschemas/Makefile.am
@@ -2,6 +2,7 @@
 
 gschema_in_files = \
   org.gnucash.dialogs.gschema.xml.in \
+  org.gnucash.dialogs.business.gschema.xml.in \
   org.gnucash.dialogs.commodities.gschema.xml.in \
   org.gnucash.dialogs.checkprinting.gschema.xml.in \
   org.gnucash.dialogs.reconcile.gschema.xml.in \
diff --git a/src/gnome-business/gschemas/org.gnucash.dialogs.business.gschema.xml.in.in b/src/gnome/gschemas/org.gnucash.dialogs.business.gschema.xml.in.in
similarity index 100%
rename from src/gnome-business/gschemas/org.gnucash.dialogs.business.gschema.xml.in.in
rename to src/gnome/gschemas/org.gnucash.dialogs.business.gschema.xml.in.in
diff --git a/src/gnome/gtkbuilder/CMakeLists.txt b/src/gnome/gtkbuilder/CMakeLists.txt
index f7cf10f..44ce3fd 100644
--- a/src/gnome/gtkbuilder/CMakeLists.txt
+++ b/src/gnome/gtkbuilder/CMakeLists.txt
@@ -13,18 +13,30 @@ SET(gnome_GLADE
         assistant-hierarchy.glade
         assistant-loan.glade
         assistant-stock-split.glade
+        business-options-gnome.glade
+        business-prefs.glade
+        dialog-billterms.glade
+        dialog-choose-owner.glade
         dialog-commodities.glade
-        dialog-imap-editor.glade
+        dialog-customer.glade
+        dialog-date-close.glade
+        dialog-employee.glade
         dialog-fincalc.glade
         dialog-find-account.glade
+        dialog-imap-editor.glade
+        dialog-invoice.glade
+        dialog-job.glade
         dialog-lot-viewer.glade
         dialog-new-user.glade
+        dialog-order.glade
+        dialog-payment.glade
         dialog-price.glade
         dialog-print-check.glade
         dialog-progress.glade
         dialog-sx.glade
         dialog-tax-info.glade
         dialog-trans-assoc.glade
+        dialog-vendor.glade
         gnc-plugin-page-budget.glade
         gnc-plugin-page-register2.glade
         gnc-plugin-page-register.glade
diff --git a/src/gnome/gtkbuilder/Makefile.am b/src/gnome/gtkbuilder/Makefile.am
index d0d5024..5fbc5a3 100644
--- a/src/gnome/gtkbuilder/Makefile.am
+++ b/src/gnome/gtkbuilder/Makefile.am
@@ -4,18 +4,30 @@ gtkbuilder_DATA = \
 	assistant-hierarchy.glade \
 	assistant-loan.glade \
 	assistant-stock-split.glade \
+	business-options-gnome.glade \
+	business-prefs.glade \
+	dialog-billterms.glade \
+	dialog-choose-owner.glade \
 	dialog-commodities.glade \
-	dialog-imap-editor.glade \
+	dialog-customer.glade \
+	dialog-date-close.glade \
+	dialog-employee.glade \
 	dialog-fincalc.glade \
 	dialog-find-account.glade \
+	dialog-imap-editor.glade \
+	dialog-invoice.glade \
+	dialog-job.glade \
 	dialog-lot-viewer.glade \
 	dialog-new-user.glade \
+	dialog-order.glade \
+	dialog-payment.glade \
 	dialog-price.glade \
 	dialog-print-check.glade \
 	dialog-progress.glade \
 	dialog-sx.glade \
 	dialog-tax-info.glade \
 	dialog-trans-assoc.glade \
+	dialog-vendor.glade \
 	gnc-plugin-page-budget.glade \
 	gnc-plugin-page-register.glade \
 	gnc-plugin-page-register2.glade \
diff --git a/src/gnome-business/gtkbuilder/business-options-gnome.glade b/src/gnome/gtkbuilder/business-options-gnome.glade
similarity index 100%
rename from src/gnome-business/gtkbuilder/business-options-gnome.glade
rename to src/gnome/gtkbuilder/business-options-gnome.glade
diff --git a/src/gnome-business/gtkbuilder/business-prefs.glade b/src/gnome/gtkbuilder/business-prefs.glade
similarity index 100%
rename from src/gnome-business/gtkbuilder/business-prefs.glade
rename to src/gnome/gtkbuilder/business-prefs.glade
diff --git a/src/gnome-business/gtkbuilder/dialog-billterms.glade b/src/gnome/gtkbuilder/dialog-billterms.glade
similarity index 100%
rename from src/gnome-business/gtkbuilder/dialog-billterms.glade
rename to src/gnome/gtkbuilder/dialog-billterms.glade
diff --git a/src/gnome-business/gtkbuilder/dialog-choose-owner.glade b/src/gnome/gtkbuilder/dialog-choose-owner.glade
similarity index 100%
rename from src/gnome-business/gtkbuilder/dialog-choose-owner.glade
rename to src/gnome/gtkbuilder/dialog-choose-owner.glade
diff --git a/src/gnome-business/gtkbuilder/dialog-customer.glade b/src/gnome/gtkbuilder/dialog-customer.glade
similarity index 100%
rename from src/gnome-business/gtkbuilder/dialog-customer.glade
rename to src/gnome/gtkbuilder/dialog-customer.glade
diff --git a/src/gnome-business/gtkbuilder/dialog-date-close.glade b/src/gnome/gtkbuilder/dialog-date-close.glade
similarity index 100%
rename from src/gnome-business/gtkbuilder/dialog-date-close.glade
rename to src/gnome/gtkbuilder/dialog-date-close.glade
diff --git a/src/gnome-business/gtkbuilder/dialog-employee.glade b/src/gnome/gtkbuilder/dialog-employee.glade
similarity index 100%
rename from src/gnome-business/gtkbuilder/dialog-employee.glade
rename to src/gnome/gtkbuilder/dialog-employee.glade
diff --git a/src/gnome-business/gtkbuilder/dialog-invoice.glade b/src/gnome/gtkbuilder/dialog-invoice.glade
similarity index 100%
rename from src/gnome-business/gtkbuilder/dialog-invoice.glade
rename to src/gnome/gtkbuilder/dialog-invoice.glade
diff --git a/src/gnome-business/gtkbuilder/dialog-job.glade b/src/gnome/gtkbuilder/dialog-job.glade
similarity index 100%
rename from src/gnome-business/gtkbuilder/dialog-job.glade
rename to src/gnome/gtkbuilder/dialog-job.glade
diff --git a/src/gnome-business/gtkbuilder/dialog-order.glade b/src/gnome/gtkbuilder/dialog-order.glade
similarity index 100%
rename from src/gnome-business/gtkbuilder/dialog-order.glade
rename to src/gnome/gtkbuilder/dialog-order.glade
diff --git a/src/gnome-business/gtkbuilder/dialog-payment.glade b/src/gnome/gtkbuilder/dialog-payment.glade
similarity index 100%
rename from src/gnome-business/gtkbuilder/dialog-payment.glade
rename to src/gnome/gtkbuilder/dialog-payment.glade
diff --git a/src/gnome-business/gtkbuilder/dialog-vendor.glade b/src/gnome/gtkbuilder/dialog-vendor.glade
similarity index 100%
rename from src/gnome-business/gtkbuilder/dialog-vendor.glade
rename to src/gnome/gtkbuilder/dialog-vendor.glade
diff --git a/src/gnome/ui/CMakeLists.txt b/src/gnome/ui/CMakeLists.txt
index 3cef926..e689376 100644
--- a/src/gnome/ui/CMakeLists.txt
+++ b/src/gnome/ui/CMakeLists.txt
@@ -12,10 +12,13 @@ SET(gnome_UI
       gnc-plugin-account-tree-ui.xml
       gnc-plugin-basic-commands-ui.xml
       gnc-plugin-budget-ui.xml
+      gnc-plugin-business-ui.xml
       gnc-plugin-file-history-ui.xml
       gnc-plugin-page-account-tree2-ui.xml
       gnc-plugin-page-account-tree-ui.xml
       gnc-plugin-page-budget-ui.xml
+      gnc-plugin-page-invoice-ui.xml
+      gnc-plugin-page-owner-tree-ui.xml
       gnc-plugin-page-register2-ui.xml
       gnc-plugin-page-register-ui.xml
       gnc-plugin-page-sx-list2-ui.xml
diff --git a/src/gnome/ui/Makefile.am b/src/gnome/ui/Makefile.am
index b599a3e..eef68bd 100644
--- a/src/gnome/ui/Makefile.am
+++ b/src/gnome/ui/Makefile.am
@@ -1,6 +1,7 @@
 uidir = $(GNC_UI_DIR)
 ui_DATA = \
 	gnc-plugin-budget-ui.xml \
+	gnc-plugin-business-ui.xml \
 	gnc-plugin-page-budget-ui.xml \
 	gnc-plugin-account-tree-ui.xml \
 	gnc-plugin-basic-commands-ui.xml \
@@ -10,6 +11,8 @@ ui_DATA = \
 	gnc-plugin-register-ui.xml \
 	gnc-plugin-register2-ui.xml \
 	gnc-plugin-register22-ui.xml \
+	gnc-plugin-page-invoice-ui.xml \
+	gnc-plugin-page-owner-tree-ui.xml \
 	gnc-plugin-page-register-ui.xml \
 	gnc-plugin-page-register2-ui.xml \
         gnc-plugin-page-sx-list-ui.xml \
diff --git a/src/gnome-business/ui/gnc-plugin-business-ui.xml b/src/gnome/ui/gnc-plugin-business-ui.xml
similarity index 100%
rename from src/gnome-business/ui/gnc-plugin-business-ui.xml
rename to src/gnome/ui/gnc-plugin-business-ui.xml
diff --git a/src/gnome-business/ui/gnc-plugin-page-invoice-ui.xml b/src/gnome/ui/gnc-plugin-page-invoice-ui.xml
similarity index 100%
rename from src/gnome-business/ui/gnc-plugin-page-invoice-ui.xml
rename to src/gnome/ui/gnc-plugin-page-invoice-ui.xml
diff --git a/src/gnome-business/ui/gnc-plugin-page-owner-tree-ui.xml b/src/gnome/ui/gnc-plugin-page-owner-tree-ui.xml
similarity index 100%
rename from src/gnome-business/ui/gnc-plugin-page-owner-tree-ui.xml
rename to src/gnome/ui/gnc-plugin-page-owner-tree-ui.xml

commit f34348a40cf770af69fe6401af69c5d2ea41faad
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Thu Jul 20 18:18:48 2017 +0200

    Move business-gnome subdirectory to higher level
    
    This is a first step in integrating it into the rest of the gnome directory
    and already allows us to drop the business intermediate directory

diff --git a/configure.ac b/configure.ac
index f4fbea1..7b77d3d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1781,11 +1781,10 @@ AC_CONFIG_FILES(
   src/tax/us/Makefile
   src/tax/us/test/Makefile
   src/test-core/Makefile
-  src/business/Makefile
-  src/business/business-gnome/Makefile
-  src/business/business-gnome/gtkbuilder/Makefile
-  src/business/business-gnome/gschemas/Makefile
-  src/business/business-gnome/ui/Makefile
+  src/gnome-business/Makefile
+  src/gnome-business/gtkbuilder/Makefile
+  src/gnome-business/gschemas/Makefile
+  src/gnome-business/ui/Makefile
   dnl # Stuff for bill/invoice import plugin
   src/plugins/Makefile
   src/plugins/bi_import/Makefile
@@ -1800,7 +1799,7 @@ AC_CONFIG_FILES(
   src/app-utils/migratable-prefs.xml
   src/gnome/gnucash.desktop.in
   dnl # GSettings schema files
-  src/business/business-gnome/gschemas/org.gnucash.dialogs.business.gschema.xml.in
+  src/gnome-business/gschemas/org.gnucash.dialogs.business.gschema.xml.in
   src/gnome/gschemas/org.gnucash.dialogs.checkprinting.gschema.xml.in
   src/gnome/gschemas/org.gnucash.dialogs.commodities.gschema.xml.in
   src/gnome/gschemas/org.gnucash.dialogs.gschema.xml.in
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 47616ae..904aaec 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -110,38 +110,6 @@ src/backend/xml/sixtp-stack.cpp
 src/backend/xml/sixtp-to-dom-parser.cpp
 src/backend/xml/sixtp-utils.cpp
 src/bin/gnucash-bin.c
-src/business/business-gnome/business-gnome.scm
-src/business/business-gnome/business-gnome-utils.c
-src/business/business-gnome/business-options-gnome.c
-src/business/business-gnome/business-urls.c
-src/business/business-gnome/dialog-billterms.c
-src/business/business-gnome/dialog-choose-owner.c
-src/business/business-gnome/dialog-customer.c
-src/business/business-gnome/dialog-date-close.c
-src/business/business-gnome/dialog-employee.c
-src/business/business-gnome/dialog-invoice.c
-src/business/business-gnome/dialog-job.c
-src/business/business-gnome/dialog-order.c
-src/business/business-gnome/dialog-payment.c
-src/business/business-gnome/dialog-vendor.c
-src/business/business-gnome/gncmod-business-gnome.c
-src/business/business-gnome/gnc-plugin-business.c
-src/business/business-gnome/gnc-plugin-page-invoice.c
-src/business/business-gnome/gnc-plugin-page-owner-tree.c
-[type: gettext/gsettings]src/business/business-gnome/gschemas/org.gnucash.dialogs.business.gschema.xml.in.in
-src/business/business-gnome/gtkbuilder/business-options-gnome.glade
-src/business/business-gnome/gtkbuilder/business-prefs.glade
-src/business/business-gnome/gtkbuilder/dialog-billterms.glade
-src/business/business-gnome/gtkbuilder/dialog-choose-owner.glade
-src/business/business-gnome/gtkbuilder/dialog-customer.glade
-src/business/business-gnome/gtkbuilder/dialog-date-close.glade
-src/business/business-gnome/gtkbuilder/dialog-employee.glade
-src/business/business-gnome/gtkbuilder/dialog-invoice.glade
-src/business/business-gnome/gtkbuilder/dialog-job.glade
-src/business/business-gnome/gtkbuilder/dialog-order.glade
-src/business/business-gnome/gtkbuilder/dialog-payment.glade
-src/business/business-gnome/gtkbuilder/dialog-vendor.glade
-src/business/business-gnome/search-owner.c
 src/core-utils/binreloc.c
 src/core-utils/core-utils.scm
 src/core-utils/gnc-environment.c
@@ -277,6 +245,38 @@ src/gnome/top-level.c
 src/gnome/window-autoclear.c
 src/gnome/window-reconcile2.c
 src/gnome/window-reconcile.c
+src/gnome-business/business-gnome.scm
+src/gnome-business/business-gnome-utils.c
+src/gnome-business/business-options-gnome.c
+src/gnome-business/business-urls.c
+src/gnome-business/dialog-billterms.c
+src/gnome-business/dialog-choose-owner.c
+src/gnome-business/dialog-customer.c
+src/gnome-business/dialog-date-close.c
+src/gnome-business/dialog-employee.c
+src/gnome-business/dialog-invoice.c
+src/gnome-business/dialog-job.c
+src/gnome-business/dialog-order.c
+src/gnome-business/dialog-payment.c
+src/gnome-business/dialog-vendor.c
+src/gnome-business/gncmod-business-gnome.c
+src/gnome-business/gnc-plugin-business.c
+src/gnome-business/gnc-plugin-page-invoice.c
+src/gnome-business/gnc-plugin-page-owner-tree.c
+[type: gettext/gsettings]src/gnome-business/gschemas/org.gnucash.dialogs.business.gschema.xml.in.in
+src/gnome-business/gtkbuilder/business-options-gnome.glade
+src/gnome-business/gtkbuilder/business-prefs.glade
+src/gnome-business/gtkbuilder/dialog-billterms.glade
+src/gnome-business/gtkbuilder/dialog-choose-owner.glade
+src/gnome-business/gtkbuilder/dialog-customer.glade
+src/gnome-business/gtkbuilder/dialog-date-close.glade
+src/gnome-business/gtkbuilder/dialog-employee.glade
+src/gnome-business/gtkbuilder/dialog-invoice.glade
+src/gnome-business/gtkbuilder/dialog-job.glade
+src/gnome-business/gtkbuilder/dialog-order.glade
+src/gnome-business/gtkbuilder/dialog-payment.glade
+src/gnome-business/gtkbuilder/dialog-vendor.glade
+src/gnome-business/search-owner.c
 src/gnome-search/dialog-search.c
 src/gnome-search/dialog-search.glade
 src/gnome-search/gnc-general-search.c
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index cb067fc..32036d1 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -151,11 +151,11 @@ ADD_SUBDIRECTORY (import-export)
 
 IF (WITH_GNUCASH)
   ADD_SUBDIRECTORY (bin)
-  ADD_SUBDIRECTORY (business)
   ADD_SUBDIRECTORY (cmake_modules)
   ADD_SUBDIRECTORY (debug)
   ADD_SUBDIRECTORY (doc)
   ADD_SUBDIRECTORY (gnome)
+  ADD_SUBDIRECTORY (gnome-business)
   ADD_SUBDIRECTORY (gnome-utils)
   ADD_SUBDIRECTORY (gnome-search)
   ADD_SUBDIRECTORY (html)
diff --git a/src/Makefile.am b/src/Makefile.am
index 520e33f..d11442b 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -32,8 +32,8 @@ GUI_SUBDIRS = \
   report \
   register \
   gnome \
+  gnome-business \
   import-export \
-  business \
   optional \
   plugins \
   bin
diff --git a/src/bin/overrides/gnucash-build-env.in b/src/bin/overrides/gnucash-build-env.in
index 0a8e29a..111870a 100644
--- a/src/bin/overrides/gnucash-build-env.in
+++ b/src/bin/overrides/gnucash-build-env.in
@@ -53,7 +53,7 @@ eval `${top_srcdir}/src/gnc-test-env.pl \
   --gnc-module-dir ${top_builddir}/src/import-export/ofx \
   --gnc-module-dir ${top_builddir}/src/import-export/hbci \
   --gnc-module-dir ${top_builddir}/src/import-export/log-replay \
-  --gnc-module-dir ${top_builddir}/src/business/business-gnome \
+  --gnc-module-dir ${top_builddir}/src/gnome-business \
   --guile-load-dir ${top_builddir}/src/core-utils \
   --guile-load-dir ${top_builddir}/src/gnc-module \
   --guile-load-dir ${top_builddir}/src/engine \
@@ -69,7 +69,7 @@ eval `${top_srcdir}/src/gnc-test-env.pl \
   --guile-load-dir ${top_builddir}/src/report/report-gnome \
   --guile-load-dir ${top_builddir}/src/report/stylesheets \
   --guile-load-dir ${top_builddir}/src/import-export/qif-import \
-  --guile-load-dir ${top_builddir}/src/business/business-gnome \
+  --guile-load-dir ${top_builddir}/src/gnome-business \
   --library-dir    ${top_builddir}/src/test-core \
   --library-dir    ${top_builddir}/src/libqof/qof \
   --library-dir    ${top_builddir}/src/core-utils \
diff --git a/src/business/CMakeLists.txt b/src/business/CMakeLists.txt
deleted file mode 100644
index 4e2809a..0000000
--- a/src/business/CMakeLists.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-ADD_SUBDIRECTORY(business-gnome)
-
-SET_LOCAL_DIST(business_DIST_local CMakeLists.txt Makefile.am)
-SET(business_DIST ${business_DIST_local} ${business_gnome_DIST} ${business_ledger_DIST} PARENT_SCOPE)
diff --git a/src/business/Makefile.am b/src/business/Makefile.am
deleted file mode 100644
index 08fae70..0000000
--- a/src/business/Makefile.am
+++ /dev/null
@@ -1,4 +0,0 @@
-SUBDIRS = \
-  business-gnome
-
-EXTRA_DIST = CMakeLists.txt
diff --git a/src/business/business-gnome/CMakeLists.txt b/src/gnome-business/CMakeLists.txt
similarity index 100%
rename from src/business/business-gnome/CMakeLists.txt
rename to src/gnome-business/CMakeLists.txt
diff --git a/src/business/business-gnome/Makefile.am b/src/gnome-business/Makefile.am
similarity index 100%
rename from src/business/business-gnome/Makefile.am
rename to src/gnome-business/Makefile.am
diff --git a/src/business/business-gnome/business-gnome-utils.c b/src/gnome-business/business-gnome-utils.c
similarity index 100%
rename from src/business/business-gnome/business-gnome-utils.c
rename to src/gnome-business/business-gnome-utils.c
diff --git a/src/business/business-gnome/business-gnome-utils.h b/src/gnome-business/business-gnome-utils.h
similarity index 100%
rename from src/business/business-gnome/business-gnome-utils.h
rename to src/gnome-business/business-gnome-utils.h
diff --git a/src/business/business-gnome/business-gnome.scm b/src/gnome-business/business-gnome.scm
similarity index 100%
rename from src/business/business-gnome/business-gnome.scm
rename to src/gnome-business/business-gnome.scm
diff --git a/src/business/business-gnome/business-options-gnome.c b/src/gnome-business/business-options-gnome.c
similarity index 100%
rename from src/business/business-gnome/business-options-gnome.c
rename to src/gnome-business/business-options-gnome.c
diff --git a/src/business/business-gnome/business-options-gnome.h b/src/gnome-business/business-options-gnome.h
similarity index 100%
rename from src/business/business-gnome/business-options-gnome.h
rename to src/gnome-business/business-options-gnome.h
diff --git a/src/business/business-gnome/business-urls.c b/src/gnome-business/business-urls.c
similarity index 100%
rename from src/business/business-gnome/business-urls.c
rename to src/gnome-business/business-urls.c
diff --git a/src/business/business-gnome/business-urls.h b/src/gnome-business/business-urls.h
similarity index 100%
rename from src/business/business-gnome/business-urls.h
rename to src/gnome-business/business-urls.h
diff --git a/src/business/business-gnome/dialog-billterms.c b/src/gnome-business/dialog-billterms.c
similarity index 100%
rename from src/business/business-gnome/dialog-billterms.c
rename to src/gnome-business/dialog-billterms.c
diff --git a/src/business/business-gnome/dialog-billterms.h b/src/gnome-business/dialog-billterms.h
similarity index 100%
rename from src/business/business-gnome/dialog-billterms.h
rename to src/gnome-business/dialog-billterms.h
diff --git a/src/business/business-gnome/dialog-choose-owner.c b/src/gnome-business/dialog-choose-owner.c
similarity index 100%
rename from src/business/business-gnome/dialog-choose-owner.c
rename to src/gnome-business/dialog-choose-owner.c
diff --git a/src/business/business-gnome/dialog-choose-owner.h b/src/gnome-business/dialog-choose-owner.h
similarity index 100%
rename from src/business/business-gnome/dialog-choose-owner.h
rename to src/gnome-business/dialog-choose-owner.h
diff --git a/src/business/business-gnome/dialog-customer.c b/src/gnome-business/dialog-customer.c
similarity index 100%
rename from src/business/business-gnome/dialog-customer.c
rename to src/gnome-business/dialog-customer.c
diff --git a/src/business/business-gnome/dialog-customer.h b/src/gnome-business/dialog-customer.h
similarity index 100%
rename from src/business/business-gnome/dialog-customer.h
rename to src/gnome-business/dialog-customer.h
diff --git a/src/business/business-gnome/dialog-date-close.c b/src/gnome-business/dialog-date-close.c
similarity index 100%
rename from src/business/business-gnome/dialog-date-close.c
rename to src/gnome-business/dialog-date-close.c
diff --git a/src/business/business-gnome/dialog-date-close.h b/src/gnome-business/dialog-date-close.h
similarity index 100%
rename from src/business/business-gnome/dialog-date-close.h
rename to src/gnome-business/dialog-date-close.h
diff --git a/src/business/business-gnome/dialog-employee.c b/src/gnome-business/dialog-employee.c
similarity index 100%
rename from src/business/business-gnome/dialog-employee.c
rename to src/gnome-business/dialog-employee.c
diff --git a/src/business/business-gnome/dialog-employee.h b/src/gnome-business/dialog-employee.h
similarity index 100%
rename from src/business/business-gnome/dialog-employee.h
rename to src/gnome-business/dialog-employee.h
diff --git a/src/business/business-gnome/dialog-invoice.c b/src/gnome-business/dialog-invoice.c
similarity index 100%
rename from src/business/business-gnome/dialog-invoice.c
rename to src/gnome-business/dialog-invoice.c
diff --git a/src/business/business-gnome/dialog-invoice.h b/src/gnome-business/dialog-invoice.h
similarity index 100%
rename from src/business/business-gnome/dialog-invoice.h
rename to src/gnome-business/dialog-invoice.h
diff --git a/src/business/business-gnome/dialog-job.c b/src/gnome-business/dialog-job.c
similarity index 100%
rename from src/business/business-gnome/dialog-job.c
rename to src/gnome-business/dialog-job.c
diff --git a/src/business/business-gnome/dialog-job.h b/src/gnome-business/dialog-job.h
similarity index 100%
rename from src/business/business-gnome/dialog-job.h
rename to src/gnome-business/dialog-job.h
diff --git a/src/business/business-gnome/dialog-order.c b/src/gnome-business/dialog-order.c
similarity index 100%
rename from src/business/business-gnome/dialog-order.c
rename to src/gnome-business/dialog-order.c
diff --git a/src/business/business-gnome/dialog-order.h b/src/gnome-business/dialog-order.h
similarity index 100%
rename from src/business/business-gnome/dialog-order.h
rename to src/gnome-business/dialog-order.h
diff --git a/src/business/business-gnome/dialog-payment.c b/src/gnome-business/dialog-payment.c
similarity index 100%
rename from src/business/business-gnome/dialog-payment.c
rename to src/gnome-business/dialog-payment.c
diff --git a/src/business/business-gnome/dialog-payment.h b/src/gnome-business/dialog-payment.h
similarity index 100%
rename from src/business/business-gnome/dialog-payment.h
rename to src/gnome-business/dialog-payment.h
diff --git a/src/business/business-gnome/dialog-vendor.c b/src/gnome-business/dialog-vendor.c
similarity index 100%
rename from src/business/business-gnome/dialog-vendor.c
rename to src/gnome-business/dialog-vendor.c
diff --git a/src/business/business-gnome/dialog-vendor.h b/src/gnome-business/dialog-vendor.h
similarity index 100%
rename from src/business/business-gnome/dialog-vendor.h
rename to src/gnome-business/dialog-vendor.h
diff --git a/src/business/business-gnome/gnc-plugin-business.c b/src/gnome-business/gnc-plugin-business.c
similarity index 100%
rename from src/business/business-gnome/gnc-plugin-business.c
rename to src/gnome-business/gnc-plugin-business.c
diff --git a/src/business/business-gnome/gnc-plugin-business.h b/src/gnome-business/gnc-plugin-business.h
similarity index 100%
rename from src/business/business-gnome/gnc-plugin-business.h
rename to src/gnome-business/gnc-plugin-business.h
diff --git a/src/business/business-gnome/gnc-plugin-page-invoice.c b/src/gnome-business/gnc-plugin-page-invoice.c
similarity index 100%
rename from src/business/business-gnome/gnc-plugin-page-invoice.c
rename to src/gnome-business/gnc-plugin-page-invoice.c
diff --git a/src/business/business-gnome/gnc-plugin-page-invoice.h b/src/gnome-business/gnc-plugin-page-invoice.h
similarity index 100%
rename from src/business/business-gnome/gnc-plugin-page-invoice.h
rename to src/gnome-business/gnc-plugin-page-invoice.h
diff --git a/src/business/business-gnome/gnc-plugin-page-owner-tree.c b/src/gnome-business/gnc-plugin-page-owner-tree.c
similarity index 100%
rename from src/business/business-gnome/gnc-plugin-page-owner-tree.c
rename to src/gnome-business/gnc-plugin-page-owner-tree.c
diff --git a/src/business/business-gnome/gnc-plugin-page-owner-tree.h b/src/gnome-business/gnc-plugin-page-owner-tree.h
similarity index 100%
rename from src/business/business-gnome/gnc-plugin-page-owner-tree.h
rename to src/gnome-business/gnc-plugin-page-owner-tree.h
diff --git a/src/business/business-gnome/gncmod-business-gnome.c b/src/gnome-business/gncmod-business-gnome.c
similarity index 100%
rename from src/business/business-gnome/gncmod-business-gnome.c
rename to src/gnome-business/gncmod-business-gnome.c
diff --git a/src/business/business-gnome/gschemas/CMakeLists.txt b/src/gnome-business/gschemas/CMakeLists.txt
similarity index 100%
rename from src/business/business-gnome/gschemas/CMakeLists.txt
rename to src/gnome-business/gschemas/CMakeLists.txt
diff --git a/src/business/business-gnome/gschemas/Makefile.am b/src/gnome-business/gschemas/Makefile.am
similarity index 100%
rename from src/business/business-gnome/gschemas/Makefile.am
rename to src/gnome-business/gschemas/Makefile.am
diff --git a/src/business/business-gnome/gschemas/org.gnucash.dialogs.business.gschema.xml.in.in b/src/gnome-business/gschemas/org.gnucash.dialogs.business.gschema.xml.in.in
similarity index 100%
rename from src/business/business-gnome/gschemas/org.gnucash.dialogs.business.gschema.xml.in.in
rename to src/gnome-business/gschemas/org.gnucash.dialogs.business.gschema.xml.in.in
diff --git a/src/business/business-gnome/gtkbuilder/CMakeLists.txt b/src/gnome-business/gtkbuilder/CMakeLists.txt
similarity index 100%
rename from src/business/business-gnome/gtkbuilder/CMakeLists.txt
rename to src/gnome-business/gtkbuilder/CMakeLists.txt
diff --git a/src/business/business-gnome/gtkbuilder/Makefile.am b/src/gnome-business/gtkbuilder/Makefile.am
similarity index 100%
rename from src/business/business-gnome/gtkbuilder/Makefile.am
rename to src/gnome-business/gtkbuilder/Makefile.am
diff --git a/src/business/business-gnome/gtkbuilder/business-options-gnome.glade b/src/gnome-business/gtkbuilder/business-options-gnome.glade
similarity index 100%
rename from src/business/business-gnome/gtkbuilder/business-options-gnome.glade
rename to src/gnome-business/gtkbuilder/business-options-gnome.glade
diff --git a/src/business/business-gnome/gtkbuilder/business-prefs.glade b/src/gnome-business/gtkbuilder/business-prefs.glade
similarity index 100%
rename from src/business/business-gnome/gtkbuilder/business-prefs.glade
rename to src/gnome-business/gtkbuilder/business-prefs.glade
diff --git a/src/business/business-gnome/gtkbuilder/dialog-billterms.glade b/src/gnome-business/gtkbuilder/dialog-billterms.glade
similarity index 100%
rename from src/business/business-gnome/gtkbuilder/dialog-billterms.glade
rename to src/gnome-business/gtkbuilder/dialog-billterms.glade
diff --git a/src/business/business-gnome/gtkbuilder/dialog-choose-owner.glade b/src/gnome-business/gtkbuilder/dialog-choose-owner.glade
similarity index 100%
rename from src/business/business-gnome/gtkbuilder/dialog-choose-owner.glade
rename to src/gnome-business/gtkbuilder/dialog-choose-owner.glade
diff --git a/src/business/business-gnome/gtkbuilder/dialog-customer.glade b/src/gnome-business/gtkbuilder/dialog-customer.glade
similarity index 100%
rename from src/business/business-gnome/gtkbuilder/dialog-customer.glade
rename to src/gnome-business/gtkbuilder/dialog-customer.glade
diff --git a/src/business/business-gnome/gtkbuilder/dialog-date-close.glade b/src/gnome-business/gtkbuilder/dialog-date-close.glade
similarity index 100%
rename from src/business/business-gnome/gtkbuilder/dialog-date-close.glade
rename to src/gnome-business/gtkbuilder/dialog-date-close.glade
diff --git a/src/business/business-gnome/gtkbuilder/dialog-employee.glade b/src/gnome-business/gtkbuilder/dialog-employee.glade
similarity index 100%
rename from src/business/business-gnome/gtkbuilder/dialog-employee.glade
rename to src/gnome-business/gtkbuilder/dialog-employee.glade
diff --git a/src/business/business-gnome/gtkbuilder/dialog-invoice.glade b/src/gnome-business/gtkbuilder/dialog-invoice.glade
similarity index 100%
rename from src/business/business-gnome/gtkbuilder/dialog-invoice.glade
rename to src/gnome-business/gtkbuilder/dialog-invoice.glade
diff --git a/src/business/business-gnome/gtkbuilder/dialog-job.glade b/src/gnome-business/gtkbuilder/dialog-job.glade
similarity index 100%
rename from src/business/business-gnome/gtkbuilder/dialog-job.glade
rename to src/gnome-business/gtkbuilder/dialog-job.glade
diff --git a/src/business/business-gnome/gtkbuilder/dialog-order.glade b/src/gnome-business/gtkbuilder/dialog-order.glade
similarity index 100%
rename from src/business/business-gnome/gtkbuilder/dialog-order.glade
rename to src/gnome-business/gtkbuilder/dialog-order.glade
diff --git a/src/business/business-gnome/gtkbuilder/dialog-payment.glade b/src/gnome-business/gtkbuilder/dialog-payment.glade
similarity index 100%
rename from src/business/business-gnome/gtkbuilder/dialog-payment.glade
rename to src/gnome-business/gtkbuilder/dialog-payment.glade
diff --git a/src/business/business-gnome/gtkbuilder/dialog-vendor.glade b/src/gnome-business/gtkbuilder/dialog-vendor.glade
similarity index 100%
rename from src/business/business-gnome/gtkbuilder/dialog-vendor.glade
rename to src/gnome-business/gtkbuilder/dialog-vendor.glade
diff --git a/src/business/business-gnome/search-owner.c b/src/gnome-business/search-owner.c
similarity index 100%
rename from src/business/business-gnome/search-owner.c
rename to src/gnome-business/search-owner.c
diff --git a/src/business/business-gnome/search-owner.h b/src/gnome-business/search-owner.h
similarity index 100%
rename from src/business/business-gnome/search-owner.h
rename to src/gnome-business/search-owner.h
diff --git a/src/business/business-gnome/ui/CMakeLists.txt b/src/gnome-business/ui/CMakeLists.txt
similarity index 100%
rename from src/business/business-gnome/ui/CMakeLists.txt
rename to src/gnome-business/ui/CMakeLists.txt
diff --git a/src/business/business-gnome/ui/Makefile.am b/src/gnome-business/ui/Makefile.am
similarity index 100%
rename from src/business/business-gnome/ui/Makefile.am
rename to src/gnome-business/ui/Makefile.am
diff --git a/src/business/business-gnome/ui/gnc-plugin-business-ui.xml b/src/gnome-business/ui/gnc-plugin-business-ui.xml
similarity index 100%
rename from src/business/business-gnome/ui/gnc-plugin-business-ui.xml
rename to src/gnome-business/ui/gnc-plugin-business-ui.xml
diff --git a/src/business/business-gnome/ui/gnc-plugin-page-invoice-ui.xml b/src/gnome-business/ui/gnc-plugin-page-invoice-ui.xml
similarity index 100%
rename from src/business/business-gnome/ui/gnc-plugin-page-invoice-ui.xml
rename to src/gnome-business/ui/gnc-plugin-page-invoice-ui.xml
diff --git a/src/business/business-gnome/ui/gnc-plugin-page-owner-tree-ui.xml b/src/gnome-business/ui/gnc-plugin-page-owner-tree-ui.xml
similarity index 100%
rename from src/business/business-gnome/ui/gnc-plugin-page-owner-tree-ui.xml
rename to src/gnome-business/ui/gnc-plugin-page-owner-tree-ui.xml
diff --git a/src/plugins/bi_import/CMakeLists.txt b/src/plugins/bi_import/CMakeLists.txt
index 95afc72..2bdda50 100644
--- a/src/plugins/bi_import/CMakeLists.txt
+++ b/src/plugins/bi_import/CMakeLists.txt
@@ -33,6 +33,11 @@ TARGET_LINK_LIBRARIES(gncmod-bi_import
   gnc-qof
 )
 
+TARGET_INCLUDE_DIRECTORIES(gncmod-bi_import
+  PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
+  PRIVATE ${CMAKE_SOURCE_DIR}/src/gnome-business
+)
+
 TARGET_COMPILE_DEFINITIONS(gncmod-bi_import PRIVATE -DG_LOG_DOMAIN=\"gnc.plugin.bi-import\")
 
 INSTALL(TARGETS gncmod-bi_import
@@ -42,4 +47,4 @@ INSTALL(TARGETS gncmod-bi_import
 # No headers to install.
 
 SET_LOCAL_DIST(bi_import_DIST_local CMakeLists.txt Makefile.am README ${bi_import_SOURCES} ${bi_import_noinst_HEADERS})
-SET(bi_import_DIST ${bi_import_DIST_local} ${bi_import_ui_DIST} ${bi_import_glade_DIST} PARENT_SCOPE)
\ No newline at end of file
+SET(bi_import_DIST ${bi_import_DIST_local} ${bi_import_ui_DIST} ${bi_import_glade_DIST} PARENT_SCOPE)
diff --git a/src/plugins/bi_import/Makefile.am b/src/plugins/bi_import/Makefile.am
index 9eab47d..6644552 100644
--- a/src/plugins/bi_import/Makefile.am
+++ b/src/plugins/bi_import/Makefile.am
@@ -18,7 +18,7 @@ noinst_HEADERS = \
 libgncmod_bi_import_la_LDFLAGS = -avoid-version
 
 libgncmod_bi_import_la_LIBADD = \
-  ${top_builddir}/src/business/business-gnome/libgncmod-business-gnome.la \
+  ${top_builddir}/src/gnome-business/libgncmod-business-gnome.la \
   ${top_builddir}/src/gnome-utils/libgncmod-gnome-utils.la \
   ${top_builddir}/src/app-utils/libgncmod-app-utils.la \
   ${top_builddir}/src/engine/libgncmod-engine.la \
@@ -33,7 +33,7 @@ AM_CPPFLAGS = \
   -I${top_srcdir}/src \
   -I${top_builddir}/src \
   -I${top_srcdir}/src/gnome \
-  -I${top_srcdir}/src/business/business-gnome/ \
+  -I${top_srcdir}/src/gnome-business \
   -I${top_srcdir}/src/report/report-gnome \
   -I${top_srcdir}/src/gnome-search/ \
   -I${top_srcdir}/src/register/ledger-core \
diff --git a/src/plugins/bi_import/dialog-bi-import.c b/src/plugins/bi_import/dialog-bi-import.c
index dce91a2..33a0944 100644
--- a/src/plugins/bi_import/dialog-bi-import.c
+++ b/src/plugins/bi_import/dialog-bi-import.c
@@ -59,9 +59,9 @@
 #include <gnc-gdate-utils.h>
 
 // To open the invoices for editing
-#include "business/business-gnome/gnc-plugin-page-invoice.h"
-#include "business/business-gnome/dialog-invoice.h"
-#include "business/business-gnome/business-gnome-utils.h"
+#include "gnc-plugin-page-invoice.h"
+#include "dialog-invoice.h"
+#include "business-gnome-utils.h"
 
 // this helper macro takes a regexp match and fills the model
 #define FILL_IN_HELPER(match_name,column) \
diff --git a/src/plugins/customer_import/CMakeLists.txt b/src/plugins/customer_import/CMakeLists.txt
index 0d8fe0d..1200c70 100644
--- a/src/plugins/customer_import/CMakeLists.txt
+++ b/src/plugins/customer_import/CMakeLists.txt
@@ -23,6 +23,11 @@ ADD_LIBRARY(gncmod-customer_import ${customer_import_SOURCES} ${customer_input_n
 TARGET_LINK_LIBRARIES(gncmod-customer_import gncmod-business-gnome gncmod-gnome-utils gncmod-app-utils
      gncmod-engine gnc-core-utils gnc-module gnc-qof ${GLIB2_LDFLAGS})
 
+TARGET_INCLUDE_DIRECTORIES(gncmod-bi_import
+  PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
+  PRIVATE ${CMAKE_SOURCE_DIR}/src/gnome-business
+)
+
 TARGET_COMPILE_DEFINITIONS(gncmod-customer_import PRIVATE -DG_LOG_DOMAIN=\"gnc.plugin.customer_import\")
 
 INSTALL(TARGETS gncmod-customer_import
@@ -32,4 +37,4 @@ INSTALL(TARGETS gncmod-customer_import
 # No headers to install.
 
 SET_LOCAL_DIST(customer_import_DIST_local CMakeLists.txt Makefile.am ${customer_import_SOURCES} ${customer_import_noinst_HEADERS})
-SET(customer_import_DIST ${customer_import_DIST_local} ${customer_import_glade_DIST} ${customer_import_ui_DIST} PARENT_SCOPE)
\ No newline at end of file
+SET(customer_import_DIST ${customer_import_DIST_local} ${customer_import_glade_DIST} ${customer_import_ui_DIST} PARENT_SCOPE)
diff --git a/src/plugins/customer_import/Makefile.am b/src/plugins/customer_import/Makefile.am
index 65eede8..e6f9499 100644
--- a/src/plugins/customer_import/Makefile.am
+++ b/src/plugins/customer_import/Makefile.am
@@ -16,7 +16,7 @@ noinst_HEADERS = \
 libgncmod_customer_import_la_LDFLAGS = -avoid-version
 
 libgncmod_customer_import_la_LIBADD = \
-  ${top_builddir}/src/business/business-gnome/libgncmod-business-gnome.la \
+  ${top_builddir}/src/gnome-business/libgncmod-business-gnome.la \
   ${top_builddir}/src/gnome-utils/libgncmod-gnome-utils.la \
   ${top_builddir}/src/app-utils/libgncmod-app-utils.la \
   ${top_builddir}/src/engine/libgncmod-engine.la \
@@ -31,7 +31,7 @@ AM_CPPFLAGS = \
   -I${top_srcdir}/src \
   -I${top_builddir}/src \
   -I${top_srcdir}/src/gnome \
-  -I${top_srcdir}/src/business/business-gnome/ \
+  -I${top_srcdir}/src/gnome-business/ \
   -I${top_srcdir}/src/report/report-gnome \
   -I${top_srcdir}/src/gnome-search/ \
   -I${top_srcdir}/src/register/ledger-core \
diff --git a/src/report/report-gnome/window-report.h b/src/report/report-gnome/window-report.h
index 96f33ce..ee7b9db 100644
--- a/src/report/report-gnome/window-report.h
+++ b/src/report/report-gnome/window-report.h
@@ -36,7 +36,7 @@ typedef struct gnc_report_window_s gnc_report_window;
 GtkWidget * gnc_report_window_default_params_editor(SCM options, SCM report);
 
 // called from multiple places
-// [business-gnome/dialog-invoice.c;gnome/window-register.c]; and
+// [gnome-business/dialog-invoice.c;gnome/window-register.c]; and
 // scm-exposed; 3-liner which calls gnc_main_window_open_report after handling busy-cursor.
 void       reportWindow(int id);
 gboolean   gnc_report_edit_options(SCM report);

commit 71ef0709e9ccd70304c0089e328b875f7df0584c
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Thu Jul 20 17:45:36 2017 +0200

    Remove references to long obsolete source directories

diff --git a/src/bin/overrides/gnucash-build-env.in b/src/bin/overrides/gnucash-build-env.in
index c36e0e9..0a8e29a 100644
--- a/src/bin/overrides/gnucash-build-env.in
+++ b/src/bin/overrides/gnucash-build-env.in
@@ -53,10 +53,6 @@ eval `${top_srcdir}/src/gnc-test-env.pl \
   --gnc-module-dir ${top_builddir}/src/import-export/ofx \
   --gnc-module-dir ${top_builddir}/src/import-export/hbci \
   --gnc-module-dir ${top_builddir}/src/import-export/log-replay \
-  --gnc-module-dir ${top_builddir}/src/business/business-core \
-  --gnc-module-dir ${top_builddir}/src/business/business-core/file \
-  --gnc-module-dir ${top_builddir}/src/business/business-utils \
-  --gnc-module-dir ${top_builddir}/src/business/dialog-tax-table \
   --gnc-module-dir ${top_builddir}/src/business/business-gnome \
   --guile-load-dir ${top_builddir}/src/core-utils \
   --guile-load-dir ${top_builddir}/src/gnc-module \
@@ -67,13 +63,13 @@ eval `${top_srcdir}/src/gnc-test-env.pl \
   --guile-load-dir ${top_builddir}/src/gnome-utils \
   --guile-load-dir ${top_builddir}/src/report/report-system \
   --guile-load-dir ${top_builddir}/src/report/standard-reports \
+  --guile-load-dir ${top_builddir}/src/report/business-reports \
   --guile-load-dir ${top_builddir}/src/report/utility-reports \
   --guile-load-dir ${top_builddir}/src/report/locale-specific/us \
   --guile-load-dir ${top_builddir}/src/report/report-gnome \
   --guile-load-dir ${top_builddir}/src/report/stylesheets \
   --guile-load-dir ${top_builddir}/src/import-export/qif-import \
   --guile-load-dir ${top_builddir}/src/business/business-gnome \
-  --guile-load-dir ${top_builddir}/src/business/business-reports \
   --library-dir    ${top_builddir}/src/test-core \
   --library-dir    ${top_builddir}/src/libqof/qof \
   --library-dir    ${top_builddir}/src/core-utils \

commit dd99d7873f3d06e641410715f361fb43623773ad
Author: Geert Janssens <info at kobaltwit.be>
Date:   Sat Nov 19 19:29:27 2011 +0100

    Merge business ledger into ledger-core
    
    There's no need to have it as a separate directory

diff --git a/CMakeLists.txt b/CMakeLists.txt
index de2a926..e9d973f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -673,7 +673,7 @@ add_custom_target(uninstall
         COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
 
 SET_TARGET_PROPERTIES(gnc-qof gnc-core-utils gnc-module gnc-backend-sql gnc-backend-xml-utils
-  gnc-business-ledger gnc-gnome PROPERTIES
+  gnc-gnome PROPERTIES
   LIBRARY_OUTPUT_DIRECTORY         ${CMAKE_BINARY_DIR}/lib
   IF (XCODE_VERSION)
     LIBRARY_OUTPUT_DIRECTORY_DEBUG   ${CMAKE_BINARY_DIR}/lib
diff --git a/configure.ac b/configure.ac
index cc6f82f..f4fbea1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1786,7 +1786,6 @@ AC_CONFIG_FILES(
   src/business/business-gnome/gtkbuilder/Makefile
   src/business/business-gnome/gschemas/Makefile
   src/business/business-gnome/ui/Makefile
-  src/business/business-ledger/Makefile
   dnl # Stuff for bill/invoice import plugin
   src/plugins/Makefile
   src/plugins/bi_import/Makefile
diff --git a/po/POTFILES.in b/po/POTFILES.in
index c2c555d..47616ae 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -142,12 +142,6 @@ src/business/business-gnome/gtkbuilder/dialog-order.glade
 src/business/business-gnome/gtkbuilder/dialog-payment.glade
 src/business/business-gnome/gtkbuilder/dialog-vendor.glade
 src/business/business-gnome/search-owner.c
-src/business/business-ledger/gncEntryLedger.c
-src/business/business-ledger/gncEntryLedgerControl.c
-src/business/business-ledger/gncEntryLedgerDisplay.c
-src/business/business-ledger/gncEntryLedgerLayout.c
-src/business/business-ledger/gncEntryLedgerLoad.c
-src/business/business-ledger/gncEntryLedgerModel.c
 src/core-utils/binreloc.c
 src/core-utils/core-utils.scm
 src/core-utils/gnc-environment.c
@@ -524,6 +518,12 @@ src/plugins/customer_import/libgncmod-customer_import.c
 src/plugins/example/gncmod-example.c
 src/plugins/example/gnc-plugin.example.c
 src/python/gncmod-python.c
+src/register/ledger-core/gncEntryLedger.c
+src/register/ledger-core/gncEntryLedgerControl.c
+src/register/ledger-core/gncEntryLedgerDisplay.c
+src/register/ledger-core/gncEntryLedgerLayout.c
+src/register/ledger-core/gncEntryLedgerLoad.c
+src/register/ledger-core/gncEntryLedgerModel.c
 src/register/ledger-core/gnc-ledger-display2.c
 src/register/ledger-core/gnc-ledger-display.c
 src/register/ledger-core/gncmod-ledger-core.c
diff --git a/src/bin/overrides/gnucash-build-env.in b/src/bin/overrides/gnucash-build-env.in
index 99fdb7a..c36e0e9 100644
--- a/src/bin/overrides/gnucash-build-env.in
+++ b/src/bin/overrides/gnucash-build-env.in
@@ -57,7 +57,6 @@ eval `${top_srcdir}/src/gnc-test-env.pl \
   --gnc-module-dir ${top_builddir}/src/business/business-core/file \
   --gnc-module-dir ${top_builddir}/src/business/business-utils \
   --gnc-module-dir ${top_builddir}/src/business/dialog-tax-table \
-  --gnc-module-dir ${top_builddir}/src/business/business-ledger \
   --gnc-module-dir ${top_builddir}/src/business/business-gnome \
   --guile-load-dir ${top_builddir}/src/core-utils \
   --guile-load-dir ${top_builddir}/src/gnc-module \
@@ -92,7 +91,6 @@ eval `${top_srcdir}/src/gnc-test-env.pl \
   --library-dir    ${top_builddir}/src/register/register-gnome \
   --library-dir    ${top_builddir}/src/register/register-core \
   --library-dir    ${top_builddir}/src/register/ledger-core \
-  --library-dir    ${top_builddir}/src/business/business-ledger \
   --library-dir    ${top_builddir}/src/report/report-system \
   --library-dir    ${top_builddir}/src/report/report-gnome
   `
diff --git a/src/business/CMakeLists.txt b/src/business/CMakeLists.txt
index 3bf7f7d..4e2809a 100644
--- a/src/business/CMakeLists.txt
+++ b/src/business/CMakeLists.txt
@@ -1,5 +1,4 @@
 ADD_SUBDIRECTORY(business-gnome)
-ADD_SUBDIRECTORY(business-ledger)
 
 SET_LOCAL_DIST(business_DIST_local CMakeLists.txt Makefile.am)
-SET(business_DIST ${business_DIST_local} ${business_gnome_DIST} ${business_ledger_DIST} PARENT_SCOPE)
\ No newline at end of file
+SET(business_DIST ${business_DIST_local} ${business_gnome_DIST} ${business_ledger_DIST} PARENT_SCOPE)
diff --git a/src/business/Makefile.am b/src/business/Makefile.am
index 4a62eea..08fae70 100644
--- a/src/business/Makefile.am
+++ b/src/business/Makefile.am
@@ -1,5 +1,4 @@
 SUBDIRS = \
-  business-ledger \
   business-gnome
 
 EXTRA_DIST = CMakeLists.txt
diff --git a/src/business/business-gnome/CMakeLists.txt b/src/business/business-gnome/CMakeLists.txt
index ab69f59..1717ac9 100644
--- a/src/business/business-gnome/CMakeLists.txt
+++ b/src/business/business-gnome/CMakeLists.txt
@@ -50,7 +50,7 @@ ADD_LIBRARY(gncmod-business-gnome
   ${business_gnome_HEADERS}
 )
 
-TARGET_LINK_LIBRARIES(gncmod-business-gnome gnc-business-ledger gncmod-gnome-search 
+TARGET_LINK_LIBRARIES(gncmod-business-gnome gncmod-ledger-core gncmod-gnome-search 
    gncmod-report-gnome gncmod-gnome-utils gnc-gnome gncmod-engine gnc-qof ${GTK3_LDFLAGS})
 
 TARGET_COMPILE_DEFINITIONS(gncmod-business-gnome PRIVATE -DG_LOG_DOMAIN=\"gnc.business.gnome\")
diff --git a/src/business/business-gnome/Makefile.am b/src/business/business-gnome/Makefile.am
index 06007ad..a583ab3 100644
--- a/src/business/business-gnome/Makefile.am
+++ b/src/business/business-gnome/Makefile.am
@@ -14,7 +14,6 @@ AM_CPPFLAGS = \
   -I${top_srcdir}/src/gnome-search \
   -I${top_srcdir}/src/html \
   -I${top_srcdir}/src/report/report-gnome \
-  -I${top_srcdir}/src/business/business-ledger \
   -I${top_srcdir}/src/register/register-core \
   -I${top_srcdir}/src/register/register-gnome \
   -I${top_srcdir}/src/register/ledger-core \
@@ -66,9 +65,9 @@ libgncmod_business_gnome_la_LDFLAGS = -avoid-version
 
 libgncmod_business_gnome_la_LIBADD = \
   ${top_builddir}/src/gnome/libgnc-gnome.la \
-  ${top_builddir}/src/business/business-ledger/libgnc-business-ledger.la \
   ${top_builddir}/src/register/register-core/libgncmod-register-core.la \
   ${top_builddir}/src/register/register-gnome/libgncmod-register-gnome.la \
+  ${top_builddir}/src/register/ledger-core/libgncmod-ledger-core.la \
   ${top_builddir}/src/report/report-gnome/libgncmod-report-gnome.la \
   ${top_builddir}/src/gnome-search/libgncmod-gnome-search.la \
   ${top_builddir}/src/gnome-utils/libgncmod-gnome-utils.la \
diff --git a/src/business/business-ledger/CMakeLists.txt b/src/business/business-ledger/CMakeLists.txt
deleted file mode 100644
index ebf5bf5..0000000
--- a/src/business/business-ledger/CMakeLists.txt
+++ /dev/null
@@ -1,37 +0,0 @@
-
-SET (gnc_business_ledger_SOURCES
-  gncEntryLedger.c
-  gncEntryLedgerControl.c
-  gncEntryLedgerDisplay.c
-  gncEntryLedgerLayout.c
-  gncEntryLedgerLoad.c
-  gncEntryLedgerModel.c
-)
-
-SET (gnc_business_ledger_noinst_HEADERS
-  gncEntryLedger.h
-  gncEntryLedgerP.h
-  gncEntryLedgerControl.h
-  gncEntryLedgerLayout.h
-  gncEntryLedgerModel.h
-)
-
-ADD_LIBRARY (gnc-business-ledger
-  ${gnc_business_ledger_SOURCES}
-  ${gnc_business_ledger_noinst_HEADERS}
-)
-
-TARGET_LINK_LIBRARIES(gnc-business-ledger gncmod-ledger-core  gncmod-register-core gncmod-engine gncmod-gnome-utils
-                            gnc-core-utils ${GTK3_LDFLAGS})
-
-TARGET_COMPILE_DEFINITIONS (gnc-business-ledger PRIVATE -DG_LOG_DOMAIN=\"gnc.business.ledger\")
-
-TARGET_INCLUDE_DIRECTORIES (gnc-business-ledger PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
-
-INSTALL(TARGETS gnc-business-ledger
-  LIBRARY DESTINATION lib
-  ARCHIVE DESTINATION lib
-  RUNTIME DESTINATION bin)
-# No headers to install
-
-SET_DIST_LIST(business_ledger_DIST CMakeLists.txt Makefile.am ${gnc_business_ledger_SOURCES} ${gnc_business_ledger_noinst_HEADERS})
diff --git a/src/business/business-ledger/Makefile.am b/src/business/business-ledger/Makefile.am
deleted file mode 100644
index 77bac56..0000000
--- a/src/business/business-ledger/Makefile.am
+++ /dev/null
@@ -1,46 +0,0 @@
-SUBDIRS = .
-
-lib_LTLIBRARIES = libgnc-business-ledger.la
-
-libgnc_business_ledger_la_SOURCES = \
-  gncEntryLedger.c \
-  gncEntryLedgerControl.c \
-  gncEntryLedgerDisplay.c \
-  gncEntryLedgerLayout.c \
-  gncEntryLedgerLoad.c \
-  gncEntryLedgerModel.c
-
-noinst_HEADERS = \
-  gncEntryLedger.h \
-  gncEntryLedgerP.h \
-  gncEntryLedgerControl.h \
-  gncEntryLedgerLayout.h \
-  gncEntryLedgerModel.h
-
-libgnc_business_ledger_la_LIBADD = \
-  ${top_builddir}/src/register/register-core/libgncmod-register-core.la \
-  ${top_builddir}/src/register/register-gnome/libgncmod-register-gnome.la \
-  ${top_builddir}/src/gnome-utils/libgncmod-gnome-utils.la \
-  ${top_builddir}/src/app-utils/libgncmod-app-utils.la \
-  ${top_builddir}/src/engine/libgncmod-engine.la \
-  ${top_builddir}/src/core-utils/libgnc-core-utils.la \
-  ${top_builddir}/src/libqof/qof/libgnc-qof.la \
-  ${GTK_LIBS} \
-  ${GLIB_LIBS}
-
-AM_CPPFLAGS = \
-  -I${top_srcdir}/src \
-  -I${top_builddir}/src \
-  -I${top_srcdir}/src/engine \
-  -I${top_srcdir}/src/core-utils \
-  -I${top_srcdir}/src/gnc-module \
-  -I${top_srcdir}/src/app-utils \
-  -I${top_srcdir}/src/gnome-utils \
-  -I${top_srcdir}/src/register/register-core \
-  -I${top_srcdir}/src/libqof/qof \
-  ${GTK_CFLAGS} \
-  ${GLIB_CFLAGS}
-
-AM_CPPFLAGS += -DG_LOG_DOMAIN=\"gnc.business.ledger\"
-
-EXTRA_DIST = CMakeLists.txt
diff --git a/src/plugins/bi_import/Makefile.am b/src/plugins/bi_import/Makefile.am
index bf40004..9eab47d 100644
--- a/src/plugins/bi_import/Makefile.am
+++ b/src/plugins/bi_import/Makefile.am
@@ -37,7 +37,7 @@ AM_CPPFLAGS = \
   -I${top_srcdir}/src/report/report-gnome \
   -I${top_srcdir}/src/gnome-search/ \
   -I${top_srcdir}/src/register/ledger-core \
-  -I${top_srcdir}/src/business/business-ledger/ \
+  -I${top_srcdir}/src/register/ledger-business \
   -I${top_srcdir}/src/register/register-gnome \
   -I${top_srcdir}/src/register/register-core \
   -I${top_srcdir}/src/business/dialog-tax-table \
diff --git a/src/plugins/customer_import/Makefile.am b/src/plugins/customer_import/Makefile.am
index 5a3dbf8..65eede8 100644
--- a/src/plugins/customer_import/Makefile.am
+++ b/src/plugins/customer_import/Makefile.am
@@ -35,7 +35,6 @@ AM_CPPFLAGS = \
   -I${top_srcdir}/src/report/report-gnome \
   -I${top_srcdir}/src/gnome-search/ \
   -I${top_srcdir}/src/register/ledger-core \
-  -I${top_srcdir}/src/business/business-ledger/ \
   -I${top_srcdir}/src/register/register-gnome \
   -I${top_srcdir}/src/register/register-core \
   -I${top_srcdir}/src/business/dialog-tax-table \
diff --git a/src/register/Makefile.am b/src/register/Makefile.am
index 5a7ecd3..1741d63 100644
--- a/src/register/Makefile.am
+++ b/src/register/Makefile.am
@@ -1,3 +1,3 @@
-SUBDIRS=register-core register-gnome ledger-core 
+SUBDIRS=register-core register-gnome ledger-core
 
 EXTRA_DIST = CMakeLists.txt
diff --git a/src/register/ledger-core/CMakeLists.txt b/src/register/ledger-core/CMakeLists.txt
index 5341fb3..295e76a 100644
--- a/src/register/ledger-core/CMakeLists.txt
+++ b/src/register/ledger-core/CMakeLists.txt
@@ -12,8 +12,15 @@ SET (ledger_core_SOURCES
   split-register-model.c
   split-register-model-save.c
   split-register-util.c
+  gncEntryLedger.c
+  gncEntryLedgerControl.c
+  gncEntryLedgerDisplay.c
+  gncEntryLedgerLayout.c
+  gncEntryLedgerLoad.c
+  gncEntryLedgerModel.c
 )
 
+
 SET (ledger_core_HEADERS
   gnc-ledger-display.h
   gnc-ledger-display2.h
@@ -23,6 +30,11 @@ SET (ledger_core_HEADERS
   split-register-model.h
   split-register-model-save.h
   split-register-p.h
+  gncEntryLedger.h
+  gncEntryLedgerP.h
+  gncEntryLedgerControl.h
+  gncEntryLedgerLayout.h
+  gncEntryLedgerModel.h
 )
 
 # Add dependency on config.h
@@ -31,7 +43,7 @@ SET_SOURCE_FILES_PROPERTIES (${ledger_core_SOURCES} PROPERTIES OBJECT_DEPENDS ${
 ADD_LIBRARY (gncmod-ledger-core ${ledger_core_SOURCES} ${ledger_core_HEADERS})
 
 TARGET_LINK_LIBRARIES(gncmod-ledger-core gncmod-register-gnome gncmod-register-core gncmod-gnome-utils
-        gncmod-engine ${GTK3_LDFLAGS})
+        gncmod-engine gnc-core-utils ${GTK3_LDFLAGS})
 
 TARGET_COMPILE_DEFINITIONS (gncmod-ledger-core PRIVATE -DG_LOG_DOMAIN=\"gnc.register.ledger\")
 
@@ -43,5 +55,7 @@ INSTALL(TARGETS gncmod-ledger-core
   RUNTIME DESTINATION bin)
 # No headers to install
 
+
 SET_LOCAL_DIST(ledger_core_DIST_local CMakeLists.txt Makefile.am ${ledger_core_SOURCES} ${ledger_core_HEADERS})
 SET(ledger_core_DIST ${ledger_core_DIST_local} ${test_ledger_core_DIST} PARENT_SCOPE)
+
diff --git a/src/register/ledger-core/Makefile.am b/src/register/ledger-core/Makefile.am
index 1eb9578..b0e256d 100644
--- a/src/register/ledger-core/Makefile.am
+++ b/src/register/ledger-core/Makefile.am
@@ -12,7 +12,13 @@ libgncmod_ledger_core_la_SOURCES = \
   split-register-load.c \
   split-register-model.c \
   split-register-model-save.c \
-  split-register-util.c
+  split-register-util.c \
+  gncEntryLedger.c \
+  gncEntryLedgerControl.c \
+  gncEntryLedgerDisplay.c \
+  gncEntryLedgerLayout.c \
+  gncEntryLedgerLoad.c \
+  gncEntryLedgerModel.c
 
 noinst_HEADERS = \
   gnc-ledger-display.h \
@@ -22,7 +28,12 @@ noinst_HEADERS = \
   split-register-layout.h \
   split-register-model.h \
   split-register-model-save.h \
-  split-register-p.h
+  split-register-p.h \
+  gncEntryLedger.h \
+  gncEntryLedgerP.h \
+  gncEntryLedgerControl.h \
+  gncEntryLedgerLayout.h \
+  gncEntryLedgerModel.h
 
 libgncmod_ledger_core_la_LDFLAGS = -avoid-version
 
diff --git a/src/business/business-ledger/gncEntryLedger.c b/src/register/ledger-core/gncEntryLedger.c
similarity index 100%
rename from src/business/business-ledger/gncEntryLedger.c
rename to src/register/ledger-core/gncEntryLedger.c
diff --git a/src/business/business-ledger/gncEntryLedger.h b/src/register/ledger-core/gncEntryLedger.h
similarity index 100%
rename from src/business/business-ledger/gncEntryLedger.h
rename to src/register/ledger-core/gncEntryLedger.h
diff --git a/src/business/business-ledger/gncEntryLedgerControl.c b/src/register/ledger-core/gncEntryLedgerControl.c
similarity index 100%
rename from src/business/business-ledger/gncEntryLedgerControl.c
rename to src/register/ledger-core/gncEntryLedgerControl.c
diff --git a/src/business/business-ledger/gncEntryLedgerControl.h b/src/register/ledger-core/gncEntryLedgerControl.h
similarity index 100%
rename from src/business/business-ledger/gncEntryLedgerControl.h
rename to src/register/ledger-core/gncEntryLedgerControl.h
diff --git a/src/business/business-ledger/gncEntryLedgerDisplay.c b/src/register/ledger-core/gncEntryLedgerDisplay.c
similarity index 100%
rename from src/business/business-ledger/gncEntryLedgerDisplay.c
rename to src/register/ledger-core/gncEntryLedgerDisplay.c
diff --git a/src/business/business-ledger/gncEntryLedgerLayout.c b/src/register/ledger-core/gncEntryLedgerLayout.c
similarity index 99%
rename from src/business/business-ledger/gncEntryLedgerLayout.c
rename to src/register/ledger-core/gncEntryLedgerLayout.c
index 27b103a..5d2b213 100644
--- a/src/business/business-ledger/gncEntryLedgerLayout.c
+++ b/src/register/ledger-core/gncEntryLedgerLayout.c
@@ -289,5 +289,3 @@ TableLayout * gnc_entry_ledger_layout_new (GncEntryLedger *ledger)
 
     return layout;
 }
-
-
diff --git a/src/business/business-ledger/gncEntryLedgerLayout.h b/src/register/ledger-core/gncEntryLedgerLayout.h
similarity index 100%
rename from src/business/business-ledger/gncEntryLedgerLayout.h
rename to src/register/ledger-core/gncEntryLedgerLayout.h
diff --git a/src/business/business-ledger/gncEntryLedgerLoad.c b/src/register/ledger-core/gncEntryLedgerLoad.c
similarity index 100%
rename from src/business/business-ledger/gncEntryLedgerLoad.c
rename to src/register/ledger-core/gncEntryLedgerLoad.c
diff --git a/src/business/business-ledger/gncEntryLedgerModel.c b/src/register/ledger-core/gncEntryLedgerModel.c
similarity index 100%
rename from src/business/business-ledger/gncEntryLedgerModel.c
rename to src/register/ledger-core/gncEntryLedgerModel.c
diff --git a/src/business/business-ledger/gncEntryLedgerModel.h b/src/register/ledger-core/gncEntryLedgerModel.h
similarity index 100%
rename from src/business/business-ledger/gncEntryLedgerModel.h
rename to src/register/ledger-core/gncEntryLedgerModel.h
diff --git a/src/business/business-ledger/gncEntryLedgerP.h b/src/register/ledger-core/gncEntryLedgerP.h
similarity index 100%
rename from src/business/business-ledger/gncEntryLedgerP.h
rename to src/register/ledger-core/gncEntryLedgerP.h



Summary of changes:
 .gitignore                                         |  325 +-
 CMakeLists.txt                                     |  209 +-
 HACKING                                            |    2 +-
 Makefile.am                                        |   16 +-
 art/tango/gnc-invoice-pay.svg                      |  786 ---
 bindings/CMakeLists.txt                            |    4 +
 bindings/Makefile.am                               |    6 +
 bindings/python/CMakeLists.txt                     |  118 +
 bindings/python/Makefile.am                        |  137 +
 .../python}/__init__.py                            |    0
 .../python}/example_scripts/CMakeLists.txt         |    0
 .../python}/example_scripts/Invoice.tex            |    0
 .../python}/example_scripts/Invoice.tex.tmpl       |    0
 .../python}/example_scripts/Invoice_2.tex.tmpl     |    0
 .../python}/example_scripts/account_analysis.py    |    0
 .../python}/example_scripts/change_tax_code.py     |    0
 .../python}/example_scripts/get_quotes.pl          |    0
 .../python}/example_scripts/gnc_convenience.py     |    0
 .../python}/example_scripts/gncinvoice_jinja.py    |    0
 .../python}/example_scripts/gncinvoicefkt.py       |    0
 .../example_scripts/invoice_export_doxygen.txt     |    0
 .../python}/example_scripts/latex_invoices.py      |    0
 .../new_book_with_opening_balances.py              |    0
 .../python}/example_scripts/priceDB_test.py        |    0
 .../example_scripts/price_database_example.py      |    0
 .../python}/example_scripts/quotes_historic.py     |    0
 .../python}/example_scripts/rest-api/README        |    0
 .../example_scripts/rest-api/gnucash_rest.py       |    0
 .../example_scripts/rest-api/gnucash_simple.py     |    0
 .../python}/example_scripts/simple_book.py         |    0
 .../example_scripts/simple_business_create.py      |    0
 .../example_scripts/simple_invoice_insert.py       |    0
 .../python}/example_scripts/simple_session.py      |    0
 .../example_scripts/simple_sqlite_create.py        |    0
 .../python}/example_scripts/simple_test.py         |    0
 .../python}/example_scripts/str_methods.py         |    0
 .../example_scripts/test_imbalance_transaction.py  |    0
 .../python}/function_class.py                      |    0
 .../python}/gnucash_business.py                    |    0
 bindings/python/gnucash_core.i                     |  229 +
 .../python}/gnucash_core.py                        |    0
 .../python}/sqlite3test.c                          |    0
 .../python}/tests/CMakeLists.txt                   |    0
 bindings/python/tests/Makefile.am                  |   53 +
 .../python}/tests/runTests.py.in                   |    0
 .../python}/tests/test_account.py                  |    0
 .../python}/tests/test_book.py                     |    0
 .../python}/tests/test_business.py                 |    0
 .../python}/tests/test_commodity.py                |    0
 .../python}/tests/test_split.py                    |    0
 .../python}/tests/test_transaction.py              |    0
 .../python-bindings => bindings/python}/timespec.i |    0
 cmake/CMakeLists.txt                               |    2 +-
 common/CMakeLists.txt                              |   25 +
 common/Makefile.am                                 |   43 +
 {src => common}/base-typemaps.i                    |    0
 {src => common}/cmake_modules/CMakeLists.txt       |    0
 .../cmake_modules/COPYING-CMAKE-SCRIPTS.txt        |    0
 .../cmake_modules/GncAddGSchemaTargets.cmake       |    0
 common/cmake_modules/GncAddSchemeTargets.cmake     |  183 +
 common/cmake_modules/GncAddSwigCommand.cmake       |   31 +
 common/cmake_modules/GncAddTest.cmake              |  163 +
 {src => common}/cmake_modules/GncConfigure.cmake   |    0
 .../cmake_modules/GncFindPkgConfig.cmake           |    0
 .../MacroAddSourceFileCompileFlags.cmake           |    0
 .../cmake_modules/MacroAppendForeach.cmake         |    0
 common/cmake_modules/MakeDist.cmake                |  207 +
 {src => common}/cmake_modules/MakeDistCheck.cmake  |    0
 common/cmake_modules/MakeDistFiles.cmake           |  109 +
 {src => common}/config.h.cmake.in                  |    0
 {src => common}/debug/CMakeLists.txt               |    0
 {src => common}/debug/Makefile.am                  |    0
 {src => common}/debug/splint-defs.h                |    0
 {src => common}/debug/valgrind/CMakeLists.txt      |    0
 {src => common}/debug/valgrind/Makefile.am         |    0
 {src => common}/debug/valgrind/valgrind-gdk.supp   |    0
 {src => common}/debug/valgrind/valgrind-glib.supp  |    0
 .../debug/valgrind/valgrind-gnucash.supp           |    0
 .../debug/valgrind/valgrind-libfontconfig.supp     |    0
 .../debug/valgrind/valgrind-libgda.supp            |    0
 .../debug/valgrind/valgrind-libguile.supp          |    0
 {src => common}/debug/valgrind/valgrind-x11.supp   |    0
 {src => common}/gnc-test-env.pl                    |    0
 {src => common}/guile-mappings.h                   |    0
 {src => common}/platform.h                         |    0
 {src => common}/swig-utf8.patch                    |    0
 common/test-core/CMakeLists.txt                    |   81 +
 common/test-core/Makefile.am                       |  144 +
 {src => common}/test-core/test-stuff.c             |    0
 {src => common}/test-core/test-stuff.h             |    0
 {src => common}/test-core/unittest-support.c       |    0
 {src => common}/test-core/unittest-support.h       |    0
 {src => common}/test-core/unittest-support.i       |    0
 {src => common}/test-core/unittest-support.scm     |    0
 common/test-core/unittest_support.py               |  166 +
 configure.ac                                       |  470 +-
 {art => contrib/art}/banner.svgz                   |  Bin
 {art => contrib/art}/icon.svgz                     |  Bin
 {art => contrib/art}/logo.svgz                     |  Bin
 {art => contrib/art}/splash.svgz                   |  Bin
 {art => contrib/art}/stock_split_title.png         |  Bin
 {art => contrib/art}/stock_split_watermark.png     |  Bin
 {art => contrib/art}/tango/README                  |    0
 contrib/art/tango/gnc-invoice-pay.svg              |  786 +++
 {art => contrib/art}/tango/gnucash-16x16.svg       |    0
 {art => contrib/art}/tango/gnucash-22x22.svg       |    0
 {art => contrib/art}/tango/gnucash-32x32.svg       |    0
 {art => contrib/art}/tango/gnucash-48x48+.svg      |    0
 data/CMakeLists.txt                                |   11 +
 data/Makefile.am                                   |    4 +
 {accounts => data/accounts}/C/CMakeLists.txt       |    0
 {accounts => data/accounts}/C/Makefile.am          |    0
 .../accounts}/C/acctchrt_brokerage.gnucash-xea     |    0
 .../accounts}/C/acctchrt_business.gnucash-xea      |    0
 .../accounts}/C/acctchrt_carloan.gnucash-xea       |    0
 .../accounts}/C/acctchrt_cdmoneymkt.gnucash-xea    |    0
 .../accounts}/C/acctchrt_checkbook.gnucash-xea     |    0
 .../accounts}/C/acctchrt_childcare.gnucash-xea     |    0
 .../accounts}/C/acctchrt_common.gnucash-xea        |    0
 .../accounts}/C/acctchrt_eduloan.gnucash-xea       |    0
 .../accounts}/C/acctchrt_fixedassets.gnucash-xea   |    0
 .../accounts}/C/acctchrt_full.gnucash-xea          |    0
 .../accounts}/C/acctchrt_homeloan.gnucash-xea      |    0
 .../accounts}/C/acctchrt_homeown.gnucash-xea       |    0
 .../accounts}/C/acctchrt_otherloan.gnucash-xea     |    0
 .../accounts}/C/acctchrt_renter.gnucash-xea        |    0
 .../accounts}/C/acctchrt_retiremt.gnucash-xea      |    0
 .../accounts}/C/acctchrt_spouseinc.gnucash-xea     |    0
 .../accounts}/C/acctchrt_spouseretire.gnucash-xea  |    0
 {accounts => data/accounts}/CMakeLists.txt         |    0
 {accounts => data/accounts}/Makefile.am            |    0
 {accounts => data/accounts}/cs/CMakeLists.txt      |    0
 {accounts => data/accounts}/cs/Makefile.am         |    0
 .../accounts}/cs/acctchrt_brokerage.gnucash-xea    |    0
 .../accounts}/cs/acctchrt_carloan.gnucash-xea      |    0
 .../accounts}/cs/acctchrt_cdmoneymkt.gnucash-xea   |    0
 .../accounts}/cs/acctchrt_childcare.gnucash-xea    |    0
 .../accounts}/cs/acctchrt_common.gnucash-xea       |    0
 .../accounts}/cs/acctchrt_currency.gnucash-xea     |    0
 .../accounts}/cs/acctchrt_eduloan.gnucash-xea      |    0
 .../accounts}/cs/acctchrt_fixedassets.gnucash-xea  |    0
 .../accounts}/cs/acctchrt_homeloan.gnucash-xea     |    0
 .../accounts}/cs/acctchrt_homeown.gnucash-xea      |    0
 .../accounts}/cs/acctchrt_otherloan.gnucash-xea    |    0
 .../accounts}/cs/acctchrt_renter.gnucash-xea       |    0
 .../accounts}/cs/acctchrt_retiremt.gnucash-xea     |    0
 .../accounts}/cs/acctchrt_spouseinc.gnucash-xea    |    0
 .../accounts}/cs/acctchrt_spouseretire.gnucash-xea |    0
 {accounts => data/accounts}/da/CMakeLists.txt      |    0
 {accounts => data/accounts}/da/Makefile.am         |    0
 .../accounts}/da/acctchrt_car.gnucash-xea          |    0
 .../accounts}/da/acctchrt_common.gnucash-xea       |    0
 .../accounts}/da/acctchrt_homeloan.gnucash-xea     |    0
 .../accounts}/da/acctchrt_homeown.gnucash-xea      |    0
 {accounts => data/accounts}/de_AT/CMakeLists.txt   |    0
 {accounts => data/accounts}/de_AT/Makefile.am      |    0
 .../accounts}/de_AT/acctchrt_auto.gnucash-xea      |    0
 .../accounts}/de_AT/acctchrt_autoloan.gnucash-xea  |    0
 .../accounts}/de_AT/acctchrt_brokerage.gnucash-xea |    0
 .../accounts}/de_AT/acctchrt_business.gnucash-xea  |    0
 .../accounts}/de_AT/acctchrt_common.gnucash-xea    |    0
 .../accounts}/de_AT/acctchrt_houseown.gnucash-xea  |    0
 .../de_AT/acctchrt_investment.gnucash-xea          |    0
 .../accounts}/de_AT/acctchrt_kids.gnucash-xea      |    0
 {accounts => data/accounts}/de_CH/CMakeLists.txt   |    0
 {accounts => data/accounts}/de_CH/Makefile.am      |    0
 .../accounts}/de_CH/acctchrt_brokerage.gnucash-xea |    0
 .../accounts}/de_CH/acctchrt_chkmu.gnucash-xea     |    0
 .../accounts}/de_CH/acctchrt_common.gnucash-xea    |    0
 .../accounts}/de_CH/acctchrt_kids.gnucash-xea      |    0
 .../de_CH/acctchrt_otherasset.gnucash-xea          |    0
 .../accounts}/de_CH/acctchrt_otherloan.gnucash-xea |    0
 {accounts => data/accounts}/de_DE/CMakeLists.txt   |    0
 {accounts => data/accounts}/de_DE/Makefile.am      |    0
 .../accounts}/de_DE/acctchrt_auto.gnucash-xea      |    0
 .../accounts}/de_DE/acctchrt_autoloan.gnucash-xea  |    0
 .../accounts}/de_DE/acctchrt_brokerage.gnucash-xea |    0
 .../accounts}/de_DE/acctchrt_common.gnucash-xea    |    0
 .../accounts}/de_DE/acctchrt_full.gnucash-xea      |    0
 .../accounts}/de_DE/acctchrt_houseown.gnucash-xea  |    0
 .../de_DE/acctchrt_investment.gnucash-xea          |    0
 .../accounts}/de_DE/acctchrt_kids.gnucash-xea      |    0
 .../de_DE/acctchrt_otherasset.gnucash-xea          |    0
 .../accounts}/de_DE/acctchrt_otherloan.gnucash-xea |    0
 .../accounts}/de_DE/acctchrt_skr03.gnucash-xea     |    0
 .../accounts}/de_DE/acctchrt_skr04.gnucash-xea     |    0
 .../accounts}/de_DE/acctchrt_skr49.gnucash-xea     |    0
 .../accounts}/de_DE/acctchrt_studium.gnucash-xea   |    0
 .../accounts}/de_DE/acctchrt_wohnungsw.gnucash-xea |    0
 {accounts => data/accounts}/el_GR/CMakeLists.txt   |    0
 {accounts => data/accounts}/el_GR/Makefile.am      |    0
 .../accounts}/el_GR/acctchrt_brokerage.gnucash-xea |    0
 .../accounts}/el_GR/acctchrt_carloan.gnucash-xea   |    0
 .../accounts}/el_GR/acctchrt_common.gnucash-xea    |    0
 {accounts => data/accounts}/en_GB/CMakeLists.txt   |    0
 {accounts => data/accounts}/en_GB/Makefile.am      |    0
 .../accounts}/en_GB/acctchrt_brokerage.gnucash-xea |    0
 .../accounts}/en_GB/acctchrt_business.gnucash-xea  |    0
 .../accounts}/en_GB/acctchrt_carloan.gnucash-xea   |    0
 .../en_GB/acctchrt_cdmoneymkt.gnucash-xea          |    0
 .../accounts}/en_GB/acctchrt_checkbook.gnucash-xea |    0
 .../accounts}/en_GB/acctchrt_childcare.gnucash-xea |    0
 .../accounts}/en_GB/acctchrt_common.gnucash-xea    |    0
 .../accounts}/en_GB/acctchrt_eduloan.gnucash-xea   |    0
 .../en_GB/acctchrt_fixedassets.gnucash-xea         |    0
 .../accounts}/en_GB/acctchrt_full.gnucash-xea      |    0
 .../accounts}/en_GB/acctchrt_homeloan.gnucash-xea  |    0
 .../accounts}/en_GB/acctchrt_homeown.gnucash-xea   |    0
 .../accounts}/en_GB/acctchrt_otherloan.gnucash-xea |    0
 .../accounts}/en_GB/acctchrt_renter.gnucash-xea    |    0
 .../accounts}/en_GB/acctchrt_retiremt.gnucash-xea  |    0
 .../accounts}/en_GB/acctchrt_spouseinc.gnucash-xea |    0
 .../en_GB/acctchrt_spouseretire.gnucash-xea        |    0
 .../accounts}/en_GB/uk-vat.gnucash-xea             |    0
 {accounts => data/accounts}/es_ES/CMakeLists.txt   |    0
 {accounts => data/accounts}/es_ES/Makefile.am      |    0
 .../accounts}/es_ES/acctchrt_brokerage.gnucash-xea |    0
 .../accounts}/es_ES/acctchrt_carloan.gnucash-xea   |    0
 .../es_ES/acctchrt_cdmoneymkt.gnucash-xea          |    0
 .../accounts}/es_ES/acctchrt_childcare.gnucash-xea |    0
 .../accounts}/es_ES/acctchrt_common.gnucash-xea    |    0
 .../accounts}/es_ES/acctchrt_currency.gnucash-xea  |    0
 .../accounts}/es_ES/acctchrt_eduloan.gnucash-xea   |    0
 .../es_ES/acctchrt_fixedassets.gnucash-xea         |    0
 .../accounts}/es_ES/acctchrt_homeloan.gnucash-xea  |    0
 .../accounts}/es_ES/acctchrt_homeown.gnucash-xea   |    0
 .../accounts}/es_ES/acctchrt_otherloan.gnucash-xea |    0
 .../accounts}/es_ES/acctchrt_renter.gnucash-xea    |    0
 .../accounts}/es_ES/acctchrt_retiremt.gnucash-xea  |    0
 .../accounts}/es_ES/acctchrt_spouseinc.gnucash-xea |    0
 .../es_ES/acctchrt_spouseretire.gnucash-xea        |    0
 {accounts => data/accounts}/es_MX/CMakeLists.txt   |    0
 {accounts => data/accounts}/es_MX/Makefile.am      |    0
 .../accounts}/es_MX/acctchrt_brokerage.gnucash-xea |    0
 .../accounts}/es_MX/acctchrt_carloan.gnucash-xea   |    0
 .../es_MX/acctchrt_cdmoneymkt.gnucash-xea          |    0
 .../accounts}/es_MX/acctchrt_childcare.gnucash-xea |    0
 .../accounts}/es_MX/acctchrt_common.gnucash-xea    |    0
 .../accounts}/es_MX/acctchrt_currency.gnucash-xea  |    0
 .../accounts}/es_MX/acctchrt_eduloan.gnucash-xea   |    0
 .../es_MX/acctchrt_fixedassets.gnucash-xea         |    0
 .../accounts}/es_MX/acctchrt_homeloan.gnucash-xea  |    0
 .../accounts}/es_MX/acctchrt_homeown.gnucash-xea   |    0
 .../accounts}/es_MX/acctchrt_otherloan.gnucash-xea |    0
 .../accounts}/es_MX/acctchrt_renter.gnucash-xea    |    0
 .../accounts}/es_MX/acctchrt_retiremt.gnucash-xea  |    0
 .../accounts}/es_MX/acctchrt_spouseinc.gnucash-xea |    0
 .../es_MX/acctchrt_spouseretire.gnucash-xea        |    0
 {accounts => data/accounts}/fi_FI/CMakeLists.txt   |    0
 {accounts => data/accounts}/fi_FI/Makefile.am      |    0
 .../accounts}/fi_FI/acctchrt_common.gnucash-xea    |    0
 .../accounts}/fi_FI/acctchrt_ry.gnucash-xea        |    0
 .../accounts}/fi_FI/acctchrt_sbr-xbrl.gnucash-xea  |    0
 {accounts => data/accounts}/fr_CA/CMakeLists.txt   |    0
 {accounts => data/accounts}/fr_CA/Makefile.am      |    0
 .../fr_CA/acctchrt_actifsfixes.gnucash-xea         |    0
 .../fr_CA/acctchrt_automobile.gnucash-xea          |    0
 .../fr_CA/acctchrt_basecommune.gnucash-xea         |    0
 .../fr_CA/acctchrt_cdmarchemon.gnucash-xea         |    0
 .../accounts}/fr_CA/acctchrt_chequier.gnucash-xea  |    0
 .../fr_CA/acctchrt_conjointretraite.gnucash-xea    |    0
 .../fr_CA/acctchrt_conjointrev.gnucash-xea         |    0
 .../accounts}/fr_CA/acctchrt_courtage.gnucash-xea  |    0
 .../fr_CA/acctchrt_etudeemprunt.gnucash-xea        |    0
 .../accounts}/fr_CA/acctchrt_garderie.gnucash-xea  |    0
 .../accounts}/fr_CA/acctchrt_locataire.gnucash-xea |    0
 .../fr_CA/acctchrt_proprietaire.gnucash-xea        |    0
 .../accounts}/fr_CA/acctchrt_retraite.gnucash-xea  |    0
 .../accounts}/fr_CA/acctchrt_revenus.gnucash-xea   |    0
 {accounts => data/accounts}/fr_CH/CMakeLists.txt   |    0
 {accounts => data/accounts}/fr_CH/Makefile.am      |    0
 .../accounts}/fr_CH/acctchrt_brokerage.gnucash-xea |    0
 .../accounts}/fr_CH/acctchrt_business.gnucash-xea  |    0
 .../accounts}/fr_CH/acctchrt_carloan.gnucash-xea   |    0
 .../fr_CH/acctchrt_cdmoneymkt.gnucash-xea          |    0
 .../accounts}/fr_CH/acctchrt_childcare.gnucash-xea |    0
 .../accounts}/fr_CH/acctchrt_common.gnucash-xea    |    0
 .../accounts}/fr_CH/acctchrt_currency.gnucash-xea  |    0
 .../accounts}/fr_CH/acctchrt_eduloan.gnucash-xea   |    0
 .../fr_CH/acctchrt_fixedassets.gnucash-xea         |    0
 .../accounts}/fr_CH/acctchrt_homeloan.gnucash-xea  |    0
 .../accounts}/fr_CH/acctchrt_homeown.gnucash-xea   |    0
 .../accounts}/fr_CH/acctchrt_otherloan.gnucash-xea |    0
 .../accounts}/fr_CH/acctchrt_renter.gnucash-xea    |    0
 .../accounts}/fr_CH/acctchrt_retiremt.gnucash-xea  |    0
 .../accounts}/fr_CH/acctchrt_spouseinc.gnucash-xea |    0
 .../fr_CH/acctchrt_spouseretire.gnucash-xea        |    0
 {accounts => data/accounts}/fr_FR/CMakeLists.txt   |    0
 {accounts => data/accounts}/fr_FR/Makefile.am      |    0
 .../accounts}/fr_FR/acctchrt_brokerage.gnucash-xea |    0
 .../accounts}/fr_FR/acctchrt_business.gnucash-xea  |    0
 .../accounts}/fr_FR/acctchrt_carloan.gnucash-xea   |    0
 .../fr_FR/acctchrt_cdmoneymkt.gnucash-xea          |    0
 .../accounts}/fr_FR/acctchrt_childcare.gnucash-xea |    0
 .../accounts}/fr_FR/acctchrt_common.gnucash-xea    |    0
 .../accounts}/fr_FR/acctchrt_currency.gnucash-xea  |    0
 .../accounts}/fr_FR/acctchrt_eduloan.gnucash-xea   |    0
 .../fr_FR/acctchrt_fixedassets.gnucash-xea         |    0
 .../accounts}/fr_FR/acctchrt_homeloan.gnucash-xea  |    0
 .../accounts}/fr_FR/acctchrt_homeown.gnucash-xea   |    0
 .../accounts}/fr_FR/acctchrt_otherloan.gnucash-xea |    0
 .../accounts}/fr_FR/acctchrt_renter.gnucash-xea    |    0
 .../accounts}/fr_FR/acctchrt_retiremt.gnucash-xea  |    0
 .../accounts}/fr_FR/acctchrt_spouseinc.gnucash-xea |    0
 .../fr_FR/acctchrt_spouseretire.gnucash-xea        |    0
 {accounts => data/accounts}/hu_HU/CMakeLists.txt   |    0
 {accounts => data/accounts}/hu_HU/Makefile.am      |    0
 .../accounts}/hu_HU/acctchrt_brokerage.gnucash-xea |    0
 .../accounts}/hu_HU/acctchrt_business.gnucash-xea  |    0
 .../accounts}/hu_HU/acctchrt_carloan.gnucash-xea   |    0
 .../hu_HU/acctchrt_cdmoneymkt.gnucash-xea          |    0
 .../accounts}/hu_HU/acctchrt_checkbook.gnucash-xea |    0
 .../accounts}/hu_HU/acctchrt_childcare.gnucash-xea |    0
 .../accounts}/hu_HU/acctchrt_common.gnucash-xea    |    0
 .../accounts}/hu_HU/acctchrt_eduloan.gnucash-xea   |    0
 .../hu_HU/acctchrt_fixedassets.gnucash-xea         |    0
 .../accounts}/hu_HU/acctchrt_homeloan.gnucash-xea  |    0
 .../accounts}/hu_HU/acctchrt_homeown.gnucash-xea   |    0
 .../accounts}/hu_HU/acctchrt_otherloan.gnucash-xea |    0
 .../accounts}/hu_HU/acctchrt_renter.gnucash-xea    |    0
 .../accounts}/hu_HU/acctchrt_retiremt.gnucash-xea  |    0
 .../accounts}/hu_HU/acctchrt_spouseinc.gnucash-xea |    0
 .../hu_HU/acctchrt_spouseretire.gnucash-xea        |    0
 {accounts => data/accounts}/it/CMakeLists.txt      |    0
 {accounts => data/accounts}/it/Makefile.am         |    0
 .../accounts}/it/acctchrt_brokerage.gnucash-xea    |    0
 .../accounts}/it/acctchrt_carloan.gnucash-xea      |    0
 .../accounts}/it/acctchrt_checkbook.gnucash-xea    |    0
 .../accounts}/it/acctchrt_childcare.gnucash-xea    |    0
 .../accounts}/it/acctchrt_common.gnucash-xea       |    0
 .../accounts}/it/acctchrt_fixedassets.gnucash-xea  |    0
 .../accounts}/it/acctchrt_homeloan.gnucash-xea     |    0
 .../accounts}/it/acctchrt_homeown.gnucash-xea      |    0
 .../accounts}/it/acctchrt_otherloan.gnucash-xea    |    0
 .../accounts}/it/acctchrt_renter.gnucash-xea       |    0
 .../accounts}/it/acctchrt_retiremt.gnucash-xea     |    0
 .../accounts}/it/acctchrt_spouseinc.gnucash-xea    |    0
 .../accounts}/it/acctchrt_spouseretire.gnucash-xea |    0
 {accounts => data/accounts}/ja/CMakeLists.txt      |    0
 {accounts => data/accounts}/ja/Makefile.am         |    0
 .../accounts}/ja/acctchrt_brokerage.gnucash-xea    |    0
 .../accounts}/ja/acctchrt_business.gnucash-xea     |    0
 .../accounts}/ja/acctchrt_carloan.gnucash-xea      |    0
 .../accounts}/ja/acctchrt_cdmoneymkt.gnucash-xea   |    0
 .../accounts}/ja/acctchrt_checkbook.gnucash-xea    |    0
 .../accounts}/ja/acctchrt_childcare.gnucash-xea    |    0
 .../accounts}/ja/acctchrt_common.gnucash-xea       |    0
 .../accounts}/ja/acctchrt_eduloan.gnucash-xea      |    0
 .../accounts}/ja/acctchrt_fixedassets.gnucash-xea  |    0
 .../accounts}/ja/acctchrt_full.gnucash-xea         |    0
 .../accounts}/ja/acctchrt_homeloan.gnucash-xea     |    0
 .../accounts}/ja/acctchrt_homeown.gnucash-xea      |    0
 .../accounts}/ja/acctchrt_otherloan.gnucash-xea    |    0
 .../accounts}/ja/acctchrt_renter.gnucash-xea       |    0
 .../accounts}/ja/acctchrt_retiremt.gnucash-xea     |    0
 .../accounts}/ja/acctchrt_spouseinc.gnucash-xea    |    0
 .../accounts}/ja/acctchrt_spouseretire.gnucash-xea |    0
 {accounts => data/accounts}/ko/CMakeLists.txt      |    0
 {accounts => data/accounts}/ko/Makefile.am         |    0
 .../accounts}/ko/acctchrt_brokerage.gnucash-xea    |    0
 .../accounts}/ko/acctchrt_business.gnucash-xea     |    0
 .../accounts}/ko/acctchrt_carloan.gnucash-xea      |    0
 .../accounts}/ko/acctchrt_cdmoneymkt.gnucash-xea   |    0
 .../accounts}/ko/acctchrt_checkbook.gnucash-xea    |    0
 .../accounts}/ko/acctchrt_childcare.gnucash-xea    |    0
 .../accounts}/ko/acctchrt_common.gnucash-xea       |    0
 .../accounts}/ko/acctchrt_eduloan.gnucash-xea      |    0
 .../accounts}/ko/acctchrt_fixedassets.gnucash-xea  |    0
 .../accounts}/ko/acctchrt_homeloan.gnucash-xea     |    0
 .../accounts}/ko/acctchrt_homeown.gnucash-xea      |    0
 .../accounts}/ko/acctchrt_otherloan.gnucash-xea    |    0
 .../accounts}/ko/acctchrt_renter.gnucash-xea       |    0
 .../accounts}/ko/acctchrt_retiremt.gnucash-xea     |    0
 .../accounts}/ko/acctchrt_spouseinc.gnucash-xea    |    0
 .../accounts}/ko/acctchrt_spouseretire.gnucash-xea |    0
 {accounts => data/accounts}/lt/CMakeLists.txt      |    0
 {accounts => data/accounts}/lt/Makefile.am         |    0
 .../accounts}/lt/acctchrt_business.gnucash-xea     |    0
 {accounts => data/accounts}/lv/CMakeLists.txt      |    0
 {accounts => data/accounts}/lv/Makefile.am         |    0
 .../accounts}/lv/acctchrt_brokerage.gnucash-xea    |    0
 .../accounts}/lv/acctchrt_business.gnucash-xea     |    0
 .../accounts}/lv/acctchrt_carloan.gnucash-xea      |    0
 .../accounts}/lv/acctchrt_cdmoneymkt.gnucash-xea   |    0
 .../accounts}/lv/acctchrt_checkbook.gnucash-xea    |    0
 .../accounts}/lv/acctchrt_childcare.gnucash-xea    |    0
 .../accounts}/lv/acctchrt_common.gnucash-xea       |    0
 .../accounts}/lv/acctchrt_eduloan.gnucash-xea      |    0
 .../accounts}/lv/acctchrt_fixedassets.gnucash-xea  |    0
 .../accounts}/lv/acctchrt_full.gnucash-xea         |    0
 .../accounts}/lv/acctchrt_homeloan.gnucash-xea     |    0
 .../accounts}/lv/acctchrt_homeown.gnucash-xea      |    0
 .../accounts}/lv/acctchrt_otherloan.gnucash-xea    |    0
 .../accounts}/lv/acctchrt_renter.gnucash-xea       |    0
 .../accounts}/lv/acctchrt_retiremt.gnucash-xea     |    0
 .../accounts}/lv/acctchrt_spouseinc.gnucash-xea    |    0
 .../accounts}/lv/acctchrt_spouseretire.gnucash-xea |    0
 {accounts => data/accounts}/nb/CMakeLists.txt      |    0
 {accounts => data/accounts}/nb/Makefile.am         |    0
 .../accounts}/nb/acctchrt_brokerage.gnucash-xea    |    0
 .../accounts}/nb/acctchrt_business.gnucash-xea     |    0
 .../accounts}/nb/acctchrt_carloan.gnucash-xea      |    0
 .../accounts}/nb/acctchrt_cdmoneymkt.gnucash-xea   |    0
 .../accounts}/nb/acctchrt_checkbook.gnucash-xea    |    0
 .../accounts}/nb/acctchrt_childcare.gnucash-xea    |    0
 .../accounts}/nb/acctchrt_common.gnucash-xea       |    0
 .../accounts}/nb/acctchrt_eduloan.gnucash-xea      |    0
 .../accounts}/nb/acctchrt_fixedassets.gnucash-xea  |    0
 .../accounts}/nb/acctchrt_full.gnucash-xea         |    0
 .../accounts}/nb/acctchrt_homeloan.gnucash-xea     |    0
 .../accounts}/nb/acctchrt_homeown.gnucash-xea      |    0
 .../accounts}/nb/acctchrt_otherloan.gnucash-xea    |    0
 .../accounts}/nb/acctchrt_renter.gnucash-xea       |    0
 .../accounts}/nb/acctchrt_retiremt.gnucash-xea     |    0
 .../accounts}/nb/acctchrt_spouseinc.gnucash-xea    |    0
 .../accounts}/nb/acctchrt_spouseretire.gnucash-xea |    0
 {accounts => data/accounts}/nl/CMakeLists.txt      |    0
 {accounts => data/accounts}/nl/Makefile.am         |    0
 .../accounts}/nl/acctchrt_checkbook.gnucash-xea    |    0
 .../accounts}/nl/acctchrt_full.gnucash-xea         |    0
 .../accounts}/nl/acctchrt_rgs_1.1.gnucash-xea      |    0
 {accounts => data/accounts}/pl/CMakeLists.txt      |    0
 {accounts => data/accounts}/pl/Makefile.am         |    0
 .../accounts}/pl/acctchrt_brokerage.gnucash-xea    |    0
 .../accounts}/pl/acctchrt_business.gnucash-xea     |    0
 .../accounts}/pl/acctchrt_carloan.gnucash-xea      |    0
 .../accounts}/pl/acctchrt_cdmoneymkt.gnucash-xea   |    0
 .../accounts}/pl/acctchrt_checkbook.gnucash-xea    |    0
 .../accounts}/pl/acctchrt_childcare.gnucash-xea    |    0
 .../accounts}/pl/acctchrt_common.gnucash-xea       |    0
 .../accounts}/pl/acctchrt_eduloan.gnucash-xea      |    0
 .../accounts}/pl/acctchrt_fixedassets.gnucash-xea  |    0
 .../accounts}/pl/acctchrt_full.gnucash-xea         |    0
 .../accounts}/pl/acctchrt_homeloan.gnucash-xea     |    0
 .../accounts}/pl/acctchrt_homeown.gnucash-xea      |    0
 .../accounts}/pl/acctchrt_otherloan.gnucash-xea    |    0
 .../accounts}/pl/acctchrt_renter.gnucash-xea       |    0
 .../accounts}/pl/acctchrt_retiremt.gnucash-xea     |    0
 .../accounts}/pl/acctchrt_spouseinc.gnucash-xea    |    0
 .../accounts}/pl/acctchrt_spouseretire.gnucash-xea |    0
 {accounts => data/accounts}/pt_BR/CMakeLists.txt   |    0
 {accounts => data/accounts}/pt_BR/Makefile.am      |    0
 .../accounts}/pt_BR/acctchrt_brokerage.gnucash-xea |    0
 .../accounts}/pt_BR/acctchrt_carloan.gnucash-xea   |    0
 .../pt_BR/acctchrt_cdmoneymkt.gnucash-xea          |    0
 .../accounts}/pt_BR/acctchrt_childcare.gnucash-xea |    0
 .../accounts}/pt_BR/acctchrt_common.gnucash-xea    |    0
 .../accounts}/pt_BR/acctchrt_currency.gnucash-xea  |    0
 .../accounts}/pt_BR/acctchrt_eduloan.gnucash-xea   |    0
 .../pt_BR/acctchrt_fixedassets.gnucash-xea         |    0
 .../accounts}/pt_BR/acctchrt_homeloan.gnucash-xea  |    0
 .../accounts}/pt_BR/acctchrt_homeown.gnucash-xea   |    0
 .../accounts}/pt_BR/acctchrt_otherloan.gnucash-xea |    0
 .../accounts}/pt_BR/acctchrt_renter.gnucash-xea    |    0
 .../accounts}/pt_BR/acctchrt_retiremt.gnucash-xea  |    0
 .../accounts}/pt_BR/acctchrt_spouseinc.gnucash-xea |    0
 .../pt_BR/acctchrt_spouseretire.gnucash-xea        |    0
 {accounts => data/accounts}/pt_PT/CMakeLists.txt   |    0
 {accounts => data/accounts}/pt_PT/Makefile.am      |    0
 .../accounts}/pt_PT/acctchrt_brokerage.gnucash-xea |    0
 .../accounts}/pt_PT/acctchrt_carloan.gnucash-xea   |    0
 .../pt_PT/acctchrt_cdmoneymkt.gnucash-xea          |    0
 .../accounts}/pt_PT/acctchrt_childcare.gnucash-xea |    0
 .../accounts}/pt_PT/acctchrt_common.gnucash-xea    |    0
 .../accounts}/pt_PT/acctchrt_eduloan.gnucash-xea   |    0
 .../pt_PT/acctchrt_fixedassets.gnucash-xea         |    0
 .../accounts}/pt_PT/acctchrt_homeloan.gnucash-xea  |    0
 .../accounts}/pt_PT/acctchrt_homeown.gnucash-xea   |    0
 .../accounts}/pt_PT/acctchrt_otherloan.gnucash-xea |    0
 .../accounts}/pt_PT/acctchrt_renter.gnucash-xea    |    0
 .../accounts}/pt_PT/acctchrt_retiremt.gnucash-xea  |    0
 .../accounts}/pt_PT/acctchrt_spouseinc.gnucash-xea |    0
 .../pt_PT/acctchrt_spouseretire.gnucash-xea        |    0
 {accounts => data/accounts}/ru/CMakeLists.txt      |    0
 {accounts => data/accounts}/ru/Makefile.am         |    0
 .../accounts}/ru/acctchrt_common.gnucash-xea       |    0
 .../accounts}/ru/acctchrt_homeloan.gnucash-xea     |    0
 .../accounts}/ru/acctchrt_homeown.gnucash-xea      |    0
 .../accounts}/ru/acctchrt_renter.gnucash-xea       |    0
 {accounts => data/accounts}/sk/CMakeLists.txt      |    0
 {accounts => data/accounts}/sk/Makefile.am         |    0
 .../accounts}/sk/acctchrt_brokerage.gnucash-xea    |    0
 .../accounts}/sk/acctchrt_carloan.gnucash-xea      |    0
 .../accounts}/sk/acctchrt_cdmoneymkt.gnucash-xea   |    0
 .../accounts}/sk/acctchrt_childcare.gnucash-xea    |    0
 .../accounts}/sk/acctchrt_common.gnucash-xea       |    0
 .../accounts}/sk/acctchrt_currency.gnucash-xea     |    0
 .../accounts}/sk/acctchrt_eduloan.gnucash-xea      |    0
 .../accounts}/sk/acctchrt_fixedassets.gnucash-xea  |    0
 .../accounts}/sk/acctchrt_homeloan.gnucash-xea     |    0
 .../accounts}/sk/acctchrt_homeown.gnucash-xea      |    0
 .../accounts}/sk/acctchrt_otherloan.gnucash-xea    |    0
 .../accounts}/sk/acctchrt_renter.gnucash-xea       |    0
 .../accounts}/sk/acctchrt_retiremt.gnucash-xea     |    0
 .../accounts}/sk/acctchrt_spouseinc.gnucash-xea    |    0
 .../accounts}/sk/acctchrt_spouseretire.gnucash-xea |    0
 {accounts => data/accounts}/sv_AX/CMakeLists.txt   |    0
 {accounts => data/accounts}/sv_AX/Makefile.am      |    0
 .../accounts}/sv_AX/acctchrt_common.gnucash-xea    |    0
 .../accounts}/sv_AX/acctchrt_rf.gnucash-xea        |    0
 .../accounts}/sv_AX/acctchrt_sbr-xbrl.gnucash-xea  |    0
 {accounts => data/accounts}/sv_FI/CMakeLists.txt   |    0
 {accounts => data/accounts}/sv_FI/Makefile.am      |    0
 .../accounts}/sv_FI/acctchrt_common.gnucash-xea    |    0
 .../accounts}/sv_FI/acctchrt_rf.gnucash-xea        |    0
 .../accounts}/sv_FI/acctchrt_sbr-xbrl.gnucash-xea  |    0
 {accounts => data/accounts}/sv_SE/CMakeLists.txt   |    0
 {accounts => data/accounts}/sv_SE/Makefile.am      |    0
 {accounts => data/accounts}/sv_SE/README.bas_2012  |    0
 .../accounts}/sv_SE/acctchrt_common.gnucash-xea    |    0
 .../accounts}/sv_SE/bas_2012.gnucash-xea           |    0
 {accounts => data/accounts}/tr_TR/CMakeLists.txt   |    0
 {accounts => data/accounts}/tr_TR/Makefile.am      |    0
 .../accounts}/tr_TR/acctchrt_TEKDUZ.gnucash-xea    |    0
 .../accounts}/tr_TR/acctchrt_brokerage.gnucash-xea |    0
 .../accounts}/tr_TR/acctchrt_carloan.gnucash-xea   |    0
 .../tr_TR/acctchrt_cdmoneymkt.gnucash-xea          |    0
 .../accounts}/tr_TR/acctchrt_checkbook.gnucash-xea |    0
 .../accounts}/tr_TR/acctchrt_common.gnucash-xea    |    0
 .../tr_TR/acctchrt_fixedassets.gnucash-xea         |    0
 .../accounts}/tr_TR/acctchrt_homeloan.gnucash-xea  |    0
 {accounts => data/accounts}/zh_CN/CMakeLists.txt   |    0
 {accounts => data/accounts}/zh_CN/Makefile.am      |    0
 .../accounts}/zh_CN/acctchrt_brokerage.gnucash-xea |    0
 .../accounts}/zh_CN/acctchrt_business.gnucash-xea  |    0
 .../accounts}/zh_CN/acctchrt_carloan.gnucash-xea   |    0
 .../zh_CN/acctchrt_cdmoneymkt.gnucash-xea          |    0
 .../accounts}/zh_CN/acctchrt_checkbook.gnucash-xea |    0
 .../accounts}/zh_CN/acctchrt_childcare.gnucash-xea |    0
 .../accounts}/zh_CN/acctchrt_common.gnucash-xea    |    0
 .../accounts}/zh_CN/acctchrt_eduloan.gnucash-xea   |    0
 .../zh_CN/acctchrt_fixedassets.gnucash-xea         |    0
 .../accounts}/zh_CN/acctchrt_full.gnucash-xea      |    0
 .../accounts}/zh_CN/acctchrt_homeloan.gnucash-xea  |    0
 .../accounts}/zh_CN/acctchrt_homeown.gnucash-xea   |    0
 .../accounts}/zh_CN/acctchrt_otherloan.gnucash-xea |    0
 .../accounts}/zh_CN/acctchrt_renter.gnucash-xea    |    0
 .../accounts}/zh_CN/acctchrt_retiremt.gnucash-xea  |    0
 .../accounts}/zh_CN/acctchrt_spouseinc.gnucash-xea |    0
 .../zh_CN/acctchrt_spouseretire.gnucash-xea        |    0
 {accounts => data/accounts}/zh_HK/CMakeLists.txt   |    0
 {accounts => data/accounts}/zh_HK/Makefile.am      |    0
 .../accounts}/zh_HK/acctchrt_business.gnucash-xea  |    0
 {accounts => data/accounts}/zh_TW/CMakeLists.txt   |    0
 {accounts => data/accounts}/zh_TW/Makefile.am      |    0
 .../accounts}/zh_TW/acctchrt_business.gnucash-xea  |    0
 {checks => data/checks}/CMakeLists.txt             |    0
 {checks => data/checks}/Makefile.am                |    0
 {checks => data/checks}/deluxe.chk                 |    0
 {checks => data/checks}/liberty.chk                |    0
 {checks => data/checks}/quicken.chk                |    0
 {checks => data/checks}/quicken_3part.chk          |    0
 {checks => data/checks}/quicken_check_21.chk       |    0
 {checks => data/checks}/quicken_wallet.chk         |    0
 {checks => data/checks}/voucher.chk                |    0
 {src => data}/pixmaps/CMakeLists.txt               |    0
 {src => data}/pixmaps/Makefile.am                  |    0
 {src => data}/pixmaps/gnucash-icon-48x48.bmp       |  Bin
 {src => data}/pixmaps/gnucash-icon.ico             |  Bin
 {src => data}/pixmaps/gnucash_splash.png           |  Bin
 .../pixmaps/hicolor/128x128/apps/gnucash-icon.png  |  Bin
 .../hicolor/16x16/actions/gnc-account-delete.png   |  Bin
 .../hicolor/16x16/actions/gnc-account-edit.png     |  Bin
 .../hicolor/16x16/actions/gnc-account-new.png      |  Bin
 .../hicolor/16x16/actions/gnc-account-open.png     |  Bin
 .../hicolor/16x16/actions/gnc-account-report.png   |  Bin
 .../pixmaps/hicolor/16x16/actions/gnc-account.png  |  Bin
 .../hicolor/16x16/actions/gnc-gnome-pdf.png        |  Bin
 .../16x16/actions/gnc-invoice-duplicate.png        |  Bin
 .../hicolor/16x16/actions/gnc-invoice-edit.png     |  Bin
 .../hicolor/16x16/actions/gnc-invoice-new.png      |  Bin
 .../hicolor/16x16/actions/gnc-invoice-pay.png      |  Bin
 .../hicolor/16x16/actions/gnc-invoice-post.png     |  Bin
 .../hicolor/16x16/actions/gnc-invoice-unpost.png   |  Bin
 .../pixmaps/hicolor/16x16/actions/gnc-invoice.png  |  Bin
 .../pixmaps/hicolor/16x16/actions/gnc-jumpto.png   |  Bin
 .../hicolor/16x16/actions/gnc-split-trans.png      |  Bin
 .../pixmaps/hicolor/16x16/actions/gnc-sx-new.png   |  Bin
 .../pixmaps/hicolor/16x16/actions/gnc-transfer.png |  Bin
 .../pixmaps/hicolor/16x16/apps/gnucash-icon.png    |  Bin
 .../pixmaps/hicolor/22x22/apps/gnucash-icon.png    |  Bin
 .../hicolor/24x24/actions/gnc-account-delete.png   |  Bin
 .../hicolor/24x24/actions/gnc-account-edit.png     |  Bin
 .../hicolor/24x24/actions/gnc-account-new.png      |  Bin
 .../hicolor/24x24/actions/gnc-account-open.png     |  Bin
 .../hicolor/24x24/actions/gnc-account-report.png   |  Bin
 .../pixmaps/hicolor/24x24/actions/gnc-account.png  |  Bin
 .../hicolor/24x24/actions/gnc-gnome-pdf.png        |  Bin
 .../24x24/actions/gnc-invoice-duplicate.png        |  Bin
 .../hicolor/24x24/actions/gnc-invoice-edit.png     |  Bin
 .../hicolor/24x24/actions/gnc-invoice-new.png      |  Bin
 .../hicolor/24x24/actions/gnc-invoice-pay.png      |  Bin
 .../hicolor/24x24/actions/gnc-invoice-post.png     |  Bin
 .../hicolor/24x24/actions/gnc-invoice-unpost.png   |  Bin
 .../pixmaps/hicolor/24x24/actions/gnc-invoice.png  |  Bin
 .../pixmaps/hicolor/24x24/actions/gnc-jumpto.png   |  Bin
 .../hicolor/24x24/actions/gnc-split-trans.png      |  Bin
 .../pixmaps/hicolor/24x24/actions/gnc-sx-new.png   |  Bin
 .../pixmaps/hicolor/24x24/actions/gnc-transfer.png |  Bin
 .../pixmaps/hicolor/24x24/apps/gnucash-icon.png    |  Bin
 .../pixmaps/hicolor/256x256/apps/gnucash-icon.png  |  Bin
 .../pixmaps/hicolor/32x32/apps/gnucash-icon.png    |  Bin
 .../pixmaps/hicolor/48x48/apps/gnucash-icon.png    |  Bin
 .../pixmaps/hicolor/64x64/apps/gnucash-icon.png    |  Bin
 .../pixmaps/hicolor/96x96/apps/gnucash-icon.png    |  Bin
 .../pixmaps/hicolor/scalable/apps/gnucash-icon.svg |    0
 gnucash/CMakeLists.txt                             |  197 +
 gnucash/CMakeLists.txt-bin                         |  178 +
 gnucash/Makefile.am                                |  161 +
 {src/bin => gnucash}/environment.in                |    0
 {src/bin => gnucash}/generate-gnc-script           |    0
 gnucash/gnome-search/CMakeLists.txt                |   64 +
 gnucash/gnome-search/Makefile.am                   |   66 +
 {src => gnucash}/gnome-search/dialog-search.c      |    0
 {src => gnucash}/gnome-search/dialog-search.glade  |    0
 {src => gnucash}/gnome-search/dialog-search.h      |    0
 {src => gnucash}/gnome-search/gnc-general-search.c |    0
 {src => gnucash}/gnome-search/gnc-general-search.h |    0
 .../gnome-search/gncmod-gnome-search.c             |    0
 {src => gnucash}/gnome-search/search-account.c     |    0
 {src => gnucash}/gnome-search/search-account.h     |    0
 {src => gnucash}/gnome-search/search-boolean.c     |    0
 {src => gnucash}/gnome-search/search-boolean.h     |    0
 {src => gnucash}/gnome-search/search-core-type.c   |    0
 {src => gnucash}/gnome-search/search-core-type.h   |    0
 {src => gnucash}/gnome-search/search-core-utils.c  |    0
 {src => gnucash}/gnome-search/search-core-utils.h  |    0
 {src => gnucash}/gnome-search/search-date.c        |    0
 {src => gnucash}/gnome-search/search-date.h        |    0
 {src => gnucash}/gnome-search/search-double.c      |    0
 {src => gnucash}/gnome-search/search-double.h      |    0
 {src => gnucash}/gnome-search/search-int64.c       |    0
 {src => gnucash}/gnome-search/search-int64.h       |    0
 {src => gnucash}/gnome-search/search-numeric.c     |    0
 {src => gnucash}/gnome-search/search-numeric.h     |    0
 {src => gnucash}/gnome-search/search-reconciled.c  |    0
 {src => gnucash}/gnome-search/search-reconciled.h  |    0
 {src => gnucash}/gnome-search/search-string.c      |    0
 {src => gnucash}/gnome-search/search-string.h      |    0
 gnucash/gnome-utils/CMakeLists.txt                 |  277 +
 gnucash/gnome-utils/Makefile.am                    |  328 +
 {src => gnucash}/gnome-utils/account-quickfill.c   |    0
 {src => gnucash}/gnome-utils/account-quickfill.h   |    0
 .../gnome-utils/assistant-xml-encoding.c           |    0
 .../gnome-utils/assistant-xml-encoding.h           |    0
 {src => gnucash}/gnome-utils/cursors.c             |    0
 {src => gnucash}/gnome-utils/dialog-account.c      |    0
 {src => gnucash}/gnome-utils/dialog-account.h      |    0
 gnucash/gnome-utils/dialog-book-close.c            |  394 ++
 {src => gnucash}/gnome-utils/dialog-book-close.h   |    0
 {src => gnucash}/gnome-utils/dialog-commodity.c    |    0
 {src => gnucash}/gnome-utils/dialog-commodity.h    |    0
 {src => gnucash}/gnome-utils/dialog-dup-trans.c    |    0
 {src => gnucash}/gnome-utils/dialog-dup-trans.h    |    0
 {src => gnucash}/gnome-utils/dialog-file-access.c  |    0
 {src => gnucash}/gnome-utils/dialog-file-access.h  |    0
 .../gnome-utils/dialog-object-references.c         |    0
 .../gnome-utils/dialog-object-references.h         |    0
 gnucash/gnome-utils/dialog-options.c               | 4329 +++++++++++++
 gnucash/gnome-utils/dialog-options.h               |  115 +
 {src => gnucash}/gnome-utils/dialog-preferences.c  |    0
 {src => gnucash}/gnome-utils/dialog-preferences.h  |    0
 {src => gnucash}/gnome-utils/dialog-query-view.c   |    0
 {src => gnucash}/gnome-utils/dialog-query-view.h   |    0
 gnucash/gnome-utils/dialog-reset-warnings.c        |  426 ++
 .../gnome-utils/dialog-reset-warnings.h            |    0
 {src => gnucash}/gnome-utils/dialog-tax-table.c    |    0
 {src => gnucash}/gnome-utils/dialog-tax-table.h    |    0
 {src => gnucash}/gnome-utils/dialog-totd.c         |    0
 {src => gnucash}/gnome-utils/dialog-totd.h         |    0
 gnucash/gnome-utils/dialog-transfer.c              | 2499 ++++++++
 {src => gnucash}/gnome-utils/dialog-transfer.h     |    0
 {src => gnucash}/gnome-utils/dialog-userpass.c     |    0
 {src => gnucash}/gnome-utils/dialog-utils.c        |    0
 {src => gnucash}/gnome-utils/dialog-utils.h        |    0
 {src => gnucash}/gnome-utils/gnc-account-sel.c     |    0
 {src => gnucash}/gnome-utils/gnc-account-sel.h     |    0
 {src => gnucash}/gnome-utils/gnc-amount-edit.c     |    0
 {src => gnucash}/gnome-utils/gnc-amount-edit.h     |    0
 {src => gnucash}/gnome-utils/gnc-autosave.c        |    0
 {src => gnucash}/gnome-utils/gnc-autosave.h        |    0
 .../gnome-utils/gnc-cell-renderer-date.c           |    0
 .../gnome-utils/gnc-cell-renderer-date.h           |    0
 .../gnome-utils/gnc-cell-renderer-popup-entry.c    |    0
 .../gnome-utils/gnc-cell-renderer-popup-entry.h    |    0
 .../gnome-utils/gnc-cell-renderer-popup.c          |    0
 .../gnome-utils/gnc-cell-renderer-popup.h          |    0
 {src => gnucash}/gnome-utils/gnc-combott.c         |    0
 {src => gnucash}/gnome-utils/gnc-combott.h         |    0
 {src => gnucash}/gnome-utils/gnc-commodity-edit.c  |    0
 {src => gnucash}/gnome-utils/gnc-commodity-edit.h  |    0
 {src => gnucash}/gnome-utils/gnc-currency-edit.c   |    0
 {src => gnucash}/gnome-utils/gnc-currency-edit.h   |    0
 {src => gnucash}/gnome-utils/gnc-date-delta.c      |    0
 {src => gnucash}/gnome-utils/gnc-date-delta.h      |    0
 {src => gnucash}/gnome-utils/gnc-date-edit.c       |    0
 {src => gnucash}/gnome-utils/gnc-date-edit.h       |    0
 {src => gnucash}/gnome-utils/gnc-date-format.c     |    0
 {src => gnucash}/gnome-utils/gnc-date-format.h     |    0
 {src => gnucash}/gnome-utils/gnc-dense-cal-model.c |    0
 {src => gnucash}/gnome-utils/gnc-dense-cal-model.h |    0
 {src => gnucash}/gnome-utils/gnc-dense-cal-store.c |    0
 {src => gnucash}/gnome-utils/gnc-dense-cal-store.h |    0
 {src => gnucash}/gnome-utils/gnc-dense-cal.c       |    0
 {src => gnucash}/gnome-utils/gnc-dense-cal.h       |    0
 {src => gnucash}/gnome-utils/gnc-embedded-window.c |    0
 {src => gnucash}/gnome-utils/gnc-embedded-window.h |    0
 {src => gnucash}/gnome-utils/gnc-file.c            |    0
 {src => gnucash}/gnome-utils/gnc-file.h            |    0
 {src => gnucash}/gnome-utils/gnc-frequency.c       |    0
 {src => gnucash}/gnome-utils/gnc-frequency.h       |    0
 {src => gnucash}/gnome-utils/gnc-general-select.c  |    0
 {src => gnucash}/gnome-utils/gnc-general-select.h  |    0
 {src => gnucash}/gnome-utils/gnc-gnome-utils.c     |    0
 {src => gnucash}/gnome-utils/gnc-gnome-utils.h     |    0
 {src => gnucash}/gnome-utils/gnc-gobject-utils.c   |    0
 {src => gnucash}/gnome-utils/gnc-gobject-utils.h   |    0
 {src => gnucash}/gnome-utils/gnc-gtk-utils.c       |    0
 {src => gnucash}/gnome-utils/gnc-gtk-utils.h       |    0
 {src => gnucash}/gnome-utils/gnc-gui-query.c       |    0
 {src => gnucash}/gnome-utils/gnc-gui-query.h       |    0
 {src => gnucash}/gnome-utils/gnc-icons.c           |    0
 {src => gnucash}/gnome-utils/gnc-icons.h           |    0
 {src => gnucash}/gnome-utils/gnc-keyring.c         |    0
 {src => gnucash}/gnome-utils/gnc-keyring.h         |    0
 gnucash/gnome-utils/gnc-main-window.c              | 4839 +++++++++++++++
 {src => gnucash}/gnome-utils/gnc-main-window.h     |    0
 {src => gnucash}/gnome-utils/gnc-menu-extensions.c |    0
 {src => gnucash}/gnome-utils/gnc-menu-extensions.h |    0
 .../gnome-utils/gnc-menu-extensions.scm            |    0
 {src => gnucash}/gnome-utils/gnc-period-select.c   |    0
 {src => gnucash}/gnome-utils/gnc-period-select.h   |    0
 .../gnome-utils/gnc-plugin-file-history.c          |    0
 .../gnome-utils/gnc-plugin-file-history.h          |    0
 {src => gnucash}/gnome-utils/gnc-plugin-manager.c  |    0
 {src => gnucash}/gnome-utils/gnc-plugin-manager.h  |    0
 .../gnome-utils/gnc-plugin-menu-additions.c        |    0
 .../gnome-utils/gnc-plugin-menu-additions.h        |    0
 {src => gnucash}/gnome-utils/gnc-plugin-page.c     |    0
 {src => gnucash}/gnome-utils/gnc-plugin-page.h     |    0
 {src => gnucash}/gnome-utils/gnc-plugin.c          |    0
 {src => gnucash}/gnome-utils/gnc-plugin.h          |    0
 {src => gnucash}/gnome-utils/gnc-query-view.c      |    0
 {src => gnucash}/gnome-utils/gnc-query-view.h      |    0
 {src => gnucash}/gnome-utils/gnc-recurrence.c      |    0
 {src => gnucash}/gnome-utils/gnc-recurrence.h      |    0
 gnucash/gnome-utils/gnc-splash.c                   |  209 +
 {src => gnucash}/gnome-utils/gnc-splash.h          |    0
 .../gnc-sx-instance-dense-cal-adapter.c            |    0
 .../gnc-sx-instance-dense-cal-adapter.h            |    0
 .../gnome-utils/gnc-sx-list-tree-model-adapter.c   |    0
 .../gnome-utils/gnc-sx-list-tree-model-adapter.h   |    0
 gnucash/gnome-utils/gnc-tree-control-split-reg.c   | 2173 +++++++
 .../gnome-utils/gnc-tree-control-split-reg.h       |    0
 .../gnome-utils/gnc-tree-model-account-types.c     |    0
 .../gnome-utils/gnc-tree-model-account-types.h     |    0
 .../gnome-utils/gnc-tree-model-account.c           |    0
 .../gnome-utils/gnc-tree-model-account.h           |    0
 .../gnome-utils/gnc-tree-model-budget.c            |    0
 .../gnome-utils/gnc-tree-model-budget.h            |    0
 .../gnome-utils/gnc-tree-model-commodity.c         |    0
 .../gnome-utils/gnc-tree-model-commodity.h         |    0
 .../gnome-utils/gnc-tree-model-owner.c             |    0
 .../gnome-utils/gnc-tree-model-owner.h             |    0
 .../gnome-utils/gnc-tree-model-price.c             |    0
 .../gnome-utils/gnc-tree-model-price.h             |    0
 .../gnome-utils/gnc-tree-model-selection.c         |    0
 .../gnome-utils/gnc-tree-model-selection.h         |    0
 .../gnome-utils/gnc-tree-model-split-reg.c         |    0
 .../gnome-utils/gnc-tree-model-split-reg.h         |    0
 {src => gnucash}/gnome-utils/gnc-tree-model.c      |    0
 {src => gnucash}/gnome-utils/gnc-tree-model.h      |    0
 .../gnome-utils/gnc-tree-util-split-reg.c          |    0
 .../gnome-utils/gnc-tree-util-split-reg.h          |    0
 .../gnome-utils/gnc-tree-view-account.c            |    0
 .../gnome-utils/gnc-tree-view-account.h            |    0
 .../gnome-utils/gnc-tree-view-commodity.c          |    0
 .../gnome-utils/gnc-tree-view-commodity.h          |    0
 {src => gnucash}/gnome-utils/gnc-tree-view-owner.c |    0
 {src => gnucash}/gnome-utils/gnc-tree-view-owner.h |    0
 {src => gnucash}/gnome-utils/gnc-tree-view-price.c |    0
 {src => gnucash}/gnome-utils/gnc-tree-view-price.h |    0
 gnucash/gnome-utils/gnc-tree-view-split-reg.c      | 6421 ++++++++++++++++++++
 .../gnome-utils/gnc-tree-view-split-reg.h          |    0
 .../gnome-utils/gnc-tree-view-sx-list.c            |    0
 .../gnome-utils/gnc-tree-view-sx-list.h            |    0
 {src => gnucash}/gnome-utils/gnc-tree-view.c       |    0
 {src => gnucash}/gnome-utils/gnc-tree-view.h       |    0
 {src => gnucash}/gnome-utils/gnc-ui.h              |    0
 {src => gnucash}/gnome-utils/gnc-window.c          |    0
 {src => gnucash}/gnome-utils/gnc-window.h          |    0
 {src => gnucash}/gnome-utils/gncmod-gnome-utils.c  |    0
 {src => gnucash}/gnome-utils/gnome-utils.i         |    0
 {src => gnucash}/gnome-utils/gnome-utils.scm       |    0
 .../gnome-utils/gschemas/CMakeLists.txt            |    0
 {src => gnucash}/gnome-utils/gschemas/Makefile.am  |    0
 .../gschemas/org.gnucash.history.gschema.xml.in.in |    0
 .../org.gnucash.warnings.gschema.xml.in.in         |    0
 .../gnome-utils/gtkbuilder/CMakeLists.txt          |    0
 .../gnome-utils/gtkbuilder/Makefile.am             |    0
 .../gtkbuilder/assistant-xml-encoding.glade        |    0
 .../gnome-utils/gtkbuilder/dialog-account.glade    |    0
 .../gnome-utils/gtkbuilder/dialog-book-close.glade |    0
 .../gnome-utils/gtkbuilder/dialog-commodity.glade  |    0
 .../gtkbuilder/dialog-file-access.glade            |    0
 .../gtkbuilder/dialog-object-references.glade      |    0
 .../gnome-utils/gtkbuilder/dialog-options.glade    |    0
 .../gtkbuilder/dialog-preferences.glade            |    0
 .../gnome-utils/gtkbuilder/dialog-query-view.glade |    0
 .../gtkbuilder/dialog-reset-warnings.glade         |    0
 .../gnome-utils/gtkbuilder/dialog-tax-table.glade  |    0
 .../gnome-utils/gtkbuilder/dialog-totd.glade       |    0
 .../gnome-utils/gtkbuilder/dialog-transfer.glade   |    0
 .../gnome-utils/gtkbuilder/dialog-userpass.glade   |    0
 .../gnome-utils/gtkbuilder/gnc-date-format.glade   |    0
 .../gnome-utils/gtkbuilder/gnc-frequency.glade     |    0
 .../gnome-utils/gtkbuilder/gnc-recurrence.glade    |    0
 .../gtkbuilder/gnc-tree-view-owner.glade           |    0
 .../gnome-utils/make-gnc-warnings-c.xsl            |    0
 .../gnome-utils/make-gnc-warnings-h.xsl            |    0
 {src => gnucash}/gnome-utils/misc-gnome-utils.c    |    0
 {src => gnucash}/gnome-utils/misc-gnome-utils.h    |    0
 {src => gnucash}/gnome-utils/print-session.c       |    0
 {src => gnucash}/gnome-utils/print-session.h       |    0
 {src => gnucash}/gnome-utils/search-param.c        |    0
 {src => gnucash}/gnome-utils/search-param.h        |    0
 gnucash/gnome-utils/test/CMakeLists.txt            |   35 +
 gnucash/gnome-utils/test/Makefile.am               |   75 +
 .../gnome-utils/test/test-gnc-recurrence.c         |    0
 .../gnome-utils/test/test-link-module.c            |    0
 .../gnome-utils/test/test-load-module.in           |    0
 {src => gnucash}/gnome-utils/tree-view-utils.c     |    0
 {src => gnucash}/gnome-utils/tree-view-utils.h     |    0
 {src => gnucash}/gnome-utils/ui/CMakeLists.txt     |    0
 {src => gnucash}/gnome-utils/ui/Makefile.am        |    0
 .../gnome-utils/ui/gnc-main-window-ui.xml          |    0
 .../gnome-utils/ui/gnc-windows-menu-ui-quartz.xml  |    0
 .../gnome-utils/ui/gnc-windows-menu-ui.xml         |    0
 {src => gnucash}/gnome-utils/ui/gnucash.css        |    0
 {src => gnucash}/gnome-utils/ui/osx_accel_map      |    0
 .../gnome-utils/window-main-summarybar.c           |    0
 .../gnome-utils/window-main-summarybar.h           |    0
 gnucash/gnome/CMakeLists.txt                       |  206 +
 gnucash/gnome/Makefile.am                          |  202 +
 {src => gnucash}/gnome/assistant-acct-period.c     |    0
 {src => gnucash}/gnome/assistant-acct-period.h     |    0
 {src => gnucash}/gnome/assistant-hierarchy.c       |    0
 {src => gnucash}/gnome/assistant-hierarchy.h       |    0
 {src => gnucash}/gnome/assistant-loan.c            |    0
 {src => gnucash}/gnome/assistant-loan.h            |    0
 {src => gnucash}/gnome/assistant-stock-split.c     |    0
 {src => gnucash}/gnome/assistant-stock-split.h     |    0
 .../gnome}/business-gnome-utils.c                  |    0
 .../gnome}/business-gnome-utils.h                  |    0
 .../gnome}/business-options-gnome.c                |    0
 .../gnome}/business-options-gnome.h                |    0
 .../gnome}/business-urls.c                         |    0
 .../gnome}/business-urls.h                         |    0
 .../gnome}/dialog-billterms.c                      |    0
 .../gnome}/dialog-billterms.h                      |    0
 .../gnome}/dialog-choose-owner.c                   |    0
 .../gnome}/dialog-choose-owner.h                   |    0
 gnucash/gnome/dialog-commodities.c                 |  431 ++
 gnucash/gnome/dialog-customer.c                    | 1347 ++++
 .../gnome}/dialog-customer.h                       |    0
 .../gnome}/dialog-date-close.c                     |    0
 .../gnome}/dialog-date-close.h                     |    0
 .../gnome}/dialog-employee.c                       |    0
 .../gnome}/dialog-employee.h                       |    0
 {src => gnucash}/gnome/dialog-fincalc.c            |    0
 {src => gnucash}/gnome/dialog-fincalc.h            |    0
 {src => gnucash}/gnome/dialog-find-account.c       |    0
 {src => gnucash}/gnome/dialog-find-account.h       |    0
 {src => gnucash}/gnome/dialog-find-transactions.c  |    0
 {src => gnucash}/gnome/dialog-find-transactions.h  |    0
 {src => gnucash}/gnome/dialog-find-transactions2.c |    0
 {src => gnucash}/gnome/dialog-find-transactions2.h |    0
 {src => gnucash}/gnome/dialog-imap-editor.c        |    0
 {src => gnucash}/gnome/dialog-imap-editor.h        |    0
 .../gnome}/dialog-invoice.c                        |    0
 .../gnome}/dialog-invoice.h                        |    0
 .../business-gnome => gnucash/gnome}/dialog-job.c  |    0
 .../business-gnome => gnucash/gnome}/dialog-job.h  |    0
 {src => gnucash}/gnome/dialog-lot-viewer.c         |    0
 {src => gnucash}/gnome/dialog-lot-viewer.h         |    0
 gnucash/gnome/dialog-new-user.c                    |  163 +
 {src => gnucash}/gnome/dialog-new-user.h           |    0
 gnucash/gnome/dialog-order.c                       |  986 +++
 .../gnome}/dialog-order.h                          |    0
 gnucash/gnome/dialog-payment.c                     | 1256 ++++
 .../gnome}/dialog-payment.h                        |    0
 gnucash/gnome/dialog-price-edit-db.c               |  568 ++
 {src => gnucash}/gnome/dialog-price-editor.c       |    0
 {src => gnucash}/gnome/dialog-print-check.c        |    0
 {src => gnucash}/gnome/dialog-print-check.h        |    0
 {src => gnucash}/gnome/dialog-progress.c           |    0
 {src => gnucash}/gnome/dialog-progress.h           |    0
 {src => gnucash}/gnome/dialog-sx-editor.c          |    0
 {src => gnucash}/gnome/dialog-sx-editor.h          |    0
 {src => gnucash}/gnome/dialog-sx-editor2.c         |    0
 {src => gnucash}/gnome/dialog-sx-editor2.h         |    0
 {src => gnucash}/gnome/dialog-sx-from-trans.c      |    0
 {src => gnucash}/gnome/dialog-sx-from-trans.h      |    0
 {src => gnucash}/gnome/dialog-sx-since-last-run.c  |    0
 {src => gnucash}/gnome/dialog-sx-since-last-run.h  |    0
 {src => gnucash}/gnome/dialog-tax-info.c           |    0
 {src => gnucash}/gnome/dialog-trans-assoc.c        |    0
 {src => gnucash}/gnome/dialog-trans-assoc.h        |    0
 .../gnome}/dialog-vendor.c                         |    0
 .../gnome}/dialog-vendor.h                         |    0
 {src => gnucash}/gnome/gnc-budget-view.c           |    0
 {src => gnucash}/gnome/gnc-budget-view.h           |    0
 {src => gnucash}/gnome/gnc-plugin-account-tree.c   |    0
 {src => gnucash}/gnome/gnc-plugin-account-tree.h   |    0
 {src => gnucash}/gnome/gnc-plugin-basic-commands.c |    0
 {src => gnucash}/gnome/gnc-plugin-basic-commands.h |    0
 {src => gnucash}/gnome/gnc-plugin-budget.c         |    0
 {src => gnucash}/gnome/gnc-plugin-budget.h         |    0
 gnucash/gnome/gnc-plugin-business.c                | 1108 ++++
 .../gnome}/gnc-plugin-business.h                   |    0
 .../gnome/gnc-plugin-page-account-tree.c           |    0
 .../gnome/gnc-plugin-page-account-tree.h           |    0
 {src => gnucash}/gnome/gnc-plugin-page-budget.c    |    0
 {src => gnucash}/gnome/gnc-plugin-page-budget.h    |    0
 .../gnome}/gnc-plugin-page-invoice.c               |    0
 .../gnome}/gnc-plugin-page-invoice.h               |    0
 .../gnome}/gnc-plugin-page-owner-tree.c            |    0
 .../gnome}/gnc-plugin-page-owner-tree.h            |    0
 gnucash/gnome/gnc-plugin-page-register.c           | 4192 +++++++++++++
 {src => gnucash}/gnome/gnc-plugin-page-register.h  |    0
 gnucash/gnome/gnc-plugin-page-register2.c          | 4082 +++++++++++++
 {src => gnucash}/gnome/gnc-plugin-page-register2.h |    0
 {src => gnucash}/gnome/gnc-plugin-page-sx-list.c   |    0
 {src => gnucash}/gnome/gnc-plugin-page-sx-list.h   |    0
 {src => gnucash}/gnome/gnc-plugin-register.c       |    0
 {src => gnucash}/gnome/gnc-plugin-register.h       |    0
 {src => gnucash}/gnome/gnc-plugin-register2.c      |    0
 {src => gnucash}/gnome/gnc-plugin-register2.h      |    0
 gnucash/gnome/gnc-split-reg.c                      | 2258 +++++++
 {src => gnucash}/gnome/gnc-split-reg.h             |    0
 gnucash/gnome/gnc-split-reg2.c                     | 1112 ++++
 {src => gnucash}/gnome/gnc-split-reg2.h            |    0
 {src => gnucash}/gnome/gnome.i                     |    0
 {src => gnucash}/gnome/gnucash.appdata.xml.in      |    0
 {src => gnucash}/gnome/gnucash.desktop.in.in       |    0
 gnucash/gnome/gschemas/CMakeLists.txt              |   26 +
 gnucash/gnome/gschemas/Makefile.am                 |   21 +
 .../org.gnucash.dialogs.business.gschema.xml.in.in |    0
 ...gnucash.dialogs.checkprinting.gschema.xml.in.in |    0
 ...g.gnucash.dialogs.commodities.gschema.xml.in.in |    0
 .../gschemas/org.gnucash.dialogs.gschema.xml.in.in |    0
 ...org.gnucash.dialogs.reconcile.gschema.xml.in.in |    0
 .../org.gnucash.dialogs.sxs.gschema.xml.in.in      |    0
 .../org.gnucash.dialogs.totd.gschema.xml.in.in     |    0
 .../gnome/gschemas/org.gnucash.gschema.xml.in.in   |    0
 ...ash.window.pages.account.tree.gschema.xml.in.in |    0
 .../org.gnucash.window.pages.gschema.xml.in.in     |    0
 gnucash/gnome/gtkbuilder/CMakeLists.txt            |   47 +
 gnucash/gnome/gtkbuilder/Makefile.am               |   37 +
 .../gnome/gtkbuilder/assistant-acct-period.glade   |    0
 .../gnome/gtkbuilder/assistant-hierarchy.glade     |    0
 .../gnome/gtkbuilder/assistant-loan.glade          |    0
 .../gnome/gtkbuilder/assistant-stock-split.glade   |    0
 .../gnome}/gtkbuilder/business-options-gnome.glade |    0
 .../gnome}/gtkbuilder/business-prefs.glade         |    0
 .../gnome}/gtkbuilder/dialog-billterms.glade       |    0
 .../gnome}/gtkbuilder/dialog-choose-owner.glade    |    0
 .../gnome/gtkbuilder/dialog-commodities.glade      |    0
 .../gnome}/gtkbuilder/dialog-customer.glade        |    0
 .../gnome}/gtkbuilder/dialog-date-close.glade      |    0
 .../gnome}/gtkbuilder/dialog-employee.glade        |    0
 .../gnome/gtkbuilder/dialog-fincalc.glade          |    0
 .../gnome/gtkbuilder/dialog-find-account.glade     |    0
 .../gnome/gtkbuilder/dialog-imap-editor.glade      |    0
 .../gnome}/gtkbuilder/dialog-invoice.glade         |    0
 .../gnome}/gtkbuilder/dialog-job.glade             |    0
 .../gnome/gtkbuilder/dialog-lot-viewer.glade       |    0
 .../gnome/gtkbuilder/dialog-new-user.glade         |    0
 .../gnome}/gtkbuilder/dialog-order.glade           |    0
 .../gnome}/gtkbuilder/dialog-payment.glade         |    0
 .../gnome/gtkbuilder/dialog-price.glade            |    0
 .../gnome/gtkbuilder/dialog-print-check.glade      |    0
 .../gnome/gtkbuilder/dialog-progress.glade         |    0
 {src => gnucash}/gnome/gtkbuilder/dialog-sx.glade  |    0
 .../gnome/gtkbuilder/dialog-tax-info.glade         |    0
 .../gnome/gtkbuilder/dialog-trans-assoc.glade      |    0
 .../gnome}/gtkbuilder/dialog-vendor.glade          |    0
 .../gnome/gtkbuilder/gnc-plugin-page-budget.glade  |    0
 .../gtkbuilder/gnc-plugin-page-register.glade      |    0
 .../gtkbuilder/gnc-plugin-page-register2.glade     |    0
 .../gnome/gtkbuilder/window-autoclear.glade        |    0
 .../gnome/gtkbuilder/window-reconcile.glade        |    0
 {src => gnucash}/gnome/reconcile-view.c            |    0
 {src => gnucash}/gnome/reconcile-view.h            |    0
 .../gnome}/search-owner.c                          |    0
 .../gnome}/search-owner.h                          |    0
 gnucash/gnome/top-level.c                          |  433 ++
 {src => gnucash}/gnome/top-level.h                 |    0
 gnucash/gnome/ui/CMakeLists.txt                    |   37 +
 gnucash/gnome/ui/Makefile.am                       |   26 +
 .../gnome/ui/gnc-plugin-account-tree-ui.xml        |    0
 .../gnome/ui/gnc-plugin-basic-commands-ui.xml      |    0
 {src => gnucash}/gnome/ui/gnc-plugin-budget-ui.xml |    0
 .../gnome}/ui/gnc-plugin-business-ui.xml           |    0
 .../gnome/ui/gnc-plugin-file-history-ui.xml        |    0
 .../gnome/ui/gnc-plugin-page-account-tree-ui.xml   |    0
 .../gnome/ui/gnc-plugin-page-account-tree2-ui.xml  |    0
 .../gnome/ui/gnc-plugin-page-budget-ui.xml         |    0
 .../gnome}/ui/gnc-plugin-page-invoice-ui.xml       |    0
 .../gnome}/ui/gnc-plugin-page-owner-tree-ui.xml    |    0
 .../gnome/ui/gnc-plugin-page-register-ui.xml       |    0
 .../gnome/ui/gnc-plugin-page-register2-ui.xml      |    0
 .../gnome/ui/gnc-plugin-page-sx-list-ui.xml        |    0
 .../gnome/ui/gnc-plugin-page-sx-list2-ui.xml       |    0
 .../gnome/ui/gnc-plugin-page-sxregister-ui.xml     |    0
 .../gnome/ui/gnc-plugin-register-ui.xml            |    0
 .../gnome/ui/gnc-plugin-register2-ui.xml           |    0
 .../gnome/ui/gnc-plugin-register22-ui.xml          |    0
 .../gnome/ui/gnc-reconcile-window-ui.xml           |    0
 .../gnome/ui/gnc-sxed-to-create-window-ui.xml      |    0
 .../gnome/ui/gnc-sxed-window-ui-full.xml           |    0
 {src => gnucash}/gnome/ui/gnc-sxed-window-ui.xml   |    0
 {src => gnucash}/gnome/window-autoclear.c          |    0
 {src => gnucash}/gnome/window-autoclear.h          |    0
 {src => gnucash}/gnome/window-reconcile.c          |    0
 {src => gnucash}/gnome/window-reconcile.h          |    0
 {src => gnucash}/gnome/window-reconcile2.c         |    0
 {src => gnucash}/gnome/window-reconcile2.h         |    0
 gnucash/gnucash-bin.c                              |  819 +++
 {src/bin => gnucash}/gnucash-strip-svn-datafile.sh |    0
 gnucash/gnucash-valgrind.in                        |   24 +
 {src/bin => gnucash}/gnucash.rc.in                 |    0
 gnucash/html/CMakeLists.txt                        |   61 +
 gnucash/html/Makefile.am                           |   95 +
 {src => gnucash}/html/gnc-html-extras.h            |    0
 {src => gnucash}/html/gnc-html-factory.c           |    0
 {src => gnucash}/html/gnc-html-factory.h           |    0
 {src => gnucash}/html/gnc-html-history.c           |    0
 {src => gnucash}/html/gnc-html-history.h           |    0
 {src => gnucash}/html/gnc-html-p.h                 |    0
 {src => gnucash}/html/gnc-html-webkit-p.h          |    0
 {src => gnucash}/html/gnc-html-webkit.h            |    0
 {src => gnucash}/html/gnc-html-webkit1.c           |    0
 {src => gnucash}/html/gnc-html-webkit1.h           |    0
 {src => gnucash}/html/gnc-html-webkit2.c           |    0
 {src => gnucash}/html/gnc-html-webkit2.h           |    0
 {src => gnucash}/html/gnc-html.c                   |    0
 {src => gnucash}/html/gnc-html.h                   |    0
 {src => gnucash}/html/gnc-html.i                   |    0
 {src => gnucash}/html/gncmod-html.c                |    0
 gnucash/import-export/CMakeLists.txt               |   88 +
 gnucash/import-export/Makefile.am                  |   79 +
 gnucash/import-export/aqb/CMakeLists.txt           |   91 +
 gnucash/import-export/aqb/Makefile.am              |   81 +
 .../import-export/aqb/assistant-ab-initial.c       |    0
 .../import-export/aqb/assistant-ab-initial.glade   |    0
 .../import-export/aqb/assistant-ab-initial.h       |    0
 .../import-export/aqb/dialog-ab-daterange.c        |    0
 .../import-export/aqb/dialog-ab-daterange.h        |    0
 .../import-export/aqb/dialog-ab-pref.glade         |    0
 .../import-export/aqb/dialog-ab-trans.c            |    0
 .../import-export/aqb/dialog-ab-trans.h            |    0
 {src => gnucash}/import-export/aqb/dialog-ab.glade |    0
 .../import-export/aqb/gnc-ab-getbalance.c          |    0
 .../import-export/aqb/gnc-ab-getbalance.h          |    0
 .../import-export/aqb/gnc-ab-gettrans.c            |    0
 .../import-export/aqb/gnc-ab-gettrans.h            |    0
 {src => gnucash}/import-export/aqb/gnc-ab-kvp.c    |    0
 {src => gnucash}/import-export/aqb/gnc-ab-kvp.h    |    0
 .../import-export/aqb/gnc-ab-transfer.c            |    0
 .../import-export/aqb/gnc-ab-transfer.h            |    0
 {src => gnucash}/import-export/aqb/gnc-ab-utils.c  |    0
 {src => gnucash}/import-export/aqb/gnc-ab-utils.h  |    0
 .../import-export/aqb/gnc-file-aqb-import.c        |    0
 .../import-export/aqb/gnc-file-aqb-import.h        |    0
 {src => gnucash}/import-export/aqb/gnc-gwen-gui.c  |    0
 {src => gnucash}/import-export/aqb/gnc-gwen-gui.h  |    0
 .../import-export/aqb/gnc-plugin-aqbanking-ui.xml  |    0
 .../import-export/aqb/gnc-plugin-aqbanking.c       |    0
 .../import-export/aqb/gnc-plugin-aqbanking.h       |    0
 .../import-export/aqb/gncmod-aqbanking.c           |    0
 .../import-export/aqb/gschemas/CMakeLists.txt      |    0
 .../import-export/aqb/gschemas/Makefile.am         |    0
 ...g.gnucash.dialogs.import.hbci.gschema.xml.in.in |    0
 .../aqb/migratable-prefs-aqbanking.xml             |    0
 gnucash/import-export/aqb/test/CMakeLists.txt      |   36 +
 gnucash/import-export/aqb/test/Makefile.am         |   73 +
 .../aqb/test/file-book-hbcislot.gnucash            |    0
 .../import-export/aqb/test/file-book.gnucash       |    0
 gnucash/import-export/aqb/test/test-aqb.c          |   61 +
 gnucash/import-export/aqb/test/test-kvp.c          |  209 +
 gnucash/import-export/bi-import/CMakeLists.txt     |   49 +
 gnucash/import-export/bi-import/Makefile.am        |   51 +
 .../import-export/bi-import}/README                |    0
 .../bi-import}/dialog-bi-import-gui.c              |    0
 .../bi-import}/dialog-bi-import-gui.h              |    0
 .../bi-import}/dialog-bi-import-helper.c           |    0
 .../bi-import}/dialog-bi-import-helper.h           |    0
 gnucash/import-export/bi-import/dialog-bi-import.c |  906 +++
 .../import-export/bi-import}/dialog-bi-import.h    |    0
 .../bi-import}/gnc-plugin-bi-import.c              |    0
 .../import-export/bi-import/gnc-plugin-bi-import.h |   80 +
 gnucash/import-export/bi-import/gncmod-bi-import.c |  101 +
 .../bi-import}/gtkbuilder/CMakeLists.txt           |    0
 .../bi-import}/gtkbuilder/Makefile.am              |    0
 .../gtkbuilder/dialog-bi-import-gui.glade          |    0
 .../import-export/bi-import}/regex.txt             |    0
 .../import-export/bi-import}/ui/CMakeLists.txt     |    0
 .../import-export/bi-import}/ui/Makefile.am        |    0
 .../bi-import}/ui/gnc-plugin-bi-import-ui.xml      |    0
 .../import-export/csv-exp/CMakeLists.txt           |    0
 gnucash/import-export/csv-exp/Makefile.am          |   60 +
 .../import-export/csv-exp/assistant-csv-export.c   |    0
 .../csv-exp/assistant-csv-export.glade             |    0
 .../import-export/csv-exp/assistant-csv-export.h   |    0
 .../csv-exp/csv-transactions-export.c              |    0
 .../csv-exp/csv-transactions-export.h              |    0
 .../import-export/csv-exp/csv-tree-export.c        |    0
 .../import-export/csv-exp/csv-tree-export.h        |    0
 .../csv-exp/gnc-plugin-csv-export-ui.xml           |    0
 .../import-export/csv-exp/gnc-plugin-csv-export.c  |    0
 .../import-export/csv-exp/gnc-plugin-csv-export.h  |    0
 .../import-export/csv-exp/gncmod-csv-export.c      |    0
 .../import-export/csv-exp/gschemas/CMakeLists.txt  |    0
 .../import-export/csv-exp/gschemas/Makefile.am     |    0
 ...rg.gnucash.dialogs.export.csv.gschema.xml.in.in |    0
 .../import-export/csv-imp/CMakeLists.txt           |    0
 gnucash/import-export/csv-imp/Makefile.am          |   83 +
 .../csv-imp/assistant-csv-account-import.c         |    0
 .../csv-imp/assistant-csv-account-import.glade     |    0
 .../csv-imp/assistant-csv-account-import.h         |    0
 .../csv-imp/assistant-csv-trans-import.cpp         |    0
 .../csv-imp/assistant-csv-trans-import.glade       |    0
 .../csv-imp/assistant-csv-trans-import.h           |    0
 .../import-export/csv-imp/csv-account-import.c     |    0
 .../import-export/csv-imp/csv-account-import.h     |    0
 .../import-export/csv-imp/gnc-csv-account-map.c    |    0
 .../import-export/csv-imp/gnc-csv-account-map.h    |    0
 .../import-export/csv-imp/gnc-csv-gnumeric-popup.c |    0
 .../import-export/csv-imp/gnc-csv-gnumeric-popup.h |    0
 .../import-export/csv-imp/gnc-csv-tokenizer.cpp    |    0
 .../import-export/csv-imp/gnc-csv-tokenizer.hpp    |    0
 .../csv-imp/gnc-csv-trans-settings.cpp             |    0
 .../csv-imp/gnc-csv-trans-settings.hpp             |    0
 .../import-export/csv-imp/gnc-dummy-tokenizer.cpp  |    0
 .../import-export/csv-imp/gnc-dummy-tokenizer.hpp  |    0
 .../import-export/csv-imp/gnc-fw-tokenizer.cpp     |    0
 .../import-export/csv-imp/gnc-fw-tokenizer.hpp     |    0
 .../csv-imp/gnc-plugin-csv-import-ui.xml           |    0
 .../import-export/csv-imp/gnc-plugin-csv-import.c  |    0
 .../import-export/csv-imp/gnc-plugin-csv-import.h  |    0
 .../import-export/csv-imp/gnc-tokenizer.cpp        |    0
 .../import-export/csv-imp/gnc-tokenizer.hpp        |    0
 .../import-export/csv-imp/gnc-trans-props.cpp      |    0
 .../import-export/csv-imp/gnc-trans-props.hpp      |    0
 .../import-export/csv-imp/gnc-tx-import.cpp        |    0
 .../import-export/csv-imp/gnc-tx-import.hpp        |    0
 .../import-export/csv-imp/gncmod-csv-import.c      |    0
 .../import-export/csv-imp/gschemas/CMakeLists.txt  |    0
 .../import-export/csv-imp/gschemas/Makefile.am     |    0
 ...rg.gnucash.dialogs.import.csv.gschema.xml.in.in |    0
 gnucash/import-export/csv-imp/test/CMakeLists.txt  |   37 +
 gnucash/import-export/csv-imp/test/Makefile.am     |  118 +
 .../import-export/csv-imp/test/sample1.csv         |    0
 .../import-export/csv-imp/test/test-tokenizer.cpp  |    0
 .../import-export/csv-imp/test/test-tx-import.cpp  |    0
 .../import-export/customer-import/CMakeLists.txt   |   40 +
 gnucash/import-export/customer-import/Makefile.am  |   48 +
 .../customer-import/dialog-customer-import-gui.c   |  464 ++
 .../customer-import}/dialog-customer-import-gui.h  |    0
 .../customer-import}/dialog-customer-import.c      |    0
 .../customer-import/dialog-customer-import.h       |   78 +
 .../customer-import/gnc-plugin-customer-import.c   |  115 +
 .../customer-import/gnc-plugin-customer-import.h   |   80 +
 .../customer-import/gncmod-customer-import.c       |  104 +
 .../customer-import}/gtkbuilder/CMakeLists.txt     |    0
 .../customer-import}/gtkbuilder/Makefile.am        |    0
 .../gtkbuilder/dialog-customer-import-gui.glade    |    0
 .../customer-import/ui/CMakeLists.txt              |   11 +
 .../import-export/customer-import/ui/Makefile.am   |    5 +
 .../ui/gnc-plugin-customer-import-ui.xml           |   11 +
 {src => gnucash}/import-export/dialog-import.glade |    0
 .../import-export/generic-import-design.txt        |    0
 .../import-export/gncmod-generic-import.c          |    0
 .../import-export/gschemas/CMakeLists.txt          |    0
 .../import-export/gschemas/Makefile.am             |    0
 ...nucash.dialogs.import.generic.gschema.xml.in.in |    0
 .../import-export/import-account-matcher.c         |    0
 .../import-export/import-account-matcher.h         |    0
 {src => gnucash}/import-export/import-backend.c    |    0
 {src => gnucash}/import-export/import-backend.h    |    0
 .../import-export/import-commodity-matcher.c       |    0
 .../import-export/import-commodity-matcher.h       |    0
 .../import-export/import-format-dialog.c           |    0
 gnucash/import-export/import-main-matcher.c        |  916 +++
 .../import-export/import-main-matcher.h            |    0
 .../import-export/import-match-picker.c            |    0
 .../import-export/import-match-picker.h            |    0
 {src => gnucash}/import-export/import-parse.c      |    0
 {src => gnucash}/import-export/import-parse.h      |    0
 .../import-export/import-pending-matches.c         |    0
 .../import-export/import-pending-matches.h         |    0
 {src => gnucash}/import-export/import-settings.c   |    0
 {src => gnucash}/import-export/import-settings.h   |    0
 {src => gnucash}/import-export/import-utilities.c  |    0
 {src => gnucash}/import-export/import-utilities.h  |    0
 gnucash/import-export/log-replay/CMakeLists.txt    |   37 +
 gnucash/import-export/log-replay/Makefile.am       |   43 +
 .../import-export/log-replay/gnc-log-replay.c      |    0
 .../import-export/log-replay/gnc-log-replay.h      |    0
 .../log-replay/gnc-plugin-log-replay-ui.xml        |    0
 .../log-replay/gnc-plugin-log-replay.c             |    0
 .../log-replay/gnc-plugin-log-replay.h             |    0
 .../import-export/log-replay/gncmod-log-replay.c   |    0
 gnucash/import-export/ofx/CMakeLists.txt           |   44 +
 gnucash/import-export/ofx/Makefile.am              |   47 +
 gnucash/import-export/ofx/gnc-ofx-import.c         | 1051 ++++
 .../import-export/ofx/gnc-ofx-import.h             |    0
 {src => gnucash}/import-export/ofx/gnc-ofx-kvp.c   |    0
 gnucash/import-export/ofx/gnc-ofx-kvp.h            |   38 +
 .../import-export/ofx/gnc-plugin-ofx-ui.xml        |    0
 .../import-export/ofx/gnc-plugin-ofx.c             |    0
 .../import-export/ofx/gnc-plugin-ofx.h             |    0
 .../import-export/ofx/gncmod-ofx-import.c          |    0
 .../import-export/ofx/gschemas/CMakeLists.txt      |    0
 .../import-export/ofx/gschemas/Makefile.am         |    0
 ...rg.gnucash.dialogs.import.ofx.gschema.xml.in.in |    0
 .../import-export/ofx/migratable-prefs-ofx.xml     |    0
 .../import-export/ofx/test/CMakeLists.txt          |    0
 gnucash/import-export/ofx/test/Makefile.am         |   13 +
 .../import-export/ofx/test/test-link.c             |    0
 gnucash/import-export/qif-imp/CMakeLists.txt       |   93 +
 gnucash/import-export/qif-imp/Makefile.am          |  142 +
 .../import-export/qif-imp/assistant-qif-import.c   |    0
 .../qif-imp/assistant-qif-import.glade             |    0
 .../import-export/qif-imp/assistant-qif-import.h   |    0
 .../import-export/qif-imp/dialog-account-picker.c  |    0
 .../qif-imp/dialog-account-picker.glade            |    0
 .../import-export/qif-imp/dialog-account-picker.h  |    0
 .../import-export/qif-imp/file-format.txt          |    0
 .../qif-imp/gnc-plugin-qif-import-ui.xml           |    0
 .../import-export/qif-imp/gnc-plugin-qif-import.c  |    0
 .../import-export/qif-imp/gnc-plugin-qif-import.h  |    0
 .../import-export/qif-imp/gncmod-qif-import.c      |    0
 .../import-export/qif-imp/gschemas/CMakeLists.txt  |    0
 .../import-export/qif-imp/gschemas/Makefile.am     |    0
 ...rg.gnucash.dialogs.import.qif.gschema.xml.in.in |    0
 .../import-export/qif-imp/qif-dialog-utils.scm     |    0
 .../import-export/qif-imp/qif-file.scm             |    0
 .../import-export/qif-imp/qif-guess-map.scm        |    0
 .../import-export/qif-imp/qif-import.scm           |    0
 .../import-export/qif-imp/qif-merge-groups.scm     |    0
 .../import-export/qif-imp/qif-objects.scm          |    0
 .../import-export/qif-imp/qif-parse.scm            |    0
 .../import-export/qif-imp/qif-to-gnc.scm           |    0
 .../import-export/qif-imp/qif-utils.scm            |    0
 .../import-export/qif-imp/test/CMakeLists.txt      |    0
 gnucash/import-export/qif-imp/test/Makefile.am     |   17 +
 .../import-export/qif-imp/test/test-link.c         |    0
 gnucash/import-export/qif/CMakeLists.txt           |   39 +
 gnucash/import-export/qif/Makefile.am              |   39 +
 {src => gnucash}/import-export/qif/qif-context.c   |    0
 {src => gnucash}/import-export/qif/qif-defaults.c  |    0
 {src => gnucash}/import-export/qif/qif-defaults.h  |    0
 {src => gnucash}/import-export/qif/qif-file.c      |    0
 {src => gnucash}/import-export/qif/qif-file.h      |    0
 {src => gnucash}/import-export/qif/qif-import-p.h  |    0
 {src => gnucash}/import-export/qif/qif-import.h    |    0
 {src => gnucash}/import-export/qif/qif-objects-p.h |    0
 {src => gnucash}/import-export/qif/qif-objects.c   |    0
 {src => gnucash}/import-export/qif/qif-objects.h   |    0
 {src => gnucash}/import-export/qif/qif-parse.c     |    0
 {src => gnucash}/import-export/qif/qif-parse.h     |    0
 gnucash/import-export/qif/test/CMakeLists.txt      |   18 +
 gnucash/import-export/qif/test/Makefile.am         |   49 +
 .../qif/test/test-files/test-1-bank-txn.qif        |    0
 .../import-export/qif/test/test-link.c             |    0
 {src => gnucash}/import-export/qif/test/test-qif.c |    0
 gnucash/import-export/test/CMakeLists.txt          |   26 +
 gnucash/import-export/test/Makefile.am             |   78 +
 .../import-export/test/test-import-parse.c         |    0
 .../test/test-import-pending-matches.c             |    0
 {src => gnucash}/import-export/test/test-link.c    |    0
 {src/bin => gnucash}/overrides/CMakeLists.txt      |    0
 {src/bin => gnucash}/overrides/Makefile.am         |    0
 gnucash/overrides/gnucash-build-env.in             |   88 +
 {src/bin => gnucash}/overrides/gnucash-env.in      |    0
 .../overrides/gnucash-make-guids.in                |    0
 {src/bin => gnucash}/overrides/guile.in            |    0
 {src => gnucash}/python/CMakeLists.txt             |    0
 gnucash/python/Makefile.am                         |   62 +
 {src => gnucash}/python/gncmod-python.c            |    0
 {src => gnucash}/python/init.py                    |    0
 {src => gnucash}/python/pycons/CMakeLists.txt      |    0
 {src => gnucash}/python/pycons/Makefile.am         |    0
 {src => gnucash}/python/pycons/__init__.py         |    0
 {src => gnucash}/python/pycons/console.py          |    0
 {src => gnucash}/python/pycons/ishell.py           |    0
 {src => gnucash}/python/pycons/pycons              |    0
 {src => gnucash}/python/pycons/setup.py            |    0
 {src => gnucash}/python/pycons/shell.py            |    0
 {src => gnucash}/python/pycons/simple_plot.py      |    0
 {src => gnucash}/register/CMakeLists.txt           |    0
 gnucash/register/Makefile.am                       |    3 +
 gnucash/register/ledger-core/CMakeLists.txt        |   65 +
 gnucash/register/ledger-core/Makefile.am           |   71 +
 .../register/ledger-core/gnc-ledger-display.c      |    0
 .../register/ledger-core/gnc-ledger-display.h      |    0
 .../register/ledger-core/gnc-ledger-display2.c     |    0
 .../register/ledger-core/gnc-ledger-display2.h     |    0
 gnucash/register/ledger-core/gncEntryLedger.c      | 1080 ++++
 .../register/ledger-core}/gncEntryLedger.h         |    0
 .../register/ledger-core/gncEntryLedgerControl.c   | 1049 ++++
 .../register/ledger-core}/gncEntryLedgerControl.h  |    0
 .../register/ledger-core}/gncEntryLedgerDisplay.c  |    0
 .../register/ledger-core/gncEntryLedgerLayout.c    |  291 +
 .../register/ledger-core}/gncEntryLedgerLayout.h   |    0
 gnucash/register/ledger-core/gncEntryLedgerLoad.c  |  617 ++
 .../register/ledger-core}/gncEntryLedgerModel.c    |    0
 .../register/ledger-core}/gncEntryLedgerModel.h    |    0
 .../register/ledger-core}/gncEntryLedgerP.h        |    0
 .../register/ledger-core/gncmod-ledger-core.c      |    0
 .../register/ledger-core/split-register-control.c  | 1859 ++++++
 .../register/ledger-core/split-register-control.h  |    0
 .../register/ledger-core/split-register-layout.c   |    0
 .../register/ledger-core/split-register-layout.h   |    0
 .../register/ledger-core/split-register-load.c     |    0
 .../ledger-core/split-register-model-save.c        |  903 +++
 .../ledger-core/split-register-model-save.h        |    0
 .../register/ledger-core/split-register-model.c    | 2736 +++++++++
 .../register/ledger-core/split-register-model.h    |    0
 .../register/ledger-core/split-register-p.h        |    0
 .../register/ledger-core/split-register-util.c     |    0
 gnucash/register/ledger-core/split-register.c      | 2992 +++++++++
 .../register/ledger-core/split-register.h          |    0
 .../register/ledger-core/test/CMakeLists.txt       |    0
 gnucash/register/ledger-core/test/Makefile.am      |   15 +
 .../register/ledger-core/test/test-link-module.c   |    0
 gnucash/register/register-core/CMakeLists.txt      |   63 +
 gnucash/register/register-core/Makefile.am         |   70 +
 {src => gnucash}/register/register-core/README     |    0
 .../register/register-core/basiccell.c             |    0
 .../register/register-core/basiccell.h             |    0
 .../register/register-core/cell-factory.c          |    0
 .../register/register-core/cell-factory.h          |    0
 .../register/register-core/cellblock.c             |    0
 .../register/register-core/cellblock.h             |    0
 .../register/register-core/checkboxcell.c          |    0
 .../register/register-core/checkboxcell.h          |    0
 .../register/register-core/combocell.h             |    0
 {src => gnucash}/register/register-core/datecell.h |    0
 .../register/register-core/formulacell.c           |    0
 .../register/register-core/formulacell.h           |    0
 .../register/register-core/gncmod-register-core.c  |    0
 {src => gnucash}/register/register-core/gtable.c   |    0
 {src => gnucash}/register/register-core/gtable.h   |    0
 {src => gnucash}/register/register-core/numcell.c  |    0
 {src => gnucash}/register/register-core/numcell.h  |    0
 .../register/register-core/pricecell.c             |    0
 .../register/register-core/pricecell.h             |    0
 .../register/register-core/quickfillcell.c         |    0
 .../register/register-core/quickfillcell.h         |    0
 {src => gnucash}/register/register-core/recncell.c |    0
 {src => gnucash}/register/register-core/recncell.h |    0
 .../register/register-core/register-common.c       |    0
 .../register/register-core/register-common.h       |    0
 .../register/register-core/table-allgui.c          |    0
 .../register/register-core/table-allgui.h          |    0
 .../register/register-core/table-control.c         |    0
 .../register/register-core/table-control.h         |    0
 .../register/register-core/table-layout.c          |    0
 .../register/register-core/table-layout.h          |    0
 .../register/register-core/table-model.c           |    0
 .../register/register-core/table-model.h           |    0
 .../register/register-core/test/CMakeLists.txt     |    0
 gnucash/register/register-core/test/Makefile.am    |   24 +
 .../register/register-core/test/test-link-module.c |    0
 gnucash/register/register-gnome/CMakeLists.txt     |   64 +
 gnucash/register/register-gnome/Makefile.am        |   69 +
 .../register/register-gnome/combocell-gnome.c      |    0
 .../register/register-gnome/datecell-gnome.c       |    0
 .../register/register-gnome/formulacell-gnome.c    |    0
 .../register/register-gnome/formulacell-gnome.h    |    0
 .../register-gnome/gncmod-register-gnome.c         |    0
 .../register/register-gnome/gnucash-color.c        |    0
 .../register/register-gnome/gnucash-color.h        |    0
 .../register/register-gnome/gnucash-cursor.c       |    0
 .../register/register-gnome/gnucash-cursor.h       |    0
 .../register/register-gnome/gnucash-date-picker.c  |    0
 .../register/register-gnome/gnucash-date-picker.h  |    0
 .../register/register-gnome/gnucash-header.c       |    0
 .../register/register-gnome/gnucash-header.h       |    0
 .../register/register-gnome/gnucash-item-edit.c    |    0
 .../register/register-gnome/gnucash-item-edit.h    |    0
 .../register/register-gnome/gnucash-item-list.c    |    0
 .../register/register-gnome/gnucash-item-list.h    |    0
 .../register/register-gnome/gnucash-register.c     |    0
 .../register/register-gnome/gnucash-register.h     |    0
 .../register-gnome/gnucash-scrolled-window.c       |    0
 .../register-gnome/gnucash-scrolled-window.h       |    0
 .../register-gnome/gnucash-sheet-private.c         |    0
 .../register/register-gnome/gnucash-sheet.c        |    0
 .../register/register-gnome/gnucash-sheet.h        |    0
 .../register/register-gnome/gnucash-sheetP.h       |    0
 .../register/register-gnome/gnucash-style.c        |    0
 .../register/register-gnome/gnucash-style.h        |    0
 .../register/register-gnome/pricecell-gnome.c      |    0
 .../register/register-gnome/pricecell-gnome.h      |    0
 .../register/register-gnome/quickfillcell-gnome.c  |    0
 .../register/register-gnome/quickfillcell-gnome.h  |    0
 .../register/register-gnome/table-gnome.c          |    0
 .../register/register-gnome/table-gnome.h          |    0
 .../register/register-gnome/test/CMakeLists.txt    |    0
 gnucash/register/register-gnome/test/Makefile.am   |   24 +
 .../register-gnome/test/test-link-module.c         |    0
 {src => gnucash}/report/CMakeLists.txt             |    0
 {src => gnucash}/report/Makefile.am                |    0
 gnucash/report/business-reports/CMakeLists.txt     |   48 +
 gnucash/report/business-reports/Makefile.am        |   99 +
 {src => gnucash}/report/business-reports/aging.scm |    0
 .../report/business-reports/balsheet-eg.css        |    0
 .../report/business-reports/balsheet-eg.eguile.scm |    0
 .../report/business-reports/balsheet-eg.scm        |    0
 .../report/business-reports/business-reports.scm   |  141 +
 .../report/business-reports/customer-summary.scm   |    0
 .../report/business-reports/easy-invoice.scm       |    0
 .../report/business-reports/fancy-invoice.scm      |    0
 .../report/business-reports/invoice.scm            |    0
 .../report/business-reports/job-report.scm         |    0
 .../report/business-reports/owner-report.scm       |    0
 .../report/business-reports/payables.scm           |    0
 .../report/business-reports/receipt.css            |    0
 .../report/business-reports/receipt.eguile.scm     |    0
 .../report/business-reports/receipt.scm            |    0
 .../report/business-reports/receivables.scm        |    0
 .../report/business-reports/taxinvoice.css         |    0
 .../report/business-reports/taxinvoice.eguile.scm  |    0
 .../report/business-reports/taxinvoice.scm         |    0
 {src => gnucash}/report/jqplot/CMakeLists.txt      |    0
 {src => gnucash}/report/jqplot/MIT-LICENSE.txt     |    0
 {src => gnucash}/report/jqplot/Makefile.am         |    0
 {src => gnucash}/report/jqplot/README.txt          |    0
 {src => gnucash}/report/jqplot/changes.txt         |    0
 {src => gnucash}/report/jqplot/copyright.txt       |    0
 {src => gnucash}/report/jqplot/excanvas.js         |    0
 {src => gnucash}/report/jqplot/excanvas.min.js     |    0
 {src => gnucash}/report/jqplot/gpl-2.0.txt         |    0
 .../report/jqplot/jqPlotCssStyling.txt             |    0
 {src => gnucash}/report/jqplot/jqPlotOptions.txt   |    0
 {src => gnucash}/report/jqplot/jquery-1.4.2.min.js |    0
 {src => gnucash}/report/jqplot/jquery.jqplot.css   |    0
 {src => gnucash}/report/jqplot/jquery.jqplot.js    |    0
 .../report/jqplot/jquery.jqplot.min.css            |    0
 .../report/jqplot/jquery.jqplot.min.js             |    0
 {src => gnucash}/report/jqplot/jquery.js           |    0
 {src => gnucash}/report/jqplot/jquery.min.js       |    0
 {src => gnucash}/report/jqplot/optionsTutorial.txt |    0
 .../jqplot/plugins/jqplot.BezierCurveRenderer.js   |    0
 .../plugins/jqplot.BezierCurveRenderer.min.js      |    0
 .../report/jqplot/plugins/jqplot.barRenderer.js    |    0
 .../jqplot/plugins/jqplot.barRenderer.min.js       |    0
 .../report/jqplot/plugins/jqplot.blockRenderer.js  |    0
 .../jqplot/plugins/jqplot.blockRenderer.min.js     |    0
 .../report/jqplot/plugins/jqplot.bubbleRenderer.js |    0
 .../jqplot/plugins/jqplot.bubbleRenderer.min.js    |    0
 .../plugins/jqplot.canvasAxisLabelRenderer.js      |    0
 .../plugins/jqplot.canvasAxisLabelRenderer.min.js  |    0
 .../plugins/jqplot.canvasAxisTickRenderer.js       |    0
 .../plugins/jqplot.canvasAxisTickRenderer.min.js   |    0
 .../report/jqplot/plugins/jqplot.canvasOverlay.js  |    0
 .../jqplot/plugins/jqplot.canvasOverlay.min.js     |    0
 .../jqplot/plugins/jqplot.canvasTextRenderer.js    |    0
 .../plugins/jqplot.canvasTextRenderer.min.js       |    0
 .../jqplot/plugins/jqplot.categoryAxisRenderer.js  |    0
 .../plugins/jqplot.categoryAxisRenderer.min.js     |    0
 .../report/jqplot/plugins/jqplot.ciParser.js       |    0
 .../report/jqplot/plugins/jqplot.ciParser.min.js   |    0
 .../report/jqplot/plugins/jqplot.cursor.js         |    0
 .../report/jqplot/plugins/jqplot.cursor.min.js     |    0
 .../jqplot/plugins/jqplot.dateAxisRenderer.js      |    0
 .../jqplot/plugins/jqplot.dateAxisRenderer.min.js  |    0
 .../report/jqplot/plugins/jqplot.donutRenderer.js  |    0
 .../jqplot/plugins/jqplot.donutRenderer.min.js     |    0
 .../report/jqplot/plugins/jqplot.dragable.js       |    0
 .../report/jqplot/plugins/jqplot.dragable.min.js   |    0
 .../plugins/jqplot.enhancedLegendRenderer.js       |    0
 .../plugins/jqplot.enhancedLegendRenderer.min.js   |    0
 .../report/jqplot/plugins/jqplot.funnelRenderer.js |    0
 .../jqplot/plugins/jqplot.funnelRenderer.min.js    |    0
 .../report/jqplot/plugins/jqplot.highlighter.js    |    0
 .../jqplot/plugins/jqplot.highlighter.min.js       |    0
 .../report/jqplot/plugins/jqplot.json2.js          |    0
 .../report/jqplot/plugins/jqplot.json2.min.js      |    0
 .../jqplot/plugins/jqplot.logAxisRenderer.js       |    0
 .../jqplot/plugins/jqplot.logAxisRenderer.min.js   |    0
 .../jqplot/plugins/jqplot.mekkoAxisRenderer.js     |    0
 .../jqplot/plugins/jqplot.mekkoAxisRenderer.min.js |    0
 .../report/jqplot/plugins/jqplot.mekkoRenderer.js  |    0
 .../jqplot/plugins/jqplot.mekkoRenderer.min.js     |    0
 .../jqplot/plugins/jqplot.meterGaugeRenderer.js    |    0
 .../plugins/jqplot.meterGaugeRenderer.min.js       |    0
 .../report/jqplot/plugins/jqplot.mobile.js         |    0
 .../report/jqplot/plugins/jqplot.mobile.min.js     |    0
 .../report/jqplot/plugins/jqplot.ohlcRenderer.js   |    0
 .../jqplot/plugins/jqplot.ohlcRenderer.min.js      |    0
 .../report/jqplot/plugins/jqplot.pieRenderer.js    |    0
 .../jqplot/plugins/jqplot.pieRenderer.min.js       |    0
 .../report/jqplot/plugins/jqplot.pointLabels.js    |    0
 .../jqplot/plugins/jqplot.pointLabels.min.js       |    0
 .../jqplot/plugins/jqplot.pyramidAxisRenderer.js   |    0
 .../plugins/jqplot.pyramidAxisRenderer.min.js      |    0
 .../jqplot/plugins/jqplot.pyramidGridRenderer.js   |    0
 .../plugins/jqplot.pyramidGridRenderer.min.js      |    0
 .../jqplot/plugins/jqplot.pyramidRenderer.js       |    0
 .../jqplot/plugins/jqplot.pyramidRenderer.min.js   |    0
 .../report/jqplot/plugins/jqplot.trendline.js      |    0
 .../report/jqplot/plugins/jqplot.trendline.min.js  |    0
 {src => gnucash}/report/jqplot/usage.txt           |    0
 .../report/locale-specific/CMakeLists.txt          |    0
 .../report/locale-specific/Makefile.am             |    0
 gnucash/report/locale-specific/us/CMakeLists.txt   |   59 +
 gnucash/report/locale-specific/us/Makefile.am      |  113 +
 .../report/locale-specific/us/de_DE.scm            |    0
 .../locale-specific/us/gncmod-locale-reports-us.c  |    0
 .../report/locale-specific/us/taxtxf-de_DE.scm     |    0
 .../report/locale-specific/us/taxtxf.scm           |    0
 .../report/locale-specific/us/test/CMakeLists.txt  |    0
 gnucash/report/locale-specific/us/test/Makefile.am |   29 +
 .../locale-specific/us/test/test-link-module.c     |    0
 .../locale-specific/us/test/test-load-module.in    |    0
 {src => gnucash}/report/locale-specific/us/us.scm  |    0
 gnucash/report/report-gnome/CMakeLists.txt         |   81 +
 gnucash/report/report-gnome/Makefile.am            |  147 +
 .../report/report-gnome/dialog-custom-report.c     |    0
 .../report/report-gnome/dialog-custom-report.glade |    0
 .../report/report-gnome/dialog-custom-report.h     |    0
 .../report-gnome/dialog-report-column-view.c       |  642 ++
 .../report-gnome/dialog-report-column-view.h       |    0
 .../report-gnome/dialog-report-style-sheet.c       |  475 ++
 .../report-gnome/dialog-report-style-sheet.h       |    0
 .../report/report-gnome/dialog-report.glade        |    0
 .../report-gnome/gnc-plugin-page-report-ui.xml     |    0
 .../report/report-gnome/gnc-plugin-page-report.c   | 1952 ++++++
 .../report/report-gnome/gnc-plugin-page-report.h   |    0
 gnucash/report/report-gnome/gncmod-report-gnome.c  |  110 +
 .../report/report-gnome/report-gnome.i             |    0
 gnucash/report/report-gnome/report-gnome.scm       |  153 +
 gnucash/report/report-gnome/test/CMakeLists.txt    |   19 +
 gnucash/report/report-gnome/test/Makefile.am       |   65 +
 .../report/report-gnome/test/test-link-module.c    |    0
 .../report/report-gnome/test/test-load-module.in   |    0
 gnucash/report/report-gnome/window-report.c        |  392 ++
 gnucash/report/report-gnome/window-report.h        |   46 +
 gnucash/report/report-system/CMakeLists.txt        |  118 +
 gnucash/report/report-system/Makefile.am           |  170 +
 .../report/report-system/collectors.scm            |    0
 .../report/report-system/commodity-utilities.scm   |    0
 .../report/report-system/doc/report-html.txt       |    0
 .../report/report-system/eguile-gnc.scm            |    0
 .../report/report-system/eguile-html-utilities.scm |    0
 .../report/report-system/eguile-utilities.scm      |    0
 {src => gnucash}/report/report-system/gnc-report.c |    0
 {src => gnucash}/report/report-system/gnc-report.h |    0
 .../report/report-system/gncmod-report-system.c    |    0
 .../report/report-system/html-acct-table.scm       |    0
 .../report/report-system/html-barchart.scm         |    0
 .../report/report-system/html-document.scm         |    0
 .../report/report-system/html-fonts.scm            |    0
 .../report/report-system/html-jqplot.scm           |    0
 .../report/report-system/html-linechart.scm        |    0
 .../report/report-system/html-piechart.scm         |    0
 .../report/report-system/html-scatter.scm          |    0
 .../report/report-system/html-style-info.scm       |    0
 .../report/report-system/html-style-sheet.scm      |    0
 .../report/report-system/html-table.scm            |    0
 .../report/report-system/html-text.scm             |    0
 .../report/report-system/html-utilities.scm        |    0
 .../report/report-system/list-extras.scm           |    0
 .../report/report-system/options-utilities.scm     |    0
 .../report/report-system/report-collectors.scm     |    0
 .../report/report-system/report-system.i           |    0
 .../report/report-system/report-system.scm         |    0
 .../report/report-system/report-utilities.scm      |    0
 {src => gnucash}/report/report-system/report.scm   |    0
 gnucash/report/report-system/test/CMakeLists.txt   |   32 +
 gnucash/report/report-system/test/Makefile.am      |  101 +
 .../report/report-system/test/test-collectors.scm  |    0
 .../report/report-system/test/test-extras.scm      |    0
 .../report/report-system/test/test-link-module.c   |    0
 .../report/report-system/test/test-list-extras.scm |    0
 .../report/report-system/test/test-load-module.in  |    0
 .../report-system/test/test-report-utilities.scm   |    0
 .../report/report-system/test/test-test-extras.scm |    0
 gnucash/report/standard-reports/CMakeLists.txt     |   71 +
 gnucash/report/standard-reports/Makefile.am        |  114 +
 .../report/standard-reports/account-piecharts.scm  |    0
 .../report/standard-reports/account-summary.scm    |    0
 .../report/standard-reports/advanced-portfolio.scm | 1203 ++++
 .../report/standard-reports/average-balance.scm    |    0
 .../report/standard-reports/balance-sheet.scm      |    0
 .../standard-reports/budget-balance-sheet.scm      |    0
 .../report/standard-reports/budget-barchart.scm    |  379 ++
 .../report/standard-reports/budget-flow.scm        |    0
 .../standard-reports/budget-income-statement.scm   |    0
 .../report/standard-reports/budget.scm             |    0
 .../report/standard-reports/cash-flow.scm          |    0
 .../report/standard-reports/category-barchart.scm  |    0
 .../report/standard-reports/daily-reports.scm      |    0
 .../report/standard-reports/equity-statement.scm   |    0
 .../report/standard-reports/general-journal.scm    |    0
 .../report/standard-reports/general-ledger.scm     |    0
 .../report/standard-reports/income-statement.scm   |    0
 gnucash/report/standard-reports/net-barchart.scm   |  480 ++
 gnucash/report/standard-reports/net-linechart.scm  |  535 ++
 gnucash/report/standard-reports/portfolio.scm      |  303 +
 .../report/standard-reports/price-scatter.scm      |    0
 .../report/standard-reports/register.scm           |    0
 .../report/standard-reports/standard-reports.scm   |    0
 .../report/standard-reports/sx-summary.scm         |    0
 .../report/standard-reports/test/CMakeLists.txt    |   24 +
 gnucash/report/standard-reports/test/Makefile.am   |   86 +
 .../standard-reports/test/test-cash-flow.scm       |    0
 .../test/test-generic-category-report.scm          |    0
 .../test/test-generic-net-barchart.scm             |    0
 .../test/test-generic-net-linechart.scm            |    0
 .../test/test-standard-category-report.scm         |    0
 .../test/test-standard-net-barchart.scm            |    0
 .../test/test-standard-net-linechart.scm           |    0
 .../report/standard-reports/transaction.scm        |    0
 .../report/standard-reports/trial-balance.scm      |    0
 gnucash/report/stylesheets/CMakeLists.txt          |   85 +
 gnucash/report/stylesheets/Makefile.am             |  116 +
 .../stylesheets/gnc-plugin-stylesheets-ui.xml      |    0
 .../report/stylesheets/gnc-plugin-stylesheets.c    |    0
 .../report/stylesheets/gnc-plugin-stylesheets.h    |    0
 .../report/stylesheets/gncmod-stylesheets.c        |    0
 .../report/stylesheets/stylesheet-easy.scm         |    0
 .../report/stylesheets/stylesheet-fancy.scm        |    0
 .../report/stylesheets/stylesheet-footer.scm       |    0
 .../report/stylesheets/stylesheet-head-or-tail.scm |    0
 .../report/stylesheets/stylesheet-plain.scm        |    0
 .../report/stylesheets/stylesheets.scm             |    0
 .../report/stylesheets/test/CMakeLists.txt         |    0
 gnucash/report/stylesheets/test/Makefile.am        |   38 +
 .../report/stylesheets/test/test-load-module.in    |    0
 gnucash/report/utility-reports/CMakeLists.txt      |   30 +
 gnucash/report/utility-reports/Makefile.am         |   76 +
 gnucash/report/utility-reports/hello-world.scm     |  522 ++
 .../report/utility-reports/test-graphing.scm       |    0
 .../report/utility-reports/utility-reports.scm     |    0
 .../report/utility-reports/view-column.scm         |    0
 .../report/utility-reports/welcome-to-gnucash.scm  |    0
 {src/bin => gnucash}/test/CMakeLists.txt           |    0
 {src/bin => gnucash}/test/Makefile.am              |    0
 {src/bin => gnucash}/test/test-version.in          |    0
 libgnucash/CMakeLists.txt                          |   20 +
 libgnucash/Makefile.am                             |   20 +
 libgnucash/app-utils/CMakeLists.txt                |  223 +
 libgnucash/app-utils/Makefile.am                   |  241 +
 {src => libgnucash}/app-utils/QuickFill.c          |    0
 {src => libgnucash}/app-utils/QuickFill.h          |    0
 {src => libgnucash}/app-utils/README               |    0
 libgnucash/app-utils/app-utils.i                   |  177 +
 {src => libgnucash}/app-utils/app-utils.scm        |    0
 {src => libgnucash}/app-utils/business-helpers.c   |    0
 {src => libgnucash}/app-utils/business-helpers.h   |    0
 {src => libgnucash}/app-utils/business-options.c   |    0
 {src => libgnucash}/app-utils/business-options.h   |    0
 {src => libgnucash}/app-utils/business-options.scm |    0
 {src => libgnucash}/app-utils/business-prefs.scm   |    0
 {src => libgnucash}/app-utils/c-interface.scm      |    0
 .../app-utils/calculation/expression_parser.c      |    0
 {src => libgnucash}/app-utils/calculation/fin.c    |    0
 .../app-utils/calculation/fin_spl_protos.h         |    0
 .../app-utils/calculation/fin_static_proto.h       |    0
 .../app-utils/calculation/finproto.h               |    0
 {src => libgnucash}/app-utils/calculation/finvar.h |    0
 {src => libgnucash}/app-utils/config-var.scm       |    0
 {src => libgnucash}/app-utils/date-utilities.scm   |    0
 {src => libgnucash}/app-utils/file-utils.c         |    0
 {src => libgnucash}/app-utils/file-utils.h         |    0
 {src => libgnucash}/app-utils/gettext.scm          |    0
 {src => libgnucash}/app-utils/gfec.c               |    0
 {src => libgnucash}/app-utils/gfec.h               |    0
 {src => libgnucash}/app-utils/gnc-account-merge.c  |    0
 {src => libgnucash}/app-utils/gnc-account-merge.h  |    0
 .../app-utils/gnc-accounting-period.c              |    0
 .../app-utils/gnc-accounting-period.h              |    0
 libgnucash/app-utils/gnc-addr-quickfill.c          |  226 +
 libgnucash/app-utils/gnc-addr-quickfill.h          |   81 +
 {src => libgnucash}/app-utils/gnc-basic-gobject.h  |    0
 .../app-utils/gnc-component-manager.c              |    0
 .../app-utils/gnc-component-manager.h              |    0
 libgnucash/app-utils/gnc-entry-quickfill.c         |  167 +
 libgnucash/app-utils/gnc-entry-quickfill.h         |   67 +
 libgnucash/app-utils/gnc-euro.c                    |  234 +
 {src => libgnucash}/app-utils/gnc-euro.h           |    0
 {src => libgnucash}/app-utils/gnc-exp-parser.c     |    0
 {src => libgnucash}/app-utils/gnc-exp-parser.h     |    0
 libgnucash/app-utils/gnc-gdate-utils.c             |  286 +
 libgnucash/app-utils/gnc-gdate-utils.h             |  228 +
 {src => libgnucash}/app-utils/gnc-gettext-util.c   |    0
 {src => libgnucash}/app-utils/gnc-gettext-util.h   |    0
 libgnucash/app-utils/gnc-gsettings.c               |  833 +++
 {src => libgnucash}/app-utils/gnc-gsettings.h      |    0
 {src => libgnucash}/app-utils/gnc-help-utils.c     |    0
 {src => libgnucash}/app-utils/gnc-help-utils.h     |    0
 {src => libgnucash}/app-utils/gnc-helpers.c        |    0
 {src => libgnucash}/app-utils/gnc-helpers.h        |    0
 libgnucash/app-utils/gnc-prefs-utils.c             |  126 +
 {src => libgnucash}/app-utils/gnc-prefs-utils.h    |    0
 {src => libgnucash}/app-utils/gnc-state.c          |    0
 {src => libgnucash}/app-utils/gnc-state.h          |    0
 .../app-utils/gnc-sx-instance-model.c              |    0
 .../app-utils/gnc-sx-instance-model.h              |    0
 {src => libgnucash}/app-utils/gnc-ui-balances.c    |    0
 {src => libgnucash}/app-utils/gnc-ui-balances.h    |    0
 libgnucash/app-utils/gnc-ui-util.c                 | 2457 ++++++++
 {src => libgnucash}/app-utils/gnc-ui-util.h        |    0
 {src => libgnucash}/app-utils/gncmod-app-utils.c   |    0
 {src => libgnucash}/app-utils/guile-util.c         |    0
 {src => libgnucash}/app-utils/guile-util.h         |    0
 {src => libgnucash}/app-utils/hooks.scm            |    0
 .../app-utils/make-prefs-migration-script.xsl      |    0
 .../app-utils/migratable-prefs.xml.in              |    0
 {src => libgnucash}/app-utils/migrate-prefs.scm    |    0
 libgnucash/app-utils/option-util.c                 | 3034 +++++++++
 libgnucash/app-utils/option-util.h                 |  292 +
 {src => libgnucash}/app-utils/options.scm          |    0
 {src => libgnucash}/app-utils/prefs.scm            |    0
 {src => libgnucash}/app-utils/simple-obj.scm       |    0
 libgnucash/app-utils/test/CMakeLists.txt           |   37 +
 libgnucash/app-utils/test/Makefile.am              |   75 +
 .../app-utils/test/test-app-utils.c                |    0
 .../app-utils/test/test-exp-parser.c               |    0
 .../app-utils/test/test-gnc-ui-util.c              |    0
 .../app-utils/test/test-link-module.c              |    0
 .../app-utils/test/test-load-module.in             |    0
 libgnucash/app-utils/test/test-option-util.cpp     |  136 +
 .../app-utils/test/test-print-parse-amount.cpp     |    0
 .../app-utils/test/test-print-queries.cpp          |    0
 .../app-utils/test/test-scm-query-string.cpp       |    0
 {src => libgnucash}/app-utils/test/test-sx.cpp     |    0
 {src => libgnucash}/backend/CMakeLists.txt         |    0
 {src => libgnucash}/backend/Makefile.am            |    0
 libgnucash/backend/dbi/.splintrc                   |   29 +
 libgnucash/backend/dbi/CMakeLists.txt              |   47 +
 libgnucash/backend/dbi/Makefile.am                 |   46 +
 .../backend/dbi/gnc-backend-dbi.cpp                |    0
 {src => libgnucash}/backend/dbi/gnc-backend-dbi.h  |    0
 .../backend/dbi/gnc-backend-dbi.hpp                |    0
 .../backend/dbi/gnc-dbiprovider.hpp                |    0
 .../backend/dbi/gnc-dbiproviderimpl.hpp            |    0
 .../backend/dbi/gnc-dbisqlconnection.cpp           |    0
 .../backend/dbi/gnc-dbisqlconnection.hpp           |    0
 .../backend/dbi/gnc-dbisqlresult.cpp               |    0
 .../backend/dbi/gnc-dbisqlresult.hpp               |    0
 .../backend/dbi/gncmod-backend-dbi.c               |    0
 libgnucash/backend/dbi/test/CMakeLists.txt         |   40 +
 libgnucash/backend/dbi/test/Makefile.am            |   81 +
 .../backend/dbi/test/test-backend-dbi-basic.cpp    |  686 +++
 libgnucash/backend/dbi/test/test-backend-dbi.cpp   |   53 +
 .../backend/dbi/test/test-dbi-business-stuff.cpp   |    0
 .../backend/dbi/test/test-dbi-business-stuff.h     |    0
 libgnucash/backend/dbi/test/test-dbi-stuff.cpp     |  245 +
 .../backend/dbi/test/test-dbi-stuff.h              |    0
 {src => libgnucash}/backend/dbi/test/test-dbi.xml  |    0
 {src => libgnucash}/backend/sql/.splintrc          |    0
 libgnucash/backend/sql/CMakeLists.txt              |   83 +
 libgnucash/backend/sql/Makefile.am                 |   84 +
 {src => libgnucash}/backend/sql/escape.cpp         |    0
 {src => libgnucash}/backend/sql/escape.h           |    0
 .../backend/sql/gnc-account-sql.cpp                |    0
 {src => libgnucash}/backend/sql/gnc-account-sql.h  |    0
 .../backend/sql/gnc-address-sql.cpp                |    0
 .../backend/sql/gnc-bill-term-sql.cpp              |    0
 .../backend/sql/gnc-bill-term-sql.h                |    0
 {src => libgnucash}/backend/sql/gnc-book-sql.cpp   |    0
 {src => libgnucash}/backend/sql/gnc-book-sql.h     |    0
 {src => libgnucash}/backend/sql/gnc-budget-sql.cpp |    0
 {src => libgnucash}/backend/sql/gnc-budget-sql.h   |    0
 .../backend/sql/gnc-commodity-sql.cpp              |    0
 .../backend/sql/gnc-commodity-sql.h                |    0
 .../backend/sql/gnc-customer-sql.cpp               |    0
 {src => libgnucash}/backend/sql/gnc-customer-sql.h |    0
 .../backend/sql/gnc-employee-sql.cpp               |    0
 {src => libgnucash}/backend/sql/gnc-employee-sql.h |    0
 {src => libgnucash}/backend/sql/gnc-entry-sql.cpp  |    0
 {src => libgnucash}/backend/sql/gnc-entry-sql.h    |    0
 .../backend/sql/gnc-invoice-sql.cpp                |    0
 {src => libgnucash}/backend/sql/gnc-invoice-sql.h  |    0
 {src => libgnucash}/backend/sql/gnc-job-sql.cpp    |    0
 {src => libgnucash}/backend/sql/gnc-job-sql.h      |    0
 {src => libgnucash}/backend/sql/gnc-lots-sql.cpp   |    0
 {src => libgnucash}/backend/sql/gnc-lots-sql.h     |    0
 {src => libgnucash}/backend/sql/gnc-order-sql.cpp  |    0
 {src => libgnucash}/backend/sql/gnc-order-sql.h    |    0
 {src => libgnucash}/backend/sql/gnc-owner-sql.cpp  |    0
 {src => libgnucash}/backend/sql/gnc-price-sql.cpp  |    0
 {src => libgnucash}/backend/sql/gnc-price-sql.h    |    0
 .../backend/sql/gnc-recurrence-sql.cpp             |    0
 .../backend/sql/gnc-recurrence-sql.h               |    0
 .../backend/sql/gnc-schedxaction-sql.cpp           |    0
 .../backend/sql/gnc-schedxaction-sql.h             |    0
 libgnucash/backend/sql/gnc-slots-sql.cpp           |  990 +++
 {src => libgnucash}/backend/sql/gnc-slots-sql.h    |    0
 .../backend/sql/gnc-sql-backend.cpp                |    0
 .../backend/sql/gnc-sql-backend.hpp                |    0
 .../backend/sql/gnc-sql-column-table-entry.cpp     |    0
 .../backend/sql/gnc-sql-column-table-entry.hpp     |    0
 .../backend/sql/gnc-sql-connection.hpp             |    0
 .../backend/sql/gnc-sql-object-backend.cpp         |    0
 .../backend/sql/gnc-sql-object-backend.hpp         |    0
 {src => libgnucash}/backend/sql/gnc-sql-result.cpp |    0
 {src => libgnucash}/backend/sql/gnc-sql-result.hpp |    0
 .../backend/sql/gnc-tax-table-sql.cpp              |    0
 .../backend/sql/gnc-tax-table-sql.h                |    0
 .../backend/sql/gnc-transaction-sql.cpp            |    0
 .../backend/sql/gnc-transaction-sql.h              |    0
 {src => libgnucash}/backend/sql/gnc-vendor-sql.cpp |    0
 {src => libgnucash}/backend/sql/gnc-vendor-sql.h   |    0
 libgnucash/backend/sql/test/CMakeLists.txt         |   25 +
 libgnucash/backend/sql/test/Makefile.am            |   72 +
 libgnucash/backend/sql/test/test-column-types.cpp  |   44 +
 .../backend/sql/test/test-sqlbe.cpp                |    0
 .../backend/sql/test/utest-gnc-backend-sql.cpp     |    0
 libgnucash/backend/xml/CMakeLists.txt              |  129 +
 libgnucash/backend/xml/Makefile.am                 |  107 +
 .../backend/xml/gnc-account-xml-v2.cpp             |    0
 .../backend/xml/gnc-address-xml-v2.cpp             |    0
 .../backend/xml/gnc-address-xml-v2.h               |    0
 .../backend/xml/gnc-backend-xml.cpp                |    0
 {src => libgnucash}/backend/xml/gnc-backend-xml.h  |    0
 .../backend/xml/gnc-bill-term-xml-v2.cpp           |    0
 .../backend/xml/gnc-bill-term-xml-v2.h             |    0
 .../backend/xml/gnc-book-xml-v2.cpp                |    0
 .../backend/xml/gnc-budget-xml-v2.cpp              |    0
 .../backend/xml/gnc-commodity-xml-v2.cpp           |    0
 .../backend/xml/gnc-customer-xml-v2.cpp            |    0
 .../backend/xml/gnc-customer-xml-v2.h              |    0
 .../backend/xml/gnc-employee-xml-v2.cpp            |    0
 .../backend/xml/gnc-employee-xml-v2.h              |    0
 .../backend/xml/gnc-entry-xml-v2.cpp               |    0
 {src => libgnucash}/backend/xml/gnc-entry-xml-v2.h |    0
 .../backend/xml/gnc-freqspec-xml-v2.cpp            |    0
 .../backend/xml/gnc-invoice-xml-v2.cpp             |    0
 .../backend/xml/gnc-invoice-xml-v2.h               |    0
 {src => libgnucash}/backend/xml/gnc-job-xml-v2.cpp |    0
 {src => libgnucash}/backend/xml/gnc-job-xml-v2.h   |    0
 {src => libgnucash}/backend/xml/gnc-lot-xml-v2.cpp |    0
 .../backend/xml/gnc-order-xml-v2.cpp               |    0
 {src => libgnucash}/backend/xml/gnc-order-xml-v2.h |    0
 .../backend/xml/gnc-owner-xml-v2.cpp               |    0
 {src => libgnucash}/backend/xml/gnc-owner-xml-v2.h |    0
 .../backend/xml/gnc-pricedb-xml-v2.cpp             |    0
 .../backend/xml/gnc-recurrence-xml-v2.cpp          |    0
 .../backend/xml/gnc-schedxaction-xml-v2.cpp        |    0
 .../backend/xml/gnc-tax-table-xml-v2.cpp           |    0
 .../backend/xml/gnc-tax-table-xml-v2.h             |    0
 .../backend/xml/gnc-transaction-xml-v2.cpp         |    0
 .../backend/xml/gnc-vendor-xml-v2.cpp              |    0
 .../backend/xml/gnc-vendor-xml-v2.h                |    0
 .../backend/xml/gnc-xml-backend.cpp                |    0
 .../backend/xml/gnc-xml-backend.hpp                |    0
 {src => libgnucash}/backend/xml/gnc-xml-helper.cpp |    0
 {src => libgnucash}/backend/xml/gnc-xml-helper.h   |    0
 {src => libgnucash}/backend/xml/gnc-xml.h          |    0
 .../backend/xml/gncmod-backend-xml.cpp             |    0
 .../backend/xml/io-example-account.cpp             |    0
 .../backend/xml/io-example-account.h               |    0
 {src => libgnucash}/backend/xml/io-gncxml-gen.cpp  |    0
 {src => libgnucash}/backend/xml/io-gncxml-gen.h    |    0
 libgnucash/backend/xml/io-gncxml-v1.cpp            | 3195 ++++++++++
 {src => libgnucash}/backend/xml/io-gncxml-v2.cpp   |    0
 {src => libgnucash}/backend/xml/io-gncxml-v2.h     |    0
 {src => libgnucash}/backend/xml/io-gncxml.h        |    0
 {src => libgnucash}/backend/xml/io-utils.cpp       |    0
 {src => libgnucash}/backend/xml/io-utils.h         |    0
 libgnucash/backend/xml/sixtp-dom-generators.cpp    |  371 ++
 .../backend/xml/sixtp-dom-generators.h             |    0
 libgnucash/backend/xml/sixtp-dom-parsers.cpp       |  908 +++
 .../backend/xml/sixtp-dom-parsers.h                |    0
 {src => libgnucash}/backend/xml/sixtp-parsers.h    |    0
 {src => libgnucash}/backend/xml/sixtp-stack.cpp    |    0
 {src => libgnucash}/backend/xml/sixtp-stack.h      |    0
 .../backend/xml/sixtp-to-dom-parser.cpp            |    0
 {src => libgnucash}/backend/xml/sixtp-utils.cpp    |    0
 {src => libgnucash}/backend/xml/sixtp-utils.h      |    0
 {src => libgnucash}/backend/xml/sixtp.cpp          |    0
 {src => libgnucash}/backend/xml/sixtp.h            |    0
 libgnucash/backend/xml/test/CMakeLists.txt         |  113 +
 libgnucash/backend/xml/test/Makefile.am            |  284 +
 {src => libgnucash}/backend/xml/test/README        |    0
 {src => libgnucash}/backend/xml/test/grab-types.pl |    0
 .../backend/xml/test/test-date-converting.cpp      |    0
 .../backend/xml/test/test-dom-converters1.cpp      |    0
 .../backend/xml/test/test-dom-parser1-1.xml        |    0
 .../backend/xml/test/test-dom-parser1.cpp          |    0
 libgnucash/backend/xml/test/test-file-stuff.cpp    |  406 ++
 .../backend/xml/test/test-file-stuff.h             |    0
 .../backend/xml/test/test-files/CMakeLists.txt     |    0
 .../backend/xml/test/test-files/Makefile.am        |    0
 .../xml/test/test-files/xml1/Money95bank_fr.gml    |    0
 .../xml/test/test-files/xml1/Money95invst.gml      |    0
 .../xml/test/test-files/xml1/Money95mutual.gml     |    0
 .../xml/test/test-files/xml1/Money95stocks.gml     |    0
 .../backend/xml/test/test-files/xml1/abc.gml       |    0
 .../backend/xml/test/test-files/xml1/abcall.gml    |    0
 .../xml/test/test-files/xml1/carols-data-file      |    0
 .../xml/test/test-files/xml1/carols-data-file.gml  |    0
 .../xml/test/test-files/xml1/cbb-export.gml        |    0
 .../backend/xml/test/test-files/xml1/conrads-file  |    0
 .../xml/test/test-files/xml1/conrads-file.gml      |    0
 .../backend/xml/test/test-files/xml1/every.gml     |    0
 .../backend/xml/test/test-files/xml1/ms-money.gml  |    0
 .../backend/xml/test/test-files/xml1/pricedb1.gml  |    0
 .../backend/xml/test/test-files/xml2/.gitignore    |    0
 .../xml/test/test-files/xml2/CMakeLists.txt        |    0
 .../backend/xml/test/test-files/xml2/Makefile.am   |    0
 .../xml/test/test-files/xml2/Money95bank_fr.gml2   |    0
 .../xml/test/test-files/xml2/Money95invst.gml2     |    0
 .../xml/test/test-files/xml2/Money95mutual.gml2    |    0
 .../xml/test/test-files/xml2/Money95stocks.gml2    |    0
 .../backend/xml/test/test-files/xml2/abc.gml2      |    0
 .../backend/xml/test/test-files/xml2/abcall.gml2   |    0
 .../xml/test/test-files/xml2/carols-data-file.gml2 |    0
 .../xml/test/test-files/xml2/cbb-export.gml2       |    0
 .../xml/test/test-files/xml2/conrads-file.gml2     |    0
 .../backend/xml/test/test-files/xml2/every.gml2    |    0
 .../xml/test/test-files/xml2/goonies-file.gml2     |    0
 .../test-files/xml2/hierachical-data-file.gml2     |    0
 .../backend/xml/test/test-files/xml2/ms-money.gml2 |    0
 .../backend/xml/test/test-files/xml2/pricedb1.gml2 |    0
 libgnucash/backend/xml/test/test-kvp-frames.cpp    |  195 +
 libgnucash/backend/xml/test/test-load-backend.cpp  |   49 +
 .../backend/xml/test/test-load-example-account.cpp |  125 +
 libgnucash/backend/xml/test/test-load-xml2.cpp     |  174 +
 .../backend/xml/test/test-real-data.sh.in          |    0
 .../backend/xml/test/test-save-in-lang.cpp         |    0
 .../backend/xml/test/test-string-converters.cpp    |    0
 .../backend/xml/test/test-xml-account.cpp          |    0
 .../backend/xml/test/test-xml-commodity.cpp        |    0
 .../backend/xml/test/test-xml-pricedb.cpp          |    0
 .../backend/xml/test/test-xml-transaction.cpp      |    0
 .../backend/xml/test/test-xml2-is-file.cpp         |    0
 {src => libgnucash}/backend/xml/xml-helpers.h      |    0
 libgnucash/core-utils/CMakeLists.txt               |  202 +
 libgnucash/core-utils/Makefile.am                  |  194 +
 {src => libgnucash}/core-utils/binreloc.c          |    0
 {src => libgnucash}/core-utils/binreloc.h          |    0
 {src => libgnucash}/core-utils/core-utils.i        |    0
 {src => libgnucash}/core-utils/core-utils.scm      |    0
 {src => libgnucash}/core-utils/gnc-environment.c   |    0
 {src => libgnucash}/core-utils/gnc-environment.h   |    0
 libgnucash/core-utils/gnc-filepath-utils.c         |  640 ++
 .../core-utils/gnc-filepath-utils.h                |    0
 libgnucash/core-utils/gnc-gkeyfile-utils.c         |  187 +
 .../core-utils/gnc-gkeyfile-utils.h                |    0
 {src => libgnucash}/core-utils/gnc-glib-utils.c    |    0
 {src => libgnucash}/core-utils/gnc-glib-utils.h    |    0
 libgnucash/core-utils/gnc-guile-utils.c            |  334 +
 {src => libgnucash}/core-utils/gnc-guile-utils.h   |    0
 {src => libgnucash}/core-utils/gnc-jalali.c        |    0
 {src => libgnucash}/core-utils/gnc-jalali.h        |    0
 {src => libgnucash}/core-utils/gnc-locale-utils.c  |    0
 {src => libgnucash}/core-utils/gnc-locale-utils.h  |    0
 libgnucash/core-utils/gnc-path.c                   |  216 +
 {src => libgnucash}/core-utils/gnc-path.h          |    0
 {src => libgnucash}/core-utils/gnc-prefs-p.h       |    0
 libgnucash/core-utils/gnc-prefs.c                  |  373 ++
 {src => libgnucash}/core-utils/gnc-prefs.h         |    0
 {src => libgnucash}/core-utils/gncla-dir.h.in      |    0
 libgnucash/core-utils/test/CMakeLists.txt          |   18 +
 libgnucash/core-utils/test/Makefile.am             |   56 +
 .../core-utils/test/test-gnc-glib-utils.c          |    0
 .../core-utils/test/test-resolve-file-path.c       |   97 +
 {src => libgnucash}/doc/CMakeLists.txt             |    0
 {src => libgnucash}/doc/Makefile.am                |    0
 {src => libgnucash}/doc/README                     |    0
 {src => libgnucash}/doc/TODO-schedxactions         |    0
 {src => libgnucash}/doc/TODO-sixtp                 |    0
 {src => libgnucash}/doc/backup.txt                 |    0
 {src => libgnucash}/doc/books.txt                  |    0
 {src => libgnucash}/doc/budget.txt                 |    0
 {src => libgnucash}/doc/business.txt               |    0
 {src => libgnucash}/doc/callgrind.txt              |    0
 {src => libgnucash}/doc/constderv.html             |    0
 {src => libgnucash}/doc/constraints.txt            |    0
 {src => libgnucash}/doc/currencies.txt             |    0
 {src => libgnucash}/doc/design/CMakeLists.txt      |    0
 {src => libgnucash}/doc/design/Makefile.am         |    0
 .../doc/design/component-manager.texi              |    0
 {src => libgnucash}/doc/design/concept-index.texi  |    0
 {src => libgnucash}/doc/design/engine.texi         |    0
 {src => libgnucash}/doc/design/fdl.texi            |    0
 {src => libgnucash}/doc/design/function-index.texi |    0
 {src => libgnucash}/doc/design/gnucash-design.texi |    0
 {src => libgnucash}/doc/design/intro.texi          |    0
 {src => libgnucash}/doc/design/register.texi       |    0
 {src => libgnucash}/doc/design/reports.texi        |    0
 {src => libgnucash}/doc/design/top-level.texi      |    0
 {src => libgnucash}/doc/design/type-index.texi     |    0
 .../doc/design/user-preferences.texi               |    0
 {src => libgnucash}/doc/dia/components.dia         |  Bin
 {src => libgnucash}/doc/dia/structures-alt.dia     |  Bin
 {src => libgnucash}/doc/dia/structures.dia         |  Bin
 libgnucash/doc/doxygen.cfg.in                      | 1855 ++++++
 {src => libgnucash}/doc/doxygen_main_page.c        |    0
 {src => libgnucash}/doc/engine.txt                 |    0
 {src => libgnucash}/doc/finderv.html               |    0
 {src => libgnucash}/doc/finutil.html               |    0
 {src => libgnucash}/doc/g2-architecture.txt        |    0
 .../doc/generic-druid-framework.txt                |    0
 {src => libgnucash}/doc/gnc-numeric-example.txt    |    0
 {src => libgnucash}/doc/guid.txt                   |    0
 {src => libgnucash}/doc/loans.txt                  |    0
 {src => libgnucash}/doc/lots.txt                   |    0
 .../doc/multicurrency-discussion.txt               |    0
 {src => libgnucash}/doc/prices.txt                 |    0
 {src => libgnucash}/doc/python-bindings-doxygen.py |    0
 {src => libgnucash}/doc/qif.txt                    |    0
 {src => libgnucash}/doc/sx.rst                     |    0
 {src => libgnucash}/doc/tax.txt                    |    0
 {src => libgnucash}/doc/user-prefs-howto.txt       |    0
 {src => libgnucash}/doc/xml/CMakeLists.txt         |    0
 {src => libgnucash}/doc/xml/Makefile.am            |    0
 {src => libgnucash}/doc/xml/README                 |    0
 {src => libgnucash}/doc/xml/account-v2.dtd         |    0
 {src => libgnucash}/doc/xml/commodity-v2.dtd       |    0
 {src => libgnucash}/doc/xml/defaults-v1.dtd        |    0
 {src => libgnucash}/doc/xml/gnucash-v2.rnc         |    0
 {src => libgnucash}/doc/xml/io-gncxml-version1.dtd |    0
 {src => libgnucash}/doc/xml/io-gncxml-version2.dtd |    0
 {src => libgnucash}/doc/xml/preferences-v1.dtd     |    0
 {src => libgnucash}/doc/xml/prices-v1.dtd          |    0
 {src => libgnucash}/doc/xml/transactions-v2.dtd    |    0
 {src => libgnucash}/doc/xml/types.dtd              |    0
 {src => libgnucash}/engine/Account.c               |    0
 {src => libgnucash}/engine/Account.h               |    0
 {src => libgnucash}/engine/AccountP.h              |    0
 libgnucash/engine/CMakeLists.txt                   |  333 +
 {src => libgnucash}/engine/FreqSpec.h              |    0
 libgnucash/engine/Makefile.am                      |  332 +
 {src => libgnucash}/engine/Query.c                 |    0
 {src => libgnucash}/engine/Query.h                 |    0
 {src => libgnucash}/engine/README                  |    0
 {src => libgnucash}/engine/README.query-api        |    0
 libgnucash/engine/Recurrence.c                     |  879 +++
 {src => libgnucash}/engine/Recurrence.h            |    0
 {src => libgnucash}/engine/SX-book-p.h             |    0
 {src => libgnucash}/engine/SX-book.c               |    0
 {src => libgnucash}/engine/SX-book.h               |    0
 {src => libgnucash}/engine/SX-ttinfo.c             |    0
 {src => libgnucash}/engine/SX-ttinfo.h             |    0
 {src => libgnucash}/engine/SchedXaction.c          |    0
 {src => libgnucash}/engine/SchedXaction.h          |    0
 {src => libgnucash}/engine/Scrub.c                 |    0
 {src => libgnucash}/engine/Scrub.h                 |    0
 {src => libgnucash}/engine/Scrub2.c                |    0
 {src => libgnucash}/engine/Scrub2.h                |    0
 {src => libgnucash}/engine/Scrub3.c                |    0
 {src => libgnucash}/engine/Scrub3.h                |    0
 {src => libgnucash}/engine/ScrubBusiness.c         |    0
 {src => libgnucash}/engine/ScrubBusiness.h         |    0
 {src => libgnucash}/engine/ScrubP.h                |    0
 {src => libgnucash}/engine/Split.c                 |    0
 {src => libgnucash}/engine/Split.h                 |    0
 {src => libgnucash}/engine/SplitP.h                |    0
 {src => libgnucash}/engine/TransLog.c              |    0
 {src => libgnucash}/engine/TransLog.h              |    0
 libgnucash/engine/Transaction.c                    | 3034 +++++++++
 {src => libgnucash}/engine/Transaction.h           |    0
 {src => libgnucash}/engine/TransactionP.h          |    0
 libgnucash/engine/business-core.i                  |  193 +
 {src => libgnucash}/engine/business-core.scm       |    0
 {src => libgnucash}/engine/cap-gains.c             |    0
 {src => libgnucash}/engine/cap-gains.h             |    0
 {src => libgnucash}/engine/cashobjects.c           |    0
 {src => libgnucash}/engine/cashobjects.h           |    0
 {src => libgnucash}/engine/commodity-table.scm     |    0
 {src => libgnucash}/engine/design.txt              |    0
 {src => libgnucash}/engine/engine-common.i         |    0
 {src => libgnucash}/engine/engine-helpers-guile.h  |    0
 {src => libgnucash}/engine/engine-helpers.c        |    0
 {src => libgnucash}/engine/engine-helpers.h        |    0
 {src => libgnucash}/engine/engine-interface.scm    |    0
 {src => libgnucash}/engine/engine-utilities.scm    |    0
 {src => libgnucash}/engine/engine.i                |    0
 {src => libgnucash}/engine/engine.scm              |    0
 {src => libgnucash}/engine/extensions.txt          |    0
 {src => libgnucash}/engine/glib-helpers.c          |    0
 {src => libgnucash}/engine/glib-helpers.h          |    0
 libgnucash/engine/gnc-aqbanking-templates.cpp      |  302 +
 .../engine}/gnc-aqbanking-templates.h              |    0
 .../qof => libgnucash/engine}/gnc-backend-prov.hpp |    0
 libgnucash/engine/gnc-budget.c                     |  783 +++
 {src => libgnucash}/engine/gnc-budget.h            |    0
 {src => libgnucash}/engine/gnc-commodity.c         |    0
 {src => libgnucash}/engine/gnc-commodity.h         |    0
 {src/libqof/qof => libgnucash/engine}/gnc-date-p.h |    0
 libgnucash/engine/gnc-date.cpp                     | 1513 +++++
 libgnucash/engine/gnc-date.h                       |  673 ++
 .../qof => libgnucash/engine}/gnc-datetime.cpp     |    0
 .../qof => libgnucash/engine}/gnc-datetime.hpp     |    0
 libgnucash/engine/gnc-engine.c                     |  191 +
 libgnucash/engine/gnc-engine.h                     |  262 +
 {src => libgnucash}/engine/gnc-event.c             |    0
 {src => libgnucash}/engine/gnc-event.h             |    0
 libgnucash/engine/gnc-features.c                   |  153 +
 libgnucash/engine/gnc-features.h                   |   70 +
 {src => libgnucash}/engine/gnc-hooks-scm.h         |    0
 {src => libgnucash}/engine/gnc-hooks.c             |    0
 {src => libgnucash}/engine/gnc-hooks.h             |    0
 .../qof => libgnucash/engine}/gnc-int128.cpp       |    0
 .../qof => libgnucash/engine}/gnc-int128.hpp       |    0
 {src => libgnucash}/engine/gnc-lot-p.h             |    0
 {src => libgnucash}/engine/gnc-lot.c               |    0
 {src => libgnucash}/engine/gnc-lot.h               |    0
 .../qof => libgnucash/engine}/gnc-numeric.cpp      |    0
 .../libqof/qof => libgnucash/engine}/gnc-numeric.h |    0
 .../qof => libgnucash/engine}/gnc-numeric.hpp      |    0
 {src => libgnucash}/engine/gnc-numeric.scm         |    0
 {src => libgnucash}/engine/gnc-pricedb-p.h         |    0
 {src => libgnucash}/engine/gnc-pricedb.c           |    0
 {src => libgnucash}/engine/gnc-pricedb.h           |    0
 .../engine}/gnc-rational-rounding.hpp              |    0
 .../qof => libgnucash/engine}/gnc-rational.cpp     |    0
 .../qof => libgnucash/engine}/gnc-rational.hpp     |    0
 {src => libgnucash}/engine/gnc-session.c           |    0
 {src => libgnucash}/engine/gnc-session.h           |    0
 .../qof => libgnucash/engine}/gnc-timezone.cpp     |    0
 .../qof => libgnucash/engine}/gnc-timezone.hpp     |    0
 .../engine}/gnc-uri-utils.c                        |    0
 .../engine}/gnc-uri-utils.h                        |    0
 {src => libgnucash}/engine/gncAddress.c            |    0
 {src => libgnucash}/engine/gncAddress.h            |    0
 {src => libgnucash}/engine/gncAddressP.h           |    0
 {src => libgnucash}/engine/gncBillTerm.c           |    0
 {src => libgnucash}/engine/gncBillTerm.h           |    0
 {src => libgnucash}/engine/gncBillTermP.h          |    0
 {src => libgnucash}/engine/gncBusGuile.c           |    0
 {src => libgnucash}/engine/gncBusGuile.h           |    0
 libgnucash/engine/gncBusiness.c                    |   99 +
 {src => libgnucash}/engine/gncBusiness.h           |    0
 {src => libgnucash}/engine/gncCustomer.c           |    0
 {src => libgnucash}/engine/gncCustomer.h           |    0
 {src => libgnucash}/engine/gncCustomerP.h          |    0
 {src => libgnucash}/engine/gncEmployee.c           |    0
 {src => libgnucash}/engine/gncEmployee.h           |    0
 {src => libgnucash}/engine/gncEmployeeP.h          |    0
 {src => libgnucash}/engine/gncEntry.c              |    0
 {src => libgnucash}/engine/gncEntry.h              |    0
 {src => libgnucash}/engine/gncEntryP.h             |    0
 {src => libgnucash}/engine/gncIDSearch.c           |    0
 {src => libgnucash}/engine/gncIDSearch.h           |    0
 {src => libgnucash}/engine/gncInvoice.c            |    0
 {src => libgnucash}/engine/gncInvoice.h            |    0
 {src => libgnucash}/engine/gncInvoiceP.h           |    0
 {src => libgnucash}/engine/gncJob.c                |    0
 {src => libgnucash}/engine/gncJob.h                |    0
 {src => libgnucash}/engine/gncJobP.h               |    0
 {src => libgnucash}/engine/gncOrder.c              |    0
 {src => libgnucash}/engine/gncOrder.h              |    0
 {src => libgnucash}/engine/gncOrderP.h             |    0
 {src => libgnucash}/engine/gncOwner.c              |    0
 {src => libgnucash}/engine/gncOwner.h              |    0
 {src => libgnucash}/engine/gncOwnerP.h             |    0
 {src => libgnucash}/engine/gncTaxTable.c           |    0
 {src => libgnucash}/engine/gncTaxTable.h           |    0
 {src => libgnucash}/engine/gncTaxTableP.h          |    0
 {src => libgnucash}/engine/gncVendor.c             |    0
 {src => libgnucash}/engine/gncVendor.h             |    0
 {src => libgnucash}/engine/gncVendorP.h            |    0
 {src => libgnucash}/engine/gncmod-engine.c         |    0
 {src/libqof/qof => libgnucash/engine}/guid.cpp     |    0
 {src/libqof/qof => libgnucash/engine}/guid.h       |    0
 {src/libqof/qof => libgnucash/engine}/guid.hpp     |    0
 {src => libgnucash}/engine/iso-4217-currencies.xml |    0
 {src => libgnucash}/engine/iso-currencies-to-c.xsl |    0
 libgnucash/engine/kvp-frame.cpp                    |  482 ++
 .../engine/kvp-frame.hpp                           |    0
 libgnucash/engine/kvp-scm.cpp                      |  120 +
 {src => libgnucash}/engine/kvp-scm.h               |    0
 libgnucash/engine/kvp-value.cpp                    |  400 ++
 .../libqof/qof => libgnucash/engine}/kvp-value.hpp |    0
 {src => libgnucash}/engine/kvp_doc.txt             |    0
 {src => libgnucash}/engine/policy-p.h              |    0
 {src => libgnucash}/engine/policy.c                |    0
 {src => libgnucash}/engine/policy.h                |    0
 libgnucash/engine/qof-backend.cpp                  |  219 +
 .../qof => libgnucash/engine}/qof-backend.hpp      |    0
 .../libqof/qof => libgnucash/engine}/qof-gobject.h |    0
 .../qof => libgnucash/engine}/qof-string-cache.cpp |    0
 .../qof => libgnucash/engine}/qof-string-cache.h   |    0
 .../libqof/qof => libgnucash/engine}/qof-win32.cpp |    0
 {src/libqof/qof => libgnucash/engine}/qof.h        |    0
 {src/libqof/qof => libgnucash/engine}/qofbackend.h |    0
 {src/libqof/qof => libgnucash/engine}/qofbook-p.h  |    0
 libgnucash/engine/qofbook.cpp                      | 1234 ++++
 {src/libqof/qof => libgnucash/engine}/qofbook.h    |    0
 .../qof => libgnucash/engine}/qofbookslots.h       |    0
 .../libqof/qof => libgnucash/engine}/qofchoice.cpp |    0
 {src/libqof/qof => libgnucash/engine}/qofchoice.h  |    0
 {src/libqof/qof => libgnucash/engine}/qofclass-p.h |    0
 {src/libqof/qof => libgnucash/engine}/qofclass.cpp |    0
 {src/libqof/qof => libgnucash/engine}/qofclass.h   |    0
 {src/libqof/qof => libgnucash/engine}/qofevent-p.h |    0
 {src/libqof/qof => libgnucash/engine}/qofevent.cpp |    0
 {src/libqof/qof => libgnucash/engine}/qofevent.h   |    0
 {src/libqof/qof => libgnucash/engine}/qofid-p.h    |    0
 {src/libqof/qof => libgnucash/engine}/qofid.cpp    |    0
 {src/libqof/qof => libgnucash/engine}/qofid.h      |    0
 .../qof => libgnucash/engine}/qofinstance-p.h      |    0
 libgnucash/engine/qofinstance.cpp                  | 1311 ++++
 .../libqof/qof => libgnucash/engine}/qofinstance.h |    0
 {src/libqof/qof => libgnucash/engine}/qoflog.cpp   |    0
 {src/libqof/qof => libgnucash/engine}/qoflog.h     |    0
 .../libqof/qof => libgnucash/engine}/qofobject-p.h |    0
 .../libqof/qof => libgnucash/engine}/qofobject.cpp |    0
 {src/libqof/qof => libgnucash/engine}/qofobject.h  |    0
 {src/libqof/qof => libgnucash/engine}/qofquery-p.h |    0
 {src/libqof/qof => libgnucash/engine}/qofquery.cpp |    0
 {src/libqof/qof => libgnucash/engine}/qofquery.h   |    0
 .../qof => libgnucash/engine}/qofquerycore-p.h     |    0
 .../qof => libgnucash/engine}/qofquerycore.cpp     |    0
 .../qof => libgnucash/engine}/qofquerycore.h       |    0
 .../qof => libgnucash/engine}/qofsession.cpp       |    0
 {src/libqof/qof => libgnucash/engine}/qofsession.h |    0
 .../qof => libgnucash/engine}/qofsession.hpp       |    0
 {src/libqof/qof => libgnucash/engine}/qofutil.cpp  |    0
 {src/libqof/qof => libgnucash/engine}/qofutil.h    |    0
 libgnucash/engine/test-core/CMakeLists.txt         |   20 +
 libgnucash/engine/test-core/Makefile.am            |   26 +
 .../engine/test-core/gncmod-test-engine.c          |    0
 .../engine/test-core/test-engine-strings.h         |    0
 libgnucash/engine/test-core/test-engine-stuff.cpp  | 2198 +++++++
 .../engine/test-core/test-engine-stuff.h           |    0
 libgnucash/engine/test/CMakeLists.txt              |  286 +
 libgnucash/engine/test/Makefile.am                 |  214 +
 {src => libgnucash}/engine/test/README             |    0
 {src => libgnucash}/engine/test/dummy.cpp          |    0
 .../engine}/test/gtest-gnc-datetime.cpp            |    0
 .../engine}/test/gtest-gnc-int128.cpp              |    0
 .../engine}/test/gtest-gnc-numeric.cpp             |    0
 .../engine}/test/gtest-gnc-rational.cpp            |    0
 .../engine}/test/gtest-gnc-timezone.cpp            |    0
 libgnucash/engine/test/gtest-import-map.cpp        |  391 ++
 .../engine/test/test-account-object.cpp            |    0
 {src => libgnucash}/engine/test/test-account.scm   |    0
 {src => libgnucash}/engine/test/test-address.c     |    0
 {src => libgnucash}/engine/test/test-business.c    |    0
 .../engine/test/test-commodities.cpp               |    0
 .../engine/test/test-create-account.in             |    0
 .../engine/test/test-create-account.scm            |    0
 {src => libgnucash}/engine/test/test-customer.c    |    0
 {src => libgnucash}/engine/test/test-date.cpp      |    0
 {src => libgnucash}/engine/test/test-employee.c    |    0
 .../engine/test/test-engine-kvp-properties.c       |    0
 {src => libgnucash}/engine/test/test-engine.c      |    0
 {src => libgnucash}/engine/test/test-extras.scm    |    0
 libgnucash/engine/test/test-gnc-date.c             | 2281 +++++++
 .../engine}/test/test-gnc-guid-old.cpp             |    0
 .../engine}/test/test-gnc-guid.cpp                 |    0
 libgnucash/engine/test/test-gnc-uri-utils.c        |  333 +
 .../engine/test/test-group-vs-book.cpp             |    0
 {src => libgnucash}/engine/test/test-guid.cpp      |    0
 {src => libgnucash}/engine/test/test-job.c         |    0
 libgnucash/engine/test/test-kvp-frame.cpp          |  204 +
 libgnucash/engine/test/test-kvp-value.cpp          |  100 +
 {src => libgnucash}/engine/test/test-link.c        |    0
 {src => libgnucash}/engine/test/test-load-engine.c |    0
 {src => libgnucash}/engine/test/test-lots.cpp      |    0
 .../engine}/test/test-numeric.cpp                  |    0
 {src => libgnucash}/engine/test/test-object.c      |    0
 .../engine}/test/test-qof-string-cache.c           |    0
 .../qof => libgnucash/engine}/test/test-qof.c      |    0
 .../engine}/test/test-qofbackend.c                 |    0
 .../qof => libgnucash/engine}/test/test-qofbook.c  |    0
 libgnucash/engine/test/test-qofinstance.cpp        | 1053 ++++
 .../engine}/test/test-qofobject.c                  |    0
 .../engine}/test/test-qofsession-old.cpp           |    0
 libgnucash/engine/test/test-qofsession.cpp         |  224 +
 {src => libgnucash}/engine/test/test-query.cpp     |    0
 {src => libgnucash}/engine/test/test-querynew.c    |    0
 {src => libgnucash}/engine/test/test-recurrence.c  |    0
 .../engine/test/test-scm-query-import.in           |    0
 .../engine/test/test-scm-query-import.scm          |    0
 {src => libgnucash}/engine/test/test-scm-query.cpp |    0
 .../engine/test/test-split-vs-account.cpp          |    0
 {src => libgnucash}/engine/test/test-split.scm     |    0
 .../engine/test/test-test-extras.scm               |    0
 .../engine/test/test-transaction-reversal.cpp      |    0
 .../engine/test/test-transaction-voiding.cpp       |    0
 {src => libgnucash}/engine/test/test-vendor.c      |    0
 libgnucash/engine/test/utest-Account.cpp           | 2608 ++++++++
 {src => libgnucash}/engine/test/utest-Budget.c     |    0
 {src => libgnucash}/engine/test/utest-Entry.c      |    0
 {src => libgnucash}/engine/test/utest-Invoice.c    |    0
 libgnucash/engine/test/utest-Split.cpp             | 1941 ++++++
 libgnucash/engine/test/utest-Transaction.cpp       | 2092 +++++++
 .../engine/test/utest-gnc-pricedb.c                |    0
 {src => libgnucash}/engine/xlate.pl                |    0
 libgnucash/gnc-module/CMakeLists.txt               |   70 +
 libgnucash/gnc-module/Makefile.am                  |  103 +
 {src => libgnucash}/gnc-module/README              |    0
 {src => libgnucash}/gnc-module/doc/design.txt      |    0
 .../gnc-module}/example/CMakeLists.txt             |    0
 libgnucash/gnc-module/example/Makefile.am          |   37 +
 .../gnc-module}/example/glade/CMakeLists.txt       |    0
 .../gnc-module}/example/glade/Makefile.am          |    0
 .../gnc-module}/example/gnc-plugin.example.c       |    0
 .../gnc-module}/example/gnc-plugin.example.h       |    0
 .../gnc-module}/example/gncmod-example.c           |    0
 .../gnc-module}/example/ui/CMakeLists.txt          |    0
 .../gnc-module}/example/ui/Makefile.am             |    0
 .../example/ui/gnc-plugin-example-ui.xml           |    0
 {src => libgnucash}/gnc-module/gnc-module-api.h    |    0
 libgnucash/gnc-module/gnc-module.c                 |  615 ++
 {src => libgnucash}/gnc-module/gnc-module.h        |    0
 {src => libgnucash}/gnc-module/gnc-module.i        |    0
 {src => libgnucash}/gnc-module/gnc-module.scm      |    0
 libgnucash/gnc-module/test/CMakeLists.txt          |  114 +
 libgnucash/gnc-module/test/Makefile.am             |   72 +
 {src => libgnucash}/gnc-module/test/README         |    0
 .../gnc-module/test/misc-mods/CMakeLists.txt       |   16 +
 libgnucash/gnc-module/test/misc-mods/Makefile.am   |   30 +
 .../gnc-module/test/misc-mods/agedver.c            |    0
 .../gnc-module/test/misc-mods/futuremodsys.c       |    0
 .../gnc-module/test/misc-mods/incompatdep.c        |    0
 libgnucash/gnc-module/test/mod-bar/CMakeLists.txt  |   24 +
 libgnucash/gnc-module/test/mod-bar/Makefile.am     |   43 +
 {src => libgnucash}/gnc-module/test/mod-bar/bar.c  |    0
 {src => libgnucash}/gnc-module/test/mod-bar/bar.h  |    0
 {src => libgnucash}/gnc-module/test/mod-bar/bar.i  |    0
 .../gnc-module/test/mod-bar/gnc-mod-bar.c          |    0
 .../gnc-module/test/mod-bar/gnucash/bar.scm        |    0
 libgnucash/gnc-module/test/mod-baz/CMakeLists.txt  |   30 +
 libgnucash/gnc-module/test/mod-baz/Makefile.am     |   47 +
 {src => libgnucash}/gnc-module/test/mod-baz/baz.c  |    0
 {src => libgnucash}/gnc-module/test/mod-baz/baz.h  |    0
 {src => libgnucash}/gnc-module/test/mod-baz/baz.i  |    0
 .../gnc-module/test/mod-baz/gnc-mod-baz.c          |    0
 .../gnc-module/test/mod-baz/gnucash/baz.scm        |    0
 libgnucash/gnc-module/test/mod-foo/CMakeLists.txt  |   24 +
 libgnucash/gnc-module/test/mod-foo/Makefile.am     |   44 +
 {src => libgnucash}/gnc-module/test/mod-foo/foo.c  |    0
 {src => libgnucash}/gnc-module/test/mod-foo/foo.h  |    0
 {src => libgnucash}/gnc-module/test/mod-foo/foo.i  |    0
 .../gnc-module/test/mod-foo/gnc-mod-foo.c          |    0
 .../gnc-module/test/mod-foo/gnucash/foo.scm        |    0
 libgnucash/gnc-module/test/test-agedver.c          |   62 +
 libgnucash/gnc-module/test/test-dynload.c          |  112 +
 libgnucash/gnc-module/test/test-gwrapped-c.in      |   15 +
 libgnucash/gnc-module/test/test-incompatdep.c      |   67 +
 libgnucash/gnc-module/test/test-load-c.c           |   67 +
 libgnucash/gnc-module/test/test-load-deps.in       |   31 +
 libgnucash/gnc-module/test/test-load-scm.in        |   20 +
 libgnucash/gnc-module/test/test-modsysver.c        |   68 +
 .../gnc-module/test/test-scm-dynload.in            |    0
 libgnucash/gnc-module/test/test-scm-init.in        |   23 +
 libgnucash/gnc-module/test/test-scm-module.in      |   15 +
 libgnucash/gnc-module/test/test-scm-multi.in       |   29 +
 {src => libgnucash}/quotes/CMakeLists.txt          |    0
 {src => libgnucash}/quotes/Makefile.am             |    0
 {src => libgnucash}/quotes/Quote_example.pl        |    0
 {src => libgnucash}/quotes/README                  |    0
 {src => libgnucash}/quotes/gnc-fq-check.in         |    0
 {src => libgnucash}/quotes/gnc-fq-dump             |    0
 {src => libgnucash}/quotes/gnc-fq-helper.in        |    0
 {src => libgnucash}/quotes/gnc-fq-update.in        |    0
 {src => libgnucash}/quotes/gnc-value-portfolio     |    0
 libgnucash/scm/CMakeLists.txt                      |   70 +
 libgnucash/scm/Makefile.am                         |   89 +
 {src => libgnucash}/scm/build-config.scm.in        |    0
 {src => libgnucash}/scm/config                     |    0
 {src => libgnucash}/scm/fin.scm                    |    0
 {src => libgnucash}/scm/gnumeric/CMakeLists.txt    |    0
 {src => libgnucash}/scm/gnumeric/Makefile.am       |    0
 .../scm/gnumeric/gnumeric-utilities.scm            |    0
 {src => libgnucash}/scm/gnumeric/table-utils.scm   |    0
 {src => libgnucash}/scm/main.scm                   |    0
 {src => libgnucash}/scm/price-quotes.scm           |    0
 {src => libgnucash}/scm/printf.scm                 |    0
 {src => libgnucash}/scm/string.scm                 |    0
 {src => libgnucash}/scm/substring-search.scm       |    0
 {src => libgnucash}/scm/xml-generator.scm          |    0
 {src => libgnucash}/tax/CMakeLists.txt             |    0
 {src => libgnucash}/tax/Makefile.am                |    0
 libgnucash/tax/us/CMakeLists.txt                   |   51 +
 libgnucash/tax/us/Makefile.am                      |   85 +
 {src => libgnucash}/tax/us/de_DE.scm               |    0
 .../tax/us/de_DE/taxtxf - LIES MICH.txt            |    0
 .../tax/us/de_DE/txf-USt-Bericht.html              |    0
 .../tax/us/de_DE/txf-USt-VA Anleitung 2011.pdf     |  Bin
 {src => libgnucash}/tax/us/gncmod-tax-us.c         |    0
 {src => libgnucash}/tax/us/test/CMakeLists.txt     |    0
 libgnucash/tax/us/test/Makefile.am                 |   19 +
 {src => libgnucash}/tax/us/test/test-link-module.c |    0
 .../tax/us/test/test-load-module.in                |    0
 {src => libgnucash}/tax/us/txf-de_DE.scm           |    0
 {src => libgnucash}/tax/us/txf-help-de_DE.scm      |    0
 {src => libgnucash}/tax/us/txf-help.scm            |    0
 {src => libgnucash}/tax/us/txf.scm                 |    0
 {src => libgnucash}/tax/us/us.scm                  |    0
 make-gnucash-potfiles.in                           |   10 +-
 packaging/CMakeLists.txt                           |    4 -
 packaging/Makefile.am                              |   18 -
 packaging/README.RPM                               |   88 -
 packaging/gnucash.spec.in                          |  264 -
 po/CMakeLists.txt                                  |   14 +-
 po/POTFILES.ignore                                 |   12 +-
 po/POTFILES.in                                     | 1348 ++--
 po/POTFILES.skip                                   |  189 +-
 src/CMakeLists.txt                                 |  192 -
 src/Makefile.am                                    |   80 -
 src/README                                         |   11 -
 src/README.modules                                 |   63 -
 src/app-utils/CMakeLists.txt                       |  221 -
 src/app-utils/Makefile.am                          |  244 -
 src/app-utils/app-utils.i                          |  177 -
 src/app-utils/gnc-addr-quickfill.c                 |  226 -
 src/app-utils/gnc-addr-quickfill.h                 |   81 -
 src/app-utils/gnc-entry-quickfill.c                |  167 -
 src/app-utils/gnc-entry-quickfill.h                |   67 -
 src/app-utils/gnc-euro.c                           |  234 -
 src/app-utils/gnc-gsettings.c                      |  833 ---
 src/app-utils/gnc-prefs-utils.c                    |  126 -
 src/app-utils/gnc-ui-util.c                        | 2457 --------
 src/app-utils/option-util.c                        | 3039 ---------
 src/app-utils/option-util.h                        |  292 -
 src/app-utils/test/CMakeLists.txt                  |   37 -
 src/app-utils/test/Makefile.am                     |   78 -
 src/app-utils/test/test-option-util.cpp            |  136 -
 src/backend/dbi/.splintrc                          |   31 -
 src/backend/dbi/CMakeLists.txt                     |   64 -
 src/backend/dbi/Makefile.am                        |   48 -
 src/backend/dbi/test/CMakeLists.txt                |   41 -
 src/backend/dbi/test/Makefile.am                   |   83 -
 src/backend/dbi/test/test-backend-dbi-basic.cpp    |  686 ---
 src/backend/dbi/test/test-backend-dbi.cpp          |   50 -
 src/backend/dbi/test/test-dbi-stuff.cpp            |  245 -
 src/backend/sql/CMakeLists.txt                     |   83 -
 src/backend/sql/Makefile.am                        |   86 -
 src/backend/sql/gnc-slots-sql.cpp                  |  990 ---
 src/backend/sql/test/CMakeLists.txt                |   26 -
 src/backend/sql/test/Makefile.am                   |   75 -
 src/backend/sql/test/test-column-types.cpp         |   48 -
 src/backend/xml/CMakeLists.txt                     |  148 -
 src/backend/xml/Makefile.am                        |  110 -
 src/backend/xml/io-gncxml-v1.cpp                   | 3195 ----------
 src/backend/xml/sixtp-dom-generators.cpp           |  371 --
 src/backend/xml/sixtp-dom-parsers.cpp              |  908 ---
 src/backend/xml/test/CMakeLists.txt                |  114 -
 src/backend/xml/test/Makefile.am                   |  287 -
 src/backend/xml/test/test-file-stuff.cpp           |  406 --
 src/backend/xml/test/test-kvp-frames.cpp           |  195 -
 src/backend/xml/test/test-load-backend.cpp         |   47 -
 src/backend/xml/test/test-load-example-account.cpp |  125 -
 src/backend/xml/test/test-load-xml2.cpp            |  172 -
 src/bin/CMakeLists.txt                             |  178 -
 src/bin/Makefile.am                                |  150 -
 src/bin/gnucash-bin.c                              |  823 ---
 src/bin/gnucash-valgrind.in                        |   24 -
 src/bin/overrides/gnucash-build-env.in             |  101 -
 src/business/CMakeLists.txt                        |    5 -
 src/business/Makefile.am                           |    5 -
 src/business/business-gnome/CMakeLists.txt         |   87 -
 src/business/business-gnome/Makefile.am            |  162 -
 src/business/business-gnome/business-gnome.scm     |   37 -
 src/business/business-gnome/dialog-customer.c      | 1347 ----
 src/business/business-gnome/dialog-order.c         |  986 ---
 src/business/business-gnome/dialog-payment.c       | 1256 ----
 src/business/business-gnome/gnc-plugin-business.c  | 1108 ----
 .../business-gnome/gncmod-business-gnome.c         |  129 -
 .../business-gnome/gschemas/CMakeLists.txt         |    6 -
 src/business/business-gnome/gschemas/Makefile.am   |   12 -
 .../business-gnome/gtkbuilder/CMakeLists.txt       |   16 -
 src/business/business-gnome/gtkbuilder/Makefile.am |   18 -
 src/business/business-gnome/ui/CMakeLists.txt      |   12 -
 src/business/business-gnome/ui/Makefile.am         |    7 -
 src/business/business-ledger/CMakeLists.txt        |   37 -
 src/business/business-ledger/Makefile.am           |   46 -
 src/business/business-ledger/gncEntryLedger.c      | 1080 ----
 .../business-ledger/gncEntryLedgerControl.c        | 1049 ----
 .../business-ledger/gncEntryLedgerLayout.c         |  293 -
 src/business/business-ledger/gncEntryLedgerLoad.c  |  617 --
 src/cmake_modules/GncAddSchemeTargets.cmake        |  183 -
 src/cmake_modules/GncAddSwigCommand.cmake          |   31 -
 src/cmake_modules/GncAddTest.cmake                 |  162 -
 src/cmake_modules/MakeDist.cmake                   |  207 -
 src/cmake_modules/MakeDistFiles.cmake              |  112 -
 src/core-utils/CMakeLists.txt                      |  206 -
 src/core-utils/Makefile.am                         |  204 -
 src/core-utils/gnc-features.c                      |  153 -
 src/core-utils/gnc-features.h                      |   70 -
 src/core-utils/gnc-filepath-utils.c                |  645 --
 src/core-utils/gnc-gdate-utils.c                   |  303 -
 src/core-utils/gnc-gdate-utils.h                   |  243 -
 src/core-utils/gnc-gkeyfile-utils.c                |  191 -
 src/core-utils/gnc-guile-utils.c                   |  338 --
 src/core-utils/gnc-path.c                          |  216 -
 src/core-utils/gnc-prefs.c                         |  383 --
 src/core-utils/test/CMakeLists.txt                 |   20 -
 src/core-utils/test/Makefile.am                    |   58 -
 src/core-utils/test/test-gnc-uri-utils.c           |  350 --
 src/core-utils/test/test-resolve-file-path.c       |  100 -
 src/doc/doxygen.cfg.in                             | 1855 ------
 src/engine/CMakeLists.txt                          |  240 -
 src/engine/Makefile.am                             |  262 -
 src/engine/Recurrence.c                            |  872 ---
 src/engine/Transaction.c                           | 3034 ---------
 src/engine/business-core.i                         |  193 -
 src/engine/gnc-budget.c                            |  783 ---
 src/engine/gnc-engine.c                            |  224 -
 src/engine/gnc-engine.h                            |  266 -
 src/engine/gncBusiness.c                           |   99 -
 src/engine/kvp-scm.cpp                             |  120 -
 src/engine/test-core/CMakeLists.txt                |   21 -
 src/engine/test-core/Makefile.am                   |   29 -
 src/engine/test-core/test-engine-stuff.cpp         | 2198 -------
 src/engine/test/CMakeLists.txt                     |  152 -
 src/engine/test/Makefile.am                        |  215 -
 src/engine/test/gtest-import-map.cpp               |  391 --
 src/engine/test/utest-Account.cpp                  | 2608 --------
 src/engine/test/utest-Split.cpp                    | 1941 ------
 src/engine/test/utest-Transaction.cpp              | 2092 -------
 src/gnc-module/CMakeLists.txt                      |   66 -
 src/gnc-module/Makefile.am                         |   91 -
 src/gnc-module/gnc-module.c                        |  627 --
 src/gnc-module/test/CMakeLists.txt                 |  115 -
 src/gnc-module/test/Makefile.am                    |   74 -
 src/gnc-module/test/misc-mods/CMakeLists.txt       |   16 -
 src/gnc-module/test/misc-mods/Makefile.am          |   30 -
 src/gnc-module/test/mod-bar/CMakeLists.txt         |   24 -
 src/gnc-module/test/mod-bar/Makefile.am            |   43 -
 src/gnc-module/test/mod-baz/CMakeLists.txt         |   30 -
 src/gnc-module/test/mod-baz/Makefile.am            |   47 -
 src/gnc-module/test/mod-foo/CMakeLists.txt         |   24 -
 src/gnc-module/test/mod-foo/Makefile.am            |   44 -
 src/gnc-module/test/test-agedver.c                 |   62 -
 src/gnc-module/test/test-dynload.c                 |  112 -
 src/gnc-module/test/test-gwrapped-c.in             |   15 -
 src/gnc-module/test/test-incompatdep.c             |   67 -
 src/gnc-module/test/test-load-c.c                  |   67 -
 src/gnc-module/test/test-load-deps.in              |   31 -
 src/gnc-module/test/test-load-scm.in               |   20 -
 src/gnc-module/test/test-modsysver.c               |   68 -
 src/gnc-module/test/test-scm-init.in               |   23 -
 src/gnc-module/test/test-scm-module.in             |   15 -
 src/gnc-module/test/test-scm-multi.in              |   29 -
 src/gnc/.gitignore                                 |    1 -
 src/gnc/AccountItemModel.cpp                       |  248 -
 src/gnc/AccountItemModel.hpp                       |  122 -
 src/gnc/AccountSelectionDelegate.cpp               |  122 -
 src/gnc/AccountSelectionDelegate.hpp               |   55 -
 src/gnc/CMakeLists.txt                             |  134 -
 src/gnc/Cmd.cpp                                    |  478 --
 src/gnc/Cmd.hpp                                    |  162 -
 src/gnc/Doxyfile                                   |  229 -
 src/gnc/QofEventWrapper.cpp                        |   59 -
 src/gnc/QofEventWrapper.hpp                        |  157 -
 src/gnc/RecentFileMenu.cpp                         |  155 -
 src/gnc/RecentFileMenu.hpp                         |   94 -
 src/gnc/Session.cpp                                |   95 -
 src/gnc/Session.hpp                                |  109 -
 src/gnc/SplitListModel.cpp                         |  756 ---
 src/gnc/SplitListModel.hpp                         |  110 -
 src/gnc/SplitListView.cpp                          |  119 -
 src/gnc/SplitListView.hpp                          |   62 -
 src/gnc/WeakPointer.hpp                            |   94 -
 src/gnc/bla.html                                   |   20 -
 src/gnc/conv.hpp                                   |   37 -
 src/gnc/dashboard.cpp                              |  335 -
 src/gnc/dashboard.hpp                              |  124 -
 src/gnc/dashboard.ui                               |  329 -
 src/gnc/fallback-icons.qrc                         |   18 -
 src/gnc/fpo/FPO.cpp                                |   46 -
 src/gnc/fpo/FPO.hpp                                |   35 -
 src/gnc/fpo/ViewletModel.cpp                       |  236 -
 src/gnc/fpo/ViewletModel.hpp                       |   55 -
 src/gnc/fpo/ViewletView.cpp                        |  371 --
 src/gnc/fpo/ViewletView.hpp                        |  102 -
 src/gnc/gnucash.qrc                                |   21 -
 src/gnc/gtk-icons.qrc                              |   16 -
 src/gnc/gtk-icons/gtk-about.png                    |  Bin 1710 -> 0 bytes
 src/gnc/gtk-icons/gtk-close.png                    |  Bin 1045 -> 0 bytes
 src/gnc/gtk-icons/gtk-copy.png                     |  Bin 567 -> 0 bytes
 src/gnc/gtk-icons/gtk-cut.png                      |  Bin 1532 -> 0 bytes
 src/gnc/gtk-icons/gtk-new.png                      |  Bin 1393 -> 0 bytes
 src/gnc/gtk-icons/gtk-open.png                     |  Bin 971 -> 0 bytes
 src/gnc/gtk-icons/gtk-paste.png                    |  Bin 1143 -> 0 bytes
 src/gnc/gtk-icons/gtk-quit.png                     |  Bin 1207 -> 0 bytes
 src/gnc/gtk-icons/gtk-redo.png                     |  Bin 1608 -> 0 bytes
 src/gnc/gtk-icons/gtk-save-as.png                  |  Bin 2024 -> 0 bytes
 src/gnc/gtk-icons/gtk-save.png                     |  Bin 1944 -> 0 bytes
 src/gnc/gtk-icons/gtk-undo.png                     |  Bin 1555 -> 0 bytes
 .../icons/oxygen/48x48/actions/document-new.png    |  Bin 2461 -> 0 bytes
 .../icons/oxygen/48x48/actions/document-open.png   |  Bin 1616 -> 0 bytes
 .../oxygen/48x48/actions/document-save-as.png      |  Bin 3792 -> 0 bytes
 .../icons/oxygen/48x48/actions/document-save.png   |  Bin 2122 -> 0 bytes
 src/gnc/icons/oxygen/48x48/actions/edit-copy.png   |  Bin 1380 -> 0 bytes
 src/gnc/icons/oxygen/48x48/actions/edit-cut.png    |  Bin 1666 -> 0 bytes
 src/gnc/icons/oxygen/48x48/actions/edit-paste.png  |  Bin 1578 -> 0 bytes
 src/gnc/icons/oxygen/48x48/actions/edit-redo.png   |  Bin 3383 -> 0 bytes
 src/gnc/icons/oxygen/48x48/actions/edit-undo.png   |  Bin 3440 -> 0 bytes
 src/gnc/icons/oxygen/48x48/actions/help-about.png  |  Bin 2742 -> 0 bytes
 src/gnc/icons/oxygen/48x48/actions/list-add.png    |  Bin 2658 -> 0 bytes
 .../icons/oxygen/48x48/actions/tab-close-other.png |  Bin 2451 -> 0 bytes
 .../icons/oxygen/48x48/actions/window-close.png    |  Bin 3751 -> 0 bytes
 src/gnc/icons/oxygen/index.theme                   |   35 -
 src/gnc/main.cpp                                   |  221 -
 src/gnc/mainwindow-file.cpp                        |  763 ---
 src/gnc/mainwindow.cpp                             |  633 --
 src/gnc/mainwindow.hpp                             |  151 -
 src/gnc/mainwindow.ui                              |  430 --
 src/gnc/metatype.hpp                               |   12 -
 src/gnc/qss/default.qss                            |   48 -
 src/gnc/stylesheets.qrc                            |    5 -
 src/gnome-search/CMakeLists.txt                    |   64 -
 src/gnome-search/Makefile.am                       |   67 -
 src/gnome-utils/CMakeLists.txt                     |  277 -
 src/gnome-utils/Makefile.am                        |  332 -
 src/gnome-utils/dialog-book-close.c                |  394 --
 src/gnome-utils/dialog-options.c                   | 4314 -------------
 src/gnome-utils/dialog-options.h                   |  115 -
 src/gnome-utils/dialog-reset-warnings.c            |  426 --
 src/gnome-utils/dialog-transfer.c                  | 2499 --------
 src/gnome-utils/gnc-main-window.c                  | 4825 ---------------
 src/gnome-utils/gnc-splash.c                       |  209 -
 src/gnome-utils/gnc-tree-control-split-reg.c       | 2173 -------
 src/gnome-utils/gnc-tree-view-split-reg.c          | 6421 --------------------
 src/gnome-utils/test/CMakeLists.txt                |   36 -
 src/gnome-utils/test/Makefile.am                   |   77 -
 src/gnome/CMakeLists.txt                           |  166 -
 src/gnome/Makefile.am                              |  170 -
 src/gnome/dialog-commodities.c                     |  431 --
 src/gnome/dialog-new-user.c                        |  163 -
 src/gnome/dialog-price-edit-db.c                   |  568 --
 src/gnome/gnc-plugin-page-register.c               | 4192 -------------
 src/gnome/gnc-plugin-page-register2.c              | 4082 -------------
 src/gnome/gnc-split-reg.c                          | 2258 -------
 src/gnome/gnc-split-reg2.c                         | 1112 ----
 src/gnome/gschemas/CMakeLists.txt                  |   25 -
 src/gnome/gschemas/Makefile.am                     |   20 -
 src/gnome/gtkbuilder/CMakeLists.txt                |   35 -
 src/gnome/gtkbuilder/Makefile.am                   |   25 -
 src/gnome/top-level.c                              |  410 --
 src/gnome/ui/CMakeLists.txt                        |   34 -
 src/gnome/ui/Makefile.am                           |   23 -
 src/html/CMakeLists.txt                            |   59 -
 src/html/Makefile.am                               |   97 -
 src/import-export/CMakeLists.txt                   |   86 -
 src/import-export/Makefile.am                      |   71 -
 src/import-export/aqb/CMakeLists.txt               |   91 -
 src/import-export/aqb/Makefile.am                  |   83 -
 src/import-export/aqb/test/CMakeLists.txt          |   37 -
 src/import-export/aqb/test/Makefile.am             |   73 -
 src/import-export/aqb/test/test-aqb.c              |   62 -
 src/import-export/aqb/test/test-kvp.c              |  209 -
 src/import-export/csv-exp/Makefile.am              |   62 -
 src/import-export/csv-imp/Makefile.am              |   85 -
 src/import-export/csv-imp/test/CMakeLists.txt      |   38 -
 src/import-export/csv-imp/test/Makefile.am         |  121 -
 src/import-export/import-main-matcher.c            |  916 ---
 src/import-export/log-replay/CMakeLists.txt        |   37 -
 src/import-export/log-replay/Makefile.am           |   46 -
 src/import-export/ofx/CMakeLists.txt               |   44 -
 src/import-export/ofx/Makefile.am                  |   49 -
 src/import-export/ofx/gnc-ofx-import.c             | 1051 ----
 src/import-export/ofx/gnc-ofx-kvp.h                |   38 -
 src/import-export/ofx/test/Makefile.am             |   13 -
 src/import-export/qif-imp/CMakeLists.txt           |   93 -
 src/import-export/qif-imp/Makefile.am              |  145 -
 src/import-export/qif-imp/test/Makefile.am         |   18 -
 src/import-export/qif/CMakeLists.txt               |   39 -
 src/import-export/qif/Makefile.am                  |   41 -
 src/import-export/qif/test/CMakeLists.txt          |   18 -
 src/import-export/qif/test/Makefile.am             |   51 -
 src/import-export/test/CMakeLists.txt              |   26 -
 src/import-export/test/Makefile.am                 |   82 -
 src/libqof/CMakeLists.txt                          |    6 -
 src/libqof/Makefile.am                             |    3 -
 src/libqof/qof/CMakeLists.txt                      |  129 -
 src/libqof/qof/Makefile.am                         |  107 -
 src/libqof/qof/gnc-aqbanking-templates.cpp         |  302 -
 src/libqof/qof/gnc-date.cpp                        | 1493 -----
 src/libqof/qof/gnc-date.h                          |  659 --
 src/libqof/qof/kvp-value.cpp                       |  400 --
 src/libqof/qof/kvp_frame.cpp                       |  482 --
 src/libqof/qof/qof-backend.cpp                     |  171 -
 src/libqof/qof/qofbook.cpp                         | 1234 ----
 src/libqof/qof/qofinstance.cpp                     | 1311 ----
 src/libqof/qof/test/CMakeLists.txt                 |  145 -
 src/libqof/qof/test/Makefile.am                    |  252 -
 src/libqof/qof/test/test-gnc-date.c                | 2281 -------
 src/libqof/qof/test/test-kvp-frame.cpp             |  204 -
 src/libqof/qof/test/test-kvp-value.cpp             |  100 -
 src/libqof/qof/test/test-qofinstance.cpp           | 1053 ----
 src/libqof/qof/test/test-qofsession.cpp            |  224 -
 src/optional/CMakeLists.txt                        |    5 -
 src/optional/Makefile.am                           |    9 -
 src/optional/gtkmm/CMakeLists.txt                  |   64 -
 src/optional/gtkmm/Makefile.am                     |   64 -
 src/optional/gtkmm/gnc-plugin-gtkmm-ui.xml         |   11 -
 src/optional/gtkmm/gnc-plugin-gtkmm.cpp            |  187 -
 src/optional/gtkmm/gnc-plugin-gtkmm.hpp            |   90 -
 src/optional/gtkmm/gncmm/Account.cpp               |  136 -
 src/optional/gtkmm/gncmm/Account.hpp               |  194 -
 src/optional/gtkmm/gncmm/Book.cpp                  |  145 -
 src/optional/gtkmm/gncmm/Book.hpp                  |  130 -
 src/optional/gtkmm/gncmm/Commodity.cpp             |  118 -
 src/optional/gtkmm/gncmm/Commodity.hpp             |  159 -
 src/optional/gtkmm/gncmm/GncInstance.cpp           |  142 -
 src/optional/gtkmm/gncmm/GncInstance.hpp           |  128 -
 src/optional/gtkmm/gncmm/Numeric.cpp               |   74 -
 src/optional/gtkmm/gncmm/Numeric.hpp               |  340 --
 src/optional/gtkmm/gncmm/Split.cpp                 |  205 -
 src/optional/gtkmm/gncmm/Split.hpp                 |  322 -
 src/optional/gtkmm/gncmm/Transaction.cpp           |  225 -
 src/optional/gtkmm/gncmm/Transaction.hpp           |  336 -
 src/optional/gtkmm/gncmm/private/Account_p.hpp     |   48 -
 src/optional/gtkmm/gncmm/private/Book_p.hpp        |   48 -
 src/optional/gtkmm/gncmm/private/Commodity_p.hpp   |   48 -
 src/optional/gtkmm/gncmm/private/GncInstance_p.hpp |   48 -
 src/optional/gtkmm/gncmm/private/Split_p.hpp       |   48 -
 src/optional/gtkmm/gncmm/private/Transaction_p.hpp |   48 -
 src/optional/gtkmm/gncmm/wrap_init.cpp             |   85 -
 src/optional/gtkmm/gncmm/wrap_init.hpp             |   32 -
 src/optional/gtkmm/gncmod-gtkmm.cpp                |  102 -
 src/optional/gtkmm/test/CMakeLists.txt             |    2 -
 src/optional/gtkmm/test/Makefile.am                |   50 -
 src/optional/gtkmm/test/test-book.cpp              |  176 -
 src/optional/gtkmm/test/test-gtkmm.cpp             |   64 -
 src/optional/python-bindings/CMakeLists.txt        |  119 -
 src/optional/python-bindings/Makefile.am           |  140 -
 src/optional/python-bindings/gnucash_core.i        |  229 -
 src/optional/python-bindings/tests/Makefile.am     |   54 -
 src/plugins/CMakeLists.txt                         |    7 -
 src/plugins/Makefile.am                            |   13 -
 src/plugins/bi_import/CMakeLists.txt               |   45 -
 src/plugins/bi_import/Makefile.am                  |   56 -
 src/plugins/bi_import/dialog-bi-import.c           |  906 ---
 src/plugins/bi_import/gnc-plugin-bi-import.h       |   80 -
 src/plugins/bi_import/gncmod-bi-import.c           |  101 -
 src/plugins/customer_import/CMakeLists.txt         |   35 -
 src/plugins/customer_import/Makefile.am            |   54 -
 .../customer_import/dialog-customer-import-gui.c   |  464 --
 .../customer_import/dialog-customer-import.h       |   78 -
 .../customer_import/gnc-plugin-customer_import.c   |  115 -
 .../customer_import/gnc-plugin-customer_import.h   |   80 -
 .../customer_import/libgncmod-customer_import.c    |  104 -
 src/plugins/customer_import/ui/CMakeLists.txt      |   11 -
 src/plugins/customer_import/ui/Makefile.am         |    5 -
 .../ui/gnc-plugin-customer_import-ui.xml           |   11 -
 src/plugins/example/Makefile.am                    |   39 -
 src/python/Makefile.am                             |   62 -
 src/register/Makefile.am                           |    3 -
 src/register/ledger-core/CMakeLists.txt            |   47 -
 src/register/ledger-core/Makefile.am               |   61 -
 src/register/ledger-core/split-register-control.c  | 1859 ------
 .../ledger-core/split-register-model-save.c        |  903 ---
 src/register/ledger-core/split-register-model.c    | 2736 ---------
 src/register/ledger-core/split-register.c          | 2992 ---------
 src/register/ledger-core/test/Makefile.am          |   15 -
 src/register/register-core/CMakeLists.txt          |   63 -
 src/register/register-core/Makefile.am             |   72 -
 src/register/register-core/test/Makefile.am        |   25 -
 src/register/register-gnome/CMakeLists.txt         |   64 -
 src/register/register-gnome/Makefile.am            |   71 -
 src/register/register-gnome/test/Makefile.am       |   25 -
 src/report/business-reports/CMakeLists.txt         |   48 -
 src/report/business-reports/Makefile.am            |  103 -
 src/report/business-reports/business-reports.scm   |  141 -
 src/report/locale-specific/us/CMakeLists.txt       |   59 -
 src/report/locale-specific/us/Makefile.am          |  114 -
 src/report/locale-specific/us/test/Makefile.am     |   30 -
 src/report/report-gnome/CMakeLists.txt             |   81 -
 src/report/report-gnome/Makefile.am                |  146 -
 .../report-gnome/dialog-report-column-view.c       |  627 --
 .../report-gnome/dialog-report-style-sheet.c       |  460 --
 src/report/report-gnome/gnc-plugin-page-report.c   | 1952 ------
 src/report/report-gnome/gncmod-report-gnome.c      |  105 -
 src/report/report-gnome/report-gnome.scm           |  150 -
 src/report/report-gnome/test/CMakeLists.txt        |   19 -
 src/report/report-gnome/test/Makefile.am           |   65 -
 src/report/report-gnome/window-report.c            |  377 --
 src/report/report-gnome/window-report.h            |   46 -
 src/report/report-system/CMakeLists.txt            |  118 -
 src/report/report-system/Makefile.am               |  172 -
 src/report/report-system/test/CMakeLists.txt       |   32 -
 src/report/report-system/test/Makefile.am          |  102 -
 src/report/standard-reports/CMakeLists.txt         |   89 -
 src/report/standard-reports/Makefile.am            |  136 -
 src/report/standard-reports/advanced-portfolio.scm | 1203 ----
 src/report/standard-reports/budget-barchart.scm    |  379 --
 .../standard-reports/gncmod-standard-reports.c     |   80 -
 src/report/standard-reports/net-barchart.scm       |  480 --
 src/report/standard-reports/net-linechart.scm      |  535 --
 src/report/standard-reports/portfolio.scm          |  303 -
 src/report/standard-reports/test/CMakeLists.txt    |   26 -
 src/report/standard-reports/test/Makefile.am       |   93 -
 .../standard-reports/test/test-load-module.in      |   20 -
 src/report/stylesheets/CMakeLists.txt              |   85 -
 src/report/stylesheets/Makefile.am                 |  117 -
 src/report/stylesheets/test/Makefile.am            |   39 -
 src/report/utility-reports/CMakeLists.txt          |   57 -
 src/report/utility-reports/Makefile.am             |   97 -
 .../utility-reports/gncmod-utility-reports.c       |   81 -
 src/report/utility-reports/hello-world.scm         |  522 --
 src/report/utility-reports/test/CMakeLists.txt     |    6 -
 src/report/utility-reports/test/Makefile.am        |   35 -
 .../utility-reports/test/test-load-module.in       |   20 -
 src/scm/CMakeLists.txt                             |   70 -
 src/scm/Makefile.am                                |   89 -
 src/tax/us/CMakeLists.txt                          |   51 -
 src/tax/us/Makefile.am                             |   86 -
 src/tax/us/test/Makefile.am                        |   19 -
 src/test-core/CMakeLists.txt                       |   81 -
 src/test-core/Makefile.am                          |  144 -
 2819 files changed, 123543 insertions(+), 136241 deletions(-)
 delete mode 100644 art/tango/gnc-invoice-pay.svg
 create mode 100644 bindings/CMakeLists.txt
 create mode 100644 bindings/Makefile.am
 create mode 100644 bindings/python/CMakeLists.txt
 create mode 100644 bindings/python/Makefile.am
 rename {src/optional/python-bindings => bindings/python}/__init__.py (100%)
 rename {src/optional/python-bindings => bindings/python}/example_scripts/CMakeLists.txt (100%)
 rename {src/optional/python-bindings => bindings/python}/example_scripts/Invoice.tex (100%)
 rename {src/optional/python-bindings => bindings/python}/example_scripts/Invoice.tex.tmpl (100%)
 rename {src/optional/python-bindings => bindings/python}/example_scripts/Invoice_2.tex.tmpl (100%)
 rename {src/optional/python-bindings => bindings/python}/example_scripts/account_analysis.py (100%)
 rename {src/optional/python-bindings => bindings/python}/example_scripts/change_tax_code.py (100%)
 rename {src/optional/python-bindings => bindings/python}/example_scripts/get_quotes.pl (100%)
 rename {src/optional/python-bindings => bindings/python}/example_scripts/gnc_convenience.py (100%)
 rename {src/optional/python-bindings => bindings/python}/example_scripts/gncinvoice_jinja.py (100%)
 rename {src/optional/python-bindings => bindings/python}/example_scripts/gncinvoicefkt.py (100%)
 rename {src/optional/python-bindings => bindings/python}/example_scripts/invoice_export_doxygen.txt (100%)
 rename {src/optional/python-bindings => bindings/python}/example_scripts/latex_invoices.py (100%)
 rename {src/optional/python-bindings => bindings/python}/example_scripts/new_book_with_opening_balances.py (100%)
 rename {src/optional/python-bindings => bindings/python}/example_scripts/priceDB_test.py (100%)
 rename {src/optional/python-bindings => bindings/python}/example_scripts/price_database_example.py (100%)
 rename {src/optional/python-bindings => bindings/python}/example_scripts/quotes_historic.py (100%)
 rename {src/optional/python-bindings => bindings/python}/example_scripts/rest-api/README (100%)
 rename {src/optional/python-bindings => bindings/python}/example_scripts/rest-api/gnucash_rest.py (100%)
 rename {src/optional/python-bindings => bindings/python}/example_scripts/rest-api/gnucash_simple.py (100%)
 rename {src/optional/python-bindings => bindings/python}/example_scripts/simple_book.py (100%)
 rename {src/optional/python-bindings => bindings/python}/example_scripts/simple_business_create.py (100%)
 rename {src/optional/python-bindings => bindings/python}/example_scripts/simple_invoice_insert.py (100%)
 rename {src/optional/python-bindings => bindings/python}/example_scripts/simple_session.py (100%)
 rename {src/optional/python-bindings => bindings/python}/example_scripts/simple_sqlite_create.py (100%)
 rename {src/optional/python-bindings => bindings/python}/example_scripts/simple_test.py (100%)
 rename {src/optional/python-bindings => bindings/python}/example_scripts/str_methods.py (100%)
 rename {src/optional/python-bindings => bindings/python}/example_scripts/test_imbalance_transaction.py (100%)
 rename {src/optional/python-bindings => bindings/python}/function_class.py (100%)
 rename {src/optional/python-bindings => bindings/python}/gnucash_business.py (100%)
 create mode 100644 bindings/python/gnucash_core.i
 rename {src/optional/python-bindings => bindings/python}/gnucash_core.py (100%)
 rename {src/optional/python-bindings => bindings/python}/sqlite3test.c (100%)
 rename {src/optional/python-bindings => bindings/python}/tests/CMakeLists.txt (100%)
 create mode 100644 bindings/python/tests/Makefile.am
 rename {src/optional/python-bindings => bindings/python}/tests/runTests.py.in (100%)
 rename {src/optional/python-bindings => bindings/python}/tests/test_account.py (100%)
 rename {src/optional/python-bindings => bindings/python}/tests/test_book.py (100%)
 rename {src/optional/python-bindings => bindings/python}/tests/test_business.py (100%)
 rename {src/optional/python-bindings => bindings/python}/tests/test_commodity.py (100%)
 rename {src/optional/python-bindings => bindings/python}/tests/test_split.py (100%)
 rename {src/optional/python-bindings => bindings/python}/tests/test_transaction.py (100%)
 rename {src/optional/python-bindings => bindings/python}/timespec.i (100%)
 create mode 100644 common/CMakeLists.txt
 create mode 100644 common/Makefile.am
 rename {src => common}/base-typemaps.i (100%)
 rename {src => common}/cmake_modules/CMakeLists.txt (100%)
 rename {src => common}/cmake_modules/COPYING-CMAKE-SCRIPTS.txt (100%)
 rename {src => common}/cmake_modules/GncAddGSchemaTargets.cmake (100%)
 create mode 100644 common/cmake_modules/GncAddSchemeTargets.cmake
 create mode 100644 common/cmake_modules/GncAddSwigCommand.cmake
 create mode 100644 common/cmake_modules/GncAddTest.cmake
 rename {src => common}/cmake_modules/GncConfigure.cmake (100%)
 rename {src => common}/cmake_modules/GncFindPkgConfig.cmake (100%)
 rename {src => common}/cmake_modules/MacroAddSourceFileCompileFlags.cmake (100%)
 rename {src => common}/cmake_modules/MacroAppendForeach.cmake (100%)
 create mode 100644 common/cmake_modules/MakeDist.cmake
 rename {src => common}/cmake_modules/MakeDistCheck.cmake (100%)
 create mode 100644 common/cmake_modules/MakeDistFiles.cmake
 rename {src => common}/config.h.cmake.in (100%)
 rename {src => common}/debug/CMakeLists.txt (100%)
 rename {src => common}/debug/Makefile.am (100%)
 rename {src => common}/debug/splint-defs.h (100%)
 rename {src => common}/debug/valgrind/CMakeLists.txt (100%)
 rename {src => common}/debug/valgrind/Makefile.am (100%)
 rename {src => common}/debug/valgrind/valgrind-gdk.supp (100%)
 rename {src => common}/debug/valgrind/valgrind-glib.supp (100%)
 rename {src => common}/debug/valgrind/valgrind-gnucash.supp (100%)
 rename {src => common}/debug/valgrind/valgrind-libfontconfig.supp (100%)
 rename {src => common}/debug/valgrind/valgrind-libgda.supp (100%)
 rename {src => common}/debug/valgrind/valgrind-libguile.supp (100%)
 rename {src => common}/debug/valgrind/valgrind-x11.supp (100%)
 rename {src => common}/gnc-test-env.pl (100%)
 rename {src => common}/guile-mappings.h (100%)
 rename {src => common}/platform.h (100%)
 rename {src => common}/swig-utf8.patch (100%)
 create mode 100644 common/test-core/CMakeLists.txt
 create mode 100644 common/test-core/Makefile.am
 rename {src => common}/test-core/test-stuff.c (100%)
 rename {src => common}/test-core/test-stuff.h (100%)
 rename {src => common}/test-core/unittest-support.c (100%)
 rename {src => common}/test-core/unittest-support.h (100%)
 rename {src => common}/test-core/unittest-support.i (100%)
 rename {src => common}/test-core/unittest-support.scm (100%)
 create mode 100644 common/test-core/unittest_support.py
 rename {art => contrib/art}/banner.svgz (100%)
 rename {art => contrib/art}/icon.svgz (100%)
 rename {art => contrib/art}/logo.svgz (100%)
 rename {art => contrib/art}/splash.svgz (100%)
 rename {art => contrib/art}/stock_split_title.png (100%)
 rename {art => contrib/art}/stock_split_watermark.png (100%)
 rename {art => contrib/art}/tango/README (100%)
 create mode 100644 contrib/art/tango/gnc-invoice-pay.svg
 rename {art => contrib/art}/tango/gnucash-16x16.svg (100%)
 rename {art => contrib/art}/tango/gnucash-22x22.svg (100%)
 rename {art => contrib/art}/tango/gnucash-32x32.svg (100%)
 rename {art => contrib/art}/tango/gnucash-48x48+.svg (100%)
 create mode 100644 data/CMakeLists.txt
 create mode 100644 data/Makefile.am
 rename {accounts => data/accounts}/C/CMakeLists.txt (100%)
 rename {accounts => data/accounts}/C/Makefile.am (100%)
 rename {accounts => data/accounts}/C/acctchrt_brokerage.gnucash-xea (100%)
 rename {accounts => data/accounts}/C/acctchrt_business.gnucash-xea (100%)
 rename {accounts => data/accounts}/C/acctchrt_carloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/C/acctchrt_cdmoneymkt.gnucash-xea (100%)
 rename {accounts => data/accounts}/C/acctchrt_checkbook.gnucash-xea (100%)
 rename {accounts => data/accounts}/C/acctchrt_childcare.gnucash-xea (100%)
 rename {accounts => data/accounts}/C/acctchrt_common.gnucash-xea (100%)
 rename {accounts => data/accounts}/C/acctchrt_eduloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/C/acctchrt_fixedassets.gnucash-xea (100%)
 rename {accounts => data/accounts}/C/acctchrt_full.gnucash-xea (100%)
 rename {accounts => data/accounts}/C/acctchrt_homeloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/C/acctchrt_homeown.gnucash-xea (100%)
 rename {accounts => data/accounts}/C/acctchrt_otherloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/C/acctchrt_renter.gnucash-xea (100%)
 rename {accounts => data/accounts}/C/acctchrt_retiremt.gnucash-xea (100%)
 rename {accounts => data/accounts}/C/acctchrt_spouseinc.gnucash-xea (100%)
 rename {accounts => data/accounts}/C/acctchrt_spouseretire.gnucash-xea (100%)
 rename {accounts => data/accounts}/CMakeLists.txt (100%)
 rename {accounts => data/accounts}/Makefile.am (100%)
 rename {accounts => data/accounts}/cs/CMakeLists.txt (100%)
 rename {accounts => data/accounts}/cs/Makefile.am (100%)
 rename {accounts => data/accounts}/cs/acctchrt_brokerage.gnucash-xea (100%)
 rename {accounts => data/accounts}/cs/acctchrt_carloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/cs/acctchrt_cdmoneymkt.gnucash-xea (100%)
 rename {accounts => data/accounts}/cs/acctchrt_childcare.gnucash-xea (100%)
 rename {accounts => data/accounts}/cs/acctchrt_common.gnucash-xea (100%)
 rename {accounts => data/accounts}/cs/acctchrt_currency.gnucash-xea (100%)
 rename {accounts => data/accounts}/cs/acctchrt_eduloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/cs/acctchrt_fixedassets.gnucash-xea (100%)
 rename {accounts => data/accounts}/cs/acctchrt_homeloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/cs/acctchrt_homeown.gnucash-xea (100%)
 rename {accounts => data/accounts}/cs/acctchrt_otherloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/cs/acctchrt_renter.gnucash-xea (100%)
 rename {accounts => data/accounts}/cs/acctchrt_retiremt.gnucash-xea (100%)
 rename {accounts => data/accounts}/cs/acctchrt_spouseinc.gnucash-xea (100%)
 rename {accounts => data/accounts}/cs/acctchrt_spouseretire.gnucash-xea (100%)
 rename {accounts => data/accounts}/da/CMakeLists.txt (100%)
 rename {accounts => data/accounts}/da/Makefile.am (100%)
 rename {accounts => data/accounts}/da/acctchrt_car.gnucash-xea (100%)
 rename {accounts => data/accounts}/da/acctchrt_common.gnucash-xea (100%)
 rename {accounts => data/accounts}/da/acctchrt_homeloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/da/acctchrt_homeown.gnucash-xea (100%)
 rename {accounts => data/accounts}/de_AT/CMakeLists.txt (100%)
 rename {accounts => data/accounts}/de_AT/Makefile.am (100%)
 rename {accounts => data/accounts}/de_AT/acctchrt_auto.gnucash-xea (100%)
 rename {accounts => data/accounts}/de_AT/acctchrt_autoloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/de_AT/acctchrt_brokerage.gnucash-xea (100%)
 rename {accounts => data/accounts}/de_AT/acctchrt_business.gnucash-xea (100%)
 rename {accounts => data/accounts}/de_AT/acctchrt_common.gnucash-xea (100%)
 rename {accounts => data/accounts}/de_AT/acctchrt_houseown.gnucash-xea (100%)
 rename {accounts => data/accounts}/de_AT/acctchrt_investment.gnucash-xea (100%)
 rename {accounts => data/accounts}/de_AT/acctchrt_kids.gnucash-xea (100%)
 rename {accounts => data/accounts}/de_CH/CMakeLists.txt (100%)
 rename {accounts => data/accounts}/de_CH/Makefile.am (100%)
 rename {accounts => data/accounts}/de_CH/acctchrt_brokerage.gnucash-xea (100%)
 rename {accounts => data/accounts}/de_CH/acctchrt_chkmu.gnucash-xea (100%)
 rename {accounts => data/accounts}/de_CH/acctchrt_common.gnucash-xea (100%)
 rename {accounts => data/accounts}/de_CH/acctchrt_kids.gnucash-xea (100%)
 rename {accounts => data/accounts}/de_CH/acctchrt_otherasset.gnucash-xea (100%)
 rename {accounts => data/accounts}/de_CH/acctchrt_otherloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/de_DE/CMakeLists.txt (100%)
 rename {accounts => data/accounts}/de_DE/Makefile.am (100%)
 rename {accounts => data/accounts}/de_DE/acctchrt_auto.gnucash-xea (100%)
 rename {accounts => data/accounts}/de_DE/acctchrt_autoloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/de_DE/acctchrt_brokerage.gnucash-xea (100%)
 rename {accounts => data/accounts}/de_DE/acctchrt_common.gnucash-xea (100%)
 rename {accounts => data/accounts}/de_DE/acctchrt_full.gnucash-xea (100%)
 rename {accounts => data/accounts}/de_DE/acctchrt_houseown.gnucash-xea (100%)
 rename {accounts => data/accounts}/de_DE/acctchrt_investment.gnucash-xea (100%)
 rename {accounts => data/accounts}/de_DE/acctchrt_kids.gnucash-xea (100%)
 rename {accounts => data/accounts}/de_DE/acctchrt_otherasset.gnucash-xea (100%)
 rename {accounts => data/accounts}/de_DE/acctchrt_otherloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/de_DE/acctchrt_skr03.gnucash-xea (100%)
 rename {accounts => data/accounts}/de_DE/acctchrt_skr04.gnucash-xea (100%)
 rename {accounts => data/accounts}/de_DE/acctchrt_skr49.gnucash-xea (100%)
 rename {accounts => data/accounts}/de_DE/acctchrt_studium.gnucash-xea (100%)
 rename {accounts => data/accounts}/de_DE/acctchrt_wohnungsw.gnucash-xea (100%)
 rename {accounts => data/accounts}/el_GR/CMakeLists.txt (100%)
 rename {accounts => data/accounts}/el_GR/Makefile.am (100%)
 rename {accounts => data/accounts}/el_GR/acctchrt_brokerage.gnucash-xea (100%)
 rename {accounts => data/accounts}/el_GR/acctchrt_carloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/el_GR/acctchrt_common.gnucash-xea (100%)
 rename {accounts => data/accounts}/en_GB/CMakeLists.txt (100%)
 rename {accounts => data/accounts}/en_GB/Makefile.am (100%)
 rename {accounts => data/accounts}/en_GB/acctchrt_brokerage.gnucash-xea (100%)
 rename {accounts => data/accounts}/en_GB/acctchrt_business.gnucash-xea (100%)
 rename {accounts => data/accounts}/en_GB/acctchrt_carloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/en_GB/acctchrt_cdmoneymkt.gnucash-xea (100%)
 rename {accounts => data/accounts}/en_GB/acctchrt_checkbook.gnucash-xea (100%)
 rename {accounts => data/accounts}/en_GB/acctchrt_childcare.gnucash-xea (100%)
 rename {accounts => data/accounts}/en_GB/acctchrt_common.gnucash-xea (100%)
 rename {accounts => data/accounts}/en_GB/acctchrt_eduloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/en_GB/acctchrt_fixedassets.gnucash-xea (100%)
 rename {accounts => data/accounts}/en_GB/acctchrt_full.gnucash-xea (100%)
 rename {accounts => data/accounts}/en_GB/acctchrt_homeloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/en_GB/acctchrt_homeown.gnucash-xea (100%)
 rename {accounts => data/accounts}/en_GB/acctchrt_otherloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/en_GB/acctchrt_renter.gnucash-xea (100%)
 rename {accounts => data/accounts}/en_GB/acctchrt_retiremt.gnucash-xea (100%)
 rename {accounts => data/accounts}/en_GB/acctchrt_spouseinc.gnucash-xea (100%)
 rename {accounts => data/accounts}/en_GB/acctchrt_spouseretire.gnucash-xea (100%)
 rename {accounts => data/accounts}/en_GB/uk-vat.gnucash-xea (100%)
 rename {accounts => data/accounts}/es_ES/CMakeLists.txt (100%)
 rename {accounts => data/accounts}/es_ES/Makefile.am (100%)
 rename {accounts => data/accounts}/es_ES/acctchrt_brokerage.gnucash-xea (100%)
 rename {accounts => data/accounts}/es_ES/acctchrt_carloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/es_ES/acctchrt_cdmoneymkt.gnucash-xea (100%)
 rename {accounts => data/accounts}/es_ES/acctchrt_childcare.gnucash-xea (100%)
 rename {accounts => data/accounts}/es_ES/acctchrt_common.gnucash-xea (100%)
 rename {accounts => data/accounts}/es_ES/acctchrt_currency.gnucash-xea (100%)
 rename {accounts => data/accounts}/es_ES/acctchrt_eduloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/es_ES/acctchrt_fixedassets.gnucash-xea (100%)
 rename {accounts => data/accounts}/es_ES/acctchrt_homeloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/es_ES/acctchrt_homeown.gnucash-xea (100%)
 rename {accounts => data/accounts}/es_ES/acctchrt_otherloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/es_ES/acctchrt_renter.gnucash-xea (100%)
 rename {accounts => data/accounts}/es_ES/acctchrt_retiremt.gnucash-xea (100%)
 rename {accounts => data/accounts}/es_ES/acctchrt_spouseinc.gnucash-xea (100%)
 rename {accounts => data/accounts}/es_ES/acctchrt_spouseretire.gnucash-xea (100%)
 rename {accounts => data/accounts}/es_MX/CMakeLists.txt (100%)
 rename {accounts => data/accounts}/es_MX/Makefile.am (100%)
 rename {accounts => data/accounts}/es_MX/acctchrt_brokerage.gnucash-xea (100%)
 rename {accounts => data/accounts}/es_MX/acctchrt_carloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/es_MX/acctchrt_cdmoneymkt.gnucash-xea (100%)
 rename {accounts => data/accounts}/es_MX/acctchrt_childcare.gnucash-xea (100%)
 rename {accounts => data/accounts}/es_MX/acctchrt_common.gnucash-xea (100%)
 rename {accounts => data/accounts}/es_MX/acctchrt_currency.gnucash-xea (100%)
 rename {accounts => data/accounts}/es_MX/acctchrt_eduloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/es_MX/acctchrt_fixedassets.gnucash-xea (100%)
 rename {accounts => data/accounts}/es_MX/acctchrt_homeloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/es_MX/acctchrt_homeown.gnucash-xea (100%)
 rename {accounts => data/accounts}/es_MX/acctchrt_otherloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/es_MX/acctchrt_renter.gnucash-xea (100%)
 rename {accounts => data/accounts}/es_MX/acctchrt_retiremt.gnucash-xea (100%)
 rename {accounts => data/accounts}/es_MX/acctchrt_spouseinc.gnucash-xea (100%)
 rename {accounts => data/accounts}/es_MX/acctchrt_spouseretire.gnucash-xea (100%)
 rename {accounts => data/accounts}/fi_FI/CMakeLists.txt (100%)
 rename {accounts => data/accounts}/fi_FI/Makefile.am (100%)
 rename {accounts => data/accounts}/fi_FI/acctchrt_common.gnucash-xea (100%)
 rename {accounts => data/accounts}/fi_FI/acctchrt_ry.gnucash-xea (100%)
 rename {accounts => data/accounts}/fi_FI/acctchrt_sbr-xbrl.gnucash-xea (100%)
 rename {accounts => data/accounts}/fr_CA/CMakeLists.txt (100%)
 rename {accounts => data/accounts}/fr_CA/Makefile.am (100%)
 rename {accounts => data/accounts}/fr_CA/acctchrt_actifsfixes.gnucash-xea (100%)
 rename {accounts => data/accounts}/fr_CA/acctchrt_automobile.gnucash-xea (100%)
 rename {accounts => data/accounts}/fr_CA/acctchrt_basecommune.gnucash-xea (100%)
 rename {accounts => data/accounts}/fr_CA/acctchrt_cdmarchemon.gnucash-xea (100%)
 rename {accounts => data/accounts}/fr_CA/acctchrt_chequier.gnucash-xea (100%)
 rename {accounts => data/accounts}/fr_CA/acctchrt_conjointretraite.gnucash-xea (100%)
 rename {accounts => data/accounts}/fr_CA/acctchrt_conjointrev.gnucash-xea (100%)
 rename {accounts => data/accounts}/fr_CA/acctchrt_courtage.gnucash-xea (100%)
 rename {accounts => data/accounts}/fr_CA/acctchrt_etudeemprunt.gnucash-xea (100%)
 rename {accounts => data/accounts}/fr_CA/acctchrt_garderie.gnucash-xea (100%)
 rename {accounts => data/accounts}/fr_CA/acctchrt_locataire.gnucash-xea (100%)
 rename {accounts => data/accounts}/fr_CA/acctchrt_proprietaire.gnucash-xea (100%)
 rename {accounts => data/accounts}/fr_CA/acctchrt_retraite.gnucash-xea (100%)
 rename {accounts => data/accounts}/fr_CA/acctchrt_revenus.gnucash-xea (100%)
 rename {accounts => data/accounts}/fr_CH/CMakeLists.txt (100%)
 rename {accounts => data/accounts}/fr_CH/Makefile.am (100%)
 rename {accounts => data/accounts}/fr_CH/acctchrt_brokerage.gnucash-xea (100%)
 rename {accounts => data/accounts}/fr_CH/acctchrt_business.gnucash-xea (100%)
 rename {accounts => data/accounts}/fr_CH/acctchrt_carloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/fr_CH/acctchrt_cdmoneymkt.gnucash-xea (100%)
 rename {accounts => data/accounts}/fr_CH/acctchrt_childcare.gnucash-xea (100%)
 rename {accounts => data/accounts}/fr_CH/acctchrt_common.gnucash-xea (100%)
 rename {accounts => data/accounts}/fr_CH/acctchrt_currency.gnucash-xea (100%)
 rename {accounts => data/accounts}/fr_CH/acctchrt_eduloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/fr_CH/acctchrt_fixedassets.gnucash-xea (100%)
 rename {accounts => data/accounts}/fr_CH/acctchrt_homeloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/fr_CH/acctchrt_homeown.gnucash-xea (100%)
 rename {accounts => data/accounts}/fr_CH/acctchrt_otherloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/fr_CH/acctchrt_renter.gnucash-xea (100%)
 rename {accounts => data/accounts}/fr_CH/acctchrt_retiremt.gnucash-xea (100%)
 rename {accounts => data/accounts}/fr_CH/acctchrt_spouseinc.gnucash-xea (100%)
 rename {accounts => data/accounts}/fr_CH/acctchrt_spouseretire.gnucash-xea (100%)
 rename {accounts => data/accounts}/fr_FR/CMakeLists.txt (100%)
 rename {accounts => data/accounts}/fr_FR/Makefile.am (100%)
 rename {accounts => data/accounts}/fr_FR/acctchrt_brokerage.gnucash-xea (100%)
 rename {accounts => data/accounts}/fr_FR/acctchrt_business.gnucash-xea (100%)
 rename {accounts => data/accounts}/fr_FR/acctchrt_carloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/fr_FR/acctchrt_cdmoneymkt.gnucash-xea (100%)
 rename {accounts => data/accounts}/fr_FR/acctchrt_childcare.gnucash-xea (100%)
 rename {accounts => data/accounts}/fr_FR/acctchrt_common.gnucash-xea (100%)
 rename {accounts => data/accounts}/fr_FR/acctchrt_currency.gnucash-xea (100%)
 rename {accounts => data/accounts}/fr_FR/acctchrt_eduloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/fr_FR/acctchrt_fixedassets.gnucash-xea (100%)
 rename {accounts => data/accounts}/fr_FR/acctchrt_homeloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/fr_FR/acctchrt_homeown.gnucash-xea (100%)
 rename {accounts => data/accounts}/fr_FR/acctchrt_otherloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/fr_FR/acctchrt_renter.gnucash-xea (100%)
 rename {accounts => data/accounts}/fr_FR/acctchrt_retiremt.gnucash-xea (100%)
 rename {accounts => data/accounts}/fr_FR/acctchrt_spouseinc.gnucash-xea (100%)
 rename {accounts => data/accounts}/fr_FR/acctchrt_spouseretire.gnucash-xea (100%)
 rename {accounts => data/accounts}/hu_HU/CMakeLists.txt (100%)
 rename {accounts => data/accounts}/hu_HU/Makefile.am (100%)
 rename {accounts => data/accounts}/hu_HU/acctchrt_brokerage.gnucash-xea (100%)
 rename {accounts => data/accounts}/hu_HU/acctchrt_business.gnucash-xea (100%)
 rename {accounts => data/accounts}/hu_HU/acctchrt_carloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/hu_HU/acctchrt_cdmoneymkt.gnucash-xea (100%)
 rename {accounts => data/accounts}/hu_HU/acctchrt_checkbook.gnucash-xea (100%)
 rename {accounts => data/accounts}/hu_HU/acctchrt_childcare.gnucash-xea (100%)
 rename {accounts => data/accounts}/hu_HU/acctchrt_common.gnucash-xea (100%)
 rename {accounts => data/accounts}/hu_HU/acctchrt_eduloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/hu_HU/acctchrt_fixedassets.gnucash-xea (100%)
 rename {accounts => data/accounts}/hu_HU/acctchrt_homeloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/hu_HU/acctchrt_homeown.gnucash-xea (100%)
 rename {accounts => data/accounts}/hu_HU/acctchrt_otherloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/hu_HU/acctchrt_renter.gnucash-xea (100%)
 rename {accounts => data/accounts}/hu_HU/acctchrt_retiremt.gnucash-xea (100%)
 rename {accounts => data/accounts}/hu_HU/acctchrt_spouseinc.gnucash-xea (100%)
 rename {accounts => data/accounts}/hu_HU/acctchrt_spouseretire.gnucash-xea (100%)
 rename {accounts => data/accounts}/it/CMakeLists.txt (100%)
 rename {accounts => data/accounts}/it/Makefile.am (100%)
 rename {accounts => data/accounts}/it/acctchrt_brokerage.gnucash-xea (100%)
 rename {accounts => data/accounts}/it/acctchrt_carloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/it/acctchrt_checkbook.gnucash-xea (100%)
 rename {accounts => data/accounts}/it/acctchrt_childcare.gnucash-xea (100%)
 rename {accounts => data/accounts}/it/acctchrt_common.gnucash-xea (100%)
 rename {accounts => data/accounts}/it/acctchrt_fixedassets.gnucash-xea (100%)
 rename {accounts => data/accounts}/it/acctchrt_homeloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/it/acctchrt_homeown.gnucash-xea (100%)
 rename {accounts => data/accounts}/it/acctchrt_otherloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/it/acctchrt_renter.gnucash-xea (100%)
 rename {accounts => data/accounts}/it/acctchrt_retiremt.gnucash-xea (100%)
 rename {accounts => data/accounts}/it/acctchrt_spouseinc.gnucash-xea (100%)
 rename {accounts => data/accounts}/it/acctchrt_spouseretire.gnucash-xea (100%)
 rename {accounts => data/accounts}/ja/CMakeLists.txt (100%)
 rename {accounts => data/accounts}/ja/Makefile.am (100%)
 rename {accounts => data/accounts}/ja/acctchrt_brokerage.gnucash-xea (100%)
 rename {accounts => data/accounts}/ja/acctchrt_business.gnucash-xea (100%)
 rename {accounts => data/accounts}/ja/acctchrt_carloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/ja/acctchrt_cdmoneymkt.gnucash-xea (100%)
 rename {accounts => data/accounts}/ja/acctchrt_checkbook.gnucash-xea (100%)
 rename {accounts => data/accounts}/ja/acctchrt_childcare.gnucash-xea (100%)
 rename {accounts => data/accounts}/ja/acctchrt_common.gnucash-xea (100%)
 rename {accounts => data/accounts}/ja/acctchrt_eduloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/ja/acctchrt_fixedassets.gnucash-xea (100%)
 rename {accounts => data/accounts}/ja/acctchrt_full.gnucash-xea (100%)
 rename {accounts => data/accounts}/ja/acctchrt_homeloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/ja/acctchrt_homeown.gnucash-xea (100%)
 rename {accounts => data/accounts}/ja/acctchrt_otherloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/ja/acctchrt_renter.gnucash-xea (100%)
 rename {accounts => data/accounts}/ja/acctchrt_retiremt.gnucash-xea (100%)
 rename {accounts => data/accounts}/ja/acctchrt_spouseinc.gnucash-xea (100%)
 rename {accounts => data/accounts}/ja/acctchrt_spouseretire.gnucash-xea (100%)
 rename {accounts => data/accounts}/ko/CMakeLists.txt (100%)
 rename {accounts => data/accounts}/ko/Makefile.am (100%)
 rename {accounts => data/accounts}/ko/acctchrt_brokerage.gnucash-xea (100%)
 rename {accounts => data/accounts}/ko/acctchrt_business.gnucash-xea (100%)
 rename {accounts => data/accounts}/ko/acctchrt_carloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/ko/acctchrt_cdmoneymkt.gnucash-xea (100%)
 rename {accounts => data/accounts}/ko/acctchrt_checkbook.gnucash-xea (100%)
 rename {accounts => data/accounts}/ko/acctchrt_childcare.gnucash-xea (100%)
 rename {accounts => data/accounts}/ko/acctchrt_common.gnucash-xea (100%)
 rename {accounts => data/accounts}/ko/acctchrt_eduloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/ko/acctchrt_fixedassets.gnucash-xea (100%)
 rename {accounts => data/accounts}/ko/acctchrt_homeloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/ko/acctchrt_homeown.gnucash-xea (100%)
 rename {accounts => data/accounts}/ko/acctchrt_otherloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/ko/acctchrt_renter.gnucash-xea (100%)
 rename {accounts => data/accounts}/ko/acctchrt_retiremt.gnucash-xea (100%)
 rename {accounts => data/accounts}/ko/acctchrt_spouseinc.gnucash-xea (100%)
 rename {accounts => data/accounts}/ko/acctchrt_spouseretire.gnucash-xea (100%)
 rename {accounts => data/accounts}/lt/CMakeLists.txt (100%)
 rename {accounts => data/accounts}/lt/Makefile.am (100%)
 rename {accounts => data/accounts}/lt/acctchrt_business.gnucash-xea (100%)
 rename {accounts => data/accounts}/lv/CMakeLists.txt (100%)
 rename {accounts => data/accounts}/lv/Makefile.am (100%)
 rename {accounts => data/accounts}/lv/acctchrt_brokerage.gnucash-xea (100%)
 rename {accounts => data/accounts}/lv/acctchrt_business.gnucash-xea (100%)
 rename {accounts => data/accounts}/lv/acctchrt_carloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/lv/acctchrt_cdmoneymkt.gnucash-xea (100%)
 rename {accounts => data/accounts}/lv/acctchrt_checkbook.gnucash-xea (100%)
 rename {accounts => data/accounts}/lv/acctchrt_childcare.gnucash-xea (100%)
 rename {accounts => data/accounts}/lv/acctchrt_common.gnucash-xea (100%)
 rename {accounts => data/accounts}/lv/acctchrt_eduloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/lv/acctchrt_fixedassets.gnucash-xea (100%)
 rename {accounts => data/accounts}/lv/acctchrt_full.gnucash-xea (100%)
 rename {accounts => data/accounts}/lv/acctchrt_homeloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/lv/acctchrt_homeown.gnucash-xea (100%)
 rename {accounts => data/accounts}/lv/acctchrt_otherloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/lv/acctchrt_renter.gnucash-xea (100%)
 rename {accounts => data/accounts}/lv/acctchrt_retiremt.gnucash-xea (100%)
 rename {accounts => data/accounts}/lv/acctchrt_spouseinc.gnucash-xea (100%)
 rename {accounts => data/accounts}/lv/acctchrt_spouseretire.gnucash-xea (100%)
 rename {accounts => data/accounts}/nb/CMakeLists.txt (100%)
 rename {accounts => data/accounts}/nb/Makefile.am (100%)
 rename {accounts => data/accounts}/nb/acctchrt_brokerage.gnucash-xea (100%)
 rename {accounts => data/accounts}/nb/acctchrt_business.gnucash-xea (100%)
 rename {accounts => data/accounts}/nb/acctchrt_carloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/nb/acctchrt_cdmoneymkt.gnucash-xea (100%)
 rename {accounts => data/accounts}/nb/acctchrt_checkbook.gnucash-xea (100%)
 rename {accounts => data/accounts}/nb/acctchrt_childcare.gnucash-xea (100%)
 rename {accounts => data/accounts}/nb/acctchrt_common.gnucash-xea (100%)
 rename {accounts => data/accounts}/nb/acctchrt_eduloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/nb/acctchrt_fixedassets.gnucash-xea (100%)
 rename {accounts => data/accounts}/nb/acctchrt_full.gnucash-xea (100%)
 rename {accounts => data/accounts}/nb/acctchrt_homeloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/nb/acctchrt_homeown.gnucash-xea (100%)
 rename {accounts => data/accounts}/nb/acctchrt_otherloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/nb/acctchrt_renter.gnucash-xea (100%)
 rename {accounts => data/accounts}/nb/acctchrt_retiremt.gnucash-xea (100%)
 rename {accounts => data/accounts}/nb/acctchrt_spouseinc.gnucash-xea (100%)
 rename {accounts => data/accounts}/nb/acctchrt_spouseretire.gnucash-xea (100%)
 rename {accounts => data/accounts}/nl/CMakeLists.txt (100%)
 rename {accounts => data/accounts}/nl/Makefile.am (100%)
 rename {accounts => data/accounts}/nl/acctchrt_checkbook.gnucash-xea (100%)
 rename {accounts => data/accounts}/nl/acctchrt_full.gnucash-xea (100%)
 rename {accounts => data/accounts}/nl/acctchrt_rgs_1.1.gnucash-xea (100%)
 rename {accounts => data/accounts}/pl/CMakeLists.txt (100%)
 rename {accounts => data/accounts}/pl/Makefile.am (100%)
 rename {accounts => data/accounts}/pl/acctchrt_brokerage.gnucash-xea (100%)
 rename {accounts => data/accounts}/pl/acctchrt_business.gnucash-xea (100%)
 rename {accounts => data/accounts}/pl/acctchrt_carloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/pl/acctchrt_cdmoneymkt.gnucash-xea (100%)
 rename {accounts => data/accounts}/pl/acctchrt_checkbook.gnucash-xea (100%)
 rename {accounts => data/accounts}/pl/acctchrt_childcare.gnucash-xea (100%)
 rename {accounts => data/accounts}/pl/acctchrt_common.gnucash-xea (100%)
 rename {accounts => data/accounts}/pl/acctchrt_eduloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/pl/acctchrt_fixedassets.gnucash-xea (100%)
 rename {accounts => data/accounts}/pl/acctchrt_full.gnucash-xea (100%)
 rename {accounts => data/accounts}/pl/acctchrt_homeloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/pl/acctchrt_homeown.gnucash-xea (100%)
 rename {accounts => data/accounts}/pl/acctchrt_otherloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/pl/acctchrt_renter.gnucash-xea (100%)
 rename {accounts => data/accounts}/pl/acctchrt_retiremt.gnucash-xea (100%)
 rename {accounts => data/accounts}/pl/acctchrt_spouseinc.gnucash-xea (100%)
 rename {accounts => data/accounts}/pl/acctchrt_spouseretire.gnucash-xea (100%)
 rename {accounts => data/accounts}/pt_BR/CMakeLists.txt (100%)
 rename {accounts => data/accounts}/pt_BR/Makefile.am (100%)
 rename {accounts => data/accounts}/pt_BR/acctchrt_brokerage.gnucash-xea (100%)
 rename {accounts => data/accounts}/pt_BR/acctchrt_carloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/pt_BR/acctchrt_cdmoneymkt.gnucash-xea (100%)
 rename {accounts => data/accounts}/pt_BR/acctchrt_childcare.gnucash-xea (100%)
 rename {accounts => data/accounts}/pt_BR/acctchrt_common.gnucash-xea (100%)
 rename {accounts => data/accounts}/pt_BR/acctchrt_currency.gnucash-xea (100%)
 rename {accounts => data/accounts}/pt_BR/acctchrt_eduloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/pt_BR/acctchrt_fixedassets.gnucash-xea (100%)
 rename {accounts => data/accounts}/pt_BR/acctchrt_homeloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/pt_BR/acctchrt_homeown.gnucash-xea (100%)
 rename {accounts => data/accounts}/pt_BR/acctchrt_otherloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/pt_BR/acctchrt_renter.gnucash-xea (100%)
 rename {accounts => data/accounts}/pt_BR/acctchrt_retiremt.gnucash-xea (100%)
 rename {accounts => data/accounts}/pt_BR/acctchrt_spouseinc.gnucash-xea (100%)
 rename {accounts => data/accounts}/pt_BR/acctchrt_spouseretire.gnucash-xea (100%)
 rename {accounts => data/accounts}/pt_PT/CMakeLists.txt (100%)
 rename {accounts => data/accounts}/pt_PT/Makefile.am (100%)
 rename {accounts => data/accounts}/pt_PT/acctchrt_brokerage.gnucash-xea (100%)
 rename {accounts => data/accounts}/pt_PT/acctchrt_carloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/pt_PT/acctchrt_cdmoneymkt.gnucash-xea (100%)
 rename {accounts => data/accounts}/pt_PT/acctchrt_childcare.gnucash-xea (100%)
 rename {accounts => data/accounts}/pt_PT/acctchrt_common.gnucash-xea (100%)
 rename {accounts => data/accounts}/pt_PT/acctchrt_eduloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/pt_PT/acctchrt_fixedassets.gnucash-xea (100%)
 rename {accounts => data/accounts}/pt_PT/acctchrt_homeloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/pt_PT/acctchrt_homeown.gnucash-xea (100%)
 rename {accounts => data/accounts}/pt_PT/acctchrt_otherloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/pt_PT/acctchrt_renter.gnucash-xea (100%)
 rename {accounts => data/accounts}/pt_PT/acctchrt_retiremt.gnucash-xea (100%)
 rename {accounts => data/accounts}/pt_PT/acctchrt_spouseinc.gnucash-xea (100%)
 rename {accounts => data/accounts}/pt_PT/acctchrt_spouseretire.gnucash-xea (100%)
 rename {accounts => data/accounts}/ru/CMakeLists.txt (100%)
 rename {accounts => data/accounts}/ru/Makefile.am (100%)
 rename {accounts => data/accounts}/ru/acctchrt_common.gnucash-xea (100%)
 rename {accounts => data/accounts}/ru/acctchrt_homeloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/ru/acctchrt_homeown.gnucash-xea (100%)
 rename {accounts => data/accounts}/ru/acctchrt_renter.gnucash-xea (100%)
 rename {accounts => data/accounts}/sk/CMakeLists.txt (100%)
 rename {accounts => data/accounts}/sk/Makefile.am (100%)
 rename {accounts => data/accounts}/sk/acctchrt_brokerage.gnucash-xea (100%)
 rename {accounts => data/accounts}/sk/acctchrt_carloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/sk/acctchrt_cdmoneymkt.gnucash-xea (100%)
 rename {accounts => data/accounts}/sk/acctchrt_childcare.gnucash-xea (100%)
 rename {accounts => data/accounts}/sk/acctchrt_common.gnucash-xea (100%)
 rename {accounts => data/accounts}/sk/acctchrt_currency.gnucash-xea (100%)
 rename {accounts => data/accounts}/sk/acctchrt_eduloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/sk/acctchrt_fixedassets.gnucash-xea (100%)
 rename {accounts => data/accounts}/sk/acctchrt_homeloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/sk/acctchrt_homeown.gnucash-xea (100%)
 rename {accounts => data/accounts}/sk/acctchrt_otherloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/sk/acctchrt_renter.gnucash-xea (100%)
 rename {accounts => data/accounts}/sk/acctchrt_retiremt.gnucash-xea (100%)
 rename {accounts => data/accounts}/sk/acctchrt_spouseinc.gnucash-xea (100%)
 rename {accounts => data/accounts}/sk/acctchrt_spouseretire.gnucash-xea (100%)
 rename {accounts => data/accounts}/sv_AX/CMakeLists.txt (100%)
 rename {accounts => data/accounts}/sv_AX/Makefile.am (100%)
 rename {accounts => data/accounts}/sv_AX/acctchrt_common.gnucash-xea (100%)
 rename {accounts => data/accounts}/sv_AX/acctchrt_rf.gnucash-xea (100%)
 rename {accounts => data/accounts}/sv_AX/acctchrt_sbr-xbrl.gnucash-xea (100%)
 rename {accounts => data/accounts}/sv_FI/CMakeLists.txt (100%)
 rename {accounts => data/accounts}/sv_FI/Makefile.am (100%)
 rename {accounts => data/accounts}/sv_FI/acctchrt_common.gnucash-xea (100%)
 rename {accounts => data/accounts}/sv_FI/acctchrt_rf.gnucash-xea (100%)
 rename {accounts => data/accounts}/sv_FI/acctchrt_sbr-xbrl.gnucash-xea (100%)
 rename {accounts => data/accounts}/sv_SE/CMakeLists.txt (100%)
 rename {accounts => data/accounts}/sv_SE/Makefile.am (100%)
 rename {accounts => data/accounts}/sv_SE/README.bas_2012 (100%)
 rename {accounts => data/accounts}/sv_SE/acctchrt_common.gnucash-xea (100%)
 rename {accounts => data/accounts}/sv_SE/bas_2012.gnucash-xea (100%)
 rename {accounts => data/accounts}/tr_TR/CMakeLists.txt (100%)
 rename {accounts => data/accounts}/tr_TR/Makefile.am (100%)
 rename {accounts => data/accounts}/tr_TR/acctchrt_TEKDUZ.gnucash-xea (100%)
 rename {accounts => data/accounts}/tr_TR/acctchrt_brokerage.gnucash-xea (100%)
 rename {accounts => data/accounts}/tr_TR/acctchrt_carloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/tr_TR/acctchrt_cdmoneymkt.gnucash-xea (100%)
 rename {accounts => data/accounts}/tr_TR/acctchrt_checkbook.gnucash-xea (100%)
 rename {accounts => data/accounts}/tr_TR/acctchrt_common.gnucash-xea (100%)
 rename {accounts => data/accounts}/tr_TR/acctchrt_fixedassets.gnucash-xea (100%)
 rename {accounts => data/accounts}/tr_TR/acctchrt_homeloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/zh_CN/CMakeLists.txt (100%)
 rename {accounts => data/accounts}/zh_CN/Makefile.am (100%)
 rename {accounts => data/accounts}/zh_CN/acctchrt_brokerage.gnucash-xea (100%)
 rename {accounts => data/accounts}/zh_CN/acctchrt_business.gnucash-xea (100%)
 rename {accounts => data/accounts}/zh_CN/acctchrt_carloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/zh_CN/acctchrt_cdmoneymkt.gnucash-xea (100%)
 rename {accounts => data/accounts}/zh_CN/acctchrt_checkbook.gnucash-xea (100%)
 rename {accounts => data/accounts}/zh_CN/acctchrt_childcare.gnucash-xea (100%)
 rename {accounts => data/accounts}/zh_CN/acctchrt_common.gnucash-xea (100%)
 rename {accounts => data/accounts}/zh_CN/acctchrt_eduloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/zh_CN/acctchrt_fixedassets.gnucash-xea (100%)
 rename {accounts => data/accounts}/zh_CN/acctchrt_full.gnucash-xea (100%)
 rename {accounts => data/accounts}/zh_CN/acctchrt_homeloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/zh_CN/acctchrt_homeown.gnucash-xea (100%)
 rename {accounts => data/accounts}/zh_CN/acctchrt_otherloan.gnucash-xea (100%)
 rename {accounts => data/accounts}/zh_CN/acctchrt_renter.gnucash-xea (100%)
 rename {accounts => data/accounts}/zh_CN/acctchrt_retiremt.gnucash-xea (100%)
 rename {accounts => data/accounts}/zh_CN/acctchrt_spouseinc.gnucash-xea (100%)
 rename {accounts => data/accounts}/zh_CN/acctchrt_spouseretire.gnucash-xea (100%)
 rename {accounts => data/accounts}/zh_HK/CMakeLists.txt (100%)
 rename {accounts => data/accounts}/zh_HK/Makefile.am (100%)
 rename {accounts => data/accounts}/zh_HK/acctchrt_business.gnucash-xea (100%)
 rename {accounts => data/accounts}/zh_TW/CMakeLists.txt (100%)
 rename {accounts => data/accounts}/zh_TW/Makefile.am (100%)
 rename {accounts => data/accounts}/zh_TW/acctchrt_business.gnucash-xea (100%)
 rename {checks => data/checks}/CMakeLists.txt (100%)
 rename {checks => data/checks}/Makefile.am (100%)
 rename {checks => data/checks}/deluxe.chk (100%)
 rename {checks => data/checks}/liberty.chk (100%)
 rename {checks => data/checks}/quicken.chk (100%)
 rename {checks => data/checks}/quicken_3part.chk (100%)
 rename {checks => data/checks}/quicken_check_21.chk (100%)
 rename {checks => data/checks}/quicken_wallet.chk (100%)
 rename {checks => data/checks}/voucher.chk (100%)
 rename {src => data}/pixmaps/CMakeLists.txt (100%)
 rename {src => data}/pixmaps/Makefile.am (100%)
 rename {src => data}/pixmaps/gnucash-icon-48x48.bmp (100%)
 rename {src => data}/pixmaps/gnucash-icon.ico (100%)
 rename {src => data}/pixmaps/gnucash_splash.png (100%)
 rename {src => data}/pixmaps/hicolor/128x128/apps/gnucash-icon.png (100%)
 rename {src => data}/pixmaps/hicolor/16x16/actions/gnc-account-delete.png (100%)
 rename {src => data}/pixmaps/hicolor/16x16/actions/gnc-account-edit.png (100%)
 rename {src => data}/pixmaps/hicolor/16x16/actions/gnc-account-new.png (100%)
 rename {src => data}/pixmaps/hicolor/16x16/actions/gnc-account-open.png (100%)
 rename {src => data}/pixmaps/hicolor/16x16/actions/gnc-account-report.png (100%)
 rename {src => data}/pixmaps/hicolor/16x16/actions/gnc-account.png (100%)
 rename {src => data}/pixmaps/hicolor/16x16/actions/gnc-gnome-pdf.png (100%)
 rename {src => data}/pixmaps/hicolor/16x16/actions/gnc-invoice-duplicate.png (100%)
 rename {src => data}/pixmaps/hicolor/16x16/actions/gnc-invoice-edit.png (100%)
 rename {src => data}/pixmaps/hicolor/16x16/actions/gnc-invoice-new.png (100%)
 rename {src => data}/pixmaps/hicolor/16x16/actions/gnc-invoice-pay.png (100%)
 rename {src => data}/pixmaps/hicolor/16x16/actions/gnc-invoice-post.png (100%)
 rename {src => data}/pixmaps/hicolor/16x16/actions/gnc-invoice-unpost.png (100%)
 rename {src => data}/pixmaps/hicolor/16x16/actions/gnc-invoice.png (100%)
 rename {src => data}/pixmaps/hicolor/16x16/actions/gnc-jumpto.png (100%)
 rename {src => data}/pixmaps/hicolor/16x16/actions/gnc-split-trans.png (100%)
 rename {src => data}/pixmaps/hicolor/16x16/actions/gnc-sx-new.png (100%)
 rename {src => data}/pixmaps/hicolor/16x16/actions/gnc-transfer.png (100%)
 rename {src => data}/pixmaps/hicolor/16x16/apps/gnucash-icon.png (100%)
 rename {src => data}/pixmaps/hicolor/22x22/apps/gnucash-icon.png (100%)
 rename {src => data}/pixmaps/hicolor/24x24/actions/gnc-account-delete.png (100%)
 rename {src => data}/pixmaps/hicolor/24x24/actions/gnc-account-edit.png (100%)
 rename {src => data}/pixmaps/hicolor/24x24/actions/gnc-account-new.png (100%)
 rename {src => data}/pixmaps/hicolor/24x24/actions/gnc-account-open.png (100%)
 rename {src => data}/pixmaps/hicolor/24x24/actions/gnc-account-report.png (100%)
 rename {src => data}/pixmaps/hicolor/24x24/actions/gnc-account.png (100%)
 rename {src => data}/pixmaps/hicolor/24x24/actions/gnc-gnome-pdf.png (100%)
 rename {src => data}/pixmaps/hicolor/24x24/actions/gnc-invoice-duplicate.png (100%)
 rename {src => data}/pixmaps/hicolor/24x24/actions/gnc-invoice-edit.png (100%)
 rename {src => data}/pixmaps/hicolor/24x24/actions/gnc-invoice-new.png (100%)
 rename {src => data}/pixmaps/hicolor/24x24/actions/gnc-invoice-pay.png (100%)
 rename {src => data}/pixmaps/hicolor/24x24/actions/gnc-invoice-post.png (100%)
 rename {src => data}/pixmaps/hicolor/24x24/actions/gnc-invoice-unpost.png (100%)
 rename {src => data}/pixmaps/hicolor/24x24/actions/gnc-invoice.png (100%)
 rename {src => data}/pixmaps/hicolor/24x24/actions/gnc-jumpto.png (100%)
 rename {src => data}/pixmaps/hicolor/24x24/actions/gnc-split-trans.png (100%)
 rename {src => data}/pixmaps/hicolor/24x24/actions/gnc-sx-new.png (100%)
 rename {src => data}/pixmaps/hicolor/24x24/actions/gnc-transfer.png (100%)
 rename {src => data}/pixmaps/hicolor/24x24/apps/gnucash-icon.png (100%)
 rename {src => data}/pixmaps/hicolor/256x256/apps/gnucash-icon.png (100%)
 rename {src => data}/pixmaps/hicolor/32x32/apps/gnucash-icon.png (100%)
 rename {src => data}/pixmaps/hicolor/48x48/apps/gnucash-icon.png (100%)
 rename {src => data}/pixmaps/hicolor/64x64/apps/gnucash-icon.png (100%)
 rename {src => data}/pixmaps/hicolor/96x96/apps/gnucash-icon.png (100%)
 rename {src => data}/pixmaps/hicolor/scalable/apps/gnucash-icon.svg (100%)
 create mode 100644 gnucash/CMakeLists.txt
 create mode 100644 gnucash/CMakeLists.txt-bin
 create mode 100644 gnucash/Makefile.am
 rename {src/bin => gnucash}/environment.in (100%)
 rename {src/bin => gnucash}/generate-gnc-script (100%)
 create mode 100644 gnucash/gnome-search/CMakeLists.txt
 create mode 100644 gnucash/gnome-search/Makefile.am
 rename {src => gnucash}/gnome-search/dialog-search.c (100%)
 rename {src => gnucash}/gnome-search/dialog-search.glade (100%)
 rename {src => gnucash}/gnome-search/dialog-search.h (100%)
 rename {src => gnucash}/gnome-search/gnc-general-search.c (100%)
 rename {src => gnucash}/gnome-search/gnc-general-search.h (100%)
 rename {src => gnucash}/gnome-search/gncmod-gnome-search.c (100%)
 rename {src => gnucash}/gnome-search/search-account.c (100%)
 rename {src => gnucash}/gnome-search/search-account.h (100%)
 rename {src => gnucash}/gnome-search/search-boolean.c (100%)
 rename {src => gnucash}/gnome-search/search-boolean.h (100%)
 rename {src => gnucash}/gnome-search/search-core-type.c (100%)
 rename {src => gnucash}/gnome-search/search-core-type.h (100%)
 rename {src => gnucash}/gnome-search/search-core-utils.c (100%)
 rename {src => gnucash}/gnome-search/search-core-utils.h (100%)
 rename {src => gnucash}/gnome-search/search-date.c (100%)
 rename {src => gnucash}/gnome-search/search-date.h (100%)
 rename {src => gnucash}/gnome-search/search-double.c (100%)
 rename {src => gnucash}/gnome-search/search-double.h (100%)
 rename {src => gnucash}/gnome-search/search-int64.c (100%)
 rename {src => gnucash}/gnome-search/search-int64.h (100%)
 rename {src => gnucash}/gnome-search/search-numeric.c (100%)
 rename {src => gnucash}/gnome-search/search-numeric.h (100%)
 rename {src => gnucash}/gnome-search/search-reconciled.c (100%)
 rename {src => gnucash}/gnome-search/search-reconciled.h (100%)
 rename {src => gnucash}/gnome-search/search-string.c (100%)
 rename {src => gnucash}/gnome-search/search-string.h (100%)
 create mode 100644 gnucash/gnome-utils/CMakeLists.txt
 create mode 100644 gnucash/gnome-utils/Makefile.am
 rename {src => gnucash}/gnome-utils/account-quickfill.c (100%)
 rename {src => gnucash}/gnome-utils/account-quickfill.h (100%)
 rename {src => gnucash}/gnome-utils/assistant-xml-encoding.c (100%)
 rename {src => gnucash}/gnome-utils/assistant-xml-encoding.h (100%)
 rename {src => gnucash}/gnome-utils/cursors.c (100%)
 rename {src => gnucash}/gnome-utils/dialog-account.c (100%)
 rename {src => gnucash}/gnome-utils/dialog-account.h (100%)
 create mode 100644 gnucash/gnome-utils/dialog-book-close.c
 rename {src => gnucash}/gnome-utils/dialog-book-close.h (100%)
 rename {src => gnucash}/gnome-utils/dialog-commodity.c (100%)
 rename {src => gnucash}/gnome-utils/dialog-commodity.h (100%)
 rename {src => gnucash}/gnome-utils/dialog-dup-trans.c (100%)
 rename {src => gnucash}/gnome-utils/dialog-dup-trans.h (100%)
 rename {src => gnucash}/gnome-utils/dialog-file-access.c (100%)
 rename {src => gnucash}/gnome-utils/dialog-file-access.h (100%)
 rename {src => gnucash}/gnome-utils/dialog-object-references.c (100%)
 rename {src => gnucash}/gnome-utils/dialog-object-references.h (100%)
 create mode 100644 gnucash/gnome-utils/dialog-options.c
 create mode 100644 gnucash/gnome-utils/dialog-options.h
 rename {src => gnucash}/gnome-utils/dialog-preferences.c (100%)
 rename {src => gnucash}/gnome-utils/dialog-preferences.h (100%)
 rename {src => gnucash}/gnome-utils/dialog-query-view.c (100%)
 rename {src => gnucash}/gnome-utils/dialog-query-view.h (100%)
 create mode 100644 gnucash/gnome-utils/dialog-reset-warnings.c
 rename {src => gnucash}/gnome-utils/dialog-reset-warnings.h (100%)
 rename {src => gnucash}/gnome-utils/dialog-tax-table.c (100%)
 rename {src => gnucash}/gnome-utils/dialog-tax-table.h (100%)
 rename {src => gnucash}/gnome-utils/dialog-totd.c (100%)
 rename {src => gnucash}/gnome-utils/dialog-totd.h (100%)
 create mode 100644 gnucash/gnome-utils/dialog-transfer.c
 rename {src => gnucash}/gnome-utils/dialog-transfer.h (100%)
 rename {src => gnucash}/gnome-utils/dialog-userpass.c (100%)
 rename {src => gnucash}/gnome-utils/dialog-utils.c (100%)
 rename {src => gnucash}/gnome-utils/dialog-utils.h (100%)
 rename {src => gnucash}/gnome-utils/gnc-account-sel.c (100%)
 rename {src => gnucash}/gnome-utils/gnc-account-sel.h (100%)
 rename {src => gnucash}/gnome-utils/gnc-amount-edit.c (100%)
 rename {src => gnucash}/gnome-utils/gnc-amount-edit.h (100%)
 rename {src => gnucash}/gnome-utils/gnc-autosave.c (100%)
 rename {src => gnucash}/gnome-utils/gnc-autosave.h (100%)
 rename {src => gnucash}/gnome-utils/gnc-cell-renderer-date.c (100%)
 rename {src => gnucash}/gnome-utils/gnc-cell-renderer-date.h (100%)
 rename {src => gnucash}/gnome-utils/gnc-cell-renderer-popup-entry.c (100%)
 rename {src => gnucash}/gnome-utils/gnc-cell-renderer-popup-entry.h (100%)
 rename {src => gnucash}/gnome-utils/gnc-cell-renderer-popup.c (100%)
 rename {src => gnucash}/gnome-utils/gnc-cell-renderer-popup.h (100%)
 rename {src => gnucash}/gnome-utils/gnc-combott.c (100%)
 rename {src => gnucash}/gnome-utils/gnc-combott.h (100%)
 rename {src => gnucash}/gnome-utils/gnc-commodity-edit.c (100%)
 rename {src => gnucash}/gnome-utils/gnc-commodity-edit.h (100%)
 rename {src => gnucash}/gnome-utils/gnc-currency-edit.c (100%)
 rename {src => gnucash}/gnome-utils/gnc-currency-edit.h (100%)
 rename {src => gnucash}/gnome-utils/gnc-date-delta.c (100%)
 rename {src => gnucash}/gnome-utils/gnc-date-delta.h (100%)
 rename {src => gnucash}/gnome-utils/gnc-date-edit.c (100%)
 rename {src => gnucash}/gnome-utils/gnc-date-edit.h (100%)
 rename {src => gnucash}/gnome-utils/gnc-date-format.c (100%)
 rename {src => gnucash}/gnome-utils/gnc-date-format.h (100%)
 rename {src => gnucash}/gnome-utils/gnc-dense-cal-model.c (100%)
 rename {src => gnucash}/gnome-utils/gnc-dense-cal-model.h (100%)
 rename {src => gnucash}/gnome-utils/gnc-dense-cal-store.c (100%)
 rename {src => gnucash}/gnome-utils/gnc-dense-cal-store.h (100%)
 rename {src => gnucash}/gnome-utils/gnc-dense-cal.c (100%)
 rename {src => gnucash}/gnome-utils/gnc-dense-cal.h (100%)
 rename {src => gnucash}/gnome-utils/gnc-embedded-window.c (100%)
 rename {src => gnucash}/gnome-utils/gnc-embedded-window.h (100%)
 rename {src => gnucash}/gnome-utils/gnc-file.c (100%)
 rename {src => gnucash}/gnome-utils/gnc-file.h (100%)
 rename {src => gnucash}/gnome-utils/gnc-frequency.c (100%)
 rename {src => gnucash}/gnome-utils/gnc-frequency.h (100%)
 rename {src => gnucash}/gnome-utils/gnc-general-select.c (100%)
 rename {src => gnucash}/gnome-utils/gnc-general-select.h (100%)
 rename {src => gnucash}/gnome-utils/gnc-gnome-utils.c (100%)
 rename {src => gnucash}/gnome-utils/gnc-gnome-utils.h (100%)
 rename {src => gnucash}/gnome-utils/gnc-gobject-utils.c (100%)
 rename {src => gnucash}/gnome-utils/gnc-gobject-utils.h (100%)
 rename {src => gnucash}/gnome-utils/gnc-gtk-utils.c (100%)
 rename {src => gnucash}/gnome-utils/gnc-gtk-utils.h (100%)
 rename {src => gnucash}/gnome-utils/gnc-gui-query.c (100%)
 rename {src => gnucash}/gnome-utils/gnc-gui-query.h (100%)
 rename {src => gnucash}/gnome-utils/gnc-icons.c (100%)
 rename {src => gnucash}/gnome-utils/gnc-icons.h (100%)
 rename {src => gnucash}/gnome-utils/gnc-keyring.c (100%)
 rename {src => gnucash}/gnome-utils/gnc-keyring.h (100%)
 create mode 100644 gnucash/gnome-utils/gnc-main-window.c
 rename {src => gnucash}/gnome-utils/gnc-main-window.h (100%)
 rename {src => gnucash}/gnome-utils/gnc-menu-extensions.c (100%)
 rename {src => gnucash}/gnome-utils/gnc-menu-extensions.h (100%)
 rename {src => gnucash}/gnome-utils/gnc-menu-extensions.scm (100%)
 rename {src => gnucash}/gnome-utils/gnc-period-select.c (100%)
 rename {src => gnucash}/gnome-utils/gnc-period-select.h (100%)
 rename {src => gnucash}/gnome-utils/gnc-plugin-file-history.c (100%)
 rename {src => gnucash}/gnome-utils/gnc-plugin-file-history.h (100%)
 rename {src => gnucash}/gnome-utils/gnc-plugin-manager.c (100%)
 rename {src => gnucash}/gnome-utils/gnc-plugin-manager.h (100%)
 rename {src => gnucash}/gnome-utils/gnc-plugin-menu-additions.c (100%)
 rename {src => gnucash}/gnome-utils/gnc-plugin-menu-additions.h (100%)
 rename {src => gnucash}/gnome-utils/gnc-plugin-page.c (100%)
 rename {src => gnucash}/gnome-utils/gnc-plugin-page.h (100%)
 rename {src => gnucash}/gnome-utils/gnc-plugin.c (100%)
 rename {src => gnucash}/gnome-utils/gnc-plugin.h (100%)
 rename {src => gnucash}/gnome-utils/gnc-query-view.c (100%)
 rename {src => gnucash}/gnome-utils/gnc-query-view.h (100%)
 rename {src => gnucash}/gnome-utils/gnc-recurrence.c (100%)
 rename {src => gnucash}/gnome-utils/gnc-recurrence.h (100%)
 create mode 100644 gnucash/gnome-utils/gnc-splash.c
 rename {src => gnucash}/gnome-utils/gnc-splash.h (100%)
 rename {src => gnucash}/gnome-utils/gnc-sx-instance-dense-cal-adapter.c (100%)
 rename {src => gnucash}/gnome-utils/gnc-sx-instance-dense-cal-adapter.h (100%)
 rename {src => gnucash}/gnome-utils/gnc-sx-list-tree-model-adapter.c (100%)
 rename {src => gnucash}/gnome-utils/gnc-sx-list-tree-model-adapter.h (100%)
 create mode 100644 gnucash/gnome-utils/gnc-tree-control-split-reg.c
 rename {src => gnucash}/gnome-utils/gnc-tree-control-split-reg.h (100%)
 rename {src => gnucash}/gnome-utils/gnc-tree-model-account-types.c (100%)
 rename {src => gnucash}/gnome-utils/gnc-tree-model-account-types.h (100%)
 rename {src => gnucash}/gnome-utils/gnc-tree-model-account.c (100%)
 rename {src => gnucash}/gnome-utils/gnc-tree-model-account.h (100%)
 rename {src => gnucash}/gnome-utils/gnc-tree-model-budget.c (100%)
 rename {src => gnucash}/gnome-utils/gnc-tree-model-budget.h (100%)
 rename {src => gnucash}/gnome-utils/gnc-tree-model-commodity.c (100%)
 rename {src => gnucash}/gnome-utils/gnc-tree-model-commodity.h (100%)
 rename {src => gnucash}/gnome-utils/gnc-tree-model-owner.c (100%)
 rename {src => gnucash}/gnome-utils/gnc-tree-model-owner.h (100%)
 rename {src => gnucash}/gnome-utils/gnc-tree-model-price.c (100%)
 rename {src => gnucash}/gnome-utils/gnc-tree-model-price.h (100%)
 rename {src => gnucash}/gnome-utils/gnc-tree-model-selection.c (100%)
 rename {src => gnucash}/gnome-utils/gnc-tree-model-selection.h (100%)
 rename {src => gnucash}/gnome-utils/gnc-tree-model-split-reg.c (100%)
 rename {src => gnucash}/gnome-utils/gnc-tree-model-split-reg.h (100%)
 rename {src => gnucash}/gnome-utils/gnc-tree-model.c (100%)
 rename {src => gnucash}/gnome-utils/gnc-tree-model.h (100%)
 rename {src => gnucash}/gnome-utils/gnc-tree-util-split-reg.c (100%)
 rename {src => gnucash}/gnome-utils/gnc-tree-util-split-reg.h (100%)
 rename {src => gnucash}/gnome-utils/gnc-tree-view-account.c (100%)
 rename {src => gnucash}/gnome-utils/gnc-tree-view-account.h (100%)
 rename {src => gnucash}/gnome-utils/gnc-tree-view-commodity.c (100%)
 rename {src => gnucash}/gnome-utils/gnc-tree-view-commodity.h (100%)
 rename {src => gnucash}/gnome-utils/gnc-tree-view-owner.c (100%)
 rename {src => gnucash}/gnome-utils/gnc-tree-view-owner.h (100%)
 rename {src => gnucash}/gnome-utils/gnc-tree-view-price.c (100%)
 rename {src => gnucash}/gnome-utils/gnc-tree-view-price.h (100%)
 create mode 100644 gnucash/gnome-utils/gnc-tree-view-split-reg.c
 rename {src => gnucash}/gnome-utils/gnc-tree-view-split-reg.h (100%)
 rename {src => gnucash}/gnome-utils/gnc-tree-view-sx-list.c (100%)
 rename {src => gnucash}/gnome-utils/gnc-tree-view-sx-list.h (100%)
 rename {src => gnucash}/gnome-utils/gnc-tree-view.c (100%)
 rename {src => gnucash}/gnome-utils/gnc-tree-view.h (100%)
 rename {src => gnucash}/gnome-utils/gnc-ui.h (100%)
 rename {src => gnucash}/gnome-utils/gnc-window.c (100%)
 rename {src => gnucash}/gnome-utils/gnc-window.h (100%)
 rename {src => gnucash}/gnome-utils/gncmod-gnome-utils.c (100%)
 rename {src => gnucash}/gnome-utils/gnome-utils.i (100%)
 rename {src => gnucash}/gnome-utils/gnome-utils.scm (100%)
 rename {src => gnucash}/gnome-utils/gschemas/CMakeLists.txt (100%)
 rename {src => gnucash}/gnome-utils/gschemas/Makefile.am (100%)
 rename {src => gnucash}/gnome-utils/gschemas/org.gnucash.history.gschema.xml.in.in (100%)
 rename {src => gnucash}/gnome-utils/gschemas/org.gnucash.warnings.gschema.xml.in.in (100%)
 rename {src => gnucash}/gnome-utils/gtkbuilder/CMakeLists.txt (100%)
 rename {src => gnucash}/gnome-utils/gtkbuilder/Makefile.am (100%)
 rename {src => gnucash}/gnome-utils/gtkbuilder/assistant-xml-encoding.glade (100%)
 rename {src => gnucash}/gnome-utils/gtkbuilder/dialog-account.glade (100%)
 rename {src => gnucash}/gnome-utils/gtkbuilder/dialog-book-close.glade (100%)
 rename {src => gnucash}/gnome-utils/gtkbuilder/dialog-commodity.glade (100%)
 rename {src => gnucash}/gnome-utils/gtkbuilder/dialog-file-access.glade (100%)
 rename {src => gnucash}/gnome-utils/gtkbuilder/dialog-object-references.glade (100%)
 rename {src => gnucash}/gnome-utils/gtkbuilder/dialog-options.glade (100%)
 rename {src => gnucash}/gnome-utils/gtkbuilder/dialog-preferences.glade (100%)
 rename {src => gnucash}/gnome-utils/gtkbuilder/dialog-query-view.glade (100%)
 rename {src => gnucash}/gnome-utils/gtkbuilder/dialog-reset-warnings.glade (100%)
 rename {src => gnucash}/gnome-utils/gtkbuilder/dialog-tax-table.glade (100%)
 rename {src => gnucash}/gnome-utils/gtkbuilder/dialog-totd.glade (100%)
 rename {src => gnucash}/gnome-utils/gtkbuilder/dialog-transfer.glade (100%)
 rename {src => gnucash}/gnome-utils/gtkbuilder/dialog-userpass.glade (100%)
 rename {src => gnucash}/gnome-utils/gtkbuilder/gnc-date-format.glade (100%)
 rename {src => gnucash}/gnome-utils/gtkbuilder/gnc-frequency.glade (100%)
 rename {src => gnucash}/gnome-utils/gtkbuilder/gnc-recurrence.glade (100%)
 rename {src => gnucash}/gnome-utils/gtkbuilder/gnc-tree-view-owner.glade (100%)
 rename {src => gnucash}/gnome-utils/make-gnc-warnings-c.xsl (100%)
 rename {src => gnucash}/gnome-utils/make-gnc-warnings-h.xsl (100%)
 rename {src => gnucash}/gnome-utils/misc-gnome-utils.c (100%)
 rename {src => gnucash}/gnome-utils/misc-gnome-utils.h (100%)
 rename {src => gnucash}/gnome-utils/print-session.c (100%)
 rename {src => gnucash}/gnome-utils/print-session.h (100%)
 rename {src => gnucash}/gnome-utils/search-param.c (100%)
 rename {src => gnucash}/gnome-utils/search-param.h (100%)
 create mode 100644 gnucash/gnome-utils/test/CMakeLists.txt
 create mode 100644 gnucash/gnome-utils/test/Makefile.am
 rename {src => gnucash}/gnome-utils/test/test-gnc-recurrence.c (100%)
 rename {src => gnucash}/gnome-utils/test/test-link-module.c (100%)
 rename {src => gnucash}/gnome-utils/test/test-load-module.in (100%)
 rename {src => gnucash}/gnome-utils/tree-view-utils.c (100%)
 rename {src => gnucash}/gnome-utils/tree-view-utils.h (100%)
 rename {src => gnucash}/gnome-utils/ui/CMakeLists.txt (100%)
 rename {src => gnucash}/gnome-utils/ui/Makefile.am (100%)
 rename {src => gnucash}/gnome-utils/ui/gnc-main-window-ui.xml (100%)
 rename {src => gnucash}/gnome-utils/ui/gnc-windows-menu-ui-quartz.xml (100%)
 rename {src => gnucash}/gnome-utils/ui/gnc-windows-menu-ui.xml (100%)
 rename {src => gnucash}/gnome-utils/ui/gnucash.css (100%)
 rename {src => gnucash}/gnome-utils/ui/osx_accel_map (100%)
 rename {src => gnucash}/gnome-utils/window-main-summarybar.c (100%)
 rename {src => gnucash}/gnome-utils/window-main-summarybar.h (100%)
 create mode 100644 gnucash/gnome/CMakeLists.txt
 create mode 100644 gnucash/gnome/Makefile.am
 rename {src => gnucash}/gnome/assistant-acct-period.c (100%)
 rename {src => gnucash}/gnome/assistant-acct-period.h (100%)
 rename {src => gnucash}/gnome/assistant-hierarchy.c (100%)
 rename {src => gnucash}/gnome/assistant-hierarchy.h (100%)
 rename {src => gnucash}/gnome/assistant-loan.c (100%)
 rename {src => gnucash}/gnome/assistant-loan.h (100%)
 rename {src => gnucash}/gnome/assistant-stock-split.c (100%)
 rename {src => gnucash}/gnome/assistant-stock-split.h (100%)
 rename {src/business/business-gnome => gnucash/gnome}/business-gnome-utils.c (100%)
 rename {src/business/business-gnome => gnucash/gnome}/business-gnome-utils.h (100%)
 rename {src/business/business-gnome => gnucash/gnome}/business-options-gnome.c (100%)
 rename {src/business/business-gnome => gnucash/gnome}/business-options-gnome.h (100%)
 rename {src/business/business-gnome => gnucash/gnome}/business-urls.c (100%)
 rename {src/business/business-gnome => gnucash/gnome}/business-urls.h (100%)
 rename {src/business/business-gnome => gnucash/gnome}/dialog-billterms.c (100%)
 rename {src/business/business-gnome => gnucash/gnome}/dialog-billterms.h (100%)
 rename {src/business/business-gnome => gnucash/gnome}/dialog-choose-owner.c (100%)
 rename {src/business/business-gnome => gnucash/gnome}/dialog-choose-owner.h (100%)
 create mode 100644 gnucash/gnome/dialog-commodities.c
 create mode 100644 gnucash/gnome/dialog-customer.c
 rename {src/business/business-gnome => gnucash/gnome}/dialog-customer.h (100%)
 rename {src/business/business-gnome => gnucash/gnome}/dialog-date-close.c (100%)
 rename {src/business/business-gnome => gnucash/gnome}/dialog-date-close.h (100%)
 rename {src/business/business-gnome => gnucash/gnome}/dialog-employee.c (100%)
 rename {src/business/business-gnome => gnucash/gnome}/dialog-employee.h (100%)
 rename {src => gnucash}/gnome/dialog-fincalc.c (100%)
 rename {src => gnucash}/gnome/dialog-fincalc.h (100%)
 rename {src => gnucash}/gnome/dialog-find-account.c (100%)
 rename {src => gnucash}/gnome/dialog-find-account.h (100%)
 rename {src => gnucash}/gnome/dialog-find-transactions.c (100%)
 rename {src => gnucash}/gnome/dialog-find-transactions.h (100%)
 rename {src => gnucash}/gnome/dialog-find-transactions2.c (100%)
 rename {src => gnucash}/gnome/dialog-find-transactions2.h (100%)
 rename {src => gnucash}/gnome/dialog-imap-editor.c (100%)
 rename {src => gnucash}/gnome/dialog-imap-editor.h (100%)
 rename {src/business/business-gnome => gnucash/gnome}/dialog-invoice.c (100%)
 rename {src/business/business-gnome => gnucash/gnome}/dialog-invoice.h (100%)
 rename {src/business/business-gnome => gnucash/gnome}/dialog-job.c (100%)
 rename {src/business/business-gnome => gnucash/gnome}/dialog-job.h (100%)
 rename {src => gnucash}/gnome/dialog-lot-viewer.c (100%)
 rename {src => gnucash}/gnome/dialog-lot-viewer.h (100%)
 create mode 100644 gnucash/gnome/dialog-new-user.c
 rename {src => gnucash}/gnome/dialog-new-user.h (100%)
 create mode 100644 gnucash/gnome/dialog-order.c
 rename {src/business/business-gnome => gnucash/gnome}/dialog-order.h (100%)
 create mode 100644 gnucash/gnome/dialog-payment.c
 rename {src/business/business-gnome => gnucash/gnome}/dialog-payment.h (100%)
 create mode 100644 gnucash/gnome/dialog-price-edit-db.c
 rename {src => gnucash}/gnome/dialog-price-editor.c (100%)
 rename {src => gnucash}/gnome/dialog-print-check.c (100%)
 rename {src => gnucash}/gnome/dialog-print-check.h (100%)
 rename {src => gnucash}/gnome/dialog-progress.c (100%)
 rename {src => gnucash}/gnome/dialog-progress.h (100%)
 rename {src => gnucash}/gnome/dialog-sx-editor.c (100%)
 rename {src => gnucash}/gnome/dialog-sx-editor.h (100%)
 rename {src => gnucash}/gnome/dialog-sx-editor2.c (100%)
 rename {src => gnucash}/gnome/dialog-sx-editor2.h (100%)
 rename {src => gnucash}/gnome/dialog-sx-from-trans.c (100%)
 rename {src => gnucash}/gnome/dialog-sx-from-trans.h (100%)
 rename {src => gnucash}/gnome/dialog-sx-since-last-run.c (100%)
 rename {src => gnucash}/gnome/dialog-sx-since-last-run.h (100%)
 rename {src => gnucash}/gnome/dialog-tax-info.c (100%)
 rename {src => gnucash}/gnome/dialog-trans-assoc.c (100%)
 rename {src => gnucash}/gnome/dialog-trans-assoc.h (100%)
 rename {src/business/business-gnome => gnucash/gnome}/dialog-vendor.c (100%)
 rename {src/business/business-gnome => gnucash/gnome}/dialog-vendor.h (100%)
 rename {src => gnucash}/gnome/gnc-budget-view.c (100%)
 rename {src => gnucash}/gnome/gnc-budget-view.h (100%)
 rename {src => gnucash}/gnome/gnc-plugin-account-tree.c (100%)
 rename {src => gnucash}/gnome/gnc-plugin-account-tree.h (100%)
 rename {src => gnucash}/gnome/gnc-plugin-basic-commands.c (100%)
 rename {src => gnucash}/gnome/gnc-plugin-basic-commands.h (100%)
 rename {src => gnucash}/gnome/gnc-plugin-budget.c (100%)
 rename {src => gnucash}/gnome/gnc-plugin-budget.h (100%)
 create mode 100644 gnucash/gnome/gnc-plugin-business.c
 rename {src/business/business-gnome => gnucash/gnome}/gnc-plugin-business.h (100%)
 rename {src => gnucash}/gnome/gnc-plugin-page-account-tree.c (100%)
 rename {src => gnucash}/gnome/gnc-plugin-page-account-tree.h (100%)
 rename {src => gnucash}/gnome/gnc-plugin-page-budget.c (100%)
 rename {src => gnucash}/gnome/gnc-plugin-page-budget.h (100%)
 rename {src/business/business-gnome => gnucash/gnome}/gnc-plugin-page-invoice.c (100%)
 rename {src/business/business-gnome => gnucash/gnome}/gnc-plugin-page-invoice.h (100%)
 rename {src/business/business-gnome => gnucash/gnome}/gnc-plugin-page-owner-tree.c (100%)
 rename {src/business/business-gnome => gnucash/gnome}/gnc-plugin-page-owner-tree.h (100%)
 create mode 100644 gnucash/gnome/gnc-plugin-page-register.c
 rename {src => gnucash}/gnome/gnc-plugin-page-register.h (100%)
 create mode 100644 gnucash/gnome/gnc-plugin-page-register2.c
 rename {src => gnucash}/gnome/gnc-plugin-page-register2.h (100%)
 rename {src => gnucash}/gnome/gnc-plugin-page-sx-list.c (100%)
 rename {src => gnucash}/gnome/gnc-plugin-page-sx-list.h (100%)
 rename {src => gnucash}/gnome/gnc-plugin-register.c (100%)
 rename {src => gnucash}/gnome/gnc-plugin-register.h (100%)
 rename {src => gnucash}/gnome/gnc-plugin-register2.c (100%)
 rename {src => gnucash}/gnome/gnc-plugin-register2.h (100%)
 create mode 100644 gnucash/gnome/gnc-split-reg.c
 rename {src => gnucash}/gnome/gnc-split-reg.h (100%)
 create mode 100644 gnucash/gnome/gnc-split-reg2.c
 rename {src => gnucash}/gnome/gnc-split-reg2.h (100%)
 rename {src => gnucash}/gnome/gnome.i (100%)
 rename {src => gnucash}/gnome/gnucash.appdata.xml.in (100%)
 rename {src => gnucash}/gnome/gnucash.desktop.in.in (100%)
 create mode 100644 gnucash/gnome/gschemas/CMakeLists.txt
 create mode 100644 gnucash/gnome/gschemas/Makefile.am
 rename {src/business/business-gnome => gnucash/gnome}/gschemas/org.gnucash.dialogs.business.gschema.xml.in.in (100%)
 rename {src => gnucash}/gnome/gschemas/org.gnucash.dialogs.checkprinting.gschema.xml.in.in (100%)
 rename {src => gnucash}/gnome/gschemas/org.gnucash.dialogs.commodities.gschema.xml.in.in (100%)
 rename {src => gnucash}/gnome/gschemas/org.gnucash.dialogs.gschema.xml.in.in (100%)
 rename {src => gnucash}/gnome/gschemas/org.gnucash.dialogs.reconcile.gschema.xml.in.in (100%)
 rename {src => gnucash}/gnome/gschemas/org.gnucash.dialogs.sxs.gschema.xml.in.in (100%)
 rename {src => gnucash}/gnome/gschemas/org.gnucash.dialogs.totd.gschema.xml.in.in (100%)
 rename {src => gnucash}/gnome/gschemas/org.gnucash.gschema.xml.in.in (100%)
 rename {src => gnucash}/gnome/gschemas/org.gnucash.window.pages.account.tree.gschema.xml.in.in (100%)
 rename {src => gnucash}/gnome/gschemas/org.gnucash.window.pages.gschema.xml.in.in (100%)
 create mode 100644 gnucash/gnome/gtkbuilder/CMakeLists.txt
 create mode 100644 gnucash/gnome/gtkbuilder/Makefile.am
 rename {src => gnucash}/gnome/gtkbuilder/assistant-acct-period.glade (100%)
 rename {src => gnucash}/gnome/gtkbuilder/assistant-hierarchy.glade (100%)
 rename {src => gnucash}/gnome/gtkbuilder/assistant-loan.glade (100%)
 rename {src => gnucash}/gnome/gtkbuilder/assistant-stock-split.glade (100%)
 rename {src/business/business-gnome => gnucash/gnome}/gtkbuilder/business-options-gnome.glade (100%)
 rename {src/business/business-gnome => gnucash/gnome}/gtkbuilder/business-prefs.glade (100%)
 rename {src/business/business-gnome => gnucash/gnome}/gtkbuilder/dialog-billterms.glade (100%)
 rename {src/business/business-gnome => gnucash/gnome}/gtkbuilder/dialog-choose-owner.glade (100%)
 rename {src => gnucash}/gnome/gtkbuilder/dialog-commodities.glade (100%)
 rename {src/business/business-gnome => gnucash/gnome}/gtkbuilder/dialog-customer.glade (100%)
 rename {src/business/business-gnome => gnucash/gnome}/gtkbuilder/dialog-date-close.glade (100%)
 rename {src/business/business-gnome => gnucash/gnome}/gtkbuilder/dialog-employee.glade (100%)
 rename {src => gnucash}/gnome/gtkbuilder/dialog-fincalc.glade (100%)
 rename {src => gnucash}/gnome/gtkbuilder/dialog-find-account.glade (100%)
 rename {src => gnucash}/gnome/gtkbuilder/dialog-imap-editor.glade (100%)
 rename {src/business/business-gnome => gnucash/gnome}/gtkbuilder/dialog-invoice.glade (100%)
 rename {src/business/business-gnome => gnucash/gnome}/gtkbuilder/dialog-job.glade (100%)
 rename {src => gnucash}/gnome/gtkbuilder/dialog-lot-viewer.glade (100%)
 rename {src => gnucash}/gnome/gtkbuilder/dialog-new-user.glade (100%)
 rename {src/business/business-gnome => gnucash/gnome}/gtkbuilder/dialog-order.glade (100%)
 rename {src/business/business-gnome => gnucash/gnome}/gtkbuilder/dialog-payment.glade (100%)
 rename {src => gnucash}/gnome/gtkbuilder/dialog-price.glade (100%)
 rename {src => gnucash}/gnome/gtkbuilder/dialog-print-check.glade (100%)
 rename {src => gnucash}/gnome/gtkbuilder/dialog-progress.glade (100%)
 rename {src => gnucash}/gnome/gtkbuilder/dialog-sx.glade (100%)
 rename {src => gnucash}/gnome/gtkbuilder/dialog-tax-info.glade (100%)
 rename {src => gnucash}/gnome/gtkbuilder/dialog-trans-assoc.glade (100%)
 rename {src/business/business-gnome => gnucash/gnome}/gtkbuilder/dialog-vendor.glade (100%)
 rename {src => gnucash}/gnome/gtkbuilder/gnc-plugin-page-budget.glade (100%)
 rename {src => gnucash}/gnome/gtkbuilder/gnc-plugin-page-register.glade (100%)
 rename {src => gnucash}/gnome/gtkbuilder/gnc-plugin-page-register2.glade (100%)
 rename {src => gnucash}/gnome/gtkbuilder/window-autoclear.glade (100%)
 rename {src => gnucash}/gnome/gtkbuilder/window-reconcile.glade (100%)
 rename {src => gnucash}/gnome/reconcile-view.c (100%)
 rename {src => gnucash}/gnome/reconcile-view.h (100%)
 rename {src/business/business-gnome => gnucash/gnome}/search-owner.c (100%)
 rename {src/business/business-gnome => gnucash/gnome}/search-owner.h (100%)
 create mode 100644 gnucash/gnome/top-level.c
 rename {src => gnucash}/gnome/top-level.h (100%)
 create mode 100644 gnucash/gnome/ui/CMakeLists.txt
 create mode 100644 gnucash/gnome/ui/Makefile.am
 rename {src => gnucash}/gnome/ui/gnc-plugin-account-tree-ui.xml (100%)
 rename {src => gnucash}/gnome/ui/gnc-plugin-basic-commands-ui.xml (100%)
 rename {src => gnucash}/gnome/ui/gnc-plugin-budget-ui.xml (100%)
 rename {src/business/business-gnome => gnucash/gnome}/ui/gnc-plugin-business-ui.xml (100%)
 rename {src => gnucash}/gnome/ui/gnc-plugin-file-history-ui.xml (100%)
 rename {src => gnucash}/gnome/ui/gnc-plugin-page-account-tree-ui.xml (100%)
 rename {src => gnucash}/gnome/ui/gnc-plugin-page-account-tree2-ui.xml (100%)
 rename {src => gnucash}/gnome/ui/gnc-plugin-page-budget-ui.xml (100%)
 rename {src/business/business-gnome => gnucash/gnome}/ui/gnc-plugin-page-invoice-ui.xml (100%)
 rename {src/business/business-gnome => gnucash/gnome}/ui/gnc-plugin-page-owner-tree-ui.xml (100%)
 rename {src => gnucash}/gnome/ui/gnc-plugin-page-register-ui.xml (100%)
 rename {src => gnucash}/gnome/ui/gnc-plugin-page-register2-ui.xml (100%)
 rename {src => gnucash}/gnome/ui/gnc-plugin-page-sx-list-ui.xml (100%)
 rename {src => gnucash}/gnome/ui/gnc-plugin-page-sx-list2-ui.xml (100%)
 rename {src => gnucash}/gnome/ui/gnc-plugin-page-sxregister-ui.xml (100%)
 rename {src => gnucash}/gnome/ui/gnc-plugin-register-ui.xml (100%)
 rename {src => gnucash}/gnome/ui/gnc-plugin-register2-ui.xml (100%)
 rename {src => gnucash}/gnome/ui/gnc-plugin-register22-ui.xml (100%)
 rename {src => gnucash}/gnome/ui/gnc-reconcile-window-ui.xml (100%)
 rename {src => gnucash}/gnome/ui/gnc-sxed-to-create-window-ui.xml (100%)
 rename {src => gnucash}/gnome/ui/gnc-sxed-window-ui-full.xml (100%)
 rename {src => gnucash}/gnome/ui/gnc-sxed-window-ui.xml (100%)
 rename {src => gnucash}/gnome/window-autoclear.c (100%)
 rename {src => gnucash}/gnome/window-autoclear.h (100%)
 rename {src => gnucash}/gnome/window-reconcile.c (100%)
 rename {src => gnucash}/gnome/window-reconcile.h (100%)
 rename {src => gnucash}/gnome/window-reconcile2.c (100%)
 rename {src => gnucash}/gnome/window-reconcile2.h (100%)
 create mode 100644 gnucash/gnucash-bin.c
 rename {src/bin => gnucash}/gnucash-strip-svn-datafile.sh (100%)
 create mode 100644 gnucash/gnucash-valgrind.in
 rename {src/bin => gnucash}/gnucash.rc.in (100%)
 create mode 100644 gnucash/html/CMakeLists.txt
 create mode 100644 gnucash/html/Makefile.am
 rename {src => gnucash}/html/gnc-html-extras.h (100%)
 rename {src => gnucash}/html/gnc-html-factory.c (100%)
 rename {src => gnucash}/html/gnc-html-factory.h (100%)
 rename {src => gnucash}/html/gnc-html-history.c (100%)
 rename {src => gnucash}/html/gnc-html-history.h (100%)
 rename {src => gnucash}/html/gnc-html-p.h (100%)
 rename {src => gnucash}/html/gnc-html-webkit-p.h (100%)
 rename {src => gnucash}/html/gnc-html-webkit.h (100%)
 rename {src => gnucash}/html/gnc-html-webkit1.c (100%)
 rename {src => gnucash}/html/gnc-html-webkit1.h (100%)
 rename {src => gnucash}/html/gnc-html-webkit2.c (100%)
 rename {src => gnucash}/html/gnc-html-webkit2.h (100%)
 rename {src => gnucash}/html/gnc-html.c (100%)
 rename {src => gnucash}/html/gnc-html.h (100%)
 rename {src => gnucash}/html/gnc-html.i (100%)
 rename {src => gnucash}/html/gncmod-html.c (100%)
 create mode 100644 gnucash/import-export/CMakeLists.txt
 create mode 100644 gnucash/import-export/Makefile.am
 create mode 100644 gnucash/import-export/aqb/CMakeLists.txt
 create mode 100644 gnucash/import-export/aqb/Makefile.am
 rename {src => gnucash}/import-export/aqb/assistant-ab-initial.c (100%)
 rename {src => gnucash}/import-export/aqb/assistant-ab-initial.glade (100%)
 rename {src => gnucash}/import-export/aqb/assistant-ab-initial.h (100%)
 rename {src => gnucash}/import-export/aqb/dialog-ab-daterange.c (100%)
 rename {src => gnucash}/import-export/aqb/dialog-ab-daterange.h (100%)
 rename {src => gnucash}/import-export/aqb/dialog-ab-pref.glade (100%)
 rename {src => gnucash}/import-export/aqb/dialog-ab-trans.c (100%)
 rename {src => gnucash}/import-export/aqb/dialog-ab-trans.h (100%)
 rename {src => gnucash}/import-export/aqb/dialog-ab.glade (100%)
 rename {src => gnucash}/import-export/aqb/gnc-ab-getbalance.c (100%)
 rename {src => gnucash}/import-export/aqb/gnc-ab-getbalance.h (100%)
 rename {src => gnucash}/import-export/aqb/gnc-ab-gettrans.c (100%)
 rename {src => gnucash}/import-export/aqb/gnc-ab-gettrans.h (100%)
 rename {src => gnucash}/import-export/aqb/gnc-ab-kvp.c (100%)
 rename {src => gnucash}/import-export/aqb/gnc-ab-kvp.h (100%)
 rename {src => gnucash}/import-export/aqb/gnc-ab-transfer.c (100%)
 rename {src => gnucash}/import-export/aqb/gnc-ab-transfer.h (100%)
 rename {src => gnucash}/import-export/aqb/gnc-ab-utils.c (100%)
 rename {src => gnucash}/import-export/aqb/gnc-ab-utils.h (100%)
 rename {src => gnucash}/import-export/aqb/gnc-file-aqb-import.c (100%)
 rename {src => gnucash}/import-export/aqb/gnc-file-aqb-import.h (100%)
 rename {src => gnucash}/import-export/aqb/gnc-gwen-gui.c (100%)
 rename {src => gnucash}/import-export/aqb/gnc-gwen-gui.h (100%)
 rename {src => gnucash}/import-export/aqb/gnc-plugin-aqbanking-ui.xml (100%)
 rename {src => gnucash}/import-export/aqb/gnc-plugin-aqbanking.c (100%)
 rename {src => gnucash}/import-export/aqb/gnc-plugin-aqbanking.h (100%)
 rename {src => gnucash}/import-export/aqb/gncmod-aqbanking.c (100%)
 rename {src => gnucash}/import-export/aqb/gschemas/CMakeLists.txt (100%)
 rename {src => gnucash}/import-export/aqb/gschemas/Makefile.am (100%)
 rename {src => gnucash}/import-export/aqb/gschemas/org.gnucash.dialogs.import.hbci.gschema.xml.in.in (100%)
 rename {src => gnucash}/import-export/aqb/migratable-prefs-aqbanking.xml (100%)
 create mode 100644 gnucash/import-export/aqb/test/CMakeLists.txt
 create mode 100644 gnucash/import-export/aqb/test/Makefile.am
 rename {src => gnucash}/import-export/aqb/test/file-book-hbcislot.gnucash (100%)
 rename {src => gnucash}/import-export/aqb/test/file-book.gnucash (100%)
 create mode 100644 gnucash/import-export/aqb/test/test-aqb.c
 create mode 100644 gnucash/import-export/aqb/test/test-kvp.c
 create mode 100644 gnucash/import-export/bi-import/CMakeLists.txt
 create mode 100644 gnucash/import-export/bi-import/Makefile.am
 rename {src/plugins/bi_import => gnucash/import-export/bi-import}/README (100%)
 rename {src/plugins/bi_import => gnucash/import-export/bi-import}/dialog-bi-import-gui.c (100%)
 rename {src/plugins/bi_import => gnucash/import-export/bi-import}/dialog-bi-import-gui.h (100%)
 rename {src/plugins/bi_import => gnucash/import-export/bi-import}/dialog-bi-import-helper.c (100%)
 rename {src/plugins/bi_import => gnucash/import-export/bi-import}/dialog-bi-import-helper.h (100%)
 create mode 100644 gnucash/import-export/bi-import/dialog-bi-import.c
 rename {src/plugins/bi_import => gnucash/import-export/bi-import}/dialog-bi-import.h (100%)
 rename {src/plugins/bi_import => gnucash/import-export/bi-import}/gnc-plugin-bi-import.c (100%)
 create mode 100644 gnucash/import-export/bi-import/gnc-plugin-bi-import.h
 create mode 100644 gnucash/import-export/bi-import/gncmod-bi-import.c
 rename {src/plugins/bi_import => gnucash/import-export/bi-import}/gtkbuilder/CMakeLists.txt (100%)
 rename {src/plugins/bi_import => gnucash/import-export/bi-import}/gtkbuilder/Makefile.am (100%)
 rename {src/plugins/bi_import => gnucash/import-export/bi-import}/gtkbuilder/dialog-bi-import-gui.glade (100%)
 rename {src/plugins/bi_import => gnucash/import-export/bi-import}/regex.txt (100%)
 rename {src/plugins/bi_import => gnucash/import-export/bi-import}/ui/CMakeLists.txt (100%)
 rename {src/plugins/bi_import => gnucash/import-export/bi-import}/ui/Makefile.am (100%)
 rename {src/plugins/bi_import => gnucash/import-export/bi-import}/ui/gnc-plugin-bi-import-ui.xml (100%)
 rename {src => gnucash}/import-export/csv-exp/CMakeLists.txt (100%)
 create mode 100644 gnucash/import-export/csv-exp/Makefile.am
 rename {src => gnucash}/import-export/csv-exp/assistant-csv-export.c (100%)
 rename {src => gnucash}/import-export/csv-exp/assistant-csv-export.glade (100%)
 rename {src => gnucash}/import-export/csv-exp/assistant-csv-export.h (100%)
 rename {src => gnucash}/import-export/csv-exp/csv-transactions-export.c (100%)
 rename {src => gnucash}/import-export/csv-exp/csv-transactions-export.h (100%)
 rename {src => gnucash}/import-export/csv-exp/csv-tree-export.c (100%)
 rename {src => gnucash}/import-export/csv-exp/csv-tree-export.h (100%)
 rename {src => gnucash}/import-export/csv-exp/gnc-plugin-csv-export-ui.xml (100%)
 rename {src => gnucash}/import-export/csv-exp/gnc-plugin-csv-export.c (100%)
 rename {src => gnucash}/import-export/csv-exp/gnc-plugin-csv-export.h (100%)
 rename {src => gnucash}/import-export/csv-exp/gncmod-csv-export.c (100%)
 rename {src => gnucash}/import-export/csv-exp/gschemas/CMakeLists.txt (100%)
 rename {src => gnucash}/import-export/csv-exp/gschemas/Makefile.am (100%)
 rename {src => gnucash}/import-export/csv-exp/gschemas/org.gnucash.dialogs.export.csv.gschema.xml.in.in (100%)
 rename {src => gnucash}/import-export/csv-imp/CMakeLists.txt (100%)
 create mode 100644 gnucash/import-export/csv-imp/Makefile.am
 rename {src => gnucash}/import-export/csv-imp/assistant-csv-account-import.c (100%)
 rename {src => gnucash}/import-export/csv-imp/assistant-csv-account-import.glade (100%)
 rename {src => gnucash}/import-export/csv-imp/assistant-csv-account-import.h (100%)
 rename {src => gnucash}/import-export/csv-imp/assistant-csv-trans-import.cpp (100%)
 rename {src => gnucash}/import-export/csv-imp/assistant-csv-trans-import.glade (100%)
 rename {src => gnucash}/import-export/csv-imp/assistant-csv-trans-import.h (100%)
 rename {src => gnucash}/import-export/csv-imp/csv-account-import.c (100%)
 rename {src => gnucash}/import-export/csv-imp/csv-account-import.h (100%)
 rename {src => gnucash}/import-export/csv-imp/gnc-csv-account-map.c (100%)
 rename {src => gnucash}/import-export/csv-imp/gnc-csv-account-map.h (100%)
 rename {src => gnucash}/import-export/csv-imp/gnc-csv-gnumeric-popup.c (100%)
 rename {src => gnucash}/import-export/csv-imp/gnc-csv-gnumeric-popup.h (100%)
 rename {src => gnucash}/import-export/csv-imp/gnc-csv-tokenizer.cpp (100%)
 rename {src => gnucash}/import-export/csv-imp/gnc-csv-tokenizer.hpp (100%)
 rename {src => gnucash}/import-export/csv-imp/gnc-csv-trans-settings.cpp (100%)
 rename {src => gnucash}/import-export/csv-imp/gnc-csv-trans-settings.hpp (100%)
 rename {src => gnucash}/import-export/csv-imp/gnc-dummy-tokenizer.cpp (100%)
 rename {src => gnucash}/import-export/csv-imp/gnc-dummy-tokenizer.hpp (100%)
 rename {src => gnucash}/import-export/csv-imp/gnc-fw-tokenizer.cpp (100%)
 rename {src => gnucash}/import-export/csv-imp/gnc-fw-tokenizer.hpp (100%)
 rename {src => gnucash}/import-export/csv-imp/gnc-plugin-csv-import-ui.xml (100%)
 rename {src => gnucash}/import-export/csv-imp/gnc-plugin-csv-import.c (100%)
 rename {src => gnucash}/import-export/csv-imp/gnc-plugin-csv-import.h (100%)
 rename {src => gnucash}/import-export/csv-imp/gnc-tokenizer.cpp (100%)
 rename {src => gnucash}/import-export/csv-imp/gnc-tokenizer.hpp (100%)
 rename {src => gnucash}/import-export/csv-imp/gnc-trans-props.cpp (100%)
 rename {src => gnucash}/import-export/csv-imp/gnc-trans-props.hpp (100%)
 rename {src => gnucash}/import-export/csv-imp/gnc-tx-import.cpp (100%)
 rename {src => gnucash}/import-export/csv-imp/gnc-tx-import.hpp (100%)
 rename {src => gnucash}/import-export/csv-imp/gncmod-csv-import.c (100%)
 rename {src => gnucash}/import-export/csv-imp/gschemas/CMakeLists.txt (100%)
 rename {src => gnucash}/import-export/csv-imp/gschemas/Makefile.am (100%)
 rename {src => gnucash}/import-export/csv-imp/gschemas/org.gnucash.dialogs.import.csv.gschema.xml.in.in (100%)
 create mode 100644 gnucash/import-export/csv-imp/test/CMakeLists.txt
 create mode 100644 gnucash/import-export/csv-imp/test/Makefile.am
 rename {src => gnucash}/import-export/csv-imp/test/sample1.csv (100%)
 rename {src => gnucash}/import-export/csv-imp/test/test-tokenizer.cpp (100%)
 rename {src => gnucash}/import-export/csv-imp/test/test-tx-import.cpp (100%)
 create mode 100644 gnucash/import-export/customer-import/CMakeLists.txt
 create mode 100644 gnucash/import-export/customer-import/Makefile.am
 create mode 100644 gnucash/import-export/customer-import/dialog-customer-import-gui.c
 rename {src/plugins/customer_import => gnucash/import-export/customer-import}/dialog-customer-import-gui.h (100%)
 rename {src/plugins/customer_import => gnucash/import-export/customer-import}/dialog-customer-import.c (100%)
 create mode 100644 gnucash/import-export/customer-import/dialog-customer-import.h
 create mode 100644 gnucash/import-export/customer-import/gnc-plugin-customer-import.c
 create mode 100644 gnucash/import-export/customer-import/gnc-plugin-customer-import.h
 create mode 100644 gnucash/import-export/customer-import/gncmod-customer-import.c
 rename {src/plugins/customer_import => gnucash/import-export/customer-import}/gtkbuilder/CMakeLists.txt (100%)
 rename {src/plugins/customer_import => gnucash/import-export/customer-import}/gtkbuilder/Makefile.am (100%)
 rename {src/plugins/customer_import => gnucash/import-export/customer-import}/gtkbuilder/dialog-customer-import-gui.glade (100%)
 create mode 100644 gnucash/import-export/customer-import/ui/CMakeLists.txt
 create mode 100644 gnucash/import-export/customer-import/ui/Makefile.am
 create mode 100644 gnucash/import-export/customer-import/ui/gnc-plugin-customer-import-ui.xml
 rename {src => gnucash}/import-export/dialog-import.glade (100%)
 rename {src => gnucash}/import-export/generic-import-design.txt (100%)
 rename {src => gnucash}/import-export/gncmod-generic-import.c (100%)
 rename {src => gnucash}/import-export/gschemas/CMakeLists.txt (100%)
 rename {src => gnucash}/import-export/gschemas/Makefile.am (100%)
 rename {src => gnucash}/import-export/gschemas/org.gnucash.dialogs.import.generic.gschema.xml.in.in (100%)
 rename {src => gnucash}/import-export/import-account-matcher.c (100%)
 rename {src => gnucash}/import-export/import-account-matcher.h (100%)
 rename {src => gnucash}/import-export/import-backend.c (100%)
 rename {src => gnucash}/import-export/import-backend.h (100%)
 rename {src => gnucash}/import-export/import-commodity-matcher.c (100%)
 rename {src => gnucash}/import-export/import-commodity-matcher.h (100%)
 rename {src => gnucash}/import-export/import-format-dialog.c (100%)
 create mode 100644 gnucash/import-export/import-main-matcher.c
 rename {src => gnucash}/import-export/import-main-matcher.h (100%)
 rename {src => gnucash}/import-export/import-match-picker.c (100%)
 rename {src => gnucash}/import-export/import-match-picker.h (100%)
 rename {src => gnucash}/import-export/import-parse.c (100%)
 rename {src => gnucash}/import-export/import-parse.h (100%)
 rename {src => gnucash}/import-export/import-pending-matches.c (100%)
 rename {src => gnucash}/import-export/import-pending-matches.h (100%)
 rename {src => gnucash}/import-export/import-settings.c (100%)
 rename {src => gnucash}/import-export/import-settings.h (100%)
 rename {src => gnucash}/import-export/import-utilities.c (100%)
 rename {src => gnucash}/import-export/import-utilities.h (100%)
 create mode 100644 gnucash/import-export/log-replay/CMakeLists.txt
 create mode 100644 gnucash/import-export/log-replay/Makefile.am
 rename {src => gnucash}/import-export/log-replay/gnc-log-replay.c (100%)
 rename {src => gnucash}/import-export/log-replay/gnc-log-replay.h (100%)
 rename {src => gnucash}/import-export/log-replay/gnc-plugin-log-replay-ui.xml (100%)
 rename {src => gnucash}/import-export/log-replay/gnc-plugin-log-replay.c (100%)
 rename {src => gnucash}/import-export/log-replay/gnc-plugin-log-replay.h (100%)
 rename {src => gnucash}/import-export/log-replay/gncmod-log-replay.c (100%)
 create mode 100644 gnucash/import-export/ofx/CMakeLists.txt
 create mode 100644 gnucash/import-export/ofx/Makefile.am
 create mode 100644 gnucash/import-export/ofx/gnc-ofx-import.c
 rename {src => gnucash}/import-export/ofx/gnc-ofx-import.h (100%)
 rename {src => gnucash}/import-export/ofx/gnc-ofx-kvp.c (100%)
 create mode 100644 gnucash/import-export/ofx/gnc-ofx-kvp.h
 rename {src => gnucash}/import-export/ofx/gnc-plugin-ofx-ui.xml (100%)
 rename {src => gnucash}/import-export/ofx/gnc-plugin-ofx.c (100%)
 rename {src => gnucash}/import-export/ofx/gnc-plugin-ofx.h (100%)
 rename {src => gnucash}/import-export/ofx/gncmod-ofx-import.c (100%)
 rename {src => gnucash}/import-export/ofx/gschemas/CMakeLists.txt (100%)
 rename {src => gnucash}/import-export/ofx/gschemas/Makefile.am (100%)
 rename {src => gnucash}/import-export/ofx/gschemas/org.gnucash.dialogs.import.ofx.gschema.xml.in.in (100%)
 rename {src => gnucash}/import-export/ofx/migratable-prefs-ofx.xml (100%)
 rename {src => gnucash}/import-export/ofx/test/CMakeLists.txt (100%)
 create mode 100644 gnucash/import-export/ofx/test/Makefile.am
 rename {src => gnucash}/import-export/ofx/test/test-link.c (100%)
 create mode 100644 gnucash/import-export/qif-imp/CMakeLists.txt
 create mode 100644 gnucash/import-export/qif-imp/Makefile.am
 rename {src => gnucash}/import-export/qif-imp/assistant-qif-import.c (100%)
 rename {src => gnucash}/import-export/qif-imp/assistant-qif-import.glade (100%)
 rename {src => gnucash}/import-export/qif-imp/assistant-qif-import.h (100%)
 rename {src => gnucash}/import-export/qif-imp/dialog-account-picker.c (100%)
 rename {src => gnucash}/import-export/qif-imp/dialog-account-picker.glade (100%)
 rename {src => gnucash}/import-export/qif-imp/dialog-account-picker.h (100%)
 rename {src => gnucash}/import-export/qif-imp/file-format.txt (100%)
 rename {src => gnucash}/import-export/qif-imp/gnc-plugin-qif-import-ui.xml (100%)
 rename {src => gnucash}/import-export/qif-imp/gnc-plugin-qif-import.c (100%)
 rename {src => gnucash}/import-export/qif-imp/gnc-plugin-qif-import.h (100%)
 rename {src => gnucash}/import-export/qif-imp/gncmod-qif-import.c (100%)
 rename {src => gnucash}/import-export/qif-imp/gschemas/CMakeLists.txt (100%)
 rename {src => gnucash}/import-export/qif-imp/gschemas/Makefile.am (100%)
 rename {src => gnucash}/import-export/qif-imp/gschemas/org.gnucash.dialogs.import.qif.gschema.xml.in.in (100%)
 rename {src => gnucash}/import-export/qif-imp/qif-dialog-utils.scm (100%)
 rename {src => gnucash}/import-export/qif-imp/qif-file.scm (100%)
 rename {src => gnucash}/import-export/qif-imp/qif-guess-map.scm (100%)
 rename {src => gnucash}/import-export/qif-imp/qif-import.scm (100%)
 rename {src => gnucash}/import-export/qif-imp/qif-merge-groups.scm (100%)
 rename {src => gnucash}/import-export/qif-imp/qif-objects.scm (100%)
 rename {src => gnucash}/import-export/qif-imp/qif-parse.scm (100%)
 rename {src => gnucash}/import-export/qif-imp/qif-to-gnc.scm (100%)
 rename {src => gnucash}/import-export/qif-imp/qif-utils.scm (100%)
 rename {src => gnucash}/import-export/qif-imp/test/CMakeLists.txt (100%)
 create mode 100644 gnucash/import-export/qif-imp/test/Makefile.am
 rename {src => gnucash}/import-export/qif-imp/test/test-link.c (100%)
 create mode 100644 gnucash/import-export/qif/CMakeLists.txt
 create mode 100644 gnucash/import-export/qif/Makefile.am
 rename {src => gnucash}/import-export/qif/qif-context.c (100%)
 rename {src => gnucash}/import-export/qif/qif-defaults.c (100%)
 rename {src => gnucash}/import-export/qif/qif-defaults.h (100%)
 rename {src => gnucash}/import-export/qif/qif-file.c (100%)
 rename {src => gnucash}/import-export/qif/qif-file.h (100%)
 rename {src => gnucash}/import-export/qif/qif-import-p.h (100%)
 rename {src => gnucash}/import-export/qif/qif-import.h (100%)
 rename {src => gnucash}/import-export/qif/qif-objects-p.h (100%)
 rename {src => gnucash}/import-export/qif/qif-objects.c (100%)
 rename {src => gnucash}/import-export/qif/qif-objects.h (100%)
 rename {src => gnucash}/import-export/qif/qif-parse.c (100%)
 rename {src => gnucash}/import-export/qif/qif-parse.h (100%)
 create mode 100644 gnucash/import-export/qif/test/CMakeLists.txt
 create mode 100644 gnucash/import-export/qif/test/Makefile.am
 rename {src => gnucash}/import-export/qif/test/test-files/test-1-bank-txn.qif (100%)
 rename {src => gnucash}/import-export/qif/test/test-link.c (100%)
 rename {src => gnucash}/import-export/qif/test/test-qif.c (100%)
 create mode 100644 gnucash/import-export/test/CMakeLists.txt
 create mode 100644 gnucash/import-export/test/Makefile.am
 rename {src => gnucash}/import-export/test/test-import-parse.c (100%)
 rename {src => gnucash}/import-export/test/test-import-pending-matches.c (100%)
 rename {src => gnucash}/import-export/test/test-link.c (100%)
 rename {src/bin => gnucash}/overrides/CMakeLists.txt (100%)
 rename {src/bin => gnucash}/overrides/Makefile.am (100%)
 create mode 100644 gnucash/overrides/gnucash-build-env.in
 rename {src/bin => gnucash}/overrides/gnucash-env.in (100%)
 rename {src/bin => gnucash}/overrides/gnucash-make-guids.in (100%)
 rename {src/bin => gnucash}/overrides/guile.in (100%)
 rename {src => gnucash}/python/CMakeLists.txt (100%)
 create mode 100644 gnucash/python/Makefile.am
 rename {src => gnucash}/python/gncmod-python.c (100%)
 rename {src => gnucash}/python/init.py (100%)
 rename {src => gnucash}/python/pycons/CMakeLists.txt (100%)
 rename {src => gnucash}/python/pycons/Makefile.am (100%)
 rename {src => gnucash}/python/pycons/__init__.py (100%)
 rename {src => gnucash}/python/pycons/console.py (100%)
 rename {src => gnucash}/python/pycons/ishell.py (100%)
 rename {src => gnucash}/python/pycons/pycons (100%)
 rename {src => gnucash}/python/pycons/setup.py (100%)
 rename {src => gnucash}/python/pycons/shell.py (100%)
 rename {src => gnucash}/python/pycons/simple_plot.py (100%)
 rename {src => gnucash}/register/CMakeLists.txt (100%)
 create mode 100644 gnucash/register/Makefile.am
 create mode 100644 gnucash/register/ledger-core/CMakeLists.txt
 create mode 100644 gnucash/register/ledger-core/Makefile.am
 rename {src => gnucash}/register/ledger-core/gnc-ledger-display.c (100%)
 rename {src => gnucash}/register/ledger-core/gnc-ledger-display.h (100%)
 rename {src => gnucash}/register/ledger-core/gnc-ledger-display2.c (100%)
 rename {src => gnucash}/register/ledger-core/gnc-ledger-display2.h (100%)
 create mode 100644 gnucash/register/ledger-core/gncEntryLedger.c
 rename {src/business/business-ledger => gnucash/register/ledger-core}/gncEntryLedger.h (100%)
 create mode 100644 gnucash/register/ledger-core/gncEntryLedgerControl.c
 rename {src/business/business-ledger => gnucash/register/ledger-core}/gncEntryLedgerControl.h (100%)
 rename {src/business/business-ledger => gnucash/register/ledger-core}/gncEntryLedgerDisplay.c (100%)
 create mode 100644 gnucash/register/ledger-core/gncEntryLedgerLayout.c
 rename {src/business/business-ledger => gnucash/register/ledger-core}/gncEntryLedgerLayout.h (100%)
 create mode 100644 gnucash/register/ledger-core/gncEntryLedgerLoad.c
 rename {src/business/business-ledger => gnucash/register/ledger-core}/gncEntryLedgerModel.c (100%)
 rename {src/business/business-ledger => gnucash/register/ledger-core}/gncEntryLedgerModel.h (100%)
 rename {src/business/business-ledger => gnucash/register/ledger-core}/gncEntryLedgerP.h (100%)
 rename {src => gnucash}/register/ledger-core/gncmod-ledger-core.c (100%)
 create mode 100644 gnucash/register/ledger-core/split-register-control.c
 rename {src => gnucash}/register/ledger-core/split-register-control.h (100%)
 rename {src => gnucash}/register/ledger-core/split-register-layout.c (100%)
 rename {src => gnucash}/register/ledger-core/split-register-layout.h (100%)
 rename {src => gnucash}/register/ledger-core/split-register-load.c (100%)
 create mode 100644 gnucash/register/ledger-core/split-register-model-save.c
 rename {src => gnucash}/register/ledger-core/split-register-model-save.h (100%)
 create mode 100644 gnucash/register/ledger-core/split-register-model.c
 rename {src => gnucash}/register/ledger-core/split-register-model.h (100%)
 rename {src => gnucash}/register/ledger-core/split-register-p.h (100%)
 rename {src => gnucash}/register/ledger-core/split-register-util.c (100%)
 create mode 100644 gnucash/register/ledger-core/split-register.c
 rename {src => gnucash}/register/ledger-core/split-register.h (100%)
 rename {src => gnucash}/register/ledger-core/test/CMakeLists.txt (100%)
 create mode 100644 gnucash/register/ledger-core/test/Makefile.am
 rename {src => gnucash}/register/ledger-core/test/test-link-module.c (100%)
 create mode 100644 gnucash/register/register-core/CMakeLists.txt
 create mode 100644 gnucash/register/register-core/Makefile.am
 rename {src => gnucash}/register/register-core/README (100%)
 rename {src => gnucash}/register/register-core/basiccell.c (100%)
 rename {src => gnucash}/register/register-core/basiccell.h (100%)
 rename {src => gnucash}/register/register-core/cell-factory.c (100%)
 rename {src => gnucash}/register/register-core/cell-factory.h (100%)
 rename {src => gnucash}/register/register-core/cellblock.c (100%)
 rename {src => gnucash}/register/register-core/cellblock.h (100%)
 rename {src => gnucash}/register/register-core/checkboxcell.c (100%)
 rename {src => gnucash}/register/register-core/checkboxcell.h (100%)
 rename {src => gnucash}/register/register-core/combocell.h (100%)
 rename {src => gnucash}/register/register-core/datecell.h (100%)
 rename {src => gnucash}/register/register-core/formulacell.c (100%)
 rename {src => gnucash}/register/register-core/formulacell.h (100%)
 rename {src => gnucash}/register/register-core/gncmod-register-core.c (100%)
 rename {src => gnucash}/register/register-core/gtable.c (100%)
 rename {src => gnucash}/register/register-core/gtable.h (100%)
 rename {src => gnucash}/register/register-core/numcell.c (100%)
 rename {src => gnucash}/register/register-core/numcell.h (100%)
 rename {src => gnucash}/register/register-core/pricecell.c (100%)
 rename {src => gnucash}/register/register-core/pricecell.h (100%)
 rename {src => gnucash}/register/register-core/quickfillcell.c (100%)
 rename {src => gnucash}/register/register-core/quickfillcell.h (100%)
 rename {src => gnucash}/register/register-core/recncell.c (100%)
 rename {src => gnucash}/register/register-core/recncell.h (100%)
 rename {src => gnucash}/register/register-core/register-common.c (100%)
 rename {src => gnucash}/register/register-core/register-common.h (100%)
 rename {src => gnucash}/register/register-core/table-allgui.c (100%)
 rename {src => gnucash}/register/register-core/table-allgui.h (100%)
 rename {src => gnucash}/register/register-core/table-control.c (100%)
 rename {src => gnucash}/register/register-core/table-control.h (100%)
 rename {src => gnucash}/register/register-core/table-layout.c (100%)
 rename {src => gnucash}/register/register-core/table-layout.h (100%)
 rename {src => gnucash}/register/register-core/table-model.c (100%)
 rename {src => gnucash}/register/register-core/table-model.h (100%)
 rename {src => gnucash}/register/register-core/test/CMakeLists.txt (100%)
 create mode 100644 gnucash/register/register-core/test/Makefile.am
 rename {src => gnucash}/register/register-core/test/test-link-module.c (100%)
 create mode 100644 gnucash/register/register-gnome/CMakeLists.txt
 create mode 100644 gnucash/register/register-gnome/Makefile.am
 rename {src => gnucash}/register/register-gnome/combocell-gnome.c (100%)
 rename {src => gnucash}/register/register-gnome/datecell-gnome.c (100%)
 rename {src => gnucash}/register/register-gnome/formulacell-gnome.c (100%)
 rename {src => gnucash}/register/register-gnome/formulacell-gnome.h (100%)
 rename {src => gnucash}/register/register-gnome/gncmod-register-gnome.c (100%)
 rename {src => gnucash}/register/register-gnome/gnucash-color.c (100%)
 rename {src => gnucash}/register/register-gnome/gnucash-color.h (100%)
 rename {src => gnucash}/register/register-gnome/gnucash-cursor.c (100%)
 rename {src => gnucash}/register/register-gnome/gnucash-cursor.h (100%)
 rename {src => gnucash}/register/register-gnome/gnucash-date-picker.c (100%)
 rename {src => gnucash}/register/register-gnome/gnucash-date-picker.h (100%)
 rename {src => gnucash}/register/register-gnome/gnucash-header.c (100%)
 rename {src => gnucash}/register/register-gnome/gnucash-header.h (100%)
 rename {src => gnucash}/register/register-gnome/gnucash-item-edit.c (100%)
 rename {src => gnucash}/register/register-gnome/gnucash-item-edit.h (100%)
 rename {src => gnucash}/register/register-gnome/gnucash-item-list.c (100%)
 rename {src => gnucash}/register/register-gnome/gnucash-item-list.h (100%)
 rename {src => gnucash}/register/register-gnome/gnucash-register.c (100%)
 rename {src => gnucash}/register/register-gnome/gnucash-register.h (100%)
 rename {src => gnucash}/register/register-gnome/gnucash-scrolled-window.c (100%)
 rename {src => gnucash}/register/register-gnome/gnucash-scrolled-window.h (100%)
 rename {src => gnucash}/register/register-gnome/gnucash-sheet-private.c (100%)
 rename {src => gnucash}/register/register-gnome/gnucash-sheet.c (100%)
 rename {src => gnucash}/register/register-gnome/gnucash-sheet.h (100%)
 rename {src => gnucash}/register/register-gnome/gnucash-sheetP.h (100%)
 rename {src => gnucash}/register/register-gnome/gnucash-style.c (100%)
 rename {src => gnucash}/register/register-gnome/gnucash-style.h (100%)
 rename {src => gnucash}/register/register-gnome/pricecell-gnome.c (100%)
 rename {src => gnucash}/register/register-gnome/pricecell-gnome.h (100%)
 rename {src => gnucash}/register/register-gnome/quickfillcell-gnome.c (100%)
 rename {src => gnucash}/register/register-gnome/quickfillcell-gnome.h (100%)
 rename {src => gnucash}/register/register-gnome/table-gnome.c (100%)
 rename {src => gnucash}/register/register-gnome/table-gnome.h (100%)
 rename {src => gnucash}/register/register-gnome/test/CMakeLists.txt (100%)
 create mode 100644 gnucash/register/register-gnome/test/Makefile.am
 rename {src => gnucash}/register/register-gnome/test/test-link-module.c (100%)
 rename {src => gnucash}/report/CMakeLists.txt (100%)
 rename {src => gnucash}/report/Makefile.am (100%)
 create mode 100644 gnucash/report/business-reports/CMakeLists.txt
 create mode 100644 gnucash/report/business-reports/Makefile.am
 rename {src => gnucash}/report/business-reports/aging.scm (100%)
 rename {src => gnucash}/report/business-reports/balsheet-eg.css (100%)
 rename {src => gnucash}/report/business-reports/balsheet-eg.eguile.scm (100%)
 rename {src => gnucash}/report/business-reports/balsheet-eg.scm (100%)
 create mode 100644 gnucash/report/business-reports/business-reports.scm
 rename {src => gnucash}/report/business-reports/customer-summary.scm (100%)
 rename {src => gnucash}/report/business-reports/easy-invoice.scm (100%)
 rename {src => gnucash}/report/business-reports/fancy-invoice.scm (100%)
 rename {src => gnucash}/report/business-reports/invoice.scm (100%)
 rename {src => gnucash}/report/business-reports/job-report.scm (100%)
 rename {src => gnucash}/report/business-reports/owner-report.scm (100%)
 rename {src => gnucash}/report/business-reports/payables.scm (100%)
 rename {src => gnucash}/report/business-reports/receipt.css (100%)
 rename {src => gnucash}/report/business-reports/receipt.eguile.scm (100%)
 rename {src => gnucash}/report/business-reports/receipt.scm (100%)
 rename {src => gnucash}/report/business-reports/receivables.scm (100%)
 rename {src => gnucash}/report/business-reports/taxinvoice.css (100%)
 rename {src => gnucash}/report/business-reports/taxinvoice.eguile.scm (100%)
 rename {src => gnucash}/report/business-reports/taxinvoice.scm (100%)
 rename {src => gnucash}/report/jqplot/CMakeLists.txt (100%)
 rename {src => gnucash}/report/jqplot/MIT-LICENSE.txt (100%)
 rename {src => gnucash}/report/jqplot/Makefile.am (100%)
 rename {src => gnucash}/report/jqplot/README.txt (100%)
 rename {src => gnucash}/report/jqplot/changes.txt (100%)
 rename {src => gnucash}/report/jqplot/copyright.txt (100%)
 rename {src => gnucash}/report/jqplot/excanvas.js (100%)
 rename {src => gnucash}/report/jqplot/excanvas.min.js (100%)
 rename {src => gnucash}/report/jqplot/gpl-2.0.txt (100%)
 rename {src => gnucash}/report/jqplot/jqPlotCssStyling.txt (100%)
 rename {src => gnucash}/report/jqplot/jqPlotOptions.txt (100%)
 rename {src => gnucash}/report/jqplot/jquery-1.4.2.min.js (100%)
 rename {src => gnucash}/report/jqplot/jquery.jqplot.css (100%)
 rename {src => gnucash}/report/jqplot/jquery.jqplot.js (100%)
 rename {src => gnucash}/report/jqplot/jquery.jqplot.min.css (100%)
 rename {src => gnucash}/report/jqplot/jquery.jqplot.min.js (100%)
 rename {src => gnucash}/report/jqplot/jquery.js (100%)
 rename {src => gnucash}/report/jqplot/jquery.min.js (100%)
 rename {src => gnucash}/report/jqplot/optionsTutorial.txt (100%)
 rename {src => gnucash}/report/jqplot/plugins/jqplot.BezierCurveRenderer.js (100%)
 rename {src => gnucash}/report/jqplot/plugins/jqplot.BezierCurveRenderer.min.js (100%)
 rename {src => gnucash}/report/jqplot/plugins/jqplot.barRenderer.js (100%)
 rename {src => gnucash}/report/jqplot/plugins/jqplot.barRenderer.min.js (100%)
 rename {src => gnucash}/report/jqplot/plugins/jqplot.blockRenderer.js (100%)
 rename {src => gnucash}/report/jqplot/plugins/jqplot.blockRenderer.min.js (100%)
 rename {src => gnucash}/report/jqplot/plugins/jqplot.bubbleRenderer.js (100%)
 rename {src => gnucash}/report/jqplot/plugins/jqplot.bubbleRenderer.min.js (100%)
 rename {src => gnucash}/report/jqplot/plugins/jqplot.canvasAxisLabelRenderer.js (100%)
 rename {src => gnucash}/report/jqplot/plugins/jqplot.canvasAxisLabelRenderer.min.js (100%)
 rename {src => gnucash}/report/jqplot/plugins/jqplot.canvasAxisTickRenderer.js (100%)
 rename {src => gnucash}/report/jqplot/plugins/jqplot.canvasAxisTickRenderer.min.js (100%)
 rename {src => gnucash}/report/jqplot/plugins/jqplot.canvasOverlay.js (100%)
 rename {src => gnucash}/report/jqplot/plugins/jqplot.canvasOverlay.min.js (100%)
 rename {src => gnucash}/report/jqplot/plugins/jqplot.canvasTextRenderer.js (100%)
 rename {src => gnucash}/report/jqplot/plugins/jqplot.canvasTextRenderer.min.js (100%)
 rename {src => gnucash}/report/jqplot/plugins/jqplot.categoryAxisRenderer.js (100%)
 rename {src => gnucash}/report/jqplot/plugins/jqplot.categoryAxisRenderer.min.js (100%)
 rename {src => gnucash}/report/jqplot/plugins/jqplot.ciParser.js (100%)
 rename {src => gnucash}/report/jqplot/plugins/jqplot.ciParser.min.js (100%)
 rename {src => gnucash}/report/jqplot/plugins/jqplot.cursor.js (100%)
 rename {src => gnucash}/report/jqplot/plugins/jqplot.cursor.min.js (100%)
 rename {src => gnucash}/report/jqplot/plugins/jqplot.dateAxisRenderer.js (100%)
 rename {src => gnucash}/report/jqplot/plugins/jqplot.dateAxisRenderer.min.js (100%)
 rename {src => gnucash}/report/jqplot/plugins/jqplot.donutRenderer.js (100%)
 rename {src => gnucash}/report/jqplot/plugins/jqplot.donutRenderer.min.js (100%)
 rename {src => gnucash}/report/jqplot/plugins/jqplot.dragable.js (100%)
 rename {src => gnucash}/report/jqplot/plugins/jqplot.dragable.min.js (100%)
 rename {src => gnucash}/report/jqplot/plugins/jqplot.enhancedLegendRenderer.js (100%)
 rename {src => gnucash}/report/jqplot/plugins/jqplot.enhancedLegendRenderer.min.js (100%)
 rename {src => gnucash}/report/jqplot/plugins/jqplot.funnelRenderer.js (100%)
 rename {src => gnucash}/report/jqplot/plugins/jqplot.funnelRenderer.min.js (100%)
 rename {src => gnucash}/report/jqplot/plugins/jqplot.highlighter.js (100%)
 rename {src => gnucash}/report/jqplot/plugins/jqplot.highlighter.min.js (100%)
 rename {src => gnucash}/report/jqplot/plugins/jqplot.json2.js (100%)
 rename {src => gnucash}/report/jqplot/plugins/jqplot.json2.min.js (100%)
 rename {src => gnucash}/report/jqplot/plugins/jqplot.logAxisRenderer.js (100%)
 rename {src => gnucash}/report/jqplot/plugins/jqplot.logAxisRenderer.min.js (100%)
 rename {src => gnucash}/report/jqplot/plugins/jqplot.mekkoAxisRenderer.js (100%)
 rename {src => gnucash}/report/jqplot/plugins/jqplot.mekkoAxisRenderer.min.js (100%)
 rename {src => gnucash}/report/jqplot/plugins/jqplot.mekkoRenderer.js (100%)
 rename {src => gnucash}/report/jqplot/plugins/jqplot.mekkoRenderer.min.js (100%)
 rename {src => gnucash}/report/jqplot/plugins/jqplot.meterGaugeRenderer.js (100%)
 rename {src => gnucash}/report/jqplot/plugins/jqplot.meterGaugeRenderer.min.js (100%)
 rename {src => gnucash}/report/jqplot/plugins/jqplot.mobile.js (100%)
 rename {src => gnucash}/report/jqplot/plugins/jqplot.mobile.min.js (100%)
 rename {src => gnucash}/report/jqplot/plugins/jqplot.ohlcRenderer.js (100%)
 rename {src => gnucash}/report/jqplot/plugins/jqplot.ohlcRenderer.min.js (100%)
 rename {src => gnucash}/report/jqplot/plugins/jqplot.pieRenderer.js (100%)
 rename {src => gnucash}/report/jqplot/plugins/jqplot.pieRenderer.min.js (100%)
 rename {src => gnucash}/report/jqplot/plugins/jqplot.pointLabels.js (100%)
 rename {src => gnucash}/report/jqplot/plugins/jqplot.pointLabels.min.js (100%)
 rename {src => gnucash}/report/jqplot/plugins/jqplot.pyramidAxisRenderer.js (100%)
 rename {src => gnucash}/report/jqplot/plugins/jqplot.pyramidAxisRenderer.min.js (100%)
 rename {src => gnucash}/report/jqplot/plugins/jqplot.pyramidGridRenderer.js (100%)
 rename {src => gnucash}/report/jqplot/plugins/jqplot.pyramidGridRenderer.min.js (100%)
 rename {src => gnucash}/report/jqplot/plugins/jqplot.pyramidRenderer.js (100%)
 rename {src => gnucash}/report/jqplot/plugins/jqplot.pyramidRenderer.min.js (100%)
 rename {src => gnucash}/report/jqplot/plugins/jqplot.trendline.js (100%)
 rename {src => gnucash}/report/jqplot/plugins/jqplot.trendline.min.js (100%)
 rename {src => gnucash}/report/jqplot/usage.txt (100%)
 rename {src => gnucash}/report/locale-specific/CMakeLists.txt (100%)
 rename {src => gnucash}/report/locale-specific/Makefile.am (100%)
 create mode 100644 gnucash/report/locale-specific/us/CMakeLists.txt
 create mode 100644 gnucash/report/locale-specific/us/Makefile.am
 rename {src => gnucash}/report/locale-specific/us/de_DE.scm (100%)
 rename {src => gnucash}/report/locale-specific/us/gncmod-locale-reports-us.c (100%)
 rename {src => gnucash}/report/locale-specific/us/taxtxf-de_DE.scm (100%)
 rename {src => gnucash}/report/locale-specific/us/taxtxf.scm (100%)
 rename {src => gnucash}/report/locale-specific/us/test/CMakeLists.txt (100%)
 create mode 100644 gnucash/report/locale-specific/us/test/Makefile.am
 rename {src => gnucash}/report/locale-specific/us/test/test-link-module.c (100%)
 rename {src => gnucash}/report/locale-specific/us/test/test-load-module.in (100%)
 rename {src => gnucash}/report/locale-specific/us/us.scm (100%)
 create mode 100644 gnucash/report/report-gnome/CMakeLists.txt
 create mode 100644 gnucash/report/report-gnome/Makefile.am
 rename {src => gnucash}/report/report-gnome/dialog-custom-report.c (100%)
 rename {src => gnucash}/report/report-gnome/dialog-custom-report.glade (100%)
 rename {src => gnucash}/report/report-gnome/dialog-custom-report.h (100%)
 create mode 100644 gnucash/report/report-gnome/dialog-report-column-view.c
 rename {src => gnucash}/report/report-gnome/dialog-report-column-view.h (100%)
 create mode 100644 gnucash/report/report-gnome/dialog-report-style-sheet.c
 rename {src => gnucash}/report/report-gnome/dialog-report-style-sheet.h (100%)
 rename {src => gnucash}/report/report-gnome/dialog-report.glade (100%)
 rename {src => gnucash}/report/report-gnome/gnc-plugin-page-report-ui.xml (100%)
 create mode 100644 gnucash/report/report-gnome/gnc-plugin-page-report.c
 rename {src => gnucash}/report/report-gnome/gnc-plugin-page-report.h (100%)
 create mode 100644 gnucash/report/report-gnome/gncmod-report-gnome.c
 rename {src => gnucash}/report/report-gnome/report-gnome.i (100%)
 create mode 100644 gnucash/report/report-gnome/report-gnome.scm
 create mode 100644 gnucash/report/report-gnome/test/CMakeLists.txt
 create mode 100644 gnucash/report/report-gnome/test/Makefile.am
 rename {src => gnucash}/report/report-gnome/test/test-link-module.c (100%)
 rename {src => gnucash}/report/report-gnome/test/test-load-module.in (100%)
 create mode 100644 gnucash/report/report-gnome/window-report.c
 create mode 100644 gnucash/report/report-gnome/window-report.h
 create mode 100644 gnucash/report/report-system/CMakeLists.txt
 create mode 100644 gnucash/report/report-system/Makefile.am
 rename {src => gnucash}/report/report-system/collectors.scm (100%)
 rename {src => gnucash}/report/report-system/commodity-utilities.scm (100%)
 rename {src => gnucash}/report/report-system/doc/report-html.txt (100%)
 rename {src => gnucash}/report/report-system/eguile-gnc.scm (100%)
 rename {src => gnucash}/report/report-system/eguile-html-utilities.scm (100%)
 rename {src => gnucash}/report/report-system/eguile-utilities.scm (100%)
 rename {src => gnucash}/report/report-system/gnc-report.c (100%)
 rename {src => gnucash}/report/report-system/gnc-report.h (100%)
 rename {src => gnucash}/report/report-system/gncmod-report-system.c (100%)
 rename {src => gnucash}/report/report-system/html-acct-table.scm (100%)
 rename {src => gnucash}/report/report-system/html-barchart.scm (100%)
 rename {src => gnucash}/report/report-system/html-document.scm (100%)
 rename {src => gnucash}/report/report-system/html-fonts.scm (100%)
 rename {src => gnucash}/report/report-system/html-jqplot.scm (100%)
 rename {src => gnucash}/report/report-system/html-linechart.scm (100%)
 rename {src => gnucash}/report/report-system/html-piechart.scm (100%)
 rename {src => gnucash}/report/report-system/html-scatter.scm (100%)
 rename {src => gnucash}/report/report-system/html-style-info.scm (100%)
 rename {src => gnucash}/report/report-system/html-style-sheet.scm (100%)
 rename {src => gnucash}/report/report-system/html-table.scm (100%)
 rename {src => gnucash}/report/report-system/html-text.scm (100%)
 rename {src => gnucash}/report/report-system/html-utilities.scm (100%)
 rename {src => gnucash}/report/report-system/list-extras.scm (100%)
 rename {src => gnucash}/report/report-system/options-utilities.scm (100%)
 rename {src => gnucash}/report/report-system/report-collectors.scm (100%)
 rename {src => gnucash}/report/report-system/report-system.i (100%)
 rename {src => gnucash}/report/report-system/report-system.scm (100%)
 rename {src => gnucash}/report/report-system/report-utilities.scm (100%)
 rename {src => gnucash}/report/report-system/report.scm (100%)
 create mode 100644 gnucash/report/report-system/test/CMakeLists.txt
 create mode 100644 gnucash/report/report-system/test/Makefile.am
 rename {src => gnucash}/report/report-system/test/test-collectors.scm (100%)
 rename {src => gnucash}/report/report-system/test/test-extras.scm (100%)
 rename {src => gnucash}/report/report-system/test/test-link-module.c (100%)
 rename {src => gnucash}/report/report-system/test/test-list-extras.scm (100%)
 rename {src => gnucash}/report/report-system/test/test-load-module.in (100%)
 rename {src => gnucash}/report/report-system/test/test-report-utilities.scm (100%)
 rename {src => gnucash}/report/report-system/test/test-test-extras.scm (100%)
 create mode 100644 gnucash/report/standard-reports/CMakeLists.txt
 create mode 100644 gnucash/report/standard-reports/Makefile.am
 rename {src => gnucash}/report/standard-reports/account-piecharts.scm (100%)
 rename {src => gnucash}/report/standard-reports/account-summary.scm (100%)
 create mode 100644 gnucash/report/standard-reports/advanced-portfolio.scm
 rename {src => gnucash}/report/standard-reports/average-balance.scm (100%)
 rename {src => gnucash}/report/standard-reports/balance-sheet.scm (100%)
 rename {src => gnucash}/report/standard-reports/budget-balance-sheet.scm (100%)
 create mode 100644 gnucash/report/standard-reports/budget-barchart.scm
 rename {src => gnucash}/report/standard-reports/budget-flow.scm (100%)
 rename {src => gnucash}/report/standard-reports/budget-income-statement.scm (100%)
 rename {src => gnucash}/report/standard-reports/budget.scm (100%)
 rename {src => gnucash}/report/standard-reports/cash-flow.scm (100%)
 rename {src => gnucash}/report/standard-reports/category-barchart.scm (100%)
 rename {src => gnucash}/report/standard-reports/daily-reports.scm (100%)
 rename {src => gnucash}/report/standard-reports/equity-statement.scm (100%)
 rename {src => gnucash}/report/standard-reports/general-journal.scm (100%)
 rename {src => gnucash}/report/standard-reports/general-ledger.scm (100%)
 rename {src => gnucash}/report/standard-reports/income-statement.scm (100%)
 create mode 100644 gnucash/report/standard-reports/net-barchart.scm
 create mode 100644 gnucash/report/standard-reports/net-linechart.scm
 create mode 100644 gnucash/report/standard-reports/portfolio.scm
 rename {src => gnucash}/report/standard-reports/price-scatter.scm (100%)
 rename {src => gnucash}/report/standard-reports/register.scm (100%)
 rename {src => gnucash}/report/standard-reports/standard-reports.scm (100%)
 rename {src => gnucash}/report/standard-reports/sx-summary.scm (100%)
 create mode 100644 gnucash/report/standard-reports/test/CMakeLists.txt
 create mode 100644 gnucash/report/standard-reports/test/Makefile.am
 rename {src => gnucash}/report/standard-reports/test/test-cash-flow.scm (100%)
 rename {src => gnucash}/report/standard-reports/test/test-generic-category-report.scm (100%)
 rename {src => gnucash}/report/standard-reports/test/test-generic-net-barchart.scm (100%)
 rename {src => gnucash}/report/standard-reports/test/test-generic-net-linechart.scm (100%)
 rename {src => gnucash}/report/standard-reports/test/test-standard-category-report.scm (100%)
 rename {src => gnucash}/report/standard-reports/test/test-standard-net-barchart.scm (100%)
 rename {src => gnucash}/report/standard-reports/test/test-standard-net-linechart.scm (100%)
 rename {src => gnucash}/report/standard-reports/transaction.scm (100%)
 rename {src => gnucash}/report/standard-reports/trial-balance.scm (100%)
 create mode 100644 gnucash/report/stylesheets/CMakeLists.txt
 create mode 100644 gnucash/report/stylesheets/Makefile.am
 rename {src => gnucash}/report/stylesheets/gnc-plugin-stylesheets-ui.xml (100%)
 rename {src => gnucash}/report/stylesheets/gnc-plugin-stylesheets.c (100%)
 rename {src => gnucash}/report/stylesheets/gnc-plugin-stylesheets.h (100%)
 rename {src => gnucash}/report/stylesheets/gncmod-stylesheets.c (100%)
 rename {src => gnucash}/report/stylesheets/stylesheet-easy.scm (100%)
 rename {src => gnucash}/report/stylesheets/stylesheet-fancy.scm (100%)
 rename {src => gnucash}/report/stylesheets/stylesheet-footer.scm (100%)
 rename {src => gnucash}/report/stylesheets/stylesheet-head-or-tail.scm (100%)
 rename {src => gnucash}/report/stylesheets/stylesheet-plain.scm (100%)
 rename {src => gnucash}/report/stylesheets/stylesheets.scm (100%)
 rename {src => gnucash}/report/stylesheets/test/CMakeLists.txt (100%)
 create mode 100644 gnucash/report/stylesheets/test/Makefile.am
 rename {src => gnucash}/report/stylesheets/test/test-load-module.in (100%)
 create mode 100644 gnucash/report/utility-reports/CMakeLists.txt
 create mode 100644 gnucash/report/utility-reports/Makefile.am
 create mode 100644 gnucash/report/utility-reports/hello-world.scm
 rename {src => gnucash}/report/utility-reports/test-graphing.scm (100%)
 rename {src => gnucash}/report/utility-reports/utility-reports.scm (100%)
 rename {src => gnucash}/report/utility-reports/view-column.scm (100%)
 rename {src => gnucash}/report/utility-reports/welcome-to-gnucash.scm (100%)
 rename {src/bin => gnucash}/test/CMakeLists.txt (100%)
 rename {src/bin => gnucash}/test/Makefile.am (100%)
 rename {src/bin => gnucash}/test/test-version.in (100%)
 create mode 100644 libgnucash/CMakeLists.txt
 create mode 100644 libgnucash/Makefile.am
 create mode 100644 libgnucash/app-utils/CMakeLists.txt
 create mode 100644 libgnucash/app-utils/Makefile.am
 rename {src => libgnucash}/app-utils/QuickFill.c (100%)
 rename {src => libgnucash}/app-utils/QuickFill.h (100%)
 rename {src => libgnucash}/app-utils/README (100%)
 create mode 100644 libgnucash/app-utils/app-utils.i
 rename {src => libgnucash}/app-utils/app-utils.scm (100%)
 rename {src => libgnucash}/app-utils/business-helpers.c (100%)
 rename {src => libgnucash}/app-utils/business-helpers.h (100%)
 rename {src => libgnucash}/app-utils/business-options.c (100%)
 rename {src => libgnucash}/app-utils/business-options.h (100%)
 rename {src => libgnucash}/app-utils/business-options.scm (100%)
 rename {src => libgnucash}/app-utils/business-prefs.scm (100%)
 rename {src => libgnucash}/app-utils/c-interface.scm (100%)
 rename {src => libgnucash}/app-utils/calculation/expression_parser.c (100%)
 rename {src => libgnucash}/app-utils/calculation/fin.c (100%)
 rename {src => libgnucash}/app-utils/calculation/fin_spl_protos.h (100%)
 rename {src => libgnucash}/app-utils/calculation/fin_static_proto.h (100%)
 rename {src => libgnucash}/app-utils/calculation/finproto.h (100%)
 rename {src => libgnucash}/app-utils/calculation/finvar.h (100%)
 rename {src => libgnucash}/app-utils/config-var.scm (100%)
 rename {src => libgnucash}/app-utils/date-utilities.scm (100%)
 rename {src => libgnucash}/app-utils/file-utils.c (100%)
 rename {src => libgnucash}/app-utils/file-utils.h (100%)
 rename {src => libgnucash}/app-utils/gettext.scm (100%)
 rename {src => libgnucash}/app-utils/gfec.c (100%)
 rename {src => libgnucash}/app-utils/gfec.h (100%)
 rename {src => libgnucash}/app-utils/gnc-account-merge.c (100%)
 rename {src => libgnucash}/app-utils/gnc-account-merge.h (100%)
 rename {src => libgnucash}/app-utils/gnc-accounting-period.c (100%)
 rename {src => libgnucash}/app-utils/gnc-accounting-period.h (100%)
 create mode 100644 libgnucash/app-utils/gnc-addr-quickfill.c
 create mode 100644 libgnucash/app-utils/gnc-addr-quickfill.h
 rename {src => libgnucash}/app-utils/gnc-basic-gobject.h (100%)
 rename {src => libgnucash}/app-utils/gnc-component-manager.c (100%)
 rename {src => libgnucash}/app-utils/gnc-component-manager.h (100%)
 create mode 100644 libgnucash/app-utils/gnc-entry-quickfill.c
 create mode 100644 libgnucash/app-utils/gnc-entry-quickfill.h
 create mode 100644 libgnucash/app-utils/gnc-euro.c
 rename {src => libgnucash}/app-utils/gnc-euro.h (100%)
 rename {src => libgnucash}/app-utils/gnc-exp-parser.c (100%)
 rename {src => libgnucash}/app-utils/gnc-exp-parser.h (100%)
 create mode 100644 libgnucash/app-utils/gnc-gdate-utils.c
 create mode 100644 libgnucash/app-utils/gnc-gdate-utils.h
 rename {src => libgnucash}/app-utils/gnc-gettext-util.c (100%)
 rename {src => libgnucash}/app-utils/gnc-gettext-util.h (100%)
 create mode 100644 libgnucash/app-utils/gnc-gsettings.c
 rename {src => libgnucash}/app-utils/gnc-gsettings.h (100%)
 rename {src => libgnucash}/app-utils/gnc-help-utils.c (100%)
 rename {src => libgnucash}/app-utils/gnc-help-utils.h (100%)
 rename {src => libgnucash}/app-utils/gnc-helpers.c (100%)
 rename {src => libgnucash}/app-utils/gnc-helpers.h (100%)
 create mode 100644 libgnucash/app-utils/gnc-prefs-utils.c
 rename {src => libgnucash}/app-utils/gnc-prefs-utils.h (100%)
 rename {src => libgnucash}/app-utils/gnc-state.c (100%)
 rename {src => libgnucash}/app-utils/gnc-state.h (100%)
 rename {src => libgnucash}/app-utils/gnc-sx-instance-model.c (100%)
 rename {src => libgnucash}/app-utils/gnc-sx-instance-model.h (100%)
 rename {src => libgnucash}/app-utils/gnc-ui-balances.c (100%)
 rename {src => libgnucash}/app-utils/gnc-ui-balances.h (100%)
 create mode 100644 libgnucash/app-utils/gnc-ui-util.c
 rename {src => libgnucash}/app-utils/gnc-ui-util.h (100%)
 rename {src => libgnucash}/app-utils/gncmod-app-utils.c (100%)
 rename {src => libgnucash}/app-utils/guile-util.c (100%)
 rename {src => libgnucash}/app-utils/guile-util.h (100%)
 rename {src => libgnucash}/app-utils/hooks.scm (100%)
 rename {src => libgnucash}/app-utils/make-prefs-migration-script.xsl (100%)
 rename {src => libgnucash}/app-utils/migratable-prefs.xml.in (100%)
 rename {src => libgnucash}/app-utils/migrate-prefs.scm (100%)
 create mode 100644 libgnucash/app-utils/option-util.c
 create mode 100644 libgnucash/app-utils/option-util.h
 rename {src => libgnucash}/app-utils/options.scm (100%)
 rename {src => libgnucash}/app-utils/prefs.scm (100%)
 rename {src => libgnucash}/app-utils/simple-obj.scm (100%)
 create mode 100644 libgnucash/app-utils/test/CMakeLists.txt
 create mode 100644 libgnucash/app-utils/test/Makefile.am
 rename {src => libgnucash}/app-utils/test/test-app-utils.c (100%)
 rename {src => libgnucash}/app-utils/test/test-exp-parser.c (100%)
 rename {src => libgnucash}/app-utils/test/test-gnc-ui-util.c (100%)
 rename {src => libgnucash}/app-utils/test/test-link-module.c (100%)
 rename {src => libgnucash}/app-utils/test/test-load-module.in (100%)
 create mode 100644 libgnucash/app-utils/test/test-option-util.cpp
 rename {src => libgnucash}/app-utils/test/test-print-parse-amount.cpp (100%)
 rename {src => libgnucash}/app-utils/test/test-print-queries.cpp (100%)
 rename {src => libgnucash}/app-utils/test/test-scm-query-string.cpp (100%)
 rename {src => libgnucash}/app-utils/test/test-sx.cpp (100%)
 rename {src => libgnucash}/backend/CMakeLists.txt (100%)
 rename {src => libgnucash}/backend/Makefile.am (100%)
 create mode 100644 libgnucash/backend/dbi/.splintrc
 create mode 100644 libgnucash/backend/dbi/CMakeLists.txt
 create mode 100644 libgnucash/backend/dbi/Makefile.am
 rename {src => libgnucash}/backend/dbi/gnc-backend-dbi.cpp (100%)
 rename {src => libgnucash}/backend/dbi/gnc-backend-dbi.h (100%)
 rename {src => libgnucash}/backend/dbi/gnc-backend-dbi.hpp (100%)
 rename {src => libgnucash}/backend/dbi/gnc-dbiprovider.hpp (100%)
 rename {src => libgnucash}/backend/dbi/gnc-dbiproviderimpl.hpp (100%)
 rename {src => libgnucash}/backend/dbi/gnc-dbisqlconnection.cpp (100%)
 rename {src => libgnucash}/backend/dbi/gnc-dbisqlconnection.hpp (100%)
 rename {src => libgnucash}/backend/dbi/gnc-dbisqlresult.cpp (100%)
 rename {src => libgnucash}/backend/dbi/gnc-dbisqlresult.hpp (100%)
 rename {src => libgnucash}/backend/dbi/gncmod-backend-dbi.c (100%)
 create mode 100644 libgnucash/backend/dbi/test/CMakeLists.txt
 create mode 100644 libgnucash/backend/dbi/test/Makefile.am
 create mode 100644 libgnucash/backend/dbi/test/test-backend-dbi-basic.cpp
 create mode 100644 libgnucash/backend/dbi/test/test-backend-dbi.cpp
 rename {src => libgnucash}/backend/dbi/test/test-dbi-business-stuff.cpp (100%)
 rename {src => libgnucash}/backend/dbi/test/test-dbi-business-stuff.h (100%)
 create mode 100644 libgnucash/backend/dbi/test/test-dbi-stuff.cpp
 rename {src => libgnucash}/backend/dbi/test/test-dbi-stuff.h (100%)
 rename {src => libgnucash}/backend/dbi/test/test-dbi.xml (100%)
 rename {src => libgnucash}/backend/sql/.splintrc (100%)
 create mode 100644 libgnucash/backend/sql/CMakeLists.txt
 create mode 100644 libgnucash/backend/sql/Makefile.am
 rename {src => libgnucash}/backend/sql/escape.cpp (100%)
 rename {src => libgnucash}/backend/sql/escape.h (100%)
 rename {src => libgnucash}/backend/sql/gnc-account-sql.cpp (100%)
 rename {src => libgnucash}/backend/sql/gnc-account-sql.h (100%)
 rename {src => libgnucash}/backend/sql/gnc-address-sql.cpp (100%)
 rename {src => libgnucash}/backend/sql/gnc-bill-term-sql.cpp (100%)
 rename {src => libgnucash}/backend/sql/gnc-bill-term-sql.h (100%)
 rename {src => libgnucash}/backend/sql/gnc-book-sql.cpp (100%)
 rename {src => libgnucash}/backend/sql/gnc-book-sql.h (100%)
 rename {src => libgnucash}/backend/sql/gnc-budget-sql.cpp (100%)
 rename {src => libgnucash}/backend/sql/gnc-budget-sql.h (100%)
 rename {src => libgnucash}/backend/sql/gnc-commodity-sql.cpp (100%)
 rename {src => libgnucash}/backend/sql/gnc-commodity-sql.h (100%)
 rename {src => libgnucash}/backend/sql/gnc-customer-sql.cpp (100%)
 rename {src => libgnucash}/backend/sql/gnc-customer-sql.h (100%)
 rename {src => libgnucash}/backend/sql/gnc-employee-sql.cpp (100%)
 rename {src => libgnucash}/backend/sql/gnc-employee-sql.h (100%)
 rename {src => libgnucash}/backend/sql/gnc-entry-sql.cpp (100%)
 rename {src => libgnucash}/backend/sql/gnc-entry-sql.h (100%)
 rename {src => libgnucash}/backend/sql/gnc-invoice-sql.cpp (100%)
 rename {src => libgnucash}/backend/sql/gnc-invoice-sql.h (100%)
 rename {src => libgnucash}/backend/sql/gnc-job-sql.cpp (100%)
 rename {src => libgnucash}/backend/sql/gnc-job-sql.h (100%)
 rename {src => libgnucash}/backend/sql/gnc-lots-sql.cpp (100%)
 rename {src => libgnucash}/backend/sql/gnc-lots-sql.h (100%)
 rename {src => libgnucash}/backend/sql/gnc-order-sql.cpp (100%)
 rename {src => libgnucash}/backend/sql/gnc-order-sql.h (100%)
 rename {src => libgnucash}/backend/sql/gnc-owner-sql.cpp (100%)
 rename {src => libgnucash}/backend/sql/gnc-price-sql.cpp (100%)
 rename {src => libgnucash}/backend/sql/gnc-price-sql.h (100%)
 rename {src => libgnucash}/backend/sql/gnc-recurrence-sql.cpp (100%)
 rename {src => libgnucash}/backend/sql/gnc-recurrence-sql.h (100%)
 rename {src => libgnucash}/backend/sql/gnc-schedxaction-sql.cpp (100%)
 rename {src => libgnucash}/backend/sql/gnc-schedxaction-sql.h (100%)
 create mode 100644 libgnucash/backend/sql/gnc-slots-sql.cpp
 rename {src => libgnucash}/backend/sql/gnc-slots-sql.h (100%)
 rename {src => libgnucash}/backend/sql/gnc-sql-backend.cpp (100%)
 rename {src => libgnucash}/backend/sql/gnc-sql-backend.hpp (100%)
 rename {src => libgnucash}/backend/sql/gnc-sql-column-table-entry.cpp (100%)
 rename {src => libgnucash}/backend/sql/gnc-sql-column-table-entry.hpp (100%)
 rename {src => libgnucash}/backend/sql/gnc-sql-connection.hpp (100%)
 rename {src => libgnucash}/backend/sql/gnc-sql-object-backend.cpp (100%)
 rename {src => libgnucash}/backend/sql/gnc-sql-object-backend.hpp (100%)
 rename {src => libgnucash}/backend/sql/gnc-sql-result.cpp (100%)
 rename {src => libgnucash}/backend/sql/gnc-sql-result.hpp (100%)
 rename {src => libgnucash}/backend/sql/gnc-tax-table-sql.cpp (100%)
 rename {src => libgnucash}/backend/sql/gnc-tax-table-sql.h (100%)
 rename {src => libgnucash}/backend/sql/gnc-transaction-sql.cpp (100%)
 rename {src => libgnucash}/backend/sql/gnc-transaction-sql.h (100%)
 rename {src => libgnucash}/backend/sql/gnc-vendor-sql.cpp (100%)
 rename {src => libgnucash}/backend/sql/gnc-vendor-sql.h (100%)
 create mode 100644 libgnucash/backend/sql/test/CMakeLists.txt
 create mode 100644 libgnucash/backend/sql/test/Makefile.am
 create mode 100644 libgnucash/backend/sql/test/test-column-types.cpp
 rename {src => libgnucash}/backend/sql/test/test-sqlbe.cpp (100%)
 rename {src => libgnucash}/backend/sql/test/utest-gnc-backend-sql.cpp (100%)
 create mode 100644 libgnucash/backend/xml/CMakeLists.txt
 create mode 100644 libgnucash/backend/xml/Makefile.am
 rename {src => libgnucash}/backend/xml/gnc-account-xml-v2.cpp (100%)
 rename {src => libgnucash}/backend/xml/gnc-address-xml-v2.cpp (100%)
 rename {src => libgnucash}/backend/xml/gnc-address-xml-v2.h (100%)
 rename {src => libgnucash}/backend/xml/gnc-backend-xml.cpp (100%)
 rename {src => libgnucash}/backend/xml/gnc-backend-xml.h (100%)
 rename {src => libgnucash}/backend/xml/gnc-bill-term-xml-v2.cpp (100%)
 rename {src => libgnucash}/backend/xml/gnc-bill-term-xml-v2.h (100%)
 rename {src => libgnucash}/backend/xml/gnc-book-xml-v2.cpp (100%)
 rename {src => libgnucash}/backend/xml/gnc-budget-xml-v2.cpp (100%)
 rename {src => libgnucash}/backend/xml/gnc-commodity-xml-v2.cpp (100%)
 rename {src => libgnucash}/backend/xml/gnc-customer-xml-v2.cpp (100%)
 rename {src => libgnucash}/backend/xml/gnc-customer-xml-v2.h (100%)
 rename {src => libgnucash}/backend/xml/gnc-employee-xml-v2.cpp (100%)
 rename {src => libgnucash}/backend/xml/gnc-employee-xml-v2.h (100%)
 rename {src => libgnucash}/backend/xml/gnc-entry-xml-v2.cpp (100%)
 rename {src => libgnucash}/backend/xml/gnc-entry-xml-v2.h (100%)
 rename {src => libgnucash}/backend/xml/gnc-freqspec-xml-v2.cpp (100%)
 rename {src => libgnucash}/backend/xml/gnc-invoice-xml-v2.cpp (100%)
 rename {src => libgnucash}/backend/xml/gnc-invoice-xml-v2.h (100%)
 rename {src => libgnucash}/backend/xml/gnc-job-xml-v2.cpp (100%)
 rename {src => libgnucash}/backend/xml/gnc-job-xml-v2.h (100%)
 rename {src => libgnucash}/backend/xml/gnc-lot-xml-v2.cpp (100%)
 rename {src => libgnucash}/backend/xml/gnc-order-xml-v2.cpp (100%)
 rename {src => libgnucash}/backend/xml/gnc-order-xml-v2.h (100%)
 rename {src => libgnucash}/backend/xml/gnc-owner-xml-v2.cpp (100%)
 rename {src => libgnucash}/backend/xml/gnc-owner-xml-v2.h (100%)
 rename {src => libgnucash}/backend/xml/gnc-pricedb-xml-v2.cpp (100%)
 rename {src => libgnucash}/backend/xml/gnc-recurrence-xml-v2.cpp (100%)
 rename {src => libgnucash}/backend/xml/gnc-schedxaction-xml-v2.cpp (100%)
 rename {src => libgnucash}/backend/xml/gnc-tax-table-xml-v2.cpp (100%)
 rename {src => libgnucash}/backend/xml/gnc-tax-table-xml-v2.h (100%)
 rename {src => libgnucash}/backend/xml/gnc-transaction-xml-v2.cpp (100%)
 rename {src => libgnucash}/backend/xml/gnc-vendor-xml-v2.cpp (100%)
 rename {src => libgnucash}/backend/xml/gnc-vendor-xml-v2.h (100%)
 rename {src => libgnucash}/backend/xml/gnc-xml-backend.cpp (100%)
 rename {src => libgnucash}/backend/xml/gnc-xml-backend.hpp (100%)
 rename {src => libgnucash}/backend/xml/gnc-xml-helper.cpp (100%)
 rename {src => libgnucash}/backend/xml/gnc-xml-helper.h (100%)
 rename {src => libgnucash}/backend/xml/gnc-xml.h (100%)
 rename {src => libgnucash}/backend/xml/gncmod-backend-xml.cpp (100%)
 rename {src => libgnucash}/backend/xml/io-example-account.cpp (100%)
 rename {src => libgnucash}/backend/xml/io-example-account.h (100%)
 rename {src => libgnucash}/backend/xml/io-gncxml-gen.cpp (100%)
 rename {src => libgnucash}/backend/xml/io-gncxml-gen.h (100%)
 create mode 100644 libgnucash/backend/xml/io-gncxml-v1.cpp
 rename {src => libgnucash}/backend/xml/io-gncxml-v2.cpp (100%)
 rename {src => libgnucash}/backend/xml/io-gncxml-v2.h (100%)
 rename {src => libgnucash}/backend/xml/io-gncxml.h (100%)
 rename {src => libgnucash}/backend/xml/io-utils.cpp (100%)
 rename {src => libgnucash}/backend/xml/io-utils.h (100%)
 create mode 100644 libgnucash/backend/xml/sixtp-dom-generators.cpp
 rename {src => libgnucash}/backend/xml/sixtp-dom-generators.h (100%)
 create mode 100644 libgnucash/backend/xml/sixtp-dom-parsers.cpp
 rename {src => libgnucash}/backend/xml/sixtp-dom-parsers.h (100%)
 rename {src => libgnucash}/backend/xml/sixtp-parsers.h (100%)
 rename {src => libgnucash}/backend/xml/sixtp-stack.cpp (100%)
 rename {src => libgnucash}/backend/xml/sixtp-stack.h (100%)
 rename {src => libgnucash}/backend/xml/sixtp-to-dom-parser.cpp (100%)
 rename {src => libgnucash}/backend/xml/sixtp-utils.cpp (100%)
 rename {src => libgnucash}/backend/xml/sixtp-utils.h (100%)
 rename {src => libgnucash}/backend/xml/sixtp.cpp (100%)
 rename {src => libgnucash}/backend/xml/sixtp.h (100%)
 create mode 100644 libgnucash/backend/xml/test/CMakeLists.txt
 create mode 100644 libgnucash/backend/xml/test/Makefile.am
 rename {src => libgnucash}/backend/xml/test/README (100%)
 rename {src => libgnucash}/backend/xml/test/grab-types.pl (100%)
 rename {src => libgnucash}/backend/xml/test/test-date-converting.cpp (100%)
 rename {src => libgnucash}/backend/xml/test/test-dom-converters1.cpp (100%)
 rename {src => libgnucash}/backend/xml/test/test-dom-parser1-1.xml (100%)
 rename {src => libgnucash}/backend/xml/test/test-dom-parser1.cpp (100%)
 create mode 100644 libgnucash/backend/xml/test/test-file-stuff.cpp
 rename {src => libgnucash}/backend/xml/test/test-file-stuff.h (100%)
 rename {src => libgnucash}/backend/xml/test/test-files/CMakeLists.txt (100%)
 rename {src => libgnucash}/backend/xml/test/test-files/Makefile.am (100%)
 rename {src => libgnucash}/backend/xml/test/test-files/xml1/Money95bank_fr.gml (100%)
 rename {src => libgnucash}/backend/xml/test/test-files/xml1/Money95invst.gml (100%)
 rename {src => libgnucash}/backend/xml/test/test-files/xml1/Money95mutual.gml (100%)
 rename {src => libgnucash}/backend/xml/test/test-files/xml1/Money95stocks.gml (100%)
 rename {src => libgnucash}/backend/xml/test/test-files/xml1/abc.gml (100%)
 rename {src => libgnucash}/backend/xml/test/test-files/xml1/abcall.gml (100%)
 rename {src => libgnucash}/backend/xml/test/test-files/xml1/carols-data-file (100%)
 rename {src => libgnucash}/backend/xml/test/test-files/xml1/carols-data-file.gml (100%)
 rename {src => libgnucash}/backend/xml/test/test-files/xml1/cbb-export.gml (100%)
 rename {src => libgnucash}/backend/xml/test/test-files/xml1/conrads-file (100%)
 rename {src => libgnucash}/backend/xml/test/test-files/xml1/conrads-file.gml (100%)
 rename {src => libgnucash}/backend/xml/test/test-files/xml1/every.gml (100%)
 rename {src => libgnucash}/backend/xml/test/test-files/xml1/ms-money.gml (100%)
 rename {src => libgnucash}/backend/xml/test/test-files/xml1/pricedb1.gml (100%)
 rename {src => libgnucash}/backend/xml/test/test-files/xml2/.gitignore (100%)
 rename {src => libgnucash}/backend/xml/test/test-files/xml2/CMakeLists.txt (100%)
 rename {src => libgnucash}/backend/xml/test/test-files/xml2/Makefile.am (100%)
 rename {src => libgnucash}/backend/xml/test/test-files/xml2/Money95bank_fr.gml2 (100%)
 rename {src => libgnucash}/backend/xml/test/test-files/xml2/Money95invst.gml2 (100%)
 rename {src => libgnucash}/backend/xml/test/test-files/xml2/Money95mutual.gml2 (100%)
 rename {src => libgnucash}/backend/xml/test/test-files/xml2/Money95stocks.gml2 (100%)
 rename {src => libgnucash}/backend/xml/test/test-files/xml2/abc.gml2 (100%)
 rename {src => libgnucash}/backend/xml/test/test-files/xml2/abcall.gml2 (100%)
 rename {src => libgnucash}/backend/xml/test/test-files/xml2/carols-data-file.gml2 (100%)
 rename {src => libgnucash}/backend/xml/test/test-files/xml2/cbb-export.gml2 (100%)
 rename {src => libgnucash}/backend/xml/test/test-files/xml2/conrads-file.gml2 (100%)
 rename {src => libgnucash}/backend/xml/test/test-files/xml2/every.gml2 (100%)
 rename {src => libgnucash}/backend/xml/test/test-files/xml2/goonies-file.gml2 (100%)
 rename {src => libgnucash}/backend/xml/test/test-files/xml2/hierachical-data-file.gml2 (100%)
 rename {src => libgnucash}/backend/xml/test/test-files/xml2/ms-money.gml2 (100%)
 rename {src => libgnucash}/backend/xml/test/test-files/xml2/pricedb1.gml2 (100%)
 create mode 100644 libgnucash/backend/xml/test/test-kvp-frames.cpp
 create mode 100644 libgnucash/backend/xml/test/test-load-backend.cpp
 create mode 100644 libgnucash/backend/xml/test/test-load-example-account.cpp
 create mode 100644 libgnucash/backend/xml/test/test-load-xml2.cpp
 rename {src => libgnucash}/backend/xml/test/test-real-data.sh.in (100%)
 rename {src => libgnucash}/backend/xml/test/test-save-in-lang.cpp (100%)
 rename {src => libgnucash}/backend/xml/test/test-string-converters.cpp (100%)
 rename {src => libgnucash}/backend/xml/test/test-xml-account.cpp (100%)
 rename {src => libgnucash}/backend/xml/test/test-xml-commodity.cpp (100%)
 rename {src => libgnucash}/backend/xml/test/test-xml-pricedb.cpp (100%)
 rename {src => libgnucash}/backend/xml/test/test-xml-transaction.cpp (100%)
 rename {src => libgnucash}/backend/xml/test/test-xml2-is-file.cpp (100%)
 rename {src => libgnucash}/backend/xml/xml-helpers.h (100%)
 create mode 100644 libgnucash/core-utils/CMakeLists.txt
 create mode 100644 libgnucash/core-utils/Makefile.am
 rename {src => libgnucash}/core-utils/binreloc.c (100%)
 rename {src => libgnucash}/core-utils/binreloc.h (100%)
 rename {src => libgnucash}/core-utils/core-utils.i (100%)
 rename {src => libgnucash}/core-utils/core-utils.scm (100%)
 rename {src => libgnucash}/core-utils/gnc-environment.c (100%)
 rename {src => libgnucash}/core-utils/gnc-environment.h (100%)
 create mode 100644 libgnucash/core-utils/gnc-filepath-utils.c
 rename {src => libgnucash}/core-utils/gnc-filepath-utils.h (100%)
 create mode 100644 libgnucash/core-utils/gnc-gkeyfile-utils.c
 rename {src => libgnucash}/core-utils/gnc-gkeyfile-utils.h (100%)
 rename {src => libgnucash}/core-utils/gnc-glib-utils.c (100%)
 rename {src => libgnucash}/core-utils/gnc-glib-utils.h (100%)
 create mode 100644 libgnucash/core-utils/gnc-guile-utils.c
 rename {src => libgnucash}/core-utils/gnc-guile-utils.h (100%)
 rename {src => libgnucash}/core-utils/gnc-jalali.c (100%)
 rename {src => libgnucash}/core-utils/gnc-jalali.h (100%)
 rename {src => libgnucash}/core-utils/gnc-locale-utils.c (100%)
 rename {src => libgnucash}/core-utils/gnc-locale-utils.h (100%)
 create mode 100644 libgnucash/core-utils/gnc-path.c
 rename {src => libgnucash}/core-utils/gnc-path.h (100%)
 rename {src => libgnucash}/core-utils/gnc-prefs-p.h (100%)
 create mode 100644 libgnucash/core-utils/gnc-prefs.c
 rename {src => libgnucash}/core-utils/gnc-prefs.h (100%)
 rename {src => libgnucash}/core-utils/gncla-dir.h.in (100%)
 create mode 100644 libgnucash/core-utils/test/CMakeLists.txt
 create mode 100644 libgnucash/core-utils/test/Makefile.am
 rename {src => libgnucash}/core-utils/test/test-gnc-glib-utils.c (100%)
 create mode 100644 libgnucash/core-utils/test/test-resolve-file-path.c
 rename {src => libgnucash}/doc/CMakeLists.txt (100%)
 rename {src => libgnucash}/doc/Makefile.am (100%)
 rename {src => libgnucash}/doc/README (100%)
 rename {src => libgnucash}/doc/TODO-schedxactions (100%)
 rename {src => libgnucash}/doc/TODO-sixtp (100%)
 rename {src => libgnucash}/doc/backup.txt (100%)
 rename {src => libgnucash}/doc/books.txt (100%)
 rename {src => libgnucash}/doc/budget.txt (100%)
 rename {src => libgnucash}/doc/business.txt (100%)
 rename {src => libgnucash}/doc/callgrind.txt (100%)
 rename {src => libgnucash}/doc/constderv.html (100%)
 rename {src => libgnucash}/doc/constraints.txt (100%)
 rename {src => libgnucash}/doc/currencies.txt (100%)
 rename {src => libgnucash}/doc/design/CMakeLists.txt (100%)
 rename {src => libgnucash}/doc/design/Makefile.am (100%)
 rename {src => libgnucash}/doc/design/component-manager.texi (100%)
 rename {src => libgnucash}/doc/design/concept-index.texi (100%)
 rename {src => libgnucash}/doc/design/engine.texi (100%)
 rename {src => libgnucash}/doc/design/fdl.texi (100%)
 rename {src => libgnucash}/doc/design/function-index.texi (100%)
 rename {src => libgnucash}/doc/design/gnucash-design.texi (100%)
 rename {src => libgnucash}/doc/design/intro.texi (100%)
 rename {src => libgnucash}/doc/design/register.texi (100%)
 rename {src => libgnucash}/doc/design/reports.texi (100%)
 rename {src => libgnucash}/doc/design/top-level.texi (100%)
 rename {src => libgnucash}/doc/design/type-index.texi (100%)
 rename {src => libgnucash}/doc/design/user-preferences.texi (100%)
 rename {src => libgnucash}/doc/dia/components.dia (100%)
 rename {src => libgnucash}/doc/dia/structures-alt.dia (100%)
 rename {src => libgnucash}/doc/dia/structures.dia (100%)
 create mode 100644 libgnucash/doc/doxygen.cfg.in
 rename {src => libgnucash}/doc/doxygen_main_page.c (100%)
 rename {src => libgnucash}/doc/engine.txt (100%)
 rename {src => libgnucash}/doc/finderv.html (100%)
 rename {src => libgnucash}/doc/finutil.html (100%)
 rename {src => libgnucash}/doc/g2-architecture.txt (100%)
 rename {src => libgnucash}/doc/generic-druid-framework.txt (100%)
 rename {src => libgnucash}/doc/gnc-numeric-example.txt (100%)
 rename {src => libgnucash}/doc/guid.txt (100%)
 rename {src => libgnucash}/doc/loans.txt (100%)
 rename {src => libgnucash}/doc/lots.txt (100%)
 rename {src => libgnucash}/doc/multicurrency-discussion.txt (100%)
 rename {src => libgnucash}/doc/prices.txt (100%)
 rename {src => libgnucash}/doc/python-bindings-doxygen.py (100%)
 rename {src => libgnucash}/doc/qif.txt (100%)
 rename {src => libgnucash}/doc/sx.rst (100%)
 rename {src => libgnucash}/doc/tax.txt (100%)
 rename {src => libgnucash}/doc/user-prefs-howto.txt (100%)
 rename {src => libgnucash}/doc/xml/CMakeLists.txt (100%)
 rename {src => libgnucash}/doc/xml/Makefile.am (100%)
 rename {src => libgnucash}/doc/xml/README (100%)
 rename {src => libgnucash}/doc/xml/account-v2.dtd (100%)
 rename {src => libgnucash}/doc/xml/commodity-v2.dtd (100%)
 rename {src => libgnucash}/doc/xml/defaults-v1.dtd (100%)
 rename {src => libgnucash}/doc/xml/gnucash-v2.rnc (100%)
 rename {src => libgnucash}/doc/xml/io-gncxml-version1.dtd (100%)
 rename {src => libgnucash}/doc/xml/io-gncxml-version2.dtd (100%)
 rename {src => libgnucash}/doc/xml/preferences-v1.dtd (100%)
 rename {src => libgnucash}/doc/xml/prices-v1.dtd (100%)
 rename {src => libgnucash}/doc/xml/transactions-v2.dtd (100%)
 rename {src => libgnucash}/doc/xml/types.dtd (100%)
 rename {src => libgnucash}/engine/Account.c (100%)
 rename {src => libgnucash}/engine/Account.h (100%)
 rename {src => libgnucash}/engine/AccountP.h (100%)
 create mode 100644 libgnucash/engine/CMakeLists.txt
 rename {src => libgnucash}/engine/FreqSpec.h (100%)
 create mode 100644 libgnucash/engine/Makefile.am
 rename {src => libgnucash}/engine/Query.c (100%)
 rename {src => libgnucash}/engine/Query.h (100%)
 rename {src => libgnucash}/engine/README (100%)
 rename {src => libgnucash}/engine/README.query-api (100%)
 create mode 100644 libgnucash/engine/Recurrence.c
 rename {src => libgnucash}/engine/Recurrence.h (100%)
 rename {src => libgnucash}/engine/SX-book-p.h (100%)
 rename {src => libgnucash}/engine/SX-book.c (100%)
 rename {src => libgnucash}/engine/SX-book.h (100%)
 rename {src => libgnucash}/engine/SX-ttinfo.c (100%)
 rename {src => libgnucash}/engine/SX-ttinfo.h (100%)
 rename {src => libgnucash}/engine/SchedXaction.c (100%)
 rename {src => libgnucash}/engine/SchedXaction.h (100%)
 rename {src => libgnucash}/engine/Scrub.c (100%)
 rename {src => libgnucash}/engine/Scrub.h (100%)
 rename {src => libgnucash}/engine/Scrub2.c (100%)
 rename {src => libgnucash}/engine/Scrub2.h (100%)
 rename {src => libgnucash}/engine/Scrub3.c (100%)
 rename {src => libgnucash}/engine/Scrub3.h (100%)
 rename {src => libgnucash}/engine/ScrubBusiness.c (100%)
 rename {src => libgnucash}/engine/ScrubBusiness.h (100%)
 rename {src => libgnucash}/engine/ScrubP.h (100%)
 rename {src => libgnucash}/engine/Split.c (100%)
 rename {src => libgnucash}/engine/Split.h (100%)
 rename {src => libgnucash}/engine/SplitP.h (100%)
 rename {src => libgnucash}/engine/TransLog.c (100%)
 rename {src => libgnucash}/engine/TransLog.h (100%)
 create mode 100644 libgnucash/engine/Transaction.c
 rename {src => libgnucash}/engine/Transaction.h (100%)
 rename {src => libgnucash}/engine/TransactionP.h (100%)
 create mode 100644 libgnucash/engine/business-core.i
 rename {src => libgnucash}/engine/business-core.scm (100%)
 rename {src => libgnucash}/engine/cap-gains.c (100%)
 rename {src => libgnucash}/engine/cap-gains.h (100%)
 rename {src => libgnucash}/engine/cashobjects.c (100%)
 rename {src => libgnucash}/engine/cashobjects.h (100%)
 rename {src => libgnucash}/engine/commodity-table.scm (100%)
 rename {src => libgnucash}/engine/design.txt (100%)
 rename {src => libgnucash}/engine/engine-common.i (100%)
 rename {src => libgnucash}/engine/engine-helpers-guile.h (100%)
 rename {src => libgnucash}/engine/engine-helpers.c (100%)
 rename {src => libgnucash}/engine/engine-helpers.h (100%)
 rename {src => libgnucash}/engine/engine-interface.scm (100%)
 rename {src => libgnucash}/engine/engine-utilities.scm (100%)
 rename {src => libgnucash}/engine/engine.i (100%)
 rename {src => libgnucash}/engine/engine.scm (100%)
 rename {src => libgnucash}/engine/extensions.txt (100%)
 rename {src => libgnucash}/engine/glib-helpers.c (100%)
 rename {src => libgnucash}/engine/glib-helpers.h (100%)
 create mode 100644 libgnucash/engine/gnc-aqbanking-templates.cpp
 rename {src/libqof/qof => libgnucash/engine}/gnc-aqbanking-templates.h (100%)
 rename {src/libqof/qof => libgnucash/engine}/gnc-backend-prov.hpp (100%)
 create mode 100644 libgnucash/engine/gnc-budget.c
 rename {src => libgnucash}/engine/gnc-budget.h (100%)
 rename {src => libgnucash}/engine/gnc-commodity.c (100%)
 rename {src => libgnucash}/engine/gnc-commodity.h (100%)
 rename {src/libqof/qof => libgnucash/engine}/gnc-date-p.h (100%)
 create mode 100644 libgnucash/engine/gnc-date.cpp
 create mode 100644 libgnucash/engine/gnc-date.h
 rename {src/libqof/qof => libgnucash/engine}/gnc-datetime.cpp (100%)
 rename {src/libqof/qof => libgnucash/engine}/gnc-datetime.hpp (100%)
 create mode 100644 libgnucash/engine/gnc-engine.c
 create mode 100644 libgnucash/engine/gnc-engine.h
 rename {src => libgnucash}/engine/gnc-event.c (100%)
 rename {src => libgnucash}/engine/gnc-event.h (100%)
 create mode 100644 libgnucash/engine/gnc-features.c
 create mode 100644 libgnucash/engine/gnc-features.h
 rename {src => libgnucash}/engine/gnc-hooks-scm.h (100%)
 rename {src => libgnucash}/engine/gnc-hooks.c (100%)
 rename {src => libgnucash}/engine/gnc-hooks.h (100%)
 rename {src/libqof/qof => libgnucash/engine}/gnc-int128.cpp (100%)
 rename {src/libqof/qof => libgnucash/engine}/gnc-int128.hpp (100%)
 rename {src => libgnucash}/engine/gnc-lot-p.h (100%)
 rename {src => libgnucash}/engine/gnc-lot.c (100%)
 rename {src => libgnucash}/engine/gnc-lot.h (100%)
 rename {src/libqof/qof => libgnucash/engine}/gnc-numeric.cpp (100%)
 rename {src/libqof/qof => libgnucash/engine}/gnc-numeric.h (100%)
 rename {src/libqof/qof => libgnucash/engine}/gnc-numeric.hpp (100%)
 rename {src => libgnucash}/engine/gnc-numeric.scm (100%)
 rename {src => libgnucash}/engine/gnc-pricedb-p.h (100%)
 rename {src => libgnucash}/engine/gnc-pricedb.c (100%)
 rename {src => libgnucash}/engine/gnc-pricedb.h (100%)
 rename {src/libqof/qof => libgnucash/engine}/gnc-rational-rounding.hpp (100%)
 rename {src/libqof/qof => libgnucash/engine}/gnc-rational.cpp (100%)
 rename {src/libqof/qof => libgnucash/engine}/gnc-rational.hpp (100%)
 rename {src => libgnucash}/engine/gnc-session.c (100%)
 rename {src => libgnucash}/engine/gnc-session.h (100%)
 rename {src/libqof/qof => libgnucash/engine}/gnc-timezone.cpp (100%)
 rename {src/libqof/qof => libgnucash/engine}/gnc-timezone.hpp (100%)
 rename {src/core-utils => libgnucash/engine}/gnc-uri-utils.c (100%)
 rename {src/core-utils => libgnucash/engine}/gnc-uri-utils.h (100%)
 rename {src => libgnucash}/engine/gncAddress.c (100%)
 rename {src => libgnucash}/engine/gncAddress.h (100%)
 rename {src => libgnucash}/engine/gncAddressP.h (100%)
 rename {src => libgnucash}/engine/gncBillTerm.c (100%)
 rename {src => libgnucash}/engine/gncBillTerm.h (100%)
 rename {src => libgnucash}/engine/gncBillTermP.h (100%)
 rename {src => libgnucash}/engine/gncBusGuile.c (100%)
 rename {src => libgnucash}/engine/gncBusGuile.h (100%)
 create mode 100644 libgnucash/engine/gncBusiness.c
 rename {src => libgnucash}/engine/gncBusiness.h (100%)
 rename {src => libgnucash}/engine/gncCustomer.c (100%)
 rename {src => libgnucash}/engine/gncCustomer.h (100%)
 rename {src => libgnucash}/engine/gncCustomerP.h (100%)
 rename {src => libgnucash}/engine/gncEmployee.c (100%)
 rename {src => libgnucash}/engine/gncEmployee.h (100%)
 rename {src => libgnucash}/engine/gncEmployeeP.h (100%)
 rename {src => libgnucash}/engine/gncEntry.c (100%)
 rename {src => libgnucash}/engine/gncEntry.h (100%)
 rename {src => libgnucash}/engine/gncEntryP.h (100%)
 rename {src => libgnucash}/engine/gncIDSearch.c (100%)
 rename {src => libgnucash}/engine/gncIDSearch.h (100%)
 rename {src => libgnucash}/engine/gncInvoice.c (100%)
 rename {src => libgnucash}/engine/gncInvoice.h (100%)
 rename {src => libgnucash}/engine/gncInvoiceP.h (100%)
 rename {src => libgnucash}/engine/gncJob.c (100%)
 rename {src => libgnucash}/engine/gncJob.h (100%)
 rename {src => libgnucash}/engine/gncJobP.h (100%)
 rename {src => libgnucash}/engine/gncOrder.c (100%)
 rename {src => libgnucash}/engine/gncOrder.h (100%)
 rename {src => libgnucash}/engine/gncOrderP.h (100%)
 rename {src => libgnucash}/engine/gncOwner.c (100%)
 rename {src => libgnucash}/engine/gncOwner.h (100%)
 rename {src => libgnucash}/engine/gncOwnerP.h (100%)
 rename {src => libgnucash}/engine/gncTaxTable.c (100%)
 rename {src => libgnucash}/engine/gncTaxTable.h (100%)
 rename {src => libgnucash}/engine/gncTaxTableP.h (100%)
 rename {src => libgnucash}/engine/gncVendor.c (100%)
 rename {src => libgnucash}/engine/gncVendor.h (100%)
 rename {src => libgnucash}/engine/gncVendorP.h (100%)
 rename {src => libgnucash}/engine/gncmod-engine.c (100%)
 rename {src/libqof/qof => libgnucash/engine}/guid.cpp (100%)
 rename {src/libqof/qof => libgnucash/engine}/guid.h (100%)
 rename {src/libqof/qof => libgnucash/engine}/guid.hpp (100%)
 rename {src => libgnucash}/engine/iso-4217-currencies.xml (100%)
 rename {src => libgnucash}/engine/iso-currencies-to-c.xsl (100%)
 create mode 100644 libgnucash/engine/kvp-frame.cpp
 rename src/libqof/qof/kvp_frame.hpp => libgnucash/engine/kvp-frame.hpp (100%)
 create mode 100644 libgnucash/engine/kvp-scm.cpp
 rename {src => libgnucash}/engine/kvp-scm.h (100%)
 create mode 100644 libgnucash/engine/kvp-value.cpp
 rename {src/libqof/qof => libgnucash/engine}/kvp-value.hpp (100%)
 rename {src => libgnucash}/engine/kvp_doc.txt (100%)
 rename {src => libgnucash}/engine/policy-p.h (100%)
 rename {src => libgnucash}/engine/policy.c (100%)
 rename {src => libgnucash}/engine/policy.h (100%)
 create mode 100644 libgnucash/engine/qof-backend.cpp
 rename {src/libqof/qof => libgnucash/engine}/qof-backend.hpp (100%)
 rename {src/libqof/qof => libgnucash/engine}/qof-gobject.h (100%)
 rename {src/libqof/qof => libgnucash/engine}/qof-string-cache.cpp (100%)
 rename {src/libqof/qof => libgnucash/engine}/qof-string-cache.h (100%)
 rename {src/libqof/qof => libgnucash/engine}/qof-win32.cpp (100%)
 rename {src/libqof/qof => libgnucash/engine}/qof.h (100%)
 rename {src/libqof/qof => libgnucash/engine}/qofbackend.h (100%)
 rename {src/libqof/qof => libgnucash/engine}/qofbook-p.h (100%)
 create mode 100644 libgnucash/engine/qofbook.cpp
 rename {src/libqof/qof => libgnucash/engine}/qofbook.h (100%)
 rename {src/libqof/qof => libgnucash/engine}/qofbookslots.h (100%)
 rename {src/libqof/qof => libgnucash/engine}/qofchoice.cpp (100%)
 rename {src/libqof/qof => libgnucash/engine}/qofchoice.h (100%)
 rename {src/libqof/qof => libgnucash/engine}/qofclass-p.h (100%)
 rename {src/libqof/qof => libgnucash/engine}/qofclass.cpp (100%)
 rename {src/libqof/qof => libgnucash/engine}/qofclass.h (100%)
 rename {src/libqof/qof => libgnucash/engine}/qofevent-p.h (100%)
 rename {src/libqof/qof => libgnucash/engine}/qofevent.cpp (100%)
 rename {src/libqof/qof => libgnucash/engine}/qofevent.h (100%)
 rename {src/libqof/qof => libgnucash/engine}/qofid-p.h (100%)
 rename {src/libqof/qof => libgnucash/engine}/qofid.cpp (100%)
 rename {src/libqof/qof => libgnucash/engine}/qofid.h (100%)
 rename {src/libqof/qof => libgnucash/engine}/qofinstance-p.h (100%)
 create mode 100644 libgnucash/engine/qofinstance.cpp
 rename {src/libqof/qof => libgnucash/engine}/qofinstance.h (100%)
 rename {src/libqof/qof => libgnucash/engine}/qoflog.cpp (100%)
 rename {src/libqof/qof => libgnucash/engine}/qoflog.h (100%)
 rename {src/libqof/qof => libgnucash/engine}/qofobject-p.h (100%)
 rename {src/libqof/qof => libgnucash/engine}/qofobject.cpp (100%)
 rename {src/libqof/qof => libgnucash/engine}/qofobject.h (100%)
 rename {src/libqof/qof => libgnucash/engine}/qofquery-p.h (100%)
 rename {src/libqof/qof => libgnucash/engine}/qofquery.cpp (100%)
 rename {src/libqof/qof => libgnucash/engine}/qofquery.h (100%)
 rename {src/libqof/qof => libgnucash/engine}/qofquerycore-p.h (100%)
 rename {src/libqof/qof => libgnucash/engine}/qofquerycore.cpp (100%)
 rename {src/libqof/qof => libgnucash/engine}/qofquerycore.h (100%)
 rename {src/libqof/qof => libgnucash/engine}/qofsession.cpp (100%)
 rename {src/libqof/qof => libgnucash/engine}/qofsession.h (100%)
 rename {src/libqof/qof => libgnucash/engine}/qofsession.hpp (100%)
 rename {src/libqof/qof => libgnucash/engine}/qofutil.cpp (100%)
 rename {src/libqof/qof => libgnucash/engine}/qofutil.h (100%)
 create mode 100644 libgnucash/engine/test-core/CMakeLists.txt
 create mode 100644 libgnucash/engine/test-core/Makefile.am
 rename {src => libgnucash}/engine/test-core/gncmod-test-engine.c (100%)
 rename {src => libgnucash}/engine/test-core/test-engine-strings.h (100%)
 create mode 100644 libgnucash/engine/test-core/test-engine-stuff.cpp
 rename {src => libgnucash}/engine/test-core/test-engine-stuff.h (100%)
 create mode 100644 libgnucash/engine/test/CMakeLists.txt
 create mode 100644 libgnucash/engine/test/Makefile.am
 rename {src => libgnucash}/engine/test/README (100%)
 rename {src => libgnucash}/engine/test/dummy.cpp (100%)
 rename {src/libqof/qof => libgnucash/engine}/test/gtest-gnc-datetime.cpp (100%)
 rename {src/libqof/qof => libgnucash/engine}/test/gtest-gnc-int128.cpp (100%)
 rename {src/libqof/qof => libgnucash/engine}/test/gtest-gnc-numeric.cpp (100%)
 rename {src/libqof/qof => libgnucash/engine}/test/gtest-gnc-rational.cpp (100%)
 rename {src/libqof/qof => libgnucash/engine}/test/gtest-gnc-timezone.cpp (100%)
 create mode 100644 libgnucash/engine/test/gtest-import-map.cpp
 rename {src => libgnucash}/engine/test/test-account-object.cpp (100%)
 rename {src => libgnucash}/engine/test/test-account.scm (100%)
 rename {src => libgnucash}/engine/test/test-address.c (100%)
 rename {src => libgnucash}/engine/test/test-business.c (100%)
 rename {src => libgnucash}/engine/test/test-commodities.cpp (100%)
 rename {src => libgnucash}/engine/test/test-create-account.in (100%)
 rename {src => libgnucash}/engine/test/test-create-account.scm (100%)
 rename {src => libgnucash}/engine/test/test-customer.c (100%)
 rename {src => libgnucash}/engine/test/test-date.cpp (100%)
 rename {src => libgnucash}/engine/test/test-employee.c (100%)
 rename {src => libgnucash}/engine/test/test-engine-kvp-properties.c (100%)
 rename {src => libgnucash}/engine/test/test-engine.c (100%)
 rename {src => libgnucash}/engine/test/test-extras.scm (100%)
 create mode 100644 libgnucash/engine/test/test-gnc-date.c
 rename {src/libqof/qof => libgnucash/engine}/test/test-gnc-guid-old.cpp (100%)
 rename {src/libqof/qof => libgnucash/engine}/test/test-gnc-guid.cpp (100%)
 create mode 100644 libgnucash/engine/test/test-gnc-uri-utils.c
 rename {src => libgnucash}/engine/test/test-group-vs-book.cpp (100%)
 rename {src => libgnucash}/engine/test/test-guid.cpp (100%)
 rename {src => libgnucash}/engine/test/test-job.c (100%)
 create mode 100644 libgnucash/engine/test/test-kvp-frame.cpp
 create mode 100644 libgnucash/engine/test/test-kvp-value.cpp
 rename {src => libgnucash}/engine/test/test-link.c (100%)
 rename {src => libgnucash}/engine/test/test-load-engine.c (100%)
 rename {src => libgnucash}/engine/test/test-lots.cpp (100%)
 rename {src/libqof/qof => libgnucash/engine}/test/test-numeric.cpp (100%)
 rename {src => libgnucash}/engine/test/test-object.c (100%)
 rename {src/libqof/qof => libgnucash/engine}/test/test-qof-string-cache.c (100%)
 rename {src/libqof/qof => libgnucash/engine}/test/test-qof.c (100%)
 rename {src/libqof/qof => libgnucash/engine}/test/test-qofbackend.c (100%)
 rename {src/libqof/qof => libgnucash/engine}/test/test-qofbook.c (100%)
 create mode 100644 libgnucash/engine/test/test-qofinstance.cpp
 rename {src/libqof/qof => libgnucash/engine}/test/test-qofobject.c (100%)
 rename {src/libqof/qof => libgnucash/engine}/test/test-qofsession-old.cpp (100%)
 create mode 100644 libgnucash/engine/test/test-qofsession.cpp
 rename {src => libgnucash}/engine/test/test-query.cpp (100%)
 rename {src => libgnucash}/engine/test/test-querynew.c (100%)
 rename {src => libgnucash}/engine/test/test-recurrence.c (100%)
 rename {src => libgnucash}/engine/test/test-scm-query-import.in (100%)
 rename {src => libgnucash}/engine/test/test-scm-query-import.scm (100%)
 rename {src => libgnucash}/engine/test/test-scm-query.cpp (100%)
 rename {src => libgnucash}/engine/test/test-split-vs-account.cpp (100%)
 rename {src => libgnucash}/engine/test/test-split.scm (100%)
 rename {src => libgnucash}/engine/test/test-test-extras.scm (100%)
 rename {src => libgnucash}/engine/test/test-transaction-reversal.cpp (100%)
 rename {src => libgnucash}/engine/test/test-transaction-voiding.cpp (100%)
 rename {src => libgnucash}/engine/test/test-vendor.c (100%)
 create mode 100644 libgnucash/engine/test/utest-Account.cpp
 rename {src => libgnucash}/engine/test/utest-Budget.c (100%)
 rename {src => libgnucash}/engine/test/utest-Entry.c (100%)
 rename {src => libgnucash}/engine/test/utest-Invoice.c (100%)
 create mode 100644 libgnucash/engine/test/utest-Split.cpp
 create mode 100644 libgnucash/engine/test/utest-Transaction.cpp
 rename {src => libgnucash}/engine/test/utest-gnc-pricedb.c (100%)
 rename {src => libgnucash}/engine/xlate.pl (100%)
 create mode 100644 libgnucash/gnc-module/CMakeLists.txt
 create mode 100644 libgnucash/gnc-module/Makefile.am
 rename {src => libgnucash}/gnc-module/README (100%)
 rename {src => libgnucash}/gnc-module/doc/design.txt (100%)
 rename {src/plugins => libgnucash/gnc-module}/example/CMakeLists.txt (100%)
 create mode 100644 libgnucash/gnc-module/example/Makefile.am
 rename {src/plugins => libgnucash/gnc-module}/example/glade/CMakeLists.txt (100%)
 rename {src/plugins => libgnucash/gnc-module}/example/glade/Makefile.am (100%)
 rename {src/plugins => libgnucash/gnc-module}/example/gnc-plugin.example.c (100%)
 rename {src/plugins => libgnucash/gnc-module}/example/gnc-plugin.example.h (100%)
 rename {src/plugins => libgnucash/gnc-module}/example/gncmod-example.c (100%)
 rename {src/plugins => libgnucash/gnc-module}/example/ui/CMakeLists.txt (100%)
 rename {src/plugins => libgnucash/gnc-module}/example/ui/Makefile.am (100%)
 rename {src/plugins => libgnucash/gnc-module}/example/ui/gnc-plugin-example-ui.xml (100%)
 rename {src => libgnucash}/gnc-module/gnc-module-api.h (100%)
 create mode 100644 libgnucash/gnc-module/gnc-module.c
 rename {src => libgnucash}/gnc-module/gnc-module.h (100%)
 rename {src => libgnucash}/gnc-module/gnc-module.i (100%)
 rename {src => libgnucash}/gnc-module/gnc-module.scm (100%)
 create mode 100644 libgnucash/gnc-module/test/CMakeLists.txt
 create mode 100644 libgnucash/gnc-module/test/Makefile.am
 rename {src => libgnucash}/gnc-module/test/README (100%)
 create mode 100644 libgnucash/gnc-module/test/misc-mods/CMakeLists.txt
 create mode 100644 libgnucash/gnc-module/test/misc-mods/Makefile.am
 rename {src => libgnucash}/gnc-module/test/misc-mods/agedver.c (100%)
 rename {src => libgnucash}/gnc-module/test/misc-mods/futuremodsys.c (100%)
 rename {src => libgnucash}/gnc-module/test/misc-mods/incompatdep.c (100%)
 create mode 100644 libgnucash/gnc-module/test/mod-bar/CMakeLists.txt
 create mode 100644 libgnucash/gnc-module/test/mod-bar/Makefile.am
 rename {src => libgnucash}/gnc-module/test/mod-bar/bar.c (100%)
 rename {src => libgnucash}/gnc-module/test/mod-bar/bar.h (100%)
 rename {src => libgnucash}/gnc-module/test/mod-bar/bar.i (100%)
 rename {src => libgnucash}/gnc-module/test/mod-bar/gnc-mod-bar.c (100%)
 rename {src => libgnucash}/gnc-module/test/mod-bar/gnucash/bar.scm (100%)
 create mode 100644 libgnucash/gnc-module/test/mod-baz/CMakeLists.txt
 create mode 100644 libgnucash/gnc-module/test/mod-baz/Makefile.am
 rename {src => libgnucash}/gnc-module/test/mod-baz/baz.c (100%)
 rename {src => libgnucash}/gnc-module/test/mod-baz/baz.h (100%)
 rename {src => libgnucash}/gnc-module/test/mod-baz/baz.i (100%)
 rename {src => libgnucash}/gnc-module/test/mod-baz/gnc-mod-baz.c (100%)
 rename {src => libgnucash}/gnc-module/test/mod-baz/gnucash/baz.scm (100%)
 create mode 100644 libgnucash/gnc-module/test/mod-foo/CMakeLists.txt
 create mode 100644 libgnucash/gnc-module/test/mod-foo/Makefile.am
 rename {src => libgnucash}/gnc-module/test/mod-foo/foo.c (100%)
 rename {src => libgnucash}/gnc-module/test/mod-foo/foo.h (100%)
 rename {src => libgnucash}/gnc-module/test/mod-foo/foo.i (100%)
 rename {src => libgnucash}/gnc-module/test/mod-foo/gnc-mod-foo.c (100%)
 rename {src => libgnucash}/gnc-module/test/mod-foo/gnucash/foo.scm (100%)
 create mode 100644 libgnucash/gnc-module/test/test-agedver.c
 create mode 100644 libgnucash/gnc-module/test/test-dynload.c
 create mode 100755 libgnucash/gnc-module/test/test-gwrapped-c.in
 create mode 100644 libgnucash/gnc-module/test/test-incompatdep.c
 create mode 100644 libgnucash/gnc-module/test/test-load-c.c
 create mode 100755 libgnucash/gnc-module/test/test-load-deps.in
 create mode 100755 libgnucash/gnc-module/test/test-load-scm.in
 create mode 100644 libgnucash/gnc-module/test/test-modsysver.c
 rename {src => libgnucash}/gnc-module/test/test-scm-dynload.in (100%)
 create mode 100755 libgnucash/gnc-module/test/test-scm-init.in
 create mode 100755 libgnucash/gnc-module/test/test-scm-module.in
 create mode 100755 libgnucash/gnc-module/test/test-scm-multi.in
 rename {src => libgnucash}/quotes/CMakeLists.txt (100%)
 rename {src => libgnucash}/quotes/Makefile.am (100%)
 rename {src => libgnucash}/quotes/Quote_example.pl (100%)
 rename {src => libgnucash}/quotes/README (100%)
 rename {src => libgnucash}/quotes/gnc-fq-check.in (100%)
 rename {src => libgnucash}/quotes/gnc-fq-dump (100%)
 rename {src => libgnucash}/quotes/gnc-fq-helper.in (100%)
 rename {src => libgnucash}/quotes/gnc-fq-update.in (100%)
 rename {src => libgnucash}/quotes/gnc-value-portfolio (100%)
 create mode 100644 libgnucash/scm/CMakeLists.txt
 create mode 100644 libgnucash/scm/Makefile.am
 rename {src => libgnucash}/scm/build-config.scm.in (100%)
 rename {src => libgnucash}/scm/config (100%)
 rename {src => libgnucash}/scm/fin.scm (100%)
 rename {src => libgnucash}/scm/gnumeric/CMakeLists.txt (100%)
 rename {src => libgnucash}/scm/gnumeric/Makefile.am (100%)
 rename {src => libgnucash}/scm/gnumeric/gnumeric-utilities.scm (100%)
 rename {src => libgnucash}/scm/gnumeric/table-utils.scm (100%)
 rename {src => libgnucash}/scm/main.scm (100%)
 rename {src => libgnucash}/scm/price-quotes.scm (100%)
 rename {src => libgnucash}/scm/printf.scm (100%)
 rename {src => libgnucash}/scm/string.scm (100%)
 rename {src => libgnucash}/scm/substring-search.scm (100%)
 rename {src => libgnucash}/scm/xml-generator.scm (100%)
 rename {src => libgnucash}/tax/CMakeLists.txt (100%)
 rename {src => libgnucash}/tax/Makefile.am (100%)
 create mode 100644 libgnucash/tax/us/CMakeLists.txt
 create mode 100644 libgnucash/tax/us/Makefile.am
 rename {src => libgnucash}/tax/us/de_DE.scm (100%)
 rename {src => libgnucash}/tax/us/de_DE/taxtxf - LIES MICH.txt (100%)
 rename {src => libgnucash}/tax/us/de_DE/txf-USt-Bericht.html (100%)
 rename {src => libgnucash}/tax/us/de_DE/txf-USt-VA Anleitung 2011.pdf (100%)
 rename {src => libgnucash}/tax/us/gncmod-tax-us.c (100%)
 rename {src => libgnucash}/tax/us/test/CMakeLists.txt (100%)
 create mode 100644 libgnucash/tax/us/test/Makefile.am
 rename {src => libgnucash}/tax/us/test/test-link-module.c (100%)
 rename {src => libgnucash}/tax/us/test/test-load-module.in (100%)
 rename {src => libgnucash}/tax/us/txf-de_DE.scm (100%)
 rename {src => libgnucash}/tax/us/txf-help-de_DE.scm (100%)
 rename {src => libgnucash}/tax/us/txf-help.scm (100%)
 rename {src => libgnucash}/tax/us/txf.scm (100%)
 rename {src => libgnucash}/tax/us/us.scm (100%)
 delete mode 100644 packaging/CMakeLists.txt
 delete mode 100644 packaging/Makefile.am
 delete mode 100644 packaging/README.RPM
 delete mode 100644 packaging/gnucash.spec.in
 delete mode 100644 src/CMakeLists.txt
 delete mode 100644 src/Makefile.am
 delete mode 100644 src/README
 delete mode 100644 src/README.modules
 delete mode 100644 src/app-utils/CMakeLists.txt
 delete mode 100644 src/app-utils/Makefile.am
 delete mode 100644 src/app-utils/app-utils.i
 delete mode 100644 src/app-utils/gnc-addr-quickfill.c
 delete mode 100644 src/app-utils/gnc-addr-quickfill.h
 delete mode 100644 src/app-utils/gnc-entry-quickfill.c
 delete mode 100644 src/app-utils/gnc-entry-quickfill.h
 delete mode 100644 src/app-utils/gnc-euro.c
 delete mode 100644 src/app-utils/gnc-gsettings.c
 delete mode 100644 src/app-utils/gnc-prefs-utils.c
 delete mode 100644 src/app-utils/gnc-ui-util.c
 delete mode 100644 src/app-utils/option-util.c
 delete mode 100644 src/app-utils/option-util.h
 delete mode 100644 src/app-utils/test/CMakeLists.txt
 delete mode 100644 src/app-utils/test/Makefile.am
 delete mode 100644 src/app-utils/test/test-option-util.cpp
 delete mode 100644 src/backend/dbi/.splintrc
 delete mode 100644 src/backend/dbi/CMakeLists.txt
 delete mode 100644 src/backend/dbi/Makefile.am
 delete mode 100644 src/backend/dbi/test/CMakeLists.txt
 delete mode 100644 src/backend/dbi/test/Makefile.am
 delete mode 100644 src/backend/dbi/test/test-backend-dbi-basic.cpp
 delete mode 100644 src/backend/dbi/test/test-backend-dbi.cpp
 delete mode 100644 src/backend/dbi/test/test-dbi-stuff.cpp
 delete mode 100644 src/backend/sql/CMakeLists.txt
 delete mode 100644 src/backend/sql/Makefile.am
 delete mode 100644 src/backend/sql/gnc-slots-sql.cpp
 delete mode 100644 src/backend/sql/test/CMakeLists.txt
 delete mode 100644 src/backend/sql/test/Makefile.am
 delete mode 100644 src/backend/sql/test/test-column-types.cpp
 delete mode 100644 src/backend/xml/CMakeLists.txt
 delete mode 100644 src/backend/xml/Makefile.am
 delete mode 100644 src/backend/xml/io-gncxml-v1.cpp
 delete mode 100644 src/backend/xml/sixtp-dom-generators.cpp
 delete mode 100644 src/backend/xml/sixtp-dom-parsers.cpp
 delete mode 100644 src/backend/xml/test/CMakeLists.txt
 delete mode 100644 src/backend/xml/test/Makefile.am
 delete mode 100644 src/backend/xml/test/test-file-stuff.cpp
 delete mode 100644 src/backend/xml/test/test-kvp-frames.cpp
 delete mode 100644 src/backend/xml/test/test-load-backend.cpp
 delete mode 100644 src/backend/xml/test/test-load-example-account.cpp
 delete mode 100644 src/backend/xml/test/test-load-xml2.cpp
 delete mode 100644 src/bin/CMakeLists.txt
 delete mode 100644 src/bin/Makefile.am
 delete mode 100644 src/bin/gnucash-bin.c
 delete mode 100644 src/bin/gnucash-valgrind.in
 delete mode 100644 src/bin/overrides/gnucash-build-env.in
 delete mode 100644 src/business/CMakeLists.txt
 delete mode 100644 src/business/Makefile.am
 delete mode 100644 src/business/business-gnome/CMakeLists.txt
 delete mode 100644 src/business/business-gnome/Makefile.am
 delete mode 100644 src/business/business-gnome/business-gnome.scm
 delete mode 100644 src/business/business-gnome/dialog-customer.c
 delete mode 100644 src/business/business-gnome/dialog-order.c
 delete mode 100644 src/business/business-gnome/dialog-payment.c
 delete mode 100644 src/business/business-gnome/gnc-plugin-business.c
 delete mode 100644 src/business/business-gnome/gncmod-business-gnome.c
 delete mode 100644 src/business/business-gnome/gschemas/CMakeLists.txt
 delete mode 100644 src/business/business-gnome/gschemas/Makefile.am
 delete mode 100644 src/business/business-gnome/gtkbuilder/CMakeLists.txt
 delete mode 100644 src/business/business-gnome/gtkbuilder/Makefile.am
 delete mode 100644 src/business/business-gnome/ui/CMakeLists.txt
 delete mode 100644 src/business/business-gnome/ui/Makefile.am
 delete mode 100644 src/business/business-ledger/CMakeLists.txt
 delete mode 100644 src/business/business-ledger/Makefile.am
 delete mode 100644 src/business/business-ledger/gncEntryLedger.c
 delete mode 100644 src/business/business-ledger/gncEntryLedgerControl.c
 delete mode 100644 src/business/business-ledger/gncEntryLedgerLayout.c
 delete mode 100644 src/business/business-ledger/gncEntryLedgerLoad.c
 delete mode 100644 src/cmake_modules/GncAddSchemeTargets.cmake
 delete mode 100644 src/cmake_modules/GncAddSwigCommand.cmake
 delete mode 100644 src/cmake_modules/GncAddTest.cmake
 delete mode 100644 src/cmake_modules/MakeDist.cmake
 delete mode 100644 src/cmake_modules/MakeDistFiles.cmake
 delete mode 100644 src/core-utils/CMakeLists.txt
 delete mode 100644 src/core-utils/Makefile.am
 delete mode 100644 src/core-utils/gnc-features.c
 delete mode 100644 src/core-utils/gnc-features.h
 delete mode 100644 src/core-utils/gnc-filepath-utils.c
 delete mode 100644 src/core-utils/gnc-gdate-utils.c
 delete mode 100644 src/core-utils/gnc-gdate-utils.h
 delete mode 100644 src/core-utils/gnc-gkeyfile-utils.c
 delete mode 100644 src/core-utils/gnc-guile-utils.c
 delete mode 100644 src/core-utils/gnc-path.c
 delete mode 100644 src/core-utils/gnc-prefs.c
 delete mode 100644 src/core-utils/test/CMakeLists.txt
 delete mode 100644 src/core-utils/test/Makefile.am
 delete mode 100644 src/core-utils/test/test-gnc-uri-utils.c
 delete mode 100644 src/core-utils/test/test-resolve-file-path.c
 delete mode 100644 src/doc/doxygen.cfg.in
 delete mode 100644 src/engine/CMakeLists.txt
 delete mode 100644 src/engine/Makefile.am
 delete mode 100644 src/engine/Recurrence.c
 delete mode 100644 src/engine/Transaction.c
 delete mode 100644 src/engine/business-core.i
 delete mode 100644 src/engine/gnc-budget.c
 delete mode 100644 src/engine/gnc-engine.c
 delete mode 100644 src/engine/gnc-engine.h
 delete mode 100644 src/engine/gncBusiness.c
 delete mode 100644 src/engine/kvp-scm.cpp
 delete mode 100644 src/engine/test-core/CMakeLists.txt
 delete mode 100644 src/engine/test-core/Makefile.am
 delete mode 100644 src/engine/test-core/test-engine-stuff.cpp
 delete mode 100644 src/engine/test/CMakeLists.txt
 delete mode 100644 src/engine/test/Makefile.am
 delete mode 100644 src/engine/test/gtest-import-map.cpp
 delete mode 100644 src/engine/test/utest-Account.cpp
 delete mode 100644 src/engine/test/utest-Split.cpp
 delete mode 100644 src/engine/test/utest-Transaction.cpp
 delete mode 100644 src/gnc-module/CMakeLists.txt
 delete mode 100644 src/gnc-module/Makefile.am
 delete mode 100644 src/gnc-module/gnc-module.c
 delete mode 100644 src/gnc-module/test/CMakeLists.txt
 delete mode 100644 src/gnc-module/test/Makefile.am
 delete mode 100644 src/gnc-module/test/misc-mods/CMakeLists.txt
 delete mode 100644 src/gnc-module/test/misc-mods/Makefile.am
 delete mode 100644 src/gnc-module/test/mod-bar/CMakeLists.txt
 delete mode 100644 src/gnc-module/test/mod-bar/Makefile.am
 delete mode 100644 src/gnc-module/test/mod-baz/CMakeLists.txt
 delete mode 100644 src/gnc-module/test/mod-baz/Makefile.am
 delete mode 100644 src/gnc-module/test/mod-foo/CMakeLists.txt
 delete mode 100644 src/gnc-module/test/mod-foo/Makefile.am
 delete mode 100644 src/gnc-module/test/test-agedver.c
 delete mode 100644 src/gnc-module/test/test-dynload.c
 delete mode 100755 src/gnc-module/test/test-gwrapped-c.in
 delete mode 100644 src/gnc-module/test/test-incompatdep.c
 delete mode 100644 src/gnc-module/test/test-load-c.c
 delete mode 100755 src/gnc-module/test/test-load-deps.in
 delete mode 100755 src/gnc-module/test/test-load-scm.in
 delete mode 100644 src/gnc-module/test/test-modsysver.c
 delete mode 100755 src/gnc-module/test/test-scm-init.in
 delete mode 100755 src/gnc-module/test/test-scm-module.in
 delete mode 100755 src/gnc-module/test/test-scm-multi.in
 delete mode 100644 src/gnc/.gitignore
 delete mode 100644 src/gnc/AccountItemModel.cpp
 delete mode 100644 src/gnc/AccountItemModel.hpp
 delete mode 100644 src/gnc/AccountSelectionDelegate.cpp
 delete mode 100644 src/gnc/AccountSelectionDelegate.hpp
 delete mode 100644 src/gnc/CMakeLists.txt
 delete mode 100644 src/gnc/Cmd.cpp
 delete mode 100644 src/gnc/Cmd.hpp
 delete mode 100644 src/gnc/Doxyfile
 delete mode 100644 src/gnc/QofEventWrapper.cpp
 delete mode 100644 src/gnc/QofEventWrapper.hpp
 delete mode 100644 src/gnc/RecentFileMenu.cpp
 delete mode 100644 src/gnc/RecentFileMenu.hpp
 delete mode 100644 src/gnc/Session.cpp
 delete mode 100644 src/gnc/Session.hpp
 delete mode 100644 src/gnc/SplitListModel.cpp
 delete mode 100644 src/gnc/SplitListModel.hpp
 delete mode 100644 src/gnc/SplitListView.cpp
 delete mode 100644 src/gnc/SplitListView.hpp
 delete mode 100644 src/gnc/WeakPointer.hpp
 delete mode 100644 src/gnc/bla.html
 delete mode 100644 src/gnc/conv.hpp
 delete mode 100644 src/gnc/dashboard.cpp
 delete mode 100644 src/gnc/dashboard.hpp
 delete mode 100644 src/gnc/dashboard.ui
 delete mode 100644 src/gnc/fallback-icons.qrc
 delete mode 100644 src/gnc/fpo/FPO.cpp
 delete mode 100644 src/gnc/fpo/FPO.hpp
 delete mode 100644 src/gnc/fpo/ViewletModel.cpp
 delete mode 100644 src/gnc/fpo/ViewletModel.hpp
 delete mode 100644 src/gnc/fpo/ViewletView.cpp
 delete mode 100644 src/gnc/fpo/ViewletView.hpp
 delete mode 100644 src/gnc/gnucash.qrc
 delete mode 100644 src/gnc/gtk-icons.qrc
 delete mode 100644 src/gnc/gtk-icons/gtk-about.png
 delete mode 100644 src/gnc/gtk-icons/gtk-close.png
 delete mode 100644 src/gnc/gtk-icons/gtk-copy.png
 delete mode 100644 src/gnc/gtk-icons/gtk-cut.png
 delete mode 100644 src/gnc/gtk-icons/gtk-new.png
 delete mode 100644 src/gnc/gtk-icons/gtk-open.png
 delete mode 100644 src/gnc/gtk-icons/gtk-paste.png
 delete mode 100644 src/gnc/gtk-icons/gtk-quit.png
 delete mode 100644 src/gnc/gtk-icons/gtk-redo.png
 delete mode 100644 src/gnc/gtk-icons/gtk-save-as.png
 delete mode 100644 src/gnc/gtk-icons/gtk-save.png
 delete mode 100644 src/gnc/gtk-icons/gtk-undo.png
 delete mode 100644 src/gnc/icons/oxygen/48x48/actions/document-new.png
 delete mode 100644 src/gnc/icons/oxygen/48x48/actions/document-open.png
 delete mode 100644 src/gnc/icons/oxygen/48x48/actions/document-save-as.png
 delete mode 100644 src/gnc/icons/oxygen/48x48/actions/document-save.png
 delete mode 100644 src/gnc/icons/oxygen/48x48/actions/edit-copy.png
 delete mode 100644 src/gnc/icons/oxygen/48x48/actions/edit-cut.png
 delete mode 100644 src/gnc/icons/oxygen/48x48/actions/edit-paste.png
 delete mode 100644 src/gnc/icons/oxygen/48x48/actions/edit-redo.png
 delete mode 100644 src/gnc/icons/oxygen/48x48/actions/edit-undo.png
 delete mode 100644 src/gnc/icons/oxygen/48x48/actions/help-about.png
 delete mode 100644 src/gnc/icons/oxygen/48x48/actions/list-add.png
 delete mode 100644 src/gnc/icons/oxygen/48x48/actions/tab-close-other.png
 delete mode 100644 src/gnc/icons/oxygen/48x48/actions/window-close.png
 delete mode 100644 src/gnc/icons/oxygen/index.theme
 delete mode 100644 src/gnc/main.cpp
 delete mode 100644 src/gnc/mainwindow-file.cpp
 delete mode 100644 src/gnc/mainwindow.cpp
 delete mode 100644 src/gnc/mainwindow.hpp
 delete mode 100644 src/gnc/mainwindow.ui
 delete mode 100644 src/gnc/metatype.hpp
 delete mode 100644 src/gnc/qss/default.qss
 delete mode 100644 src/gnc/stylesheets.qrc
 delete mode 100644 src/gnome-search/CMakeLists.txt
 delete mode 100644 src/gnome-search/Makefile.am
 delete mode 100644 src/gnome-utils/CMakeLists.txt
 delete mode 100644 src/gnome-utils/Makefile.am
 delete mode 100644 src/gnome-utils/dialog-book-close.c
 delete mode 100644 src/gnome-utils/dialog-options.c
 delete mode 100644 src/gnome-utils/dialog-options.h
 delete mode 100644 src/gnome-utils/dialog-reset-warnings.c
 delete mode 100644 src/gnome-utils/dialog-transfer.c
 delete mode 100644 src/gnome-utils/gnc-main-window.c
 delete mode 100644 src/gnome-utils/gnc-splash.c
 delete mode 100644 src/gnome-utils/gnc-tree-control-split-reg.c
 delete mode 100644 src/gnome-utils/gnc-tree-view-split-reg.c
 delete mode 100644 src/gnome-utils/test/CMakeLists.txt
 delete mode 100644 src/gnome-utils/test/Makefile.am
 delete mode 100644 src/gnome/CMakeLists.txt
 delete mode 100644 src/gnome/Makefile.am
 delete mode 100644 src/gnome/dialog-commodities.c
 delete mode 100644 src/gnome/dialog-new-user.c
 delete mode 100644 src/gnome/dialog-price-edit-db.c
 delete mode 100644 src/gnome/gnc-plugin-page-register.c
 delete mode 100644 src/gnome/gnc-plugin-page-register2.c
 delete mode 100644 src/gnome/gnc-split-reg.c
 delete mode 100644 src/gnome/gnc-split-reg2.c
 delete mode 100644 src/gnome/gschemas/CMakeLists.txt
 delete mode 100644 src/gnome/gschemas/Makefile.am
 delete mode 100644 src/gnome/gtkbuilder/CMakeLists.txt
 delete mode 100644 src/gnome/gtkbuilder/Makefile.am
 delete mode 100644 src/gnome/top-level.c
 delete mode 100644 src/gnome/ui/CMakeLists.txt
 delete mode 100644 src/gnome/ui/Makefile.am
 delete mode 100644 src/html/CMakeLists.txt
 delete mode 100644 src/html/Makefile.am
 delete mode 100644 src/import-export/CMakeLists.txt
 delete mode 100644 src/import-export/Makefile.am
 delete mode 100644 src/import-export/aqb/CMakeLists.txt
 delete mode 100644 src/import-export/aqb/Makefile.am
 delete mode 100644 src/import-export/aqb/test/CMakeLists.txt
 delete mode 100644 src/import-export/aqb/test/Makefile.am
 delete mode 100644 src/import-export/aqb/test/test-aqb.c
 delete mode 100644 src/import-export/aqb/test/test-kvp.c
 delete mode 100644 src/import-export/csv-exp/Makefile.am
 delete mode 100644 src/import-export/csv-imp/Makefile.am
 delete mode 100644 src/import-export/csv-imp/test/CMakeLists.txt
 delete mode 100644 src/import-export/csv-imp/test/Makefile.am
 delete mode 100644 src/import-export/import-main-matcher.c
 delete mode 100644 src/import-export/log-replay/CMakeLists.txt
 delete mode 100644 src/import-export/log-replay/Makefile.am
 delete mode 100644 src/import-export/ofx/CMakeLists.txt
 delete mode 100644 src/import-export/ofx/Makefile.am
 delete mode 100644 src/import-export/ofx/gnc-ofx-import.c
 delete mode 100644 src/import-export/ofx/gnc-ofx-kvp.h
 delete mode 100644 src/import-export/ofx/test/Makefile.am
 delete mode 100644 src/import-export/qif-imp/CMakeLists.txt
 delete mode 100644 src/import-export/qif-imp/Makefile.am
 delete mode 100644 src/import-export/qif-imp/test/Makefile.am
 delete mode 100644 src/import-export/qif/CMakeLists.txt
 delete mode 100644 src/import-export/qif/Makefile.am
 delete mode 100644 src/import-export/qif/test/CMakeLists.txt
 delete mode 100644 src/import-export/qif/test/Makefile.am
 delete mode 100644 src/import-export/test/CMakeLists.txt
 delete mode 100644 src/import-export/test/Makefile.am
 delete mode 100644 src/libqof/CMakeLists.txt
 delete mode 100644 src/libqof/Makefile.am
 delete mode 100644 src/libqof/qof/CMakeLists.txt
 delete mode 100644 src/libqof/qof/Makefile.am
 delete mode 100644 src/libqof/qof/gnc-aqbanking-templates.cpp
 delete mode 100644 src/libqof/qof/gnc-date.cpp
 delete mode 100644 src/libqof/qof/gnc-date.h
 delete mode 100644 src/libqof/qof/kvp-value.cpp
 delete mode 100644 src/libqof/qof/kvp_frame.cpp
 delete mode 100644 src/libqof/qof/qof-backend.cpp
 delete mode 100644 src/libqof/qof/qofbook.cpp
 delete mode 100644 src/libqof/qof/qofinstance.cpp
 delete mode 100644 src/libqof/qof/test/CMakeLists.txt
 delete mode 100644 src/libqof/qof/test/Makefile.am
 delete mode 100644 src/libqof/qof/test/test-gnc-date.c
 delete mode 100644 src/libqof/qof/test/test-kvp-frame.cpp
 delete mode 100644 src/libqof/qof/test/test-kvp-value.cpp
 delete mode 100644 src/libqof/qof/test/test-qofinstance.cpp
 delete mode 100644 src/libqof/qof/test/test-qofsession.cpp
 delete mode 100644 src/optional/CMakeLists.txt
 delete mode 100644 src/optional/Makefile.am
 delete mode 100644 src/optional/gtkmm/CMakeLists.txt
 delete mode 100644 src/optional/gtkmm/Makefile.am
 delete mode 100644 src/optional/gtkmm/gnc-plugin-gtkmm-ui.xml
 delete mode 100644 src/optional/gtkmm/gnc-plugin-gtkmm.cpp
 delete mode 100644 src/optional/gtkmm/gnc-plugin-gtkmm.hpp
 delete mode 100644 src/optional/gtkmm/gncmm/Account.cpp
 delete mode 100644 src/optional/gtkmm/gncmm/Account.hpp
 delete mode 100644 src/optional/gtkmm/gncmm/Book.cpp
 delete mode 100644 src/optional/gtkmm/gncmm/Book.hpp
 delete mode 100644 src/optional/gtkmm/gncmm/Commodity.cpp
 delete mode 100644 src/optional/gtkmm/gncmm/Commodity.hpp
 delete mode 100644 src/optional/gtkmm/gncmm/GncInstance.cpp
 delete mode 100644 src/optional/gtkmm/gncmm/GncInstance.hpp
 delete mode 100644 src/optional/gtkmm/gncmm/Numeric.cpp
 delete mode 100644 src/optional/gtkmm/gncmm/Numeric.hpp
 delete mode 100644 src/optional/gtkmm/gncmm/Split.cpp
 delete mode 100644 src/optional/gtkmm/gncmm/Split.hpp
 delete mode 100644 src/optional/gtkmm/gncmm/Transaction.cpp
 delete mode 100644 src/optional/gtkmm/gncmm/Transaction.hpp
 delete mode 100644 src/optional/gtkmm/gncmm/private/Account_p.hpp
 delete mode 100644 src/optional/gtkmm/gncmm/private/Book_p.hpp
 delete mode 100644 src/optional/gtkmm/gncmm/private/Commodity_p.hpp
 delete mode 100644 src/optional/gtkmm/gncmm/private/GncInstance_p.hpp
 delete mode 100644 src/optional/gtkmm/gncmm/private/Split_p.hpp
 delete mode 100644 src/optional/gtkmm/gncmm/private/Transaction_p.hpp
 delete mode 100644 src/optional/gtkmm/gncmm/wrap_init.cpp
 delete mode 100644 src/optional/gtkmm/gncmm/wrap_init.hpp
 delete mode 100644 src/optional/gtkmm/gncmod-gtkmm.cpp
 delete mode 100644 src/optional/gtkmm/test/CMakeLists.txt
 delete mode 100644 src/optional/gtkmm/test/Makefile.am
 delete mode 100644 src/optional/gtkmm/test/test-book.cpp
 delete mode 100644 src/optional/gtkmm/test/test-gtkmm.cpp
 delete mode 100644 src/optional/python-bindings/CMakeLists.txt
 delete mode 100644 src/optional/python-bindings/Makefile.am
 delete mode 100644 src/optional/python-bindings/gnucash_core.i
 delete mode 100644 src/optional/python-bindings/tests/Makefile.am
 delete mode 100644 src/plugins/CMakeLists.txt
 delete mode 100644 src/plugins/Makefile.am
 delete mode 100644 src/plugins/bi_import/CMakeLists.txt
 delete mode 100644 src/plugins/bi_import/Makefile.am
 delete mode 100644 src/plugins/bi_import/dialog-bi-import.c
 delete mode 100644 src/plugins/bi_import/gnc-plugin-bi-import.h
 delete mode 100644 src/plugins/bi_import/gncmod-bi-import.c
 delete mode 100644 src/plugins/customer_import/CMakeLists.txt
 delete mode 100644 src/plugins/customer_import/Makefile.am
 delete mode 100644 src/plugins/customer_import/dialog-customer-import-gui.c
 delete mode 100644 src/plugins/customer_import/dialog-customer-import.h
 delete mode 100644 src/plugins/customer_import/gnc-plugin-customer_import.c
 delete mode 100644 src/plugins/customer_import/gnc-plugin-customer_import.h
 delete mode 100644 src/plugins/customer_import/libgncmod-customer_import.c
 delete mode 100644 src/plugins/customer_import/ui/CMakeLists.txt
 delete mode 100644 src/plugins/customer_import/ui/Makefile.am
 delete mode 100644 src/plugins/customer_import/ui/gnc-plugin-customer_import-ui.xml
 delete mode 100644 src/plugins/example/Makefile.am
 delete mode 100644 src/python/Makefile.am
 delete mode 100644 src/register/Makefile.am
 delete mode 100644 src/register/ledger-core/CMakeLists.txt
 delete mode 100644 src/register/ledger-core/Makefile.am
 delete mode 100644 src/register/ledger-core/split-register-control.c
 delete mode 100644 src/register/ledger-core/split-register-model-save.c
 delete mode 100644 src/register/ledger-core/split-register-model.c
 delete mode 100644 src/register/ledger-core/split-register.c
 delete mode 100644 src/register/ledger-core/test/Makefile.am
 delete mode 100644 src/register/register-core/CMakeLists.txt
 delete mode 100644 src/register/register-core/Makefile.am
 delete mode 100644 src/register/register-core/test/Makefile.am
 delete mode 100644 src/register/register-gnome/CMakeLists.txt
 delete mode 100644 src/register/register-gnome/Makefile.am
 delete mode 100644 src/register/register-gnome/test/Makefile.am
 delete mode 100644 src/report/business-reports/CMakeLists.txt
 delete mode 100644 src/report/business-reports/Makefile.am
 delete mode 100644 src/report/business-reports/business-reports.scm
 delete mode 100644 src/report/locale-specific/us/CMakeLists.txt
 delete mode 100644 src/report/locale-specific/us/Makefile.am
 delete mode 100644 src/report/locale-specific/us/test/Makefile.am
 delete mode 100644 src/report/report-gnome/CMakeLists.txt
 delete mode 100644 src/report/report-gnome/Makefile.am
 delete mode 100644 src/report/report-gnome/dialog-report-column-view.c
 delete mode 100644 src/report/report-gnome/dialog-report-style-sheet.c
 delete mode 100644 src/report/report-gnome/gnc-plugin-page-report.c
 delete mode 100644 src/report/report-gnome/gncmod-report-gnome.c
 delete mode 100644 src/report/report-gnome/report-gnome.scm
 delete mode 100644 src/report/report-gnome/test/CMakeLists.txt
 delete mode 100644 src/report/report-gnome/test/Makefile.am
 delete mode 100644 src/report/report-gnome/window-report.c
 delete mode 100644 src/report/report-gnome/window-report.h
 delete mode 100644 src/report/report-system/CMakeLists.txt
 delete mode 100644 src/report/report-system/Makefile.am
 delete mode 100644 src/report/report-system/test/CMakeLists.txt
 delete mode 100644 src/report/report-system/test/Makefile.am
 delete mode 100644 src/report/standard-reports/CMakeLists.txt
 delete mode 100644 src/report/standard-reports/Makefile.am
 delete mode 100644 src/report/standard-reports/advanced-portfolio.scm
 delete mode 100644 src/report/standard-reports/budget-barchart.scm
 delete mode 100644 src/report/standard-reports/gncmod-standard-reports.c
 delete mode 100644 src/report/standard-reports/net-barchart.scm
 delete mode 100644 src/report/standard-reports/net-linechart.scm
 delete mode 100644 src/report/standard-reports/portfolio.scm
 delete mode 100644 src/report/standard-reports/test/CMakeLists.txt
 delete mode 100644 src/report/standard-reports/test/Makefile.am
 delete mode 100755 src/report/standard-reports/test/test-load-module.in
 delete mode 100644 src/report/stylesheets/CMakeLists.txt
 delete mode 100644 src/report/stylesheets/Makefile.am
 delete mode 100644 src/report/stylesheets/test/Makefile.am
 delete mode 100644 src/report/utility-reports/CMakeLists.txt
 delete mode 100644 src/report/utility-reports/Makefile.am
 delete mode 100644 src/report/utility-reports/gncmod-utility-reports.c
 delete mode 100644 src/report/utility-reports/hello-world.scm
 delete mode 100644 src/report/utility-reports/test/CMakeLists.txt
 delete mode 100644 src/report/utility-reports/test/Makefile.am
 delete mode 100755 src/report/utility-reports/test/test-load-module.in
 delete mode 100644 src/scm/CMakeLists.txt
 delete mode 100644 src/scm/Makefile.am
 delete mode 100644 src/tax/us/CMakeLists.txt
 delete mode 100644 src/tax/us/Makefile.am
 delete mode 100644 src/tax/us/test/Makefile.am
 delete mode 100644 src/test-core/CMakeLists.txt
 delete mode 100644 src/test-core/Makefile.am



More information about the gnucash-changes mailing list